aboutsummaryrefslogtreecommitdiff
path: root/gfsm/gfsm/src
diff options
context:
space:
mode:
authorBryan Jurish <mukau@users.sourceforge.net>2008-12-04 14:23:42 +0000
committerBryan Jurish <mukau@users.sourceforge.net>2008-12-04 14:23:42 +0000
commitb2394c4ae6c41d6f7a7dfbf7b2c2c3200c3c4992 (patch)
treebe0e9995576a695fb0eead5f4bc5aa9718f2e9a7 /gfsm/gfsm/src
parent6b81740cda47da83fe3dc8f1dbf53558fcd80d7c (diff)
+ added ./autogen.sh-generated stuff to SVN, for pd-extended auto-builds
- pkg-config autoconf macros e.g. PKG_CHECK_MODULES are missing on darwin + removed extraneous (non-library) gfsm/ subdirectories doc/, src/programs, tests/ + added a lot of UNUSED attributes to lighten the pd-extended autobuild logs a bit svn path=/trunk/externals/moocow/; revision=10421
Diffstat (limited to 'gfsm/gfsm/src')
-rw-r--r--gfsm/gfsm/src/Makefile.am2
-rw-r--r--gfsm/gfsm/src/Makefile.in585
-rw-r--r--gfsm/gfsm/src/libgfsm/.cvsignore24
-rw-r--r--gfsm/gfsm/src/libgfsm/Makefile.in881
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmAlgebra.c4
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmAlphabet.c20
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmAutomaton.hi6
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmAutomatonIO.c6
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmCommon.h12
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmCompound.c4
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmCompound.h2
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmDraw.c6
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmIO.c6
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmIndexed.hi5
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmIndexedIO.c4
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmMem.h2
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmMem.hi4
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmPaths.c10
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmScanner.c5
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmSet.c11
-rw-r--r--gfsm/gfsm/src/libgfsm/gfsmUtils.c9
-rw-r--r--gfsm/gfsm/src/libgfsm/gnulib/.cvsignore5
-rw-r--r--gfsm/gfsm/src/libgfsm/gnulib/Makefile.in55
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/.cvsignore38
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/Makefile116
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/NOTES.lookup26
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/alphachurn.c11
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/arctab-1test.c54
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/arytest.c27
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/arytest2.c63
-rwxr-xr-xgfsm/gfsm/src/libgfsm/tests/asciigen.perl17
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/bvtest.c30
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/calc2test.l56
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/calc2test.y89
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/calctest.l52
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/calctest.y118
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/commatest.c8
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/compre2test.c41
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/comprelex.l297
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/compretest.l199
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/compretest.y185
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/ctest.c18
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/dettest.c21
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/flex2test.l174
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/flex3test.l232
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/flextest.l59
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/ftest.c17
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/gbtest.c27
-rwxr-xr-xgfsm/gfsm/src/libgfsm/tests/gfsm-chop.perl40
-rwxr-xr-xgfsm/gfsm/src/libgfsm/tests/gfsm-out-degrees.perl11
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.c210
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.h121
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/gfsmlabdump.c73
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/gscantest.c51
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/intfloat.c31
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/iotest.c180
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/lab2ary.c62
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/labchurn.c23
-rwxr-xr-xgfsm/gfsm/src/libgfsm/tests/labcount.perl28
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/labprobs.h71
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/lkptest.tfst8
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/macrotest.i11
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/memtest-alphabet.c26
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/memtest-automaton.c20
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/memtest-general.c168
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/memtest.c26
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/module/.cvsignore18
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/module/Makefile39
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/module/mod1a.c5
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/module/mod1b.c5
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/module/mod1test.c52
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/nofinal.tfst1
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/offsettest.c101
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/ortest.c7
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/pathtest.c289
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/pathtest.tfst9
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/priotest.c171
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/prtest.c28
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/prtest.tfst8
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/ptest.c25
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/rudtest.c100
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/rudtest.tfst3
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/rudtest2.tfst5
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/seek2test.c259
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/seek3test.c611
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/seektest.c365
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/seektest.dat9
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/settest.c36
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/sizes.bc70
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/sizetest.c16
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/sltest.c25
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/statetest.tfst8
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/structtest.c14
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/tagh-lo.testus8
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/test-255.lab3
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/test-stateset.c61
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/test.lab10
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/test.txt2
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/test2.lab2
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/test2.txt1
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/testme.lab5
-rw-r--r--gfsm/gfsm/src/programs/.cvsignore79
-rw-r--r--gfsm/gfsm/src/programs/Makefile.am613
-rw-r--r--gfsm/gfsm/src/programs/arith.tfst9
-rw-r--r--gfsm/gfsm/src/programs/c1.tfst5
-rw-r--r--gfsm/gfsm/src/programs/c2.lab11
-rw-r--r--gfsm/gfsm/src/programs/c2.tfst4
-rw-r--r--gfsm/gfsm/src/programs/c2a.tfst10
-rw-r--r--gfsm/gfsm/src/programs/c2b.tfst22
-rw-r--r--gfsm/gfsm/src/programs/c3a.tfst8
-rw-r--r--gfsm/gfsm/src/programs/c3b.tfst26
-rw-r--r--gfsm/gfsm/src/programs/c3filt.tfst20
-rw-r--r--gfsm/gfsm/src/programs/cat1.tfst3
-rw-r--r--gfsm/gfsm/src/programs/cat2.tfst4
-rw-r--r--gfsm/gfsm/src/programs/comp1a.tfst4
-rw-r--r--gfsm/gfsm/src/programs/comp1b.tfst4
-rw-r--r--gfsm/gfsm/src/programs/comp2.tfst6
-rw-r--r--gfsm/gfsm/src/programs/comp2a.tfst2
-rw-r--r--gfsm/gfsm/src/programs/comp2b.tfst3
-rw-r--r--gfsm/gfsm/src/programs/complement-in.tfst4
-rw-r--r--gfsm/gfsm/src/programs/compose-mohri-1.tfst5
-rw-r--r--gfsm/gfsm/src/programs/compose-mohri-2.tfst4
-rw-r--r--gfsm/gfsm/src/programs/config.h13
-rw-r--r--gfsm/gfsm/src/programs/connect-in.tfst7
-rw-r--r--gfsm/gfsm/src/programs/ctest.tfst7
-rw-r--r--gfsm/gfsm/src/programs/ctest2.tfst6
-rw-r--r--gfsm/gfsm/src/programs/det.tfst5
-rw-r--r--gfsm/gfsm/src/programs/determinize-in.tfst7
-rw-r--r--gfsm/gfsm/src/programs/elookup.tfst2
-rw-r--r--gfsm/gfsm/src/programs/gfsmarcsort.gog107
-rw-r--r--gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.c595
-rw-r--r--gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.h77
-rw-r--r--gfsm/gfsm/src/programs/gfsmarcsort_main.c102
-rw-r--r--gfsm/gfsm/src/programs/gfsmarith.gog132
-rw-r--r--gfsm/gfsm/src/programs/gfsmarith_cmdparser.c773
-rw-r--r--gfsm/gfsm/src/programs/gfsmarith_cmdparser.h93
-rw-r--r--gfsm/gfsm/src/programs/gfsmarith_main.c132
-rw-r--r--gfsm/gfsm/src/programs/gfsmclosure.gog79
-rw-r--r--gfsm/gfsm/src/programs/gfsmclosure_cmdparser.c495
-rw-r--r--gfsm/gfsm/src/programs/gfsmclosure_cmdparser.h67
-rw-r--r--gfsm/gfsm/src/programs/gfsmclosure_main.c100
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompile.gog102
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompile_cmdparser.c569
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompile_cmdparser.h73
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompile_main.c132
-rw-r--r--gfsm/gfsm/src/programs/gfsmcomplement.gog73
-rw-r--r--gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.c473
-rw-r--r--gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.h65
-rw-r--r--gfsm/gfsm/src/programs/gfsmcomplement_main.c105
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompose.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompose_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompose_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompose_main.c123
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompre.gog94
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompre_cmdparser.c542
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompre_cmdparser.h71
-rw-r--r--gfsm/gfsm/src/programs/gfsmcompre_main.c143
-rw-r--r--gfsm/gfsm/src/programs/gfsmconcat.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmconcat_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmconcat_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmconcat_main.c118
-rw-r--r--gfsm/gfsm/src/programs/gfsmconnect.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmconnect_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmconnect_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmconnect_main.c99
-rw-r--r--gfsm/gfsm/src/programs/gfsmconvert.gog89
-rw-r--r--gfsm/gfsm/src/programs/gfsmconvert_cmdparser.c517
-rw-r--r--gfsm/gfsm/src/programs/gfsmconvert_cmdparser.h69
-rw-r--r--gfsm/gfsm/src/programs/gfsmconvert_main.c110
-rw-r--r--gfsm/gfsm/src/programs/gfsmdeterminize.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmdeterminize_main.c100
-rw-r--r--gfsm/gfsm/src/programs/gfsmdifference.gog71
-rw-r--r--gfsm/gfsm/src/programs/gfsmdifference_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmdifference_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmdifference_main.c123
-rw-r--r--gfsm/gfsm/src/programs/gfsmdraw.gog138
-rw-r--r--gfsm/gfsm/src/programs/gfsmdraw_cmdparser.c835
-rw-r--r--gfsm/gfsm/src/programs/gfsmdraw_cmdparser.h99
-rw-r--r--gfsm/gfsm/src/programs/gfsmdraw_main.c166
-rw-r--r--gfsm/gfsm/src/programs/gfsmheader.gog57
-rw-r--r--gfsm/gfsm/src/programs/gfsmheader_cmdparser.c403
-rw-r--r--gfsm/gfsm/src/programs/gfsmheader_cmdparser.h60
-rw-r--r--gfsm/gfsm/src/programs/gfsmheader_main.c129
-rw-r--r--gfsm/gfsm/src/programs/gfsmindex.gog75
-rw-r--r--gfsm/gfsm/src/programs/gfsmindex_cmdparser.c473
-rw-r--r--gfsm/gfsm/src/programs/gfsmindex_cmdparser.h65
-rw-r--r--gfsm/gfsm/src/programs/gfsmindex_main.c124
-rw-r--r--gfsm/gfsm/src/programs/gfsminfo.gog57
-rw-r--r--gfsm/gfsm/src/programs/gfsminfo_cmdparser.c403
-rw-r--r--gfsm/gfsm/src/programs/gfsminfo_cmdparser.h60
-rw-r--r--gfsm/gfsm/src/programs/gfsminfo_main.c123
-rw-r--r--gfsm/gfsm/src/programs/gfsmintersect.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmintersect_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmintersect_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmintersect_main.c123
-rw-r--r--gfsm/gfsm/src/programs/gfsminvert.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsminvert_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsminvert_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsminvert_main.c95
-rw-r--r--gfsm/gfsm/src/programs/gfsmlabels.gog78
-rw-r--r--gfsm/gfsm/src/programs/gfsmlabels_cmdparser.c523
-rw-r--r--gfsm/gfsm/src/programs/gfsmlabels_cmdparser.h69
-rw-r--r--gfsm/gfsm/src/programs/gfsmlabels_main.c208
-rw-r--r--gfsm/gfsm/src/programs/gfsmlookup.gog77
-rw-r--r--gfsm/gfsm/src/programs/gfsmlookup_cmdparser.c473
-rw-r--r--gfsm/gfsm/src/programs/gfsmlookup_cmdparser.h65
-rw-r--r--gfsm/gfsm/src/programs/gfsmlookup_main.c125
-rw-r--r--gfsm/gfsm/src/programs/gfsmoptional.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmoptional_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmoptional_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmoptional_main.c101
-rw-r--r--gfsm/gfsm/src/programs/gfsmprint.gog80
-rw-r--r--gfsm/gfsm/src/programs/gfsmprint_cmdparser.c498
-rw-r--r--gfsm/gfsm/src/programs/gfsmprint_cmdparser.h67
-rw-r--r--gfsm/gfsm/src/programs/gfsmprint_main.c125
-rw-r--r--gfsm/gfsm/src/programs/gfsmproduct.gog78
-rw-r--r--gfsm/gfsm/src/programs/gfsmproduct_cmdparser.c450
-rw-r--r--gfsm/gfsm/src/programs/gfsmproduct_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmproduct_main.c123
-rw-r--r--gfsm/gfsm/src/programs/gfsmproject.gog76
-rw-r--r--gfsm/gfsm/src/programs/gfsmproject_cmdparser.c523
-rw-r--r--gfsm/gfsm/src/programs/gfsmproject_cmdparser.h71
-rw-r--r--gfsm/gfsm/src/programs/gfsmproject_main.c100
-rw-r--r--gfsm/gfsm/src/programs/gfsmrenumber.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmrenumber_main.c95
-rw-r--r--gfsm/gfsm/src/programs/gfsmreplace.gog79
-rw-r--r--gfsm/gfsm/src/programs/gfsmreplace_cmdparser.c514
-rw-r--r--gfsm/gfsm/src/programs/gfsmreplace_cmdparser.h69
-rw-r--r--gfsm/gfsm/src/programs/gfsmreplace_main.c108
-rw-r--r--gfsm/gfsm/src/programs/gfsmreverse.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmreverse_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmreverse_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmreverse_main.c101
-rw-r--r--gfsm/gfsm/src/programs/gfsmrmepsilon.gog80
-rw-r--r--gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmrmepsilon_main.c95
-rw-r--r--gfsm/gfsm/src/programs/gfsmsigma.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmsigma_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmsigma_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmsigma_main.c100
-rw-r--r--gfsm/gfsm/src/programs/gfsmstrings.gog76
-rw-r--r--gfsm/gfsm/src/programs/gfsmstrings_cmdparser.c525
-rw-r--r--gfsm/gfsm/src/programs/gfsmstrings_cmdparser.h69
-rw-r--r--gfsm/gfsm/src/programs/gfsmstrings_main.c153
-rw-r--r--gfsm/gfsm/src/programs/gfsmunion.gog70
-rw-r--r--gfsm/gfsm/src/programs/gfsmunion_cmdparser.c449
-rw-r--r--gfsm/gfsm/src/programs/gfsmunion_cmdparser.h63
-rw-r--r--gfsm/gfsm/src/programs/gfsmunion_main.c123
-rwxr-xr-xgfsm/gfsm/src/programs/gfsmview.sh6
-rw-r--r--gfsm/gfsm/src/programs/gfsmviterbi.gog88
-rw-r--r--gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.c473
-rw-r--r--gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.h65
-rw-r--r--gfsm/gfsm/src/programs/gfsmviterbi_main.c125
-rw-r--r--gfsm/gfsm/src/programs/isect1.tfst4
-rw-r--r--gfsm/gfsm/src/programs/isect2.tfst5
-rw-r--r--gfsm/gfsm/src/programs/lkptest.tfst13
-rw-r--r--gfsm/gfsm/src/programs/p1.tfst5
-rw-r--r--gfsm/gfsm/src/programs/p2.tfst3
-rw-r--r--gfsm/gfsm/src/programs/prunetest.tfst6
-rw-r--r--gfsm/gfsm/src/programs/r1.tfst9
-rw-r--r--gfsm/gfsm/src/programs/r2.tfst4
-rw-r--r--gfsm/gfsm/src/programs/renumber.tfst5
-rw-r--r--gfsm/gfsm/src/programs/renumber2.tfst8
-rw-r--r--gfsm/gfsm/src/programs/rev1.tfst7
-rw-r--r--gfsm/gfsm/src/programs/rme.tfst6
-rw-r--r--gfsm/gfsm/src/programs/rme2.tfst8
-rw-r--r--gfsm/gfsm/src/programs/rme2b.tfst8
-rw-r--r--gfsm/gfsm/src/programs/rme3.tfst5
-rw-r--r--gfsm/gfsm/src/programs/sort.tfst7
-rw-r--r--gfsm/gfsm/src/programs/sortme.tfst15
-rw-r--r--gfsm/gfsm/src/programs/symtest.lab15
-rw-r--r--gfsm/gfsm/src/programs/symtest.sym8
-rw-r--r--gfsm/gfsm/src/programs/test+lab.tfst3
-rw-r--r--gfsm/gfsm/src/programs/test-rn.tfst8
-rw-r--r--gfsm/gfsm/src/programs/test.lab15
-rw-r--r--gfsm/gfsm/src/programs/test.tfst3
-rw-r--r--gfsm/gfsm/src/programs/test2.tfst7
-rw-r--r--gfsm/gfsm/src/programs/test3.tfst6
-rw-r--r--gfsm/gfsm/src/programs/test4.tfst9
-rw-r--r--gfsm/gfsm/src/programs/test4b.tfst9
-rw-r--r--gfsm/gfsm/src/programs/test5.tfst3
-rw-r--r--gfsm/gfsm/src/programs/test6.tfst12
-rw-r--r--gfsm/gfsm/src/programs/test7.lab4
-rw-r--r--gfsm/gfsm/src/programs/test7.tfst2
-rw-r--r--gfsm/gfsm/src/programs/test8.tfst4
-rw-r--r--gfsm/gfsm/src/programs/test9.tfst4
-rw-r--r--gfsm/gfsm/src/programs/testa.tfsa6
-rw-r--r--gfsm/gfsm/src/programs/testa.tfst6
-rw-r--r--gfsm/gfsm/src/programs/testrn.tfst3
-rw-r--r--gfsm/gfsm/src/programs/vit-in.lab3
-rw-r--r--gfsm/gfsm/src/programs/vit-out.lab7
-rw-r--r--gfsm/gfsm/src/programs/vit-q.lab3
-rw-r--r--gfsm/gfsm/src/programs/vit.tfst17
-rw-r--r--gfsm/gfsm/src/programs/vit2.tfst15
299 files changed, 1545 insertions, 31253 deletions
diff --git a/gfsm/gfsm/src/Makefile.am b/gfsm/gfsm/src/Makefile.am
index 486aedb..c596a1b 100644
--- a/gfsm/gfsm/src/Makefile.am
+++ b/gfsm/gfsm/src/Makefile.am
@@ -12,7 +12,7 @@
## --- recursion subdirectories
#SUBDIRS = libgfsm programs
-SUBDIRS = libgfsm $(GFSM_SRC_SUBDIRS)
+SUBDIRS = libgfsm
#-----------------------------------------------------------------------
# Variables: cleanup
diff --git a/gfsm/gfsm/src/Makefile.in b/gfsm/gfsm/src/Makefile.in
new file mode 100644
index 0000000..912c0c7
--- /dev/null
+++ b/gfsm/gfsm/src/Makefile.in
@@ -0,0 +1,585 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# File: ./src/Makefile.am
+# Package: *
+# Description:
+# + source-level automake file
+#
+# Process this file with Automake to create Makefile.in.
+#-----------------------------------------------------------------------
+
+#-----------------------------------------------------------------------
+# Options & Subdirectories
+#-----------------------------------------------------------------------
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
+ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/getdelim.m4 \
+ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/intmax_t.m4 \
+ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/longdouble.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/onceonly_2_57.m4 \
+ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
+ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/libgfsm/gfsmConfigAuto.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_OPTIONS = @CONFIG_OPTIONS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTCHECK = @DISTCHECK@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EOVERFLOW = @EOVERFLOW@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FLEX = @FLEX@
+GFSM_SRC_SUBDIRS = @GFSM_SRC_SUBDIRS@
+GFSM_SUBDIRS = @GFSM_SUBDIRS@
+GFSM_VERSION_MAJOR = @GFSM_VERSION_MAJOR@
+GFSM_VERSION_MICRO = @GFSM_VERSION_MICRO@
+GFSM_VERSION_MINOR = @GFSM_VERSION_MINOR@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GREP = @GREP@
+HAVE_BISON_FALSE = @HAVE_BISON_FALSE@
+HAVE_BISON_TRUE = @HAVE_BISON_TRUE@
+HAVE_FLEX_FALSE = @HAVE_FLEX_FALSE@
+HAVE_FLEX_TRUE = @HAVE_FLEX_TRUE@
+HAVE_POD2HTML_FALSE = @HAVE_POD2HTML_FALSE@
+HAVE_POD2HTML_TRUE = @HAVE_POD2HTML_TRUE@
+HAVE_POD2TEXT_FALSE = @HAVE_POD2TEXT_FALSE@
+HAVE_POD2TEXT_TRUE = @HAVE_POD2TEXT_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OPTGEN_PERL = @OPTGEN_PERL@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POD2HTML = @POD2HTML@
+POD2TEXT = @POD2TEXT@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gfsm_CFLAGS = @gfsm_CFLAGS@
+gfsm_LDFLAGS = @gfsm_LDFLAGS@
+gfsm_LIBS = @gfsm_LIBS@
+gfsm_OFLAGS = @gfsm_OFLAGS@
+gfsm_WFLAGS = @gfsm_WFLAGS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+spkgincludedir = @spkgincludedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+
+#SUBDIRS = libgfsm programs
+SUBDIRS = libgfsm
+
+#-----------------------------------------------------------------------
+# Variables: cleanup
+#-----------------------------------------------------------------------
+
+#MOSTLYCLEANFILES =
+
+#CLEANFILES =
+DISTCLEANFILES = \
+ autom4te.cache \
+ config.log \
+ config.status \
+ config.cache
+
+MAINTAINERCLEANFILES = *~ \
+ $(PODS:.pod=.txt) \
+ Makefile Makefile.in \
+ aclocal.m4 \
+ configure
+
+
+#-----------------------------------------------------------------------
+# Variables: distribution
+#-----------------------------------------------------------------------
+
+#EXTRA_DIST =
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+
+#DISTHOOK_DIRS = subdir
+#DISTHOOK_FILES = subdir/file1 subdir/file2
+#
+#dist-hook:
+# for d in $(DISTHOOK_DIRS); do\
+# mkdir -p $(distdir)/$$d ;\
+# done
+# for f in $(DISTHOOK_FILES); do\
+# cp -p $(srcdir)/$$f $(distdir)/$$f ;\
+# done
+
+#-----------------------------------------------------------------------
+# Rules: cleanup
+#-----------------------------------------------------------------------
+.PHONY: cvsclean cvsclean-hook
+
+cvsclean: maintainer-clean ;
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gfsm/gfsm/src/libgfsm/.cvsignore b/gfsm/gfsm/src/libgfsm/.cvsignore
index fcae916..4e1ca1c 100644
--- a/gfsm/gfsm/src/libgfsm/.cvsignore
+++ b/gfsm/gfsm/src/libgfsm/.cvsignore
@@ -1,3 +1,12 @@
+gfsmConfigAuto.*
+gfsmConfigNoAuto.h
+gmon.out
+
+###config.h
+stamp-h*
+
+Makefile
+
*~
.*~
*.o
@@ -11,19 +20,8 @@
*.tfst
*.lab
*.loT
-gfsmConfigAuto.*
-gfsmConfigNoAuto.h
-gmon.out
*.output
-stamp-h*
-###config.h
-config.h.in
-aclocal.m4
-Makefile
-Makefile.in
-README.txt
-configure
-graveyard
+
*.tfst
*.afst
*.thfst
@@ -35,6 +33,8 @@ graveyard
*.vcg
*.ps
*.tfst
+
+graveyard
fsmlib
SFST.moocow
fsa6-src
diff --git a/gfsm/gfsm/src/libgfsm/Makefile.in b/gfsm/gfsm/src/libgfsm/Makefile.in
new file mode 100644
index 0000000..bac3904
--- /dev/null
+++ b/gfsm/gfsm/src/libgfsm/Makefile.in
@@ -0,0 +1,881 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = src/libgfsm
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/gfsmConfigAuto.h.in \
+ gfsmRegex.lex.c gfsmRegex.tab.c
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \
+ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/getdelim.m4 \
+ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/intmax_t.m4 \
+ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/longdouble.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/onceonly_2_57.m4 \
+ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \
+ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
+ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = gfsmConfigAuto.h
+CONFIG_CLEAN_FILES = gfsmConfigNoAuto.h
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libgfsm_la_LIBADD =
+am_libgfsm_la_OBJECTS = gfsmCommon.lo gfsmCompound.lo gfsmDebug.lo \
+ gfsmError.lo gfsmIO.lo gfsmMem.lo gfsmVersion.lo gfsmUtils.lo \
+ gfsmEnum.lo gfsmSet.lo gfsmWeightMap.lo gfsmBitVector.lo \
+ gfsmAlphabet.lo gfsmSemiring.lo gfsmArc.lo gfsmArcList.lo \
+ gfsmArcIter.lo gfsmArcIndex.lo gfsmState.lo gfsmStateSet.lo \
+ gfsmAutomaton.lo gfsmAutomatonIO.lo gfsmDraw.lo gfsmAlgebra.lo \
+ gfsmArith.lo gfsmLookup.lo gfsmPaths.lo gfsmTrie.lo \
+ gfsmScanner.lo gfsmRegex.lex.lo gfsmRegex.tab.lo \
+ gfsmRegexCompiler.lo gfsmIndexed.lo gfsmIndexedIO.lo
+libgfsm_la_OBJECTS = $(am_libgfsm_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
+LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
+YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
+LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \
+ $(AM_YFLAGS)
+SOURCES = $(libgfsm_la_SOURCES)
+DIST_SOURCES = $(libgfsm_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_OPTIONS = @CONFIG_OPTIONS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTCHECK = @DISTCHECK@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EOVERFLOW = @EOVERFLOW@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FLEX = @FLEX@
+GFSM_SRC_SUBDIRS = @GFSM_SRC_SUBDIRS@
+GFSM_SUBDIRS = @GFSM_SUBDIRS@
+GFSM_VERSION_MAJOR = @GFSM_VERSION_MAJOR@
+GFSM_VERSION_MICRO = @GFSM_VERSION_MICRO@
+GFSM_VERSION_MINOR = @GFSM_VERSION_MINOR@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GREP = @GREP@
+HAVE_BISON_FALSE = @HAVE_BISON_FALSE@
+HAVE_BISON_TRUE = @HAVE_BISON_TRUE@
+HAVE_FLEX_FALSE = @HAVE_FLEX_FALSE@
+HAVE_FLEX_TRUE = @HAVE_FLEX_TRUE@
+HAVE_POD2HTML_FALSE = @HAVE_POD2HTML_FALSE@
+HAVE_POD2HTML_TRUE = @HAVE_POD2HTML_TRUE@
+HAVE_POD2TEXT_FALSE = @HAVE_POD2TEXT_FALSE@
+HAVE_POD2TEXT_TRUE = @HAVE_POD2TEXT_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = $(MY_LEX)
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OPTGEN_PERL = @OPTGEN_PERL@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POD2HTML = @POD2HTML@
+POD2TEXT = @POD2TEXT@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+YACC = $(MY_YACC)
+YFLAGS = @YFLAGS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gfsm_CFLAGS = @gfsm_CFLAGS@
+gfsm_LDFLAGS = @gfsm_LDFLAGS@
+gfsm_LIBS = @gfsm_LIBS@
+gfsm_OFLAGS = @gfsm_OFLAGS@
+gfsm_WFLAGS = @gfsm_WFLAGS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+spkgincludedir = @spkgincludedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUBDIRS = gnulib
+
+#bin_PROGRAMS = ${prog_1} ... ${prog_N}
+#bin_PROGRAMS = dwdspp moot moot-fstgen moot-pargen
+
+#lib_LTLIBRARIES = ${lib_1}.la ... ${lib_N}.la
+#lib_LTLIBRARIES = libgfsm.la
+noinst_LTLIBRARIES = libgfsm.la
+
+#pkgdata_DATA = ${data_1} ... ${data_N}
+
+#man_MANS = ${man_1} ... ${man_N}
+
+#${prog_i}_SOURCES =
+#${lib_i}_la_SOURCES =
+libgfsm_la_SOURCES = \
+ config.h \
+ gfsmCommon.c \
+ gfsmCompound.c \
+ gfsmDebug.c \
+ gfsmError.c \
+ gfsmIO.c \
+ gfsmMem.c \
+ gfsmVersion.c \
+ gfsmUtils.c \
+ gfsmEnum.c \
+ gfsmSet.c \
+ gfsmWeightMap.c \
+ gfsmBitVector.c \
+ gfsmAlphabet.c \
+ gfsmSemiring.c \
+ gfsmArc.c \
+ gfsmArcList.c \
+ gfsmArcIter.c \
+ gfsmArcIndex.c \
+ gfsmState.c \
+ gfsmStateSet.c \
+ gfsmAutomaton.c \
+ gfsmAutomatonIO.c \
+ gfsmDraw.c \
+ gfsmAlgebra.c \
+ gfsmArith.c \
+ gfsmLookup.c \
+ gfsmPaths.c \
+ gfsmTrie.c \
+ gfsmScanner.c \
+ gfsmRegex.lex.l \
+ gfsmRegex.tab.y \
+ gfsmRegexCompiler.c \
+ gfsmIndexed.c \
+ gfsmIndexedIO.c
+
+sources_argh = \
+ gfsmIndexed.c \
+ gfsmIndexed2.c \
+ gfsmIndexedIO.c
+
+
+#EXTRA_${prog_i}_SOURCES =
+#EXTRA_${lib_i}_la_SOURCES =
+
+#gfsmConfigNoAuto.h: gfsmConfigAuto.h.in
+# rm -f "$@"
+# cp "$<" "$@"
+
+#pkginclude_HEADERS = ${hfile_1} ... ${hfile_N}
+#pkginclude_HEADERS =
+noinst_HEADERS = \
+ gfsmAssert.h \
+ gfsmConfig.h \
+ gfsmConfigNoAuto.h \
+ gfsmConfigAuto.h \
+ gfsmCommon.h \
+ gfsmCompound.h \
+ gfsmCompound.hi \
+ gfsmDebug.h \
+ gfsmError.h \
+ gfsmIO.h \
+ gfsmMem.h \
+ gfsmMem.hi \
+ gfsmVersion.h \
+ gfsmUtils.h \
+ gfsmEnum.h \
+ gfsmEnum.hi \
+ gfsmSet.h \
+ gfsmSet.hi \
+ gfsmWeightMap.h \
+ gfsmWeightMap.hi \
+ gfsmBitVector.h \
+ gfsmBitVector.hi \
+ gfsmAlphabet.h \
+ gfsmSemiring.h \
+ gfsmSemiring.hi \
+ gfsmArc.h \
+ gfsmArc.hi \
+ gfsmArcList.h \
+ gfsmArcList.hi \
+ gfsmArcIter.h \
+ gfsmArcIter.hi \
+ gfsmArcIndex.h \
+ gfsmArcIndex.hi \
+ gfsmState.h \
+ gfsmState.hi \
+ gfsmStateSet.h \
+ gfsmStateSet.hi \
+ gfsmAutomaton.h \
+ gfsmAutomaton.hi \
+ gfsmAutomatonIO.h \
+ gfsmDraw.h \
+ gfsmAlgebra.h \
+ gfsmArith.h \
+ gfsmLookup.h \
+ gfsmPaths.h \
+ gfsmTrie.h \
+ gfsmScanner.h \
+ gfsmRegexCompiler.h \
+ gfsmIndexed.h \
+ gfsmIndexed.hi \
+ gfsmIndexedIO.h \
+ gfsm.h
+
+headers_argh = \
+ gfsmIndexed.h \
+ gfsmIndexed2.h \
+ gfsmIndexedIO.h
+
+
+#noinst_HEADERS = nopackage.h
+SRCDIR = @srcdir@
+@HAVE_FLEX_FALSE@MY_LEX = sh $(SRCDIR)/dummy-flex.sh
+@HAVE_FLEX_TRUE@MY_LEX = @FLEX@
+@HAVE_FLEX_FALSE@MY_LFLAGS =
+@HAVE_FLEX_TRUE@MY_LFLAGS =
+AM_LFLAGS = $(MY_LFLAGS)
+@HAVE_BISON_FALSE@MY_YACC = sh $(SRCDIR)/dummy-bison.sh
+@HAVE_BISON_TRUE@MY_YACC = @BISON@
+@HAVE_BISON_FALSE@MY_YFLAGS =
+@HAVE_BISON_TRUE@MY_YFLAGS = --defines --fixed-output-files --name-prefix="$(basename $*)_yy"
+AM_YFLAGS = $(MY_YFLAGS)
+SUFFIXES = .l .lex.l .y .tab.y .tab.c .tab.h .lex.c .lex.h
+
+#AM_CPPFLAGS =
+AM_CPPFLAGS = -I. -I$(SRCDIR)/gnulib
+AM_CFLAGS = $(gfsm_WFLAGS) $(gfsm_CFLAGS) $(gfsm_OFLAGS)
+AM_LDFLAGS = $(gfsm_LDFLAGS)
+AM_LIBS = $(gfsm_LIBS)
+LIBCUR = $(GFSM_VERSION_MAJOR)
+LIBAGE = 0
+LIBREV = $(GFSM_VERSION_MINOR)
+
+#${prog_i}_LDFLAGS = -L. -static
+#${prog_i}_LDADD = ${non_src_file}.o -lsomelib
+
+#${lib_i}_la_LDFLAGS = -L. -version-info ${lib_i_current}:${lib_i_rev}:${lib_i_age}
+#${lib_i}_la_LIBADD = -lotherlib
+libgfsm_la_LDFLAGS = -version-info $(LIBCUR):$(LIBREV):$(LIBAGE)
+#libgfsm_la_LIBADD = gnulib/libgnu.la @gfsm_LIBS@ $(LIBS)
+
+#MOSTLYCLEANFILES =
+
+#CLEANFILES =
+
+#DISTCLEANFILES =
+MAINTAINERCLEANFILES = \
+ *~ .*~ Makefile Makefile.in \
+ gmon.out
+
+EXTRA_DIST = \
+ config.h \
+ gfsmConfigNoAuto.h \
+ gfsmRegex.lex.c \
+ gfsmRegex.lex.h \
+ gfsmRegex.tab.c \
+ gfsmRegex.tab.h \
+ dummy-flex.sh \
+ dummy-bison.sh
+
+all: gfsmConfigAuto.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .l .lex.l .y .tab.y .tab.c .tab.h .lex.c .lex.h .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libgfsm/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/libgfsm/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+gfsmConfigAuto.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/gfsmConfigAuto.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status src/libgfsm/gfsmConfigAuto.h
+$(srcdir)/gfsmConfigAuto.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f gfsmConfigAuto.h stamp-h1
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgfsm.la: $(libgfsm_la_OBJECTS) $(libgfsm_la_DEPENDENCIES)
+ $(LINK) $(libgfsm_la_LDFLAGS) $(libgfsm_la_OBJECTS) $(libgfsm_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmAlgebra.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmAlphabet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmArc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmArcIndex.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmArcIter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmArcList.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmArith.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmAutomaton.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmAutomatonIO.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmBitVector.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmCommon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmCompound.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmDebug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmDraw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmEnum.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmError.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmIO.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmIndexed.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmIndexedIO.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmLookup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmMem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmPaths.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmRegex.lex.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmRegex.tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmRegexCompiler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmScanner.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmSemiring.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmSet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmState.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmStateSet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmTrie.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmUtils.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmVersion.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfsmWeightMap.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+.l.c:
+ $(LEXCOMPILE) $<
+ sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@
+ rm -f $(LEX_OUTPUT_ROOT).c
+
+.y.c:
+ $(YACCCOMPILE) $<
+ if test -f y.tab.h; then \
+ to=`echo "$*_H" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \
+ sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \
+ y.tab.h >$*.ht; \
+ rm -f y.tab.h; \
+ if cmp -s $*.ht $*.h; then \
+ rm -f $*.ht ;\
+ else \
+ mv $*.ht $*.h; \
+ fi; \
+ fi
+ if test -f y.output; then \
+ mv y.output $*.output; \
+ fi
+ sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@
+ rm -f y.tab.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) gfsmConfigAuto.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) gfsmConfigAuto.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) gfsmConfigAuto.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) gfsmConfigAuto.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) gfsmConfigAuto.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f gfsmRegex.lex.c
+ -rm -f gfsmRegex.tab.c
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-hdr \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am
+
+
+gfsmRegex.lex.o: gfsmRegex.lex.c gfsmRegex.tab.c gfsmRegexCompiler.h
+gfsmRegex.tab.o: gfsmRegex.tab.c gfsmRegex.lex.c gfsmRegexCompiler.h
+gfsmRegexCompiler.o: gfsmRegexCompiler.c gfsmRegexCompiler.h gfsmRegex.lex.c gfsmRegex.tab.c
+
+#DIST_SUBDIRS = $(SUBDIRS)
+
+#DISTHOOK_DIRS = foo
+#DISTHOOK_FILES = foo/bar.txt foo/baz.txt
+#dist-hook:
+# for d in $(DISTHOOK_DIRS); do\
+# mkdir -p $(distdir)/$$d ;\
+# done
+# for f in $(DISTHOOK_FILES); do\
+# cp -p $(srcdir)/$$f $(distdir)/$$f ;\
+# done
+
+.PHONY: cvsclean
+
+cvsclean: maintainer-clean ;
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gfsm/gfsm/src/libgfsm/gfsmAlgebra.c b/gfsm/gfsm/src/libgfsm/gfsmAlgebra.c
index 4e9effe..5215423 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmAlgebra.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmAlgebra.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1621,7 +1621,7 @@ gfsmAutomaton *gfsm_automaton_reverse_old(gfsmAutomaton *fsm)
/*--------------------------------------------------------------
* sigma()
*/
-gboolean gfsm_automaton_sigma_foreach_func_(gfsmAlphabet *abet, gpointer key, gfsmLabelVal lab, gfsmAutomaton *fsm)
+gboolean gfsm_automaton_sigma_foreach_func_(GFSM_UNUSED gfsmAlphabet *abet, GFSM_UNUSED gpointer key, gfsmLabelVal lab, gfsmAutomaton *fsm)
{
gfsm_automaton_add_arc(fsm,0,1,lab,lab,fsm->sr->one);
return FALSE;
diff --git a/gfsm/gfsm/src/libgfsm/gfsmAlphabet.c b/gfsm/gfsm/src/libgfsm/gfsmAlphabet.c
index 078f176..52c8332 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmAlphabet.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmAlphabet.c
@@ -223,9 +223,9 @@ void gfsm_alphabet_clear(gfsmAlphabet *a)
* gfsm_alphabet_foreach_remove_func()
*/
gboolean gfsm_alphabet_foreach_remove_func(gfsmAlphabet *a,
- gpointer key,
+ GFSM_UNUSED gpointer key,
gfsmLabelVal lab,
- gpointer data)
+ GFSM_UNUSED gpointer data)
{
gfsm_alphabet_remove_label(a,lab);
return FALSE;
@@ -280,7 +280,7 @@ gboolean gfsm_alphabet_foreach (gfsmAlphabet *a,
/*--------------------------------------------------------------
* strdup()
*/
-gpointer gfsm_alphabet_strdup(gfsmAlphabet *a, const gchar *str)
+gpointer gfsm_alphabet_strdup(GFSM_UNUSED gfsmAlphabet *a, const gchar *str)
{ return g_strdup(str); }
/*======================================================================
@@ -315,7 +315,7 @@ gfsmLabelVal gfsm_alphabet_size(gfsmAlphabet *a)
/*--------------------------------------------------------------
* foreach_size_func()
*/
-gboolean gfsm_alphabet_foreach_size_func(gfsmAlphabet *a,
+gboolean gfsm_alphabet_foreach_size_func(GFSM_UNUSED gfsmAlphabet *a,
gpointer key,
gfsmLabelVal lab,
guint *np)
@@ -558,9 +558,9 @@ gfsmAlphabet *gfsm_alphabet_union(gfsmAlphabet *a1, gfsmAlphabet *a2)
/*--------------------------------------------------------------
* union_func()
*/
-gboolean gfsm_alphabet_foreach_union_func(gfsmAlphabet *src,
+gboolean gfsm_alphabet_foreach_union_func(GFSM_UNUSED gfsmAlphabet *src,
gpointer src_key,
- gfsmLabelVal src_id,
+ GFSM_UNUSED gfsmLabelVal src_id,
gfsmAlphabet *dst)
{
gfsm_alphabet_get_label(dst,src_key);
@@ -570,8 +570,8 @@ gboolean gfsm_alphabet_foreach_union_func(gfsmAlphabet *src,
/*--------------------------------------------------------------
* gfsm_alphabet_labels_to_array_func()
*/
-gboolean gfsm_alphabet_labels_to_array_func(gfsmAlphabet *alph,
- gpointer key,
+gboolean gfsm_alphabet_labels_to_array_func(GFSM_UNUSED gfsmAlphabet *alph,
+ GFSM_UNUSED gpointer key,
gfsmLabelVal lab,
GPtrArray *ary)
{
@@ -656,7 +656,7 @@ void gfsm_alphabet_key2string(gfsmAlphabet *a, gpointer key, GString *gstr)
/*--------------------------------------------------------------
* load_handle()
*/
-gboolean gfsm_alphabet_load_handle (gfsmAlphabet *a, gfsmIOHandle *ioh, gfsmError **errp)
+gboolean gfsm_alphabet_load_handle (gfsmAlphabet *a, gfsmIOHandle *ioh, GFSM_UNUSED gfsmError **errp)
{
int c;
gpointer key;
@@ -968,7 +968,7 @@ GString *gfsm_alphabet_labels_to_gstring(gfsmAlphabet *abet,
{
gfsmLabelVal lab;
const gchar *sym;
- int i;
+ guint i;
//-- setup GString
if (gstr==NULL) {
diff --git a/gfsm/gfsm/src/libgfsm/gfsmAutomaton.hi b/gfsm/gfsm/src/libgfsm/gfsmAutomaton.hi
index b99f441..33a1674 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmAutomaton.hi
+++ b/gfsm/gfsm/src/libgfsm/gfsmAutomaton.hi
@@ -3,7 +3,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: automata: inline definitions
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -184,7 +184,7 @@ void gfsm_automaton_reserve_states(gfsmAutomaton *fsm, gfsmStateId n_states)
* reserve_arcs()
*/
GFSM_INLINE
-void gfsm_automaton_reserve_arcs(gfsmAutomaton *fsm, guint n_arcs)
+void gfsm_automaton_reserve_arcs(GFSM_UNUSED gfsmAutomaton *fsm, GFSM_UNUSED guint n_arcs)
{
return;
}
@@ -323,7 +323,7 @@ gfsmState *gfsm_automaton_open_state_force(gfsmAutomaton *fsm, gfsmStateId qid)
* close_state()
*/
GFSM_INLINE
-void gfsm_automaton_close_state(gfsmAutomaton *fsm, gfsmState *qp)
+void gfsm_automaton_close_state(GFSM_UNUSED gfsmAutomaton *fsm, GFSM_UNUSED gfsmState *qp)
{
//gfsm_state_close(qp);
return;
diff --git a/gfsm/gfsm/src/libgfsm/gfsmAutomatonIO.c b/gfsm/gfsm/src/libgfsm/gfsmAutomatonIO.c
index 234dec1..9cc396e 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmAutomatonIO.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmAutomatonIO.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: automata: I/O
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* For information on usage and redistribution, and for a DISCLAIMER
* OF ALL WARRANTIES, see the file "COPYING" in this distribution.
@@ -546,7 +546,7 @@ gboolean gfsm_automaton_compile_handle (gfsmAutomaton *fsm,
gfsmAlphabet *lo_alphabet,
gfsmAlphabet *hi_alphabet,
gfsmAlphabet *state_alphabet,
- gfsmError **errp)
+ GFSM_UNUSED gfsmError **errp)
{
gfsmStateId q1, q2;
gfsmLabelId lo, hi;
@@ -741,7 +741,7 @@ gboolean gfsm_automaton_print_handle (gfsmAutomaton *fsm,
gfsmAlphabet *lo_alphabet,
gfsmAlphabet *hi_alphabet,
gfsmAlphabet *state_alphabet,
- gfsmError **errp)
+ GFSM_UNUSED gfsmError **errp)
{
guint i;
GString *gs = g_string_new("");
diff --git a/gfsm/gfsm/src/libgfsm/gfsmCommon.h b/gfsm/gfsm/src/libgfsm/gfsmCommon.h
index b27910e..24a4621 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmCommon.h
+++ b/gfsm/gfsm/src/libgfsm/gfsmCommon.h
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: common definitions
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,6 +32,16 @@
#include <glib.h>
/*======================================================================
+ * Defines
+ */
+#ifdef __GNUC__
+# define GFSM_UNUSED __attribute__((unused))
+#else
+# define GFSM_UNUSED
+#endif
+
+
+/*======================================================================
* Basic Types
*/
/** Type for elementary arc-labels */
diff --git a/gfsm/gfsm/src/libgfsm/gfsmCompound.c b/gfsm/gfsm/src/libgfsm/gfsmCompound.c
index ec54502..74f9801 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmCompound.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmCompound.c
@@ -3,7 +3,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: compound states
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -40,7 +40,7 @@ gint gfsm_labelpair_compare(gfsmLabelPair lp1, gfsmLabelPair lp2)
/*--------------------------------------------------------------
* labelpair_compare_with_data()
*/
-gint gfsm_labelpair_compare_with_data(gfsmLabelPair lp1, gfsmLabelPair lp2, gpointer data)
+gint gfsm_labelpair_compare_with_data(gfsmLabelPair lp1, gfsmLabelPair lp2, GFSM_UNUSED gpointer data)
{ return gfsm_labelpair_compare_inline(lp1,lp2); }
diff --git a/gfsm/gfsm/src/libgfsm/gfsmCompound.h b/gfsm/gfsm/src/libgfsm/gfsmCompound.h
index d492cc7..985a8c5 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmCompound.h
+++ b/gfsm/gfsm/src/libgfsm/gfsmCompound.h
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: basic compound types
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/gfsm/gfsm/src/libgfsm/gfsmDraw.c b/gfsm/gfsm/src/libgfsm/gfsmDraw.c
index 3c10991..4baf55f 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmDraw.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmDraw.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: automata: visualization
*
- * Copyright (c) 2004 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@ gboolean gfsm_automaton_draw_vcg_file_full (gfsmAutomaton *fsm,
const gchar *state_shape,
const gchar *state_color,
const gchar *final_color,
- gfsmError **errp)
+ GFSM_UNUSED gfsmError **errp)
{
gfsmStateId id;
GString *gstr = g_string_new("");
@@ -176,7 +176,7 @@ gboolean gfsm_automaton_draw_dot_file_full (gfsmAutomaton *fsm,
gboolean vertical,
float nodesep,
float ranksep,
- gfsmError **errp)
+ GFSM_UNUSED gfsmError **errp)
{
gfsmStateId id;
GString *gstr = g_string_new("");
diff --git a/gfsm/gfsm/src/libgfsm/gfsmIO.c b/gfsm/gfsm/src/libgfsm/gfsmIO.c
index f5e637d..e396c7b 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmIO.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmIO.c
@@ -335,7 +335,7 @@ ssize_t gfsmio_getdelim(gfsmIOHandle *ioh, char **lineptr, size_t *n, int delim)
int c = -2;
GString *gs=NULL;
- while ( *n > 0 && i < (*n-1) && (c=gfsmio_getc(ioh)) != GFSMIO_EOF ) {
+ while ( *n > 0 && i < (((ssize_t)(*n))-1) && (c=gfsmio_getc(ioh)) != GFSMIO_EOF ) {
(*lineptr)[i++] = c;
#ifdef GFSM_DEBUG_GETDELIM
fprintf(stderr, "---> getdelim(i=%d) got char %d ~ '%c' to linebuf\n", i, (char)c, c);//--DEBUG
@@ -502,13 +502,13 @@ gboolean gfsmio_eof_zfile(gzFile zf)
* gzFile: Read Methods
*/
gboolean gfsmio_read_zfile(gzFile zf, void *buf, size_t nbytes)
-{ return zf ? (gzread(zf,buf,nbytes)==nbytes) : FALSE; }
+{ return zf ? (gzread(zf,buf,nbytes)==(int)nbytes) : FALSE; }
/*--------------------------------------------------------------
* gzFile: Write Methods
*/
gboolean gfsmio_write_zfile(gzFile zf, const void *buf, size_t nbytes)
-{ return zf ? (gzwrite(zf, buf, nbytes)==nbytes) : FALSE; }
+{ return zf ? (gzwrite(zf, buf, nbytes)==(int)nbytes) : FALSE; }
#endif /* GFSM_ZLIB_ENABLED */
diff --git a/gfsm/gfsm/src/libgfsm/gfsmIndexed.hi b/gfsm/gfsm/src/libgfsm/gfsmIndexed.hi
index 670f03d..9ded88d 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmIndexed.hi
+++ b/gfsm/gfsm/src/libgfsm/gfsmIndexed.hi
@@ -1,10 +1,9 @@
-
/*=============================================================================*\
* File: gfsmIndexed.hi
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: indexed automaton: inline definitions
*
- * Copyright (c) 2007 Bryan Jurish.
+ * Copyright (c) 2007-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -224,7 +223,7 @@ gfsmStateId gfsm_indexed_automaton_ensure_state(gfsmIndexedAutomaton *xfsm, gfsm
//----------------------------------------
GFSM_INLINE
-void gfsm_indexed_automaton_remove_state(gfsmIndexedAutomaton *fsm, gfsmStateId qid)
+void gfsm_indexed_automaton_remove_state(GFSM_UNUSED gfsmIndexedAutomaton *fsm, GFSM_UNUSED gfsmStateId qid)
{ return; }
diff --git a/gfsm/gfsm/src/libgfsm/gfsmIndexedIO.c b/gfsm/gfsm/src/libgfsm/gfsmIndexedIO.c
index 9e2f297..5d5f3b6 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmIndexedIO.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmIndexedIO.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: indexed automata: I/O
*
- * Copyright (c) 2007 Bryan Jurish.
+ * Copyright (c) 2007-2008 Bryan Jurish.
*
* For information on usage and redistribution, and for a DISCLAIMER
* OF ALL WARRANTIES, see the file "COPYING" in this distribution.
@@ -312,7 +312,7 @@ gboolean gfsm_indexed_automaton_print_handle (gfsmIndexedAutomaton *xfsm,
gfsmAlphabet *lo_alphabet,
gfsmAlphabet *hi_alphabet,
gfsmAlphabet *state_alphabet,
- gfsmError **errp)
+ GFSM_UNUSED gfsmError **errp)
{
gfsmStateId qid;
gfsmArcRange range;
diff --git a/gfsm/gfsm/src/libgfsm/gfsmMem.h b/gfsm/gfsm/src/libgfsm/gfsmMem.h
index 4791d26..dd1a917 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmMem.h
+++ b/gfsm/gfsm/src/libgfsm/gfsmMem.h
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: memory utilities (currently unused)
*
- * Copyright (c) 2004 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/gfsm/gfsm/src/libgfsm/gfsmMem.hi b/gfsm/gfsm/src/libgfsm/gfsmMem.hi
index 4b9819d..26aff79 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmMem.hi
+++ b/gfsm/gfsm/src/libgfsm/gfsmMem.hi
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library: memory utilities: inline definitions
*
- * Copyright (c) 2004 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -120,7 +120,7 @@ GFSM_INLINE
void gfsm_gstring_assign_bytes (GString *gstr, const gchar *src, gsize len)
{
g_string_truncate(gstr, 0);
- g_string_append_len(gstr, src, gstr->len);
+ g_string_append_len(gstr, src, len);
}
/*----------------------------------------------------------------------
diff --git a/gfsm/gfsm/src/libgfsm/gfsmPaths.c b/gfsm/gfsm/src/libgfsm/gfsmPaths.c
index 7b5faa5..b2c7115 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmPaths.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmPaths.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library
*
- * Copyright (c) 2005-2007 Bryan Jurish.
+ * Copyright (c) 2005-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,7 @@
//--------------------------------------------------------------
gfsmLabelVector *gfsm_label_vector_copy(gfsmLabelVector *dst, gfsmLabelVector *src)
{
- int i;
+ guint i;
g_ptr_array_set_size(dst, src->len);
for (i=0; i < src->len; i++) {
g_ptr_array_index(dst,i) = g_ptr_array_index(src,i);
@@ -148,7 +148,7 @@ void gfsm_path_pop(gfsmPath *p, gfsmLabelVal lo, gfsmLabelVal hi)
//--------------------------------------------------------------
int gfsm_label_vector_compare(const gfsmLabelVector *v1, const gfsmLabelVector *v2)
{
- int i;
+ guint i;
gfsmLabelVal lab1, lab2;
if (v1==v2) return 0;
@@ -275,7 +275,7 @@ GSList *gfsm_paths_to_strings(gfsmSet *paths,
gfsmSemiring *sr,
gboolean warn_on_undefined,
gboolean att_style,
- GSList *strings)
+ GFSM_UNUSED GSList *strings)
{
gfsmPathsToStringsOptions opts =
{
@@ -294,7 +294,7 @@ GSList *gfsm_paths_to_strings(gfsmSet *paths,
//--------------------------------------------------------------
gboolean _gfsm_paths_to_strings_foreach_func(gfsmPath *path,
- gpointer value_dummy,
+ GFSM_UNUSED gpointer value_dummy,
gfsmPathsToStringsOptions *opts)
{
GString *gs = gfsm_path_to_gstring(path, NULL,
diff --git a/gfsm/gfsm/src/libgfsm/gfsmScanner.c b/gfsm/gfsm/src/libgfsm/gfsmScanner.c
index afa2632..b0d032d 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmScanner.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmScanner.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library
*
- * Copyright (c) 2005 Bryan Jurish.
+ * Copyright (c) 2005-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
#include <gfsmScanner.h>
#include <gfsmUtils.h>
+#include <gfsmCommon.h>
#include <string.h>
/*======================================================================
@@ -177,7 +178,7 @@ void gfsm_scanner_scan_string(gfsmScanner *scanner, const char *str)
*/
//--------------------------------------------------------------
-int gfsm_scanner_yywrap(gfsmScanner *scanner)
+int gfsm_scanner_yywrap(GFSM_UNUSED gfsmScanner *scanner)
{ return 1; }
diff --git a/gfsm/gfsm/src/libgfsm/gfsmSet.c b/gfsm/gfsm/src/libgfsm/gfsmSet.c
index 1083caa..61a3b96 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmSet.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmSet.c
@@ -3,7 +3,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library
*
- * Copyright (c) 2004-2007 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,7 @@
*=============================================================================*/
#include <gfsmSet.h>
+#include <gfsmCommon.h>
//-- no-inline definitions
#ifndef GFSM_INLINE_ENABLED
@@ -62,7 +63,7 @@ void gfsm_set_clear(gfsmSet *set)
/*--------------------------------------------------------------
* union_func()
*/
-gboolean gfsm_set_union_func(gpointer key, gpointer value, gfsmSetUnionData *data)
+gboolean gfsm_set_union_func(gpointer key, GFSM_UNUSED gpointer value, gfsmSetUnionData *data)
{
if (!data->dupfunc) {
//-- no memory hairiness: just insert
@@ -77,7 +78,7 @@ gboolean gfsm_set_union_func(gpointer key, gpointer value, gfsmSetUnionData *dat
/*--------------------------------------------------------------
* difference_func()
*/
-gboolean gfsm_set_difference_func(gpointer key, gpointer value, gfsmSet *set1)
+gboolean gfsm_set_difference_func(gpointer key, GFSM_UNUSED gpointer value, gfsmSet *set1)
{
gfsm_set_remove(set1,key);
return FALSE;
@@ -107,7 +108,7 @@ gfsmSet *gfsm_set_intersection(gfsmSet *set1, gfsmSet *set2)
/*--------------------------------------------------------------
* to_slist_foreach_func()
*/
-gboolean gfsm_set_to_slist_foreach_func(gpointer key, gpointer value, GSList **dst)
+gboolean gfsm_set_to_slist_foreach_func(gpointer key, GFSM_UNUSED gpointer value, GSList **dst)
{
*dst = g_slist_prepend(*dst, key);
return FALSE; //-- don't stop iterating
@@ -116,7 +117,7 @@ gboolean gfsm_set_to_slist_foreach_func(gpointer key, gpointer value, GSList **d
/*--------------------------------------------------------------
* to_ptr_array_foreach_func()
*/
-gboolean gfsm_set_to_ptr_array_foreach_func(gpointer key, gpointer value, GPtrArray *dst)
+gboolean gfsm_set_to_ptr_array_foreach_func(gpointer key, GFSM_UNUSED gpointer value, GPtrArray *dst)
{
g_ptr_array_add(dst,key);
return FALSE;
diff --git a/gfsm/gfsm/src/libgfsm/gfsmUtils.c b/gfsm/gfsm/src/libgfsm/gfsmUtils.c
index 2fe8e1e..2928450 100644
--- a/gfsm/gfsm/src/libgfsm/gfsmUtils.c
+++ b/gfsm/gfsm/src/libgfsm/gfsmUtils.c
@@ -3,7 +3,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: finite state machine library
*
- * Copyright (c) 2004 Bryan Jurish.
+ * Copyright (c) 2004-2008 Bryan Jurish.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
#include <glib.h>
#include <gfsmUtils.h>
#include <gfsmError.h>
+#include <gfsmCommon.h>
#include <string.h>
#include <errno.h>
@@ -41,7 +42,7 @@ gint gfsm_int_compare(gconstpointer a, gconstpointer b)
/*--------------------------------------------------------------
* int_compare_data()
*/
-gint gfsm_int_compare_data(gconstpointer a, gconstpointer b, gpointer data)
+gint gfsm_int_compare_data(gconstpointer a, gconstpointer b, GFSM_UNUSED gpointer data)
{
return (GPOINTER_TO_INT(b) - GPOINTER_TO_INT(a));
}
@@ -61,7 +62,7 @@ gint gfsm_uint_compare(gconstpointer a, gconstpointer b)
/*--------------------------------------------------------------
* uint_compare_data()
*/
-gint gfsm_uint_compare_data(gconstpointer a, gconstpointer b, gpointer data)
+gint gfsm_uint_compare_data(gconstpointer a, gconstpointer b, GFSM_UNUSED gpointer data)
{
return gfsm_uint_compare_code(a,b);
}
@@ -72,7 +73,7 @@ gint gfsm_uint_compare_data(gconstpointer a, gconstpointer b, gpointer data)
/*--------------------------------------------------------------
* gfsm_hash_clear_func()
*/
-gboolean gfsm_hash_clear_func (gpointer key, gpointer value, gpointer user_data)
+gboolean gfsm_hash_clear_func (GFSM_UNUSED gpointer key, GFSM_UNUSED gpointer value, GFSM_UNUSED gpointer user_data)
{ return TRUE; };
diff --git a/gfsm/gfsm/src/libgfsm/gnulib/.cvsignore b/gfsm/gfsm/src/libgfsm/gnulib/.cvsignore
index 8ef01bb..0985ed1 100644
--- a/gfsm/gfsm/src/libgfsm/gnulib/.cvsignore
+++ b/gfsm/gfsm/src/libgfsm/gnulib/.cvsignore
@@ -1,3 +1,5 @@
+Makefile
+
.*~
*~
*.o
@@ -6,8 +8,5 @@
*.la
*.so
-Makefile
-Makefile.in
-
orig
.libs
diff --git a/gfsm/gfsm/src/libgfsm/gnulib/Makefile.in b/gfsm/gfsm/src/libgfsm/gnulib/Makefile.in
index 671e4e5..3ada70f 100644
--- a/gfsm/gfsm/src/libgfsm/gnulib/Makefile.in
+++ b/gfsm/gfsm/src/libgfsm/gnulib/Makefile.in
@@ -99,21 +99,10 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BINDIST_CPU = @BINDIST_CPU@
-BINDIST_OS = @BINDIST_OS@
-BINDIST_PKGNAME = @BINDIST_PKGNAME@
-BINDIST_RELEASE = @BINDIST_RELEASE@
BISON = @BISON@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
-CONFIG_DOC_WANT_DVI = @CONFIG_DOC_WANT_DVI@
-CONFIG_DOC_WANT_HTML = @CONFIG_DOC_WANT_HTML@
-CONFIG_DOC_WANT_LATEX = @CONFIG_DOC_WANT_LATEX@
-CONFIG_DOC_WANT_MAN = @CONFIG_DOC_WANT_MAN@
-CONFIG_DOC_WANT_PDF = @CONFIG_DOC_WANT_PDF@
-CONFIG_DOC_WANT_PS = @CONFIG_DOC_WANT_PS@
-CONFIG_DOC_WANT_TXT = @CONFIG_DOC_WANT_TXT@
CONFIG_OPTIONS = @CONFIG_OPTIONS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
@@ -125,34 +114,6 @@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK = @DISTCHECK@
-DOC_GOGS = @DOC_GOGS@
-DOC_MAN1_GOGS = @DOC_MAN1_GOGS@
-DOC_MAN5_PODS = @DOC_MAN5_PODS@
-DOC_PODS = @DOC_PODS@
-DOC_PROG_INDEX_SKEL = @DOC_PROG_INDEX_SKEL@
-DOC_WANT_DVI_FALSE = @DOC_WANT_DVI_FALSE@
-DOC_WANT_DVI_TRUE = @DOC_WANT_DVI_TRUE@
-DOC_WANT_HTML_FALSE = @DOC_WANT_HTML_FALSE@
-DOC_WANT_HTML_TRUE = @DOC_WANT_HTML_TRUE@
-DOC_WANT_LATEX_FALSE = @DOC_WANT_LATEX_FALSE@
-DOC_WANT_LATEX_TRUE = @DOC_WANT_LATEX_TRUE@
-DOC_WANT_MAN_FALSE = @DOC_WANT_MAN_FALSE@
-DOC_WANT_MAN_TRUE = @DOC_WANT_MAN_TRUE@
-DOC_WANT_PDF_FALSE = @DOC_WANT_PDF_FALSE@
-DOC_WANT_PDF_TRUE = @DOC_WANT_PDF_TRUE@
-DOC_WANT_PS_FALSE = @DOC_WANT_PS_FALSE@
-DOC_WANT_PS_TRUE = @DOC_WANT_PS_TRUE@
-DOC_WANT_TXT_FALSE = @DOC_WANT_TXT_FALSE@
-DOC_WANT_TXT_TRUE = @DOC_WANT_TXT_TRUE@
-DOXYGEN = @DOXYGEN@
-DOXYGEN_SOURCES = @DOXYGEN_SOURCES@
-DOXY_DEFINES = @DOXY_DEFINES@
-DOXY_FILTER = @DOXY_FILTER@
-DOXY_INPUT_FILTER = @DOXY_INPUT_FILTER@
-DOXY_TAGFILES = @DOXY_TAGFILES@
-DOXY_WANT_HTML = @DOXY_WANT_HTML@
-DOXY_WANT_LATEX = @DOXY_WANT_LATEX@
-DOXY_WANT_MAN = @DOXY_WANT_MAN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@@ -173,20 +134,10 @@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
HAVE_BISON_FALSE = @HAVE_BISON_FALSE@
HAVE_BISON_TRUE = @HAVE_BISON_TRUE@
-HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
-HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
-HAVE_DOXY_FILTER_FALSE = @HAVE_DOXY_FILTER_FALSE@
-HAVE_DOXY_FILTER_TRUE = @HAVE_DOXY_FILTER_TRUE@
HAVE_FLEX_FALSE = @HAVE_FLEX_FALSE@
HAVE_FLEX_TRUE = @HAVE_FLEX_TRUE@
-HAVE_OPTGEN_FALSE = @HAVE_OPTGEN_FALSE@
-HAVE_OPTGEN_TRUE = @HAVE_OPTGEN_TRUE@
HAVE_POD2HTML_FALSE = @HAVE_POD2HTML_FALSE@
HAVE_POD2HTML_TRUE = @HAVE_POD2HTML_TRUE@
-HAVE_POD2LATEX_FALSE = @HAVE_POD2LATEX_FALSE@
-HAVE_POD2LATEX_TRUE = @HAVE_POD2LATEX_TRUE@
-HAVE_POD2MAN_FALSE = @HAVE_POD2MAN_FALSE@
-HAVE_POD2MAN_TRUE = @HAVE_POD2MAN_TRUE@
HAVE_POD2TEXT_FALSE = @HAVE_POD2TEXT_FALSE@
HAVE_POD2TEXT_TRUE = @HAVE_POD2TEXT_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@@ -216,8 +167,6 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POD2HTML = @POD2HTML@
-POD2LATEX = @POD2LATEX@
-POD2MAN = @POD2MAN@
POD2TEXT = @POD2TEXT@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
@@ -272,10 +221,6 @@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgconfigdir = @pkgconfigdir@
-pkgdocdir = @pkgdocdir@
-pkgdoclibdir = @pkgdoclibdir@
-pkgdocprogdir = @pkgdocprogdir@
-pkgdoctutdir = @pkgdoctutdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
diff --git a/gfsm/gfsm/src/libgfsm/tests/.cvsignore b/gfsm/gfsm/src/libgfsm/tests/.cvsignore
deleted file mode 100644
index ef3800b..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/.cvsignore
+++ /dev/null
@@ -1,38 +0,0 @@
-*~
-.*~
-
-*.gfst
-*.output
-*.lex.c
-*.lex.h
-*.tab.c
-*.tab.h
-*.gz
-
-tagh*
-*.dat
-negra*
-lts-grimm.*
-
-offsettest
-priotest
-seek2test
-seek3test
-seektest
-gfsmlabdump
-iotest
-pathtest
-ftest
-memtest-general
-calctest
-calc2test
-flextest
-flex2test
-flex3test
-compretest
-comprelex
-compre2test
-structtest
-
-flextest.c
-flextest.h
diff --git a/gfsm/gfsm/src/libgfsm/tests/Makefile b/gfsm/gfsm/src/libgfsm/tests/Makefile
deleted file mode 100644
index f4ec863..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/Makefile
+++ /dev/null
@@ -1,116 +0,0 @@
-TARGETS = priotest
-
-KNOWN_TARGETS = \
- priotest \
- seek3test \
- seek2test \
- offsettest \
- arctab-1test \
- seektest \
- gfsmlabdump \
- iotest \
- structtest \
- pathtest \
- memtest \
- memtest-general \
- ftest \
- flextest \
- calctest \
- flex2test \
- calc2test \
- flex3test \
- compretest \
- comprelex \
- compre2test
-
-
-CC = gcc
-#CC = ccmalloc --no-wrapper gcc
-LD = $(CC)
-
-CPPFLAGS = -I. -I.. -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-CFLAGS ?= -O2 -pipe
-#CFLAGS ?= -Wall -g
-#CFLAGS += -Wall -g
-#CFLAGS = -Wall -g
-CFLAGS += -Wall -Winline
-
-LDFLAGS = -L../libgfsm/.libs -L/usr/local/lib -L/usr/lib
-LIBS = -lz -lglib-2.0 -lm
-GFSMLIBS = ../.libs/libgfsm.a
-
-LEX ?= flex
-FLEX ?= flex
-FLEXFLAGS ?=
-BISON ?= bison
-BISONFLAGS ?= --verbose
-
-all: $(TARGETS)
-
-##-- keep intermediate files
-.SECONDARY:
-
-seektest.o: seektest.c labprobs.h
-seektest: seektest.o
-
-##-- flex
-%.lex.c %.lex.h: %.l
- $(FLEX) $(FLEXFLAGS) --outfile="$*.lex.c" --header-file="$*.lex.h" $^
-
-calctest.lex.o: calctest.tab.h
-
-calc2test.lex.o: calc2test.tab.h ../gfsmRegexCompiler.h
-
-compretest.lex.o: compretest.tab.h ../gfsmRegexCompiler.h
-
-comprelex.lex.o: compretest.lex.c compretest.lex.h ../gfsmRegexCompiler.h
-
-##-- gfsmlabdump
-gfsmlabdump: gfsmlabdump.o ../.libs/libgfsm.a
- $(LD) $(LDFLAGS) -o $@ $< $(GFSMLIBS) $(LIBS)
-
-##-- bison
-%.tab.c %.tab.h: %.y
- $(BISON) $(BISONFLAGS) --defines --file-prefix="$*" --name-prefix="$*_yy" $^
-
-##-- flex+bison
-calctest: calctest.lex.o calctest.tab.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-calc2test: calc2test.lex.o calc2test.tab.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-flex2test: flex2test.lex.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-flex3test: flex3test.lex.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-compretest: compretest.lex.o compretest.tab.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-comprelex: comprelex.lex.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-compre2test: compre2test.o $(GFSMLIBS)
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-##-- io
-iotest: iotest.o
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-##-- .c -> .o
-%.o: %.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
-
-##-- clean
-clean:
- rm -f *.o *.lo *.tab.[ch] *.lex.[ch] $(KNOWN_TARGETS)
-
-
-##-- executables
-%test: %test.o
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
-
-%-general: %-general.o
- $(LD) $(LDFLAGS) -o $@ $^ $(GFSMLIBS) $(LIBS)
diff --git a/gfsm/gfsm/src/libgfsm/tests/NOTES.lookup b/gfsm/gfsm/src/libgfsm/tests/NOTES.lookup
deleted file mode 100644
index 538feaf..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/NOTES.lookup
+++ /dev/null
@@ -1,26 +0,0 @@
-lookup (NITERS=524288)
- real 0m3.410s
- user 0m3.403s
- sys 0m0.002s
-
- -> iters/s = 153750.147 = 153.75 K
-
- : lookup @ 153.75 K iters/s
-
-lookup + paths (NITERS=524288)
- real 0m5.880s
- user 0m5.873s
- sys 0m0.002s
-
- -> iters/s = 89164.626 = 89.16 K
-
- : paths @ (52488/(5.88-3.41)) = 21250.2 = 21.25 K iters/s
-
-lookup + paths + strings (NITERS=524288)
- real 0m9.013s
- user 0m9.005s
- sys 0m0.002s
-
- -> iters/s = 58170.199 = 58.17 K
-
- : strings @ (52488/(9.013-5.88)) = 16753.27 = 16.75 K iters/s
diff --git a/gfsm/gfsm/src/libgfsm/tests/alphachurn.c b/gfsm/gfsm/src/libgfsm/tests/alphachurn.c
deleted file mode 100644
index 8ea47a8..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/alphachurn.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <gfsmAlphabet.h>
-#include <stdlib.h>
-
-int main (void) {
- gfsmStringAlphabet *a = gfsm_string_alphabet_new();
-
- gfsm_string_alphabet_load_filename(a,"test.lab");
- gfsm_string_alphabet_save_filename(a,"-");
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/arctab-1test.c b/gfsm/gfsm/src/libgfsm/tests/arctab-1test.c
deleted file mode 100644
index d4cdb4b..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/arctab-1test.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <gfsm.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main (int argc, char **argv)
-{
- const char *infilename = "-";
- const char *prog = argv[0];
- gfsmAutomaton *fsm=NULL;
- gfsmError *err=NULL;
- gfsmArcTableIndex *ix=NULL;
- gfsmArcLabelIndex *lx=NULL;
-
- if (argc > 1) { infilename = argv[1]; }
-
- //-- load automaton
- fprintf(stderr, "%s: loading file: '%s'... ", prog,infilename); fflush(stderr);
- fsm = gfsm_automaton_new();
- if ( !(gfsm_automaton_load_bin_filename(fsm,infilename,&err)) ) {
- fprintf(stderr, "FAILED: %s\n", (err ? err->message : "?"));
- exit(1);
- }
- fprintf(stderr, "loaded.\n"); fflush(stderr);
-
- //-- ArcTableIndex
- fprintf(stderr, "%s: creating ArcTableIndex... ", prog); fflush(stderr);
- if ( !(ix = gfsm_automaton_to_arc_table_index(fsm,ix)) ) {
- fprintf(stderr, "FAILED\n");
- exit(2);
- }
- fprintf(stderr, "created.\n"); fflush(stderr);
- //
- //-- sort table (todo: check for existing sort mode?!)
- fprintf(stderr, "%s: sorting ArcTableIndex (priority sort)... ", prog); fflush(stderr);
- gfsm_arc_table_index_priority_sort(ix,gfsmASP_LW,fsm->sr);
- fprintf(stderr, "sorted.\n"); fflush(stderr);
-
- //-- ArcLabelIndex
- fprintf(stderr, "%s: creating ArcLabelIndex... ", prog); fflush(stderr);
- if ( !(lx = gfsm_automaton_to_arc_label_index_lower(fsm,lx)) ) {
- fprintf(stderr, "FAILED\n");
- exit(3);
- }
- fprintf(stderr, "created.\n"); fflush(stderr);
-
- //-- cleanup
- fprintf(stderr, "%s: cleanup... ", prog); fflush(stderr);
- gfsm_automaton_free(fsm);
- gfsm_arc_table_index_free(ix);
- gfsm_arc_label_index_free(lx);
- fprintf(stderr, "done.\n"); fflush(stderr);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/arytest.c b/gfsm/gfsm/src/libgfsm/tests/arytest.c
deleted file mode 100644
index d766b89..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/arytest.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-
-int main (void) {
- GPtrArray *a;
- gpointer p;
- g_mem_set_vtable(glib_mem_profiler_table);
-
- printf("<PROF:1>--------\n");
-
-
- a = g_ptr_array_sized_new(128);
- g_ptr_array_set_size(a,1024);
- p = g_ptr_array_free(a,TRUE);
- printf("p=ptr_array_free()=%p\n", p);
-
- printf("<CHUNKS:1>--------\n");
- //g_mem_chunk_info();
-
- //printf("<CHUNKS:2>--------\n");
- g_blow_chunks();
- //g_mem_chunk_info();
-
- printf("<PROF:2>--------\n");
- g_mem_profile();
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/arytest2.c b/gfsm/gfsm/src/libgfsm/tests/arytest2.c
deleted file mode 100644
index ebef7f5..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/arytest2.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-void print_array(const char *label, GArray *a) {
- int i;
- printf("Array %s: {", label);
- for (i=0; i < a->len; i++) {
- printf(" %d", g_array_index(a,int,i));
- }
- printf(" }\n");
-}
-
-gint compare_int(int *x, int *y) {
- return (*x)-(*y);
- //return (*x < *y ? -1 : (*x > *y ? 1 : 0));
-}
-
-int main (int argc, char **argv) {
- GArray *a1, *a2;
- int i, val;
-
- a1 = g_array_new(FALSE, TRUE, sizeof(int));
- a2 = g_array_new(FALSE, TRUE, sizeof(int));
- for (i=1; i < argc; i++) {
- val = strtol(argv[i],NULL,10);
- g_array_append_val(a1,val);
- }
- print_array("a1", a1);
-
- //-- insert(0,0)
- val = 0;
- g_array_insert_val(a1,0,val);
- printf("--\n");
- print_array("a1/insert(0,0)",a1);
-
- //-- copy a1 into a2
- g_array_append_vals(a2,a1->data,a1->len);
- print_array("a2", a2);
- printf("--\n");
-
- //-- move elements of a1 up one notch
- /*-- NOT ok
- g_array_insert_vals(a1, 1, a1->data, a1->len-1);
- g_array_index(a1,int,0) = 0;
- */
-
- /*-- ok */
- i = 0;
- g_array_insert_val(a1,0,i);
- print_array("a1/moved", a1);
- printf("--\n");
-
- //-- sort
- //g_array_sort(a1,NULL); //-- NOT ok
- g_array_sort(a1,(GCompareFunc)compare_int); //-- ok
- print_array("a1/sorted", a1);
-
- g_array_free(a1,TRUE);
- g_array_free(a2,TRUE);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/asciigen.perl b/gfsm/gfsm/src/libgfsm/tests/asciigen.perl
deleted file mode 100755
index 1cabeb9..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/asciigen.perl
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/perl -w
-
-@ascii = (ord('A')..ord('Z'),
- ord('a')..ord('z'),
- ord('!')..ord('/'),
- ord('0')..ord('9'),
- ord(':')..ord('?'));
-
-foreach $c (@ascii) {
- print chr($c);
-}
-print "\n";
-
-foreach $c (161..255) {
- printf("\\%o", $c);
-}
-print "\n";
diff --git a/gfsm/gfsm/src/libgfsm/tests/bvtest.c b/gfsm/gfsm/src/libgfsm/tests/bvtest.c
deleted file mode 100644
index 3cf190a..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/bvtest.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <gfsm.h>
-
-int main (int argc, char **argv) {
- int i;
- guint bit;
- gfsmBitVector *bv = gfsm_bitvector_new();
-
- for (i = 0; i <= 16 ; i++) {
- printf("\t%d bits ~= %d bytes @ %d\n",
- i, _gfsm_bitvector_bits2bytes(i), i%8);
- }
-
- for (i = 1; i < argc; i++) {
- sscanf(argv[i], "%u", &bit);
- printf("%s: setting bit=%u : bit2byte=%u\n", *argv, bit, _gfsm_bitvector_bits2bytes(bit));
- gfsm_bitvector_set(bv,bit,1);
- }
-
- printf("%s: vector [bytes=%u ; bits=%u] =\n",
- *argv, bv->len, gfsm_bitvector_size(bv));
- for (bit = 0; bit < gfsm_bitvector_size(bv); bit++) {
- if ((bit%8)==0) fputc(' ', stdout);
- fputc((gfsm_bitvector_get(bv,bit) ? '1' : '0'), stdout);
- }
- printf("\n");
-
- gfsm_bitvector_free(bv);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/calc2test.l b/gfsm/gfsm/src/libgfsm/tests/calc2test.l
deleted file mode 100644
index 7072a4c..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/calc2test.l
+++ /dev/null
@@ -1,56 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="calc2test.lex.c"
-%option header-file="calc2test.lex.h"
-%option prefix="calc2test_yy"
-%option reentrant
-%option 8bit
-%option yylineno
-
-%option bison-bridge
-
-%{
-/*======================================================================
- * User C Header
- */
-
-/* bison stuff */
-#include <gfsmScanner.h>
-#include "calc2test.tab.h"
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-
-/*======================================================================
- * Flex Rules
- */
-%%
-
-([[:digit:]]*\.?)[[:digit:]]+ { yylval->dbl = strtod(yytext,NULL); return NUMBER;}
-
-\( { return LPAREN; }
-\) { return RPAREN; }
-\+ { return PLUS; }
-\- { return MINUS; }
-\* { return TIMES; }
-\/ { return DIV; }
-
-\n { return NEWLINE; }
-
-[[:space:]] { /* ignore */ }
-
-. { return OTHER; /* ignore */ }
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-//-- wrapper: use default
-GFSM_SCANNER_YYWRAP(calc2test_yy)
diff --git a/gfsm/gfsm/src/libgfsm/tests/calc2test.y b/gfsm/gfsm/src/libgfsm/tests/calc2test.y
deleted file mode 100644
index 4754613..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/calc2test.y
+++ /dev/null
@@ -1,89 +0,0 @@
-/*======================================================================
- * Bison Options
- */
-%pure_parser
-
-%{
-/*======================================================================
- * Bison C Header
- */
-#include <stdio.h>
-#include <gfsmScanner.h>
-#include "calc2test.tab.h"
-#include "calc2test.lex.h"
-
-typedef struct calc2testDataS {
- gfsmScanner scanner;
- double val;
-} calc2testData;
-
-#define YYLEX_PARAM ((calc2testData*)pparam)->scanner.yyscanner
-#define YYPARSE_PARAM pparam
-
-#define YYERROR_VERBOSE 1
-#define calc2test_yyerror(msg) \
- gfsm_scanner_carp((gfsmScanner*)pparam, (msg));
-
-%}
-
-/*======================================================================
- * Bison Definitions
- */
-%union {
- double dbl;
-}
-
-%token <dbl> NUMBER PLUS MINUS TIMES DIV LPAREN RPAREN NEWLINE OTHER
-%type <dbl> expr exprs
-
-%left PLUS MINUS
-%left TIMES DIV
-%nonassoc UMINUS
-
-/*======================================================================
- * Bison Rules
- */
-%%
-
-exprs: /* empty */
- { $$=0; }
- | exprs expr NEWLINE
- { printf("%g\n", $2); ((calc2testData*)pparam)->val=$$=$2; }
- ;
-
-expr: LPAREN expr RPAREN { $$=$2; }
- | MINUS expr { $$=-$2; }
- | expr TIMES expr { $$=$1*$3; }
- | expr DIV expr { $$=$1/$3; }
- | expr PLUS expr { $$=$1+$3; }
- | expr MINUS expr %prec UMINUS { $$=$1-$3; }
- | NUMBER { $$=$1; }
- ;
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-void calc2test_yyerror_func(const char *msg)
-{
- fprintf(stderr, "yyerror: %s\n", msg);
-}
-
-
-int main (void) {
- calc2testData *pparams = g_new0(calc2testData,1);
- gfsm_scanner_init((gfsmScanner*)pparams, "calctest2Scanner", calc2test_yy);
-
- calc2test_yyparse(pparams);
- if (pparams->scanner.err) {
- fprintf(stderr, "Error: %s\n", pparams->scanner.err->message);
- }
-
- printf("Final calctest value=%g\n", pparams->val);
-
- gfsm_scanner_free((gfsmScanner*)pparams);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/calctest.l b/gfsm/gfsm/src/libgfsm/tests/calctest.l
deleted file mode 100644
index 1a03bc1..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/calctest.l
+++ /dev/null
@@ -1,52 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="calctest.lex.c"
-%option header-file="calctest.lex.h"
-%option prefix="calctest_yy"
-%option reentrant
-%option 8bit
-
-%option bison-bridge
-
-%{
-/*======================================================================
- * User C Header
- */
-
-/* bison stuff */
-#include "calctest.tab.h"
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-
-/*======================================================================
- * Flex Rules
- */
-%%
-
-([[:digit:]]*\.?)[[:digit:]]+ { yylval->dbl = strtod(yytext,NULL); return NUMBER;}
-
-\( { return LPAREN; }
-\) { return RPAREN; }
-\+ { return PLUS; }
-\- { return MINUS; }
-\* { return TIMES; }
-\/ { return DIV; }
-
-\n { return NEWLINE; }
-
-. { return OTHER; /* ignore */ }
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-//-- wrapper: don't
-int calctest_yywrap(yyscan_t yyscanner) { return 1; }
diff --git a/gfsm/gfsm/src/libgfsm/tests/calctest.y b/gfsm/gfsm/src/libgfsm/tests/calctest.y
deleted file mode 100644
index befec0e..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/calctest.y
+++ /dev/null
@@ -1,118 +0,0 @@
-/*======================================================================
- * Bison Options
- */
-%pure_parser
-
-%{
-/*======================================================================
- * Bison C Header
- */
-#include <stdio.h>
-#include <stdarg.h>
-#include "calctest.tab.h"
-#include "calctest.lex.h"
-
-typedef struct _yyparse_param {
- char *name;
- char *filename;
- yyscan_t scanner;
- float val;
-} yyparseParam;
-
-#define YYLEX_PARAM ((yyparseParam*)pparam)->scanner
-#define YYPARSE_PARAM pparam
-
-extern void calctest_yyerror(const char *msg);
-extern void calctest_yycarp(yyparseParam *pparams, const char *fmt, ...);
-
-%}
-
-/*======================================================================
- * Bison Definitions
- */
-%union {
- double dbl;
-}
-
-%token <dbl> NUMBER PLUS MINUS TIMES DIV LPAREN RPAREN NEWLINE OTHER
-%type <dbl> expr exprs
-
-%left PLUS MINUS
-%left TIMES DIV
-%nonassoc UMINUS
-
-/*======================================================================
- * Bison Rules
- */
-%%
-
-exprs: /* empty */
- { $$=0; }
- | exprs expr NEWLINE
- { printf("%g\n", $2); ((yyparseParam*)pparam)->val=$$=$2; }
- ;
-
-expr: LPAREN expr RPAREN { $$=$2; }
- | MINUS expr { $$=-$2; }
- | expr TIMES expr { $$=$1*$3; }
- | expr DIV expr { $$=$1/$3; }
- | expr PLUS expr { $$=$1+$3; }
- | expr MINUS expr %prec UMINUS { $$=$1-$3; }
- | NUMBER { $$=$1; }
- | OTHER
- {
- calctest_yycarp((yyparseParam*)pparam, "Failed to parse expression");
- YYABORT;
- }
- ;
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-void calctest_yyerror(const char *msg)
-{
- fprintf(stderr, "yyerror: %s\n", msg);
-}
-
-void calctest_yycarp(yyparseParam *pparams, const char *fmt, ...)
-{
- va_list ap;
- fprintf(stderr, "%s: ", (pparams->name ? pparams->name : "calctest_parser"));
-
- va_start(ap,fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- fprintf(stderr, " in %s%s%s at line %u, column %u.\n",
- (pparams->filename ? "file \"" : ""),
- (pparams->filename ? pparams->filename : "input"),
- (pparams->filename ? "\"" : ""),
- calctest_yyget_lineno(pparams->scanner),
- calctest_yyget_column(pparams->scanner));
-}
-
-int main (void) {
- yyscan_t scanner;
- yyparseParam pparams;
-
- calctest_yylex_init(&scanner); //-- initialize reentrant flex scanner
-
- pparams.name = NULL;
- pparams.filename = NULL;
- //--
- //pparams.name = "myParser";
- //pparams.filename = "(stdin)";
-
- pparams.scanner = scanner;
-
- calctest_yyparse(&pparams);
-
- calctest_yylex_destroy(pparams.scanner); //-- cleanup reentrant flex scanner
-
- printf("Final calctest value=%g\n", pparams.val);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/commatest.c b/gfsm/gfsm/src/libgfsm/tests/commatest.c
deleted file mode 100644
index b704970..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/commatest.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdio.h>
-
-int main (void) {
- int x = 0;
-
- x = 1, printf("foo\n"), printf("bar\n"), x=2, printf("%d\n", x);
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/compre2test.c b/gfsm/gfsm/src/libgfsm/tests/compre2test.c
deleted file mode 100644
index 07d2b07..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/compre2test.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <gfsmRegexCompiler.h>
-#include <gfsmAutomatonIO.h>
-
-
-/*======================================================================
- * User C Code
- */
-
-int main (int argc, char **argv) {
- gfsmRegexCompiler *rec = gfsm_regex_compiler_new();
- gfsmAutomaton *fsm = NULL;
-
- //-- initialization
- rec->abet = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(rec->abet, "test.lab", &(rec->scanner.err))) {
- g_printerr("%s: load failed for labels file '%s': %s\n",
- *argv, "test.lab", (rec->scanner.err ? rec->scanner.err->message : "?"));
- exit(2);
- }
-
- //-- debug: lexer
- rec->scanner.emit_warnings = TRUE;
-
- //-- parse
- fsm = gfsm_regex_compiler_parse(rec);
-
- //-- sanity check
- if (rec->scanner.err) {
- fprintf(stderr, "%s: %s\n", *argv, rec->scanner.err->message);
- }
-
- if (fsm) {
- gfsm_automaton_save_bin_file(fsm, stdout, NULL);
- } else {
- fprintf(stderr, "%s: Error: no fsm!\n", *argv);
- }
-
- gfsm_regex_compiler_free(rec,TRUE,TRUE);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/comprelex.l b/gfsm/gfsm/src/libgfsm/tests/comprelex.l
deleted file mode 100644
index b82178d..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/comprelex.l
+++ /dev/null
@@ -1,297 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="comprelex.lex.c"
-%option header-file="comprelex.lex.h"
-%option prefix="compretest_yy"
-%option reentrant
-%option 8bit
-%option yylineno
-
-%{
-/*======================================================================
- * User C Header
- */
-
-#include <gfsmRegexCompiler.h>
-//#include "compretest.tab.h"
-
-#define my_compiler ((gfsmRegexCompiler*)yyextra)
-#define my_gstr (my_compiler->gstr)
-#define my_abet (my_compiler->abet)
-
-typedef enum {
- TOK_UNKNOWN =256,
- TOK_CHAR =257,
- TOK_STRING =258,
- TOK_WEIGHT =259,
- TOK_UINT =260,
- TOK_BRACKETED =261,
- TOK_EOF =262
-} TokenType;
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-DIGIT [0-9]
-SPACE [[:space:]]
-WCHAR [^\<\[\\ \t\n\r\#]
-BCHAR [^\\\]\ \t\n\r\=]
-UTF8PREFIX "Ã"
-
-%x STATE_ESCAPE
-%x STATE_BRACKETED
-%x STATE_BRACKETED_SEP
-%x STATE_BRACKETED_ESCAPE
-%x STATE_COMMENT
-%x STATE_WEIGHT
-%x STATE_UINT
-
-/*======================================================================
- * Rules
- */
-%%
-
-{UTF8PREFIX}+. {
- g_string_truncate(my_gstr,0);
- g_string_append_len(my_gstr,yytext,yyleng);
- return TOK_STRING;
-}
-
-"\\" { BEGIN(STATE_ESCAPE); }
-
-"#" { BEGIN(STATE_COMMENT); }
-
-"[" {
- BEGIN(STATE_BRACKETED);
- return '[';
-}
-
-"<" { BEGIN(STATE_WEIGHT); return '<'; }
-
-"(" { return '('; }
-")" { return ')'; }
-
-"*" { return '*'; }
-"+" { return '+'; }
-"^" { BEGIN(STATE_UINT); return '|'; }
-"?" { return '?'; }
-"!" { return '!'; }
-"|" { return '|'; }
-"&" { return '&'; }
-":" { return ':'; }
-"@" { return '@'; }
-"-" { return '-'; /*"/1"{return PROJ1;}*/ /*"/2"{return PROJ2;}*/ }
-
-"$" { return '$'; /* non-AT&T: determinize */ }
-"%" { return '%'; /* non-AT&T: rmepsilon */ }
-"~" { return '~'; /* non-AT&T: connect */ }
-
-{SPACE} { /* ignore */ }
-
-{WCHAR} {
- //yylval->u = gfsm_alphabet_find_label(my_abet, yytext);
- return TOK_CHAR;
-}
-
-
-
-<STATE_WEIGHT>([\+\-])?({DIGIT}*\.)?({DIGIT}+)([Ee]([\+\-]?){DIGIT}+)? {
- //yylval->w = strtod(yytext,NULL);
- return TOK_WEIGHT;
-}
-
-<STATE_WEIGHT>\> {
- BEGIN(INITIAL);
- return '>';
-}
-
-
-
-<STATE_UINT>{DIGIT}+ {
- BEGIN(INITIAL);
- //yylval->u = strtol(yytext,NULL,0);
- return TOK_UINT;
-}
-
-
-<STATE_COMMENT>[^\n]*\n { BEGIN(INITIAL); /* ignore comments */ }
-
-
-
-
-<STATE_ESCAPE>. {
- BEGIN(INITIAL);
- return TOK_CHAR;
-}
-
-
-
-<STATE_BRACKETED>{UTF8PREFIX}+. {
- g_string_append_len(my_gstr,yytext,yyleng);
-}
-<STATE_BRACKETED>{SPACE}*"]" {
- unput(']');
- BEGIN(STATE_BRACKETED_SEP);
- if (my_gstr->len) return TOK_STRING;
-}
-<STATE_BRACKETED>{BCHAR}+ {
- g_string_append(my_gstr, yytext);
- //return TOK_STRING;
-}
-<STATE_BRACKETED>({SPACE}*)"="({SPACE}*) {
- unput('=');
- BEGIN(STATE_BRACKETED_SEP);
- if (my_gstr->len) return TOK_STRING;
-}
-<STATE_BRACKETED>{SPACE}+ {
- unput(' ');
- BEGIN(STATE_BRACKETED_SEP);
- if (my_gstr->len) return TOK_STRING;
-}
-<STATE_BRACKETED>\\ {
- BEGIN(STATE_BRACKETED_ESCAPE);
-}
-
-
-<STATE_BRACKETED_SEP>"]" {
- BEGIN(INITIAL);
- if (my_gstr->len) {
- g_string_truncate(my_gstr,0);
- return ']';
- }
-}
-<STATE_BRACKETED_SEP>"=" {
- BEGIN(STATE_BRACKETED);
- g_string_truncate(my_gstr,0);
- return '=';
-}
-<STATE_BRACKETED_SEP>" " {
- BEGIN(STATE_BRACKETED);
- if (my_gstr->len) {
- g_string_truncate(my_gstr,0);
- return ' ';
- }
-}
-
-
-
-<STATE_BRACKETED_ESCAPE>. {
- BEGIN(STATE_BRACKETED);
- g_string_append_c(my_gstr, yytext[0]);
- //return TOK_STRING;
-}
-
-
-
-<*>. {
- gfsm_scanner_carp(yyextra, "bad character '%s'", yytext);
- return TOK_UNKNOWN;
-}
-
-<<EOF>> { return TOK_EOF; }
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-void testme(gfsmScanner *scanner) {
- TokenType tok;
- double weight;
- unsigned int uint;
-
- while ((tok=compretest_yylex(scanner->yyscanner)) != TOK_EOF) {
- switch (tok) {
- case TOK_CHAR:
- printf("(char) '%s'\n", compretest_yyget_text(scanner->yyscanner));
- break;
-
- case TOK_BRACKETED:
- printf("(bracketed) text=\"%s\" gstr=\"%s\"\n",
- compretest_yyget_text(scanner->yyscanner),
- ((gfsmRegexCompiler*)scanner)->gstr->str);
- break;
-
- case TOK_STRING:
- printf("(string) gstr=\"%s\"\n",
- //compretest_yyget_text(scanner->yyscanner),
- ((gfsmRegexCompiler*)scanner)->gstr->str
- );
- break;
-
- case '[':
- printf("(left-bracket) text=\"%s\"\n", compretest_yyget_text(scanner->yyscanner));
- break;
-
- case ']':
- printf("(right-bracket) text=\"%s\"\n", compretest_yyget_text(scanner->yyscanner));
- break;
-
- case ' ':
- printf("(space) text=\"%s\"\n", compretest_yyget_text(scanner->yyscanner));
- break;
-
- case '=':
- printf("(equal) text=\"%s\"\n", compretest_yyget_text(scanner->yyscanner));
- break;
-
- case TOK_WEIGHT:
- weight = strtod(compretest_yyget_text(scanner->yyscanner),NULL);
- printf("(weight) =%g\n", weight);
- break;
-
- case TOK_UINT:
- uint = strtol(compretest_yyget_text(scanner->yyscanner),NULL,0);
- printf("(uint) =%d\n", uint);
- break;
-
- default:
- printf("(other=%d~'%c'): (%s)\n", tok, tok, compretest_yyget_text(scanner->yyscanner));
- break;
- }
-
- if (scanner->err) {
- fprintf(stderr, "Error: %s\n", scanner->err->message);
- g_clear_error(&(scanner->err));
- break;
- }
- }
-}
-
-int main(int argc,char **argv) {
- gfsmRegexCompiler *reparser = g_new0(gfsmRegexCompiler,1);
- gfsm_scanner_init((gfsmScanner*)reparser, "gfsmRegexCompiler", compretest_yy);
-
- //-- initialization
- reparser->srtype = gfsmSRTTropical;
- reparser->gstr = g_string_new("");
- reparser->abet = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(reparser->abet, "test.lab", &(reparser->scanner.err))) {
- g_printerr("%s: load failed for labels file '%s': %s\n",
- *argv, "test.lab", (reparser->scanner.err ? reparser->scanner.err->message : "?"));
- exit(2);
- }
-
- //-- debug: lexer
- reparser->scanner.emit_warnings = TRUE;
-
- //-- lex
- testme((gfsmScanner*)reparser);
-
- //-- sanity check
- if (reparser->scanner.err) {
- fprintf(stderr, "Error: %s\n", reparser->scanner.err->message);
- }
-
- gfsm_scanner_free((gfsmScanner*)reparser);
-
- return 0;
-}
-
-
-GFSM_SCANNER_YYWRAP(compretest_yy)
diff --git a/gfsm/gfsm/src/libgfsm/tests/compretest.l b/gfsm/gfsm/src/libgfsm/tests/compretest.l
deleted file mode 100644
index 731655c..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/compretest.l
+++ /dev/null
@@ -1,199 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="compretest.lex.c"
-%option header-file="compretest.lex.h"
-%option prefix="compretest_yy"
-%option reentrant
-%option 8bit
-%option yylineno
-
-%option bison-bridge
-
-%{
-/*======================================================================
- * User C Header
- */
-
-#include <gfsmMem.h>
-#include <gfsmRegexCompiler.h>
-#include "compretest.tab.h"
-
-#define my_compiler ((gfsmRegexCompiler*)yyextra)
-#define my_gstr (my_compiler->gstr)
-#define my_abet (my_compiler->abet)
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-DIGIT [0-9]
-SPACE [[:space:]]
-WCHAR [^\<\[\\ \t\n\r\#]
-BCHAR [^\\\]\ \t\n\r\=]
-UTF8PREFIX "Ã"
-
-%x STATE_ESCAPE
-%x STATE_BRACKETED
-%x STATE_BRACKETED_SEP
-%x STATE_BRACKETED_ESCAPE
-%x STATE_COMMENT
-%x STATE_WEIGHT
-%x STATE_UINT
-
-/*======================================================================
- * Rules
- */
-%%
-
-{UTF8PREFIX}+. {
- yylval->gs = gfsm_gstring_new_bytes(yytext,yyleng);
- return TOK_STRING;
-}
-
-"\\" { BEGIN(STATE_ESCAPE); }
-
-"#" { BEGIN(STATE_COMMENT); }
-
-"[" {
- BEGIN(STATE_BRACKETED);
- return '[';
-}
-
-"<" { BEGIN(STATE_WEIGHT); return '<'; }
-
-"(" { return '('; }
-")" { return ')'; }
-
-"*" { return '*'; }
-"+" { return '+'; }
-"^" { BEGIN(STATE_UINT); return '|'; }
-"?" { return '?'; }
-"!" { return '!'; }
-"|" { return '|'; }
-"&" { return '&'; }
-":" { return ':'; }
-"@" { return '@'; }
-"-" { return '-'; /*"/1"{return PROJ1;}*/ /*"/2"{return PROJ2;}*/ }
-
-"$" { return '$'; /* non-AT&T: determinize */ }
-"%" { return '%'; /* non-AT&T: rmepsilon */ }
-"~" { return '~'; /* non-AT&T: connect */ }
-
-{SPACE} { /* ignore */ }
-
-{WCHAR} {
- yylval->c = yytext[0];
- return TOK_CHAR;
-}
-
-
-
-<STATE_WEIGHT>([\+\-])?({DIGIT}*\.)?({DIGIT}+)([Ee]([\+\-]?){DIGIT}+)? {
- yylval->w = strtod(yytext,NULL);
- return TOK_WEIGHT;
-}
-
-<STATE_WEIGHT>\> {
- BEGIN(INITIAL);
- return '>';
-}
-
-
-
-<STATE_UINT>{DIGIT}+ {
- BEGIN(INITIAL);
- yylval->u = strtol(yytext,NULL,0);
- return TOK_UINT;
-}
-
-
-<STATE_COMMENT>[^\n]*\n { BEGIN(INITIAL); /* ignore comments */ }
-
-
-
-
-<STATE_ESCAPE>. {
- BEGIN(INITIAL);
- yylval->c = yytext[0];
- return TOK_CHAR;
-}
-
-
-<STATE_BRACKETED>{UTF8PREFIX}+. {
- g_string_append_len(my_gstr,yytext,yyleng);
-}
-<STATE_BRACKETED>{SPACE}*"]" {
- unput(']');
- BEGIN(STATE_BRACKETED_SEP);
- if (my_gstr->len) {
- yylval->gs = gfsm_gstring_dup(my_gstr);
- return TOK_STRING;
- }
-}
-<STATE_BRACKETED>{BCHAR}+ {
- g_string_append(my_gstr, yytext);
-}
-<STATE_BRACKETED>({SPACE}*)"="({SPACE}*) {
- unput('=');
- BEGIN(STATE_BRACKETED_SEP);
- if (my_gstr->len) {
- yylval->gs = gfsm_gstring_dup(my_gstr);
- return TOK_STRING;
- }
-}
-<STATE_BRACKETED>{SPACE}+ {
- unput(' ');
- BEGIN(STATE_BRACKETED_SEP);
- if (my_gstr->len) {
- yylval->gs = gfsm_gstring_dup(my_gstr);
- return TOK_STRING;
- }
-}
-<STATE_BRACKETED>\\ {
- BEGIN(STATE_BRACKETED_ESCAPE);
-}
-
-
-<STATE_BRACKETED_SEP>"]" {
- BEGIN(INITIAL);
- if (my_gstr->len) {
- g_string_truncate(my_gstr,0);
- return ']';
- }
-}
-<STATE_BRACKETED_SEP>"=" {
- BEGIN(STATE_BRACKETED);
- g_string_truncate(my_gstr,0);
- return '=';
-}
-<STATE_BRACKETED_SEP>" " {
- BEGIN(STATE_BRACKETED);
- if (my_gstr->len) {
- g_string_truncate(my_gstr,0);
- return ' ';
- }
-}
-
-
-<STATE_BRACKETED_ESCAPE>. {
- BEGIN(STATE_BRACKETED);
- g_string_append_c(my_gstr, yytext[0]);
-}
-
-
-
-<*>. {
- gfsm_scanner_carp(yyextra, "bad character '%s'", yytext);
- return TOK_UNKNOWN;
-}
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-GFSM_SCANNER_YYWRAP(compretest_yy)
diff --git a/gfsm/gfsm/src/libgfsm/tests/compretest.y b/gfsm/gfsm/src/libgfsm/tests/compretest.y
deleted file mode 100644
index d55f488..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/compretest.y
+++ /dev/null
@@ -1,185 +0,0 @@
-/*======================================================================
- * Bison Options
- */
-%pure_parser
-
-%{
-/*======================================================================
- * Bison C Header
- */
-#include <gfsmRegexCompiler.h>
-#include <gfsmAutomatonIO.h>
-
-#include "compretest.tab.h"
-#include "compretest.lex.h"
-
-#define my_compiler ((gfsmRegexCompiler*)reparser)
-
-#define YYLEX_PARAM ((gfsmRegexCompiler*)reparser)->scanner.yyscanner
-#define YYPARSE_PARAM reparser
-
-#define YYERROR_VERBOSE 1
-#define compretest_yyerror(msg) \
- gfsm_scanner_carp((gfsmScanner*)reparser, (msg));
-
-%}
-
-/*======================================================================
- * Bison Definitions
- */
-%union {
- gfsmAutomaton *fsm; //-- automaton
- GString *gs; //-- needs to be freed by hand
- gchar c;
- guint32 u;
- gfsmWeight w;
-}
-
-%token <c> TOK_UNKNOWN TOK_CHAR
-%token <u> TOK_UINT
-%token <gs> TOK_STRING
-%token <w> TOK_WEIGHT
-
-%type <u> label
-%type <w> weight
-%type <fsm> regex
-
-/*
-empty { $$=gfsm_regex_automaton_epsilon(my_compiler); }
-*/
-
-/*
- | gfsmRETChar %prec LAB
- { $$=gfsm_regex_automaton_lab(my_compiler, $1); }
-*/
-
-// -- Operator precedence and associativity
-%left CONCAT
-%left LABCONCAT
-%left WEIGHT
-%right '%' //-- non-AT&T: rmepsilon: % REGEX
-%right '$' //-- non-AT&T: determinize: $ REGEX
-%right '~' //-- non-AT&T: connect: ~ REGEX
-%left '*' '+' '?' '^'
-%right '!'
-%left '@'
-%left ':'
-%left '-'
-%left '&'
-%left '|'
-
-/*======================================================================
- * Bison Rules
- */
-%%
-
-regex: '('regex ')'
- { $$=$2; }
-
- | label
- { $$=gfsm_regex_compiler_label_fsm(my_compiler, $1); }
-
- | label regex %prec LABCONCAT
- { $$=gfsm_regex_compiler_prepend_lab(my_compiler, $1, $2); }
-
- | regex regex %prec CONCAT
- { $$=gfsm_regex_compiler_concat(my_compiler, $1, $2); }
-
- | '%' regex
- { $$=gfsm_regex_compiler_rmepsilon(my_compiler, $2); /* non-ATT */ }
-
- | '$' regex
- { $$=gfsm_regex_compiler_determinize(my_compiler, $2); /* non-ATT */ }
-
- | '~' regex
- { $$=gfsm_regex_compiler_connect(my_compiler, $2); /* non-ATT */ }
-
- | regex '*'
- { $$=gfsm_regex_compiler_closure(my_compiler,$1,FALSE); }
-
- | regex '+'
- { $$=gfsm_regex_compiler_closure(my_compiler,$1,TRUE); }
-
- | regex '^' TOK_UINT
- { $$=gfsm_regex_compiler_power(my_compiler,$1,$3); }
-
- | regex '?'
- { $$=gfsm_regex_compiler_optional(my_compiler,$1); }
-
- | '!' regex
- { $$=gfsm_regex_compiler_complement(my_compiler,$2); }
-
- | regex '|' regex
- { $$=gfsm_regex_compiler_union(my_compiler,$1,$3); }
-
- | regex '&' regex
- { $$=gfsm_regex_compiler_intersect(my_compiler,$1,$3); }
-
- | regex ':' regex
- { $$=gfsm_regex_compiler_product(my_compiler,$1,$3); }
-
- | regex '@' regex
- { $$=gfsm_regex_compiler_compose(my_compiler,$1,$3); }
-
- | regex '-' regex
- { $$=gfsm_regex_compiler_difference(my_compiler,$1,$3); }
-
- | regex weight %prec WEIGHT
- { $$=gfsm_regex_compiler_weight(my_compiler,$1,$2); }
- ;
-
-label: TOK_CHAR
- { $$=gfsm_regex_compiler_char2label(my_compiler, $1); }
-
- | TOK_STRING
- { $$=gfsm_regex_compiler_gstring2label(my_compiler, $1); }
-
- | '[' TOK_STRING ']'
- { $$=gfsm_regex_compiler_gstring2label(my_compiler, $2); }
- ;
-
-weight: '<' TOK_WEIGHT '>' { $$=$2; }
- ;
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-int main (int argc, char **argv) {
- gfsmRegexCompiler *reparser = g_new0(gfsmRegexCompiler,1);
- gfsm_scanner_init((gfsmScanner*)reparser, "gfsmRegexCompiler", compretest_yy);
-
-
- //-- initialization
- reparser->srtype = gfsmSRTTropical;
- reparser->gstr = g_string_new("");
- reparser->abet = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(reparser->abet, "test.lab", &(reparser->scanner.err))) {
- g_printerr("%s: load failed for labels file '%s': %s\n",
- *argv, "test.lab", (reparser->scanner.err ? reparser->scanner.err->message : "?"));
- exit(2);
- }
-
- //-- debug: lexer
- reparser->scanner.emit_warnings = TRUE;
-
- //-- parse
- compretest_yyparse(reparser);
-
- //-- sanity check
- if (reparser->scanner.err) {
- fprintf(stderr, "%s: %s\n", *argv, reparser->scanner.err->message);
- }
-
- if (reparser->fsm) {
- gfsm_automaton_save_bin_file(reparser->fsm, stdout, NULL);
- } else {
- fprintf(stderr, "%s: Error: no fsm!\n", *argv);
- }
-
- gfsm_scanner_free((gfsmScanner*)reparser);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/ctest.c b/gfsm/gfsm/src/libgfsm/tests/ctest.c
deleted file mode 100644
index 78d9002..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/ctest.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-
-typedef struct testme_s {
- int i : 1;
- int j : 1;
- int k : 1;
-} testme_t;
-
-int main (void) {
- int x,y,z;
- float f = +inf;
- printf("sizeof(testme_t)=%u\n", sizeof(testme_t));
-
- z = (x=42,y=24,17);
- printf ("z = (x=42,y=24) = %d\n", z);
- printf("f = %g\n", f);
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/dettest.c b/gfsm/gfsm/src/libgfsm/tests/dettest.c
deleted file mode 100644
index 278535c..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/dettest.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <gfsm.h>
-#include <stdio.h>
-
-int main (void) {
- gfsmAutomaton *fsm = gfsm_automaton_new();
-
- printf("##-- determinize()-1...\n");
- gfsm_automaton_determinize(fsm);
- gfsm_automaton_print_file(fsm,stdout,NULL);
-
- printf("##-- determinize()-2...\n");
- gfsm_automaton_determinize(fsm);
- gfsm_automaton_print_file(fsm,stdout,NULL);
-
- printf("##-- determinize()-3...\n");
- gfsm_automaton_determinize(fsm);
- gfsm_automaton_print_file(fsm,stdout,NULL);
-
- printf("done.\n");
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/flex2test.l b/gfsm/gfsm/src/libgfsm/tests/flex2test.l
deleted file mode 100644
index b81e7f7..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/flex2test.l
+++ /dev/null
@@ -1,174 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="flex2test.lex.c"
-%option header-file="flex2test.lex.h"
-%option prefix="testme_yy"
-%option reentrant
-%option 8bit
-%option yylineno
-
-%{
-/*======================================================================
- * User C Header
- */
-
-#include <gfsm.h>
-
-typedef enum {
- T_EOF,
- T_CHAR,
- T_STRING,
- T_WEIGHT,
-
- T_OP_PROJ_1,
- T_OP_PROJ_2,
- T_OP_STAR,
- T_OP_PLUS,
- T_OP_POWER, //-- "^n"
- T_OP_MINUS,
- T_OP_OPTIONAL,
- T_OP_UNION,
- T_OP_COMPLEMENT,
- T_OP_INTERSECT,
- T_OP_PRODUCT,
- T_OP_COMPOSE,
-
- T_LPAREN,
- T_RPAREN,
- T_LBRACKET,
- T_RBRACKET,
-
- T_EQUAL,
- T_SEMICOLON, //-- semicolon
-
- T_OTHER
-} TokenType;
-
-#define GSTR_BUF ((GString*)((gfsmScanner*)yyextra)->data)
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-DIGIT [0-9]
-SPACE [[:space:]]
-WCHAR [^\\\[ \t\n\r\#\<]
-SCHAR [^\\\]]
-
-%x ESCAPE STRING SESCAPE COMMENT WEIGHT
-
-/*======================================================================
- * Rules
- */
-%%
-
-<INITIAL>{WCHAR} { return T_CHAR; }
-
-<INITIAL>{SPACE} { /* ignore */ }
-
-<INITIAL># { BEGIN(COMMENT); }
-
-<INITIAL>\\ { BEGIN(ESCAPE); }
-
-<INITIAL>\[ { BEGIN(STRING); GSTR_BUF->len = 0; }
-
-<INITIAL>\< { BEGIN(WEIGHT); }
-
-
-
-<WEIGHT>[^\>]+ { return WEIGHT; /* hack */ }
-
-<WEIGHT>\> { BEGIN(INITIAL); }
-
-
-
-<COMMENT>[^\n]*\n { BEGIN(INITIAL); }
-
-
-
-
-<ESCAPE>. { BEGIN(INITIAL); return T_CHAR; }
-
-
-
-
-<STRING>\] { BEGIN(INITIAL); return T_STRING; }
-
-<STRING>{SCHAR} { g_string_append_c(GSTR_BUF, yytext[0]); }
-
-<STRING>\\ { BEGIN(SESCAPE); }
-
-
-
-<SESCAPE>. { BEGIN(STRING); g_string_append_c(GSTR_BUF, yytext[0]); }
-
-
-
-<<EOF>> { return T_EOF; }
-
-
-<*>. {
- gfsm_scanner_carp(yyextra, "bad character '%s'", yytext);
- return T_OTHER;
-}
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-void testme(gfsmScanner *scanner) {
- TokenType tok;
- double weight;
-
- while ((tok=testme_yylex(scanner->yyscanner)) != T_EOF) {
- switch (tok) {
- case T_CHAR:
- printf("(char) '%s'\n", testme_yyget_text(scanner->yyscanner));
- break;
- case STRING:
- printf("(string) \"%s\"\n", ((GString*)scanner->data)->str);
- break;
- case WEIGHT:
- weight = strtod(testme_yyget_text(scanner->yyscanner),NULL);
- printf("(weight) %g\n", weight);
- break;
- default:
- printf("(other=%d): (%s)\n", tok, testme_yyget_text(scanner->yyscanner));
- break;
- }
-
- if (scanner->err) {
- fprintf(stderr, "Error: %s\n", scanner->err->message);
- g_clear_error(&(scanner->err));
- break;
- }
- }
-}
-
-int main(void) {
- gfsmScanner *scanner = gfsm_scanner_new("myScanner",testme_yy);
- scanner->data = g_string_new("");
-
- //-- first, scan a string
- /*
- gfsm_scanner_scan_string(scanner, "line 1\nline 2\nline 3.");
- scanner->filename = g_strdup("string");
- testme(scanner);
- */
-
- //-- now scan stdin
- gfsm_scanner_scan_filename(scanner, "-");
- testme(scanner);
-
- gfsm_scanner_free(scanner);
-
- return 0;
-}
-
-//int testme_yywrap(yyscan_t yyscanner) { return 1; }
-GFSM_SCANNER_YYWRAP(testme_yy)
diff --git a/gfsm/gfsm/src/libgfsm/tests/flex3test.l b/gfsm/gfsm/src/libgfsm/tests/flex3test.l
deleted file mode 100644
index 27c1cc1..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/flex3test.l
+++ /dev/null
@@ -1,232 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="flex3test.lex.c"
-%option header-file="flex3test.lex.h"
-%option prefix="testme_yy"
-%option reentrant
-%option 8bit
-%option yylineno
-
-%{
-/*======================================================================
- * User C Header
- */
-
-#include <gfsm.h>
-
-typedef enum {
- T_EOF = 256,
- T_CHAR = 257,
- T_BRACKETED = 258,
- T_BSPACE = 259,
- T_WEIGHT = 260,
- T_UINT = 261,
- T_UTF8 = 262,
-
- T_LPAREN = '(',
- T_RPAREN = ')',
- T_LBRACKET = '[',
- T_RBRACKET = ']',
- T_LANGLE = '<',
- T_RANGLE = '>',
-
- T_BEQUAL = '=',
-
- T_OTHER = 65535
-} TokenType;
-
-#define GSTR_BUF ((GString*)((gfsmScanner*)yyextra)->data)
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-DIGIT [0-9]
-SPACE [[:space:]]
-WCHAR [^\<\>\[\]\\ \t\n\r\#]
-BCHAR [^\\\]\ \t\n\r\=]
-UTF8PREFIX "Ã"
-
-%x ESCAPE BRACKETED BESCAPE COMMENT WEIGHT UINT UTF8 BUTF8
-
-/*======================================================================
- * Rules
- */
-%%
-
-{UTF8PREFIX} { BEGIN(UTF8); g_string_set_size(GSTR_BUF,1); GSTR_BUF->str[0] = yytext[0]; }
-
-"\\" { BEGIN(ESCAPE); }
-
-"#" { BEGIN(COMMENT); }
-
-"[" { BEGIN(BRACKETED); g_string_truncate(GSTR_BUF,0); return T_LBRACKET; }
-
-"<" { BEGIN(WEIGHT); return T_LANGLE; }
-
-
-"(" { return '('; }
-")" { return ')'; }
-
-"*" { return '*'; }
-"+" { return '+'; }
-"^" { BEGIN(UINT); return '|'; }
-"?" { return '?'; }
-"!" { return '!'; }
-"|" { return '|'; }
-"&" { return '&'; }
-":" { return ':'; }
-"@" { return '@'; }
-"-" { return '-'; }
-
-{SPACE} { /* ignore */ }
-
-{WCHAR} { return T_CHAR; }
-
-
-
-<UTF8>{UTF8PREFIX}+ { g_string_append(GSTR_BUF, yytext); }
-
-<UTF8>. { BEGIN(INITIAL); g_string_append_c(GSTR_BUF, yytext[0]); return T_UTF8; }
-
-
-<WEIGHT>([\+\-])?({DIGIT}*\.)?({DIGIT}+)([Ee]([\+\-]?){DIGIT}+)? { return T_WEIGHT; /* hack */ }
-
-<WEIGHT>\> { BEGIN(INITIAL); return T_RANGLE; }
-
-
-
-<UINT>{DIGIT}+ { BEGIN(INITIAL); return T_UINT; }
-
-
-<COMMENT>[^\n]*\n { BEGIN(INITIAL); /* ignore comments */ }
-
-
-
-
-<ESCAPE>. { BEGIN(INITIAL); return T_CHAR; }
-
-
-
-<BRACKETED>{UTF8PREFIX} { BEGIN(BUTF8); g_string_append_c(GSTR_BUF, yytext[0]); }
-
-<BRACKETED>\] { BEGIN(INITIAL); return T_RBRACKET; }
-
-<BRACKETED>{BCHAR} { g_string_append_c(GSTR_BUF, yytext[0]); }
-
-<BRACKETED>{SPACE} { return T_BSPACE; }
-
-<BRACKETED>"=" { return T_BEQUAL; }
-
-<BRACKETED>\\ { BEGIN(BESCAPE); }
-
-
-<BUTF8>{UTF8PREFIX}+ { g_string_append(GSTR_BUF, yytext); }
-
-<BUTF8>. { BEGIN(BRACKETED); g_string_append_c(GSTR_BUF, yytext[0]); }
-
-
-<BESCAPE>. { BEGIN(BRACKETED); g_string_append_c(GSTR_BUF, yytext[0]); }
-
-
-
-<<EOF>> { return T_EOF; }
-
-
-<*>. {
- gfsm_scanner_carp(yyextra, "bad character '%s'", yytext);
- return T_OTHER;
-}
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-void testme(gfsmScanner *scanner) {
- TokenType tok;
- double weight;
- unsigned int uint;
-
- while ((tok=testme_yylex(scanner->yyscanner)) != T_EOF) {
- switch (tok) {
- case T_CHAR:
- printf("(char) '%s'\n", testme_yyget_text(scanner->yyscanner));
- break;
-
- case T_UTF8:
- printf("(utf8) '%s'\n", ((GString*)scanner->data)->str);
- break;
-
- case T_LBRACKET:
- printf("(lbracket)\n");
- break;
-
- case T_RBRACKET:
- printf("(rbracket) gstr=\"%s\"\n", ((GString*)scanner->data)->str);
- g_string_truncate(((GString*)scanner->data),0);
- break;
- case T_BSPACE:
- printf("(bspace) gstr=\"%s\"\n", ((GString*)scanner->data)->str);
- g_string_truncate(((GString*)scanner->data),0);
- break;
- case T_BEQUAL:
- printf("(bequal) gstr=\"%s\"\n", ((GString*)scanner->data)->str);
- g_string_truncate(((GString*)scanner->data),0);
- break;
-
- case T_LANGLE:
- printf("(langle)\n");
- break;
- case T_RANGLE:
- printf("(rangle)\n");
- break;
- case T_WEIGHT:
- weight = strtod(testme_yyget_text(scanner->yyscanner),NULL);
- printf("(weight) =%g\n", weight);
- break;
-
- case T_UINT:
- uint = strtol(testme_yyget_text(scanner->yyscanner),NULL,0);
- printf("(uint) =%d\n", uint);
- break;
-
- default:
- printf("(other=%d~'%c'): (%s)\n", tok, tok, testme_yyget_text(scanner->yyscanner));
- break;
- }
-
- if (scanner->err) {
- fprintf(stderr, "Error: %s\n", scanner->err->message);
- g_clear_error(&(scanner->err));
- break;
- }
- }
-}
-
-int main(void) {
- gfsmScanner *scanner = gfsm_scanner_new("myScanner",testme_yy);
- scanner->data = g_string_new("");
-
- //-- first, scan a string
- /*
- gfsm_scanner_scan_string(scanner, "line 1\nline 2\nline 3.");
- scanner->filename = g_strdup("string");
- testme(scanner);
- */
-
- //-- now scan stdin
- gfsm_scanner_scan_filename(scanner, "-");
- testme(scanner);
-
- gfsm_scanner_free(scanner);
-
- return 0;
-}
-
-//int testme_yywrap(yyscan_t yyscanner) { return 1; }
-GFSM_SCANNER_YYWRAP(testme_yy)
diff --git a/gfsm/gfsm/src/libgfsm/tests/flextest.l b/gfsm/gfsm/src/libgfsm/tests/flextest.l
deleted file mode 100644
index c0d103d..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/flextest.l
+++ /dev/null
@@ -1,59 +0,0 @@
-/*======================================================================
- * Flex Options
- */
-%option outfile="flextest.c"
-%option header-file="flextest.h"
-%option prefix="testme_yy"
-%option reentrant
-%option 8bit
-
-%{
-/*======================================================================
- * User C Header
- */
-
-int nlines=0;
-
-%}
-
-/*======================================================================
- * Flex Definitions
- */
-
-
-/*======================================================================
- * Rules
- */
-%%
-
-\n { return 1; }
-
-<<EOF>> { return 0; }
-
-. { /* do nothing */; }
-
-%%
-
-/*======================================================================
- * User C Code
- */
-
-int main(void) {
- yyscan_t scanner;
- int nlines=0;
- int tok;
-
- testme_yylex_init(&scanner); //-- initialize reentrant flex scanner
-
- while ((tok=testme_yylex(scanner))) {
- //printf("tok=%d\n", tok);
- nlines++;
- }
-
- testme_yylex_destroy(scanner); //-- cleanup reentrant flex scanner
-
- printf("%d\n", nlines);
- return 0;
-}
-
-int testme_yywrap(yyscan_t yyscanner) { return 1; }
diff --git a/gfsm/gfsm/src/libgfsm/tests/ftest.c b/gfsm/gfsm/src/libgfsm/tests/ftest.c
deleted file mode 100644
index e571f31..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/ftest.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdio.h>
-#include <glib.h>
-
-int main (int argc, char **argv) {
- float f, f2;
- gpointer p;
- int i;
-
- for (i=1; i<argc; i++) {
- sscanf(argv[i], "%f", &f);
- p = (gpointer)(*((int*)(&f)));
- f2 = *((float*)(&p));
- printf("argv[i=%d]='%s' ; f=%g ; f->p=%p ; p->f=%g\n", i, argv[i], f, p, f2);
- }
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/gbtest.c b/gfsm/gfsm/src/libgfsm/tests/gbtest.c
deleted file mode 100644
index e0e406d..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gbtest.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-
-GArray *ary1;
-GArray *ary2;
-GArray *ary3;
-guint esize = 8;
-guint nelts = 128;
-
-int main (void) {
- int i;
-
- ary1 = g_array_sized_new(FALSE, TRUE, esize, nelts);
- ary2 = g_array_sized_new(FALSE, TRUE, esize, nelts);
- ary3 = g_array_sized_new(FALSE, TRUE, esize, nelts);
-
- for (i=0; i < 128; i++) {
- g_array_free(ary2,TRUE);
- ary2 = g_array_sized_new(FALSE,TRUE,esize,nelts*i);
- }
-
- g_array_free(ary1,TRUE);
- g_array_free(ary2,TRUE);
- g_array_free(ary3,TRUE);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/gfsm-chop.perl b/gfsm/gfsm/src/libgfsm/tests/gfsm-chop.perl
deleted file mode 100755
index 7f81bd8..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gfsm-chop.perl
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/perl -w
-
-use Gfsm;
-
-our @want_states =
- (
- 5,
- 4,
- 11,
- 98,
- 5257,
- 45623,
- 290132,
- 0
- );
-
-push(@ARGV,'-') if (!@ARGV);
-
-$fsmfile = shift(@ARGV);
-our $fsm = Gfsm::Automaton->new();
-$fsm->load($fsmfile) or die("$0: load failed for fsm file '$fsmfile': $!");
-
-##-- chop it
-my %q2i = map { $want_states[$_]=>$_ } (0..$#want_states);
-my $qid_dummy = scalar(@want_states);
-$fsm2 = $fsm->shadow;
-$ai=Gfsm::ArcIter->new;
-
-foreach $qid_dst (0..$#want_states) {
- $fsm2->ensure_state($qid_dst);
- $qid_src = $want_states[$qid_dst];
- for ($ai->open($fsm,$qid_src); $ai->ok; $ai->next) {
- $fsm2->add_arc($qid_dst, $qid_dummy, $ai->lower, $ai->upper, $ai->weight);
- }
- $fsm2->add_arc($qid_dummy,$qid_dst,0,0,0);
-}
-$fsm2->root($qid_dummy);
-$fsm2->final_weight($qid_dummy,0);
-
-$fsm2->save('-');
diff --git a/gfsm/gfsm/src/libgfsm/tests/gfsm-out-degrees.perl b/gfsm/gfsm/src/libgfsm/tests/gfsm-out-degrees.perl
deleted file mode 100755
index 38caf2d..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gfsm-out-degrees.perl
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/perl -w
-
-use Gfsm;
-
-$fsmfile = @ARGV ? shift : '-';
-$fsm = Gfsm::Automaton->new();
-die("$0: load failed for '$fsmfile': $!") if (!$fsm->load($fsmfile));
-
-foreach $qid (0..($fsm->n_states-1)) {
- print $qid, "\t", $fsm->out_degree($qid), "\n";
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.c b/gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.c
deleted file mode 100644
index 12495fa..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.c
+++ /dev/null
@@ -1,210 +0,0 @@
-#include <gfsmRegexCompiler.h>
-#include <gfsmArith.h>
-#include <gfsmUtils.h>
-
-#define RETURN(rec,_rea) (rec)->rea=(_rea); return (_rea);
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_epsilon(gfsmRegexCompiler *rec)
-{
- rec->rea.typ = gfsmREATEmpty;
- rec->rea.val.lab = 0;
- return rec->rea;
-}
-
-//--------------------------------------------------------------
-gfsmAutomaton *gfsm_regex_automaton_new_fsm(gfsmRegexCompiler *rec)
-{
- gfsmAutomaton *fsm = gfsm_automaton_new_full(gfsmAutomatonDefaultFlags,
- rec->srtype,
- gfsmAutomatonDefaultSize);
- fsm->flags.is_transducer = FALSE;
- return fsm;
-}
-
-//--------------------------------------------------------------
-gfsmAutomaton *gfsm_regex_automaton_epsilon_fsm(gfsmRegexCompiler *rec)
-{
- gfsmAutomaton *fsm = gfsm_regex_automaton_new_fsm(rec);
- fsm->root_id = gfsm_automaton_add_state(fsm);
- gfsm_automaton_set_final_state(fsm,fsm->root_id,TRUE);
- return fsm;
-}
-
-//--------------------------------------------------------------
-gfsmAutomaton *gfsm_regex_automaton_label_fsm(gfsmRegexCompiler *rec, gfsmLabelVal lab)
-{
- gfsmAutomaton *fsm = gfsm_regex_automaton_new_fsm(rec);
- gfsmStateId labid;
- fsm->root_id = gfsm_automaton_add_state(fsm);
- labid = gfsm_automaton_add_state(fsm);
- gfsm_automaton_add_arc(fsm, fsm->root_id, labid, lab, lab, fsm->sr->one);
- gfsm_automaton_set_final_state(fsm,labid,TRUE);
- return fsm;
-}
-
-//--------------------------------------------------------------
-gfsmAutomaton *gfsm_regex_automaton_fsm(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea)
-{
- switch (rea.typ) {
- case gfsmREATEmpty:
- return gfsm_regex_automaton_epsilon_fsm(rec);
- break;
- case gfsmREATLabel:
- return gfsm_regex_automaton_label_fsm(rec, rea.val.lab);
- break;
- case gfsmREATFull:
- default:
- return rea.val.fsm;
- break;
- }
-}
-
-//--------------------------------------------------------------
-gfsmAutomaton *gfsm_regex_automaton_expand(gfsmRegexCompiler *rec, gfsmRegexAutomaton *rea)
-{
- rea->val.fsm = gfsm_regex_automaton_fsm(rec,*rea);
- rea->typ = gfsmREATFull;
- return rea->val.fsm;
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_label(gfsmRegexCompiler *rec, gfsmLabelVal lab)
-{
- rec->rea.typ = gfsmREATLabel;
- rec->rea.val.lab = lab;
- return rec->rea;
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_concat(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2)
-{
- switch (rea2.typ) {
- case gfsmREATEmpty:
- break;
- case gfsmREATLabel:
- gfsm_regex_automaton_append_lab(rec, gfsm_regex_automaton_expand(rec,&rea1), rea2.val.lab);
- break;
- case gfsmREATFull:
- default:
- gfsm_automaton_concat(gfsm_regex_automaton_expand(rec,&rea1), rea2.val.fsm);
- gfsm_automaton_free(rea2.val.fsm);
- break;
- }
-
- RETURN(rec,rea1);
-}
-
-
-//--------------------------------------------------------------
-struct _gfsm_regex_append_lab_data {
- gfsmAutomaton *fsm;
- gfsmLabelVal lab;
- gfsmStateId newid;
-};
-
-gboolean _gfsm_regex_append_lab_foreach_func(gfsmStateId qid, gpointer pw,
- struct _gfsm_regex_append_lab_data *data)
-{
- gfsm_automaton_get_state(data->fsm,qid)->is_final = FALSE;
- gfsm_automaton_add_arc(data->fsm, qid, data->newid, data->lab, data->lab, gfsm_ptr2weight(pw));
- return FALSE;
-}
-
-gfsmAutomaton *gfsm_regex_automaton_append_lab(gfsmRegexCompiler *rec, gfsmAutomaton *fsm, gfsmLabelVal lab)
-{
- struct _gfsm_regex_append_lab_data data = { fsm, lab, gfsm_automaton_add_state(fsm) };
- gfsm_weightmap_foreach(fsm->finals,
- (GTraverseFunc)_gfsm_regex_append_lab_foreach_func,
- &data);
- gfsm_weightmap_clear(fsm->finals);
- gfsm_automaton_set_final_state(fsm, data.newid, TRUE);
- return fsm;
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_closure(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea, gboolean is_plus)
-{
- gfsm_automaton_closure(gfsm_regex_automaton_expand(rec,&rea),is_plus);
- RETURN(rec,rea);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_power(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea, guint32 n)
-{
- gfsm_automaton_n_closure(gfsm_regex_automaton_expand(rec,&rea),n);
- RETURN(rec,rea);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_project(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea,
- gfsmLabelSide which)
-{
- gfsm_automaton_project(gfsm_regex_automaton_expand(rec,&rea),which);
- RETURN(rec,rea);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_optional(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea)
-{
- gfsm_automaton_optional(gfsm_regex_automaton_expand(rec,&rea));
- RETURN(rec,rea);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_complement(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea)
-{
- gfsm_automaton_complement_full(gfsm_regex_automaton_expand(rec,&rea),rec->abet);
- RETURN(rec,rea);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_union(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea1, gfsmRegexAutomaton rea2)
-{
- gfsm_automaton_union(gfsm_regex_automaton_expand(rec,&rea1),gfsm_regex_automaton_expand(rec,&rea2));
- gfsm_automaton_free(gfsm_regex_automaton_expand(rec,&rea2));
- RETURN(rec,rea1);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_intersect(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea1, gfsmRegexAutomaton rea2)
-{
- gfsm_automaton_intersect(gfsm_regex_automaton_expand(rec,&rea1),gfsm_regex_automaton_expand(rec,&rea2));
- gfsm_automaton_free(gfsm_regex_automaton_expand(rec,&rea2));
- RETURN(rec,rea1);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_product(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea1, gfsmRegexAutomaton rea2)
-{
- _gfsm_automaton_product(gfsm_regex_automaton_expand(rec,&rea1),gfsm_regex_automaton_expand(rec,&rea2));
- gfsm_automaton_free(gfsm_regex_automaton_expand(rec,&rea2));
- RETURN(rec,rea1);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_compose(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea1, gfsmRegexAutomaton rea2)
-{
- gfsm_automaton_compose(gfsm_regex_automaton_expand(rec,&rea1),gfsm_regex_automaton_expand(rec,&rea2));
- gfsm_automaton_free(gfsm_regex_automaton_expand(rec,&rea2));
- RETURN(rec,rea1);
-}
-
-//--------------------------------------------------------------
-gfsmRegexAutomaton gfsm_regex_automaton_difference(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea1, gfsmRegexAutomaton rea2)
-{
- gfsm_automaton_difference(gfsm_regex_automaton_expand(rec,&rea1),gfsm_regex_automaton_expand(rec,&rea2));
- gfsm_automaton_free(gfsm_regex_automaton_expand(rec,&rea2));
- RETURN(rec,rea1);
-}
-
-//--------------------------------------------------------------
-/** Weight */
-gfsmRegexAutomaton gfsm_regex_automaton_weight(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea, gfsmWeight w)
-{
- gfsm_automaton_arith_final(gfsm_regex_automaton_expand(rec,&rea), gfsmAOSRTimes, w, FALSE);
- RETURN(rec,rea);
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.h b/gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.h
deleted file mode 100644
index aefc1cc..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gfsmRegexCompiler-v1.h
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef _GFSM_REGEX_COMPILER_H
-#define _GFSM_REGEX_COMPILER_H
-
-#include <gfsmScanner.h>
-#include <gfsmAutomaton.h>
-#include <gfsmAlphabet.h>
-#include <gfsmAlgebra.h>
-
-/** Regex automaton type */
-typedef enum {
- gfsmREATEmpty, ///< empty acceptor
- gfsmREATLabel, ///< single label
- gfsmREATFull ///< full automaton
-} gfsmRegexAutomatonType;
-
-/** Regex automaton value */
-typedef union {
- gfsmLabelVal lab; ///< single label
- gfsmAutomaton *fsm; ///< full automaton
-} gfsmRegexAutomatonValue;
-
-/** Regex automaton */
-typedef struct {
- gfsmRegexAutomatonType typ; ///< regex type
- gfsmRegexAutomatonValue val; ///< regex value
-} gfsmRegexAutomaton;
-
-/** Data structure for regex compiler */
-typedef struct {
- gfsmScanner scanner; ///< scanner
- gfsmSRType srtype; ///< semiring type
- gfsmRegexAutomaton rea; ///< regex automaton under construction
- gfsmAlphabet *abet; ///< alphabet
- GString *gstr; ///< buffer
- gboolean is_label : 1; ///< is this a singleton fsm? (if so, *fsm is a gfsmLabelVal)
-} gfsmRegexCompiler;
-
-/** New full-fleded automaton */
-gfsmAutomaton *gfsm_regex_automaton_new_fsm(gfsmRegexCompiler *rec);
-
-/** Get full-fledged automaton */
-gfsmAutomaton *gfsm_regex_automaton_fsm(gfsmRegexCompiler *rec, gfsmRegexAutomaton rea);
-
-/** Full Epsilon recognizer */
-gfsmAutomaton *gfsm_regex_automaton_epsilon_fsm(gfsmRegexCompiler *rec);
-
-/** Full single-character recognizer */
-gfsmAutomaton *gfsm_regex_automaton_label_fsm(gfsmRegexCompiler *rec, gfsmLabelVal lab);
-
-
-/** Single-label recognizer */
-gfsmRegexAutomaton gfsm_regex_automaton_label(gfsmRegexCompiler *rec, gfsmLabelVal lab);
-
-/** Single-label concatenation (low-level) */
-gfsmAutomaton *gfsm_regex_automaton_append_lab(gfsmRegexCompiler *rec,
- gfsmAutomaton *fsm,
- gfsmLabelVal lab);
-
-/** General concatenation */
-gfsmRegexAutomaton gfsm_regex_automaton_concat(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2);
-
-/** Closure */
-gfsmRegexAutomaton gfsm_regex_automaton_closure(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea,
- gboolean is_plus);
-
-/** Power (n-ary closure) */
-gfsmRegexAutomaton gfsm_regex_automaton_power(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea,
- guint32 n);
-
-/** Projection */
-gfsmRegexAutomaton gfsm_regex_automaton_project(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea,
- gfsmLabelSide which);
-
-
-/** Optionality */
-gfsmRegexAutomaton gfsm_regex_automaton_optional(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea);
-
-/** Complement */
-gfsmRegexAutomaton gfsm_regex_automaton_complement(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea);
-
-/** Union */
-gfsmRegexAutomaton gfsm_regex_automaton_union(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2);
-
-/** Intersection */
-gfsmRegexAutomaton gfsm_regex_automaton_intersect(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2);
-
-/** Product */
-gfsmRegexAutomaton gfsm_regex_automaton_product(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2);
-
-/** Composition */
-gfsmRegexAutomaton gfsm_regex_automaton_compose(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2);
-
-/** Difference */
-gfsmRegexAutomaton gfsm_regex_automaton_difference(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmRegexAutomaton rea2);
-
-/** Weight */
-gfsmRegexAutomaton gfsm_regex_automaton_weight(gfsmRegexCompiler *rec,
- gfsmRegexAutomaton rea1,
- gfsmWeight w);
-
-
-
-
-#endif /* _GFSM_REGEX_COMPILER_H */
diff --git a/gfsm/gfsm/src/libgfsm/tests/gfsmlabdump.c b/gfsm/gfsm/src/libgfsm/tests/gfsmlabdump.c
deleted file mode 100644
index 05916ac..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gfsmlabdump.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <gfsm.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int main (int argc, char **argv) {
- gfsmStringAlphabet *sa = (gfsmStringAlphabet*)gfsm_string_alphabet_new();
- gfsmAlphabet *a = (gfsmAlphabet*)sa;
- gfsmError *err = NULL;
- char *filename= NULL;
- gfsmLabelVal lv1,lv2;
- char *key;
-
- /*-- test: insert --*/
- printf("testing insert: ");
- lv1 = gfsm_alphabet_insert(a,"foo",gfsmNoLabel);
- printf("%s\n", lv1 != gfsmNoLabel ? "ok" : "FAILED");
-
- /*-- test: find --*/
- printf("testing find_label: ");
- lv2 = gfsm_alphabet_find_label(a,"foo");
- printf("%s\n", lv1==lv2 ? "ok" : "FAILED");
-
- /*-- test: find key --*/
- printf("testing find_key: ");
- key = gfsm_alphabet_find_key(a,lv1);
- printf("%s\n", key != NULL && strcmp(key,"foo")==0 ? "ok" : "FAILED");
-
- /*-- clear test --*/
- printf("testing clear: ");
- gfsm_alphabet_clear(a);
- printf("%s\n", gfsm_alphabet_size(a)==0 ? "ok" : "FAILED");
-
- /*-- load labels file --*/
- if (argc > 0) { filename=argv[1]; }
- else { filename="-"; }
- printf("\nLoading alphabet from file %s: ", argc==0 ? "(stdin)" : filename);
- if (!a || !gfsm_alphabet_load_filename(a, filename, &err)) {
- g_printerr("couldn't load labels from stdin: %s\n", err->message);
- exit(1);
- }
- printf("loaded.\n\n");
-
- /*-- get some basic information --*/
- printf("Basic Information:\n");
- printf(" + gfsmAlphabet:\n");
- printf(" type : %u (%s)\n", a->type,
- (a->type==gfsmATString ? "string keys" : "weird type: tell moocow"));
- printf(" lab_min: %u\n", a->lab_min);
- printf(" lab_max: %u\n", a->lab_max);
- printf(" + gfsmPointerAlphabet:\n");
- printf(" labels2keys: %p [size=%u]\n",
- sa->labels2keys, sa->labels2keys->len);
- printf(" keys2labels: %p [size=%u]\n",
- sa->keys2labels, g_hash_table_size(sa->keys2labels));
- printf(" keydupfunc : %p (%s)\n",
- sa->key_dup_func, (sa->key_dup_func == NULL
- ? "no key copying: tell moocow"
- : ((void*)sa->key_dup_func == (void*)gfsm_alphabet_strdup
- ? "keys are copied: ok"
- : "strangeness: tell moocow")));
-
-
- /*-- dump it --*/
- printf("\n--BEGIN dump--\n");
- if (!gfsm_alphabet_save_file(a,stdout,&err)) {
- g_printerr("couldn't save labels to stdout: %s\n", err->message);
- exit(1);
- }
- printf("--END dump--\n\n");
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/gscantest.c b/gfsm/gfsm/src/libgfsm/tests/gscantest.c
deleted file mode 100644
index 199c414..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/gscantest.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <gfsm.h>
-#include <glib.h>
-#include <stdlib.h>
-
-#undef VERBOSE
-
-int main (int argc, char **argv) {
- GScanner *scanner = g_scanner_new(&gfsm_automaton_scanner_config);
- GTokenType typ;
-
- scanner->input_name = *argv;
- g_scanner_input_file(scanner, fileno(stdin));
- while ((typ = g_scanner_get_next_token(scanner)) != G_TOKEN_EOF) {
-#ifdef VERBOSE
- switch (typ) {
- case G_TOKEN_INT:
- printf("INT %ld\n", scanner->value.v_int);
- break;
- case G_TOKEN_FLOAT:
- printf("FLOAT %g\n", scanner->value.v_float);
- break;
- case G_TOKEN_CHAR:
- if (scanner->value.v_char == '\n') printf ("CHAR '\\n'\n");
- else printf("CHAR '%c'\n", scanner->value.v_char);
- break;
- default:
- printf("? (typ=%d)\n", typ);
- break;
- }
-#else // !VERBOSE
- switch (typ) {
- case G_TOKEN_INT:
- printf("%ld\t", scanner->value.v_int);
- break;
- case G_TOKEN_FLOAT:
- printf("%g\t", scanner->value.v_float);
- break;
- case G_TOKEN_CHAR:
- if (scanner->value.v_char == '\n') fputc('\n',stdout);
- else exit(1);
- break;
- default:
- exit(1);
- break;
- }
-#endif // VERBOSE
- }
- g_scanner_destroy(scanner);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/intfloat.c b/gfsm/gfsm/src/libgfsm/tests/intfloat.c
deleted file mode 100644
index 098b860..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/intfloat.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdio.h>
-
-#define ptr2int(p) ((int)(p))
-#define int2ptr(i) ((void*)(i))
-#define ptr2float(p) (*((float*)(&(p))))
-#define int2float(i) (*((float*)(&(i))))
-
-#define float2int(f) (*((int*)(&(f))))
-#define float2ptr(f) (*((void**)(&(f))))
-
-int main(void) {
- float f = 42.24;
- int fi;
- void *fp;
- float fif, fpf;
-
- printf("f=%f\n", f);
- fi = float2int(f);
- printf("->fi=%d\n", fi);
-
- fif = int2float(fi);
- printf("-->fif=%f\n", fif);
-
- fp = float2ptr(f);
- printf("->fp=%p\n", fp);
-
- fpf=ptr2float(fp);
- printf("-->fpf=%f\n", fpf);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/iotest.c b/gfsm/gfsm/src/libgfsm/tests/iotest.c
deleted file mode 100644
index c218627..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/iotest.c
+++ /dev/null
@@ -1,180 +0,0 @@
-#include <glib.h>
-#include <gfsmIO.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*---------------------------------------------------
- * generic test: output
- */
-void test_output_generic(gfsmIOHandle *io, const char *label)
-{
- gboolean rc;
- fprintf(stderr, "\n-------- I/O: %s: output\n", label);
-
- fprintf(stderr, "+ write(\"foo\\n\",4):\n");
- rc = gfsmio_write(io, "foo\n", 4);
- gfsmio_flush(io);
- fprintf(stderr, " --> %d\n", rc);
-
- fprintf(stderr, "+ puts(\"bar\\n\"):\n");
- rc = gfsmio_puts(io, "bar\n");
- gfsmio_flush(io);
- fprintf(stderr, " --> %d\n", rc);
-
- fprintf(stderr, "+ putc('x'); putc('\\n'):\n");
- rc = gfsmio_putc(io, 'x') && gfsmio_putc(io, '\n');
- gfsmio_flush(io);
- fprintf(stderr, " --> %d\n", rc);
-
- fprintf(stderr, "+ printf(\"%%s%%s\\n\",\"foo\",\"bar\"):\n");
- rc = gfsmio_printf(io, "%s%s\n", "foo", "bar");
- gfsmio_flush(io);
- fprintf(stderr, " --> %d\n", rc);
-}
-
-/*---------------------------------------------------
- * generic test: input
- */
-void test_input_generic(gfsmIOHandle *io, const char *label)
-{
- char buf[2];
- char *linebuf=NULL;
- size_t n=0;
- ssize_t nread=0;
- gboolean rc;
-
- fprintf(stderr, "\n-------- I/O: %s: input\n", label);
-
- fprintf(stderr, "+ read(2)\n");
- rc = gfsmio_read(io, buf, 2);
- fprintf(stderr, " --> %d ; buf=\"%c%c\"\n", rc, buf[0], buf[1]);
-
- fprintf(stderr, "+ getline()\n");
- while ( (nread=gfsmio_getline(io, &linebuf, &n)) > 0) {
- fprintf(stderr, " --> %d ; linebuf=\"%s\"\n", nread, linebuf);
- fprintf(stderr, "+ getline()\n");
- }
- fprintf(stderr, " --> %d ; linebuf=\"%s\"\n", nread, linebuf);
-
- if (linebuf) free(linebuf);
-}
-
-
-/*---------------------------------------------------
- * test: FILE*
- */
-void test_io_cfile(void) {
- gfsmIOHandle *ioh=NULL;
-
- //-- I/O to file: output
- ioh = gfsmio_new_file(stdout);
- test_output_generic(ioh, "FILE* (stdout)");
- gfsmio_handle_free(ioh);
-
- //-- I/O from file: input
- ioh = gfsmio_new_file(stdin);
- test_input_generic(ioh, "FILE* (stdin)");
- gfsmio_handle_free(ioh);
-}
-
-/*---------------------------------------------------
- * test: GString*
- */
-void test_io_gstring(void) {
- GString *gs = g_string_new("");
- gfsmPosGString pgs = { gs, 0 };
- gfsmIOHandle *ioh = NULL;
-
- //-- I/O to GString*: output
- ioh = gfsmio_new_gstring(&pgs);
- test_output_generic(ioh, "GString*");
- fprintf(stderr, "+ OUTPUT=\"%s\"\n", gs->str);
-
- //-- I/O from GString*: input
- pgs.pos = 0;
- /*
- g_string_assign(gs, "ab\ncde");
- test_input_generic(ioh, "GString* \"ab\\nc\")");
- */
- /*
- g_string_assign(gs, "a b c\nd e f");
- test_input_generic(ioh, "GString* \"a b c\\nd e f\")");
- */
- /*
- g_string_assign(gs, "abcde\nfghij\nklmnopqrstuvwxyz");
- test_input_generic(ioh, "GString* \"...\")");
- */
- g_string_assign(gs, "abc\n\ndef\n");
- test_input_generic(ioh, "GString* \"...\")");
-
-
- gfsmio_handle_free(ioh);
- g_string_free(gs,TRUE);
-}
-
-/*---------------------------------------------------
- * test: gzFile
- */
-void test_io_zfile(void) {
- gfsmIOHandle *ioh=NULL;
- gfsmError *err=NULL;
-
- //-- I/O to gzGile: output
- ioh = gfsmio_new_filename("iotest-out.gz", "wb", 0, &err);
- test_output_generic(ioh, "gzFile (iotest-out.gz)");
- gfsmio_close(ioh);
- gfsmio_handle_free(ioh);
-
- //-- I/O from gzFile: input
- ioh = gfsmio_new_filename("iotest-in.gz", "rb", -1, &err);
- test_input_generic(ioh, "gzFile (iotest-in.gz)");
- gfsmio_close(ioh);
- gfsmio_handle_free(ioh);
-}
-
-/*---------------------------------------------------
- * test: gzFile from FILE*
- */
-void test_io_zcfile(void) {
- gfsmIOHandle *ioh=NULL;
- int zlevel = -1;
-
- //-- I/O to gzGile: output
- ioh = gfsmio_new_zfile(stdout, "wb", zlevel);
- test_output_generic(ioh, "gzFile(fileno(stdout))");
- gfsmio_close(ioh);
- gfsmio_handle_free(ioh);
-
- //-- I/O from gzFile: input
- ioh = gfsmio_new_zfile(stdin, "rb", zlevel);
- test_input_generic(ioh, "gzFile(fileno(stdin))");
- gfsmio_close(ioh);
- gfsmio_handle_free(ioh);
-}
-
-
-/*---------------------------------------------------
- * MAIN
- */
-int main (void) {
- /*
- fprintf(stderr, "\n=================================\n");
- test_io_cfile();
- */
-
- /*
- fprintf(stderr, "\n=================================\n");
- test_io_gstring();
- */
-
- /*
- fprintf(stderr, "\n=================================\n");
- test_io_zfile();
- */
-
- fprintf(stderr, "\n=================================\n");
- test_io_zcfile();
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/lab2ary.c b/gfsm/gfsm/src/libgfsm/tests/lab2ary.c
deleted file mode 100644
index e6dbee9..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/lab2ary.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <gfsm.h>
-#include <stdlib.h>
-
-
-gfsmAutomaton *fsm;
-gfsmAlphabet *ialph;
-const char *tfstname = "lab2ary.tfst";
-gfsmError *err = NULL;
-
-
-int main (int argc, char **argv) {
- guint i;
- ialph = gfsm_identity_alphabet_new();
- //GArray *ary;
- GPtrArray *ary;
-
- fsm = gfsm_automaton_new();
- if (!gfsm_automaton_compile_filename(fsm,tfstname,&err)) {
- g_printerr("%s: compile failed for '%s': %s\n", *argv, tfstname, err->message);
- exit(255);
- }
- printf("%s: compiled test automaton from '%s'\n", *argv, tfstname);
-
- ialph = gfsm_automaton_get_alphabet(fsm, gfsmLSLower, ialph);
-
- printf("--\n");
- printf("alphabet size=%u ; min=%u ; max=%u\n",
- gfsm_alphabet_size(ialph), ialph->lab_min, ialph->lab_max);
-
- printf("--\n");
- printf("alphabet array={");
- /*-- ok
- ary = g_array_new(FALSE,FALSE,sizeof(gfsmLabelVal));
- gfsm_alphabet_labels_to_array(ialph,ary);
- */
- /*-- ok
- ary = g_array_sized_new(FALSE,FALSE,sizeof(gfsmLabelVal),gfsm_alphabet_size(ialph));
- gfsm_alphabet_labels_to_array(ialph,ary);
- */
- /*-- ok */
- //ary = gfsm_alphabet_labels_to_array(ialph,NULL);
-
- /*-- ptr_array */
- ary = g_ptr_array_sized_new(gfsm_alphabet_size(ialph));
- gfsm_alphabet_labels_to_array(ialph,ary);
-
- for (i=0; i < ary->len; i++) {
- //printf(" %u", g_array_index(ary,gfsmLabelVal,i));
- printf(" %u", (gfsmLabelVal)g_ptr_array_index(ary,i));
- }
- printf(" }\n");
-
- //-- cleanup
- //g_array_free(ary,TRUE);
- g_ptr_array_free(ary,TRUE);
-
- gfsm_automaton_free(fsm);
- gfsm_alphabet_free(ialph);
-
- return 0;
-}
-
diff --git a/gfsm/gfsm/src/libgfsm/tests/labchurn.c b/gfsm/gfsm/src/libgfsm/tests/labchurn.c
deleted file mode 100644
index b8f0a99..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/labchurn.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <gfsm.h>
-
-gfsmAlphabet *alph;
-
-int main (int argc, char **argv)
-{
- char *infilename = (argc > 1 ? argv[1] : "-");
-
- g_mem_set_vtable(glib_mem_profiler_table);
-
- alph = gfsm_string_alphabet_new();
- //g_mem_profile();
-
- gfsm_alphabet_load_filename(alph,infilename,NULL);
- //gfsm_alphabet_save_file(alph,stdout,NULL);
-
-
- gfsm_alphabet_free(alph);
-
- g_blow_chunks();
- g_mem_profile();
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/labcount.perl b/gfsm/gfsm/src/libgfsm/tests/labcount.perl
deleted file mode 100755
index 4086797..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/labcount.perl
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/perl -w
-
-use Gfsm;
-
-if (!@ARGV) {
- print STDERR "Usage: $0 LABFILE [DATA_FILE(s)...]\n";
- exit 1;
-}
-
-$labfile = shift;
-$labs = Gfsm::Alphabet->new();
-$labs->load($labfile) or die("$0: load failed for labels file '$labfile': $!");
-$sym2id = $labs->asHash;
-
-##-- read data
-%labf = qw();
-$ftotal = 0;
-while (defined($line=<>)) {
- chomp($line);
- @labs = grep {defined($_)} @$sym2id{split(//,$line)};
- $ftotal += scalar(@labs);
- foreach (@labs) { ++$labf{$_}; }
-}
-
-##-- write data vector
-#print map { pack('d', (defined($_) ? $_ : 0)/$ftotal) } @labf;
-
-print map {pack('Sd',$_,$labf{$_}/$ftotal)} sort(keys(%labf));
diff --git a/gfsm/gfsm/src/libgfsm/tests/labprobs.h b/gfsm/gfsm/src/libgfsm/tests/labprobs.h
deleted file mode 100644
index d8589d0..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/labprobs.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <gfsm.h>
-
-guint32 grand_seed = 42;
-const char *probfile = "tagh-probs.bin";
-
-extern gulong count_test;
-GArray *seekus = NULL; /*-- lab = g_array_index(seekus,i); 1<=i<=count_test --*/
-
-typedef struct {
- gfsmLabelId lab;
- double prob;
-} seekProb;
-GArray *labp=NULL; /*-- g_array_index(probs,seekProb,i) = (lab,p(lab)) --*/
-
-GRand *grand=NULL;
-
-/*======================================================================
- * load_label_probs()
- */
-void load_label_probs(void) {
- seekProb sp;
- double total=0, tmp;
- FILE *f = fopen(probfile,"r");
- if (!f) {
- fprintf(stderr, "error: open failed for probability file '%s'\n", probfile);
- exit(1);
- }
- labp = g_array_sized_new(FALSE,TRUE,sizeof(seekProb),256);
- labp->len = 0;
- while ( !feof(f) ) {
- if (fread(&(sp.lab), sizeof(gfsmLabelId), 1, f) != 1
- || fread(&(sp.prob), sizeof(double), 1, f) != 1)
- {
- break;
- }
- tmp = sp.prob;
- sp.prob += total;
- total += tmp;
- g_array_append_val(labp,sp);
-
- }
- fclose(f);
- fprintf(stderr, "[info]: read probability distribution over %d labels from '%s'\n",
- labp->len, probfile);
-}
-
-/*======================================================================
- * random_label()
- */
-gfsmLabelId random_label(void) {
- double w;
- int i;
- if (!grand) { grand = g_rand_new_with_seed(grand_seed); }
- w = g_rand_double(grand);
- for (i=0; i < labp->len && w > g_array_index(labp,seekProb,i).prob; i++) { ; }
- if (i==labp->len) { --i; }
- return g_array_index(labp,seekProb,i).lab;
-}
-
-/*======================================================================
- * populate_seek_labels()
- */
-void populate_seek_labels(void) {
- int i;
- gfsmLabelId lab;
- seekus = g_array_sized_new(FALSE,TRUE,sizeof(gfsmLabelId),count_test);
- for (i=0; i < count_test; i++) {
- lab = random_label();
- g_array_append_val(seekus,lab);
- }
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/lkptest.tfst b/gfsm/gfsm/src/libgfsm/tests/lkptest.tfst
deleted file mode 100644
index 11f371e..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/lkptest.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-0 0 1 2 1
-0 0 2 3 1
-0 0 3 1 1
-0 1 2 2 1
-0 0
-1 2 2 2 1
-2 3 3 3 1
-3 0
diff --git a/gfsm/gfsm/src/libgfsm/tests/macrotest.i b/gfsm/gfsm/src/libgfsm/tests/macrotest.i
deleted file mode 100644
index e540e43..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/macrotest.i
+++ /dev/null
@@ -1,11 +0,0 @@
-#define _gfsm_bitvector_bits2bytes(nbits) ((nbits)>0 ? ((((nbits)-1)/8)+1) : 1)
-
-#define gfsm_bitvector_set(bv,i,v) \
- ( (i >= gfsm_bitvector_size(bv) ? gfsm_bitvector_resize(bv,i) : 0), \
- (v ? ( (bv)->data[ _gfsm_bitvector_bits2bytes(i)-1 ] |= (1<<((i)%8)) ) \
- : ( (bv)->data[ _gfsm_bitvector_bits2bytes(i)-1 ] &= ~(1<<((i)%8)) ) ) )
-
-bits2bytes: _gfsm_bitvector_bits2bytes(MyBit)
-
-set: gfsm_bitvector_set(MyVector,MyBit,MyValue)
-
diff --git a/gfsm/gfsm/src/libgfsm/tests/memtest-alphabet.c b/gfsm/gfsm/src/libgfsm/tests/memtest-alphabet.c
deleted file mode 100644
index edb1492..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/memtest-alphabet.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <glib.h>
-#include <gfsmAlphabet.h>
-
-void dofree (gpointer p) { g_free(p); }
-
-int main (void) {
- gfsmAlphabet *a;
- g_mem_set_vtable(glib_mem_profiler_table);
-
- //a = (gfsmAlphabet*)g_new0(gfsmPointerAlphabet,1);
- a = gfsm_string_alphabet_new();
-
- gfsm_alphabet_insert(a,"foo",42);
-
- gfsm_alphabet_free(a);
-
- printf("<CHUNKS:1>--------\n");
- //g_mem_chunk_info();
-
-
-
- printf("<PROF:1>--------\n");
- g_mem_profile();
- g_blow_chunks();
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/memtest-automaton.c b/gfsm/gfsm/src/libgfsm/tests/memtest-automaton.c
deleted file mode 100644
index ace1fbd..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/memtest-automaton.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <glib.h>
-#include <gfsm.h>
-
-void dofree (gpointer p) { g_free(p); }
-
-int main (void) {
- gfsmAutomaton *fsm;
- g_mem_set_vtable(glib_mem_profiler_table);
-
- fsm = gfsm_automaton_new();
- gfsm_automaton_free(fsm);
-
- //printf("<CHUNKS:1>--------\n");
- //g_mem_chunk_info();
-
- printf("<PROF:1>--------\n");
- g_blow_chunks();
- g_mem_profile();
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/memtest-general.c b/gfsm/gfsm/src/libgfsm/tests/memtest-general.c
deleted file mode 100644
index 50fe42f..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/memtest-general.c
+++ /dev/null
@@ -1,168 +0,0 @@
-#include <gfsm.h>
-#include <glib.h>
-
-#define VTABLE_PROFILE 1
-//#define VTABLE_LOCAL 1
-
-
-//#define USE_ALLOCATORS 1
-//#define DELAY_ALLOCATOR_FREE 1
-
-
-//#define NITEMS 0
-//#define NITEMS 1
-//#define NITEMS 10
-#define NITEMS 128
-//#define NITEMS 256
-//#define NITEMS 1024
-//#define NITEMS 65536
-//#define NITEMS 131072
-//#define NITEMS 262144
-//#define NITEMS 524288
-//#define NITEMS 1048576
-
-
-//#define NITERS
-//#define NITERS 1
-//#define NITERS 10
-#define NITERS 128
-//#define NITERS 1024
-//#define NITERS 65536
-//#define NITERS 131072
-//#define NITERS 262144
-//#define NITERS 524288
-//#define NITERS 1048576
-
-//#define PRINT_CHUNK_INFO 1
-//#define DO_PROFILE 1
-
-#define DO_GMALLOC 1
-#define GMALLOC_SIZE 45
-
-#define DO_GNEW 1
-#define GNEW_SIZE 70
-
-#define DO_SLIST 1
-
-#define DO_PTRARRAY 1
-#define PTRARRAY_SIZE 128
-
-
-/*--------------------------------------------------------------------
- * mem table
- */
-gpointer my_malloc(gsize n_bytes)
-{ return (gpointer)malloc(n_bytes); }
-
-gpointer my_realloc(gpointer mem, gsize n_bytes)
-{ return (gpointer)realloc(mem, n_bytes); }
-
-void my_free(gpointer mem)
-{ free(mem); }
-
-GMemVTable my_vtable =
- {
- my_malloc,
- my_realloc,
- my_free,
- NULL,
- NULL,
- NULL
- };
-
-/*--------------------------------------------------------------------
- * operation macro
- */
-#define MEMOP(code) \
- printf("%s\n", #code); \
- code;
-
-#define ITEMOP(code) \
- for (i=0; i<NITEMS; i++) { code; }
-
-/*--------------------------------------------------------------------
- * variables
- */
-gpointer mallocp[NITERS];
-gpointer newp[NITERS];
-GSList *slist[NITERS];
-GPtrArray *ptrarray[NITERS];
-
-/*--------------------------------------------------------------------
- * MAIN
- */
-int main(int argc, char **argv) {
- int i,j;
-
-
- //-- memory debugging
-#if defined(VTABLE_PROFILE)
- g_mem_set_vtable(glib_mem_profiler_table);
-#elif defined(VTABLE_LOCAL)
- g_mem_set_vtable(&my_vtable);
-#endif
-
- //-- setup gfsm allocators
-#if defined(USE_ALLOCATORS)
- MEMOP(gfsm_allocators_enable());
-#endif
-
-
- //--------------- iteration
- for (j=0; j < NITERS; j++) {
- //-- alloc
-# ifdef DO_GMALLOC
- ITEMOP(mallocp[i]=g_malloc(GMALLOC_SIZE));
-# endif
-# ifdef DO_GNEW
- ITEMOP(newp[i]=g_new(char,GNEW_SIZE));
-# endif
-# ifdef DO_SLIST
- ITEMOP(slist[i]=g_slist_prepend(NULL,NULL));
-# endif
-# ifdef DO_PTRARRAY
- ITEMOP(ptrarray[i]=g_ptr_array_sized_new(PTRARRAY_SIZE));
-# endif
-
- //-- free
-# ifdef DO_GMALLOC
- ITEMOP(g_free(mallocp[i]));
-# endif
-# ifdef DO_GNEW
- ITEMOP(g_free(newp[i]));
-# endif
-# ifdef DO_SLIST
- ITEMOP(g_slist_free(slist[i]));
-# endif
-# ifdef DO_PTRARRAY
- ITEMOP(g_ptr_array_free(ptrarray[i],TRUE));
-# endif
- }
-
-
- //-- pop gfsm allocators
-#if defined(USE_ALLOCATORS) && !defined(DELAY_ALLOCATOR_FREE)
- MEMOP(gfsm_allocators_free());
-#endif
-
- //-- memory debugging
-#if defined(PRINT_CHUNK_INFO) && defined(VTABLE_PROFILE)
- printf("\n<CHUNKS:1>--------\n");
- g_blow_chunks();
- g_mem_chunk_info();
-#endif
- //
-#ifdef VTABLE_PROFILE
- printf("\n<PROF:1>--------\n");
- g_blow_chunks();
- g_mem_profile();
-#endif
-
- g_blow_chunks();
-
-#if defined(USE_ALLOCATORS) && defined(DELAY_ALLOCATOR_FREE)
- MEMOP(gfsm_allocators_free());
-#endif
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/memtest.c b/gfsm/gfsm/src/libgfsm/tests/memtest.c
deleted file mode 100644
index edb1492..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/memtest.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <glib.h>
-#include <gfsmAlphabet.h>
-
-void dofree (gpointer p) { g_free(p); }
-
-int main (void) {
- gfsmAlphabet *a;
- g_mem_set_vtable(glib_mem_profiler_table);
-
- //a = (gfsmAlphabet*)g_new0(gfsmPointerAlphabet,1);
- a = gfsm_string_alphabet_new();
-
- gfsm_alphabet_insert(a,"foo",42);
-
- gfsm_alphabet_free(a);
-
- printf("<CHUNKS:1>--------\n");
- //g_mem_chunk_info();
-
-
-
- printf("<PROF:1>--------\n");
- g_mem_profile();
- g_blow_chunks();
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/module/.cvsignore b/gfsm/gfsm/src/libgfsm/tests/module/.cvsignore
deleted file mode 100644
index 58d248b..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/module/.cvsignore
+++ /dev/null
@@ -1,18 +0,0 @@
-*~
-.*~
-
-*.gfst
-*.output
-*.lex.c
-*.lex.h
-*.tab.c
-*.tab.h
-*.gz
-*.so
-*.o
-
-tagh*
-*.dat
-negra*
-
-mod1test
diff --git a/gfsm/gfsm/src/libgfsm/tests/module/Makefile b/gfsm/gfsm/src/libgfsm/tests/module/Makefile
deleted file mode 100644
index c310837..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/module/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-TARGETS = mod1test libmod1a.so libmod1b.so
-KNOWN_TARGETS = mod1test libmod1a.so libmod1b.so
-
-CC = gcc
-#CC = ccmalloc --no-wrapper gcc
-LD = $(CC)
-
-CPPFLAGS = $(shell pkg-config --cflags-only-I gmodule-2.0)
-#CFLAGS ?= -O2 -pipe
-#CFLAGS ?= -Wall -g
-#CFLAGS += -Wall -g
-CFLAGS ?= -g
-CFLAGS += -Wall -fPIC -DPIC
-
-LDFLAGS = $(shell pkg-config --libs-only-L gmodule-2.0)
-LIBS = $(shell pkg-config --libs-only-l gmodule-2.0) -lm
-
-LDFLAGS_MODULE = -shared $(LDFLAGS)
-
-all: $(TARGETS)
-
-##-- keep intermediate files
-.SECONDARY:
-
-##-- PATTERN: .c -> .o
-%.o: %.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
-
-##-- clean
-clean:
- rm -f *.o *.lo *.tab.[ch] *.lex.[ch] $(KNOWN_TARGETS)
-
-##-- modules
-lib%.so: %.o
- $(LD) $(LDFLAGS_MODULE) -o $@ $^ $(LIBS)
-
-##-- Executables
-%test: %test.o
- $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
diff --git a/gfsm/gfsm/src/libgfsm/tests/module/mod1a.c b/gfsm/gfsm/src/libgfsm/tests/module/mod1a.c
deleted file mode 100644
index 69674c5..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/module/mod1a.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-
-void foo(void) {
- printf("mod1a:foo() called.\n");
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/module/mod1b.c b/gfsm/gfsm/src/libgfsm/tests/module/mod1b.c
deleted file mode 100644
index 4705f7c..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/module/mod1b.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-
-void foo(void) {
- printf("mod1b:foo() called.\n");
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/module/mod1test.c b/gfsm/gfsm/src/libgfsm/tests/module/mod1test.c
deleted file mode 100644
index 6389972..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/module/mod1test.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <stdio.h>
-#include <glib.h>
-#include <gmodule.h>
-
-typedef void (*fooFunc) (void);
-
-int main(int argc, char **argv) {
- int i;
- const gchar *prog = argv[0];
- //const gchar *moddir = g_getenv("PWD"); //-- get module directory (hack)
- const gchar *moddir = ".";
- gchar *modpath;
- GModule *mod;
- fooFunc foofunc;
-
- g_assert(g_module_supported());
-
- for (i=1; i < argc; i++) {
- //-- build full module pathname
- modpath = g_module_build_path(moddir,argv[i]);
- printf("%s: argv[%d]='%s': moddir='%s', modpath='%s'\n", prog, i, moddir, argv[i], modpath);
- //--
- //modpath = argv[i];
- //printf("%s: argv[%d]='%s': modfile='%s'\n", prog, i, argv[i], modpath);
-
- //-- open module
- if ( !(mod = g_module_open(modpath,G_MODULE_BIND_LOCAL)) ) {
- g_printerr("%s: could not load module '%s': %s - skipping\n", prog, modpath, g_module_error());
- if (modpath != argv[i]) g_free(modpath);
- continue;
- }
- printf("-> open(): %p\n", mod);
-
- //-- get symbol 'foo' from module
- if (!g_module_symbol(mod,"foo",(gpointer *)&foofunc)) {
- g_printerr("%s: could not load symbol 'foo' from module '%s': %s\n", prog, modpath, g_module_error());
- g_module_close(mod);
- if (modpath != argv[i]) g_free(modpath);
- continue;
- }
- printf("-> symbol('foo'): %p\n", foofunc);
-
- //-- call 'foo' as a foofunc
- printf("-> calling foo(): ");
- foofunc();
-
- //-- cleanup
- if (modpath != argv[i]) g_free(modpath);
- g_module_close(mod);
- }
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/nofinal.tfst b/gfsm/gfsm/src/libgfsm/tests/nofinal.tfst
deleted file mode 100644
index ab866fa..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/nofinal.tfst
+++ /dev/null
@@ -1 +0,0 @@
-0 0 1 1
diff --git a/gfsm/gfsm/src/libgfsm/tests/offsettest.c b/gfsm/gfsm/src/libgfsm/tests/offsettest.c
deleted file mode 100644
index bec8e8f..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/offsettest.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <gfsm.h>
-#include <glib.h>
-#include <stdio.h>
-
-static const gulong count_test
-//= 1048576UL //== 2^20
-//= 16777216UL //== 2^24
-//= 33554432UL //==2^25
-= 268435456UL //==2^28
-//= 4294967295UL //== 2^32-1
-;
-
-//======================================================================
-// Basic bench subs
-
-inline gfsmLabelId get_lower(gfsmArc *a) { return a->lower; }
-inline gfsmLabelId get_upper(gfsmArc *a) { return a->upper; }
-inline gfsmLabelId get_label_offset(gfsmArc *a, gint offset) {
- return *((gfsmLabelId*)G_STRUCT_MEMBER_P(&a,offset));
-}
-
-//======================================================================
-// Bench: literal: lower
-
-double bench_literal_lower(gfsmArc *a) {
- gfsmLabelId l;
- GTimer *timer = g_timer_new();
- gulong i;
- double elapsed;
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- l = get_lower(a);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
- g_timer_destroy(timer);
- return elapsed;
-}
-
-//======================================================================
-// Bench: offset
-
-double bench_offset(gfsmArc *a, gint lab_offset) {
- gfsmLabelId l;
- GTimer *timer = g_timer_new();
- gulong i;
- double elapsed;
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- l = get_label_offset(a,lab_offset);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
- g_timer_destroy(timer);
- return elapsed;
-}
-
-//======================================================================
-// Bench: offset: lower
-
-#define bench_offset_lower(a) bench_offset((a),G_STRUCT_OFFSET(gfsmArc, lower))
-
-
-//======================================================================
-// MAIN
-int main(int argc, char **argv) {
- gfsmArc a = {0,1,2,3,4.5};
- double elapsed_literal, elapsed_offset, count_dbl=count_test;
-
- printf("G_STRUCT_OFFSET(gfsmArc, lower)=%d: *()=%d\n",
- G_STRUCT_OFFSET(gfsmArc, lower),
- *((gfsmLabelId*)G_STRUCT_MEMBER_P(&a,G_STRUCT_OFFSET(gfsmArc, lower)))
- );
-
- printf("G_STRUCT_OFFSET(gfsmArc, upper)=%d: *()=%d\n",
- G_STRUCT_OFFSET(gfsmArc, upper),
- *((gfsmLabelId*)G_STRUCT_MEMBER_P(&a,G_STRUCT_OFFSET(gfsmArc, upper)))
- );
-
- printf("G_STRUCT_OFFSET(gfsmArc, weight)=%d: *()=%g\n",
- G_STRUCT_OFFSET(gfsmArc, weight),
- *((gfsmWeight*)G_STRUCT_MEMBER_P(&a,G_STRUCT_OFFSET(gfsmArc, weight)))
- );
-
- //-- bench
- elapsed_literal = bench_literal_lower(&a);
- elapsed_literal = bench_literal_lower(&a);
- //
- elapsed_offset = bench_offset_lower(&a);
- elapsed_offset = bench_offset_lower(&a);
- //
- //
- fprintf(stderr, "%16s: %.2f sec, %ld iters, %.2e iter/sec\n",
- "literal", elapsed_literal, count_test, count_dbl/elapsed_literal);
- fprintf(stderr, "%16s: %.2f sec, %ld iters, %.2e iter/sec\n",
- "offset", elapsed_offset, count_test, count_dbl/elapsed_offset);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/ortest.c b/gfsm/gfsm/src/libgfsm/tests/ortest.c
deleted file mode 100644
index 8327e0b..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/ortest.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-int main(void) {
- int x=0, y=-1;
- int z = x||y;
- printf("x||y=%d\n", z);
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/pathtest.c b/gfsm/gfsm/src/libgfsm/tests/pathtest.c
deleted file mode 100644
index 86a3ad3..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/pathtest.c
+++ /dev/null
@@ -1,289 +0,0 @@
-#include <gfsm.h>
-
-
-//#define USE_VTABLE 1
-//#define USE_ALLOCATORS 1
-//#define DELAY_ALLOCATOR_FREE 1
-
-#define NEW_FST 1
-
-//#define MAKE_SLIST 1
-//#define MAKE_LIST 1
-//#define MAKE_FST 1
-//#define COMPILE_FST 1
-#define LOAD_FST 1
-//#define LOAD_EMPTY
-//#define LOAD_NOFINAL
-
-#define LOAD_NITERS 1
-//#define LOAD_NITERS 10
-//#define LOAD_NITERS 32768
-//#define LOAD_NITERS 65535
-//#define LOAD_NITERS 131072
-//#define LOAD_NITERS 262144
-//#define LOAD_NITERS 524288
-//#define LOAD_NITERS 1048576
-
-
-#define NEW_ABET 1
-#define LOAD_ABET 1
-
-//#define DO_INPUT 1
-//#define DO_LOOKUP 1
-//#define DO_PATHS 1
-//#define DO_STRINGS 1
-//#define DO_PTRARRAY 1
-
-#define NITERS 0
-//#define NITERS 1
-//#define NITERS 10
-//#define NITERS 1024
-//#define NITERS 65536
-//#define NITERS 131072
-//#define NITERS 262144
-//#define NITERS 524288
-//#define NITERS 1048576
-
-//#define PRINT_CHUNK_INFO 1
-//#define DO_PROFILE 1
-
-const char *progname = "pathtest";
-const char *labfile = "test.lab";
-
-#if defined(LOAD_EMPTY)
-const char *fstfile = "empty.gfst";
-const char *tfstfile = "empty.tfst";
-#elif defined(LOAD_NOFINAL)
-const char *fstfile = "nofinal.gfst";
-const char *tfstfile = "nofinal.tfst";
-#else
-const char *fstfile = "lkptest.gfst";
-const char *tfstfile = "lkptest.tfst";
-#endif
-
-
-gfsmLabelVector *input = NULL;
-gfsmAlphabet *abet = NULL;
-gfsmAutomaton *fst = NULL;
-gfsmAutomaton *result = NULL;
-gfsmSet *paths = NULL;
-GSList *strings = NULL;
-GPtrArray *ptrarray = NULL;
-gfsmError *err = NULL;
-GSList *sltmp = NULL;
-gfsmState *st = NULL;
-gfsmArc *arc=NULL;
-gfsmArcList *al=NULL;
-char line[256];
-
-
-gpointer my_malloc(gsize n_bytes)
-{
- return (gpointer)malloc(n_bytes);
-}
-
-gpointer my_realloc(gpointer mem, gsize n_bytes)
-{
- return (gpointer)realloc(mem, n_bytes);
-}
-
-void my_free(gpointer mem)
-{
- free(mem);
-}
-
-GMemVTable my_vtable =
- {
- my_malloc,
- my_realloc,
- my_free,
- NULL,
- NULL,
- NULL
- };
-
-#define MEMOP(code) \
- fprintf(stderr,"%s\n", #code); \
- code;
-
-int main(int argc, char **argv) {
- int i;
-
- //-- memory debugging
-#if defined(DO_PROFILE)
- g_mem_set_vtable(glib_mem_profiler_table);
-#elif defined(USE_VTABLE)
- g_mem_set_vtable(&my_vtable);
-#endif
-
- //-- setup gfsm allocators
-#if defined(USE_ALLOCATORS)
- MEMOP(gfsm_allocators_enable());
-#endif
-
- //-- load or make fst
-#ifdef NEW_FST
- MEMOP(fst = gfsm_automaton_new(););
-
-#if defined(MAKE_SLIST)
- //-- this is the culprit!
- MEMOP(al = g_slist_prepend(NULL,NULL));
- MEMOP(g_slist_free(al));
-#elif defined(MAKE_LIST)
- {
- GList *l=NULL;
- MEMOP(l=g_list_prepend(NULL,NULL));
- MEMOP(g_list_free(l));
- }
-#elif defined(MAKE_FST)
- MEMOP(st = gfsm_automaton_get_state(fst,0)); //-- ok
- MEMOP(gfsm_automaton_set_final_state(fst, 0, TRUE)); //-- ok
-
- MEMOP(gfsm_automaton_add_arc(fst,0,0,1,1,0)); //-- NOT ok!
-
- //-- alloc
- //MEMOP(arc=gfsm_arc_new_full(0,1,1,0)); //--ok
- //MEMOP(st->arcs = g_slist_prepend((gpointer)arc,st->arcs)); //-- ok w/ allocator
-
- //-- free
- //MEMOP(g_slist_free(st->arcs); st->arcs=NULL;); //-- ok w/ allocator
- //MEMOP(gfsm_arc_free(arc)); //-- /ok
-
-#elif defined(COMPILE_FST)
- fprintf(stderr,"gfsm_automaton_compile_filename(\"%s\");\n", tfstfile);
- if (!gfsm_automaton_compile_filename(fst,tfstfile,&err)) {
- fprintf(stderr,"%s: compile failed for '%s': %s\n", progname, tfstfile, (err ? err->message : "?"));
- exit(3);
- }
- //g_mem_profile();
-#elif defined(LOAD_FST)
- fprintf(stderr,"gfsm_automaton_load_bin_filename(\"%s\"); //---[x %d]---\n", fstfile, LOAD_NITERS);
- for (i=0; i < LOAD_NITERS; i++) {
- if (fst) gfsm_automaton_free(fst);
- fst = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fst,fstfile,&err)) {
- fprintf(stderr,"%s: load failed for '%s': %s\n", progname, fstfile, (err ? err->message : "?"));
- exit(3);
- }
- g_blow_chunks();
- }
- //g_mem_profile();
-#endif // make or load FST
-#endif // NEW_FST
-
- //-- load labels
-#ifdef NEW_ABET
- MEMOP(abet = gfsm_string_alphabet_new(););
-#ifdef LOAD_ABET
- fprintf(stderr,"gfsm_alphabet_load_filename(\"%s\");\n", labfile);
- if (!gfsm_alphabet_load_filename(abet,labfile,&err)) {
- fprintf(stderr,"%s: load failed for labels file '%s': %s\n",
- progname, labfile, (err ? err->message : "?"));
- exit(2);
- }
- //g_mem_profile();
-#endif //-- LOAD_ABET
-#endif //-- NEW_ABET
-
- //-- setup input vector
-#ifdef DO_INPUT
- MEMOP(input = g_ptr_array_new());
- MEMOP(g_ptr_array_add(input,(gpointer)2));
- MEMOP(g_ptr_array_add(input,(gpointer)2));
- MEMOP(g_ptr_array_add(input,(gpointer)3));
-#endif //-- DEFINE_INPUT
-
- //-- guts
- fprintf(stderr, "\n--bench[%d] :lookup=%d, paths=%d, strings=%d, ptrarray=%d--\n\n",
- NITERS,
-#ifdef DO_LOOKUP
- 1
-#else
- 0
-#endif
- ,
-#ifdef DO_PATHS
- 1
-#else
- 0
-#endif
- ,
-#ifdef DO_STRINGS
- 1
-#else
- 0
-#endif
- ,
-#ifdef DO_PTRARRAY
- 1
-#else
- 0
-#endif
- );
-
- for (i=0; i < NITERS; i++) {
-#ifdef DO_LOOKUP
- result = gfsm_automaton_lookup(fst, input, result);
-#endif
-#ifdef DO_PATHS
- paths = gfsm_automaton_paths(result,paths);
-#endif
-#ifdef DO_STRINGS
- strings = gfsm_paths_to_strings(paths, abet, NULL, fst->sr, TRUE, TRUE, strings);
-#endif
-#ifdef DO_PTRARRAY
- ptrarray=g_ptr_array_sized_new(gfsm_set_size(paths));
- gfsm_set_to_ptr_array(paths, ptrarray);
-#endif
-
- //-- cleanup
- for (sltmp=strings; sltmp; sltmp=sltmp->next) { g_free(sltmp->data); }
- if (ptrarray) g_ptr_array_free(ptrarray,TRUE);
- if (strings) g_slist_free(strings);
- if (paths) gfsm_set_clear(paths);
- g_blow_chunks();
- }
-
- //-- pop gfsm allocators (too early: segfaults)
- /*
-#if defined(USE_ALLOCATORS) && !defined(DELAY_ALLOCATOR_FREE)
- MEMOP(gfsm_allocators_disable());
-#endif
- */
-
- //-- cleanup
- if (result) { MEMOP(gfsm_automaton_free(result)); }
- if (paths) { MEMOP(gfsm_set_free(paths)); }
- if (input) { MEMOP(g_ptr_array_free(input,TRUE)); }
- if (fst) { MEMOP(gfsm_automaton_free(fst)); }
- if (abet) { MEMOP(gfsm_alphabet_free(abet);); }
-
- //-- pop gfsm allocators
-#if defined(USE_ALLOCATORS) && !defined(DELAY_ALLOCATOR_FREE)
- MEMOP(gfsm_allocators_free());
-#endif
-
- //-- memory debugging
-#ifdef PRINT_CHUNK_INFO
- printf("\n<CHUNKS:1>--------\n");
- g_blow_chunks();
- g_mem_chunk_info();
-#endif
- //
-#ifdef DO_PROFILE
- printf("\n<PROF:1>--------\n");
- g_blow_chunks();
- g_mem_profile();
-#endif
-
-#if defined(USE_ALLOCATORS) && defined(DELAY_ALLOCATOR_FREE)
- MEMOP(gfsm_allocators_free());
-#endif
-
- {
- printf("OK to exit? ");
- scanf("%s", &line);
- }
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/pathtest.tfst b/gfsm/gfsm/src/libgfsm/tests/pathtest.tfst
deleted file mode 100644
index fd189c5..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/pathtest.tfst
+++ /dev/null
@@ -1,9 +0,0 @@
-0 2 3 3 1
-0 1 2 2 1
-1 6 2 2 1
-2 4 3 3 1
-2 3 2 2 1
-4 5 1 1 1
-5 0
-6 7 3 3 1
-7 0
diff --git a/gfsm/gfsm/src/libgfsm/tests/priotest.c b/gfsm/gfsm/src/libgfsm/tests/priotest.c
deleted file mode 100644
index c56a39e..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/priotest.c
+++ /dev/null
@@ -1,171 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-
-const char *prog=NULL;
-
-//======================================================================
-// typedefs
-typedef enum {
- gfsmAFNone = 0x0, /**< no sort field */
- gfsmAFLower = 0x1, /**< sort by lower label */
- gfsmAFUpper = 0x2, /**< sort by upper label */
- gfsmAFWeight = 0x3, /**< sort by weight (refers to semiring) */
- gfsmAFSource = 0x4, /**< sort by arc source (if supported and meaningful) */
- gfsmAFTarget = 0x5, /**< sort by arc target (if supported and meaningful) */
- gfsmAFUser = 0x6, /**< user-defined sort function */
- gfsmAFAll = 0x7, /**< not really a sort field: mask of all valid sort fields */
- gfsmAFReverse = 0x8, /**< not really a sort field: if set, indicates that arc comparisons should be reversed */
- gfsmAFMask = 0xf /**< not really a sort field: mask of valid sort fields & reverse flag */
-} gfsmArcField;
-
-typedef enum {
- gfsmAFNone = 0x0, /**< '_': no sort field */
- gfsmAFLower = 0x1, /**< 'l': sort by lower label */
- gfsmAFUpper = 0x2, /**< 'u': sort by upper label */
- gfsmAFWeight = 0x3, /**< 'w': sort by weight (refers to semiring) */
- gfsmAFSource = 0x4, /**< 's': sort by arc source (if supported and meaningful) */
- gfsmAFTarget = 0x5, /**< 't': sort by arc target (if supported and meaningful) */
- gfsmAFLowerR = 0x6, /**< 'L': reverse sort by lower label */
- gfsmAFUpperR = 0x7, /**< 'U': reverse sort by upper label */
- gfsmAFWeightR = 0x8, /**< 'W': reverse sort semiring weight */
- gfsmAFSourceR = 0x9, /**< 'S': reverse sort source state (if supported and meaningful) */
- gfsmAFTargetR = 0xa, /**< 'T': reverse sort target state (if supported and meaningful) */
- gfsmAFUser = 0xf /**< 'x': pseudo-field for user-defined comparisons */
-} gfsmArcFieldId;
-
-#define gfsmArcFieldShift 4 //-- number of bits in a single logical ::gfsmArcField element
-const guint32 gfsmNArcFields = 5; //-- maximum 'nth' paramter supported by ::gfsmArcFieldMask
-
-typedef guint32 gfsmArcFieldMask; //-- mask of ::gfsmArcField values, left-shifted by ::gfsmArcFieldShift
-
-
-const guint32 gfsmAFM_L = gfsmAFLower;
-const guint32 gfsmAFM_LU = gfsmAFLower|(gfsmAFUpper<<gfsmArcFieldShift);
-const guint32 gfsmAFM_LUW = gfsmAFLower|(gfsmAFUpper<<gfsmArcFieldShift)|(gfsmAFWeight<<(2*gfsmArcFieldShift));
-
-gfsmArcFieldMask gfsm_arc_field_mask_new(guint nth, gfsmArcField field, gboolean reverse)
-{
- gfsmArcFieldMask m = field;
- if (reverse) m |= gfsmAFReverse;
- return m << (nth*gfsmArcFieldShift);
-}
-
-gfsmArcFieldMask gfsm_arc_field_mask_add(gfsmArcFieldMask m, guint nth, gfsmArcField field, gboolean reverse)
-{ return (m | gfsm_arc_field_mask_new(nth,field,reverse)); }
-
-gfsmArcFieldMask gfsm_arc_field_mask_clear(gfsmArcFieldMask m, guint nth)
-{ return m & ((~gfsmAFMask)<<(nth*gfsmArcFieldShift)); }
-
-gfsmArcField gfsm_arc_field_mask_get_field(gfsmArcFieldMask m, guint nth)
-{ return (m>>(nth*gfsmArcFieldShift))&gfsmAFAll; }
-
-gboolean gfsm_arc_field_mask_get_reverse(gfsmArcFieldMask m, guint nth)
-{ return ((m>>(nth*gfsmArcFieldShift))&gfsmAFReverse) ? TRUE : FALSE; }
-
-
-//======================================================================
-// parse
-gfsmArcFieldMask parse_mask(const char *str)
-{
- gfsmArcFieldMask m = 0;
- gint i;
- guint nth=0;
- /*
- gint max_tokens = 32;
- gchar **toks = g_strsplit(str,",; \n\t",max_tokens);
-
- //-- parse
- for (i=0; toks[i] != NULL; i++) {
- gchar *tok = toks[i];
- g_strstrip(tok);
- }
- */
- for (i=0; str[i] && nth < gfsmNArcFields; i++) {
- switch (str[i]) {
- case 'l' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFLower,0); break;
- case 'L' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFLower,1); break;
-
- case 'u' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFUpper,0); break;
- case 'U' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFUpper,1); break;
-
- case 'w' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFWeight,0); break;
- case 'W' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFWeight,1); break;
-
- case 's' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFSource,0); break;
- case 'S' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFSource,1); break;
-
- case 't' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFTarget,0); break;
- case 'T' : m |= gfsm_arc_field_mask_new(nth++,gfsmAFTarget,1); break;
-
- //-- silently ignore these
- case 'x':
- case 'X':
- case '-':
- case ',':
- case ' ':
- case '\t':
- case '\n':
- break;
-
- default:
- g_printerr("%s: character '%c' is not in [sStTlLuUwW] in field string '%s' - skipping\n", prog, str[i], str);
- break;
- }
- }
- if (str[i] && nth==gfsmNArcFields) {
- g_printerr("%s: ignoring trailing characters '%s' in field string '%s'\n", prog, (str+i), str);
- }
-
- //-- cleanup
- //g_strfreev(toks);
-
- return m;
-}
-
-//======================================================================
-// dump
-
-const char *mask_field_str(gfsmArcFieldMask afm, guint nth)
-{
- switch (gfsm_arc_field_mask_get_field(afm, nth)) {
- case gfsmAFNone: return "none";
- case gfsmAFLower: return "lower";
- case gfsmAFUpper: return "upper";
- case gfsmAFWeight: return "weight";
- case gfsmAFSource: return "source";
- case gfsmAFTarget: return "target";
- default: return "?";
- }
- return "?";
-}
-const char *mask_reverse_str(gfsmArcFieldMask afm, guint nth)
-{
- return gfsm_arc_field_mask_get_reverse(afm, nth) ? ">" : "<";
-}
-
-void dump_mask(gfsmArcFieldMask afm, const char *str)
-{
- printf("%s: str='%s': priorities = %u = %#0.6x = { %s%s, %s%s, %s%s, %s%s, %s%s }\n",
- prog, str, afm, afm,
- mask_field_str(afm,0), mask_reverse_str(afm,0),
- mask_field_str(afm,1), mask_reverse_str(afm,1),
- mask_field_str(afm,2), mask_reverse_str(afm,2),
- mask_field_str(afm,3), mask_reverse_str(afm,3),
- mask_field_str(afm,4), mask_reverse_str(afm,4)
- );
-}
-
-//======================================================================
-// MAIN
-int main(int argc, char **argv) {
- int i;
- gfsmArcFieldMask afm = 0;
-
- prog = argv[0];
- for (i=1; i < argc; i++) {
- afm = parse_mask(argv[i]);
- dump_mask(afm, argv[i]);
- }
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/prtest.c b/gfsm/gfsm/src/libgfsm/tests/prtest.c
deleted file mode 100644
index d93f207..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/prtest.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <gfsm.h>
-#include <stdlib.h>
-
-//char *fsmfile = "prtest.tfst";
-char *fsmfile = "prtest.gfst";
-gfsmError *errp = NULL;
-
-int main (int argc, char **argv) {
- gfsmAutomaton *fsm=NULL;
-
- if (argc > 1) fsmfile = argv[1];
-
- fsm = gfsm_automaton_new();
-
- //gfsm_automaton_compile_filename(fsm,fsmfile,&errp);
- gfsm_automaton_load_bin_filename(fsm,fsmfile,&errp);
- if (errp) { g_printerr("error: %s\n", errp->message); exit(1); }
-
- gfsm_automaton_prune(fsm);
- gfsm_automaton_renumber_states(fsm);
-
- gfsm_automaton_print_file(fsm,stdout,&errp);
- if (errp) { g_printerr("error: %s\n", errp->message); exit(1); }
-
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/prtest.tfst b/gfsm/gfsm/src/libgfsm/tests/prtest.tfst
deleted file mode 100644
index f3ebd16..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/prtest.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-0 1 1 1 0
-0 0
-1 0
-2 0
-3 0
-4 0
-5 0
-6 0
diff --git a/gfsm/gfsm/src/libgfsm/tests/ptest.c b/gfsm/gfsm/src/libgfsm/tests/ptest.c
deleted file mode 100644
index 44911cd..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/ptest.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-
-typedef struct _xstruc {
- int x;
- int y;
-} xstruc;
-
-int main (void) {
- xstruc xs = {42,24};
- xstruc *xsp = &xs;
- void *vp = xsp;
- char *s = NULL;
- char *s2;
-
- printf ("&xs =%p ; xsp =%p ; vp =%p\n", &xs, xsp, vp);
- printf ("&xs.x =%p ; &xs.y =%p\n", &xs.x, &xs.y);
- printf ("&xsp->x=%p ; &xsp->y=%p\n", &xsp->x, &xsp->y);
- printf ("(vp)->x=%p ; (vp)->y=%p\n", &((xstruc*)vp)->x, &((xstruc*)vp)->y);
-
- printf("\n");
- printf("s=%p ; s2=%p\n", s, g_strdup(s));
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/rudtest.c b/gfsm/gfsm/src/libgfsm/tests/rudtest.c
deleted file mode 100644
index 7329b70..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/rudtest.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <gfsm.h>
-#include <gfsmDebug.h>
-#include <stdlib.h>
-
-//char *fsm1file = "rudtest.gfst";
-char *fsm1file = "rudtest2.gfst";
-char *fsm2file = "rudtest.gfst";
-
-gfsmError *errp = NULL;
-
-void hackme(gfsmAutomaton *fsm1, gfsmAutomaton *fsm2, char *label)
-{
- printf("<%s>.a : reverse(fsm1)\n", label);
- gfsm_automaton_reverse(fsm1);
-
- printf("<%s>.b : union(fsm1,fsm2)\n", label);
- gfsm_automaton_union(fsm1, fsm2);
-
- printf("<%s>.c : determinize(fsm1)\n", label);
- gfsm_automaton_determinize(fsm1);
-
- printf("<%s> : done.\n", label);
-}
-
-void print_sizes(void)
-{
- //-- show some memory sizes:
- fprintf(stderr, "%-32s | %6s\n", "TYPE", "SIZE");
-#define PRINTSIZE(type) fprintf(stderr, "%-32s | %u\n", #type, sizeof(type))
- PRINTSIZE(gfsmAlphabet);
- PRINTSIZE(gfsmIdentityAlphabet);
- PRINTSIZE(gfsmRangeAlphabet);
-
- PRINTSIZE(gfsmArc);
- PRINTSIZE(gfsmArcIter);
- PRINTSIZE(gfsmArcList);
- PRINTSIZE(gfsmAutomaton);
- PRINTSIZE(gfsmAutomatonFlags);
- PRINTSIZE(gfsmAutomatonHeader);
- PRINTSIZE(gfsmSemiring);
- //PRINTSIZE(gfsmSet);
- //PRINTSIZE(gfsmSetUnionData);
- PRINTSIZE(gfsmWeightedStateSet);
- PRINTSIZE(gfsmState);
- PRINTSIZE(gfsmStatePair);
- PRINTSIZE(gfsmStateSet);
- PRINTSIZE(gfsmStateSetIter);
- PRINTSIZE(gfsmStoredState);
- PRINTSIZE(gfsmStoredArc);
- PRINTSIZE(gfsmVersionInfo);
-#undef PRINTSIZE
-}
-
-void rudtest_construct(gfsmAutomaton *fsm)
-{
- gfsm_automaton_clear(fsm);
- fsm->root_id = 0;
- gfsm_automaton_add_state_full(fsm,0);
- gfsm_automaton_add_state_full(fsm,1);
- gfsm_automaton_add_state_full(fsm,2);
- gfsm_automaton_set_final_state(fsm,2,TRUE);
- gfsm_automaton_add_arc(fsm,0,1,1,1,0);
-}
-
-int main (int argc, char **argv) {
- gfsmAutomaton *fsm1=NULL, *fsm2=NULL;
-
- //g_thread_init(NULL);
- GFSM_DEBUG_INIT();
-
- //print_sizes();
-
- if (argc > 1) fsm1file = argv[1];
- if (argc > 2) fsm2file = argv[2];
-
- fsm1 = gfsm_automaton_new();
- fsm2 = gfsm_automaton_new();
-
- gfsm_automaton_load_bin_filename(fsm1,fsm1file,&errp);
- //rudtest_construct(fsm1);
- if (errp) { g_printerr("error: %s\n", errp->message); exit(1); }
-
- if (fsm2) gfsm_automaton_load_bin_filename(fsm2,fsm1file,&errp);
- if (errp) { g_printerr("error: %s\n", errp->message); exit(1); }
-
- hackme(fsm1,fsm2,"1");
- hackme(fsm1,fsm2,"2");
- hackme(fsm1,fsm2,"3");
- hackme(fsm1,fsm2,"4");
- /* */
-
- if (fsm1) gfsm_automaton_free(fsm1);
- if (fsm2) gfsm_automaton_free(fsm2);
-
-
- GFSM_DEBUG_FINISH();
- GFSM_DEBUG_PRINT();
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/rudtest.tfst b/gfsm/gfsm/src/libgfsm/tests/rudtest.tfst
deleted file mode 100644
index ac8c248..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/rudtest.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 1 1 0
-1 2 2 2 0
-2 0
diff --git a/gfsm/gfsm/src/libgfsm/tests/rudtest2.tfst b/gfsm/gfsm/src/libgfsm/tests/rudtest2.tfst
deleted file mode 100644
index 65261c9..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/rudtest2.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 1 1 1 0
-1 2 2 2 0
-2 3 3 3 0
-3 4 4 4 0
-4 0
diff --git a/gfsm/gfsm/src/libgfsm/tests/seek2test.c b/gfsm/gfsm/src/libgfsm/tests/seek2test.c
deleted file mode 100644
index cf12ac8..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/seek2test.c
+++ /dev/null
@@ -1,259 +0,0 @@
-#include <gfsm.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "labprobs.h"
-
-/*======================================================================
- * Globals
- */
-const char *prog = "seek2test";
-
-const char *fsmfile = "tagh-chopped.gfst";
-//const char *xfsmfile = "tagh-lo.gfstx";
-
-gfsmStateId qid_test = 0;
-guint out_degree_test = 0;
-gulong count_test =
-//1024
-//1048576
-4194304
-//16777216
-;
-
-//#define BENCH_SORTED 1
-#undef BENCH_SORTED
-
-/*======================================================================
- * bench_seek_vanilla()
- */
-double bench_seek_vanilla(gfsmAutomaton *fsm) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(gfsm_automaton_out_degree(fsm,qid_test));
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = qid_test;
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcIter ai;
- ary->len=0;
- for (gfsm_arciter_open(&ai,fsm,qid), gfsm_arciter_seek_lower(&ai,lab);
- gfsm_arciter_ok(&ai);
- gfsm_arciter_next(&ai), gfsm_arciter_seek_lower(&ai,lab))
- {
- gfsmArc *a = gfsm_arciter_arc(&ai);
- if (fsm->flags.sort_mode==gfsmASMLower && a->lower!=lab) break;
- g_ptr_array_add(ary, a);
- }
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_labx()
- */
-#ifndef SEEK_LABX_BINSEARCH_CUTOFF
-#define SEEK_LABX_BINSEARCH_CUTOFF 0
-//#define SEEK_LABX_BINSEARCH_CUTOFF 4
-//#define SEEK_LABX_BINSEARCH_CUTOFF 8
-//#define SEEK_LABX_BINSEARCH_CUTOFF 16
-//#define SEEK_LABX_BINSEARCH_CUTOFF 32
-//#define SEEK_LABX_BINSEARCH_CUTOFF 64
-//#define SEEK_LABX_BINSEARCH_CUTOFF 128
-//#define SEEK_LABX_BINSEARCH_CUTOFF 256
-#endif
-
-double bench_seek_labx(gfsmArcLabelIndex *labx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(gfsm_arc_label_index_out_degree(labx,qid_test));
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = qid_test;
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- gfsmArc *a;
- ary->len=0;
- gfsm_arcrange_open_label_index(&range,labx,qid);
- if ((range.max - range.min) <= SEEK_LABX_BINSEARCH_CUTOFF) {
- for ( ; gfsm_arcrange_ok(&range); gfsm_arcrange_next(&range) ) {
- a = gfsm_arcrange_arc(&range);
- if (a->lower<lab) continue;
- if (a->lower>lab) break;
- g_ptr_array_add(ary, a);
- }
- } else {
- for (gfsm_arcrange_seek_lower(&range,lab); gfsm_arcrange_ok(&range); gfsm_arcrange_next(&range)) {
- a = gfsm_arcrange_arc(&range);
- if (a->lower!=lab) break;
- g_ptr_array_add(ary, a);
- }
- }
- //gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-
-
-/*======================================================================
- * Report
- */
-GString *dat_header=NULL;
-GString *dat_data=NULL;
-gint dat_row=0;
-gint dat_col=0;
-
-void report_new_row(void) {
- fprintf(stderr, "%s: qid=%u, out_degree=%u\n", prog, qid_test, out_degree_test);
- //
- //-- save data for gnuplot output
- dat_col=0;
- if (!dat_header) dat_header = g_string_new("");
- if (!dat_data) dat_data = g_string_new("");
- if (dat_row==0) {
- g_string_append(dat_header,"#1:out_deg");
- }
- g_string_append_printf(dat_data, "%u", out_degree_test);
-}
-
-void report_column(char *label, double elapsed) {
- double iters_per_sec = ((double)count_test)/elapsed;
- //
- //-- to stderr
- fprintf(stderr, "BENCH[%16s]: %ld iters in %.2g sec: %.2g iters/sec\n",
- label, count_test, elapsed, iters_per_sec);
- fflush(stderr);
- //
- //-- to data strings
- if (dat_row==0) {
- g_string_append_printf(dat_header, "\t%d:%s_secs\t%d:%s_ips", (2*dat_col+2),label, (2*dat_col+3),label);
- }
- g_string_append_c(dat_data,'\t');
- g_string_append_printf(dat_data,"\t%g\t%g", elapsed,iters_per_sec);
- ++dat_col;
-}
-
-void report_end_row(void) {
- ++dat_row;
- g_string_append(dat_data,"\n");
-}
-
-void report_gnuplot(void) {
- fflush(stderr);
- printf("%s\n%s", dat_header->str, dat_data->str);
-}
-
-
-/*======================================================================
- * Main
- */
-int main(int argc, char **argv)
-{
- char *qid_str="0";
- gfsmError *err=NULL;
- int argi;
- //
- gfsmAutomaton *fsm=NULL;
- double elapsed_vanilla;
-#ifdef BENCH_SORTED
- gfsmAutomaton *fsm_sorted=NULL;
- double elapsed_sorted;
-#endif
- gfsmArcLabelIndex *labx=NULL;
- double elapsed_labx;
-
- //-- sanity check
- if (argc < 2) {
- fprintf(stderr, "Usage: %s [QID(s)...]\n", prog);
- exit(1);
- }
-
- //-- load probabilities & initialize
- load_label_probs();
- populate_seek_labels();
-
- //-- report
- fprintf(stderr, "%s: count=%lu\n", prog, count_test);
- fflush(stderr);
-
- //-- load/create: vanilla
- fprintf(stderr, "%s: loading vanilla automaton '%s'... ", prog, fsmfile); fflush(stderr);
- fsm = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fsm,fsmfile,&err)) {
- fprintf(stderr,"%s: load failed for '%s': %s\n", prog, fsmfile, (err ? err->message : "?"));
- exit(3);
- }
- fsm->flags.sort_mode = gfsmASMNone;
- fprintf(stderr, "loaded.\n"); fflush(stderr);
-
-#ifdef BENCH_SORTED
- //-- load/create: sorted
- fprintf(stderr, "%s: sorting... ", prog); fflush(stderr);
- fsm_sorted = gfsm_automaton_clone(fsm);
- gfsm_automaton_arcsort(fsm_sorted,gfsmASMLower);
- fprintf(stderr, "sorted.\n"); fflush(stderr);
-#endif
-
- //-- load/create: labx
- fprintf(stderr, "%s: indexing to gfsmArcLabelIndex... ", prog); fflush(stderr);
- labx = gfsm_automaton_to_arc_label_index_lower(fsm,NULL);
- fprintf(stderr, "indexed.\n"); fflush(stderr);
-
- //-- main loop
- for (argi=1; argi < argc; argi++) {
- qid_str = argv[argi];
- qid_test = strtol(qid_str,NULL,0);
- out_degree_test = gfsm_automaton_out_degree(fsm,qid_test);
-
- report_new_row();
-
- //-- benchmark: vanilla
- elapsed_vanilla = bench_seek_vanilla(fsm);
- report_column("vanilla", elapsed_vanilla);
-
-#ifdef BENCH_SORTED
- //-- benchmark: vanilla+sorted
- gfsm_automaton_arcsort(fsm,gfsmASMLower);
- elapsed_sorted = bench_seek_vanilla(fsm);
- report_column("sorted", elapsed_sorted);
-#endif
-
- //-- benchmark: indexed
- elapsed_labx = bench_seek_labx(labx);
- report_column("labx", elapsed_labx);
-
- report_end_row();
- }
-
- //-- gnuplot output
- report_gnuplot();
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-#ifdef BENCH_SORTED
- if (fsm_sorted) gfsm_automaton_free(fsm_sorted);
-#endif
- if (labx) gfsm_arc_label_index_free(labx);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/seek3test.c b/gfsm/gfsm/src/libgfsm/tests/seek3test.c
deleted file mode 100644
index 8c3e8af..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/seek3test.c
+++ /dev/null
@@ -1,611 +0,0 @@
-#include <gfsm.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/*======================================================================
- * Globals
- */
-const char *prog = "seek2test";
-
-gfsmStateId qid_test = 0;
-guint out_degree_test;
-gulong count_test_max =
-//1024UL //==2^10
-//1048576UL //==2^20
-2097152UL //==2^21
-//4194304UL //==2^22
-//16777216UL //==2^24
-//67108864UL //==2^26
-//268435456UL //==2^28
-;
-gulong count_test=0; //-- count_test_max/out_degree
-
-/*======================================================================
- * Label population
- */
-
-//--------------------------------------------------------------
-// globals
-GRand *grand = NULL;
-const guint32 grand_seed = 42;
-#define GRAND_USE_SEED 1
-//#undef GRAND_USE_SEED
-
-const guint32 n_labels = 128;
-const guint32 n_states = 8192;
-
-GArray *seekus = NULL; /*-- lab = g_array_index(seekus,i); 1<=i<=count_test --*/
-GArray *seekfrom = NULL; /*-- qid = g_array_index(seekus,i); 1<=i<=count_test --*/
-
-//--------------------------------------------------------------
-// random_label()
-gfsmLabelId random_label(void) {
- if (!grand) {
- grand = g_rand_new();
-#ifdef GRAND_USE_SEED
- g_rand_set_seed(grand,grand_seed);
-#endif
- }
- return g_rand_int_range(grand,0,n_labels);
-}
-
-//--------------------------------------------------------------
-// populate_seek_labels()
-void populate_seek_labels(void) {
- int i;
- gfsmLabelId lab;
- seekus = g_array_sized_new(FALSE,TRUE,sizeof(gfsmLabelId),count_test_max);
- for (i=0; i < count_test_max; i++) {
- lab = random_label();
- g_array_append_val(seekus,lab);
- }
-}
-
-//--------------------------------------------------------------
-// random_state()
-gfsmStateId random_state(void) {
- if (!grand) { grand = g_rand_new_with_seed(grand_seed); }
- return g_rand_int_range(grand,0,n_states);
-}
-
-//--------------------------------------------------------------
-// populate_seek_states()
-void populate_seek_states(void) {
- int i;
- seekfrom = g_array_sized_new(FALSE,TRUE,sizeof(gfsmStateId),count_test_max);
- for (i=0; i < count_test_max; i++) {
- gfsmStateId qid = random_state();
- g_array_append_val(seekfrom,qid);
- }
-}
-
-
-/*======================================================================
- * bench_seek_vanilla()
- */
-double bench_seek_vanilla(gfsmAutomaton *fsm) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId, i);
- gfsmLabelId lab = g_array_index(seekus, gfsmLabelId, i);
- gfsmArcIter ai;
- ary->len=0;
- for (gfsm_arciter_open(&ai,fsm,qid); gfsm_arciter_ok(&ai); gfsm_arciter_next(&ai)) {
- gfsmArc *a = gfsm_arciter_arc(&ai);
- if (a->lower != lab) continue;
- g_ptr_array_add(ary, a);
- }
- gfsm_arciter_close(&ai);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_sorted()
- */
-double bench_seek_sorted(gfsmAutomaton *fsm) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcIter ai;
- ary->len=0;
- for (gfsm_arciter_open(&ai,fsm,qid); gfsm_arciter_ok(&ai); gfsm_arciter_next(&ai)) {
- gfsmArc *a = gfsm_arciter_arc(&ai);
- if (a->lower < lab) continue;
- if (a->lower > lab) break;
- g_ptr_array_add(ary, a);
- }
- gfsm_arciter_close(&ai);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_tabx_vanilla()
- */
-double bench_seek_tabx_vanilla(gfsmArcTableIndex *tabx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- ary->len=0;
- for (gfsm_arcrange_open_table_index(&range,tabx,qid); gfsm_arcrange_ok(&range); gfsm_arcrange_next(&range)) {
- gfsmArc *a = gfsm_arcrange_arc(&range);
- if (a->lower != lab) continue;
- g_ptr_array_add(ary, a);
- }
- gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_tabx_sorted() : linear search
- */
-double bench_seek_tabx_sorted(gfsmArcTableIndex *tabx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- ary->len=0;
- for (gfsm_arcrange_open_table_index(&range,tabx,qid); gfsm_arcrange_ok(&range); gfsm_arcrange_next(&range)) {
- gfsmArc *a = gfsm_arcrange_arc(&range);
- if (a->lower < lab) continue;
- if (a->lower > lab) break;
- g_ptr_array_add(ary, a);
- }
- gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_tabx_sorted_2() : linear search (v2) [identical to v1]
- */
-double bench_seek_tabx_sorted_2(gfsmArcTableIndex *tabx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- ary->len=0;
- for (gfsm_arcrange_open_table_index(&range,tabx,qid); range.min<range.max; ++range.min) {
- if (range.min->lower < lab) continue;
- if (range.min->lower > lab) break;
- g_ptr_array_add(ary, range.min);
- }
- gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_tabx_seek_lib() : binary search: library function
- */
-inline void gfsm_arcrange_seek_lower(gfsmArcRange *range, gfsmLabelId find)
-{
- g_assert(range != NULL);
- while (gfsm_arcrange_ok(range) && gfsm_arcrange_arc(range)->lower < find)
- gfsm_arcrange_next(range);
-}
-
-double bench_seek_tabx_seek_lib(gfsmArcTableIndex *tabx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- ary->len=0;
- for (gfsm_arcrange_open_table_index(&range,tabx,qid), gfsm_arcrange_seek_lower(&range,lab);
- gfsm_arcrange_ok(&range);
- gfsm_arcrange_next(&range))
- {
- gfsmArc *a = gfsm_arcrange_arc(&range);
- if (a->lower > lab) break;
- g_ptr_array_add(ary, a);
- }
- gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_tabx_bsearch_inl() : binary search: inline function
- */
-#define BSEARCH_CUTOFF 16
-static inline gfsmArc *bsearch_lower(gfsmArc *min, gfsmArc *max, gfsmLabelId find)
-{
- while (min < max) {
- gint diff = max-min;
- if (diff < BSEARCH_CUTOFF) {
- do {
- if (min->lower >= find) break;
- min++;
- } while (min < max);
- return min;
- }
- else {
- gfsmArc *mid = min + diff/2;
- if (mid->lower < find) min = mid+1;
- else max = mid;
- }
- }
- return min;
-}
-
-double bench_seek_tabx_bsearch_inl(gfsmArcTableIndex *tabx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- ary->len=0;
- for (gfsm_arcrange_open_table_index(&range,tabx,qid), range.min=bsearch_lower(range.min,range.max,lab);
- gfsm_arcrange_ok(&range);
- gfsm_arcrange_next(&range))
- {
- gfsmArc *a = gfsm_arcrange_arc(&range);
- if (a->lower > lab) break;
- g_ptr_array_add(ary, a);
- }
- gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * bench_seek_tabx_bsearch_func() : binary search: inline function
- */
-static void bsearch_range_func(gfsmArcRange *range, gfsmLabelId find)
-{
- gfsmArc *min=range->min, *max=range->max;
- while (min < max) {
- gfsmArc *mid = min + (max-min)/2;
- if (mid->lower < find) min = mid+1;
- else max = mid;
- }
- range->min = min;
-}
-
-double bench_seek_tabx_bsearch_func(gfsmArcTableIndex *tabx) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(out_degree_test);
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = g_array_index(seekfrom,gfsmStateId,i);
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcRange range;
- ary->len=0;
- for (gfsm_arcrange_open_table_index(&range,tabx,qid), bsearch_range_func(&range,lab);
- gfsm_arcrange_ok(&range);
- gfsm_arcrange_next(&range))
- {
- gfsmArc *a = gfsm_arcrange_arc(&range);
- if (a->lower > lab) break;
- g_ptr_array_add(ary, a);
- }
- gfsm_arcrange_close(&range);
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-
-/*======================================================================
- * Report
- */
-GString *dat_header=NULL;
-GString *dat_data=NULL;
-gint dat_row=0;
-gint dat_col=0;
-
-void report_new_row(void) {
- fprintf(stderr, "%s: n_states=%u, n_labels=%u, out_degree=%u\n", prog, n_states, n_labels, out_degree_test);
- //
- //-- save data for gnuplot output
- dat_col=0;
- if (!dat_header) dat_header = g_string_new("");
- if (!dat_data) dat_data = g_string_new("");
- if (dat_row==0) {
- g_string_append(dat_header,"#1:out_deg");
- }
- g_string_append_printf(dat_data, "%u", out_degree_test);
-}
-
-void report_column(char *label, double elapsed) {
- double iters_per_sec = ((double)count_test)/elapsed;
- //
- //-- to stderr
- fprintf(stderr, "BENCH[%24s]: %ld iters in %5.3f sec: %7.2e iters/sec\n",
- label, count_test, elapsed, iters_per_sec);
- fflush(stderr);
- //
- //-- to data strings
- if (dat_row==0) {
- g_string_append_printf(dat_header, "\t%d:%s_secs\t%d:%s_ips", (2*dat_col+2),label, (2*dat_col+3),label);
- }
- g_string_append_c(dat_data,'\t');
- g_string_append_printf(dat_data,"\t%g\t%g", elapsed,iters_per_sec);
- ++dat_col;
-}
-
-void report_end_row(void) {
- ++dat_row;
- g_string_append(dat_data,"\n");
-}
-
-void report_gnuplot(void) {
- fflush(stderr);
- printf("%s\n%s", dat_header->str, dat_data->str);
-}
-
-
-/*======================================================================
- * Main
- */
-//#define BENCH_VANILLA 1
-//#define BENCH_SORTED 1
-//#define BENCH_TABX_VANILLA 1
-#define BENCH_TABX_SORTED 1
-//#define BENCH_TABX_SORTED_2 1
-//#define BENCH_TABX_SEEK_LIB 1
-#define BENCH_TABX_BSEARCH_FUNC 1
-//#define BENCH_TABX_BSEARCH_INL 1
-int main(int argc, char **argv)
-{
- char *out_degree_str="32";
- int argi, arci, qi;
- //
- gfsmAutomaton *fsm=NULL;
- double elapsed_vanilla=0;
- //
- gfsmAutomaton *fsm_sorted=NULL;
- double elapsed_sorted=0;
- //
- gfsmArcTableIndex *tabx=NULL;
- double elapsed_tabx_vanilla=0;
- //
- gfsmArcTableIndex *tabx_sorted=NULL;
- double elapsed_tabx_sorted=0;
- //
- gfsmArcTableIndex *tabx_sorted_2=NULL;
- double elapsed_tabx_sorted_2=0;
- //
- gfsmArcTableIndex *tabx_seek_lib=NULL;
- double elapsed_tabx_seek_lib=0;
- //
- gfsmArcTableIndex *tabx_bsearch_func=NULL;
- double elapsed_tabx_bsearch_func=0;
- //
- gfsmArcTableIndex *tabx_bsearch_inl=NULL;
- double elapsed_tabx_bsearch_inl=0;
-
- //-- sanity check
- if (argc < 2) {
- fprintf(stderr, "Usage: %s [OUT_DEGREE(s)...]\n", prog);
- exit(1);
- }
-
- //-- initialize labels to seek
- populate_seek_labels();
- populate_seek_states();
-
- //-- report
- fprintf(stderr, "%s: count_test_max=%lu\n", prog, count_test_max);
- fflush(stderr);
-
- //-- create: vanilla
- fsm = gfsm_automaton_new();
-
- //-- main loop
- for (argi=1; argi < argc; argi++) {
- out_degree_str = argv[argi];
- out_degree_test = strtol(out_degree_str,NULL,0);
- //count_test = count_test_max / out_degree_test;
- count_test = count_test_max;
-
- //-- populate: vanilla
- gfsm_automaton_clear(fsm);
- gfsm_automaton_set_root(fsm,gfsm_automaton_ensure_state(fsm,0));
- gfsm_automaton_set_final_state_full(fsm,0,TRUE,fsm->sr->one);
- for (qi=1; qi < n_states; qi++) {
- gfsm_automaton_ensure_state(fsm,qi);
- for (arci=0; arci < out_degree_test; arci++) {
- gfsmLabelId lo = random_label();
- gfsmLabelId hi = random_label();
- gfsmWeight w = arci + 1.0;
- gfsm_automaton_add_arc(fsm,qi,qi, lo,hi, w);
- }
- }
-
- //-------- bench
- report_new_row();
-
- //-- benchmark: vanilla (twice for cache optimization)
-#ifdef BENCH_VANILLA
- elapsed_vanilla = bench_seek_vanilla(fsm);
- elapsed_vanilla = bench_seek_vanilla(fsm);
- report_column("vanilla", elapsed_vanilla);
-#endif
-
-#ifdef BENCH_SORTED
- //-- benchmark: vanilla+sorted
- fsm_sorted = gfsm_automaton_clone(fsm);
- gfsm_automaton_arcsort(fsm_sorted,gfsmASMLower);
- elapsed_sorted = bench_seek_sorted(fsm_sorted);
- elapsed_sorted = bench_seek_sorted(fsm_sorted);
- report_column("sorted", elapsed_sorted);
-#endif
-
-#ifdef BENCH_TABX_VANILLA
- //-- benchmark: table: vanilla
- tabx = gfsm_automaton_to_arc_table_index(fsm,tabx);
- elapsed_tabx_vanilla = bench_seek_tabx_vanilla(tabx);
- elapsed_tabx_vanilla = bench_seek_tabx_vanilla(tabx);
- report_column("tabx_vanilla", elapsed_tabx_vanilla);
-#endif
-
-#ifdef BENCH_TABX_SORTED
- //-- benchmark: table: sorted linear
- tabx_sorted = gfsm_automaton_to_arc_table_index(fsm,tabx_sorted);
- gfsm_arc_table_index_priority_sort(tabx_sorted, gfsmASP_LU, fsm->sr);
- elapsed_tabx_sorted = bench_seek_tabx_sorted(tabx_sorted);
- elapsed_tabx_sorted = bench_seek_tabx_sorted(tabx_sorted);
- report_column("tabx_sorted", elapsed_tabx_sorted);
-#endif
-
-#ifdef BENCH_TABX_SORTED_2
- //-- benchmark: table: sorted linear (v2)
- tabx_sorted_2 = gfsm_automaton_to_arc_table_index(fsm,tabx_sorted_2);
- gfsm_arc_table_index_priority_sort(tabx_sorted_2, gfsmASP_LU, fsm->sr);
- elapsed_tabx_sorted_2 = bench_seek_tabx_sorted_2(tabx_sorted_2);
- elapsed_tabx_sorted_2 = bench_seek_tabx_sorted_2(tabx_sorted_2);
- report_column("tabx_sorted_2", elapsed_tabx_sorted_2);
-#endif
-
-#ifdef BENCH_TABX_SEEK_LIB
- //-- benchmark: table: binary search: lib
- tabx_seek_lib = gfsm_automaton_to_arc_table_index(fsm,tabx_seek_lib);
- gfsm_arc_table_index_priority_sort(tabx_seek_lib, gfsmASP_LU, fsm->sr);
- elapsed_tabx_seek_lib = bench_seek_tabx_seek_lib(tabx_seek_lib);
- elapsed_tabx_seek_lib = bench_seek_tabx_seek_lib(tabx_seek_lib);
- report_column("tabx_seek_lib", elapsed_tabx_seek_lib);
-#endif
-
-#ifdef BENCH_TABX_BSEARCH_FUNC
- //-- benchmark: table: binary search: func
- tabx_bsearch_func = gfsm_automaton_to_arc_table_index(fsm,tabx_bsearch_func);
- gfsm_arc_table_index_priority_sort(tabx_bsearch_func, gfsmASP_LU, fsm->sr);
- elapsed_tabx_bsearch_func = bench_seek_tabx_bsearch_func(tabx_bsearch_func);
- elapsed_tabx_bsearch_func = bench_seek_tabx_bsearch_func(tabx_bsearch_func);
- report_column("tabx_bsearch_func", elapsed_tabx_bsearch_func);
-#endif
-
-#ifdef BENCH_TABX_BSEARCH_INL
- //-- benchmark: table: binary search: inline
- tabx_bsearch_inl = gfsm_automaton_to_arc_table_index(fsm,tabx_bsearch_inl);
- gfsm_arc_table_index_priority_sort(tabx_bsearch_inl, gfsmASP_LU, fsm->sr);
- elapsed_tabx_bsearch_inl = bench_seek_tabx_bsearch_inl(tabx_bsearch_inl);
- elapsed_tabx_bsearch_inl = bench_seek_tabx_bsearch_inl(tabx_bsearch_inl);
- report_column("tabx_bsearch_inl", elapsed_tabx_bsearch_inl);
-#endif
-
- report_end_row();
- }
-
- //-- gnuplot output
- report_gnuplot();
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
- if (fsm_sorted) gfsm_automaton_free(fsm_sorted);
- if (tabx) gfsm_arc_table_index_free(tabx);
- if (tabx_sorted) gfsm_arc_table_index_free(tabx_sorted);
- if (tabx_sorted_2) gfsm_arc_table_index_free(tabx_sorted_2);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/seektest.c b/gfsm/gfsm/src/libgfsm/tests/seektest.c
deleted file mode 100644
index cc59874..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/seektest.c
+++ /dev/null
@@ -1,365 +0,0 @@
-#include <gfsm.h>
-#include <gfsmIndexed2.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "labprobs.h"
-
-/*======================================================================
- * Globals
- */
-const char *prog = "seektest";
-
-const char *fsmfile = "tagh-chopped.gfst";
-//const char *xfsmfile = "tagh-lo.gfstx";
-
-gfsmStateId qid_test = 0;
-guint out_degree_test = 0;
-gulong count_test =
-//1024
-//1048576
-4194304
-//16777216
-;
-
-//#define BENCH_SORTED 1
-#undef BENCH_SORTED
-
-/*======================================================================
- * bench_seek_vanilla()
- */
-double bench_seek_vanilla(gfsmAutomaton *fsm) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(gfsm_automaton_out_degree(fsm,qid_test));
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = qid_test;
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcIter ai;
- ary->len=0;
- for (gfsm_arciter_open(&ai,fsm,qid), gfsm_arciter_seek_lower(&ai,lab);
- gfsm_arciter_ok(&ai);
- gfsm_arciter_next(&ai), gfsm_arciter_seek_lower(&ai,lab))
- {
- gfsmArc *a = gfsm_arciter_arc(&ai);
- if (fsm->flags.sort_mode==gfsmASMLower && a->lower!=lab) break;
- g_ptr_array_add(ary, a);
- }
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-/*======================================================================
- * indexed_lower_lb()
- */
-gfsmArcId indexed_lower_lb(gfsmIndexedAutomaton *fsm,
- gfsmLabelId lab,
- gfsmArcId aid_lo,
- gfsmArcId aid_hi)
-
-{
- /*
- gfsmArcId aid_mid;
- gfsmArc *a;
- */
-
- //if (!gfsm_indexed_automaton_has_state(fsm,qid)) return gfsmNoArc;
- /*
- aid_lo = g_array_index(fsm->state_first_arc, gfsmArcId, qid);
- aid_hi = g_array_index(fsm->state_first_arc, gfsmArcId, qid+1);
- */
-
- while (aid_lo < aid_hi) {
- gfsmArcId aid_mid = (aid_lo+aid_hi)/2;
- gfsmArc *a = &g_array_index(fsm->arcs, gfsmArc, g_array_index(fsm->arcix_lower, gfsmArcId, aid_mid));
- if (a->lower < lab) { aid_lo = aid_mid+1; }
- else { aid_hi = aid_mid; }
- }
- //return aid_lo <= aid_hi ? aid_lo : gfsmNoArc;
- return aid_lo;
-}
-
-
-/*======================================================================
- * bench_seek_indexed()
- */
-#ifndef SEEK_INDEXED_BINSEARCH_CUTOFF
-//#define SEEK_INDEXED_BINSEARCH_CUTOFF 0
-//#define SEEK_INDEXED_BINSEARCH_CUTOFF 4
-//#define SEEK_INDEXED_BINSEARCH_CUTOFF 8
-//#define SEEK_INDEXED_BINSEARCH_CUTOFF 16
-//#define SEEK_INDEXED_BINSEARCH_CUTOFF 32
-#define SEEK_INDEXED_BINSEARCH_CUTOFF 64
-#endif
-double bench_seek_indexed(gfsmIndexedAutomaton *fsm) {
-#if 1
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(gfsm_indexed_automaton_out_degree(fsm,qid_test));
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = qid_test;
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcId aid_lo = g_array_index(fsm->state_first_arc, gfsmArcId, qid);
- gfsmArcId aid_hi = g_array_index(fsm->state_first_arc, gfsmArcId, qid+1);
- gfsmArcId aid;
- gfsmArc *a;
- ary->len=0;
- if (aid_hi-aid_lo >= SEEK_INDEXED_BINSEARCH_CUTOFF) {
- for (aid=indexed_lower_lb(fsm,lab,aid_lo,aid_hi); aid<aid_hi; aid++) {
- a = &g_array_index(fsm->arcs, gfsmArc, g_array_index(fsm->arcix_lower, gfsmArcId, aid));
- if (a->lower!=lab) break;
- g_ptr_array_add(ary, a);
- }
- } else {
- for (a=((gfsmArc*)fsm->arcs->data)+aid_lo; a < ((gfsmArc*)fsm->arcs->data)+aid_hi; a++) {
- if (a->lower==lab) g_ptr_array_add(ary,a);
- }
- }
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-#else
- return 1e38; //-- dummy
-#endif
-}
-
-
-/*======================================================================
- * indexed2_lower_lb()
- */
-gfsmArcId indexed2_lower_lb(gfsmIndexedAutomaton2 *fsm,
- gfsmLabelId lab,
- gfsmArcId aid_lo,
- gfsmArcId aid_hi)
-
-{
- while (aid_lo < aid_hi) {
- gfsmArcId aid_mid = (aid_lo+aid_hi)/2;
- gfsmArc *a = g_ptr_array_index(fsm->arcix_lower, aid_mid);
- if (a->lower < lab) { aid_lo = aid_mid+1; }
- else { aid_hi = aid_mid; }
- }
- //return aid_lo <= aid_hi ? aid_lo : gfsmNoArc;
- return aid_lo;
-}
-
-
-/*======================================================================
- * bench_seek_indexed2()
- */
-double bench_seek_indexed2(gfsmIndexedAutomaton2 *fsm) {
- guint i;
- double elapsed;
- GPtrArray *ary = g_ptr_array_sized_new(gfsm_indexed_automaton2_out_degree(fsm,qid_test));
- GTimer *timer = g_timer_new();
-
- g_timer_start(timer);
- for (i=0; i < count_test; i++) {
- //-- BEGIN TEST CODE
- gfsmStateId qid = qid_test;
- gfsmLabelId lab = g_array_index(seekus,gfsmLabelId,i);
- gfsmArcId aid_lo = g_array_index(fsm->state_first_arc, gfsmArcId, qid);
- gfsmArcId aid_hi = g_array_index(fsm->state_first_arc, gfsmArcId, qid+1);
- gfsmArcId aid;
- gfsmArc **app;
- ary->len=0;
- if (aid_hi-aid_lo >= SEEK_INDEXED_BINSEARCH_CUTOFF) {
- for (app = ((gfsmArc**)(fsm->arcix_lower->pdata)) + indexed2_lower_lb(fsm,lab,aid_lo,aid_hi);
- app < ((gfsmArc**)(fsm->arcix_lower->pdata)) + aid_hi && (*app)->lower==lab;
- app++)
- {
- g_ptr_array_add(ary, (*app));
- }
- } else {
- for (app = ((gfsmArc**)(fsm->arcix_lower->pdata)) + aid_lo;
- app < ((gfsmArc**)(fsm->arcix_lower->pdata)) + aid_hi;
- app++)
- {
- if ((*app)->lower==lab) g_ptr_array_add(ary,(*app));
- }
- }
- //-- END TEST CODE
- }
- elapsed = g_timer_elapsed(timer,NULL);
-
- //-- cleanup
- g_ptr_array_free(ary,TRUE);
- g_timer_destroy(timer);
-
- return elapsed;
-}
-
-
-/*======================================================================
- * Report
- */
-GString *dat_header=NULL;
-GString *dat_data=NULL;
-gint dat_row=0;
-gint dat_col=0;
-
-void report_new_row(void) {
- fprintf(stderr, "%s: qid=%u, out_degree=%u\n", prog, qid_test, out_degree_test);
- //
- //-- save data for gnuplot output
- dat_col=0;
- if (!dat_header) dat_header = g_string_new("");
- if (!dat_data) dat_data = g_string_new("");
- if (dat_row==0) {
- g_string_append(dat_header,"#1:out_deg");
- }
- g_string_append_printf(dat_data, "%u", out_degree_test);
-}
-
-void report_column(char *label, double elapsed) {
- double iters_per_sec = ((double)count_test)/elapsed;
- //
- //-- to stderr
- fprintf(stderr, "BENCH[%16s]: %ld iters in %.2g sec: %.2g iters/sec\n",
- label, count_test, elapsed, iters_per_sec);
- fflush(stderr);
- //
- //-- to data strings
- if (dat_row==0) {
- g_string_append_printf(dat_header, "\t%d:%s_secs\t%d:%s_ips", (2*dat_col+2),label, (2*dat_col+3),label);
- }
- g_string_append_c(dat_data,'\t');
- g_string_append_printf(dat_data,"\t%g\t%g", elapsed,iters_per_sec);
- ++dat_col;
-}
-
-void report_end_row(void) {
- ++dat_row;
- g_string_append(dat_data,"\n");
-}
-
-void report_gnuplot(void) {
- fflush(stderr);
- printf("%s\n%s", dat_header->str, dat_data->str);
-}
-
-
-/*======================================================================
- * Main
- */
-int main(int argc, char **argv)
-{
- char *qid_str="0";
- gfsmError *err=NULL;
- int argi;
- //
- gfsmAutomaton *fsm=NULL;
- double elapsed_vanilla;
-#ifdef BENCH_SORTED
- gfsmAutomaton *fsm_sorted=NULL;
- double elapsed_sorted;
-#endif
- gfsmIndexedAutomaton *xfsm=NULL;
- double elapsed_indexed;
- gfsmIndexedAutomaton2 *xfsm2=NULL;
- double elapsed_indexed2;
-
- //-- sanity check
- if (argc < 2) {
- fprintf(stderr, "Usage: %s [QID(s)...]\n", prog);
- exit(1);
- }
-
- //-- load probabilities & initialize
- load_label_probs();
- populate_seek_labels();
-
- //-- report
- fprintf(stderr, "%s: count=%lu\n", prog, count_test);
- fflush(stderr);
-
- //-- load/create: vanilla
- fprintf(stderr, "%s: loading vanilla automaton '%s'... ", prog, fsmfile); fflush(stderr);
- fsm = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fsm,fsmfile,&err)) {
- fprintf(stderr,"%s: load failed for '%s': %s\n", prog, fsmfile, (err ? err->message : "?"));
- exit(3);
- }
- fsm->flags.sort_mode = gfsmASMNone;
- fprintf(stderr, "loaded.\n"); fflush(stderr);
-
-#ifdef BENCH_SORTED
- //-- load/create: sorted
- fprintf(stderr, "%s: sorting... ", prog); fflush(stderr);
- fsm_sorted = gfsm_automaton_clone(fsm);
- gfsm_automaton_arcsort(fsm_sorted,gfsmASMLower);
- fprintf(stderr, "sorted.\n"); fflush(stderr);
-#endif
-
- //-- load/create: indexed
- fprintf(stderr, "%s: indexing... ", prog); fflush(stderr);
- xfsm = gfsm_automaton_to_indexed(fsm,NULL);
- fprintf(stderr, "indexed.\n"); fflush(stderr);
-
- //-- load/create: indexed2
- fprintf(stderr, "%s: indexing(2)... ", prog); fflush(stderr);
- xfsm2 = gfsm_automaton_to_indexed2(fsm,NULL);
- fprintf(stderr, "indexed.\n"); fflush(stderr);
-
- //-- main loop
- for (argi=1; argi < argc; argi++) {
- qid_str = argv[argi];
- qid_test = strtol(qid_str,NULL,0);
- out_degree_test = gfsm_automaton_out_degree(fsm,qid_test);
-
- report_new_row();
-
- //-- benchmark: vanilla
- elapsed_vanilla = bench_seek_vanilla(fsm);
- report_column("vanilla", elapsed_vanilla);
-
-#ifdef BENCH_SORTED
- //-- benchmark: vanilla+sorted
- gfsm_automaton_arcsort(fsm,gfsmASMLower);
- elapsed_sorted = bench_seek_vanilla(fsm);
- report_column("sorted", elapsed_sorted);
-#endif
-
- //-- benchmark: indexed
- elapsed_indexed = bench_seek_indexed(xfsm);
- report_column("indexed", elapsed_indexed);
-
- //-- benchmark: indexed2
- elapsed_indexed2 = bench_seek_indexed2(xfsm2);
- report_column("indexed2", elapsed_indexed2);
-
- report_end_row();
- }
-
- //-- gnuplot output
- report_gnuplot();
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-#ifdef BENCH_SORTED
- if (fsm_sorted) gfsm_automaton_free(fsm_sorted);
-#endif
- if (xfsm) gfsm_indexed_automaton_free(xfsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/seektest.dat b/gfsm/gfsm/src/libgfsm/tests/seektest.dat
deleted file mode 100644
index 2f05a4b..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/seektest.dat
+++ /dev/null
@@ -1,9 +0,0 @@
-#1:out_deg 2:vanilla_secs 3:vanilla_ips 4:indexed_secs 5:indexed_ips
-1 0.100445 4.17572e+07 0.057384 7.30919e+07
-2 0.108812 3.85463e+07 0.139554 3.00551e+07
-4 0.141588 2.96233e+07 0.148173 2.83068e+07
-8 0.195003 2.15089e+07 0.147859 2.83669e+07
-16 0.292195 1.43545e+07 0.21333 1.96611e+07
-32 0.539624 7.77264e+06 0.328515 1.27675e+07
-64 0.889506 4.71532e+06 0.394453 1.06332e+07
-148 1.79711 2.33392e+06 0.544203 7.70724e+06
diff --git a/gfsm/gfsm/src/libgfsm/tests/settest.c b/gfsm/gfsm/src/libgfsm/tests/settest.c
deleted file mode 100644
index 443f4d1..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/settest.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <glib.h>
-#include <gfsm.h>
-
-int main (void)
-{
- gfsmSet *set;
- GSList *setl;
- GPtrArray *setary;
- g_mem_set_vtable(glib_mem_profiler_table);
-
- set = gfsm_set_new(gfsm_uint_compare);
- gfsm_set_insert(set,(gpointer)2);
-
- //gfsm_set_clear(set);
-
- /*
- fprintf(stderr,"**** set=");
- gfsm_set_print_uint(set,stderr);
- fprintf(stderr,"\n");
- */
- //setl = gfsm_set_to_slist(set);
- //g_slist_free(setl);
- /*
- setl = g_slist_prepend(NULL,(gpointer)2);
- g_slist_free(setl);
- */
- setary = g_ptr_array_sized_new(gfsm_set_size(set));
- gfsm_set_to_ptr_array(set,setary);
- g_ptr_array_free(setary,TRUE);
-
- gfsm_set_free(set);
-
- g_blow_chunks();
- g_mem_profile();
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/sizes.bc b/gfsm/gfsm/src/libgfsm/tests/sizes.bc
deleted file mode 100644
index 28632e4..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/sizes.bc
+++ /dev/null
@@ -1,70 +0,0 @@
-##-*- Mode: Shell-Script -*-
-
-##-- tagh size (carrot)
-tagh_carrot_n_states = 5345565;
-tagh_carrot_n_finals = 1;
-tagh_carrot_n_arcs = 9407741;
-
-##-- test constants (tagh, carrot)
-n_states = tagh_carrot_n_states;
-n_finals = tagh_carrot_n_finals;
-n_arcs = tagh_carrot_n_arcs;
-
-##-- basic type sizes
-size_ptr = 4;
-size_int32 = 4;
-size_float = 4;
-size_arc = 12;
-size_arc_src = 16;
-size_weight = size_float;
-
-##-- vanilla automaton sizes
-define size_vanilla_arcs(n_arcs) { return n_arcs*(size_arc+size_ptr); }
-define size_vanilla_states(n_states,n_finals) {
- return (n_states*(size_int32+size_ptr)) + (n_finals*(size_float+size_int32));
-}
-define size_vanilla_full(n_states,n_finals,n_arcs) {
- return size_vanilla_states(n_states,n_finals) + size_vanilla_arcs(n_arcs);
-}
-size_vanilla = size_vanilla_full(n_states,n_finals,n_arcs) / 2^20; ##== 184MB
-
-##-- basic index type sizes
-define size_arctab_ptr(n_arcs) { return (n_arcs*size_ptr); }
-define size_arctab(n_arcs) { return (n_arcs*size_arc); }
-define size_arcfirst(n_states) { return (n_states*size_ptr); }
-define size_finaltab(n_states) { return (n_states*size_weight); }
-define size_bitvec(n_bits) { return (n_bits/8); }
-
-##-- arcindex_ptr: auxilliary index: { arc*[] arc_ptrs_sorted; arc** first; }
-define size_arcindex_ptr_full(n_states,n_finals,n_arcs) {
- return size_arctab_ptr(n_arcs) + size_arcfirst(n_states);
-}
-size_arcindex_ptr = size_arcindex_ptr_full(n_states,n_finals,n_arcs)/2^20; ##== 56MB
-
-##-- arcindex_tab: copy index: { arc[] arcs_sorted; arc* first; }
-define size_arcindex_tab_full(n_states,n_finals,n_arcs) {
- return size_arctab(n_arcs) + size_arcfirst(n_states);
-}
-size_arcindex_tab = size_arcindex_tab_full(n_states,n_finals,n_arcs) / 2^20;
-
-##-- fsmtab: copy index: { arc[] arcs_sorted; arc* first; weight[] finals; }
-## --> SMALLEST, likely also MOST EFFICIENT!
-## + w/ finals: 149MB (vs. vanilla 184MB)
-## + w/o finals: 129MB
-define size_fsmtab_full(n_states,n_finals,n_arcs) {
- return size_arctab(n_arcs) + size_arcfirst(n_states) + size_finaltab(n_states) + size_bitvec(n_states);
-}
-size_fsmtab = size_fsmtab_full(n_states,n_finals,n_arcs) / 2^20; ##== 149MB
-
-##-- fsmbitab: bi-indexed: { arc[] arcs; int32~arc*[] first; weight[] finals; int32[] ix_lo; int32[] ix_hi; }
-define size_ixtab(n_arcs) { return n_arcs*size_int32; }
-define size_fsmbitab_full(n_states,n_finals,n_arcs) {
- return size_fsmtab_full(n_states,n_finals,n_arcs) + 2*size_ixtab(n_arcs);
-}
-size_fsmbitab = size_fsmbitab_full(n_states,n_finals,n_arcs) / 2^20; ##== 220MB
-
-##-- fsmbitab2: bi-indexed: { arc[] arcs~ix_lo; int32~arc*[] first; weight[] finals; int32[] ix_hi; }
-define size_fsmbitab2_full(n_states,n_finals,n_arcs) {
- return size_fsmtab_full(n_states,n_finals,n_arcs) + size_ixtab(n_arcs);
-}
-size_fsmbitab2 = size_fsmbitab2_full(n_states,n_finals,n_arcs) / 2^20; ##== 185MB
diff --git a/gfsm/gfsm/src/libgfsm/tests/sizetest.c b/gfsm/gfsm/src/libgfsm/tests/sizetest.c
deleted file mode 100644
index 5e09070..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/sizetest.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdio.h>
-
-typedef struct {
- int x1 : 1;
- int x2 : 1;
- int x3 : 30;
-} tstruc;
-
-int main (void) {
- int i;
- tstruc ts;
-
- printf("sizeof(int)=%ld ; sizeof(tstruc)=%ld\n", sizeof(int), sizeof(tstruc));
- printf("sizeof(float)=%ld, sizeof(void*)=%ld\n", sizeof(float), sizeof(void*));
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/sltest.c b/gfsm/gfsm/src/libgfsm/tests/sltest.c
deleted file mode 100644
index 8567e6a..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/sltest.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-
-int main (void) {
- GSList *sl=NULL;
- GAllocator *myalloc=NULL;
-
- g_mem_set_vtable(glib_mem_profiler_table);
-
- //-- allocator hack
- myalloc = g_allocator_new("myAllocator", 128);
- g_slist_push_allocator(myalloc);
-
- sl = g_slist_prepend(NULL,(gpointer)2);
- g_slist_free(sl);
-
- //-- allocator hack
- g_slist_pop_allocator();
- g_allocator_free(myalloc);
-
- g_blow_chunks();
- g_mem_profile();
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/statetest.tfst b/gfsm/gfsm/src/libgfsm/tests/statetest.tfst
deleted file mode 100644
index 175575f..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/statetest.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-0 1 0 0 0
-0 2 0 0 0
-0 3 0 0 0
-3 4 0 0 0
-0 99 99 99 0
-1
-2
-3
diff --git a/gfsm/gfsm/src/libgfsm/tests/structtest.c b/gfsm/gfsm/src/libgfsm/tests/structtest.c
deleted file mode 100644
index 6bb0558..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/structtest.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-
-typedef struct {
- guint32 i1 : 1;
- guint32 i2 : 31;
-} testme;
-
-int main (void) {
-
- printf("guint32:%u ; testme=%u\n", sizeof(guint32), sizeof(testme));
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/tagh-lo.testus b/gfsm/gfsm/src/libgfsm/tests/tagh-lo.testus
deleted file mode 100644
index b8eeec7..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/tagh-lo.testus
+++ /dev/null
@@ -1,8 +0,0 @@
-5 out_deg=1
-4 out_deg=2
-11 out_deg=4
-98 out_deg=8
-5257 out_deg=16
-45623 out_deg=32
-290132 out_deg=64
-0 out_deg=148
diff --git a/gfsm/gfsm/src/libgfsm/tests/test-255.lab b/gfsm/gfsm/src/libgfsm/tests/test-255.lab
deleted file mode 100644
index d2ad9fa..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/test-255.lab
+++ /dev/null
@@ -1,3 +0,0 @@
-a 1
-ÿ 2
-b 3
diff --git a/gfsm/gfsm/src/libgfsm/tests/test-stateset.c b/gfsm/gfsm/src/libgfsm/tests/test-stateset.c
deleted file mode 100644
index 4e56112..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/test-stateset.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <gfsm.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-const char *progname = "test-stateset";
-const char *infilename = "statetest.tfst";
-
-gfsmAutomaton *fsm;
-gfsmError *err = NULL;
-
-gboolean stateset_print_func(gfsmStateId id, gpointer data)
-{
- printf(" %u", id);
- return FALSE;
-}
-
-void stateset_print(const char *label, gfsmStateSet *sset)
-{
- gfsmStateSetIter ssi;
- gfsmStateId ssid;
-
- printf("%s: {", label);
-
- //gfsm_stateset_foreach(sset, stateset_print_func, NULL);
- for (ssi = gfsm_stateset_iter_begin(sset);
- (ssid=gfsm_stateset_iter_id(ssi)) != gfsmNoState;
- ssi = gfsm_stateset_iter_next(sset,ssi))
- {
- printf(" %u", ssid);
- }
-
- printf(" }\n");
-}
-
-int main (int argc, char **argv) {
- int i;
- gfsmStateId id;
- gfsmStateSet *sset;
-
- fsm = gfsm_automaton_new();
- sset = gfsm_stateset_new();
-
- if (!gfsm_automaton_compile_filename(fsm,infilename,&err)) {
- g_printerr("%s: compile failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
- printf("%s: compiled test automaton from '%s'\n", *argv, infilename);
-
- for (i=0; i < argc; i++) {
- id = strtol(argv[i],NULL,10);
- gfsm_stateset_clear(sset);
- gfsm_stateset_populate(sset,fsm,id, gfsmEpsilon, gfsmEpsilon);
-
- printf("--\nseed=%u\n", id);
- stateset_print("equiv", sset);
- }
-
- gfsm_stateset_free(sset);
- gfsm_automaton_free(fsm);
- return 0;
-}
diff --git a/gfsm/gfsm/src/libgfsm/tests/test.lab b/gfsm/gfsm/src/libgfsm/tests/test.lab
deleted file mode 100644
index ff5af08..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/test.lab
+++ /dev/null
@@ -1,10 +0,0 @@
-<epsilon> 0
-a 1
-b 2
-c 3
-d 4
-e 5
-f 6
-foo 42
-bar 43
-baz 44
diff --git a/gfsm/gfsm/src/libgfsm/tests/test.txt b/gfsm/gfsm/src/libgfsm/tests/test.txt
deleted file mode 100644
index c89f586..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/test.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This is a test.
-This is ONLY a test.
diff --git a/gfsm/gfsm/src/libgfsm/tests/test2.lab b/gfsm/gfsm/src/libgfsm/tests/test2.lab
deleted file mode 100644
index 2398dad..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/test2.lab
+++ /dev/null
@@ -1,2 +0,0 @@
-a 1
-b 2
diff --git a/gfsm/gfsm/src/libgfsm/tests/test2.txt b/gfsm/gfsm/src/libgfsm/tests/test2.txt
deleted file mode 100644
index ed2c580..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/test2.txt
+++ /dev/null
@@ -1 +0,0 @@
-a b c \ No newline at end of file
diff --git a/gfsm/gfsm/src/libgfsm/tests/testme.lab b/gfsm/gfsm/src/libgfsm/tests/testme.lab
deleted file mode 100644
index 78226ef..0000000
--- a/gfsm/gfsm/src/libgfsm/tests/testme.lab
+++ /dev/null
@@ -1,5 +0,0 @@
-<eps> 0
-a 1
-b 2
-c 3
-answer 42
diff --git a/gfsm/gfsm/src/programs/.cvsignore b/gfsm/gfsm/src/programs/.cvsignore
deleted file mode 100644
index ccc326d..0000000
--- a/gfsm/gfsm/src/programs/.cvsignore
+++ /dev/null
@@ -1,79 +0,0 @@
-gfsmindex
-gfsmarith
-gfsmheader
-gfsmoptional
-gfsmreplace
-gfsmsigma
-gfsmarcsort
-gfsmclosure
-gfsmcompile
-gfsmcomplement
-gfsmcompose
-gfsmcompre
-gfsmconcat
-gfsmconnect
-gfsmconvert
-gfsmdeterminize
-gfsmdifference
-gfsmdraw
-gfsminfo
-gfsmintersect
-gfsminvert
-gfsmlabels
-gfsmlookup
-gfsmprint
-gfsmproduct
-gfsmproject
-gfsmprune
-gfsmrenumber
-gfsmreverse
-gfsmrmepsilon
-gfsmstrings
-gfsmunion
-gfsmviterbi
-
-*.out
-*.tmp
-tmp.*
-tmp
-SFST*
-
-*~
-.*~
-*.o
-*.lo
-*.la
-.libs
-*.a
-*.so
-.deps
-*.ps
-*.lfsa
-*.fst
-#*.tfst
-*.fsa
-#*.tfsa
-*.thfst
-*.afst
-*.afsa
-*.gfsa
-*.gfst
-*.dot
-#*.lab
-*.scl
-
-#*_cmdparser.c
-#*_cmdparser.h
-
-argh
-save
-tdata
-
-stamp-h*
-aclocal.m4
-Makefile
-Makefile.in
-README.txt
-configure
-
-ma-dwds-hacks
diff --git a/gfsm/gfsm/src/programs/Makefile.am b/gfsm/gfsm/src/programs/Makefile.am
deleted file mode 100644
index b59e087..0000000
--- a/gfsm/gfsm/src/programs/Makefile.am
+++ /dev/null
@@ -1,613 +0,0 @@
-## File: src/programs/Makefile.am
-## Package: gfsm
-## Description:
-## + src-level automake file
-##
-## Process this file with Automake to create Makefile.in.
-##-----------------------------------------------------------------------
-
-##-----------------------------------------------------------------------
-## subdirectories
-##-----------------------------------------------------------------------
-#SUBDIRS =
-
-##-----------------------------------------------------------------------
-## primary targets
-##-----------------------------------------------------------------------
-
-## --- executable programs
-#bin_PROGRAMS = ${prog_1} ... ${prog_N}
-bin_PROGRAMS = \
- gfsmarcsort \
- gfsmarith \
- gfsmclosure \
- gfsmcompile \
- gfsmcomplement \
- gfsmcompose \
- gfsmcompre \
- gfsmconcat \
- gfsmconnect \
- gfsmconvert \
- gfsmdeterminize \
- gfsmdifference \
- gfsmdraw \
- gfsmheader \
- gfsminfo \
- gfsmintersect \
- gfsminvert \
- gfsmlabels \
- gfsmlookup \
- gfsmoptional \
- gfsmprint \
- gfsmproduct \
- gfsmproject \
- gfsmrenumber \
- gfsmreplace \
- gfsmreverse \
- gfsmrmepsilon \
- gfsmsigma \
- gfsmstrings \
- gfsmunion \
- gfsmviterbi
-
-EXTRA_PROGRAMS = gfsmindex
-bin_PROGRAMS += gfsmindex
-
-EXTRA_DIST =
-
-#bin_SCRIPTS = ${script1} ... ${scriptN}
-
-## --- libtool libraries
-#lib_LTLIBRARIES = ${lib_1}.la ... ${lib_N}.la
-
-## --- shared data in @pkgdatadir@
-#pkgdata_DATA = ${data_1} ... ${data_N}
-
-## --- manpages -- section is auto-detected
-#man_MANS = ${man_1} ... ${man_N}
-
-##-----------------------------------------------------------------------
-## sources
-##-----------------------------------------------------------------------
-
-SUFFIXES = \
- .gog _cmdparser.c _cmdparser.cc _cmdparser.h \
- .pod .txt .1 .html .tex
-
-
-##-----------------------------------------------------------------------
-## individual programs
-##-----------------------------------------------------------------------
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-## --- Required sources
-#${prog_i}_SOURCES =
-##
-## --- Extra (possible)sources
-#EXTRA_${prog_i}_SOURCES =
-#EXTRA_${lib_i}_la_SOURCES =
-##
-## --- leftovers
-#mootconfig_SOURCES = mootconfig.cc
-##
-## --- Additional dependencies
-#gfsmcompile_main.o: gfsmcompile_cmdparser.h
-##
-## --- Linker flags
-#${prog_i}_LDFLAGS = -L. -static
-#${prog_i}_LDADD = ${non_src_file}.o -lsomelib
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#gfsmX_SOURCES = \
-# gfsmX_main.c \
-# gfsmX_cmdparser.c gfsmX_cmdparser.h
-#
-#gfsmX_main.o: gfsmX_cmdparser.h
-#
-#gfsmX_LDFLAGS = $(LDFLAGS_COMMON)
-#gfsmX_LDADD = $(LDADD_COMMON)
-#
-#EXTRA_DIST += gfsmX.gog
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmarith_SOURCES = \
- gfsmarith_main.c \
- gfsmarith_cmdparser.c gfsmarith_cmdparser.h
-
-gfsmarith_main.o: gfsmarith_cmdparser.h
-
-gfsmarith_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmarith_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmarith.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmcompile_SOURCES = \
- gfsmcompile_main.c \
- gfsmcompile_cmdparser.c gfsmcompile_cmdparser.h
-
-gfsmcompile_main.o: gfsmcompile_cmdparser.h
-
-gfsmcompile_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmcompile_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmcompile.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmconvert_SOURCES = \
- gfsmconvert_main.c \
- gfsmconvert_cmdparser.c gfsmconvert_cmdparser.h
-
-gfsmconvert_main.o: gfsmconvert_cmdparser.h
-
-gfsmconvert_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmconvert_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmconvert.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmprint_SOURCES = \
- gfsmprint_main.c \
- gfsmprint_cmdparser.c gfsmprint_cmdparser.h
-
-gfsmprint_main.o: gfsmprint_cmdparser.h
-
-gfsmprint_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmprint_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmprint.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmindex_SOURCES = \
- gfsmindex_main.c \
- gfsmindex_cmdparser.c gfsmindex_cmdparser.h
-
-gfsmindex_main.o: gfsmindex_cmdparser.h
-
-gfsmindex_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmindex_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmindex.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsminfo_SOURCES = \
- gfsminfo_main.c \
- gfsminfo_cmdparser.c gfsminfo_cmdparser.h
-
-gfsminfo_main.o: gfsminfo_cmdparser.h
-
-gfsminfo_LDFLAGS = $(LDFLAGS_COMMON)
-gfsminfo_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsminfo.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmarcsort_SOURCES = \
- gfsmarcsort_main.c \
- gfsmarcsort_cmdparser.c gfsmarcsort_cmdparser.h
-
-gfsmarcsort_main.o: gfsmarcsort_cmdparser.h
-
-gfsmarcsort_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmarcsort_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmarcsort.gog
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmcomplement_SOURCES = \
- gfsmcomplement_main.c \
- gfsmcomplement_cmdparser.c gfsmcomplement_cmdparser.h
-
-gfsmcomplement_main.o: gfsmcomplement_cmdparser.h
-
-gfsmcomplement_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmcomplement_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmcomplement.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmcompose_SOURCES = \
- gfsmcompose_main.c \
- gfsmcompose_cmdparser.c gfsmcompose_cmdparser.h
-
-gfsmcompose_main.o: gfsmcompose_cmdparser.h
-
-gfsmcompose_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmcompose_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmcompose.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmcompre_SOURCES = \
- gfsmcompre_main.c \
- gfsmcompre_cmdparser.c gfsmcompre_cmdparser.h
-
-gfsmcompre_main.o: gfsmcompre_cmdparser.h
-
-gfsmcompre_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmcompre_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmcompre.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmconcat_SOURCES = \
- gfsmconcat_main.c \
- gfsmconcat_cmdparser.c gfsmconcat_cmdparser.h
-
-gfsmconcat_main.o: gfsmconcat_cmdparser.h
-
-gfsmconcat_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmconcat_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmconcat.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmclosure_SOURCES = \
- gfsmclosure_main.c \
- gfsmclosure_cmdparser.c gfsmclosure_cmdparser.h
-
-gfsmclosure_main.o: gfsmclosure_cmdparser.h
-
-gfsmclosure_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmclosure_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmclosure.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmconnect_SOURCES = \
- gfsmconnect_main.c \
- gfsmconnect_cmdparser.c gfsmconnect_cmdparser.h
-
-gfsmconnect_main.o: gfsmconnect_cmdparser.h
-
-gfsmconnect_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmconnect_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmconnect.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmdeterminize_SOURCES = \
- gfsmdeterminize_main.c \
- gfsmdeterminize_cmdparser.c gfsmdeterminize_cmdparser.h
-
-gfsmdeterminize_main.o: gfsmdeterminize_cmdparser.h
-
-gfsmdeterminize_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmdeterminize_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmdeterminize.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmdifference_SOURCES = \
- gfsmdifference_main.c \
- gfsmdifference_cmdparser.c gfsmdifference_cmdparser.h
-
-gfsmdifference_main.o: gfsmdifference_cmdparser.h
-
-gfsmdifference_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmdifference_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmdifference.gog
-
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmdraw_SOURCES = \
- gfsmdraw_main.c \
- gfsmdraw_cmdparser.c gfsmdraw_cmdparser.h
-
-gfsmdraw_main.o: gfsmdraw_cmdparser.h
-
-gfsmdraw_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmdraw_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmdraw.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmheader_SOURCES = \
- gfsmheader_main.c \
- gfsmheader_cmdparser.c gfsmheader_cmdparser.h
-
-gfsmheader_main.o: gfsmheader_cmdparser.h
-
-gfsmheader_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmheader_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmheader.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmintersect_SOURCES = \
- gfsmintersect_main.c \
- gfsmintersect_cmdparser.c gfsmintersect_cmdparser.h
-
-gfsmintersect_main.o: gfsmintersect_cmdparser.h
-
-gfsmintersect_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmintersect_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmintersect.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsminvert_SOURCES = \
- gfsminvert_main.c \
- gfsminvert_cmdparser.c gfsminvert_cmdparser.h
-
-gfsminvert_main.o: gfsminvert_cmdparser.h
-
-gfsminvert_LDFLAGS = $(LDFLAGS_COMMON)
-gfsminvert_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsminvert.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmlabels_SOURCES = \
- gfsmlabels_main.c \
- gfsmlabels_cmdparser.c gfsmlabels_cmdparser.h
-
-gfsmlabels_main.o: gfsmlabels_cmdparser.h
-
-gfsmlabels_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmlabels_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmlabels.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmlookup_SOURCES = \
- gfsmlookup_main.c \
- gfsmlookup_cmdparser.c gfsmlookup_cmdparser.h
-
-gfsmlookup_main.o: gfsmlookup_cmdparser.h
-
-gfsmlookup_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmlookup_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmlookup.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmoptional_SOURCES = \
- gfsmoptional_main.c \
- gfsmoptional_cmdparser.c gfsmoptional_cmdparser.h
-
-gfsmoptional_main.o: gfsmoptional_cmdparser.h
-
-gfsmoptional_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmoptional_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmoptional.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmproduct_SOURCES = \
- gfsmproduct_main.c \
- gfsmproduct_cmdparser.c gfsmproduct_cmdparser.h
-
-gfsmproduct_main.o: gfsmproduct_cmdparser.h
-
-gfsmproduct_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmproduct_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmproduct.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmproject_SOURCES = \
- gfsmproject_main.c \
- gfsmproject_cmdparser.c gfsmproject_cmdparser.h
-
-gfsmproject_main.o: gfsmproject_cmdparser.h
-
-gfsmproject_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmproject_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmproject.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmrenumber_SOURCES = \
- gfsmrenumber_main.c \
- gfsmrenumber_cmdparser.c gfsmrenumber_cmdparser.h
-
-gfsmrenumber_main.o: gfsmrenumber_cmdparser.h
-
-gfsmrenumber_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmrenumber_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmrenumber.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmreplace_SOURCES = \
- gfsmreplace_main.c \
- gfsmreplace_cmdparser.c gfsmreplace_cmdparser.h
-
-gfsmreplace_main.o: gfsmreplace_cmdparser.h
-
-gfsmreplace_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmreplace_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmreplace.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmreverse_SOURCES = \
- gfsmreverse_main.c \
- gfsmreverse_cmdparser.c gfsmreverse_cmdparser.h
-
-gfsmreverse_main.o: gfsmreverse_cmdparser.h
-
-gfsmreverse_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmreverse_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmreverse.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmrmepsilon_SOURCES = \
- gfsmrmepsilon_main.c \
- gfsmrmepsilon_cmdparser.c gfsmrmepsilon_cmdparser.h
-
-gfsmrmepsilon_main.o: gfsmrmepsilon_cmdparser.h
-
-gfsmrmepsilon_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmrmepsilon_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmrmepsilon.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmsigma_SOURCES = \
- gfsmsigma_main.c \
- gfsmsigma_cmdparser.c gfsmsigma_cmdparser.h
-
-gfsmsigma_main.o: gfsmsigma_cmdparser.h
-
-gfsmsigma_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmsigma_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmsigma.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmstrings_SOURCES = \
- gfsmstrings_main.c \
- gfsmstrings_cmdparser.c gfsmstrings_cmdparser.h
-
-gfsmstrings_main.o: gfsmstrings_cmdparser.h
-
-gfsmstrings_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmstrings_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmstrings.gog
-
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmunion_SOURCES = \
- gfsmunion_main.c \
- gfsmunion_cmdparser.c gfsmunion_cmdparser.h
-
-gfsmunion_main.o: gfsmunion_cmdparser.h
-
-gfsmunion_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmunion_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmunion.gog
-
-##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gfsmviterbi_SOURCES = \
- gfsmviterbi_main.c \
- gfsmviterbi_cmdparser.c gfsmviterbi_cmdparser.h
-
-gfsmviterbi_main.o: gfsmviterbi_cmdparser.h
-
-gfsmviterbi_LDFLAGS = $(LDFLAGS_COMMON)
-gfsmviterbi_LDADD = $(LDADD_COMMON)
-
-EXTRA_DIST += gfsmviterbi.gog
-
-##-----------------------------------------------------------------------
-## headers
-##-----------------------------------------------------------------------
-
-## --- installable headers: @includedir@/@pkgname@
-#pkginclude_HEADERS = ${hfile_1} ... ${hfile_N}
-
-## --- no-install headers
-noinst_HEADERS = config.h
-
-##-----------------------------------------------------------------------
-## pre-compile rules: gengetopt
-##-----------------------------------------------------------------------
-
-##-----------------------------------------------------------------------
-## pre-compile rules: Getopt::Gen
-##-----------------------------------------------------------------------
-.SECONDARY:
-
-OPTGENFLAGS = -u -l --no-handle-rcfile
-
-if HAVE_OPTGEN
-
-.gog_cmdparser.h:
- optgen.perl $(OPTGENFLAGS) --nopod -F $*_cmdparser $<
-
-.gog_cmdparser.c:
- optgen.perl $(OPTGENFLAGS) --nopod -F $*_cmdparser $<
-
-.gog.pod:
- optgen.perl $(OPTGENFLAGS) --nocfile --nohfile -F $* $<
-
-endif
-
-##-----------------------------------------------------------------------
-## compile flags
-##-----------------------------------------------------------------------
-
-## --- preprocessor flags
-AM_CPPFLAGS = -I@srcdir@/../libgfsm -I../libgfsm
-
-## --- compiler flags (c++)
-AM_CFLAGS = $(gfsm_WFLAGS) $(gfsm_OFLAGS)
-
-##-----------------------------------------------------------------------
-## linker flags
-## + library special handling of configure.in vars:
-##-----------------------------------------------------------------------
-#${prog_i}_LDFLAGS = -L. -static
-#${prog_i}_LDADD = ${non_src_file}.o -lsomelib
-
-LDFLAGS_COMMON = -L../libgfsm
-LDADD_COMMON = ../libgfsm/libgfsm.la @gfsm_LIBS@
-
-#${lib_i}_la_LDFLAGS = -L. -version-info ${lib_i_current}:${lib_i_rev}:${lib_i_age}
-#${lib_i}_LIBADD = -lotherlib
-
-##-----------------------------------------------------------------------
-## cleanup: fst
-##-----------------------------------------------------------------------
-
-fsmclean:
- rm -f *.afsa *.afst *.gfsa *.gfst *.thfsa *.thfst
-
-##-----------------------------------------------------------------------
-## Variables: cleanup
-##-----------------------------------------------------------------------
-
-## --- mostlyclean: built by 'make' & commonly rebuilt
-#MOSTLYCLEANFILES =
-
-## --- clean: built by 'make'
-#CLEANFILES =
-
-## --- distclean: built by 'configure'
-#DISTCLEANFILES =
-
-## -- maintainerclean: built by maintainer / by hand
-MAINTAINERCLEANFILES = \
- *~ .*~ Makefile Makefile.in \
- *.man *.1 *.html *.txt *.tex \
- *.afsa *.afst *.gfsa *.gfst *.thfst \
- *.dot *.ps *.vcg
-
-# *_cmdparser.c *_cmdparser.h
-
-##-----------------------------------------------------------------------
-## Variables: distribution
-##-----------------------------------------------------------------------
-
-## --- extra distribution files
-#EXTRA_DIST =
-
-## --- recursion subdirectories for 'make dist'
-#DIST_SUBDIRS = $(SUBDIRS)
-
-## --- dist-hook: when another 'Makefile.am' is overkill
-#DISTHOOK_DIRS = foo
-#DISTHOOK_FILES = foo/bar.txt foo/baz.txt
-#dist-hook:
-# for d in $(DISTHOOK_DIRS); do\
-# mkdir -p $(distdir)/$$d ;\
-# done
-# for f in $(DISTHOOK_FILES); do\
-# cp -p $(srcdir)/$$f $(distdir)/$$f ;\
-# done
-
-##-----------------------------------------------------------------------
-## Rules: cleanup
-##-----------------------------------------------------------------------
-.PHONY: cvsclean
-
-cvsclean: maintainer-clean ;
diff --git a/gfsm/gfsm/src/programs/arith.tfst b/gfsm/gfsm/src/programs/arith.tfst
deleted file mode 100644
index d7e7b72..0000000
--- a/gfsm/gfsm/src/programs/arith.tfst
+++ /dev/null
@@ -1,9 +0,0 @@
-0 1 1 1 1
-0 2 2 2 2
-0 3 3 3 -3
-0 4 4 4 inf
-0 0
-1 1
-2 2
-3 -3
-4 inf
diff --git a/gfsm/gfsm/src/programs/c1.tfst b/gfsm/gfsm/src/programs/c1.tfst
deleted file mode 100644
index fef3d10..0000000
--- a/gfsm/gfsm/src/programs/c1.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 0 1 2
-0 1 0 0
-1 1 1 3
-0
-1
diff --git a/gfsm/gfsm/src/programs/c2.lab b/gfsm/gfsm/src/programs/c2.lab
deleted file mode 100644
index 5288861..0000000
--- a/gfsm/gfsm/src/programs/c2.lab
+++ /dev/null
@@ -1,11 +0,0 @@
-<eps> 0
-a 1
-b 2
-A 3
-B 4
-AA 5
-{A|B} 6
-{AA|B} 7
-{} 8
-[e2] 65533
-[e1] 65534
diff --git a/gfsm/gfsm/src/programs/c2.tfst b/gfsm/gfsm/src/programs/c2.tfst
deleted file mode 100644
index c437b71..0000000
--- a/gfsm/gfsm/src/programs/c2.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 0 2 3
-0 1 0 0
-1 1 3 1
-0
diff --git a/gfsm/gfsm/src/programs/c2a.tfst b/gfsm/gfsm/src/programs/c2a.tfst
deleted file mode 100644
index d6c5236..0000000
--- a/gfsm/gfsm/src/programs/c2a.tfst
+++ /dev/null
@@ -1,10 +0,0 @@
-0 1 a {A|B}
-1 2 <eps> a
-2 3 a {AA|B}
-3 2 <eps> a
-2 4 b {A|B}
-4 0 <eps> b
-0 5 b {A|B}
-5 0 <eps> b
-0
-2
diff --git a/gfsm/gfsm/src/programs/c2b.tfst b/gfsm/gfsm/src/programs/c2b.tfst
deleted file mode 100644
index b16d00e..0000000
--- a/gfsm/gfsm/src/programs/c2b.tfst
+++ /dev/null
@@ -1,22 +0,0 @@
-0 1 <eps> <eps>
-0 2 <eps> <eps>
-0 3 <eps> <eps>
-3 4 {A|B} B
-3 4 {AA|B} B
-4 1 b <eps>
-2 5 {A|B} A
-2 5 {AA|B} AA
-5 1 a <eps>
-3 6 {A|B} B
-3 6 {AA|B} B
-6 2 b <eps>
-2 7 {A|B} A
-2 7 {AA|B} AA
-7 2 a <eps>
-3 8 {A|B} B
-3 8 {AA|B} B
-8 3 b <eps>
-2 9 {A|B} A
-2 9 {AA|B} AA
-9 3 a <eps>
-1
diff --git a/gfsm/gfsm/src/programs/c3a.tfst b/gfsm/gfsm/src/programs/c3a.tfst
deleted file mode 100644
index d82ca52..0000000
--- a/gfsm/gfsm/src/programs/c3a.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-0 1 a a
-1 0 <eps> A
-0 2 b b
-2 0 <eps> B
-0
-0 0 <eps> <eps1>
-1 1 <eps> <eps1>
-2 2 <eps> <eps1>
diff --git a/gfsm/gfsm/src/programs/c3b.tfst b/gfsm/gfsm/src/programs/c3b.tfst
deleted file mode 100644
index 4a4133f..0000000
--- a/gfsm/gfsm/src/programs/c3b.tfst
+++ /dev/null
@@ -1,26 +0,0 @@
-0 1 <eps1> <eps>
-1
-0 2 <eps1> <eps>
-2 4 a A
-4 1 A <eps>
-2 5 a A
-5 2 A <eps>
-2 6 a A
-6 3 A <eps>
-0 3 <eps1> <eps>
-3 7 b B
-7 1 B <eps>
-3 8 b B
-8 3 B <eps>
-3 9 b B
-9 2 B <eps>
-0 0 <eps2> <eps>
-1 1 <eps2> <eps>
-2 2 <eps2> <eps>
-3 3 <eps2> <eps>
-4 4 <eps2> <eps>
-5 5 <eps2> <eps>
-6 6 <eps2> <eps>
-7 7 <eps2> <eps>
-8 8 <eps2> <eps>
-9 9 <eps2> <eps>
diff --git a/gfsm/gfsm/src/programs/c3filt.tfst b/gfsm/gfsm/src/programs/c3filt.tfst
deleted file mode 100644
index 34cc982..0000000
--- a/gfsm/gfsm/src/programs/c3filt.tfst
+++ /dev/null
@@ -1,20 +0,0 @@
-0 0 <eps2> <eps1>
-0 0 a a
-0 0 b b
-0 0 A A
-0 0 B B
-0
-0 1 <eps1> <eps1>
-1 1 <eps1> <eps1>
-1 0 a a
-1 0 b b
-1 0 A A
-1 0 B B
-1
-0 2 <eps2> <eps2>
-2 2 <eps2> <eps2>
-2 0 a a
-2 0 b b
-2 0 A A
-2 0 B B
-2
diff --git a/gfsm/gfsm/src/programs/cat1.tfst b/gfsm/gfsm/src/programs/cat1.tfst
deleted file mode 100644
index 9a51daf..0000000
--- a/gfsm/gfsm/src/programs/cat1.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 1 1 1.0
-1 2 2 2 2.0
-2 20
diff --git a/gfsm/gfsm/src/programs/cat2.tfst b/gfsm/gfsm/src/programs/cat2.tfst
deleted file mode 100644
index 5e9e740..0000000
--- a/gfsm/gfsm/src/programs/cat2.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 3 3 30
-0 2 4 4 40
-1 100
-2 200
diff --git a/gfsm/gfsm/src/programs/comp1a.tfst b/gfsm/gfsm/src/programs/comp1a.tfst
deleted file mode 100644
index c98130b..0000000
--- a/gfsm/gfsm/src/programs/comp1a.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 1 0 0
-1 2 0 0 0
-2 3 0 2 0
-3 0
diff --git a/gfsm/gfsm/src/programs/comp1b.tfst b/gfsm/gfsm/src/programs/comp1b.tfst
deleted file mode 100644
index 7818495..0000000
--- a/gfsm/gfsm/src/programs/comp1b.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 2 0 0
-1 2 0 0 0
-2 3 0 3 0
-3 0
diff --git a/gfsm/gfsm/src/programs/comp2.tfst b/gfsm/gfsm/src/programs/comp2.tfst
deleted file mode 100644
index 5eb2b86..0000000
--- a/gfsm/gfsm/src/programs/comp2.tfst
+++ /dev/null
@@ -1,6 +0,0 @@
-0 1 1 0 0
-1 2 0 0 0
-2 3 0 0 0
-3 4 0 0 0
-4 5 0 3 0
-5 0
diff --git a/gfsm/gfsm/src/programs/comp2a.tfst b/gfsm/gfsm/src/programs/comp2a.tfst
deleted file mode 100644
index ed416e9..0000000
--- a/gfsm/gfsm/src/programs/comp2a.tfst
+++ /dev/null
@@ -1,2 +0,0 @@
-0 1 1 2 0
-1 0
diff --git a/gfsm/gfsm/src/programs/comp2b.tfst b/gfsm/gfsm/src/programs/comp2b.tfst
deleted file mode 100644
index dbf6c01..0000000
--- a/gfsm/gfsm/src/programs/comp2b.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 2 0 0
-1 2 0 3 0
-2 0
diff --git a/gfsm/gfsm/src/programs/complement-in.tfst b/gfsm/gfsm/src/programs/complement-in.tfst
deleted file mode 100644
index 45e1e1b..0000000
--- a/gfsm/gfsm/src/programs/complement-in.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 1 1
-1 2 2 2
-2 2 2 2
-2 0
diff --git a/gfsm/gfsm/src/programs/compose-mohri-1.tfst b/gfsm/gfsm/src/programs/compose-mohri-1.tfst
deleted file mode 100644
index ebf0277..0000000
--- a/gfsm/gfsm/src/programs/compose-mohri-1.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 1 1 1
-1 2 2 0
-2 3 3 0
-3 4 4 4
-4
diff --git a/gfsm/gfsm/src/programs/compose-mohri-2.tfst b/gfsm/gfsm/src/programs/compose-mohri-2.tfst
deleted file mode 100644
index 154e266..0000000
--- a/gfsm/gfsm/src/programs/compose-mohri-2.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 1 4
-1 2 0 5
-2 3 4 1
-3
diff --git a/gfsm/gfsm/src/programs/config.h b/gfsm/gfsm/src/programs/config.h
deleted file mode 100644
index 2b1cb3c..0000000
--- a/gfsm/gfsm/src/programs/config.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <gfsmConfig.h>
-
-/* Define this for verbose memory debugging */
-//#define GFSM_DEBUG_VERBOSE
-
-#ifdef GFSM_DEBUG_VERBOSE
-# include <gfsmDebug.h>
-# define GFSM_INIT gfsm_debug_init();
-# define GFSM_FINISH gfsm_debug_finish(); gfsm_debug_print();
-#else
-# define GFSM_INIT
-# define GFSM_FINISH
-#endif
diff --git a/gfsm/gfsm/src/programs/connect-in.tfst b/gfsm/gfsm/src/programs/connect-in.tfst
deleted file mode 100644
index f160c6c..0000000
--- a/gfsm/gfsm/src/programs/connect-in.tfst
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 0 1
-0 2 0 2
-1 3 1 3
-1 4 1 4
-2 4 2 4
-2 3 2 3
-3
diff --git a/gfsm/gfsm/src/programs/ctest.tfst b/gfsm/gfsm/src/programs/ctest.tfst
deleted file mode 100644
index f160c6c..0000000
--- a/gfsm/gfsm/src/programs/ctest.tfst
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 0 1
-0 2 0 2
-1 3 1 3
-1 4 1 4
-2 4 2 4
-2 3 2 3
-3
diff --git a/gfsm/gfsm/src/programs/ctest2.tfst b/gfsm/gfsm/src/programs/ctest2.tfst
deleted file mode 100644
index b27f50a..0000000
--- a/gfsm/gfsm/src/programs/ctest2.tfst
+++ /dev/null
@@ -1,6 +0,0 @@
-0 1 0 1
-0 2 0 2
-1 3 1 3
-1 4 1 4
-2 4 2 4
-2 3 2 3
diff --git a/gfsm/gfsm/src/programs/det.tfst b/gfsm/gfsm/src/programs/det.tfst
deleted file mode 100644
index f93e247..0000000
--- a/gfsm/gfsm/src/programs/det.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 1 1 1
-0 2 1 2
-2 3 3 3
-1
-3
diff --git a/gfsm/gfsm/src/programs/determinize-in.tfst b/gfsm/gfsm/src/programs/determinize-in.tfst
deleted file mode 100644
index 8a6d556..0000000
--- a/gfsm/gfsm/src/programs/determinize-in.tfst
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 1 1
-0 2 2 2
-0 2 1 1
-2 1 1 1
-2 3 3 3
-1 10
-3 30
diff --git a/gfsm/gfsm/src/programs/elookup.tfst b/gfsm/gfsm/src/programs/elookup.tfst
deleted file mode 100644
index a7a0db1..0000000
--- a/gfsm/gfsm/src/programs/elookup.tfst
+++ /dev/null
@@ -1,2 +0,0 @@
-0 0 0 1 0
-0 0
diff --git a/gfsm/gfsm/src/programs/gfsmarcsort.gog b/gfsm/gfsm/src/programs/gfsmarcsort.gog
deleted file mode 100644
index ab827d6..0000000
--- a/gfsm/gfsm/src/programs/gfsmarcsort.gog
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmarcsort"
-#program_version "0.01"
-
-purpose "Sort arcs of a finite state machine"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-flag "lower" l "Sort by (lower,upper,target) [default]."
-flag - i "Alias for -l"
-
-flag "upper" u "Sort by (upper,lower,target)."
-flag - o "Alias for '-u'"
-
-flag "weight" w "Sort by weight (ascending)."
-flag "cost" C "Alias for '-w'"
-
-string "mode" m "Sort by explicit mode string (overrides -l, -u, etc.)" \
- arg="MODE" \
- default="" \
- details="
-Sort by a mode string over the characters \"luwstLUWST_\", as accepted
-by gfsm_acmask_from_chars(). Each character in the string represents
-a single elementary arc field comparison, and the comparison with the
-highest priority should occur leftmost in the string. Correspondence
-between characters in MODE and arc comparisons is:
-
- CHAR : COMPARISON
- l : sort by lower labels in ascending order
- u : sort by upper labels in ascending order
- w : sort by arc weight in semiring-ascending order
- s : sort by source state in ascending order (useless here)
- t : sort by target state in ascending order
-
- L : sort by lower labels in descending order
- U : sort by upper labels in descending order
- W : sort by arc weight in semiring-descending order
- S : sort by source state in descending order (useless here)
- T : sort by target state in descending order
-
- _ : no comparison at the corresponding priority level
- x : user-specified comparison (useless here)
-
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.c b/gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.c
deleted file mode 100644
index 94f4f16..0000000
--- a/gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.c
+++ /dev/null
@@ -1,595 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmarcsort_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.06
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmarcsort_cmdparser gfsmarcsort.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmarcsort"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmarcsort_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmarcsort (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Sort arcs of a finite state machine\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmarcsort");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -l --lower Sort by (lower,upper,target) [default].\n");
- printf(" -i Alias for -l\n");
- printf(" -u --upper Sort by (upper,lower,target).\n");
- printf(" -o Alias for '-u'\n");
- printf(" -w --weight Sort by weight (ascending).\n");
- printf(" -C --cost Alias for '-w'\n");
- printf(" -mMODE --mode=MODE Sort by explicit mode string (overrides -l, -u, etc.)\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->lower_flag = 0;
- args_info->i_flag = 0;
- args_info->upper_flag = 0;
- args_info->o_flag = 0;
- args_info->weight_flag = 0;
- args_info->cost_flag = 0;
- args_info->mode_arg = strdup("");
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->lower_given = 0;
- args_info->i_given = 0;
- args_info->upper_given = 0;
- args_info->o_given = 0;
- args_info->weight_given = 0;
- args_info->cost_given = 0;
- args_info->mode_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "lower", 0, NULL, 'l' },
- { "upper", 0, NULL, 'u' },
- { "weight", 0, NULL, 'w' },
- { "cost", 0, NULL, 'C' },
- { "mode", 1, NULL, 'm' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'l',
- 'i',
- 'u',
- 'o',
- 'w',
- 'C',
- 'm', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'l': /* Sort by (lower,upper,target) [default]. */
- if (args_info->lower_given) {
- fprintf(stderr, "%s: `--lower' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->lower_given++;
- if (args_info->lower_given <= 1)
- args_info->lower_flag = !(args_info->lower_flag);
- break;
-
- case 'i': /* Alias for -l */
- if (args_info->i_given) {
- fprintf(stderr, "%s: (`-i') option given more than once\n", PROGRAM);
- }
- args_info->i_given++;
- if (args_info->i_given <= 1)
- args_info->i_flag = !(args_info->i_flag);
- break;
-
- case 'u': /* Sort by (upper,lower,target). */
- if (args_info->upper_given) {
- fprintf(stderr, "%s: `--upper' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->upper_given++;
- if (args_info->upper_given <= 1)
- args_info->upper_flag = !(args_info->upper_flag);
- break;
-
- case 'o': /* Alias for '-u' */
- if (args_info->o_given) {
- fprintf(stderr, "%s: (`-o') option given more than once\n", PROGRAM);
- }
- args_info->o_given++;
- if (args_info->o_given <= 1)
- args_info->o_flag = !(args_info->o_flag);
- break;
-
- case 'w': /* Sort by weight (ascending). */
- if (args_info->weight_given) {
- fprintf(stderr, "%s: `--weight' (`-w') option given more than once\n", PROGRAM);
- }
- args_info->weight_given++;
- if (args_info->weight_given <= 1)
- args_info->weight_flag = !(args_info->weight_flag);
- break;
-
- case 'C': /* Alias for '-w' */
- if (args_info->cost_given) {
- fprintf(stderr, "%s: `--cost' (`-C') option given more than once\n", PROGRAM);
- }
- args_info->cost_given++;
- if (args_info->cost_given <= 1)
- args_info->cost_flag = !(args_info->cost_flag);
- break;
-
- case 'm': /* Sort by explicit mode string (overrides -l, -u, etc.) */
- if (args_info->mode_given) {
- fprintf(stderr, "%s: `--mode' (`-m') option given more than once\n", PROGRAM);
- }
- args_info->mode_given++;
- if (args_info->mode_arg) free(args_info->mode_arg);
- args_info->mode_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Sort by (lower,upper,target) [default]. */
- else if (strcmp(olong, "lower") == 0) {
- if (args_info->lower_given) {
- fprintf(stderr, "%s: `--lower' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->lower_given++;
- if (args_info->lower_given <= 1)
- args_info->lower_flag = !(args_info->lower_flag);
- }
-
- /* Sort by (upper,lower,target). */
- else if (strcmp(olong, "upper") == 0) {
- if (args_info->upper_given) {
- fprintf(stderr, "%s: `--upper' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->upper_given++;
- if (args_info->upper_given <= 1)
- args_info->upper_flag = !(args_info->upper_flag);
- }
-
- /* Sort by weight (ascending). */
- else if (strcmp(olong, "weight") == 0) {
- if (args_info->weight_given) {
- fprintf(stderr, "%s: `--weight' (`-w') option given more than once\n", PROGRAM);
- }
- args_info->weight_given++;
- if (args_info->weight_given <= 1)
- args_info->weight_flag = !(args_info->weight_flag);
- }
-
- /* Alias for '-w' */
- else if (strcmp(olong, "cost") == 0) {
- if (args_info->cost_given) {
- fprintf(stderr, "%s: `--cost' (`-C') option given more than once\n", PROGRAM);
- }
- args_info->cost_given++;
- if (args_info->cost_given <= 1)
- args_info->cost_flag = !(args_info->cost_flag);
- }
-
- /* Sort by explicit mode string (overrides -l, -u, etc.) */
- else if (strcmp(olong, "mode") == 0) {
- if (args_info->mode_given) {
- fprintf(stderr, "%s: `--mode' (`-m') option given more than once\n", PROGRAM);
- }
- args_info->mode_given++;
- if (args_info->mode_arg) free(args_info->mode_arg);
- args_info->mode_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.h b/gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.h
deleted file mode 100644
index 29f5f6a..0000000
--- a/gfsm/gfsm/src/programs/gfsmarcsort_cmdparser.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmarcsort_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.06.
- *
- */
-
-#ifndef gfsmarcsort_cmdparser_h
-#define gfsmarcsort_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int lower_flag; /* Sort by (lower,upper,target) [default]. (default=0). */
- int i_flag; /* Alias for -l (default=0). */
- int upper_flag; /* Sort by (upper,lower,target). (default=0). */
- int o_flag; /* Alias for '-u' (default=0). */
- int weight_flag; /* Sort by weight (ascending). (default=0). */
- int cost_flag; /* Alias for '-w' (default=0). */
- char * mode_arg; /* Sort by explicit mode string (overrides -l, -u, etc.) (default=). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int lower_given; /* Whether lower was given */
- int i_given; /* Whether - was given */
- int upper_given; /* Whether upper was given */
- int o_given; /* Whether - was given */
- int weight_given; /* Whether weight was given */
- int cost_given; /* Whether cost was given */
- int mode_given; /* Whether mode was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmarcsort_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmarcsort_main.c b/gfsm/gfsm/src/programs/gfsmarcsort_main.c
deleted file mode 100644
index ac3e48f..0000000
--- a/gfsm/gfsm/src/programs/gfsmarcsort_main.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004-2007 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmarcsort_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmarcsort";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs & vars
-gfsmAutomaton *fsm;
-gfsmArcCompMask mode = gfsmASMLower;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- mode?
- if (args.mode_given) { mode = gfsm_acmask_from_chars(args.mode_arg); }
- else if (args.lower_given || args.i_given) mode = gfsmASMLower;
- else if (args.upper_given || args.o_given) mode = gfsmASMUpper;
- else if (args.weight_given || args.cost_given) mode = gfsmASMWeight;
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- sort
- gfsm_automaton_arcsort(fsm,mode);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmarith.gog b/gfsm/gfsm/src/programs/gfsmarith.gog
deleted file mode 100644
index b2f14b9..0000000
--- a/gfsm/gfsm/src/programs/gfsmarith.gog
+++ /dev/null
@@ -1,132 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmarith"
-#program_version "0.01"
-
-purpose "Perform an elementary arithmetic operation on automaton weights"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "FSMFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-
-#-------------------------------------------------------
-# Basic Options
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-------------------------------------------------------
-# Operator Selection
-group "Operator Selection"
-
-flag "exp" E "Real exponentiation"
-
-flag "log" L "Real logarithm"
-
-float "multiply" m "Real multiplication by WEIGHT" \
- arg="WEIGHT"
-
-float "add" a "Real addition of WEIGHT" \
- arg="WEIGHT"
-
-flag "positive" p "Set real negative weights to zero"
-
-
-float "times" - "Semiring multiplication by WEIGHT" \
- arg="WEIGHT"
-
-float "plus" - "Semiring addition of WEIGHT" \
- arg="WEIGHT"
-
-flag "sr-positive" - "Set semiring-negative weights to semiring-zero"
-
-#-------------------------------------------------------
-# Weight Selection
-group "Weight Selection"
-
-flag "no-arcs" A "Exclude arc weights (default: include)"
-
-flag "no-finals" f "Exclude final weights (default: include)"
-
-#flag "potentials" P "Include potentials (default: include)" ##-- what the heck are 'potentials'?
-
-flag "zero" Z "Include semiring-zero weights (default: exclude)"
-
-#-------------------------------------------------------
-# State & Label Selection
-group "State & Label Selection"
-
-flag "initial" i "Select only initial state and its arcs/finality"
-
-int "state" s "Select only state ID and its arcs/finality (default=all)" \
- arg="ID" \
- default="-1"
-
-int "lower" l "Select only arcs with lower-label LO (default=any)" \
- arg="LO" \
- default="-1"
-
-int "upper" u "Select only arcs with upper-label HI (defualt=any)" \
- arg="HI" \
- default="-1"
-
-
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-Note that the --plus and --times operations are
-sensitive to the semiring associated with the stored FSM file, while
-the --add and --multiply operations have the usual real-number interpretations,
-regardless of the automaton semiring.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmarith_cmdparser.c b/gfsm/gfsm/src/programs/gfsmarith_cmdparser.c
deleted file mode 100644
index 7aade2f..0000000
--- a/gfsm/gfsm/src/programs/gfsmarith_cmdparser.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmarith_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmarith_cmdparser gfsmarith.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmarith"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmarith_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmarith (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Perform an elementary arithmetic operation on automaton weights\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... FSMFILE\n", "gfsmarith");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" FSMFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
- printf("\n");
- printf(" Operator Selection:\n");
- printf(" -E --exp Real exponentiation\n");
- printf(" -L --log Real logarithm\n");
- printf(" -mFLOAT --multiply=FLOAT Real multiplication by WEIGHT\n");
- printf(" -aFLOAT --add=FLOAT Real addition of WEIGHT\n");
- printf(" -p --positive Set real negative weights to zero\n");
- printf(" --times=FLOAT Semiring multiplication by WEIGHT\n");
- printf(" --plus=FLOAT Semiring addition of WEIGHT\n");
- printf(" --sr-positive Set semiring-negative weights to semiring-zero\n");
- printf("\n");
- printf(" Weight Selection:\n");
- printf(" -A --no-arcs Exclude arc weights (default: include)\n");
- printf(" -f --no-finals Exclude final weights (default: include)\n");
- printf(" -Z --zero Include semiring-zero weights (default: exclude)\n");
- printf("\n");
- printf(" State & Label Selection:\n");
- printf(" -i --initial Select only initial state and its arcs/finality\n");
- printf(" -sID --state=ID Select only state ID and its arcs/finality (default=all)\n");
- printf(" -lLO --lower=LO Select only arcs with lower-label LO (default=any)\n");
- printf(" -uHI --upper=HI Select only arcs with upper-label HI (defualt=any)\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
- args_info->exp_flag = 0;
- args_info->log_flag = 0;
- args_info->multiply_arg = 0;
- args_info->add_arg = 0;
- args_info->positive_flag = 0;
- args_info->times_arg = 0;
- args_info->plus_arg = 0;
- args_info->sr_positive_flag = 0;
- args_info->no_arcs_flag = 0;
- args_info->no_finals_flag = 0;
- args_info->zero_flag = 0;
- args_info->initial_flag = 0;
- args_info->state_arg = -1;
- args_info->lower_arg = -1;
- args_info->upper_arg = -1;
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
- args_info->exp_given = 0;
- args_info->log_given = 0;
- args_info->multiply_given = 0;
- args_info->add_given = 0;
- args_info->positive_given = 0;
- args_info->times_given = 0;
- args_info->plus_given = 0;
- args_info->sr_positive_given = 0;
- args_info->no_arcs_given = 0;
- args_info->no_finals_given = 0;
- args_info->zero_given = 0;
- args_info->initial_given = 0;
- args_info->state_given = 0;
- args_info->lower_given = 0;
- args_info->upper_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { "exp", 0, NULL, 'E' },
- { "log", 0, NULL, 'L' },
- { "multiply", 1, NULL, 'm' },
- { "add", 1, NULL, 'a' },
- { "positive", 0, NULL, 'p' },
- { "times", 1, NULL, 0 },
- { "plus", 1, NULL, 0 },
- { "sr-positive", 0, NULL, 0 },
- { "no-arcs", 0, NULL, 'A' },
- { "no-finals", 0, NULL, 'f' },
- { "zero", 0, NULL, 'Z' },
- { "initial", 0, NULL, 'i' },
- { "state", 1, NULL, 's' },
- { "lower", 1, NULL, 'l' },
- { "upper", 1, NULL, 'u' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- 'E',
- 'L',
- 'm', ':',
- 'a', ':',
- 'p',
- 'A',
- 'f',
- 'Z',
- 'i',
- 's', ':',
- 'l', ':',
- 'u', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 'E': /* Real exponentiation */
- if (args_info->exp_given) {
- fprintf(stderr, "%s: `--exp' (`-E') option given more than once\n", PROGRAM);
- }
- args_info->exp_given++;
- if (args_info->exp_given <= 1)
- args_info->exp_flag = !(args_info->exp_flag);
- break;
-
- case 'L': /* Real logarithm */
- if (args_info->log_given) {
- fprintf(stderr, "%s: `--log' (`-L') option given more than once\n", PROGRAM);
- }
- args_info->log_given++;
- if (args_info->log_given <= 1)
- args_info->log_flag = !(args_info->log_flag);
- break;
-
- case 'm': /* Real multiplication by WEIGHT */
- if (args_info->multiply_given) {
- fprintf(stderr, "%s: `--multiply' (`-m') option given more than once\n", PROGRAM);
- }
- args_info->multiply_given++;
- args_info->multiply_arg = (float)strtod(val, NULL);
- break;
-
- case 'a': /* Real addition of WEIGHT */
- if (args_info->add_given) {
- fprintf(stderr, "%s: `--add' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->add_given++;
- args_info->add_arg = (float)strtod(val, NULL);
- break;
-
- case 'p': /* Set real negative weights to zero */
- if (args_info->positive_given) {
- fprintf(stderr, "%s: `--positive' (`-p') option given more than once\n", PROGRAM);
- }
- args_info->positive_given++;
- if (args_info->positive_given <= 1)
- args_info->positive_flag = !(args_info->positive_flag);
- break;
-
- case 'A': /* Exclude arc weights (default: include) */
- if (args_info->no_arcs_given) {
- fprintf(stderr, "%s: `--no-arcs' (`-A') option given more than once\n", PROGRAM);
- }
- args_info->no_arcs_given++;
- if (args_info->no_arcs_given <= 1)
- args_info->no_arcs_flag = !(args_info->no_arcs_flag);
- break;
-
- case 'f': /* Exclude final weights (default: include) */
- if (args_info->no_finals_given) {
- fprintf(stderr, "%s: `--no-finals' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->no_finals_given++;
- if (args_info->no_finals_given <= 1)
- args_info->no_finals_flag = !(args_info->no_finals_flag);
- break;
-
- case 'Z': /* Include semiring-zero weights (default: exclude) */
- if (args_info->zero_given) {
- fprintf(stderr, "%s: `--zero' (`-Z') option given more than once\n", PROGRAM);
- }
- args_info->zero_given++;
- if (args_info->zero_given <= 1)
- args_info->zero_flag = !(args_info->zero_flag);
- break;
-
- case 'i': /* Select only initial state and its arcs/finality */
- if (args_info->initial_given) {
- fprintf(stderr, "%s: `--initial' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->initial_given++;
- if (args_info->initial_given <= 1)
- args_info->initial_flag = !(args_info->initial_flag);
- break;
-
- case 's': /* Select only state ID and its arcs/finality (default=all) */
- if (args_info->state_given) {
- fprintf(stderr, "%s: `--state' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->state_given++;
- args_info->state_arg = (int)atoi(val);
- break;
-
- case 'l': /* Select only arcs with lower-label LO (default=any) */
- if (args_info->lower_given) {
- fprintf(stderr, "%s: `--lower' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->lower_given++;
- args_info->lower_arg = (int)atoi(val);
- break;
-
- case 'u': /* Select only arcs with upper-label HI (defualt=any) */
- if (args_info->upper_given) {
- fprintf(stderr, "%s: `--upper' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->upper_given++;
- args_info->upper_arg = (int)atoi(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- /* Real exponentiation */
- else if (strcmp(olong, "exp") == 0) {
- if (args_info->exp_given) {
- fprintf(stderr, "%s: `--exp' (`-E') option given more than once\n", PROGRAM);
- }
- args_info->exp_given++;
- if (args_info->exp_given <= 1)
- args_info->exp_flag = !(args_info->exp_flag);
- }
-
- /* Real logarithm */
- else if (strcmp(olong, "log") == 0) {
- if (args_info->log_given) {
- fprintf(stderr, "%s: `--log' (`-L') option given more than once\n", PROGRAM);
- }
- args_info->log_given++;
- if (args_info->log_given <= 1)
- args_info->log_flag = !(args_info->log_flag);
- }
-
- /* Real multiplication by WEIGHT */
- else if (strcmp(olong, "multiply") == 0) {
- if (args_info->multiply_given) {
- fprintf(stderr, "%s: `--multiply' (`-m') option given more than once\n", PROGRAM);
- }
- args_info->multiply_given++;
- args_info->multiply_arg = (float)strtod(val, NULL);
- }
-
- /* Real addition of WEIGHT */
- else if (strcmp(olong, "add") == 0) {
- if (args_info->add_given) {
- fprintf(stderr, "%s: `--add' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->add_given++;
- args_info->add_arg = (float)strtod(val, NULL);
- }
-
- /* Set real negative weights to zero */
- else if (strcmp(olong, "positive") == 0) {
- if (args_info->positive_given) {
- fprintf(stderr, "%s: `--positive' (`-p') option given more than once\n", PROGRAM);
- }
- args_info->positive_given++;
- if (args_info->positive_given <= 1)
- args_info->positive_flag = !(args_info->positive_flag);
- }
-
- /* Semiring multiplication by WEIGHT */
- else if (strcmp(olong, "times") == 0) {
- if (args_info->times_given) {
- fprintf(stderr, "%s: `--times' option given more than once\n", PROGRAM);
- }
- args_info->times_given++;
- args_info->times_arg = (float)strtod(val, NULL);
- }
-
- /* Semiring addition of WEIGHT */
- else if (strcmp(olong, "plus") == 0) {
- if (args_info->plus_given) {
- fprintf(stderr, "%s: `--plus' option given more than once\n", PROGRAM);
- }
- args_info->plus_given++;
- args_info->plus_arg = (float)strtod(val, NULL);
- }
-
- /* Set semiring-negative weights to semiring-zero */
- else if (strcmp(olong, "sr-positive") == 0) {
- if (args_info->sr_positive_given) {
- fprintf(stderr, "%s: `--sr-positive' option given more than once\n", PROGRAM);
- }
- args_info->sr_positive_given++;
- if (args_info->sr_positive_given <= 1)
- args_info->sr_positive_flag = !(args_info->sr_positive_flag);
- }
-
- /* Exclude arc weights (default: include) */
- else if (strcmp(olong, "no-arcs") == 0) {
- if (args_info->no_arcs_given) {
- fprintf(stderr, "%s: `--no-arcs' (`-A') option given more than once\n", PROGRAM);
- }
- args_info->no_arcs_given++;
- if (args_info->no_arcs_given <= 1)
- args_info->no_arcs_flag = !(args_info->no_arcs_flag);
- }
-
- /* Exclude final weights (default: include) */
- else if (strcmp(olong, "no-finals") == 0) {
- if (args_info->no_finals_given) {
- fprintf(stderr, "%s: `--no-finals' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->no_finals_given++;
- if (args_info->no_finals_given <= 1)
- args_info->no_finals_flag = !(args_info->no_finals_flag);
- }
-
- /* Include semiring-zero weights (default: exclude) */
- else if (strcmp(olong, "zero") == 0) {
- if (args_info->zero_given) {
- fprintf(stderr, "%s: `--zero' (`-Z') option given more than once\n", PROGRAM);
- }
- args_info->zero_given++;
- if (args_info->zero_given <= 1)
- args_info->zero_flag = !(args_info->zero_flag);
- }
-
- /* Select only initial state and its arcs/finality */
- else if (strcmp(olong, "initial") == 0) {
- if (args_info->initial_given) {
- fprintf(stderr, "%s: `--initial' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->initial_given++;
- if (args_info->initial_given <= 1)
- args_info->initial_flag = !(args_info->initial_flag);
- }
-
- /* Select only state ID and its arcs/finality (default=all) */
- else if (strcmp(olong, "state") == 0) {
- if (args_info->state_given) {
- fprintf(stderr, "%s: `--state' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->state_given++;
- args_info->state_arg = (int)atoi(val);
- }
-
- /* Select only arcs with lower-label LO (default=any) */
- else if (strcmp(olong, "lower") == 0) {
- if (args_info->lower_given) {
- fprintf(stderr, "%s: `--lower' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->lower_given++;
- args_info->lower_arg = (int)atoi(val);
- }
-
- /* Select only arcs with upper-label HI (defualt=any) */
- else if (strcmp(olong, "upper") == 0) {
- if (args_info->upper_given) {
- fprintf(stderr, "%s: `--upper' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->upper_given++;
- args_info->upper_arg = (int)atoi(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmarith_cmdparser.h b/gfsm/gfsm/src/programs/gfsmarith_cmdparser.h
deleted file mode 100644
index 0f8b5c4..0000000
--- a/gfsm/gfsm/src/programs/gfsmarith_cmdparser.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmarith_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmarith_cmdparser_h
-#define gfsmarith_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
- int exp_flag; /* Real exponentiation (default=0). */
- int log_flag; /* Real logarithm (default=0). */
- float multiply_arg; /* Real multiplication by WEIGHT (default=0). */
- float add_arg; /* Real addition of WEIGHT (default=0). */
- int positive_flag; /* Set real negative weights to zero (default=0). */
- float times_arg; /* Semiring multiplication by WEIGHT (default=0). */
- float plus_arg; /* Semiring addition of WEIGHT (default=0). */
- int sr_positive_flag; /* Set semiring-negative weights to semiring-zero (default=0). */
- int no_arcs_flag; /* Exclude arc weights (default: include) (default=0). */
- int no_finals_flag; /* Exclude final weights (default: include) (default=0). */
- int zero_flag; /* Include semiring-zero weights (default: exclude) (default=0). */
- int initial_flag; /* Select only initial state and its arcs/finality (default=0). */
- int state_arg; /* Select only state ID and its arcs/finality (default=all) (default=-1). */
- int lower_arg; /* Select only arcs with lower-label LO (default=any) (default=-1). */
- int upper_arg; /* Select only arcs with upper-label HI (defualt=any) (default=-1). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
- int exp_given; /* Whether exp was given */
- int log_given; /* Whether log was given */
- int multiply_given; /* Whether multiply was given */
- int add_given; /* Whether add was given */
- int positive_given; /* Whether positive was given */
- int times_given; /* Whether times was given */
- int plus_given; /* Whether plus was given */
- int sr_positive_given; /* Whether sr-positive was given */
- int no_arcs_given; /* Whether no-arcs was given */
- int no_finals_given; /* Whether no-finals was given */
- int zero_given; /* Whether zero was given */
- int initial_given; /* Whether initial was given */
- int state_given; /* Whether state was given */
- int lower_given; /* Whether lower was given */
- int upper_given; /* Whether upper was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmarith_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmarith_main.c b/gfsm/gfsm/src/programs/gfsmarith_main.c
deleted file mode 100644
index 53f5708..0000000
--- a/gfsm/gfsm/src/programs/gfsmarith_main.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gfsm.h>
-
-#include "gfsmarith_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmarith";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmError *err = NULL;
-
-//-- arithmetic operation
-gfsmArithOp op=gfsmAONone;
-gfsmWeight arg=0;
-
-//-- weight selection
-gboolean do_arcs;
-gboolean do_finals;
-gboolean do_zero;
-
-//-- state & label selection
-gfsmStateId qid;
-gfsmLabelVal lo;
-gfsmLabelVal hi;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- outfilename = args.output_arg;
-
- //-- operator selection
- if (args.exp_given) { op = gfsmAOExp; }
- else if (args.log_given) { op = gfsmAOLog; }
- else if (args.multiply_given) { op = gfsmAOMult; arg=args.multiply_arg; }
- else if (args.add_given) { op = gfsmAOAdd; arg=args.add_arg; }
- else if (args.positive_given) { op = gfsmAONoNeg; }
- else if (args.times_given) { op = gfsmAOSRTimes; arg=args.times_arg; }
- else if (args.plus_given) { op = gfsmAOSRPlus; arg=args.plus_arg; }
- else if (args.sr_positive_given) { op = gfsmAOSRNoNeg; }
-
- //-- weight selection
- do_arcs = !args.no_arcs_given;
- do_finals = !args.no_finals_given;
- do_zero = args.zero_given;
-
- //-- state & label selection
- qid = args.state_given ? args.state_arg : gfsmNoState;
- lo = args.lower_given ? args.lower_arg : gfsmNoLabel;
- hi = args.upper_given ? args.upper_arg : gfsmNoLabel;
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(3);
- }
-
- //-- hack: initial-state selection
- if (args.initial_flag) qid=fsm->root_id;
-
- //-- perform weight aritmetic
- gfsm_automaton_arith_state(fsm, qid, op, arg, lo, hi, do_arcs, do_finals, do_zero);
-
- //-- store automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- gfsm_automaton_free(fsm);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmclosure.gog b/gfsm/gfsm/src/programs/gfsmclosure.gog
deleted file mode 100644
index 77b5884..0000000
--- a/gfsm/gfsm/src/programs/gfsmclosure.gog
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmclosure"
-#program_version "0.01"
-
-purpose "Compute Kleene closure of a finite state machine"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "times" n "Compute n-ary (^n) closure." \
- arg="N" \
- default="0"
-
-flag "plus" p "Compute transitive (+) closure." \
- details="
-Alias for '-n 1'.
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmclosure_cmdparser.c b/gfsm/gfsm/src/programs/gfsmclosure_cmdparser.c
deleted file mode 100644
index 11f7bfd..0000000
--- a/gfsm/gfsm/src/programs/gfsmclosure_cmdparser.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmclosure_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmclosure_cmdparser gfsmclosure.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmclosure"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmclosure_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmclosure (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute Kleene closure of a finite state machine\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmclosure");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -nN --times=N Compute n-ary (^n) closure.\n");
- printf(" -p --plus Compute transitive (+) closure.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->times_arg = 0;
- args_info->plus_flag = 0;
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->times_given = 0;
- args_info->plus_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "times", 1, NULL, 'n' },
- { "plus", 0, NULL, 'p' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'n', ':',
- 'p',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'n': /* Compute n-ary (^n) closure. */
- if (args_info->times_given) {
- fprintf(stderr, "%s: `--times' (`-n') option given more than once\n", PROGRAM);
- }
- args_info->times_given++;
- args_info->times_arg = (int)atoi(val);
- break;
-
- case 'p': /* Compute transitive (+) closure. */
- if (args_info->plus_given) {
- fprintf(stderr, "%s: `--plus' (`-p') option given more than once\n", PROGRAM);
- }
- args_info->plus_given++;
- if (args_info->plus_given <= 1)
- args_info->plus_flag = !(args_info->plus_flag);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Compute n-ary (^n) closure. */
- else if (strcmp(olong, "times") == 0) {
- if (args_info->times_given) {
- fprintf(stderr, "%s: `--times' (`-n') option given more than once\n", PROGRAM);
- }
- args_info->times_given++;
- args_info->times_arg = (int)atoi(val);
- }
-
- /* Compute transitive (+) closure. */
- else if (strcmp(olong, "plus") == 0) {
- if (args_info->plus_given) {
- fprintf(stderr, "%s: `--plus' (`-p') option given more than once\n", PROGRAM);
- }
- args_info->plus_given++;
- if (args_info->plus_given <= 1)
- args_info->plus_flag = !(args_info->plus_flag);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmclosure_cmdparser.h b/gfsm/gfsm/src/programs/gfsmclosure_cmdparser.h
deleted file mode 100644
index 0837b6a..0000000
--- a/gfsm/gfsm/src/programs/gfsmclosure_cmdparser.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmclosure_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmclosure_cmdparser_h
-#define gfsmclosure_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int times_arg; /* Compute n-ary (^n) closure. (default=0). */
- int plus_flag; /* Compute transitive (+) closure. (default=0). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int times_given; /* Whether times was given */
- int plus_given; /* Whether plus was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmclosure_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmclosure_main.c b/gfsm/gfsm/src/programs/gfsmclosure_main.c
deleted file mode 100644
index 8b8d029..0000000
--- a/gfsm/gfsm/src/programs/gfsmclosure_main.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmclosure_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmclosure";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsm=NULL;
-guint times = 0;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- get closure length
- if (args.plus_given) times = 1;
- else times = args.times_arg;
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute closure
- gfsm_automaton_n_closure(fsm, times);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcompile.gog b/gfsm/gfsm/src/programs/gfsmcompile.gog
deleted file mode 100644
index e53307b..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompile.gog
+++ /dev/null
@@ -1,102 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmcompile"
-#program_version "0.01"
-
-purpose "Compile text format gfsm files to binary"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "TXTFILE" "Input text file" \
- details="
-If unspecified, standard input will be read
-"
-
-#argument "BINFILE" "Output binary gfsm file" \
-# details="
-#If unspecified, output will be written to standard output.
-#"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-flag "acceptor" a "Compile as acceptor (default=transducer)" \
- default=0
-
-string "ilabels" i "Specify input (lower) labels file." \
- arg="LABELS"
-
-string "olabels" o "Specify output (upper) labels file." \
- arg="LABELS"
-
-string "slabels" S "Specify state labels file." \
- arg="LABELS"
-
-string "semiring" s "Specify semiring type." \
- arg="SRTYPE" \
- default="tropical" \
- details="
-Specify one of the following:
-
- boolean
- log
- plog
- real
- trivial
- tropical
-
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmcompile_cmdparser.c b/gfsm/gfsm/src/programs/gfsmcompile_cmdparser.c
deleted file mode 100644
index ea17d5d..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompile_cmdparser.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcompile_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmcompile_cmdparser gfsmcompile.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmcompile"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmcompile_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmcompile (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compile text format gfsm files to binary\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... TXTFILE\n", "gfsmcompile");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" TXTFILE Input text file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -a --acceptor Compile as acceptor (default=transducer)\n");
- printf(" -iLABELS --ilabels=LABELS Specify input (lower) labels file.\n");
- printf(" -oLABELS --olabels=LABELS Specify output (upper) labels file.\n");
- printf(" -SLABELS --slabels=LABELS Specify state labels file.\n");
- printf(" -sSRTYPE --semiring=SRTYPE Specify semiring type.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->acceptor_flag = 0;
- args_info->ilabels_arg = NULL;
- args_info->olabels_arg = NULL;
- args_info->slabels_arg = NULL;
- args_info->semiring_arg = strdup("tropical");
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->acceptor_given = 0;
- args_info->ilabels_given = 0;
- args_info->olabels_given = 0;
- args_info->slabels_given = 0;
- args_info->semiring_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "acceptor", 0, NULL, 'a' },
- { "ilabels", 1, NULL, 'i' },
- { "olabels", 1, NULL, 'o' },
- { "slabels", 1, NULL, 'S' },
- { "semiring", 1, NULL, 's' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'a',
- 'i', ':',
- 'o', ':',
- 'S', ':',
- 's', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'a': /* Compile as acceptor (default=transducer) */
- if (args_info->acceptor_given) {
- fprintf(stderr, "%s: `--acceptor' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->acceptor_given++;
- if (args_info->acceptor_given <= 1)
- args_info->acceptor_flag = !(args_info->acceptor_flag);
- break;
-
- case 'i': /* Specify input (lower) labels file. */
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- break;
-
- case 'o': /* Specify output (upper) labels file. */
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- break;
-
- case 'S': /* Specify state labels file. */
- if (args_info->slabels_given) {
- fprintf(stderr, "%s: `--slabels' (`-S') option given more than once\n", PROGRAM);
- }
- args_info->slabels_given++;
- if (args_info->slabels_arg) free(args_info->slabels_arg);
- args_info->slabels_arg = strdup(val);
- break;
-
- case 's': /* Specify semiring type. */
- if (args_info->semiring_given) {
- fprintf(stderr, "%s: `--semiring' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->semiring_given++;
- if (args_info->semiring_arg) free(args_info->semiring_arg);
- args_info->semiring_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Compile as acceptor (default=transducer) */
- else if (strcmp(olong, "acceptor") == 0) {
- if (args_info->acceptor_given) {
- fprintf(stderr, "%s: `--acceptor' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->acceptor_given++;
- if (args_info->acceptor_given <= 1)
- args_info->acceptor_flag = !(args_info->acceptor_flag);
- }
-
- /* Specify input (lower) labels file. */
- else if (strcmp(olong, "ilabels") == 0) {
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- }
-
- /* Specify output (upper) labels file. */
- else if (strcmp(olong, "olabels") == 0) {
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- }
-
- /* Specify state labels file. */
- else if (strcmp(olong, "slabels") == 0) {
- if (args_info->slabels_given) {
- fprintf(stderr, "%s: `--slabels' (`-S') option given more than once\n", PROGRAM);
- }
- args_info->slabels_given++;
- if (args_info->slabels_arg) free(args_info->slabels_arg);
- args_info->slabels_arg = strdup(val);
- }
-
- /* Specify semiring type. */
- else if (strcmp(olong, "semiring") == 0) {
- if (args_info->semiring_given) {
- fprintf(stderr, "%s: `--semiring' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->semiring_given++;
- if (args_info->semiring_arg) free(args_info->semiring_arg);
- args_info->semiring_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcompile_cmdparser.h b/gfsm/gfsm/src/programs/gfsmcompile_cmdparser.h
deleted file mode 100644
index 53c4d59..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompile_cmdparser.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcompile_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmcompile_cmdparser_h
-#define gfsmcompile_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int acceptor_flag; /* Compile as acceptor (default=transducer) (default=0). */
- char * ilabels_arg; /* Specify input (lower) labels file. (default=NULL). */
- char * olabels_arg; /* Specify output (upper) labels file. (default=NULL). */
- char * slabels_arg; /* Specify state labels file. (default=NULL). */
- char * semiring_arg; /* Specify semiring type. (default=tropical). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int acceptor_given; /* Whether acceptor was given */
- int ilabels_given; /* Whether ilabels was given */
- int olabels_given; /* Whether olabels was given */
- int slabels_given; /* Whether slabels was given */
- int semiring_given; /* Whether semiring was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmcompile_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmcompile_main.c b/gfsm/gfsm/src/programs/gfsmcompile_main.c
deleted file mode 100644
index feeba69..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompile_main.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gfsm.h>
-
-#include "gfsmcompile_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmcompile";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmAlphabet *ilabels=NULL, *olabels=NULL, *slabels=NULL;
-gfsmError *err = NULL;
-gfsmSRType srtype = gfsmSRTUnknown;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- outfilename = args.output_arg;
-
- //-- labels: input
- if (args.ilabels_given) {
- ilabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(ilabels,args.ilabels_arg,&err)) {
- g_printerr("%s: load failed for input-labels file '%s': %s\n",
- progname, args.ilabels_arg, err->message);
- exit(2);
- }
- }
- //-- labels: output
- if (args.olabels_given) {
- olabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(olabels,args.olabels_arg,&err)) {
- g_printerr("%s: load failed for output-labels file '%s': %s\n",
- progname, args.olabels_arg, err->message);
- exit(2);
- }
- }
- //-- labels: state
- if (args.slabels_given) {
- slabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(slabels,args.slabels_arg,&err)) {
- g_printerr("%s: load failed for state-labels file '%s': %s\n",
- progname, args.slabels_arg, err->message);
- exit(2);
- }
- }
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
- if (args.acceptor_given) fsm->flags.is_transducer = FALSE;
-
- //-- set semiring
- srtype = gfsm_sr_name_to_type(args.semiring_arg);
- if (srtype != fsm->sr->type) {
- gfsm_automaton_set_semiring(fsm, gfsm_semiring_new(srtype));
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- compile automaton
- if (!gfsm_automaton_compile_filename_full(fsm,infilename,ilabels,olabels,slabels,&err)) {
- g_printerr("%s: compile failed for '%s': %s\n", progname, infilename, err->message);
- exit(3);
- }
-
- //-- store automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (ilabels) gfsm_alphabet_free(ilabels);
- if (olabels) gfsm_alphabet_free(olabels);
- if (slabels) gfsm_alphabet_free(slabels);
- gfsm_automaton_free(fsm);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcomplement.gog b/gfsm/gfsm/src/programs/gfsmcomplement.gog
deleted file mode 100644
index 7712b3c..0000000
--- a/gfsm/gfsm/src/programs/gfsmcomplement.gog
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmcomplement"
-#program_version "0.01"
-
-purpose "Compute complement of finite state acceptors"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "ilabels" i "Specify input (lower) labels file for alphabet." \
- arg="LABELS"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-Epsilon arcs are not handled correctly.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.c b/gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.c
deleted file mode 100644
index d697579..0000000
--- a/gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcomplement_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmcomplement_cmdparser gfsmcomplement.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmcomplement"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmcomplement_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmcomplement (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute complement of finite state acceptors\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmcomplement");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -iLABELS --ilabels=LABELS Specify input (lower) labels file for alphabet.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->ilabels_arg = NULL;
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->ilabels_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "ilabels", 1, NULL, 'i' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'i', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'i': /* Specify input (lower) labels file for alphabet. */
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify input (lower) labels file for alphabet. */
- else if (strcmp(olong, "ilabels") == 0) {
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.h b/gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.h
deleted file mode 100644
index 4b3d57d..0000000
--- a/gfsm/gfsm/src/programs/gfsmcomplement_cmdparser.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcomplement_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmcomplement_cmdparser_h
-#define gfsmcomplement_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * ilabels_arg; /* Specify input (lower) labels file for alphabet. (default=NULL). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int ilabels_given; /* Whether ilabels was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmcomplement_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmcomplement_main.c b/gfsm/gfsm/src/programs/gfsmcomplement_main.c
deleted file mode 100644
index 227b963..0000000
--- a/gfsm/gfsm/src/programs/gfsmcomplement_main.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmcomplement_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmcomplement";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmAlphabet *ilabels=NULL;
-gfsmError *err=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- labels: input
- if (args.ilabels_given) {
- ilabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(ilabels,args.ilabels_arg,&err)) {
- g_printerr("%s: load failed for input-labels file '%s': %s\n",
- progname, args.ilabels_arg, err->message);
- exit(2);
- }
- }
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- complement
- if (ilabels) gfsm_automaton_complement_full(fsm,ilabels);
- else gfsm_automaton_complement(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (ilabels) gfsm_alphabet_free(ilabels);
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcompose.gog b/gfsm/gfsm/src/programs/gfsmcompose.gog
deleted file mode 100644
index c4e34f3..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompose.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmcompose"
-#program_version "0.01"
-
-purpose "Compute composition of finite-state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE(s)" "Stored binary gfsm file(s)" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-Probably many.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmcompose_cmdparser.c b/gfsm/gfsm/src/programs/gfsmcompose_cmdparser.c
deleted file mode 100644
index 5a82199..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompose_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcompose_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmcompose_cmdparser gfsmcompose.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmcompose"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmcompose_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmcompose (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute composition of finite-state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE(s)\n", "gfsmcompose");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE(s) Stored binary gfsm file(s)\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcompose_cmdparser.h b/gfsm/gfsm/src/programs/gfsmcompose_cmdparser.h
deleted file mode 100644
index a99342e..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompose_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcompose_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmcompose_cmdparser_h
-#define gfsmcompose_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmcompose_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmcompose_main.c b/gfsm/gfsm/src/programs/gfsmcompose_main.c
deleted file mode 100644
index 232c5e6..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompose_main.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005-2007 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmcompose_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmcompose";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename;
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmOut=NULL, *fsmIn=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- require at least one file argument
- if (args.inputs_num < 1) {
- cmdline_parser_print_help();
- exit(2);
- }
-
- //-- output
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsmIn = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * compute_operation()
- * + utility routine
- */
-void compute_operation(const char *infilename)
-{
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsmIn,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute underlying FSM operation
- if (fsmOut == NULL) {
- fsmOut = fsmIn;
- fsmIn = gfsm_automaton_new();
- } else {
- gfsm_automaton_compose(fsmOut,fsmIn);
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- for (i = 0; i < args.inputs_num; i++) {
- compute_operation(args.inputs[i]);
- }
- if (args.inputs_num == 1) compute_operation("-");
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmOut,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsmIn) gfsm_automaton_free(fsmIn);
- if (fsmOut) gfsm_automaton_free(fsmOut);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcompre.gog b/gfsm/gfsm/src/programs/gfsmcompre.gog
deleted file mode 100644
index 7e4058f..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompre.gog
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmcompre"
-#program_version "0.01"
-
-purpose "Compile an automaton from a regular expression"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-#argument "LABELID..." "Input label IDs" \
-# details="
-#In ASCII decimal notation.
-#"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "labels" l "Basic label alphabet" \
- arg="LABFILE"
-
-string "regex" s "Regular expression to compile" \
- arg="REGEX"
-
-flag "string" x "Compile as string, not regex" \
- default=0
-
-string "semiring" r "Specify semiring type" \
- arg="SRTYPE" \
- default="tropical" \
- details="
-Specify one of the following:
-
- boolean
- log
- plog
- real
- trivial
- tropical
-
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmcompre_cmdparser.c b/gfsm/gfsm/src/programs/gfsmcompre_cmdparser.c
deleted file mode 100644
index 75f5810..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompre_cmdparser.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcompre_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmcompre_cmdparser gfsmcompre.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmcompre"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmcompre_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmcompre (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compile an automaton from a regular expression\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... [FILES]...\n", "gfsmcompre");
-
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -lLABFILE --labels=LABFILE Basic label alphabet\n");
- printf(" -sREGEX --regex=REGEX Regular expression to compile\n");
- printf(" -x --string Compile as string, not regex\n");
- printf(" -rSRTYPE --semiring=SRTYPE Specify semiring type\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->labels_arg = NULL;
- args_info->regex_arg = NULL;
- args_info->string_flag = 0;
- args_info->semiring_arg = strdup("tropical");
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->labels_given = 0;
- args_info->regex_given = 0;
- args_info->string_given = 0;
- args_info->semiring_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "labels", 1, NULL, 'l' },
- { "regex", 1, NULL, 's' },
- { "string", 0, NULL, 'x' },
- { "semiring", 1, NULL, 'r' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'l', ':',
- 's', ':',
- 'x',
- 'r', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'l': /* Basic label alphabet */
- if (args_info->labels_given) {
- fprintf(stderr, "%s: `--labels' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->labels_given++;
- if (args_info->labels_arg) free(args_info->labels_arg);
- args_info->labels_arg = strdup(val);
- break;
-
- case 's': /* Regular expression to compile */
- if (args_info->regex_given) {
- fprintf(stderr, "%s: `--regex' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->regex_given++;
- if (args_info->regex_arg) free(args_info->regex_arg);
- args_info->regex_arg = strdup(val);
- break;
-
- case 'x': /* Compile as string, not regex */
- if (args_info->string_given) {
- fprintf(stderr, "%s: `--string' (`-x') option given more than once\n", PROGRAM);
- }
- args_info->string_given++;
- if (args_info->string_given <= 1)
- args_info->string_flag = !(args_info->string_flag);
- break;
-
- case 'r': /* Specify semiring type */
- if (args_info->semiring_given) {
- fprintf(stderr, "%s: `--semiring' (`-r') option given more than once\n", PROGRAM);
- }
- args_info->semiring_given++;
- if (args_info->semiring_arg) free(args_info->semiring_arg);
- args_info->semiring_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Basic label alphabet */
- else if (strcmp(olong, "labels") == 0) {
- if (args_info->labels_given) {
- fprintf(stderr, "%s: `--labels' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->labels_given++;
- if (args_info->labels_arg) free(args_info->labels_arg);
- args_info->labels_arg = strdup(val);
- }
-
- /* Regular expression to compile */
- else if (strcmp(olong, "regex") == 0) {
- if (args_info->regex_given) {
- fprintf(stderr, "%s: `--regex' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->regex_given++;
- if (args_info->regex_arg) free(args_info->regex_arg);
- args_info->regex_arg = strdup(val);
- }
-
- /* Compile as string, not regex */
- else if (strcmp(olong, "string") == 0) {
- if (args_info->string_given) {
- fprintf(stderr, "%s: `--string' (`-x') option given more than once\n", PROGRAM);
- }
- args_info->string_given++;
- if (args_info->string_given <= 1)
- args_info->string_flag = !(args_info->string_flag);
- }
-
- /* Specify semiring type */
- else if (strcmp(olong, "semiring") == 0) {
- if (args_info->semiring_given) {
- fprintf(stderr, "%s: `--semiring' (`-r') option given more than once\n", PROGRAM);
- }
- args_info->semiring_given++;
- if (args_info->semiring_arg) free(args_info->semiring_arg);
- args_info->semiring_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmcompre_cmdparser.h b/gfsm/gfsm/src/programs/gfsmcompre_cmdparser.h
deleted file mode 100644
index 32361ea..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompre_cmdparser.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmcompre_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmcompre_cmdparser_h
-#define gfsmcompre_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * labels_arg; /* Basic label alphabet (default=NULL). */
- char * regex_arg; /* Regular expression to compile (default=NULL). */
- int string_flag; /* Compile as string, not regex (default=0). */
- char * semiring_arg; /* Specify semiring type (default=tropical). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int labels_given; /* Whether labels was given */
- int regex_given; /* Whether regex was given */
- int string_given; /* Whether string was given */
- int semiring_given; /* Whether semiring was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmcompre_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmcompre_main.c b/gfsm/gfsm/src/programs/gfsmcompre_main.c
deleted file mode 100644
index 78e7721..0000000
--- a/gfsm/gfsm/src/programs/gfsmcompre_main.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <gfsm.h>
-
-#include "gfsmcompre_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmcompre";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *fstfilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmRegexCompiler *rec = NULL;
-gfsmAlphabet *abet = NULL;
-gfsmError *err = NULL;
-gboolean emit_warnings = TRUE;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- sanity checks
- if (!args.regex_given) {
- g_printerr("%s: no regex specified!\n", progname);
- cmdline_parser_print_help();
- exit(-1);
- }
-
- //-- filenames
- outfilename = args.output_arg;
-
- //-- alphabet: basic labels
- abet = gfsm_string_alphabet_new();
- if (args.labels_given) {
- if (!gfsm_alphabet_load_filename(abet, args.labels_arg, &err)) {
- g_printerr("%s: load failed for labels file '%s': %s\n",
- progname, args.labels_arg, err->message);
- exit(2);
- }
- }
-
- //-- options for regex compiler
- rec = gfsm_regex_compiler_new_full("gfsmRegexCompiler",
- abet,
- gfsm_sr_name_to_type(args.semiring_arg),
- emit_warnings);
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmAutomaton *fsm;
- char *regex=NULL;
-
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- string-compile hack: escape everything
- if (args.string_flag) {
- GString *tmp = g_string_new("");
- int i;
- for (i=0; i < strlen(args.regex_arg); i++) {
- g_string_append_c(tmp,'\\');
- g_string_append_c(tmp,args.regex_arg[i]);
- }
- regex = tmp->str;
- g_string_free(tmp,FALSE);
- } else {
- regex = args.regex_arg;
- }
-
- //-- parse regex string
- gfsm_scanner_scan_string(&(rec->scanner), regex);
- fsm = gfsm_regex_compiler_parse(rec);
-
- //-- check for errors
- if (rec->scanner.err) {
- g_printerr("%s: %s\n", progname, err->message);
- exit(3);
- }
- if (!fsm) {
- g_printerr("%s: no automaton!\n", progname);
- exit(4);
- }
-
-
- //-- save output fsm
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(5);
- }
-
- //-- cleanup
- gfsm_regex_compiler_free(rec,TRUE,TRUE);
-
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmconcat.gog b/gfsm/gfsm/src/programs/gfsmconcat.gog
deleted file mode 100644
index f9b1e47..0000000
--- a/gfsm/gfsm/src/programs/gfsmconcat.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmconcat"
-#program_version "0.01"
-
-purpose "Concatenate finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE(s)" "Stored binary gfsm file(s)" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmconcat_cmdparser.c b/gfsm/gfsm/src/programs/gfsmconcat_cmdparser.c
deleted file mode 100644
index 617a630..0000000
--- a/gfsm/gfsm/src/programs/gfsmconcat_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmconcat_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmconcat_cmdparser gfsmconcat.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmconcat"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmconcat_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmconcat (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Concatenate finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE(s)\n", "gfsmconcat");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE(s) Stored binary gfsm file(s)\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmconcat_cmdparser.h b/gfsm/gfsm/src/programs/gfsmconcat_cmdparser.h
deleted file mode 100644
index 43125dd..0000000
--- a/gfsm/gfsm/src/programs/gfsmconcat_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmconcat_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmconcat_cmdparser_h
-#define gfsmconcat_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmconcat_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmconcat_main.c b/gfsm/gfsm/src/programs/gfsmconcat_main.c
deleted file mode 100644
index 9d63792..0000000
--- a/gfsm/gfsm/src/programs/gfsmconcat_main.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmconcat_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmconcat";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename;
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmOut=NULL, *fsmIn=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- require at least one file argument
- if (args.inputs_num < 1) {
- cmdline_parser_print_help();
- exit(2);
- }
-
- //-- output
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsmIn = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * compute_operation()
- * + utility routine
- */
-void compute_operation(const char *infilename)
-{
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsmIn,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute concat
- if (fsmOut == NULL) {
- fsmOut = fsmIn;
- fsmIn = gfsm_automaton_new();
- } else {
- gfsm_automaton_concat(fsmOut,fsmIn);
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
- get_my_options(argc,argv);
-
- for (i = 0; i < args.inputs_num; i++) {
- compute_operation(args.inputs[i]);
- }
- if (args.inputs_num == 1) compute_operation("-");
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmOut,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsmIn) gfsm_automaton_free(fsmIn);
- if (fsmOut) gfsm_automaton_free(fsmOut);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmconnect.gog b/gfsm/gfsm/src/programs/gfsmconnect.gog
deleted file mode 100644
index 2de8230..0000000
--- a/gfsm/gfsm/src/programs/gfsmconnect.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmconnect"
-#program_version "0.01"
-
-purpose "Remove non-coaccessible states from finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmconnect_cmdparser.c b/gfsm/gfsm/src/programs/gfsmconnect_cmdparser.c
deleted file mode 100644
index a3f30cb..0000000
--- a/gfsm/gfsm/src/programs/gfsmconnect_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmconnect_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmconnect_cmdparser gfsmconnect.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmconnect"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmconnect_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmconnect (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Remove non-coaccessible states from finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmconnect");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmconnect_cmdparser.h b/gfsm/gfsm/src/programs/gfsmconnect_cmdparser.h
deleted file mode 100644
index 08f42e0..0000000
--- a/gfsm/gfsm/src/programs/gfsmconnect_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmconnect_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmconnect_cmdparser_h
-#define gfsmconnect_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmconnect_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmconnect_main.c b/gfsm/gfsm/src/programs/gfsmconnect_main.c
deleted file mode 100644
index 82c9c22..0000000
--- a/gfsm/gfsm/src/programs/gfsmconnect_main.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmconnect_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmconnect";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- int rc = 0;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- connect
- gfsm_automaton_connect(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- get exit status: 255 if no root state
- if (fsm->root_id == gfsmNoState) rc=255;
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return rc;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmconvert.gog b/gfsm/gfsm/src/programs/gfsmconvert.gog
deleted file mode 100644
index 4bb24af..0000000
--- a/gfsm/gfsm/src/programs/gfsmconvert.gog
+++ /dev/null
@@ -1,89 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmconvert"
-#program_version "0.01"
-
-purpose "Convert binary format gfsm files"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "FSMFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "transducer" t "Specify whether automaton is a transducer" \
- arg="BOOL"
-
-int "weighted" w "Specify whether automaton is weighted" \
- arg="BOOL"
-
-string "semiring" s "Specify semiring type." \
- arg="SRTYPE" \
- details="
-Specify one of the following:
-
- boolean
- log
- real
- trivial
- tropical
-
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmconvert_cmdparser.c b/gfsm/gfsm/src/programs/gfsmconvert_cmdparser.c
deleted file mode 100644
index 3e77ce5..0000000
--- a/gfsm/gfsm/src/programs/gfsmconvert_cmdparser.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmconvert_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmconvert_cmdparser gfsmconvert.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmconvert"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmconvert_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmconvert (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Convert binary format gfsm files\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... FSMFILE\n", "gfsmconvert");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" FSMFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -tBOOL --transducer=BOOL Specify whether automaton is a transducer\n");
- printf(" -wBOOL --weighted=BOOL Specify whether automaton is weighted\n");
- printf(" -sSRTYPE --semiring=SRTYPE Specify semiring type.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->transducer_arg = 0;
- args_info->weighted_arg = 0;
- args_info->semiring_arg = NULL;
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->transducer_given = 0;
- args_info->weighted_given = 0;
- args_info->semiring_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "transducer", 1, NULL, 't' },
- { "weighted", 1, NULL, 'w' },
- { "semiring", 1, NULL, 's' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 't', ':',
- 'w', ':',
- 's', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 't': /* Specify whether automaton is a transducer */
- if (args_info->transducer_given) {
- fprintf(stderr, "%s: `--transducer' (`-t') option given more than once\n", PROGRAM);
- }
- args_info->transducer_given++;
- args_info->transducer_arg = (int)atoi(val);
- break;
-
- case 'w': /* Specify whether automaton is weighted */
- if (args_info->weighted_given) {
- fprintf(stderr, "%s: `--weighted' (`-w') option given more than once\n", PROGRAM);
- }
- args_info->weighted_given++;
- args_info->weighted_arg = (int)atoi(val);
- break;
-
- case 's': /* Specify semiring type. */
- if (args_info->semiring_given) {
- fprintf(stderr, "%s: `--semiring' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->semiring_given++;
- if (args_info->semiring_arg) free(args_info->semiring_arg);
- args_info->semiring_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify whether automaton is a transducer */
- else if (strcmp(olong, "transducer") == 0) {
- if (args_info->transducer_given) {
- fprintf(stderr, "%s: `--transducer' (`-t') option given more than once\n", PROGRAM);
- }
- args_info->transducer_given++;
- args_info->transducer_arg = (int)atoi(val);
- }
-
- /* Specify whether automaton is weighted */
- else if (strcmp(olong, "weighted") == 0) {
- if (args_info->weighted_given) {
- fprintf(stderr, "%s: `--weighted' (`-w') option given more than once\n", PROGRAM);
- }
- args_info->weighted_given++;
- args_info->weighted_arg = (int)atoi(val);
- }
-
- /* Specify semiring type. */
- else if (strcmp(olong, "semiring") == 0) {
- if (args_info->semiring_given) {
- fprintf(stderr, "%s: `--semiring' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->semiring_given++;
- if (args_info->semiring_arg) free(args_info->semiring_arg);
- args_info->semiring_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmconvert_cmdparser.h b/gfsm/gfsm/src/programs/gfsmconvert_cmdparser.h
deleted file mode 100644
index 93a2291..0000000
--- a/gfsm/gfsm/src/programs/gfsmconvert_cmdparser.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmconvert_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmconvert_cmdparser_h
-#define gfsmconvert_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int transducer_arg; /* Specify whether automaton is a transducer (default=0). */
- int weighted_arg; /* Specify whether automaton is weighted (default=0). */
- char * semiring_arg; /* Specify semiring type. (default=NULL). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int transducer_given; /* Whether transducer was given */
- int weighted_given; /* Whether weighted was given */
- int semiring_given; /* Whether semiring was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmconvert_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmconvert_main.c b/gfsm/gfsm/src/programs/gfsmconvert_main.c
deleted file mode 100644
index 7c09f08..0000000
--- a/gfsm/gfsm/src/programs/gfsmconvert_main.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gfsm.h>
-
-#include "gfsmconvert_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmconvert";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmError *err = NULL;
-gfsmSRType srtype = gfsmSRTUnknown;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- outfilename = args.output_arg;
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(3);
- }
-
- //-- set flags
- if (args.transducer_given) fsm->flags.is_transducer = args.transducer_arg;
- if (args.weighted_given) fsm->flags.is_weighted = args.weighted_arg;
-
- //-- set semiring
- if (args.semiring_given) {
- srtype = gfsm_sr_name_to_type(args.semiring_arg);
- if (srtype == gfsmSRTUnknown) {
- g_printerr("%s: Warning: unknown semiring name '%s' defaults to type 'tropical'.\n",
- progname, args.semiring_arg);
- srtype = gfsmSRTTropical;
- }
- if (srtype != fsm->sr->type) {
- gfsm_automaton_set_semiring(fsm, gfsm_semiring_new(srtype));
- }
- }
-
- //-- store automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- gfsm_automaton_free(fsm);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmdeterminize.gog b/gfsm/gfsm/src/programs/gfsmdeterminize.gog
deleted file mode 100644
index 1fed7e8..0000000
--- a/gfsm/gfsm/src/programs/gfsmdeterminize.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmdeterminize"
-#program_version "0.01"
-
-purpose "Determinize a finite state machine"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.c b/gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.c
deleted file mode 100644
index 0ce40e9..0000000
--- a/gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmdeterminize_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmdeterminize_cmdparser gfsmdeterminize.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmdeterminize"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmdeterminize_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmdeterminize (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Determinize a finite state machine\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmdeterminize");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.h b/gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.h
deleted file mode 100644
index a0324f4..0000000
--- a/gfsm/gfsm/src/programs/gfsmdeterminize_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmdeterminize_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmdeterminize_cmdparser_h
-#define gfsmdeterminize_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmdeterminize_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmdeterminize_main.c b/gfsm/gfsm/src/programs/gfsmdeterminize_main.c
deleted file mode 100644
index 66ba402..0000000
--- a/gfsm/gfsm/src/programs/gfsmdeterminize_main.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmdeterminize_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmdeterminize";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- determinize
- gfsm_automaton_determinize(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm, outfilename, args.compress_arg, &err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmdifference.gog b/gfsm/gfsm/src/programs/gfsmdifference.gog
deleted file mode 100644
index 9bdb612..0000000
--- a/gfsm/gfsm/src/programs/gfsmdifference.gog
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmdifference"
-#program_version "0.01"
-
-purpose "Compute difference of epsilon-free finite state acceptors"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE(s)" "Stored binary gfsm file(s)" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-Epsilon arcs are not handled correctly.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmdifference_cmdparser.c b/gfsm/gfsm/src/programs/gfsmdifference_cmdparser.c
deleted file mode 100644
index 80c51f7..0000000
--- a/gfsm/gfsm/src/programs/gfsmdifference_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmdifference_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmdifference_cmdparser gfsmdifference.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmdifference"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmdifference_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmdifference (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute difference of epsilon-free finite state acceptors\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE(s)\n", "gfsmdifference");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE(s) Stored binary gfsm file(s)\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmdifference_cmdparser.h b/gfsm/gfsm/src/programs/gfsmdifference_cmdparser.h
deleted file mode 100644
index b61aa90..0000000
--- a/gfsm/gfsm/src/programs/gfsmdifference_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmdifference_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmdifference_cmdparser_h
-#define gfsmdifference_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmdifference_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmdifference_main.c b/gfsm/gfsm/src/programs/gfsmdifference_main.c
deleted file mode 100644
index 19aaedf..0000000
--- a/gfsm/gfsm/src/programs/gfsmdifference_main.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmdifference_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmdifference";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename;
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmOut=NULL, *fsmIn=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- require at least one file argument
- if (args.inputs_num < 1) {
- cmdline_parser_print_help();
- exit(2);
- }
-
- //-- output
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsmIn = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * compute_operation()
- * + utility routine
- */
-void compute_operation(const char *infilename)
-{
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsmIn,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute difference
- if (fsmOut == NULL) {
- fsmOut = fsmIn;
- fsmIn = gfsm_automaton_new();
- } else {
- gfsm_automaton_difference(fsmOut,fsmIn);
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- for (i = 0; i < args.inputs_num; i++) {
- compute_operation(args.inputs[i]);
- }
- if (args.inputs_num == 1) compute_operation("-");
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmOut,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsmIn) gfsm_automaton_free(fsmIn);
- if (fsmOut) gfsm_automaton_free(fsmOut);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmdraw.gog b/gfsm/gfsm/src/programs/gfsmdraw.gog
deleted file mode 100644
index 63fbb4f..0000000
--- a/gfsm/gfsm/src/programs/gfsmdraw.gog
+++ /dev/null
@@ -1,138 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmdraw"
-#program_version "0.01"
-
-purpose "Generate graph specifications from binary gfsm files"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details "
-gfsmdraw reads a binary GFSM file file and produces a graph specification
-in either dot(1) or vcg(1) format.
-"
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Common Options
-#-----------------------------------------------------------------------------
-group "Common Options"
-
-string "ilabels" i "Specify input (lower) labels file." \
- arg="LABELS"
-
-string "olabels" o "Specify output (upper) labels file." \
- arg="LABELS"
-
-string "slabels" s "Specify state labels file." \
- arg="LABELS"
-
-string "title" t "Specify output title." \
- arg="TITLE" \
- details="Default is input filename."
-
-flag "vertical" v "Draw vertically." \
- details="Default mode is top-to-bottom"
-
-string "output" F "Output graph specification." \
- arg="DOTFILE" \
- details="
-Default behavior is to write to stdout.
-"
-
-#-----------------------------------------------------------------------------
-# dot Options
-#-----------------------------------------------------------------------------
-group "dot Options"
-
-flag "dot" d "Request dot output (default)"
-
-float "width" W "Specify output width (default=bbox)." \
- arg="WIDTH" \
- default="8.5"
-float "height" H "Specify output height (default=bbox)." \
- arg="HEIGHT" \
- default="11"
-
-int "fontsize" f "Set output font size." \
- arg="POINTS" \
- default="14"
-string "font" - "Set output font name." \
- arg="FONT"
-
-float "nodesep" n "Set min node separation." \
- default="0.25"
-float "ranksep" r "Set min rank separation." \
- default="0.40"
-
-flag "portrait" p "Generate in portrait mode." \
- details="Default mode is landscape."
-
-#-----------------------------------------------------------------------------
-# VCG Options
-#-----------------------------------------------------------------------------
-group "VCG Options"
-
-flag "vcg" g "Request VCG output."
-
-int "xspace" x "Set xspace graph parameter." \
- default="40"
-int "yspace" y "Set yspace graph parameter." \
- default="20"
-
-string "state-shape" - "Set shape for state nodes." \
- arg="SHAPE" \
- default="box"
-
-string "state-color" - "Set default state color." \
- arg="COLOR" \
- default="white"
-
-string "final-color" - "Set color for final states." \
- arg="COLOR" \
- default="lightgrey"
-
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>,
-dot(1),
-vcg(1),
-xvcg(1)
-"
diff --git a/gfsm/gfsm/src/programs/gfsmdraw_cmdparser.c b/gfsm/gfsm/src/programs/gfsmdraw_cmdparser.c
deleted file mode 100644
index 40b52e6..0000000
--- a/gfsm/gfsm/src/programs/gfsmdraw_cmdparser.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmdraw_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmdraw_cmdparser gfsmdraw.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmdraw"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmdraw_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmdraw (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Generate graph specifications from binary gfsm files\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmdraw");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf("\n");
- printf(" Common Options:\n");
- printf(" -iLABELS --ilabels=LABELS Specify input (lower) labels file.\n");
- printf(" -oLABELS --olabels=LABELS Specify output (upper) labels file.\n");
- printf(" -sLABELS --slabels=LABELS Specify state labels file.\n");
- printf(" -tTITLE --title=TITLE Specify output title.\n");
- printf(" -v --vertical Draw vertically.\n");
- printf(" -FDOTFILE --output=DOTFILE Output graph specification.\n");
- printf("\n");
- printf(" dot Options:\n");
- printf(" -d --dot Request dot output (default)\n");
- printf(" -WFLOAT --width=FLOAT Specify output width (default=bbox).\n");
- printf(" -HFLOAT --height=FLOAT Specify output height (default=bbox).\n");
- printf(" -fPOINTS --fontsize=POINTS Set output font size.\n");
- printf(" --font=FONT Set output font name.\n");
- printf(" -nFLOAT --nodesep=FLOAT Set min node separation.\n");
- printf(" -rFLOAT --ranksep=FLOAT Set min rank separation.\n");
- printf(" -p --portrait Generate in portrait mode.\n");
- printf("\n");
- printf(" VCG Options:\n");
- printf(" -g --vcg Request VCG output.\n");
- printf(" -xINT --xspace=INT Set xspace graph parameter.\n");
- printf(" -yINT --yspace=INT Set yspace graph parameter.\n");
- printf(" --state-shape=SHAPE Set shape for state nodes.\n");
- printf(" --state-color=COLOR Set default state color.\n");
- printf(" --final-color=COLOR Set color for final states.\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->ilabels_arg = NULL;
- args_info->olabels_arg = NULL;
- args_info->slabels_arg = NULL;
- args_info->title_arg = NULL;
- args_info->vertical_flag = 0;
- args_info->output_arg = NULL;
- args_info->dot_flag = 0;
- args_info->width_arg = 8.5;
- args_info->height_arg = 11;
- args_info->fontsize_arg = 14;
- args_info->font_arg = NULL;
- args_info->nodesep_arg = 0.25;
- args_info->ranksep_arg = 0.40;
- args_info->portrait_flag = 0;
- args_info->vcg_flag = 0;
- args_info->xspace_arg = 40;
- args_info->yspace_arg = 20;
- args_info->state_shape_arg = strdup("box");
- args_info->state_color_arg = strdup("white");
- args_info->final_color_arg = strdup("lightgrey");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->ilabels_given = 0;
- args_info->olabels_given = 0;
- args_info->slabels_given = 0;
- args_info->title_given = 0;
- args_info->vertical_given = 0;
- args_info->output_given = 0;
- args_info->dot_given = 0;
- args_info->width_given = 0;
- args_info->height_given = 0;
- args_info->fontsize_given = 0;
- args_info->font_given = 0;
- args_info->nodesep_given = 0;
- args_info->ranksep_given = 0;
- args_info->portrait_given = 0;
- args_info->vcg_given = 0;
- args_info->xspace_given = 0;
- args_info->yspace_given = 0;
- args_info->state_shape_given = 0;
- args_info->state_color_given = 0;
- args_info->final_color_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "ilabels", 1, NULL, 'i' },
- { "olabels", 1, NULL, 'o' },
- { "slabels", 1, NULL, 's' },
- { "title", 1, NULL, 't' },
- { "vertical", 0, NULL, 'v' },
- { "output", 1, NULL, 'F' },
- { "dot", 0, NULL, 'd' },
- { "width", 1, NULL, 'W' },
- { "height", 1, NULL, 'H' },
- { "fontsize", 1, NULL, 'f' },
- { "font", 1, NULL, 0 },
- { "nodesep", 1, NULL, 'n' },
- { "ranksep", 1, NULL, 'r' },
- { "portrait", 0, NULL, 'p' },
- { "vcg", 0, NULL, 'g' },
- { "xspace", 1, NULL, 'x' },
- { "yspace", 1, NULL, 'y' },
- { "state-shape", 1, NULL, 0 },
- { "state-color", 1, NULL, 0 },
- { "final-color", 1, NULL, 0 },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'i', ':',
- 'o', ':',
- 's', ':',
- 't', ':',
- 'v',
- 'F', ':',
- 'd',
- 'W', ':',
- 'H', ':',
- 'f', ':',
- 'n', ':',
- 'r', ':',
- 'p',
- 'g',
- 'x', ':',
- 'y', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'i': /* Specify input (lower) labels file. */
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- break;
-
- case 'o': /* Specify output (upper) labels file. */
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- break;
-
- case 's': /* Specify state labels file. */
- if (args_info->slabels_given) {
- fprintf(stderr, "%s: `--slabels' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->slabels_given++;
- if (args_info->slabels_arg) free(args_info->slabels_arg);
- args_info->slabels_arg = strdup(val);
- break;
-
- case 't': /* Specify output title. */
- if (args_info->title_given) {
- fprintf(stderr, "%s: `--title' (`-t') option given more than once\n", PROGRAM);
- }
- args_info->title_given++;
- if (args_info->title_arg) free(args_info->title_arg);
- args_info->title_arg = strdup(val);
- break;
-
- case 'v': /* Draw vertically. */
- if (args_info->vertical_given) {
- fprintf(stderr, "%s: `--vertical' (`-v') option given more than once\n", PROGRAM);
- }
- args_info->vertical_given++;
- if (args_info->vertical_given <= 1)
- args_info->vertical_flag = !(args_info->vertical_flag);
- break;
-
- case 'F': /* Output graph specification. */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 'd': /* Request dot output (default) */
- if (args_info->dot_given) {
- fprintf(stderr, "%s: `--dot' (`-d') option given more than once\n", PROGRAM);
- }
- args_info->dot_given++;
- if (args_info->dot_given <= 1)
- args_info->dot_flag = !(args_info->dot_flag);
- break;
-
- case 'W': /* Specify output width (default=bbox). */
- if (args_info->width_given) {
- fprintf(stderr, "%s: `--width' (`-W') option given more than once\n", PROGRAM);
- }
- args_info->width_given++;
- args_info->width_arg = (float)strtod(val, NULL);
- break;
-
- case 'H': /* Specify output height (default=bbox). */
- if (args_info->height_given) {
- fprintf(stderr, "%s: `--height' (`-H') option given more than once\n", PROGRAM);
- }
- args_info->height_given++;
- args_info->height_arg = (float)strtod(val, NULL);
- break;
-
- case 'f': /* Set output font size. */
- if (args_info->fontsize_given) {
- fprintf(stderr, "%s: `--fontsize' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->fontsize_given++;
- args_info->fontsize_arg = (int)atoi(val);
- break;
-
- case 'n': /* Set min node separation. */
- if (args_info->nodesep_given) {
- fprintf(stderr, "%s: `--nodesep' (`-n') option given more than once\n", PROGRAM);
- }
- args_info->nodesep_given++;
- args_info->nodesep_arg = (float)strtod(val, NULL);
- break;
-
- case 'r': /* Set min rank separation. */
- if (args_info->ranksep_given) {
- fprintf(stderr, "%s: `--ranksep' (`-r') option given more than once\n", PROGRAM);
- }
- args_info->ranksep_given++;
- args_info->ranksep_arg = (float)strtod(val, NULL);
- break;
-
- case 'p': /* Generate in portrait mode. */
- if (args_info->portrait_given) {
- fprintf(stderr, "%s: `--portrait' (`-p') option given more than once\n", PROGRAM);
- }
- args_info->portrait_given++;
- if (args_info->portrait_given <= 1)
- args_info->portrait_flag = !(args_info->portrait_flag);
- break;
-
- case 'g': /* Request VCG output. */
- if (args_info->vcg_given) {
- fprintf(stderr, "%s: `--vcg' (`-g') option given more than once\n", PROGRAM);
- }
- args_info->vcg_given++;
- if (args_info->vcg_given <= 1)
- args_info->vcg_flag = !(args_info->vcg_flag);
- break;
-
- case 'x': /* Set xspace graph parameter. */
- if (args_info->xspace_given) {
- fprintf(stderr, "%s: `--xspace' (`-x') option given more than once\n", PROGRAM);
- }
- args_info->xspace_given++;
- args_info->xspace_arg = (int)atoi(val);
- break;
-
- case 'y': /* Set yspace graph parameter. */
- if (args_info->yspace_given) {
- fprintf(stderr, "%s: `--yspace' (`-y') option given more than once\n", PROGRAM);
- }
- args_info->yspace_given++;
- args_info->yspace_arg = (int)atoi(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify input (lower) labels file. */
- else if (strcmp(olong, "ilabels") == 0) {
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- }
-
- /* Specify output (upper) labels file. */
- else if (strcmp(olong, "olabels") == 0) {
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- }
-
- /* Specify state labels file. */
- else if (strcmp(olong, "slabels") == 0) {
- if (args_info->slabels_given) {
- fprintf(stderr, "%s: `--slabels' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->slabels_given++;
- if (args_info->slabels_arg) free(args_info->slabels_arg);
- args_info->slabels_arg = strdup(val);
- }
-
- /* Specify output title. */
- else if (strcmp(olong, "title") == 0) {
- if (args_info->title_given) {
- fprintf(stderr, "%s: `--title' (`-t') option given more than once\n", PROGRAM);
- }
- args_info->title_given++;
- if (args_info->title_arg) free(args_info->title_arg);
- args_info->title_arg = strdup(val);
- }
-
- /* Draw vertically. */
- else if (strcmp(olong, "vertical") == 0) {
- if (args_info->vertical_given) {
- fprintf(stderr, "%s: `--vertical' (`-v') option given more than once\n", PROGRAM);
- }
- args_info->vertical_given++;
- if (args_info->vertical_given <= 1)
- args_info->vertical_flag = !(args_info->vertical_flag);
- }
-
- /* Output graph specification. */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- /* Request dot output (default) */
- else if (strcmp(olong, "dot") == 0) {
- if (args_info->dot_given) {
- fprintf(stderr, "%s: `--dot' (`-d') option given more than once\n", PROGRAM);
- }
- args_info->dot_given++;
- if (args_info->dot_given <= 1)
- args_info->dot_flag = !(args_info->dot_flag);
- }
-
- /* Specify output width (default=bbox). */
- else if (strcmp(olong, "width") == 0) {
- if (args_info->width_given) {
- fprintf(stderr, "%s: `--width' (`-W') option given more than once\n", PROGRAM);
- }
- args_info->width_given++;
- args_info->width_arg = (float)strtod(val, NULL);
- }
-
- /* Specify output height (default=bbox). */
- else if (strcmp(olong, "height") == 0) {
- if (args_info->height_given) {
- fprintf(stderr, "%s: `--height' (`-H') option given more than once\n", PROGRAM);
- }
- args_info->height_given++;
- args_info->height_arg = (float)strtod(val, NULL);
- }
-
- /* Set output font size. */
- else if (strcmp(olong, "fontsize") == 0) {
- if (args_info->fontsize_given) {
- fprintf(stderr, "%s: `--fontsize' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->fontsize_given++;
- args_info->fontsize_arg = (int)atoi(val);
- }
-
- /* Set output font name. */
- else if (strcmp(olong, "font") == 0) {
- if (args_info->font_given) {
- fprintf(stderr, "%s: `--font' option given more than once\n", PROGRAM);
- }
- args_info->font_given++;
- if (args_info->font_arg) free(args_info->font_arg);
- args_info->font_arg = strdup(val);
- }
-
- /* Set min node separation. */
- else if (strcmp(olong, "nodesep") == 0) {
- if (args_info->nodesep_given) {
- fprintf(stderr, "%s: `--nodesep' (`-n') option given more than once\n", PROGRAM);
- }
- args_info->nodesep_given++;
- args_info->nodesep_arg = (float)strtod(val, NULL);
- }
-
- /* Set min rank separation. */
- else if (strcmp(olong, "ranksep") == 0) {
- if (args_info->ranksep_given) {
- fprintf(stderr, "%s: `--ranksep' (`-r') option given more than once\n", PROGRAM);
- }
- args_info->ranksep_given++;
- args_info->ranksep_arg = (float)strtod(val, NULL);
- }
-
- /* Generate in portrait mode. */
- else if (strcmp(olong, "portrait") == 0) {
- if (args_info->portrait_given) {
- fprintf(stderr, "%s: `--portrait' (`-p') option given more than once\n", PROGRAM);
- }
- args_info->portrait_given++;
- if (args_info->portrait_given <= 1)
- args_info->portrait_flag = !(args_info->portrait_flag);
- }
-
- /* Request VCG output. */
- else if (strcmp(olong, "vcg") == 0) {
- if (args_info->vcg_given) {
- fprintf(stderr, "%s: `--vcg' (`-g') option given more than once\n", PROGRAM);
- }
- args_info->vcg_given++;
- if (args_info->vcg_given <= 1)
- args_info->vcg_flag = !(args_info->vcg_flag);
- }
-
- /* Set xspace graph parameter. */
- else if (strcmp(olong, "xspace") == 0) {
- if (args_info->xspace_given) {
- fprintf(stderr, "%s: `--xspace' (`-x') option given more than once\n", PROGRAM);
- }
- args_info->xspace_given++;
- args_info->xspace_arg = (int)atoi(val);
- }
-
- /* Set yspace graph parameter. */
- else if (strcmp(olong, "yspace") == 0) {
- if (args_info->yspace_given) {
- fprintf(stderr, "%s: `--yspace' (`-y') option given more than once\n", PROGRAM);
- }
- args_info->yspace_given++;
- args_info->yspace_arg = (int)atoi(val);
- }
-
- /* Set shape for state nodes. */
- else if (strcmp(olong, "state-shape") == 0) {
- if (args_info->state_shape_given) {
- fprintf(stderr, "%s: `--state-shape' option given more than once\n", PROGRAM);
- }
- args_info->state_shape_given++;
- if (args_info->state_shape_arg) free(args_info->state_shape_arg);
- args_info->state_shape_arg = strdup(val);
- }
-
- /* Set default state color. */
- else if (strcmp(olong, "state-color") == 0) {
- if (args_info->state_color_given) {
- fprintf(stderr, "%s: `--state-color' option given more than once\n", PROGRAM);
- }
- args_info->state_color_given++;
- if (args_info->state_color_arg) free(args_info->state_color_arg);
- args_info->state_color_arg = strdup(val);
- }
-
- /* Set color for final states. */
- else if (strcmp(olong, "final-color") == 0) {
- if (args_info->final_color_given) {
- fprintf(stderr, "%s: `--final-color' option given more than once\n", PROGRAM);
- }
- args_info->final_color_given++;
- if (args_info->final_color_arg) free(args_info->final_color_arg);
- args_info->final_color_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmdraw_cmdparser.h b/gfsm/gfsm/src/programs/gfsmdraw_cmdparser.h
deleted file mode 100644
index b494e48..0000000
--- a/gfsm/gfsm/src/programs/gfsmdraw_cmdparser.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmdraw_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmdraw_cmdparser_h
-#define gfsmdraw_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * ilabels_arg; /* Specify input (lower) labels file. (default=NULL). */
- char * olabels_arg; /* Specify output (upper) labels file. (default=NULL). */
- char * slabels_arg; /* Specify state labels file. (default=NULL). */
- char * title_arg; /* Specify output title. (default=NULL). */
- int vertical_flag; /* Draw vertically. (default=0). */
- char * output_arg; /* Output graph specification. (default=NULL). */
- int dot_flag; /* Request dot output (default) (default=0). */
- float width_arg; /* Specify output width (default=bbox). (default=8.5). */
- float height_arg; /* Specify output height (default=bbox). (default=11). */
- int fontsize_arg; /* Set output font size. (default=14). */
- char * font_arg; /* Set output font name. (default=NULL). */
- float nodesep_arg; /* Set min node separation. (default=0.25). */
- float ranksep_arg; /* Set min rank separation. (default=0.40). */
- int portrait_flag; /* Generate in portrait mode. (default=0). */
- int vcg_flag; /* Request VCG output. (default=0). */
- int xspace_arg; /* Set xspace graph parameter. (default=40). */
- int yspace_arg; /* Set yspace graph parameter. (default=20). */
- char * state_shape_arg; /* Set shape for state nodes. (default=box). */
- char * state_color_arg; /* Set default state color. (default=white). */
- char * final_color_arg; /* Set color for final states. (default=lightgrey). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int ilabels_given; /* Whether ilabels was given */
- int olabels_given; /* Whether olabels was given */
- int slabels_given; /* Whether slabels was given */
- int title_given; /* Whether title was given */
- int vertical_given; /* Whether vertical was given */
- int output_given; /* Whether output was given */
- int dot_given; /* Whether dot was given */
- int width_given; /* Whether width was given */
- int height_given; /* Whether height was given */
- int fontsize_given; /* Whether fontsize was given */
- int font_given; /* Whether font was given */
- int nodesep_given; /* Whether nodesep was given */
- int ranksep_given; /* Whether ranksep was given */
- int portrait_given; /* Whether portrait was given */
- int vcg_given; /* Whether vcg was given */
- int xspace_given; /* Whether xspace was given */
- int yspace_given; /* Whether yspace was given */
- int state_shape_given; /* Whether state-shape was given */
- int state_color_given; /* Whether state-color was given */
- int final_color_given; /* Whether final-color was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmdraw_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmdraw_main.c b/gfsm/gfsm/src/programs/gfsmdraw_main.c
deleted file mode 100644
index 7748419..0000000
--- a/gfsm/gfsm/src/programs/gfsmdraw_main.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmdraw_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmdraw";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmAlphabet *ilabels=NULL, *olabels=NULL, *slabels=NULL;
-gfsmError *err = NULL;
-
-typedef enum _gfsmDrawMode {
- gfsmDMNone,
- gfsmDMDot,
- gfsmDMVCG
-} gfsmDrawMode;
-gfsmDrawMode mode = gfsmDMDot; //-- default mode
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- if (args.output_given) outfilename = args.output_arg;
-
- //-- labels: input
- if (args.ilabels_given) {
- ilabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(ilabels,args.ilabels_arg,&err)) {
- g_printerr("%s: load failed for input-labels file '%s': %s\n",
- progname, args.ilabels_arg, (err ? err->message : "?"));
- exit(2);
- }
- }
- //-- labels: output
- if (args.olabels_given) {
- olabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(olabels,args.olabels_arg,&err)) {
- g_printerr("%s: load failed for output-labels file '%s': %s\n",
- progname, args.olabels_arg, (err ? err->message : "?"));
- exit(2);
- }
- }
- //-- labels: state
- if (args.slabels_given) {
- slabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(slabels,args.slabels_arg,&err)) {
- g_printerr("%s: load failed for state-labels file '%s': %s\n",
- progname, args.slabels_arg, (err ? err->message : "?"));
- exit(2);
- }
- }
-
- //-- draw mode
- if (args.dot_given) mode = gfsmDMDot;
- else if (args.vcg_given) mode = gfsmDMVCG;
-
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gboolean rc = FALSE;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, (err ? err->message : "?"));
- exit(3);
- }
-
- //-- draw automaton
- if (mode==gfsmDMDot)
- rc = gfsm_automaton_draw_dot_filename_full(fsm,
- outfilename,
- ilabels,
- olabels,
- slabels,
- (args.title_given ? args.title_arg : infilename),
- args.width_arg,
- args.height_arg,
- args.fontsize_arg,
- args.font_arg,
- args.portrait_given,
- args.vertical_given,
- args.nodesep_arg,
- args.ranksep_arg,
- &err);
- else if (mode==gfsmDMVCG)
- rc = gfsm_automaton_draw_vcg_filename_full(fsm,
- outfilename,
- ilabels,
- olabels,
- slabels,
- (args.title_given ? args.title_arg : infilename),
- args.xspace_arg,
- args.yspace_arg,
- (args.vertical_given ? "top_to_bottom" : "left_to_right"),
- args.state_shape_arg,
- args.state_color_arg,
- args.final_color_arg,
- &err);
-
- if (!rc) {
- g_printerr("%s: store failed to '%s': %s\n",
- progname, outfilename, (err ? err->message : "?"));
- exit(4);
- }
-
- //-- cleanup
- if (ilabels) gfsm_alphabet_free(ilabels);
- if (olabels) gfsm_alphabet_free(olabels);
- if (slabels) gfsm_alphabet_free(slabels);
- gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmheader.gog b/gfsm/gfsm/src/programs/gfsmheader.gog
deleted file mode 100644
index c3555ee..0000000
--- a/gfsm/gfsm/src/programs/gfsmheader.gog
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmheader"
-#program_version "0.01"
-
-purpose "Show header information from stored gfsm files"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmheader_cmdparser.c b/gfsm/gfsm/src/programs/gfsmheader_cmdparser.c
deleted file mode 100644
index 58f982f..0000000
--- a/gfsm/gfsm/src/programs/gfsmheader_cmdparser.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmheader_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmheader_cmdparser gfsmheader.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmheader"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmheader_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmheader (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Show header information from stored gfsm files\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmheader");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmheader_cmdparser.h b/gfsm/gfsm/src/programs/gfsmheader_cmdparser.h
deleted file mode 100644
index b9e0baa..0000000
--- a/gfsm/gfsm/src/programs/gfsmheader_cmdparser.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmheader_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmheader_cmdparser_h
-#define gfsmheader_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
-
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmheader_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmheader_main.c b/gfsm/gfsm/src/programs/gfsmheader_main.c
deleted file mode 100644
index 5ba0a87..0000000
--- a/gfsm/gfsm/src/programs/gfsmheader_main.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmheader_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmheader";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-
-//-- global structs
-gfsmAutomatonHeader hdr;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
-
- //-- initialize header
- memset(&hdr, 0, sizeof(gfsmAutomatonHeader));
-}
-
-/*--------------------------------------------------------------------------
- * Utilities
- *--------------------------------------------------------------------------*/
-#define bool2char(b) (b ? 'y' : 'n')
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- gfsmIOHandle *ioh = NULL;
- GString *modestr = NULL;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- //-- open file
- if (!(ioh = gfsmio_new_filename(infilename,"rb",-1,&err)) || err) {
- g_printerr("%s: open failed for '%s': %s\n", progname, infilename, err->message);
- exit(2);
- }
-
- //-- read header
- if (!gfsmio_read(ioh, &hdr, sizeof(gfsmAutomatonHeader))) {
- g_printerr("%s: failed to read header!\n", progname);
- exit(3);
- }
- gfsmio_close(ioh);
-
- //-- print header information
- printf("%-24s: %s\n", "Filename", infilename);
- printf("%-24s: %s\n", "magic", hdr.magic);
- printf("%-24s: %d.%d.%d\n", "version",
- hdr.version.major, hdr.version.minor, hdr.version.micro);
- printf("%-24s: %d.%d.%d\n", "version_min",
- hdr.version_min.major, hdr.version_min.minor, hdr.version_min.micro);
-
- printf("%-24s: %d\n", "flags.is_transducer", hdr.flags.is_transducer);
- printf("%-24s: %d\n", "flags.is_weighted", hdr.flags.is_transducer);
-#if 0
- printf("%-24s: %d (%s)\n", "flags.sort_mode",
- hdr.flags.sort_mode, gfsm_arc_sortmode_to_name(hdr.flags.sort_mode));
-#else
- modestr = gfsm_acmask_to_gstring(hdr.flags.sort_mode, modestr);
- printf("%-24s: %d (%s)\n", "flags.sort_mode", hdr.flags.sort_mode, modestr->str);
- g_string_free(modestr,TRUE);
-#endif
- printf("%-24s: %d\n", "flags.is_deterministic", hdr.flags.is_deterministic);
- printf("%-24s: %d\n", "flags.unused", hdr.flags.unused);
-
- printf("%-24s: %u\n", "root_id", hdr.root_id);
- printf("%-24s: %u\n", "n_states", hdr.n_states);
- printf("%-24s: %u\n", "n_arcs", hdr.n_arcs_007);
- printf("%-24s: %u (%s)\n", "srtype", hdr.srtype, gfsm_sr_type_to_name(hdr.srtype));
-
- printf("%-24s: %u\n", "unused1", hdr.unused1);
- printf("%-24s: %u\n", "unused2", hdr.unused2);
- printf("%-24s: %u\n", "unused3", hdr.unused3);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmindex.gog b/gfsm/gfsm/src/programs/gfsmindex.gog
deleted file mode 100644
index 53c2a14..0000000
--- a/gfsm/gfsm/src/programs/gfsmindex.gog
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmindex"
-#program_version "0.01"
-
-purpose "Convert between indexed and un-indexed binary gfsm automata"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "FSMFILE" "Stored binary gfsm automaton file or index" \
- details="
-If unspecified, standard input will be read.
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-flag "unindex" u "Convert indexed automaton to unindexed format" \
- details="
-Default behavior is to convert a plain unindexed automaton to an indexed automaton.
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmindex_cmdparser.c b/gfsm/gfsm/src/programs/gfsmindex_cmdparser.c
deleted file mode 100644
index 8de1602..0000000
--- a/gfsm/gfsm/src/programs/gfsmindex_cmdparser.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmindex_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.06
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmindex_cmdparser gfsmindex.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmindex"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmindex_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmindex (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Convert between indexed and un-indexed binary gfsm automata\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... FSMFILE\n", "gfsmindex");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" FSMFILE Stored binary gfsm automaton file or index\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -u --unindex Convert indexed automaton to unindexed format\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->unindex_flag = 0;
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->unindex_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "unindex", 0, NULL, 'u' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'u',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'u': /* Convert indexed automaton to unindexed format */
- if (args_info->unindex_given) {
- fprintf(stderr, "%s: `--unindex' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->unindex_given++;
- if (args_info->unindex_given <= 1)
- args_info->unindex_flag = !(args_info->unindex_flag);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Convert indexed automaton to unindexed format */
- else if (strcmp(olong, "unindex") == 0) {
- if (args_info->unindex_given) {
- fprintf(stderr, "%s: `--unindex' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->unindex_given++;
- if (args_info->unindex_given <= 1)
- args_info->unindex_flag = !(args_info->unindex_flag);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmindex_cmdparser.h b/gfsm/gfsm/src/programs/gfsmindex_cmdparser.h
deleted file mode 100644
index 7dbcfb6..0000000
--- a/gfsm/gfsm/src/programs/gfsmindex_cmdparser.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmindex_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.06.
- *
- */
-
-#ifndef gfsmindex_cmdparser_h
-#define gfsmindex_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int unindex_flag; /* Convert indexed automaton to unindexed format (default=0). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int unindex_given; /* Whether unindex was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmindex_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmindex_main.c b/gfsm/gfsm/src/programs/gfsmindex_main.c
deleted file mode 100644
index 76adf26..0000000
--- a/gfsm/gfsm/src/programs/gfsmindex_main.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2007 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gfsm.h>
-
-#include "gfsmindex_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmindex";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm=NULL;
-gfsmIndexedAutomaton *xfsm=NULL;
-gfsmError *err=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- outfilename = args.output_arg;
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- dispatch
- if (args.unindex_given) {
- //-- convert indexed --> vanilla
-
- //-- load index
- xfsm = gfsm_indexed_automaton_new();
- if (!gfsm_indexed_automaton_load_bin_filename(xfsm,infilename,&err)) {
- g_printerr("%s: load failed for indexed automaton from '%s': %s\n", progname, infilename,
- (err ? err->message : "?"));
- exit(3);
- }
-
- //-- unindex
- fsm = gfsm_indexed_to_automaton(xfsm,NULL);
-
- //-- store vanilla
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed for vanilla automaton to '%s': %s\n", progname, outfilename,
- (err ? err->message : "?"));
- exit(4);
- }
- }
- else {
- //-- convert vanilla --> indexed
-
- //-- load vanilla
- fsm = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for vanilla automaton from '%s': %s\n", progname, infilename,
- (err ? err->message : "?"));
- exit(3);
- }
-
- //-- index & sort
- xfsm = gfsm_automaton_to_indexed(fsm,NULL);
- //gfsm_indexed_automaton_sort(xfsm, gfsm_acmask_from_args(gfsmACLower,gfsmACWeight)); //-- TODO: make these options!
-
- //-- store indexed
- if (!gfsm_indexed_automaton_save_bin_filename(xfsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed for indexed automaton to '%s': %s\n", progname, outfilename,
- (err ? err->message : "?"));
- exit(4);
- }
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
- if (xfsm) gfsm_indexed_automaton_free(xfsm);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsminfo.gog b/gfsm/gfsm/src/programs/gfsminfo.gog
deleted file mode 100644
index 22ddbec..0000000
--- a/gfsm/gfsm/src/programs/gfsminfo.gog
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsminfo"
-#program_version "0.01"
-
-purpose "Show basic information about stored gfsm files"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsminfo_cmdparser.c b/gfsm/gfsm/src/programs/gfsminfo_cmdparser.c
deleted file mode 100644
index 79e978f..0000000
--- a/gfsm/gfsm/src/programs/gfsminfo_cmdparser.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsminfo_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsminfo_cmdparser gfsminfo.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsminfo"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsminfo_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsminfo (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Show basic information about stored gfsm files\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsminfo");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsminfo_cmdparser.h b/gfsm/gfsm/src/programs/gfsminfo_cmdparser.h
deleted file mode 100644
index 8aa6727..0000000
--- a/gfsm/gfsm/src/programs/gfsminfo_cmdparser.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsminfo_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsminfo_cmdparser_h
-#define gfsminfo_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
-
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsminfo_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsminfo_main.c b/gfsm/gfsm/src/programs/gfsminfo_main.c
deleted file mode 100644
index 7c6377d..0000000
--- a/gfsm/gfsm/src/programs/gfsminfo_main.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsminfo_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsminfo";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * Utilities
- *--------------------------------------------------------------------------*/
-#define bool2char(b) (b ? 'y' : 'n')
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- GString *modestr = NULL;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
- guint n_eps_i, n_eps_o, n_eps_io;
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(2);
- }
-
- //-- print information
- printf("%-24s: %s\n", "Filename", infilename);
- printf("%-24s: %s\n", "Semiring", gfsm_sr_type_to_name(fsm->sr->type));
- printf("%-24s: %c\n", "Transducer?", bool2char(gfsm_automaton_is_transducer(fsm)));
- printf("%-24s: %c\n", "Weighted?", bool2char(gfsm_automaton_is_weighted(fsm)));
- printf("%-24s: %c\n", "Deterministic?", bool2char(fsm->flags.is_deterministic));
-#if 0
- printf("%-24s: %s\n", "Sort Mode", gfsm_arc_sortmode_to_name(gfsm_automaton_sortmode(fsm)));
-#else
- modestr = gfsm_acmask_to_gstring(fsm->flags.sort_mode, modestr);
- printf("%-24s: %s\n", "Sort Mode", modestr->str);
- g_string_free(modestr,TRUE);
-#endif
- if (fsm->root_id != gfsmNoState) {
- printf("%-24s: %u\n", "Initial state", fsm->root_id);
- } else {
- printf("%-24s: %s\n", "Initial state", "none");
- }
- printf("%-24s: %u\n", "# of states", gfsm_automaton_n_states(fsm));
- printf("%-24s: %u\n", "# of final states", gfsm_automaton_n_final_states(fsm));
- printf("%-24s: %u\n", "# of arcs", gfsm_automaton_n_arcs_full(fsm, &n_eps_i, &n_eps_o, &n_eps_io));
- printf("%-24s: %u\n", "# of i/o epsilon arcs", n_eps_io);
- printf("%-24s: %u\n", "# of input epsilon arcs", n_eps_i);
- printf("%-24s: %u\n", "# of output epsilon arcs", n_eps_o);
-
- printf("%-24s: %c\n", "cyclic?", bool2char(gfsm_automaton_is_cyclic(fsm)));
- //...
-
- //-- cleanup
- gfsm_automaton_free(fsm);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmintersect.gog b/gfsm/gfsm/src/programs/gfsmintersect.gog
deleted file mode 100644
index 9ce5f79..0000000
--- a/gfsm/gfsm/src/programs/gfsmintersect.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmintersect"
-#program_version "0.01"
-
-purpose "Compute intersection of finite state acceptors"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE(s)" "Stored binary gfsm file(s)" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-Probably many.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmintersect_cmdparser.c b/gfsm/gfsm/src/programs/gfsmintersect_cmdparser.c
deleted file mode 100644
index 28b385e..0000000
--- a/gfsm/gfsm/src/programs/gfsmintersect_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmintersect_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmintersect_cmdparser gfsmintersect.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmintersect"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmintersect_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmintersect (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute intersection of finite state acceptors\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE(s)\n", "gfsmintersect");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE(s) Stored binary gfsm file(s)\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmintersect_cmdparser.h b/gfsm/gfsm/src/programs/gfsmintersect_cmdparser.h
deleted file mode 100644
index 4ff1144..0000000
--- a/gfsm/gfsm/src/programs/gfsmintersect_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmintersect_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmintersect_cmdparser_h
-#define gfsmintersect_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmintersect_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmintersect_main.c b/gfsm/gfsm/src/programs/gfsmintersect_main.c
deleted file mode 100644
index 4fd05ff..0000000
--- a/gfsm/gfsm/src/programs/gfsmintersect_main.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmintersect_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmintersect";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename;
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmOut=NULL, *fsmIn=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- require at least one file argument
- if (args.inputs_num < 1) {
- cmdline_parser_print_help();
- exit(2);
- }
-
- //-- output
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsmIn = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * compute_operation()
- * + utility routine
- */
-void compute_operation(const char *infilename)
-{
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsmIn,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute underlying FSM operation
- if (fsmOut == NULL) {
- fsmOut = fsmIn;
- fsmIn = gfsm_automaton_new();
- } else {
- gfsm_automaton_intersect(fsmOut,fsmIn);
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- for (i = 0; i < args.inputs_num; i++) {
- compute_operation(args.inputs[i]);
- }
- if (args.inputs_num == 1) compute_operation("-");
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmOut,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsmIn) gfsm_automaton_free(fsmIn);
- if (fsmOut) gfsm_automaton_free(fsmOut);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsminvert.gog b/gfsm/gfsm/src/programs/gfsminvert.gog
deleted file mode 100644
index 4bb0f2e..0000000
--- a/gfsm/gfsm/src/programs/gfsminvert.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsminvert"
-#program_version "0.01"
-
-purpose "Invert input/output tapes of finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsminvert_cmdparser.c b/gfsm/gfsm/src/programs/gfsminvert_cmdparser.c
deleted file mode 100644
index 04d03c1..0000000
--- a/gfsm/gfsm/src/programs/gfsminvert_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsminvert_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsminvert_cmdparser gfsminvert.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsminvert"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsminvert_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsminvert (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Invert input/output tapes of finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsminvert");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsminvert_cmdparser.h b/gfsm/gfsm/src/programs/gfsminvert_cmdparser.h
deleted file mode 100644
index 47b8bad..0000000
--- a/gfsm/gfsm/src/programs/gfsminvert_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsminvert_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsminvert_cmdparser_h
-#define gfsminvert_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsminvert_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsminvert_main.c b/gfsm/gfsm/src/programs/gfsminvert_main.c
deleted file mode 100644
index acb285c..0000000
--- a/gfsm/gfsm/src/programs/gfsminvert_main.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsminvert_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsminvert";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- invert
- gfsm_automaton_invert(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmlabels.gog b/gfsm/gfsm/src/programs/gfsmlabels.gog
deleted file mode 100644
index 56642da..0000000
--- a/gfsm/gfsm/src/programs/gfsmlabels.gog
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmlabels"
-#program_version "0.01"
-
-purpose "Map input text characters to gfsm labels"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "TXTFILE" "Input text file" \
- details="
-If unspecified, standard input will be read.
-"
-
-#argument "BINFILE" "Output binary gfsm file" \
-# details="
-#If unspecified, output will be written to standard output.
-#"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "labels" l "Specify input alphabet (labels) file." \
- arg="LABELS"
-
-flag "att-mode" a "Parse string(s) in AT&T-compatible mode." \
- default="0"
-
-flag "map-mode" m "Output original strings in addition to label vectors." \
- default="0"
-
-flag "quiet" q "Suppress warnings about undefined symbols." \
- default="0"
-
-string "output" o "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmlabels_cmdparser.c b/gfsm/gfsm/src/programs/gfsmlabels_cmdparser.c
deleted file mode 100644
index 078f4e5..0000000
--- a/gfsm/gfsm/src/programs/gfsmlabels_cmdparser.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmlabels_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.06
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmlabels_cmdparser gfsmlabels.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmlabels"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmlabels_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmlabels (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Map input text characters to gfsm labels\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... TXTFILE\n", "gfsmlabels");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" TXTFILE Input text file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -lLABELS --labels=LABELS Specify input alphabet (labels) file.\n");
- printf(" -a --att-mode Parse string(s) in AT&T-compatible mode.\n");
- printf(" -m --map-mode Output original strings in addition to label vectors.\n");
- printf(" -q --quiet Suppress warnings about undefined symbols.\n");
- printf(" -oFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->labels_arg = NULL;
- args_info->att_mode_flag = 0;
- args_info->map_mode_flag = 0;
- args_info->quiet_flag = 0;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->labels_given = 0;
- args_info->att_mode_given = 0;
- args_info->map_mode_given = 0;
- args_info->quiet_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "labels", 1, NULL, 'l' },
- { "att-mode", 0, NULL, 'a' },
- { "map-mode", 0, NULL, 'm' },
- { "quiet", 0, NULL, 'q' },
- { "output", 1, NULL, 'o' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'l', ':',
- 'a',
- 'm',
- 'q',
- 'o', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'l': /* Specify input alphabet (labels) file. */
- if (args_info->labels_given) {
- fprintf(stderr, "%s: `--labels' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->labels_given++;
- if (args_info->labels_arg) free(args_info->labels_arg);
- args_info->labels_arg = strdup(val);
- break;
-
- case 'a': /* Parse string(s) in AT&T-compatible mode. */
- if (args_info->att_mode_given) {
- fprintf(stderr, "%s: `--att-mode' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->att_mode_given++;
- if (args_info->att_mode_given <= 1)
- args_info->att_mode_flag = !(args_info->att_mode_flag);
- break;
-
- case 'm': /* Output original strings in addition to label vectors. */
- if (args_info->map_mode_given) {
- fprintf(stderr, "%s: `--map-mode' (`-m') option given more than once\n", PROGRAM);
- }
- args_info->map_mode_given++;
- if (args_info->map_mode_given <= 1)
- args_info->map_mode_flag = !(args_info->map_mode_flag);
- break;
-
- case 'q': /* Suppress warnings about undefined symbols. */
- if (args_info->quiet_given) {
- fprintf(stderr, "%s: `--quiet' (`-q') option given more than once\n", PROGRAM);
- }
- args_info->quiet_given++;
- if (args_info->quiet_given <= 1)
- args_info->quiet_flag = !(args_info->quiet_flag);
- break;
-
- case 'o': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify input alphabet (labels) file. */
- else if (strcmp(olong, "labels") == 0) {
- if (args_info->labels_given) {
- fprintf(stderr, "%s: `--labels' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->labels_given++;
- if (args_info->labels_arg) free(args_info->labels_arg);
- args_info->labels_arg = strdup(val);
- }
-
- /* Parse string(s) in AT&T-compatible mode. */
- else if (strcmp(olong, "att-mode") == 0) {
- if (args_info->att_mode_given) {
- fprintf(stderr, "%s: `--att-mode' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->att_mode_given++;
- if (args_info->att_mode_given <= 1)
- args_info->att_mode_flag = !(args_info->att_mode_flag);
- }
-
- /* Output original strings in addition to label vectors. */
- else if (strcmp(olong, "map-mode") == 0) {
- if (args_info->map_mode_given) {
- fprintf(stderr, "%s: `--map-mode' (`-m') option given more than once\n", PROGRAM);
- }
- args_info->map_mode_given++;
- if (args_info->map_mode_given <= 1)
- args_info->map_mode_flag = !(args_info->map_mode_flag);
- }
-
- /* Suppress warnings about undefined symbols. */
- else if (strcmp(olong, "quiet") == 0) {
- if (args_info->quiet_given) {
- fprintf(stderr, "%s: `--quiet' (`-q') option given more than once\n", PROGRAM);
- }
- args_info->quiet_given++;
- if (args_info->quiet_given <= 1)
- args_info->quiet_flag = !(args_info->quiet_flag);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmlabels_cmdparser.h b/gfsm/gfsm/src/programs/gfsmlabels_cmdparser.h
deleted file mode 100644
index 71f8d95..0000000
--- a/gfsm/gfsm/src/programs/gfsmlabels_cmdparser.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmlabels_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.06.
- *
- */
-
-#ifndef gfsmlabels_cmdparser_h
-#define gfsmlabels_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * labels_arg; /* Specify input alphabet (labels) file. (default=NULL). */
- int att_mode_flag; /* Parse string(s) in AT&T-compatible mode. (default=0). */
- int map_mode_flag; /* Output original strings in addition to label vectors. (default=0). */
- int quiet_flag; /* Suppress warnings about undefined symbols. (default=0). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int labels_given; /* Whether labels was given */
- int att_mode_given; /* Whether att-mode was given */
- int map_mode_given; /* Whether map-mode was given */
- int quiet_given; /* Whether quiet was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmlabels_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmlabels_main.c b/gfsm/gfsm/src/programs/gfsmlabels_main.c
deleted file mode 100644
index 0e25c78..0000000
--- a/gfsm/gfsm/src/programs/gfsmlabels_main.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005-2008 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <gfsm.h>
-
-/*-- use gnulib --*/
-#include "gnulib/getdelim.h"
-
-#include "gfsmlabels_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmlabels";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-FILE *outfile = NULL;
-
-//-- global structs
-gfsmAlphabet *labels=NULL;
-gfsmError *err = NULL;
-gboolean att_mode = FALSE;
-gboolean map_mode = FALSE;
-gboolean warn_on_undef = TRUE;
-
-/* HACK */
-//extern ssize_t getline(char **LINEPTR, size_t *N, FILE *STREAM);
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- outfilename = args.output_arg;
-
- //-- open output file
- if (args.output_given) {
- outfilename = args.output_arg;
- outfile = gfsm_open_filename(outfilename,"w",&err);
- if (!outfile) {
- g_printerr("%s: open failed for output file '%s': %s\n",
- progname, outfilename, strerror(errno));
- exit(2);
- }
- }
- else {
- outfile = stdout;
- }
-
- //-- labels
- if (args.labels_given) {
- labels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(labels, args.labels_arg, &err)) {
- g_printerr("%s: load failed for labels file '%s': %s\n",
- progname, args.labels_arg, err->message);
- exit(3);
- }
- } else {
- g_printerr("%s: no labels file specified!\n", progname);
- exit(3);
- }
-
- //-- mode flags
- att_mode = args.att_mode_flag;
- map_mode = args.map_mode_flag;
- warn_on_undef = !args.quiet_flag;
-}
-
-/*--------------------------------------------------------------------------
- * apply_labels_file()
- */
-void apply_labels_file(gfsmAlphabet *labels, FILE *infile, FILE *outfile)
-{
- char *str = NULL;
- size_t buflen = 0;
- ssize_t linelen = 0;
- ssize_t i;
- gfsmLabelVal lab;
- gfsmLabelVector *vec = g_ptr_array_new();
-
- while (!feof(infile)) {
- linelen = getdelim(&str,&buflen,'\n',infile);
- if (linelen<0) { break; } //-- EOF
-
- //-- truncate terminating newline character
- if (str[linelen-1] == '\n') { str[linelen-1] = 0; }
-
- //-- map mode?
- if (map_mode) { fprintf(outfile, "%s\t", str); }
-
- //-- convert
- vec = gfsm_alphabet_generic_string_to_labels(labels,str,vec,warn_on_undef,att_mode);
-
- //-- dump labels
- for (i=0; i<vec->len; i++) {
- lab = GPOINTER_TO_UINT(vec->pdata[i]);
- if (i>0) { fputc(' ',outfile); }
- fprintf(outfile, "%d", lab);
- }
- fputc('\n', outfile);
- }
-
- if (str) free(str);
- if (vec) g_ptr_array_free(vec,TRUE);
-}
-
-void apply_labels_file_0(gfsmAlphabet *labels, FILE *infile, FILE *outfile)
-{
- char *str = NULL;
- size_t buflen = 0;
- ssize_t linelen = 0;
- ssize_t i;
- gfsmLabelVal lab;
- char cs[2] = {'\0', '\0'};
-
- while (!feof(infile)) {
- /*linelen = getline(&str,&buflen,infile);*/
- linelen = getdelim(&str,&buflen,'\n',infile);
- for (i=0; i < linelen; i++) {
- if (isspace(str[i])) continue;
- cs[0] = str[i];
- lab = gfsm_alphabet_find_label(labels,cs);
-
- if (lab==gfsmNoLabel) {
- g_printerr("%s: Warning: no label for character '%c' -- skipping.\n",
- progname, cs[0]);
- continue;
- }
-
- fprintf(outfile, "%d ", lab);
- }
- fputs("\n", outfile);
- }
-
- if (str) free(str);
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
-
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- process input(s)
- if (args.inputs_num==0) {
- apply_labels_file(labels,stdin,outfile);
- }
- for (i=0; i < args.inputs_num; i++) {
- FILE *infile = (strcmp(args.inputs[i],"-")==0 ? stdin : fopen(args.inputs[i], "r"));
- if (!infile) {
- g_printerr("%s: load failed for input file '%s': %s\n", progname, args.inputs[i], strerror(errno));
- exit(255);
- }
- apply_labels_file(labels,infile,outfile);
- if (infile != stdin) fclose(infile);
- }
-
-
- //-- cleanup
- if (labels) gfsm_alphabet_free(labels);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmlookup.gog b/gfsm/gfsm/src/programs/gfsmlookup.gog
deleted file mode 100644
index 500108f..0000000
--- a/gfsm/gfsm/src/programs/gfsmlookup.gog
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmlookup"
-#program_version "0.01"
-
-purpose "Apply a transducer to a linear label sequence"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "LABELID..." "Input label IDs" \
- details="
-In ASCII decimal notation.
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "fst" f "Transducer to apply (default=stdin)." \
- arg="FSTFILE" \
- default="-" \
- details="
-If unspecified, standard input will be read.
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmlookup_cmdparser.c b/gfsm/gfsm/src/programs/gfsmlookup_cmdparser.c
deleted file mode 100644
index ae36643..0000000
--- a/gfsm/gfsm/src/programs/gfsmlookup_cmdparser.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmlookup_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmlookup_cmdparser gfsmlookup.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmlookup"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmlookup_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmlookup (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Apply a transducer to a linear label sequence\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... LABELID...\n", "gfsmlookup");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" LABELID... Input label IDs\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -fFSTFILE --fst=FSTFILE Transducer to apply (default=stdin).\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->fst_arg = strdup("-");
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->fst_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "fst", 1, NULL, 'f' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'f', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'f': /* Transducer to apply (default=stdin). */
- if (args_info->fst_given) {
- fprintf(stderr, "%s: `--fst' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->fst_given++;
- if (args_info->fst_arg) free(args_info->fst_arg);
- args_info->fst_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Transducer to apply (default=stdin). */
- else if (strcmp(olong, "fst") == 0) {
- if (args_info->fst_given) {
- fprintf(stderr, "%s: `--fst' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->fst_given++;
- if (args_info->fst_arg) free(args_info->fst_arg);
- args_info->fst_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmlookup_cmdparser.h b/gfsm/gfsm/src/programs/gfsmlookup_cmdparser.h
deleted file mode 100644
index 3b20b24..0000000
--- a/gfsm/gfsm/src/programs/gfsmlookup_cmdparser.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmlookup_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmlookup_cmdparser_h
-#define gfsmlookup_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * fst_arg; /* Transducer to apply (default=stdin). (default=-). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int fst_given; /* Whether fst was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmlookup_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmlookup_main.c b/gfsm/gfsm/src/programs/gfsmlookup_main.c
deleted file mode 100644
index 39dd8a2..0000000
--- a/gfsm/gfsm/src/programs/gfsmlookup_main.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <gfsm.h>
-
-#include "gfsmlookup_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmlookup";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *fstfilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fst = NULL;
-gfsmError *err = NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.fst_given) fstfilename = args.fst_arg;
- outfilename = args.output_arg;
-
- //-- load FST
- fst = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fst, fstfilename, &err)) {
- g_printerr("%s: load failed for FST file '%s': %s\n", progname, fstfilename, err->message);
- exit(255);
- }
-}
-
-/*--------------------------------------------------------------------------
- * lookup_labels()
- */
-gfsmAutomaton *lookup_labels(gfsmAutomaton *fst, int argc, char **argv)
-{
- gfsmLabelVector *vec = g_ptr_array_sized_new(argc);
- char *s=NULL, *tail=NULL;
- gfsmLabelVal lab;
- gfsmAutomaton *result = NULL;
- int i;
-
- //-- fill input vector
- for (i=0; i < argc; i++) {
- for (s=argv[i], lab=strtol(s,&tail,0); s != tail; s=tail, lab=strtol(s,&tail,0)) {
- g_ptr_array_add(vec, (gpointer)lab);
- }
- }
-
- //-- actual lookup
- result = gfsm_automaton_lookup(fst, vec, result);
-
- //-- cleanup
- g_ptr_array_free(vec,TRUE);
-
- return result;
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmAutomaton *result;
-
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- process input
- result = lookup_labels(fst, args.inputs_num, args.inputs);
-
- //-- save output
- if (!gfsm_automaton_save_bin_filename(result,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fst) gfsm_automaton_free(fst);
- if (result) gfsm_automaton_free(result);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmoptional.gog b/gfsm/gfsm/src/programs/gfsmoptional.gog
deleted file mode 100644
index 3bf6102..0000000
--- a/gfsm/gfsm/src/programs/gfsmoptional.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmoptional"
-#program_version "0.01"
-
-purpose "Make a an automaton optional"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmoptional_cmdparser.c b/gfsm/gfsm/src/programs/gfsmoptional_cmdparser.c
deleted file mode 100644
index 0f90ca4..0000000
--- a/gfsm/gfsm/src/programs/gfsmoptional_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmoptional_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmoptional_cmdparser gfsmoptional.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmoptional"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmoptional_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmoptional (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Make a an automaton optional\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmoptional");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmoptional_cmdparser.h b/gfsm/gfsm/src/programs/gfsmoptional_cmdparser.h
deleted file mode 100644
index 566495e..0000000
--- a/gfsm/gfsm/src/programs/gfsmoptional_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmoptional_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmoptional_cmdparser_h
-#define gfsmoptional_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmoptional_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmoptional_main.c b/gfsm/gfsm/src/programs/gfsmoptional_main.c
deleted file mode 100644
index 73c442c..0000000
--- a/gfsm/gfsm/src/programs/gfsmoptional_main.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmoptional_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmoptional";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * Utilities
- *--------------------------------------------------------------------------*/
-#define bool2char(b) (b ? 'y' : 'n')
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
-
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(2);
- }
-
- //-- make optional
- gfsm_automaton_optional(fsm);
-
- //-- store automaton
- if (!gfsm_automaton_save_bin_filename(fsm,args.output_arg,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, args.output_arg, err->message);
- exit(4);
- }
-
- //-- cleanup
- gfsm_automaton_free(fsm);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmprint.gog b/gfsm/gfsm/src/programs/gfsmprint.gog
deleted file mode 100644
index 4a01ef2..0000000
--- a/gfsm/gfsm/src/programs/gfsmprint.gog
+++ /dev/null
@@ -1,80 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmprint"
-#program_version "0.01"
-
-purpose "Convert binary format gfsm files to text"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-argument "TXTFILE" "Output text file" \
- details="
-If unspecified, output will be written to standard output.
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "ilabels" i "Specify input (lower) labels file." \
- arg="LABELS"
-
-string "olabels" o "Specify output (upper) labels file." \
- arg="LABELS"
-
-string "slabels" s "Specify state labels file." \
- arg="LABELS"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="0" \
- details="
-Specify zlib compression level of output file. -1 indicates
-the library default compression level, 0 (default) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmprint_cmdparser.c b/gfsm/gfsm/src/programs/gfsmprint_cmdparser.c
deleted file mode 100644
index 253eb1d..0000000
--- a/gfsm/gfsm/src/programs/gfsmprint_cmdparser.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmprint_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmprint_cmdparser gfsmprint.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmprint"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmprint_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmprint (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Convert binary format gfsm files to text\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE TXTFILE\n", "gfsmprint");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
- printf(" TXTFILE Output text file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -iLABELS --ilabels=LABELS Specify input (lower) labels file.\n");
- printf(" -oLABELS --olabels=LABELS Specify output (upper) labels file.\n");
- printf(" -sLABELS --slabels=LABELS Specify state labels file.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->ilabels_arg = NULL;
- args_info->olabels_arg = NULL;
- args_info->slabels_arg = NULL;
- args_info->compress_arg = 0;
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->ilabels_given = 0;
- args_info->olabels_given = 0;
- args_info->slabels_given = 0;
- args_info->compress_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "ilabels", 1, NULL, 'i' },
- { "olabels", 1, NULL, 'o' },
- { "slabels", 1, NULL, 's' },
- { "compress", 1, NULL, 'z' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'i', ':',
- 'o', ':',
- 's', ':',
- 'z', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'i': /* Specify input (lower) labels file. */
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- break;
-
- case 'o': /* Specify output (upper) labels file. */
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- break;
-
- case 's': /* Specify state labels file. */
- if (args_info->slabels_given) {
- fprintf(stderr, "%s: `--slabels' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->slabels_given++;
- if (args_info->slabels_arg) free(args_info->slabels_arg);
- args_info->slabels_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify input (lower) labels file. */
- else if (strcmp(olong, "ilabels") == 0) {
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- }
-
- /* Specify output (upper) labels file. */
- else if (strcmp(olong, "olabels") == 0) {
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- }
-
- /* Specify state labels file. */
- else if (strcmp(olong, "slabels") == 0) {
- if (args_info->slabels_given) {
- fprintf(stderr, "%s: `--slabels' (`-s') option given more than once\n", PROGRAM);
- }
- args_info->slabels_given++;
- if (args_info->slabels_arg) free(args_info->slabels_arg);
- args_info->slabels_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmprint_cmdparser.h b/gfsm/gfsm/src/programs/gfsmprint_cmdparser.h
deleted file mode 100644
index 0b06787..0000000
--- a/gfsm/gfsm/src/programs/gfsmprint_cmdparser.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmprint_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmprint_cmdparser_h
-#define gfsmprint_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * ilabels_arg; /* Specify input (lower) labels file. (default=NULL). */
- char * olabels_arg; /* Specify output (upper) labels file. (default=NULL). */
- char * slabels_arg; /* Specify state labels file. (default=NULL). */
- int compress_arg; /* Specify compression level of output file. (default=0). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int ilabels_given; /* Whether ilabels was given */
- int olabels_given; /* Whether olabels was given */
- int slabels_given; /* Whether slabels was given */
- int compress_given; /* Whether compress was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmprint_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmprint_main.c b/gfsm/gfsm/src/programs/gfsmprint_main.c
deleted file mode 100644
index fe6d7f3..0000000
--- a/gfsm/gfsm/src/programs/gfsmprint_main.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmprint_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmprint";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmAlphabet *ilabels=NULL, *olabels=NULL, *slabels=NULL;
-gfsmError *err = NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- if (args.inputs_num > 1) outfilename = args.inputs[1];
-
- //-- labels: input
- if (args.ilabels_given) {
- ilabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(ilabels,args.ilabels_arg,&err)) {
- g_printerr("%s: load failed for input-labels file '%s': %s\n",
- progname, args.ilabels_arg, err->message);
- exit(2);
- }
- }
- //-- labels: output
- if (args.olabels_given) {
- olabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(olabels,args.olabels_arg,&err)) {
- g_printerr("%s: load failed for output-labels file '%s': %s\n",
- progname, args.olabels_arg, err->message);
- exit(2);
- }
- }
- //-- labels: state
- if (args.slabels_given) {
- slabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(slabels,args.slabels_arg,&err)) {
- g_printerr("%s: load failed for state-labels file '%s': %s\n",
- progname, args.slabels_arg, err->message);
- exit(2);
- }
- }
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(3);
- }
-
- //-- print automaton
- if (!gfsm_automaton_print_filename_full(fsm,outfilename,ilabels,olabels,slabels,args.compress_arg,&err)) {
- g_printerr("%s: print failed to '%s': %s\n", progname, outfilename, err->message);
- exit(3);
- }
-
- //-- cleanup
- if (ilabels) gfsm_alphabet_free(ilabels);
- if (olabels) gfsm_alphabet_free(olabels);
- if (slabels) gfsm_alphabet_free(slabels);
- gfsm_automaton_free(fsm);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmproduct.gog b/gfsm/gfsm/src/programs/gfsmproduct.gog
deleted file mode 100644
index 120c823..0000000
--- a/gfsm/gfsm/src/programs/gfsmproduct.gog
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmproduct"
-#program_version "0.01"
-
-purpose "Compute Cartesian product of finite state acceptors"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "LOWER" "Stored binary gfsm file" \
- required=1 \
- details="
-FSM accepting the lower side of the output FST.
-Required argument.
-"
-
-argument "UPPER" "Stored binary gfsm file" \
- details="
-FSM accepting the upper side of the output FST.
-If unspecified, standard input will be read.
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmproduct_cmdparser.c b/gfsm/gfsm/src/programs/gfsmproduct_cmdparser.c
deleted file mode 100644
index 27fd759..0000000
--- a/gfsm/gfsm/src/programs/gfsmproduct_cmdparser.c
+++ /dev/null
@@ -1,450 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmproduct_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmproduct_cmdparser gfsmproduct.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmproduct"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmproduct_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmproduct (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute Cartesian product of finite state acceptors\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... LOWER UPPER\n", "gfsmproduct");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" LOWER Stored binary gfsm file\n");
- printf(" UPPER Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmproduct_cmdparser.h b/gfsm/gfsm/src/programs/gfsmproduct_cmdparser.h
deleted file mode 100644
index 527630e..0000000
--- a/gfsm/gfsm/src/programs/gfsmproduct_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmproduct_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmproduct_cmdparser_h
-#define gfsmproduct_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmproduct_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmproduct_main.c b/gfsm/gfsm/src/programs/gfsmproduct_main.c
deleted file mode 100644
index 446e875..0000000
--- a/gfsm/gfsm/src/programs/gfsmproduct_main.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmproduct_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmproduct";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename;
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmOut=NULL, *fsmIn=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- require at least one file argument
- if (args.inputs_num < 1) {
- cmdline_parser_print_help();
- exit(2);
- }
-
- //-- output
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsmIn = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * compute_operation()
- * + utility routine
- */
-void compute_operation(const char *infilename)
-{
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsmIn,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute product
- if (fsmOut == NULL) {
- fsmOut = fsmIn;
- fsmIn = gfsm_automaton_new();
- } else {
- gfsm_automaton_product2(fsmOut,fsmIn); //-- dual-destructive version
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- for (i = 0; i < args.inputs_num && i < 2; i++) {
- compute_operation(args.inputs[i]);
- }
- if (args.inputs_num == 1) compute_operation("-");
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmOut,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsmIn) gfsm_automaton_free(fsmIn);
- if (fsmOut) gfsm_automaton_free(fsmOut);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmproject.gog b/gfsm/gfsm/src/programs/gfsmproject.gog
deleted file mode 100644
index 42fcb6c..0000000
--- a/gfsm/gfsm/src/programs/gfsmproject.gog
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmproject"
-#program_version "0.01"
-
-purpose "Project one side of finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-flag "first" 1 "Project lower side [default]."
-flag - i "Project input tape (alias for -1)"
-
-flag "second" 2 "Project upper side."
-flag - o "Project output side (alias for -2)"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmproject_cmdparser.c b/gfsm/gfsm/src/programs/gfsmproject_cmdparser.c
deleted file mode 100644
index 5905210..0000000
--- a/gfsm/gfsm/src/programs/gfsmproject_cmdparser.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmproject_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmproject_cmdparser gfsmproject.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmproject"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmproject_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmproject (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Project one side of finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmproject");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -1 --first Project lower side [default].\n");
- printf(" -i Project input tape (alias for -1)\n");
- printf(" -2 --second Project upper side.\n");
- printf(" -o Project output side (alias for -2)\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->first_flag = 0;
- args_info->i_flag = 0;
- args_info->second_flag = 0;
- args_info->o_flag = 0;
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->first_given = 0;
- args_info->i_given = 0;
- args_info->second_given = 0;
- args_info->o_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "first", 0, NULL, '1' },
- { "second", 0, NULL, '2' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- '1',
- 'i',
- '2',
- 'o',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case '1': /* Project lower side [default]. */
- if (args_info->first_given) {
- fprintf(stderr, "%s: `--first' (`-1') option given more than once\n", PROGRAM);
- }
- args_info->first_given++;
- if (args_info->first_given <= 1)
- args_info->first_flag = !(args_info->first_flag);
- break;
-
- case 'i': /* Project input tape (alias for -1) */
- if (args_info->i_given) {
- fprintf(stderr, "%s: (`-i') option given more than once\n", PROGRAM);
- }
- args_info->i_given++;
- if (args_info->i_given <= 1)
- args_info->i_flag = !(args_info->i_flag);
- break;
-
- case '2': /* Project upper side. */
- if (args_info->second_given) {
- fprintf(stderr, "%s: `--second' (`-2') option given more than once\n", PROGRAM);
- }
- args_info->second_given++;
- if (args_info->second_given <= 1)
- args_info->second_flag = !(args_info->second_flag);
- break;
-
- case 'o': /* Project output side (alias for -2) */
- if (args_info->o_given) {
- fprintf(stderr, "%s: (`-o') option given more than once\n", PROGRAM);
- }
- args_info->o_given++;
- if (args_info->o_given <= 1)
- args_info->o_flag = !(args_info->o_flag);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Project lower side [default]. */
- else if (strcmp(olong, "first") == 0) {
- if (args_info->first_given) {
- fprintf(stderr, "%s: `--first' (`-1') option given more than once\n", PROGRAM);
- }
- args_info->first_given++;
- if (args_info->first_given <= 1)
- args_info->first_flag = !(args_info->first_flag);
- }
-
- /* Project upper side. */
- else if (strcmp(olong, "second") == 0) {
- if (args_info->second_given) {
- fprintf(stderr, "%s: `--second' (`-2') option given more than once\n", PROGRAM);
- }
- args_info->second_given++;
- if (args_info->second_given <= 1)
- args_info->second_flag = !(args_info->second_flag);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmproject_cmdparser.h b/gfsm/gfsm/src/programs/gfsmproject_cmdparser.h
deleted file mode 100644
index e7fbb80..0000000
--- a/gfsm/gfsm/src/programs/gfsmproject_cmdparser.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmproject_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmproject_cmdparser_h
-#define gfsmproject_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int first_flag; /* Project lower side [default]. (default=0). */
- int i_flag; /* Project input tape (alias for -1) (default=0). */
- int second_flag; /* Project upper side. (default=0). */
- int o_flag; /* Project output side (alias for -2) (default=0). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int first_given; /* Whether first was given */
- int i_given; /* Whether - was given */
- int second_given; /* Whether second was given */
- int o_given; /* Whether - was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmproject_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmproject_main.c b/gfsm/gfsm/src/programs/gfsmproject_main.c
deleted file mode 100644
index 528b456..0000000
--- a/gfsm/gfsm/src/programs/gfsmproject_main.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmproject_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmproject";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs & vars
-gfsmAutomaton *fsm;
-gfsmLabelSide which = gfsmLSLower;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- which?
- if (args.second_given || args.o_given) which = gfsmLSUpper;
- else which = gfsmLSLower;
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- invert
- gfsm_automaton_project(fsm,which);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmrenumber.gog b/gfsm/gfsm/src/programs/gfsmrenumber.gog
deleted file mode 100644
index df2d0b6..0000000
--- a/gfsm/gfsm/src/programs/gfsmrenumber.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmrenumber"
-#program_version "0.01"
-
-purpose "Renumber states in finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.c b/gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.c
deleted file mode 100644
index a058eb2..0000000
--- a/gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmrenumber_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmrenumber_cmdparser gfsmrenumber.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmrenumber"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmrenumber_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmrenumber (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Renumber states in finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmrenumber");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.h b/gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.h
deleted file mode 100644
index 08db747..0000000
--- a/gfsm/gfsm/src/programs/gfsmrenumber_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmrenumber_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmrenumber_cmdparser_h
-#define gfsmrenumber_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmrenumber_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmrenumber_main.c b/gfsm/gfsm/src/programs/gfsmrenumber_main.c
deleted file mode 100644
index 7bf7a59..0000000
--- a/gfsm/gfsm/src/programs/gfsmrenumber_main.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmrenumber_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmrenumber";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- renumber
- gfsm_automaton_renumber_states(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmreplace.gog b/gfsm/gfsm/src/programs/gfsmreplace.gog
deleted file mode 100644
index 466526d..0000000
--- a/gfsm/gfsm/src/programs/gfsmreplace.gog
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmreplace"
-#program_version "0.01"
-
-purpose "Replace some automaton arcs with a whole automaton"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "replacement" r "Replacement automaton (binary gfsm file)" \
- arg="FSMFILE" \
- default="-" \
- details="
-If unspecified, standard input will be read.
-"
-
-int "lower" l "Lower label to replace (default=any)" \
- arg="LABEL"
-
-int "upper" u "Upper label to replace (default=any)" \
- arg="LABEL"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmreplace_cmdparser.c b/gfsm/gfsm/src/programs/gfsmreplace_cmdparser.c
deleted file mode 100644
index 652c7a7..0000000
--- a/gfsm/gfsm/src/programs/gfsmreplace_cmdparser.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmreplace_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmreplace_cmdparser gfsmreplace.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmreplace"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmreplace_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmreplace (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Replace some automaton arcs with a whole automaton\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... [FILES]...\n", "gfsmreplace");
-
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -rFSMFILE --replacement=FSMFILE Replacement automaton (binary gfsm file)\n");
- printf(" -lLABEL --lower=LABEL Lower label to replace (default=any)\n");
- printf(" -uLABEL --upper=LABEL Upper label to replace (default=any)\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->replacement_arg = strdup("-");
- args_info->lower_arg = 0;
- args_info->upper_arg = 0;
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->replacement_given = 0;
- args_info->lower_given = 0;
- args_info->upper_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "replacement", 1, NULL, 'r' },
- { "lower", 1, NULL, 'l' },
- { "upper", 1, NULL, 'u' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'r', ':',
- 'l', ':',
- 'u', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'r': /* Replacement automaton (binary gfsm file) */
- if (args_info->replacement_given) {
- fprintf(stderr, "%s: `--replacement' (`-r') option given more than once\n", PROGRAM);
- }
- args_info->replacement_given++;
- if (args_info->replacement_arg) free(args_info->replacement_arg);
- args_info->replacement_arg = strdup(val);
- break;
-
- case 'l': /* Lower label to replace (default=any) */
- if (args_info->lower_given) {
- fprintf(stderr, "%s: `--lower' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->lower_given++;
- args_info->lower_arg = (int)atoi(val);
- break;
-
- case 'u': /* Upper label to replace (default=any) */
- if (args_info->upper_given) {
- fprintf(stderr, "%s: `--upper' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->upper_given++;
- args_info->upper_arg = (int)atoi(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Replacement automaton (binary gfsm file) */
- else if (strcmp(olong, "replacement") == 0) {
- if (args_info->replacement_given) {
- fprintf(stderr, "%s: `--replacement' (`-r') option given more than once\n", PROGRAM);
- }
- args_info->replacement_given++;
- if (args_info->replacement_arg) free(args_info->replacement_arg);
- args_info->replacement_arg = strdup(val);
- }
-
- /* Lower label to replace (default=any) */
- else if (strcmp(olong, "lower") == 0) {
- if (args_info->lower_given) {
- fprintf(stderr, "%s: `--lower' (`-l') option given more than once\n", PROGRAM);
- }
- args_info->lower_given++;
- args_info->lower_arg = (int)atoi(val);
- }
-
- /* Upper label to replace (default=any) */
- else if (strcmp(olong, "upper") == 0) {
- if (args_info->upper_given) {
- fprintf(stderr, "%s: `--upper' (`-u') option given more than once\n", PROGRAM);
- }
- args_info->upper_given++;
- args_info->upper_arg = (int)atoi(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmreplace_cmdparser.h b/gfsm/gfsm/src/programs/gfsmreplace_cmdparser.h
deleted file mode 100644
index f7c704d..0000000
--- a/gfsm/gfsm/src/programs/gfsmreplace_cmdparser.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmreplace_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmreplace_cmdparser_h
-#define gfsmreplace_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * replacement_arg; /* Replacement automaton (binary gfsm file) (default=-). */
- int lower_arg; /* Lower label to replace (default=any) (default=0). */
- int upper_arg; /* Upper label to replace (default=any) (default=0). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int replacement_given; /* Whether replacement was given */
- int lower_given; /* Whether lower was given */
- int upper_given; /* Whether upper was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmreplace_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmreplace_main.c b/gfsm/gfsm/src/programs/gfsmreplace_main.c
deleted file mode 100644
index c2b1107..0000000
--- a/gfsm/gfsm/src/programs/gfsmreplace_main.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <gfsm.h>
-
-#include "gfsmreplace_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmreplace";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *replfilename = "-";
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *repl = NULL, *fsm=NULL;
-gfsmError *err = NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.replacement_given) replfilename = args.replacement_arg;
- outfilename = args.output_arg;
-
- //-- load replacement automaton
- repl = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(repl, replfilename, &err)) {
- g_printerr("%s: load failed for FST file '%s': %s\n", progname, replfilename, err->message);
- exit(255);
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- load input automaton
- fsm = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- perform replacement
- gfsm_automaton_replace(fsm,
- (args.lower_given ? args.lower_arg : gfsmNoLabel),
- (args.upper_given ? args.upper_arg : gfsmNoLabel),
- repl);
-
- //-- save output
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (repl) gfsm_automaton_free(repl);
- if (fsm) gfsm_automaton_free(fsm);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmreverse.gog b/gfsm/gfsm/src/programs/gfsmreverse.gog
deleted file mode 100644
index f67c417..0000000
--- a/gfsm/gfsm/src/programs/gfsmreverse.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmreverse"
-#program_version "0.01"
-
-purpose "Reverse a finite state machine"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read.
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmreverse_cmdparser.c b/gfsm/gfsm/src/programs/gfsmreverse_cmdparser.c
deleted file mode 100644
index f992776..0000000
--- a/gfsm/gfsm/src/programs/gfsmreverse_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmreverse_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmreverse_cmdparser gfsmreverse.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmreverse"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmreverse_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmreverse (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Reverse a finite state machine\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmreverse");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmreverse_cmdparser.h b/gfsm/gfsm/src/programs/gfsmreverse_cmdparser.h
deleted file mode 100644
index 81ed264..0000000
--- a/gfsm/gfsm/src/programs/gfsmreverse_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmreverse_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmreverse_cmdparser_h
-#define gfsmreverse_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmreverse_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmreverse_main.c b/gfsm/gfsm/src/programs/gfsmreverse_main.c
deleted file mode 100644
index e2b24f1..0000000
--- a/gfsm/gfsm/src/programs/gfsmreverse_main.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmreverse_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmreverse";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs & vars
-gfsmAutomaton *fsm;
-int which = 1;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- invert
- gfsm_automaton_reverse(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmrmepsilon.gog b/gfsm/gfsm/src/programs/gfsmrmepsilon.gog
deleted file mode 100644
index e1b78d6..0000000
--- a/gfsm/gfsm/src/programs/gfsmrmepsilon.gog
+++ /dev/null
@@ -1,80 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmrmepsilon"
-#program_version "0.01"
-
-purpose "Remove epsilon arcs from finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-=over 4
-
-=item
-
-No negative-cost epsilon cycles are allowed in the input automaton.
-
-=item
-
-Probably many more.
-
-=back
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.c b/gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.c
deleted file mode 100644
index 1f4351f..0000000
--- a/gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmrmepsilon_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmrmepsilon_cmdparser gfsmrmepsilon.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmrmepsilon"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmrmepsilon_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmrmepsilon (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Remove epsilon arcs from finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmrmepsilon");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.h b/gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.h
deleted file mode 100644
index e9deda5..0000000
--- a/gfsm/gfsm/src/programs/gfsmrmepsilon_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmrmepsilon_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmrmepsilon_cmdparser_h
-#define gfsmrmepsilon_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmrmepsilon_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmrmepsilon_main.c b/gfsm/gfsm/src/programs/gfsmrmepsilon_main.c
deleted file mode 100644
index ec3e899..0000000
--- a/gfsm/gfsm/src/programs/gfsmrmepsilon_main.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmrmepsilon_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmrmepsilon";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fsm;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) infilename = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsm = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmError *err = NULL;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- rmepsilon
- gfsm_automaton_rmepsilon(fsm);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsm,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsm) gfsm_automaton_free(fsm);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmsigma.gog b/gfsm/gfsm/src/programs/gfsmsigma.gog
deleted file mode 100644
index 68b7243..0000000
--- a/gfsm/gfsm/src/programs/gfsmsigma.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmsigma"
-#program_version "0.01"
-
-purpose "Create a single-state alphabet acceptor"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "LABFILE" "Alphabet file" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmsigma_cmdparser.c b/gfsm/gfsm/src/programs/gfsmsigma_cmdparser.c
deleted file mode 100644
index 7cf017f..0000000
--- a/gfsm/gfsm/src/programs/gfsmsigma_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmsigma_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmsigma_cmdparser gfsmsigma.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmsigma"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmsigma_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmsigma (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Create a single-state alphabet acceptor\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... LABFILE\n", "gfsmsigma");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" LABFILE Alphabet file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmsigma_cmdparser.h b/gfsm/gfsm/src/programs/gfsmsigma_cmdparser.h
deleted file mode 100644
index 4a7832c..0000000
--- a/gfsm/gfsm/src/programs/gfsmsigma_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmsigma_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmsigma_cmdparser_h
-#define gfsmsigma_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmsigma_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmsigma_main.c b/gfsm/gfsm/src/programs/gfsmsigma_main.c
deleted file mode 100644
index ce5c59d..0000000
--- a/gfsm/gfsm/src/programs/gfsmsigma_main.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmsigma_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmsigma";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *abetname = "-";
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmOut=NULL;
-gfsmAlphabet *abet=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- output
- if (args.inputs_num) abetname = args.inputs[0];
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- initialize automaton
- fsmOut = gfsm_automaton_new();
-}
-
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- //-- load alphabet
- abet = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(abet, abetname, &err)) {
- g_printerr("%s: load failed for alphabet file '%s': %s\n",
- progname, abetname, err->message);
- exit(2);
- }
-
- //-- compute operation
- gfsm_automaton_sigma(fsmOut,abet);
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmOut,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (abet) gfsm_alphabet_free(abet);
- if (fsmOut) gfsm_automaton_free(fsmOut);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmstrings.gog b/gfsm/gfsm/src/programs/gfsmstrings.gog
deleted file mode 100644
index 5672f36..0000000
--- a/gfsm/gfsm/src/programs/gfsmstrings.gog
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmstrings"
-#program_version "0.01"
-
-purpose "Serialize binary acyclic gfsm files to lists of strings"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-#details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/gfsmrc"
-#rcfile "~/.gfsmrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE" "Stored binary gfsm file" \
- details="
-If unspecified, standard input will be read.
-"
-
-#-----------------------------------------------------------------------------
-# Common Options
-#-----------------------------------------------------------------------------
-group "Common Options"
-
-string "ilabels" i "Specify input (lower) labels file." \
- arg="LABELS"
-
-string "olabels" o "Specify output (upper) labels file." \
- arg="LABELS"
-
-flag "att" a "Output in AT&T regex format." \
- default=0
-
-flag "viterbi" v "Treat input automaton as a Viterbi trellis." \
- default=0
-
-string "output" F "Output file." \
- arg="TXTFILE" \
- details="
-Default behavior is to write to stdout.
-"
-
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>,
-"
diff --git a/gfsm/gfsm/src/programs/gfsmstrings_cmdparser.c b/gfsm/gfsm/src/programs/gfsmstrings_cmdparser.c
deleted file mode 100644
index 6f2c30b..0000000
--- a/gfsm/gfsm/src/programs/gfsmstrings_cmdparser.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmstrings_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmstrings_cmdparser gfsmstrings.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmstrings"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmstrings_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmstrings (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Serialize binary acyclic gfsm files to lists of strings\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE\n", "gfsmstrings");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE Stored binary gfsm file\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf("\n");
- printf(" Common Options:\n");
- printf(" -iLABELS --ilabels=LABELS Specify input (lower) labels file.\n");
- printf(" -oLABELS --olabels=LABELS Specify output (upper) labels file.\n");
- printf(" -a --att Output in AT&T regex format.\n");
- printf(" -v --viterbi Treat input automaton as a Viterbi trellis.\n");
- printf(" -FTXTFILE --output=TXTFILE Output file.\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->ilabels_arg = NULL;
- args_info->olabels_arg = NULL;
- args_info->att_flag = 0;
- args_info->viterbi_flag = 0;
- args_info->output_arg = NULL;
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->ilabels_given = 0;
- args_info->olabels_given = 0;
- args_info->att_given = 0;
- args_info->viterbi_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "ilabels", 1, NULL, 'i' },
- { "olabels", 1, NULL, 'o' },
- { "att", 0, NULL, 'a' },
- { "viterbi", 0, NULL, 'v' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'i', ':',
- 'o', ':',
- 'a',
- 'v',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'i': /* Specify input (lower) labels file. */
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- break;
-
- case 'o': /* Specify output (upper) labels file. */
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- break;
-
- case 'a': /* Output in AT&T regex format. */
- if (args_info->att_given) {
- fprintf(stderr, "%s: `--att' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->att_given++;
- if (args_info->att_given <= 1)
- args_info->att_flag = !(args_info->att_flag);
- break;
-
- case 'v': /* Treat input automaton as a Viterbi trellis. */
- if (args_info->viterbi_given) {
- fprintf(stderr, "%s: `--viterbi' (`-v') option given more than once\n", PROGRAM);
- }
- args_info->viterbi_given++;
- if (args_info->viterbi_given <= 1)
- args_info->viterbi_flag = !(args_info->viterbi_flag);
- break;
-
- case 'F': /* Output file. */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify input (lower) labels file. */
- else if (strcmp(olong, "ilabels") == 0) {
- if (args_info->ilabels_given) {
- fprintf(stderr, "%s: `--ilabels' (`-i') option given more than once\n", PROGRAM);
- }
- args_info->ilabels_given++;
- if (args_info->ilabels_arg) free(args_info->ilabels_arg);
- args_info->ilabels_arg = strdup(val);
- }
-
- /* Specify output (upper) labels file. */
- else if (strcmp(olong, "olabels") == 0) {
- if (args_info->olabels_given) {
- fprintf(stderr, "%s: `--olabels' (`-o') option given more than once\n", PROGRAM);
- }
- args_info->olabels_given++;
- if (args_info->olabels_arg) free(args_info->olabels_arg);
- args_info->olabels_arg = strdup(val);
- }
-
- /* Output in AT&T regex format. */
- else if (strcmp(olong, "att") == 0) {
- if (args_info->att_given) {
- fprintf(stderr, "%s: `--att' (`-a') option given more than once\n", PROGRAM);
- }
- args_info->att_given++;
- if (args_info->att_given <= 1)
- args_info->att_flag = !(args_info->att_flag);
- }
-
- /* Treat input automaton as a Viterbi trellis. */
- else if (strcmp(olong, "viterbi") == 0) {
- if (args_info->viterbi_given) {
- fprintf(stderr, "%s: `--viterbi' (`-v') option given more than once\n", PROGRAM);
- }
- args_info->viterbi_given++;
- if (args_info->viterbi_given <= 1)
- args_info->viterbi_flag = !(args_info->viterbi_flag);
- }
-
- /* Output file. */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmstrings_cmdparser.h b/gfsm/gfsm/src/programs/gfsmstrings_cmdparser.h
deleted file mode 100644
index 51e085e..0000000
--- a/gfsm/gfsm/src/programs/gfsmstrings_cmdparser.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmstrings_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmstrings_cmdparser_h
-#define gfsmstrings_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * ilabels_arg; /* Specify input (lower) labels file. (default=NULL). */
- char * olabels_arg; /* Specify output (upper) labels file. (default=NULL). */
- int att_flag; /* Output in AT&T regex format. (default=0). */
- int viterbi_flag; /* Treat input automaton as a Viterbi trellis. (default=0). */
- char * output_arg; /* Output file. (default=NULL). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int ilabels_given; /* Whether ilabels was given */
- int olabels_given; /* Whether olabels was given */
- int att_given; /* Whether att was given */
- int viterbi_given; /* Whether viterbi was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmstrings_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmstrings_main.c b/gfsm/gfsm/src/programs/gfsmstrings_main.c
deleted file mode 100644
index 4b561e6..0000000
--- a/gfsm/gfsm/src/programs/gfsmstrings_main.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmstrings_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmstrings";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename = "-";
-const char *outfilename = "-";
-FILE *outfile = NULL;
-
-//-- global structs
-gfsmAutomaton *fsm;
-gfsmAlphabet *ilabels=NULL, *olabels=NULL;
-gfsmError *err = NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.inputs_num > 0) infilename = args.inputs[0];
- if (args.output_given) outfilename = args.output_arg;
-
- //-- labels: input
- if (args.ilabels_given) {
- ilabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(ilabels,args.ilabels_arg,&err)) {
- g_printerr("%s: load failed for input-labels file '%s': %s\n",
- progname, args.ilabels_arg, (err ? err->message : "?"));
- exit(2);
- }
- }
- //-- labels: output
- if (args.olabels_given) {
- olabels = gfsm_string_alphabet_new();
- if (!gfsm_alphabet_load_filename(olabels,args.olabels_arg,&err)) {
- g_printerr("%s: load failed for output-labels file '%s': %s\n",
- progname, args.olabels_arg, (err ? err->message : "?"));
- exit(2);
- }
- }
-
- //-- initialize fsm
- fsm = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmSet *paths = NULL;
- GSList *strings = NULL;
- get_my_options(argc,argv);
-
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsm,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, (err ? err->message : "?"));
- exit(3);
- }
-
- //-- sanity check
- if (gfsm_automaton_is_cyclic(fsm)) {
- g_printerr("%s: input automaton must be acyclic!\n", progname);
- exit(255);
- }
-
- //-- open output file
- outfile = gfsm_open_filename(outfilename, "w", &err);
- if (!outfile) {
- g_printerr("%s: %s\n", progname, (err ? err->message : "?"));
- exit(4);
- }
-
-
- //-- get & stringify full paths
- if (args.viterbi_flag) {
- //-- serialize Viterbi trellis automaton
- paths = gfsm_viterbi_trellis_paths_full(fsm, NULL, gfsmLSBoth);
- }
- else {
- //-- serialize "normal" automaton
- paths = gfsm_automaton_paths_full(fsm, NULL, gfsmLSBoth);
- }
- strings = gfsm_paths_to_strings(paths,
- ilabels,
- olabels,
- fsm->sr,
- TRUE,
- args.att_given,
- NULL);
- while (strings) {
- //-- pop first datum
- char *s = (char *)strings->data;
- strings = g_slist_delete_link(strings,strings);
-
- //-- print string
- fputs(s, outfile);
- fputc('\n', outfile);
-
- g_free(s);
- }
-
- //-- cleanup
- if (paths) gfsm_set_free(paths);
- if (ilabels) gfsm_alphabet_free(ilabels);
- if (olabels) gfsm_alphabet_free(olabels);
- if (fsm) gfsm_automaton_free(fsm);
-
- if (outfile != stdout) fclose(outfile);
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmunion.gog b/gfsm/gfsm/src/programs/gfsmunion.gog
deleted file mode 100644
index 96d84e2..0000000
--- a/gfsm/gfsm/src/programs/gfsmunion.gog
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmunion"
-#program_version "0.01"
-
-purpose "Compute union of finite state machines"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "BINFILE(s)" "Stored binary gfsm file(s)" \
- details="
-If unspecified, standard input will be read
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-None known.
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmunion_cmdparser.c b/gfsm/gfsm/src/programs/gfsmunion_cmdparser.c
deleted file mode 100644
index 31aafa8..0000000
--- a/gfsm/gfsm/src/programs/gfsmunion_cmdparser.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmunion_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmunion_cmdparser gfsmunion.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmunion"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmunion_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmunion (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" Compute union of finite state machines\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... BINFILE(s)\n", "gfsmunion");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" BINFILE(s) Stored binary gfsm file(s)\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmunion_cmdparser.h b/gfsm/gfsm/src/programs/gfsmunion_cmdparser.h
deleted file mode 100644
index 6086492..0000000
--- a/gfsm/gfsm/src/programs/gfsmunion_cmdparser.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmunion_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmunion_cmdparser_h
-#define gfsmunion_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmunion_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmunion_main.c b/gfsm/gfsm/src/programs/gfsmunion_main.c
deleted file mode 100644
index dd7998d..0000000
--- a/gfsm/gfsm/src/programs/gfsmunion_main.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <gfsm.h>
-
-#include "gfsmunion_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmunion";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *infilename;
-const char *outfilename = "-";
-
-//-- global structs etc.
-gfsmError *err = NULL;
-gfsmAutomaton *fsmUnion=NULL, *fsmIn=NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- require at least one file argument
- if (args.inputs_num < 1) {
- cmdline_parser_print_help();
- exit(2);
- }
-
- //-- output
- if (args.output_arg) outfilename = args.output_arg;
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- initialize automaton
- fsmIn = gfsm_automaton_new();
-}
-
-/*--------------------------------------------------------------------------
- * compute_union()
- * + utility routine
- */
-void compute_union(const char *infilename)
-{
- //-- load automaton
- if (!gfsm_automaton_load_bin_filename(fsmIn,infilename,&err)) {
- g_printerr("%s: load failed for '%s': %s\n", progname, infilename, err->message);
- exit(255);
- }
-
- //-- compute union
- if (fsmUnion == NULL) {
- fsmUnion = fsmIn;
- fsmIn = gfsm_automaton_new();
- } else {
- gfsm_automaton_union(fsmUnion,fsmIn);
- }
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- int i;
-
- GFSM_INIT
-
- get_my_options(argc,argv);
-
- for (i = 0; i < args.inputs_num; i++) {
- compute_union(args.inputs[i]);
- }
- if (args.inputs_num == 1) compute_union("-");
-
- //-- spew automaton
- if (!gfsm_automaton_save_bin_filename(fsmUnion,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fsmIn) gfsm_automaton_free(fsmIn);
- if (fsmUnion) gfsm_automaton_free(fsmUnion);
-
- GFSM_FINISH
-
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmview.sh b/gfsm/gfsm/src/programs/gfsmview.sh
deleted file mode 100755
index d8df9c2..0000000
--- a/gfsm/gfsm/src/programs/gfsmview.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-GFSMDRAW=./gfsmdraw
-DOTGV=dotgv.sh
-
-exec $GFSMDRAW "$@" | $DOTGV
diff --git a/gfsm/gfsm/src/programs/gfsmviterbi.gog b/gfsm/gfsm/src/programs/gfsmviterbi.gog
deleted file mode 100644
index 827d26e..0000000
--- a/gfsm/gfsm/src/programs/gfsmviterbi.gog
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- Mode: Shell-Script -*-
-#
-# Getopt::Gen specification
-#-----------------------------------------------------------------------------
-program "gfsmviterbi"
-#program_version "0.01"
-
-purpose "EXPERIMENTAL: Compute Viterbi trellis for a linear label sequence in a transducer"
-author "Bryan Jurish <moocow@ling.uni-potsdam.de>"
-on_reparse "warn"
-
-#-----------------------------------------------------------------------------
-# Details
-#-----------------------------------------------------------------------------
-details ""
-
-#-----------------------------------------------------------------------------
-# Files
-#-----------------------------------------------------------------------------
-#rcfile "/etc/mootrc"
-#rcfile "~/.mootrc"
-
-#-----------------------------------------------------------------------------
-# Arguments
-#-----------------------------------------------------------------------------
-argument "LABELID..." "Input label IDs" \
- details="
-In ASCII decimal notation.
-"
-
-#-----------------------------------------------------------------------------
-# Options
-#-----------------------------------------------------------------------------
-#group "Basic Options"
-
-string "fst" f "Weighted transducer to apply (default=stdin)." \
- arg="FSTFILE" \
- default="-" \
- details="
-If unspecified, standard input will be read.
-"
-
-int "compress" z "Specify compression level of output file." \
- arg="LEVEL" \
- default="-1" \
- details="
-Specify zlib compression level of output file. -1 (default) indicates
-the default compression level, 0 (zero) indicates no zlib compression at all,
-and 9 indicates the best possible compression.
-"
-
-string "output" F "Specifiy output file (default=stdout)." \
- arg="FILE" \
- default="-"
-
-#-----------------------------------------------------------------------------
-# Addenda
-#-----------------------------------------------------------------------------
-#addenda ""
-
-#-----------------------------------------------------------------------------
-# Bugs
-#-----------------------------------------------------------------------------
-bugs "
-
-=over 4
-
-=item
-
-No negative-cost epsilon cycles are allowed in the transducer.
-
-=item
-
-The Viterbi API, the existence of the gfsmviterbi command-line program,
-its arguments & optiosn, etc. are HIGHLY UNSTABLE.
-
-=back
-
-"
-
-#-----------------------------------------------------------------------------
-# Footer
-#-----------------------------------------------------------------------------
-#acknowledge `cat acknowledge.pod`
-
-seealso "
-L<gfsmutils>
-"
diff --git a/gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.c b/gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.c
deleted file mode 100644
index f4de7a9..0000000
--- a/gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmviterbi_cmdparser.c
- * Description: Code for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05
- * generated with the following command:
- * /usr/local/bin/optgen.perl -u -l --no-handle-rcfile --nopod -F gfsmviterbi_cmdparser gfsmviterbi.gog
- *
- * The developers of optgen.perl consider the fixed text that goes in all
- * optgen.perl output files to be in the public domain:
- * we make no copyright claims on it.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-/* If we use autoconf/autoheader. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-
-/* Allow user-overrides for PACKAGE and VERSION */
-#ifndef PACKAGE
-# define PACKAGE "PACKAGE"
-#endif
-
-#ifndef VERSION
-# define VERSION "VERSION"
-#endif
-
-
-#ifndef PROGRAM
-# define PROGRAM "gfsmviterbi"
-#endif
-
-/* #define cmdline_parser_DEBUG */
-
-/* Check for "configure's" getopt check result. */
-#ifndef HAVE_GETOPT_LONG
-# include "getopt.h"
-#else
-# include <getopt.h>
-#endif
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-# define strdup gengetopt_strdup
-#endif /* HAVE_STRDUP */
-
-#include "gfsmviterbi_cmdparser.h"
-
-
-/* user code section */
-
-/* end user code section */
-
-
-void
-cmdline_parser_print_version (void)
-{
- printf("gfsmviterbi (%s %s) by Bryan Jurish <moocow@ling.uni-potsdam.de>\n", PACKAGE, VERSION);
-}
-
-void
-cmdline_parser_print_help (void)
-{
- cmdline_parser_print_version ();
- printf("\n");
- printf("Purpose:\n");
- printf(" EXPERIMENTAL: Compute Viterbi trellis for a linear label sequence in a transducer\n");
- printf("\n");
-
- printf("Usage: %s [OPTIONS]... LABELID...\n", "gfsmviterbi");
-
- printf("\n");
- printf(" Arguments:\n");
- printf(" LABELID... Input label IDs\n");
-
- printf("\n");
- printf(" Options:\n");
- printf(" -h --help Print help and exit.\n");
- printf(" -V --version Print version and exit.\n");
- printf(" -fFSTFILE --fst=FSTFILE Weighted transducer to apply (default=stdin).\n");
- printf(" -zLEVEL --compress=LEVEL Specify compression level of output file.\n");
- printf(" -FFILE --output=FILE Specifiy output file (default=stdout).\n");
-}
-
-#if !defined(HAVE_STRDUP) && !defined(strdup)
-/* gengetopt_strdup(): automatically generated from strdup.c. */
-/* strdup.c replacement of strdup, which is not standard */
-static char *
-gengetopt_strdup (const char *s)
-{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
-}
-#endif /* HAVE_STRDUP */
-
-/* clear_args(args_info): clears all args & resets to defaults */
-static void
-clear_args(struct gengetopt_args_info *args_info)
-{
- args_info->fst_arg = strdup("-");
- args_info->compress_arg = -1;
- args_info->output_arg = strdup("-");
-}
-
-
-int
-cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
-{
- int c; /* Character of the parsed option. */
- int missing_required_options = 0;
-
- args_info->help_given = 0;
- args_info->version_given = 0;
- args_info->fst_given = 0;
- args_info->compress_given = 0;
- args_info->output_given = 0;
-
- clear_args(args_info);
-
- /* rcfile handling */
-
- /* end rcfile handling */
-
- optarg = 0;
- optind = 1;
- opterr = 1;
- optopt = '?';
-
- while (1)
- {
- int option_index = 0;
- static struct option long_options[] = {
- { "help", 0, NULL, 'h' },
- { "version", 0, NULL, 'V' },
- { "fst", 1, NULL, 'f' },
- { "compress", 1, NULL, 'z' },
- { "output", 1, NULL, 'F' },
- { NULL, 0, NULL, 0 }
- };
- static char short_options[] = {
- 'h',
- 'V',
- 'f', ':',
- 'z', ':',
- 'F', ':',
- '\0'
- };
-
- c = getopt_long (argc, argv, short_options, long_options, &option_index);
-
- if (c == -1) break; /* Exit from 'while (1)' loop. */
-
- if (cmdline_parser_parse_option(c, long_options[option_index].name, optarg, args_info) != 0) {
- exit (EXIT_FAILURE);
- }
- } /* while */
-
-
-
- if ( missing_required_options )
- exit (EXIT_FAILURE);
-
-
- if (optind < argc) {
- int i = 0 ;
- args_info->inputs_num = argc - optind ;
- args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
- while (optind < argc)
- args_info->inputs[ i++ ] = strdup (argv[optind++]) ;
- }
-
- return 0;
-}
-
-
-/* Parse a single option */
-int
-cmdline_parser_parse_option(char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info)
-{
- if (!oshort && !(olong && *olong)) return 1; /* ignore null options */
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "parse_option(): oshort='%c', olong='%s', val='%s'\n", oshort, olong, val);*/
-#endif
-
- switch (oshort)
- {
- case 'h': /* Print help and exit. */
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'V': /* Print version and exit. */
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- break;
-
- case 'f': /* Weighted transducer to apply (default=stdin). */
- if (args_info->fst_given) {
- fprintf(stderr, "%s: `--fst' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->fst_given++;
- if (args_info->fst_arg) free(args_info->fst_arg);
- args_info->fst_arg = strdup(val);
- break;
-
- case 'z': /* Specify compression level of output file. */
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- break;
-
- case 'F': /* Specifiy output file (default=stdout). */
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- break;
-
- case 0: /* Long option(s) with no short form */
- /* Print help and exit. */
- if (strcmp(olong, "help") == 0) {
- if (args_info->help_given) {
- fprintf(stderr, "%s: `--help' (`-h') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_help();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Print version and exit. */
- else if (strcmp(olong, "version") == 0) {
- if (args_info->version_given) {
- fprintf(stderr, "%s: `--version' (`-V') option given more than once\n", PROGRAM);
- }
- clear_args(args_info);
- cmdline_parser_print_version();
- exit(EXIT_SUCCESS);
-
- }
-
- /* Weighted transducer to apply (default=stdin). */
- else if (strcmp(olong, "fst") == 0) {
- if (args_info->fst_given) {
- fprintf(stderr, "%s: `--fst' (`-f') option given more than once\n", PROGRAM);
- }
- args_info->fst_given++;
- if (args_info->fst_arg) free(args_info->fst_arg);
- args_info->fst_arg = strdup(val);
- }
-
- /* Specify compression level of output file. */
- else if (strcmp(olong, "compress") == 0) {
- if (args_info->compress_given) {
- fprintf(stderr, "%s: `--compress' (`-z') option given more than once\n", PROGRAM);
- }
- args_info->compress_given++;
- args_info->compress_arg = (int)atoi(val);
- }
-
- /* Specifiy output file (default=stdout). */
- else if (strcmp(olong, "output") == 0) {
- if (args_info->output_given) {
- fprintf(stderr, "%s: `--output' (`-F') option given more than once\n", PROGRAM);
- }
- args_info->output_given++;
- if (args_info->output_arg) free(args_info->output_arg);
- args_info->output_arg = strdup(val);
- }
-
- else {
- fprintf(stderr, "%s: unknown long option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
- }
- break;
-
- case '?': /* Invalid Option */
- fprintf(stderr, "%s: unknown option '%s'.\n", PROGRAM, olong);
- return (EXIT_FAILURE);
-
-
- default: /* bug: options not considered. */
- fprintf (stderr, "%s: option unknown: %c\n", PROGRAM, oshort);
- abort ();
- } /* switch */
- return 0;
-}
-
-
-/* Initialize options not yet given from environmental defaults */
-void
-cmdline_parser_envdefaults(struct gengetopt_args_info *args_info)
-{
-
-
- return;
-}
-
-
-/* Load option values from an .rc file */
-void
-cmdline_parser_read_rcfile(const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified)
-{
- char *fullname;
- FILE *rcfile;
-
- if (!filename) return; /* ignore NULL filenames */
-
-#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID)
- if (*filename == '~') {
- /* tilde-expansion hack */
- struct passwd *pwent = getpwuid(getuid());
- if (!pwent) {
- fprintf(stderr, "%s: user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- if (!pwent->pw_dir) {
- fprintf(stderr, "%s: home directory for user-id %d not found!\n", PROGRAM, getuid());
- return;
- }
- fullname = (char *)malloc(strlen(pwent->pw_dir)+strlen(filename));
- strcpy(fullname, pwent->pw_dir);
- strcat(fullname, filename+1);
- } else {
- fullname = strdup(filename);
- }
-#else /* !(defined(HAVE_GETUID) && defined(HAVE_GETPWUID)) */
- fullname = strdup(filename);
-#endif /* defined(HAVE_GETUID) && defined(HAVE_GETPWUID) */
-
- /* try to open */
- rcfile = fopen(fullname,"r");
- if (!rcfile) {
- if (user_specified) {
- fprintf(stderr, "%s: warning: open failed for rc-file '%s': %s\n",
- PROGRAM, fullname, strerror(errno));
- }
- }
- else {
- cmdline_parser_read_rc_stream(rcfile, fullname, args_info);
- }
-
- /* cleanup */
- if (fullname != filename) free(fullname);
- if (rcfile) fclose(rcfile);
-
- return;
-}
-
-
-/* Parse option values from an .rc file : guts */
-#define OPTPARSE_GET 32
-void
-cmdline_parser_read_rc_stream(FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info)
-{
- char *optname = (char *)malloc(OPTPARSE_GET);
- char *optval = (char *)malloc(OPTPARSE_GET);
- size_t onsize = OPTPARSE_GET;
- size_t ovsize = OPTPARSE_GET;
- size_t onlen = 0;
- size_t ovlen = 0;
- int lineno = 0;
- char c;
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'):\n", filename);
-#endif
-
- while ((c = fgetc(rcfile)) != EOF) {
- onlen = 0;
- ovlen = 0;
- lineno++;
-
- /* -- get next option-name */
- /* skip leading space and comments */
- if (isspace(c)) continue;
- if (c == '#') {
- while ((c = fgetc(rcfile)) != EOF) {
- if (c == '\n') break;
- }
- continue;
- }
-
- /* parse option-name */
- while (c != EOF && c != '=' && !isspace(c)) {
- /* re-allocate if necessary */
- if (onlen >= onsize-1) {
- char *tmp = (char *)malloc(onsize+OPTPARSE_GET);
- strcpy(tmp,optname);
- free(optname);
-
- onsize += OPTPARSE_GET;
- optname = tmp;
- }
- optname[onlen++] = c;
- c = fgetc(rcfile);
- }
- optname[onlen++] = '\0';
-
-#ifdef cmdline_parser_DEBUG
- fprintf(stderr, "cmdline_parser_read_rc_stream('%s'): line %d: optname='%s'\n",
- filename, lineno, optname);
-#endif
-
- /* -- get next option-value */
- /* skip leading space */
- while ((c = fgetc(rcfile)) != EOF && isspace(c)) {
- ;
- }
-
- /* parse option-value */
- while (c != EOF && c != '\n') {
- /* re-allocate if necessary */
- if (ovlen >= ovsize-1) {
- char *tmp = (char *)malloc(ovsize+OPTPARSE_GET);
- strcpy(tmp,optval);
- free(optval);
- ovsize += OPTPARSE_GET;
- optval = tmp;
- }
- optval[ovlen++] = c;
- c = fgetc(rcfile);
- }
- optval[ovlen++] = '\0';
-
- /* now do the action for the option */
- if (cmdline_parser_parse_option('\0',optname,optval,args_info) != 0) {
- fprintf(stderr, "%s: error in file '%s' at line %d.\n", PROGRAM, filename, lineno);
-
- }
- }
-
- /* cleanup */
- free(optname);
- free(optval);
-
- return;
-}
diff --git a/gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.h b/gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.h
deleted file mode 100644
index d38087d..0000000
--- a/gfsm/gfsm/src/programs/gfsmviterbi_cmdparser.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C -*-
- *
- * File: gfsmviterbi_cmdparser.h
- * Description: Headers for command-line parser struct gengetopt_args_info.
- *
- * File autogenerated by optgen.perl version 0.05.
- *
- */
-
-#ifndef gfsmviterbi_cmdparser_h
-#define gfsmviterbi_cmdparser_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * moocow: Never set PACKAGE and VERSION here.
- */
-
-struct gengetopt_args_info {
- char * fst_arg; /* Weighted transducer to apply (default=stdin). (default=-). */
- int compress_arg; /* Specify compression level of output file. (default=-1). */
- char * output_arg; /* Specifiy output file (default=stdout). (default=-). */
-
- int help_given; /* Whether help was given */
- int version_given; /* Whether version was given */
- int fst_given; /* Whether fst was given */
- int compress_given; /* Whether compress was given */
- int output_given; /* Whether output was given */
-
- char **inputs; /* unnamed arguments */
- unsigned inputs_num; /* number of unnamed arguments */
-};
-
-/* read rc files (if any) and parse all command-line options in one swell foop */
-int cmdline_parser (int argc, char *const *argv, struct gengetopt_args_info *args_info);
-
-/* instantiate defaults from environment variables: you must call this yourself! */
-void cmdline_parser_envdefaults (struct gengetopt_args_info *args_info);
-
-/* read a single rc-file */
-void cmdline_parser_read_rcfile (const char *filename,
- struct gengetopt_args_info *args_info,
- int user_specified);
-
-/* read a single rc-file (stream) */
-void cmdline_parser_read_rc_stream (FILE *rcfile,
- const char *filename,
- struct gengetopt_args_info *args_info);
-
-/* parse a single option */
-int cmdline_parser_parse_option (char oshort, const char *olong, const char *val,
- struct gengetopt_args_info *args_info);
-
-/* print help message */
-void cmdline_parser_print_help(void);
-
-/* print version */
-void cmdline_parser_print_version(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gfsmviterbi_cmdparser_h */
diff --git a/gfsm/gfsm/src/programs/gfsmviterbi_main.c b/gfsm/gfsm/src/programs/gfsmviterbi_main.c
deleted file mode 100644
index 33bb01a..0000000
--- a/gfsm/gfsm/src/programs/gfsmviterbi_main.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- gfsm-utils : finite state automaton utilities
- Copyright (C) 2005 by Bryan Jurish <moocow@ling.uni-potsdam.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <gfsm.h>
-
-#include "gfsmviterbi_cmdparser.h"
-
-/*--------------------------------------------------------------------------
- * Globals
- *--------------------------------------------------------------------------*/
-char *progname = "gfsmviterbi";
-
-//-- options
-struct gengetopt_args_info args;
-
-//-- files
-const char *fstfilename = "-";
-const char *outfilename = "-";
-
-//-- global structs
-gfsmAutomaton *fst = NULL;
-gfsmError *err = NULL;
-
-/*--------------------------------------------------------------------------
- * Option Processing
- *--------------------------------------------------------------------------*/
-void get_my_options(int argc, char **argv)
-{
- if (cmdline_parser(argc, argv, &args) != 0)
- exit(1);
-
- //-- load environmental defaults
- //cmdline_parser_envdefaults(&args);
-
- //-- filenames
- if (args.fst_given) fstfilename = args.fst_arg;
- outfilename = args.output_arg;
-
- //-- load FST
- fst = gfsm_automaton_new();
- if (!gfsm_automaton_load_bin_filename(fst, fstfilename, &err)) {
- g_printerr("%s: load failed for FST file '%s': %s\n", progname, fstfilename, err->message);
- exit(255);
- }
-}
-
-/*--------------------------------------------------------------------------
- * viterbi_labels()
- */
-gfsmAutomaton *viterbi_labels(gfsmAutomaton *fst, int argc, char **argv)
-{
- gfsmLabelVector *vec = g_ptr_array_sized_new(argc);
- char *s=NULL, *tail=NULL;
- gfsmLabelVal lab;
- gfsmAutomaton *trellis = NULL;
- int i;
-
- //-- fill input vector
- for (i=0; i < argc; i++) {
- for (s=argv[i], lab=strtol(s,&tail,0); s != tail; s=tail, lab=strtol(s,&tail,0)) {
- g_ptr_array_add(vec, (gpointer)lab);
- }
- }
-
- //-- actual viterbi lookup
- trellis = gfsm_automaton_lookup_viterbi(fst, vec, trellis);
-
- //-- cleanup
- g_ptr_array_free(vec,TRUE);
-
- return trellis;
-}
-
-/*--------------------------------------------------------------------------
- * MAIN
- *--------------------------------------------------------------------------*/
-int main (int argc, char **argv)
-{
- gfsmAutomaton *trellis;
-
- GFSM_INIT
- get_my_options(argc,argv);
-
- //-- process input
- trellis = viterbi_labels(fst, args.inputs_num, args.inputs);
-
- //-- save output
- if (!gfsm_automaton_save_bin_filename(trellis,outfilename,args.compress_arg,&err)) {
- g_printerr("%s: store failed to '%s': %s\n", progname, outfilename, err->message);
- exit(4);
- }
-
- //-- cleanup
- if (fst) gfsm_automaton_free(fst);
- if (trellis) gfsm_automaton_free(trellis);
-
- GFSM_FINISH
- return 0;
-}
diff --git a/gfsm/gfsm/src/programs/isect1.tfst b/gfsm/gfsm/src/programs/isect1.tfst
deleted file mode 100644
index 5781fec..0000000
--- a/gfsm/gfsm/src/programs/isect1.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 0 0
-1
-1 2 1 1
-2
diff --git a/gfsm/gfsm/src/programs/isect2.tfst b/gfsm/gfsm/src/programs/isect2.tfst
deleted file mode 100644
index d64b6cb..0000000
--- a/gfsm/gfsm/src/programs/isect2.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 0 1 1
-0 1 0 0
-0
-1 1 2 2
-1
diff --git a/gfsm/gfsm/src/programs/lkptest.tfst b/gfsm/gfsm/src/programs/lkptest.tfst
deleted file mode 100644
index 40c6d7a..0000000
--- a/gfsm/gfsm/src/programs/lkptest.tfst
+++ /dev/null
@@ -1,13 +0,0 @@
-0 0 1 2 1
-0 0 2 3 1
-0 0 3 1 1
-0 0
-
-0 1 2 2 1
-1 2 2 2 1
-2 3 3 3 1
-3 0
-
-0 4 1 0 1
-4 5 0 3 1
-5 0
diff --git a/gfsm/gfsm/src/programs/p1.tfst b/gfsm/gfsm/src/programs/p1.tfst
deleted file mode 100644
index 671e9e0..0000000
--- a/gfsm/gfsm/src/programs/p1.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 1 1 1
-0 1 2 2
-1
-1 2 3 3
-2
diff --git a/gfsm/gfsm/src/programs/p2.tfst b/gfsm/gfsm/src/programs/p2.tfst
deleted file mode 100644
index f8fd663..0000000
--- a/gfsm/gfsm/src/programs/p2.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 4 4
-0 1 5 5
-1
diff --git a/gfsm/gfsm/src/programs/prunetest.tfst b/gfsm/gfsm/src/programs/prunetest.tfst
deleted file mode 100644
index 0dc8950..0000000
--- a/gfsm/gfsm/src/programs/prunetest.tfst
+++ /dev/null
@@ -1,6 +0,0 @@
-0 1 1 1 0
-1 2 2 2 0
-0 3 3 3 0
-1 0
-4 5 4 4 0
-5 0
diff --git a/gfsm/gfsm/src/programs/r1.tfst b/gfsm/gfsm/src/programs/r1.tfst
deleted file mode 100644
index f9608f2..0000000
--- a/gfsm/gfsm/src/programs/r1.tfst
+++ /dev/null
@@ -1,9 +0,0 @@
-0 1 1 1
-0 2 0 1
-0 3 1 0
-1 4 4 4
-2 5 5 5
-3 6 6 6
-4
-5
-6
diff --git a/gfsm/gfsm/src/programs/r2.tfst b/gfsm/gfsm/src/programs/r2.tfst
deleted file mode 100644
index a61738d..0000000
--- a/gfsm/gfsm/src/programs/r2.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 24 7
-0 2 7 24
-1 10
-2 20
diff --git a/gfsm/gfsm/src/programs/renumber.tfst b/gfsm/gfsm/src/programs/renumber.tfst
deleted file mode 100644
index b4697b0..0000000
--- a/gfsm/gfsm/src/programs/renumber.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-5 4 43 0 0
-5 1 42 0 0
-7 0
-1 7 1 1 0
-4 7 1 1 0
diff --git a/gfsm/gfsm/src/programs/renumber2.tfst b/gfsm/gfsm/src/programs/renumber2.tfst
deleted file mode 100644
index 1c71c3d..0000000
--- a/gfsm/gfsm/src/programs/renumber2.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-5 1 42 0 0
-5 4 43 0 0
-6 7 1 1 0
-7 0
-0 1 42 0 0
-1 7 1 1 0
-3 4 43 0 0
-4 7 1 1 0
diff --git a/gfsm/gfsm/src/programs/rev1.tfst b/gfsm/gfsm/src/programs/rev1.tfst
deleted file mode 100644
index 5a428b4..0000000
--- a/gfsm/gfsm/src/programs/rev1.tfst
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 0 1 1
-1 2 1 2 12
-2 2 2 2 22
-2 20
-1 3 1 3 13
-3 4 3 4 34
-4 40 \ No newline at end of file
diff --git a/gfsm/gfsm/src/programs/rme.tfst b/gfsm/gfsm/src/programs/rme.tfst
deleted file mode 100644
index 06922fa..0000000
--- a/gfsm/gfsm/src/programs/rme.tfst
+++ /dev/null
@@ -1,6 +0,0 @@
-0 0 0 0 0
-0 1 0 0 1
-1 2 0 0 2
-0 2 0 0 10
-2 3 1 1 3
-3
diff --git a/gfsm/gfsm/src/programs/rme2.tfst b/gfsm/gfsm/src/programs/rme2.tfst
deleted file mode 100644
index b30d66e..0000000
--- a/gfsm/gfsm/src/programs/rme2.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-5 0 0 0 0
-5 3 0 0 0
-6 7 0 0 0
-7 0
-0 1 42 0 0
-1 6 0 0 0
-3 4 43 0 0
-4 6 0 0 0
diff --git a/gfsm/gfsm/src/programs/rme2b.tfst b/gfsm/gfsm/src/programs/rme2b.tfst
deleted file mode 100644
index da2ffd2..0000000
--- a/gfsm/gfsm/src/programs/rme2b.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-5 0 0 0 0
-5 3 0 0 0
-6 7 1 1 0
-7 0
-0 1 42 0 0
-1 6 0 0 0
-3 4 43 0 0
-4 6 0 0 0
diff --git a/gfsm/gfsm/src/programs/rme3.tfst b/gfsm/gfsm/src/programs/rme3.tfst
deleted file mode 100644
index 8235e2b..0000000
--- a/gfsm/gfsm/src/programs/rme3.tfst
+++ /dev/null
@@ -1,5 +0,0 @@
-0 1 42 0
-0 2 43 0
-1 3 0 0 0
-2 3 0 0 0
-3 0
diff --git a/gfsm/gfsm/src/programs/sort.tfst b/gfsm/gfsm/src/programs/sort.tfst
deleted file mode 100644
index a5bb1c7..0000000
--- a/gfsm/gfsm/src/programs/sort.tfst
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 1 2 1
-0 1 2 1 2
-0 1 2 2 3
-0 1 1 2 3
-0 1 2 1 2
-0 1 2 2 1
-1
diff --git a/gfsm/gfsm/src/programs/sortme.tfst b/gfsm/gfsm/src/programs/sortme.tfst
deleted file mode 100644
index d48ea71..0000000
--- a/gfsm/gfsm/src/programs/sortme.tfst
+++ /dev/null
@@ -1,15 +0,0 @@
-0 1 1 10 10.0
-0 1 2 10 10.0
-0 1 1 20 10.0
-0 1 2 20 10.0
-0 1 3 10 10.0
-0 1 3 20 10.0
-0 1 3 30 10.0
-0 1 4 40 1.0
-0 1 4 40 2.0
-0 1 4 40 3.0
-0 0 5 50 10.0
-0 0 5 50 10.0
-0 0 5 50 10.0
-0 0.0
-1 0.0
diff --git a/gfsm/gfsm/src/programs/symtest.lab b/gfsm/gfsm/src/programs/symtest.lab
deleted file mode 100644
index 4d677d5..0000000
--- a/gfsm/gfsm/src/programs/symtest.lab
+++ /dev/null
@@ -1,15 +0,0 @@
-<epsilon> 0
-a 1
-b 2
-c 3
-A 4
-B 5
-C 6
-acc 7
-dat 8
-sg 9
-pl 10
-_NOUN 11
-_Case 12
-_Number 13
-_VERB 14
diff --git a/gfsm/gfsm/src/programs/symtest.sym b/gfsm/gfsm/src/programs/symtest.sym
deleted file mode 100644
index f151932..0000000
--- a/gfsm/gfsm/src/programs/symtest.sym
+++ /dev/null
@@ -1,8 +0,0 @@
-Lower a b c
-Upper A B C
-
-Case acc dat
-Number sg pl
-
-Category: NOUN Case Number
-Category: VERB Number
diff --git a/gfsm/gfsm/src/programs/test+lab.tfst b/gfsm/gfsm/src/programs/test+lab.tfst
deleted file mode 100644
index 252d6a6..0000000
--- a/gfsm/gfsm/src/programs/test+lab.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 a b 0
-1 2 c d 0
-2 0
diff --git a/gfsm/gfsm/src/programs/test-rn.tfst b/gfsm/gfsm/src/programs/test-rn.tfst
deleted file mode 100644
index 694ddcd..0000000
--- a/gfsm/gfsm/src/programs/test-rn.tfst
+++ /dev/null
@@ -1,8 +0,0 @@
-0 1 1 1 0
-0 0
-1 0
-2 0
-3 0
-4
-5
-6
diff --git a/gfsm/gfsm/src/programs/test.lab b/gfsm/gfsm/src/programs/test.lab
deleted file mode 100644
index b7c05ae..0000000
--- a/gfsm/gfsm/src/programs/test.lab
+++ /dev/null
@@ -1,15 +0,0 @@
-<eps> 0
-a 1
-b 2
-c 3
-d 4
-e 5
-f 6
-fourtwenty 420
-twentyfour 24
-seven 7
-( 10
-) 11
-FOO 12
-BAR 13
-BAZ 14
diff --git a/gfsm/gfsm/src/programs/test.tfst b/gfsm/gfsm/src/programs/test.tfst
deleted file mode 100644
index 02acee3..0000000
--- a/gfsm/gfsm/src/programs/test.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 420 24 0.7
-1 2 0 0 99
-2
diff --git a/gfsm/gfsm/src/programs/test2.tfst b/gfsm/gfsm/src/programs/test2.tfst
deleted file mode 100644
index 37fe96a..0000000
--- a/gfsm/gfsm/src/programs/test2.tfst
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 1 3 .042
-0 2 2 2 .24
-0 3 3 1 .07
-1
-2
-3
-
diff --git a/gfsm/gfsm/src/programs/test3.tfst b/gfsm/gfsm/src/programs/test3.tfst
deleted file mode 100644
index 669bfc9..0000000
--- a/gfsm/gfsm/src/programs/test3.tfst
+++ /dev/null
@@ -1,6 +0,0 @@
-0 1 1 1 100
-0 4 4 4 400
-1 2 2 2 200
-2 3 3 3 300
-3 0
-4 0
diff --git a/gfsm/gfsm/src/programs/test4.tfst b/gfsm/gfsm/src/programs/test4.tfst
deleted file mode 100644
index 44d5c9e..0000000
--- a/gfsm/gfsm/src/programs/test4.tfst
+++ /dev/null
@@ -1,9 +0,0 @@
-0 1 0 0 0
-0 1 0 0 1
-0 1 0 1 0
-0 1 0 1 1
-0 1 1 0 0
-0 1 1 0 1
-0 1 1 1 0
-0 1 1 1 1
-1
diff --git a/gfsm/gfsm/src/programs/test4b.tfst b/gfsm/gfsm/src/programs/test4b.tfst
deleted file mode 100644
index 8890ba6..0000000
--- a/gfsm/gfsm/src/programs/test4b.tfst
+++ /dev/null
@@ -1,9 +0,0 @@
-0 1 1 1 1
-0 1 1 1 0
-0 1 1 0 1
-0 1 1 0 0
-0 1 0 1 1
-0 1 0 1 0
-0 1 0 0 1
-0 1 0 0 0
-1 \ No newline at end of file
diff --git a/gfsm/gfsm/src/programs/test5.tfst b/gfsm/gfsm/src/programs/test5.tfst
deleted file mode 100644
index ac8c248..0000000
--- a/gfsm/gfsm/src/programs/test5.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-0 1 1 1 0
-1 2 2 2 0
-2 0
diff --git a/gfsm/gfsm/src/programs/test6.tfst b/gfsm/gfsm/src/programs/test6.tfst
deleted file mode 100644
index 4c306da..0000000
--- a/gfsm/gfsm/src/programs/test6.tfst
+++ /dev/null
@@ -1,12 +0,0 @@
-0 1 0 0 0
-0 2 0 0 0
-0 3 0 0 0
-3 4 0 0 0
-1 10 1 1 0
-2 20 2 2 0
-4 5 4 4 0
-4 1 4 4 1
-10
-20
-5
-
diff --git a/gfsm/gfsm/src/programs/test7.lab b/gfsm/gfsm/src/programs/test7.lab
deleted file mode 100644
index 0cedd17..0000000
--- a/gfsm/gfsm/src/programs/test7.lab
+++ /dev/null
@@ -1,4 +0,0 @@
-<eps> 0
-a 1
-b 2
-c 3
diff --git a/gfsm/gfsm/src/programs/test7.tfst b/gfsm/gfsm/src/programs/test7.tfst
deleted file mode 100644
index c96f7e6..0000000
--- a/gfsm/gfsm/src/programs/test7.tfst
+++ /dev/null
@@ -1,2 +0,0 @@
-0 1 1 1 0
-1 0
diff --git a/gfsm/gfsm/src/programs/test8.tfst b/gfsm/gfsm/src/programs/test8.tfst
deleted file mode 100644
index 9009985..0000000
--- a/gfsm/gfsm/src/programs/test8.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 1 1 1 0
-0 2 2 2 0
-1 0
-2 0
diff --git a/gfsm/gfsm/src/programs/test9.tfst b/gfsm/gfsm/src/programs/test9.tfst
deleted file mode 100644
index 47867d2..0000000
--- a/gfsm/gfsm/src/programs/test9.tfst
+++ /dev/null
@@ -1,4 +0,0 @@
-0 0
-1 0
-2 0
-3 0
diff --git a/gfsm/gfsm/src/programs/testa.tfsa b/gfsm/gfsm/src/programs/testa.tfsa
deleted file mode 100644
index f2926c5..0000000
--- a/gfsm/gfsm/src/programs/testa.tfsa
+++ /dev/null
@@ -1,6 +0,0 @@
-0 0 0
-0 1 1 10
-0
-1 2 2 20
-1 100
-2 200
diff --git a/gfsm/gfsm/src/programs/testa.tfst b/gfsm/gfsm/src/programs/testa.tfst
deleted file mode 100644
index 1078be4..0000000
--- a/gfsm/gfsm/src/programs/testa.tfst
+++ /dev/null
@@ -1,6 +0,0 @@
-0 0 0
-0 1 1 1
-0
-1 2 2 2 20
-1 100
-2 200
diff --git a/gfsm/gfsm/src/programs/testrn.tfst b/gfsm/gfsm/src/programs/testrn.tfst
deleted file mode 100644
index 0bcf201..0000000
--- a/gfsm/gfsm/src/programs/testrn.tfst
+++ /dev/null
@@ -1,3 +0,0 @@
-300 100 1 1
-100 200 2 2
-200 0
diff --git a/gfsm/gfsm/src/programs/vit-in.lab b/gfsm/gfsm/src/programs/vit-in.lab
deleted file mode 100644
index 5c74e25..0000000
--- a/gfsm/gfsm/src/programs/vit-in.lab
+++ /dev/null
@@ -1,3 +0,0 @@
-<eps> 0
-a 1
-b 2
diff --git a/gfsm/gfsm/src/programs/vit-out.lab b/gfsm/gfsm/src/programs/vit-out.lab
deleted file mode 100644
index bd1493c..0000000
--- a/gfsm/gfsm/src/programs/vit-out.lab
+++ /dev/null
@@ -1,7 +0,0 @@
-<eps> 0
-a_A 1
-a_B 2
-b_A 3
-b_B 4
-<eps>_A 5
-<eps>_B 6
diff --git a/gfsm/gfsm/src/programs/vit-q.lab b/gfsm/gfsm/src/programs/vit-q.lab
deleted file mode 100644
index 0fbd83b..0000000
--- a/gfsm/gfsm/src/programs/vit-q.lab
+++ /dev/null
@@ -1,3 +0,0 @@
-<BOS> 0
-A 1
-B 2
diff --git a/gfsm/gfsm/src/programs/vit.tfst b/gfsm/gfsm/src/programs/vit.tfst
deleted file mode 100644
index e92ec55..0000000
--- a/gfsm/gfsm/src/programs/vit.tfst
+++ /dev/null
@@ -1,17 +0,0 @@
-<BOS> A a a_A 1
-<BOS> A b b_A 1
-<BOS> B a a_B 1
-<BOS> B b b_B 1
-<BOS> 1
-
-A A a a_A .4
-A A b b_A .3
-A B a a_B .2
-A B b b_B .1
-A 1
-
-B B b b_B .4
-B A a a_A .3
-B A b b_A .2
-B B a a_B .1
-B 1
diff --git a/gfsm/gfsm/src/programs/vit2.tfst b/gfsm/gfsm/src/programs/vit2.tfst
deleted file mode 100644
index 879b3a1..0000000
--- a/gfsm/gfsm/src/programs/vit2.tfst
+++ /dev/null
@@ -1,15 +0,0 @@
-<BOS> A <eps> <eps>_A .4
-<BOS> A a a_A .3
-<BOS> B <eps> <eps>_B .2
-<BOS> B b b_B .1
-<BOS> 1
-
-A A a a_A .7
-A B <eps> <eps>_B .2
-A B b b_B .1
-A 1
-
-B B b b_B .7
-B A a a_A .2
-B A <eps> <eps>_A .1
-B 1