PR modula2/113749 m2 enabled build times out on i686-gnu-hurd

The bug fix changes the FIO module to use the target O_RDONLY,
O_WRONLY, SEEK_SET and SEEK_END (now available from the module wrapc).
Also rebuilt are the bootstrap tools mc and pge as they have their
own wrapc and C translations of FIO.

gcc/m2/ChangeLog:

	PR modula2/113749
	* Make-lang.in (BUILD-PGE-O): Add m2/pge-boot/Gwrapc.o.
	* gm2-libs-ch/wrapc.c (wrapc_SeekSet): New function.
	(wrapc_SeekEnd): Ditto.
	(wrapc_ReadOnly): Ditto.
	(wrapc_WriteOnly): Ditto.
	* gm2-libs/FIO.mod (SEEK_SET): Remove.
	(SEEK_END): Remove.
	(UNIXREADONLY): Remove.
	(UNIXWRITEONLY): Remove.
	(ConnectToUnix): Replace UNIXWRITEONLY with a call to WriteOnly.
	Replace UNIXREADONLY with a call to ReadOnly.
	(SetPositionFromBeginning): Replace SEEK_SET with a call to
	SeekSet.
	(SetPositionFromEnd): Replace SEEK_END with a call to
	SeekEnd.
	* gm2-libs/wrapc.def (SeekSet): New procedure function.
	(SeekEnd): New procedure function.
	(ReadOnly): New procedure function.
	(WriteOnly): New procedure function.
	* mc-boot-ch/Glibc.c (BUILD_MC_LIBC_TRACE): Undef.
	(check_init): New function.
	(tracedb): Ditto.
	(tracedb_open): Ditto.
	(tracedb_result): Ditto.
	(libc_read): Ditto.
	(libc_write): Ditto.
	(libc_close): Ditto.
	(libc_creat): Ditto.
	(libc_open): Ditto.
	(libc_lseek): Ditto.
	* mc-boot-ch/Gwrapc.c (wrapc_SeekSet): New function.
	(wrapc_SeekEnd): Ditto.
	(wrapc_ReadOnly): Ditto.
	(wrapc_WriteOnly): Ditto.
	* mc-boot/GDynamicStrings.cc: Rebuilt.
	* mc-boot/GFIO.cc: Ditto.
	* mc-boot/GIndexing.cc: Ditto.
	* mc-boot/GM2Dependent.cc: Ditto.
	* mc-boot/GM2EXCEPTION.cc: Ditto.
	* mc-boot/GPushBackInput.cc: Ditto.
	* mc-boot/GRTExceptions.cc: Ditto.
	* mc-boot/GRTint.cc: Ditto.
	* mc-boot/GSArgs.cc: Ditto.
	* mc-boot/GStdIO.cc: Ditto.
	* mc-boot/GStringConvert.cc: Ditto.
	* mc-boot/GSysStorage.cc: Ditto.
	* mc-boot/Gdecl.cc: Ditto.
	* mc-boot/Gkeyc.cc: Ditto.
	* mc-boot/Glibc.h: Ditto.
	* mc-boot/GmcComment.cc: Ditto.
	* mc-boot/GmcComp.cc: Ditto.
	* mc-boot/GmcDebug.cc: Ditto.
	* mc-boot/GmcMetaError.cc: Ditto.
	* mc-boot/GmcStack.cc: Ditto.
	* mc-boot/GmcStream.cc: Ditto.
	* mc-boot/GnameKey.cc: Ditto.
	* mc-boot/GsymbolKey.cc: Ditto.
	* mc-boot/Gvarargs.cc: Ditto.
	* mc-boot/Gwrapc.h: Ditto.
	* mc/decl.mod (getSymName): Add pointerref clause.
	* mc/mcStream.mod (copy): Check for an error after every read.
	* mc/varargs.mod (copy): Rewrite pointer arithmetic using INC to
	avoid type incompatibility.
	* pge-boot/GDynamicStrings.cc: Rebuilt.
	* pge-boot/GDynamicStrings.h: Ditto.
	* pge-boot/GFIO.cc: Ditto.
	* pge-boot/GFIO.h: Ditto.
	* pge-boot/GIO.cc: Ditto.
	* pge-boot/GIndexing.cc: Ditto.
	* pge-boot/GM2Dependent.cc: Ditto.
	* pge-boot/GM2EXCEPTION.cc: Ditto.
	* pge-boot/GNameKey.cc: Ditto.
	* pge-boot/GPushBackInput.cc: Ditto.
	* pge-boot/GRTExceptions.cc: Ditto.
	* pge-boot/GStdIO.cc: Ditto.
	* pge-boot/GSymbolKey.cc: Ditto.
	* pge-boot/GSysStorage.cc: Ditto.
	* pge-boot/Glibc.h: Ditto.
	* pge-boot/Gwrapc.cc: Ditto.
	* pge-boot/Gwrapc.h: Ditto.

libgm2/ChangeLog:

	PR modula2/113749
	* libm2pim/wrapc.cc: Include fcntl.h.
	(SeekSet): New function.
	(SeekEnd): Ditto.
	(ReadOnly): Ditto.
	(WriteOnly): Ditto.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
This commit is contained in:
Gaius Mulley 2024-02-25 11:08:37 +00:00
parent 5c45dc1b97
commit d1b241b950
52 changed files with 735 additions and 280 deletions

View file

@ -1786,6 +1786,7 @@ BUILD-PGE-O = \
m2/pge-boot/GSymbolKey.o \
m2/pge-boot/GSysStorage.o \
m2/pge-boot/Glibc.o \
m2/pge-boot/Gwrapc.o \
m2/pge-boot/Gerrno.o \
m2/pge-boot/GUnixArgs.o \
m2/pge-boot/Gtermios.o \

View file

@ -252,6 +252,38 @@ wrapc_isnanl (long double x)
return isnan (x);
}
/* SeekSet return the system libc SEEK_SET value. */
int
wrapc_SeekSet (void)
{
return SEEK_SET;
}
/* SeekEnd return the system libc SEEK_END value. */
int
wrapc_SeekEnd (void)
{
return SEEK_END;
}
/* ReadOnly return the system value of O_RDONLY. */
int
wrapc_ReadOnly (void)
{
return O_RDONLY;
}
/* WriteOnly return the system value of O_WRONLY. */
int
wrapc_WriteOnly (void)
{
return O_WRONLY;
}
/* init - init/finish functions for the module */
void

View file

@ -41,18 +41,16 @@ FROM ASCII IMPORT nl, nul, tab ;
FROM StrLib IMPORT StrLen, StrConCat, StrCopy ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
FROM NumberIO IMPORT CardToStr ;
FROM libc IMPORT exit, open, creat, read, write, close, lseek, strncpy, memcpy ;
FROM Indexing IMPORT Index, InitIndex, InBounds, HighIndice, PutIndice, GetIndice ;
FROM M2RTS IMPORT InstallTerminationProcedure ;
FROM libc IMPORT exit, open, creat, read, write, close, lseek, strncpy, memcpy ;
FROM wrapc IMPORT SeekSet, SeekEnd, ReadOnly, WriteOnly ;
CONST
SEEK_SET = 0 ; (* relative from beginning of the file *)
SEEK_END = 2 ; (* relative to the end of the file *)
UNIXREADONLY = 0 ;
UNIXWRITEONLY = 1 ;
CreatePermissions = 666B;
MaxBufferLength = 1024*16 ;
MaxErrorString = 1024* 8 ;
CreatePermissions = 666B;
TYPE
FileUsage = (unused, openedforread, openedforwrite, openedforrandom) ;
@ -428,10 +426,10 @@ BEGIN
THEN
unixfd := creat(name.address, CreatePermissions)
ELSE
unixfd := open(name.address, UNIXWRITEONLY, 0)
unixfd := open(name.address, INTEGER (WriteOnly ()), 0)
END
ELSE
unixfd := open(name.address, UNIXREADONLY, 0)
unixfd := open(name.address, INTEGER (ReadOnly ()), 0)
END ;
IF unixfd<0
THEN
@ -1448,7 +1446,7 @@ BEGIN
filled := 0
END
END ;
offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_SET) ;
offset := lseek (unixfd, VAL (CSSIZE_T, pos), SeekSet ()) ;
IF (offset>=0) AND (pos=offset)
THEN
abspos := pos
@ -1497,7 +1495,7 @@ BEGIN
filled := 0
END
END ;
offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_END) ;
offset := lseek (unixfd, VAL (CSSIZE_T, pos), SeekEnd ()) ;
IF offset>=0
THEN
abspos := offset ;

