|
From: Larry D. <ldo...@re...> - 2014-07-11 21:24:02
|
Friends -
On Fri, Jul 11, 2014 at 01:38:13PM -0700, Larry Doolittle wrote:
> > >> 3. Create 20 new .h files, each declaring foo_register(void).
> > >> #include all 20 of these files in sys_table.c. Creates quite a
> > >> bit of fluff for not much benefit.
> I didn't like it either, which is why I suggested #4.
If making all those 27 files is the maintainers' choice, as ugly
as it is, at least we can script their creation:
#!/bin/bash
for n in sys_clog2 sys_convert sys_countdrivers sys_darray sys_deposit sys_display sys_fileio sys_finish sys_fst sys_lxt sys_lxt2 sys_plusargs sys_queue sys_random sys_random_mti sys_readmem sys_scanf sys_sdf sys_special sys_time sys_vcd sys_vcdoff table_model v2009_array v2009_enum v2009_string vams_simparam; do
echo "#include \"${n}_register.h\""
(echo "#ifndef ${n^^}_REGISTER_H"
echo "#define ${n^^}_REGISTER_H"
echo "extern void ${n}_register(void);"
echo "#endif") > ${n}_register.h
done
where the output is ready (more-or-less) to paste into sys_table.c.
BTW, the use of the "extern" keyword here is optional.
Just because I suggested this as an option, doesn't mean I like it.
- Larry
|