Xref: utzoo comp.unix.programmer:1634 comp.lang.perl:5017 comp.std.internat:873 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!spdcc!tauxersvilli!alphalpha!nazgul From: nazgul@alphalpha.com (Kee Hinckley) Newsgroups: comp.unix.programmer,comp.lang.perl,comp.std.internat Subject: Re: Tools for manipulating message catalogs Message-ID: <1991Apr21.043742.28994@alphalpha.com> Date: 21 Apr 91 04:37:42 GMT References: <1991Apr7.190119.24825@motcad.portal.com> <1991Apr15.170901.18836@dg-rtp.dg.com> <1991Apr17.053943.6263@alphalpha.com> <1991Apr19.130632.17861@dg-rtp.dg.com> Distribution: comp Organization: asi Lines: 59 In article <1991Apr19.130632.17861@dg-rtp.dg.com> eliot@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@alfalfa.com | Send Anything... Anywhere 617/646-7703 (voice/fax) | info@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.