The m2 tools have been changed to emit Sphinx output.
pge has also been rebuilt.
gcc/m2/ChangeLog:
* gcc/m2/Make-lang.in: Introduced rst rules for
subcomponents: gm2-libs.rst, gm2-ebnf.rst
SYSTEM-pim.rst, SYSTEM-iso.rst and Builtins.rst.
* gcc/m2/Make-maintainer.in: Added pge-clean rule.
* gcc/m2/gm2-compiler/ppg.mod: Introduced new option
-x for sphinx output. Implemented ebnf pretty printing.
* gcc/m2/tools-src/def2doc.py: Introduced state class
to ensure that the rst block is only changed if
necessary.
* gcc/m2/pge-boot/GASCII.c: Rebuilt.
* gcc/m2/pge-boot/GArgs.c: Rebuilt.
* gcc/m2/pge-boot/GAssertion.c: Rebuilt.
* gcc/m2/pge-boot/GDebug.c: Rebuilt.
* gcc/m2/pge-boot/GDynamicStrings.c: Rebuilt.
* gcc/m2/pge-boot/GFIO.c: Rebuilt.
* gcc/m2/pge-boot/GIO.c: Rebuilt.
* gcc/m2/pge-boot/GIndexing.c: Rebuilt.
* gcc/m2/pge-boot/GLists.c: Rebuilt.
* gcc/m2/pge-boot/GM2Dependent.c: Rebuilt.
* gcc/m2/pge-boot/GM2EXCEPTION.c: Rebuilt.
* gcc/m2/pge-boot/GM2RTS.c: Rebuilt.
* gcc/m2/pge-boot/GNameKey.c: Rebuilt.
* gcc/m2/pge-boot/GNumberIO.c: Rebuilt.
* gcc/m2/pge-boot/GOutput.c: Rebuilt.
* gcc/m2/pge-boot/GPushBackInput.c: Rebuilt.
* gcc/m2/pge-boot/GRTExceptions.c: Rebuilt.
* gcc/m2/pge-boot/GSFIO.c: Rebuilt.
* gcc/m2/pge-boot/GStdIO.c: Rebuilt.
* gcc/m2/pge-boot/GStorage.c: Rebuilt.
* gcc/m2/pge-boot/GStrCase.c: Rebuilt.
* gcc/m2/pge-boot/GStrIO.c: Rebuilt.
* gcc/m2/pge-boot/GStrLib.c: Rebuilt.
* gcc/m2/pge-boot/GSymbolKey.c: Rebuilt.
* gcc/m2/pge-boot/GSysStorage.c: Rebuilt.
* gcc/m2/pge-boot/Gbnflex.c: Rebuilt.
* gcc/m2/pge-boot/Gpge.c: Rebuilt.
* gcc/m2/pge-boot/main.c: Rebuilt.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
m2/SYSTEM-iso.texi \
m2/Builtins.texi
+RSTSRC = $(objdir)/m2/images/gnu.eps \
+ $(srcdir)/doc/gm2.texi \
+ m2/gm2-libs.rst \
+ m2/gm2-ebnf.rst \
+ m2/SYSTEM-pim.rst \
+ m2/SYSTEM-iso.rst \
+ m2/Builtins.rst
+
# Define the names for selecting modula-2 in LANGUAGES.
m2 modula-2 modula2: gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext) \
$(GCC_PASSES) $(GCC_PARTS)
m2.start.encap: gm2$(exeext) plugin/m2rte$(exeext).so
m2.rest.encap:
-m2.info: doc/m2.info
+# Documentation.
+
+doc/m2/info/texinfo/gm2.info: $(SPHINX_FILES)
+ + if [ x$(HAS_SPHINX_BUILD) = xhas-sphinx-build ]; then \
+ make -C $(srcdir)/../doc info SOURCEDIR=$(abs_srcdir)/m2/doc/ BUILDDIR=$(objdir)/doc/gm2/info SPHINXBUILD=$(SPHINX_BUILD); \
+ else true; fi
+
+doc/m2/pdf/latex/gm2.pdf: $(SPHINX_FILES)
+ + make -C $(srcdir)/../doc latexpdf SOURCEDIR=$(abs_srcdir)/m2/doc/ BUILDDIR=$(objdir)/doc/gm2/pdf SPHINXBUILD=$(SPHINX_BUILD)
+
+doc/m2/html/html/index.html: $(SPHINX_FILES)
+ + make -C $(srcdir)/../doc html SOURCEDIR=$(abs_srcdir)/m2/doc/ BUILDDIR=$(objdir)/doc/gm2/html SPHINXBUILD=$(SPHINX_BUILD)
-m2.man: doc/m2.1
+m2.man: doc/m2/man/man/gm2.1
+
+m2.srcman: doc/m2/man/man/gm2.1
+ -cp -p $^ $(srcdir)/doc
+
+doc/m2/man/man/gm2.1: $(SPHINX_FILES)
+ + make -C $(srcdir)/../doc man SOURCEDIR=$(abs_srcdir)/m2/doc BUILDDIR=$(objdir)/doc/m2/man SPHINXBUILD=$(SPHINX_BUILD)
+
+# m2.info: doc/m2.info
+
+# m2.man: doc/m2.1
m2.install-man: $(DESTDIR)$(man1dir)/$(GM2_INSTALL_NAME)$(man1ext)
m2.pdf: m2.ps
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$@ $<
+m2.doc: $(RSTSRC)
+
.INTERMEDIATE: gm2.pod
m2.pod: doc/gm2.texi $(TEXISRC)
pngtopnm $< | pnmtops -noturn > $@ ; \
fi
+# gm2-libs.texi
+
m2/gm2-libs.texi: gm2-libs.texi-check; @true
ifeq ($(HAVE_PYTHON),yes)
gm2-libs.texi-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
- $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def m2/gm2-ebnf.texi
+ $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.texi
$(STAMP) gm2-libs.texi-check
else
touch $(objdir)/m2/gm2-libs.texi
endif
+# gm2-libs.rst
+
+m2/gm2-libs.rst: gm2-libs.rst-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+gm2-libs.rst-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
+ $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
+ $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.rst
+ $(STAMP) gm2-libs.rst-check
+else
+gm2-libs.rst-check:
+ echo "not building gm2-libs.rst as python3 has not been found"
+ touch $(objdir)/m2/gm2-libs.rst
+endif
+
+# gm2-ebnf.texi
+
m2/gm2-ebnf.texi: gm2-ebnf.texi-check; @true
gm2-ebnf.texi-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
- $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf > m2/gm2-ebnf.texi
+ $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.texi
$(STAMP) gm2-ebnf.texi-check
+# gm2-ebnf.rst
+
+m2/gm2-ebnf.rst: gm2-ebnf.rst-check; @true
+
+gm2-ebnf.rst-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
+ $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.rst
+ $(STAMP) gm2-ebnf.rst-check
+
+# SYSTEM-pim.texi
+
m2/SYSTEM-pim.texi: SYSTEM-pim-texi-check; @true
ifeq ($(HAVE_PYTHON),yes)
touch $(objdir)/m2/SYSTEM-pim.texi
endif
+# SYSTEM-pim.rst
+
+m2/SYSTEM-pim.rst: SYSTEM-pim-rst-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
+ $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.rst
+ $(STAMP) SYSTEM-pim-rst-check
+else
+SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
+ echo "not building SYSTEM-pim.rst as python3 has not been found"
+ touch $(objdir)/m2/SYSTEM-pim.rst
+endif
+
+# SYSTEM-pim.texi
+
m2/SYSTEM-iso.texi: SYSTEM-iso.texi-check; @true
ifeq ($(HAVE_PYTHON),yes)
touch $(objdir)/m2/SYSTEM-iso.texi
endif
+# SYSTEM-pim.rst
+
+m2/SYSTEM-iso.rst: SYSTEM-iso.rst-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+SYSTEM-iso.rst-check: $(objdir)/m2/gm2-libs-iso/SYSTEM.def
+ $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.rst
+ $(STAMP) SYSTEM-iso.rst-check
+else
+SYSTEM-iso.rst-check: $(objdir)/m2/gm2-libs-iso/SYSTEM.def
+ echo "not building SYSTEM-iso.rst as python3 has not been found"
+ touch $(objdir)/m2/SYSTEM-iso.rst
+endif
+
+# m2/Builtins.texi
+
m2/Builtins.texi: Builtins.texi-check; @true
ifeq ($(HAVE_PYTHON),yes)
touch $(objdir)/m2/Builtins.texi
endif
+# m2/Builtins.rst
+
+m2/Builtins.rst: Builtins.rst-check; @true
+
+ifeq ($(HAVE_PYTHON),yes)
+Builtins.rst-check: m2/gm2-libs/Builtins.def
+ $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.rst
+ $(STAMP) Builtins.rst-check
+else
+Builtins.rst-check: m2/gm2-libs/Builtins.def
+ echo "not building SYSTEM-iso.rst as python3 has not been found"
+ touch $(objdir)/m2/Builtins.rst
+endif
+
$(objdir)/m2/gm2-compiler-boot:
test -d $@ || mkdir $@
# Remove pge build files.
pge-clean: force
+ $(RM) -f m2/gm2-pg-boot/* m2/gm2-ppg-boot/* m2/gm2-pge-boot/*
# The rest of the Make-lang.in handles the bootstrap tool (maintained
PrettyPrint,
EmitCode,
Texinfo,
+ Sphinx,
FreeDocLicense,
Debugging,
WasNoError : BOOLEAN ;
IF Texinfo
THEN
Output.WriteString('@example') ; NewLine(0)
+ ELSIF Sphinx
+ THEN
+ Output.WriteString('.. code-block:: ebnf') ; NewLine(0)
END ;
Output.WriteKey(GetDefinitionName(p)) ;
Output.WriteString(' := ') ;
THEN
Output.WriteString('@findex ') ; Output.WriteKey(GetDefinitionName(p)) ; Output.WriteString(' (ebnf)') ; NewLine(0) ;
Output.WriteString('@end example') ; NewLine(0)
+ ELSIF Sphinx
+ THEN
+ Output.WriteString('.. index::') ; NewLine(0) ;
+ Output.WriteString(' pair: ') ; Output.WriteKey(GetDefinitionName(p)) ; Output.WriteString('; (ebnf)') ; NewLine(0)
END ;
NewLine(0)
END
PROCEDURE DisplayHelp ;
BEGIN
- WriteString('Usage: ppg [-l] [-c] [-d] [-e] [-k] [-t] [-k] [-p] [-t] [-f] [-o outputfile] filename') ; WriteLn ;
+ WriteString('Usage: ppg [-l] [-c] [-d] [-e] [-k] [-t] [-k] [-p] [-x] [-f] [-o outputfile] filename') ; WriteLn ;
WriteString(' -l suppress file and line source information') ; WriteLn ;
WriteString(' -c do not generate any Modula-2 code within the parser rules') ; WriteLn ;
WriteString(' -h or --help generate this help message') ; WriteLn ;
WriteString(' -d generate internal debugging information') ; WriteLn ;
WriteString(' -p only display the ebnf rules') ; WriteLn ;
WriteString(' -t generate texinfo formating for pretty printing (-p)') ; WriteLn ;
+ WriteString(' -x generate sphinx formating for pretty printing (-p)') ; WriteLn ;
WriteString(' -f generate GNU Free Documentation header before pretty printing in texinfo') ; WriteLn ;
WriteString(' -o write output to filename') ; WriteLn ;
exit (0)
ELSIF StrEqual(ArgName, '-t')
THEN
Texinfo := TRUE
+ ELSIF StrEqual(ArgName, '-x')
+ THEN
+ Sphinx := TRUE
ELSIF StrEqual(ArgName, '-f')
THEN
FreeDocLicense := TRUE
BEGIN
WasNoError := TRUE ;
Texinfo := FALSE ;
+ Sphinx := FALSE ;
FreeDocLicense := FALSE ;
EmitCode := TRUE ;
LargestValue := 0 ;
# define ASCII_del (char) 0177
# define ASCII_EOL ASCII_nl
-extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_ASCII_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_ASCII_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
# define MaxArgs 255
# define MaxString 4096
-typedef struct _T2_a _T2;
+typedef struct Args__T2_a Args__T2;
-typedef _T2 *_T1;
+typedef Args__T2 *Args__T1;
-typedef struct _T3_a _T3;
+typedef struct Args__T3_a Args__T3;
-struct _T2_a { _T3 * array[MaxArgs+1]; };
-struct _T3_a { char array[MaxString+1]; };
-static _T1 Source;
+struct Args__T2_a { Args__T3 * array[MaxArgs+1]; };
+struct Args__T3_a { char array[MaxString+1]; };
+static Args__T1 Source;
/*
GetArg - returns the nth argument from the command line.
High = _a_high;
if (i < (UnixArgs_GetArgC ()))
{
- Source = static_cast<_T1> (UnixArgs_GetArgV ());
+ Source = static_cast<Args__T1> (UnixArgs_GetArgV ());
while (((*(*Source).array[i]).array[j] != ASCII_nul) && (j < High))
{
a[j] = (*(*Source).array[i]).array[j];
__builtin_unreachable ();
}
-extern "C" void _M2_Args_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Args_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_Args_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Args_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
}
}
-extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_Assertion_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Assertion_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, unsigned int LineNo, const char *Module_, unsigned int _Module_high)
{
- typedef struct _T1_a _T1;
+ typedef struct Halt__T1_a Halt__T1;
- struct _T1_a { char array[MaxNoOfDigits+1]; };
- _T1 No;
+ struct Halt__T1_a { char array[MaxNoOfDigits+1]; };
+ Halt__T1 No;
char Message[_Message_high+1];
char Module[_Module_high+1];
}
}
-extern "C" void _M2_Debug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Debug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_Debug_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Debug_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
# define DebugOn FALSE
# define CheckOn FALSE
# define TraceOn FALSE
-typedef struct Contents_r Contents;
+typedef struct DynamicStrings_Contents_r DynamicStrings_Contents;
-typedef struct DebugInfo_r DebugInfo;
+typedef struct DynamicStrings_DebugInfo_r DynamicStrings_DebugInfo;
-typedef struct stringRecord_r stringRecord;
+typedef struct DynamicStrings_stringRecord_r DynamicStrings_stringRecord;
-typedef struct descriptor_r descriptor;
+typedef struct DynamicStrings_descriptor_r DynamicStrings_descriptor;
-typedef descriptor *Descriptor;
+typedef DynamicStrings_descriptor *DynamicStrings_Descriptor;
-typedef struct frameRec_r frameRec;
+typedef struct DynamicStrings_frameRec_r DynamicStrings_frameRec;
-typedef frameRec *frame;
+typedef DynamicStrings_frameRec *DynamicStrings_frame;
-typedef struct _T3_a _T3;
+typedef struct DynamicStrings__T3_a DynamicStrings__T3;
-typedef enum {inuse, marked, onlist, poisoned} desState;
+typedef enum {DynamicStrings_inuse, DynamicStrings_marked, DynamicStrings_onlist, DynamicStrings_poisoned} DynamicStrings_desState;
-typedef stringRecord *DynamicStrings_String;
+typedef DynamicStrings_stringRecord *DynamicStrings_String;
-struct DebugInfo_r {
- DynamicStrings_String next;
- void *file;
- unsigned int line;
- void *proc;
- };
+struct DynamicStrings_DebugInfo_r {
+ DynamicStrings_String next;
+ void *file;
+ unsigned int line;
+ void *proc;
+ };
-struct descriptor_r {
- unsigned int charStarUsed;
- void *charStar;
- unsigned int charStarSize;
- unsigned int charStarValid;
- desState state;
- DynamicStrings_String garbage;
- };
+struct DynamicStrings_descriptor_r {
+ unsigned int charStarUsed;
+ void *charStar;
+ unsigned int charStarSize;
+ unsigned int charStarValid;
+ DynamicStrings_desState state;
+ DynamicStrings_String garbage;
+ };
-struct frameRec_r {
- DynamicStrings_String alloc;
- DynamicStrings_String dealloc;
- frame next;
- };
+struct DynamicStrings_frameRec_r {
+ DynamicStrings_String alloc;
+ DynamicStrings_String dealloc;
+ DynamicStrings_frame next;
+ };
-struct _T3_a { char array[(MaxBuf-1)+1]; };
-struct Contents_r {
- _T3 buf;
- unsigned int len;
- DynamicStrings_String next;
- };
+struct DynamicStrings__T3_a { char array[(MaxBuf-1)+1]; };
+struct DynamicStrings_Contents_r {
+ DynamicStrings__T3 buf;
+ unsigned int len;
+ DynamicStrings_String next;
+ };
-struct stringRecord_r {
- Contents contents;
- Descriptor head;
- DebugInfo debug;
- };
+struct DynamicStrings_stringRecord_r {
+ DynamicStrings_Contents contents;
+ DynamicStrings_Descriptor head;
+ DynamicStrings_DebugInfo debug;
+ };
static unsigned int Initialized;
-static frame frameHead;
+static DynamicStrings_frame frameHead;
static DynamicStrings_String captured;
/*
total length of, a. The offset is in, o.
*/
-static void ConcatContents (Contents *c, const char *a_, unsigned int _a_high, unsigned int h, unsigned int o);
+static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned int _a_high, unsigned int h, unsigned int o);
/*
DeallocateCharStar - deallocates any charStar.
total length of, a.
*/
-static void ConcatContentsAddress (Contents *c, void * a, unsigned int h);
+static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigned int h);
/*
AddToGarbage - adds String, b, onto the garbage list of, a. Providing
writeString ((const char *) " ", 1);
switch (s->head->state)
{
- case inuse:
+ case DynamicStrings_inuse:
writeString ((const char *) "still in use (", 14);
writeCard (s->contents.len);
writeString ((const char *) ") characters", 12);
break;
- case marked:
+ case DynamicStrings_marked:
writeString ((const char *) "marked", 6);
break;
- case onlist:
+ case DynamicStrings_onlist:
writeString ((const char *) "on a (lost) garbage list", 24);
break;
- case poisoned:
+ case DynamicStrings_poisoned:
writeString ((const char *) "poisoned", 8);
break;
static unsigned int IsOnAllocated (DynamicStrings_String s)
{
- frame f;
+ DynamicStrings_frame f;
Init ();
f = frameHead;
static unsigned int IsOnDeallocated (DynamicStrings_String s)
{
- frame f;
+ DynamicStrings_frame f;
Init ();
f = frameHead;
static void SubAllocated (DynamicStrings_String s)
{
- frame f;
+ DynamicStrings_frame f;
Init ();
f = frameHead;
static void SubDeallocated (DynamicStrings_String s)
{
- frame f;
+ DynamicStrings_frame f;
Init ();
f = frameHead;
total length of, a. The offset is in, o.
*/
-static void ConcatContents (Contents *c, const char *a_, unsigned int _a_high, unsigned int h, unsigned int o)
+static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned int _a_high, unsigned int h, unsigned int o)
{
unsigned int i;
char a[_a_high+1];
if (o < h)
{
(*c).len = MaxBuf;
- Storage_ALLOCATE ((void **) &(*c).next, sizeof (stringRecord));
+ Storage_ALLOCATE ((void **) &(*c).next, sizeof (DynamicStrings_stringRecord));
(*c).next->head = NULL;
(*c).next->contents.len = 0;
(*c).next->contents.next = NULL;
ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o);
AddDebugInfo ((*c).next);
- (*c).next = AssignDebug ((*c).next, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 722, (const char *) "ConcatContents", 14);
+ (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 722, (const char *) "ConcatContents", 14);
}
else
{
static DynamicStrings_String CheckPoisoned (DynamicStrings_String s)
{
- if (((PoisonOn && (s != NULL)) && (s->head != NULL)) && (s->head->state == poisoned))
+ if (((PoisonOn && (s != NULL)) && (s->head != NULL)) && (s->head->state == DynamicStrings_poisoned))
{
M2RTS_HALT (-1);
__builtin_unreachable ();
total length of, a.
*/
-static void ConcatContentsAddress (Contents *c, void * a, unsigned int h)
+static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigned int h)
{
- typedef char *_T1;
+ typedef char *ConcatContentsAddress__T1;
- _T1 p;
+ ConcatContentsAddress__T1 p;
unsigned int i;
unsigned int j;
j = 0;
i = (*c).len;
- p = static_cast<_T1> (a);
+ p = static_cast<ConcatContentsAddress__T1> (a);
while ((j < h) && (i < MaxBuf))
{
(*c).buf.array[i] = (*p);
{
/* avoid dangling else. */
(*c).len = MaxBuf;
- Storage_ALLOCATE ((void **) &(*c).next, sizeof (stringRecord));
+ Storage_ALLOCATE ((void **) &(*c).next, sizeof (DynamicStrings_stringRecord));
(*c).next->head = NULL;
(*c).next->contents.len = 0;
(*c).next->contents.next = NULL;
AddDebugInfo ((*c).next);
if (TraceOn)
{
- (*c).next = AssignDebug ((*c).next, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 917, (const char *) "ConcatContentsAddress", 21);
+ (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 917, (const char *) "ConcatContentsAddress", 21);
}
}
else
writeString('warning trying to add to a marked string') ; writeLn
END ;
*/
- if (((((a != b) && (a != NULL)) && (b != NULL)) && (b->head->state == marked)) && (a->head->state == inuse))
+ if (((((a != b) && (a != NULL)) && (b != NULL)) && (b->head->state == DynamicStrings_marked)) && (a->head->state == DynamicStrings_inuse))
{
c = a;
while (c->head->garbage != NULL)
c = c->head->garbage;
}
c->head->garbage = b;
- b->head->state = onlist;
+ b->head->state = DynamicStrings_onlist;
if (CheckOn)
{
SubDebugInfo (b);
{
switch (s->head->state)
{
- case inuse:
+ case DynamicStrings_inuse:
writeString ((const char *) "still in use (", 14);
writeCard (s->contents.len);
writeString ((const char *) ") characters", 12);
break;
- case marked:
+ case DynamicStrings_marked:
writeString ((const char *) "marked", 6);
break;
- case onlist:
+ case DynamicStrings_onlist:
writeString ((const char *) "on a garbage list", 17);
break;
- case poisoned:
+ case DynamicStrings_poisoned:
writeString ((const char *) "poisoned", 8);
break;
/* make a local copy of each unbounded array. */
memcpy (a, a_, _a_high+1);
- Storage_ALLOCATE ((void **) &s, sizeof (stringRecord));
+ Storage_ALLOCATE ((void **) &s, sizeof (DynamicStrings_stringRecord));
s->contents.len = 0;
s->contents.next = NULL;
ConcatContents (&s->contents, (const char *) a, _a_high, StrLib_StrLen ((const char *) a, _a_high), 0);
- Storage_ALLOCATE ((void **) &s->head, sizeof (descriptor));
+ Storage_ALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor));
s->head->charStarUsed = FALSE;
s->head->charStar = NULL;
s->head->charStarSize = 0;
s->head->charStarValid = FALSE;
s->head->garbage = NULL;
- s->head->state = inuse;
+ s->head->state = DynamicStrings_inuse;
AddDebugInfo (s);
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 758, (const char *) "InitString", 10);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 758, (const char *) "InitString", 10);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
}
if (s->head != NULL)
{
- s->head->state = poisoned;
+ s->head->state = DynamicStrings_poisoned;
s->head->garbage = DynamicStrings_KillString (s->head->garbage);
if (! PoisonOn)
{
}
if (! PoisonOn)
{
- Storage_DEALLOCATE ((void **) &s->head, sizeof (descriptor));
+ Storage_DEALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor));
s->head = NULL;
}
}
t = DynamicStrings_KillString (s->contents.next);
if (! PoisonOn)
{
- Storage_DEALLOCATE ((void **) &s, sizeof (stringRecord));
+ Storage_DEALLOCATE ((void **) &s, sizeof (DynamicStrings_stringRecord));
}
}
return NULL;
{
DynamicStrings_String s;
- Storage_ALLOCATE ((void **) &s, sizeof (stringRecord));
+ Storage_ALLOCATE ((void **) &s, sizeof (DynamicStrings_stringRecord));
s->contents.len = 0;
s->contents.next = NULL;
if (a != NULL)
{
ConcatContentsAddress (&s->contents, a, static_cast<unsigned int> (libc_strlen (a)));
}
- Storage_ALLOCATE ((void **) &s->head, sizeof (descriptor));
+ Storage_ALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor));
s->head->charStarUsed = FALSE;
s->head->charStar = NULL;
s->head->charStarSize = 0;
s->head->charStarValid = FALSE;
s->head->garbage = NULL;
- s->head->state = inuse;
+ s->head->state = DynamicStrings_inuse;
AddDebugInfo (s);
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 957, (const char *) "InitStringCharStar", 18);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 957, (const char *) "InitStringCharStar", 18);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch)
{
- typedef struct _T4_a _T4;
+ typedef struct InitStringChar__T4_a InitStringChar__T4;
- struct _T4_a { char array[1+1]; };
- _T4 a;
+ struct InitStringChar__T4_a { char array[1+1]; };
+ InitStringChar__T4 a;
DynamicStrings_String s;
a.array[0] = ch;
s = DynamicStrings_InitString ((const char *) &a.array[0], 1);
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 977, (const char *) "InitStringChar", 14);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 977, (const char *) "InitStringChar", 14);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
{
s = CheckPoisoned (s);
}
- if ((s != NULL) && (s->head->state == inuse))
+ if ((s != NULL) && (s->head->state == DynamicStrings_inuse))
{
- s->head->state = marked;
+ s->head->state = DynamicStrings_marked;
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a, char ch)
{
- typedef struct _T5_a _T5;
+ typedef struct ConCatChar__T5_a ConCatChar__T5;
- struct _T5_a { char array[1+1]; };
- _T5 b;
+ struct ConCatChar__T5_a { char array[1+1]; };
+ ConCatChar__T5 b;
DynamicStrings_String t;
if (PoisonOn)
s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s);
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1173, (const char *) "Dup", 3);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1173, (const char *) "Dup", 3);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b);
if (TraceOn)
{
- a = AssignDebug (a, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1193, (const char *) "Add", 3);
+ a = AssignDebug (a, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1193, (const char *) "Add", 3);
}
return a;
/* static analysis guarentees a RETURN statement will be used before here. */
t = DynamicStrings_InitStringCharStar (a);
if (TraceOn)
{
- t = AssignDebug (t, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1258, (const char *) "EqualCharStar", 13);
+ t = AssignDebug (t, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1258, (const char *) "EqualCharStar", 13);
}
t = AddToGarbage (t, s);
if (DynamicStrings_Equal (t, s))
t = DynamicStrings_InitString ((const char *) a, _a_high);
if (TraceOn)
{
- t = AssignDebug (t, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1288, (const char *) "EqualArray", 10);
+ t = AssignDebug (t, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1288, (const char *) "EqualArray", 10);
}
t = AddToGarbage (t, s);
if (DynamicStrings_Equal (t, s))
}
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1320, (const char *) "Mult", 4);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1320, (const char *) "Mult", 4);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
{
if (t->contents.next == NULL)
{
- Storage_ALLOCATE ((void **) &t->contents.next, sizeof (stringRecord));
+ Storage_ALLOCATE ((void **) &t->contents.next, sizeof (DynamicStrings_stringRecord));
t->contents.next->head = NULL;
t->contents.next->contents.len = 0;
AddDebugInfo (t->contents.next);
if (TraceOn)
{
- t->contents.next = AssignDebug (t->contents.next, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1388, (const char *) "Slice", 5);
+ t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1388, (const char *) "Slice", 5);
}
}
t = t->contents.next;
}
if (TraceOn)
{
- d = AssignDebug (d, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1405, (const char *) "Slice", 5);
+ d = AssignDebug (d, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1405, (const char *) "Slice", 5);
}
return d;
/* static analysis guarentees a RETURN statement will be used before here. */
}
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1517, (const char *) "RemoveComment", 13);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1517, (const char *) "RemoveComment", 13);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
s = DynamicStrings_Slice (s, (int ) (i), 0);
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1629, (const char *) "RemoveWhitePrefix", 17);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1629, (const char *) "RemoveWhitePrefix", 17);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
s = DynamicStrings_Slice (s, 0, i+1);
if (TraceOn)
{
- s = AssignDebug (s, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 1651, (const char *) "RemoveWhitePostfix", 18);
+ s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1651, (const char *) "RemoveWhitePostfix", 18);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" void * DynamicStrings_string (DynamicStrings_String s)
{
- typedef char *_T2;
+ typedef char *string__T2;
DynamicStrings_String a;
unsigned int l;
unsigned int i;
- _T2 p;
+ string__T2 p;
if (PoisonOn)
{
s->head->charStarSize = l+1;
s->head->charStarUsed = TRUE;
}
- p = static_cast<_T2> (s->head->charStar);
+ p = static_cast<string__T2> (s->head->charStar);
a = s;
while (a != NULL)
{
extern "C" void DynamicStrings_PushAllocation (void)
{
- frame f;
+ DynamicStrings_frame f;
if (CheckOn)
{
Init ();
- Storage_ALLOCATE ((void **) &f, sizeof (frameRec));
+ Storage_ALLOCATE ((void **) &f, sizeof (DynamicStrings_frameRec));
f->next = frameHead;
f->alloc = NULL;
f->dealloc = NULL;
extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e)
{
DynamicStrings_String s;
- frame f;
+ DynamicStrings_frame f;
unsigned int b;
Init ();
{
stop ();
/* writeString ("mismatched number of PopAllocation's compared to PushAllocation's") */
- M2RTS_Halt ((const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 86, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65);
+ M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65);
}
else
{
__builtin_unreachable ();
}
-extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
Initialized = FALSE;
Init ();
}
-extern "C" void _M2_DynamicStrings_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_DynamicStrings_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
# define CreatePermissions 0666
# define MaxBufferLength (1024*16)
# define MaxErrorString (1024*8)
-typedef struct NameInfo_r NameInfo;
+typedef struct FIO_NameInfo_r FIO_NameInfo;
-typedef struct buf_r buf;
+typedef struct FIO_buf_r FIO_buf;
-typedef buf *Buffer;
+typedef FIO_buf *FIO_Buffer;
-typedef struct fds_r fds;
+typedef struct FIO_fds_r FIO_fds;
-typedef fds *FileDescriptor;
+typedef FIO_fds *FIO_FileDescriptor;
-typedef struct _T7_a _T7;
+typedef struct FIO__T7_a FIO__T7;
-typedef char *PtrToChar;
+typedef char *FIO_PtrToChar;
-typedef enum {successful, outofmemory, toomanyfilesopen, failed, connectionfailure, endofline, endoffile} FileStatus;
+typedef enum {FIO_successful, FIO_outofmemory, FIO_toomanyfilesopen, FIO_failed, FIO_connectionfailure, FIO_endofline, FIO_endoffile} FIO_FileStatus;
-typedef enum {unused, openedforread, openedforwrite, openedforrandom} FileUsage;
+typedef enum {FIO_unused, FIO_openedforread, FIO_openedforwrite, FIO_openedforrandom} FIO_FileUsage;
-struct NameInfo_r {
- void *address;
- unsigned int size;
- };
+struct FIO_NameInfo_r {
+ void *address;
+ unsigned int size;
+ };
-struct buf_r {
- unsigned int valid;
- long int bufstart;
- unsigned int position;
- void *address;
- unsigned int filled;
- unsigned int size;
- unsigned int left;
- _T7 *contents;
- };
+struct FIO_buf_r {
+ unsigned int valid;
+ long int bufstart;
+ unsigned int position;
+ void *address;
+ unsigned int filled;
+ unsigned int size;
+ unsigned int left;
+ FIO__T7 *contents;
+ };
-struct _T7_a { char array[MaxBufferLength+1]; };
-struct fds_r {
- int unixfd;
- NameInfo name;
- FileStatus state;
- FileUsage usage;
- unsigned int output;
- Buffer buffer;
- long int abspos;
- };
+struct FIO__T7_a { char array[MaxBufferLength+1]; };
+struct FIO_fds_r {
+ int unixfd;
+ FIO_NameInfo name;
+ FIO_FileStatus state;
+ FIO_FileUsage usage;
+ unsigned int output;
+ FIO_Buffer buffer;
+ long int abspos;
+ };
static Indexing_Index FileInfo;
static FIO_File Error;
extern "C" unsigned int FIO_WasEOLN (FIO_File f);
/*
- ReadChar - returns a character read from file, f.
+ ReadChar - returns a character read from file f.
Sensible to check with IsNoError or EOF after calling
this function.
*/
extern "C" char FIO_ReadChar (FIO_File f);
/*
- UnReadChar - replaces a character, ch, back into file, f.
+ UnReadChar - replaces a character, ch, back into file f.
This character must have been read by ReadChar
and it does not allow successive calls. It may
only be called if the previous read was successful
SetState - sets the field, state, of file, f, to, s.
*/
-static void SetState (FIO_File f, FileStatus s);
+static void SetState (FIO_File f, FIO_FileStatus s);
/*
InitializeFile - initialize a file descriptor
*/
-static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FileStatus fstate, FileUsage use, unsigned int towrite, unsigned int buflength);
+static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_FileUsage use, unsigned int towrite, unsigned int buflength);
/*
ConnectToUnix - connects a FIO file to a UNIX file descriptor.
static void FormatError (const char *a_, unsigned int _a_high);
/*
- FormatError1 - fairly generic error procedure.
+ FormatError1 - generic error procedure taking standard format string
+ and single parameter.
*/
static void FormatError1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
/*
- FormatError2 - fairly generic error procedure.
+ FormatError2 - generic error procedure taking standard format string
+ and two parameters.
*/
static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
/*
- CheckAccess - checks to see whether a file, f, has been
+ CheckAccess - checks to see whether a file f has been
opened for read/write.
*/
-static void CheckAccess (FIO_File f, FileUsage use, unsigned int towrite);
+static void CheckAccess (FIO_File f, FIO_FileUsage use, unsigned int towrite);
/*
SetEndOfLine -
PreInitialize - preinitialize the file descriptor.
*/
-static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FileStatus state, FileUsage use, unsigned int towrite, int osfd, unsigned int bufsize);
+static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, unsigned int towrite, int osfd, unsigned int bufsize);
/*
Init - initialize the modules, global variables.
{
FIO_File f;
FIO_File h;
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
f = Error+1;
h = Indexing_HighIndice (FileInfo);
{
if (f <= h)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd == NULL)
{
return f;
return f; /* create new slot */
}
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1);
__builtin_unreachable ();
}
SetState - sets the field, state, of file, f, to, s.
*/
-static void SetState (FIO_File f, FileStatus s)
+static void SetState (FIO_File f, FIO_FileStatus s)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
fd->state = s;
}
InitializeFile - initialize a file descriptor
*/
-static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FileStatus fstate, FileUsage use, unsigned int towrite, unsigned int buflength)
+static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_FileUsage use, unsigned int towrite, unsigned int buflength)
{
- PtrToChar p;
- FileDescriptor fd;
+ FIO_PtrToChar p;
+ FIO_FileDescriptor fd;
- Storage_ALLOCATE ((void **) &fd, sizeof (fds));
+ Storage_ALLOCATE ((void **) &fd, sizeof (FIO_fds));
if (fd == NULL)
{
- SetState (Error, outofmemory);
+ SetState (Error, FIO_outofmemory);
return Error;
}
else
Storage_ALLOCATE (&fd->name.address, fd->name.size);
if (fd->name.address == NULL)
{
- fd->state = outofmemory;
+ fd->state = FIO_outofmemory;
return f;
}
fd->name.address = libc_strncpy (fd->name.address, fname, flength);
/* and assign nul to the last byte */
- p = static_cast<PtrToChar> (fd->name.address);
+ p = static_cast<FIO_PtrToChar> (fd->name.address);
p += flength;
(*p) = ASCII_nul;
fd->abspos = 0;
/* now for the buffer */
- Storage_ALLOCATE ((void **) &fd->buffer, sizeof (buf));
+ Storage_ALLOCATE ((void **) &fd->buffer, sizeof (FIO_buf));
if (fd->buffer == NULL)
{
- SetState (Error, outofmemory);
+ SetState (Error, FIO_outofmemory);
return Error;
}
else
Storage_ALLOCATE (&fd->buffer->address, fd->buffer->size);
if (fd->buffer->address == NULL)
{
- fd->state = outofmemory;
+ fd->state = FIO_outofmemory;
return f;
}
}
{
fd->buffer->left = 0;
}
- fd->buffer->contents = reinterpret_cast<_T7 *> (fd->buffer->address); /* provides easy access for reading characters */
+ fd->buffer->contents = reinterpret_cast<FIO__T7 *> (fd->buffer->address); /* provides easy access for reading characters */
fd->state = fstate; /* provides easy access for reading characters */
}
}
static void ConnectToUnix (FIO_File f, unsigned int towrite, unsigned int newfile)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
if (towrite)
}
if (fd->unixfd < 0)
{
- fd->state = connectionfailure;
+ fd->state = FIO_connectionfailure;
}
}
}
static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes)
{
- typedef unsigned char *_T1;
+ typedef unsigned char *ReadFromBuffer__T1;
void * t;
int result;
unsigned int total;
unsigned int n;
- _T1 p;
- FileDescriptor fd;
+ ReadFromBuffer__T1 p;
+ FIO_FileDescriptor fd;
if (f != Error)
{
total = 0; /* how many bytes have we read */
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f)); /* how many bytes have we read */
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f)); /* how many bytes have we read */
/* extract from the buffer first */
if ((fd->buffer != NULL) && fd->buffer->valid)
{
if (nBytes == 1)
{
/* too expensive to call memcpy for 1 character */
- p = static_cast<_T1> (a);
+ p = static_cast<ReadFromBuffer__T1> (a);
(*p) = static_cast<unsigned char> ((*fd->buffer->contents).array[fd->buffer->position]);
fd->buffer->left -= 1; /* remove consumed bytes */
fd->buffer->position += 1; /* move onwards n bytes */
n = Min (fd->buffer->left, nBytes);
t = fd->buffer->address;
t = reinterpret_cast<void *> (reinterpret_cast<char *> (t)+fd->buffer->position);
- p = static_cast<_T1> (libc_memcpy (a, t, static_cast<size_t> (n)));
+ p = static_cast<ReadFromBuffer__T1> (libc_memcpy (a, t, static_cast<size_t> (n)));
fd->buffer->left -= n; /* remove consumed bytes */
fd->buffer->position += n; /* move onwards n bytes */
/* move onwards ready for direct reads */
if (result == 0)
{
/* eof reached */
- fd->state = endoffile;
+ fd->state = FIO_endoffile;
}
else
{
- fd->state = failed;
+ fd->state = FIO_failed;
}
/* indicate buffer is empty */
if (fd->buffer != NULL)
static int BufferedRead (FIO_File f, unsigned int nBytes, void * a)
{
- typedef unsigned char *_T3;
+ typedef unsigned char *BufferedRead__T3;
void * t;
int result;
int total;
int n;
- _T3 p;
- FileDescriptor fd;
+ BufferedRead__T3 p;
+ FIO_FileDescriptor fd;
if (f != Error)
{
/* avoid dangling else. */
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
total = 0; /* how many bytes have we read */
if (fd != NULL) /* how many bytes have we read */
{
if (nBytes == 1)
{
/* too expensive to call memcpy for 1 character */
- p = static_cast<_T3> (a);
+ p = static_cast<BufferedRead__T3> (a);
(*p) = static_cast<unsigned char> ((*fd->buffer->contents).array[fd->buffer->position]);
fd->buffer->left -= 1; /* remove consumed byte */
fd->buffer->position += 1; /* move onwards n byte */
n = Min (fd->buffer->left, nBytes);
t = fd->buffer->address;
t = reinterpret_cast<void *> (reinterpret_cast<char *> (t)+fd->buffer->position);
- p = static_cast<_T3> (libc_memcpy (a, t, static_cast<size_t> (n)));
+ p = static_cast<BufferedRead__T3> (libc_memcpy (a, t, static_cast<size_t> (n)));
fd->buffer->left -= n; /* remove consumed bytes */
fd->buffer->position += n; /* move onwards n bytes */
/* move onwards ready for direct reads */
if (n == 0)
{
/* eof reached */
- fd->state = endoffile;
+ fd->state = FIO_endoffile;
return -1;
}
}
fd->buffer->position = 0;
fd->buffer->left = 0;
fd->buffer->filled = 0;
- fd->state = failed;
+ fd->state = FIO_failed;
return total;
}
}
static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_, unsigned int _src_high, const unsigned char *w_, unsigned int _w_high)
{
- typedef struct _T8_a _T8;
+ typedef struct StringFormat1__T8_a StringFormat1__T8;
- typedef char *_T4;
+ typedef char *StringFormat1__T4;
- struct _T8_a { char array[MaxErrorString+1]; };
+ struct StringFormat1__T8_a { char array[MaxErrorString+1]; };
unsigned int HighSrc;
unsigned int HighDest;
unsigned int c;
unsigned int i;
unsigned int j;
- _T8 str;
- _T4 p;
+ StringFormat1__T8 str;
+ StringFormat1__T4 p;
char src[_src_high+1];
unsigned char w[_w_high+1];
HighSrc = StrLib_StrLen ((const char *) src, _src_high);
HighDest = _dest_high;
+ p = NULL;
+ c = 0;
i = 0;
j = 0;
while ((((i < HighSrc) && (src[i] != ASCII_nul)) && (j < HighDest)) && (src[i] != '%'))
/*
- FormatError1 - fairly generic error procedure.
+ FormatError1 - generic error procedure taking standard format string
+ and single parameter.
*/
static void FormatError1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high)
{
- typedef struct _T9_a _T9;
+ typedef struct FormatError1__T9_a FormatError1__T9;
- struct _T9_a { char array[MaxErrorString+1]; };
- _T9 s;
+ struct FormatError1__T9_a { char array[MaxErrorString+1]; };
+ FormatError1__T9 s;
char a[_a_high+1];
unsigned char w[_w_high+1];
/*
- FormatError2 - fairly generic error procedure.
+ FormatError2 - generic error procedure taking standard format string
+ and two parameters.
*/
static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high)
{
- typedef struct _T10_a _T10;
+ typedef struct FormatError2__T10_a FormatError2__T10;
- struct _T10_a { char array[MaxErrorString+1]; };
- _T10 s;
+ struct FormatError2__T10_a { char array[MaxErrorString+1]; };
+ FormatError2__T10 s;
char a[_a_high+1];
unsigned char w1[_w1_high+1];
unsigned char w2[_w2_high+1];
/*
- CheckAccess - checks to see whether a file, f, has been
+ CheckAccess - checks to see whether a file f has been
opened for read/write.
*/
-static void CheckAccess (FIO_File f, FileUsage use, unsigned int towrite)
+static void CheckAccess (FIO_File f, FIO_FileUsage use, unsigned int towrite)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
/* avoid dangling else. */
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd == NULL)
{
if (f != FIO_StdErr)
}
else
{
- if ((use == openedforwrite) && (fd->usage == openedforread))
+ if ((use == FIO_openedforwrite) && (fd->usage == FIO_openedforread))
{
FormatError1 ((const char *) "this file (%s) has been opened for reading but is now being written\\n", 69, (const unsigned char *) &fd->name.address, (sizeof (fd->name.address)-1));
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- else if ((use == openedforread) && (fd->usage == openedforwrite))
+ else if ((use == FIO_openedforread) && (fd->usage == FIO_openedforwrite))
{
/* avoid dangling else. */
FormatError1 ((const char *) "this file (%s) has been opened for writing but is now being read\\n", 66, (const unsigned char *) &fd->name.address, (sizeof (fd->name.address)-1));
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- else if (fd->state == connectionfailure)
+ else if (fd->state == FIO_connectionfailure)
{
/* avoid dangling else. */
FormatError1 ((const char *) "this file (%s) was not successfully opened\\n", 44, (const unsigned char *) &fd->name.address, (sizeof (fd->name.address)-1));
static void SetEndOfLine (FIO_File f, char ch)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (ch == ASCII_nl)
{
- fd->state = endofline;
+ fd->state = FIO_endofline;
}
else
{
- fd->state = successful;
+ fd->state = FIO_successful;
}
}
}
static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a)
{
- typedef unsigned char *_T5;
+ typedef unsigned char *BufferedWrite__T5;
void * t;
int result;
int total;
int n;
- _T5 p;
- FileDescriptor fd;
+ BufferedWrite__T5 p;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
total = 0; /* how many bytes have we read */
if (nBytes == 1)
{
/* too expensive to call memcpy for 1 character */
- p = static_cast<_T5> (a);
+ p = static_cast<BufferedWrite__T5> (a);
(*fd->buffer->contents).array[fd->buffer->position] = static_cast<char> ((*p));
fd->buffer->left -= 1; /* reduce space */
fd->buffer->position += 1; /* move onwards n byte */
n = Min (fd->buffer->left, nBytes);
t = fd->buffer->address;
t = reinterpret_cast<void *> (reinterpret_cast<char *> (t)+fd->buffer->position);
- p = static_cast<_T5> (libc_memcpy (a, t, static_cast<size_t> ((unsigned int ) (n))));
+ p = static_cast<BufferedWrite__T5> (libc_memcpy (a, t, static_cast<size_t> ((unsigned int ) (n))));
fd->buffer->left -= n; /* remove consumed bytes */
fd->buffer->position += n; /* move onwards n bytes */
/* move ready for further writes */
else
{
FIO_FlushBuffer (f);
- if ((fd->state != successful) && (fd->state != endofline))
+ if ((fd->state != FIO_successful) && (fd->state != FIO_endofline))
{
nBytes = 0;
}
PreInitialize - preinitialize the file descriptor.
*/
-static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FileStatus state, FileUsage use, unsigned int towrite, int osfd, unsigned int bufsize)
+static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, unsigned int towrite, int osfd, unsigned int bufsize)
{
- FileDescriptor fd;
- FileDescriptor fe;
+ FIO_FileDescriptor fd;
+ FIO_FileDescriptor fe;
char fname[_fname_high+1];
/* make a local copy of each unbounded array. */
if ((InitializeFile (f, &fname, StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (f == Error)
{
- fe = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, FIO_StdErr));
+ fe = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, FIO_StdErr));
if (fe == NULL)
{
M2RTS_HALT (-1);
{
FileInfo = Indexing_InitIndex (0);
Error = 0;
- PreInitialize (Error, (const char *) "error", 5, toomanyfilesopen, unused, FALSE, -1, 0);
+ PreInitialize (Error, (const char *) "error", 5, FIO_toomanyfilesopen, FIO_unused, FALSE, -1, 0);
FIO_StdIn = 1;
- PreInitialize (FIO_StdIn, (const char *) "<stdin>", 7, successful, openedforread, FALSE, 0, MaxBufferLength);
+ PreInitialize (FIO_StdIn, (const char *) "<stdin>", 7, FIO_successful, FIO_openedforread, FALSE, 0, MaxBufferLength);
FIO_StdOut = 2;
- PreInitialize (FIO_StdOut, (const char *) "<stdout>", 8, successful, openedforwrite, TRUE, 1, MaxBufferLength);
+ PreInitialize (FIO_StdOut, (const char *) "<stdout>", 8, FIO_successful, FIO_openedforwrite, TRUE, 1, MaxBufferLength);
FIO_StdErr = 3;
- PreInitialize (FIO_StdErr, (const char *) "<stderr>", 8, successful, openedforwrite, TRUE, 2, MaxBufferLength);
+ PreInitialize (FIO_StdErr, (const char *) "<stderr>", 8, FIO_successful, FIO_openedforwrite, TRUE, 2, MaxBufferLength);
if (! (M2RTS_InstallTerminationProcedure ((PROC ) {(PROC_t) FIO_FlushOutErr})))
{
M2RTS_HALT (-1);
extern "C" unsigned int FIO_IsNoError (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f == Error)
{
}
else
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
- return (fd != NULL) && (((fd->state == successful) || (fd->state == endoffile)) || (fd->state == endofline));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ return (fd != NULL) && (((fd->state == FIO_successful) || (fd->state == FIO_endoffile)) || (fd->state == FIO_endofline));
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
extern "C" void FIO_Close (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
/*
we allow users to close files which have an error status
*/
if ((libc_close (fd->unixfd)) != 0)
{
FormatError1 ((const char *) "failed to close file (%s)\\n", 27, (const unsigned char *) &fd->name.address, (sizeof (fd->name.address)-1));
- fd->state = failed; /* --fixme-- too late to notify user (unless we return a BOOLEAN) */
+ fd->state = FIO_failed; /* --fixme-- too late to notify user (unless we return a BOOLEAN) */
}
}
if (fd->name.address != NULL)
{
Storage_DEALLOCATE (&fd->buffer->address, fd->buffer->size);
}
- Storage_DEALLOCATE ((void **) &fd->buffer, sizeof (buf));
+ Storage_DEALLOCATE ((void **) &fd->buffer, sizeof (FIO_buf));
fd->buffer = NULL;
}
- Storage_DEALLOCATE ((void **) &fd, sizeof (fds));
+ Storage_DEALLOCATE ((void **) &fd, sizeof (FIO_fds));
Indexing_PutIndice (FileInfo, f, NULL);
}
}
f = GetNextFreeDescriptor ();
if (f == Error)
{
- SetState (f, toomanyfilesopen);
+ SetState (f, FIO_toomanyfilesopen);
}
else
{
- f = InitializeFile (f, fname, flength, successful, openedforread, FALSE, MaxBufferLength);
+ f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforread, FALSE, MaxBufferLength);
ConnectToUnix (f, FALSE, FALSE);
}
return f;
f = GetNextFreeDescriptor ();
if (f == Error)
{
- SetState (f, toomanyfilesopen);
+ SetState (f, FIO_toomanyfilesopen);
}
else
{
- f = InitializeFile (f, fname, flength, successful, openedforwrite, TRUE, MaxBufferLength);
+ f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforwrite, TRUE, MaxBufferLength);
ConnectToUnix (f, TRUE, TRUE);
}
return f;
f = GetNextFreeDescriptor ();
if (f == Error)
{
- SetState (f, toomanyfilesopen);
+ SetState (f, FIO_toomanyfilesopen);
}
else
{
- f = InitializeFile (f, fname, flength, successful, openedforrandom, towrite, MaxBufferLength);
+ f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforrandom, towrite, MaxBufferLength);
ConnectToUnix (f, towrite, newfile);
}
return f;
extern "C" void FIO_FlushBuffer (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
if (fd->output && (fd->buffer != NULL))
}
else
{
- fd->state = failed;
+ fd->state = FIO_failed;
}
}
}
extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest)
{
- typedef char *_T2;
+ typedef char *ReadNBytes__T2;
int n;
- _T2 p;
+ ReadNBytes__T2 p;
if (f != Error)
{
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
n = ReadFromBuffer (f, dest, nBytes);
if (n <= 0)
{
}
else
{
- p = static_cast<_T2> (dest);
+ p = static_cast<ReadNBytes__T2> (dest);
p += n-1;
SetEndOfLine (f, (*p));
return n;
extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high)
{
- CheckAccess (f, openedforread, FALSE);
- if ((BufferedRead (f, _a_high, a)) == _a_high)
+ CheckAccess (f, FIO_openedforread, FALSE);
+ if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high)))
{
SetEndOfLine (f, static_cast<char> (a[_a_high]));
}
extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src)
{
int total;
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
- CheckAccess (f, openedforwrite, TRUE);
+ CheckAccess (f, FIO_openedforwrite, TRUE);
FIO_FlushBuffer (f);
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
total = static_cast<int> (libc_write (fd->unixfd, src, static_cast<size_t> ((int ) (nBytes))));
if (total < 0)
{
- fd->state = failed;
+ fd->state = FIO_failed;
return 0;
}
else
extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high)
{
- CheckAccess (f, openedforwrite, TRUE);
- if ((BufferedWrite (f, _a_high, a)) == _a_high)
+ CheckAccess (f, FIO_openedforwrite, TRUE);
+ if ((BufferedWrite (f, _a_high, a)) == ((int ) (_a_high)))
{} /* empty. */
}
extern "C" void FIO_WriteChar (FIO_File f, char ch)
{
- CheckAccess (f, openedforwrite, TRUE);
- if ((BufferedWrite (f, sizeof (ch), &ch)) == sizeof (ch))
+ CheckAccess (f, FIO_openedforwrite, TRUE);
+ if ((BufferedWrite (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch))))
{} /* empty. */
}
extern "C" unsigned int FIO_EOF (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
- return fd->state == endoffile;
+ return fd->state == FIO_endoffile;
}
}
return TRUE;
extern "C" unsigned int FIO_EOLN (FIO_File f)
{
char ch;
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
/*
we will read a character and then push it back onto the input stream,
having noted the file status, we also reset the status.
*/
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
- if ((fd->state == successful) || (fd->state == endofline))
+ if ((fd->state == FIO_successful) || (fd->state == FIO_endofline))
{
ch = FIO_ReadChar (f);
- if ((fd->state == successful) || (fd->state == endofline))
+ if ((fd->state == FIO_successful) || (fd->state == FIO_endofline))
{
FIO_UnReadChar (f, ch);
}
extern "C" unsigned int FIO_WasEOLN (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
if (f == Error)
{
return FALSE;
}
else
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
- return (fd != NULL) && (fd->state == endofline);
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ return (fd != NULL) && (fd->state == FIO_endofline);
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
/*
- ReadChar - returns a character read from file, f.
+ ReadChar - returns a character read from file f.
Sensible to check with IsNoError or EOF after calling
this function.
*/
{
char ch;
- CheckAccess (f, openedforread, FALSE);
- if ((BufferedRead (f, sizeof (ch), &ch)) == sizeof (ch))
+ CheckAccess (f, FIO_openedforread, FALSE);
+ if ((BufferedRead (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch))))
{
SetEndOfLine (f, ch);
return ch;
/*
- UnReadChar - replaces a character, ch, back into file, f.
+ UnReadChar - replaces a character, ch, back into file f.
This character must have been read by ReadChar
and it does not allow successive calls. It may
only be called if the previous read was successful
extern "C" void FIO_UnReadChar (FIO_File f, char ch)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
unsigned int n;
void * a;
void * b;
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
- if (((fd->state == successful) || (fd->state == endoffile)) || (fd->state == endofline))
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ if (((fd->state == FIO_successful) || (fd->state == FIO_endoffile)) || (fd->state == FIO_endofline))
{
/* avoid dangling else. */
if ((fd->buffer != NULL) && fd->buffer->valid)
{
/* we assume that a ReadChar has occurred, we will check just in case. */
- if (fd->state == endoffile)
+ if (fd->state == FIO_endoffile)
{
fd->buffer->position = MaxBufferLength;
fd->buffer->left = 0;
fd->buffer->filled = 0;
- fd->state = successful;
+ fd->state = FIO_successful;
}
if (fd->buffer->position > 0)
{
unsigned int i;
char ch;
- CheckAccess (f, openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, FALSE);
high = _a_high;
i = 0;
do {
extern "C" int FIO_GetUnixFileDescriptor (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
return fd->unixfd;
extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos)
{
long int offset;
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
/* always force the lseek, until we are confident that abspos is always correct,
}
else
{
- fd->state = failed;
+ fd->state = FIO_failed;
fd->abspos = 0;
}
if (fd->buffer != NULL)
extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos)
{
long int offset;
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
FIO_FlushBuffer (f);
}
else
{
- fd->state = failed;
+ fd->state = FIO_failed;
fd->abspos = 0;
offset = 0;
}
extern "C" long int FIO_FindPosition (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd != NULL)
{
if ((fd->buffer == NULL) || ! fd->buffer->valid)
extern "C" void FIO_GetFileName (FIO_File f, char *a, unsigned int _a_high)
{
- typedef char *_T6;
+ typedef char *GetFileName__T6;
unsigned int i;
- _T6 p;
- FileDescriptor fd;
+ GetFileName__T6 p;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd == NULL)
{
FormatError ((const char *) "this file has probably been closed and not reopened successfully or alternatively never opened\\n", 96);
}
else
{
- p = static_cast<_T6> (fd->name.address);
+ p = static_cast<GetFileName__T6> (fd->name.address);
i = 0;
while (((*p) != ASCII_nul) && (i <= _a_high))
{
extern "C" void * FIO_getFileName (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd == NULL)
{
FormatError ((const char *) "this file has probably been closed and not reopened successfully or alternatively never opened\\n", 96);
return fd->name.address;
}
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1);
__builtin_unreachable ();
}
extern "C" unsigned int FIO_getFileNameLength (FIO_File f)
{
- FileDescriptor fd;
+ FIO_FileDescriptor fd;
if (f != Error)
{
- fd = static_cast<FileDescriptor> (Indexing_GetIndice (FileInfo, f));
+ fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (fd == NULL)
{
FormatError ((const char *) "this file has probably been closed and not reopened successfully or alternatively never opened\\n", 96);
return fd->name.size;
}
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1);
__builtin_unreachable ();
}
}
}
-extern "C" void _M2_FIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
Init ();
}
-extern "C" void _M2_FIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
FIO_FlushOutErr ();
}
# include "Gtermios.h"
# define MaxDefaultFd 2
-typedef struct BasicFds_r BasicFds;
+typedef struct IO_BasicFds_r IO_BasicFds;
-typedef struct _T1_a _T1;
+typedef struct IO__T1_a IO__T1;
-struct BasicFds_r {
- unsigned int IsEof;
- unsigned int IsRaw;
- };
+struct IO_BasicFds_r {
+ unsigned int IsEof;
+ unsigned int IsRaw;
+ };
-struct _T1_a { BasicFds array[MaxDefaultFd+1]; };
-static _T1 fdState;
+struct IO__T1_a { IO_BasicFds array[MaxDefaultFd+1]; };
+static IO__T1 fdState;
/*
IsDefaultFd - returns TRUE if, fd, is 0, 1 or 2.
term = termios_KillTermios (term);
}
-extern "C" void _M2_IO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_IO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
Init ();
}
-extern "C" void _M2_IO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_IO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct Indexing_IndexProcedure_p Indexing_IndexProcedure;
# define MinSize 128
-typedef struct _T2_r _T2;
+typedef struct Indexing__T2_r Indexing__T2;
-typedef void * *PtrToAddress;
+typedef void * *Indexing_PtrToAddress;
-typedef _T2 *Indexing_Index;
+typedef Indexing__T2 *Indexing_Index;
-typedef unsigned char *PtrToByte;
+typedef unsigned char *Indexing_PtrToByte;
typedef void (*Indexing_IndexProcedure_t) (void *);
struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
-struct _T2_r {
- void *ArrayStart;
- unsigned int ArraySize;
- unsigned int Used;
- unsigned int Low;
- unsigned int High;
- unsigned int Debug;
- unsigned int Map;
- };
+struct Indexing__T2_r {
+ void *ArrayStart;
+ unsigned int ArraySize;
+ unsigned int Used;
+ unsigned int Low;
+ unsigned int High;
+ unsigned int Debug;
+ unsigned int Map;
+ };
/*
{
Indexing_Index i;
- Storage_ALLOCATE ((void **) &i, sizeof (_T2));
+ Storage_ALLOCATE ((void **) &i, sizeof (Indexing__T2));
i->Low = low;
i->High = 0;
i->ArraySize = MinSize;
extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
{
Storage_DEALLOCATE (&i->ArrayStart, i->ArraySize);
- Storage_DEALLOCATE ((void **) &i, sizeof (_T2));
+ Storage_DEALLOCATE ((void **) &i, sizeof (Indexing__T2));
return NULL;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
{
return (n >= i->Low) && (n <= i->High);
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1);
__builtin_unreachable ();
}
{
return i->High;
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1);
__builtin_unreachable ();
}
{
return i->Low;
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1);
__builtin_unreachable ();
}
extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
{
- typedef unsigned int * *_T1;
+ typedef unsigned int * *PutIndice__T1;
unsigned int oldSize;
void * b;
- _T1 p;
+ PutIndice__T1 p;
if (! (Indexing_InBounds (i, n)))
{
}
b = i->ArrayStart;
b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-i->Low)*sizeof (void *));
- p = static_cast<_T1> (b);
+ p = static_cast<PutIndice__T1> (b);
(*p) = reinterpret_cast<unsigned int *> (a);
i->Used += 1;
if (i->Debug)
extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n)
{
- PtrToByte b;
- PtrToAddress p;
+ Indexing_PtrToByte b;
+ Indexing_PtrToAddress p;
if (! (Indexing_InBounds (i, n)))
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- b = static_cast<PtrToByte> (i->ArrayStart);
+ b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
b += (n-i->Low)*sizeof (void *);
- p = (PtrToAddress) (b);
+ p = (Indexing_PtrToAddress) (b);
if (i->Debug)
{
if (((n < 32) && (! ((((1 << (n)) & (i->Map)) != 0)))) && ((*p) != NULL))
extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a)
{
unsigned int j;
- PtrToByte b;
- PtrToAddress p;
+ Indexing_PtrToByte b;
+ Indexing_PtrToAddress p;
j = i->Low;
- b = static_cast<PtrToByte> (i->ArrayStart);
+ b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
while (j <= i->High)
{
- p = (PtrToAddress) (b);
+ p = (Indexing_PtrToAddress) (b);
if ((*p) == a)
{
return TRUE;
{
unsigned int j;
unsigned int k;
- PtrToAddress p;
- PtrToByte b;
+ Indexing_PtrToAddress p;
+ Indexing_PtrToByte b;
j = i->Low;
- b = static_cast<PtrToByte> (i->ArrayStart);
+ b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
while (j <= i->High)
{
- p = (PtrToAddress) (b);
+ p = (Indexing_PtrToAddress) (b);
b += sizeof (void *);
if ((*p) == a)
{
extern "C" void Indexing_DeleteIndice (Indexing_Index i, unsigned int j)
{
- PtrToAddress p;
- PtrToByte b;
+ Indexing_PtrToAddress p;
+ Indexing_PtrToByte b;
if (Indexing_InBounds (i, j))
{
- b = static_cast<PtrToByte> (i->ArrayStart);
+ b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
b += sizeof (void *)*(j-i->Low);
- p = (PtrToAddress) (b);
+ p = (Indexing_PtrToAddress) (b);
b += sizeof (void *);
- p = static_cast<PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((i->High-j)*sizeof (void *))));
+ p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((i->High-j)*sizeof (void *))));
i->High -= 1;
i->Used -= 1;
}
}
}
-extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_Indexing_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Indexing_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct SymbolKey_PerformOperation_p SymbolKey_PerformOperation;
# define MaxNoOfElements 5
-typedef struct list_r list;
+typedef struct Lists_list_r Lists_list;
-typedef struct _T1_a _T1;
+typedef struct Lists__T1_a Lists__T1;
-typedef list *Lists_List;
+typedef Lists_list *Lists_List;
typedef void (*SymbolKey_PerformOperation_t) (unsigned int);
struct SymbolKey_PerformOperation_p { SymbolKey_PerformOperation_t proc; };
-struct _T1_a { unsigned int array[MaxNoOfElements-1+1]; };
-struct list_r {
- unsigned int NoOfElements;
- _T1 Elements;
- Lists_List Next;
- };
+struct Lists__T1_a { unsigned int array[MaxNoOfElements-1+1]; };
+struct Lists_list_r {
+ unsigned int NoOfElements;
+ Lists__T1 Elements;
+ Lists_List Next;
+ };
/*
if ((l->NoOfElements == 0) && (p != NULL))
{
p->Next = l->Next;
- Storage_DEALLOCATE ((void **) &l, sizeof (list));
+ Storage_DEALLOCATE ((void **) &l, sizeof (Lists_list));
}
}
extern "C" void Lists_InitList (Lists_List *l)
{
- Storage_ALLOCATE ((void **) &(*l), sizeof (list));
+ Storage_ALLOCATE ((void **) &(*l), sizeof (Lists_list));
(*l)->NoOfElements = 0;
(*l)->Next = NULL;
}
{
Lists_KillList (&(*l)->Next);
}
- Storage_DEALLOCATE ((void **) &(*l), sizeof (list));
+ Storage_DEALLOCATE ((void **) &(*l), sizeof (Lists_list));
}
}
__builtin_unreachable ();
}
-extern "C" void _M2_Lists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Lists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_Lists_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Lists_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct M2Dependent_ArgCVEnvP_p M2Dependent_ArgCVEnvP;
-typedef struct DependencyList_r DependencyList;
+typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList;
-typedef struct _T2_r _T2;
+typedef struct M2Dependent__T2_r M2Dependent__T2;
-typedef _T2 *ModuleChain;
+typedef M2Dependent__T2 *M2Dependent_ModuleChain;
-typedef struct _T3_a _T3;
+typedef struct M2Dependent__T3_a M2Dependent__T3;
-typedef enum {unregistered, unordered, started, ordered, user} DependencyState;
+typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState;
typedef void (*M2Dependent_ArgCVEnvP_t) (int, void *, void *);
struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; };
-struct DependencyList_r {
- PROC proc;
- unsigned int forced;
- unsigned int forc;
- unsigned int appl;
- DependencyState state;
- };
-
-struct _T3_a { ModuleChain array[user-unregistered+1]; };
-struct _T2_r {
- void *name;
- M2Dependent_ArgCVEnvP init;
- M2Dependent_ArgCVEnvP fini;
- DependencyList dependency;
- ModuleChain prev;
- ModuleChain next;
- };
-
-static _T3 Modules;
+struct M2Dependent_DependencyList_r {
+ PROC proc;
+ unsigned int forced;
+ unsigned int forc;
+ unsigned int appl;
+ M2Dependent_DependencyState state;
+ };
+
+struct M2Dependent__T3_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
+struct M2Dependent__T2_r {
+ void *name;
+ M2Dependent_ArgCVEnvP init;
+ M2Dependent_ArgCVEnvP fini;
+ M2Dependent_DependencyList dependency;
+ M2Dependent_ModuleChain prev;
+ M2Dependent_ModuleChain next;
+ };
+
+static M2Dependent__T3 Modules;
static unsigned int Initialized;
static unsigned int ModuleTrace;
static unsigned int DependencyTrace;
ModuleChain.
*/
-static ModuleChain CreateModule (void * name, M2Dependent_ArgCVEnvP init, M2Dependent_ArgCVEnvP fini, PROC dependencies);
+static M2Dependent_ModuleChain CreateModule (void * name, M2Dependent_ArgCVEnvP init, M2Dependent_ArgCVEnvP fini, PROC dependencies);
/*
AppendModule - append chain to end of the list.
*/
-static void AppendModule (ModuleChain *head, ModuleChain chain);
+static void AppendModule (M2Dependent_ModuleChain *head, M2Dependent_ModuleChain chain);
/*
RemoveModule - remove chain from double linked list head.
*/
-static void RemoveModule (ModuleChain *head, ModuleChain chain);
+static void RemoveModule (M2Dependent_ModuleChain *head, M2Dependent_ModuleChain chain);
/*
onChain - returns TRUE if mptr is on the Modules[state] list.
*/
-static unsigned int onChain (DependencyState state, ModuleChain mptr);
+static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr);
/*
LookupModuleN - lookup module from the state list. The string is limited
to nchar.
*/
-static ModuleChain LookupModuleN (DependencyState state, void * name, unsigned int nchar);
+static M2Dependent_ModuleChain LookupModuleN (M2Dependent_DependencyState state, void * name, unsigned int nchar);
/*
LookupModule - lookup and return the ModuleChain pointer containing
module name from a particular list.
*/
-static ModuleChain LookupModule (DependencyState state, void * name);
+static M2Dependent_ModuleChain LookupModule (M2Dependent_DependencyState state, void * name);
/*
toCString - replace any character sequence
It updates the mptr state appropriately.
*/
-static void moveTo (DependencyState newstate, ModuleChain mptr);
+static void moveTo (M2Dependent_DependencyState newstate, M2Dependent_ModuleChain mptr);
/*
ResolveDependant -
*/
-static void ResolveDependant (ModuleChain mptr, void * currentmodule);
+static void ResolveDependant (M2Dependent_ModuleChain mptr, void * currentmodule);
/*
PerformRequestDependant - the current modulename has a dependancy upon
DisplayModuleInfo - displays all module in the state.
*/
-static void DisplayModuleInfo (DependencyState state, const char *name_, unsigned int _name_high);
+static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *name_, unsigned int _name_high);
/*
DumpModuleData -
src := NIL.
*/
-static void combine (DependencyState src, DependencyState dest);
+static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyState dest);
/*
ForceDependencies - if the user has specified a forced order then we override
static void ForceDependencies (void);
+/*
+ CheckApplication - check to see that the application is the last entry in the list.
+ This might happen if the application only imports FOR C modules.
+*/
+
+static void CheckApplication (void);
+
/*
equal - return TRUE if C string cstr is equal to str.
*/
ModuleChain.
*/
-static ModuleChain CreateModule (void * name, M2Dependent_ArgCVEnvP init, M2Dependent_ArgCVEnvP fini, PROC dependencies)
+static M2Dependent_ModuleChain CreateModule (void * name, M2Dependent_ArgCVEnvP init, M2Dependent_ArgCVEnvP fini, PROC dependencies)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
- Storage_ALLOCATE ((void **) &mptr, sizeof (_T2));
+ Storage_ALLOCATE ((void **) &mptr, sizeof (M2Dependent__T2));
mptr->name = name;
mptr->init = init;
mptr->fini = fini;
mptr->dependency.proc = dependencies;
- mptr->dependency.state = unregistered;
+ mptr->dependency.state = M2Dependent_unregistered;
mptr->prev = NULL;
mptr->next = NULL;
return mptr;
AppendModule - append chain to end of the list.
*/
-static void AppendModule (ModuleChain *head, ModuleChain chain)
+static void AppendModule (M2Dependent_ModuleChain *head, M2Dependent_ModuleChain chain)
{
if ((*head) == NULL)
{
RemoveModule - remove chain from double linked list head.
*/
-static void RemoveModule (ModuleChain *head, ModuleChain chain)
+static void RemoveModule (M2Dependent_ModuleChain *head, M2Dependent_ModuleChain chain)
{
if ((chain->next == (*head)) && (chain == (*head)))
{
onChain - returns TRUE if mptr is on the Modules[state] list.
*/
-static unsigned int onChain (DependencyState state, ModuleChain mptr)
+static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr)
{
- ModuleChain ptr;
+ M2Dependent_ModuleChain ptr;
- if (Modules.array[state-unregistered] != NULL)
+ if (Modules.array[state-M2Dependent_unregistered] != NULL)
{
- ptr = Modules.array[state-unregistered];
+ ptr = Modules.array[state-M2Dependent_unregistered];
do {
if (ptr == mptr)
{
return TRUE;
}
ptr = ptr->next;
- } while (! (ptr == Modules.array[state-unregistered]));
+ } while (! (ptr == Modules.array[state-M2Dependent_unregistered]));
}
return FALSE;
/* static analysis guarentees a RETURN statement will be used before here. */
to nchar.
*/
-static ModuleChain LookupModuleN (DependencyState state, void * name, unsigned int nchar)
+static M2Dependent_ModuleChain LookupModuleN (M2Dependent_DependencyState state, void * name, unsigned int nchar)
{
- ModuleChain ptr;
+ M2Dependent_ModuleChain ptr;
- if (Modules.array[state-unregistered] != NULL)
+ if (Modules.array[state-M2Dependent_unregistered] != NULL)
{
- ptr = Modules.array[state-unregistered];
+ ptr = Modules.array[state-M2Dependent_unregistered];
do {
if ((strncmp (reinterpret_cast<M2LINK_PtrToChar> (ptr->name), reinterpret_cast<M2LINK_PtrToChar> (name), nchar)) == 0)
{
return ptr;
}
ptr = ptr->next;
- } while (! (ptr == Modules.array[state-unregistered]));
+ } while (! (ptr == Modules.array[state-M2Dependent_unregistered]));
}
return NULL;
/* static analysis guarentees a RETURN statement will be used before here. */
module name from a particular list.
*/
-static ModuleChain LookupModule (DependencyState state, void * name)
+static M2Dependent_ModuleChain LookupModule (M2Dependent_DependencyState state, void * name)
{
return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (name))));
/* static analysis guarentees a RETURN statement will be used before here. */
It updates the mptr state appropriately.
*/
-static void moveTo (DependencyState newstate, ModuleChain mptr)
+static void moveTo (M2Dependent_DependencyState newstate, M2Dependent_ModuleChain mptr)
{
if (onChain (mptr->dependency.state, mptr))
{
- RemoveModule (&Modules.array[mptr->dependency.state-unregistered], mptr);
+ RemoveModule (&Modules.array[mptr->dependency.state-M2Dependent_unregistered], mptr);
}
mptr->dependency.state = newstate;
- AppendModule (&Modules.array[mptr->dependency.state-unregistered], mptr);
+ AppendModule (&Modules.array[mptr->dependency.state-M2Dependent_unregistered], mptr);
}
ResolveDependant -
*/
-static void ResolveDependant (ModuleChain mptr, void * currentmodule)
+static void ResolveDependant (M2Dependent_ModuleChain mptr, void * currentmodule)
{
if (mptr == NULL)
{
}
else
{
- if (onChain (started, mptr))
+ if (onChain (M2Dependent_started, mptr))
{
traceprintf (DependencyTrace, (const char *) " processing...\\n", 18);
}
else
{
- moveTo (started, mptr);
+ moveTo (M2Dependent_started, mptr);
traceprintf2 (DependencyTrace, (const char *) " starting: %s\\n", 17, currentmodule);
(*mptr->dependency.proc.proc) (); /* Invoke and process the dependency graph. */
traceprintf2 (DependencyTrace, (const char *) " finished: %s\\n", 17, currentmodule); /* Invoke and process the dependency graph. */
- moveTo (ordered, mptr);
+ moveTo (M2Dependent_ordered, mptr);
}
}
}
static void PerformRequestDependant (void * modulename, void * dependantmodule)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
traceprintf2 (DependencyTrace, (const char *) " module %s", 11, modulename);
if (dependantmodule == NULL)
{
/* avoid dangling else. */
traceprintf2 (DependencyTrace, (const char *) " has finished its import graph\\n", 32, modulename);
- mptr = LookupModule (unordered, modulename);
+ mptr = LookupModule (M2Dependent_unordered, modulename);
if (mptr != NULL)
{
traceprintf2 (DependencyTrace, (const char *) " module %s is now ordered\\n", 28, modulename);
- moveTo (ordered, mptr);
+ moveTo (M2Dependent_ordered, mptr);
}
}
else
{
traceprintf2 (DependencyTrace, (const char *) " imports from %s\\n", 18, dependantmodule);
- mptr = LookupModule (ordered, dependantmodule);
+ mptr = LookupModule (M2Dependent_ordered, dependantmodule);
if (mptr == NULL)
{
traceprintf2 (DependencyTrace, (const char *) " module %s is not ordered\\n", 28, dependantmodule);
- mptr = LookupModule (unordered, dependantmodule);
+ mptr = LookupModule (M2Dependent_unordered, dependantmodule);
if (mptr == NULL)
{
traceprintf2 (DependencyTrace, (const char *) " module %s is not unordered\\n", 30, dependantmodule);
- mptr = LookupModule (started, dependantmodule);
+ mptr = LookupModule (M2Dependent_started, dependantmodule);
if (mptr == NULL)
{
traceprintf2 (DependencyTrace, (const char *) " module %s has not started\\n", 29, dependantmodule);
static void ResolveDependencies (void * currentmodule)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
- mptr = LookupModule (unordered, currentmodule);
+ mptr = LookupModule (M2Dependent_unordered, currentmodule);
while (mptr != NULL)
{
traceprintf2 (DependencyTrace, (const char *) " attempting to resolve the dependants for %s\\n", 48, currentmodule);
ResolveDependant (mptr, currentmodule);
- mptr = Modules.array[unordered-unregistered];
+ mptr = Modules.array[M2Dependent_unordered-M2Dependent_unregistered];
}
}
DisplayModuleInfo - displays all module in the state.
*/
-static void DisplayModuleInfo (DependencyState state, const char *name_, unsigned int _name_high)
+static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *name_, unsigned int _name_high)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
+ unsigned int count;
char name[_name_high+1];
/* make a local copy of each unbounded array. */
memcpy (name, name_, _name_high+1);
- if (Modules.array[state-unregistered] != NULL)
+ if (Modules.array[state-M2Dependent_unregistered] != NULL)
{
libc_printf ((const char *) "%s modules\\n", 12, &name);
- mptr = Modules.array[state-unregistered];
+ mptr = Modules.array[state-M2Dependent_unregistered];
+ count = 0;
do {
- libc_printf ((const char *) " %s", 4, mptr->name);
+ libc_printf ((const char *) " %d %s", 8, count, mptr->name);
+ count += 1;
if (mptr->dependency.appl)
{
libc_printf ((const char *) " application", 12);
}
libc_printf ((const char *) "\\n", 2);
mptr = mptr->next;
- } while (! (mptr == Modules.array[state-unregistered]));
+ } while (! (mptr == Modules.array[state-M2Dependent_unregistered]));
}
}
static void DumpModuleData (unsigned int flag)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
if (flag)
{
- DisplayModuleInfo (unregistered, (const char *) "unregistered", 12);
- DisplayModuleInfo (unordered, (const char *) "unordered", 9);
- DisplayModuleInfo (started, (const char *) "started", 7);
- DisplayModuleInfo (ordered, (const char *) "ordered", 7);
+ DisplayModuleInfo (M2Dependent_unregistered, (const char *) "unregistered", 12);
+ DisplayModuleInfo (M2Dependent_unordered, (const char *) "unordered", 9);
+ DisplayModuleInfo (M2Dependent_started, (const char *) "started", 7);
+ DisplayModuleInfo (M2Dependent_ordered, (const char *) "ordered", 7);
}
}
src := NIL.
*/
-static void combine (DependencyState src, DependencyState dest)
+static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyState dest)
{
- ModuleChain last;
+ M2Dependent_ModuleChain last;
- while (Modules.array[src-unregistered] != NULL)
+ while (Modules.array[src-M2Dependent_unregistered] != NULL)
{
- last = Modules.array[src-unregistered]->prev;
- moveTo (ordered, last);
- Modules.array[dest-unregistered] = last; /* New item is at the head. */
+ last = Modules.array[src-M2Dependent_unregistered]->prev;
+ moveTo (M2Dependent_ordered, last);
+ Modules.array[dest-M2Dependent_unregistered] = last; /* New item is at the head. */
}
}
static void ForceDependencies (void)
{
- ModuleChain mptr;
- ModuleChain userChain;
+ M2Dependent_ModuleChain mptr;
+ M2Dependent_ModuleChain userChain;
unsigned int count;
M2LINK_PtrToChar pc;
M2LINK_PtrToChar start;
{
if ((*pc) == ',')
{
- mptr = LookupModuleN (ordered, reinterpret_cast<void *> (start), count);
+ mptr = LookupModuleN (M2Dependent_ordered, reinterpret_cast<void *> (start), count);
if (mptr != NULL)
{
mptr->dependency.forced = TRUE;
- moveTo (user, mptr);
+ moveTo (M2Dependent_user, mptr);
}
pc += 1;
start = pc;
}
if (start != pc)
{
- mptr = LookupModuleN (ordered, reinterpret_cast<void *> (start), count);
+ mptr = LookupModuleN (M2Dependent_ordered, reinterpret_cast<void *> (start), count);
if (mptr != NULL)
{
mptr->dependency.forced = TRUE;
- moveTo (user, mptr);
+ moveTo (M2Dependent_user, mptr);
}
}
- combine (user, ordered);
+ combine (M2Dependent_user, M2Dependent_ordered);
+ }
+}
+
+
+/*
+ CheckApplication - check to see that the application is the last entry in the list.
+ This might happen if the application only imports FOR C modules.
+*/
+
+static void CheckApplication (void)
+{
+ M2Dependent_ModuleChain mptr;
+ M2Dependent_ModuleChain appl;
+
+ mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered];
+ if (mptr != NULL)
+ {
+ appl = NULL;
+ do {
+ if (mptr->dependency.appl)
+ {
+ appl = mptr;
+ }
+ else
+ {
+ mptr = mptr->next;
+ }
+ } while (! ((appl != NULL) || (mptr == Modules.array[M2Dependent_ordered-M2Dependent_unregistered])));
+ if (appl != NULL)
+ {
+ Modules.array[M2Dependent_ordered-M2Dependent_unregistered] = appl->next;
+ }
}
}
static void SetupDebugFlags (void)
{
- typedef char *_T1;
+ typedef char *SetupDebugFlags__T1;
- _T1 pc;
+ SetupDebugFlags__T1 pc;
ModuleTrace = FALSE;
DependencyTrace = FALSE;
PostTrace = FALSE;
PreTrace = FALSE;
ForceTrace = FALSE;
- pc = static_cast<_T1> (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("GCC_M2LINK_RTFLAG"))));
+ pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("GCC_M2LINK_RTFLAG"))));
while ((pc != NULL) && ((*pc) != ASCII_nul))
{
if (equal (reinterpret_cast<void *> (pc), (const char *) "all", 3))
static void Init (void)
{
- DependencyState state;
+ M2Dependent_DependencyState state;
SetupDebugFlags ();
- for (state=unregistered; state<=user; state= static_cast<DependencyState>(static_cast<int>(state+1)))
+ for (state=M2Dependent_unregistered; state<=M2Dependent_user; state= static_cast<M2Dependent_DependencyState>(static_cast<int>(state+1)))
{
- Modules.array[state-unregistered] = NULL;
+ Modules.array[state-M2Dependent_unregistered] = NULL;
}
}
extern "C" void M2Dependent_ConstructModules (void * applicationmodule, int argc, void * argv, void * envp)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
M2Dependent_ArgCVEnvP nulp;
CheckInitialized ();
traceprintf2 (ModuleTrace, (const char *) "application module: %s\\n", 24, applicationmodule);
- mptr = LookupModule (unordered, applicationmodule);
+ mptr = LookupModule (M2Dependent_unordered, applicationmodule);
if (mptr != NULL)
{
mptr->dependency.appl = TRUE;
ForceDependencies ();
traceprintf (ForceTrace, (const char *) "After user forcing ordering\\n", 29);
DumpModuleData (ForceTrace);
- if (Modules.array[ordered-unregistered] == NULL)
+ CheckApplication ();
+ traceprintf (ForceTrace, (const char *) "After runtime forces application to the end\\n", 45);
+ DumpModuleData (ForceTrace);
+ if (Modules.array[M2Dependent_ordered-M2Dependent_unregistered] == NULL)
{
traceprintf2 (ModuleTrace, (const char *) " module: %s has not registered itself using a global constructor\\n", 67, applicationmodule);
traceprintf2 (ModuleTrace, (const char *) " hint try compile and linking using: gm2 %s.mod\\n", 50, applicationmodule);
}
else
{
- mptr = Modules.array[ordered-unregistered];
+ mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered];
do {
if (mptr->dependency.forc)
{
}
(*mptr->init.proc) (argc, argv, envp);
mptr = mptr->next;
- } while (! (mptr == Modules.array[ordered-unregistered]));
+ } while (! (mptr == Modules.array[M2Dependent_ordered-M2Dependent_unregistered]));
}
}
extern "C" void M2Dependent_DeconstructModules (void * applicationmodule, int argc, void * argv, void * envp)
{
- ModuleChain mptr;
+ M2Dependent_ModuleChain mptr;
traceprintf2 (ModuleTrace, (const char *) "application module finishing: %s\\n", 34, applicationmodule);
- if (Modules.array[ordered-unregistered] == NULL)
+ if (Modules.array[M2Dependent_ordered-M2Dependent_unregistered] == NULL)
{
traceprintf (ModuleTrace, (const char *) " no ordered modules found during finishing\\n", 45);
}
traceprintf (ModuleTrace, (const char *) "ExecuteTerminationProcedures\\n", 30);
M2RTS_ExecuteTerminationProcedures ();
traceprintf (ModuleTrace, (const char *) "terminating modules in sequence\\n", 33);
- mptr = Modules.array[ordered-unregistered]->prev;
+ mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered]->prev;
do {
if (mptr->dependency.forc)
{
}
(*mptr->fini.proc) (argc, argv, envp);
mptr = mptr->prev;
- } while (! (mptr == Modules.array[ordered-unregistered]->prev));
+ } while (! (mptr == Modules.array[M2Dependent_ordered-M2Dependent_unregistered]->prev));
}
}
if (! M2LINK_StaticInitialization)
{
traceprintf2 (ModuleTrace, (const char *) "module: %s registering\\n", 24, name);
- moveTo (unordered, CreateModule (name, init, fini, dependencies));
+ moveTo (M2Dependent_unordered, CreateModule (name, init, fini, dependencies));
}
}
}
}
-extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
CheckInitialized ();
}
-extern "C" void _M2_M2Dependent_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2Dependent_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
n = RTExceptions_GetNumber (e);
if (n == (UINT_MAX))
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
}
else
{
return (M2EXCEPTION_M2Exceptions) (n);
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
__builtin_unreachable ();
}
__builtin_unreachable ();
}
-extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
RTExceptions_SetExceptionBlock (RTExceptions_InitExceptionBlock ());
}
-extern "C" void _M2_M2EXCEPTION_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2EXCEPTION_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
-typedef struct ProcedureList_r ProcedureList;
+typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList;
-typedef char *PtrToChar;
+typedef char *M2RTS_PtrToChar;
-typedef struct _T1_r _T1;
+typedef struct M2RTS__T1_r M2RTS__T1;
-typedef _T1 *ProcedureChain;
+typedef M2RTS__T1 *M2RTS_ProcedureChain;
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-struct ProcedureList_r {
- ProcedureChain head;
- ProcedureChain tail;
- };
+struct M2RTS_ProcedureList_r {
+ M2RTS_ProcedureChain head;
+ M2RTS_ProcedureChain tail;
+ };
-struct _T1_r {
- PROC p;
- ProcedureChain prev;
- ProcedureChain next;
- };
+struct M2RTS__T1_r {
+ PROC p;
+ M2RTS_ProcedureChain prev;
+ M2RTS_ProcedureChain next;
+ };
-static ProcedureList InitialProc;
-static ProcedureList TerminateProc;
+static M2RTS_ProcedureList InitialProc;
+static M2RTS_ProcedureList TerminateProc;
static int ExitValue;
static unsigned int isHalting;
static unsigned int CallExit;
procedures in the chain.
*/
-static void ExecuteReverse (ProcedureChain procptr);
+static void ExecuteReverse (M2RTS_ProcedureChain procptr);
/*
AppendProc - append proc to the end of the procedure list
defined by proclist.
*/
-static unsigned int AppendProc (ProcedureList *proclist, PROC proc);
+static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc);
/*
ErrorString - writes a string to stderr.
InitProcList - initialize the head and tail pointers to NIL.
*/
-static void InitProcList (ProcedureList *p);
+static void InitProcList (M2RTS_ProcedureList *p);
/*
Init - initialize the initial, terminate procedure lists and booleans.
procedures in the chain.
*/
-static void ExecuteReverse (ProcedureChain procptr)
+static void ExecuteReverse (M2RTS_ProcedureChain procptr)
{
while (procptr != NULL)
{
defined by proclist.
*/
-static unsigned int AppendProc (ProcedureList *proclist, PROC proc)
+static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc)
{
- ProcedureChain pdes;
+ M2RTS_ProcedureChain pdes;
- Storage_ALLOCATE ((void **) &pdes, sizeof (_T1));
+ Storage_ALLOCATE ((void **) &pdes, sizeof (M2RTS__T1));
pdes->p = proc;
pdes->prev = (*proclist).tail;
pdes->next = NULL;
InitProcList - initialize the head and tail pointers to NIL.
*/
-static void InitProcList (ProcedureList *p)
+static void InitProcList (M2RTS_ProcedureList *p)
{
(*p).head = NULL;
(*p).tail = NULL;
extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high)
{
- typedef struct _T2_a _T2;
+ typedef struct ErrorMessage__T2_a ErrorMessage__T2;
- struct _T2_a { char array[10+1]; };
- _T2 LineNo;
+ struct ErrorMessage__T2_a { char array[10+1]; };
+ ErrorMessage__T2 LineNo;
char message[_message_high+1];
char file[_file_high+1];
char function[_function_high+1];
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), filename, line, column, scope, message);
}
-extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
CheckInitialized ();
}
-extern "C" void _M2_M2RTS_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2RTS_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
# define NameKey_NulName 0
typedef unsigned int NameKey_Name;
-typedef struct Node_r Node;
+typedef struct NameKey_Node_r NameKey_Node;
-typedef char *PtrToChar;
+typedef char *NameKey_PtrToChar;
-typedef Node *NameNode;
+typedef NameKey_Node *NameKey_NameNode;
-typedef enum {less, equal, greater} Comparison;
+typedef enum {NameKey_less, NameKey_equal, NameKey_greater} NameKey_Comparison;
-struct Node_r {
- PtrToChar Data;
- NameKey_Name Key;
- NameNode Left;
- NameNode Right;
- };
+struct NameKey_Node_r {
+ NameKey_PtrToChar Data;
+ NameKey_Name Key;
+ NameKey_NameNode Left;
+ NameKey_NameNode Right;
+ };
-static NameNode BinaryTree;
+static NameKey_NameNode BinaryTree;
static Indexing_Index KeyIndex;
static unsigned int LastIndice;
If a name is found then the string, n, is deallocated.
*/
-static NameKey_Name DoMakeKey (PtrToChar n, unsigned int higha);
+static NameKey_Name DoMakeKey (NameKey_PtrToChar n, unsigned int higha);
/*
Compare - return the result of Names[i] with Names[j]
*/
-static Comparison Compare (PtrToChar pi, NameKey_Name j);
+static NameKey_Comparison Compare (NameKey_PtrToChar pi, NameKey_Name j);
/*
FindNodeAndParentInTree - search BinaryTree for a name.
A comparison is returned to assist adding entries into this tree.
*/
-static Comparison FindNodeAndParentInTree (PtrToChar n, NameNode *child, NameNode *father);
+static NameKey_Comparison FindNodeAndParentInTree (NameKey_PtrToChar n, NameKey_NameNode *child, NameKey_NameNode *father);
/*
If a name is found then the string, n, is deallocated.
*/
-static NameKey_Name DoMakeKey (PtrToChar n, unsigned int higha)
+static NameKey_Name DoMakeKey (NameKey_PtrToChar n, unsigned int higha)
{
- Comparison result;
- NameNode father;
- NameNode child;
+ NameKey_Comparison result;
+ NameKey_NameNode father;
+ NameKey_NameNode child;
NameKey_Name k;
result = FindNodeAndParentInTree (n, &child, &father);
if (child == NULL)
{
- if (result == less)
+ if (result == NameKey_less)
{
- Storage_ALLOCATE ((void **) &child, sizeof (Node));
+ Storage_ALLOCATE ((void **) &child, sizeof (NameKey_Node));
father->Left = child;
}
- else if (result == greater)
+ else if (result == NameKey_greater)
{
/* avoid dangling else. */
- Storage_ALLOCATE ((void **) &child, sizeof (Node));
+ Storage_ALLOCATE ((void **) &child, sizeof (NameKey_Node));
father->Right = child;
}
child->Right = NULL;
Compare - return the result of Names[i] with Names[j]
*/
-static Comparison Compare (PtrToChar pi, NameKey_Name j)
+static NameKey_Comparison Compare (NameKey_PtrToChar pi, NameKey_Name j)
{
- PtrToChar pj;
+ NameKey_PtrToChar pj;
char c1;
char c2;
- pj = static_cast<PtrToChar> (NameKey_KeyToCharStar (j));
+ pj = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (j));
c1 = (*pi);
c2 = (*pj);
while ((c1 != ASCII_nul) || (c2 != ASCII_nul))
{
if (c1 < c2)
{
- return less;
+ return NameKey_less;
}
else if (c1 > c2)
{
/* avoid dangling else. */
- return greater;
+ return NameKey_greater;
}
else
{
c2 = (*pj);
}
}
- return equal;
+ return NameKey_equal;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
A comparison is returned to assist adding entries into this tree.
*/
-static Comparison FindNodeAndParentInTree (PtrToChar n, NameNode *child, NameNode *father)
+static NameKey_Comparison FindNodeAndParentInTree (NameKey_PtrToChar n, NameKey_NameNode *child, NameKey_NameNode *father)
{
- Comparison result;
+ NameKey_Comparison result;
/* firstly set up the initial values of child and father, using sentinal node */
(*father) = BinaryTree;
(*child) = BinaryTree->Left;
if ((*child) == NULL)
{
- return less;
+ return NameKey_less;
}
else
{
do {
result = Compare (n, (*child)->Key);
- if (result == less)
+ if (result == NameKey_less)
{
(*father) = (*child);
(*child) = (*child)->Left;
}
- else if (result == greater)
+ else if (result == NameKey_greater)
{
/* avoid dangling else. */
(*father) = (*child);
(*child) = (*child)->Right;
}
- } while (! (((*child) == NULL) || (result == equal)));
+ } while (! (((*child) == NULL) || (result == NameKey_equal)));
return result;
}
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" NameKey_Name NameKey_MakeKey (const char *a_, unsigned int _a_high)
{
- PtrToChar n;
- PtrToChar p;
+ NameKey_PtrToChar n;
+ NameKey_PtrToChar p;
unsigned int i;
unsigned int higha;
char a[_a_high+1];
(*p) = ASCII_nul;
return DoMakeKey (n, higha);
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-compiler/NameKey.def", 20, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/NameKey.def", 20, 1);
__builtin_unreachable ();
}
extern "C" NameKey_Name NameKey_makekey (void * a)
{
- PtrToChar n;
- PtrToChar p;
- PtrToChar pa;
+ NameKey_PtrToChar n;
+ NameKey_PtrToChar p;
+ NameKey_PtrToChar pa;
unsigned int i;
unsigned int higha;
else
{
n = p;
- pa = static_cast<PtrToChar> (a);
+ pa = static_cast<NameKey_PtrToChar> (a);
i = 0;
while (i < higha)
{
return DoMakeKey (n, higha);
}
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-compiler/NameKey.def", 20, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/NameKey.def", 20, 1);
__builtin_unreachable ();
}
extern "C" void NameKey_GetKey (NameKey_Name key, char *a, unsigned int _a_high)
{
- PtrToChar p;
+ NameKey_PtrToChar p;
unsigned int i;
unsigned int higha;
- p = static_cast<PtrToChar> (NameKey_KeyToCharStar (key));
+ p = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (key));
i = 0;
higha = _a_high;
while (((p != NULL) && (i <= higha)) && ((*p) != ASCII_nul))
extern "C" unsigned int NameKey_LengthKey (NameKey_Name Key)
{
unsigned int i;
- PtrToChar p;
+ NameKey_PtrToChar p;
- p = static_cast<PtrToChar> (NameKey_KeyToCharStar (Key));
+ p = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (Key));
i = 0;
while ((*p) != ASCII_nul)
{
extern "C" unsigned int NameKey_IsKey (const char *a_, unsigned int _a_high)
{
- NameNode child;
- PtrToChar p;
+ NameKey_NameNode child;
+ NameKey_PtrToChar p;
unsigned int i;
unsigned int higha;
char a[_a_high+1];
do {
i = 0;
higha = _a_high;
- p = static_cast<PtrToChar> (NameKey_KeyToCharStar (child->Key));
+ p = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (child->Key));
while ((i <= higha) && (a[i] != ASCII_nul))
{
if (a[i] < (*p))
extern "C" void NameKey_WriteKey (NameKey_Name key)
{
- PtrToChar s;
+ NameKey_PtrToChar s;
- s = static_cast<PtrToChar> (NameKey_KeyToCharStar (key));
+ s = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (key));
while ((s != NULL) && ((*s) != ASCII_nul))
{
StdIO_Write ((*s));
extern "C" unsigned int NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2)
{
- PtrToChar pi;
- PtrToChar pj;
+ NameKey_PtrToChar pi;
+ NameKey_PtrToChar pj;
char c1;
char c2;
}
else
{
- pi = static_cast<PtrToChar> (NameKey_KeyToCharStar (key1));
- pj = static_cast<PtrToChar> (NameKey_KeyToCharStar (key2));
+ pi = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (key1));
+ pj = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (key2));
c1 = (*pi);
c2 = (*pj);
while ((c1 != ASCII_nul) && (c2 != ASCII_nul))
extern "C" char NameKey_CharKey (NameKey_Name key, unsigned int i)
{
- PtrToChar p;
+ NameKey_PtrToChar p;
if (i >= (NameKey_LengthKey (key)))
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- p = static_cast<PtrToChar> (NameKey_KeyToCharStar (key));
+ p = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (key));
p += i;
return (*p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
-extern "C" void _M2_NameKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_NameKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
LastIndice = 0;
KeyIndex = Indexing_InitIndex (1);
- Storage_ALLOCATE ((void **) &BinaryTree, sizeof (Node));
+ Storage_ALLOCATE ((void **) &BinaryTree, sizeof (NameKey_Node));
BinaryTree->Left = NULL;
}
-extern "C" void _M2_NameKey_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_NameKey_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
extern "C" void NumberIO_ReadCard (unsigned int *x)
{
- typedef struct _T1_a _T1;
+ typedef struct ReadCard__T1_a ReadCard__T1;
- struct _T1_a { char array[MaxLineLength+1]; };
- _T1 a;
+ struct ReadCard__T1_a { char array[MaxLineLength+1]; };
+ ReadCard__T1 a;
StrIO_ReadString ((char *) &a.array[0], MaxLineLength);
NumberIO_StrToCard ((const char *) &a.array[0], MaxLineLength, x);
extern "C" void NumberIO_WriteCard (unsigned int x, unsigned int n)
{
- typedef struct _T2_a _T2;
+ typedef struct WriteCard__T2_a WriteCard__T2;
- struct _T2_a { char array[MaxLineLength+1]; };
- _T2 a;
+ struct WriteCard__T2_a { char array[MaxLineLength+1]; };
+ WriteCard__T2 a;
NumberIO_CardToStr (x, n, (char *) &a.array[0], MaxLineLength);
StrIO_WriteString ((const char *) &a.array[0], MaxLineLength);
extern "C" void NumberIO_ReadHex (unsigned int *x)
{
- typedef struct _T3_a _T3;
+ typedef struct ReadHex__T3_a ReadHex__T3;
- struct _T3_a { char array[MaxLineLength+1]; };
- _T3 a;
+ struct ReadHex__T3_a { char array[MaxLineLength+1]; };
+ ReadHex__T3 a;
StrIO_ReadString ((char *) &a.array[0], MaxLineLength);
NumberIO_StrToHex ((const char *) &a.array[0], MaxLineLength, x);
extern "C" void NumberIO_WriteHex (unsigned int x, unsigned int n)
{
- typedef struct _T4_a _T4;
+ typedef struct WriteHex__T4_a WriteHex__T4;
- struct _T4_a { char array[MaxLineLength+1]; };
- _T4 a;
+ struct WriteHex__T4_a { char array[MaxLineLength+1]; };
+ WriteHex__T4 a;
NumberIO_HexToStr (x, n, (char *) &a.array[0], MaxLineLength);
StrIO_WriteString ((const char *) &a.array[0], MaxLineLength);
extern "C" void NumberIO_ReadInt (int *x)
{
- typedef struct _T5_a _T5;
+ typedef struct ReadInt__T5_a ReadInt__T5;
- struct _T5_a { char array[MaxLineLength+1]; };
- _T5 a;
+ struct ReadInt__T5_a { char array[MaxLineLength+1]; };
+ ReadInt__T5 a;
StrIO_ReadString ((char *) &a.array[0], MaxLineLength);
NumberIO_StrToInt ((const char *) &a.array[0], MaxLineLength, x);
extern "C" void NumberIO_WriteInt (int x, unsigned int n)
{
- typedef struct _T6_a _T6;
+ typedef struct WriteInt__T6_a WriteInt__T6;
- struct _T6_a { char array[MaxLineLength+1]; };
- _T6 a;
+ struct WriteInt__T6_a { char array[MaxLineLength+1]; };
+ WriteInt__T6 a;
NumberIO_IntToStr (x, n, (char *) &a.array[0], MaxLineLength);
StrIO_WriteString ((const char *) &a.array[0], MaxLineLength);
extern "C" void NumberIO_CardToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high)
{
- typedef struct _T7_a _T7;
+ typedef struct CardToStr__T7_a CardToStr__T7;
- struct _T7_a { unsigned int array[MaxDigits-1+1]; };
+ struct CardToStr__T7_a { unsigned int array[MaxDigits-1+1]; };
unsigned int i;
unsigned int j;
unsigned int Higha;
- _T7 buf;
+ CardToStr__T7 buf;
i = 0;
do {
extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high)
{
- typedef struct _T8_a _T8;
+ typedef struct HexToStr__T8_a HexToStr__T8;
- struct _T8_a { unsigned int array[MaxHexDigits-1+1]; };
+ struct HexToStr__T8_a { unsigned int array[MaxHexDigits-1+1]; };
unsigned int i;
unsigned int j;
unsigned int Higha;
- _T8 buf;
+ HexToStr__T8 buf;
i = 0;
do {
extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int _a_high)
{
- typedef struct _T9_a _T9;
+ typedef struct IntToStr__T9_a IntToStr__T9;
- struct _T9_a { unsigned int array[MaxDigits-1+1]; };
+ struct IntToStr__T9_a { unsigned int array[MaxDigits-1+1]; };
unsigned int i;
unsigned int j;
unsigned int c;
unsigned int Higha;
- _T9 buf;
+ IntToStr__T9 buf;
unsigned int Negative;
if (x < 0)
extern "C" void NumberIO_ReadOct (unsigned int *x)
{
- typedef struct _T10_a _T10;
+ typedef struct ReadOct__T10_a ReadOct__T10;
- struct _T10_a { char array[MaxLineLength+1]; };
- _T10 a;
+ struct ReadOct__T10_a { char array[MaxLineLength+1]; };
+ ReadOct__T10 a;
StrIO_ReadString ((char *) &a.array[0], MaxLineLength);
NumberIO_StrToOct ((const char *) &a.array[0], MaxLineLength, x);
extern "C" void NumberIO_WriteOct (unsigned int x, unsigned int n)
{
- typedef struct _T11_a _T11;
+ typedef struct WriteOct__T11_a WriteOct__T11;
- struct _T11_a { char array[MaxLineLength+1]; };
- _T11 a;
+ struct WriteOct__T11_a { char array[MaxLineLength+1]; };
+ WriteOct__T11 a;
NumberIO_OctToStr (x, n, (char *) &a.array[0], MaxLineLength);
StrIO_WriteString ((const char *) &a.array[0], MaxLineLength);
extern "C" void NumberIO_OctToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high)
{
- typedef struct _T12_a _T12;
+ typedef struct OctToStr__T12_a OctToStr__T12;
- struct _T12_a { unsigned int array[MaxOctDigits-1+1]; };
+ struct OctToStr__T12_a { unsigned int array[MaxOctDigits-1+1]; };
unsigned int i;
unsigned int j;
unsigned int Higha;
- _T12 buf;
+ OctToStr__T12 buf;
i = 0;
do {
extern "C" void NumberIO_ReadBin (unsigned int *x)
{
- typedef struct _T13_a _T13;
+ typedef struct ReadBin__T13_a ReadBin__T13;
- struct _T13_a { char array[MaxLineLength+1]; };
- _T13 a;
+ struct ReadBin__T13_a { char array[MaxLineLength+1]; };
+ ReadBin__T13 a;
StrIO_ReadString ((char *) &a.array[0], MaxLineLength);
NumberIO_StrToBin ((const char *) &a.array[0], MaxLineLength, x);
extern "C" void NumberIO_WriteBin (unsigned int x, unsigned int n)
{
- typedef struct _T14_a _T14;
+ typedef struct WriteBin__T14_a WriteBin__T14;
- struct _T14_a { char array[MaxLineLength+1]; };
- _T14 a;
+ struct WriteBin__T14_a { char array[MaxLineLength+1]; };
+ WriteBin__T14 a;
NumberIO_BinToStr (x, n, (char *) &a.array[0], MaxLineLength);
StrIO_WriteString ((const char *) &a.array[0], MaxLineLength);
extern "C" void NumberIO_BinToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high)
{
- typedef struct _T15_a _T15;
+ typedef struct BinToStr__T15_a BinToStr__T15;
- struct _T15_a { unsigned int array[MaxBits-1+1]; };
+ struct BinToStr__T15_a { unsigned int array[MaxBits-1+1]; };
unsigned int i;
unsigned int j;
unsigned int Higha;
- _T15 buf;
+ BinToStr__T15 buf;
i = 0;
do {
}
}
-extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_NumberIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_NumberIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
extern "C" void Output_WriteCard (unsigned int card, unsigned int fieldlength)
{
- typedef struct _T1_a _T1;
+ typedef struct WriteCard__T1_a WriteCard__T1;
- struct _T1_a { char array[20+1]; };
- _T1 s;
+ struct WriteCard__T1_a { char array[20+1]; };
+ WriteCard__T1 s;
NumberIO_CardToStr (card, fieldlength, (char *) &s.array[0], 20);
Output_WriteString ((const char *) &s.array[0], 20);
__builtin_unreachable ();
}
-extern "C" void _M2_Output_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Output_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
stdout_ = TRUE;
buffer = static_cast<DynamicStrings_String> (NULL);
outputFile = FIO_StdOut;
}
-extern "C" void _M2_Output_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Output_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
# define MaxPushBackStack 8192
# define MaxFileName 4096
-typedef struct _T2_a _T2;
+typedef struct PushBackInput__T2_a PushBackInput__T2;
-typedef struct _T3_a _T3;
+typedef struct PushBackInput__T3_a PushBackInput__T3;
-struct _T2_a { char array[MaxFileName+1]; };
-struct _T3_a { char array[MaxPushBackStack+1]; };
-static _T2 FileName;
-static _T3 CharStack;
+struct PushBackInput__T2_a { char array[MaxFileName+1]; };
+struct PushBackInput__T3_a { char array[MaxPushBackStack+1]; };
+static PushBackInput__T2 FileName;
+static PushBackInput__T3 CharStack;
static unsigned int ExitStatus;
static unsigned int Column;
static unsigned int StackPtr;
}
else
{
- Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 85);
+ Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61);
}
return ch;
/* static analysis guarentees a RETURN statement will be used before here. */
l -= 1;
if ((PushBackInput_PutCh (a[l])) != a[l])
{
- Debug_Halt ((const char *) "assert failed", 13, 132, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 85);
+ Debug_Halt ((const char *) "assert failed", 13, 132, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61);
}
}
}
i -= 1;
if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast<int> (i)))) != (DynamicStrings_char (s, static_cast<int> (i))))
{
- Debug_Halt ((const char *) "assert failed", 13, 113, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 85);
+ Debug_Halt ((const char *) "assert failed", 13, 113, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61);
}
}
}
extern "C" void PushBackInput_WarnString (DynamicStrings_String s)
{
- typedef char *_T1;
+ typedef char *WarnString__T1;
- _T1 p;
+ WarnString__T1 p;
- p = static_cast<_T1> (DynamicStrings_string (s));
+ p = static_cast<WarnString__T1> (DynamicStrings_string (s));
StrIO_WriteString ((const char *) &FileName.array[0], MaxFileName);
StdIO_Write (':');
NumberIO_WriteCard (LineNo, 0);
__builtin_unreachable ();
}
-extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
PushBackInput_SetDebug (FALSE);
Init ();
}
-extern "C" void _M2_PushBackInput_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_PushBackInput_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct RTExceptions_ProcedureHandler_p RTExceptions_ProcedureHandler;
# define MaxBuffer 4096
-typedef struct _T1_r _T1;
+typedef struct RTExceptions__T1_r RTExceptions__T1;
-typedef char *PtrToChar;
+typedef char *RTExceptions_PtrToChar;
-typedef struct _T2_a _T2;
+typedef struct RTExceptions__T2_a RTExceptions__T2;
-typedef struct _T3_r _T3;
+typedef struct RTExceptions__T3_r RTExceptions__T3;
-typedef _T3 *Handler;
+typedef RTExceptions__T3 *RTExceptions_Handler;
-typedef _T1 *RTExceptions_EHBlock;
+typedef RTExceptions__T1 *RTExceptions_EHBlock;
typedef void (*RTExceptions_ProcedureHandler_t) (void);
struct RTExceptions_ProcedureHandler_p { RTExceptions_ProcedureHandler_t proc; };
-struct _T2_a { char array[MaxBuffer+1]; };
-struct _T1_r {
- _T2 buffer;
- unsigned int number;
- Handler handlers;
- RTExceptions_EHBlock right;
- };
-
-struct _T3_r {
- RTExceptions_ProcedureHandler p;
- unsigned int n;
- Handler right;
- Handler left;
- Handler stack;
- };
+struct RTExceptions__T2_a { char array[MaxBuffer+1]; };
+struct RTExceptions__T1_r {
+ RTExceptions__T2 buffer;
+ unsigned int number;
+ RTExceptions_Handler handlers;
+ RTExceptions_EHBlock right;
+ };
+
+struct RTExceptions__T3_r {
+ RTExceptions_ProcedureHandler p;
+ unsigned int n;
+ RTExceptions_Handler right;
+ RTExceptions_Handler left;
+ RTExceptions_Handler stack;
+ };
static unsigned int inException;
-static Handler freeHandler;
+static RTExceptions_Handler freeHandler;
static RTExceptions_EHBlock freeEHB;
static RTExceptions_EHBlock currentEHB;
static void * currentSource;
findHandler -
*/
-static Handler findHandler (RTExceptions_EHBlock e, unsigned int number);
+static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number);
/*
InvokeHandler - invokes the associated handler for the current
NewHandler - returns a new handler.
*/
-static Handler NewHandler (void);
+static RTExceptions_Handler NewHandler (void);
/*
KillHandler - returns, NIL, and places, h, onto the free list.
*/
-static Handler KillHandler (Handler h);
+static RTExceptions_Handler KillHandler (RTExceptions_Handler h);
/*
KillHandlers - kills all handlers in the list.
*/
-static Handler KillHandlers (Handler h);
+static RTExceptions_Handler KillHandlers (RTExceptions_Handler h);
/*
InitHandler -
*/
-static Handler InitHandler (Handler h, Handler l, Handler r, Handler s, unsigned int number, RTExceptions_ProcedureHandler proc);
+static RTExceptions_Handler InitHandler (RTExceptions_Handler h, RTExceptions_Handler l, RTExceptions_Handler r, RTExceptions_Handler s, unsigned int number, RTExceptions_ProcedureHandler proc);
/*
SubHandler -
*/
-static void SubHandler (Handler h);
+static void SubHandler (RTExceptions_Handler h);
/*
AddHandler - add, e, to the end of the list of handlers.
*/
-static void AddHandler (RTExceptions_EHBlock e, Handler h);
+static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h);
/*
indexf - raise an index out of bounds exception.
findHandler -
*/
-static Handler findHandler (RTExceptions_EHBlock e, unsigned int number)
+static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number)
{
- Handler h;
+ RTExceptions_Handler h;
h = e->handlers->right;
while ((h != e->handlers) && (number != h->n))
static void InvokeHandler (void)
{
- Handler h;
+ RTExceptions_Handler h;
h = findHandler (currentEHB, currentEHB->number);
if (h == NULL)
static void * stripPath (void * s)
{
- PtrToChar f;
- PtrToChar p;
+ RTExceptions_PtrToChar f;
+ RTExceptions_PtrToChar p;
- p = static_cast<PtrToChar> (s);
- f = static_cast<PtrToChar> (s);
+ p = static_cast<RTExceptions_PtrToChar> (s);
+ f = static_cast<RTExceptions_PtrToChar> (s);
while ((*p) != ASCII_nul)
{
if ((*p) == '/')
static void addFile (void * s, unsigned int *i)
{
- PtrToChar p;
+ RTExceptions_PtrToChar p;
- p = static_cast<PtrToChar> (stripPath (s));
+ p = static_cast<RTExceptions_PtrToChar> (stripPath (s));
while ((p != NULL) && ((*p) != ASCII_nul))
{
addChar ((*p), i);
static void addStr (void * s, unsigned int *i)
{
- PtrToChar p;
+ RTExceptions_PtrToChar p;
- p = static_cast<PtrToChar> (s);
+ p = static_cast<RTExceptions_PtrToChar> (s);
while ((p != NULL) && ((*p) != ASCII_nul))
{
addChar ((*p), i);
if (freeEHB == NULL)
{
- Storage_ALLOCATE ((void **) &e, sizeof (_T1));
+ Storage_ALLOCATE ((void **) &e, sizeof (RTExceptions__T1));
}
else
{
NewHandler - returns a new handler.
*/
-static Handler NewHandler (void)
+static RTExceptions_Handler NewHandler (void)
{
- Handler h;
+ RTExceptions_Handler h;
if (freeHandler == NULL)
{
- Storage_ALLOCATE ((void **) &h, sizeof (_T3));
+ Storage_ALLOCATE ((void **) &h, sizeof (RTExceptions__T3));
}
else
{
KillHandler - returns, NIL, and places, h, onto the free list.
*/
-static Handler KillHandler (Handler h)
+static RTExceptions_Handler KillHandler (RTExceptions_Handler h)
{
h->right = freeHandler;
freeHandler = h;
KillHandlers - kills all handlers in the list.
*/
-static Handler KillHandlers (Handler h)
+static RTExceptions_Handler KillHandlers (RTExceptions_Handler h)
{
h->left->right = freeHandler;
freeHandler = h;
InitHandler -
*/
-static Handler InitHandler (Handler h, Handler l, Handler r, Handler s, unsigned int number, RTExceptions_ProcedureHandler proc)
+static RTExceptions_Handler InitHandler (RTExceptions_Handler h, RTExceptions_Handler l, RTExceptions_Handler r, RTExceptions_Handler s, unsigned int number, RTExceptions_ProcedureHandler proc)
{
h->p = proc;
h->n = number;
SubHandler -
*/
-static void SubHandler (Handler h)
+static void SubHandler (RTExceptions_Handler h)
{
h->right->left = h->left;
h->left->right = h->right;
AddHandler - add, e, to the end of the list of handlers.
*/
-static void AddHandler (RTExceptions_EHBlock e, Handler h)
+static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
{
h->right = e->handlers;
h->left = e->handlers->left;
static void indexf (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 612, 9, const_cast<void*> (reinterpret_cast<const void*>("indexf")), const_cast<void*> (reinterpret_cast<const void*>("array index out of bounds")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 612, 9, const_cast<void*> (reinterpret_cast<const void*>("indexf")), const_cast<void*> (reinterpret_cast<const void*>("array index out of bounds")));
}
static void range (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 624, 9, const_cast<void*> (reinterpret_cast<const void*>("range")), const_cast<void*> (reinterpret_cast<const void*>("assignment out of range")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 624, 9, const_cast<void*> (reinterpret_cast<const void*>("range")), const_cast<void*> (reinterpret_cast<const void*>("assignment out of range")));
}
static void casef (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 636, 9, const_cast<void*> (reinterpret_cast<const void*>("casef")), const_cast<void*> (reinterpret_cast<const void*>("case selector out of range")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 636, 9, const_cast<void*> (reinterpret_cast<const void*>("casef")), const_cast<void*> (reinterpret_cast<const void*>("case selector out of range")));
}
static void invalidloc (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 648, 9, const_cast<void*> (reinterpret_cast<const void*>("invalidloc")), const_cast<void*> (reinterpret_cast<const void*>("invalid address referenced")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 648, 9, const_cast<void*> (reinterpret_cast<const void*>("invalidloc")), const_cast<void*> (reinterpret_cast<const void*>("invalid address referenced")));
}
static void function (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 660, 9, const_cast<void*> (reinterpret_cast<const void*>("function")), const_cast<void*> (reinterpret_cast<const void*>("... function ... "))); /* --fixme-- what has happened ? */
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 660, 9, const_cast<void*> (reinterpret_cast<const void*>("function")), const_cast<void*> (reinterpret_cast<const void*>("... function ... "))); /* --fixme-- what has happened ? */
}
static void wholevalue (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 672, 9, const_cast<void*> (reinterpret_cast<const void*>("wholevalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 672, 9, const_cast<void*> (reinterpret_cast<const void*>("wholevalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
}
static void wholediv (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 684, 9, const_cast<void*> (reinterpret_cast<const void*>("wholediv")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 684, 9, const_cast<void*> (reinterpret_cast<const void*>("wholediv")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
}
static void realvalue (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 696, 9, const_cast<void*> (reinterpret_cast<const void*>("realvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal real value exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 696, 9, const_cast<void*> (reinterpret_cast<const void*>("realvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal real value exception")));
}
static void realdiv (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 708, 9, const_cast<void*> (reinterpret_cast<const void*>("realdiv")), const_cast<void*> (reinterpret_cast<const void*>("real number division by zero exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 708, 9, const_cast<void*> (reinterpret_cast<const void*>("realdiv")), const_cast<void*> (reinterpret_cast<const void*>("real number division by zero exception")));
}
static void complexvalue (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 720, 9, const_cast<void*> (reinterpret_cast<const void*>("complexvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal complex value exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 720, 9, const_cast<void*> (reinterpret_cast<const void*>("complexvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal complex value exception")));
}
static void complexdiv (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 732, 9, const_cast<void*> (reinterpret_cast<const void*>("complexdiv")), const_cast<void*> (reinterpret_cast<const void*>("complex number division by zero exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 732, 9, const_cast<void*> (reinterpret_cast<const void*>("complexdiv")), const_cast<void*> (reinterpret_cast<const void*>("complex number division by zero exception")));
}
static void protection (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 744, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 744, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
}
static void systemf (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 756, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 756, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
}
static void coroutine (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 768, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 768, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
}
static void exception (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 780, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
+ RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 780, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
}
static void TidyUp (void)
{
- Handler f;
+ RTExceptions_Handler f;
RTExceptions_EHBlock e;
if (currentEHB != NULL)
{
f = freeHandler;
freeHandler = freeHandler->right;
- Storage_DEALLOCATE ((void **) &f, sizeof (_T3));
+ Storage_DEALLOCATE ((void **) &f, sizeof (RTExceptions__T3));
}
while (freeEHB != NULL)
{
e = freeEHB;
freeEHB = freeEHB->right;
- Storage_DEALLOCATE ((void **) &e, sizeof (_T1));
+ Storage_DEALLOCATE ((void **) &e, sizeof (RTExceptions__T1));
}
}
extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int number, RTExceptions_ProcedureHandler p)
{
- Handler h;
- Handler i;
+ RTExceptions_Handler h;
+ RTExceptions_Handler i;
h = findHandler (e, number);
if (h == NULL)
extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int number)
{
- Handler h;
- Handler i;
+ RTExceptions_Handler h;
+ RTExceptions_Handler i;
h = findHandler (e, number);
if (h != NULL)
{
if (currentEHB == NULL)
{
- M2RTS_Halt ((const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod", 84, 598, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39);
+ M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod", 60, 598, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39);
}
else
{
return currentEHB;
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
__builtin_unreachable ();
}
__builtin_unreachable ();
}
-extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
Init ();
}
-extern "C" void _M2_RTExceptions_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_RTExceptions_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
TidyUp ();
}
__builtin_unreachable ();
}
-extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_SFIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SFIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct StdIO_ProcRead_p StdIO_ProcRead;
# define MaxStack 40
-typedef struct _T1_a _T1;
+typedef struct StdIO__T1_a StdIO__T1;
-typedef struct _T2_a _T2;
+typedef struct StdIO__T2_a StdIO__T2;
typedef void (*StdIO_ProcWrite_t) (char);
struct StdIO_ProcWrite_p { StdIO_ProcWrite_t proc; };
typedef void (*StdIO_ProcRead_t) (char *);
struct StdIO_ProcRead_p { StdIO_ProcRead_t proc; };
-struct _T1_a { StdIO_ProcWrite array[MaxStack+1]; };
-struct _T2_a { StdIO_ProcRead array[MaxStack+1]; };
-static _T1 StackW;
+struct StdIO__T1_a { StdIO_ProcWrite array[MaxStack+1]; };
+struct StdIO__T2_a { StdIO_ProcRead array[MaxStack+1]; };
+static StdIO__T1 StackW;
static unsigned int StackWPtr;
-static _T2 StackR;
+static StdIO__T2 StackR;
static unsigned int StackRPtr;
/*
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1);
__builtin_unreachable ();
}
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- ReturnException ("/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1);
+ ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1);
__builtin_unreachable ();
}
-extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
StackWPtr = 0;
StackRPtr = 0;
StdIO_PushInput ((StdIO_ProcRead) {(StdIO_ProcRead_t) IO_Read});
}
-extern "C" void _M2_StdIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StdIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
__builtin_unreachable ();
}
-extern "C" void _M2_Storage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Storage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_Storage_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Storage_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
__builtin_unreachable ();
}
-extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_StrCase_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrCase_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
}
}
-extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
/* IsATTY := isatty() */
IsATTY = FALSE;
}
-extern "C" void _M2_StrIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
}
}
-extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_StrLib_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrLib_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
typedef struct SymbolKey_PerformOperation_p SymbolKey_PerformOperation;
-typedef struct Node_r Node;
+typedef struct SymbolKey_Node_r SymbolKey_Node;
-typedef Node *SymbolKey_SymbolTree;
+typedef SymbolKey_Node *SymbolKey_SymbolTree;
typedef unsigned int (*SymbolKey_IsSymbol_t) (unsigned int);
struct SymbolKey_IsSymbol_p { SymbolKey_IsSymbol_t proc; };
typedef void (*SymbolKey_PerformOperation_t) (unsigned int);
struct SymbolKey_PerformOperation_p { SymbolKey_PerformOperation_t proc; };
-struct Node_r {
- NameKey_Name KeyName;
- unsigned int KeySym;
- SymbolKey_SymbolTree Left;
- SymbolKey_SymbolTree Right;
- };
+struct SymbolKey_Node_r {
+ NameKey_Name KeyName;
+ unsigned int KeySym;
+ SymbolKey_SymbolTree Left;
+ SymbolKey_SymbolTree Right;
+ };
extern "C" void SymbolKey_InitTree (SymbolKey_SymbolTree *t);
extern "C" void SymbolKey_KillTree (SymbolKey_SymbolTree *t);
(*parent) = t;
if (t == NULL)
{
- Debug_Halt ((const char *) "parameter t should never be NIL", 31, 240, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 85);
+ Debug_Halt ((const char *) "parameter t should never be NIL", 31, 240, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 61);
}
Assertion_Assert (t->Right == NULL);
(*child) = t->Left;
extern "C" void SymbolKey_InitTree (SymbolKey_SymbolTree *t)
{
- Storage_ALLOCATE ((void **) &(*t), sizeof (Node)); /* The value entity */
+ Storage_ALLOCATE ((void **) &(*t), sizeof (SymbolKey_Node)); /* The value entity */
(*t)->Left = NULL;
(*t)->Right = NULL;
}
{
SymbolKey_KillTree (&(*t)->Left);
SymbolKey_KillTree (&(*t)->Right);
- Storage_DEALLOCATE ((void **) &(*t), sizeof (Node));
+ Storage_DEALLOCATE ((void **) &(*t), sizeof (SymbolKey_Node));
(*t) = NULL;
}
}
if (father == t)
{
/* empty tree, add it to the left branch of t */
- Storage_ALLOCATE ((void **) &child, sizeof (Node));
+ Storage_ALLOCATE ((void **) &child, sizeof (SymbolKey_Node));
father->Left = child;
}
else
{
if (NameKey < father->KeyName)
{
- Storage_ALLOCATE ((void **) &child, sizeof (Node));
+ Storage_ALLOCATE ((void **) &child, sizeof (SymbolKey_Node));
father->Left = child;
}
else if (NameKey > father->KeyName)
{
/* avoid dangling else. */
- Storage_ALLOCATE ((void **) &child, sizeof (Node));
+ Storage_ALLOCATE ((void **) &child, sizeof (SymbolKey_Node));
father->Right = child;
}
}
}
else
{
- Debug_Halt ((const char *) "symbol already stored", 21, 156, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 85);
+ Debug_Halt ((const char *) "symbol already stored", 21, 156, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 61);
}
}
/* (as in a single linked list) to child^.Right */
father->Right = child->Right;
}
- Storage_DEALLOCATE ((void **) &child, sizeof (Node));
+ Storage_DEALLOCATE ((void **) &child, sizeof (SymbolKey_Node));
}
else
{
/* (as in a single linked list) to child^.Left. */
father->Left = child->Left;
}
- Storage_DEALLOCATE ((void **) &child, sizeof (Node));
+ Storage_DEALLOCATE ((void **) &child, sizeof (SymbolKey_Node));
}
}
else
{
- Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, 223, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 85);
+ Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, 223, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 61);
}
}
}
}
-extern "C" void _M2_SymbolKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SymbolKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_SymbolKey_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SymbolKey_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
(*a) = libc_malloc (static_cast<size_t> (size));
if ((*a) == NULL)
{
- Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 82);
+ Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58);
}
if (enableTrace && trace)
{
}
if ((libc_memset ((*a), 0, static_cast<size_t> (size))) != (*a))
{
- Debug_Halt ((const char *) "memset should have returned the first parameter", 47, 76, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 82);
+ Debug_Halt ((const char *) "memset should have returned the first parameter", 47, 76, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58);
}
}
if (enableDeallocation)
(*a) = libc_realloc ((*a), static_cast<size_t> (size));
if ((*a) == NULL)
{
- Debug_Halt ((const char *) "out of memory error", 19, 119, (const char *) "/home/gaius/GM2/graft-combine/gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 82);
+ Debug_Halt ((const char *) "out of memory error", 19, 119, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58);
}
if (enableTrace && trace)
{
{
}
-extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
callno = 0;
if (enableTrace)
}
}
-extern "C" void _M2_SysStorage_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SysStorage_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
static void Init (void)
{
- typedef struct _T1_a _T1;
+ typedef struct Init__T1_a Init__T1;
- struct _T1_a { char array[1+1]; };
- _T1 a;
+ struct Init__T1_a { char array[1+1]; };
+ Init__T1 a;
SymbolKey_InitTree (&ReservedWords);
Debugging = FALSE;
extern "C" void bnflex_AdvanceToken (void)
{
- typedef struct _T2_a _T2;
+ typedef struct AdvanceToken__T2_a AdvanceToken__T2;
- struct _T2_a { char array[MaxNameLength+1]; };
- _T2 a;
+ struct AdvanceToken__T2_a { char array[MaxNameLength+1]; };
+ AdvanceToken__T2 a;
unsigned int i;
i = 0;
extern "C" void bnflex_PushBackToken (NameKey_Name t)
{
- typedef struct _T3_a _T3;
+ typedef struct PushBackToken__T3_a PushBackToken__T3;
- struct _T3_a { char array[MaxNameLength+1]; };
- _T3 a;
+ struct PushBackToken__T3_a { char array[MaxNameLength+1]; };
+ PushBackToken__T3 a;
NameKey_GetKey (t, (char *) &a.array[0], MaxNameLength);
PushBackInput_PutString ((const char *) &a.array[0], MaxNameLength);
Debugging = flag;
}
-extern "C" void _M2_bnflex_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_bnflex_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
Init ();
}
-extern "C" void _M2_bnflex_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_bnflex_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
# define BaseRightLimit 75
# define BaseRightMargin 50
# define BaseNewLine 3
-typedef struct termdesc_r termdesc;
+typedef struct pge_termdesc_r pge_termdesc;
-typedef termdesc *TermDesc;
+typedef pge_termdesc *pge_TermDesc;
-typedef struct DoProcedure_p DoProcedure;
+typedef struct pge_DoProcedure_p pge_DoProcedure;
-typedef unsigned int SetOfStop;
+typedef unsigned int pge_SetOfStop;
-typedef struct _T1_r _T1;
+typedef struct pge__T1_r pge__T1;
-typedef _T1 *IdentDesc;
+typedef pge__T1 *pge_IdentDesc;
-typedef struct _T2_r _T2;
+typedef struct pge__T2_r pge__T2;
-typedef _T2 *ProductionDesc;
+typedef pge__T2 *pge_ProductionDesc;
-typedef struct _T3_r _T3;
+typedef struct pge__T3_r pge__T3;
-typedef _T3 *StatementDesc;
+typedef pge__T3 *pge_StatementDesc;
-typedef struct _T4_r _T4;
+typedef struct pge__T4_r pge__T4;
-typedef _T4 *ExpressionDesc;
+typedef pge__T4 *pge_ExpressionDesc;
-typedef struct _T5_r _T5;
+typedef struct pge__T5_r pge__T5;
-typedef struct _T6_r _T6;
+typedef struct pge__T6_r pge__T6;
-typedef _T6 *FollowDesc;
+typedef pge__T6 *pge_FollowDesc;
-typedef struct _T7_r _T7;
+typedef struct pge__T7_r pge__T7;
-typedef _T7 *SetDesc;
+typedef pge__T7 *pge_SetDesc;
-typedef struct _T8_r _T8;
+typedef struct pge__T8_r pge__T8;
-typedef _T8 *CodeDesc;
+typedef pge__T8 *pge_CodeDesc;
-typedef struct _T9_r _T9;
+typedef struct pge__T9_r pge__T9;
-typedef _T9 *CodeHunk;
+typedef pge__T9 *pge_CodeHunk;
-typedef struct _T10_a _T10;
+typedef struct pge__T10_a pge__T10;
-typedef struct _T11_a _T11;
+typedef struct pge__T11_a pge__T11;
-typedef enum {idel, tokel, litel} ElementType;
+typedef enum {pge_idel, pge_tokel, pge_litel} pge_ElementType;
-typedef enum {m2none, m2if, m2elsif, m2while} m2condition;
+typedef enum {pge_m2none, pge_m2if, pge_m2elsif, pge_m2while} pge_m2condition;
-typedef enum {unknown, true_, false_} TraverseResult;
+typedef enum {pge_unknown, pge_true, pge_false} pge_TraverseResult;
-typedef enum {id, lit, sub, opt, mult, m2} FactorType;
+typedef enum {pge_id, pge_lit, pge_sub, pge_opt, pge_mult, pge_m2} pge_FactorType;
-typedef _T5 *FactorDesc;
+typedef pge__T5 *pge_FactorDesc;
-struct termdesc_r {
- FactorDesc factor;
- TermDesc next;
- FollowDesc followinfo;
- unsigned int line;
- };
+struct pge_termdesc_r {
+ pge_FactorDesc factor;
+ pge_TermDesc next;
+ pge_FollowDesc followinfo;
+ unsigned int line;
+ };
-typedef void (*DoProcedure_t) (ProductionDesc);
-struct DoProcedure_p { DoProcedure_t proc; };
+typedef void (*pge_DoProcedure_t) (pge_ProductionDesc);
+struct pge_DoProcedure_p { pge_DoProcedure_t proc; };
-struct _T1_r {
- ProductionDesc definition;
- NameKey_Name name;
- unsigned int line;
- };
+struct pge__T1_r {
+ pge_ProductionDesc definition;
+ NameKey_Name name;
+ unsigned int line;
+ };
-struct _T2_r {
- ProductionDesc next;
- StatementDesc statement;
- SetDesc first;
- unsigned int firstsolved;
- FollowDesc followinfo;
- unsigned int line;
- NameKey_Name description;
- };
+struct pge__T2_r {
+ pge_ProductionDesc next;
+ pge_StatementDesc statement;
+ pge_SetDesc first;
+ unsigned int firstsolved;
+ pge_FollowDesc followinfo;
+ unsigned int line;
+ NameKey_Name description;
+ };
-struct _T3_r {
- IdentDesc ident;
- ExpressionDesc expr;
- FollowDesc followinfo;
- unsigned int line;
- };
+struct pge__T3_r {
+ pge_IdentDesc ident;
+ pge_ExpressionDesc expr;
+ pge_FollowDesc followinfo;
+ unsigned int line;
+ };
-struct _T4_r {
- TermDesc term;
- FollowDesc followinfo;
- unsigned int line;
- };
+struct pge__T4_r {
+ pge_TermDesc term;
+ pge_FollowDesc followinfo;
+ unsigned int line;
+ };
-struct _T5_r {
- FollowDesc followinfo;
- FactorDesc next;
- unsigned int line;
- FactorDesc pushed;
- FactorType type; /* case tag */
- union {
- IdentDesc ident;
- NameKey_Name string;
- ExpressionDesc expr;
- CodeDesc code;
- };
- };
+struct pge__T5_r {
+ pge_FollowDesc followinfo;
+ pge_FactorDesc next;
+ unsigned int line;
+ pge_FactorDesc pushed;
+ pge_FactorType type; /* case tag */
+ union {
+ pge_IdentDesc ident;
+ NameKey_Name string;
+ pge_ExpressionDesc expr;
+ pge_CodeDesc code;
+ };
+ };
-struct _T6_r {
- unsigned int calcfollow;
- SetDesc follow;
- TraverseResult reachend;
- TraverseResult epsilon;
- unsigned int line;
- };
+struct pge__T6_r {
+ unsigned int calcfollow;
+ pge_SetDesc follow;
+ pge_TraverseResult reachend;
+ pge_TraverseResult epsilon;
+ unsigned int line;
+ };
-struct _T7_r {
- SetDesc next;
- ElementType type; /* case tag */
- union {
- IdentDesc ident;
- NameKey_Name string;
- };
- };
-
-struct _T8_r {
- CodeHunk code;
- unsigned int indent;
- unsigned int line;
- };
-
-struct _T10_a { char array[MaxCodeHunkLength+1]; };
-struct _T11_a { char array[MaxFileName+1]; };
-struct _T9_r {
- _T10 codetext;
- CodeHunk next;
- };
+struct pge__T7_r {
+ pge_SetDesc next;
+ pge_ElementType type; /* case tag */
+ union {
+ pge_IdentDesc ident;
+ NameKey_Name string;
+ };
+ };
+
+struct pge__T8_r {
+ pge_CodeHunk code;
+ unsigned int indent;
+ unsigned int line;
+ };
+
+struct pge__T10_a { char array[MaxCodeHunkLength+1]; };
+struct pge__T11_a { char array[MaxFileName+1]; };
+struct pge__T9_r {
+ pge__T10 codetext;
+ pge_CodeHunk next;
+ };
static unsigned int LastLineNo;
static unsigned int Finished;
static unsigned int PrettyPrint;
static unsigned int EmitCode;
static unsigned int Texinfo;
+static unsigned int Sphinx;
static unsigned int FreeDocLicense;
static unsigned int Debugging;
static unsigned int WasNoError;
static unsigned int LinePrologue;
static unsigned int LineEpilogue;
static unsigned int LineDeclaration;
-static CodeHunk CodePrologue;
-static CodeHunk CodeEpilogue;
-static CodeHunk CodeDeclaration;
-static ProductionDesc CurrentProduction;
-static ProductionDesc TailProduction;
-static ProductionDesc HeadProduction;
-static ExpressionDesc CurrentExpression;
-static TermDesc CurrentTerm;
-static FactorDesc CurrentFactor;
-static IdentDesc CurrentIdent;
-static StatementDesc CurrentStatement;
-static SetDesc CurrentSetDesc;
+static pge_CodeHunk CodePrologue;
+static pge_CodeHunk CodeEpilogue;
+static pge_CodeHunk CodeDeclaration;
+static pge_ProductionDesc CurrentProduction;
+static pge_ProductionDesc TailProduction;
+static pge_ProductionDesc HeadProduction;
+static pge_ExpressionDesc CurrentExpression;
+static pge_TermDesc CurrentTerm;
+static pge_FactorDesc CurrentFactor;
+static pge_IdentDesc CurrentIdent;
+static pge_StatementDesc CurrentStatement;
+static pge_SetDesc CurrentSetDesc;
static SymbolKey_SymbolTree ReverseValues;
static SymbolKey_SymbolTree Values;
static SymbolKey_SymbolTree ReverseAliases;
static NameKey_Name TokenTypeProc;
static NameKey_Name ErrorProcArray;
static NameKey_Name ErrorProcString;
-static _T11 ArgName;
-static _T11 FileName;
+static pge__T11 ArgName;
+static pge__T11 FileName;
static unsigned int OnLineStart;
static unsigned int BeginningOfLine;
static unsigned int Indent;
DescribeStop - issues a message explaining what tokens were expected
*/
-static DynamicStrings_String DescribeStop (SetOfStop stopset);
+static DynamicStrings_String DescribeStop (pge_SetOfStop stopset);
/*
DescribeError - issues a message explaining what tokens were expected
PrettyFollow -
*/
-static void PrettyFollow (const char *start_, unsigned int _start_high, const char *end_, unsigned int _end_high, FollowDesc f);
+static void PrettyFollow (const char *start_, unsigned int _start_high, const char *end_, unsigned int _end_high, pge_FollowDesc f);
/*
NewFollow - creates a new follow descriptor and returns the data structure.
*/
-static FollowDesc NewFollow (void);
+static pge_FollowDesc NewFollow (void);
/*
AssignEpsilon - assigns the epsilon value and sets the epsilon to value,
providing condition is TRUE.
*/
-static void AssignEpsilon (unsigned int condition, FollowDesc f, TraverseResult value);
+static void AssignEpsilon (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetEpsilon - returns the value of epsilon
*/
-static TraverseResult GetEpsilon (FollowDesc f);
+static pge_TraverseResult GetEpsilon (pge_FollowDesc f);
/*
AssignReachEnd - assigns the reachend value providing that, condition, is TRUE.
*/
-static void AssignReachEnd (unsigned int condition, FollowDesc f, TraverseResult value);
+static void AssignReachEnd (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetReachEnd - returns the value of reachend
*/
-static TraverseResult GetReachEnd (FollowDesc f);
+static pge_TraverseResult GetReachEnd (pge_FollowDesc f);
/*
AssignFollow - assigns the follow set and sets the calcfollow to TRUE.
*/
-static void AssignFollow (FollowDesc f, SetDesc s);
+static void AssignFollow (pge_FollowDesc f, pge_SetDesc s);
/*
GetFollow - returns the follow set.
*/
-static SetDesc GetFollow (FollowDesc f);
+static pge_SetDesc GetFollow (pge_FollowDesc f);
/*
NewProduction - creates a new production and returns the data structure.
*/
-static ProductionDesc NewProduction (void);
+static pge_ProductionDesc NewProduction (void);
/*
NewFactor -
*/
-static FactorDesc NewFactor (void);
+static pge_FactorDesc NewFactor (void);
/*
NewTerm - returns a new term.
*/
-static TermDesc NewTerm (void);
+static pge_TermDesc NewTerm (void);
/*
NewExpression - returns a new expression.
*/
-static ExpressionDesc NewExpression (void);
+static pge_ExpressionDesc NewExpression (void);
/*
NewStatement - returns a new statement.
*/
-static StatementDesc NewStatement (void);
+static pge_StatementDesc NewStatement (void);
/*
NewSetDesc - creates a new set description and returns the data structure.
*/
-static SetDesc NewSetDesc (void);
+static pge_SetDesc NewSetDesc (void);
/*
NewCodeDesc - creates a new code descriptor and initializes all fields to zero.
*/
-static CodeDesc NewCodeDesc (void);
+static pge_CodeDesc NewCodeDesc (void);
/*
CodeFragmentPrologue - consumes code text up to a "%" after a newline.
GetCodeFragment - collects the code fragment up until ^ %
*/
-static void GetCodeFragment (CodeHunk *h);
+static void GetCodeFragment (pge_CodeHunk *h);
/*
WriteCodeHunkList - writes the CodeHunk list in the correct order.
*/
-static void WriteCodeHunkList (CodeHunk l);
+static void WriteCodeHunkList (pge_CodeHunk l);
/*
WriteIndent - writes, n, spaces.
but it removes up to indent spaces if they exist.
*/
-static void WriteCodeHunkListIndent (CodeHunk l, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext);
+static void WriteCodeHunkListIndent (pge_CodeHunk l, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext);
/*
Add - adds a character to a code hunk and creates another code hunk if necessary.
*/
-static CodeHunk Add (CodeHunk *p, char ch, unsigned int *i);
+static pge_CodeHunk Add (pge_CodeHunk *p, char ch, unsigned int *i);
/*
ConsHunk - combine two possible code hunks.
*/
-static void ConsHunk (CodeHunk *p, CodeHunk q);
+static void ConsHunk (pge_CodeHunk *p, pge_CodeHunk q);
/*
GetName - returns the next symbol which is checked for a legal name.
a stop symbol.
*/
-static void SyntaxError (SetOfStop stop);
+static void SyntaxError (pge_SetOfStop stop);
/*
SyntaxCheck -
*/
-static void SyntaxCheck (SetOfStop stop);
+static void SyntaxCheck (pge_SetOfStop stop);
/*
Expect -
*/
-static void Expect (bnflex_TokenType t, SetOfStop stop);
+static void Expect (bnflex_TokenType t, pge_SetOfStop stop);
/*
Ident - error checking varient of Ident
*/
-static void Ident (SetOfStop stop);
+static void Ident (pge_SetOfStop stop);
/*
Modula2Code - error checking varient of Modula2Code
*/
-static void Modula2Code (SetOfStop stop);
+static void Modula2Code (pge_SetOfStop stop);
/*
StartModName := % ModuleName := GetName() ; ignore begintok CodeFragmentPrologue % =:
*/
-static void StartModName (SetOfStop stop);
+static void StartModName (pge_SetOfStop stop);
/*
EndModName :=
*/
-static void EndModName (SetOfStop stop);
+static void EndModName (pge_SetOfStop stop);
/*
DoDeclaration := % CodeFragmentDeclaration % =:
*/
-static void DoDeclaration (SetOfStop stop);
+static void DoDeclaration (pge_SetOfStop stop);
/*
CollectLiteral :=
cannot reachend
*/
-static void CollectLiteral (SetOfStop stopset);
+static void CollectLiteral (pge_SetOfStop stopset);
/*
CollectTok :=
cannot reachend
*/
-static void CollectTok (SetOfStop stopset);
+static void CollectTok (pge_SetOfStop stopset);
/*
DefineToken :=
cannot reachend
*/
-static void DefineToken (SetOfStop stopset);
+static void DefineToken (pge_SetOfStop stopset);
/*
Rules := '%' 'rules' { Defs } ExtBNF
cannot reachend
*/
-static void Rules (SetOfStop stopset);
+static void Rules (pge_SetOfStop stopset);
/*
Special := Ident
cannot reachend
*/
-static void Special (SetOfStop stopset);
+static void Special (pge_SetOfStop stopset);
/*
Factor := '%' Modula2Code '%' |
cannot reachend
*/
-static void Factor (SetOfStop stopset);
+static void Factor (pge_SetOfStop stopset);
/*
Statement :=
cannot reachend
*/
-static void Statement (SetOfStop stopset);
+static void Statement (pge_SetOfStop stopset);
/*
Defs := 'special' Special | 'token' Token |
cannot reachend
*/
-static void Defs (SetOfStop stopset);
+static void Defs (pge_SetOfStop stopset);
/*
ExtBNF := 'BNF' { Production } 'FNB'
cannot reachend
*/
-static void ExtBNF (SetOfStop stopset);
+static void ExtBNF (pge_SetOfStop stopset);
/*
Main := Header Decls Footer Rules
cannot reachend
*/
-static void Main (SetOfStop stopset);
+static void Main (pge_SetOfStop stopset);
/*
Header := '%' 'module' StartModName
cannot reachend
*/
-static void Header (SetOfStop stopset);
+static void Header (pge_SetOfStop stopset);
/*
Decls := '%' 'declaration' DoDeclaration
cannot reachend
*/
-static void Decls (SetOfStop stopset);
+static void Decls (pge_SetOfStop stopset);
/*
Footer := '%' 'module' EndModName
cannot reachend
*/
-static void Footer (SetOfStop stopset);
+static void Footer (pge_SetOfStop stopset);
/*
First := 'first' '{' { LitOrTokenOrIdent
cannot reachend
*/
-static void First (SetOfStop stopset);
+static void First (pge_SetOfStop stopset);
/*
Follow := 'follow' '{' { LitOrTokenOrIdent
cannot reachend
*/
-static void Follow (SetOfStop stopset);
+static void Follow (pge_SetOfStop stopset);
/*
LitOrTokenOrIdent := Literal
cannot reachend
*/
-static void LitOrTokenOrIdent (SetOfStop stopset);
+static void LitOrTokenOrIdent (pge_SetOfStop stopset);
/*
Literal := '"' CollectLiteral '"' |
cannot reachend
*/
-static void Literal (SetOfStop stopset);
+static void Literal (pge_SetOfStop stopset);
/*
Token := Literal DefineToken
cannot reachend
*/
-static void Token (SetOfStop stopset);
+static void Token (pge_SetOfStop stopset);
/*
ErrorProcedures := Literal
cannot reachend
*/
-static void ErrorProcedures (SetOfStop stopset);
+static void ErrorProcedures (pge_SetOfStop stopset);
/*
TokenProcedure := Literal
cannot reachend
*/
-static void TokenProcedure (SetOfStop stopset);
+static void TokenProcedure (pge_SetOfStop stopset);
/*
SymProcedure := Literal
cannot reachend
*/
-static void SymProcedure (SetOfStop stopset);
+static void SymProcedure (pge_SetOfStop stopset);
/*
Production := Statement
cannot reachend
*/
-static void Production (SetOfStop stopset);
+static void Production (pge_SetOfStop stopset);
/*
Expression :=
cannot reachend
*/
-static void Expression (SetOfStop stopset);
+static void Expression (pge_SetOfStop stopset);
/*
Term :=
cannot reachend
*/
-static void Term (SetOfStop stopset);
+static void Term (pge_SetOfStop stopset);
/*
GetDefinitionName - returns the name of the rule inside, p.
*/
-static NameKey_Name GetDefinitionName (ProductionDesc p);
+static NameKey_Name GetDefinitionName (pge_ProductionDesc p);
/*
FindDefinition - searches and returns the rule which defines, n.
*/
-static ProductionDesc FindDefinition (NameKey_Name n);
+static pge_ProductionDesc FindDefinition (NameKey_Name n);
/*
BackPatchIdent - found an ident, i, we must look for the corresponding rule and
set the definition accordingly.
*/
-static void BackPatchIdent (IdentDesc i);
+static void BackPatchIdent (pge_IdentDesc i);
/*
BackPatchFactor - runs through the factor looking for an ident
*/
-static void BackPatchFactor (FactorDesc f);
+static void BackPatchFactor (pge_FactorDesc f);
/*
BackPatchTerm - runs through all terms to find idents.
*/
-static void BackPatchTerm (TermDesc t);
+static void BackPatchTerm (pge_TermDesc t);
/*
BackPatchExpression - runs through the term to find any idents.
*/
-static void BackPatchExpression (ExpressionDesc e);
+static void BackPatchExpression (pge_ExpressionDesc e);
/*
BackPatchSet -
*/
-static void BackPatchSet (SetDesc s);
+static void BackPatchSet (pge_SetDesc s);
/*
BackPatchIdentToDefinitions - search through all the rules and add a link from any ident
to the definition.
*/
-static void BackPatchIdentToDefinitions (ProductionDesc d);
+static void BackPatchIdentToDefinitions (pge_ProductionDesc d);
/*
CalculateFirstAndFollow -
*/
-static void CalculateFirstAndFollow (ProductionDesc p);
+static void CalculateFirstAndFollow (pge_ProductionDesc p);
/*
ForeachRuleDo -
*/
-static void ForeachRuleDo (DoProcedure p);
+static void ForeachRuleDo (pge_DoProcedure p);
/*
WhileNotCompleteDo -
*/
-static void WhileNotCompleteDo (DoProcedure p);
+static void WhileNotCompleteDo (pge_DoProcedure p);
/*
NewLine - generate a newline and indent.
PrettyPara -
*/
-static void PrettyPara (const char *c1_, unsigned int _c1_high, const char *c2_, unsigned int _c2_high, ExpressionDesc e, unsigned int Left);
+static void PrettyPara (const char *c1_, unsigned int _c1_high, const char *c2_, unsigned int _c2_high, pge_ExpressionDesc e, unsigned int Left);
/*
WriteKeyTexinfo -
PrettyCommentFactor -
*/
-static void PrettyCommentFactor (FactorDesc f, unsigned int Left);
+static void PrettyCommentFactor (pge_FactorDesc f, unsigned int Left);
/*
PeepTerm - returns the length of characters in term.
*/
-static unsigned int PeepTerm (TermDesc t);
+static unsigned int PeepTerm (pge_TermDesc t);
/*
PeepExpression - returns the length of the expression.
*/
-static unsigned int PeepExpression (ExpressionDesc e);
+static unsigned int PeepExpression (pge_ExpressionDesc e);
/*
PeepFactor - returns the length of character in the factor
*/
-static unsigned int PeepFactor (FactorDesc f);
+static unsigned int PeepFactor (pge_FactorDesc f);
/*
PrettyCommentTerm -
*/
-static void PrettyCommentTerm (TermDesc t, unsigned int Left);
+static void PrettyCommentTerm (pge_TermDesc t, unsigned int Left);
/*
PrettyCommentExpression -
*/
-static void PrettyCommentExpression (ExpressionDesc e, unsigned int Left);
+static void PrettyCommentExpression (pge_ExpressionDesc e, unsigned int Left);
/*
PrettyCommentStatement -
*/
-static void PrettyCommentStatement (StatementDesc s, unsigned int Left);
+static void PrettyCommentStatement (pge_StatementDesc s, unsigned int Left);
/*
PrettyCommentProduction - generates the comment for rule, p.
*/
-static void PrettyCommentProduction (ProductionDesc p);
+static void PrettyCommentProduction (pge_ProductionDesc p);
/*
PrettyPrintProduction - pretty prints the ebnf rule, p.
*/
-static void PrettyPrintProduction (ProductionDesc p);
+static void PrettyPrintProduction (pge_ProductionDesc p);
/*
EmitFileLineTag - emits a line and file tag using the C preprocessor syntax.
EmitRule - generates a comment and code for rule, p.
*/
-static void EmitRule (ProductionDesc p);
+static void EmitRule (pge_ProductionDesc p);
/*
CodeCondition -
*/
-static void CodeCondition (m2condition m);
+static void CodeCondition (pge_m2condition m);
/*
CodeThenDo - codes a "THEN" or "DO" depending upon, m.
*/
-static void CodeThenDo (m2condition m);
+static void CodeThenDo (pge_m2condition m);
/*
CodeElseEnd - builds an ELSE END statement using string, end.
*/
-static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, FactorDesc f, unsigned int inopt);
+static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
/*
CodeEnd - codes a "END" depending upon, m.
*/
-static void CodeEnd (m2condition m, TermDesc t, unsigned int consumed, FactorDesc f, unsigned int inopt);
+static void CodeEnd (pge_m2condition m, pge_TermDesc t, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
/*
EmitNonVarCode - writes out, code, providing it is not a variable declaration.
*/
-static void EmitNonVarCode (CodeDesc code, unsigned int curpos, unsigned int left);
+static void EmitNonVarCode (pge_CodeDesc code, unsigned int curpos, unsigned int left);
/*
ChainOn -
*/
-static FactorDesc ChainOn (FactorDesc codeStack, FactorDesc f);
+static pge_FactorDesc ChainOn (pge_FactorDesc codeStack, pge_FactorDesc f);
/*
FlushCode -
*/
-static void FlushCode (FactorDesc *codeStack);
+static void FlushCode (pge_FactorDesc *codeStack);
/*
CodeFactor -
*/
-static void CodeFactor (FactorDesc f, TermDesc t, m2condition l, m2condition n, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack);
+static void CodeFactor (pge_FactorDesc f, pge_TermDesc t, pge_m2condition l, pge_m2condition n, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
/*
CodeTerm -
*/
-static void CodeTerm (TermDesc t, m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack);
+static void CodeTerm (pge_TermDesc t, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
/*
CodeExpression -
*/
-static void CodeExpression (ExpressionDesc e, m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack);
+static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
/*
CodeStatement -
*/
-static void CodeStatement (StatementDesc s, m2condition m);
+static void CodeStatement (pge_StatementDesc s, pge_m2condition m);
/*
CodeProduction - only encode grammer rules which are not special.
*/
-static void CodeProduction (ProductionDesc p);
+static void CodeProduction (pge_ProductionDesc p);
/*
RecoverCondition -
*/
-static void RecoverCondition (m2condition m);
+static void RecoverCondition (pge_m2condition m);
/*
ConditionIndent - returns the number of spaces indentation created via, m.
*/
-static unsigned int ConditionIndent (m2condition m);
+static unsigned int ConditionIndent (pge_m2condition m);
/*
WriteGetTokenType - writes out the method of determining the token type.
NumberOfElements - returns the number of elements in set, to, which lie between low..high
*/
-static unsigned int NumberOfElements (SetDesc to, unsigned int low, unsigned int high);
+static unsigned int NumberOfElements (pge_SetDesc to, unsigned int low, unsigned int high);
/*
WriteElement - writes the literal name for element, e.
EmitIsInSet - writes out the equivalent of GetTokenType() IN { toset }
*/
-static void EmitIsInSet (SetDesc to, NameKey_Name low, NameKey_Name high);
+static void EmitIsInSet (pge_SetDesc to, NameKey_Name low, NameKey_Name high);
/*
EmitIsInSubSet - writes out a test to see whether GetTokenype() is in { subset }
*/
-static void EmitIsInSubSet (SetDesc to, unsigned int low, unsigned int high);
+static void EmitIsInSubSet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitIsInFirst -
*/
-static void EmitIsInFirst (SetDesc to, m2condition m);
-static void FlushRecoverCode (FactorDesc *codeStack);
+static void EmitIsInFirst (pge_SetDesc to, pge_m2condition m);
+static void FlushRecoverCode (pge_FactorDesc *codeStack);
/*
RecoverFactor -
*/
-static void RecoverFactor (FactorDesc f, m2condition m, FactorDesc codeStack);
+static void RecoverFactor (pge_FactorDesc f, pge_m2condition m, pge_FactorDesc codeStack);
/*
OptExpSeen - returns TRUE if we can see an optional expression in the factor.
and FALSE in the first.
*/
-static unsigned int OptExpSeen (FactorDesc f);
+static unsigned int OptExpSeen (pge_FactorDesc f);
/*
RecoverTerm -
*/
-static void RecoverTerm (TermDesc t, m2condition new_, m2condition old);
+static void RecoverTerm (pge_TermDesc t, pge_m2condition new_, pge_m2condition old);
/*
RecoverExpression -
*/
-static void RecoverExpression (ExpressionDesc e, m2condition new_, m2condition old);
+static void RecoverExpression (pge_ExpressionDesc e, pge_m2condition new_, pge_m2condition old);
/*
RecoverStatement -
*/
-static void RecoverStatement (StatementDesc s, m2condition m);
+static void RecoverStatement (pge_StatementDesc s, pge_m2condition m);
/*
EmitFirstFactor - generate a list of all first tokens between the range: low..high.
*/
-static void EmitFirstFactor (FactorDesc f, unsigned int low, unsigned int high);
+static void EmitFirstFactor (pge_FactorDesc f, unsigned int low, unsigned int high);
/*
EmitUsed -
IsEmptySet - returns TRUE if no elements exist in set, to, with values, low..high.
*/
-static unsigned int IsEmptySet (SetDesc to, unsigned int low, unsigned int high);
+static unsigned int IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitSet - emits the tokens in the set, to, which have values low..high
*/
-static void EmitSet (SetDesc to, unsigned int low, unsigned int high);
+static void EmitSet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitSetName - emits the tokens in the set, to, which have values low..high, using
their names.
*/
-static void EmitSetName (SetDesc to, unsigned int low, unsigned int high);
+static void EmitSetName (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitStopParametersAndSet - generates the stop parameters together with a set
inclusion of all the symbols in set, to.
*/
-static void EmitStopParametersAndSet (SetDesc to);
+static void EmitStopParametersAndSet (pge_SetDesc to);
/*
EmitSetAsParameters - generates the first symbols as parameters to a set function.
*/
-static void EmitSetAsParameters (SetDesc to);
+static void EmitSetAsParameters (pge_SetDesc to);
/*
EmitStopParametersAndFollow - generates the stop parameters together with a set
sentances.
*/
-static void EmitStopParametersAndFollow (FactorDesc f, m2condition m);
+static void EmitStopParametersAndFollow (pge_FactorDesc f, pge_m2condition m);
/*
EmitFirstAsParameters -
*/
-static void EmitFirstAsParameters (FactorDesc f);
+static void EmitFirstAsParameters (pge_FactorDesc f);
/*
RecoverProduction - only encode grammer rules which are not special.
Generate error recovery code.
*/
-static void RecoverProduction (ProductionDesc p);
+static void RecoverProduction (pge_ProductionDesc p);
/*
IsWhite - returns TRUE if, ch, is a space or a tab.
FindStr - returns TRUE if, str, was seen inside the code hunk
*/
-static unsigned int FindStr (CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
+static unsigned int FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
/*
WriteUpto -
*/
-static void WriteUpto (CodeHunk code, CodeHunk upto, unsigned int limit);
+static void WriteUpto (pge_CodeHunk code, pge_CodeHunk upto, unsigned int limit);
/*
CheckForVar - checks for any local variables which need to be emitted during
this production.
*/
-static void CheckForVar (CodeHunk code);
+static void CheckForVar (pge_CodeHunk code);
/*
VarFactor -
*/
-static void VarFactor (FactorDesc f);
+static void VarFactor (pge_FactorDesc f);
/*
VarTerm -
*/
-static void VarTerm (TermDesc t);
+static void VarTerm (pge_TermDesc t);
/*
VarExpression -
*/
-static void VarExpression (ExpressionDesc e);
+static void VarExpression (pge_ExpressionDesc e);
/*
VarStatement -
*/
-static void VarStatement (StatementDesc s);
+static void VarStatement (pge_StatementDesc s);
/*
VarProduction - writes out all variable declarations.
*/
-static void VarProduction (ProductionDesc p);
+static void VarProduction (pge_ProductionDesc p);
/*
In - returns TRUE if token, s, is already in the set, to.
*/
-static unsigned int In (SetDesc to, NameKey_Name s);
+static unsigned int In (pge_SetDesc to, NameKey_Name s);
/*
IntersectionIsNil - given two set lists, s1, s2, return TRUE if the
s1 * s2 = {}
*/
-static unsigned int IntersectionIsNil (SetDesc s1, SetDesc s2);
+static unsigned int IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2);
/*
AddSet - adds a first symbol to a production.
*/
-static void AddSet (SetDesc *to, NameKey_Name s);
+static void AddSet (pge_SetDesc *to, NameKey_Name s);
/*
OrSet -
*/
-static void OrSet (SetDesc *to, SetDesc from);
+static void OrSet (pge_SetDesc *to, pge_SetDesc from);
/*
CalcFirstFactor -
*/
-static void CalcFirstFactor (FactorDesc f, ProductionDesc from, SetDesc *to);
+static void CalcFirstFactor (pge_FactorDesc f, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstTerm -
*/
-static void CalcFirstTerm (TermDesc t, ProductionDesc from, SetDesc *to);
+static void CalcFirstTerm (pge_TermDesc t, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstExpression -
*/
-static void CalcFirstExpression (ExpressionDesc e, ProductionDesc from, SetDesc *to);
+static void CalcFirstExpression (pge_ExpressionDesc e, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstStatement -
*/
-static void CalcFirstStatement (StatementDesc s, ProductionDesc from, SetDesc *to);
+static void CalcFirstStatement (pge_StatementDesc s, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstProduction - calculates all of the first symbols for the grammer
*/
-static void CalcFirstProduction (ProductionDesc p, ProductionDesc from, SetDesc *to);
-static void WorkOutFollowFactor (FactorDesc f, SetDesc *followset, SetDesc after);
+static void CalcFirstProduction (pge_ProductionDesc p, pge_ProductionDesc from, pge_SetDesc *to);
+static void WorkOutFollowFactor (pge_FactorDesc f, pge_SetDesc *followset, pge_SetDesc after);
/*
WorkOutFollowTerm -
*/
-static void WorkOutFollowTerm (TermDesc t, SetDesc *followset, SetDesc after);
+static void WorkOutFollowTerm (pge_TermDesc t, pge_SetDesc *followset, pge_SetDesc after);
/*
WorkOutFollowExpression -
*/
-static void WorkOutFollowExpression (ExpressionDesc e, SetDesc *followset, SetDesc after);
+static void WorkOutFollowExpression (pge_ExpressionDesc e, pge_SetDesc *followset, pge_SetDesc after);
/*
CollectFollow - collects the follow set from, f, into, to.
*/
-static void CollectFollow (SetDesc *to, FollowDesc f);
+static void CollectFollow (pge_SetDesc *to, pge_FollowDesc f);
/*
CalcFollowFactor -
*/
-static void CalcFollowFactor (FactorDesc f, SetDesc after);
+static void CalcFollowFactor (pge_FactorDesc f, pge_SetDesc after);
/*
CalcFollowTerm -
*/
-static void CalcFollowTerm (TermDesc t, SetDesc after);
+static void CalcFollowTerm (pge_TermDesc t, pge_SetDesc after);
/*
CalcFollowExpression -
*/
-static void CalcFollowExpression (ExpressionDesc e, SetDesc after);
+static void CalcFollowExpression (pge_ExpressionDesc e, pge_SetDesc after);
/*
CalcFollowStatement - given a bnf statement generate the follow set.
*/
-static void CalcFollowStatement (StatementDesc s);
+static void CalcFollowStatement (pge_StatementDesc s);
/*
CalcFollowProduction -
*/
-static void CalcFollowProduction (ProductionDesc p);
+static void CalcFollowProduction (pge_ProductionDesc p);
/*
CalcEpsilonFactor -
*/
-static void CalcEpsilonFactor (FactorDesc f);
+static void CalcEpsilonFactor (pge_FactorDesc f);
/*
CalcEpsilonTerm -
*/
-static void CalcEpsilonTerm (TermDesc t);
+static void CalcEpsilonTerm (pge_TermDesc t);
/*
CalcEpsilonExpression -
*/
-static void CalcEpsilonExpression (ExpressionDesc e);
+static void CalcEpsilonExpression (pge_ExpressionDesc e);
/*
CalcEpsilonStatement - given a bnf statement generate the follow set.
*/
-static void CalcEpsilonStatement (StatementDesc s);
+static void CalcEpsilonStatement (pge_StatementDesc s);
/*
CalcEpsilonProduction -
*/
-static void CalcEpsilonProduction (ProductionDesc p);
+static void CalcEpsilonProduction (pge_ProductionDesc p);
/*
CalcReachEndFactor -
*/
-static TraverseResult CalcReachEndFactor (FactorDesc f);
+static pge_TraverseResult CalcReachEndFactor (pge_FactorDesc f);
/*
CalcReachEndTerm -
*/
-static TraverseResult CalcReachEndTerm (TermDesc t);
+static pge_TraverseResult CalcReachEndTerm (pge_TermDesc t);
/*
CalcReachEndExpression -
*/
-static void CalcReachEndExpression (ExpressionDesc e);
+static void CalcReachEndExpression (pge_ExpressionDesc e);
/*
CalcReachEndStatement -
*/
-static void CalcReachEndStatement (StatementDesc s);
+static void CalcReachEndStatement (pge_StatementDesc s);
/*
CalcReachEndStatement -
CalcReachEndProduction -
*/
-static void CalcReachEndProduction (ProductionDesc p);
+static void CalcReachEndProduction (pge_ProductionDesc p);
/*
EmptyFactor -
*/
-static unsigned int EmptyFactor (FactorDesc f);
+static unsigned int EmptyFactor (pge_FactorDesc f);
/*
EmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int EmptyTerm (TermDesc t);
+static unsigned int EmptyTerm (pge_TermDesc t);
/*
EmptyExpression -
*/
-static unsigned int EmptyExpression (ExpressionDesc e);
+static unsigned int EmptyExpression (pge_ExpressionDesc e);
/*
EmptyStatement - returns TRUE if statement, s, is empty.
*/
-static unsigned int EmptyStatement (StatementDesc s);
+static unsigned int EmptyStatement (pge_StatementDesc s);
/*
EmptyProduction - returns if production, p, maybe empty.
*/
-static unsigned int EmptyProduction (ProductionDesc p);
+static unsigned int EmptyProduction (pge_ProductionDesc p);
/*
EmitFDLNotice -
DisposeSetDesc - dispose of the set list, s.
*/
-static void DisposeSetDesc (SetDesc *s);
+static void DisposeSetDesc (pge_SetDesc *s);
/*
OptionalFactor -
*/
-static unsigned int OptionalFactor (FactorDesc f);
+static unsigned int OptionalFactor (pge_FactorDesc f);
/*
OptionalTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int OptionalTerm (TermDesc t);
+static unsigned int OptionalTerm (pge_TermDesc t);
/*
OptionalExpression -
*/
-static unsigned int OptionalExpression (ExpressionDesc e);
+static unsigned int OptionalExpression (pge_ExpressionDesc e);
/*
OptionalStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int OptionalStatement (StatementDesc s);
+static unsigned int OptionalStatement (pge_StatementDesc s);
/*
OptionalProduction -
*/
-static unsigned int OptionalProduction (ProductionDesc p);
+static unsigned int OptionalProduction (pge_ProductionDesc p);
/*
CheckFirstFollow -
*/
-static unsigned int CheckFirstFollow (FactorDesc f, FactorDesc after);
+static unsigned int CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after);
/*
ConstrainedEmptyFactor -
*/
-static unsigned int ConstrainedEmptyFactor (FactorDesc f);
+static unsigned int ConstrainedEmptyFactor (pge_FactorDesc f);
/*
ConstrainedEmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int ConstrainedEmptyTerm (TermDesc t);
+static unsigned int ConstrainedEmptyTerm (pge_TermDesc t);
/*
ConstrainedEmptyExpression -
*/
-static unsigned int ConstrainedEmptyExpression (ExpressionDesc e);
+static unsigned int ConstrainedEmptyExpression (pge_ExpressionDesc e);
/*
ConstrainedEmptyStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int ConstrainedEmptyStatement (StatementDesc s);
+static unsigned int ConstrainedEmptyStatement (pge_StatementDesc s);
/*
ConstrainedEmptyProduction - returns TRUE if a problem exists with, p.
*/
-static unsigned int ConstrainedEmptyProduction (ProductionDesc p);
+static unsigned int ConstrainedEmptyProduction (pge_ProductionDesc p);
/*
TestForLALR1 -
*/
-static void TestForLALR1 (ProductionDesc p);
+static void TestForLALR1 (pge_ProductionDesc p);
/*
DoEpsilon - runs the epsilon interrelated rules
*/
-static void DoEpsilon (ProductionDesc p);
+static void DoEpsilon (pge_ProductionDesc p);
/*
CheckComplete - checks that production, p, is complete.
*/
-static void CheckComplete (ProductionDesc p);
+static void CheckComplete (pge_ProductionDesc p);
/*
PostProcessRules - backpatch the ident to rule definitions and emit comments and code.
DescribeStop - issues a message explaining what tokens were expected
*/
-static DynamicStrings_String DescribeStop (SetOfStop stopset);
+static DynamicStrings_String DescribeStop (pge_SetOfStop stopset);
/*
DescribeError - issues a message explaining what tokens were expected
PrettyFollow -
*/
-static void PrettyFollow (const char *start_, unsigned int _start_high, const char *end_, unsigned int _end_high, FollowDesc f);
+static void PrettyFollow (const char *start_, unsigned int _start_high, const char *end_, unsigned int _end_high, pge_FollowDesc f);
/*
NewFollow - creates a new follow descriptor and returns the data structure.
*/
-static FollowDesc NewFollow (void);
+static pge_FollowDesc NewFollow (void);
/*
AssignEpsilon - assigns the epsilon value and sets the epsilon to value,
providing condition is TRUE.
*/
-static void AssignEpsilon (unsigned int condition, FollowDesc f, TraverseResult value);
+static void AssignEpsilon (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetEpsilon - returns the value of epsilon
*/
-static TraverseResult GetEpsilon (FollowDesc f);
+static pge_TraverseResult GetEpsilon (pge_FollowDesc f);
/*
AssignReachEnd - assigns the reachend value providing that, condition, is TRUE.
*/
-static void AssignReachEnd (unsigned int condition, FollowDesc f, TraverseResult value);
+static void AssignReachEnd (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetReachEnd - returns the value of reachend
*/
-static TraverseResult GetReachEnd (FollowDesc f);
+static pge_TraverseResult GetReachEnd (pge_FollowDesc f);
/*
AssignFollow - assigns the follow set and sets the calcfollow to TRUE.
*/
-static void AssignFollow (FollowDesc f, SetDesc s);
+static void AssignFollow (pge_FollowDesc f, pge_SetDesc s);
/*
GetFollow - returns the follow set.
*/
-static SetDesc GetFollow (FollowDesc f);
+static pge_SetDesc GetFollow (pge_FollowDesc f);
/*
NewProduction - creates a new production and returns the data structure.
*/
-static ProductionDesc NewProduction (void);
+static pge_ProductionDesc NewProduction (void);
/*
NewFactor -
*/
-static FactorDesc NewFactor (void);
+static pge_FactorDesc NewFactor (void);
/*
NewTerm - returns a new term.
*/
-static TermDesc NewTerm (void);
+static pge_TermDesc NewTerm (void);
/*
NewExpression - returns a new expression.
*/
-static ExpressionDesc NewExpression (void);
+static pge_ExpressionDesc NewExpression (void);
/*
NewStatement - returns a new statement.
*/
-static StatementDesc NewStatement (void);
+static pge_StatementDesc NewStatement (void);
/*
NewSetDesc - creates a new set description and returns the data structure.
*/
-static SetDesc NewSetDesc (void);
+static pge_SetDesc NewSetDesc (void);
/*
NewCodeDesc - creates a new code descriptor and initializes all fields to zero.
*/
-static CodeDesc NewCodeDesc (void);
+static pge_CodeDesc NewCodeDesc (void);
/*
CodeFragmentPrologue - consumes code text up to a "%" after a newline.
GetCodeFragment - collects the code fragment up until ^ %
*/
-static void GetCodeFragment (CodeHunk *h);
+static void GetCodeFragment (pge_CodeHunk *h);
/*
WriteCodeHunkList - writes the CodeHunk list in the correct order.
*/
-static void WriteCodeHunkList (CodeHunk l);
+static void WriteCodeHunkList (pge_CodeHunk l);
/*
WriteIndent - writes, n, spaces.
but it removes up to indent spaces if they exist.
*/
-static void WriteCodeHunkListIndent (CodeHunk l, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext);
+static void WriteCodeHunkListIndent (pge_CodeHunk l, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext);
/*
Add - adds a character to a code hunk and creates another code hunk if necessary.
*/
-static CodeHunk Add (CodeHunk *p, char ch, unsigned int *i);
+static pge_CodeHunk Add (pge_CodeHunk *p, char ch, unsigned int *i);
/*
ConsHunk - combine two possible code hunks.
*/
-static void ConsHunk (CodeHunk *p, CodeHunk q);
+static void ConsHunk (pge_CodeHunk *p, pge_CodeHunk q);
/*
GetName - returns the next symbol which is checked for a legal name.
a stop symbol.
*/
-static void SyntaxError (SetOfStop stop);
+static void SyntaxError (pge_SetOfStop stop);
/*
SyntaxCheck -
*/
-static void SyntaxCheck (SetOfStop stop);
+static void SyntaxCheck (pge_SetOfStop stop);
/*
Expect -
*/
-static void Expect (bnflex_TokenType t, SetOfStop stop);
+static void Expect (bnflex_TokenType t, pge_SetOfStop stop);
/*
Ident - error checking varient of Ident
*/
-static void Ident (SetOfStop stop);
+static void Ident (pge_SetOfStop stop);
/*
Modula2Code - error checking varient of Modula2Code
*/
-static void Modula2Code (SetOfStop stop);
+static void Modula2Code (pge_SetOfStop stop);
/*
StartModName := % ModuleName := GetName() ; ignore begintok CodeFragmentPrologue % =:
*/
-static void StartModName (SetOfStop stop);
+static void StartModName (pge_SetOfStop stop);
/*
EndModName :=
*/
-static void EndModName (SetOfStop stop);
+static void EndModName (pge_SetOfStop stop);
/*
DoDeclaration := % CodeFragmentDeclaration % =:
*/
-static void DoDeclaration (SetOfStop stop);
+static void DoDeclaration (pge_SetOfStop stop);
/*
CollectLiteral :=
cannot reachend
*/
-static void CollectLiteral (SetOfStop stopset);
+static void CollectLiteral (pge_SetOfStop stopset);
/*
CollectTok :=
cannot reachend
*/
-static void CollectTok (SetOfStop stopset);
+static void CollectTok (pge_SetOfStop stopset);
/*
DefineToken :=
cannot reachend
*/
-static void DefineToken (SetOfStop stopset);
+static void DefineToken (pge_SetOfStop stopset);
/*
Rules := '%' 'rules' { Defs } ExtBNF
cannot reachend
*/
-static void Rules (SetOfStop stopset);
+static void Rules (pge_SetOfStop stopset);
/*
Special := Ident
cannot reachend
*/
-static void Special (SetOfStop stopset);
+static void Special (pge_SetOfStop stopset);
/*
Factor := '%' Modula2Code '%' |
cannot reachend
*/
-static void Factor (SetOfStop stopset);
+static void Factor (pge_SetOfStop stopset);
/*
Statement :=
cannot reachend
*/
-static void Statement (SetOfStop stopset);
+static void Statement (pge_SetOfStop stopset);
/*
Defs := 'special' Special | 'token' Token |
cannot reachend
*/
-static void Defs (SetOfStop stopset);
+static void Defs (pge_SetOfStop stopset);
/*
ExtBNF := 'BNF' { Production } 'FNB'
cannot reachend
*/
-static void ExtBNF (SetOfStop stopset);
+static void ExtBNF (pge_SetOfStop stopset);
/*
Main := Header Decls Footer Rules
cannot reachend
*/
-static void Main (SetOfStop stopset);
+static void Main (pge_SetOfStop stopset);
/*
Header := '%' 'module' StartModName
cannot reachend
*/
-static void Header (SetOfStop stopset);
+static void Header (pge_SetOfStop stopset);
/*
Decls := '%' 'declaration' DoDeclaration
cannot reachend
*/
-static void Decls (SetOfStop stopset);
+static void Decls (pge_SetOfStop stopset);
/*
Footer := '%' 'module' EndModName
cannot reachend
*/
-static void Footer (SetOfStop stopset);
+static void Footer (pge_SetOfStop stopset);
/*
First := 'first' '{' { LitOrTokenOrIdent
cannot reachend
*/
-static void First (SetOfStop stopset);
+static void First (pge_SetOfStop stopset);
/*
Follow := 'follow' '{' { LitOrTokenOrIdent
cannot reachend
*/
-static void Follow (SetOfStop stopset);
+static void Follow (pge_SetOfStop stopset);
/*
LitOrTokenOrIdent := Literal
cannot reachend
*/
-static void LitOrTokenOrIdent (SetOfStop stopset);
+static void LitOrTokenOrIdent (pge_SetOfStop stopset);
/*
Literal := '"' CollectLiteral '"' |
cannot reachend
*/
-static void Literal (SetOfStop stopset);
+static void Literal (pge_SetOfStop stopset);
/*
Token := Literal DefineToken
cannot reachend
*/
-static void Token (SetOfStop stopset);
+static void Token (pge_SetOfStop stopset);
/*
ErrorProcedures := Literal
cannot reachend
*/
-static void ErrorProcedures (SetOfStop stopset);
+static void ErrorProcedures (pge_SetOfStop stopset);
/*
TokenProcedure := Literal
cannot reachend
*/
-static void TokenProcedure (SetOfStop stopset);
+static void TokenProcedure (pge_SetOfStop stopset);
/*
SymProcedure := Literal
cannot reachend
*/
-static void SymProcedure (SetOfStop stopset);
+static void SymProcedure (pge_SetOfStop stopset);
/*
Production := Statement
cannot reachend
*/
-static void Production (SetOfStop stopset);
+static void Production (pge_SetOfStop stopset);
/*
Expression :=
cannot reachend
*/
-static void Expression (SetOfStop stopset);
+static void Expression (pge_SetOfStop stopset);
/*
Term :=
cannot reachend
*/
-static void Term (SetOfStop stopset);
+static void Term (pge_SetOfStop stopset);
/*
GetDefinitionName - returns the name of the rule inside, p.
*/
-static NameKey_Name GetDefinitionName (ProductionDesc p);
+static NameKey_Name GetDefinitionName (pge_ProductionDesc p);
/*
FindDefinition - searches and returns the rule which defines, n.
*/
-static ProductionDesc FindDefinition (NameKey_Name n);
+static pge_ProductionDesc FindDefinition (NameKey_Name n);
/*
BackPatchIdent - found an ident, i, we must look for the corresponding rule and
set the definition accordingly.
*/
-static void BackPatchIdent (IdentDesc i);
+static void BackPatchIdent (pge_IdentDesc i);
/*
BackPatchFactor - runs through the factor looking for an ident
*/
-static void BackPatchFactor (FactorDesc f);
+static void BackPatchFactor (pge_FactorDesc f);
/*
BackPatchTerm - runs through all terms to find idents.
*/
-static void BackPatchTerm (TermDesc t);
+static void BackPatchTerm (pge_TermDesc t);
/*
BackPatchExpression - runs through the term to find any idents.
*/
-static void BackPatchExpression (ExpressionDesc e);
+static void BackPatchExpression (pge_ExpressionDesc e);
/*
BackPatchSet -
*/
-static void BackPatchSet (SetDesc s);
+static void BackPatchSet (pge_SetDesc s);
/*
BackPatchIdentToDefinitions - search through all the rules and add a link from any ident
to the definition.
*/
-static void BackPatchIdentToDefinitions (ProductionDesc d);
+static void BackPatchIdentToDefinitions (pge_ProductionDesc d);
/*
CalculateFirstAndFollow -
*/
-static void CalculateFirstAndFollow (ProductionDesc p);
+static void CalculateFirstAndFollow (pge_ProductionDesc p);
/*
ForeachRuleDo -
*/
-static void ForeachRuleDo (DoProcedure p);
+static void ForeachRuleDo (pge_DoProcedure p);
/*
WhileNotCompleteDo -
*/
-static void WhileNotCompleteDo (DoProcedure p);
+static void WhileNotCompleteDo (pge_DoProcedure p);
/*
NewLine - generate a newline and indent.
PrettyPara -
*/
-static void PrettyPara (const char *c1_, unsigned int _c1_high, const char *c2_, unsigned int _c2_high, ExpressionDesc e, unsigned int Left);
+static void PrettyPara (const char *c1_, unsigned int _c1_high, const char *c2_, unsigned int _c2_high, pge_ExpressionDesc e, unsigned int Left);
/*
WriteKeyTexinfo -
PrettyCommentFactor -
*/
-static void PrettyCommentFactor (FactorDesc f, unsigned int Left);
+static void PrettyCommentFactor (pge_FactorDesc f, unsigned int Left);
/*
PeepTerm - returns the length of characters in term.
*/
-static unsigned int PeepTerm (TermDesc t);
+static unsigned int PeepTerm (pge_TermDesc t);
/*
PeepExpression - returns the length of the expression.
*/
-static unsigned int PeepExpression (ExpressionDesc e);
+static unsigned int PeepExpression (pge_ExpressionDesc e);
/*
PeepFactor - returns the length of character in the factor
*/
-static unsigned int PeepFactor (FactorDesc f);
+static unsigned int PeepFactor (pge_FactorDesc f);
/*
PrettyCommentTerm -
*/
-static void PrettyCommentTerm (TermDesc t, unsigned int Left);
+static void PrettyCommentTerm (pge_TermDesc t, unsigned int Left);
/*
PrettyCommentExpression -
*/
-static void PrettyCommentExpression (ExpressionDesc e, unsigned int Left);
+static void PrettyCommentExpression (pge_ExpressionDesc e, unsigned int Left);
/*
PrettyCommentStatement -
*/
-static void PrettyCommentStatement (StatementDesc s, unsigned int Left);
+static void PrettyCommentStatement (pge_StatementDesc s, unsigned int Left);
/*
PrettyCommentProduction - generates the comment for rule, p.
*/
-static void PrettyCommentProduction (ProductionDesc p);
+static void PrettyCommentProduction (pge_ProductionDesc p);
/*
PrettyPrintProduction - pretty prints the ebnf rule, p.
*/
-static void PrettyPrintProduction (ProductionDesc p);
+static void PrettyPrintProduction (pge_ProductionDesc p);
/*
EmitFileLineTag - emits a line and file tag using the C preprocessor syntax.
EmitRule - generates a comment and code for rule, p.
*/
-static void EmitRule (ProductionDesc p);
+static void EmitRule (pge_ProductionDesc p);
/*
CodeCondition -
*/
-static void CodeCondition (m2condition m);
+static void CodeCondition (pge_m2condition m);
/*
CodeThenDo - codes a "THEN" or "DO" depending upon, m.
*/
-static void CodeThenDo (m2condition m);
+static void CodeThenDo (pge_m2condition m);
/*
CodeElseEnd - builds an ELSE END statement using string, end.
*/
-static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, FactorDesc f, unsigned int inopt);
+static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
/*
CodeEnd - codes a "END" depending upon, m.
*/
-static void CodeEnd (m2condition m, TermDesc t, unsigned int consumed, FactorDesc f, unsigned int inopt);
+static void CodeEnd (pge_m2condition m, pge_TermDesc t, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
/*
EmitNonVarCode - writes out, code, providing it is not a variable declaration.
*/
-static void EmitNonVarCode (CodeDesc code, unsigned int curpos, unsigned int left);
+static void EmitNonVarCode (pge_CodeDesc code, unsigned int curpos, unsigned int left);
/*
ChainOn -
*/
-static FactorDesc ChainOn (FactorDesc codeStack, FactorDesc f);
+static pge_FactorDesc ChainOn (pge_FactorDesc codeStack, pge_FactorDesc f);
/*
FlushCode -
*/
-static void FlushCode (FactorDesc *codeStack);
+static void FlushCode (pge_FactorDesc *codeStack);
/*
CodeFactor -
*/
-static void CodeFactor (FactorDesc f, TermDesc t, m2condition l, m2condition n, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack);
+static void CodeFactor (pge_FactorDesc f, pge_TermDesc t, pge_m2condition l, pge_m2condition n, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
/*
CodeTerm -
*/
-static void CodeTerm (TermDesc t, m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack);
+static void CodeTerm (pge_TermDesc t, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
/*
CodeExpression -
*/
-static void CodeExpression (ExpressionDesc e, m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack);
+static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
/*
CodeStatement -
*/
-static void CodeStatement (StatementDesc s, m2condition m);
+static void CodeStatement (pge_StatementDesc s, pge_m2condition m);
/*
CodeProduction - only encode grammer rules which are not special.
*/
-static void CodeProduction (ProductionDesc p);
+static void CodeProduction (pge_ProductionDesc p);
/*
RecoverCondition -
*/
-static void RecoverCondition (m2condition m);
+static void RecoverCondition (pge_m2condition m);
/*
ConditionIndent - returns the number of spaces indentation created via, m.
*/
-static unsigned int ConditionIndent (m2condition m);
+static unsigned int ConditionIndent (pge_m2condition m);
/*
WriteGetTokenType - writes out the method of determining the token type.
NumberOfElements - returns the number of elements in set, to, which lie between low..high
*/
-static unsigned int NumberOfElements (SetDesc to, unsigned int low, unsigned int high);
+static unsigned int NumberOfElements (pge_SetDesc to, unsigned int low, unsigned int high);
/*
WriteElement - writes the literal name for element, e.
EmitIsInSet - writes out the equivalent of GetTokenType() IN { toset }
*/
-static void EmitIsInSet (SetDesc to, NameKey_Name low, NameKey_Name high);
+static void EmitIsInSet (pge_SetDesc to, NameKey_Name low, NameKey_Name high);
/*
EmitIsInSubSet - writes out a test to see whether GetTokenype() is in { subset }
*/
-static void EmitIsInSubSet (SetDesc to, unsigned int low, unsigned int high);
+static void EmitIsInSubSet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitIsInFirst -
*/
-static void EmitIsInFirst (SetDesc to, m2condition m);
-static void FlushRecoverCode (FactorDesc *codeStack);
+static void EmitIsInFirst (pge_SetDesc to, pge_m2condition m);
+static void FlushRecoverCode (pge_FactorDesc *codeStack);
/*
RecoverFactor -
*/
-static void RecoverFactor (FactorDesc f, m2condition m, FactorDesc codeStack);
+static void RecoverFactor (pge_FactorDesc f, pge_m2condition m, pge_FactorDesc codeStack);
/*
OptExpSeen - returns TRUE if we can see an optional expression in the factor.
and FALSE in the first.
*/
-static unsigned int OptExpSeen (FactorDesc f);
+static unsigned int OptExpSeen (pge_FactorDesc f);
/*
RecoverTerm -
*/
-static void RecoverTerm (TermDesc t, m2condition new_, m2condition old);
+static void RecoverTerm (pge_TermDesc t, pge_m2condition new_, pge_m2condition old);
/*
RecoverExpression -
*/
-static void RecoverExpression (ExpressionDesc e, m2condition new_, m2condition old);
+static void RecoverExpression (pge_ExpressionDesc e, pge_m2condition new_, pge_m2condition old);
/*
RecoverStatement -
*/
-static void RecoverStatement (StatementDesc s, m2condition m);
+static void RecoverStatement (pge_StatementDesc s, pge_m2condition m);
/*
EmitFirstFactor - generate a list of all first tokens between the range: low..high.
*/
-static void EmitFirstFactor (FactorDesc f, unsigned int low, unsigned int high);
+static void EmitFirstFactor (pge_FactorDesc f, unsigned int low, unsigned int high);
/*
EmitUsed -
IsEmptySet - returns TRUE if no elements exist in set, to, with values, low..high.
*/
-static unsigned int IsEmptySet (SetDesc to, unsigned int low, unsigned int high);
+static unsigned int IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitSet - emits the tokens in the set, to, which have values low..high
*/
-static void EmitSet (SetDesc to, unsigned int low, unsigned int high);
+static void EmitSet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitSetName - emits the tokens in the set, to, which have values low..high, using
their names.
*/
-static void EmitSetName (SetDesc to, unsigned int low, unsigned int high);
+static void EmitSetName (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitStopParametersAndSet - generates the stop parameters together with a set
inclusion of all the symbols in set, to.
*/
-static void EmitStopParametersAndSet (SetDesc to);
+static void EmitStopParametersAndSet (pge_SetDesc to);
/*
EmitSetAsParameters - generates the first symbols as parameters to a set function.
*/
-static void EmitSetAsParameters (SetDesc to);
+static void EmitSetAsParameters (pge_SetDesc to);
/*
EmitStopParametersAndFollow - generates the stop parameters together with a set
sentances.
*/
-static void EmitStopParametersAndFollow (FactorDesc f, m2condition m);
+static void EmitStopParametersAndFollow (pge_FactorDesc f, pge_m2condition m);
/*
EmitFirstAsParameters -
*/
-static void EmitFirstAsParameters (FactorDesc f);
+static void EmitFirstAsParameters (pge_FactorDesc f);
/*
RecoverProduction - only encode grammer rules which are not special.
Generate error recovery code.
*/
-static void RecoverProduction (ProductionDesc p);
+static void RecoverProduction (pge_ProductionDesc p);
/*
IsWhite - returns TRUE if, ch, is a space or a tab.
FindStr - returns TRUE if, str, was seen inside the code hunk
*/
-static unsigned int FindStr (CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
+static unsigned int FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
/*
WriteUpto -
*/
-static void WriteUpto (CodeHunk code, CodeHunk upto, unsigned int limit);
+static void WriteUpto (pge_CodeHunk code, pge_CodeHunk upto, unsigned int limit);
/*
CheckForVar - checks for any local variables which need to be emitted during
this production.
*/
-static void CheckForVar (CodeHunk code);
+static void CheckForVar (pge_CodeHunk code);
/*
VarFactor -
*/
-static void VarFactor (FactorDesc f);
+static void VarFactor (pge_FactorDesc f);
/*
VarTerm -
*/
-static void VarTerm (TermDesc t);
+static void VarTerm (pge_TermDesc t);
/*
VarExpression -
*/
-static void VarExpression (ExpressionDesc e);
+static void VarExpression (pge_ExpressionDesc e);
/*
VarStatement -
*/
-static void VarStatement (StatementDesc s);
+static void VarStatement (pge_StatementDesc s);
/*
VarProduction - writes out all variable declarations.
*/
-static void VarProduction (ProductionDesc p);
+static void VarProduction (pge_ProductionDesc p);
/*
In - returns TRUE if token, s, is already in the set, to.
*/
-static unsigned int In (SetDesc to, NameKey_Name s);
+static unsigned int In (pge_SetDesc to, NameKey_Name s);
/*
IntersectionIsNil - given two set lists, s1, s2, return TRUE if the
s1 * s2 = {}
*/
-static unsigned int IntersectionIsNil (SetDesc s1, SetDesc s2);
+static unsigned int IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2);
/*
AddSet - adds a first symbol to a production.
*/
-static void AddSet (SetDesc *to, NameKey_Name s);
+static void AddSet (pge_SetDesc *to, NameKey_Name s);
/*
OrSet -
*/
-static void OrSet (SetDesc *to, SetDesc from);
+static void OrSet (pge_SetDesc *to, pge_SetDesc from);
/*
CalcFirstFactor -
*/
-static void CalcFirstFactor (FactorDesc f, ProductionDesc from, SetDesc *to);
+static void CalcFirstFactor (pge_FactorDesc f, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstTerm -
*/
-static void CalcFirstTerm (TermDesc t, ProductionDesc from, SetDesc *to);
+static void CalcFirstTerm (pge_TermDesc t, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstExpression -
*/
-static void CalcFirstExpression (ExpressionDesc e, ProductionDesc from, SetDesc *to);
+static void CalcFirstExpression (pge_ExpressionDesc e, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstStatement -
*/
-static void CalcFirstStatement (StatementDesc s, ProductionDesc from, SetDesc *to);
+static void CalcFirstStatement (pge_StatementDesc s, pge_ProductionDesc from, pge_SetDesc *to);
/*
CalcFirstProduction - calculates all of the first symbols for the grammer
*/
-static void CalcFirstProduction (ProductionDesc p, ProductionDesc from, SetDesc *to);
-static void WorkOutFollowFactor (FactorDesc f, SetDesc *followset, SetDesc after);
+static void CalcFirstProduction (pge_ProductionDesc p, pge_ProductionDesc from, pge_SetDesc *to);
+static void WorkOutFollowFactor (pge_FactorDesc f, pge_SetDesc *followset, pge_SetDesc after);
/*
WorkOutFollowTerm -
*/
-static void WorkOutFollowTerm (TermDesc t, SetDesc *followset, SetDesc after);
+static void WorkOutFollowTerm (pge_TermDesc t, pge_SetDesc *followset, pge_SetDesc after);
/*
WorkOutFollowExpression -
*/
-static void WorkOutFollowExpression (ExpressionDesc e, SetDesc *followset, SetDesc after);
+static void WorkOutFollowExpression (pge_ExpressionDesc e, pge_SetDesc *followset, pge_SetDesc after);
/*
CollectFollow - collects the follow set from, f, into, to.
*/
-static void CollectFollow (SetDesc *to, FollowDesc f);
+static void CollectFollow (pge_SetDesc *to, pge_FollowDesc f);
/*
CalcFollowFactor -
*/
-static void CalcFollowFactor (FactorDesc f, SetDesc after);
+static void CalcFollowFactor (pge_FactorDesc f, pge_SetDesc after);
/*
CalcFollowTerm -
*/
-static void CalcFollowTerm (TermDesc t, SetDesc after);
+static void CalcFollowTerm (pge_TermDesc t, pge_SetDesc after);
/*
CalcFollowExpression -
*/
-static void CalcFollowExpression (ExpressionDesc e, SetDesc after);
+static void CalcFollowExpression (pge_ExpressionDesc e, pge_SetDesc after);
/*
CalcFollowStatement - given a bnf statement generate the follow set.
*/
-static void CalcFollowStatement (StatementDesc s);
+static void CalcFollowStatement (pge_StatementDesc s);
/*
CalcFollowProduction -
*/
-static void CalcFollowProduction (ProductionDesc p);
+static void CalcFollowProduction (pge_ProductionDesc p);
/*
CalcEpsilonFactor -
*/
-static void CalcEpsilonFactor (FactorDesc f);
+static void CalcEpsilonFactor (pge_FactorDesc f);
/*
CalcEpsilonTerm -
*/
-static void CalcEpsilonTerm (TermDesc t);
+static void CalcEpsilonTerm (pge_TermDesc t);
/*
CalcEpsilonExpression -
*/
-static void CalcEpsilonExpression (ExpressionDesc e);
+static void CalcEpsilonExpression (pge_ExpressionDesc e);
/*
CalcEpsilonStatement - given a bnf statement generate the follow set.
*/
-static void CalcEpsilonStatement (StatementDesc s);
+static void CalcEpsilonStatement (pge_StatementDesc s);
/*
CalcEpsilonProduction -
*/
-static void CalcEpsilonProduction (ProductionDesc p);
+static void CalcEpsilonProduction (pge_ProductionDesc p);
/*
CalcReachEndFactor -
*/
-static TraverseResult CalcReachEndFactor (FactorDesc f);
+static pge_TraverseResult CalcReachEndFactor (pge_FactorDesc f);
/*
CalcReachEndTerm -
*/
-static TraverseResult CalcReachEndTerm (TermDesc t);
+static pge_TraverseResult CalcReachEndTerm (pge_TermDesc t);
/*
CalcReachEndExpression -
*/
-static void CalcReachEndExpression (ExpressionDesc e);
+static void CalcReachEndExpression (pge_ExpressionDesc e);
/*
CalcReachEndStatement -
*/
-static void CalcReachEndStatement (StatementDesc s);
+static void CalcReachEndStatement (pge_StatementDesc s);
/*
CalcReachEndStatement -
CalcReachEndProduction -
*/
-static void CalcReachEndProduction (ProductionDesc p);
+static void CalcReachEndProduction (pge_ProductionDesc p);
/*
EmptyFactor -
*/
-static unsigned int EmptyFactor (FactorDesc f);
+static unsigned int EmptyFactor (pge_FactorDesc f);
/*
EmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int EmptyTerm (TermDesc t);
+static unsigned int EmptyTerm (pge_TermDesc t);
/*
EmptyExpression -
*/
-static unsigned int EmptyExpression (ExpressionDesc e);
+static unsigned int EmptyExpression (pge_ExpressionDesc e);
/*
EmptyStatement - returns TRUE if statement, s, is empty.
*/
-static unsigned int EmptyStatement (StatementDesc s);
+static unsigned int EmptyStatement (pge_StatementDesc s);
/*
EmptyProduction - returns if production, p, maybe empty.
*/
-static unsigned int EmptyProduction (ProductionDesc p);
+static unsigned int EmptyProduction (pge_ProductionDesc p);
/*
EmitFDLNotice -
DisposeSetDesc - dispose of the set list, s.
*/
-static void DisposeSetDesc (SetDesc *s);
+static void DisposeSetDesc (pge_SetDesc *s);
/*
OptionalFactor -
*/
-static unsigned int OptionalFactor (FactorDesc f);
+static unsigned int OptionalFactor (pge_FactorDesc f);
/*
OptionalTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int OptionalTerm (TermDesc t);
+static unsigned int OptionalTerm (pge_TermDesc t);
/*
OptionalExpression -
*/
-static unsigned int OptionalExpression (ExpressionDesc e);
+static unsigned int OptionalExpression (pge_ExpressionDesc e);
/*
OptionalStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int OptionalStatement (StatementDesc s);
+static unsigned int OptionalStatement (pge_StatementDesc s);
/*
OptionalProduction -
*/
-static unsigned int OptionalProduction (ProductionDesc p);
+static unsigned int OptionalProduction (pge_ProductionDesc p);
/*
CheckFirstFollow -
*/
-static unsigned int CheckFirstFollow (FactorDesc f, FactorDesc after);
+static unsigned int CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after);
/*
ConstrainedEmptyFactor -
*/
-static unsigned int ConstrainedEmptyFactor (FactorDesc f);
+static unsigned int ConstrainedEmptyFactor (pge_FactorDesc f);
/*
ConstrainedEmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int ConstrainedEmptyTerm (TermDesc t);
+static unsigned int ConstrainedEmptyTerm (pge_TermDesc t);
/*
ConstrainedEmptyExpression -
*/
-static unsigned int ConstrainedEmptyExpression (ExpressionDesc e);
+static unsigned int ConstrainedEmptyExpression (pge_ExpressionDesc e);
/*
ConstrainedEmptyStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int ConstrainedEmptyStatement (StatementDesc s);
+static unsigned int ConstrainedEmptyStatement (pge_StatementDesc s);
/*
ConstrainedEmptyProduction - returns TRUE if a problem exists with, p.
*/
-static unsigned int ConstrainedEmptyProduction (ProductionDesc p);
+static unsigned int ConstrainedEmptyProduction (pge_ProductionDesc p);
/*
TestForLALR1 -
*/
-static void TestForLALR1 (ProductionDesc p);
+static void TestForLALR1 (pge_ProductionDesc p);
/*
DoEpsilon - runs the epsilon interrelated rules
*/
-static void DoEpsilon (ProductionDesc p);
+static void DoEpsilon (pge_ProductionDesc p);
/*
CheckComplete - checks that production, p, is complete.
*/
-static void CheckComplete (ProductionDesc p);
+static void CheckComplete (pge_ProductionDesc p);
/*
PostProcessRules - backpatch the ident to rule definitions and emit comments and code.
DescribeStop - issues a message explaining what tokens were expected
*/
-static DynamicStrings_String DescribeStop (SetOfStop stopset)
+static DynamicStrings_String DescribeStop (pge_SetOfStop stopset)
{
unsigned int n;
DynamicStrings_String str;
static void Format1 (const char *src_, unsigned int _src_high, unsigned int n, char *dest, unsigned int _dest_high)
{
- typedef struct _T12_a _T12;
+ typedef struct Format1__T12_a Format1__T12;
- struct _T12_a { char array[MaxString+1]; };
+ struct Format1__T12_a { char array[MaxString+1]; };
unsigned int HighSrc;
unsigned int HighDest;
unsigned int i;
unsigned int j;
- _T12 str;
+ Format1__T12 str;
char src[_src_high+1];
/* make a local copy of each unbounded array. */
static void WarnError1 (const char *a_, unsigned int _a_high, unsigned int n)
{
- typedef struct _T13_a _T13;
+ typedef struct WarnError1__T13_a WarnError1__T13;
- struct _T13_a { char array[MaxString+1]; };
- _T13 line;
+ struct WarnError1__T13_a { char array[MaxString+1]; };
+ WarnError1__T13 line;
char a[_a_high+1];
/* make a local copy of each unbounded array. */
PrettyFollow -
*/
-static void PrettyFollow (const char *start_, unsigned int _start_high, const char *end_, unsigned int _end_high, FollowDesc f)
+static void PrettyFollow (const char *start_, unsigned int _start_high, const char *end_, unsigned int _end_high, pge_FollowDesc f)
{
char start[_start_high+1];
char end[_end_high+1];
}
switch (f->reachend)
{
- case true_:
+ case pge_true:
Output_WriteString ((const char *) " [E]", 4);
break;
- case false_:
+ case pge_false:
Output_WriteString ((const char *) " [C]", 4);
break;
- case unknown:
+ case pge_unknown:
Output_WriteString ((const char *) " [U]", 4);
break;
}
switch (f->epsilon)
{
- case true_:
+ case pge_true:
Output_WriteString ((const char *) " [e]", 4);
break;
- case false_:
+ case pge_false:
break;
- case unknown:
+ case pge_unknown:
Output_WriteString ((const char *) " [u]", 4);
break;
NewFollow - creates a new follow descriptor and returns the data structure.
*/
-static FollowDesc NewFollow (void)
+static pge_FollowDesc NewFollow (void)
{
- FollowDesc f;
+ pge_FollowDesc f;
- Storage_ALLOCATE ((void **) &f, sizeof (_T6));
+ Storage_ALLOCATE ((void **) &f, sizeof (pge__T6));
f->follow = NULL;
- f->reachend = unknown;
- f->epsilon = unknown;
+ f->reachend = pge_unknown;
+ f->epsilon = pge_unknown;
return f;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
providing condition is TRUE.
*/
-static void AssignEpsilon (unsigned int condition, FollowDesc f, TraverseResult value)
+static void AssignEpsilon (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value)
{
- if ((condition && (value != unknown)) && (f->epsilon == unknown))
+ if ((condition && (value != pge_unknown)) && (f->epsilon == pge_unknown))
{
f->epsilon = value;
Finished = FALSE;
GetEpsilon - returns the value of epsilon
*/
-static TraverseResult GetEpsilon (FollowDesc f)
+static pge_TraverseResult GetEpsilon (pge_FollowDesc f)
{
if (f == NULL)
{
- Debug_Halt ((const char *) "why is the follow info NIL?", 27, 595, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why is the follow info NIL?", 27, 596, (const char *) "m2/gm2-auto/pge.mod", 19);
}
else
{
AssignReachEnd - assigns the reachend value providing that, condition, is TRUE.
*/
-static void AssignReachEnd (unsigned int condition, FollowDesc f, TraverseResult value)
+static void AssignReachEnd (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value)
{
if (condition)
{
- if ((f->reachend == unknown) && (value != unknown))
+ if ((f->reachend == pge_unknown) && (value != pge_unknown))
{
f->reachend = value;
Finished = FALSE;
GetReachEnd - returns the value of reachend
*/
-static TraverseResult GetReachEnd (FollowDesc f)
+static pge_TraverseResult GetReachEnd (pge_FollowDesc f)
{
if (f == NULL)
{
- Debug_Halt ((const char *) "why is the follow info NIL?", 27, 629, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why is the follow info NIL?", 27, 630, (const char *) "m2/gm2-auto/pge.mod", 19);
}
else
{
AssignFollow - assigns the follow set and sets the calcfollow to TRUE.
*/
-static void AssignFollow (FollowDesc f, SetDesc s)
+static void AssignFollow (pge_FollowDesc f, pge_SetDesc s)
{
if (f->calcfollow)
{
- Debug_Halt ((const char *) "why are we reassigning this follow set?", 39, 645, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why are we reassigning this follow set?", 39, 646, (const char *) "m2/gm2-auto/pge.mod", 19);
}
f->follow = s;
f->calcfollow = TRUE;
GetFollow - returns the follow set.
*/
-static SetDesc GetFollow (FollowDesc f)
+static pge_SetDesc GetFollow (pge_FollowDesc f)
{
if (f == NULL)
{
- Debug_Halt ((const char *) "why is the follow info NIL?", 27, 661, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why is the follow info NIL?", 27, 662, (const char *) "m2/gm2-auto/pge.mod", 19);
}
else
{
}
else
{
- Debug_Halt ((const char *) "not calculated the follow set yet..", 35, 668, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "not calculated the follow set yet..", 35, 669, (const char *) "m2/gm2-auto/pge.mod", 19);
}
}
ReturnException ("m2/gm2-auto/pge.mod", 1, 7);
NewProduction - creates a new production and returns the data structure.
*/
-static ProductionDesc NewProduction (void)
+static pge_ProductionDesc NewProduction (void)
{
- ProductionDesc p;
+ pge_ProductionDesc p;
- Storage_ALLOCATE ((void **) &p, sizeof (_T2));
+ Storage_ALLOCATE ((void **) &p, sizeof (pge__T2));
if (TailProduction != NULL)
{
TailProduction->next = p;
NewFactor -
*/
-static FactorDesc NewFactor (void)
+static pge_FactorDesc NewFactor (void)
{
- FactorDesc f;
+ pge_FactorDesc f;
- Storage_ALLOCATE ((void **) &f, sizeof (_T5));
+ Storage_ALLOCATE ((void **) &f, sizeof (pge__T5));
f->next = NULL;
f->followinfo = NewFollow ();
f->line = PushBackInput_GetCurrentLine ();
NewTerm - returns a new term.
*/
-static TermDesc NewTerm (void)
+static pge_TermDesc NewTerm (void)
{
- TermDesc t;
+ pge_TermDesc t;
- Storage_ALLOCATE ((void **) &t, sizeof (termdesc));
+ Storage_ALLOCATE ((void **) &t, sizeof (pge_termdesc));
t->factor = NULL;
t->followinfo = NewFollow ();
t->next = NULL;
NewExpression - returns a new expression.
*/
-static ExpressionDesc NewExpression (void)
+static pge_ExpressionDesc NewExpression (void)
{
- ExpressionDesc e;
+ pge_ExpressionDesc e;
- Storage_ALLOCATE ((void **) &e, sizeof (_T4));
+ Storage_ALLOCATE ((void **) &e, sizeof (pge__T4));
e->term = NULL;
e->followinfo = NewFollow ();
e->line = PushBackInput_GetCurrentLine ();
NewStatement - returns a new statement.
*/
-static StatementDesc NewStatement (void)
+static pge_StatementDesc NewStatement (void)
{
- StatementDesc s;
+ pge_StatementDesc s;
- Storage_ALLOCATE ((void **) &s, sizeof (_T3));
+ Storage_ALLOCATE ((void **) &s, sizeof (pge__T3));
s->ident = NULL;
s->expr = NULL;
s->followinfo = NewFollow ();
NewSetDesc - creates a new set description and returns the data structure.
*/
-static SetDesc NewSetDesc (void)
+static pge_SetDesc NewSetDesc (void)
{
- SetDesc s;
+ pge_SetDesc s;
- Storage_ALLOCATE ((void **) &s, sizeof (_T7));
+ Storage_ALLOCATE ((void **) &s, sizeof (pge__T7));
s->next = NULL;
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
NewCodeDesc - creates a new code descriptor and initializes all fields to zero.
*/
-static CodeDesc NewCodeDesc (void)
+static pge_CodeDesc NewCodeDesc (void)
{
- CodeDesc c;
+ pge_CodeDesc c;
- Storage_ALLOCATE ((void **) &c, sizeof (_T8));
+ Storage_ALLOCATE ((void **) &c, sizeof (pge__T8));
c->code = NULL;
c->indent = 0;
c->line = PushBackInput_GetCurrentLine ();
GetCodeFragment - collects the code fragment up until ^ %
*/
-static void GetCodeFragment (CodeHunk *h)
+static void GetCodeFragment (pge_CodeHunk *h)
{
unsigned int i;
char ch;
WriteCodeHunkList - writes the CodeHunk list in the correct order.
*/
-static void WriteCodeHunkList (CodeHunk l)
+static void WriteCodeHunkList (pge_CodeHunk l)
{
if (l != NULL)
{
but it removes up to indent spaces if they exist.
*/
-static void WriteCodeHunkListIndent (CodeHunk l, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext)
+static void WriteCodeHunkListIndent (pge_CodeHunk l, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext)
{
if (l != NULL)
{
Add - adds a character to a code hunk and creates another code hunk if necessary.
*/
-static CodeHunk Add (CodeHunk *p, char ch, unsigned int *i)
+static pge_CodeHunk Add (pge_CodeHunk *p, char ch, unsigned int *i)
{
- CodeHunk q;
+ pge_CodeHunk q;
if (((*p) == NULL) || ((*i) > MaxCodeHunkLength))
{
- Storage_ALLOCATE ((void **) &q, sizeof (_T9));
+ Storage_ALLOCATE ((void **) &q, sizeof (pge__T9));
q->next = (*p);
q->codetext.array[0] = ch;
(*i) = 1;
ConsHunk - combine two possible code hunks.
*/
-static void ConsHunk (CodeHunk *p, CodeHunk q)
+static void ConsHunk (pge_CodeHunk *p, pge_CodeHunk q)
{
- CodeHunk r;
+ pge_CodeHunk r;
if ((*p) != NULL)
{
a stop symbol.
*/
-static void SyntaxError (SetOfStop stop)
+static void SyntaxError (pge_SetOfStop stop)
{
DescribeError ();
if (Debugging)
SyntaxCheck -
*/
-static void SyntaxCheck (SetOfStop stop)
+static void SyntaxCheck (pge_SetOfStop stop)
{
if (! ((((1 << (bnflex_GetCurrentTokenType ()-bnflex_identtok)) & (stop)) != 0)))
{
Expect -
*/
-static void Expect (bnflex_TokenType t, SetOfStop stop)
+static void Expect (bnflex_TokenType t, pge_SetOfStop stop)
{
if ((bnflex_GetCurrentTokenType ()) == t)
{
Ident - error checking varient of Ident
*/
-static void Ident (SetOfStop stop)
+static void Ident (pge_SetOfStop stop)
{
if ((bnflex_GetCurrentTokenType ()) == bnflex_identtok)
{
- Storage_ALLOCATE ((void **) &CurrentIdent, sizeof (_T1));
+ Storage_ALLOCATE ((void **) &CurrentIdent, sizeof (pge__T1));
CurrentIdent->definition = NULL;
CurrentIdent->name = GetName ();
CurrentIdent->line = PushBackInput_GetCurrentLine ();
Modula2Code - error checking varient of Modula2Code
*/
-static void Modula2Code (SetOfStop stop)
+static void Modula2Code (pge_SetOfStop stop)
{
- CodeHunk p;
+ pge_CodeHunk p;
unsigned int i;
unsigned int quote;
unsigned int line;
}
}
p = Add (&p, ASCII_nul, &i);
- CurrentFactor->type = m2;
+ CurrentFactor->type = pge_m2;
CurrentFactor->code = NewCodeDesc ();
CurrentFactor->code->code = p;
CurrentFactor->code->indent = position;
StartModName := % ModuleName := GetName() ; ignore begintok CodeFragmentPrologue % =:
*/
-static void StartModName (SetOfStop stop)
+static void StartModName (pge_SetOfStop stop)
{
ModuleName = GetName ();
CodeFragmentPrologue ();
EndModName :=
*/
-static void EndModName (SetOfStop stop)
+static void EndModName (pge_SetOfStop stop)
{
if (ModuleName != (GetName ()))
{
DoDeclaration := % CodeFragmentDeclaration % =:
*/
-static void DoDeclaration (SetOfStop stop)
+static void DoDeclaration (pge_SetOfStop stop)
{
if (ModuleName != (GetName ()))
{
cannot reachend
*/
-static void CollectLiteral (SetOfStop stopset)
+static void CollectLiteral (pge_SetOfStop stopset)
{
LastLiteral = bnflex_GetCurrentToken (); /* */
bnflex_AdvanceToken ();
cannot reachend
*/
-static void CollectTok (SetOfStop stopset)
+static void CollectTok (pge_SetOfStop stopset)
{
CurrentSetDesc = NewSetDesc (); /* */
- CurrentSetDesc->type = tokel;
+ CurrentSetDesc->type = pge_tokel;
CurrentSetDesc->string = bnflex_GetCurrentToken ();
if (! (SymbolKey_ContainsSymKey (Values, bnflex_GetCurrentToken ())))
{
cannot reachend
*/
-static void DefineToken (SetOfStop stopset)
+static void DefineToken (pge_SetOfStop stopset)
{
AddEntry (&Aliases, LastLiteral, bnflex_GetCurrentToken ()); /* */
AddEntry (&ReverseAliases, bnflex_GetCurrentToken (), LastLiteral);
cannot reachend
*/
-static void Rules (SetOfStop stopset)
+static void Rules (pge_SetOfStop stopset)
{
- Expect (bnflex_codetok, stopset|(SetOfStop) ((1 << (bnflex_rulestok-bnflex_identtok))));
- Expect (bnflex_rulestok, stopset|(SetOfStop) ((1 << (bnflex_symfunctok-bnflex_identtok)) | (1 << (bnflex_tfunctok-bnflex_identtok)) | (1 << (bnflex_errortok-bnflex_identtok)) | (1 << (bnflex_tokentok-bnflex_identtok)) | (1 << (bnflex_specialtok-bnflex_identtok)) | (1 << (bnflex_BNFtok-bnflex_identtok))));
+ Expect (bnflex_codetok, stopset|(pge_SetOfStop) ((1 << (bnflex_rulestok-bnflex_identtok))));
+ Expect (bnflex_rulestok, stopset|(pge_SetOfStop) ((1 << (bnflex_symfunctok-bnflex_identtok)) | (1 << (bnflex_tfunctok-bnflex_identtok)) | (1 << (bnflex_errortok-bnflex_identtok)) | (1 << (bnflex_tokentok-bnflex_identtok)) | (1 << (bnflex_specialtok-bnflex_identtok)) | (1 << (bnflex_BNFtok-bnflex_identtok))));
while ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_specialtok)) | (1 << (bnflex_tokentok)) | (1 << (bnflex_errortok)) | (1 << (bnflex_tfunctok)) | (1 << (bnflex_symfunctok))))) != 0))
{
- Defs (stopset|(SetOfStop) ((1 << (bnflex_BNFtok-bnflex_identtok)) | (1 << (bnflex_specialtok-bnflex_identtok)) | (1 << (bnflex_tokentok-bnflex_identtok)) | (1 << (bnflex_errortok-bnflex_identtok)) | (1 << (bnflex_tfunctok-bnflex_identtok)) | (1 << (bnflex_symfunctok-bnflex_identtok))));
+ Defs (stopset|(pge_SetOfStop) ((1 << (bnflex_BNFtok-bnflex_identtok)) | (1 << (bnflex_specialtok-bnflex_identtok)) | (1 << (bnflex_tokentok-bnflex_identtok)) | (1 << (bnflex_errortok-bnflex_identtok)) | (1 << (bnflex_tfunctok-bnflex_identtok)) | (1 << (bnflex_symfunctok-bnflex_identtok))));
}
/* while */
ExtBNF (stopset);
cannot reachend
*/
-static void Special (SetOfStop stopset)
+static void Special (pge_SetOfStop stopset)
{
- ProductionDesc p;
+ pge_ProductionDesc p;
- Ident (stopset|(SetOfStop) ((1 << (bnflex_firsttok-bnflex_identtok))));
+ Ident (stopset|(pge_SetOfStop) ((1 << (bnflex_firsttok-bnflex_identtok))));
p = NewProduction ();
p->statement = NewStatement ();
p->statement->followinfo->calcfollow = TRUE;
- p->statement->followinfo->epsilon = false_;
- p->statement->followinfo->reachend = false_;
+ p->statement->followinfo->epsilon = pge_false;
+ p->statement->followinfo->reachend = pge_false;
p->statement->ident = CurrentIdent;
p->statement->expr = NULL;
p->firstsolved = TRUE;
p->followinfo->calcfollow = TRUE;
- p->followinfo->epsilon = false_;
- p->followinfo->reachend = false_;
- First (stopset|(SetOfStop) ((1 << (bnflex_followtok-bnflex_identtok))));
- Follow (stopset|(SetOfStop) ((1 << (bnflex_epsilontok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
+ p->followinfo->epsilon = pge_false;
+ p->followinfo->reachend = pge_false;
+ First (stopset|(pge_SetOfStop) ((1 << (bnflex_followtok-bnflex_identtok))));
+ Follow (stopset|(pge_SetOfStop) ((1 << (bnflex_epsilontok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
if ((bnflex_GetCurrentTokenType ()) == bnflex_epsilontok)
{
- Expect (bnflex_epsilontok, stopset|(SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
- p->statement->followinfo->epsilon = true_; /* these are not used - but they are displayed when debugging */
- p->statement->followinfo->reachend = true_; /* these are not used - but they are displayed when debugging */
- p->followinfo->epsilon = true_;
- p->followinfo->reachend = true_;
+ Expect (bnflex_epsilontok, stopset|(pge_SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ p->statement->followinfo->epsilon = pge_true; /* these are not used - but they are displayed when debugging */
+ p->statement->followinfo->reachend = pge_true; /* these are not used - but they are displayed when debugging */
+ p->followinfo->epsilon = pge_true;
+ p->followinfo->reachend = pge_true;
}
if ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_dquotetok)) | (1 << (bnflex_squotetok))))) != 0))
{
cannot reachend
*/
-static void Factor (SetOfStop stopset)
+static void Factor (pge_SetOfStop stopset)
{
if ((bnflex_GetCurrentTokenType ()) == bnflex_codetok)
{
Expect (bnflex_codetok, stopset);
- Modula2Code (stopset|(SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
+ Modula2Code (stopset|(pge_SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
Expect (bnflex_codetok, stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_identtok)
{
/* avoid dangling else. */
Ident (stopset);
- CurrentFactor->type = id;
+ CurrentFactor->type = pge_id;
CurrentFactor->ident = CurrentIdent;
}
else if ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_dquotetok)) | (1 << (bnflex_squotetok))))) != 0))
{
/* avoid dangling else. */
Literal (stopset);
- CurrentFactor->type = lit;
+ CurrentFactor->type = pge_lit;
CurrentFactor->string = LastLiteral;
if ((SymbolKey_GetSymKey (Aliases, LastLiteral)) == NameKey_NulName)
{
else if ((bnflex_GetCurrentTokenType ()) == bnflex_lcparatok)
{
/* avoid dangling else. */
- Expect (bnflex_lcparatok, stopset|(SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
- CurrentFactor->type = mult;
+ Expect (bnflex_lcparatok, stopset|(pge_SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ CurrentFactor->type = pge_mult;
CurrentFactor->expr = NewExpression ();
CurrentExpression = CurrentFactor->expr;
- Expression (stopset|(SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok))));
+ Expression (stopset|(pge_SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok))));
Expect (bnflex_rcparatok, stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_lsparatok)
{
/* avoid dangling else. */
- Expect (bnflex_lsparatok, stopset|(SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
- CurrentFactor->type = opt;
+ Expect (bnflex_lsparatok, stopset|(pge_SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ CurrentFactor->type = pge_opt;
CurrentFactor->expr = NewExpression ();
CurrentExpression = CurrentFactor->expr;
- Expression (stopset|(SetOfStop) ((1 << (bnflex_rsparatok-bnflex_identtok))));
+ Expression (stopset|(pge_SetOfStop) ((1 << (bnflex_rsparatok-bnflex_identtok))));
Expect (bnflex_rsparatok, stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_lparatok)
{
/* avoid dangling else. */
- Expect (bnflex_lparatok, stopset|(SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
- CurrentFactor->type = sub;
+ Expect (bnflex_lparatok, stopset|(pge_SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ CurrentFactor->type = pge_sub;
CurrentFactor->expr = NewExpression ();
CurrentExpression = CurrentFactor->expr;
- Expression (stopset|(SetOfStop) ((1 << (bnflex_rparatok-bnflex_identtok))));
+ Expression (stopset|(pge_SetOfStop) ((1 << (bnflex_rparatok-bnflex_identtok))));
Expect (bnflex_rparatok, stopset);
}
else
cannot reachend
*/
-static void Statement (SetOfStop stopset)
+static void Statement (pge_SetOfStop stopset)
{
- IdentDesc i;
- ProductionDesc p;
- ExpressionDesc e;
- StatementDesc s;
+ pge_IdentDesc i;
+ pge_ProductionDesc p;
+ pge_ExpressionDesc e;
+ pge_StatementDesc s;
- Ident (stopset|(SetOfStop) ((1 << (bnflex_lbecomestok-bnflex_identtok))));
+ Ident (stopset|(pge_SetOfStop) ((1 << (bnflex_lbecomestok-bnflex_identtok))));
p = FindDefinition (CurrentIdent->name);
if (p == NULL)
{
}
}
i = CurrentIdent;
- Expect (bnflex_lbecomestok, stopset|(SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_lbecomestok, stopset|(pge_SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
e = NewExpression ();
CurrentExpression = e;
s = NewStatement ();
s->ident = i;
s->expr = e;
- Expression (stopset|(SetOfStop) ((1 << (bnflex_rbecomestok-bnflex_identtok))));
+ Expression (stopset|(pge_SetOfStop) ((1 << (bnflex_rbecomestok-bnflex_identtok))));
p->statement = s;
Expect (bnflex_rbecomestok, stopset);
}
cannot reachend
*/
-static void Defs (SetOfStop stopset)
+static void Defs (pge_SetOfStop stopset)
{
if ((bnflex_GetCurrentTokenType ()) == bnflex_specialtok)
{
- Expect (bnflex_specialtok, stopset|(SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
+ Expect (bnflex_specialtok, stopset|(pge_SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
Special (stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_tokentok)
{
/* avoid dangling else. */
- Expect (bnflex_tokentok, stopset|(SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_tokentok, stopset|(pge_SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
Token (stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_errortok)
{
/* avoid dangling else. */
- Expect (bnflex_errortok, stopset|(SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_errortok, stopset|(pge_SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
ErrorProcedures (stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_tfunctok)
{
/* avoid dangling else. */
- Expect (bnflex_tfunctok, stopset|(SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_tfunctok, stopset|(pge_SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
TokenProcedure (stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_symfunctok)
{
/* avoid dangling else. */
- Expect (bnflex_symfunctok, stopset|(SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_symfunctok, stopset|(pge_SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
SymProcedure (stopset);
}
else
cannot reachend
*/
-static void ExtBNF (SetOfStop stopset)
+static void ExtBNF (pge_SetOfStop stopset)
{
- Expect (bnflex_BNFtok, stopset|(SetOfStop) ((1 << (bnflex_FNBtok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok))));
+ Expect (bnflex_BNFtok, stopset|(pge_SetOfStop) ((1 << (bnflex_FNBtok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok))));
while ((bnflex_GetCurrentTokenType ()) == bnflex_identtok)
{
- Production (stopset|(SetOfStop) ((1 << (bnflex_FNBtok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok))));
+ Production (stopset|(pge_SetOfStop) ((1 << (bnflex_FNBtok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok))));
}
/* while */
Expect (bnflex_FNBtok, stopset);
cannot reachend
*/
-static void Main (SetOfStop stopset)
+static void Main (pge_SetOfStop stopset)
{
- Header (stopset|(SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
- Decls (stopset|(SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
- Footer (stopset|(SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
+ Header (stopset|(pge_SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
+ Decls (stopset|(pge_SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
+ Footer (stopset|(pge_SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok))));
Rules (stopset);
}
cannot reachend
*/
-static void Header (SetOfStop stopset)
+static void Header (pge_SetOfStop stopset)
{
- Expect (bnflex_codetok, stopset|(SetOfStop) ((1 << (bnflex_moduletok-bnflex_identtok))));
- Expect (bnflex_moduletok, stopset|(SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
+ Expect (bnflex_codetok, stopset|(pge_SetOfStop) ((1 << (bnflex_moduletok-bnflex_identtok))));
+ Expect (bnflex_moduletok, stopset|(pge_SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
StartModName (stopset);
}
cannot reachend
*/
-static void Decls (SetOfStop stopset)
+static void Decls (pge_SetOfStop stopset)
{
- Expect (bnflex_codetok, stopset|(SetOfStop) ((1 << (bnflex_declarationtok-bnflex_identtok))));
- Expect (bnflex_declarationtok, stopset|(SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
+ Expect (bnflex_codetok, stopset|(pge_SetOfStop) ((1 << (bnflex_declarationtok-bnflex_identtok))));
+ Expect (bnflex_declarationtok, stopset|(pge_SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
DoDeclaration (stopset);
}
cannot reachend
*/
-static void Footer (SetOfStop stopset)
+static void Footer (pge_SetOfStop stopset)
{
- Expect (bnflex_codetok, stopset|(SetOfStop) ((1 << (bnflex_moduletok-bnflex_identtok))));
- Expect (bnflex_moduletok, stopset|(SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
+ Expect (bnflex_codetok, stopset|(pge_SetOfStop) ((1 << (bnflex_moduletok-bnflex_identtok))));
+ Expect (bnflex_moduletok, stopset|(pge_SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
EndModName (stopset);
}
cannot reachend
*/
-static void First (SetOfStop stopset)
+static void First (pge_SetOfStop stopset)
{
- Expect (bnflex_firsttok, stopset|(SetOfStop) ((1 << (bnflex_lcparatok-bnflex_identtok))));
- Expect (bnflex_lcparatok, stopset|(SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_firsttok, stopset|(pge_SetOfStop) ((1 << (bnflex_lcparatok-bnflex_identtok))));
+ Expect (bnflex_lcparatok, stopset|(pge_SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
while ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_lesstok)) | (1 << (bnflex_identtok)) | (1 << (bnflex_squotetok)) | (1 << (bnflex_dquotetok))))) != 0))
{
- LitOrTokenOrIdent (stopset|(SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
+ LitOrTokenOrIdent (stopset|(pge_SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
CurrentSetDesc->next = TailProduction->first;
TailProduction->first = CurrentSetDesc;
}
cannot reachend
*/
-static void Follow (SetOfStop stopset)
+static void Follow (pge_SetOfStop stopset)
{
- Expect (bnflex_followtok, stopset|(SetOfStop) ((1 << (bnflex_lcparatok-bnflex_identtok))));
- Expect (bnflex_lcparatok, stopset|(SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_followtok, stopset|(pge_SetOfStop) ((1 << (bnflex_lcparatok-bnflex_identtok))));
+ Expect (bnflex_lcparatok, stopset|(pge_SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
while ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_lesstok)) | (1 << (bnflex_identtok)) | (1 << (bnflex_squotetok)) | (1 << (bnflex_dquotetok))))) != 0))
{
- LitOrTokenOrIdent (stopset|(SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
+ LitOrTokenOrIdent (stopset|(pge_SetOfStop) ((1 << (bnflex_rcparatok-bnflex_identtok)) | (1 << (bnflex_lesstok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
CurrentSetDesc->next = TailProduction->followinfo->follow;
TailProduction->followinfo->follow = CurrentSetDesc;
}
cannot reachend
*/
-static void LitOrTokenOrIdent (SetOfStop stopset)
+static void LitOrTokenOrIdent (pge_SetOfStop stopset)
{
if ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_dquotetok)) | (1 << (bnflex_squotetok))))) != 0))
{
Literal (stopset);
CurrentSetDesc = NewSetDesc ();
- CurrentSetDesc->type = litel;
+ CurrentSetDesc->type = pge_litel;
CurrentSetDesc->string = LastLiteral;
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_lesstok)
{
/* avoid dangling else. */
- Expect (bnflex_lesstok, stopset|(SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
- CollectTok (stopset|(SetOfStop) ((1 << (bnflex_gretok-bnflex_identtok))));
+ Expect (bnflex_lesstok, stopset|(pge_SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
+ CollectTok (stopset|(pge_SetOfStop) ((1 << (bnflex_gretok-bnflex_identtok))));
Expect (bnflex_gretok, stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_identtok)
/* avoid dangling else. */
Ident (stopset);
CurrentSetDesc = NewSetDesc ();
- CurrentSetDesc->type = idel;
+ CurrentSetDesc->type = pge_idel;
CurrentSetDesc->ident = CurrentIdent;
}
else
cannot reachend
*/
-static void Literal (SetOfStop stopset)
+static void Literal (pge_SetOfStop stopset)
{
if ((bnflex_GetCurrentTokenType ()) == bnflex_dquotetok)
{
- Expect (bnflex_dquotetok, stopset|(SetOfStop) ((1 << (bnflex_literaltok-bnflex_identtok))));
- CollectLiteral (stopset|(SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok))));
+ Expect (bnflex_dquotetok, stopset|(pge_SetOfStop) ((1 << (bnflex_literaltok-bnflex_identtok))));
+ CollectLiteral (stopset|(pge_SetOfStop) ((1 << (bnflex_dquotetok-bnflex_identtok))));
Expect (bnflex_dquotetok, stopset);
}
else if ((bnflex_GetCurrentTokenType ()) == bnflex_squotetok)
{
/* avoid dangling else. */
- Expect (bnflex_squotetok, stopset|(SetOfStop) ((1 << (bnflex_literaltok-bnflex_identtok))));
- CollectLiteral (stopset|(SetOfStop) ((1 << (bnflex_squotetok-bnflex_identtok))));
+ Expect (bnflex_squotetok, stopset|(pge_SetOfStop) ((1 << (bnflex_literaltok-bnflex_identtok))));
+ CollectLiteral (stopset|(pge_SetOfStop) ((1 << (bnflex_squotetok-bnflex_identtok))));
Expect (bnflex_squotetok, stopset);
}
else
cannot reachend
*/
-static void Token (SetOfStop stopset)
+static void Token (pge_SetOfStop stopset)
{
- Literal (stopset|(SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
+ Literal (stopset|(pge_SetOfStop) ((1 << (bnflex_identtok-bnflex_identtok))));
DefineToken (stopset);
}
cannot reachend
*/
-static void ErrorProcedures (SetOfStop stopset)
+static void ErrorProcedures (pge_SetOfStop stopset)
{
- Literal (stopset|(SetOfStop) ((1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
+ Literal (stopset|(pge_SetOfStop) ((1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
ErrorProcArray = LastLiteral;
Literal (stopset);
ErrorProcString = LastLiteral;
cannot reachend
*/
-static void TokenProcedure (SetOfStop stopset)
+static void TokenProcedure (pge_SetOfStop stopset)
{
Literal (stopset);
TokenTypeProc = LastLiteral;
cannot reachend
*/
-static void SymProcedure (SetOfStop stopset)
+static void SymProcedure (pge_SetOfStop stopset)
{
Literal (stopset);
SymIsProc = LastLiteral;
cannot reachend
*/
-static void Production (SetOfStop stopset)
+static void Production (pge_SetOfStop stopset)
{
Statement (stopset);
}
cannot reachend
*/
-static void Expression (SetOfStop stopset)
+static void Expression (pge_SetOfStop stopset)
{
- TermDesc t1;
- TermDesc t2;
- ExpressionDesc e;
+ pge_TermDesc t1;
+ pge_TermDesc t2;
+ pge_ExpressionDesc e;
e = CurrentExpression;
t1 = NewTerm ();
CurrentTerm = t1;
- Term (stopset|(SetOfStop) ((1 << (bnflex_bartok-bnflex_identtok))));
+ Term (stopset|(pge_SetOfStop) ((1 << (bnflex_bartok-bnflex_identtok))));
e->term = t1;
while ((bnflex_GetCurrentTokenType ()) == bnflex_bartok)
{
- Expect (bnflex_bartok, stopset|(SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
+ Expect (bnflex_bartok, stopset|(pge_SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
t2 = NewTerm ();
CurrentTerm = t2;
- Term (stopset|(SetOfStop) ((1 << (bnflex_bartok-bnflex_identtok))));
+ Term (stopset|(pge_SetOfStop) ((1 << (bnflex_bartok-bnflex_identtok))));
t1->next = t2;
t1 = t2;
}
cannot reachend
*/
-static void Term (SetOfStop stopset)
+static void Term (pge_SetOfStop stopset)
{
- TermDesc t1;
- FactorDesc f1;
- FactorDesc f2;
+ pge_TermDesc t1;
+ pge_FactorDesc f1;
+ pge_FactorDesc f2;
CurrentFactor = NewFactor ();
f1 = CurrentFactor;
t1 = CurrentTerm;
- Factor (stopset|(SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
+ Factor (stopset|(pge_SetOfStop) ((1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok))));
t1->factor = f1;
f2 = NewFactor ();
CurrentFactor = f2;
while ((((1 << (bnflex_GetCurrentTokenType ())) & ((unsigned int) ((1 << (bnflex_codetok)) | (1 << (bnflex_identtok)) | (1 << (bnflex_lcparatok)) | (1 << (bnflex_lsparatok)) | (1 << (bnflex_lparatok)) | (1 << (bnflex_squotetok)) | (1 << (bnflex_dquotetok))))) != 0))
{
- Factor (stopset|(SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
+ Factor (stopset|(pge_SetOfStop) ((1 << (bnflex_codetok-bnflex_identtok)) | (1 << (bnflex_identtok-bnflex_identtok)) | (1 << (bnflex_lcparatok-bnflex_identtok)) | (1 << (bnflex_lsparatok-bnflex_identtok)) | (1 << (bnflex_lparatok-bnflex_identtok)) | (1 << (bnflex_squotetok-bnflex_identtok)) | (1 << (bnflex_dquotetok-bnflex_identtok))));
f1->next = f2;
f1 = f2;
f2 = NewFactor ();
GetDefinitionName - returns the name of the rule inside, p.
*/
-static NameKey_Name GetDefinitionName (ProductionDesc p)
+static NameKey_Name GetDefinitionName (pge_ProductionDesc p)
{
if (p != NULL)
{
FindDefinition - searches and returns the rule which defines, n.
*/
-static ProductionDesc FindDefinition (NameKey_Name n)
+static pge_ProductionDesc FindDefinition (NameKey_Name n)
{
- ProductionDesc p;
- ProductionDesc f;
+ pge_ProductionDesc p;
+ pge_ProductionDesc f;
p = HeadProduction;
f = NULL;
set the definition accordingly.
*/
-static void BackPatchIdent (IdentDesc i)
+static void BackPatchIdent (pge_IdentDesc i)
{
if (i != NULL)
{
BackPatchFactor - runs through the factor looking for an ident
*/
-static void BackPatchFactor (FactorDesc f)
+static void BackPatchFactor (pge_FactorDesc f)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
BackPatchIdent (f->ident);
break;
- case sub:
- case opt:
- case mult:
+ case pge_sub:
+ case pge_opt:
+ case pge_mult:
BackPatchExpression (f->expr);
break;
BackPatchTerm - runs through all terms to find idents.
*/
-static void BackPatchTerm (TermDesc t)
+static void BackPatchTerm (pge_TermDesc t)
{
while (t != NULL)
{
BackPatchExpression - runs through the term to find any idents.
*/
-static void BackPatchExpression (ExpressionDesc e)
+static void BackPatchExpression (pge_ExpressionDesc e)
{
if (e != NULL)
{
BackPatchSet -
*/
-static void BackPatchSet (SetDesc s)
+static void BackPatchSet (pge_SetDesc s)
{
while (s != NULL)
{
switch (s->type)
{
- case idel:
+ case pge_idel:
BackPatchIdent (s->ident);
break;
to the definition.
*/
-static void BackPatchIdentToDefinitions (ProductionDesc d)
+static void BackPatchIdentToDefinitions (pge_ProductionDesc d)
{
if ((d != NULL) && (d->statement != NULL))
{
CalculateFirstAndFollow -
*/
-static void CalculateFirstAndFollow (ProductionDesc p)
+static void CalculateFirstAndFollow (pge_ProductionDesc p)
{
if (Debugging)
{
ForeachRuleDo -
*/
-static void ForeachRuleDo (DoProcedure p)
+static void ForeachRuleDo (pge_DoProcedure p)
{
CurrentProduction = HeadProduction;
while (CurrentProduction != NULL)
WhileNotCompleteDo -
*/
-static void WhileNotCompleteDo (DoProcedure p)
+static void WhileNotCompleteDo (pge_DoProcedure p)
{
do {
Finished = TRUE;
PrettyPara -
*/
-static void PrettyPara (const char *c1_, unsigned int _c1_high, const char *c2_, unsigned int _c2_high, ExpressionDesc e, unsigned int Left)
+static void PrettyPara (const char *c1_, unsigned int _c1_high, const char *c2_, unsigned int _c2_high, pge_ExpressionDesc e, unsigned int Left)
{
char c1[_c1_high+1];
char c2[_c2_high+1];
PrettyCommentFactor -
*/
-static void PrettyCommentFactor (FactorDesc f, unsigned int Left)
+static void PrettyCommentFactor (pge_FactorDesc f, unsigned int Left)
{
unsigned int curpos;
unsigned int seentext;
CheckNewLine (Left);
switch (f->type)
{
- case id:
+ case pge_id:
Output_WriteKey (f->ident->name);
Output_WriteString ((const char *) " ", 1);
Indent += (NameKey_LengthKey (f->ident->name))+1;
break;
- case lit:
+ case pge_lit:
if ((NameKey_MakeKey ((const char *) "'", 1)) == f->string)
{
Output_Write ('"');
Indent += (NameKey_LengthKey (f->string))+3;
break;
- case sub:
+ case pge_sub:
PrettyPara ((const char *) "( ", 2, (const char *) " ) ", 3, f->expr, Left);
break;
- case opt:
+ case pge_opt:
PrettyPara ((const char *) "[ ", 2, (const char *) " ] ", 3, f->expr, Left);
break;
- case mult:
+ case pge_mult:
if (Texinfo)
{
PrettyPara ((const char *) "@{ ", 3, (const char *) " @} ", 4, f->expr, Left);
}
break;
- case m2:
+ case pge_m2:
if (EmitCode)
{
NewLine (Left);
PeepTerm - returns the length of characters in term.
*/
-static unsigned int PeepTerm (TermDesc t)
+static unsigned int PeepTerm (pge_TermDesc t)
{
unsigned int l;
PeepExpression - returns the length of the expression.
*/
-static unsigned int PeepExpression (ExpressionDesc e)
+static unsigned int PeepExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
PeepFactor - returns the length of character in the factor
*/
-static unsigned int PeepFactor (FactorDesc f)
+static unsigned int PeepFactor (pge_FactorDesc f)
{
unsigned int l;
{
switch (f->type)
{
- case id:
+ case pge_id:
l += (NameKey_LengthKey (f->ident->name))+1;
break;
- case lit:
+ case pge_lit:
l += (NameKey_LengthKey (f->string))+3;
break;
- case opt:
- case mult:
- case sub:
+ case pge_opt:
+ case pge_mult:
+ case pge_sub:
l += PeepExpression (f->expr);
break;
- case m2:
+ case pge_m2:
break;
PrettyCommentTerm -
*/
-static void PrettyCommentTerm (TermDesc t, unsigned int Left)
+static void PrettyCommentTerm (pge_TermDesc t, unsigned int Left)
{
while (t != NULL)
{
PrettyCommentExpression -
*/
-static void PrettyCommentExpression (ExpressionDesc e, unsigned int Left)
+static void PrettyCommentExpression (pge_ExpressionDesc e, unsigned int Left)
{
if (e != NULL)
{
PrettyCommentStatement -
*/
-static void PrettyCommentStatement (StatementDesc s, unsigned int Left)
+static void PrettyCommentStatement (pge_StatementDesc s, unsigned int Left)
{
if (s != NULL)
{
PrettyCommentProduction - generates the comment for rule, p.
*/
-static void PrettyCommentProduction (ProductionDesc p)
+static void PrettyCommentProduction (pge_ProductionDesc p)
{
- SetDesc to;
+ pge_SetDesc to;
if (p != NULL)
{
NewLine (3);
switch (GetReachEnd (p->followinfo))
{
- case true_:
+ case pge_true:
Output_WriteString ((const char *) "reachend", 8);
break;
- case false_:
+ case pge_false:
Output_WriteString ((const char *) "cannot reachend", 15);
break;
- case unknown:
+ case pge_unknown:
Output_WriteString ((const char *) "unknown...", 10);
break;
PrettyPrintProduction - pretty prints the ebnf rule, p.
*/
-static void PrettyPrintProduction (ProductionDesc p)
+static void PrettyPrintProduction (pge_ProductionDesc p)
{
- SetDesc to;
+ pge_SetDesc to;
if (p != NULL)
{
Output_WriteString ((const char *) "@example", 8);
NewLine (0);
}
+ else if (Sphinx)
+ {
+ /* avoid dangling else. */
+ Output_WriteString ((const char *) ".. code-block:: ebnf", 20);
+ NewLine (0);
+ }
Output_WriteKey (GetDefinitionName (p));
Output_WriteString ((const char *) " := ", 4);
Indent += (NameKey_LengthKey (GetDefinitionName (p)))+4;
Output_WriteString ((const char *) "@end example", 12);
NewLine (0);
}
+ else if (Sphinx)
+ {
+ /* avoid dangling else. */
+ Output_WriteString ((const char *) ".. index::", 10);
+ NewLine (0);
+ Output_WriteString ((const char *) " pair: ", 8);
+ Output_WriteKey (GetDefinitionName (p));
+ Output_WriteString ((const char *) "; (ebnf)", 8);
+ NewLine (0);
+ }
NewLine (0);
}
}
EmitRule - generates a comment and code for rule, p.
*/
-static void EmitRule (ProductionDesc p)
+static void EmitRule (pge_ProductionDesc p)
{
if (PrettyPrint)
{
CodeCondition -
*/
-static void CodeCondition (m2condition m)
+static void CodeCondition (pge_m2condition m)
{
switch (m)
{
- case m2if:
- case m2none:
+ case pge_m2if:
+ case pge_m2none:
IndentString ((const char *) "IF ", 3);
break;
- case m2elsif:
+ case pge_m2elsif:
IndentString ((const char *) "ELSIF ", 6);
break;
- case m2while:
+ case pge_m2while:
IndentString ((const char *) "WHILE ", 6);
break;
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 2672, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, 2680, (const char *) "m2/gm2-auto/pge.mod", 19);
break;
}
}
CodeThenDo - codes a "THEN" or "DO" depending upon, m.
*/
-static void CodeThenDo (m2condition m)
+static void CodeThenDo (pge_m2condition m)
{
switch (m)
{
- case m2if:
- case m2none:
- case m2elsif:
+ case pge_m2if:
+ case pge_m2none:
+ case pge_m2elsif:
if (LastLineNo == 0)
{
Output_WriteLn ();
Output_WriteLn ();
break;
- case m2while:
+ case pge_m2while:
Output_WriteString ((const char *) " DO", 3);
Output_WriteLn ();
break;
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 2697, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, 2705, (const char *) "m2/gm2-auto/pge.mod", 19);
break;
}
OnLineStart = TRUE;
CodeElseEnd - builds an ELSE END statement using string, end.
*/
-static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, FactorDesc f, unsigned int inopt)
+static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, pge_FactorDesc f, unsigned int inopt)
{
char end[_end_high+1];
Output_Write ('(');
switch (f->type)
{
- case id:
+ case pge_id:
Output_Write ('\'');
Output_WriteKey (f->ident->name);
Output_WriteString ((const char *) " - expected", 11);
Output_WriteString ((const char *) "') ;", 4);
break;
- case lit:
+ case pge_lit:
if ((NameKey_MakeKey ((const char *) "'", 1)) == f->string)
{
Output_Write ('"');
CodeEnd - codes a "END" depending upon, m.
*/
-static void CodeEnd (m2condition m, TermDesc t, unsigned int consumed, FactorDesc f, unsigned int inopt)
+static void CodeEnd (pge_m2condition m, pge_TermDesc t, unsigned int consumed, pge_FactorDesc f, unsigned int inopt)
{
Indent -= 3;
Output_WriteLn ();
OnLineStart = TRUE;
switch (m)
{
- case m2none:
+ case pge_m2none:
if (t == NULL)
{
CodeElseEnd ((const char *) "END ;", 5, consumed, f, inopt);
}
break;
- case m2if:
+ case pge_m2if:
if (t == NULL)
{
CodeElseEnd ((const char *) "END ; (* if *)", 15, consumed, f, inopt);
}
break;
- case m2elsif:
+ case pge_m2elsif:
if (t == NULL)
{
CodeElseEnd ((const char *) "END ; (* elsif *)", 18, consumed, f, inopt);
}
break;
- case m2while:
+ case pge_m2while:
IndentString ((const char *) "END ; (* while *)", 18);
break;
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 2780, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, 2788, (const char *) "m2/gm2-auto/pge.mod", 19);
break;
}
OnLineStart = FALSE;
EmitNonVarCode - writes out, code, providing it is not a variable declaration.
*/
-static void EmitNonVarCode (CodeDesc code, unsigned int curpos, unsigned int left)
+static void EmitNonVarCode (pge_CodeDesc code, unsigned int curpos, unsigned int left)
{
unsigned int i;
- CodeHunk t;
+ pge_CodeHunk t;
unsigned int seentext;
t = code->code;
ChainOn -
*/
-static FactorDesc ChainOn (FactorDesc codeStack, FactorDesc f)
+static pge_FactorDesc ChainOn (pge_FactorDesc codeStack, pge_FactorDesc f)
{
- FactorDesc s;
+ pge_FactorDesc s;
f->pushed = NULL;
if (codeStack == NULL)
FlushCode -
*/
-static void FlushCode (FactorDesc *codeStack)
+static void FlushCode (pge_FactorDesc *codeStack)
{
if ((*codeStack) != NULL)
{
CodeFactor -
*/
-static void CodeFactor (FactorDesc f, TermDesc t, m2condition l, m2condition n, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack)
+static void CodeFactor (pge_FactorDesc f, pge_TermDesc t, pge_m2condition l, pge_m2condition n, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack)
{
if (f == NULL)
{
EmitFileLineTag (f->line);
switch (f->type)
{
- case id:
+ case pge_id:
FlushCode (&codeStack);
CodeCondition (n);
Output_WriteKey (f->ident->name);
Output_WriteString ((const char *) "()", 2);
CodeThenDo (n);
Indent += 3;
- CodeFactor (f->next, NULL, n, m2none, inopt, inwhile, TRUE, NULL);
+ CodeFactor (f->next, NULL, n, pge_m2none, inopt, inwhile, TRUE, NULL);
CodeEnd (n, t, consumed, f, inopt);
break;
- case lit:
+ case pge_lit:
FlushCode (&codeStack);
CodeCondition (n);
Output_WriteKey (SymIsProc);
Output_Write (')');
CodeThenDo (n);
Indent += 3;
- CodeFactor (f->next, NULL, n, m2none, inopt, inwhile, TRUE, NULL);
+ CodeFactor (f->next, NULL, n, pge_m2none, inopt, inwhile, TRUE, NULL);
CodeEnd (n, t, consumed, f, inopt);
break;
- case sub:
+ case pge_sub:
FlushCode (&codeStack);
- CodeExpression (f->expr, m2none, inopt, inwhile, consumed, NULL);
+ CodeExpression (f->expr, pge_m2none, inopt, inwhile, consumed, NULL);
if (f->next != NULL)
{
/*
* the test above makes sure that we don't emit a RETURN( TRUE )
* after a subexpression. Remember sub expressions are not conditional
*/
- CodeFactor (f->next, t, n, m2none, inopt, inwhile, TRUE, NULL);
+ CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, TRUE, NULL);
}
break;
- case opt:
+ case pge_opt:
FlushCode (&codeStack);
- CodeExpression (f->expr, m2if, TRUE, inwhile, FALSE, NULL);
- CodeFactor (f->next, t, n, m2none, inopt, inwhile, consumed, NULL);
+ CodeExpression (f->expr, pge_m2if, TRUE, inwhile, FALSE, NULL);
+ CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, consumed, NULL);
break;
- case mult:
+ case pge_mult:
FlushCode (&codeStack);
- CodeExpression (f->expr, m2while, FALSE, TRUE, consumed, NULL);
- CodeFactor (f->next, t, n, m2none, inopt, inwhile, consumed, NULL);
+ CodeExpression (f->expr, pge_m2while, FALSE, TRUE, consumed, NULL);
+ CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, consumed, NULL);
break;
- case m2:
+ case pge_m2:
codeStack = ChainOn (codeStack, f);
if (consumed || (f->next == NULL))
{
FlushCode (&codeStack);
}
- CodeFactor (f->next, t, n, m2none, inopt, inwhile, consumed, codeStack);
+ CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, consumed, codeStack);
break;
CodeTerm -
*/
-static void CodeTerm (TermDesc t, m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack)
+static void CodeTerm (pge_TermDesc t, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack)
{
- m2condition l;
+ pge_m2condition l;
l = m;
while (t != NULL)
{
EmitFileLineTag (t->line);
- if ((t->factor->type == m2) && (m == m2elsif))
+ if ((t->factor->type == pge_m2) && (m == pge_m2elsif))
{
- m = m2if;
+ m = pge_m2if;
IndentString ((const char *) "ELSE", 4);
Output_WriteLn ();
OnLineStart = TRUE;
Indent += 3;
- CodeFactor (t->factor, t->next, m2none, m2none, inopt, inwhile, consumed, codeStack);
+ CodeFactor (t->factor, t->next, pge_m2none, pge_m2none, inopt, inwhile, consumed, codeStack);
Indent -= 3;
IndentString ((const char *) "END ;", 5);
Output_WriteLn ();
}
else
{
- CodeFactor (t->factor, t->next, m2none, m, inopt, inwhile, consumed, codeStack);
+ CodeFactor (t->factor, t->next, pge_m2none, m, inopt, inwhile, consumed, codeStack);
}
l = m;
if (t->next != NULL)
{
- m = m2elsif;
+ m = pge_m2elsif;
}
t = t->next;
}
CodeExpression -
*/
-static void CodeExpression (ExpressionDesc e, m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, FactorDesc codeStack)
+static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack)
{
if (e != NULL)
{
CodeStatement -
*/
-static void CodeStatement (StatementDesc s, m2condition m)
+static void CodeStatement (pge_StatementDesc s, pge_m2condition m)
{
if (s != NULL)
{
CodeProduction - only encode grammer rules which are not special.
*/
-static void CodeProduction (ProductionDesc p)
+static void CodeProduction (pge_ProductionDesc p)
{
if ((p != NULL) && (! p->firstsolved || ((p->statement != NULL) && (p->statement->expr != NULL))))
{
OnLineStart = FALSE;
EmitFileLineTag (p->line);
Indent = 3;
- CodeStatement (p->statement, m2none);
+ CodeStatement (p->statement, pge_m2none);
Output_WriteLn ();
Indent = 0;
IndentString ((const char *) "END ", 4);
RecoverCondition -
*/
-static void RecoverCondition (m2condition m)
+static void RecoverCondition (pge_m2condition m)
{
switch (m)
{
- case m2if:
+ case pge_m2if:
IndentString ((const char *) "IF ", 3);
break;
- case m2none:
+ case pge_m2none:
IndentString ((const char *) "IF ", 3);
break;
- case m2elsif:
+ case pge_m2elsif:
IndentString ((const char *) "ELSIF ", 6);
break;
- case m2while:
+ case pge_m2while:
IndentString ((const char *) "WHILE ", 6);
break;
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 3037, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, 3045, (const char *) "m2/gm2-auto/pge.mod", 19);
break;
}
}
ConditionIndent - returns the number of spaces indentation created via, m.
*/
-static unsigned int ConditionIndent (m2condition m)
+static unsigned int ConditionIndent (pge_m2condition m)
{
switch (m)
{
- case m2if:
+ case pge_m2if:
return 3;
break;
- case m2none:
+ case pge_m2none:
return 3;
break;
- case m2elsif:
+ case pge_m2elsif:
return 6;
break;
- case m2while:
+ case pge_m2while:
return 6;
break;
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 3056, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, 3064, (const char *) "m2/gm2-auto/pge.mod", 19);
break;
}
ReturnException ("m2/gm2-auto/pge.mod", 1, 7);
NumberOfElements - returns the number of elements in set, to, which lie between low..high
*/
-static unsigned int NumberOfElements (SetDesc to, unsigned int low, unsigned int high)
+static unsigned int NumberOfElements (pge_SetDesc to, unsigned int low, unsigned int high)
{
unsigned int n;
{
switch (to->type)
{
- case tokel:
+ case pge_tokel:
if ((high == 0) || (IsBetween (to->string, low, high)))
{
n += 1;
}
break;
- case litel:
+ case pge_litel:
if ((high == 0) || (IsBetween (SymbolKey_GetSymKey (Aliases, to->string), low, high)))
{
n += 1;
}
break;
- case idel:
+ case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
WasNoError = FALSE;
break;
EmitIsInSet - writes out the equivalent of GetTokenType() IN { toset }
*/
-static void EmitIsInSet (SetDesc to, NameKey_Name low, NameKey_Name high)
+static void EmitIsInSet (pge_SetDesc to, NameKey_Name low, NameKey_Name high)
{
if ((NumberOfElements (to, low, high)) == 1)
{
EmitIsInSubSet - writes out a test to see whether GetTokenype() is in { subset }
*/
-static void EmitIsInSubSet (SetDesc to, unsigned int low, unsigned int high)
+static void EmitIsInSubSet (pge_SetDesc to, unsigned int low, unsigned int high)
{
if ((NumberOfElements (to, low, high)) == 1)
{
EmitIsInFirst -
*/
-static void EmitIsInFirst (SetDesc to, m2condition m)
+static void EmitIsInFirst (pge_SetDesc to, pge_m2condition m)
{
unsigned int i;
unsigned int first;
}
}
-static void FlushRecoverCode (FactorDesc *codeStack)
+static void FlushRecoverCode (pge_FactorDesc *codeStack)
{
/*
FlushCode -
RecoverFactor -
*/
-static void RecoverFactor (FactorDesc f, m2condition m, FactorDesc codeStack)
+static void RecoverFactor (pge_FactorDesc f, pge_m2condition m, pge_FactorDesc codeStack)
{
- SetDesc to;
+ pge_SetDesc to;
if (f == NULL)
{} /* empty. */
EmitFileLineTag (f->line);
switch (f->type)
{
- case id:
+ case pge_id:
to = NULL;
CalcFirstFactor (f, NULL, &to);
- if ((to != NULL) && (m != m2none))
+ if ((to != NULL) && (m != pge_m2none))
{
RecoverCondition (m);
EmitIsInFirst (to, m);
EmitStopParametersAndFollow (f, m);
Output_WriteString ((const char *) ") ;", 3);
Output_WriteLn ();
- RecoverFactor (f->next, m2none, codeStack);
- if ((to != NULL) && (m != m2none))
+ RecoverFactor (f->next, pge_m2none, codeStack);
+ if ((to != NULL) && (m != pge_m2none))
{
Indent -= 3;
}
break;
- case lit:
- if (m == m2none)
+ case pge_lit:
+ if (m == pge_m2none)
{
FlushRecoverCode (&codeStack);
IndentString ((const char *) "Expect(", 7);
EmitStopParametersAndFollow (f, m);
Output_WriteString ((const char *) ") ;", 3);
Output_WriteLn ();
- RecoverFactor (f->next, m2none, codeStack);
+ RecoverFactor (f->next, pge_m2none, codeStack);
}
else
{
Output_WriteString ((const char *) ") ;", 3);
Output_WriteLn ();
FlushRecoverCode (&codeStack);
- RecoverFactor (f->next, m2none, codeStack);
+ RecoverFactor (f->next, pge_m2none, codeStack);
Indent -= 3;
}
break;
- case sub:
+ case pge_sub:
FlushRecoverCode (&codeStack);
- RecoverExpression (f->expr, m2none, m);
- RecoverFactor (f->next, m2none, codeStack);
+ RecoverExpression (f->expr, pge_m2none, m);
+ RecoverFactor (f->next, pge_m2none, codeStack);
break;
- case opt:
+ case pge_opt:
FlushRecoverCode (&codeStack);
if (OptExpSeen (f))
{
IndentString ((const char *) "(* seen optional [ | ] expression *)", 36);
Output_WriteLn ();
stop ();
- RecoverExpression (f->expr, m2none, m2if);
+ RecoverExpression (f->expr, pge_m2none, pge_m2if);
IndentString ((const char *) "(* end of optional [ | ] expression *)", 38);
Output_WriteLn ();
Indent -= 3;
}
else
{
- RecoverExpression (f->expr, m2if, m);
+ RecoverExpression (f->expr, pge_m2if, m);
}
- RecoverFactor (f->next, m2none, codeStack);
+ RecoverFactor (f->next, pge_m2none, codeStack);
break;
- case mult:
+ case pge_mult:
FlushRecoverCode (&codeStack);
- if (((OptExpSeen (f)) || (m == m2if)) || (m == m2elsif))
+ if (((OptExpSeen (f)) || (m == pge_m2if)) || (m == pge_m2elsif))
{
/* avoid dangling else. */
to = NULL;
Indent += 3;
IndentString ((const char *) "(* seen optional { | } expression *)", 36);
Output_WriteLn ();
- RecoverCondition (m2while);
- EmitIsInFirst (to, m2while);
- CodeThenDo (m2while);
+ RecoverCondition (pge_m2while);
+ EmitIsInFirst (to, pge_m2while);
+ CodeThenDo (pge_m2while);
Indent += 3;
- RecoverExpression (f->expr, m2none, m2while);
+ RecoverExpression (f->expr, pge_m2none, pge_m2while);
IndentString ((const char *) "(* end of optional { | } expression *)", 38);
Output_WriteLn ();
Indent -= 3;
IndentString ((const char *) "END ;", 5);
Output_WriteLn ();
Indent -= 3;
- if (m == m2none)
+ if (m == pge_m2none)
{
IndentString ((const char *) "END ;", 5);
Output_WriteLn ();
}
else
{
- RecoverExpression (f->expr, m2while, m);
+ RecoverExpression (f->expr, pge_m2while, m);
}
- RecoverFactor (f->next, m2none, codeStack);
+ RecoverFactor (f->next, pge_m2none, codeStack);
break;
- case m2:
+ case pge_m2:
codeStack = ChainOn (codeStack, f);
if (f->next == NULL)
{
and FALSE in the first.
*/
-static unsigned int OptExpSeen (FactorDesc f)
+static unsigned int OptExpSeen (pge_FactorDesc f)
{
if (f == NULL)
{
{
switch (f->type)
{
- case id:
- case lit:
+ case pge_id:
+ case pge_lit:
return FALSE;
break;
- case sub:
+ case pge_sub:
return FALSE; /* is this correct? */
break;
- case opt:
- case mult:
+ case pge_opt:
+ case pge_mult:
return ((f->expr != NULL) && (f->expr->term != NULL)) && (f->expr->term->next != NULL); /* is this correct? */
break;
- case m2:
+ case pge_m2:
return TRUE;
break;
RecoverTerm -
*/
-static void RecoverTerm (TermDesc t, m2condition new_, m2condition old)
+static void RecoverTerm (pge_TermDesc t, pge_m2condition new_, pge_m2condition old)
{
unsigned int LastWasM2Only;
unsigned int alternative;
- SetDesc to;
+ pge_SetDesc to;
- LastWasM2Only = (t->factor->type == m2) && (t->factor->next == NULL); /* does the factor only contain inline code? */
+ LastWasM2Only = (t->factor->type == pge_m2) && (t->factor->next == NULL); /* does the factor only contain inline code? */
to = NULL;
CalcFirstTerm (t, NULL, &to);
alternative = FALSE;
if (t->next != NULL)
{
- new_ = m2if;
+ new_ = pge_m2if;
}
while (t != NULL)
{
EmitFileLineTag (t->line);
- LastWasM2Only = (t->factor->type == m2) && (t->factor->next == NULL);
- if ((t->factor->type == m2) && (new_ == m2elsif))
+ LastWasM2Only = (t->factor->type == pge_m2) && (t->factor->next == NULL);
+ if ((t->factor->type == pge_m2) && (new_ == pge_m2elsif))
{
- new_ = m2if;
+ new_ = pge_m2if;
IndentString ((const char *) "ELSE", 4);
Output_WriteLn ();
Indent += 3;
- RecoverFactor (t->factor, m2none, NULL);
+ RecoverFactor (t->factor, pge_m2none, NULL);
alternative = FALSE;
}
else
}
if (t->next != NULL)
{
- new_ = m2elsif;
+ new_ = pge_m2elsif;
alternative = TRUE;
}
t = t->next;
}
- if ((new_ == m2if) || (new_ == m2elsif))
+ if ((new_ == pge_m2if) || (new_ == pge_m2elsif))
{
- if (alternative && (old != m2while))
+ if (alternative && (old != pge_m2while))
{
IndentString ((const char *) "ELSE", 4);
Output_WriteLn ();
IndentString ((const char *) "END ;", 5);
Output_WriteLn ();
}
- else if (new_ == m2while)
+ else if (new_ == pge_m2while)
{
/* avoid dangling else. */
IndentString ((const char *) "END (* while *) ;", 17);
RecoverExpression -
*/
-static void RecoverExpression (ExpressionDesc e, m2condition new_, m2condition old)
+static void RecoverExpression (pge_ExpressionDesc e, pge_m2condition new_, pge_m2condition old)
{
if (e != NULL)
{
RecoverStatement -
*/
-static void RecoverStatement (StatementDesc s, m2condition m)
+static void RecoverStatement (pge_StatementDesc s, pge_m2condition m)
{
if (s != NULL)
{
EmitFileLineTag (s->line);
- RecoverExpression (s->expr, m, m2none);
+ RecoverExpression (s->expr, m, pge_m2none);
}
}
EmitFirstFactor - generate a list of all first tokens between the range: low..high.
*/
-static void EmitFirstFactor (FactorDesc f, unsigned int low, unsigned int high)
+static void EmitFirstFactor (pge_FactorDesc f, unsigned int low, unsigned int high)
{
}
IsEmptySet - returns TRUE if no elements exist in set, to, with values, low..high.
*/
-static unsigned int IsEmptySet (SetDesc to, unsigned int low, unsigned int high)
+static unsigned int IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high)
{
while (to != NULL)
{
switch (to->type)
{
- case tokel:
+ case pge_tokel:
if (IsBetween (to->string, low, high))
{
return FALSE;
}
break;
- case litel:
+ case pge_litel:
if (IsBetween (SymbolKey_GetSymKey (Aliases, to->string), low, high))
{
return FALSE;
}
break;
- case idel:
+ case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
WasNoError = FALSE;
break;
EmitSet - emits the tokens in the set, to, which have values low..high
*/
-static void EmitSet (SetDesc to, unsigned int low, unsigned int high)
+static void EmitSet (pge_SetDesc to, unsigned int low, unsigned int high)
{
unsigned int first;
{
switch (to->type)
{
- case tokel:
+ case pge_tokel:
if ((high == 0) || (IsBetween (to->string, low, high)))
{
if (! first)
}
break;
- case litel:
+ case pge_litel:
if ((high == 0) || (IsBetween (SymbolKey_GetSymKey (Aliases, to->string), low, high)))
{
if (! first)
}
break;
- case idel:
+ case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
WasNoError = FALSE;
break;
their names.
*/
-static void EmitSetName (SetDesc to, unsigned int low, unsigned int high)
+static void EmitSetName (pge_SetDesc to, unsigned int low, unsigned int high)
{
while (to != NULL)
{
switch (to->type)
{
- case tokel:
+ case pge_tokel:
if ((high == 0) || (IsBetween (to->string, low, high)))
{
/* avoid gcc warning by using compound statement even if not strictly necessary. */
}
break;
- case litel:
+ case pge_litel:
if ((high == 0) || (IsBetween (SymbolKey_GetSymKey (Aliases, to->string), low, high)))
{
Output_WriteKey (to->string);
}
break;
- case idel:
+ case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
WasNoError = FALSE;
break;
inclusion of all the symbols in set, to.
*/
-static void EmitStopParametersAndSet (SetDesc to)
+static void EmitStopParametersAndSet (pge_SetDesc to)
{
unsigned int i;
EmitSetAsParameters - generates the first symbols as parameters to a set function.
*/
-static void EmitSetAsParameters (SetDesc to)
+static void EmitSetAsParameters (pge_SetDesc to)
{
unsigned int i;
sentances.
*/
-static void EmitStopParametersAndFollow (FactorDesc f, m2condition m)
+static void EmitStopParametersAndFollow (pge_FactorDesc f, pge_m2condition m)
{
- SetDesc to;
+ pge_SetDesc to;
to = NULL;
/*
EmitFirstAsParameters -
*/
-static void EmitFirstAsParameters (FactorDesc f)
+static void EmitFirstAsParameters (pge_FactorDesc f)
{
- SetDesc to;
+ pge_SetDesc to;
to = NULL;
CalcFirstFactor (f, NULL, &to);
Generate error recovery code.
*/
-static void RecoverProduction (ProductionDesc p)
+static void RecoverProduction (pge_ProductionDesc p)
{
DynamicStrings_String s;
OnLineStart = FALSE;
EmitFileLineTag (p->line);
Indent = 3;
- RecoverStatement (p->statement, m2none);
+ RecoverStatement (p->statement, pge_m2none);
Indent = 0;
IndentString ((const char *) "END ", 4);
Output_WriteKey (GetDefinitionName (p));
FindStr - returns TRUE if, str, was seen inside the code hunk
*/
-static unsigned int FindStr (CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high)
+static unsigned int FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high)
{
unsigned int j;
unsigned int k;
- CodeHunk t;
+ pge_CodeHunk t;
char str[_str_high+1];
/* make a local copy of each unbounded array. */
WriteUpto -
*/
-static void WriteUpto (CodeHunk code, CodeHunk upto, unsigned int limit)
+static void WriteUpto (pge_CodeHunk code, pge_CodeHunk upto, unsigned int limit)
{
if (code != upto)
{
this production.
*/
-static void CheckForVar (CodeHunk code)
+static void CheckForVar (pge_CodeHunk code)
{
unsigned int i;
- CodeHunk t;
+ pge_CodeHunk t;
t = code;
if ((FindStr (&t, &i, (const char *) "VAR", 3)) && EmitCode)
VarFactor -
*/
-static void VarFactor (FactorDesc f)
+static void VarFactor (pge_FactorDesc f)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
break;
- case lit:
+ case pge_lit:
break;
- case sub:
- case opt:
- case mult:
+ case pge_sub:
+ case pge_opt:
+ case pge_mult:
VarExpression (f->expr);
break;
- case m2:
+ case pge_m2:
CheckForVar (f->code->code);
break;
VarTerm -
*/
-static void VarTerm (TermDesc t)
+static void VarTerm (pge_TermDesc t)
{
while (t != NULL)
{
VarExpression -
*/
-static void VarExpression (ExpressionDesc e)
+static void VarExpression (pge_ExpressionDesc e)
{
if (e != NULL)
{
VarStatement -
*/
-static void VarStatement (StatementDesc s)
+static void VarStatement (pge_StatementDesc s)
{
if (s != NULL)
{
VarProduction - writes out all variable declarations.
*/
-static void VarProduction (ProductionDesc p)
+static void VarProduction (pge_ProductionDesc p)
{
EmittedVar = FALSE;
if (p != NULL)
In - returns TRUE if token, s, is already in the set, to.
*/
-static unsigned int In (SetDesc to, NameKey_Name s)
+static unsigned int In (pge_SetDesc to, NameKey_Name s)
{
while (to != NULL)
{
switch (to->type)
{
- case idel:
+ case pge_idel:
if (s == to->ident->name)
{
return TRUE;
}
break;
- case tokel:
- case litel:
+ case pge_tokel:
+ case pge_litel:
if (s == to->string)
{
return TRUE;
s1 * s2 = {}
*/
-static unsigned int IntersectionIsNil (SetDesc s1, SetDesc s2)
+static unsigned int IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2)
{
while (s1 != NULL)
{
switch (s1->type)
{
- case idel:
+ case pge_idel:
if (In (s2, s1->ident->name))
{
return FALSE;
}
break;
- case tokel:
- case litel:
+ case pge_tokel:
+ case pge_litel:
if (In (s2, s1->string))
{
return FALSE;
AddSet - adds a first symbol to a production.
*/
-static void AddSet (SetDesc *to, NameKey_Name s)
+static void AddSet (pge_SetDesc *to, NameKey_Name s)
{
- SetDesc d;
+ pge_SetDesc d;
if (! (In ((*to), s)))
{
d = NewSetDesc ();
- d->type = tokel;
+ d->type = pge_tokel;
d->string = s;
d->next = (*to);
(*to) = d;
OrSet -
*/
-static void OrSet (SetDesc *to, SetDesc from)
+static void OrSet (pge_SetDesc *to, pge_SetDesc from)
{
while (from != NULL)
{
switch (from->type)
{
- case tokel:
+ case pge_tokel:
AddSet (to, from->string);
break;
- case litel:
+ case pge_litel:
AddSet (to, SymbolKey_GetSymKey (Aliases, from->string));
break;
- case idel:
+ case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
WasNoError = FALSE;
break;
default:
- Debug_Halt ((const char *) "unknown element in enumeration type", 35, 4114, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unknown element in enumeration type", 35, 4122, (const char *) "m2/gm2-auto/pge.mod", 19);
break;
}
from = from->next;
CalcFirstFactor -
*/
-static void CalcFirstFactor (FactorDesc f, ProductionDesc from, SetDesc *to)
+static void CalcFirstFactor (pge_FactorDesc f, pge_ProductionDesc from, pge_SetDesc *to)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
if (f->ident->definition == NULL)
{
WarnError1 ((const char *) "no rule found for an 'ident' called '%s'", 40, f->ident->name);
__builtin_unreachable ();
}
OrSet (to, f->ident->definition->first);
- if ((GetReachEnd (f->ident->definition->followinfo)) == false_)
+ if ((GetReachEnd (f->ident->definition->followinfo)) == pge_false)
{
return ;
}
break;
- case lit:
+ case pge_lit:
if ((SymbolKey_GetSymKey (Aliases, f->string)) == SymbolKey_NulKey)
{
WarnError1 ((const char *) "unknown token for '%s'", 22, f->string);
return ;
break;
- case sub:
- case opt:
- case mult:
+ case pge_sub:
+ case pge_opt:
+ case pge_mult:
CalcFirstExpression (f->expr, from, to);
break;
- case m2:
+ case pge_m2:
break;
CalcFirstTerm -
*/
-static void CalcFirstTerm (TermDesc t, ProductionDesc from, SetDesc *to)
+static void CalcFirstTerm (pge_TermDesc t, pge_ProductionDesc from, pge_SetDesc *to)
{
while (t != NULL)
{
CalcFirstExpression -
*/
-static void CalcFirstExpression (ExpressionDesc e, ProductionDesc from, SetDesc *to)
+static void CalcFirstExpression (pge_ExpressionDesc e, pge_ProductionDesc from, pge_SetDesc *to)
{
if (e != NULL)
{
CalcFirstStatement -
*/
-static void CalcFirstStatement (StatementDesc s, ProductionDesc from, SetDesc *to)
+static void CalcFirstStatement (pge_StatementDesc s, pge_ProductionDesc from, pge_SetDesc *to)
{
if (s != NULL)
{
CalcFirstProduction - calculates all of the first symbols for the grammer
*/
-static void CalcFirstProduction (ProductionDesc p, ProductionDesc from, SetDesc *to)
+static void CalcFirstProduction (pge_ProductionDesc p, pge_ProductionDesc from, pge_SetDesc *to)
{
- SetDesc s;
+ pge_SetDesc s;
if (p != NULL)
{
{
switch (s->type)
{
- case idel:
+ case pge_idel:
CalcFirstProduction (s->ident->definition, from, to);
break;
- case tokel:
- case litel:
+ case pge_tokel:
+ case pge_litel:
AddSet (to, s->string);
break;
}
}
-static void WorkOutFollowFactor (FactorDesc f, SetDesc *followset, SetDesc after)
+static void WorkOutFollowFactor (pge_FactorDesc f, pge_SetDesc *followset, pge_SetDesc after)
{
- TraverseResult foundepsilon;
- TraverseResult canreachend;
+ pge_TraverseResult foundepsilon;
+ pge_TraverseResult canreachend;
/*
WorkOutFollow -
*/
- foundepsilon = true_;
- canreachend = true_;
- while ((f != NULL) && (foundepsilon == true_))
+ foundepsilon = pge_true;
+ canreachend = pge_true;
+ while ((f != NULL) && (foundepsilon == pge_true))
{
switch (f->type)
{
- case id:
+ case pge_id:
if (f->ident->definition == NULL)
{
WarnError1 ((const char *) "no rule found for an 'ident' called '%s'", 40, f->ident->name);
OrSet (followset, f->ident->definition->first);
break;
- case lit:
+ case pge_lit:
AddSet (followset, SymbolKey_GetSymKey (Aliases, f->string));
break;
- case sub:
+ case pge_sub:
WorkOutFollowExpression (f->expr, followset, NULL);
break;
- case opt:
+ case pge_opt:
WorkOutFollowExpression (f->expr, followset, NULL);
break;
- case mult:
+ case pge_mult:
WorkOutFollowExpression (f->expr, followset, NULL);
break;
- case m2:
+ case pge_m2:
break;
default:
break;
}
- if ((GetEpsilon (f->followinfo)) == unknown)
+ if ((GetEpsilon (f->followinfo)) == pge_unknown)
{
PushBackInput_WarnError ((const char *) "internal error: epsilon unknown", 31);
PrettyCommentFactor (f, 3);
canreachend = GetReachEnd (f->followinfo); /* only goes from FALSE -> TRUE */
f = f->next; /* only goes from FALSE -> TRUE */
}
- if (canreachend == true_)
+ if (canreachend == pge_true)
{
OrSet (followset, after);
}
WorkOutFollowTerm -
*/
-static void WorkOutFollowTerm (TermDesc t, SetDesc *followset, SetDesc after)
+static void WorkOutFollowTerm (pge_TermDesc t, pge_SetDesc *followset, pge_SetDesc after)
{
if (t != NULL)
{
WorkOutFollowExpression -
*/
-static void WorkOutFollowExpression (ExpressionDesc e, SetDesc *followset, SetDesc after)
+static void WorkOutFollowExpression (pge_ExpressionDesc e, pge_SetDesc *followset, pge_SetDesc after)
{
if (e != NULL)
{
CollectFollow - collects the follow set from, f, into, to.
*/
-static void CollectFollow (SetDesc *to, FollowDesc f)
+static void CollectFollow (pge_SetDesc *to, pge_FollowDesc f)
{
OrSet (to, f->follow);
}
CalcFollowFactor -
*/
-static void CalcFollowFactor (FactorDesc f, SetDesc after)
+static void CalcFollowFactor (pge_FactorDesc f, pge_SetDesc after)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
WorkOutFollowFactor (f->next, &f->followinfo->follow, after);
break;
- case lit:
+ case pge_lit:
WorkOutFollowFactor (f->next, &f->followinfo->follow, after);
break;
- case opt:
- case sub:
+ case pge_opt:
+ case pge_sub:
CalcFirstFactor (f->next, NULL, &f->followinfo->follow);
- if ((f->next == NULL) || ((GetReachEnd (f->next->followinfo)) == true_))
+ if ((f->next == NULL) || ((GetReachEnd (f->next->followinfo)) == pge_true))
{
OrSet (&f->followinfo->follow, after);
CalcFollowExpression (f->expr, f->followinfo->follow);
}
break;
- case mult:
+ case pge_mult:
CalcFirstFactor (f, NULL, &f->followinfo->follow);
/* include first as we may repeat this sentance */
if (Debugging)
EmitSet (f->followinfo->follow, static_cast<unsigned int> (0), static_cast<unsigned int> (0));
StrIO_WriteLn ();
}
- if ((f->next == NULL) || ((GetReachEnd (f->next->followinfo)) == true_))
+ if ((f->next == NULL) || ((GetReachEnd (f->next->followinfo)) == pge_true))
{
OrSet (&f->followinfo->follow, after);
CalcFollowExpression (f->expr, f->followinfo->follow);
CalcFollowTerm -
*/
-static void CalcFollowTerm (TermDesc t, SetDesc after)
+static void CalcFollowTerm (pge_TermDesc t, pge_SetDesc after)
{
if (t != NULL)
{
CalcFollowExpression -
*/
-static void CalcFollowExpression (ExpressionDesc e, SetDesc after)
+static void CalcFollowExpression (pge_ExpressionDesc e, pge_SetDesc after)
{
if (e != NULL)
{
CalcFollowStatement - given a bnf statement generate the follow set.
*/
-static void CalcFollowStatement (StatementDesc s)
+static void CalcFollowStatement (pge_StatementDesc s)
{
if (s != NULL)
{
CalcFollowProduction -
*/
-static void CalcFollowProduction (ProductionDesc p)
+static void CalcFollowProduction (pge_ProductionDesc p)
{
if (p != NULL)
{
CalcEpsilonFactor -
*/
-static void CalcEpsilonFactor (FactorDesc f)
+static void CalcEpsilonFactor (pge_FactorDesc f)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
- AssignEpsilon ((GetEpsilon (f->ident->definition->followinfo)) != unknown, f->followinfo, GetEpsilon (f->ident->definition->followinfo));
+ case pge_id:
+ AssignEpsilon ((GetEpsilon (f->ident->definition->followinfo)) != pge_unknown, f->followinfo, GetEpsilon (f->ident->definition->followinfo));
break;
- case lit:
- AssignEpsilon (TRUE, f->followinfo, false_);
+ case pge_lit:
+ AssignEpsilon (TRUE, f->followinfo, pge_false);
break;
- case sub:
+ case pge_sub:
CalcEpsilonExpression (f->expr);
- AssignEpsilon ((GetEpsilon (f->expr->followinfo)) != unknown, f->followinfo, GetEpsilon (f->expr->followinfo));
+ AssignEpsilon ((GetEpsilon (f->expr->followinfo)) != pge_unknown, f->followinfo, GetEpsilon (f->expr->followinfo));
break;
- case m2:
- AssignEpsilon (TRUE, f->followinfo, true_);
+ case pge_m2:
+ AssignEpsilon (TRUE, f->followinfo, pge_true);
break;
- case opt:
- case mult:
+ case pge_opt:
+ case pge_mult:
CalcEpsilonExpression (f->expr);
- AssignEpsilon (TRUE, f->followinfo, true_);
+ AssignEpsilon (TRUE, f->followinfo, pge_true);
break;
CalcEpsilonTerm -
*/
-static void CalcEpsilonTerm (TermDesc t)
+static void CalcEpsilonTerm (pge_TermDesc t)
{
if (t != NULL)
{
{
switch (GetReachEnd (t->factor->followinfo))
{
- case true_:
- AssignEpsilon (TRUE, t->followinfo, true_);
+ case pge_true:
+ AssignEpsilon (TRUE, t->followinfo, pge_true);
break;
- case false_:
- AssignEpsilon (TRUE, t->followinfo, false_);
+ case pge_false:
+ AssignEpsilon (TRUE, t->followinfo, pge_false);
break;
- case unknown:
+ case pge_unknown:
break;
CalcEpsilonExpression -
*/
-static void CalcEpsilonExpression (ExpressionDesc e)
+static void CalcEpsilonExpression (pge_ExpressionDesc e)
{
- TermDesc t;
- TraverseResult result;
+ pge_TermDesc t;
+ pge_TraverseResult result;
if (e != NULL)
{
CalcEpsilonTerm (e->term);
- if ((GetEpsilon (e->followinfo)) == unknown)
+ if ((GetEpsilon (e->followinfo)) == pge_unknown)
{
- result = unknown;
+ result = pge_unknown;
t = e->term;
while (t != NULL)
{
- if ((GetEpsilon (t->followinfo)) != unknown)
+ if ((GetEpsilon (t->followinfo)) != pge_unknown)
{
stop ();
}
switch (GetEpsilon (t->followinfo))
{
- case unknown:
+ case pge_unknown:
break;
- case true_:
- result = true_;
+ case pge_true:
+ result = pge_true;
break;
- case false_:
- if (result != true_)
+ case pge_false:
+ if (result != pge_true)
{
- result = false_;
+ result = pge_false;
}
break;
}
t = t->next;
}
- AssignEpsilon (result != unknown, e->followinfo, result);
+ AssignEpsilon (result != pge_unknown, e->followinfo, result);
}
}
}
CalcEpsilonStatement - given a bnf statement generate the follow set.
*/
-static void CalcEpsilonStatement (StatementDesc s)
+static void CalcEpsilonStatement (pge_StatementDesc s)
{
if (s != NULL)
{
if (s->expr != NULL)
{
- AssignEpsilon ((GetEpsilon (s->expr->followinfo)) != unknown, s->followinfo, GetEpsilon (s->expr->followinfo));
+ AssignEpsilon ((GetEpsilon (s->expr->followinfo)) != pge_unknown, s->followinfo, GetEpsilon (s->expr->followinfo));
}
CalcEpsilonExpression (s->expr);
}
CalcEpsilonProduction -
*/
-static void CalcEpsilonProduction (ProductionDesc p)
+static void CalcEpsilonProduction (pge_ProductionDesc p)
{
if (p != NULL)
{
StrIO_WriteString ((const char *) " calculating epsilon", 21);
StrIO_WriteLn ();
}
- AssignEpsilon ((GetEpsilon (p->statement->followinfo)) != unknown, p->followinfo, GetEpsilon (p->statement->followinfo));
+ AssignEpsilon ((GetEpsilon (p->statement->followinfo)) != pge_unknown, p->followinfo, GetEpsilon (p->statement->followinfo));
CalcEpsilonStatement (p->statement);
}
}
CalcReachEndFactor -
*/
-static TraverseResult CalcReachEndFactor (FactorDesc f)
+static pge_TraverseResult CalcReachEndFactor (pge_FactorDesc f)
{
- TraverseResult canreachend;
- TraverseResult result;
+ pge_TraverseResult canreachend;
+ pge_TraverseResult result;
if (f == NULL)
{
- return true_; /* we have reached the end of this factor list */
+ return pge_true; /* we have reached the end of this factor list */
}
else
{
result = CalcReachEndFactor (f->next);
switch (f->type)
{
- case id:
+ case pge_id:
if (f->ident->definition == NULL)
{
WarnError1 ((const char *) "definition for %s is absent (assuming epsilon is false for this production)", 75, f->ident->name);
- result = false_;
+ result = pge_false;
}
- else if (result != false_)
+ else if (result != pge_false)
{
/* avoid dangling else. */
switch (GetReachEnd (f->ident->definition->followinfo))
{
- case false_:
- result = false_;
+ case pge_false:
+ result = pge_false;
break;
- case true_:
+ case pge_true:
break;
- case unknown:
- result = unknown;
+ case pge_unknown:
+ result = pge_unknown;
break;
}
break;
- case lit:
- result = false_;
+ case pge_lit:
+ result = pge_false;
break;
- case sub:
+ case pge_sub:
CalcReachEndExpression (f->expr);
- if ((f->expr != NULL) && (result == true_))
+ if ((f->expr != NULL) && (result == pge_true))
{
result = GetReachEnd (f->expr->followinfo);
}
break;
- case mult:
- case opt:
+ case pge_mult:
+ case pge_opt:
if (f->expr != NULL)
{
/* not interested in the result as expression is optional */
}
break;
- case m2:
+ case pge_m2:
break;
default:
break;
}
- AssignReachEnd (result != unknown, f->followinfo, result);
+ AssignReachEnd (result != pge_unknown, f->followinfo, result);
return result;
}
/* static analysis guarentees a RETURN statement will be used before here. */
CalcReachEndTerm -
*/
-static TraverseResult CalcReachEndTerm (TermDesc t)
+static pge_TraverseResult CalcReachEndTerm (pge_TermDesc t)
{
- TraverseResult canreachend;
- TraverseResult result;
+ pge_TraverseResult canreachend;
+ pge_TraverseResult result;
if (t != NULL)
{
- canreachend = false_;
+ canreachend = pge_false;
while (t != NULL)
{
result = CalcReachEndFactor (t->factor);
- AssignReachEnd (result != unknown, t->followinfo, result);
+ AssignReachEnd (result != pge_unknown, t->followinfo, result);
switch (result)
{
- case true_:
- canreachend = true_;
+ case pge_true:
+ canreachend = pge_true;
break;
- case false_:
+ case pge_false:
break;
- case unknown:
- if (canreachend == false_)
+ case pge_unknown:
+ if (canreachend == pge_false)
{
- canreachend = unknown;
+ canreachend = pge_unknown;
}
break;
CalcReachEndExpression -
*/
-static void CalcReachEndExpression (ExpressionDesc e)
+static void CalcReachEndExpression (pge_ExpressionDesc e)
{
- TraverseResult result;
+ pge_TraverseResult result;
if (e == NULL)
{} /* empty. */
{
/* no expression, thus reached the end of this sentance */
result = CalcReachEndTerm (e->term);
- AssignReachEnd (result != unknown, e->followinfo, result);
+ AssignReachEnd (result != pge_unknown, e->followinfo, result);
}
}
CalcReachEndStatement -
*/
-static void CalcReachEndStatement (StatementDesc s)
+static void CalcReachEndStatement (pge_StatementDesc s)
{
if (s != NULL)
{
if (s->expr != NULL)
{
CalcReachEndExpression (s->expr);
- AssignReachEnd ((GetReachEnd (s->expr->followinfo)) != unknown, s->followinfo, GetReachEnd (s->expr->followinfo));
+ AssignReachEnd ((GetReachEnd (s->expr->followinfo)) != pge_unknown, s->followinfo, GetReachEnd (s->expr->followinfo));
}
}
}
CalcReachEndProduction -
*/
-static void CalcReachEndProduction (ProductionDesc p)
+static void CalcReachEndProduction (pge_ProductionDesc p)
{
if (p != NULL)
{
CalcReachEndStatement (p->statement);
- if ((GetReachEnd (p->followinfo)) != unknown)
+ if ((GetReachEnd (p->followinfo)) != pge_unknown)
{
if (Debugging)
{
StrIO_WriteString ((const char *) "already calculated reach end for: ", 34);
NameKey_WriteKey (p->statement->ident->name);
StrIO_WriteString ((const char *) " its value is ", 14);
- if ((GetReachEnd (p->followinfo)) == true_)
+ if ((GetReachEnd (p->followinfo)) == pge_true)
{
StrIO_WriteString ((const char *) "reachable", 9);
}
StrIO_WriteLn ();
}
}
- AssignReachEnd ((GetReachEnd (p->statement->followinfo)) != unknown, p->followinfo, GetReachEnd (p->statement->followinfo));
+ AssignReachEnd ((GetReachEnd (p->statement->followinfo)) != pge_unknown, p->followinfo, GetReachEnd (p->statement->followinfo));
}
}
EmptyFactor -
*/
-static unsigned int EmptyFactor (FactorDesc f)
+static unsigned int EmptyFactor (pge_FactorDesc f)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
if (! (EmptyProduction (f->ident->definition)))
{
return FALSE;
}
break;
- case lit:
+ case pge_lit:
return FALSE;
break;
- case sub:
+ case pge_sub:
if (! (EmptyExpression (f->expr)))
{
return FALSE;
}
break;
- case opt:
- case mult:
+ case pge_opt:
+ case pge_mult:
return TRUE;
break;
- case m2:
+ case pge_m2:
break;
EmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int EmptyTerm (TermDesc t)
+static unsigned int EmptyTerm (pge_TermDesc t)
{
while (t != NULL)
{
EmptyExpression -
*/
-static unsigned int EmptyExpression (ExpressionDesc e)
+static unsigned int EmptyExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
EmptyStatement - returns TRUE if statement, s, is empty.
*/
-static unsigned int EmptyStatement (StatementDesc s)
+static unsigned int EmptyStatement (pge_StatementDesc s)
{
if (s == NULL)
{
EmptyProduction - returns if production, p, maybe empty.
*/
-static unsigned int EmptyProduction (ProductionDesc p)
+static unsigned int EmptyProduction (pge_ProductionDesc p)
{
if (p == NULL)
{
{
EmitFDLNotice ();
}
- ForeachRuleDo ((DoProcedure) {(DoProcedure_t) EmitRule});
+ ForeachRuleDo ((pge_DoProcedure) {(pge_DoProcedure_t) EmitRule});
}
DisposeSetDesc - dispose of the set list, s.
*/
-static void DisposeSetDesc (SetDesc *s)
+static void DisposeSetDesc (pge_SetDesc *s)
{
- SetDesc h;
- SetDesc n;
+ pge_SetDesc h;
+ pge_SetDesc n;
if ((*s) != NULL)
{
h = (*s);
n = (*s)->next;
do {
- Storage_DEALLOCATE ((void **) &h, sizeof (_T7));
+ Storage_DEALLOCATE ((void **) &h, sizeof (pge__T7));
h = n;
if (n != NULL)
{
OptionalFactor -
*/
-static unsigned int OptionalFactor (FactorDesc f)
+static unsigned int OptionalFactor (pge_FactorDesc f)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
break;
- case lit:
+ case pge_lit:
break;
- case sub:
- case opt:
- case mult:
+ case pge_sub:
+ case pge_opt:
+ case pge_mult:
if (OptionalExpression (f->expr))
{
return TRUE;
}
break;
- case m2:
+ case pge_m2:
break;
OptionalTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int OptionalTerm (TermDesc t)
+static unsigned int OptionalTerm (pge_TermDesc t)
{
- TermDesc u;
- TermDesc v;
- SetDesc tov;
- SetDesc tou;
+ pge_TermDesc u;
+ pge_TermDesc v;
+ pge_SetDesc tov;
+ pge_SetDesc tou;
u = t;
while (u != NULL)
OptionalExpression -
*/
-static unsigned int OptionalExpression (ExpressionDesc e)
+static unsigned int OptionalExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
OptionalStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int OptionalStatement (StatementDesc s)
+static unsigned int OptionalStatement (pge_StatementDesc s)
{
if (s == NULL)
{
OptionalProduction -
*/
-static unsigned int OptionalProduction (ProductionDesc p)
+static unsigned int OptionalProduction (pge_ProductionDesc p)
{
if (p == NULL)
{
CheckFirstFollow -
*/
-static unsigned int CheckFirstFollow (FactorDesc f, FactorDesc after)
+static unsigned int CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after)
{
- SetDesc first;
- SetDesc follow;
+ pge_SetDesc first;
+ pge_SetDesc follow;
first = NULL;
CalcFirstFactor (f, NULL, &first);
ConstrainedEmptyFactor -
*/
-static unsigned int ConstrainedEmptyFactor (FactorDesc f)
+static unsigned int ConstrainedEmptyFactor (pge_FactorDesc f)
{
while (f != NULL)
{
switch (f->type)
{
- case id:
+ case pge_id:
break;
- case lit:
+ case pge_lit:
break;
- case sub:
- case opt:
- case mult:
+ case pge_sub:
+ case pge_opt:
+ case pge_mult:
if (ConstrainedEmptyExpression (f->expr))
{
return TRUE;
}
break;
- case m2:
+ case pge_m2:
break;
default:
break;
}
- if (((f->type != m2) && (EmptyFactor (f))) && (CheckFirstFollow (f, f->next)))
+ if (((f->type != pge_m2) && (EmptyFactor (f))) && (CheckFirstFollow (f, f->next)))
{
return TRUE;
}
ConstrainedEmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int ConstrainedEmptyTerm (TermDesc t)
+static unsigned int ConstrainedEmptyTerm (pge_TermDesc t)
{
- SetDesc first;
- SetDesc follow;
+ pge_SetDesc first;
+ pge_SetDesc follow;
while (t != NULL)
{
{
return TRUE;
}
- else if (((t->factor->type != m2) && (EmptyFactor (t->factor))) && (CheckFirstFollow (t->factor, t->factor->next)))
+ else if (((t->factor->type != pge_m2) && (EmptyFactor (t->factor))) && (CheckFirstFollow (t->factor, t->factor->next)))
{
/* avoid dangling else. */
return TRUE;
ConstrainedEmptyExpression -
*/
-static unsigned int ConstrainedEmptyExpression (ExpressionDesc e)
+static unsigned int ConstrainedEmptyExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
ConstrainedEmptyStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int ConstrainedEmptyStatement (StatementDesc s)
+static unsigned int ConstrainedEmptyStatement (pge_StatementDesc s)
{
if (s == NULL)
{
ConstrainedEmptyProduction - returns TRUE if a problem exists with, p.
*/
-static unsigned int ConstrainedEmptyProduction (ProductionDesc p)
+static unsigned int ConstrainedEmptyProduction (pge_ProductionDesc p)
{
if (p == NULL)
{
TestForLALR1 -
*/
-static void TestForLALR1 (ProductionDesc p)
+static void TestForLALR1 (pge_ProductionDesc p)
{
if (OptionalProduction (p))
{
DoEpsilon - runs the epsilon interrelated rules
*/
-static void DoEpsilon (ProductionDesc p)
+static void DoEpsilon (pge_ProductionDesc p)
{
CalcEpsilonProduction (p);
CalcReachEndProduction (p);
CheckComplete - checks that production, p, is complete.
*/
-static void CheckComplete (ProductionDesc p)
+static void CheckComplete (pge_ProductionDesc p)
{
- if ((GetReachEnd (p->followinfo)) == unknown)
+ if ((GetReachEnd (p->followinfo)) == pge_unknown)
{
PrettyCommentProduction (p);
WarnError1 ((const char *) "cannot determine epsilon, probably a left recursive rule in %s and associated rules (hint rewrite using ebnf and eliminate left recursion)", 138, p->statement->ident->name);
static void PostProcessRules (void)
{
- ForeachRuleDo ((DoProcedure) {(DoProcedure_t) BackPatchIdentToDefinitions});
+ ForeachRuleDo ((pge_DoProcedure) {(pge_DoProcedure_t) BackPatchIdentToDefinitions});
if (! WasNoError)
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- WhileNotCompleteDo ((DoProcedure) {(DoProcedure_t) DoEpsilon});
+ WhileNotCompleteDo ((pge_DoProcedure) {(pge_DoProcedure_t) DoEpsilon});
if (! WasNoError)
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- ForeachRuleDo ((DoProcedure) {(DoProcedure_t) CheckComplete});
+ ForeachRuleDo ((pge_DoProcedure) {(pge_DoProcedure_t) CheckComplete});
if (! WasNoError)
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- WhileNotCompleteDo ((DoProcedure) {(DoProcedure_t) CalculateFirstAndFollow});
+ WhileNotCompleteDo ((pge_DoProcedure) {(pge_DoProcedure_t) CalculateFirstAndFollow});
if (! WasNoError)
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
- ForeachRuleDo ((DoProcedure) {(DoProcedure_t) TestForLALR1});
+ ForeachRuleDo ((pge_DoProcedure) {(pge_DoProcedure_t) TestForLALR1});
if (! WasNoError)
{
- ForeachRuleDo ((DoProcedure) {(DoProcedure_t) PrettyCommentProduction});
+ ForeachRuleDo ((pge_DoProcedure) {(pge_DoProcedure_t) PrettyCommentProduction});
}
}
static void DisplayHelp (void)
{
- StrIO_WriteString ((const char *) "Usage: pge [-l] [-c] [-d] [-e] [-k] [-t] [-k] [-p] [-t] [-f] [-o outputfile] filename", 85);
+ StrIO_WriteString ((const char *) "Usage: pge [-l] [-c] [-d] [-e] [-k] [-t] [-k] [-p] [-x] [-f] [-o outputfile] filename", 85);
StrIO_WriteLn ();
StrIO_WriteString ((const char *) " -l suppress file and line source information", 59);
StrIO_WriteLn ();
StrIO_WriteLn ();
StrIO_WriteString ((const char *) " -t generate texinfo formating for pretty printing (-p)", 69);
StrIO_WriteLn ();
+ StrIO_WriteString ((const char *) " -x generate sphinx formating for pretty printing (-p)", 68);
+ StrIO_WriteLn ();
StrIO_WriteString ((const char *) " -f generate GNU Free Documentation header before pretty printing in texinfo", 90);
StrIO_WriteLn ();
StrIO_WriteString ((const char *) " -o write output to filename", 42);
/* avoid dangling else. */
Texinfo = TRUE;
}
+ else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-x", 2))
+ {
+ /* avoid dangling else. */
+ Sphinx = TRUE;
+ }
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-f", 2))
{
/* avoid dangling else. */
{
WasNoError = TRUE;
Texinfo = FALSE;
+ Sphinx = FALSE;
FreeDocLicense = FALSE;
EmitCode = TRUE;
LargestValue = 0;
SymIsProc = NameKey_MakeKey ((const char *) "SymIs", 5);
OnLineStart = TRUE;
ParseArgs ();
- Main (static_cast<SetOfStop> ((unsigned int) ((1 << (bnflex_eoftok))))); /* this line will be manipulated by sed in buildpg */
+ Main (static_cast<pge_SetOfStop> ((unsigned int) ((1 << (bnflex_eoftok))))); /* this line will be manipulated by sed in buildpg */
if (WasNoError) /* this line will be manipulated by sed in buildpg */
{
PostProcessRules ();
Output_Close ();
}
-extern "C" void _M2_pge_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_pge_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
Init ();
}
-extern "C" void _M2_pge_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_pge_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
-extern "C" void _M2_RTExceptions_init(int argc, char *argv[]);
-extern "C" void _M2_RTExceptions_finish(int argc, char *argv[]);
-extern "C" void _M2_M2EXCEPTION_init(int argc, char *argv[]);
-extern "C" void _M2_M2EXCEPTION_finish(int argc, char *argv[]);
-extern "C" void _M2_M2RTS_init(int argc, char *argv[]);
-extern "C" void _M2_M2RTS_finish(int argc, char *argv[]);
-extern "C" void _M2_SysExceptions_init(int argc, char *argv[]);
-extern "C" void _M2_SysExceptions_finish(int argc, char *argv[]);
-extern "C" void _M2_StrLib_init(int argc, char *argv[]);
-extern "C" void _M2_StrLib_finish(int argc, char *argv[]);
-extern "C" void _M2_errno_init(int argc, char *argv[]);
-extern "C" void _M2_errno_finish(int argc, char *argv[]);
-extern "C" void _M2_termios_init(int argc, char *argv[]);
-extern "C" void _M2_termios_finish(int argc, char *argv[]);
-extern "C" void _M2_IO_init(int argc, char *argv[]);
-extern "C" void _M2_IO_finish(int argc, char *argv[]);
-extern "C" void _M2_StdIO_init(int argc, char *argv[]);
-extern "C" void _M2_StdIO_finish(int argc, char *argv[]);
-extern "C" void _M2_Debug_init(int argc, char *argv[]);
-extern "C" void _M2_Debug_finish(int argc, char *argv[]);
-extern "C" void _M2_SysStorage_init(int argc, char *argv[]);
-extern "C" void _M2_SysStorage_finish(int argc, char *argv[]);
-extern "C" void _M2_Storage_init(int argc, char *argv[]);
-extern "C" void _M2_Storage_finish(int argc, char *argv[]);
-extern "C" void _M2_StrIO_init(int argc, char *argv[]);
-extern "C" void _M2_StrIO_finish(int argc, char *argv[]);
-extern "C" void _M2_DynamicStrings_init(int argc, char *argv[]);
-extern "C" void _M2_DynamicStrings_finish(int argc, char *argv[]);
-extern "C" void _M2_Assertion_init(int argc, char *argv[]);
-extern "C" void _M2_Assertion_finish(int argc, char *argv[]);
-extern "C" void _M2_Indexing_init(int argc, char *argv[]);
-extern "C" void _M2_Indexing_finish(int argc, char *argv[]);
-extern "C" void _M2_NameKey_init(int argc, char *argv[]);
-extern "C" void _M2_NameKey_finish(int argc, char *argv[]);
-extern "C" void _M2_NumberIO_init(int argc, char *argv[]);
-extern "C" void _M2_NumberIO_finish(int argc, char *argv[]);
-extern "C" void _M2_PushBackInput_init(int argc, char *argv[]);
-extern "C" void _M2_PushBackInput_finish(int argc, char *argv[]);
-extern "C" void _M2_SymbolKey_init(int argc, char *argv[]);
-extern "C" void _M2_SymbolKey_finish(int argc, char *argv[]);
-extern "C" void _M2_UnixArgs_init(int argc, char *argv[]);
-extern "C" void _M2_UnixArgs_finish(int argc, char *argv[]);
-extern "C" void _M2_FIO_init(int argc, char *argv[]);
-extern "C" void _M2_FIO_finish(int argc, char *argv[]);
-extern "C" void _M2_SFIO_init(int argc, char *argv[]);
-extern "C" void _M2_SFIO_finish(int argc, char *argv[]);
-extern "C" void _M2_StrCase_init(int argc, char *argv[]);
-extern "C" void _M2_StrCase_finish(int argc, char *argv[]);
-extern "C" void _M2_bnflex_init(int argc, char *argv[]);
-extern "C" void _M2_bnflex_finish(int argc, char *argv[]);
-extern "C" void _M2_Lists_init(int argc, char *argv[]);
-extern "C" void _M2_Lists_finish(int argc, char *argv[]);
-extern "C" void _M2_Args_init(int argc, char *argv[]);
-extern "C" void _M2_Args_finish(int argc, char *argv[]);
-extern "C" void _M2_Output_init(int argc, char *argv[]);
-extern "C" void _M2_Output_finish(int argc, char *argv[]);
-extern "C" void _M2_pge_init(int argc, char *argv[]);
-extern "C" void _M2_pge_finish(int argc, char *argv[]);
+extern "C" void _M2_RTExceptions_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_RTExceptions_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_M2EXCEPTION_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_M2EXCEPTION_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_M2RTS_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_M2RTS_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SysExceptions_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SysExceptions_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StrLib_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StrLib_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_errno_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_errno_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_termios_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_termios_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_IO_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_IO_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StdIO_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StdIO_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Debug_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Debug_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SysStorage_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SysStorage_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Storage_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Storage_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StrIO_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StrIO_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_DynamicStrings_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_DynamicStrings_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Assertion_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Assertion_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Indexing_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Indexing_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_NameKey_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_NameKey_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_NumberIO_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_NumberIO_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_PushBackInput_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_PushBackInput_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SymbolKey_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SymbolKey_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_UnixArgs_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_UnixArgs_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_FIO_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_FIO_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SFIO_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_SFIO_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StrCase_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_StrCase_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_bnflex_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_bnflex_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Lists_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Lists_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Args_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Args_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Output_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_Output_finish (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_pge_init (int argc, char *argv[], char *envp[]);
+extern "C" void _M2_pge_finish (int argc, char *argv[], char *envp[]);
extern "C" void _exit(int);
-int main(int argc, char *argv[])
+int main(int argc, char *argv[], char *envp[])
{
- _M2_RTExceptions_init(argc, argv);
- _M2_M2EXCEPTION_init(argc, argv);
- _M2_M2RTS_init(argc, argv);
- _M2_SysExceptions_init(argc, argv);
- _M2_StrLib_init(argc, argv);
- _M2_errno_init(argc, argv);
- _M2_termios_init(argc, argv);
- _M2_IO_init(argc, argv);
- _M2_StdIO_init(argc, argv);
- _M2_Debug_init(argc, argv);
- _M2_SysStorage_init(argc, argv);
- _M2_Storage_init(argc, argv);
- _M2_StrIO_init(argc, argv);
- _M2_DynamicStrings_init(argc, argv);
- _M2_Assertion_init(argc, argv);
- _M2_Indexing_init(argc, argv);
- _M2_NameKey_init(argc, argv);
- _M2_NumberIO_init(argc, argv);
- _M2_PushBackInput_init(argc, argv);
- _M2_SymbolKey_init(argc, argv);
- _M2_UnixArgs_init(argc, argv);
- _M2_FIO_init(argc, argv);
- _M2_SFIO_init(argc, argv);
- _M2_StrCase_init(argc, argv);
- _M2_bnflex_init(argc, argv);
- _M2_Lists_init(argc, argv);
- _M2_Args_init(argc, argv);
- _M2_Output_init(argc, argv);
- _M2_pge_init(argc, argv);
- _M2_pge_finish(argc, argv);
- _M2_Output_finish(argc, argv);
- _M2_Args_finish(argc, argv);
- _M2_Lists_finish(argc, argv);
- _M2_bnflex_finish(argc, argv);
- _M2_StrCase_finish(argc, argv);
- _M2_SFIO_finish(argc, argv);
- _M2_FIO_finish(argc, argv);
- _M2_UnixArgs_finish(argc, argv);
- _M2_SymbolKey_finish(argc, argv);
- _M2_PushBackInput_finish(argc, argv);
- _M2_NumberIO_finish(argc, argv);
- _M2_NameKey_finish(argc, argv);
- _M2_Indexing_finish(argc, argv);
- _M2_Assertion_finish(argc, argv);
- _M2_DynamicStrings_finish(argc, argv);
- _M2_StrIO_finish(argc, argv);
- _M2_Storage_finish(argc, argv);
- _M2_SysStorage_finish(argc, argv);
- _M2_Debug_finish(argc, argv);
- _M2_StdIO_finish(argc, argv);
- _M2_IO_finish(argc, argv);
- _M2_termios_finish(argc, argv);
- _M2_errno_finish(argc, argv);
- _M2_StrLib_finish(argc, argv);
- _M2_SysExceptions_finish(argc, argv);
- _M2_M2RTS_finish(argc, argv);
- _M2_M2EXCEPTION_finish(argc, argv);
- _M2_RTExceptions_finish(argc, argv);
+ _M2_RTExceptions_init (argc, argv, envp);
+ _M2_M2EXCEPTION_init (argc, argv, envp);
+ _M2_M2RTS_init (argc, argv, envp);
+ _M2_SysExceptions_init (argc, argv, envp);
+ _M2_StrLib_init (argc, argv, envp);
+ _M2_errno_init (argc, argv, envp);
+ _M2_termios_init (argc, argv, envp);
+ _M2_IO_init (argc, argv, envp);
+ _M2_StdIO_init (argc, argv, envp);
+ _M2_Debug_init (argc, argv, envp);
+ _M2_SysStorage_init (argc, argv, envp);
+ _M2_Storage_init (argc, argv, envp);
+ _M2_StrIO_init (argc, argv, envp);
+ _M2_DynamicStrings_init (argc, argv, envp);
+ _M2_Assertion_init (argc, argv, envp);
+ _M2_Indexing_init (argc, argv, envp);
+ _M2_NameKey_init (argc, argv, envp);
+ _M2_NumberIO_init (argc, argv, envp);
+ _M2_PushBackInput_init (argc, argv, envp);
+ _M2_SymbolKey_init (argc, argv, envp);
+ _M2_UnixArgs_init (argc, argv, envp);
+ _M2_FIO_init (argc, argv, envp);
+ _M2_SFIO_init (argc, argv, envp);
+ _M2_StrCase_init (argc, argv, envp);
+ _M2_bnflex_init (argc, argv, envp);
+ _M2_Lists_init (argc, argv, envp);
+ _M2_Args_init (argc, argv, envp);
+ _M2_Output_init (argc, argv, envp);
+ _M2_pge_init (argc, argv, envp);
+ _M2_pge_finish (argc, argv, envp);
+ _M2_Output_finish (argc, argv, envp);
+ _M2_Args_finish (argc, argv, envp);
+ _M2_Lists_finish (argc, argv, envp);
+ _M2_bnflex_finish (argc, argv, envp);
+ _M2_StrCase_finish (argc, argv, envp);
+ _M2_SFIO_finish (argc, argv, envp);
+ _M2_FIO_finish (argc, argv, envp);
+ _M2_UnixArgs_finish (argc, argv, envp);
+ _M2_SymbolKey_finish (argc, argv, envp);
+ _M2_PushBackInput_finish (argc, argv, envp);
+ _M2_NumberIO_finish (argc, argv, envp);
+ _M2_NameKey_finish (argc, argv, envp);
+ _M2_Indexing_finish (argc, argv, envp);
+ _M2_Assertion_finish (argc, argv, envp);
+ _M2_DynamicStrings_finish (argc, argv, envp);
+ _M2_StrIO_finish (argc, argv, envp);
+ _M2_Storage_finish (argc, argv, envp);
+ _M2_SysStorage_finish (argc, argv, envp);
+ _M2_Debug_finish (argc, argv, envp);
+ _M2_StdIO_finish (argc, argv, envp);
+ _M2_IO_finish (argc, argv, envp);
+ _M2_termios_finish (argc, argv, envp);
+ _M2_errno_finish (argc, argv, envp);
+ _M2_StrLib_finish (argc, argv, envp);
+ _M2_SysExceptions_finish (argc, argv, envp);
+ _M2_M2RTS_finish (argc, argv, envp);
+ _M2_M2EXCEPTION_finish (argc, argv, envp);
+ _M2_RTExceptions_finish (argc, argv, envp);
return(0);
}
library_classifications = [Base_Libs, PIM_Log, PIM_Cor, ISO_Libs]
+# state_states
+state_none, state_var, state_type, state_const = range(4)
+# block states
+block_none, block_code, block_text, block_index = range(4)
+
+
+class state:
+ def __init__(self):
+ self._state_state = state_none
+ self._block = block_none
+ def get_state (self):
+ return self._state_state
+ def set_state (self, value):
+ self._state_state = value
+ def is_const(self):
+ return self._state_state == state_const
+ def is_type(self):
+ return self._state_state == state_type
+ def is_var(self):
+ return self._state_state == state_var
+ def get_block(self):
+ return self._block
+ def _change_block(self, new_block):
+ if self._block != new_block:
+ self._block = new_block
+ self._emit_block_desc()
+ def _emit_block_desc(self):
+ if self._block == block_code:
+ output.write('.. code-block:: modula2\n')
+ elif self._block == block_index:
+ output.write('.. index::\n')
+ def to_code(self):
+ self._change_block(block_code)
+ def to_index(self):
+ self._change_block(block_index)
+
def init_state():
- global in_var, in_type, in_const
- in_var, in_type, in_const = False, False, False
+ global state_obj
+ state_obj = state()
def emit_node(name, nxt, previous, up):
output.write(line.rstrip() + '\n')
-def emit_index(entry, tag, previous):
+def emit_index(entry, tag):
+ global state_obj
if args.texinfo:
if tag == '':
output.write('@findex ' + entry.rstrip() + '\n')
output.write('@findex ' + entry.rstrip() + ' ' + tag + '\n')
elif args.sphinx:
if tag == '':
- output.write('.. index::')
+ state_obj.to_index()
output.write(' ' * 3 + entry.rstrip() + '\n')
else:
- output.write('.. index::')
+ state_obj.to_index()
output.write(' ' * 3 + 'pair: ' + entry.rstrip() + '; ' + tag + '\n')
- if previous != '':
- output.write(previous + '\n')
-def check_index(line, current):
+def check_index(line):
# check_index - create an index entry for a PROCEDURE, TYPE, CONST or VAR.
- global in_var, in_type, in_const
+ global state_obj
words = line.split()
procedure = ''
if (len(words) > 1) and (words[0] == 'PROCEDURE'):
- in_const = False
- in_type = False
- in_var = False
+ state_obj.set_state(state_none)
if (words[1] == '__BUILTIN__') and (len(words) > 2):
procedure = words[2]
else:
procedure = words[1]
if (len(line) > 1) and (line[0:2] == '(*'):
- in_const = False
- in_type = False
- in_var = False
+ state_obj.set_state(state_none)
elif line == 'VAR':
- in_const = False
- in_var = True
- in_type = False
+ state_obj.set_state(state_var)
return
elif line == 'TYPE':
- in_const = False
- in_type = True
- in_var = False
+ state_obj.set_state(state_type)
return
elif line == 'CONST':
- in_const = True
- in_type = False
- in_var = False
- if in_var:
+ state_obj.set_state(state_const)
+ if state_obj.is_var():
words = line.split(',')
for word in words:
word = word.lstrip()
if word != '':
if word.find(':') == -1:
- emit_index(word, '(var)', current)
+ emit_index(word, '(var)')
elif len(word) > 0:
var = word.split(':')
if len(var) > 0:
- emit_index(var[0], '(var)', current)
-
- if in_type:
+ emit_index(var[0], '(var)')
+ if state_obj.is_type():
words = line.lstrip()
if words.find('=') != -1:
word = words.split('=')
if (len(word[0]) > 0) and (word[0][0] != '_'):
- emit_index(word[0].rstrip(), '(type)', current)
+ emit_index(word[0].rstrip(), '(type)')
else:
word = words.split()
if (len(word) > 1) and (word[1] == ';'):
# hidden type
if (len(word[0]) > 0) and (word[0][0] != '_'):
- emit_index(word[0].rstrip(), '(type)', current)
- if in_const:
+ emit_index(word[0].rstrip(), '(type)')
+ if state_obj.is_const():
words = line.split(';')
for word in words:
word = word.lstrip()
if word.find('=') != -1:
var = word.split('=')
if len(var) > 0:
- emit_index(var[0], '(const)', current)
+ emit_index(var[0], '(const)')
if procedure != '':
name = procedure.split('(')
if name[0] != '':
if proc[-1] == ';':
proc = proc[:-1]
if proc != '':
- emit_index(proc, '', current)
+ emit_index(proc, '')
def emit_texinfo_content(f, line):
+ global state_obj
+ state_obj.to_code()
output.write(line.rstrip() + '\n')
line = f.readline()
if len(line.rstrip()) == 0:
line = f.readline()
while line:
line = line.rstrip()
- check_index(line, '')
+ check_index(line)
+ state_obj.to_code()
output.write(str.replace(str.replace(line, '{', '@{'), '}', '@}'))
output.write('\n')
line = f.readline()
def emit_sphinx_content(f, line):
- output.write('.. code-block:: modula2\n')
+ global state_obj
+ state_obj.to_code()
indent = ' ' * 4
output.write(indent + line.rstrip() + '\n')
line = f.readline()
line = f.readline()
while line:
line = line.rstrip()
- check_index(line, '.. code-block:: modula2')
+ check_index(line)
+ state_obj.to_code()
output.write(indent + line + '\n')
line = f.readline()
return f
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
# Used to install the shared libgcc.
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
# Used to install the shared libgcc.
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
# Used to install the shared libgcc.
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
# Used to install the shared libgcc.
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
# Used to install the shared libgcc.