IO.def \
M2Dependent.def \
M2EXCEPTION.def \
- M2LINK.def \
M2RTS.def \
MemUtils.def \
NumberIO.def \
m2/pge-boot/Glibc.o \
m2/pge-boot/Gerrno.o \
m2/pge-boot/GUnixArgs.o \
- m2/pge-boot/GM2LINK.o \
m2/pge-boot/Gtermios.o \
m2/pge-boot/GSysExceptions.o \
m2/pge-boot/Gabort.o \
PPG-MODS = SymbolKey.mod NameKey.mod Lists.mod bnflex.mod Output.mod
+PPG-DEFS = SymbolKey.def NameKey.def Lists.def bnflex.def Output.def
+
# Core library definition modules used by ppg found in the gm2-libs directory.
PPG-LIB-DEFS = Args.def Assertion.def ASCII.def Debug.def \
DynamicStrings.def FIO.def Indexing.def IO.def \
NumberIO.def PushBackInput.def \
M2Dependent.def \
- M2EXCEPTION.def M2LINK.def M2RTS.def \
+ M2EXCEPTION.def M2RTS.def \
RTExceptions.def \
StdIO.def SFIO.def StrIO.def StrLib.def \
Storage.def StrCase.def SysStorage.def
BUILD-BOOT-PPG-H: $(BUILD-BOOT-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.h \
- m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h
+ m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h \
+ $(PPG-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
m2/ppg$(exeext): m2/boot-bin/mc $(BUILD-PPG-O) $(BUILD-MC-INTERFACE-O) m2/gm2-ppg-boot/main.o \
- m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o \
- m2/gm2-libs-boot/M2LINK.o
+ m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o
-test -d m2 || $(mkinstalldirs) m2
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PPG-O) m2/gm2-ppg-boot/main.o \
- m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o \
- m2/gm2-libs-boot/M2LINK.o -lm
+ m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
IO.def \
M2Dependent.def \
M2EXCEPTION.def \
- M2LINK.def \
M2RTS.def \
MemUtils.def \
NumberIO.def \
termios.def \
wrapc.def \
+PGE-DEPS = Gabort.cc \
+ GArgs.cc \
+ GArgs.h \
+ GASCII.cc \
+ GASCII.h \
+ GAssertion.cc \
+ GAssertion.h \
+ Gbnflex.cc \
+ Gbnflex.h \
+ GBreak.h \
+ GBuiltins.cc \
+ Gcbuiltin.cc \
+ GCmdArgs.h \
+ GDebug.cc \
+ GDebug.h \
+ Gdtoa.cc \
+ Gdtoa.h \
+ GDynamicStrings.cc \
+ GDynamicStrings.h \
+ GEnvironment.h \
+ Gerrno.cc \
+ Gerrno.h \
+ GFIO.cc \
+ GFIO.h \
+ GFormatStrings.h \
+ GFpuIO.h \
+ GIndexing.cc \
+ GIndexing.h \
+ GIO.cc \
+ GIO.h \
+ Gldtoa.cc \
+ Gldtoa.h \
+ Glibc.cc \
+ Glibc.h \
+ Glibm.cc \
+ Glibm.h \
+ GLists.cc \
+ GLists.h \
+ GM2Dependent.cc \
+ GM2Dependent.h \
+ GM2EXCEPTION.cc \
+ GM2EXCEPTION.h \
+ GM2RTS.cc \
+ GM2RTS.h \
+ Gmcrts.cc \
+ Gmcrts.h \
+ GNameKey.cc \
+ GNameKey.h \
+ Gnetwork.h \
+ GNumberIO.cc \
+ GNumberIO.h \
+ GOutput.cc \
+ GOutput.h \
+ Gpge.cc \
+ GPushBackInput.cc \
+ GPushBackInput.h \
+ GRTco.cc \
+ GRTExceptions.cc \
+ GRTExceptions.h \
+ GSArgs.h \
+ GScan.h \
+ GSelective.cc \
+ GSEnvironment.h \
+ GSFIO.cc \
+ GSFIO.h \
+ GStdIO.cc \
+ GStdIO.h \
+ GStorage.cc \
+ GStorage.h \
+ GStrCase.cc \
+ GStrCase.h \
+ GStringConvert.h \
+ GStrIO.cc \
+ GStrIO.h \
+ GStrLib.cc \
+ GStrLib.h \
+ GSymbolKey.cc \
+ GSymbolKey.h \
+ GSysExceptions.cc \
+ GSysExceptions.h \
+ GSysStorage.cc \
+ GSysStorage.h \
+ GSYSTEM.cc \
+ GSYSTEM.h \
+ Gtermios.cc \
+ Gtermios.h \
+ GTimeString.h \
+ GUnixArgs.cc \
+ GUnixArgs.h \
+ Gwrapc.cc \
+ Gwrapc.h
+
BUILD-PG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
m2/pg$(exeext): m2/boot-bin/mc \
$(BUILD-PG-O) $(GM2-PPG-MODS:%.mod=m2/gm2-pg-boot/%.o) \
$(BUILD-MC-INTERFACE-O) m2/gm2-pg-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
- m2/mc-boot-ch/$(SRC_PREFIX)abort.o m2/gm2-libs-boot/M2LINK.o
+ m2/mc-boot-ch/$(SRC_PREFIX)abort.o
-test -d m2 || $(mkinstalldirs) m2
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PG-O) \
m2/gm2-pg-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
- m2/gm2-libs-boot/M2LINK.o \
m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
m2/gm2-auto/pginit:
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-compiler/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot \
- -Im2/gm2-libs-boot \
+ -Im2/gm2-libs-boot -Im2/gm2-pge-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)pge.o: m2/gm2-auto/pge.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
m2/pge$(exeext): m2/boot-bin/mc \
$(BUILD-PGE-O) $(GM2-PPG-MODS:%.mod=m2/gm2-pge-boot/%.o) \
$(BUILD-MC-INTERFACE-O) m2/gm2-pge-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
- m2/mc-boot-ch/$(SRC_PREFIX)abort.o m2/gm2-libs-boot/M2LINK.o
+ m2/mc-boot-ch/$(SRC_PREFIX)abort.o
-test -d m2 || $(mkinstalldirs) m2
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) \
m2/gm2-pge-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
- m2/mc-boot-ch/$(SRC_PREFIX)abort.o m2/gm2-libs-boot/M2LINK.o -lm
+ m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
$(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod t > m2/gm2-auto/t.bnf
./m2/pge$(exeext) m2/gm2-auto/t.bnf -o m2/gm2-auto/t1.mod
./m2/pg$(exeext) m2/gm2-auto/t.bnf -o m2/gm2-auto/t2.mod
@echo " make pge-app-push # copy pge C++ application modules into srcdir/m2/pge-boot"
@echo " make pge-clean"
-pge-maintainer: $(PGE)
+# pge-maintainer: $(PGE)
+pge-maintainer: pge-clean $(PGE) pge-verify pge-push
# Copy the C++ sources for ppe.mod into $(srcdir)/pge-boot.
pge-push: pge-libs-push pge-app-push
pge-libs-push: force
- for i in $(cat $(srcdir)/m2/init/ppginit) ; do \
- if [ -f $(srcdir)/m2/gm2-libs-ch/${i}.h ] ; then \
- cp $(srcdir)/m2/gm2-libs-ch/${i}.h $(srcdir) ; \
- else \
- echo "not found ${i}" ; \
- fi ; \
- if [ -f $(srcdir)/m2/gm2-libs-ch/${i}.c* ] ; then \
- cp $(srcdir)/m2/gm2-libs-ch/${i}.c* $(srcdir) ; \
- elif [ -f $(srcdir)/m2/gm2-pge-libs/${i}.c* ] ; then \
- cp $(srcdir)/m2/gm2-pge-libs/${i}.c* $(srcdir) ; \
+ for i in ${PGE-DEPS} ; do \
+ if [ -f ${srcdir}/m2/gm2-libs-ch/$${i} ] ; then \
+ echo cp ${srcdir}/m2/gm2-libs-ch/$${i} ${srcdir}/m2/pge-boot ; \
+ cp ${srcdir}/m2/gm2-libs-ch/$${i} ${srcdir}/m2/pge-boot ; \
+ elif [ -f m2/gm2-pge-boot/$${i} ] ; then \
+ echo cp m2/gm2-pge-boot/$${i} ${srcdir}/m2/pge-boot ; \
+ cp m2/gm2-pge-boot/$${i} ${srcdir}/m2/pge-boot ; \
+ elif [ -f m2/gm2-compiler-boot/$${i} ] ; then \
+ echo cp m2/gm2-compiler-boot/$${i} ${srcdir}/m2/pge-boot ; \
+ cp m2/gm2-compiler-boot/$${i} ${srcdir}/m2/pge-boot ; \
+ elif [ -f m2/gm2-libs-boot/$${i} ] ; then \
+ echo cp m2/gm2-libs-boot/$${i} ${srcdir}/m2/pge-boot ; \
+ cp m2/gm2-libs-boot/$${i} ${srcdir}/m2/pge-boot ; \
else \
- echo "not found ${i}" ; \
+ echo "not found $${i}" ; \
fi ; \
done
m2/m2obj3/cc1gm2$(exeext): m2/m2obj2/cc1gm2$(exeext) m2/gm2-compiler-paranoid/m2flex.o \
$(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS_PARANOID) \
- m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so m2/gm2-libs-boot/M2LINK.o
+ m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
-test -d m2/m2obj3 || $(mkinstalldirs) m2/m2obj3
@$(call LINK_PROGRESS,$(INDEX.m2),start)
+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-paranoid/m2flex.o \
attribs.o \
$(GM2_LIBS_PARANOID) \
- $(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o m2/gm2-libs-boot/M2LINK.o \
+ $(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o \
$(BACKENDLIBS) $(LIBSTDCXX) -lm
@$(call LINK_PROGRESS,$(INDEX.m2),end)
IMPLEMENTATION MODULE DynamicStrings ;
-FROM libc IMPORT strlen, strncpy, write, exit ;
+FROM libc IMPORT strlen, strncpy, write, exit, snprintf ;
FROM StrLib IMPORT StrLen ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
FROM Assertion IMPORT Assert ;
(*
- writeAddress -
+ writeAddress - writes out the address of a with a C style hex prefix.
*)
PROCEDURE writeAddress (a: ADDRESS) ;
+VAR
+ buffer: ARRAY [0..30] OF CHAR ;
BEGIN
- writeLongcard (VAL (LONGCARD, a))
+ snprintf (ADR (buffer), SIZE (buffer), "0x%", a) ;
+ writeString (buffer) ;
END writeAddress ;
FROM libc IMPORT abort, exit, write, getenv, printf, snprintf, strncpy ;
-(* FROM Builtins IMPORT strncmp, strcmp ; not available during bootstrap. *)
-(* FROM M2LINK IMPORT ForcedModuleInitOrder, StaticInitialization, PtrToChar ; *)
FROM ASCII IMPORT nul, nl ;
FROM SYSTEM IMPORT ADR, SIZE ;
FROM Storage IMPORT ALLOCATE ;
static void writeLongcard (long unsigned int l);
/*
- writeAddress -
+ writeAddress - writes out the address of a with a C style hex prefix.
*/
static void writeAddress (void * a);
static void DumpStringInfo (DynamicStrings_String s, unsigned int i)
{
- DynamicStrings_String t;
-
if (s != NULL)
{
writeNspace (i);
/*
- writeAddress -
+ writeAddress - writes out the address of a with a C style hex prefix.
*/
static void writeAddress (void * a)
{
- writeLongcard ((long unsigned int ) (a));
+ typedef struct writeAddress__T4_a writeAddress__T4;
+
+ struct writeAddress__T4_a { char array[30+1]; };
+ writeAddress__T4 buffer;
+
+ libc_snprintf (&buffer, static_cast<size_t> (sizeof (buffer)), (const char *) "0x%", 3, a);
+ writeString ((const char *) &buffer.array[0], 30);
}
extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch)
{
- typedef struct InitStringChar__T4_a InitStringChar__T4;
+ typedef struct InitStringChar__T5_a InitStringChar__T5;
- struct InitStringChar__T4_a { char array[1+1]; };
- InitStringChar__T4 a;
+ struct InitStringChar__T5_a { char array[1+1]; };
+ InitStringChar__T5 a;
DynamicStrings_String s;
a.array[0] = ch;
extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a, char ch)
{
- typedef struct ConCatChar__T5_a ConCatChar__T5;
+ typedef struct ConCatChar__T6_a ConCatChar__T6;
- struct ConCatChar__T5_a { char array[1+1]; };
- ConCatChar__T5 b;
+ struct ConCatChar__T6_a { char array[1+1]; };
+ ConCatChar__T6 b;
DynamicStrings_String t;
if (PoisonOn)
extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e)
{
DynamicStrings_String s;
- DynamicStrings_frame f;
bool b;
Init ();
if (frameHead == NULL)
{
stop ();
- M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 177);
+ M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 174);
}
else
{
typedef unsigned char *BufferedRead__T3;
void * t;
- int result;
int total;
int n;
BufferedRead__T3 p;
typedef unsigned char *BufferedWrite__T5;
void * t;
- int result;
int total;
int n;
BufferedWrite__T5 p;
int width;
int nextperc;
int afterperc;
- int endpos;
char leader;
char ch;
char ch2;
static DynamicStrings_String HandlePercent (DynamicStrings_String fmt, DynamicStrings_String s, int startpos)
{
int prevpos;
- DynamicStrings_String result;
if ((startpos == ((int ) (DynamicStrings_Length (fmt)))) || (startpos < 0))
{
#define _M2Dependent_C
# include "Glibc.h"
-# include "GM2LINK.h"
# include "GASCII.h"
# include "GSYSTEM.h"
# include "GStorage.h"
typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList;
+typedef char *M2Dependent_PtrToChar;
+
typedef struct M2Dependent__T2_r M2Dependent__T2;
typedef M2Dependent__T2 *M2Dependent_ModuleChain;
};
static M2Dependent__T3 Modules;
+static bool DynamicInitialization;
static bool Initialized;
static bool WarningTrace;
static bool ModuleTrace;
module constructor in turn.
*/
-extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
/*
DeconstructModules - resolve dependencies and then call each
/*
RequestDependant - used to specify that modulename is dependant upon
module dependantmodule. It only takes effect
- if we are not using StaticInitialization.
+ if we are using DynamicInitialization.
*/
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
We cannot use Builtins.def during bootstrap.
*/
-static int strcmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b);
+static int strcmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b);
/*
strncmp - return 0 if both strings are equal.
We cannot use Builtins.def during bootstrap.
*/
-static int strncmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b, unsigned int n);
+static int strncmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b, unsigned int n);
/*
strlen - returns the length of string.
*/
-static int strlen_ (M2LINK_PtrToChar string);
+static int strlen_ (M2Dependent_PtrToChar string);
/*
traceprintf - wrap printf with a boolean flag.
the dynamic ordering with the preference.
*/
-static void ForceDependencies (void);
+static void ForceDependencies (void * overrideliborder);
/*
CheckApplication - check to see that the application is the last entry in the list.
static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Dependent_ArgCVEnvP init, M2Dependent_ArgCVEnvP fini, PROC dependencies)
{
M2Dependent_ModuleChain mptr;
- void * p0;
- void * p1;
Storage_ALLOCATE ((void **) &mptr, sizeof (M2Dependent__T2));
mptr->name = name;
{
ptr = Modules.array[state-M2Dependent_unregistered];
do {
- if (((strncmp (reinterpret_cast<M2LINK_PtrToChar> (ptr->name), reinterpret_cast<M2LINK_PtrToChar> (name), max (namelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (ptr->name)))))) == 0) && ((strncmp (reinterpret_cast<M2LINK_PtrToChar> (ptr->libname), reinterpret_cast<M2LINK_PtrToChar> (libname), max (libnamelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (ptr->libname)))))) == 0))
+ if (((strncmp (reinterpret_cast<M2Dependent_PtrToChar> (ptr->name), reinterpret_cast<M2Dependent_PtrToChar> (name), max (namelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (ptr->name)))))) == 0) && ((strncmp (reinterpret_cast<M2Dependent_PtrToChar> (ptr->libname), reinterpret_cast<M2Dependent_PtrToChar> (libname), max (libnamelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (ptr->libname)))))) == 0))
{
return ptr;
}
static M2Dependent_ModuleChain LookupModule (M2Dependent_DependencyState state, void * name, void * libname)
{
- return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (name))), libname, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (libname))));
+ return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (name))), libname, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (libname))));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
We cannot use Builtins.def during bootstrap.
*/
-static int strcmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b)
+static int strcmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b)
{
if ((a != NULL) && (b != NULL))
{
We cannot use Builtins.def during bootstrap.
*/
-static int strncmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b, unsigned int n)
+static int strncmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b, unsigned int n)
{
if (n == 0)
{
strlen - returns the length of string.
*/
-static int strlen_ (M2LINK_PtrToChar string)
+static int strlen_ (M2Dependent_PtrToChar string)
{
int count;
static void DumpModuleData (bool flag)
{
- M2Dependent_ModuleChain mptr;
-
if (flag)
{
DisplayModuleInfo (M2Dependent_unregistered, (const char *) "unregistered", 12);
the dynamic ordering with the preference.
*/
-static void ForceDependencies (void)
+static void ForceDependencies (void * overrideliborder)
{
unsigned int len;
unsigned int modlen;
unsigned int liblen;
- M2LINK_PtrToChar modname;
- M2LINK_PtrToChar libname;
- M2LINK_PtrToChar pc;
- M2LINK_PtrToChar start;
+ M2Dependent_PtrToChar modname;
+ M2Dependent_PtrToChar libname;
+ M2Dependent_PtrToChar pc;
+ M2Dependent_PtrToChar start;
- if (M2LINK_ForcedModuleInitOrder != NULL)
+ if (overrideliborder != NULL)
{
- traceprintf2 (ForceTrace, (const char *) "user forcing order: %s\\n", 24, reinterpret_cast<void *> (M2LINK_ForcedModuleInitOrder));
- pc = M2LINK_ForcedModuleInitOrder;
+ traceprintf2 (ForceTrace, (const char *) "user forcing order: %s\\n", 24, overrideliborder);
+ pc = static_cast<M2Dependent_PtrToChar> (overrideliborder);
start = pc;
len = 0;
modname = NULL;
/* make a local copy of each unbounded array. */
memcpy (str, str_, _str_high+1);
- return (strncmp (reinterpret_cast<M2LINK_PtrToChar> (cstr), reinterpret_cast<M2LINK_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
+ return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
{
Modules.array[state-M2Dependent_unregistered] = NULL;
}
+ DynamicInitialization = false;
}
module constructor in turn.
*/
-extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp)
+extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp)
{
M2Dependent_ModuleChain mptr;
- M2Dependent_ArgCVEnvP nulp;
CheckInitialized ();
- traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, applicationmodule, libname);
+ DynamicInitialization = true; /* This procedure is only called if we desire dynamic initialization. */
+ traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, applicationmodule, libname); /* This procedure is only called if we desire dynamic initialization. */
mptr = LookupModule (M2Dependent_unordered, applicationmodule, libname);
if (mptr != NULL)
{
ResolveDependencies (applicationmodule, libname);
traceprintf (PreTrace, (const char *) "Post resolving dependents\\n", 27);
DumpModuleData (PostTrace);
- ForceDependencies ();
+ ForceDependencies (overrideliborder);
traceprintf (ForceTrace, (const char *) "After user forcing ordering\\n", 29);
DumpModuleData (ForceTrace);
CheckApplication ();
M2Dependent_ModuleChain mptr;
CheckInitialized ();
- if (! M2LINK_StaticInitialization)
+ mptr = LookupModule (M2Dependent_unordered, modulename, libname);
+ if (mptr == NULL)
{
- mptr = LookupModule (M2Dependent_unordered, modulename, libname);
- if (mptr == NULL)
- {
- traceprintf3 (ModuleTrace, (const char *) "module: %s [%s] registering", 27, modulename, libname);
- moveTo (M2Dependent_unordered, CreateModule (modulename, libname, init, fini, dependencies));
- traceprintf (ModuleTrace, (const char *) "\\n", 2);
- }
- else
- {
- warning3 ((const char *) "module: %s [%s] (ignoring duplicate registration)\\n", 51, modulename, libname);
- }
+ traceprintf3 (ModuleTrace, (const char *) "module: %s [%s] registering", 27, modulename, libname);
+ moveTo (M2Dependent_unordered, CreateModule (modulename, libname, init, fini, dependencies));
+ traceprintf (ModuleTrace, (const char *) "\\n", 2);
+ }
+ else
+ {
+ warning3 ((const char *) "module: %s [%s] (ignoring duplicate registration)\\n", 51, modulename, libname);
}
}
/*
RequestDependant - used to specify that modulename is dependant upon
module dependantmodule. It only takes effect
- if we are not using StaticInitialization.
+ if we are using DynamicInitialization.
*/
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname)
{
CheckInitialized ();
- if (! M2LINK_StaticInitialization)
- {
- PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname);
- }
+ PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname);
}
extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
typedef void (*M2Dependent_ArgCVEnvP_t) (int, void *, void *);
struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; };
-EXTERN void M2Dependent_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+EXTERN void M2Dependent_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
EXTERN void M2Dependent_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
/*
+++ /dev/null
-/* do not edit automatically generated by mc from M2LINK. */
-/* M2LINK.def defines the linking mode used in Modula-2.
-
-Copyright (C) 2022-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GNU Modula-2 is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-
-#if !defined (_M2LINK_H)
-# define _M2LINK_H
-
-#include "config.h"
-#include "system.h"
-# ifdef __cplusplus
-extern "C" {
-# endif
-#include <stdbool.h>
-# if !defined (PROC_D)
-# define PROC_D
- typedef void (*PROC_t) (void);
- typedef struct { PROC_t proc; } PROC;
-# endif
-
-
-# if defined (_M2LINK_C)
-# define EXTERN
-# else
-# define EXTERN extern
-# endif
-
-typedef char *M2LINK_PtrToChar;
-
-EXTERN M2LINK_PtrToChar M2LINK_ForcedModuleInitOrder;
-EXTERN bool M2LINK_StaticInitialization;
-# ifdef __cplusplus
-}
-# endif
-
-# undef EXTERN
-#endif
module constructor in turn.
*/
-extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
/*
DeconstructModules - resolve dependencies and then call each
module constructor in turn.
*/
-extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp)
+extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp)
{
- M2Dependent_ConstructModules (applicationmodule, libname, argc, argv, envp);
+ M2Dependent_ConstructModules (applicationmodule, libname, overrideliborder, argc, argv, envp);
}
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
EXTERN void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
/*
extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int number)
{
RTExceptions_Handler h;
- RTExceptions_Handler i;
h = findHandler (e, number);
if (h != NULL)
RTint_Vector vec;
Selective_SetOfFd inSet;
Selective_SetOfFd outSet;
- unsigned int b4s;
- unsigned int b4m;
- unsigned int afs;
- unsigned int afm;
unsigned int sec;
unsigned int micro;
int maxFd;
}
if (((untilInterrupt && (inSet == NULL)) && (outSet == NULL)) && ! found)
{
- M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "Listen", 6, 732);
+ M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "Listen", 6, 728);
}
/* printf('}
') ; */
extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file)
{
DynamicStrings_String s;
- unsigned int c;
s = DynamicStrings_InitString ((const char *) "", 0);
while (((! (FIO_EOLN (file))) && (! (FIO_EOF (file)))) && (FIO_IsNoError (file)))
int l;
int point;
DynamicStrings_String t;
- DynamicStrings_String whole;
- DynamicStrings_String fraction;
DynamicStrings_String tenths;
DynamicStrings_String hundreths;
int point;
unsigned int poTen;
- Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1222, (const char *) "ToSigFig", 8);
+ Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1220, (const char *) "ToSigFig", 8);
point = DynamicStrings_Index (s, '.', 0);
if (point < 0)
{
extern "C" void SYSTEM_RotateVal (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, int RotateCount);
extern "C" void SYSTEM_RotateLeft (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int RotateCount);
extern "C" void SYSTEM_RotateRight (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int RotateCount);
-extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
extern "C" void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
extern "C" void M2RTS_RegisterModule (void * name, void * libname, M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies);
extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
The success of the operation is returned.
*/
-extern "C" unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int n);
+extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n);
/*
Narg - returns the number of arguments available from
The success of the operation is returned.
*/
-extern "C" unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int n)
+extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n)
{
int i;
unsigned int High;
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
The success of the operation is returned.
*/
-EXTERN unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int n);
+EXTERN bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n);
/*
Narg - returns the number of arguments available from
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
Assert - tests the boolean Condition, if it fails then HALT is called.
*/
-extern "C" void Assertion_Assert (unsigned int Condition);
+extern "C" void Assertion_Assert (bool Condition);
/*
Assert - tests the boolean Condition, if it fails then HALT is called.
*/
-extern "C" void Assertion_Assert (unsigned int Condition)
+extern "C" void Assertion_Assert (bool Condition)
{
if (! Condition)
{
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
is called.
*/
-EXTERN void Assertion_Assert (unsigned int Condition);
+EXTERN void Assertion_Assert (bool Condition);
# ifdef __cplusplus
}
# endif
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
the success of the operation is returned.
*/
-EXTERN unsigned int CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high);
+EXTERN bool CmdArgs_GetArg (const char *CmdLine_, unsigned int _CmdLine_high, unsigned int n, char *Argi, unsigned int _Argi_high);
/*
Narg - returns the number of arguments available from
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
/*
Halt - writes a message in the format:
- Module:Line:Message
+ Module:Function:Line:Message
It then terminates by calling HALT.
*/
-extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, unsigned int LineNo, const char *Module_, unsigned int _Module_high);
+extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, const char *Module_, unsigned int _Module_high, const char *Function_, unsigned int _Function_high, unsigned int LineNo);
/*
DebugString - writes a string to the debugging device (Scn.Write).
/*
Halt - writes a message in the format:
- Module:Line:Message
+ Module:Function:Line:Message
It then terminates by calling HALT.
*/
-extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, unsigned int LineNo, const char *Module_, unsigned int _Module_high)
+extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, const char *Module_, unsigned int _Module_high, const char *Function_, unsigned int _Function_high, unsigned int LineNo)
{
typedef struct Halt__T1_a Halt__T1;
Halt__T1 No;
char Message[_Message_high+1];
char Module[_Module_high+1];
+ char Function[_Function_high+1];
/* make a local copy of each unbounded array. */
memcpy (Message, Message_, _Message_high+1);
memcpy (Module, Module_, _Module_high+1);
+ memcpy (Function, Function_, _Function_high+1);
Debug_DebugString ((const char *) Module, _Module_high); /* should be large enough for most source files.. */
+ Debug_DebugString ((const char *) ":", 1);
+ Debug_DebugString ((const char *) Function, _Function_high);
+ Debug_DebugString ((const char *) ":", 1);
NumberIO_CardToStr (LineNo, 0, (char *) &No.array[0], MaxNoOfDigits);
Debug_DebugString ((const char *) ":", 1);
Debug_DebugString ((const char *) &No.array[0], MaxNoOfDigits);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
/*
Halt - writes a message in the format:
- Module:Line:Message
+ Module:Function:Line:Message
It then terminates by calling HALT.
*/
-EXTERN void Debug_Halt (const char *Message_, unsigned int _Message_high, unsigned int LineNo, const char *Module_, unsigned int _Module_high);
+EXTERN void Debug_Halt (const char *Message_, unsigned int _Message_high, const char *Module_, unsigned int _Module_high, const char *Function_, unsigned int _Function_high, unsigned int LineNo);
/*
DebugString - writes a string to the debugging device (Scn.Write).
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# include "GM2RTS.h"
# define MaxBuf 127
-# define PoisonOn FALSE
-# define DebugOn FALSE
-# define CheckOn FALSE
-# define TraceOn FALSE
+# define PoisonOn false
+# define DebugOn false
+# define CheckOn false
+# define TraceOn false
typedef struct DynamicStrings_Contents_r DynamicStrings_Contents;
typedef struct DynamicStrings_DebugInfo_r DynamicStrings_DebugInfo;
};
struct DynamicStrings_descriptor_r {
- unsigned int charStarUsed;
+ bool charStarUsed;
void *charStar;
unsigned int charStarSize;
- unsigned int charStarValid;
+ bool charStarValid;
DynamicStrings_desState state;
DynamicStrings_String garbage;
};
DynamicStrings_DebugInfo debug;
};
-static unsigned int Initialized;
+static bool Initialized;
static DynamicStrings_frame frameHead;
static DynamicStrings_String captured;
Equal - returns TRUE if String, a, and, b, are equal.
*/
-extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b);
+extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b);
/*
EqualCharStar - returns TRUE if contents of String, s, is the same as the
string, a.
*/
-extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a);
+extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a);
/*
EqualArray - returns TRUE if contents of String, s, is the same as the
string, a.
*/
-extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high);
+extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high);
/*
Mult - returns a new string which is n concatenations of String, s.
with an exit code of 1.
*/
-extern "C" void DynamicStrings_PopAllocation (unsigned int halt);
+extern "C" void DynamicStrings_PopAllocation (bool halt);
/*
PopAllocationExemption - test to see that all strings are deallocated, except
- string, e, since the last push.
- Then it pops to the previous allocation/deallocation
+ string e since the last push.
+ Post-condition: it pops to the previous allocation/deallocation
lists.
If halt is true then the application terminates
with an exit code of 1.
*/
-extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e);
+extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e);
/*
writeStringDesc write out debugging information about string, s. */
static void writeLongcard (long unsigned int l);
/*
- writeAddress -
+ writeAddress - writes out the address of a with a C style hex prefix.
*/
static void writeAddress (void * a);
IsOn - returns TRUE if, s, is on one of the debug lists.
*/
-static unsigned int IsOn (DynamicStrings_String list, DynamicStrings_String s);
+static bool IsOn (DynamicStrings_String list, DynamicStrings_String s);
/*
AddTo - adds string, s, to, list.
IsOnAllocated - returns TRUE if the string, s, has ever been allocated.
*/
-static unsigned int IsOnAllocated (DynamicStrings_String s);
+static bool IsOnAllocated (DynamicStrings_String s);
/*
IsOnDeallocated - returns TRUE if the string, s, has ever been deallocated.
*/
-static unsigned int IsOnDeallocated (DynamicStrings_String s);
+static bool IsOnDeallocated (DynamicStrings_String s);
/*
SubAllocated - removes string, s, from the list of allocated strings.
IsOnGarbage - returns TRUE if, s, is on string, e, garbage list.
*/
-static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s);
+static bool IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s);
/*
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch);
+static bool IsWhite (char ch);
/*
DumpState -
static void DumpStringInfo (DynamicStrings_String s, unsigned int i)
{
- DynamicStrings_String t;
-
if (s != NULL)
{
writeNspace (i);
{
if (CheckOn)
{
- s = DynamicStrings_PopAllocationExemption (TRUE, s);
+ s = DynamicStrings_PopAllocationExemption (true, s);
}
}
/*
- writeAddress -
+ writeAddress - writes out the address of a with a C style hex prefix.
*/
static void writeAddress (void * a)
{
- writeLongcard ((long unsigned int ) (a));
+ typedef struct writeAddress__T4_a writeAddress__T4;
+
+ struct writeAddress__T4_a { char array[30+1]; };
+ writeAddress__T4 buffer;
+
+ libc_snprintf (&buffer, static_cast<size_t> (sizeof (buffer)), (const char *) "0x%", 3, a);
+ writeString ((const char *) &buffer.array[0], 30);
}
IsOn - returns TRUE if, s, is on one of the debug lists.
*/
-static unsigned int IsOn (DynamicStrings_String list, DynamicStrings_String s)
+static bool IsOn (DynamicStrings_String list, DynamicStrings_String s)
{
while ((list != s) && (list != NULL))
{
IsOnAllocated - returns TRUE if the string, s, has ever been allocated.
*/
-static unsigned int IsOnAllocated (DynamicStrings_String s)
+static bool IsOnAllocated (DynamicStrings_String s)
{
DynamicStrings_frame f;
do {
if (IsOn (f->alloc, s))
{
- return TRUE;
+ return true;
}
else
{
f = f->next;
}
} while (! (f == NULL));
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
IsOnDeallocated - returns TRUE if the string, s, has ever been deallocated.
*/
-static unsigned int IsOnDeallocated (DynamicStrings_String s)
+static bool IsOnDeallocated (DynamicStrings_String s)
{
DynamicStrings_frame f;
do {
if (IsOn (f->dealloc, s))
{
- return TRUE;
+ return true;
}
else
{
f = f->next;
}
} while (! (f == NULL));
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
{
Storage_DEALLOCATE (&s->head->charStar, s->head->charStarSize);
}
- s->head->charStarUsed = FALSE;
+ s->head->charStarUsed = false;
s->head->charStar = NULL;
s->head->charStarSize = 0;
- s->head->charStarValid = FALSE;
+ s->head->charStarValid = false;
}
}
}
if (s->head != NULL)
{
- s->head->charStarValid = FALSE;
+ s->head->charStarValid = false;
}
}
IsOnGarbage - returns TRUE if, s, is on string, e, garbage list.
*/
-static unsigned int IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s)
+static bool IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s)
{
if ((e != NULL) && (s != NULL))
{
{
if (e->head->garbage == s)
{
- return TRUE;
+ return true;
}
else
{
}
}
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch)
+static bool IsWhite (char ch)
{
return (ch == ' ') || (ch == ASCII_tab);
/* static analysis guarentees a RETURN statement will be used before here. */
{
if (! Initialized)
{
- Initialized = TRUE;
+ Initialized = true;
frameHead = NULL;
DynamicStrings_PushAllocation ();
}
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 (DynamicStrings_descriptor));
- s->head->charStarUsed = FALSE;
+ s->head->charStarUsed = false;
s->head->charStar = NULL;
s->head->charStarSize = 0;
- s->head->charStarValid = FALSE;
+ s->head->charStarValid = false;
s->head->garbage = NULL;
s->head->state = DynamicStrings_inuse;
AddDebugInfo (s);
ConcatContentsAddress (&s->contents, a, static_cast<unsigned int> (libc_strlen (a)));
}
Storage_ALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor));
- s->head->charStarUsed = FALSE;
+ s->head->charStarUsed = false;
s->head->charStar = NULL;
s->head->charStarSize = 0;
- s->head->charStarValid = FALSE;
+ s->head->charStarValid = false;
s->head->garbage = NULL;
s->head->state = DynamicStrings_inuse;
AddDebugInfo (s);
extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch)
{
- typedef struct InitStringChar__T4_a InitStringChar__T4;
+ typedef struct InitStringChar__T5_a InitStringChar__T5;
- struct InitStringChar__T4_a { char array[1+1]; };
- InitStringChar__T4 a;
+ struct InitStringChar__T5_a { char array[1+1]; };
+ InitStringChar__T5 a;
DynamicStrings_String s;
a.array[0] = ch;
extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a, char ch)
{
- typedef struct ConCatChar__T5_a ConCatChar__T5;
+ typedef struct ConCatChar__T6_a ConCatChar__T6;
- struct ConCatChar__T5_a { char array[1+1]; };
- ConCatChar__T5 b;
+ struct ConCatChar__T6_a { char array[1+1]; };
+ ConCatChar__T6 b;
DynamicStrings_String t;
if (PoisonOn)
Equal - returns TRUE if String, a, and, b, are equal.
*/
-extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b)
+extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b)
{
unsigned int i;
{
if (a->contents.buf.array[i] != b->contents.buf.array[i])
{
- return FALSE;
+ return false;
}
i += 1;
}
a = a->contents.next;
b = b->contents.next;
}
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
string, a.
*/
-extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a)
+extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a)
{
DynamicStrings_String t;
if (DynamicStrings_Equal (t, s))
{
t = DynamicStrings_KillString (t);
- return TRUE;
+ return true;
}
else
{
t = DynamicStrings_KillString (t);
- return FALSE;
+ return false;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
string, a.
*/
-extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high)
+extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high)
{
DynamicStrings_String t;
char a[_a_high+1];
if (DynamicStrings_Equal (t, s))
{
t = DynamicStrings_KillString (t);
- return TRUE;
+ return true;
}
else
{
t = DynamicStrings_KillString (t);
- return FALSE;
+ return false;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
DeallocateCharStar (s);
Storage_ALLOCATE (&s->head->charStar, l+1);
s->head->charStarSize = l+1;
- s->head->charStarUsed = TRUE;
+ s->head->charStarUsed = true;
}
p = static_cast<string__T2> (s->head->charStar);
a = s;
a = a->contents.next;
}
(*p) = ASCII_nul;
- s->head->charStarValid = TRUE;
+ s->head->charStarValid = true;
}
return s->head->charStar;
}
with an exit code of 1.
*/
-extern "C" void DynamicStrings_PopAllocation (unsigned int halt)
+extern "C" void DynamicStrings_PopAllocation (bool halt)
{
if (CheckOn)
{
/*
PopAllocationExemption - test to see that all strings are deallocated, except
- string, e, since the last push.
- Then it pops to the previous allocation/deallocation
+ string e since the last push.
+ Post-condition: it pops to the previous allocation/deallocation
lists.
If halt is true then the application terminates
with an exit code of 1.
*/
-extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e)
+extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e)
{
DynamicStrings_String s;
- DynamicStrings_frame f;
- unsigned int b;
+ bool b;
Init ();
if (CheckOn)
if (frameHead == NULL)
{
stop ();
- /* writeString ("mismatched number of PopAllocation's compared to PushAllocation's") */
- M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65);
+ M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 174);
}
else
{
+ /* writeString ("mismatched number of PopAllocation's compared to PushAllocation's") */
if (frameHead->alloc != NULL)
{
- b = FALSE;
+ b = false;
s = frameHead->alloc;
while (s != NULL)
{
{
writeString ((const char *) "the following strings have been lost", 36);
writeLn ();
- b = TRUE;
+ b = true;
}
DumpStringInfo (s, 0);
}
extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
- Initialized = FALSE;
+ Initialized = false;
Init ();
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
Equal - returns TRUE if String, a, and, b, are equal.
*/
-EXTERN unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b);
+EXTERN bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b);
/*
EqualCharStar - returns TRUE if contents of String, s, is
the same as the string, a.
*/
-EXTERN unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a);
+EXTERN bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a);
/*
EqualArray - returns TRUE if contents of String, s, is the
same as the string, a.
*/
-EXTERN unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high);
+EXTERN bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high);
/*
Mult - returns a new string which is n concatenations of String, s.
with an exit code of 1.
*/
-EXTERN void DynamicStrings_PopAllocation (unsigned int halt);
+EXTERN void DynamicStrings_PopAllocation (bool halt);
/*
PopAllocationExemption - test to see that all strings are
- deallocated, except string, e, since
+ deallocated, except string e since
the last push.
- Then it pops to the previous
+ Post-condition: it pops to the previous
allocation/deallocation lists.
If halt is true then the application
The string, e, is returned unmodified,
*/
-EXTERN DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned int halt, DynamicStrings_String e);
+EXTERN DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e);
# ifdef __cplusplus
}
# endif
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
the processes environment.
*/
-EXTERN unsigned int Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high);
+EXTERN bool Environment_GetEnvironment (const char *Env_, unsigned int _Env_high, char *dest, unsigned int _dest_high);
/*
PutEnvironment - change or add an environment variable definition
set or changed successfully.
*/
-EXTERN unsigned int Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high);
+EXTERN bool Environment_PutEnvironment (const char *EnvDef_, unsigned int _EnvDef_high);
# ifdef __cplusplus
}
# endif
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
};
struct FIO_buf_r {
- unsigned int valid;
+ bool valid;
long int bufstart;
unsigned int position;
void *address;
FIO_NameInfo name;
FIO_FileStatus state;
FIO_FileUsage usage;
- unsigned int output;
+ bool output;
FIO_Buffer buffer;
long int abspos;
};
IsNoError - returns a TRUE if no error has occured on file, f.
*/
-extern "C" unsigned int FIO_IsNoError (FIO_File f);
+extern "C" bool FIO_IsNoError (FIO_File f);
/*
IsActive - returns TRUE if the file, f, is still active.
*/
-extern "C" unsigned int FIO_IsActive (FIO_File f);
-extern "C" unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high);
+extern "C" bool FIO_IsActive (FIO_File f);
+extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high);
extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high);
extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_high);
-extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile);
+extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile);
/*
Close - close a file which has been previously opened using:
exists - returns TRUE if a file named, fname exists for reading.
*/
-extern "C" unsigned int FIO_exists (void * fname, unsigned int flength);
+extern "C" bool FIO_exists (void * fname, unsigned int flength);
/*
openToRead - attempts to open a file, fname, for reading and
opened for writing or reading.
*/
-extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile);
+extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile);
/*
FlushBuffer - flush contents of file, f.
EOF - tests to see whether a file, f, has reached end of file.
*/
-extern "C" unsigned int FIO_EOF (FIO_File f);
+extern "C" bool FIO_EOF (FIO_File f);
/*
EOLN - tests to see whether a file, f, is upon a newline.
It does NOT consume the newline.
*/
-extern "C" unsigned int FIO_EOLN (FIO_File f);
+extern "C" bool FIO_EOLN (FIO_File f);
/*
WasEOLN - tests to see whether a file, f, has just seen a newline.
*/
-extern "C" unsigned int FIO_WasEOLN (FIO_File f);
+extern "C" bool FIO_WasEOLN (FIO_File f);
/*
ReadChar - returns a character read from file f.
InitializeFile - initialize a file descriptor
*/
-static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_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, bool towrite, unsigned int buflength);
/*
ConnectToUnix - connects a FIO file to a UNIX file descriptor.
*/
-static void ConnectToUnix (FIO_File f, unsigned int towrite, unsigned int newfile);
+static void ConnectToUnix (FIO_File f, bool towrite, bool newfile);
/*
ReadFromBuffer - attempts to read, nBytes, from file, f.
opened for read/write.
*/
-static void CheckAccess (FIO_File f, FIO_FileUsage use, unsigned int towrite);
+static void CheckAccess (FIO_File f, FIO_FileUsage use, bool towrite);
/*
SetEndOfLine -
PreInitialize - preinitialize the file descriptor.
*/
-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);
+static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, bool towrite, int osfd, unsigned int bufsize);
/*
Init - initialize the modules, global variables.
InitializeFile - initialize a file descriptor
*/
-static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength, FIO_FileStatus fstate, FIO_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, bool towrite, unsigned int buflength)
{
FIO_PtrToChar p;
FIO_FileDescriptor fd;
}
else
{
- fd->buffer->valid = FALSE;
+ fd->buffer->valid = false;
fd->buffer->bufstart = 0;
fd->buffer->size = buflength;
fd->buffer->position = 0;
ConnectToUnix - connects a FIO file to a UNIX file descriptor.
*/
-static void ConnectToUnix (FIO_File f, unsigned int towrite, unsigned int newfile)
+static void ConnectToUnix (FIO_File f, bool towrite, bool newfile)
{
FIO_FileDescriptor fd;
(*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 */
- nBytes = 0;
+ nBytes = 0; /* reduce the amount for future direct */
/* read */
return 1;
}
/* now disable the buffer as we read directly into, a. */
if (fd->buffer != NULL)
{
- fd->buffer->valid = FALSE;
+ fd->buffer->valid = false;
}
}
else
/* indicate buffer is empty */
if (fd->buffer != NULL)
{
- fd->buffer->valid = FALSE;
+ fd->buffer->valid = false;
fd->buffer->left = 0;
fd->buffer->position = 0;
if (fd->buffer->address != NULL)
typedef unsigned char *BufferedRead__T3;
void * t;
- int result;
int total;
int n;
BufferedRead__T3 p;
if (n >= 0)
{
/* avoid dangling else. */
- fd->buffer->valid = TRUE;
+ fd->buffer->valid = true;
fd->buffer->position = 0;
fd->buffer->left = n;
fd->buffer->filled = n;
}
else
{
- fd->buffer->valid = FALSE;
+ fd->buffer->valid = false;
fd->buffer->position = 0;
fd->buffer->left = 0;
fd->buffer->filled = 0;
opened for read/write.
*/
-static void CheckAccess (FIO_File f, FIO_FileUsage use, unsigned int towrite)
+static void CheckAccess (FIO_File f, FIO_FileUsage use, bool towrite)
{
FIO_FileDescriptor fd;
{
FIO_FileDescriptor fd;
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
if (f != Error)
{
fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
typedef unsigned char *BufferedWrite__T5;
void * t;
- int result;
int total;
int n;
BufferedWrite__T5 p;
PreInitialize - preinitialize the file descriptor.
*/
-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)
+static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_high, FIO_FileStatus state, FIO_FileUsage use, bool towrite, int osfd, unsigned int bufsize)
{
FIO_FileDescriptor fd;
FIO_FileDescriptor fe;
{
FileInfo = Indexing_InitIndex (0);
Error = 0;
- PreInitialize (Error, (const char *) "error", 5, FIO_toomanyfilesopen, FIO_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, FIO_successful, FIO_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, FIO_successful, FIO_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, FIO_successful, FIO_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);
IsNoError - returns a TRUE if no error has occured on file, f.
*/
-extern "C" unsigned int FIO_IsNoError (FIO_File f)
+extern "C" bool FIO_IsNoError (FIO_File f)
{
FIO_FileDescriptor fd;
if (f == Error)
{
- return FALSE;
+ return false;
}
else
{
IsActive - returns TRUE if the file, f, is still active.
*/
-extern "C" unsigned int FIO_IsActive (FIO_File f)
+extern "C" bool FIO_IsActive (FIO_File f)
{
if (f == Error)
{
- return FALSE;
+ return false;
}
else
{
__builtin_unreachable ();
}
-extern "C" unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high)
+extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high)
{
char fname[_fname_high+1];
__builtin_unreachable ();
}
-extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile)
+extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile)
{
char fname[_fname_high+1];
exists - returns TRUE if a file named, fname exists for reading.
*/
-extern "C" unsigned int FIO_exists (void * fname, unsigned int flength)
+extern "C" bool FIO_exists (void * fname, unsigned int flength)
{
FIO_File f;
if (FIO_IsNoError (f))
{
FIO_Close (f);
- return TRUE;
+ return true;
}
else
{
FIO_Close (f);
- return FALSE;
+ return false;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
else
{
- f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforread, FALSE, MaxBufferLength);
- ConnectToUnix (f, FALSE, FALSE);
+ f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforread, false, MaxBufferLength);
+ ConnectToUnix (f, false, false);
}
return f;
/* static analysis guarentees a RETURN statement will be used before here. */
}
else
{
- f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforwrite, TRUE, MaxBufferLength);
- ConnectToUnix (f, TRUE, TRUE);
+ f = InitializeFile (f, fname, flength, FIO_successful, FIO_openedforwrite, true, MaxBufferLength);
+ ConnectToUnix (f, true, true);
}
return f;
/* static analysis guarentees a RETURN statement will be used before here. */
opened for writing or reading.
*/
-extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile)
+extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile)
{
FIO_File f;
if (f != Error)
{
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
n = ReadFromBuffer (f, dest, nBytes);
if (n <= 0)
{
extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high)
{
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high)))
{
SetEndOfLine (f, static_cast<char> (a[_a_high]));
int total;
FIO_FileDescriptor fd;
- CheckAccess (f, FIO_openedforwrite, TRUE);
+ CheckAccess (f, FIO_openedforwrite, true);
FIO_FlushBuffer (f);
if (f != Error)
{
extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high)
{
- CheckAccess (f, FIO_openedforwrite, TRUE);
+ 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, FIO_openedforwrite, TRUE);
+ CheckAccess (f, FIO_openedforwrite, true);
if ((BufferedWrite (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch))))
{} /* empty. */
}
EOF - tests to see whether a file, f, has reached end of file.
*/
-extern "C" unsigned int FIO_EOF (FIO_File f)
+extern "C" bool FIO_EOF (FIO_File f)
{
FIO_FileDescriptor fd;
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
if (f != Error)
{
fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
return fd->state == FIO_endoffile;
}
}
- return TRUE;
+ return true;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
It does NOT consume the newline.
*/
-extern "C" unsigned int FIO_EOLN (FIO_File f)
+extern "C" bool FIO_EOLN (FIO_File f)
{
char ch;
FIO_FileDescriptor fd;
- CheckAccess (f, FIO_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.
}
}
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
WasEOLN - tests to see whether a file, f, has just seen a newline.
*/
-extern "C" unsigned int FIO_WasEOLN (FIO_File f)
+extern "C" bool FIO_WasEOLN (FIO_File f)
{
FIO_FileDescriptor fd;
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
if (f == Error)
{
- return FALSE;
+ return false;
}
else
{
{
char ch;
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
if ((BufferedRead (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch))))
{
SetEndOfLine (f, ch);
void * a;
void * b;
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
if (f != Error)
{
fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
unsigned int i;
char ch;
- CheckAccess (f, FIO_openedforread, FALSE);
+ CheckAccess (f, FIO_openedforread, false);
high = _a_high;
i = 0;
do {
{
/* always force the lseek, until we are confident that abspos is always correct,
basically it needs some hard testing before we should remove the OR TRUE. */
- if ((fd->abspos != pos) || TRUE)
+ if ((fd->abspos != pos) || true)
{
FIO_FlushBuffer (f);
if (fd->buffer != NULL)
}
if (fd->buffer != NULL)
{
- fd->buffer->valid = FALSE;
+ fd->buffer->valid = false;
fd->buffer->bufstart = fd->abspos;
}
}
}
if (fd->buffer != NULL)
{
- fd->buffer->valid = FALSE;
+ fd->buffer->valid = false;
fd->buffer->bufstart = offset;
}
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
IsNoError - returns a TRUE if no error has occured on file, f.
*/
-EXTERN unsigned int FIO_IsNoError (FIO_File f);
+EXTERN bool FIO_IsNoError (FIO_File f);
/*
IsActive - returns TRUE if the file, f, is still active.
*/
-EXTERN unsigned int FIO_IsActive (FIO_File f);
+EXTERN bool FIO_IsActive (FIO_File f);
/*
Exists - returns TRUE if a file named, fname exists for reading.
*/
-EXTERN unsigned int FIO_Exists (const char *fname_, unsigned int _fname_high);
+EXTERN bool FIO_Exists (const char *fname_, unsigned int _fname_high);
/*
OpenToRead - attempts to open a file, fname, for reading and
and modify an existing file.
*/
-EXTERN FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, unsigned int towrite, unsigned int newfile);
+EXTERN FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile);
/*
Close - close a file which has been previously opened using:
*/
EXTERN void FIO_Close (FIO_File f);
-EXTERN unsigned int FIO_exists (void * fname, unsigned int flength);
+EXTERN bool FIO_exists (void * fname, unsigned int flength);
EXTERN FIO_File FIO_openToRead (void * fname, unsigned int flength);
EXTERN FIO_File FIO_openToWrite (void * fname, unsigned int flength);
-EXTERN FIO_File FIO_openForRandom (void * fname, unsigned int flength, unsigned int towrite, unsigned int newfile);
+EXTERN FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile);
/*
FlushBuffer - flush contents of the FIO file, f, to libc.
EOF - tests to see whether a file, f, has reached end of file.
*/
-EXTERN unsigned int FIO_EOF (FIO_File f);
+EXTERN bool FIO_EOF (FIO_File f);
/*
EOLN - tests to see whether a file, f, is about to read a newline.
and then immediately unreads the character.
*/
-EXTERN unsigned int FIO_EOLN (FIO_File f);
+EXTERN bool FIO_EOLN (FIO_File f);
/*
WasEOLN - tests to see whether a file, f, has just read a newline
character.
*/
-EXTERN unsigned int FIO_WasEOLN (FIO_File f);
+EXTERN bool FIO_WasEOLN (FIO_File f);
/*
ReadChar - returns a character read from file, f.
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef struct IO__T1_a IO__T1;
struct IO_BasicFds_r {
- unsigned int IsEof;
- unsigned int IsRaw;
+ bool IsEof;
+ bool IsRaw;
};
struct IO__T1_a { IO_BasicFds array[MaxDefaultFd+1]; };
*/
extern "C" void IO_Error (char ch);
-extern "C" void IO_UnBufferedMode (int fd, unsigned int input);
-extern "C" void IO_BufferedMode (int fd, unsigned int input);
+extern "C" void IO_UnBufferedMode (int fd, bool input);
+extern "C" void IO_BufferedMode (int fd, bool input);
/*
EchoOn - turns on echoing for file descriptor, fd. This
which is attached to a particular piece of hardware.
*/
-extern "C" void IO_EchoOn (int fd, unsigned int input);
+extern "C" void IO_EchoOn (int fd, bool input);
/*
EchoOff - turns off echoing for file descriptor, fd. This
which is attached to a particular piece of hardware.
*/
-extern "C" void IO_EchoOff (int fd, unsigned int input);
+extern "C" void IO_EchoOff (int fd, bool input);
/*
IsDefaultFd - returns TRUE if, fd, is 0, 1 or 2.
*/
-static unsigned int IsDefaultFd (int fd);
+static bool IsDefaultFd (int fd);
/*
doWrite - performs the write of a single character, ch,
setFlag - sets or unsets the appropriate flag in, t.
*/
-static void setFlag (termios_TERMIOS t, termios_Flag f, unsigned int b);
+static void setFlag (termios_TERMIOS t, termios_Flag f, bool b);
/*
doraw - sets all the flags associated with making this
IsDefaultFd - returns TRUE if, fd, is 0, 1 or 2.
*/
-static unsigned int IsDefaultFd (int fd)
+static bool IsDefaultFd (int fd)
{
return (fd <= MaxDefaultFd) && (fd >= 0);
/* static analysis guarentees a RETURN statement will be used before here. */
r = errno_geterrno ();
if ((r != errno_EAGAIN) && (r != errno_EINTR))
{
- fdState.array[fd].IsEof = TRUE;
+ fdState.array[fd].IsEof = true;
return ;
}
}
setFlag - sets or unsets the appropriate flag in, t.
*/
-static void setFlag (termios_TERMIOS t, termios_Flag f, unsigned int b)
+static void setFlag (termios_TERMIOS t, termios_Flag f, bool b)
{
if (termios_SetFlag (t, f, b))
{} /* empty. */
* termios_p->c_cflag &= ~(CSIZE | PARENB);
* termios_p->c_cflag |= CS8;
*/
- setFlag (term, termios_ignbrk, FALSE);
- setFlag (term, termios_ibrkint, FALSE);
- setFlag (term, termios_iparmrk, FALSE);
- setFlag (term, termios_istrip, FALSE);
- setFlag (term, termios_inlcr, FALSE);
- setFlag (term, termios_igncr, FALSE);
- setFlag (term, termios_icrnl, FALSE);
- setFlag (term, termios_ixon, FALSE);
- setFlag (term, termios_opost, FALSE);
- setFlag (term, termios_lecho, FALSE);
- setFlag (term, termios_lechonl, FALSE);
- setFlag (term, termios_licanon, FALSE);
- setFlag (term, termios_lisig, FALSE);
- setFlag (term, termios_liexten, FALSE);
- setFlag (term, termios_parenb, FALSE);
- setFlag (term, termios_cs8, TRUE);
+ setFlag (term, termios_ignbrk, false);
+ setFlag (term, termios_ibrkint, false);
+ setFlag (term, termios_iparmrk, false);
+ setFlag (term, termios_istrip, false);
+ setFlag (term, termios_inlcr, false);
+ setFlag (term, termios_igncr, false);
+ setFlag (term, termios_icrnl, false);
+ setFlag (term, termios_ixon, false);
+ setFlag (term, termios_opost, false);
+ setFlag (term, termios_lecho, false);
+ setFlag (term, termios_lechonl, false);
+ setFlag (term, termios_licanon, false);
+ setFlag (term, termios_lisig, false);
+ setFlag (term, termios_liexten, false);
+ setFlag (term, termios_parenb, false);
+ setFlag (term, termios_cs8, true);
}
* termios_p->c_cflag &= ~(CSIZE | PARENB);
* termios_p->c_cflag |= CS8;
*/
- setFlag (term, termios_ignbrk, TRUE);
- setFlag (term, termios_ibrkint, TRUE);
- setFlag (term, termios_iparmrk, TRUE);
- setFlag (term, termios_istrip, TRUE);
- setFlag (term, termios_inlcr, TRUE);
- setFlag (term, termios_igncr, TRUE);
- setFlag (term, termios_icrnl, TRUE);
- setFlag (term, termios_ixon, TRUE);
- setFlag (term, termios_opost, TRUE);
- setFlag (term, termios_lecho, TRUE);
- setFlag (term, termios_lechonl, TRUE);
- setFlag (term, termios_licanon, TRUE);
- setFlag (term, termios_lisig, TRUE);
- setFlag (term, termios_liexten, TRUE);
+ setFlag (term, termios_ignbrk, true);
+ setFlag (term, termios_ibrkint, true);
+ setFlag (term, termios_iparmrk, true);
+ setFlag (term, termios_istrip, true);
+ setFlag (term, termios_inlcr, true);
+ setFlag (term, termios_igncr, true);
+ setFlag (term, termios_icrnl, true);
+ setFlag (term, termios_ixon, true);
+ setFlag (term, termios_opost, true);
+ setFlag (term, termios_lecho, true);
+ setFlag (term, termios_lechonl, true);
+ setFlag (term, termios_licanon, true);
+ setFlag (term, termios_lisig, true);
+ setFlag (term, termios_liexten, true);
}
static void Init (void)
{
- fdState.array[0].IsEof = FALSE;
- fdState.array[0].IsRaw = FALSE;
- fdState.array[1].IsEof = FALSE;
- fdState.array[1].IsRaw = FALSE;
- fdState.array[2].IsEof = FALSE;
- fdState.array[2].IsRaw = FALSE;
+ fdState.array[0].IsEof = false;
+ fdState.array[0].IsRaw = false;
+ fdState.array[1].IsEof = false;
+ fdState.array[1].IsRaw = false;
+ fdState.array[2].IsEof = false;
+ fdState.array[2].IsRaw = false;
}
r = errno_geterrno ();
if (r != errno_EAGAIN)
{
- fdState.array[0].IsEof = TRUE;
+ fdState.array[0].IsEof = true;
(*ch) = ASCII_eof;
return ;
}
doWrite (2, FIO_StdErr, ch);
}
-extern "C" void IO_UnBufferedMode (int fd, unsigned int input)
+extern "C" void IO_UnBufferedMode (int fd, bool input)
{
termios_TERMIOS term;
int result;
if (IsDefaultFd (fd))
{
- fdState.array[fd].IsRaw = TRUE;
+ fdState.array[fd].IsRaw = true;
}
term = termios_InitTermios ();
if ((termios_tcgetattr (fd, term)) == 0)
term = termios_KillTermios (term);
}
-extern "C" void IO_BufferedMode (int fd, unsigned int input)
+extern "C" void IO_BufferedMode (int fd, bool input)
{
termios_TERMIOS term;
int r;
if (IsDefaultFd (fd))
{
- fdState.array[fd].IsRaw = FALSE;
+ fdState.array[fd].IsRaw = false;
}
term = termios_InitTermios ();
if ((termios_tcgetattr (fd, term)) == 0)
which is attached to a particular piece of hardware.
*/
-extern "C" void IO_EchoOn (int fd, unsigned int input)
+extern "C" void IO_EchoOn (int fd, bool input)
{
termios_TERMIOS term;
int result;
term = termios_InitTermios ();
if ((termios_tcgetattr (fd, term)) == 0)
{
- setFlag (term, termios_lecho, TRUE);
+ setFlag (term, termios_lecho, true);
if (input)
{
result = termios_tcsetattr (fd, termios_tcsflush (), term);
which is attached to a particular piece of hardware.
*/
-extern "C" void IO_EchoOff (int fd, unsigned int input)
+extern "C" void IO_EchoOff (int fd, bool input)
{
termios_TERMIOS term;
int result;
term = termios_InitTermios ();
if ((termios_tcgetattr (fd, term)) == 0)
{
- setFlag (term, termios_lecho, FALSE);
+ setFlag (term, termios_lecho, false);
if (input)
{
result = termios_tcsetattr (fd, termios_tcsflush (), term);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
UnBufferedMode - places file descriptor, fd, into an unbuffered mode.
*/
-EXTERN void IO_UnBufferedMode (int fd, unsigned int input);
+EXTERN void IO_UnBufferedMode (int fd, bool input);
/*
BufferedMode - places file descriptor, fd, into a buffered mode.
*/
-EXTERN void IO_BufferedMode (int fd, unsigned int input);
+EXTERN void IO_BufferedMode (int fd, bool input);
/*
EchoOn - turns on echoing for file descriptor, fd. This
which is attached to a particular piece of hardware.
*/
-EXTERN void IO_EchoOn (int fd, unsigned int input);
+EXTERN void IO_EchoOn (int fd, bool input);
/*
EchoOff - turns off echoing for file descriptor, fd. This
which is attached to a particular piece of hardware.
*/
-EXTERN void IO_EchoOff (int fd, unsigned int input);
+EXTERN void IO_EchoOff (int fd, bool input);
# ifdef __cplusplus
}
# endif
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
unsigned int Used;
unsigned int Low;
unsigned int High;
- unsigned int Debug;
+ bool Debug;
unsigned int Map;
};
of the dynamic array.
*/
-extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n);
+extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n);
/*
HighIndice - returns the last legally accessible indice of this array.
IsIndiceInIndex - returns TRUE if, a, is in the index, i.
*/
-extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a);
+extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a);
/*
RemoveIndiceFromIndex - removes, a, from Index, i.
i->ArraySize = MinSize;
Storage_ALLOCATE (&i->ArrayStart, MinSize);
i->ArrayStart = libc_memset (i->ArrayStart, 0, static_cast<size_t> (i->ArraySize));
- i->Debug = FALSE;
+ i->Debug = false;
i->Used = 0;
i->Map = (unsigned int) 0;
return i;
extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i)
{
- i->Debug = TRUE;
+ i->Debug = true;
return i;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
of the dynamic array.
*/
-extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n)
+extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n)
{
if (i == NULL)
{
IsIndiceInIndex - returns TRUE if, a, is in the index, i.
*/
-extern "C" unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a)
+extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a)
{
unsigned int j;
Indexing_PtrToByte b;
p = (Indexing_PtrToAddress) (b);
if ((*p) == a)
{
- return TRUE;
+ return true;
}
/* we must not INC(p, ..) as p2c gets confused */
b += sizeof (void *);
j += 1;
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
extern "C" void Indexing_RemoveIndiceFromIndex (Indexing_Index i, void * a)
{
unsigned int j;
- unsigned int k;
Indexing_PtrToAddress p;
Indexing_PtrToByte b;
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
of the dynamic array.
*/
-EXTERN unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n);
+EXTERN bool Indexing_InBounds (Indexing_Index i, unsigned int n);
/*
HighIndice - returns the last legally accessible indice of this array.
IsIndiceInIndex - returns TRUE if, a, is in the index, i.
*/
-EXTERN unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a);
+EXTERN bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a);
/*
RemoveIndiceFromIndex - removes, a, from Index, i.
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
IsItemInList - returns true if a WORD, c, was found in list, l.
*/
-extern "C" unsigned int Lists_IsItemInList (Lists_List l, unsigned int c);
+extern "C" bool Lists_IsItemInList (Lists_List l, unsigned int c);
/*
ForeachItemInListDo - calls procedure, P, foreach item in list, l.
{
Lists_List p;
unsigned int i;
- unsigned int Found;
+ bool Found;
if (l != NULL)
{
- Found = FALSE;
+ Found = false;
p = NULL;
do {
i = 1;
}
if ((i <= l->NoOfElements) && (l->Elements.array[i-1] == c))
{
- Found = TRUE;
+ Found = true;
}
else
{
IsItemInList - returns true if a WORD, c, was found in list, l.
*/
-extern "C" unsigned int Lists_IsItemInList (Lists_List l, unsigned int c)
+extern "C" bool Lists_IsItemInList (Lists_List l, unsigned int c)
{
unsigned int i;
{
if (l->Elements.array[i-1] == c)
{
- return TRUE;
+ return true;
}
else
{
}
l = l->Next;
} while (! (l == NULL));
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
IsItemInList - returns true if a WORD, c, was found in list, l.
*/
-EXTERN unsigned int Lists_IsItemInList (Lists_List l, unsigned int c);
+EXTERN bool Lists_IsItemInList (Lists_List l, unsigned int c);
/*
ForeachItemInListDo - calls procedure, P, foreach item in list, l.
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
#define _M2Dependent_C
# include "Glibc.h"
-# include "GM2LINK.h"
# include "GASCII.h"
# include "GSYSTEM.h"
# include "GStorage.h"
typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList;
+typedef char *M2Dependent_PtrToChar;
+
typedef struct M2Dependent__T2_r M2Dependent__T2;
typedef M2Dependent__T2 *M2Dependent_ModuleChain;
struct M2Dependent_DependencyList_r {
PROC proc;
- unsigned int forced;
- unsigned int forc;
- unsigned int appl;
+ bool forced;
+ bool forc;
+ bool appl;
M2Dependent_DependencyState state;
};
};
static M2Dependent__T3 Modules;
-static unsigned int Initialized;
-static unsigned int WarningTrace;
-static unsigned int ModuleTrace;
-static unsigned int HexTrace;
-static unsigned int DependencyTrace;
-static unsigned int PreTrace;
-static unsigned int PostTrace;
-static unsigned int ForceTrace;
+static bool DynamicInitialization;
+static bool Initialized;
+static bool WarningTrace;
+static bool ModuleTrace;
+static bool HexTrace;
+static bool DependencyTrace;
+static bool PreTrace;
+static bool PostTrace;
+static bool ForceTrace;
/*
ConstructModules - resolve dependencies and then call each
module constructor in turn.
*/
-extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
/*
DeconstructModules - resolve dependencies and then call each
/*
RequestDependant - used to specify that modulename is dependant upon
module dependantmodule. It only takes effect
- if we are not using StaticInitialization.
+ if we are using DynamicInitialization.
*/
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
onChain - returns TRUE if mptr is on the Modules[state] list.
*/
-static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr);
+static bool onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr);
/*
max -
We cannot use Builtins.def during bootstrap.
*/
-static int strcmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b);
+static int strcmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b);
/*
strncmp - return 0 if both strings are equal.
We cannot use Builtins.def during bootstrap.
*/
-static int strncmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b, unsigned int n);
+static int strncmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b, unsigned int n);
/*
strlen - returns the length of string.
*/
-static int strlen_ (M2LINK_PtrToChar string);
+static int strlen_ (M2Dependent_PtrToChar string);
/*
traceprintf - wrap printf with a boolean flag.
*/
-static void traceprintf (unsigned int flag, const char *str_, unsigned int _str_high);
+static void traceprintf (bool flag, const char *str_, unsigned int _str_high);
/*
traceprintf2 - wrap printf with a boolean flag.
*/
-static void traceprintf2 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg);
+static void traceprintf2 (bool flag, const char *str_, unsigned int _str_high, void * arg);
/*
traceprintf3 - wrap printf with a boolean flag.
*/
-static void traceprintf3 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2);
+static void traceprintf3 (bool flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2);
/*
moveTo - moves mptr to the new list determined by newstate.
DumpModuleData -
*/
-static void DumpModuleData (unsigned int flag);
+static void DumpModuleData (bool flag);
/*
combine - dest := src + dest. Places src at the front of list dest.
tracemodule -
*/
-static void tracemodule (unsigned int flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen);
+static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen);
/*
ForceModule -
the dynamic ordering with the preference.
*/
-static void ForceDependencies (void);
+static void ForceDependencies (void * overrideliborder);
/*
CheckApplication - check to see that the application is the last entry in the list.
equal - return TRUE if C string cstr is equal to str.
*/
-static unsigned int equal (void * cstr, const char *str_, unsigned int _str_high);
+static bool equal (void * cstr, const char *str_, unsigned int _str_high);
/*
SetupDebugFlags - By default assigns ModuleTrace, DependencyTrace,
static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Dependent_ArgCVEnvP init, M2Dependent_ArgCVEnvP fini, PROC dependencies)
{
M2Dependent_ModuleChain mptr;
- void * p0;
- void * p1;
Storage_ALLOCATE ((void **) &mptr, sizeof (M2Dependent__T2));
mptr->name = name;
onChain - returns TRUE if mptr is on the Modules[state] list.
*/
-static unsigned int onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr)
+static bool onChain (M2Dependent_DependencyState state, M2Dependent_ModuleChain mptr)
{
M2Dependent_ModuleChain ptr;
do {
if (ptr == mptr)
{
- return TRUE;
+ return true;
}
ptr = ptr->next;
} while (! (ptr == Modules.array[state-M2Dependent_unregistered]));
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
{
ptr = Modules.array[state-M2Dependent_unregistered];
do {
- if (((strncmp (reinterpret_cast<M2LINK_PtrToChar> (ptr->name), reinterpret_cast<M2LINK_PtrToChar> (name), max (namelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (ptr->name)))))) == 0) && ((strncmp (reinterpret_cast<M2LINK_PtrToChar> (ptr->libname), reinterpret_cast<M2LINK_PtrToChar> (libname), max (libnamelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (ptr->libname)))))) == 0))
+ if (((strncmp (reinterpret_cast<M2Dependent_PtrToChar> (ptr->name), reinterpret_cast<M2Dependent_PtrToChar> (name), max (namelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (ptr->name)))))) == 0) && ((strncmp (reinterpret_cast<M2Dependent_PtrToChar> (ptr->libname), reinterpret_cast<M2Dependent_PtrToChar> (libname), max (libnamelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (ptr->libname)))))) == 0))
{
return ptr;
}
static M2Dependent_ModuleChain LookupModule (M2Dependent_DependencyState state, void * name, void * libname)
{
- return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (name))), libname, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2LINK_PtrToChar> (libname))));
+ return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (name))), libname, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (libname))));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
We cannot use Builtins.def during bootstrap.
*/
-static int strcmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b)
+static int strcmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b)
{
if ((a != NULL) && (b != NULL))
{
We cannot use Builtins.def during bootstrap.
*/
-static int strncmp (M2LINK_PtrToChar a, M2LINK_PtrToChar b, unsigned int n)
+static int strncmp (M2Dependent_PtrToChar a, M2Dependent_PtrToChar b, unsigned int n)
{
if (n == 0)
{
strlen - returns the length of string.
*/
-static int strlen_ (M2LINK_PtrToChar string)
+static int strlen_ (M2Dependent_PtrToChar string)
{
int count;
traceprintf - wrap printf with a boolean flag.
*/
-static void traceprintf (unsigned int flag, const char *str_, unsigned int _str_high)
+static void traceprintf (bool flag, const char *str_, unsigned int _str_high)
{
char str[_str_high+1];
traceprintf2 - wrap printf with a boolean flag.
*/
-static void traceprintf2 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg)
+static void traceprintf2 (bool flag, const char *str_, unsigned int _str_high, void * arg)
{
char ch;
char str[_str_high+1];
traceprintf3 - wrap printf with a boolean flag.
*/
-static void traceprintf3 (unsigned int flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2)
+static void traceprintf3 (bool flag, const char *str_, unsigned int _str_high, void * arg1, void * arg2)
{
char ch;
char str[_str_high+1];
DumpModuleData -
*/
-static void DumpModuleData (unsigned int flag)
+static void DumpModuleData (bool flag)
{
- M2Dependent_ModuleChain mptr;
-
if (flag)
{
DisplayModuleInfo (M2Dependent_unregistered, (const char *) "unregistered", 12);
tracemodule -
*/
-static void tracemodule (unsigned int flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen)
+static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen)
{
typedef struct tracemodule__T4_a tracemodule__T4;
mptr = LookupModuleN (M2Dependent_ordered, modname, modlen, libname, liblen);
if (mptr != NULL)
{
- mptr->dependency.forced = TRUE;
+ mptr->dependency.forced = true;
moveTo (M2Dependent_user, mptr);
}
}
the dynamic ordering with the preference.
*/
-static void ForceDependencies (void)
+static void ForceDependencies (void * overrideliborder)
{
unsigned int len;
unsigned int modlen;
unsigned int liblen;
- M2LINK_PtrToChar modname;
- M2LINK_PtrToChar libname;
- M2LINK_PtrToChar pc;
- M2LINK_PtrToChar start;
+ M2Dependent_PtrToChar modname;
+ M2Dependent_PtrToChar libname;
+ M2Dependent_PtrToChar pc;
+ M2Dependent_PtrToChar start;
- if (M2LINK_ForcedModuleInitOrder != NULL)
+ if (overrideliborder != NULL)
{
- traceprintf2 (ForceTrace, (const char *) "user forcing order: %s\\n", 24, reinterpret_cast<void *> (M2LINK_ForcedModuleInitOrder));
- pc = M2LINK_ForcedModuleInitOrder;
+ traceprintf2 (ForceTrace, (const char *) "user forcing order: %s\\n", 24, overrideliborder);
+ pc = static_cast<M2Dependent_PtrToChar> (overrideliborder);
start = pc;
len = 0;
modname = NULL;
equal - return TRUE if C string cstr is equal to str.
*/
-static unsigned int equal (void * cstr, const char *str_, unsigned int _str_high)
+static bool equal (void * cstr, const char *str_, unsigned int _str_high)
{
char str[_str_high+1];
/* make a local copy of each unbounded array. */
memcpy (str, str_, _str_high+1);
- return (strncmp (reinterpret_cast<M2LINK_PtrToChar> (cstr), reinterpret_cast<M2LINK_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
+ return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
SetupDebugFlags__T1 pc;
- ModuleTrace = FALSE;
- DependencyTrace = FALSE;
- PostTrace = FALSE;
- PreTrace = FALSE;
- ForceTrace = FALSE;
- HexTrace = FALSE;
- WarningTrace = FALSE;
+ ModuleTrace = false;
+ DependencyTrace = false;
+ PostTrace = false;
+ PreTrace = false;
+ ForceTrace = false;
+ HexTrace = false;
+ WarningTrace = false;
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))
{
- ModuleTrace = TRUE;
- DependencyTrace = TRUE;
- PreTrace = TRUE;
- PostTrace = TRUE;
- ForceTrace = TRUE;
- HexTrace = TRUE;
- WarningTrace = TRUE;
+ ModuleTrace = true;
+ DependencyTrace = true;
+ PreTrace = true;
+ PostTrace = true;
+ ForceTrace = true;
+ HexTrace = true;
+ WarningTrace = true;
pc += 3;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "module", 6))
{
/* avoid dangling else. */
- ModuleTrace = TRUE;
+ ModuleTrace = true;
pc += 6;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "warning", 7))
{
/* avoid dangling else. */
- WarningTrace = TRUE;
+ WarningTrace = true;
pc += 7;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "hex", 3))
{
/* avoid dangling else. */
- HexTrace = TRUE;
+ HexTrace = true;
pc += 3;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "dep", 3))
{
/* avoid dangling else. */
- DependencyTrace = TRUE;
+ DependencyTrace = true;
pc += 3;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "pre", 3))
{
/* avoid dangling else. */
- PreTrace = TRUE;
+ PreTrace = true;
pc += 3;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "post", 4))
{
/* avoid dangling else. */
- PostTrace = TRUE;
+ PostTrace = true;
pc += 4;
}
else if (equal (reinterpret_cast<void *> (pc), (const char *) "force", 5))
{
/* avoid dangling else. */
- ForceTrace = TRUE;
+ ForceTrace = true;
pc += 5;
}
else
{
Modules.array[state-M2Dependent_unregistered] = NULL;
}
+ DynamicInitialization = false;
}
{
if (! Initialized)
{
- Initialized = TRUE;
+ Initialized = true;
Init ();
}
}
module constructor in turn.
*/
-extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp)
+extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp)
{
M2Dependent_ModuleChain mptr;
- M2Dependent_ArgCVEnvP nulp;
CheckInitialized ();
- traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, applicationmodule, libname);
+ DynamicInitialization = true; /* This procedure is only called if we desire dynamic initialization. */
+ traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, applicationmodule, libname); /* This procedure is only called if we desire dynamic initialization. */
mptr = LookupModule (M2Dependent_unordered, applicationmodule, libname);
if (mptr != NULL)
{
- mptr->dependency.appl = TRUE;
+ mptr->dependency.appl = true;
}
traceprintf (PreTrace, (const char *) "Pre resolving dependents\\n", 26);
DumpModuleData (PreTrace);
ResolveDependencies (applicationmodule, libname);
traceprintf (PreTrace, (const char *) "Post resolving dependents\\n", 27);
DumpModuleData (PostTrace);
- ForceDependencies ();
+ ForceDependencies (overrideliborder);
traceprintf (ForceTrace, (const char *) "After user forcing ordering\\n", 29);
DumpModuleData (ForceTrace);
CheckApplication ();
M2Dependent_ModuleChain mptr;
CheckInitialized ();
- if (! M2LINK_StaticInitialization)
+ mptr = LookupModule (M2Dependent_unordered, modulename, libname);
+ if (mptr == NULL)
{
- mptr = LookupModule (M2Dependent_unordered, modulename, libname);
- if (mptr == NULL)
- {
- traceprintf3 (ModuleTrace, (const char *) "module: %s [%s] registering", 27, modulename, libname);
- moveTo (M2Dependent_unordered, CreateModule (modulename, libname, init, fini, dependencies));
- traceprintf (ModuleTrace, (const char *) "\\n", 2);
- }
- else
- {
- warning3 ((const char *) "module: %s [%s] (ignoring duplicate registration)\\n", 51, modulename, libname);
- }
+ traceprintf3 (ModuleTrace, (const char *) "module: %s [%s] registering", 27, modulename, libname);
+ moveTo (M2Dependent_unordered, CreateModule (modulename, libname, init, fini, dependencies));
+ traceprintf (ModuleTrace, (const char *) "\\n", 2);
+ }
+ else
+ {
+ warning3 ((const char *) "module: %s [%s] (ignoring duplicate registration)\\n", 51, modulename, libname);
}
}
/*
RequestDependant - used to specify that modulename is dependant upon
module dependantmodule. It only takes effect
- if we are not using StaticInitialization.
+ if we are using DynamicInitialization.
*/
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname)
{
CheckInitialized ();
- if (! M2LINK_StaticInitialization)
- {
- PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname);
- }
+ PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname);
}
extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
#if !defined (_M2Dependent_H)
# define _M2Dependent_H
+#include "config.h"
+#include "system.h"
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef void (*M2Dependent_ArgCVEnvP_t) (int, void *, void *);
struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; };
-EXTERN void M2Dependent_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+EXTERN void M2Dependent_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
EXTERN void M2Dependent_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
/*
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions;
extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void);
-extern "C" unsigned int M2EXCEPTION_IsM2Exception (void);
+extern "C" bool M2EXCEPTION_IsM2Exception (void);
extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
{
__builtin_unreachable ();
}
-extern "C" unsigned int M2EXCEPTION_IsM2Exception (void)
+extern "C" bool M2EXCEPTION_IsM2Exception (void)
{
RTExceptions_EHBlock e;
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions;
EXTERN M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void);
-EXTERN unsigned int M2EXCEPTION_IsM2Exception (void);
+EXTERN bool M2EXCEPTION_IsM2Exception (void);
# ifdef __cplusplus
}
# endif
+++ /dev/null
-/* GM2LINK.c a handwritten module for mc.
-
-Copyright (C) 2022-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaiusmod2@gmail.com>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GNU Modula-2 is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Modula-2; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-/* mc currently is built using a static scaffold. */
-
-#include <cstddef>
-
-int M2LINK_StaticInitialization = 1;
-char *M2LINK_ForcedModuleInitOrder = NULL;
+++ /dev/null
-/* do not edit automatically generated by mc from M2LINK. */
-/* M2LINK.def defines the linking mode used in Modula-2.
-
-Copyright (C) 2022-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GNU Modula-2 is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-
-#if !defined (_M2LINK_H)
-# define _M2LINK_H
-
-#include "config.h"
-#include "system.h"
-# ifdef __cplusplus
-extern "C" {
-# endif
-# if !defined (PROC_D)
-# define PROC_D
- typedef void (*PROC_t) (void);
- typedef struct { PROC_t proc; } PROC;
-# endif
-
-
-# if defined (_M2LINK_C)
-# define EXTERN
-# else
-# define EXTERN extern
-# endif
-
-typedef char *M2LINK_PtrToChar;
-
-EXTERN M2LINK_PtrToChar M2LINK_ForcedModuleInitOrder;
-EXTERN unsigned int M2LINK_StaticInitialization;
-# ifdef __cplusplus
-}
-# endif
-
-# undef EXTERN
-#endif
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
static M2RTS_ProcedureList InitialProc;
static M2RTS_ProcedureList TerminateProc;
static int ExitValue;
-static unsigned int isHalting;
-static unsigned int CallExit;
-static unsigned int Initialized;
+static bool isHalting;
+static bool CallExit;
+static bool Initialized;
/*
ConstructModules - resolve dependencies and then call each
module constructor in turn.
*/
-extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
/*
DeconstructModules - resolve dependencies and then call each
procedure is installed.
*/
-extern "C" unsigned int M2RTS_InstallTerminationProcedure (PROC p);
+extern "C" bool M2RTS_InstallTerminationProcedure (PROC p);
/*
ExecuteInitialProcedures - executes the initial procedures installed by
main program module.
*/
-extern "C" unsigned int M2RTS_InstallInitialProcedure (PROC p);
+extern "C" bool M2RTS_InstallInitialProcedure (PROC p);
/*
ExecuteTerminationProcedures - calls each installed termination procedure
to stderr and calls exit (1).
*/
-extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high);
+extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line);
/*
HaltC - provides a more user friendly version of HALT, which takes
to stderr and calls exit (1).
*/
-extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description);
+extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line);
/*
ExitOnHalt - if HALT is executed then call exit with the exit code, e.
defined by proclist.
*/
-static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc);
+static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc);
/*
ErrorString - writes a string to stderr.
defined by proclist.
*/
-static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc)
+static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc)
{
M2RTS_ProcedureChain pdes;
(*proclist).head = pdes;
}
(*proclist).tail = pdes;
- return TRUE;
+ return true;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
InitProcList (&InitialProc);
InitProcList (&TerminateProc);
ExitValue = 0;
- isHalting = FALSE;
- CallExit = FALSE; /* default by calling abort */
+ isHalting = false;
+ CallExit = false; /* default by calling abort */
}
{
if (! Initialized)
{
- Initialized = TRUE;
+ Initialized = true;
Init ();
}
}
module constructor in turn.
*/
-extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp)
+extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp)
{
- M2Dependent_ConstructModules (applicationmodule, libname, argc, argv, envp);
+ M2Dependent_ConstructModules (applicationmodule, libname, overrideliborder, argc, argv, envp);
}
procedure is installed.
*/
-extern "C" unsigned int M2RTS_InstallTerminationProcedure (PROC p)
+extern "C" bool M2RTS_InstallTerminationProcedure (PROC p)
{
return AppendProc (&TerminateProc, p);
/* static analysis guarentees a RETURN statement will be used before here. */
main program module.
*/
-extern "C" unsigned int M2RTS_InstallInitialProcedure (PROC p)
+extern "C" bool M2RTS_InstallInitialProcedure (PROC p)
{
return AppendProc (&InitialProc, p);
/* static analysis guarentees a RETURN statement will be used before here. */
{
if (exitcode != -1)
{
- CallExit = TRUE;
+ CallExit = true;
ExitValue = exitcode;
}
if (isHalting)
}
else
{
- isHalting = TRUE;
+ isHalting = true;
M2RTS_ExecuteTerminationProcedures ();
}
if (CallExit)
to stderr and calls exit (1).
*/
-extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high)
+extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line)
{
+ char description[_description_high+1];
char filename[_filename_high+1];
char function[_function_high+1];
- char description[_description_high+1];
/* make a local copy of each unbounded array. */
+ memcpy (description, description_, _description_high+1);
memcpy (filename, filename_, _filename_high+1);
memcpy (function, function_, _function_high+1);
- memcpy (description, description_, _description_high+1);
M2RTS_ErrorMessage ((const char *) description, _description_high, (const char *) filename, _filename_high, line, (const char *) function, _function_high);
}
to stderr and calls exit (1).
*/
-extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description)
+extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line)
{
ErrorMessageC (description, filename, line, function);
}
extern "C" void M2RTS_ExitOnHalt (int e)
{
ExitValue = e;
- CallExit = TRUE;
+ CallExit = true;
}
#if !defined (_M2RTS_H)
# define _M2RTS_H
+#include "config.h"
+#include "system.h"
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
+EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
EXTERN void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
/*
procedure is installed.
*/
-EXTERN unsigned int M2RTS_InstallTerminationProcedure (PROC p);
+EXTERN bool M2RTS_InstallTerminationProcedure (PROC p);
/*
ExecuteInitialProcedures - executes the initial procedures installed
program module.
*/
-EXTERN unsigned int M2RTS_InstallInitialProcedure (PROC p);
+EXTERN bool M2RTS_InstallInitialProcedure (PROC p);
/*
ExecuteTerminationProcedures - calls each installed termination procedure
to stderr and calls exit (1).
*/
-EXTERN void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn));
+EXTERN void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line) __attribute__ ((noreturn));
/*
HaltC - provides a more user friendly version of HALT, which takes
to stderr and calls exit (1).
*/
-EXTERN void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description) __attribute__ ((noreturn));
+EXTERN void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line) __attribute__ ((noreturn));
/*
ExitOnHalt - if HALT is executed then call exit with the exit code, e.
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
converting, a, into a String, for speed.
*/
-extern "C" unsigned int NameKey_IsKey (const char *a_, unsigned int _a_high);
+extern "C" bool NameKey_IsKey (const char *a_, unsigned int _a_high);
/*
KeyToCharStar - returns the C char * string equivalent for, key.
This function deliberately inlines CAP for speed.
*/
-extern "C" unsigned int NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2);
+extern "C" bool NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2);
/*
KeyToCharStar - returns the C char * string equivalent for, key.
converting, a, into a String, for speed.
*/
-extern "C" unsigned int NameKey_IsKey (const char *a_, unsigned int _a_high)
+extern "C" bool NameKey_IsKey (const char *a_, unsigned int _a_high)
{
NameKey_NameNode child;
NameKey_PtrToChar p;
/* avoid gcc warning by using compound statement even if not strictly necessary. */
if ((*p) == ASCII_nul)
{
- return TRUE;
+ return true;
}
else
{
}
} while (! (child == NULL));
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
This function deliberately inlines CAP for speed.
*/
-extern "C" unsigned int NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2)
+extern "C" bool NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2)
{
NameKey_PtrToChar pi;
NameKey_PtrToChar pj;
if (key1 == key2)
{
- return TRUE;
+ return true;
}
else
{
else
{
/* difference found */
- return FALSE;
+ return false;
}
}
return c1 == c2;
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
IsKey - returns TRUE if string, a, is currently a key.
*/
-EXTERN unsigned int NameKey_IsKey (const char *a_, unsigned int _a_high);
+EXTERN bool NameKey_IsKey (const char *a_, unsigned int _a_high);
/*
WriteKey - Display the symbol represented by Key.
the same. It is case insensitive.
*/
-EXTERN unsigned int NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2);
+EXTERN bool NameKey_IsSameExcludingCase (NameKey_Name key1, NameKey_Name key2);
/*
KeyToCharStar - returns the C char * string equivalent for, key.
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
extern "C" void NumberIO_StrToCard (const char *a_, unsigned int _a_high, unsigned int *x)
{
unsigned int i;
- unsigned int ok;
+ bool ok;
unsigned int higha;
char a[_a_high+1];
StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high);
higha = StrLib_StrLen ((const char *) a, _a_high);
i = 0;
- ok = TRUE;
+ ok = true;
while (ok)
{
if (i < higha)
}
else
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
}
(*x) = 0;
if (i < higha)
{
- ok = TRUE;
+ ok = true;
do {
(*x) = (10*(*x))+( ((unsigned int) (a[i]))- ((unsigned int) ('0')));
if (i < higha)
i += 1;
if ((a[i] < '0') || (a[i] > '9'))
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
} while (! (! ok));
}
unsigned int c;
unsigned int Higha;
IntToStr__T9 buf;
- unsigned int Negative;
+ bool Negative;
if (x < 0)
{
/* avoid dangling else. */
- Negative = TRUE;
+ Negative = true;
c = ((unsigned int ) (abs (x+1)))+1;
if (n > 0)
{
else
{
c = x;
- Negative = FALSE;
+ Negative = false;
}
i = 0;
do {
extern "C" void NumberIO_StrToInt (const char *a_, unsigned int _a_high, int *x)
{
unsigned int i;
- unsigned int ok;
- unsigned int Negative;
+ bool ok;
+ bool Negative;
unsigned int higha;
char a[_a_high+1];
StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high);
higha = StrLib_StrLen ((const char *) a, _a_high);
i = 0;
- Negative = FALSE;
- ok = TRUE;
+ Negative = false;
+ ok = true;
while (ok)
{
if (i < higha)
else
{
/* avoid dangling else. */
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
}
(*x) = 0;
if (i < higha)
{
- ok = TRUE;
+ ok = true;
do {
if (Negative)
{
i += 1;
if ((a[i] < '0') || (a[i] > '9'))
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
} while (! (! ok));
}
extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int *x)
{
unsigned int i;
- unsigned int ok;
+ bool ok;
unsigned int higha;
char a[_a_high+1];
StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high);
higha = StrLib_StrLen ((const char *) a, _a_high);
i = 0;
- ok = TRUE;
+ ok = true;
while (ok)
{
if (i < higha)
}
else
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
}
(*x) = 0;
if (i < higha)
{
- ok = TRUE;
+ ok = true;
do {
(*x) = (2*(*x))+((int ) ( ((unsigned int) (a[i]))- ((unsigned int) ('0'))));
if (i < higha)
i += 1;
if ((a[i] < '0') || (a[i] > '1'))
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
} while (! (! ok));
}
extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int *x)
{
unsigned int i;
- unsigned int ok;
+ bool ok;
unsigned int higha;
char a[_a_high+1];
StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high);
higha = StrLib_StrLen ((const char *) a, _a_high);
i = 0;
- ok = TRUE;
+ ok = true;
while (ok)
{
if (i < higha)
{
if (((a[i] >= '0') && (a[i] <= '9')) || ((a[i] >= 'A') && (a[i] <= 'F')))
{
- ok = FALSE;
+ ok = false;
}
else
{
}
else
{
- ok = FALSE;
+ ok = false;
}
}
(*x) = 0;
if (i < higha)
{
- ok = TRUE;
+ ok = true;
do {
if ((a[i] >= '0') && (a[i] <= '9'))
{
i += 1;
if (((a[i] < '0') || (a[i] > '9')) && ((a[i] < 'A') || (a[i] > 'F')))
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
} while (! (! ok));
}
extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int *x)
{
unsigned int i;
- unsigned int ok;
+ bool ok;
unsigned int higha;
char a[_a_high+1];
StrLib_StrRemoveWhitePrefix ((const char *) a, _a_high, (char *) a, _a_high);
higha = StrLib_StrLen ((const char *) a, _a_high);
i = 0;
- ok = TRUE;
+ ok = true;
while (ok)
{
if (i < higha)
}
else
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
}
(*x) = 0;
if (i < higha)
{
- ok = TRUE;
+ ok = true;
do {
(*x) = (8*(*x))+((int ) ( ((unsigned int) (a[i]))- ((unsigned int) ('0'))));
if (i < higha)
i += 1;
if ((a[i] < '0') || (a[i] > '7'))
{
- ok = FALSE;
+ ok = false;
}
}
else
{
- ok = FALSE;
+ ok = false;
}
} while (! (! ok));
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# include "GASCII.h"
# include "GDynamicStrings.h"
-static unsigned int stdout_;
+static bool stdout_;
static FIO_File outputFile;
static DynamicStrings_String buffer;
TRUE is returned if success, FALSE otherwise.
*/
-extern "C" unsigned int Output_Open (const char *filename_, unsigned int _filename_high);
+extern "C" bool Output_Open (const char *filename_, unsigned int _filename_high);
/*
Close - close the output file.
TRUE is returned if success, FALSE otherwise.
*/
-extern "C" unsigned int Output_Open (const char *filename_, unsigned int _filename_high)
+extern "C" bool Output_Open (const char *filename_, unsigned int _filename_high)
{
char filename[_filename_high+1];
if ((StrLib_StrEqual ((const char *) filename, _filename_high, (const char *) "<stdout>", 8)) || (StrLib_StrEqual ((const char *) filename, _filename_high, (const char *) "-", 1)))
{
outputFile = FIO_StdOut;
- stdout_ = TRUE;
- return TRUE;
+ stdout_ = true;
+ return true;
}
else
{
outputFile = FIO_OpenToWrite ((const char *) filename, _filename_high);
- stdout_ = FALSE;
+ stdout_ = false;
return FIO_IsNoError (outputFile);
}
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" void _M2_Output_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
- stdout_ = TRUE;
+ stdout_ = true;
buffer = static_cast<DynamicStrings_String> (NULL);
outputFile = FIO_StdOut;
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
TRUE is returned if success, FALSE otherwise.
*/
-EXTERN unsigned int Output_Open (const char *filename_, unsigned int _filename_high);
+EXTERN bool Output_Open (const char *filename_, unsigned int _filename_high);
/*
Close - close the output file.
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
static unsigned int Column;
static unsigned int StackPtr;
static unsigned int LineNo;
-static unsigned int Debugging;
+static bool Debugging;
/*
Open - opens a file for reading.
SetDebug - sets the debug flag on or off.
*/
-extern "C" void PushBackInput_SetDebug (unsigned int d);
+extern "C" void PushBackInput_SetDebug (bool d);
/*
GetColumnPosition - returns the column position of the current character.
}
else
{
- Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54);
+ Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutCh", 5, 151);
}
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 *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54);
+ Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132);
}
}
}
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 *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54);
+ Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113);
}
}
}
SetDebug - sets the debug flag on or off.
*/
-extern "C" void PushBackInput_SetDebug (unsigned int d)
+extern "C" void PushBackInput_SetDebug (bool d)
{
Debugging = d;
}
extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
- PushBackInput_SetDebug (FALSE);
+ PushBackInput_SetDebug (false);
Init ();
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
SetDebug - sets the debug flag on or off.
*/
-EXTERN void PushBackInput_SetDebug (unsigned int d);
+EXTERN void PushBackInput_SetDebug (bool d);
/*
GetColumnPosition - returns the column position of the current character.
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
RTExceptions_Handler stack;
};
-static unsigned int inException;
+static bool inException;
static RTExceptions_Handler freeHandler;
static RTExceptions_EHBlock freeEHB;
static RTExceptions_EHBlock currentEHB;
in the exception state.
*/
-extern "C" unsigned int RTExceptions_IsInExceptionState (void);
+extern "C" bool RTExceptions_IsInExceptionState (void);
/*
SetExceptionState - returns the current exception state and
to.
*/
-extern "C" unsigned int RTExceptions_SetExceptionState (unsigned int to);
+extern "C" bool RTExceptions_SetExceptionState (bool to);
/*
SwitchExceptionState - assigns, from, with the current exception
to, to.
*/
-extern "C" void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to);
+extern "C" void RTExceptions_SwitchExceptionState (bool *from, bool to);
/*
GetBaseExceptionBlock - returns the initial language exception block
static void indexf (void * a)
{
- RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 613, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 614, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 625, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 626, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 637, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 638, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 649, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 650, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 661, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 662, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 673, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 674, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 685, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 686, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 697, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 698, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 709, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 710, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 721, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 722, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 733, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 734, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 745, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 746, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 757, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 758, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 769, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 770, 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*>("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 781, 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-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
}
static void Init (void)
{
- inException = FALSE;
+ inException = false;
freeHandler = NULL;
freeEHB = NULL;
currentEHB = RTExceptions_InitExceptionBlock ();
extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int number)
{
RTExceptions_Handler h;
- RTExceptions_Handler i;
h = findHandler (e, number);
if (h != NULL)
in the exception state.
*/
-extern "C" unsigned int RTExceptions_IsInExceptionState (void)
+extern "C" bool RTExceptions_IsInExceptionState (void)
{
return inException;
/* static analysis guarentees a RETURN statement will be used before here. */
to.
*/
-extern "C" unsigned int RTExceptions_SetExceptionState (unsigned int to)
+extern "C" bool RTExceptions_SetExceptionState (bool to)
{
- unsigned int old;
+ bool old;
old = inException;
inException = to;
to, to.
*/
-extern "C" void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to)
+extern "C" void RTExceptions_SwitchExceptionState (bool *from, bool to)
{
(*from) = inException;
inException = to;
{
if (currentEHB == NULL)
{
- M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, 599, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39);
+ M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, (const char *) "GetBaseExceptionBlock", 21, 600);
}
else
{
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
and message in the EHBlock for later use.
*/
-EXTERN void RTExceptions_Raise (unsigned int number, void * file, unsigned int line, unsigned int column, void * function, void * message);
+EXTERN void RTExceptions_Raise (unsigned int number, void * file, unsigned int line, unsigned int column, void * function, void * message) __attribute__ ((noreturn));
/*
SetExceptionBlock - sets, source, as the active EHB.
in the exception state.
*/
-EXTERN unsigned int RTExceptions_IsInExceptionState (void);
+EXTERN bool RTExceptions_IsInExceptionState (void);
/*
SetExceptionState - returns the current exception state and
to.
*/
-EXTERN unsigned int RTExceptions_SetExceptionState (unsigned int to);
+EXTERN bool RTExceptions_SetExceptionState (bool to);
/*
SwitchExceptionState - assigns, from, with the current exception
to, to.
*/
-EXTERN void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to);
+EXTERN void RTExceptions_SwitchExceptionState (bool *from, bool to);
/*
GetBaseExceptionBlock - returns the initial language exception block
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
new string, otherwise s is set to NIL.
*/
-EXTERN unsigned int SArgs_GetArg (DynamicStrings_String *s, unsigned int n);
+EXTERN bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n);
/*
Narg - returns the number of arguments available from
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
the processes environment.
*/
-EXTERN unsigned int SEnvironment_GetEnvironment (DynamicStrings_String Env, DynamicStrings_String *dest);
+EXTERN bool SEnvironment_GetEnvironment (DynamicStrings_String Env, DynamicStrings_String *dest);
/*
PutEnvironment - change or add an environment variable definition EnvDef.
set or changed successfully.
*/
-EXTERN unsigned int SEnvironment_PutEnvironment (DynamicStrings_String EnvDef);
+EXTERN bool SEnvironment_PutEnvironment (DynamicStrings_String EnvDef);
# ifdef __cplusplus
}
# endif
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
Exists - returns TRUE if a file named, fname exists for reading.
*/
-extern "C" unsigned int SFIO_Exists (DynamicStrings_String fname);
+extern "C" bool SFIO_Exists (DynamicStrings_String fname);
/*
OpenToRead - attempts to open a file, fname, for reading and
and modify an existing file.
*/
-extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile);
+extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile);
/*
WriteS - writes a string, s, to, file. It returns the String, s.
Exists - returns TRUE if a file named, fname exists for reading.
*/
-extern "C" unsigned int SFIO_Exists (DynamicStrings_String fname)
+extern "C" bool SFIO_Exists (DynamicStrings_String fname)
{
return FIO_exists (DynamicStrings_string (fname), DynamicStrings_Length (fname));
/* static analysis guarentees a RETURN statement will be used before here. */
and modify an existing file.
*/
-extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile)
+extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile)
{
return FIO_openForRandom (DynamicStrings_string (fname), DynamicStrings_Length (fname), towrite, newfile);
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file)
{
DynamicStrings_String s;
- unsigned int c;
s = DynamicStrings_InitString ((const char *) "", 0);
while (((! (FIO_EOLN (file))) && (! (FIO_EOF (file)))) && (FIO_IsNoError (file)))
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
Exists - returns TRUE if a file named, fname exists for reading.
*/
-EXTERN unsigned int SFIO_Exists (DynamicStrings_String fname);
+EXTERN bool SFIO_Exists (DynamicStrings_String fname);
/*
OpenToRead - attempts to open a file, fname, for reading and
and modify an existing file.
*/
-EXTERN FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, unsigned int towrite, unsigned int newfile);
+EXTERN FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile);
/*
WriteS - writes a string, s, to, file. It returns the String, s.
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
/*
OpenSource - opens a source file for reading. */
-EXTERN unsigned int Scan_OpenSource (const char *a_, unsigned int _a_high);
+EXTERN bool Scan_OpenSource (const char *a_, unsigned int _a_high);
/*
CloseSource - closes the current source file from reading. */
are allowed.
*/
-EXTERN void Scan_DefineComments (const char *Start_, unsigned int _Start_high, const char *End_, unsigned int _End_high, unsigned int eoln);
+EXTERN void Scan_DefineComments (const char *Start_, unsigned int _Start_high, const char *End_, unsigned int _End_high, bool eoln);
# ifdef __cplusplus
}
# endif
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size);
extern "C" void Storage_DEALLOCATE (void * *a, unsigned int Size);
extern "C" void Storage_REALLOCATE (void * *a, unsigned int Size);
-extern "C" unsigned int Storage_Available (unsigned int Size);
+extern "C" bool Storage_Available (unsigned int Size);
extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size)
{
SysStorage_REALLOCATE (a, Size);
}
-extern "C" unsigned int Storage_Available (unsigned int Size)
+extern "C" bool Storage_Available (unsigned int Size)
{
return SysStorage_Available (Size);
/* static analysis guarentees a RETURN statement will be used before here. */
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
Available - returns TRUE if, Size, bytes can be allocated.
*/
-EXTERN unsigned int Storage_Available (unsigned int Size);
+EXTERN bool Storage_Available (unsigned int Size);
# ifdef __cplusplus
}
# endif
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# include "GStdIO.h"
# include "Glibc.h"
-static unsigned int IsATTY;
+static bool IsATTY;
/*
WriteLn - writes a carriage return and a newline
AlphaNum- returns true if character, ch, is an alphanumeric character.
*/
-static unsigned int AlphaNum (char ch);
+static bool AlphaNum (char ch);
/*
AlphaNum- returns true if character, ch, is an alphanumeric character.
*/
-static unsigned int AlphaNum (char ch)
+static bool AlphaNum (char ch)
{
return (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))) || ((ch >= '0') && (ch <= '9'));
/* static analysis guarentees a RETURN statement will be used before here. */
extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
/* IsATTY := isatty() */
- IsATTY = FALSE;
+ IsATTY = false;
}
extern "C" void _M2_StrIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
string, b.
*/
-extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
-extern "C" unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
+extern "C" bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
+extern "C" bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
extern "C" unsigned int StrLib_StrLen (const char *a_, unsigned int _a_high);
/*
IsSubString - returns true if b is a subcomponent of a.
*/
-extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
+extern "C" bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
/*
StrRemoveWhitePrefix - copies string, into string, b, excluding any white
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch);
+static bool IsWhite (char ch);
/*
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch)
+static bool IsWhite (char ch)
{
return (ch == ' ') || (ch == ASCII_tab);
/* static analysis guarentees a RETURN statement will be used before here. */
string, b.
*/
-extern "C" unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high)
+extern "C" bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high)
{
unsigned int Higha;
unsigned int Highb;
{
if (a[i] < b[i])
{
- return TRUE;
+ return true;
}
else if (a[i] > b[i])
{
/* avoid dangling else. */
- return FALSE;
+ return false;
}
/* must be equal, move on to next character */
i += 1;
__builtin_unreachable ();
}
-extern "C" unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high)
+extern "C" bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high)
{
unsigned int i;
unsigned int higha;
{
if (a[i] != b[i])
{
- return FALSE;
+ return false;
}
i += 1;
}
IsSubString - returns true if b is a subcomponent of a.
*/
-extern "C" unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high)
+extern "C" bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high)
{
unsigned int i;
unsigned int j;
}
if (j == LengthB)
{
- return TRUE;
+ return true;
}
else
{
}
}
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
string, b.
*/
-EXTERN unsigned int StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
+EXTERN bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
/*
StrEqual - performs a = b on two strings.
*/
-EXTERN unsigned int StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
+EXTERN bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
/*
StrLen - returns the length of string, a.
IsSubString - returns true if b is a subcomponent of a.
*/
-EXTERN unsigned int StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
+EXTERN bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
/*
StrRemoveWhitePrefix - copies string, into string, b, excluding any white
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
abcdef are used, and if FALSE then ABCDEF are used.
*/
-EXTERN DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower);
+EXTERN DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower);
/*
CardinalToString - converts CARDINAL, c, into a String. The field
abcdef are used, and if FALSE then ABCDEF are used.
*/
-EXTERN DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower);
+EXTERN DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, bool lower);
/*
StringToInteger - converts a string, s, of, base, into an INTEGER.
The parameter found is set TRUE if a number was found.
*/
-EXTERN int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, unsigned int *found);
+EXTERN int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, bool *found);
/*
StringToCardinal - converts a string, s, of, base, into a CARDINAL.
The parameter found is set TRUE if a number was found.
*/
-EXTERN unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found);
+EXTERN unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, bool *found);
/*
LongIntegerToString - converts LONGINT, i, into a String. The field with
abcdef are used, and if FALSE then ABCDEF are used.
*/
-EXTERN DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, unsigned int sign, unsigned int base, unsigned int lower);
+EXTERN DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower);
/*
StringToLongInteger - converts a string, s, of, base, into an LONGINT.
The parameter found is set TRUE if a number was found.
*/
-EXTERN long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, unsigned int *found);
+EXTERN long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, bool *found);
/*
LongCardinalToString - converts LONGCARD, c, into a String. The field
abcdef are used, and if FALSE then ABCDEF are used.
*/
-EXTERN DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower);
+EXTERN DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, bool lower);
/*
StringToLongCardinal - converts a string, s, of, base, into a LONGCARD.
The parameter found is set TRUE if a number was found.
*/
-EXTERN long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found);
+EXTERN long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, bool *found);
/*
ShortCardinalToString - converts SHORTCARD, c, into a String. The field
abcdef are used, and if FALSE then ABCDEF are used.
*/
-EXTERN DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, unsigned int lower);
+EXTERN DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, bool lower);
/*
StringToShortCardinal - converts a string, s, of, base, into a SHORTCARD.
The parameter found is set TRUE if a number was found.
*/
-EXTERN short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, unsigned int *found);
+EXTERN short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, bool *found);
/*
stoi - decimal string to INTEGER
itos - integer to decimal string.
*/
-EXTERN DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, unsigned int sign);
+EXTERN DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, bool sign);
/*
ctos - cardinal to decimal string.
if a legal number is seen.
*/
-EXTERN long double StringConvert_StringToLongreal (DynamicStrings_String s, unsigned int *found);
+EXTERN long double StringConvert_StringToLongreal (DynamicStrings_String s, bool *found);
/*
LongrealToString - converts a LONGREAL number, Real, which has,
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef SymbolKey_Node *SymbolKey_SymbolTree;
-typedef unsigned int (*SymbolKey_IsSymbol_t) (unsigned int);
+typedef bool (*SymbolKey_IsSymbol_t) (unsigned int);
struct SymbolKey_IsSymbol_p { SymbolKey_IsSymbol_t proc; };
typedef void (*SymbolKey_PerformOperation_t) (unsigned int);
IsEmptyTree - returns true if SymbolTree, t, is empty.
*/
-extern "C" unsigned int SymbolKey_IsEmptyTree (SymbolKey_SymbolTree t);
+extern "C" bool SymbolKey_IsEmptyTree (SymbolKey_SymbolTree t);
/*
DoesTreeContainAny - returns true if SymbolTree, t, contains any
Left, hence we need two procedures.
*/
-extern "C" unsigned int SymbolKey_DoesTreeContainAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P);
+extern "C" bool SymbolKey_DoesTreeContainAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P);
/*
ForeachNodeDo - for each node in SymbolTree, t, a procedure, P,
ContainsSymKey - return TRUE if tree, t, contains an entry for, NameKey.
*/
-extern "C" unsigned int SymbolKey_ContainsSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKey);
+extern "C" bool SymbolKey_ContainsSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKey);
/*
NoOfNodes - returns the number of nodes in the tree t.
therefore we must skip over it.
*/
-static unsigned int SearchForAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P);
+static bool SearchForAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P);
/*
SearchAndDo - searches all the nodes in SymbolTree, t, and
(*parent) = t;
if (t == NULL)
{
- Debug_Halt ((const char *) "parameter t should never be NIL", 31, 240, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54);
+ Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "FindNodeParentInTree", 20, 241);
}
Assertion_Assert (t->Right == NULL);
(*child) = t->Left;
therefore we must skip over it.
*/
-static unsigned int SearchForAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P)
+static bool SearchForAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P)
{
if (t == NULL)
{
- return FALSE;
+ return false;
}
else
{
}
else
{
- Debug_Halt ((const char *) "symbol already stored", 21, 156, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54);
+ Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "PutSymKey", 9, 156);
}
}
}
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 *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54);
+ Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "DelSymKey", 9, 223);
}
}
IsEmptyTree - returns true if SymbolTree, t, is empty.
*/
-extern "C" unsigned int SymbolKey_IsEmptyTree (SymbolKey_SymbolTree t)
+extern "C" bool SymbolKey_IsEmptyTree (SymbolKey_SymbolTree t)
{
return t->Left == NULL;
/* static analysis guarentees a RETURN statement will be used before here. */
Left, hence we need two procedures.
*/
-extern "C" unsigned int SymbolKey_DoesTreeContainAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P)
+extern "C" bool SymbolKey_DoesTreeContainAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P)
{
return SearchForAny (t->Left, P);
/* static analysis guarentees a RETURN statement will be used before here. */
ContainsSymKey - return TRUE if tree, t, contains an entry for, NameKey.
*/
-extern "C" unsigned int SymbolKey_ContainsSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKey)
+extern "C" bool SymbolKey_ContainsSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKey)
{
SymbolKey_SymbolTree father;
SymbolKey_SymbolTree child;
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
typedef struct SymbolKey_PerformOperation_p SymbolKey_PerformOperation;
-typedef unsigned int (*SymbolKey_IsSymbol_t) (unsigned int);
+typedef bool (*SymbolKey_IsSymbol_t) (unsigned int);
struct SymbolKey_IsSymbol_p { SymbolKey_IsSymbol_t proc; };
typedef void (*SymbolKey_PerformOperation_t) (unsigned int);
IsEmptyTree - returns true if SymbolTree, t, is empty.
*/
-EXTERN unsigned int SymbolKey_IsEmptyTree (SymbolKey_SymbolTree t);
+EXTERN bool SymbolKey_IsEmptyTree (SymbolKey_SymbolTree t);
/*
DoesTreeContainAny - returns true if SymbolTree, t, contains any
P, is called with a symbol as its parameter.
*/
-EXTERN unsigned int SymbolKey_DoesTreeContainAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P);
+EXTERN bool SymbolKey_DoesTreeContainAny (SymbolKey_SymbolTree t, SymbolKey_IsSymbol P);
/*
ForeachNodeDo - for each node in SymbolTree, t, a procedure, P,
ContainsSymKey - return TRUE if tree, t, contains an entry for, NameKey.
*/
-EXTERN unsigned int SymbolKey_ContainsSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKey);
+EXTERN bool SymbolKey_ContainsSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKey);
/*
NoOfNodes - returns the number of nodes in the tree t.
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# include "GDebug.h"
# include "GSYSTEM.h"
-# define enableDeallocation TRUE
-# define enableZero FALSE
-# define enableTrace FALSE
+# define enableDeallocation true
+# define enableZero true
+# define enableTrace false
static unsigned int callno;
-static unsigned int zero;
-static unsigned int trace;
+static bool zero;
+static bool trace;
extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size);
extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size);
is resized accordingly.
*/
-extern "C" unsigned int SysStorage_Available (unsigned int size);
+extern "C" bool SysStorage_Available (unsigned int size);
/*
Init - initializes the heap. This does nothing on a GNU/Linux system.
(*a) = libc_malloc (static_cast<size_t> (size));
if ((*a) == NULL)
{
- Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51);
+ Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "ALLOCATE", 8, 51);
}
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 *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51);
+ Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "DEALLOCATE", 10, 78);
}
}
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 *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51);
+ Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "REALLOCATE", 10, 122);
}
if (enableTrace && trace)
{
is resized accordingly.
*/
-extern "C" unsigned int SysStorage_Available (unsigned int size)
+extern "C" bool SysStorage_Available (unsigned int size)
{
void * a;
{
libc_printf ((const char *) " no\\n", 7, size);
}
- return FALSE;
+ return false;
}
else
{
libc_printf ((const char *) " yes\\n", 8, size);
}
libc_free (a);
- return TRUE;
+ return true;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
else
{
- trace = FALSE;
+ trace = false;
}
if (enableZero)
{
}
else
{
- zero = FALSE;
+ zero = false;
}
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
Available - returns TRUE if, size, bytes can be allocated.
*/
-EXTERN unsigned int SysStorage_Available (unsigned int size);
+EXTERN bool SysStorage_Available (unsigned int size);
/*
Init - initializes the heap.
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
static SymbolKey_SymbolTree ReservedWords;
static NameKey_Name CurrentToken;
static bnflex_TokenType CurrentType;
-static unsigned int Debugging;
-static unsigned int InQuote;
+static bool Debugging;
+static bool InQuote;
static char QuoteChar;
/*
The success of the operation is returned.
*/
-extern "C" unsigned int bnflex_OpenSource (const char *a_, unsigned int _a_high);
+extern "C" bool bnflex_OpenSource (const char *a_, unsigned int _a_high);
/*
CloseSource - Closes the current open file.
and true is returned, otherwise false is returned.
*/
-extern "C" unsigned int bnflex_SymIs (bnflex_TokenType t);
+extern "C" bool bnflex_SymIs (bnflex_TokenType t);
/*
IsSym - returns the result of the comparison between the current token
type and t.
*/
-extern "C" unsigned int bnflex_IsSym (bnflex_TokenType t);
+extern "C" bool bnflex_IsSym (bnflex_TokenType t);
/*
GetCurrentTokenType - returns the type of current token.
IsReserved - returns TRUE if the name is a reserved word.
*/
-extern "C" unsigned int bnflex_IsReserved (NameKey_Name name);
+extern "C" bool bnflex_IsReserved (NameKey_Name name);
/*
PushBackToken - pushes a token back onto input.
SetDebugging - sets the debugging flag.
*/
-extern "C" void bnflex_SetDebugging (unsigned int flag);
+extern "C" void bnflex_SetDebugging (bool flag);
/*
EatChar - consumes the next character in the input.
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch);
+static bool IsWhite (char ch);
/*
SkipComments - consumes comments.
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch)
+static bool IsWhite (char ch)
{
return ((ch == ' ') || (ch == ASCII_tab)) || (ch == ASCII_lf);
/* static analysis guarentees a RETURN statement will be used before here. */
Init__T1 a;
SymbolKey_InitTree (&ReservedWords);
- Debugging = FALSE;
+ Debugging = false;
a.array[0] = ASCII_nul;
SymbolKey_PutSymKey (ReservedWords, NameKey_MakeKey ((const char *) &a.array[0], 1), ((unsigned int) (bnflex_eoftok)));
SymbolKey_PutSymKey (ReservedWords, NameKey_MakeKey ((const char *) "%", 1), ((unsigned int) (bnflex_codetok)));
SymbolKey_PutSymKey (ReservedWords, NameKey_MakeKey ((const char *) "FNB", 3), ((unsigned int) (bnflex_FNBtok)));
CurrentToken = NameKey_NulName;
CurrentType = bnflex_identtok;
- InQuote = FALSE;
+ InQuote = false;
}
The success of the operation is returned.
*/
-extern "C" unsigned int bnflex_OpenSource (const char *a_, unsigned int _a_high)
+extern "C" bool bnflex_OpenSource (const char *a_, unsigned int _a_high)
{
char a[_a_high+1];
and true is returned, otherwise false is returned.
*/
-extern "C" unsigned int bnflex_SymIs (bnflex_TokenType t)
+extern "C" bool bnflex_SymIs (bnflex_TokenType t)
{
if (CurrentType == t)
{
bnflex_AdvanceToken ();
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
type and t.
*/
-extern "C" unsigned int bnflex_IsSym (bnflex_TokenType t)
+extern "C" bool bnflex_IsSym (bnflex_TokenType t)
{
return t == CurrentType;
/* static analysis guarentees a RETURN statement will be used before here. */
if ((bnflex_PutChar (bnflex_GetChar ())) == QuoteChar)
{
a.array[i] = bnflex_GetChar ();
- InQuote = FALSE;
+ InQuote = false;
i += 1;
a.array[i] = ASCII_nul;
CurrentToken = NameKey_MakeKey ((const char *) &a.array[0], MaxNameLength);
{
PushBackInput_WarnError ((const char *) "missing ' at the end of a literal", 33);
}
- InQuote = FALSE; /* to avoid a contineous list of the same error message */
+ InQuote = false; /* to avoid a contineous list of the same error message */
}
}
else
{
PushBackInput_WarnError ((const char *) "missing ' at the end of a literal", 33);
}
- InQuote = FALSE; /* to avoid a contineous list of the same error message */
+ InQuote = false; /* to avoid a contineous list of the same error message */
}
}
}
a.array[i] = bnflex_GetChar ();
QuoteChar = a.array[i];
i += 1;
- InQuote = TRUE;
+ InQuote = true;
a.array[i] = ASCII_nul;
CurrentToken = NameKey_MakeKey ((const char *) &a.array[0], MaxNameLength);
CurrentType = (bnflex_TokenType) (SymbolKey_GetSymKey (ReservedWords, CurrentToken));
IsReserved - returns TRUE if the name is a reserved word.
*/
-extern "C" unsigned int bnflex_IsReserved (NameKey_Name name)
+extern "C" bool bnflex_IsReserved (NameKey_Name name)
{
return (SymbolKey_GetSymKey (ReservedWords, name)) != 0;
/* static analysis guarentees a RETURN statement will be used before here. */
SetDebugging - sets the debugging flag.
*/
-extern "C" void bnflex_SetDebugging (unsigned int flag)
+extern "C" void bnflex_SetDebugging (bool flag)
{
Debugging = flag;
}
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
The success of the operation is returned.
*/
-EXTERN unsigned int bnflex_OpenSource (const char *a_, unsigned int _a_high);
+EXTERN bool bnflex_OpenSource (const char *a_, unsigned int _a_high);
/*
CloseSource - Closes the current open file.
and true is returned, otherwise false is returned.
*/
-EXTERN unsigned int bnflex_SymIs (bnflex_TokenType t);
+EXTERN bool bnflex_SymIs (bnflex_TokenType t);
/*
IsSym - returns the result of the comparison between the current token
type and t.
*/
-EXTERN unsigned int bnflex_IsSym (bnflex_TokenType t);
+EXTERN bool bnflex_IsSym (bnflex_TokenType t);
/*
GetCurrentTokenType - returns the type of current token.
IsReserved - returns TRUE if the name is a reserved word.
*/
-EXTERN unsigned int bnflex_IsReserved (NameKey_Name name);
+EXTERN bool bnflex_IsReserved (NameKey_Name name);
/*
PushBackToken - pushes a token back onto input.
SetDebugging - sets the debugging flag.
*/
-EXTERN void bnflex_SetDebugging (unsigned int flag);
+EXTERN void bnflex_SetDebugging (bool flag);
# ifdef __cplusplus
}
# endif
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
error to TRUE if the number is too large.
*/
-EXTERN double dtoa_strtod (void * s, unsigned int *error);
+EXTERN double dtoa_strtod (void * s, bool *error);
/*
dtoa - converts a REAL, d, into a string. The address of the
sign does the string have a sign?
*/
-EXTERN void * dtoa_dtoa (double d, dtoa_Mode mode, int ndigits, int *decpt, unsigned int *sign);
+EXTERN void * dtoa_dtoa (double d, dtoa_Mode mode, int ndigits, int *decpt, bool *sign);
# ifdef __cplusplus
}
# endif
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
error to TRUE if the number is too large or badly formed.
*/
-EXTERN long double ldtoa_strtold (void * s, unsigned int *error);
+EXTERN long double ldtoa_strtold (void * s, bool *error);
/*
ldtoa - converts a LONGREAL, d, into a string. The address of the
sign does the string have a sign?
*/
-EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, unsigned int *sign);
+EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, bool *sign);
# ifdef __cplusplus
}
# endif
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
EXTERN void * libc_memmove (void * dest, void * src, size_t size);
EXTERN int libc_printf (const char *format_, unsigned int _format_high, ...);
-EXTERN int libc_snprintf (void *dest, size_t length, const char *format_, unsigned int _format_high, ...);
+EXTERN int libc_snprintf (void * dest, size_t size, const char *format_, unsigned int _format_high, ...);
/*
setenv - sets environment variable, name, to value.
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
# define MaxCodeHunkLength 8192
# define MaxFileName 8192
# define MaxString 8192
-# define DefaultRecovery TRUE
+# define DefaultRecovery true
# define MaxElementsInSet 32
# define BaseRightLimit 75
# define BaseRightMargin 50
pge_ProductionDesc next;
pge_StatementDesc statement;
pge_SetDesc first;
- unsigned int firstsolved;
+ bool firstsolved;
pge_FollowDesc followinfo;
unsigned int line;
NameKey_Name description;
};
struct pge__T6_r {
- unsigned int calcfollow;
+ bool calcfollow;
pge_SetDesc follow;
pge_TraverseResult reachend;
pge_TraverseResult epsilon;
};
static unsigned int LastLineNo;
-static unsigned int Finished;
-static unsigned int SuppressFileLineTag;
-static unsigned int KeywordFormatting;
-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 bool Finished;
+static bool SuppressFileLineTag;
+static bool KeywordFormatting;
+static bool PrettyPrint;
+static bool EmitCode;
+static bool Texinfo;
+static bool Sphinx;
+static bool FreeDocLicense;
+static bool Debugging;
+static bool WasNoError;
static unsigned int LinePrologue;
static unsigned int LineEpilogue;
static unsigned int LineDeclaration;
static NameKey_Name ErrorProcString;
static pge__T11 ArgName;
static pge__T11 FileName;
-static unsigned int OnLineStart;
-static unsigned int BeginningOfLine;
+static bool OnLineStart;
+static bool BeginningOfLine;
static unsigned int Indent;
-static unsigned int EmittedVar;
-static unsigned int ErrorRecovery;
+static bool EmittedVar;
+static bool ErrorRecovery;
static unsigned int LargestValue;
-static unsigned int InitialElement;
+static bool InitialElement;
static unsigned int ParametersUsed;
/*
providing condition is TRUE.
*/
-static void AssignEpsilon (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
+static void AssignEpsilon (bool condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetEpsilon - returns the value of epsilon
AssignReachEnd - assigns the reachend value providing that, condition, is TRUE.
*/
-static void AssignReachEnd (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
+static void AssignReachEnd (bool condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetReachEnd - returns the value of reachend
CheckWrite -
*/
-static void CheckWrite (char ch, unsigned int *curpos, unsigned int left, unsigned int *seentext);
+static void CheckWrite (char ch, unsigned int *curpos, unsigned int left, bool *seentext);
/*
WriteStringIndent - writes a string but it will try and remove upto indent spaces
if they exist.
*/
-static void WriteStringIndent (const char *a_, unsigned int _a_high, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext);
+static void WriteStringIndent (const char *a_, unsigned int _a_high, unsigned int indent, unsigned int *curpos, unsigned int left, bool *seentext);
/*
WriteCodeHunkListIndent - writes the CodeHunk list in the correct order
but it removes up to indent spaces if they exist.
*/
-static void WriteCodeHunkListIndent (pge_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, bool *seentext);
/*
Add - adds a character to a code hunk and creates another code hunk if necessary.
CodeElseEnd - builds an ELSE END statement using string, end.
*/
-static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
+static void CodeElseEnd (const char *end_, unsigned int _end_high, bool consumed, pge_FactorDesc f, bool inopt);
/*
CodeEnd - codes a "END" depending upon, m.
*/
-static void CodeEnd (pge_m2condition m, pge_TermDesc t, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
+static void CodeEnd (pge_m2condition m, pge_TermDesc t, bool consumed, pge_FactorDesc f, bool inopt);
/*
EmitNonVarCode - writes out, code, providing it is not a variable declaration.
CodeFactor -
*/
-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);
+static void CodeFactor (pge_FactorDesc f, pge_TermDesc t, pge_m2condition l, pge_m2condition n, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack);
/*
CodeTerm -
*/
-static void CodeTerm (pge_TermDesc t, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
+static void CodeTerm (pge_TermDesc t, pge_m2condition m, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack);
/*
CodeExpression -
*/
-static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
+static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack);
/*
CodeStatement -
and FALSE in the first.
*/
-static unsigned int OptExpSeen (pge_FactorDesc f);
+static bool OptExpSeen (pge_FactorDesc f);
/*
RecoverTerm -
EmitStopParameters - generate the stop set.
*/
-static void EmitStopParameters (unsigned int FormalParameters);
+static void EmitStopParameters (bool FormalParameters);
/*
IsBetween - returns TRUE if the value of the token, string, is
in the range: low..high
*/
-static unsigned int IsBetween (NameKey_Name string, unsigned int low, unsigned int high);
+static bool IsBetween (NameKey_Name string, unsigned int low, unsigned int high);
/*
IsEmptySet - returns TRUE if no elements exist in set, to, with values, low..high.
*/
-static unsigned int IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high);
+static bool IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitSet - emits the tokens in the set, to, which have values low..high
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch);
+static bool IsWhite (char ch);
/*
FindStr - returns TRUE if, str, was seen inside the code hunk
*/
-static unsigned int FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
+static bool FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
/*
WriteUpto -
In - returns TRUE if token, s, is already in the set, to.
*/
-static unsigned int In (pge_SetDesc to, NameKey_Name s);
+static bool In (pge_SetDesc to, NameKey_Name s);
/*
IntersectionIsNil - given two set lists, s1, s2, return TRUE if the
s1 * s2 = {}
*/
-static unsigned int IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2);
+static bool IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2);
/*
AddSet - adds a first symbol to a production.
EmptyFactor -
*/
-static unsigned int EmptyFactor (pge_FactorDesc f);
+static bool EmptyFactor (pge_FactorDesc f);
/*
EmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int EmptyTerm (pge_TermDesc t);
+static bool EmptyTerm (pge_TermDesc t);
/*
EmptyExpression -
*/
-static unsigned int EmptyExpression (pge_ExpressionDesc e);
+static bool EmptyExpression (pge_ExpressionDesc e);
/*
EmptyStatement - returns TRUE if statement, s, is empty.
*/
-static unsigned int EmptyStatement (pge_StatementDesc s);
+static bool EmptyStatement (pge_StatementDesc s);
/*
EmptyProduction - returns if production, p, maybe empty.
*/
-static unsigned int EmptyProduction (pge_ProductionDesc p);
+static bool EmptyProduction (pge_ProductionDesc p);
/*
EmitFDLNotice -
OptionalFactor -
*/
-static unsigned int OptionalFactor (pge_FactorDesc f);
+static bool OptionalFactor (pge_FactorDesc f);
/*
OptionalTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int OptionalTerm (pge_TermDesc t);
+static bool OptionalTerm (pge_TermDesc t);
/*
OptionalExpression -
*/
-static unsigned int OptionalExpression (pge_ExpressionDesc e);
+static bool OptionalExpression (pge_ExpressionDesc e);
/*
OptionalStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int OptionalStatement (pge_StatementDesc s);
+static bool OptionalStatement (pge_StatementDesc s);
/*
OptionalProduction -
*/
-static unsigned int OptionalProduction (pge_ProductionDesc p);
+static bool OptionalProduction (pge_ProductionDesc p);
/*
CheckFirstFollow -
*/
-static unsigned int CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after);
+static bool CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after);
/*
ConstrainedEmptyFactor -
*/
-static unsigned int ConstrainedEmptyFactor (pge_FactorDesc f);
+static bool ConstrainedEmptyFactor (pge_FactorDesc f);
/*
ConstrainedEmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int ConstrainedEmptyTerm (pge_TermDesc t);
+static bool ConstrainedEmptyTerm (pge_TermDesc t);
/*
ConstrainedEmptyExpression -
*/
-static unsigned int ConstrainedEmptyExpression (pge_ExpressionDesc e);
+static bool ConstrainedEmptyExpression (pge_ExpressionDesc e);
/*
ConstrainedEmptyStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int ConstrainedEmptyStatement (pge_StatementDesc s);
+static bool ConstrainedEmptyStatement (pge_StatementDesc s);
/*
ConstrainedEmptyProduction - returns TRUE if a problem exists with, p.
*/
-static unsigned int ConstrainedEmptyProduction (pge_ProductionDesc p);
+static bool ConstrainedEmptyProduction (pge_ProductionDesc p);
/*
TestForLALR1 -
providing condition is TRUE.
*/
-static void AssignEpsilon (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
+static void AssignEpsilon (bool condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetEpsilon - returns the value of epsilon
AssignReachEnd - assigns the reachend value providing that, condition, is TRUE.
*/
-static void AssignReachEnd (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value);
+static void AssignReachEnd (bool condition, pge_FollowDesc f, pge_TraverseResult value);
/*
GetReachEnd - returns the value of reachend
CheckWrite -
*/
-static void CheckWrite (char ch, unsigned int *curpos, unsigned int left, unsigned int *seentext);
+static void CheckWrite (char ch, unsigned int *curpos, unsigned int left, bool *seentext);
/*
WriteStringIndent - writes a string but it will try and remove upto indent spaces
if they exist.
*/
-static void WriteStringIndent (const char *a_, unsigned int _a_high, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext);
+static void WriteStringIndent (const char *a_, unsigned int _a_high, unsigned int indent, unsigned int *curpos, unsigned int left, bool *seentext);
/*
WriteCodeHunkListIndent - writes the CodeHunk list in the correct order
but it removes up to indent spaces if they exist.
*/
-static void WriteCodeHunkListIndent (pge_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, bool *seentext);
/*
Add - adds a character to a code hunk and creates another code hunk if necessary.
CodeElseEnd - builds an ELSE END statement using string, end.
*/
-static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
+static void CodeElseEnd (const char *end_, unsigned int _end_high, bool consumed, pge_FactorDesc f, bool inopt);
/*
CodeEnd - codes a "END" depending upon, m.
*/
-static void CodeEnd (pge_m2condition m, pge_TermDesc t, unsigned int consumed, pge_FactorDesc f, unsigned int inopt);
+static void CodeEnd (pge_m2condition m, pge_TermDesc t, bool consumed, pge_FactorDesc f, bool inopt);
/*
EmitNonVarCode - writes out, code, providing it is not a variable declaration.
CodeFactor -
*/
-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);
+static void CodeFactor (pge_FactorDesc f, pge_TermDesc t, pge_m2condition l, pge_m2condition n, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack);
/*
CodeTerm -
*/
-static void CodeTerm (pge_TermDesc t, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
+static void CodeTerm (pge_TermDesc t, pge_m2condition m, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack);
/*
CodeExpression -
*/
-static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack);
+static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack);
/*
CodeStatement -
and FALSE in the first.
*/
-static unsigned int OptExpSeen (pge_FactorDesc f);
+static bool OptExpSeen (pge_FactorDesc f);
/*
RecoverTerm -
EmitStopParameters - generate the stop set.
*/
-static void EmitStopParameters (unsigned int FormalParameters);
+static void EmitStopParameters (bool FormalParameters);
/*
IsBetween - returns TRUE if the value of the token, string, is
in the range: low..high
*/
-static unsigned int IsBetween (NameKey_Name string, unsigned int low, unsigned int high);
+static bool IsBetween (NameKey_Name string, unsigned int low, unsigned int high);
/*
IsEmptySet - returns TRUE if no elements exist in set, to, with values, low..high.
*/
-static unsigned int IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high);
+static bool IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high);
/*
EmitSet - emits the tokens in the set, to, which have values low..high
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch);
+static bool IsWhite (char ch);
/*
FindStr - returns TRUE if, str, was seen inside the code hunk
*/
-static unsigned int FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
+static bool FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high);
/*
WriteUpto -
In - returns TRUE if token, s, is already in the set, to.
*/
-static unsigned int In (pge_SetDesc to, NameKey_Name s);
+static bool In (pge_SetDesc to, NameKey_Name s);
/*
IntersectionIsNil - given two set lists, s1, s2, return TRUE if the
s1 * s2 = {}
*/
-static unsigned int IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2);
+static bool IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2);
/*
AddSet - adds a first symbol to a production.
EmptyFactor -
*/
-static unsigned int EmptyFactor (pge_FactorDesc f);
+static bool EmptyFactor (pge_FactorDesc f);
/*
EmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int EmptyTerm (pge_TermDesc t);
+static bool EmptyTerm (pge_TermDesc t);
/*
EmptyExpression -
*/
-static unsigned int EmptyExpression (pge_ExpressionDesc e);
+static bool EmptyExpression (pge_ExpressionDesc e);
/*
EmptyStatement - returns TRUE if statement, s, is empty.
*/
-static unsigned int EmptyStatement (pge_StatementDesc s);
+static bool EmptyStatement (pge_StatementDesc s);
/*
EmptyProduction - returns if production, p, maybe empty.
*/
-static unsigned int EmptyProduction (pge_ProductionDesc p);
+static bool EmptyProduction (pge_ProductionDesc p);
/*
EmitFDLNotice -
OptionalFactor -
*/
-static unsigned int OptionalFactor (pge_FactorDesc f);
+static bool OptionalFactor (pge_FactorDesc f);
/*
OptionalTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int OptionalTerm (pge_TermDesc t);
+static bool OptionalTerm (pge_TermDesc t);
/*
OptionalExpression -
*/
-static unsigned int OptionalExpression (pge_ExpressionDesc e);
+static bool OptionalExpression (pge_ExpressionDesc e);
/*
OptionalStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int OptionalStatement (pge_StatementDesc s);
+static bool OptionalStatement (pge_StatementDesc s);
/*
OptionalProduction -
*/
-static unsigned int OptionalProduction (pge_ProductionDesc p);
+static bool OptionalProduction (pge_ProductionDesc p);
/*
CheckFirstFollow -
*/
-static unsigned int CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after);
+static bool CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after);
/*
ConstrainedEmptyFactor -
*/
-static unsigned int ConstrainedEmptyFactor (pge_FactorDesc f);
+static bool ConstrainedEmptyFactor (pge_FactorDesc f);
/*
ConstrainedEmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int ConstrainedEmptyTerm (pge_TermDesc t);
+static bool ConstrainedEmptyTerm (pge_TermDesc t);
/*
ConstrainedEmptyExpression -
*/
-static unsigned int ConstrainedEmptyExpression (pge_ExpressionDesc e);
+static bool ConstrainedEmptyExpression (pge_ExpressionDesc e);
/*
ConstrainedEmptyStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int ConstrainedEmptyStatement (pge_StatementDesc s);
+static bool ConstrainedEmptyStatement (pge_StatementDesc s);
/*
ConstrainedEmptyProduction - returns TRUE if a problem exists with, p.
*/
-static unsigned int ConstrainedEmptyProduction (pge_ProductionDesc p);
+static bool ConstrainedEmptyProduction (pge_ProductionDesc p);
/*
TestForLALR1 -
providing condition is TRUE.
*/
-static void AssignEpsilon (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value)
+static void AssignEpsilon (bool condition, pge_FollowDesc f, pge_TraverseResult value)
{
if ((condition && (value != pge_unknown)) && (f->epsilon == pge_unknown))
{
f->epsilon = value;
- Finished = FALSE;
+ Finished = false;
}
}
{
if (f == NULL)
{
- Debug_Halt ((const char *) "why is the follow info NIL?", 27, 596, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why is the follow info NIL?", 27, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "GetEpsilon", 10, 597);
}
else
{
AssignReachEnd - assigns the reachend value providing that, condition, is TRUE.
*/
-static void AssignReachEnd (unsigned int condition, pge_FollowDesc f, pge_TraverseResult value)
+static void AssignReachEnd (bool condition, pge_FollowDesc f, pge_TraverseResult value)
{
if (condition)
{
if ((f->reachend == pge_unknown) && (value != pge_unknown))
{
f->reachend = value;
- Finished = FALSE;
+ Finished = false;
}
}
}
{
if (f == NULL)
{
- Debug_Halt ((const char *) "why is the follow info NIL?", 27, 630, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why is the follow info NIL?", 27, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "GetReachEnd", 11, 632);
}
else
{
{
if (f->calcfollow)
{
- Debug_Halt ((const char *) "why are we reassigning this follow set?", 39, 646, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why are we reassigning this follow set?", 39, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "AssignFollow", 12, 649);
}
f->follow = s;
- f->calcfollow = TRUE;
+ f->calcfollow = true;
}
{
if (f == NULL)
{
- Debug_Halt ((const char *) "why is the follow info NIL?", 27, 662, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "why is the follow info NIL?", 27, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "GetFollow", 9, 666);
}
else
{
}
else
{
- Debug_Halt ((const char *) "not calculated the follow set yet..", 35, 669, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "not calculated the follow set yet..", 35, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "GetFollow", 9, 674);
}
}
ReturnException ("m2/gm2-auto/pge.mod", 1, 7);
p->next = NULL;
p->statement = NULL;
p->first = NULL;
- p->firstsolved = FALSE;
+ p->firstsolved = false;
p->followinfo = NewFollow ();
p->line = PushBackInput_GetCurrentLine ();
p->description = NameKey_NulName;
{
if (l != NULL)
{
- OnLineStart = FALSE;
+ OnLineStart = false;
/* recursion */
WriteCodeHunkList (l->next);
Output_WriteString ((const char *) &l->codetext.array[0], MaxCodeHunkLength);
Output_Write (' ');
n -= 1;
}
- OnLineStart = FALSE;
+ OnLineStart = false;
}
CheckWrite -
*/
-static void CheckWrite (char ch, unsigned int *curpos, unsigned int left, unsigned int *seentext)
+static void CheckWrite (char ch, unsigned int *curpos, unsigned int left, bool *seentext)
{
if (ch == ASCII_lf)
{
NewLine (left);
(*curpos) = 0;
- (*seentext) = FALSE;
+ (*seentext) = false;
}
else
{
if they exist.
*/
-static void WriteStringIndent (const char *a_, unsigned int _a_high, unsigned int indent, unsigned int *curpos, unsigned int left, unsigned int *seentext)
+static void WriteStringIndent (const char *a_, unsigned int _a_high, unsigned int indent, unsigned int *curpos, unsigned int left, bool *seentext)
{
unsigned int l;
unsigned int i;
{
WriteIndent ((*curpos)-indent);
}
- (*seentext) = TRUE;
+ (*seentext) = true;
CheckWrite (a[i], curpos, left, seentext);
}
}
but it removes up to indent spaces if they exist.
*/
-static void WriteCodeHunkListIndent (pge_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, bool *seentext)
{
if (l != NULL)
{
StrIO_WriteString ((const char *) " ***", 4);
StrIO_WriteLn ();
}
- WasNoError = FALSE;
+ WasNoError = false;
}
{
pge_CodeHunk p;
unsigned int i;
- unsigned int quote;
+ bool quote;
unsigned int line;
unsigned int position;
Ident (stopset|(pge_SetOfStop) ((1 << (bnflex_firsttok-bnflex_identtok))));
p = NewProduction ();
p->statement = NewStatement ();
- p->statement->followinfo->calcfollow = TRUE;
+ p->statement->followinfo->calcfollow = true;
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->firstsolved = true;
+ p->followinfo->calcfollow = true;
p->followinfo->epsilon = pge_false;
p->followinfo->reachend = pge_false;
First (stopset|(pge_SetOfStop) ((1 << (bnflex_followtok-bnflex_identtok))));
if (i->definition == NULL)
{
WarnError1 ((const char *) "unable to find production %s", 28, i->name);
- WasNoError = FALSE;
+ WasNoError = false;
}
}
}
static void WhileNotCompleteDo (pge_DoProcedure p)
{
do {
- Finished = TRUE;
+ Finished = true;
ForeachRuleDo (p);
} while (! (Finished));
}
static void NewLine (unsigned int Left)
{
Output_WriteLn ();
- BeginningOfLine = TRUE;
+ BeginningOfLine = true;
Indent = 0;
while (Indent < Left)
{
static void PrettyCommentFactor (pge_FactorDesc f, unsigned int Left)
{
unsigned int curpos;
- unsigned int seentext;
+ bool seentext;
while (f != NULL)
{
{
NewLine (Left);
Output_WriteString ((const char *) "% ", 2);
- seentext = FALSE;
+ seentext = false;
curpos = 0;
WriteCodeHunkListIndent (f->code->code, f->code->indent, &curpos, Left+2, &seentext);
Output_WriteString ((const char *) " %", 2);
if (p != NULL)
{
- BeginningOfLine = TRUE;
+ BeginningOfLine = true;
Indent = 0;
Output_WriteString ((const char *) "(*", 2);
NewLine (3);
if (p != NULL)
{
- BeginningOfLine = TRUE;
+ BeginningOfLine = true;
Indent = 0;
if (Texinfo)
{
Output_WriteString ((const char *) &FileName.array[0], MaxFileName);
Output_Write ('"');
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
}
}
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 2680, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "CodeCondition", 13, 2686);
break;
}
}
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 2705, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "CodeThenDo", 10, 2712);
break;
}
- OnLineStart = TRUE;
+ OnLineStart = true;
}
CodeElseEnd - builds an ELSE END statement using string, end.
*/
-static void CodeElseEnd (const char *end_, unsigned int _end_high, unsigned int consumed, pge_FactorDesc f, unsigned int inopt)
+static void CodeElseEnd (const char *end_, unsigned int _end_high, bool consumed, pge_FactorDesc f, bool inopt)
{
char end[_end_high+1];
memcpy (end, end_, _end_high+1);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
EmitFileLineTag (f->line);
if (! inopt)
{
}
IndentString ((const char *) end, _end_high);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
}
CodeEnd - codes a "END" depending upon, m.
*/
-static void CodeEnd (pge_m2condition m, pge_TermDesc t, unsigned int consumed, pge_FactorDesc f, unsigned int inopt)
+static void CodeEnd (pge_m2condition m, pge_TermDesc t, bool consumed, pge_FactorDesc f, bool inopt)
{
Indent -= 3;
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
switch (m)
{
case pge_m2none:
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 2788, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "CodeEnd", 7, 2796);
break;
}
- OnLineStart = FALSE;
+ OnLineStart = false;
}
{
unsigned int i;
pge_CodeHunk t;
- unsigned int seentext;
+ bool seentext;
t = code->code;
if ((! (FindStr (&t, &i, (const char *) "VAR", 3))) && EmitCode)
{
- seentext = FALSE;
+ seentext = false;
curpos = 0;
EmitFileLineTag (code->line);
IndentString ((const char *) "", 0);
WriteCodeHunkListIndent (code->code, code->indent, &curpos, left, &seentext);
Output_WriteString ((const char *) " ;", 2);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
}
}
{
NewLine (Indent);
Output_WriteString ((const char *) "(* begin flushing code *)", 25);
- OnLineStart = FALSE;
+ OnLineStart = false;
while ((*codeStack) != NULL)
{
NewLine (Indent);
{
Output_WriteString ((const char *) " (* again flushing code *)", 26);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
}
}
NewLine (Indent);
Output_WriteString ((const char *) "(* end flushing code *)", 23);
- OnLineStart = FALSE;
+ OnLineStart = false;
}
}
CodeFactor -
*/
-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)
+static void CodeFactor (pge_FactorDesc f, pge_TermDesc t, pge_m2condition l, pge_m2condition n, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack)
{
if (f == NULL)
{
{
Output_WriteLn ();
IndentString ((const char *) "RETURN( TRUE )", 14);
- OnLineStart = FALSE;
+ OnLineStart = false;
}
}
else
Output_WriteString ((const char *) "()", 2);
CodeThenDo (n);
Indent += 3;
- CodeFactor (f->next, NULL, n, pge_m2none, inopt, inwhile, TRUE, NULL);
+ CodeFactor (f->next, NULL, n, pge_m2none, inopt, inwhile, true, NULL);
CodeEnd (n, t, consumed, f, inopt);
break;
Output_Write (')');
CodeThenDo (n);
Indent += 3;
- CodeFactor (f->next, NULL, n, pge_m2none, inopt, inwhile, TRUE, NULL);
+ CodeFactor (f->next, NULL, n, pge_m2none, inopt, inwhile, true, NULL);
CodeEnd (n, t, consumed, f, inopt);
break;
* 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, pge_m2none, inopt, inwhile, TRUE, NULL);
+ CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, true, NULL);
}
break;
case pge_opt:
FlushCode (&codeStack);
- CodeExpression (f->expr, pge_m2if, TRUE, inwhile, FALSE, NULL);
+ CodeExpression (f->expr, pge_m2if, true, inwhile, false, NULL);
CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, consumed, NULL);
break;
case pge_mult:
FlushCode (&codeStack);
- CodeExpression (f->expr, pge_m2while, FALSE, TRUE, consumed, NULL);
+ CodeExpression (f->expr, pge_m2while, false, true, consumed, NULL);
CodeFactor (f->next, t, n, pge_m2none, inopt, inwhile, consumed, NULL);
break;
CodeTerm -
*/
-static void CodeTerm (pge_TermDesc t, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack)
+static void CodeTerm (pge_TermDesc t, pge_m2condition m, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack)
{
pge_m2condition l;
m = pge_m2if;
IndentString ((const char *) "ELSE", 4);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
Indent += 3;
CodeFactor (t->factor, t->next, pge_m2none, pge_m2none, inopt, inwhile, consumed, codeStack);
Indent -= 3;
IndentString ((const char *) "END ;", 5);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
}
else
{
CodeExpression -
*/
-static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, unsigned int inopt, unsigned int inwhile, unsigned int consumed, pge_FactorDesc codeStack)
+static void CodeExpression (pge_ExpressionDesc e, pge_m2condition m, bool inopt, bool inwhile, bool consumed, pge_FactorDesc codeStack)
{
if (e != NULL)
{
if (s != NULL)
{
EmitFileLineTag (s->line);
- CodeExpression (s->expr, m, FALSE, FALSE, FALSE, NULL);
+ CodeExpression (s->expr, m, false, false, false, NULL);
}
}
{
if ((p != NULL) && (! p->firstsolved || ((p->statement != NULL) && (p->statement->expr != NULL))))
{
- BeginningOfLine = TRUE;
+ BeginningOfLine = true;
Indent = 0;
Output_WriteLn ();
EmitFileLineTag (p->line);
Output_WriteString ((const char *) " () : BOOLEAN ;", 15);
VarProduction (p);
Output_WriteLn ();
- OnLineStart = TRUE;
+ OnLineStart = true;
EmitFileLineTag (p->line);
IndentString ((const char *) "BEGIN", 5);
StrIO_WriteLn ();
- OnLineStart = FALSE;
+ OnLineStart = false;
EmitFileLineTag (p->line);
Indent = 3;
CodeStatement (p->statement, pge_m2none);
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 3045, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "RecoverCondition", 16, 3054);
break;
}
}
default:
- Debug_Halt ((const char *) "unrecognised m2condition", 24, 3064, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unrecognised m2condition", 24, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "ConditionIndent", 15, 3074);
break;
}
ReturnException ("m2/gm2-auto/pge.mod", 1, 7);
case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
- WasNoError = FALSE;
+ WasNoError = false;
break;
default:
PushBackInput_WarnError ((const char *) "unknown enuneration element", 27);
- WasNoError = FALSE;
+ WasNoError = false;
break;
}
to = to->next;
static void EmitIsInFirst (pge_SetDesc to, pge_m2condition m)
{
unsigned int i;
- unsigned int first;
+ bool first;
if ((NumberOfElements (to, static_cast<unsigned int> (0), static_cast<unsigned int> (0))) == 1)
{
else
{
i = 0;
- first = TRUE;
+ first = true;
do {
if (! (IsEmptySet (to, i*MaxElementsInSet, ((i+1)*MaxElementsInSet)-1)))
{
Indent -= ConditionIndent (m);
}
EmitIsInSubSet (to, i*MaxElementsInSet, ((i+1)*MaxElementsInSet)-1);
- first = FALSE;
+ first = false;
}
i += 1;
} while (! ((i*MaxElementsInSet) > LargestValue));
and FALSE in the first.
*/
-static unsigned int OptExpSeen (pge_FactorDesc f)
+static bool OptExpSeen (pge_FactorDesc f)
{
if (f == NULL)
{
- return FALSE;
+ return false;
}
else
{
{
case pge_id:
case pge_lit:
- return FALSE;
+ return false;
break;
case pge_sub:
- return FALSE; /* is this correct? */
+ return false; /* is this correct? */
break;
case pge_opt:
break;
case pge_m2:
- return TRUE;
+ return true;
break;
}
}
PushBackInput_WarnError ((const char *) "all cases were not handled", 26);
- WasNoError = FALSE;
+ WasNoError = false;
ReturnException ("m2/gm2-auto/pge.mod", 1, 7);
__builtin_unreachable ();
}
static void RecoverTerm (pge_TermDesc t, pge_m2condition new_, pge_m2condition old)
{
- unsigned int LastWasM2Only;
- unsigned int alternative;
+ bool LastWasM2Only;
+ bool alternative;
pge_SetDesc to;
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;
+ alternative = false;
if (t->next != NULL)
{
new_ = pge_m2if;
Output_WriteLn ();
Indent += 3;
RecoverFactor (t->factor, pge_m2none, NULL);
- alternative = FALSE;
+ alternative = false;
}
else
{
if (t->next != NULL)
{
new_ = pge_m2elsif;
- alternative = TRUE;
+ alternative = true;
}
t = t->next;
}
EmitStopParameters - generate the stop set.
*/
-static void EmitStopParameters (unsigned int FormalParameters)
+static void EmitStopParameters (bool FormalParameters)
{
unsigned int i;
in the range: low..high
*/
-static unsigned int IsBetween (NameKey_Name string, unsigned int low, unsigned int high)
+static bool IsBetween (NameKey_Name string, unsigned int low, unsigned int high)
{
return ((SymbolKey_GetSymKey (Values, string)) >= low) && ((SymbolKey_GetSymKey (Values, string)) <= high);
/* static analysis guarentees a RETURN statement will be used before here. */
IsEmptySet - returns TRUE if no elements exist in set, to, with values, low..high.
*/
-static unsigned int IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high)
+static bool IsEmptySet (pge_SetDesc to, unsigned int low, unsigned int high)
{
while (to != NULL)
{
case pge_tokel:
if (IsBetween (to->string, low, high))
{
- return FALSE;
+ return false;
}
break;
case pge_litel:
if (IsBetween (SymbolKey_GetSymKey (Aliases, to->string), low, high))
{
- return FALSE;
+ return false;
}
break;
case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
- WasNoError = FALSE;
+ WasNoError = false;
break;
default:
PushBackInput_WarnError ((const char *) "unknown enuneration element", 27);
- WasNoError = FALSE;
+ WasNoError = false;
break;
}
to = to->next;
}
- return TRUE;
+ return true;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static void EmitSet (pge_SetDesc to, unsigned int low, unsigned int high)
{
- unsigned int first;
+ bool first;
- first = TRUE;
+ first = true;
while (to != NULL)
{
switch (to->type)
Output_WriteString ((const char *) ", ", 2);
}
Output_WriteKey (to->string);
- first = FALSE;
+ first = false;
}
break;
Output_WriteString ((const char *) ", ", 2);
}
Output_WriteKey (SymbolKey_GetSymKey (Aliases, to->string));
- first = FALSE;
+ first = false;
}
break;
case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
- WasNoError = FALSE;
+ WasNoError = false;
break;
default:
PushBackInput_WarnError ((const char *) "unknown enuneration element", 27);
- WasNoError = FALSE;
+ WasNoError = false;
break;
}
to = to->next;
case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
- WasNoError = FALSE;
+ WasNoError = false;
break;
default:
PushBackInput_WarnError ((const char *) "unknown enuneration element", 27);
- WasNoError = FALSE;
+ WasNoError = false;
break;
}
to = to->next;
if ((p != NULL) && (! p->firstsolved || ((p->statement != NULL) && (p->statement->expr != NULL))))
{
- BeginningOfLine = TRUE;
+ BeginningOfLine = true;
Indent = 0;
Output_WriteLn ();
- OnLineStart = FALSE;
+ OnLineStart = false;
EmitFileLineTag (p->line);
IndentString ((const char *) "PROCEDURE ", 10);
Output_WriteKey (GetDefinitionName (p));
Output_WriteString ((const char *) ") ;", 3);
VarProduction (p);
Output_WriteLn ();
- OnLineStart = FALSE;
+ OnLineStart = false;
EmitFileLineTag (p->line);
Indent = 0;
IndentString ((const char *) "BEGIN", 5);
Output_WriteLn ();
- OnLineStart = FALSE;
+ OnLineStart = false;
EmitFileLineTag (p->line);
Indent = 3;
RecoverStatement (p->statement, pge_m2none);
Output_WriteLn ();
Output_WriteLn ();
s = Output_EndBuffer ();
- EmitStopParameters (TRUE);
+ EmitStopParameters (true);
Output_KillWriteS (s);
}
}
IsWhite - returns TRUE if, ch, is a space or a tab.
*/
-static unsigned int IsWhite (char ch)
+static bool IsWhite (char ch)
{
return ((ch == ' ') || (ch == ASCII_tab)) || (ch == ASCII_lf);
/* static analysis guarentees a RETURN statement will be used before here. */
FindStr - returns TRUE if, str, was seen inside the code hunk
*/
-static unsigned int FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high)
+static bool FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsigned int _str_high)
{
unsigned int j;
unsigned int k;
IndentString ((const char *) "VAR", 3);
Indent += 3;
Output_WriteLn ();
- EmittedVar = TRUE;
+ EmittedVar = true;
}
WriteUpto (code, t, i);
}
static void VarProduction (pge_ProductionDesc p)
{
- EmittedVar = FALSE;
+ EmittedVar = false;
if (p != NULL)
{
VarStatement (p->statement);
In - returns TRUE if token, s, is already in the set, to.
*/
-static unsigned int In (pge_SetDesc to, NameKey_Name s)
+static bool In (pge_SetDesc to, NameKey_Name s)
{
while (to != NULL)
{
case pge_idel:
if (s == to->ident->name)
{
- return TRUE;
+ return true;
}
break;
case pge_litel:
if (s == to->string)
{
- return TRUE;
+ return true;
}
break;
default:
PushBackInput_WarnError ((const char *) "internal error CASE type not known", 34);
- WasNoError = FALSE;
+ WasNoError = false;
break;
}
to = to->next;
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
s1 * s2 = {}
*/
-static unsigned int IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2)
+static bool IntersectionIsNil (pge_SetDesc s1, pge_SetDesc s2)
{
while (s1 != NULL)
{
case pge_idel:
if (In (s2, s1->ident->name))
{
- return FALSE;
+ return false;
}
break;
case pge_litel:
if (In (s2, s1->string))
{
- return FALSE;
+ return false;
}
break;
default:
PushBackInput_WarnError ((const char *) "internal error CASE type not known", 34);
- WasNoError = FALSE;
+ WasNoError = false;
break;
}
s1 = s1->next;
}
- return TRUE;
+ return true;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
d->string = s;
d->next = (*to);
(*to) = d;
- Finished = FALSE;
+ Finished = false;
}
}
case pge_idel:
PushBackInput_WarnError ((const char *) "not expecting ident in first symbol list", 40);
- WasNoError = FALSE;
+ WasNoError = false;
break;
default:
- Debug_Halt ((const char *) "unknown element in enumeration type", 35, 4122, (const char *) "m2/gm2-auto/pge.mod", 19);
+ Debug_Halt ((const char *) "unknown element in enumeration type", 35, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "OrSet", 5, 4133);
break;
}
from = from->next;
if ((SymbolKey_GetSymKey (Aliases, f->string)) == SymbolKey_NulKey)
{
WarnError1 ((const char *) "unknown token for '%s'", 22, f->string);
- WasNoError = FALSE;
+ WasNoError = false;
}
else
{
{
PushBackInput_WarnError ((const char *) "internal error: epsilon unknown", 31);
PrettyCommentFactor (f, 3);
- WasNoError = FALSE;
+ WasNoError = false;
}
foundepsilon = GetEpsilon (f->followinfo);
canreachend = GetReachEnd (f->followinfo); /* only goes from FALSE -> TRUE */
break;
case pge_lit:
- AssignEpsilon (TRUE, f->followinfo, pge_false);
+ AssignEpsilon (true, f->followinfo, pge_false);
break;
case pge_sub:
break;
case pge_m2:
- AssignEpsilon (TRUE, f->followinfo, pge_true);
+ AssignEpsilon (true, f->followinfo, pge_true);
break;
case pge_opt:
case pge_mult:
CalcEpsilonExpression (f->expr);
- AssignEpsilon (TRUE, f->followinfo, pge_true);
+ AssignEpsilon (true, f->followinfo, pge_true);
break;
switch (GetReachEnd (t->factor->followinfo))
{
case pge_true:
- AssignEpsilon (TRUE, t->followinfo, pge_true);
+ AssignEpsilon (true, t->followinfo, pge_true);
break;
case pge_false:
- AssignEpsilon (TRUE, t->followinfo, pge_false);
+ AssignEpsilon (true, t->followinfo, pge_false);
break;
case pge_unknown:
EmptyFactor -
*/
-static unsigned int EmptyFactor (pge_FactorDesc f)
+static bool EmptyFactor (pge_FactorDesc f)
{
while (f != NULL)
{
case pge_id:
if (! (EmptyProduction (f->ident->definition)))
{
- return FALSE;
+ return false;
}
break;
case pge_lit:
- return FALSE;
+ return false;
break;
case pge_sub:
if (! (EmptyExpression (f->expr)))
{
- return FALSE;
+ return false;
}
break;
case pge_opt:
case pge_mult:
- return TRUE;
+ return true;
break;
case pge_m2:
}
f = f->next;
}
- return TRUE;
+ return true;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
EmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int EmptyTerm (pge_TermDesc t)
+static bool EmptyTerm (pge_TermDesc t)
{
while (t != NULL)
{
if (EmptyFactor (t->factor))
{
- return TRUE;
+ return true;
}
else
{
t = t->next;
}
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
EmptyExpression -
*/
-static unsigned int EmptyExpression (pge_ExpressionDesc e)
+static bool EmptyExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
- return TRUE;
+ return true;
}
else
{
EmptyStatement - returns TRUE if statement, s, is empty.
*/
-static unsigned int EmptyStatement (pge_StatementDesc s)
+static bool EmptyStatement (pge_StatementDesc s)
{
if (s == NULL)
{
- return TRUE;
+ return true;
}
else
{
EmptyProduction - returns if production, p, maybe empty.
*/
-static unsigned int EmptyProduction (pge_ProductionDesc p)
+static bool EmptyProduction (pge_ProductionDesc p)
{
if (p == NULL)
{
PushBackInput_WarnError ((const char *) "unknown production", 18);
- return TRUE;
+ return true;
}
else if (p->firstsolved && (p->first != NULL))
{
/* avoid dangling else. */
/* predefined but first set to something - thus not empty */
- return FALSE;
+ return false;
}
else
{
if (InitialElement)
{
- InitialElement = FALSE;
+ InitialElement = false;
}
else
{
Output_WriteLn ();
Output_WriteLn ();
s = Output_EndBuffer ();
- EmitStopParameters (TRUE);
+ EmitStopParameters (true);
Output_KillWriteS (s);
}
WriteGetTokenType ();
Output_WriteString ((const char *) " OF", 3);
NewLine (3);
- InitialElement = TRUE;
+ InitialElement = true;
SymbolKey_ForeachNodeDo (Aliases, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DescribeElement});
Output_WriteLn ();
Indent = 3;
OptionalFactor -
*/
-static unsigned int OptionalFactor (pge_FactorDesc f)
+static bool OptionalFactor (pge_FactorDesc f)
{
while (f != NULL)
{
case pge_mult:
if (OptionalExpression (f->expr))
{
- return TRUE;
+ return true;
}
break;
}
f = f->next;
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
OptionalTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int OptionalTerm (pge_TermDesc t)
+static bool OptionalTerm (pge_TermDesc t)
{
pge_TermDesc u;
pge_TermDesc v;
{
if (OptionalFactor (u->factor))
{
- return TRUE;
+ return true;
}
v = t;
tou = NULL;
StrIO_WriteLn ();
DisposeSetDesc (&tou);
DisposeSetDesc (&tov);
- return TRUE;
+ return true;
}
}
v = v->next;
DisposeSetDesc (&tou);
u = u->next;
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
OptionalExpression -
*/
-static unsigned int OptionalExpression (pge_ExpressionDesc e)
+static bool OptionalExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
- return FALSE;
+ return false;
}
else
{
OptionalStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int OptionalStatement (pge_StatementDesc s)
+static bool OptionalStatement (pge_StatementDesc s)
{
if (s == NULL)
{
- return FALSE;
+ return false;
}
else
{
OptionalProduction -
*/
-static unsigned int OptionalProduction (pge_ProductionDesc p)
+static bool OptionalProduction (pge_ProductionDesc p)
{
if (p == NULL)
{
- return FALSE;
+ return false;
}
else
{
CheckFirstFollow -
*/
-static unsigned int CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after)
+static bool CheckFirstFollow (pge_FactorDesc f, pge_FactorDesc after)
{
pge_SetDesc first;
pge_SetDesc follow;
{
DisposeSetDesc (&first);
DisposeSetDesc (&follow);
- return FALSE;
+ return false;
}
else
{
NewLine (3);
DisposeSetDesc (&first);
DisposeSetDesc (&follow);
- return TRUE;
+ return true;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
ConstrainedEmptyFactor -
*/
-static unsigned int ConstrainedEmptyFactor (pge_FactorDesc f)
+static bool ConstrainedEmptyFactor (pge_FactorDesc f)
{
while (f != NULL)
{
case pge_mult:
if (ConstrainedEmptyExpression (f->expr))
{
- return TRUE;
+ return true;
}
break;
}
if (((f->type != pge_m2) && (EmptyFactor (f))) && (CheckFirstFollow (f, f->next)))
{
- return TRUE;
+ return true;
}
f = f->next;
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
ConstrainedEmptyTerm - returns TRUE if the term maybe empty.
*/
-static unsigned int ConstrainedEmptyTerm (pge_TermDesc t)
+static bool ConstrainedEmptyTerm (pge_TermDesc t)
{
pge_SetDesc first;
pge_SetDesc follow;
{
if (ConstrainedEmptyFactor (t->factor))
{
- return TRUE;
+ return true;
}
else if (((t->factor->type != pge_m2) && (EmptyFactor (t->factor))) && (CheckFirstFollow (t->factor, t->factor->next)))
{
/* avoid dangling else. */
- return TRUE;
+ return true;
}
t = t->next;
}
- return FALSE;
+ return false;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
ConstrainedEmptyExpression -
*/
-static unsigned int ConstrainedEmptyExpression (pge_ExpressionDesc e)
+static bool ConstrainedEmptyExpression (pge_ExpressionDesc e)
{
if (e == NULL)
{
- return FALSE;
+ return false;
}
else
{
ConstrainedEmptyStatement - returns FALSE if statement, s, does not have a optional ambiguity.
*/
-static unsigned int ConstrainedEmptyStatement (pge_StatementDesc s)
+static bool ConstrainedEmptyStatement (pge_StatementDesc s)
{
if (s == NULL)
{
- return FALSE;
+ return false;
}
else
{
ConstrainedEmptyProduction - returns TRUE if a problem exists with, p.
*/
-static unsigned int ConstrainedEmptyProduction (pge_ProductionDesc p)
+static bool ConstrainedEmptyProduction (pge_ProductionDesc p)
{
if (p == NULL)
{
- return FALSE;
+ return false;
}
else
{
if (OptionalProduction (p))
{
WarnError1 ((const char *) "production %s has two optional sentances using | which both have the same start symbols", 87, p->statement->ident->name);
- WasNoError = FALSE;
+ WasNoError = false;
PrettyCommentProduction (p);
}
}
{
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);
- WasNoError = FALSE;
+ WasNoError = false;
}
}
unsigned int n;
unsigned int i;
- ErrorRecovery = TRUE; /* DefaultRecovery ; */
- Debugging = FALSE; /* DefaultRecovery ; */
- PrettyPrint = FALSE;
- KeywordFormatting = FALSE;
+ ErrorRecovery = true; /* DefaultRecovery ; */
+ Debugging = false; /* DefaultRecovery ; */
+ PrettyPrint = false;
+ KeywordFormatting = false;
i = 1;
n = Args_Narg ();
while (i < n)
/* avoid gcc warning by using compound statement even if not strictly necessary. */
if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-e", 2))
{
- ErrorRecovery = FALSE;
+ ErrorRecovery = false;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-d", 2))
{
/* avoid dangling else. */
- Debugging = TRUE;
- bnflex_SetDebugging (TRUE);
+ Debugging = true;
+ bnflex_SetDebugging (true);
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-c", 2))
{
/* avoid dangling else. */
- EmitCode = FALSE;
+ EmitCode = false;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-k", 2))
{
/* avoid dangling else. */
- KeywordFormatting = TRUE;
+ KeywordFormatting = true;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-l", 2))
{
/* avoid dangling else. */
- SuppressFileLineTag = TRUE;
+ SuppressFileLineTag = true;
}
else if ((StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-h", 2)) || (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "--help", 6)))
{
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-p", 2))
{
/* avoid dangling else. */
- PrettyPrint = TRUE;
+ PrettyPrint = true;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-t", 2))
{
/* avoid dangling else. */
- Texinfo = TRUE;
+ Texinfo = true;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-x", 2))
{
/* avoid dangling else. */
- Sphinx = TRUE;
+ Sphinx = true;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-f", 2))
{
/* avoid dangling else. */
- FreeDocLicense = TRUE;
+ FreeDocLicense = true;
}
else if (StrLib_StrEqual ((const char *) &ArgName.array[0], MaxFileName, (const char *) "-o", 2))
{
static void Init (void)
{
- WasNoError = TRUE;
- Texinfo = FALSE;
- Sphinx = FALSE;
- FreeDocLicense = FALSE;
- EmitCode = TRUE;
+ WasNoError = true;
+ Texinfo = false;
+ Sphinx = false;
+ FreeDocLicense = false;
+ EmitCode = true;
LargestValue = 0;
HeadProduction = NULL;
CurrentProduction = NULL;
ErrorProcString = NameKey_MakeKey ((const char *) "ErrorS", 6);
TokenTypeProc = NameKey_MakeKey ((const char *) "GetCurrentTokenType()", 21);
SymIsProc = NameKey_MakeKey ((const char *) "SymIs", 5);
- OnLineStart = TRUE;
+ OnLineStart = true;
ParseArgs ();
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 */
Output_WriteString ((const char *) &FileName.array[0], MaxFileName);
Output_WriteString ((const char *) " *)", 3);
Output_WriteLn ();
- OnLineStart = FALSE;
+ OnLineStart = false;
EmitFileLineTag (LinePrologue);
- BeginningOfLine = TRUE;
+ BeginningOfLine = true;
WriteCodeHunkList (CodePrologue);
EmitSupport ();
EmitFileLineTag (LineDeclaration);
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);
if, t, supports, f.
*/
-EXTERN unsigned int termios_GetFlag (termios_TERMIOS t, termios_Flag f, unsigned int *b);
+EXTERN bool termios_GetFlag (termios_TERMIOS t, termios_Flag f, bool *b);
/*
SetFlag - sets a flag value in, t, to, b, and returns TRUE if
this flag value is supported.
*/
-EXTERN unsigned int termios_SetFlag (termios_TERMIOS t, termios_Flag f, unsigned int b);
+EXTERN bool termios_SetFlag (termios_TERMIOS t, termios_Flag f, bool b);
/*
GetChar - sets a CHAR, ch, value from, t, and returns TRUE if
this value is supported.
*/
-EXTERN unsigned int termios_GetChar (termios_TERMIOS t, termios_ControlChar c, char *ch);
+EXTERN bool termios_GetChar (termios_TERMIOS t, termios_ControlChar c, char *ch);
/*
SetChar - sets a CHAR value in, t, and returns TRUE if, c,
is supported.
*/
-EXTERN unsigned int termios_SetChar (termios_TERMIOS t, termios_ControlChar c, char ch);
+EXTERN bool termios_SetChar (termios_TERMIOS t, termios_ControlChar c, char ch);
# ifdef __cplusplus
}
# endif
# ifdef __cplusplus
extern "C" {
# endif
+#include <stdbool.h>
# if !defined (PROC_D)
# define PROC_D
typedef void (*PROC_t) (void);