View file

@ -140,4 +140,32 @@ PROCEDURE isnanf (x: SHORTREAL) : INTEGER ;
PROCEDURE isnanl (x: LONGREAL) : INTEGER ;
(*
SeekSet - return the system libc SEEK_SET value.
*)
PROCEDURE SeekSet () : INTEGER ;
(*
SeekEnd - return the system libc SEEK_END value.
*)
PROCEDURE SeekEnd () : INTEGER ;
(*
ReadOnly - return the system value of O_RDONLY.
*)
PROCEDURE ReadOnly () : BITSET ;
(*
WriteOnly - return the system value of O_WRONLY.
*)
PROCEDURE WriteOnly () : BITSET ;
END wrapc.

View file

@ -28,25 +28,116 @@ along with GNU Modula-2; see the file COPYING3. If not see
#define EXTERN
#endif
#undef BUILD_MC_LIBC_TRACE
#if defined(BUILD_MC_LIBC_TRACE)
static bool initialzed_trace = false;
static bool trace_on = false;
static
void
check_init (void)
{
if (! initialzed_trace)
{
initialzed_trace = true;
trace_on = ((getenv ("MC_LIBC_TRACE") != NULL));
}
}
#endif
static
void
tracedb (const char *format, ...)
{
#if defined(BUILD_MC_LIBC_TRACE)
check_init ();
if (trace_on)
{
va_list arg;
va_start (arg, format);
{
vfprintf (stdout, format, arg);
fflush (stdout);
}
va_end (arg);
}
#endif
}
static
void
tracedb_open (const char *p, int flags, mode_t mode)
{
#if defined(BUILD_MC_LIBC_TRACE)
bool item_written = false;
tracedb ("libc_open (%s, flags = 0x%x = ", p, flags);
int bits = (flags & O_ACCMODE);
tracedb ("bits = 0x%x", bits);
if (bits == O_RDONLY)
{
tracedb ("O_RDONLY");
item_written = true;
}
if ((flags & O_WRONLY) != 0)
{
if (item_written)
tracedb (" | ");
tracedb ("O_WRONLY");
item_written = true;
}
if ((flags & O_RDWR) != 0)
{
if (item_written)
tracedb (" | ");
tracedb ("O_RDWR");
item_written = true;
}
tracedb (", 0x%x)\n", mode);
#endif
}
static
void
tracedb_result (int result)
{
#if defined(BUILD_MC_LIBC_TRACE)
tracedb (" result = %d", result);
if (result == -1)
tracedb (", errno = %s", strerror (errno));
tracedb ("\n");
#endif
}
EXTERN
int
libc_read (int fd, void *a, int nbytes)
{
return read (fd, a, nbytes);
tracedb ("libc_read (%d, %p, %d)\n", fd, a, nbytes);
int result = read (fd, a, nbytes);
tracedb_result (result);
return result;
}
EXTERN
int
libc_write (int fd, void *a, int nbytes)
{
return write (fd, a, nbytes);
tracedb ("libc_write (%d, %p, %d)\n", fd, a, nbytes);
int result = write (fd, a, nbytes);
tracedb_result (result);
return result;
}
EXTERN
int
libc_close (int fd)
{
return close (fd);
tracedb ("libc_close (%d)\n", fd);
int result = close (fd);
tracedb_result (result);
return result;
}
EXTERN
@ -232,21 +323,30 @@ EXTERN
int
libc_creat (char *p, mode_t mode)
{
return creat (p, mode);
tracedb ("libc_creat (%s, 0x%x)\n", p, mode);
int result = creat (p, mode);
tracedb_result (result);
return result;
}
EXTERN
int
libc_open (char *p, int flags, mode_t mode)
{
return open (p, flags, mode);
tracedb_open (p, flags, mode);
int result = open (p, flags, mode);
tracedb_result (result);
return result;
}
EXTERN
off_t
libc_lseek (int fd, off_t offset, int whence)
{
return lseek (fd, offset, whence);
tracedb ("libc_lseek (%s, %p, %d)\n", fd, offset, whence);
int result = lseek (fd, offset, whence);
tracedb_result (result);
return result;
}
EXTERN

View file

@ -164,6 +164,38 @@ wrapc_signbitf (float r)
#endif
}
/* SeekSet return the system libc SEEK_SET value. */
int
wrapc_SeekSet (void)
{
return SEEK_SET;
}
/* SeekEnd return the system libc SEEK_END value. */
int
wrapc_SeekEnd (void)
{
return SEEK_END;
}
/* ReadOnly return the system value of O_RDONLY. */
int
wrapc_ReadOnly (void)
{
return O_RDONLY;
}
/* WriteOnly return the system value of O_WRONLY. */
int
wrapc_WriteOnly (void)
{
return O_WRONLY;
}
/* init constructor for the module. */
void

View file

@ -1225,7 +1225,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned
(*c).next->contents.next = NULL;
ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o);
AddDebugInfo ((*c).next);
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14);
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14);
}
else
{
@ -1323,7 +1323,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne
AddDebugInfo ((*c).next);
if (TraceOn)
{
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21);
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 917, (const char *) "ConcatContentsAddress", 21);
}
}
else
@ -1548,7 +1548,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi
AddDebugInfo (s);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1651,7 +1651,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a)
AddDebugInfo (s);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1676,7 +1676,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch)
s = DynamicStrings_InitString ((const char *) &a.array[0], 1);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1863,7 +1863,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s)
s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1198, (const char *) "Dup", 3);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1885,7 +1885,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy
a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b);
if (TraceOn)
{
a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1218, (const char *) "Add", 3);
a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3);
}
return a;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1950,7 +1950,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a)
t = DynamicStrings_InitStringCharStar (a);
if (TraceOn)
{
t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1275, (const char *) "EqualCharStar", 13);
t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13);
}
t = AddToGarbage (t, s);
if (DynamicStrings_Equal (t, s))
@ -1988,7 +1988,7 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *
t = DynamicStrings_InitString ((const char *) a, _a_high);
if (TraceOn)
{
t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1305, (const char *) "EqualArray", 10);
t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10);
}
t = AddToGarbage (t, s);
if (DynamicStrings_Equal (t, s))
@ -2026,7 +2026,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u
}
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1337, (const char *) "Mult", 4);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2105,7 +2105,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
AddDebugInfo (t->contents.next);
if (TraceOn)
{
t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1405, (const char *) "Slice", 5);
t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1405, (const char *) "Slice", 5);
}
}
t = t->contents.next;
@ -2123,7 +2123,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
}
if (TraceOn)
{
d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1422, (const char *) "Slice", 5);
d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5);
}
return d;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2251,7 +2251,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St
}
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1534, (const char *) "RemoveComment", 13);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1534, (const char *) "RemoveComment", 13);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2276,7 +2276,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString
s = DynamicStrings_Slice (s, (int ) (i), 0);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1646, (const char *) "RemoveWhitePrefix", 17);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1646, (const char *) "RemoveWhitePrefix", 17);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2301,7 +2301,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin
s = DynamicStrings_Slice (s, 0, i+1);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1668, (const char *) "RemoveWhitePostfix", 18);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1668, (const char *) "RemoveWhitePostfix", 18);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2668,7 +2668,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal
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, 174);
M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, (const char *) "PopAllocationExemption", 22, 174);
}
else
{

View file

@ -56,22 +56,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# include "GStrLib.h"
# include "GStorage.h"
# include "GNumberIO.h"
# include "Glibc.h"
# include "GIndexing.h"
# include "GM2RTS.h"
# include "Glibc.h"
# include "Gwrapc.h"
typedef unsigned int FIO_File;
FIO_File FIO_StdErr;
FIO_File FIO_StdOut;
FIO_File FIO_StdIn;
# define SEEK_SET 0
# define SEEK_END 2
# define UNIXREADONLY 0
# define UNIXWRITEONLY 1
# define CreatePermissions 0666
# define MaxBufferLength (1024*16)
# define MaxErrorString (1024*8)
# define CreatePermissions 0666
typedef struct FIO_NameInfo_r FIO_NameInfo;
typedef struct FIO_buf_r FIO_buf;
@ -556,7 +553,7 @@ static FIO_File GetNextFreeDescriptor (void)
return f; /* create new slot */
}
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/FIO.def", 25, 1);
__builtin_unreachable ();
}
@ -673,12 +670,12 @@ static void ConnectToUnix (FIO_File f, bool towrite, bool newfile)
}
else
{
fd->unixfd = libc_open (fd->name.address, UNIXWRITEONLY, 0);
fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_WriteOnly ()), 0);
}
}
else
{
fd->unixfd = libc_open (fd->name.address, UNIXREADONLY, 0);
fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_ReadOnly ()), 0);
}
if (fd->unixfd < 0)
{
@ -2093,7 +2090,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos)
fd->buffer->position = 0;
fd->buffer->filled = 0;
}
offset = libc_lseek (fd->unixfd, pos, SEEK_SET);
offset = static_cast<long int> (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekSet ()));
if ((offset >= 0) && (pos == offset))
{
fd->abspos = pos;
@ -2142,7 +2139,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos)
fd->buffer->position = 0;
fd->buffer->filled = 0;
}
offset = libc_lseek (fd->unixfd, pos, SEEK_END);
offset = static_cast<long int> (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekEnd ()));
if (offset >= 0)
{
fd->abspos = offset;

View file

@ -223,7 +223,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n)
{
return (n >= i->Low) && (n <= i->High);
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1);
ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
__builtin_unreachable ();
}
@ -243,7 +243,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i)
{
return i->High;
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1);
ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
__builtin_unreachable ();
}
@ -263,7 +263,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i)
{
return i->Low;
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1);
ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
__builtin_unreachable ();
}

