dbw@ariel.UUCP (DAVE B. WOOD) (07/23/86)
The "shortc" program posted a while ago is very nice, if you have a preprocessor that can handle long identifiers. If you don't, then use m4 with a macro file generated by the following modification to shortc: 194,195c194,195 < printf("#define %s %s%s\n", y->inname, < y->prefix, y->inname); --- > printf("define(`%s',`ifelse($#,0,%s%s,%s%s($*))')\n", > y->inname, y->prefix, y->inname, y->prefix, y->inname); At the end of the m4 macro file include the following text: (either put it into the end of dump() in shortc.c, or add it after the rest is generated.) changecom undefine(`define') undefine(`defn') undefine(`pushdef') undefine(`popdef') undefine(`ifdef') undefine(`shift') undefine(`changecom') undefine(`divert') undefine(`undivert') undefine(`divnum') undefine(`dnl') undefine(`incr') undefine(`decr') undefine(`eval') undefine(`len') undefine(`index') undefine(`substr') undefine(`translit') undefine(`include') undefine(`sinclude') undefine(`syscmd') undefine(`sysval') undefine(`maketemp') undefine(`m4exit') undefine(`m4wrap') undefine(`errprint') undefine(`dumpdef') undefine(`traceon') undefine(`traceoff') changequote($$#$$,##$##) undefine($$#$$changequote##$##) undefine($$#$$undefine##$##) /* This is a dummy line for sed to rip off */ (i.e. for file in *.[ch] do ; m4 short.out $file >tmp && mv tmp $file ; done) Thanks to Tony Hansen for this one. Dave Wood