Synopsis: Fusing gsn definitions and declarations. Obsoleted by autogsn.txt. February 97 From erwin@pip.dknet.dk Thu Mar 20 16:49:09 1997 To: MERC/Envy Mailing List Subject: gsns It got kind of annyoing to update gsns in two places. Here is what I did to make life easier: File: gsn.h. Contains following: #define GSN(gsn) ,gsn Then for each gsn (it should be easy to search-replace with e.g. joe) GSN(gsn_second_attack) In merc.h, use this: extern int useless_filler_variable #include "gsn.h" ; In db.c, replace all the int gsn_xx with this: int useless_filler_variable #include "gsn.h" ; Now you only have to add new gsns to gsn.h, by adding adding a line: GSN(gsn_ninth_attack) to the file. Remember to recompile db.c. ============================================================================== Erwin Andreasen Viby J, Denmark Computer Science Student at Aarhus Business erwin@pip.dknet.dk College ============================================================================== Oliver Jowett later suggested a cleaner way of doing this (unfortunately, I could not find his letter): [gsn.h] #ifdef IN_DB_C #define GSN(gsn) int gsn; #else #define GSN(gsn) extern int gsn; #endif GSN(gsn_first) GSN(gsn_second) ... [db.c] #define IN_DB_C #include "gsn.h" [merc.h] #include "gsn.h"