View file

@ -134,6 +134,12 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
/*
InitDependencyList - initialize all fields of DependencyList.
*/
static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state);
/*
CreateModule - creates a new module entry and returns the
ModuleChain.
@ -354,6 +360,20 @@ static void Init (void);
static void CheckInitialized (void);
/*
InitDependencyList - initialize all fields of DependencyList.
*/
static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state)
{
(*depList).proc = proc;
(*depList).forced = false;
(*depList).forc = false;
(*depList).appl = false;
(*depList).state = state;
}
/*
CreateModule - creates a new module entry and returns the
ModuleChain.
@ -368,8 +388,7 @@ static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Depe
mptr->libname = libname;
mptr->init = init;
mptr->fini = fini;
mptr->dependency.proc = dependencies;
mptr->dependency.state = M2Dependent_unregistered;
InitDependencyList (&mptr->dependency, dependencies, M2Dependent_unregistered);
mptr->prev = NULL;
mptr->next = NULL;
if (HexTrace)

View file

@ -58,13 +58,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
n = RTExceptions_GetNumber (e);
if (n == (UINT_MAX))
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
}
else
{
return (M2EXCEPTION_M2Exceptions) (n);
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -275,7 +275,7 @@ extern "C" char PushBackInput_PutCh (char ch)
}
else
{
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);
Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutCh", 5, 151);
}
return ch;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -301,7 +301,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high)
l -= 1;
if ((PushBackInput_PutCh (a[l])) != a[l])
{
Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132);
Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutString", 9, 132);
}
}
}
@ -322,7 +322,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s)
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, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113);
Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutStr", 6, 113);
}
}
}

View file

@ -722,7 +722,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
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")), 614, 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/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")));
}
@ -732,7 +732,7 @@ static void indexf (void * a)
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")), 626, 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/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")));
}
@ -742,7 +742,7 @@ static void range (void * a)
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")), 638, 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/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")));
}
@ -752,7 +752,7 @@ static void casef (void * a)
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")), 650, 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/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")));
}
@ -762,7 +762,7 @@ static void invalidloc (void * a)
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")), 662, 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/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 ? */
}
@ -772,7 +772,7 @@ static void function (void * a)
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")), 674, 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/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")));
}
@ -782,7 +782,7 @@ static void wholevalue (void * a)
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")), 686, 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/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")));
}
@ -792,7 +792,7 @@ static void wholediv (void * a)
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")), 698, 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/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")));
}
@ -802,7 +802,7 @@ static void realvalue (void * a)
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")), 710, 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/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")));
}
@ -812,7 +812,7 @@ static void realdiv (void * a)
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")), 722, 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/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")));
}
@ -822,7 +822,7 @@ static void complexvalue (void * a)
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")), 734, 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/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")));
}
@ -832,7 +832,7 @@ static void complexdiv (void * a)
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")), 746, 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/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
}
@ -842,7 +842,7 @@ static void protection (void * a)
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")), 758, 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/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
}
@ -852,7 +852,7 @@ static void systemf (void * a)
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")), 770, 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/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
}
@ -862,7 +862,7 @@ static void coroutine (void * a)
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")), 782, 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/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
}
@ -1180,13 +1180,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void)
{
if (currentEHB == NULL)
{
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);
M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc/m2/gm2-libs/RTExceptions.mod", 38, (const char *) "GetBaseExceptionBlock", 21, 600);
}
else
{
return currentEHB;
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -585,7 +585,7 @@ static bool activatePending (bool untilInterrupt, RTint_DispatchVector call, uns
default:
CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1);
CaseException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1);
__builtin_unreachable ();
}
vec = vec->pending;
@ -698,7 +698,7 @@ extern "C" unsigned int RTint_InitOutputVector (int fd, unsigned int pri)
RTco_signal (lock);
return vptr->no;
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1);
__builtin_unreachable ();
}
@ -755,7 +755,7 @@ extern "C" void RTint_ReArmTimeVector (unsigned int vec, unsigned int micro, uns
vptr = FindVectorNo (vec);
if (vptr == NULL)
{
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "ReArmTimeVector", 15, 287);
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "ReArmTimeVector", 15, 287);
}
else
{
@ -780,7 +780,7 @@ extern "C" void RTint_GetTimeVector (unsigned int vec, unsigned int *micro, unsi
vptr = FindVectorNo (vec);
if (vptr == NULL)
{
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "GetTimeVector", 13, 313);
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "GetTimeVector", 13, 313);
}
else
{
@ -806,7 +806,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * ptr)
vptr = FindVectorNo (vec);
if (vptr == NULL)
{
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "AttachVector", 12, 340);
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "AttachVector", 12, 340);
}
else
{
@ -820,7 +820,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * ptr)
RTco_signal (lock);
return prevArg;
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1);
__builtin_unreachable ();
}
@ -845,7 +845,7 @@ extern "C" void RTint_IncludeVector (unsigned int vec)
vptr = FindVectorNo (vec);
if (vptr == NULL)
{
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "IncludeVector", 13, 374);
M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "IncludeVector", 13, 374);
}
else
{
@ -891,7 +891,7 @@ extern "C" void RTint_ExcludeVector (unsigned int vec)
vptr = FindPendingVector (vec);
if (vptr == NULL)
{
M2RTS_Halt ((const char *) "cannot find pending vector supplied", 35, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "ExcludeVector", 13, 416);
M2RTS_Halt ((const char *) "cannot find pending vector supplied", 35, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "ExcludeVector", 13, 416);
}
else
{
@ -989,7 +989,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un
default:
CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1);
CaseException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1);
__builtin_unreachable ();
}
vec = vec->pending;
@ -1002,7 +1002,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un
}
if ((untilInterrupt && (((inSet == NULL) && (outSet == NULL)) || (maxFd == -1))) && ! 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, 733);
M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "Listen", 6, 733);
}
/* printf('}
') ; */

View file

