[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Mar 31 09:26:53 2000 
Subject:Re: Language dependent error messages (Was from Jonathan Cunningham about Macintosh implementations) 
From: 
Volume-ID:1000331.05 

The way I do this in C would generalise nicely to Pop.

In a C program I am writing, the messages are all literals of the form

    MM("this is a message with insert <x>")

MM is the identity macro; its purpose is to tag the message text. At some
point a tool will scan the source for all the MM messages and generate
a table mapping them to other messages (or not, as required). I'll
modify the message-reporting code to consult the table and use the
revised entry as the output. (Humans generate revised entries as
required).

This means:

(a) you don't need to faff around inventing constants and updating
header files.

(b) the messages work immediately.

(c) you can map an existing message to a different string in the same
language if you like.

(d) but the messages take up space in the executable all the time, even
if you always use French or Italian or German or Dutch or Finnish or American
spelling.

(e) the lookup is a performance overhead.

For Pop, one has the option of making MM (or however it's spelt) a syntax
word that builds the table on the fly, allocating indicies as it goes,
and arranging that it's both fast and effective.

-- 
Chris "why C, you cry? don't ask." Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html