This is a patch to improve the layering of libgm2.
It removes the m2cor Debug.{def,mod} (the codebase will use
m2pim Debug instead). It also layers SysStorage under
both m2pim Storage and m2iso Storage. SysStorage is now
a dependant of m2pim Storage.mod. Halt parameters for
Debug.mod and M2RTS.mod now have the same order.
gcc/m2/ChangeLog:
* gm2-compiler/SymbolKey.mod (PutSymKey): Halt parameters
reordered.
(DelSymKey): Ditto.
* gm2-compiler/ppg.mod (GetEpsilon): Ditto.
(GetReachEnd): Ditto.
(GetFollow): Ditto.
(CodeCondition): Ditto.
(CodeThenDo): Ditto.
(CodeEnd): Ditto.
(RecoverCondition): Ditto.
(ConditionIndent): Ditto.
* gm2-libs-ch/m2rts.h (M2RTS_Halt): Ditto.
* gm2-libs-coroutines/Executive.mod (Assert): Ditto.
(Resume): Remove redundant comments.
(Wait): Remove redundant comments.
* gm2-libs-coroutines/SYSTEM.mod (TRANSFER): Halt parameters
reordered.
(IOTransferHandler): Ditto.
(Finished): Ditto.
(localInit): Ditto.
* gm2-libs-coroutines/TimerHandler.mod (WaitOn): Halt parameters
reordered.
(Cancel): Ditto.
(ReArmEvent): Ditto.
(OnActiveQueue): Ditto.
* gm2-libs-iso/COROUTINES.mod (NEWCOROUTINE): Ditto.
(Transfer): Ditto.
(IOTRANSFER): Ditto.
* gm2-libs-iso/EXCEPTIONS.mod (RAISE): Correct Halt parameters.
* gm2-libs-iso/M2RTS.def (Halt): Halt parameters reordered.
(HaltC): Ditto.
* gm2-libs-iso/M2RTS.mod: Ditto.
* gm2-libs-iso/RTentity.mod (PutKey): Ditto.
(DelKey): Ditto.
(findChildAndParent): Ditto.
(assert): Ditto.
* gm2-libs-iso/Storage.mod (ALLOCATE): Add DebugTrace.
Add UseMallocFree test.
(DEALLOCATE): Add DebugTrace. Add UseMallocFree test.
(assert): Halt parameters reordered.
* gm2-libs-log/Termbase.mod (Read): Ditto.
(KeyPressed): Ditto.
(Write): Ditto.
(Init): Ditto.
* gm2-libs/Debug.def (Halt): Halt parameters reordered.
* gm2-libs/Debug.mod (Halt): Ditto.
* gm2-libs/DynamicStrings.def (PopAllocation): Improve comment.
* gm2-libs/DynamicStrings.mod (PopAllocation): Improve comment.
Halt parameters reordered.
* gm2-libs/M2RTS.def (Halt): Ditto.
(HaltC): Ditto.
* gm2-libs/M2RTS.mod (Halt): Ditto.
(HaltC): Ditto.
* gm2-libs/PushBackInput.mod (PutStr): Ditto.
(PutString): Ditto.
(PutCh): Ditto.
* gm2-libs/RTExceptions.mod (GetBaseExceptionBlock): Ditto.
* gm2-libs/RTint.mod (ReArmTimeVector): Ditto.
(GetTimeVector): Ditto.
(AttachVector): Ditto.
(IncludeVector): Ditto.
(Listen): Ditto.
* gm2-libs/SysStorage.mod (ALLOCATE): Ditto.
(DEALLOCATE): Ditto.
(REALLOCATE): Ditto.
* gm2-libs-coroutines/Debug.def: Removed.
* gm2-libs-coroutines/Debug.mod: Removed.
libgm2/ChangeLog:
* libm2cor/Makefile.am: Remove
* libm2cor/Makefile.in: Rebuild.
* libm2iso/RTco.cc (newSem): Halt parameters reordered.
(currentThread): Ditto.
(never): Ditto.
(defined): Ditto.
(initThread): Ditto.
* libm2iso/m2rts.h (m2iso_M2RTS_HaltC): Ditto.
gcc/testsuite/ChangeLog:
* gm2/complex/pass/arith3.mod: Halt parameters reordered.
* gm2/complex/run/pass/arith3.mod: Ditto.
* gm2/complex/run/pass/arith4.mod: Ditto.
* gm2/complex/run/pass/arith5.mod: Ditto.
* gm2/isolib/run/pass/real2.mod: Ditto.
* gm2/isolib/run/pass/real3.mod: Ditto.
* gm2/isolib/run/pass/realconv.mod: Ditto.
* gm2/isolib/run/pass/realconv2.mod: Ditto.
* gm2/pim/pass/testshort.mod: Ditto.
* gm2/projects/pim/run/pass/tower/AdvSystem.mod: Ditto.
* gm2/projects/pim/run/pass/tower/DrawL.mod: Ditto.
* gm2/warnings/returntype/pass/Termbase.mod: Ditto.
* gm2/warnings/returntype/pass/keypressedsimple.mod: Ditto.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
KeyName := NameKey
END
ELSE
- Halt('symbol already stored', __LINE__, __FILE__)
+ Halt('symbol already stored', __FILE__, __FUNCTION__, __LINE__)
END
END PutSymKey ;
END
ELSE
Halt('trying to delete a symbol that is not in the tree - the compiler never expects this to occur',
- __LINE__, __FILE__)
+ __FILE__, __FUNCTION__, __LINE__)
END
END DelSymKey ;
parent := t ;
IF t=NIL
THEN
- Halt('parameter t should never be NIL', __LINE__, __FILE__)
+ Halt('parameter t should never be NIL',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
Assert (t^.Right = NIL) ;
child := t^.Left ;
BEGIN
IF f=NIL
THEN
- Halt('why is the follow info NIL?', __LINE__, __FILE__)
+ Halt('why is the follow info NIL?',
+ __FILE_, __FUNCTION__, __LINE__)
ELSE
RETURN( f^.epsilon )
END
BEGIN
IF f=NIL
THEN
- Halt('why is the follow info NIL?', __LINE__, __FILE__)
+ Halt('why is the follow info NIL?',
+ __FILE_, __FUNCTION__, __LINE__)
ELSE
RETURN( f^.reachend )
END
WITH f^ DO
IF calcfollow
THEN
- Halt('why are we reassigning this follow set?', __LINE__, __FILE__)
+ Halt('why are we reassigning this follow set?',
+ __FILE_, __FUNCTION__, __LINE__)
END ;
follow := s ;
calcfollow := TRUE
BEGIN
IF f=NIL
THEN
- Halt('why is the follow info NIL?', __LINE__, __FILE__)
+ Halt ('why is the follow info NIL?',
+ __FILE_, __FUNCTION__, __LINE__)
ELSE
WITH f^ DO
IF calcfollow
THEN
RETURN( follow )
ELSE
- Halt('not calculated the follow set yet..', __LINE__, __FILE__)
+ Halt('not calculated the follow set yet..',
+ __FILE_, __FUNCTION__, __LINE__)
END
END
END
m2while: IndentString('WHILE ')
ELSE
- Halt('unrecognised m2condition', __LINE__, __FILE__)
+ Halt('unrecognised m2condition',
+ __FILE_, __FUNCTION__, __LINE__)
END
END CodeCondition ;
Output.WriteLn
ELSE
- Halt('unrecognised m2condition', __LINE__, __FILE__)
+ Halt('unrecognised m2condition',
+ __FILE_, __FUNCTION__, __LINE__)
END ;
OnLineStart := TRUE
END CodeThenDo ;
m2while: IndentString('END ; (* while *)')
ELSE
- Halt('unrecognised m2condition', __LINE__, __FILE__)
+ Halt('unrecognised m2condition',
+ __FILE_, __FUNCTION__, __LINE__)
END ;
OnLineStart := FALSE
END CodeEnd ;
m2while: IndentString('WHILE ')
ELSE
- Halt('unrecognised m2condition', __LINE__, __FILE__)
+ Halt('unrecognised m2condition',
+ __FILE_, __FUNCTION__, __LINE__)
END
END RecoverCondition ;
m2while: RETURN( 6 )
ELSE
- Halt('unrecognised m2condition', __LINE__, __FILE__)
+ Halt('unrecognised m2condition',
+ __FILE_, __FUNCTION__, __LINE__)
END
END ConditionIndent ;
WasNoError := FALSE
ELSE
- Halt('unknown element in enumeration type', __LINE__, __FILE__)
+ Halt('unknown element in enumeration type',
+ __FILE_, __FUNCTION__, __LINE__)
END
END ;
from := from^.next
extern "C" void M2RTS_Terminate (void);
extern "C" void M2RTS_DeconstructModules (void);
-extern "C" void M2RTS_Halt (const char *, int, const char *, const char *) __attribute__ ((noreturn));
+extern "C" void M2RTS_Halt (const char *, const char *, const char *, int) __attribute__ ((noreturn));
+++ /dev/null
-(* Debug.def provides some simple debugging routines.
-
-Copyright (C) 2002-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GNU Modula-2 is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. *)
-
-DEFINITION MODULE Debug ;
-
-(*
- Title : Debug
- Author : Gaius Mulley
- System : UNIX (gm2)
- Date : Sat Aug 13 19:41:57 1994
- Last edit : Sat Aug 13 19:41:57 1994
- Description: provides some simple debugging routines.
-*)
-
-EXPORT QUALIFIED Halt, DebugString, PushOutput ;
-
-TYPE
- WriteP = PROCEDURE (CHAR) ;
-
-
-(*
- Halt - writes a message in the format:
- Module:Line:Message
-
- It then terminates by calling HALT.
-*)
-
-PROCEDURE Halt (File : ARRAY OF CHAR;
- LineNo : CARDINAL;
- Function,
- Message : ARRAY OF CHAR) <* noreturn *> ;
-
-
-(*
- DebugString - writes a string to the debugging device (Scn.Write).
- It interprets \n as carriage return, linefeed.
-*)
-
-PROCEDURE DebugString (a: ARRAY OF CHAR) ;
-
-
-(*
- PushOutput - pushes the output procedure, p, which is used Debug.
-*)
-
-PROCEDURE PushOutput (p: WriteP) ;
-
-
-(*
- PopOutput - pops the current output procedure from the stack.
-*)
-
-PROCEDURE PopOutput ;
-
-
-END Debug.
+++ /dev/null
-(* Debug.mod provides some simple debugging routines.
-
-Copyright (C) 2002-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GNU Modula-2 is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. *)
-
-IMPLEMENTATION MODULE Debug ;
-
-
-FROM ASCII IMPORT cr, nul, lf ;
-FROM NumberIO IMPORT CardToStr ;
-FROM libc IMPORT exit, write ;
-FROM SYSTEM IMPORT ADR ;
-
-
-CONST
- MaxStack = 10 ;
-
-VAR
- Stack: ARRAY [1..MaxStack] OF WriteP ;
- Ptr : CARDINAL ;
-
-
-PROCEDURE Write (ch: CHAR) ;
-BEGIN
- IF Ptr>0
- THEN
- Stack[Ptr](ch)
- ELSE
- LocalWrite(ch)
- END
-END Write ;
-
-
-PROCEDURE LocalWrite (ch: CHAR) ;
-VAR
- r: INTEGER ;
-BEGIN
- r := write(2, ADR(ch), 1)
-END LocalWrite ;
-
-
-(*
- PushOutput - pushes the output procedure, p, which is used Debug.
-*)
-
-PROCEDURE PushOutput (p: WriteP) ;
-BEGIN
- IF Ptr=MaxStack
- THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'stack exceeded')
- ELSE
- INC(Ptr) ;
- Stack[Ptr] := p
- END
-END PushOutput ;
-
-
-(*
- PopOutput - pops the current output procedure from the stack.
-*)
-
-PROCEDURE PopOutput ;
-BEGIN
- IF Ptr>1
- THEN
- DEC(Ptr)
- END
-END PopOutput ;
-
-
-(*
- Halt - writes a message in the format:
- Module:Line:Message
-
- It then terminates by calling HALT.
-*)
-
-PROCEDURE Halt (File : ARRAY OF CHAR;
- LineNo : CARDINAL;
- Function,
- Message : ARRAY OF CHAR) ;
-CONST
- MaxNoOfDigits = 12 ; (* should be large enough for most source files.. *)
-VAR
- No : ARRAY [0..MaxNoOfDigits] OF CHAR ;
-BEGIN
- DebugString(File) ;
- CardToStr(LineNo, 0, No) ;
- DebugString(':') ;
- DebugString(No) ;
- DebugString(':') ;
- DebugString(Function) ;
- DebugString(':') ;
- DebugString(Message) ;
- DebugString('\n') ;
- HALT
-END Halt ;
-
-
-(*
- DebugString - writes a string to the debugging device (Scn.Write).
- It interprets \n as carriage return, linefeed.
-*)
-
-PROCEDURE DebugString (a: ARRAY OF CHAR) ;
-VAR
- n, high: CARDINAL ;
-BEGIN
- high := HIGH( a ) ;
- n := 0 ;
- WHILE (n <= high) AND (a[n] # nul) DO
- IF a[n]='\'
- THEN
- IF n+1<=high
- THEN
- IF a[n+1]='n'
- THEN
- WriteLn ;
- INC(n)
- ELSIF a[n+1]='\'
- THEN
- Write('\') ;
- INC(n)
- END
- END
- ELSE
- Write( a[n] )
- END ;
- INC( n )
- END
-END DebugString ;
-
-
-(*
- WriteLn - writes a carriage return and a newline
- character.
-*)
-
-PROCEDURE WriteLn ;
-BEGIN
- Write(cr) ;
- Write(lf)
-END WriteLn ;
-
-
-(*
- Init - initialises this module.
-*)
-
-PROCEDURE Init ;
-BEGIN
- Ptr := 0 ;
- PushOutput(LocalWrite)
-END Init ;
-
-
-BEGIN
- Init
-END Debug.
IF NOT c
THEN
Ps ;
- Halt(file, line, function, 'assert failed')
+ Halt ('assert failed', file, function, line)
END
END Assert ;
ToOldState: PROTECTION ;
BEGIN
(* ToOldState := TurnInterrupts(MAX(PROTECTION)) ; (* disable interrupts *) *)
-
- (* your code needs to go here *)
- WITH d^ DO (* remove for student *)
- IF Status=Suspended (* remove for student *)
- THEN (* remove for student *)
- (* legal state transition *) (* remove for student *)
- Status := Runnable ; (* change status *) (* remove for student *)
- AddToReady(d) ; (* add to run queue *) (* remove for student *)
- RunQueue[RunPriority] := d ; (* make d at top of q *) (* remove for student *)
- Reschedule (* check whether this process has a higher run priority *) (* remove for student *)
- ELSE (* remove for student *)
- (* we are trying to Resume a process which is *) (* remove for student *)
- Halt(__FILE__, __LINE__, __FUNCTION__, (* remove for student *)
- 'trying to resume a process which is not suspended') ; (* remove for student *)
- RETURN( NIL ) (* not held in a Suspended state - error *) (* remove for student *)
- END (* remove for student *)
- END ; (* remove for student *)
+ WITH d^ DO
+ IF Status=Suspended
+ THEN
+ (* legal state transition *)
+ Status := Runnable ; (* change status *)
+ AddToReady(d) ; (* add to run queue *)
+ RunQueue[RunPriority] := d ; (* make d at top of q *)
+ Reschedule (* check whether this process has a higher run priority *)
+ ELSE
+ (* we are trying to Resume a process which is *)
+ Halt ('trying to resume a process which is not suspended',
+ __FILE__, __FUNCTION__, __LINE__) ;
+ RETURN( NIL ) (* not held in a Suspended state - error *)
+ END
+ END ;
(* ToOldState := TurnInterrupts(ToOldState) ; (* restore interrupts *) *)
RETURN( d )
END Resume ;
ToOldState: PROTECTION ;
BEGIN
(* ToOldState := TurnInterrupts(MAX(PROTECTION)) ; (* disable interrupts *) *)
-
- (* your code needs to go here *)
- WITH s^ DO (* remove for student *)
- IF Value>0 (* remove for student *)
- THEN (* remove for student *)
- DEC( Value ) (* remove for student *)
- ELSE (* remove for student *)
- SubFromReady(CurrentProcess) ; (* remove from run q *) (* remove for student *)
+ WITH s^ DO
+ IF Value>0
+ THEN
+ DEC( Value )
+ ELSE
+ SubFromReady(CurrentProcess) ; (* remove from run q *)
IF Who=CurrentProcess
THEN
Ps ;
- Halt(__FILE__, __LINE__, __FUNCTION__, 'we are already on sem')
+ Halt ('we are already on sem',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
- AddToSemaphore(Who, CurrentProcess) ; (* add to semaphore q *) (* remove for student *)
- CurrentProcess^.Status := WaitOnSem ; (* set new status *) (* remove for student *)
- CurrentProcess^.Which := s ; (* debugging aid *) (* remove for student *)
- Reschedule (* find next process *) (* remove for student *)
- END (* remove for student *)
- END ; (* remove for student *)
+ AddToSemaphore(Who, CurrentProcess) ; (* add to semaphore q *)
+ CurrentProcess^.Status := WaitOnSem ; (* set new status *)
+ CurrentProcess^.Which := s ; (* debugging aid *)
+ Reschedule (* find next process *)
+ END
+ END ;
(* ToOldState := TurnInterrupts(ToOldState) (* restore interrupts *) *)
END Wait ;
localMain (p1) ;
IF p1.context=p2.context
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'error when attempting to context switch to the same process')
+ Halt('error when attempting to context switch to the same process',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
transfer (p1.context, p2.context)
END TRANSFER ;
BEGIN
IF l=NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'no processes attached to this interrupt vector which is associated with IOTRANSFER')
+ Halt ('no processes attached to this interrupt vector which is associated with IOTRANSFER',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
WITH l^ DO
old := AttachVector (InterruptNo, next) ;
IF old#l
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'inconsistancy of return result')
+ Halt ('inconsistancy of return result',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
IF next=NIL
THEN
PROCEDURE Finished (p: ADDRESS) ;
BEGIN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'process terminated illegally')
+ Halt('process terminated illegally',
+ __FILE__, __FUNCTION__, __LINE__)
END Finished ;
initGTh := TRUE ;
IF init () # 0
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__, "gthr did not initialize")
+ Halt ("gthr did not initialize",
+ __FILE__, __FUNCTION__, __LINE__)
END ;
RTint.Init
END
(* ToOldState := TurnInterrupts(MAX(PROTECTION)) ; (* disable interrupts *) *)
IF e=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'event should never be NIL')
+ Halt ('event should never be NIL',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
WITH e^ DO
(* we will just check to see whether someone has cancelled this *)
Cancelled := NOT WasCancelled ;
IF WasCancelled
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'inconsistancy event has been cancelled and it is on queue')
+ Halt ('inconsistancy event has been cancelled and it is on queue',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
OnSoloQueue(e) ;
WasCancelled := TRUE ;
NoOfTicks := t ; (* give it a new time *)
OnActiveQueue(e) (* back on queue *)
ELSE
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'ReArm should not be asked to ReArm a dead event')
+ Halt ('ReArm should not be asked to ReArm a dead event',
+ __FILE__, __FUNCTION__, __LINE__)
END
END ;
(* ToOldState := TurnInterrupts(ToOldState) ; (* restore interrupts *) *)
THEN
IF IsOnDeadQueue(e)
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'illegal state change')
+ Halt ('illegal state change',
+ __FILE__, __FUNCTION__, __LINE__)
ELSIF IsOnSoloQueue(e)
THEN
RelativeAddToActive(e) ;
tp := initThread (procBody, size, initProtection) ;
IF tp = -1
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__, 'unable to create a new thread')
+ Halt ('unable to create a new thread', __FILE__, __FUNCTION__, __LINE__)
END ;
NEW (cr) ;
WITH cr^ DO
from := currentCoRoutine ;
IF to^.context = from^.context
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'error when attempting to context switch to the same process')
+ Halt ('error when attempting to context switch to the same process',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
from^.inexcept := SetExceptionState (to^.inexcept) ;
from^.source := GetExceptionSource () ;
Init ;
IF init () # 0
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'failed to initialize RTco')
+ Halt ('failed to initialize RTco',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
RTint.Init ;
initCo := TRUE
old := TurnInterrupts (MAX (PROTECTION)) ;
IF from = to
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- "error IOTRANSFER cannot transfer control to the running COROUTINE")
+ Halt ("error IOTRANSFER cannot transfer control to the running COROUTINE",
+ __FILE__, __FUNCTION__, __LINE__)
END ;
wait (lock) ;
l := currentCoRoutine^.attached ;
localInit ;
IF l = NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'no coroutine attached to this interrupt vector which was initiated by IOTRANSFER')
+ Halt ('no coroutine attached to this interrupt vector which was initiated by IOTRANSFER',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
IF Debugging
THEN
ourself := AttachVector (InterruptNo, chain) ;
IF ourself # l
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'inconsistancy of return result')
+ Halt ('inconsistancy of return result',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
IF chain = NIL
THEN
RTExceptions.SetExceptionBlock(source^.eh) ;
RTExceptions.Raise(number, ADR(__FILE__), __LINE__, __COLUMN__, ADR(__FUNCTION__), ADR(message)) ;
(* we should never reach here as Raise should jump to the exception handler *)
- M2RTS.Halt(__FILE__, __LINE__, __FUNCTION__, 'should never return from RTException.Raise')
+ M2RTS.Halt('should never return from RTException.Raise',
+ __FILE__, __FUNCTION__, __LINE__)
END RAISE ;
to stderr and calls exit (1).
*)
-PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL;
- function: ARRAY OF CHAR; description: ARRAY OF CHAR)
- <* noreturn *> ;
+PROCEDURE Halt (description, filename, function: ARRAY OF CHAR;
+ line: CARDINAL) <* noreturn *> ;
(*
to stderr and calls exit (1).
*)
-PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL;
- function, description: ADDRESS) <* noreturn *> ;
+PROCEDURE HaltC (description, filename, function: ADDRESS;
+ line: CARDINAL) <* noreturn *> ;
+
(*
to stderr and calls exit (1).
*)
-PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL;
- function, description: ADDRESS) ;
+PROCEDURE HaltC (description, filename, function: ADDRESS; line: CARDINAL) ;
BEGIN
ErrorMessageC (description, filename, line, function)
END HaltC ;
to stderr and calls exit (1).
*)
-PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL;
- function: ARRAY OF CHAR; description: ARRAY OF CHAR) ;
+PROCEDURE Halt (description, filename, function: ARRAY OF CHAR; line: CARDINAL) ;
BEGIN
ErrorMessage (description, filename, line, function)
END Halt ;
entityKey := key
END
ELSE
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'internal runtime error, entity already stored')
+ Halt ('internal runtime error, entity already stored',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
signal (mutex)
END PutKey ;
free (child)
END
ELSE
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'internal runtime error, trying to delete an entity which is not in the tree')
+ Halt('internal runtime error, trying to delete an entity which is not in the tree',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
signal (mutex)
END DelKey ;
parent := t ;
IF t = NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'internal runtime error, RTentity is either corrupt or the module storage has not been initialized yet')
+ Halt ('internal runtime error, RTentity is either corrupt or the module storage has not been initialized yet',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
child := t^.left ;
IF child # NIL
BEGIN
IF NOT condition
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'internal runtime error, RTentity is either corrupt or the module storage has not been initialized yet')
+ Halt ('internal runtime error, RTentity is either corrupt or the module storage has not been initialized yet',
+ __FILE__, __FUNCTION__, __LINE__)
END
END assert ;
IMPLEMENTATION MODULE Storage ;
-FROM libc IMPORT malloc, free, memcpy ;
+FROM libc IMPORT memcpy, abort, malloc, free, printf ;
+
+IMPORT SysStorage ;
+
FROM M2RTS IMPORT Halt ;
FROM SYSTEM IMPORT TSIZE ;
FROM M2EXCEPTION IMPORT M2Exceptions ;
IsExceptionalExecution ;
+CONST
+ DebugTrace = FALSE ;
+ UseMallocFree = FALSE ;
+
PROCEDURE ALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL) ;
BEGIN
Init ;
- addr := malloc (amount) ;
+ IF DebugTrace
+ THEN
+ printf ("request m2iso:Storage.ALLOCATE (..., %d bytes)\n", amount)
+ END ;
+ IF UseMallocFree
+ THEN
+ addr := malloc (amount)
+ ELSE
+ SysStorage.ALLOCATE (addr, amount)
+ END ;
+ IF DebugTrace
+ THEN
+ printf ("return m2iso:Storage.ALLOCATE (%p, %d bytes)\n", addr, amount)
+ END ;
IF addr#NIL
THEN
PutKey (storageTree, addr, amount)
PROCEDURE DEALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL) ;
BEGIN
assert (initialized) ;
+ IF DebugTrace
+ THEN
+ printf ("m2iso:Storage.DEALLOCATE (%p, %d bytes)\n", addr, amount)
+ END ;
IF VerifyDeallocate (addr, amount)
THEN
- free (addr) ;
+ IF UseMallocFree
+ THEN
+ free (addr)
+ ELSE
+ SysStorage.DEALLOCATE (addr, amount)
+ END ;
addr := NIL
END
END DEALLOCATE ;
VAR
a: CARDINAL ;
BEGIN
-
+ Init ;
IF addr=NIL
THEN
RAISE (storageException, ORD(nilDeallocation), 'deallocating pointer whose value is NIL') ;
BEGIN
IF NOT condition
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'internal runtime error, module Storage has not been initialized yet')
+ Halt ('internal runtime error, module Storage has not been initialized yet',
+ __FILE__, __FUNCTION__, __LINE__)
END
END assert ;
BEGIN
IF rStack=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active read procedure')
+ Halt ('no active read procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
rStack^.r(ch)
END
BEGIN
IF rStack=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active status procedure')
+ Halt ('no active status procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
RETURN( rStack^.s() )
END
BEGIN
IF wStack=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active write procedure')
+ Halt ('no active write procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
wStack^.w(ch)
END
AssignRead(Keyboard.Read, Keyboard.KeyPressed, Done) ;
IF NOT Done
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'failed to assign read routines from module Keyboard')
+ Halt ('failed to assign read routines from module Keyboard', __FILE__, __FUNCTION__, __LINE__)
END ;
AssignWrite(Display.Write, Done) ;
IF NOT Done
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'failed to assign write routine from module Display')
+ Halt ('failed to assign write routine from module Display', __FILE__, __FUNCTION__, __LINE__)
END
END Init ;
(*
Halt - writes a message in the format:
- Module:Line:Message
+ Module:Function:Line:Message
It then terminates by calling HALT.
*)
-PROCEDURE Halt (Message: ARRAY OF CHAR;
- LineNo: CARDINAL;
- Module: ARRAY OF CHAR) ;
+PROCEDURE Halt (Message,
+ Module,
+ Function: ARRAY OF CHAR ;
+ LineNo : CARDINAL) ;
(*
(*
Halt - writes a message in the format:
- Module:Line:Message
+ Module:Function:Line:Message
It then terminates by calling HALT.
*)
-PROCEDURE Halt (Message: ARRAY OF CHAR;
- LineNo: CARDINAL;
- Module: ARRAY OF CHAR) ;
+PROCEDURE Halt (Message,
+ Module,
+ Function: ARRAY OF CHAR ;
+ LineNo : CARDINAL) ;
CONST
MaxNoOfDigits = 12 ; (* should be large enough for most source files.. *)
VAR
No : ARRAY [0..MaxNoOfDigits] OF CHAR ;
BEGIN
DebugString(Module) ;
+ DebugString(':') ;
+ DebugString(Function) ;
+ DebugString(':') ;
CardToStr(LineNo, 0, No) ;
DebugString(':') ;
DebugString(No) ;
(*
PopAllocationExemption - test to see that all strings are
- deallocated, except string, e, since
+ deallocated, except string e since
the last push.
- Then it pops to the previous
+ Post-condition: it pops to the previous
allocation/deallocation lists.
If halt is true then the application
(*
PopAllocationExemption - test to see that all strings are deallocated, except
- string, e, since the last push.
- Then it pops to the previous allocation/deallocation
+ string e since the last push.
+ Post-condition: it pops to the previous allocation/deallocation
lists.
If halt is true then the application terminates
IF frameHead = NIL
THEN
stop ;
- Halt (__FILE__, __LINE__, __FUNCTION__,
- "mismatched number of PopAllocation's compared to PushAllocation's")
+ Halt ("mismatched number of PopAllocation's compared to PushAllocation's",
+ __FILE__, __FUNCTION__, __LINE__) ;
(* writeString ("mismatched number of PopAllocation's compared to PushAllocation's") *)
ELSE
IF frameHead^.alloc # NIL
to stderr and calls exit (1).
*)
-PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL;
- function: ARRAY OF CHAR; description: ARRAY OF CHAR)
- <* noreturn *> ;
+PROCEDURE Halt (description, filename, function: ARRAY OF CHAR;
+ line: CARDINAL) <* noreturn *> ;
(*
to stderr and calls exit (1).
*)
-PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL;
- function, description: ADDRESS) <* noreturn *> ;
+PROCEDURE HaltC (description, filename, function: ADDRESS;
+ line: CARDINAL) <* noreturn *> ;
(*
to stderr and calls exit (1).
*)
-PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL;
- function, description: ADDRESS) ;
+PROCEDURE HaltC (description, filename, function: ADDRESS; line: CARDINAL) ;
BEGIN
ErrorMessageC (description, filename, line, function)
END HaltC ;
to stderr and calls exit (1).
*)
-PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL;
- function: ARRAY OF CHAR; description: ARRAY OF CHAR) ;
+PROCEDURE Halt (description, filename, function: ARRAY OF CHAR; line: CARDINAL) ;
BEGIN
ErrorMessage (description, filename, line, function)
END Halt ;
DEC (i) ;
IF PutCh (char (s, i)) # char (s, i)
THEN
- Halt('assert failed', __LINE__, __FILE__)
+ Halt('assert failed', __FILE__, __FUNCTION__, __LINE__)
END
END
END PutStr ;
DEC (l) ;
IF PutCh (a[l]) # a[l]
THEN
- Halt ('assert failed', __LINE__, __FILE__)
+ Halt ('assert failed', __FILE__, __FUNCTION__, __LINE__)
END
END
END PutString ;
CharStack[StackPtr] := ch ;
INC(StackPtr)
ELSE
- Halt('max push back stack exceeded, increase MaxPushBackStack', __LINE__, __FILE__)
+ Halt('max push back stack exceeded, increase MaxPushBackStack',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
RETURN( ch )
END PutCh ;
BEGIN
IF currentEHB=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'currentEHB has not been initialized yet')
+ Halt('currentEHB has not been initialized yet',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
RETURN( currentEHB )
END
vptr := FindVectorNo (vec) ;
IF vptr = NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'cannot find vector supplied')
+ Halt ('cannot find vector supplied',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
WITH vptr^ DO
SetTime (rel, secs + DebugTime, micro)
vptr := FindVectorNo (vec) ;
IF vptr=NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'cannot find vector supplied')
+ Halt ('cannot find vector supplied',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
WITH vptr^ DO
GetTime (rel, secs, micro) ;
vptr := FindVectorNo (vec) ;
IF vptr = NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__, 'cannot find vector supplied')
+ Halt ( 'cannot find vector supplied',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
prevArg := vptr^.arg ;
vptr^.arg := ptr ;
vptr := FindVectorNo (vec) ;
IF vptr = NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'cannot find vector supplied') ;
+ Halt ('cannot find vector supplied',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
(* printf('including vector %d (fd = %d)\n', vec, v^.File) ; *)
vptr^.pending := Pending[vptr^.priority] ;
vptr := FindPendingVector (vec) ;
IF vptr = NIL
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'cannot find pending vector supplied')
+ Halt ('cannot find pending vector supplied',
+ __FILE__, __FUNCTION__, __LINE__)
ELSE
(* printf('excluding vector %d\n', vec) ; *)
IF Pending[vptr^.priority] = vptr
END ;
IF untilInterrupt AND (inSet=NIL) AND (outSet=NIL) AND (NOT found)
THEN
- Halt (__FILE__, __LINE__, __FUNCTION__,
- 'deadlock found, no more processes to run and no interrupts active')
+ Halt ('deadlock found, no more processes to run and no interrupts active',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
(* printf('timeval = 0x%x\n', timeval) ; *)
(* printf('}\n') ; *)
CONST
enableDeallocation = TRUE ;
- enableZero = FALSE ;
- enableTrace = FALSE ;
+ enableZero = TRUE ;
+ enableTrace = TRUE ;
VAR
callno: CARDINAL ;
a := malloc (size) ;
IF a = NIL
THEN
- Halt ('out of memory error', __LINE__, __FILE__)
+ Halt ('out of memory error',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
IF enableTrace AND trace
THEN
END ;
IF memset (a, 0, size) # a
THEN
- Halt ('memset should have returned the first parameter', __LINE__, __FILE__)
+ Halt ('memset should have returned the first parameter',
+ __FILE__, __FUNCTION__, __LINE__)
END
END ;
IF enableDeallocation
a := realloc (a, size) ;
IF a = NIL
THEN
- Halt ('out of memory error', __LINE__, __FILE__)
+ Halt ('out of memory error',
+ __FILE__, __FUNCTION__, __LINE__)
END ;
IF enableTrace AND trace
THEN
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, 'failed')
+ Halt ('failed', __FILE__, __FUNCTION__, __LINE__)
END
END Assert ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, 'failure')
+ Halt ('failure', __FILE__, __FUNCTION__, l)
END
END Assert ;
a, b, c: COMPLEX ;
BEGIN
printf ("main module starting\n");
- printf ("a := i\n");
+ printf ("a := i\n");
a := i ;
printf ("b := a*getOne()\n");
b := a*getOne() ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, 'failure')
+ Halt ('failure', __FILE__, __FUNCTION__, l)
END
END Assert ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, 'failure')
+ Halt ('failure', __FILE__, __FUNCTION__, l)
END
END Assert ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, "assert failed")
+ Halt ('assert failed', __FILE__, __FUNCTION__, l)
END
END Assert ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, "assert failed")
+ Halt ('assert failed', __FILE__, __FUNCTION__, l)
END
END Assert ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, "assert failed")
+ Halt ('assert failed', __FILE__, __FUNCTION__, l)
END
END Assert ;
BEGIN
IF NOT b
THEN
- Halt(__FILE__, l, __FUNCTION__, "assert failed")
+ Halt ('assert failed', __FILE__, __FUNCTION__, l)
END
END Assert ;
BEGIN
IF i#-1
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'promotion failed')
+ Halt ('promotion failed', __FILE__, __FUNCTION__, __LINE__)
END
END promote ;
END ;
INC(i)
END ;
- Halt(__FILE__, __LINE__, __FUNCTION__, 'increase MaxNoOfProcesses')
+ Halt ('increase MaxNoOfProcesses', __FILE__, __FUNCTION__, __LINE__)
END AssignOutputTo ;
END ;
INC(i)
END ;
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'process has never has a player assigned to its output')
+ Halt ('process has never has a player assigned to its output',
+ __FILE__, __FUNCTION__, __LINE__)
END ProcessToPlayer ;
RETURN( i )
END
END ;
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'process calling is not a player process')
+ Halt ('process calling is not a player process',
+ __FILE__, __FUNCTION__, __LINE__)
END PlayerNo ;
3: StrPoint('Eman', x, y)
ELSE
- Halt(__FILE__, __LINE__, __FUNCTION__, 'unexpected direction')
+ Halt ('unexpected direction', __FILE__, __FUNCTION__, __LINE__)
END
ELSE
CASE dir OF
3: StrPoint('eman', x, y)
ELSE
- Halt(__FILE__, __LINE__, __FUNCTION__, 'unexpected direction')
+ Halt ('unexpected direction', __FILE__, __FUNCTION__, __LINE__)
END
END
END DrawMan ;
3: StrPoint('ear', x, y)
ELSE
- Halt(__FILE__, __LINE__, __FUNCTION__, 'unexpected direction')
+ Halt ('unexpected direction', __FILE__, __FUNCTION__, __LINE__)
END
END DArrow ;
BEGIN
IF rStack=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active read procedure')
+ Halt ('no active read procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
rStack^.r(ch)
END
BEGIN
IF rStack=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active status procedure')
+ Halt ('no active status procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
RETURN( rStack^.s() )
END
BEGIN
IF wStack=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active write procedure')
+ Halt('no active write procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
wStack^.w(ch)
END
AssignRead(Keyboard.Read, Keyboard.KeyPressed, Done) ;
IF NOT Done
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'failed to assign read routines from module Keyboard')
+ Halt ('failed to assign read routines from module Keyboard', __FILE__, __FUNCTION__, __LINE__)
END ;
AssignWrite(Display.Write, Done) ;
IF NOT Done
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'failed to assign write routine from module Display')
+ Halt ('failed to assign write routine from module Display', __FILE__, __FUNCTION__, __LINE__)
END
END Init ;
BEGIN
IF Narg () < 0
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__, 'no active status procedure')
+ Halt ('no active status procedure', __FILE__, __FUNCTION__, __LINE__)
ELSE
RETURN FALSE
END
if BUILD_CORLIB
-M2DEFS = Debug.def Executive.def \
+M2DEFS = Executive.def \
KeyBoardLEDs.def SYSTEM.def \
TimerHandler.def
-M2MODS = Debug.mod Executive.mod \
+M2MODS = Executive.mod \
SYSTEM.mod TimerHandler.mod
toolexeclib_LTLIBRARIES = libm2cor.la
am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libm2cor_la_LIBADD =
-@BUILD_CORLIB_TRUE@am__objects_1 = Debug.lo Executive.lo SYSTEM.lo \
+@BUILD_CORLIB_TRUE@am__objects_1 = Executive.lo SYSTEM.lo \
@BUILD_CORLIB_TRUE@ TimerHandler.lo
@BUILD_CORLIB_TRUE@am_libm2cor_la_OBJECTS = $(am__objects_1) \
@BUILD_CORLIB_TRUE@ KeyBoardLEDs.lo
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
-@BUILD_CORLIB_TRUE@M2DEFS = Debug.def Executive.def \
+@BUILD_CORLIB_TRUE@M2DEFS = Executive.def \
@BUILD_CORLIB_TRUE@ KeyBoardLEDs.def SYSTEM.def \
@BUILD_CORLIB_TRUE@ TimerHandler.def
-@BUILD_CORLIB_TRUE@M2MODS = Debug.mod Executive.mod \
+@BUILD_CORLIB_TRUE@M2MODS = Executive.mod \
@BUILD_CORLIB_TRUE@ SYSTEM.mod TimerHandler.mod
@BUILD_CORLIB_TRUE@toolexeclib_LTLIBRARIES = libm2cor.la
= (threadSem *)malloc (sizeof (threadSem));
nSemaphores += 1;
if (nSemaphores == SEM_POOL)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "too many semaphores created");
+ m2iso_M2RTS_HaltC ("too many semaphores created",
+ __FILE__, __FUNCTION__, __LINE__);
#else
threadSem *sem
= (threadSem *)malloc (sizeof (threadSem));
for (tid = 0; tid < nThreads; tid++)
if (pthread_self () == threadArray[tid].p)
return tid;
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "failed to find currentThread");
+ m2iso_M2RTS_HaltC ("failed to find currentThread",
+ __FILE__, __FUNCTION__, __LINE__);
}
extern "C" int
static void
never (void)
{
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "the main thread should never call here");
+ m2iso_M2RTS_HaltC ("the main thread should never call here",
+ __FILE__, __FUNCTION__, __LINE__);
}
static void *
#if 0
m2iso_M2RTS_CoroutineException ( __FILE__, __LINE__, __COLUMN__, __FUNCTION__, "coroutine finishing");
#endif
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "execThread should never finish");
+ m2iso_M2RTS_HaltC ("execThread should never finish",
+ __FILE__, __FUNCTION__, __LINE__);
return NULL;
}
#if defined(POOL)
nThreads += 1;
if (nThreads == THREAD_POOL)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "too many threads created");
+ m2iso_M2RTS_HaltC ("too many threads created",
+ __FILE__, __FUNCTION__, __LINE__);
return nThreads - 1;
#else
if (nThreads == 0)
/* Set thread creation attributes. */
result = pthread_attr_init (&attr);
if (result != 0)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "failed to create thread attribute");
+ m2iso_M2RTS_HaltC ("failed to create thread attribute",
+ __FILE__, __FUNCTION__, __LINE__);
if (stackSize > 0)
{
result = pthread_attr_setstacksize (&attr, stackSize);
if (result != 0)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "failed to set stack size attribute");
+ m2iso_M2RTS_HaltC ("failed to set stack size attribute",
+ __FILE__, __FUNCTION__, __LINE__);
}
tprintf ("initThread [%d] function = 0x%p (arg = 0x%p)\n", tid, proc,
result = pthread_create (&threadArray[tid].p, &attr, execThread,
(void *)&threadArray[tid]);
if (result != 0)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, "thread_create failed");
+ m2iso_M2RTS_HaltC ("thread_create failed",
+ __FILE__, __FUNCTION__, __LINE__);
tprintf (" created thread [%d] function = 0x%p 0x%p\n", tid, proc,
(void *)&threadArray[tid]);
return tid;
{
int current = currentThread ();
if (!initialized)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "cannot transfer to a process before the process has been created");
+ m2iso_M2RTS_HaltC ("cannot transfer to a process before the process has been created",
+ __FILE__, __FUNCTION__, __LINE__);
if (current == p2)
{
/* Error. */
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "attempting to transfer to ourself");
+ m2iso_M2RTS_HaltC ("attempting to transfer to ourself",
+ __FILE__, __FUNCTION__, __LINE__);
}
else
{
}
tprintf ("end, context back to %d\n", current);
if (current != old)
- m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__,
- "wrong process id");
+ m2iso_M2RTS_HaltC ("wrong process id",
+ __FILE__, __FUNCTION__, __LINE__);
}
}
__gthread_mutex_unlock (&lock);
extern "C" void m2iso_M2RTS_Terminate (void);
extern "C" void m2iso_M2RTS_DeconstructModules (void);
-extern "C" void m2iso_M2RTS_HaltC (const char *filename, int line,
- const char *functionname, const char *desc)
- __attribute__ ((noreturn));
+extern "C" void m2iso_M2RTS_HaltC (const char *desc, const char *filename,
+ const char *functionname, int line) __attribute__ ((noreturn));