@ -85,13 +85,15 @@ extern "C" unsigned int SArgs_Narg (void);
extern "C" bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n)
{
int i;
void * a;
SArgs_PtrToPtrToChar ppc;
i = (int ) (n);
if (i < (UnixArgs_GetArgC ()))
{
/* ppc := ADDRESS (VAL (PtrToPtrToChar, ArgV) + (i * CARDINAL (TSIZE(PtrToChar)))) ; */
ppc = static_cast<SArgs_PtrToPtrToChar> ((void *) (((SArgs_PtrToChar) (UnixArgs_GetArgV ()))+(n*sizeof (SArgs_PtrToChar))));
a = (void *) (UnixArgs_GetArgV ());
a = reinterpret_cast<void *> (reinterpret_cast<char *> (a)+n*sizeof (SArgs_PtrToChar));
ppc = static_cast<SArgs_PtrToPtrToChar> (a);
(*s) = DynamicStrings_InitStringCharStar (reinterpret_cast<void *> ((*ppc)));
return true;
}

View file

@ -194,7 +194,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1);
__builtin_unreachable ();
}
@ -253,7 +253,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -1915,7 +1915,7 @@ extern "C" DynamicStrings_String StringConvert_ToSigFig (DynamicStrings_String s
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, 1220, (const char *) "ToSigFig", 8);
Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc/m2/gm2-libs/StringConvert.mod", 39, 1220, (const char *) "ToSigFig", 8);
point = DynamicStrings_Index (s, '.', 0);
if (point < 0)
{
@ -1967,7 +1967,7 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S
{
int point;
Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1069, (const char *) "ToDecimalPlaces", 15);
Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc/m2/gm2-libs/StringConvert.mod", 39, 1069, (const char *) "ToDecimalPlaces", 15);
point = DynamicStrings_Index (s, '.', 0);
if (point < 0)
{

View file

@ -94,7 +94,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size)
(*a) = libc_malloc (static_cast<size_t> (size));
if ((*a) == NULL)
{
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);
Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "ALLOCATE", 8, 51);
}
if (enableTrace && trace)
{
@ -119,7 +119,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size)
}
if ((libc_memset ((*a), 0, static_cast<size_t> (size))) != (*a))
{
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);
Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "DEALLOCATE", 10, 78);
}
}
if (enableDeallocation)
@ -164,7 +164,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size)
(*a) = libc_realloc ((*a), static_cast<size_t> (size));
if ((*a) == NULL)
{
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);
Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "REALLOCATE", 10, 122);
}
if (enableTrace && trace)
{

View file

@ -2781,7 +2781,7 @@ extern "C" int libc_dup (int d);
extern "C" int libc_close (int d);
extern "C" int libc_open (void * filename, int oflag, ...);
extern "C" int libc_creat (void * filename, unsigned int mode);
extern "C" long int libc_lseek (int fd, long int offset, int whence);
extern "C" ssize_t libc_lseek (int fd, ssize_t offset, int whence);
extern "C" void libc_perror (const char *string_, unsigned int _string_high);
extern "C" int libc_readv (int fd, void * v, int n);
extern "C" int libc_writev (int fd, void * v, int n);
@ -6705,7 +6705,7 @@ static decl_node newNode (decl_nodeT k)
d->at.firstUsed = 0;
return d;
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -7065,7 +7065,7 @@ static decl_node addToScope (decl_node n)
}
M2RTS_HALT (-1);
__builtin_unreachable ();
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -7143,7 +7143,7 @@ static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -7426,7 +7426,7 @@ static void putFieldVarient (decl_node f, decl_node v)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
switch (f->kind)
@ -7437,7 +7437,7 @@ static void putFieldVarient (decl_node f, decl_node v)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -7488,7 +7488,7 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type,
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* fill in, n. */
@ -7546,7 +7546,7 @@ static void putVarientTag (decl_node v, decl_node tag)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -7570,7 +7570,7 @@ static decl_node getParent (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -7598,7 +7598,7 @@ static decl_node getRecord (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -7778,7 +7778,7 @@ static bool getConstExpComplete (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -7883,7 +7883,7 @@ static decl_node makeVal (decl_node params)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -7904,7 +7904,7 @@ static decl_node makeCast (decl_node c, decl_node p)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -8414,7 +8414,7 @@ static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -8508,7 +8508,7 @@ static DynamicStrings_String getStringContents (decl_node n)
}
M2RTS_HALT (-1);
__builtin_unreachable ();
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -8644,7 +8644,7 @@ static decl_node doMakeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
return n;
@ -9244,12 +9244,12 @@ static decl_node doGetExprType (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
M2RTS_HALT (-1);
__builtin_unreachable ();
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -9388,12 +9388,12 @@ static decl_node getSymScope (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
M2RTS_HALT (-1);
__builtin_unreachable ();
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -9705,7 +9705,7 @@ static bool needsParen (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
return true;
@ -9814,7 +9814,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -9840,7 +9840,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -10118,7 +10118,7 @@ static decl_node doGetLastOp (decl_node a, decl_node b)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -10772,7 +10772,7 @@ static void doExprC (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -10977,7 +10977,7 @@ static void doExprM2 (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -11149,7 +11149,7 @@ static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, cons
return s;
}
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -11209,7 +11209,7 @@ static unsigned int countChar (DynamicStrings_String s, char ch)
return c;
}
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -12268,7 +12268,7 @@ static decl_node doMin (decl_node n)
M2RTS_HALT (-1); /* finish the cacading elsif statement. */
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -12349,7 +12349,7 @@ static decl_node doMax (decl_node n)
M2RTS_HALT (-1); /* finish the cacading elsif statement. */
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -12655,7 +12655,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
mcPretty_setNeedSpace (p);
@ -12745,7 +12745,7 @@ static void doSystemC (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -16099,7 +16099,7 @@ static void doCreal (mcPretty_pretty p, decl_node t)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -16130,7 +16130,7 @@ static void doCimag (mcPretty_pretty p, decl_node t)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -16261,7 +16261,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
outText (p, (const char *) ";", 1);
@ -17437,7 +17437,7 @@ static void dbs (decl_dependentState s, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
if (n != NULL)
@ -18330,10 +18330,10 @@ static decl_dependentState doDependants (alists_alist l, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -18430,7 +18430,7 @@ static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProced
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -19429,7 +19429,7 @@ static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -19776,12 +19776,12 @@ static DynamicStrings_String genKind (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
M2RTS_HALT (-1);
__builtin_unreachable ();
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -20956,7 +20956,7 @@ static void doBaseM2 (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
mcPretty_setNeedSpace (p);
@ -20982,7 +20982,7 @@ static void doSystemM2 (mcPretty_pretty p, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -22193,10 +22193,10 @@ static decl_node doDupExpr (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -22526,7 +22526,7 @@ extern "C" bool decl_isVisited (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -22556,7 +22556,7 @@ extern "C" void decl_unsetVisited (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -22584,7 +22584,7 @@ extern "C" void decl_setVisited (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -22612,7 +22612,7 @@ extern "C" void decl_setEnumsComplete (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -22640,7 +22640,7 @@ extern "C" bool decl_getEnumsComplete (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -22861,7 +22861,7 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -23236,12 +23236,12 @@ extern "C" decl_node decl_getType (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
M2RTS_HALT (-1);
__builtin_unreachable ();
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -23635,7 +23635,7 @@ extern "C" decl_node decl_getScope (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -24290,7 +24290,7 @@ extern "C" decl_node decl_makeVarient (decl_node r)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
return n;
@ -24743,6 +24743,10 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
return nameKey_makeKey ((const char *) "MIN", 3);
break;
case decl_pointerref:
return nameKey_NulName;
break;
case decl_funccall:
return nameKey_NulName;
break;
@ -24757,7 +24761,7 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
__builtin_unreachable ();
break;
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -24795,7 +24799,7 @@ extern "C" decl_node decl_import (decl_node m, decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
importEnumFields (m, n);
@ -24924,7 +24928,7 @@ extern "C" void decl_setSource (decl_node n, nameKey_Name s)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -24952,7 +24956,7 @@ extern "C" nameKey_Name decl_getSource (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
/* static analysis guarentees a RETURN statement will be used before here. */
@ -25395,7 +25399,7 @@ extern "C" void decl_addParameter (decl_node proc, decl_node param)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -25488,7 +25492,7 @@ extern "C" decl_node decl_makeBinaryTok (mcReserved_toktype op, decl_node l, dec
M2RTS_HALT (-1); /* most likely op needs a clause as above. */
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -25520,7 +25524,7 @@ extern "C" decl_node decl_makeUnaryTok (mcReserved_toktype op, decl_node e)
M2RTS_HALT (-1); /* most likely op needs a clause as above. */
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
@ -25958,7 +25962,7 @@ extern "C" void decl_setConstExpComplete (decl_node n)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -26323,7 +26327,7 @@ extern "C" void decl_putBegin (decl_node b, decl_node s)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -26350,7 +26354,7 @@ extern "C" void decl_putFinally (decl_node b, decl_node s)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
}
@ -26978,7 +26982,7 @@ extern "C" void decl_out (void)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1);
CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
__builtin_unreachable ();
}
closeOutput ();

View file

@ -928,7 +928,7 @@ static bool mangleN (nameKey_Name n, DynamicStrings_String *m, bool scopes)
return true;
}
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/keyc.def", 20, 1);
ReturnException ("../../gcc/m2/mc/keyc.def", 20, 1);
__builtin_unreachable ();
}

View file

@ -192,7 +192,7 @@ EXTERN int libc_creat (void * filename, unsigned int mode);
off_t lseek(int fildes, off_t offset, int whence);
*/
EXTERN long int libc_lseek (int fd, long int offset, int whence);
EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence);
/*
perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS).

View file

@ -258,7 +258,7 @@ static void dumpComment (mcComment_commentDesc cd)
default:
CaseException ("../../gcc-read-write/gcc/m2/mc/mcComment.def", 20, 1);
CaseException ("../../gcc/m2/mc/mcComment.def", 20, 1);
__builtin_unreachable ();
}
if (cd->used)

View file

@ -295,7 +295,7 @@ static decl_node examineCompilationUnit (void)
}
mcflex_mcError (DynamicStrings_string (DynamicStrings_InitString ((const char *) "failed to find module name", 26)));
libc_exit (1);
ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1);
ReturnException ("../../gcc/m2/mc/mcComp.def", 20, 1);
__builtin_unreachable ();
}
@ -325,7 +325,7 @@ static decl_node peepInto (DynamicStrings_String s)
mcPrintf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &s, (sizeof (s)-1));
libc_exit (1);
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1);
ReturnException ("../../gcc/m2/mc/mcComp.def", 20, 1);
__builtin_unreachable ();
}

View file

@ -55,7 +55,7 @@ extern "C" void mcDebug_assert (bool q)
{
if (! q)
{
mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/mc/mcDebug.mod", 42, 35);
mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/mc/mcDebug.mod", 27, 35);
}
}

View file

@ -409,7 +409,7 @@ static void internalFormat (DynamicStrings_String s, int i, const char *m_, unsi
s = DynamicStrings_ConCatChar (s, '^');
s = SFIO_WriteS (FIO_StdOut, s);
FIO_WriteLine (FIO_StdOut);
mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 97);
mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 97);
}
@ -421,7 +421,7 @@ static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b
{
if (a != b)
{
mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 109);
mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 109);
}
return a;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -735,7 +735,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned
case mcMetaError_chained:
if (e == NULL)
{
mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 355);
mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 355);
}
else
{
@ -759,7 +759,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned
default:
mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 369);
mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 369);
break;
}
return e;

View file

@ -166,7 +166,7 @@ extern "C" void * mcStack_pop (mcStack_stack s)
Indexing_DeleteIndice (s->list, Indexing_HighIndice (s->list));
return a;
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1);
ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1);
__builtin_unreachable ();
}
@ -216,7 +216,7 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i)
{
return Indexing_GetIndice (s->list, i);
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1);
ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1);
__builtin_unreachable ();
}

View file

@ -181,10 +181,19 @@ static void copy (mcStream_ptrToFile p)
s = DynamicStrings_InitStringCharStar (FIO_getFileName (f));
FIO_Close (f);
f = SFIO_OpenToRead (s);
while (! (FIO_EOF (f)))
while ((! (FIO_EOF (f))) && (FIO_IsNoError (f)))
{
b = FIO_ReadNBytes (f, maxBuffer, &buffer);
b = FIO_WriteNBytes (destFile, b, &buffer);
if (FIO_IsNoError (f))
{
b = FIO_WriteNBytes (destFile, b, &buffer);
}
else if (! (FIO_EOF (f)))
{
/* avoid dangling else. */
libc_printf ((const char *) "mcStream.mod:copy: error seen when reading file fragment: %s\\n", 62, DynamicStrings_string (s));
libc_exit (1);
}
}
FIO_Close (f);
}

View file

@ -324,7 +324,7 @@ extern "C" nameKey_Name nameKey_makeKey (const char *a_, unsigned int _a_high)
(*p) = ASCII_nul;
return doMakeKey (n, higha);
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1);
ReturnException ("../../gcc/m2/mc/nameKey.def", 20, 1);
__builtin_unreachable ();
}
@ -374,7 +374,7 @@ extern "C" nameKey_Name nameKey_makekey (void * a)
return doMakeKey (n, higha);
}
}
ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1);
ReturnException ("../../gcc/m2/mc/nameKey.def", 20, 1);
__builtin_unreachable ();
}

View file

@ -143,7 +143,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym
(*father) = t;
if (t == NULL)
{
Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "findNodeAndParentInTree", 23, 203);
Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "findNodeAndParentInTree", 23, 203);
}
(*child) = t->left;
if ((*child) != NULL)
@ -286,7 +286,7 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name,
}
else
{
Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "putSymKey", 9, 119);
Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "putSymKey", 9, 119);
}
}
@ -353,7 +353,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name)
}
else
{
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/mc/symbolKey.mod", 44, (const char *) "delSymKey", 9, 186);
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/m2/mc/symbolKey.mod", 29, (const char *) "delSymKey", 9, 186);
}
}

