Tools for manipulating message catalogs
Kee Hinckley
nazgul at alphalpha.com
Sun Apr 21 14:37:42 AEST 1991
In article <1991Apr19.130632.17861 at dg-rtp.dg.com> eliot at dg-rtp.dg.com writes:
>Someone sent me some mail with a suggestion that I thought was good. I was
>waiting to see it posted, but I'll go ahead and do it. The suggestion was
>that the input catalog should look like:
>
>$set 1 BASEMSGS
>1 ERRMSG "Error in application foo:"
>2 WARNMSG "Warning:"
Unless I misunderstand you, this is essentially what I do, except that I
tried to remain compatible with the standard. The spec says that anything
after "$set n" is a comment, and anything after "$ " is a comment, so
I just made comments that begin with "#" special.
$set 1 #Foo
$ #ErrMsg
1 "Error in application foo:"
$ #WarnMsg
2 "Warning"
This generates
#define FooSet 0x1
#define FooErrMsg 0x1
#define FooWarnMsg 0x2
Unless you use the '-or' option, which is useful if you want to simplify
things down to a single set and msgid number.
/* Use these Macros to compose and decompose setId's and msgId's */
#ifndef MCMakeId
# define MCMakeId(s,m) (unsigned long)(((unsigned short)s<<(sizeof(short)*8))\
|(unsigned short)m)
# define MCSetId(id) (unsigned int) (id >> (sizeof(short) * 8))
# define MCMsgId(id) (unsigned int) ((id << (sizeof(short) * 8))\
>> (sizeof(short) * 8))
#endif
#define FooSet 0x1
#define FooErrMsg 0x10001
#define FooWarnMsg 0x10002
>and so on. From this one could generate a .h file, and allow the .c file to
>use the symbolic values (BASEMSGS, ERRMSG, WARNMSG, etc), and yet still avoid
>the danger of accidental renumbering. Of course if you WANT automatic
>renumbering then this approach isn't for you. But with this approach manual
Right. The automatic number I simply do by replacing the initial number
with '#', which is the main thing I believe you disagree with. But it's
optional.
--
Alfalfa Software, Inc. | Poste: The EMail for Unix
nazgul at alfalfa.com | Send Anything... Anywhere
617/646-7703 (voice/fax) | info at alfalfa.com
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
More information about the Comp.unix.programmer
mailing list