diff options
Diffstat (limited to 'ACE/apps/gperf/tests')
36 files changed, 2873 insertions, 0 deletions
diff --git a/ACE/apps/gperf/tests/Makefile.am b/ACE/apps/gperf/tests/Makefile.am new file mode 100644 index 00000000000..027d848b869 --- /dev/null +++ b/ACE/apps/gperf/tests/Makefile.am @@ -0,0 +1,305 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ./bin/mwc.pl -type automake -noreldefs ACE.mwc + +ACE_BUILDDIR = $(top_builddir) +ACE_ROOT = $(top_srcdir) + +CLEANFILES = +BUILT_SOURCES = +noinst_PROGRAMS = + +## Makefile.adainset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + ada.cpp + +CLEANFILES += \ + ada.cpp + +ada.cpp: $(srcdir)/ada.gperf + ../src/gperf -a -k1,4,$$ $(srcdir)/ada.gperf > ada.cpp + +noinst_PROGRAMS += aout + +aout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +aout_SOURCES = \ + ada.cpp \ + test.cpp + +aout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.cinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + c.cpp + +CLEANFILES += \ + c.cpp + +c.cpp: $(srcdir)/c.gperf + ../src/gperf -a -p -c -l -S1 -o $(srcdir)/c.gperf > c.cpp + +noinst_PROGRAMS += cout + +cout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +cout_SOURCES = \ + c.cpp \ + test.cpp + +cout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.cppinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + cpp.cpp + +CLEANFILES += \ + cpp.cpp + +cpp.cpp: $(srcdir)/cpp.gperf + ../src/gperf -a -D $(srcdir)/cpp.gperf > cpp.cpp + +noinst_PROGRAMS += cppout + +cppout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +cppout_SOURCES = \ + cpp.cpp \ + test.cpp + +cppout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.iinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + idl.cpp + +CLEANFILES += \ + idl.cpp + +idl.cpp: $(srcdir)/idl.gperf + ../src/gperf -m -M -c -C -D -S1 -E -T -a -o -p $(srcdir)/idl.gperf > idl.cpp + +noinst_PROGRAMS += iout + +iout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +iout_SOURCES = \ + idl.cpp \ + test.cpp + +iout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.iinset2.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + iout2_gen/idl.cpp + +CLEANFILES += \ + iout2_gen/idl.cpp + +iout2_gen/idl.cpp: $(srcdir)/idl.gperf + mkdir -p iout2_gen + ../src/gperf -m -M -c -C -D -E -T -a -o -p $(srcdir)/idl.gperf > iout2_gen/idl.cpp + +noinst_PROGRAMS += iout2 + +iout2_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +iout2_SOURCES = \ + iout2_gen/idl.cpp \ + test.cpp + +iout2_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.m3inset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + modula3.cpp + +CLEANFILES += \ + modula3.cpp + +modula3.cpp: $(srcdir)/modula3.gperf + ../src/gperf -a -k1,2,$$ $(srcdir)/modula3.gperf > modula3.cpp + +noinst_PROGRAMS += m3out + +m3out_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +m3out_SOURCES = \ + modula3.cpp \ + test.cpp + +m3out_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.pinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + pascal.cpp + +CLEANFILES += \ + pascal.cpp + +pascal.cpp: $(srcdir)/pascal.gperf + ../src/gperf -a -o -S2 -p $(srcdir)/pascal.gperf > pascal.cpp + +noinst_PROGRAMS += pout + +pout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +pout_SOURCES = \ + pascal.cpp \ + test.cpp + +pout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.preinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + adadefs.cpp + +CLEANFILES += \ + adadefs.cpp + +adadefs.cpp: $(srcdir)/adadefs.gperf + ../src/gperf -a -p -D -k1,$$ -s 2 -o $(srcdir)/adadefs.gperf > adadefs.cpp + +noinst_PROGRAMS += preout + +preout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +preout_SOURCES = \ + adadefs.cpp \ + test.cpp + +preout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.taoinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + tao.cpp + +CLEANFILES += \ + tao.cpp + +tao.cpp: $(srcdir)/tao.gperf + ../src/gperf -c -C -D -E -f 0 -a -o $(srcdir)/tao.gperf > tao.cpp + +noinst_PROGRAMS += taoout + +taoout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +taoout_SOURCES = \ + tao.cpp \ + test.cpp + +taoout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Makefile.tinset.am + +if !BUILD_USES_WCHAR + +BUILT_SOURCES += \ + corba.cpp + +CLEANFILES += \ + corba.cpp + +corba.cpp: $(srcdir)/corba.gperf + ../src/gperf -a -o $(srcdir)/corba.gperf > corba.cpp + +noinst_PROGRAMS += tout + +tout_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) + +tout_SOURCES = \ + corba.cpp \ + test.cpp + +tout_LDADD = \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_USES_WCHAR + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/ACE/apps/gperf/tests/ada-pred.exp b/ACE/apps/gperf/tests/ada-pred.exp new file mode 100644 index 00000000000..33caaa32ea1 --- /dev/null +++ b/ACE/apps/gperf/tests/ada-pred.exp @@ -0,0 +1,54 @@ +in word set boolean +in word set character +in word set constraint_error +in word set false +in word set float +in word set integer +in word set natural +in word set numeric_error +in word set positive +in word set program_error +in word set storage_error +in word set string +in word set tasking_error +in word set true +in word set address +in word set aft +in word set base +in word set callable +in word set constrained +in word set count +in word set delta +in word set digits +in word set emax +in word set epsilon +in word set first +in word set firstbit +in word set fore +in word set image +in word set large +in word set last +in word set lastbit +in word set length +in word set machine_emax +in word set machine_emin +in word set machine_mantissa +in word set machine_overflows +in word set machine_radix +in word set machine_rounds +in word set mantissa +in word set pos +in word set position +in word set pred +in word set range +in word set safe_emax +in word set safe_large +in word set safe_small +in word set size +in word set small +in word set storage_size +in word set succ +in word set terminated +in word set val +in word set value +in word set width diff --git a/ACE/apps/gperf/tests/ada-res.exp b/ACE/apps/gperf/tests/ada-res.exp new file mode 100644 index 00000000000..8134fe861f5 --- /dev/null +++ b/ACE/apps/gperf/tests/ada-res.exp @@ -0,0 +1,63 @@ +in word set else +in word set exit +in word set terminate +in word set type +in word set raise +in word set range +in word set reverse +in word set declare +in word set end +in word set record +in word set exception +in word set not +in word set then +in word set return +in word set separate +in word set select +in word set digits +in word set renames +in word set subtype +in word set elsif +in word set function +in word set for +in word set package +in word set procedure +in word set private +in word set while +in word set when +in word set new +in word set entry +in word set delay +in word set case +in word set constant +in word set at +in word set abort +in word set accept +in word set and +in word set delta +in word set access +in word set abs +in word set pragma +in word set array +in word set use +in word set out +in word set do +in word set others +in word set of +in word set or +in word set all +in word set limited +in word set loop +in word set null +in word set task +in word set in +in word set is +in word set if +in word set rem +in word set mod +in word set begin +in word set body +in word set xor +in word set goto +in word set generic +in word set with diff --git a/ACE/apps/gperf/tests/ada.gperf b/ACE/apps/gperf/tests/ada.gperf new file mode 100644 index 00000000000..332bdc740ad --- /dev/null +++ b/ACE/apps/gperf/tests/ada.gperf @@ -0,0 +1,63 @@ +else +exit +terminate +type +raise +range +reverse +declare +end +record +exception +not +then +return +separate +select +digits +renames +subtype +elsif +function +for +package +procedure +private +while +when +new +entry +delay +case +constant +at +abort +accept +and +delta +access +abs +pragma +array +use +out +do +others +of +or +all +limited +loop +null +task +in +is +if +rem +mod +begin +body +xor +goto +generic +with diff --git a/ACE/apps/gperf/tests/adadefs.gperf b/ACE/apps/gperf/tests/adadefs.gperf new file mode 100644 index 00000000000..875be69abc9 --- /dev/null +++ b/ACE/apps/gperf/tests/adadefs.gperf @@ -0,0 +1,54 @@ +boolean +character +constraint_error +false +float +integer +natural +numeric_error +positive +program_error +storage_error +string +tasking_error +true +address +aft +base +callable +constrained +count +delta +digits +emax +epsilon +first +firstbit +fore +image +large +last +lastbit +length +machine_emax +machine_emin +machine_mantissa +machine_overflows +machine_radix +machine_rounds +mantissa +pos +position +pred +range +safe_emax +safe_large +safe_small +size +small +storage_size +succ +terminated +val +value +width diff --git a/ACE/apps/gperf/tests/c-parse.gperf b/ACE/apps/gperf/tests/c-parse.gperf new file mode 100644 index 00000000000..24aa09b2ecd --- /dev/null +++ b/ACE/apps/gperf/tests/c-parse.gperf @@ -0,0 +1,56 @@ +%{ +/* Command-line: gperf -p -j1 -i 1 -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ +%} +struct resword { const char *name; short token; enum rid rid; }; +%% +__alignof, ALIGNOF, NORID +__alignof__, ALIGNOF, NORID +__asm, ASM, NORID +__asm__, ASM, NORID +__attribute, ATTRIBUTE, NORID +__attribute__, ATTRIBUTE, NORID +__const, TYPE_QUAL, RID_CONST +__const__, TYPE_QUAL, RID_CONST +__inline, SCSPEC, RID_INLINE +__inline__, SCSPEC, RID_INLINE +__signed, TYPESPEC, RID_SIGNED +__signed__, TYPESPEC, RID_SIGNED +__typeof, TYPEOF, NORID +__typeof__, TYPEOF, NORID +__volatile, TYPE_QUAL, RID_VOLATILE +__volatile__, TYPE_QUAL, RID_VOLATILE +asm, ASM, NORID +auto, SCSPEC, RID_AUTO +break, BREAK, NORID +case, CASE, NORID +char, TYPESPEC, RID_CHAR +const, TYPE_QUAL, RID_CONST +continue, CONTINUE, NORID +default, DEFAULT, NORID +do, DO, NORID +double, TYPESPEC, RID_DOUBLE +else, ELSE, NORID +enum, ENUM, NORID +extern, SCSPEC, RID_EXTERN +float, TYPESPEC, RID_FLOAT +for, FOR, NORID +goto, GOTO, NORID +if, IF, NORID +inline, SCSPEC, RID_INLINE +int, TYPESPEC, RID_INT +long, TYPESPEC, RID_LONG +register, SCSPEC, RID_REGISTER +return, RETURN, NORID +short, TYPESPEC, RID_SHORT +signed, TYPESPEC, RID_SIGNED +sizeof, SIZEOF, NORID +static, SCSPEC, RID_STATIC +struct, STRUCT, NORID +switch, SWITCH, NORID +typedef, SCSPEC, RID_TYPEDEF +typeof, TYPEOF, NORID +union, UNION, NORID +unsigned, TYPESPEC, RID_UNSIGNED +void, TYPESPEC, RID_VOID +volatile, TYPE_QUAL, RID_VOLATILE +while, WHILE, NORID diff --git a/ACE/apps/gperf/tests/c.exp b/ACE/apps/gperf/tests/c.exp new file mode 100644 index 00000000000..10c8b7f6116 --- /dev/null +++ b/ACE/apps/gperf/tests/c.exp @@ -0,0 +1,32 @@ +in word set if +in word set do +in word set int +in word set for +in word set case +in word set char +in word set auto +in word set goto +in word set else +in word set long +in word set void +in word set enum +in word set float +in word set short +in word set union +in word set break +in word set while +in word set const +in word set double +in word set static +in word set extern +in word set struct +in word set return +in word set sizeof +in word set switch +in word set signed +in word set typedef +in word set default +in word set unsigned +in word set continue +in word set register +in word set volatile diff --git a/ACE/apps/gperf/tests/c.gperf b/ACE/apps/gperf/tests/c.gperf new file mode 100644 index 00000000000..8672d6c25ed --- /dev/null +++ b/ACE/apps/gperf/tests/c.gperf @@ -0,0 +1,32 @@ +if +do +int +for +case +char +auto +goto +else +long +void +enum +float +short +union +break +while +const +double +static +extern +struct +return +sizeof +switch +signed +typedef +default +unsigned +continue +register +volatile diff --git a/ACE/apps/gperf/tests/corba.exp b/ACE/apps/gperf/tests/corba.exp new file mode 100644 index 00000000000..4dac28e4a79 --- /dev/null +++ b/ACE/apps/gperf/tests/corba.exp @@ -0,0 +1,36 @@ +in word set any +in word set module +in word set raises +in word set readonly +in word set attribute +in word set exception +in word set context +in word set interface +in word set const +in word set typedef +in word set struct +in word set enum +in word set string +in word set wstring +in word set sequence +in word set union +in word set switch +in word set case +in word set default +in word set float +in word set double +in word set long +in word set short +in word set unsigned +in word set char +in word set wchar +in word set boolean +in word set octet +in word set void +in word set native +in word set TRUE +in word set FALSE +in word set inout +in word set in +in word set out +in word set oneway diff --git a/ACE/apps/gperf/tests/corba.gperf b/ACE/apps/gperf/tests/corba.gperf new file mode 100644 index 00000000000..d9e4377492d --- /dev/null +++ b/ACE/apps/gperf/tests/corba.gperf @@ -0,0 +1,36 @@ +any +module +raises +readonly +attribute +exception +context +interface +const +typedef +struct +enum +string +wstring +sequence +union +switch +case +default +float +double +long +short +unsigned +char +wchar +boolean +octet +void +native +TRUE +FALSE +inout +in +out +oneway diff --git a/ACE/apps/gperf/tests/cpp-res.exp b/ACE/apps/gperf/tests/cpp-res.exp new file mode 100644 index 00000000000..124af99193f --- /dev/null +++ b/ACE/apps/gperf/tests/cpp-res.exp @@ -0,0 +1,73 @@ +in word set and +in word set and_eq +in word set asm +in word set auto +in word set bitand +in word set bitor +in word set bool +in word set break +in word set case +in word set catch +in word set char +in word set class +in word set compl +in word set const +in word set const_cast +in word set continue +in word set default +in word set delete +in word set do +in word set double +in word set dynamic_cast +in word set else +in word set enum +in word set explicit +in word set extern +in word set false +in word set float +in word set for +in word set friend +in word set goto +in word set if +in word set inline +in word set int +in word set long +in word set mutable +in word set namespace +in word set new +in word set not +in word set not_eq +in word set operator +in word set or +in word set or_eq +in word set private +in word set protected +in word set public +in word set register +in word set reinterpret_cast +in word set return +in word set short +in word set signed +in word set sizeof +in word set static +in word set static_cast +in word set struct +in word set switch +in word set template +in word set this +in word set throw +in word set true +in word set try +in word set typedef +in word set typeid +in word set typename +in word set union +in word set unsigned +in word set using +in word set virtual +in word set void +in word set volatile +in word set wchar_t +in word set while +in word set xor +in word set xor_eq diff --git a/ACE/apps/gperf/tests/cpp.gperf b/ACE/apps/gperf/tests/cpp.gperf new file mode 100644 index 00000000000..e8c8dc3f251 --- /dev/null +++ b/ACE/apps/gperf/tests/cpp.gperf @@ -0,0 +1,73 @@ +and +and_eq +asm +auto +bitand +bitor +bool +break +case +catch +char +class +compl +const +const_cast +continue +default +delete +do +double +dynamic_cast +else +enum +explicit +extern +false +float +for +friend +goto +if +inline +int +long +mutable +namespace +new +not +not_eq +operator +or +or_eq +private +protected +public +register +reinterpret_cast +return +short +signed +sizeof +static +static_cast +struct +switch +template +this +throw +true +try +typedef +typeid +typename +union +unsigned +using +virtual +void +volatile +wchar_t +while +xor +xor_eq diff --git a/ACE/apps/gperf/tests/gpc.gperf b/ACE/apps/gperf/tests/gpc.gperf new file mode 100644 index 00000000000..6752d028546 --- /dev/null +++ b/ACE/apps/gperf/tests/gpc.gperf @@ -0,0 +1,48 @@ +%{ +/* ISO Pascal 7185 reserved words. + * + * For GNU Pascal compiler (GPC) by jtv@hut.fi + * + * run this through the Doug Schmidt's gperf program + * with command + * gperf -g -o -j1 -t -p -N is_reserved_word + * + */ +%} +struct resword { const char *name; short token; short iclass;}; +%% +And, AND, PASCAL_ISO +Array, ARRAY, PASCAL_ISO +Begin, BEGIN_, PASCAL_ISO +Case, CASE, PASCAL_ISO +Const, CONST, PASCAL_ISO +Div, DIV, PASCAL_ISO +Do, DO, PASCAL_ISO +Downto, DOWNTO, PASCAL_ISO +Else, ELSE, PASCAL_ISO +End, END, PASCAL_ISO +File, FILE_, PASCAL_ISO +For, FOR, PASCAL_ISO +Function, FUNCTION, PASCAL_ISO +Goto, GOTO, PASCAL_ISO +If, IF, PASCAL_ISO +In, IN, PASCAL_ISO +Label, LABEL, PASCAL_ISO +Mod, MOD, PASCAL_ISO +Nil, NIL, PASCAL_ISO +Not, NOT, PASCAL_ISO +Of, OF, PASCAL_ISO +Or, OR, PASCAL_ISO +Packed, PACKED, PASCAL_ISO +Procedure, PROCEDURE, PASCAL_ISO +Program,PROGRAM,PASCAL_ISO +Record, RECORD, PASCAL_ISO +Repeat, REPEAT, PASCAL_ISO +Set, SET, PASCAL_ISO +Then, THEN, PASCAL_ISO +To, TO, PASCAL_ISO +Type, TYPE, PASCAL_ISO +Until, UNTIL, PASCAL_ISO +Var, VAR, PASCAL_ISO +While, WHILE, PASCAL_ISO +With, WITH, PASCAL_ISO diff --git a/ACE/apps/gperf/tests/gperf_test.mpb b/ACE/apps/gperf/tests/gperf_test.mpb new file mode 100644 index 00000000000..1620def9fd0 --- /dev/null +++ b/ACE/apps/gperf/tests/gperf_test.mpb @@ -0,0 +1,23 @@ +// -*- MPC -*- +// $Id$ + +project: aceexe, crosscompile { + after += gperf + avoids += uses_wchar + Define_Custom(GPERF) { + command = $(ACE_ROOT)/bin/gperf + libpath += $(ACE_ROOT)/lib + output_option = > + inputext = .gperf + source_outputext = .cpp + keyword gperf_cmd = command + } + + specific(automake) { + gperf_cmd = ../src/gperf + } + + Source_Files { + test.cpp + } +} diff --git a/ACE/apps/gperf/tests/gplus.gperf b/ACE/apps/gperf/tests/gplus.gperf new file mode 100644 index 00000000000..91815fcc549 --- /dev/null +++ b/ACE/apps/gperf/tests/gplus.gperf @@ -0,0 +1,76 @@ +%{ +/* Command-line: gperf -p -j1 -o -t -N is_reserved_word -k1,4,$ gplus.gperf */ +%} +struct resword { const char *name; short token; enum rid rid;}; +%% +__alignof, ALIGNOF, NORID +__alignof__, ALIGNOF, NORID +__asm, ASM, NORID +__asm__, ASM, NORID +__attribute, ATTRIBUTE, NORID +__attribute__, ATTRIBUTE, NORID +__const, TYPE_QUAL, RID_CONST +__const__, TYPE_QUAL, RID_CONST +__inline, SCSPEC, RID_INLINE +__inline__, SCSPEC, RID_INLINE +__signed, TYPESPEC, RID_SIGNED +__signed__, TYPESPEC, RID_SIGNED +__typeof, TYPEOF, NORID +__typeof__, TYPEOF, NORID +__volatile, TYPE_QUAL, RID_VOLATILE +__volatile__, TYPE_QUAL, RID_VOLATILE +all, ALL, NORID /* Extension */, +except, EXCEPT, NORID /* Extension */, +exception, AGGR, RID_EXCEPTION /* Extension */, +raise, RAISE, NORID /* Extension */, +raises, RAISES, NORID /* Extension */, +reraise, RERAISE, NORID /* Extension */, +try, TRY, NORID /* Extension */, +asm, ASM, NORID, +auto, SCSPEC, RID_AUTO, +break, BREAK, NORID, +case, CASE, NORID, +catch, CATCH, NORID, +char, TYPESPEC, RID_CHAR, +class, AGGR, RID_CLASS, +const, TYPE_QUAL, RID_CONST, +continue, CONTINUE, NORID, +default, DEFAULT, NORID, +delete, DELETE, NORID, +do, DO, NORID, +double, TYPESPEC, RID_DOUBLE, +dynamic, DYNAMIC, NORID, +else, ELSE, NORID, +enum, ENUM, NORID, +extern, SCSPEC, RID_EXTERN, +float, TYPESPEC, RID_FLOAT, +for, FOR, NORID, +friend, SCSPEC, RID_FRIEND, +goto, GOTO, NORID, +if, IF, NORID, +inline, SCSPEC, RID_INLINE, +int, TYPESPEC, RID_INT, +long, TYPESPEC, RID_LONG, +new, NEW, NORID, +operator, OPERATOR, NORID, +overload, OVERLOAD, NORID, +private, PRIVATE, NORID, +protected, PROTECTED, NORID, +public, PUBLIC, NORID, +register, SCSPEC, RID_REGISTER, +return, RETURN, NORID, +short, TYPESPEC, RID_SHORT, +signed, TYPESPEC, RID_SIGNED, +sizeof, SIZEOF, NORID, +static, SCSPEC, RID_STATIC, +struct, AGGR, RID_RECORD, +switch, SWITCH, NORID, +this, THIS, NORID, +typedef, SCSPEC, RID_TYPEDEF, +typeof, TYPEOF, NORID, +union, AGGR, RID_UNION, +unsigned, TYPESPEC, RID_UNSIGNED, +virtual, SCSPEC, RID_VIRTUAL, +void, TYPESPEC, RID_VOID, +volatile, TYPE_QUAL, RID_VOLATILE, +while, WHILE, NORID, diff --git a/ACE/apps/gperf/tests/idl.exp b/ACE/apps/gperf/tests/idl.exp new file mode 100644 index 00000000000..ce29fd044c0 --- /dev/null +++ b/ACE/apps/gperf/tests/idl.exp @@ -0,0 +1,9 @@ +in word set set +in word set _is_a +in word set destroy +in word set get +in word set _get_width +in word set _set_width +in word set _get_height +in word set _set_height +in word set _non_existent diff --git a/ACE/apps/gperf/tests/idl.gperf b/ACE/apps/gperf/tests/idl.gperf new file mode 100644 index 00000000000..cbce5603da8 --- /dev/null +++ b/ACE/apps/gperf/tests/idl.gperf @@ -0,0 +1,9 @@ +set +_is_a +destroy +get +_get_width +_set_width +_get_height +_set_height +_non_existent diff --git a/ACE/apps/gperf/tests/iout2_gen/.empty b/ACE/apps/gperf/tests/iout2_gen/.empty new file mode 100644 index 00000000000..eb0e403e06a --- /dev/null +++ b/ACE/apps/gperf/tests/iout2_gen/.empty @@ -0,0 +1 @@ +This file keeps the directory around even when using cvs update -dP diff --git a/ACE/apps/gperf/tests/irc.gperf b/ACE/apps/gperf/tests/irc.gperf new file mode 100644 index 00000000000..dbe40095849 --- /dev/null +++ b/ACE/apps/gperf/tests/irc.gperf @@ -0,0 +1,63 @@ +%{ +extern int m_text(), m_private(), m_who(), m_whois(), m_user(), m_list(); +extern int m_topic(), m_invite(), m_channel(), m_version(), m_quit(); +extern int m_server(), m_kill(), m_info(), m_links(), m_summon(), m_stats(); +extern int m_users(), m_nick(), m_error(), m_help(), m_whoreply(); +extern int m_squit(), m_restart(), m_away(), m_die(), m_connect(); +extern int m_ping(), m_pong(), m_oper(), m_pass(), m_wall(), m_trace(); +extern int m_time(), m_rehash(), m_names(), m_namreply(), m_admin(); +extern int m_linreply(), m_notice(), m_lusers(), m_voice(), m_grph(); +extern int m_xtra(), m_motd(); +%} +struct Message { + const char *cmd; + int (* func)(); + int count; + int parameters; +}; +%% +NICK, m_nick, 0, 1 +MSG, m_text, 0, 1 +PRIVMSG, m_private, 0, 2 +WHO, m_who, 0, 1 +WHOIS, m_whois, 0, 4 +USER, m_user, 0, 4 +SERVER, m_server, 0, 2 +LIST, m_list, 0, 1 +TOPIC, m_topic, 0, 1 +INVITE, m_invite, 0, 2 +CHANNEL, m_channel, 0, 1 +VERSION, m_version, 0, 1 +QUIT, m_quit, 0, 2 +SQUIT, m_squit, 0, 2 +KILL, m_kill, 0, 2 +INFO, m_info, 0, 1 +LINKS, m_links, 0, 1 +SUMMON, m_summon, 0, 1 +STATS, m_stats, 0, 1 +USERS, m_users, 0, 1 +RESTART, m_restart, 0, 1 +WHOREPLY,m_whoreply, 0, 7 +HELP, m_help, 0, 2 +ERROR, m_error, 0, 1 +AWAY, m_away, 0, 1 +DIE, m_die, 0, 1 +CONNECT, m_connect, 0, 3 +PING, m_ping, 0, 2 +PONG, m_pong, 0, 3 +OPER, m_oper, 0, 3 +PASS, m_pass, 0, 2 +WALL, m_wall, 0, 1 +TIME, m_time, 0, 1 +REHASH, m_rehash, 0, 1 +NAMES, m_names, 0, 1 +NAMREPLY,m_namreply, 0, 3 +ADMIN, m_admin, 0, 1 +TRACE, m_trace, 0, 1 +LINREPLY,m_linreply, 0, 2 +NOTICE, m_notice, 0, 2 +LUSERS, m_lusers, 0, 1 +VOICE, m_voice, 0, 2 +GRPH, m_grph, 0, 2 +XTRA, m_xtra, 0, 2 +MOTD, m_motd, 0, 2 diff --git a/ACE/apps/gperf/tests/makeinfo.gperf b/ACE/apps/gperf/tests/makeinfo.gperf new file mode 100644 index 00000000000..1488b8e38fb --- /dev/null +++ b/ACE/apps/gperf/tests/makeinfo.gperf @@ -0,0 +1,116 @@ +COMMAND; +%% +!, cm_force_sentence_end, false +', insert_self, false +*, cm_asterisk, false +., cm_force_sentence_end, false +:, cm_force_abbreviated_whitespace, false +?, cm_force_sentence_end, false +@, insert_self, false +TeX, cm_TeX, true +`, insert_self, false +appendix, cm_appendix, false +appendixsec, cm_appendixsec, false +appendixsubsec, cm_appendixsubsec, false +asis, cm_asis, true +b, cm_bold, true +br, cm_br, false +bullet, cm_bullet, true +bye, cm_bye, false +c, cm_comment, false +center, cm_center, false +chapter, cm_chapter, false +cindex, cm_cindex, false +cite, cm_cite, true +code, cm_code, true +comment, cm_comment, false +contents, do_nothing, false +copyright, cm_copyright, true +ctrl, cm_ctrl, true +defcodeindex, cm_defindex, false +defindex, cm_defindex, false +dfn, cm_dfn, true +display, cm_display, false +dots, cm_dots, true +emph, cm_emph, true +end, cm_end, false +enumerate, cm_enumerate, false +equiv, cm_equiv, true +error, cm_error, true +example, cm_example, false +exdent, cm_exdent, false +expansion, cm_expansion, true +file, cm_file, true +findex, cm_findex, false +format, cm_format, false +group, cm_group, false +i, cm_italic, true +iappendix, cm_appendix, false +iappendixsec, cm_appendixsec, false +iappendixsubsec, cm_appendixsubsec, false +ichapter, cm_chapter, false +ifinfo, cm_ifinfo, false +iftex, cm_iftex, false +ignore, cm_ignore, false +include, cm_include, false +inforef, cm_inforef, true +input, cm_include, false +isection, cm_section, false +isubsection, cm_subsection, false +isubsubsection, cm_subsubsection, false +item, cm_item, false +itemize, cm_itemize, false +itemx, cm_itemx, false +iunnumbered, cm_unnumbered, false +iunnumberedsec, cm_unnumberedsec, false +iunnumberedsubsec, cm_unnumberedsubsec, false +kbd, cm_kbd, true +key, cm_key, true +kindex, cm_kindex, false +lisp, cm_lisp, false +menu, cm_menu +minus, cm_minus, true +need, cm_need, false +node, cm_node, false +noindent, cm_noindent, false +page, do_nothing, false +pindex, cm_pindex, false +point, cm_point, true +print, cm_print, true +printindex, cm_printindex, false +pxref, cm_pxref, true +quotation, cm_quotation, false +r, cm_roman, true +ref, cm_xref, true +refill, cm_refill, false +result, cm_result, true +samp, cm_samp, true +sc, cm_sc, true +section, cm_section, false +setchapternewpage, cm_setchapternewpage, false +setfilename, cm_setfilename, false +settitle, cm_settitle, false +smallexample, cm_smallexample, false +sp, cm_sp, false +strong, cm_strong, true +subsection, cm_subsection, false +subsubsection, cm_subsubsection, false +summarycontents, do_nothing, false +syncodeindex, cm_synindex, false +synindex, cm_synindex, false +t, cm_title, true +table, cm_table, false +tex, cm_tex, false +tindex, cm_tindex, false +titlepage, cm_titlepage, false +unnumbered, cm_unnumbered, false +unnumberedsec, cm_unnumberedsec, false +unnumberedsubsec, cm_unnumberedsubsec, false +var, cm_var, true +vindex, cm_vindex, false +w, cm_w, true +xref, cm_xref, true +{, insert_self, false +}, insert_self, false +infoinclude, cm_infoinclude, false +footnote, cm_footnote, false diff --git a/ACE/apps/gperf/tests/modula.exp b/ACE/apps/gperf/tests/modula.exp new file mode 100644 index 00000000000..cef7d5acad8 --- /dev/null +++ b/ACE/apps/gperf/tests/modula.exp @@ -0,0 +1,106 @@ +in word set AND +in word set ARRAY +in word set BEGIN +in word set BITS +in word set BY +in word set CASE +in word set CONST +in word set DIV +in word set DO +in word set ELSE +in word set ELSIF +in word set END +in word set EVAL +in word set EXCEPT +in word set EXCEPTION +in word set EXIT +in word set EXPORTS +in word set FINALLY +in word set FOR +in word set FROM +in word set IF +in word set IMPORT +in word set INTERFACE +in word set IN +in word set INLINE +in word set LOCK +in word set METHODS +in word set MOD +in word set MODULE +in word set NOT +in word set OBJECT +in word set OF +in word set OR +in word set PROCEDURE +in word set RAISES +in word set READONLY +in word set RECORD +in word set REF +in word set REPEAT +in word set RETURN +in word set SET +in word set THEN +in word set TO +in word set TRY +in word set TYPE +in word set TYPECASE +in word set UNSAFE +in word set UNTIL +in word set UNTRACED +in word set VALUE +in word set VAR +in word set WHILE +in word set WITH +in word set and +in word set array +in word set begin +in word set bits +in word set by +in word set case +in word set const +in word set div +in word set do +in word set else +in word set elsif +in word set end +in word set eval +in word set except +in word set exception +in word set exit +in word set exports +in word set finally +in word set for +in word set from +in word set if +in word set import +in word set interface +in word set in +in word set inline +in word set lock +in word set methods +in word set mod +in word set module +in word set not +in word set object +in word set of +in word set or +in word set procedure +in word set raises +in word set readonly +in word set record +in word set ref +in word set repeat +in word set return +in word set set +in word set then +in word set to +in word set try +in word set type +in word set typecase +in word set unsafe +in word set until +in word set untraced +in word set value +in word set var +in word set while +in word set with diff --git a/ACE/apps/gperf/tests/modula2.gperf b/ACE/apps/gperf/tests/modula2.gperf new file mode 100644 index 00000000000..5ef9c753835 --- /dev/null +++ b/ACE/apps/gperf/tests/modula2.gperf @@ -0,0 +1,40 @@ +AND +ARRAY +BEGIN +BY +CASE +CONST +DEFINITION +DIV +DO +ELSE +ELSIF +END +EXIT +EXPORT +FOR +FROM +IF +IMPLEMENTATION +IMPORT +IN +LOOP +MOD +MODULE +NOT +OF +OR +POINTER +PROCEDURE +QUALIFIED +RECORD +REPEAT +RETURN +SET +THEN +TO +TYPE +UNTIL +VAR +WHILE +WITH diff --git a/ACE/apps/gperf/tests/modula3.gperf b/ACE/apps/gperf/tests/modula3.gperf new file mode 100644 index 00000000000..d0243460d9b --- /dev/null +++ b/ACE/apps/gperf/tests/modula3.gperf @@ -0,0 +1,106 @@ +AND +ARRAY +BEGIN +BITS +BY +CASE +CONST +DIV +DO +ELSE +ELSIF +END +EVAL +EXCEPT +EXCEPTION +EXIT +EXPORTS +FINALLY +FOR +FROM +IF +IMPORT +INTERFACE +IN +INLINE +LOCK +METHODS +MOD +MODULE +NOT +OBJECT +OF +OR +PROCEDURE +RAISES +READONLY +RECORD +REF +REPEAT +RETURN +SET +THEN +TO +TRY +TYPE +TYPECASE +UNSAFE +UNTIL +UNTRACED +VALUE +VAR +WHILE +WITH +and +array +begin +bits +by +case +const +div +do +else +elsif +end +eval +except +exception +exit +exports +finally +for +from +if +import +interface +in +inline +lock +methods +mod +module +not +object +of +or +procedure +raises +readonly +record +ref +repeat +return +set +then +to +try +type +typecase +unsafe +until +untraced +value +var +while +with diff --git a/ACE/apps/gperf/tests/pascal.exp b/ACE/apps/gperf/tests/pascal.exp new file mode 100644 index 00000000000..765e44c6a0f --- /dev/null +++ b/ACE/apps/gperf/tests/pascal.exp @@ -0,0 +1,36 @@ +in word set with +in word set array +in word set and +in word set function +in word set case +in word set var +in word set const +in word set until +in word set then +in word set set +in word set record +in word set program +in word set procedure +in word set or +in word set packed +in word set not +in word set nil +in word set label +in word set in +in word set repeat +in word set of +in word set goto +in word set forward +in word set for +in word set while +in word set file +in word set else +in word set downto +in word set do +in word set div +in word set to +in word set type +in word set end +in word set mod +in word set begin +in word set if diff --git a/ACE/apps/gperf/tests/pascal.gperf b/ACE/apps/gperf/tests/pascal.gperf new file mode 100644 index 00000000000..fed3fbb30ea --- /dev/null +++ b/ACE/apps/gperf/tests/pascal.gperf @@ -0,0 +1,36 @@ +with +array +and +function +case +var +const +until +then +set +record +program +procedure +or +packed +not +nil +label +in +repeat +of +goto +forward +for +while +file +else +downto +do +div +to +type +end +mod +begin +if diff --git a/ACE/apps/gperf/tests/tao.exp b/ACE/apps/gperf/tests/tao.exp new file mode 100644 index 00000000000..e3d52c74ed0 --- /dev/null +++ b/ACE/apps/gperf/tests/tao.exp @@ -0,0 +1,21 @@ +in word set _is_a +in word set _non_existent +in word set _interface +in word set ackConfBasData +in word set ackConfMosData +in word set ackConfTwmData +in word set ackConfArchData +in word set ackConfVonData +in word set ackConfFftData +in word set ackConfSosData +in word set ackConfSscData +in word set ackConfCsData +in word set ackConfR10Data +in word set ackConfR11Data +in word set ackConfR12Data +in word set ackConfR13Data +in word set ackConfR14Data +in word set ackConfR15Data +in word set shutdown +in word set transferTriggerDb +in word set transferTriggerTdc diff --git a/ACE/apps/gperf/tests/tao.gperf b/ACE/apps/gperf/tests/tao.gperf new file mode 100644 index 00000000000..40058ccba0b --- /dev/null +++ b/ACE/apps/gperf/tests/tao.gperf @@ -0,0 +1,21 @@ +_is_a +_non_existent +_interface +ackConfBasData +ackConfMosData +ackConfTwmData +ackConfArchData +ackConfVonData +ackConfFftData +ackConfSosData +ackConfSscData +ackConfCsData +ackConfR10Data +ackConfR11Data +ackConfR12Data +ackConfR13Data +ackConfR14Data +ackConfR15Data +shutdown +transferTriggerDb +transferTriggerTdc diff --git a/ACE/apps/gperf/tests/test-1.exp b/ACE/apps/gperf/tests/test-1.exp new file mode 100644 index 00000000000..af000be2831 --- /dev/null +++ b/ACE/apps/gperf/tests/test-1.exp @@ -0,0 +1,165 @@ +/* C code produced by gperf version 2.8 (ACE version) */ +/* Command-line: ../src/gperf -p -j1 -o -t -N is_reserved_word -k1,3,$ */ +/* Command-line: gperf -p -j1 -i 1 -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ +#include <string.h> +struct resword { const char *name; short token; enum rid rid; }; + +#define TOTAL_KEYWORDS 51 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 13 +#define MIN_HASH_VALUE 8 +#define MAX_HASH_VALUE 82 +#define HASH_VALUE_RANGE 75 +#define DUPLICATES 0 +#define WORDLIST_SIZE 59 + +static unsigned int +hash (str, len) + char *str; + unsigned int len; +{ + static unsigned char asso_values[] = + { +#if defined (ACE_MVS) + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 0, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 1, + 2, 34, 19, 6, 11, 29, 0, 17, 83, 83, + 83, 83, 83, 83, 83, 83, 0, 23, 28, 26, + 30, 31, 83, 15, 83, 83, 83, 83, 83, 83, + 83, 83, 1, 0, 28, 13, 4, 83, 83, 5, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, +#else + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 0, 83, 1, 2, 34, + 19, 6, 11, 29, 0, 17, 83, 0, 23, 28, + 26, 30, 31, 83, 15, 1, 0, 28, 13, 4, + 83, 83, 5, 83, 83, 83, 83, 83, +#endif /* ACE_MVS */ + }; + unsigned int hval = len; + + switch (hval) + { + default: + case 3: + hval += asso_values[(int) str[2]]; + case 2: + case 1: + hval += asso_values[(int) str[0]]; + } + return hval + asso_values[(int) str[len - 1]]; +} + +struct resword * +is_reserved_word (str, len) + char *str; + unsigned int len; +{ + static struct resword wordlist[] = + { + {"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",}, + {"__asm__", ASM, NORID}, + {"",}, + {"__typeof__", TYPEOF, NORID}, + {"__signed__", TYPESPEC, RID_SIGNED}, + {"__alignof__", ALIGNOF, NORID}, + {"break", BREAK, NORID}, + {"__attribute__", ATTRIBUTE, NORID}, + {"",},{"",}, + {"else", ELSE, NORID}, + {"__attribute", ATTRIBUTE, NORID}, + {"__typeof", TYPEOF, NORID}, + {"int", TYPESPEC, RID_INT}, + {"__alignof", ALIGNOF, NORID}, + {"struct", STRUCT, NORID}, + {"sizeof", SIZEOF, NORID}, + {"switch", SWITCH, NORID}, + {"__volatile__", TYPE_QUAL, RID_VOLATILE}, + {"",}, + {"__inline__", SCSPEC, RID_INLINE}, + {"__signed", TYPESPEC, RID_SIGNED}, + {"__volatile", TYPE_QUAL, RID_VOLATILE}, + {"if", IF, NORID}, + {"__inline", SCSPEC, RID_INLINE}, + {"while", WHILE, NORID}, + {"",}, + {"__asm", ASM, NORID}, + {"auto", SCSPEC, RID_AUTO}, + {"short", TYPESPEC, RID_SHORT}, + {"default", DEFAULT, NORID}, + {"extern", SCSPEC, RID_EXTERN}, + {"",},{"",}, + {"__const", TYPE_QUAL, RID_CONST}, + {"static", SCSPEC, RID_STATIC}, + {"__const__", TYPE_QUAL, RID_CONST}, + {"for", FOR, NORID}, + {"case", CASE, NORID}, + {"float", TYPESPEC, RID_FLOAT}, + {"return", RETURN, NORID}, + {"typeof", TYPEOF, NORID}, + {"typedef", SCSPEC, RID_TYPEDEF}, + {"volatile", TYPE_QUAL, RID_VOLATILE}, + {"do", DO, NORID}, + {"inline", SCSPEC, RID_INLINE}, + {"void", TYPESPEC, RID_VOID}, + {"char", TYPESPEC, RID_CHAR}, + {"signed", TYPESPEC, RID_SIGNED}, + {"unsigned", TYPESPEC, RID_UNSIGNED}, + {"",},{"",}, + {"double", TYPESPEC, RID_DOUBLE}, + {"asm", ASM, NORID}, + {"",},{"",}, + {"goto", GOTO, NORID}, + {"",}, + {"const", TYPE_QUAL, RID_CONST}, + {"enum", ENUM, NORID}, + {"register", SCSPEC, RID_REGISTER}, + {"",},{"",},{"",},{"",},{"",},{"",}, + {"continue", CONTINUE, NORID}, + {"",}, + {"union", UNION, NORID}, + {"",},{"",},{"",},{"",},{"",}, + {"long", TYPESPEC, RID_LONG}, + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + unsigned int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) + { + char *s = wordlist[key].name; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/ACE/apps/gperf/tests/test-2.exp b/ACE/apps/gperf/tests/test-2.exp new file mode 100644 index 00000000000..c911e2791ec --- /dev/null +++ b/ACE/apps/gperf/tests/test-2.exp @@ -0,0 +1,214 @@ +/* C code produced by gperf version 2.8 (ACE version) */ +/* Command-line: ../src/gperf -n -k1-8 -l */ +#include <string.h> + +#define TOTAL_KEYWORDS 40 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 14 +#define MIN_HASH_VALUE 1 +#define MAX_HASH_VALUE 256 +#define HASH_VALUE_RANGE 256 +#define DUPLICATES 0 +#define WORDLIST_SIZE 41 + +static unsigned int +hash (str, len) + char *str; + unsigned int len; +{ + static unsigned short asso_values[] = + { +#if defined (ACE_MVS) + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 25, 30, 35, 21, 0, 30, 15, + 30, 45, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 0, 5, 45, 0, 10, 0, 1, 257, 257, + 257, 257, 257, 257, 257, 257, 20, 25, 15, 30, + 40, 15, 5, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, +#else + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 25, 30, 35, 21, 0, + 30, 15, 30, 45, 257, 257, 0, 5, 45, 0, + 10, 0, 1, 20, 25, 15, 30, 40, 15, 5, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, +#endif /* ACE_MVS */ + }; + unsigned int hval = 0; + + switch (len) + { + default: + case 8: + hval += asso_values[(int) str[7]]; + case 7: + hval += asso_values[(int) str[6]]; + case 6: + hval += asso_values[(int) str[5]]; + case 5: + hval += asso_values[(int) str[4]]; + case 4: + hval += asso_values[(int) str[3]]; + case 3: + hval += asso_values[(int) str[2]]; + case 2: + hval += asso_values[(int) str[1]]; + case 1: + hval += asso_values[(int) str[0]]; + } + return hval; +} + +const char * +in_word_set (str, len) + char *str; + unsigned int len; +{ + + static unsigned char lengthtable[] = + { + 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 2, 3, 0, + 0, 0, 2, 3, 0, 0, 0, 2, 4, 0, 0, 0, 4, 6, + 0, 0, 0, 3, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, + 3, 5, 6, 0, 0, 6, 0, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 0, 9, + 0, 4, 6, 6, 0, 0, 2, 3, 0, 0, 0, 5, 3, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, + 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 7, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, + }; + static const char *wordlist[] = + { + "", + "OR", + "","","","","","","","", + "LOOP", + "","","","","","","","","", + "ELSE", + "DO", + "","","", + "TO", + "MOD", + "","","", + "OF", + "FOR", + "","","", + "BY", + "FROM", + "","","", + "TYPE", + "MODULE", + "","","", + "SET", + "","","","","", + "EXPORT", + "","","","", + "VAR", + "ARRAY", + "RECORD", + "","", + "REPEAT", + "","","","", + "END", + "","","", + "NOT", + "","","","", + "IF", + "","","","", + "CASE", + "","", + "PROCEDURE", + "", + "EXIT", + "IMPORT", + "RETURN", + "","", + "IN", + "AND", + "","","", + "ELSIF", + "DIV", + "","","", + "THEN", + "","","","","","","","","", + "IMPLEMENTATION", + "","","","", + "WHILE", + "","","","","","","","","", + "CONST", + "POINTER", + "","","", + "UNTIL", + "","","","", + "BEGIN", + "","","","", + "WITH", + "","","","","","","","","", + "","","","","","","","","", + "","QUALIFIED", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","","","","","", + "","","","","", + "DEFINITION", + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + unsigned int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) + { + const char *s = wordlist[key]; + + if (len == lengthtable[key] + && *str == *s && !strcmp (str + 1, s + 1)) + return s; + } + } + return 0; +} diff --git a/ACE/apps/gperf/tests/test-3.exp b/ACE/apps/gperf/tests/test-3.exp new file mode 100644 index 00000000000..7ea59af01fe --- /dev/null +++ b/ACE/apps/gperf/tests/test-3.exp @@ -0,0 +1,196 @@ +/* C code produced by gperf version 2.8 (ACE version) */ +/* Command-line: ../src/gperf -p -j 1 -o -a -C -g -t -k1,4,$ */ +/* Command-line: gperf -p -j1 -o -t -N is_reserved_word -k1,4,$ gplus.gperf */ +#include <string.h> +struct resword { const char *name; short token; enum rid rid;}; + +#define TOTAL_KEYWORDS 71 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 13 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 147 +#define HASH_VALUE_RANGE 144 +#define DUPLICATES 0 +#define WORDLIST_SIZE 75 + +inline +static unsigned int +hash (const char *str, unsigned int len) +{ + static const unsigned char asso_values[] = + { +#if defined (ACE_MVS) + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 0, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 19, + 6, 27, 37, 0, 12, 1, 15, 63, 148, 148, + 148, 148, 148, 148, 148, 148, 4, 0, 56, 20, + 15, 42, 148, 31, 148, 148, 148, 148, 148, 148, + 148, 148, 5, 26, 39, 32, 10, 148, 40, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, +#else + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 0, 148, 19, 6, 27, + 37, 0, 12, 1, 15, 63, 148, 4, 0, 56, + 20, 15, 42, 148, 31, 5, 26, 39, 32, 10, + 148, 40, 148, 148, 148, 148, 148, 148, +#endif /* ACE_MVS */ + }; + unsigned int hval = len; + + switch (hval) + { + default: + case 4: + hval += asso_values[(int) str[3]]; + case 3: + case 2: + case 1: + hval += asso_values[(int) str[0]]; + } + return hval + asso_values[(int) str[len - 1]]; +} + +inline +const struct resword * +in_word_set (const char *str, unsigned int len) +{ + static const struct resword wordlist[] = + { + {"",},{"",},{"",},{"",}, + {"else", ELSE, NORID,}, + {"",}, + {"long", TYPESPEC, RID_LONG,}, + {"",},{"",},{"",},{"",}, + {"__alignof__", ALIGNOF, NORID}, + {"__asm__", ASM, NORID}, + {"",},{"",}, + {"while", WHILE, NORID,}, + {"",},{"",},{"",},{"",},{"",}, + {"__alignof", ALIGNOF, NORID}, + {"all", ALL, NORID /* Extension */,}, + {"sizeof", SIZEOF, NORID,}, + {"__const__", TYPE_QUAL, RID_CONST}, + {"__volatile", TYPE_QUAL, RID_VOLATILE}, + {"extern", SCSPEC, RID_EXTERN,}, + {"__volatile__", TYPE_QUAL, RID_VOLATILE}, + {"__inline", SCSPEC, RID_INLINE}, + {"exception", AGGR, RID_EXCEPTION /* Extension */,}, + {"__inline__", SCSPEC, RID_INLINE}, + {"case", CASE, NORID,}, + {"except", EXCEPT, NORID /* Extension */,}, + {"new", NEW, NORID,}, + {"break", BREAK, NORID,}, + {"goto", GOTO, NORID,}, + {"",}, + {"__attribute", ATTRIBUTE, NORID}, + {"",}, + {"__attribute__", ATTRIBUTE, NORID}, + {"this", THIS, NORID,}, + {"raise", RAISE, NORID /* Extension */,}, + {"class", AGGR, RID_CLASS,}, + {"delete", DELETE, NORID,}, + {"typeof", TYPEOF, NORID,}, + {"typedef", SCSPEC, RID_TYPEDEF,}, + {"for", FOR, NORID,}, + {"raises", RAISES, NORID /* Extension */,}, + {"__const", TYPE_QUAL, RID_CONST}, + {"double", TYPESPEC, RID_DOUBLE,}, + {"__typeof__", TYPEOF, NORID}, + {"",}, + {"switch", SWITCH, NORID,}, + {"auto", SCSPEC, RID_AUTO,}, + {"do", DO, NORID,}, + {"friend", SCSPEC, RID_FRIEND,}, + {"",}, + {"reraise", RERAISE, NORID /* Extension */,}, + {"",}, + {"volatile", TYPE_QUAL, RID_VOLATILE,}, + {"__typeof", TYPEOF, NORID}, + {"continue", CONTINUE, NORID,}, + {"float", TYPESPEC, RID_FLOAT,}, + {"const", TYPE_QUAL, RID_CONST,}, + {"static", SCSPEC, RID_STATIC,}, + {"virtual", SCSPEC, RID_VIRTUAL,}, + {"__asm", ASM, NORID}, + {"short", TYPESPEC, RID_SHORT,}, + {"signed", TYPESPEC, RID_SIGNED,}, + {"try", TRY, NORID /* Extension */,}, + {"",},{"",},{"",}, + {"__signed__", TYPESPEC, RID_SIGNED}, + {"catch", CATCH, NORID,}, + {"public", PUBLIC, NORID,}, + {"struct", AGGR, RID_RECORD,}, + {"if", IF, NORID,}, + {"asm", ASM, NORID,}, + {"union", AGGR, RID_UNION,}, + {"",}, + {"private", PRIVATE, NORID,}, + {"",},{"",},{"",}, + {"operator", OPERATOR, NORID,}, + {"",},{"",},{"",}, + {"default", DEFAULT, NORID,}, + {"dynamic", DYNAMIC, NORID,}, + {"overload", OVERLOAD, NORID,}, + {"int", TYPESPEC, RID_INT,}, + {"char", TYPESPEC, RID_CHAR,}, + {"",},{"",}, + {"return", RETURN, NORID,}, + {"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",}, + {"",},{"",}, + {"__signed", TYPESPEC, RID_SIGNED}, + {"",}, + {"void", TYPESPEC, RID_VOID,}, + {"",},{"",},{"",}, + {"protected", PROTECTED, NORID,}, + {"",}, + {"enum", ENUM, NORID,}, + {"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",}, + {"",},{"",},{"",},{"",},{"",},{"",}, + {"inline", SCSPEC, RID_INLINE,}, + {"register", SCSPEC, RID_REGISTER,}, + {"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",},{"",}, + {"",},{"",},{"",},{"",}, + {"unsigned", TYPESPEC, RID_UNSIGNED,}, + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + unsigned int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) + { + const char *s = wordlist[key].name; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/ACE/apps/gperf/tests/test-4.exp b/ACE/apps/gperf/tests/test-4.exp new file mode 100644 index 00000000000..a6077d4fd69 --- /dev/null +++ b/ACE/apps/gperf/tests/test-4.exp @@ -0,0 +1,170 @@ +/* C code produced by gperf version 2.8 (ACE version) */ +/* Command-line: ../src/gperf -D -p -t */ +/* Command-line: gperf -p -j1 -i 1 -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ +#include <string.h> +struct resword { const char *name; short token; enum rid rid; }; + +#define TOTAL_KEYWORDS 51 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 13 +#define MIN_HASH_VALUE 4 +#define MAX_HASH_VALUE 82 +#define HASH_VALUE_RANGE 79 +#define DUPLICATES 3 +#define WORDLIST_SIZE 55 + +static unsigned int +hash (str, len) + char *str; + unsigned int len; +{ + static unsigned char asso_values[] = + { +#if defined (ACE_MVS) + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 0, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 40, + 20, 50, 25, 10, 30, 0, 0, 50, 83, 83, + 83, 83, 83, 83, 83, 83, 0, 15, 0, 35, + 0, 83, 83, 20, 83, 83, 83, 83, 83, 83, + 83, 83, 0, 10, 40, 5, 15, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, +#else + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 0, 83, 40, 20, 50, + 25, 10, 30, 0, 0, 50, 83, 0, 15, 0, + 35, 0, 83, 83, 20, 0, 10, 40, 5, 15, + 83, 83, 83, 83, 83, 83, 83, 83, +#endif /* ACE_MVS */ + }; + return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]]; +} + +struct resword * +in_word_set (str, len) + char *str; + unsigned int len; +{ + static struct resword wordlist[] = + { + {"",},{"",},{"",},{"",}, + {"goto", GOTO, NORID}, + {"__asm", ASM, NORID}, + {"switch", SWITCH, NORID}, + {"__asm__", ASM, NORID}, + {"__const__", TYPE_QUAL, RID_CONST}, + {"__inline__", SCSPEC, RID_INLINE}, + {"__typeof__", TYPEOF, NORID}, + {"__signed__", TYPESPEC, RID_SIGNED}, + {"__alignof__", ALIGNOF, NORID}, + {"__volatile__", TYPE_QUAL, RID_VOLATILE}, + {"__attribute__", ATTRIBUTE, NORID}, + {"enum", ENUM, NORID}, + {"short", TYPESPEC, RID_SHORT}, + {"struct", STRUCT, NORID}, + {"__const", TYPE_QUAL, RID_CONST}, + {"__inline", SCSPEC, RID_INLINE}, + {"long", TYPESPEC, RID_LONG}, + {"__volatile", TYPE_QUAL, RID_VOLATILE}, + {"__attribute", ATTRIBUTE, NORID}, + {"volatile", TYPE_QUAL, RID_VOLATILE}, + {"else", ELSE, NORID}, + {"break", BREAK, NORID}, + {"do", DO, NORID}, + {"while", WHILE, NORID}, + {"signed", TYPESPEC, RID_SIGNED}, + {"__signed", TYPESPEC, RID_SIGNED}, + {"void", TYPESPEC, RID_VOID}, + {"sizeof", SIZEOF, NORID}, + {"__typeof", TYPEOF, NORID}, + {"__alignof", ALIGNOF, NORID}, + {"double", TYPESPEC, RID_DOUBLE}, + {"default", DEFAULT, NORID}, + {"asm", ASM, NORID}, + {"auto", SCSPEC, RID_AUTO}, + {"float", TYPESPEC, RID_FLOAT}, + {"typeof", TYPEOF, NORID}, + {"typedef", SCSPEC, RID_TYPEDEF}, + {"register", SCSPEC, RID_REGISTER}, + {"extern", SCSPEC, RID_EXTERN}, + {"for", FOR, NORID}, + {"static", SCSPEC, RID_STATIC}, + {"return", RETURN, NORID}, + {"int", TYPESPEC, RID_INT}, + {"case", CASE, NORID}, + {"const", TYPE_QUAL, RID_CONST}, + {"inline", SCSPEC, RID_INLINE}, + {"continue", CONTINUE, NORID}, + {"unsigned", TYPESPEC, RID_UNSIGNED}, + {"char", TYPESPEC, RID_CHAR}, + {"union", UNION, NORID}, + {"if", IF, NORID}, + }; + + static signed char lookup[] = + { + -1, -1, -9, -3, 4, 5, 6, 7, -1, 8, -90, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, -1, 23, 24, 25, -1, 26, + -1, -1, 27, 28, -1, 29, 30, -1, 31, -1, 32, 33, -1, 34, + 35, 36, 37, 38, 39, 40, 41, -1, -1, 42, -1, 43, -1, -1, + 44, -1, -1, -1, -1, 45, -1, 46, 47, 48, 49, -1, 50, -1, + -1, -1, -1, 51, 52, -1, -1, -1, -1, -1, 53, -1, 54, + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + unsigned int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) + { + int slot = lookup[key]; + + if (slot >= 0 && slot < WORDLIST_SIZE) + { + char *s = wordlist[slot].name; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[slot]; + } + else if (slot < 0 && slot >= -MAX_HASH_VALUE) + return 0; + else + { + unsigned int offset = key + slot + (slot > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE); + struct resword *base = &wordlist[-lookup[offset]]; + struct resword *ptr = base + -lookup[offset + 1]; + + while (--ptr >= base) + if (*str == *ptr->name && !strcmp (str + 1, ptr->name + 1)) + return ptr; + } + } + } + return 0; +} diff --git a/ACE/apps/gperf/tests/test-5.exp b/ACE/apps/gperf/tests/test-5.exp new file mode 100644 index 00000000000..56143fbd915 --- /dev/null +++ b/ACE/apps/gperf/tests/test-5.exp @@ -0,0 +1,139 @@ +/* C code produced by gperf version 2.8 (ACE version) */ +/* Command-line: ../src/gperf -g -o -j1 -t -p -N is_reserved_word */ +/* ISO Pascal 7185 reserved words. + * + * For GNU Pascal compiler (GPC) by jtv@hut.fi + * + * run this through the Doug Schmidt's gperf program + * with command + * gperf -g -o -j1 -t -p -N is_reserved_word + * + */ +#include <string.h> +struct resword { const char *name; short token; short iclass;}; + +#define TOTAL_KEYWORDS 35 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 9 +#define MIN_HASH_VALUE 2 +#define MAX_HASH_VALUE 43 +#define HASH_VALUE_RANGE 42 +#define DUPLICATES 0 +#define WORDLIST_SIZE 37 + +inline +static unsigned int +hash (str, len) + char *str; + unsigned int len; +{ + static unsigned char asso_values[] = + { +#if defined (ACE_MVS) + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 0, 0, 13, 44, 30, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 0, 25, 1, + 0, 44, 44, 0, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 1, 44, 25, 44, 44, 0, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 18, 29, 14, 6, 7, 10, 20, + 44, 28, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 28, 19, 22, 15, 0, 44, 9, 44, 44, + 44, 44, 44, 44, 44, 44, 23, 0, 23, 26, + 2, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, +#else + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 18, 29, 14, 6, 7, + 10, 20, 44, 28, 44, 44, 28, 19, 22, 15, + 0, 44, 9, 23, 0, 23, 26, 2, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 0, 0, 13, 44, 30, 44, 44, 44, 0, 25, + 1, 0, 44, 44, 0, 44, 1, 44, 25, 44, + 44, 0, 44, 44, 44, 44, 44, 44, +#endif /* ACE_MVS */ + }; + return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]]; +} + +inline +struct resword * +is_reserved_word (str, len) + char *str; + unsigned int len; +{ + static struct resword wordlist[] = + { + {"",},{"",}, + {"To", TO, PASCAL_ISO}, + {"",}, + {"Type", TYPE, PASCAL_ISO}, + {"Then", THEN, PASCAL_ISO}, + {"Packed", PACKED, PASCAL_ISO}, + {"While", WHILE, PASCAL_ISO}, + {"Do", DO, PASCAL_ISO}, + {"Procedure", PROCEDURE, PASCAL_ISO}, + {"End", END, PASCAL_ISO}, + {"Else", ELSE, PASCAL_ISO}, + {"Downto", DOWNTO, PASCAL_ISO}, + {"For", FOR, PASCAL_ISO}, + {"File", FILE_, PASCAL_ISO}, + {"Record", RECORD, PASCAL_ISO}, + {"Repeat", REPEAT, PASCAL_ISO}, + {"Or", OR, PASCAL_ISO}, + {"Case", CASE, PASCAL_ISO}, + {"Function", FUNCTION, PASCAL_ISO}, + {"Const", CONST, PASCAL_ISO}, + {"And", AND, PASCAL_ISO}, + {"Mod", MOD, PASCAL_ISO}, + {"Array", ARRAY, PASCAL_ISO}, + {"Goto", GOTO, PASCAL_ISO}, + {"Nil", NIL, PASCAL_ISO}, + {"Not", NOT, PASCAL_ISO}, + {"Set", SET, PASCAL_ISO}, + {"Until", UNTIL, PASCAL_ISO}, + {"Var", VAR, PASCAL_ISO}, + {"Of", OF, PASCAL_ISO}, + {"In", IN, PASCAL_ISO}, + {"Program", PROGRAM,PASCAL_ISO}, + {"Label", LABEL, PASCAL_ISO}, + {"Div", DIV, PASCAL_ISO}, + {"Begin", BEGIN_, PASCAL_ISO}, + {"With", WITH, PASCAL_ISO}, + {"",},{"",},{"",},{"",},{"",},{"",}, + {"If", IF, PASCAL_ISO}, + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + unsigned int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) + { + char *s = wordlist[key].name; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/ACE/apps/gperf/tests/test-6.exp b/ACE/apps/gperf/tests/test-6.exp new file mode 100644 index 00000000000..2205ab7f481 --- /dev/null +++ b/ACE/apps/gperf/tests/test-6.exp @@ -0,0 +1,90 @@ +-a Generate ANSI standard C output code, i.e., function prototypes. +-b Generate code for Linear Search. +-B Generate code for Binary Search. +-c Generate comparison code using strncmp rather than strcmp. +-C Make the contents of generated lookup tables constant, i.e., readonly. +-d Enables the debugging option (produces verbose output to the standard + error). +-D Handle keywords that hash to duplicate values. This is useful + for certain highly redundant keyword sets. +-e Allow user to provide a string containing delimiters used to separate + keywords from their attributes. Default is ",\n" +-E Define constant values using an enum local to the lookup function + rather than with defines +-f Generate the gen-perf.hash function ``fast.'' This decreases GPERF's + running time at the cost of minimizing generated table-size. + The numeric argument represents the number of times to iterate when + resolving a collision. `0' means ``iterate by the number of keywords.'' +-F Provided expression will be used to assign default values in keyword + table, i.e., the fill value. Default is "". +-g Make generated routines use ``inline'' to remove function overhead. +-G Generate the static table of keywords as a static global variable, + rather than hiding it inside of the lookup function (which is the + default behavior). +-h Prints this message. +-H Allow user to specify name of generated hash function. Default + is `hash'. +-i Provide an initial value for the associate values array. Default is 0. +-I Generate comparison code using case insensitive string comparison, e.g., + strncasecmp or strcasecmp. + Setting this value larger helps inflate the size of the final table. +-j Affects the ``jump value,'' i.e., how far to advance the associated + character value upon collisions. Must be an odd number, default is 5. +-J Skips '#include <string.h>' part in the output. +-k Allows selection of the key positions used in the hash function. + The allowable choices range between 1-126, inclusive. The positions + are separated by commas, ranges may be used, and key positions may + occur in any order. Also, the meta-character '*' causes the generated + hash function to consider ALL key positions, and $ indicates the + ``final character'' of a key, e.g., $,1,2,4,6-10. +-K Allow use to select name of the keyword component in the keyword + structure. +-l Compare key lengths before trying a string comparison. This helps + cut down on the number of string comparisons made during the lookup. +-L Generates code in the language specified by the option's argument. + Languages handled are currently C++ and C. The default is C. +-m Avoids the warning about identical hash values. This is valid + only if the -D option is enabled. +-M Skips class definition in the output. This is valid only in C++ mode. +-n Do not include the length of the keyword when computing the hash + function. +-N Allow user to specify name of generated lookup function. Default + name is `in_word_set.' +-o Reorders input keys by frequency of occurrence of the key sets. + This should decrease the search time dramatically. +-O Optimize the generated lookup function by assuming that all input + keywords are members of the keyset from the keyfile. +-p Changes the return value of the generated function ``in_word_set'' + from its default boolean value (i.e., 0 or 1), to type ``pointer + to wordlist array'' This is most useful when the -t option, allowing + user-defined structs, is used. +-r Utilizes randomness to initialize the associated values table. +-s Affects the size of the generated hash table. The numeric argument + for this option indicates ``how many times larger or smaller'' the + associated value range should be, in relationship to the number of + keys, e.g. a value of 3 means ``allow the maximum associated value + to be about 3 times larger than the number of input keys.'' + Conversely, a value of -3 means ``make the maximum associated + value about 3 times smaller than the number of input keys. A + larger table should decrease the time required for an unsuccessful + search, at the expense of extra table space. Default value is 1. +-S Causes the generated C code to use a switch statement scheme, rather + than an array lookup table. This can lead to a reduction in both + time and space requirements for some keyfiles. The argument to + this option determines how many switch statements are generated. + A value of 1 generates 1 switch containing all the elements, a value + of 2 generates 2 tables with 1/2 the elements in each table, etc. + This is useful since many C compilers cannot correctly generate code + for large switch statements. +-t Allows the user to include a structured type declaration for + generated code. Any text before %% is consider part of the type + declaration. Key words and additional fields may follow this, one + group of fields per line. +-T Prevents the transfer of the type declaration to the output file. + Use this option if the type is already defined elsewhere. +-v Prints out the current version number and exits with a value of 0 +-V Exits silently with a value of 0. +-Z Allow user to specify name of generated C++ class. Default + name is `Perfect_Hash.' +Usage: ../src/gperf [-abBcCdDef[num]gGhH<hashname>i<init>IjJk<keys>K<keyname>lL<language>mMnN<function name>oOprs<size>S<switches>tTvVZ<class name>]. +(type ../src/gperf -h for help) diff --git a/ACE/apps/gperf/tests/test-7.exp b/ACE/apps/gperf/tests/test-7.exp new file mode 100644 index 00000000000..c5c942c10d1 --- /dev/null +++ b/ACE/apps/gperf/tests/test-7.exp @@ -0,0 +1,32 @@ +in word set if +in word set do +NOT in word set int +in word set for +in word set case +NOT in word set char +NOT in word set auto +in word set goto +in word set else +NOT in word set long +NOT in word set void +NOT in word set enum +NOT in word set float +NOT in word set short +NOT in word set union +NOT in word set break +in word set while +NOT in word set const +NOT in word set double +NOT in word set static +NOT in word set extern +NOT in word set struct +in word set return +NOT in word set sizeof +NOT in word set switch +NOT in word set signed +NOT in word set typedef +NOT in word set default +NOT in word set unsigned +NOT in word set continue +NOT in word set register +NOT in word set volatile diff --git a/ACE/apps/gperf/tests/test.cpp b/ACE/apps/gperf/tests/test.cpp new file mode 100644 index 00000000000..0333e3f3b70 --- /dev/null +++ b/ACE/apps/gperf/tests/test.cpp @@ -0,0 +1,35 @@ +// $Id$ + +// Tests the generated perfect hash function. + +// The -v option prints diagnostics as to whether a word is in the set +// or not. Without -v the program is useful for timing. + +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_stdio.h" + +ACE_RCSID(tests, test, "$Id$") + +static const int MAX_LEN = 80; + +// Lookup function. +const char *in_word_set (const char *str, unsigned int len); + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + int verbose = argc > 1 && ACE_OS::strcmp (argv[1], ACE_TEXT("-v")) == 0 ? 1 : 0; + char buf[MAX_LEN]; + + while (ACE_OS::fgets (buf, sizeof buf, stdin) != 0) + { + size_t len = ACE_OS::strlen (buf) - 1; + buf[len] = '\0'; + if (in_word_set (buf, len) && verbose) + ACE_OS::printf ("in word set %s\n", buf); + else if (verbose) + ACE_OS::printf ("NOT in word set %s\n", buf); + } + + return 0; +} diff --git a/ACE/apps/gperf/tests/tests.mpc b/ACE/apps/gperf/tests/tests.mpc new file mode 100644 index 00000000000..f5ea29989fe --- /dev/null +++ b/ACE/apps/gperf/tests/tests.mpc @@ -0,0 +1,244 @@ +// -*- MPC -*- +// $Id$ + +project(cinset): gperf_test { + exename = cout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: cout$(EXEEXT) + " @echo "Testing cout" + " ./cout -v < c.gperf > cout.out + " -diff -b c.exp cout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -p -c -l -S1 -o + c.gperf + } + + Source_Files { + c.cpp + } +} + +project(adainset): gperf_test { + exename = aout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: aout$(EXEEXT) + " @echo "Testing aout" + " ./aout -v < ada.gperf > aout.out + " -diff -b ada-res.exp aout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -k1,4,$$ + ada.gperf + } + + Source_Files { + ada.cpp + } +} + +project(cppinset): gperf_test { + exename = cppout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: cppout$(EXEEXT) + " @echo "Testing cppout" + " ./cppout -v < cpp.gperf > cppout.out + " -diff -b cpp-res.exp cppout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -D + cpp.gperf + } + + Source_Files { + cpp.cpp + } +} + +project(preinset): gperf_test { + exename = preout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: preout$(EXEEXT) + " @echo "Testing preout" + " ./preout -v < adadefs.gperf > preout.out + " -diff -b ada-pred.exp preout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -p -D -k1,$$ -s 2 -o + adadefs.gperf + } + + Source_Files { + adadefs.cpp + } +} + +project(m3inset): gperf_test { + exename = m3out + + verbatim(gnuace, bottom) { + all: runtests + + runtests: m3out$(EXEEXT) + " @echo "Testing m3out" + " ./m3out -v < modula3.gperf > m3out.out + " -diff -b modula.exp m3out.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -k1,2,$$ + modula3.gperf + } + + Source_Files { + modula3.cpp + } +} + +project(pinset): gperf_test { + exename = pout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: pout$(EXEEXT) + " @echo "Testing pout" + " ./pout -v < pascal.gperf > pout.out + " -diff -b pascal.exp pout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -o -S2 -p + pascal.gperf + } + + Source_Files { + pascal.cpp + } +} + +project(iinset): gperf_test { + exename = iout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: iout$(EXEEXT) + " @echo "Testing iout" + " ./iout -v < idl.gperf > iout.out + " -diff -b idl.exp iout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -m -M -c -C -D -S1 -E -T -a -o -p + idl.gperf + } + + Source_Files { + idl.cpp + } +} + +project(iinset2): gperf_test { + exename = iout2 + after += iinset + + verbatim(gnuace, bottom) { + all: runtests + + runtests: iout2$(EXEEXT) + " @echo "Testing iout2" + " ./iout2 -v < idl.gperf > iout2.out + " -diff -b idl.exp iout2.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + gendir = iout2_gen + commandflags += -m -M -c -C -D -E -T -a -o -p + idl.gperf + } + + Source_Files { + iout2_gen/idl.cpp + } +} + +project(tinset): gperf_test { + exename = tout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: tout$(EXEEXT) + " @echo "Testing tout" + " ./tout -v < corba.gperf > tout.out + " -diff -b corba.exp tout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -a -o + corba.gperf + } + + Source_Files { + corba.cpp + } +} + +project(taoinset): gperf_test { + exename = taoout + + verbatim(gnuace, bottom) { + all: runtests + + runtests: taoout$(EXEEXT) + " @echo "Testing taoout" + " ./taoout -v < tao.gperf > taoout.out + " -diff -b tao.exp taoout.out" + + endif # CROSS-COMPILE + } + + GPERF_Files { + commandflags += -c -C -D -E -f 0 -a -o + tao.gperf + } + + Source_Files { + tao.cpp + } +} |