View file

@ -213,7 +213,8 @@ extern "C" varargs_vararg varargs_copy (varargs_vararg v)
for (j=0; j<=c->nArgs; j++)
{
offset = (unsigned int ) (((varargs_ptrToByte) (v->contents))-((varargs_ptrToByte) (v->arg.array[j].ptr)));
c->arg.array[j].ptr = reinterpret_cast<void *> ((varargs_ptrToByte) (((varargs_ptrToByte) (c->contents))+offset));
c->arg.array[j].ptr = reinterpret_cast<void *> ((varargs_ptrToByte) (c->contents));
c->arg.array[j].ptr = reinterpret_cast<void *> (reinterpret_cast<char *> (c->arg.array[j].ptr)+offset);
c->arg.array[j].len = v->arg.array[j].len;
}
return c;

View file

@ -118,6 +118,51 @@ EXTERN int wrapc_isfinitef (float x);
*/
EXTERN int wrapc_isfinitel (long double x);
/*
isnan - provide non builtin alternative to the gcc builtin isnan.
Returns 1 if x is a NaN otherwise return 0.
*/
EXTERN int wrapc_isnan (double x);
/*
isnanf - provide non builtin alternative to the gcc builtin isnanf.
Returns 1 if x is a NaN otherwise return 0.
*/
EXTERN int wrapc_isnanf (float x);
/*
isnanl - provide non builtin alternative to the gcc builtin isnanl.
Returns 1 if x is a NaN otherwise return 0.
*/
EXTERN int wrapc_isnanl (long double x);
/*
SeekSet - return the system libc SEEK_SET value.
*/
EXTERN int wrapc_SeekSet (void);
/*
SeekEnd - return the system libc SEEK_END value.
*/
EXTERN int wrapc_SeekEnd (void);
/*
ReadOnly - return the system value of O_RDONLY.
*/
EXTERN unsigned int wrapc_ReadOnly (void);
/*
WriteOnly - return the system value of O_WRONLY.
*/
EXTERN unsigned int wrapc_WriteOnly (void);
# ifdef __cplusplus
}
# endif

View file

@ -4243,6 +4243,7 @@ BEGIN
im : RETURN makeKey ('IM') |
max : RETURN makeKey ('MAX') |
min : RETURN makeKey ('MIN') |
pointerref : RETURN NulName |
funccall : RETURN NulName |
identlist : RETURN NulName

View file

@ -22,8 +22,8 @@ along with GNU Modula-2; see the file COPYING3. If not see
IMPLEMENTATION MODULE mcStream ;
FROM FIO IMPORT File, OpenToWrite, OpenToRead, EOF, ReadNBytes, WriteNBytes, Close, getFileName ;
FROM libc IMPORT unlink, printf, getpid ;
FROM FIO IMPORT File, OpenToWrite, OpenToRead, EOF, ReadNBytes, WriteNBytes, Close, getFileName, IsNoError ;
FROM libc IMPORT unlink, printf, getpid, exit ;
FROM Indexing IMPORT InitIndex, InBounds, HighIndice, LowIndice, PutIndice, GetIndice, Index, ForeachIndiceInIndexDo ;
FROM DynamicStrings IMPORT String, InitString, InitStringCharStar, string ;
FROM FormatStrings IMPORT Sprintf2 ;
@ -134,9 +134,17 @@ BEGIN
s := InitStringCharStar(getFileName (f)) ;
Close (f) ;
f := SFIO.OpenToRead (s) ;
WHILE NOT EOF (f) DO
WHILE (NOT EOF (f)) AND IsNoError (f) DO
b := ReadNBytes (f, HIGH (buffer), ADR (buffer)) ;
b := WriteNBytes (destFile, b, ADR (buffer))
IF IsNoError (f)
THEN
b := WriteNBytes (destFile, b, ADR (buffer))
ELSIF NOT EOF (f)
THEN
printf ("mcStream.mod:copy: error seen when reading file fragment: %s\n",
string (s)) ;
exit (1)
END
END ;
Close (f)
END

View file

@ -108,7 +108,8 @@ BEGIN
contents := memcpy (contents, v^.contents, size) ;
FOR j := 0 TO nArgs DO
offset := VAL (CARDINAL, VAL (ptrToByte, v^.contents) - VAL (ptrToByte, v^.arg[j].ptr)) ;
arg[j].ptr := VAL (ptrToByte, VAL (ptrToByte, contents) + offset) ;
arg[j].ptr := VAL (ptrToByte, contents) ;
INC (arg[j].ptr, offset) ;
arg[j].len := v^.arg[j].len ;
END
END ;

View file

@ -190,6 +190,12 @@ extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_Strin
extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b);
/*
ReplaceChar - returns string s after it has changed all occurances of from to to.
*/
extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to);
/*
Dup - duplicate a String, s, returning the copy of s.
*/
@ -1222,7 +1228,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned
(*c).next->contents.next = NULL;
ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o);
AddDebugInfo ((*c).next);
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14);
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14);
}
else
{
@ -1320,7 +1326,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne
AddDebugInfo ((*c).next);
if (TraceOn)
{
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21);
(*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 917, (const char *) "ConcatContentsAddress", 21);
}
}
else
@ -1545,7 +1551,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi
AddDebugInfo (s);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1648,7 +1654,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a)
AddDebugInfo (s);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1673,7 +1679,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch)
s = DynamicStrings_InitString ((const char *) &a.array[0], 1);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1818,6 +1824,35 @@ extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a,
}
/*
ReplaceChar - returns string s after it has changed all occurances of from to to.
*/
extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to)
{
DynamicStrings_String t;
unsigned int i;
t = s;
while (t != NULL)
{
i = 0;
while (i < t->contents.len)
{
if (t->contents.buf.array[i] == from)
{
t->contents.buf.array[i] = to;
}
i += 1;
}
t = t->contents.next;
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
/*
Dup - duplicate a String, s, returning the copy of s.
*/
@ -1831,7 +1866,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s)
s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1173, (const char *) "Dup", 3);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1853,7 +1888,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy
a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b);
if (TraceOn)
{
a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1193, (const char *) "Add", 3);
a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3);
}
return a;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -1918,7 +1953,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a)
t = DynamicStrings_InitStringCharStar (a);
if (TraceOn)
{
t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1250, (const char *) "EqualCharStar", 13);
t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13);
}
t = AddToGarbage (t, s);
if (DynamicStrings_Equal (t, s))
@ -1956,7 +1991,7 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *
t = DynamicStrings_InitString ((const char *) a, _a_high);
if (TraceOn)
{
t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1280, (const char *) "EqualArray", 10);
t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10);
}
t = AddToGarbage (t, s);
if (DynamicStrings_Equal (t, s))
@ -1994,7 +2029,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u
}
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1312, (const char *) "Mult", 4);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2073,7 +2108,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
AddDebugInfo (t->contents.next);
if (TraceOn)
{
t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1380, (const char *) "Slice", 5);
t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1405, (const char *) "Slice", 5);
}
}
t = t->contents.next;
@ -2091,7 +2126,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
}
if (TraceOn)
{
d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1397, (const char *) "Slice", 5);
d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5);
}
return d;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2219,7 +2254,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St
}
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1509, (const char *) "RemoveComment", 13);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1534, (const char *) "RemoveComment", 13);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2244,7 +2279,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString
s = DynamicStrings_Slice (s, (int ) (i), 0);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1621, (const char *) "RemoveWhitePrefix", 17);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1646, (const char *) "RemoveWhitePrefix", 17);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2269,7 +2304,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin
s = DynamicStrings_Slice (s, 0, i+1);
if (TraceOn)
{
s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1643, (const char *) "RemoveWhitePostfix", 18);
s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1668, (const char *) "RemoveWhitePostfix", 18);
}
return s;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -2636,7 +2671,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal
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, 174);
M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, (const char *) "PopAllocationExemption", 22, 174);
}
else
{

View file

@ -124,6 +124,13 @@ EXTERN DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a,
EXTERN DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b);
/*
ReplaceChar - returns string s after it has changed all
occurances of from to to.
*/
EXTERN DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to);
/*
Dup - duplicate a String, s, returning the copy of s.
*/

View file

@ -47,6 +47,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# include "GStorage.h"
# include "Gmcrts.h"
#include <unistd.h>
# include <sys/types.h>
#if defined(__cplusplus)
# undef NULL
# define NULL 0
@ -59,22 +60,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# include "GStrLib.h"
# include "GStorage.h"
# include "GNumberIO.h"
# include "Glibc.h"
# include "GIndexing.h"
# include "GM2RTS.h"
# include "Glibc.h"
# include "Gwrapc.h"
typedef unsigned int FIO_File;
FIO_File FIO_StdErr;
FIO_File FIO_StdOut;
FIO_File FIO_StdIn;
# define SEEK_SET 0
# define SEEK_END 2
# define UNIXREADONLY 0
# define UNIXWRITEONLY 1
# define CreatePermissions 0666
# define MaxBufferLength (1024*16)
# define MaxErrorString (1024*8)
# define CreatePermissions 0666
typedef struct FIO_NameInfo_r FIO_NameInfo;
typedef struct FIO_buf_r FIO_buf;
@ -198,7 +196,7 @@ extern "C" void FIO_FlushBuffer (FIO_File f);
extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest);
/*
ReadAny - reads HIGH(a) bytes into, a. All input
ReadAny - reads HIGH (a) + 1 bytes into, a. All input
is fully buffered, unlike ReadNBytes and thus is more
suited to small reads.
*/
@ -216,7 +214,7 @@ extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high)
extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src);
/*
WriteAny - writes HIGH(a) bytes onto, file, f. All output
WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output
is fully buffered, unlike WriteNBytes and thus is more
suited to small writes.
*/
@ -413,7 +411,7 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes);
Useful when performing small reads.
*/
static int BufferedRead (FIO_File f, unsigned int nBytes, void * a);
static int BufferedRead (FIO_File f, unsigned int nBytes, void * dest);
/*
HandleEscape - translates
@ -476,7 +474,7 @@ static void SetEndOfLine (FIO_File f, char ch);
Useful when performing small writes.
*/
static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a);
static int BufferedWrite (FIO_File f, unsigned int nBytes, void * src);
/*
PreInitialize - preinitialize the file descriptor.
@ -559,7 +557,7 @@ static FIO_File GetNextFreeDescriptor (void)
return f; /* create new slot */
}
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/FIO.def", 25, 1);
__builtin_unreachable ();
}
@ -676,12 +674,12 @@ static void ConnectToUnix (FIO_File f, bool towrite, bool newfile)
}
else
{
fd->unixfd = libc_open (fd->name.address, UNIXWRITEONLY, 0);
fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_WriteOnly ()), 0);
}
}
else
{
fd->unixfd = libc_open (fd->name.address, UNIXREADONLY, 0);
fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_ReadOnly ()), 0);
}
if (fd->unixfd < 0)
{
@ -812,11 +810,11 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes)
Useful when performing small reads.
*/
static int BufferedRead (FIO_File f, unsigned int nBytes, void * a)
static int BufferedRead (FIO_File f, unsigned int nBytes, void * dest)
{
typedef unsigned char *BufferedRead__T3;
void * t;
void * src;
int total;
int n;
BufferedRead__T3 p;
@ -838,7 +836,7 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a)
if (nBytes == 1)
{
/* too expensive to call memcpy for 1 character */
p = static_cast<BufferedRead__T3> (a);
p = static_cast<BufferedRead__T3> (dest);
(*p) = static_cast<unsigned char> ((*fd->buffer->contents).array[fd->buffer->position]);
fd->buffer->left -= 1; /* remove consumed byte */
fd->buffer->position += 1; /* move onwards n byte */
@ -848,13 +846,13 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a)
else
{
n = Min (fd->buffer->left, nBytes);
t = fd->buffer->address;
t = reinterpret_cast<void *> (reinterpret_cast<char *> (t)+fd->buffer->position);
p = static_cast<BufferedRead__T3> (libc_memcpy (a, t, static_cast<size_t> (n)));
src = fd->buffer->address;
src = reinterpret_cast<void *> (reinterpret_cast<char *> (src)+fd->buffer->position);
p = static_cast<BufferedRead__T3> (libc_memcpy (dest, src, static_cast<size_t> (n)));
fd->buffer->left -= n; /* remove consumed bytes */
fd->buffer->position += n; /* move onwards n bytes */
/* move onwards ready for direct reads */
a = reinterpret_cast<void *> (reinterpret_cast<char *> (a)+n);
dest = reinterpret_cast<void *> (reinterpret_cast<char *> (dest)+n);
nBytes -= n; /* reduce the amount for future direct */
/* read */
total += n;
@ -1239,11 +1237,11 @@ static void SetEndOfLine (FIO_File f, char ch)
Useful when performing small writes.
*/
static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a)
static int BufferedWrite (FIO_File f, unsigned int nBytes, void * src)
{
typedef unsigned char *BufferedWrite__T5;
void * t;
void * dest;
int total;
int n;
BufferedWrite__T5 p;
@ -1265,7 +1263,7 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a)
if (nBytes == 1)
{
/* too expensive to call memcpy for 1 character */
p = static_cast<BufferedWrite__T5> (a);
p = static_cast<BufferedWrite__T5> (src);
(*fd->buffer->contents).array[fd->buffer->position] = static_cast<char> ((*p));
fd->buffer->left -= 1; /* reduce space */
fd->buffer->position += 1; /* move onwards n byte */
@ -1275,13 +1273,13 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a)
else
{
n = Min (fd->buffer->left, nBytes);
t = fd->buffer->address;
t = reinterpret_cast<void *> (reinterpret_cast<char *> (t)+fd->buffer->position);
p = static_cast<BufferedWrite__T5> (libc_memcpy (a, t, static_cast<size_t> ((unsigned int ) (n))));
dest = fd->buffer->address;
dest = reinterpret_cast<void *> (reinterpret_cast<char *> (dest)+fd->buffer->position);
p = static_cast<BufferedWrite__T5> (libc_memcpy (dest, src, static_cast<size_t> ((unsigned int ) (n))));
fd->buffer->left -= n; /* remove consumed bytes */
fd->buffer->position += n; /* move onwards n bytes */
/* move ready for further writes */
a = reinterpret_cast<void *> (reinterpret_cast<char *> (a)+n);
src = reinterpret_cast<void *> (reinterpret_cast<char *> (src)+n);
nBytes -= n; /* reduce the amount for future writes */
total += n; /* reduce the amount for future writes */
}
@ -1689,7 +1687,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void *
/*
ReadAny - reads HIGH(a) bytes into, a. All input
ReadAny - reads HIGH (a) + 1 bytes into, a. All input
is fully buffered, unlike ReadNBytes and thus is more
suited to small reads.
*/
@ -1697,7 +1695,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void *
extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high)
{
CheckAccess (f, FIO_openedforread, false);
if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high)))
if ((BufferedRead (f, _a_high+1, a)) == ((int ) (_a_high+1)))
{
SetEndOfLine (f, static_cast<char> (a[_a_high]));
}
@ -1748,7 +1746,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void *
/*
WriteAny - writes HIGH(a) bytes onto, file, f. All output
WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output
is fully buffered, unlike WriteNBytes and thus is more
suited to small writes.
*/
@ -1756,7 +1754,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void *
extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high)
{
CheckAccess (f, FIO_openedforwrite, true);
if ((BufferedWrite (f, _a_high, a)) == ((int ) (_a_high)))
if ((BufferedWrite (f, _a_high+1, a)) == ((int ) (_a_high+1)))
{} /* empty. */
}
@ -2096,7 +2094,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos)
fd->buffer->position = 0;
fd->buffer->filled = 0;
}
offset = libc_lseek (fd->unixfd, pos, SEEK_SET);
offset = static_cast<long int> (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekSet ()));
if ((offset >= 0) && (pos == offset))
{
fd->abspos = pos;
@ -2145,7 +2143,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos)
fd->buffer->position = 0;
fd->buffer->filled = 0;
}
offset = libc_lseek (fd->unixfd, pos, SEEK_END);
offset = static_cast<long int> (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekEnd ()));
if (offset >= 0)
{
fd->abspos = offset;

View file

@ -135,7 +135,7 @@ EXTERN void FIO_FlushBuffer (FIO_File f);
EXTERN unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest);
/*
ReadAny - reads HIGH(a) bytes into, a. All input
ReadAny - reads HIGH (a) + 1 bytes into, a. All input
is fully buffered, unlike ReadNBytes and thus is more
suited to small reads.
*/
@ -153,7 +153,7 @@ EXTERN void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high);
EXTERN unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src);
/*
WriteAny - writes HIGH(a) bytes onto, file, f. All output
WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output
is fully buffered, unlike WriteNBytes and thus is more
suited to small writes.
*/

View file

@ -286,12 +286,13 @@ static void dononraw (termios_TERMIOS term)
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;
unsigned int fdi;
for (fdi=0; fdi<=MaxDefaultFd; fdi++)
{
fdState.array[fdi].IsEof = false;
fdState.array[fdi].IsRaw = false;
}
}

View file

@ -228,7 +228,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n)
{
return (n >= i->Low) && (n <= i->High);
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1);
__builtin_unreachable ();
}
@ -248,7 +248,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i)
{
return i->High;
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1);
__builtin_unreachable ();
}
@ -268,7 +268,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i)
{
return i->Low;
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -137,6 +137,12 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
/*
InitDependencyList - initialize all fields of DependencyList.
*/
static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state);
/*
CreateModule - creates a new module entry and returns the
ModuleChain.
@ -357,6 +363,20 @@ static void Init (void);
static void CheckInitialized (void);
/*
InitDependencyList - initialize all fields of DependencyList.
*/
static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state)
{
(*depList).proc = proc;
(*depList).forced = false;
(*depList).forc = false;
(*depList).appl = false;
(*depList).state = state;
}
/*
CreateModule - creates a new module entry and returns the
ModuleChain.
@ -371,8 +391,7 @@ static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Depe
mptr->libname = libname;
mptr->init = init;
mptr->fini = fini;
mptr->dependency.proc = dependencies;
mptr->dependency.state = M2Dependent_unregistered;
InitDependencyList (&mptr->dependency, dependencies, M2Dependent_unregistered);
mptr->prev = NULL;
mptr->next = NULL;
if (HexTrace)

View file

@ -57,13 +57,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
n = RTExceptions_GetNumber (e);
if (n == (UINT_MAX))
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
}
else
{
return (M2EXCEPTION_M2Exceptions) (n);
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -331,7 +331,7 @@ extern "C" NameKey_Name NameKey_MakeKey (const char *a_, unsigned int _a_high)
(*p) = ASCII_nul;
return DoMakeKey (n, higha);
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1);
ReturnException ("../../gcc/m2/gm2-compiler/NameKey.def", 20, 1);
__builtin_unreachable ();
}
@ -381,7 +381,7 @@ extern "C" NameKey_Name NameKey_makekey (void * a)
return DoMakeKey (n, higha);
}
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1);
ReturnException ("../../gcc/m2/gm2-compiler/NameKey.def", 20, 1);
__builtin_unreachable ();
}
@ -421,12 +421,15 @@ extern "C" unsigned int NameKey_LengthKey (NameKey_Name Key)
unsigned int i;
NameKey_PtrToChar p;
p = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (Key));
i = 0;
while ((*p) != ASCII_nul)
if (Key != NameKey_NulName)
{
i += 1;
p += 1;
p = static_cast<NameKey_PtrToChar> (NameKey_KeyToCharStar (Key));
while ((*p) != ASCII_nul)
{
i += 1;
p += 1;
}
}
return i;
/* static analysis guarentees a RETURN statement will be used before here. */

View file

@ -276,7 +276,7 @@ extern "C" char PushBackInput_PutCh (char ch)
}
else
{
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);
Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutCh", 5, 151);
}
return ch;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -302,7 +302,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high)
l -= 1;
if ((PushBackInput_PutCh (a[l])) != a[l])
{
Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132);
Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutString", 9, 132);
}
}
}
@ -323,7 +323,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s)
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, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113);
Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutStr", 6, 113);
}
}
}

View file

@ -725,7 +725,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
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")), 614, 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/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")));
}
@ -735,7 +735,7 @@ static void indexf (void * a)
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")), 626, 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/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")));
}
@ -745,7 +745,7 @@ static void range (void * a)
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")), 638, 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/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")));
}
@ -755,7 +755,7 @@ static void casef (void * a)
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")), 650, 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/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")));
}
@ -765,7 +765,7 @@ static void invalidloc (void * a)
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")), 662, 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/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 ? */
}
@ -775,7 +775,7 @@ static void function (void * a)
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")), 674, 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/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")));
}
@ -785,7 +785,7 @@ static void wholevalue (void * a)
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")), 686, 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/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")));
}
@ -795,7 +795,7 @@ static void wholediv (void * a)
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")), 698, 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/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")));
}
@ -805,7 +805,7 @@ static void realvalue (void * a)
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")), 710, 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/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")));
}
@ -815,7 +815,7 @@ static void realdiv (void * a)
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")), 722, 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/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")));
}
@ -825,7 +825,7 @@ static void complexvalue (void * a)
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")), 734, 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/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")));
}
@ -835,7 +835,7 @@ static void complexdiv (void * a)
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")), 746, 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/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
}
@ -845,7 +845,7 @@ static void protection (void * a)
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")), 758, 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/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
}
@ -855,7 +855,7 @@ static void systemf (void * a)
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")), 770, 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/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
}
@ -865,7 +865,7 @@ static void coroutine (void * a)
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")), 782, 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/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
}
@ -1183,13 +1183,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void)
{
if (currentEHB == NULL)
{
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);
M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc/m2/gm2-libs/RTExceptions.mod", 38, (const char *) "GetBaseExceptionBlock", 21, 600);
}
else
{
return currentEHB;
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -192,7 +192,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1);
__builtin_unreachable ();
}
@ -251,7 +251,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1);
ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1);
__builtin_unreachable ();
}

View file

@ -184,7 +184,7 @@ static void FindNodeParentInTree (SymbolKey_SymbolTree t, NameKey_Name n, Symbol
(*parent) = t;
if (t == NULL)
{
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);
Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "FindNodeParentInTree", 20, 241);
}
Assertion_Assert (t->Right == NULL);
(*child) = t->Left;
@ -393,7 +393,7 @@ extern "C" void SymbolKey_PutSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe
}
else
{
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);
Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "PutSymKey", 9, 156);
}
}
@ -460,7 +460,7 @@ extern "C" void SymbolKey_DelSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe
}
else
{
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);
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/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "DelSymKey", 9, 223);
}
}

View file

@ -94,7 +94,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size)
(*a) = libc_malloc (static_cast<size_t> (size));
if ((*a) == NULL)
{
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);
Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "ALLOCATE", 8, 51);
}
if (enableTrace && trace)
{
@ -119,7 +119,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size)
}
if ((libc_memset ((*a), 0, static_cast<size_t> (size))) != (*a))
{
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);
Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "DEALLOCATE", 10, 78);
}
}
if (enableDeallocation)
@ -164,7 +164,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size)
(*a) = libc_realloc ((*a), static_cast<size_t> (size));
if ((*a) == NULL)
{
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);
Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "REALLOCATE", 10, 122);
}
if (enableTrace && trace)
{

View file

@ -192,7 +192,7 @@ EXTERN int libc_creat (void * filename, unsigned int mode);
off_t lseek(int fildes, off_t offset, int whence);
*/
EXTERN long int libc_lseek (int fd, long int offset, int whence);
EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence);
/*
perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS).

View file

@ -164,6 +164,38 @@ wrapc_signbitf (float r)
#endif
}
/* SeekSet return the system libc SEEK_SET value. */
int
wrapc_SeekSet (void)
{
return SEEK_SET;
}
/* SeekEnd return the system libc SEEK_END value. */
int
wrapc_SeekEnd (void)
{
return SEEK_END;
}
/* ReadOnly return the system value of O_RDONLY. */
int
wrapc_ReadOnly (void)
{
return O_RDONLY;
}
/* WriteOnly return the system value of O_WRONLY. */
int
wrapc_WriteOnly (void)
{
return O_WRONLY;
}
/* init constructor for the module. */
void

View file

@ -118,6 +118,51 @@ EXTERN int wrapc_isfinitef (float x);
*/
EXTERN int wrapc_isfinitel (long double x);
/*
isnan - provide non builtin alternative to the gcc builtin isnan.
Returns 1 if x is a NaN otherwise return 0.
*/
EXTERN int wrapc_isnan (double x);
/*
isnanf - provide non builtin alternative to the gcc builtin isnanf.
Returns 1 if x is a NaN otherwise return 0.
*/
EXTERN int wrapc_isnanf (float x);
/*
isnanl - provide non builtin alternative to the gcc builtin isnanl.
Returns 1 if x is a NaN otherwise return 0.
*/
EXTERN int wrapc_isnanl (long double x);
/*
SeekSet - return the system libc SEEK_SET value.
*/
EXTERN int wrapc_SeekSet (void);
/*
SeekEnd - return the system libc SEEK_END value.
*/
EXTERN int wrapc_SeekEnd (void);
/*
ReadOnly - return the system value of O_RDONLY.
*/
EXTERN unsigned int wrapc_ReadOnly (void);
/*
WriteOnly - return the system value of O_WRONLY.
*/
EXTERN unsigned int wrapc_WriteOnly (void);
# ifdef __cplusplus
}
# endif

View file

@ -59,6 +59,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <time.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
/* Define a generic NULL if one hasn't already been defined. */
#if !defined(NULL)
@ -316,6 +320,39 @@ EXPORT(isnanl) (long double x)
#endif
}
/* SeekSet return the system libc SEEK_SET value. */
extern "C" int
EXPORT(SeekSet) (void)
{
return SEEK_SET;
}
/* SeekEnd return the system libc SEEK_END value. */
extern "C" int
EXPORT(SeekEnd) (void)
{
return SEEK_END;
}
/* ReadOnly return the system value of O_RDONLY. */
extern "C" int
EXPORT(ReadOnly) (void)
{
return O_RDONLY;
}
/* WriteOnly return the system value of O_WRONLY. */
extern "C" int
EXPORT(WriteOnly) (void)
{
return O_WRONLY;
}
/* GNU Modula-2 linking hooks. */
extern "C" void