fixed issues #29 and #32

Added procedure API.SetTrap (Windows, Linux, KolibriOS) to set custom trap handler
This commit is contained in:
AntKrotov committed 2025-06-06 00:57:06 +03:00
1 parent 6058ffe801
commit 887e7fc185
16 files changed
+70 -16

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+12 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018, 2020-2022, Anton Krotov
Copyright (c) 2018, 2020-2022, 2025, Anton Krotov
All rights reserved.
*)
@@ -28,6 +28,8 @@ TYPE
CRITICAL_SECTION = ARRAY 2 OF INTEGER;
Trap = PROCEDURE (ModNum, ModNamePtr, line, error: INTEGER);
VAR
@@ -40,6 +42,8 @@ VAR
base*: INTEGER;
trap*: Trap;
PROCEDURE [stdcall] zeromem* (dwords: INTEGER; adr: INTEGER);
BEGIN
@@ -260,6 +264,7 @@ END DebugMsg;
PROCEDURE init* (import_, code: INTEGER);
BEGIN
multi := FALSE;
trap := NIL;
base := code - SizeOfHeader;
K.sysfunc2(68, 11);
InitializeCriticalSection(CriticalSection);
@@ -287,4 +292,10 @@ PROCEDURE sofinit*;
END sofinit;
PROCEDURE SetTrap* (_trap: Trap);
BEGIN
trap := _trap
END SetTrap;
END API.
+5 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2021, Anton Krotov
Copyright (c) 2018-2021, 2025, Anton Krotov
All rights reserved.
*)
@@ -435,6 +435,10 @@ VAR
s, temp: ARRAY 1024 OF CHAR;
BEGIN
IF API.trap # NIL THEN
API.trap(modnum, _module, line, err)
END;
CASE err OF
| 1: s := "assertion failure"
| 2: s := "NIL dereference"
+11 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2019-2021, 2023, Anton Krotov
Copyright (c) 2019-2021, 2023, 2025, Anton Krotov
All rights reserved.
*)
@@ -24,6 +24,8 @@ TYPE
SOFINI = PROCEDURE;
Trap = PROCEDURE (ModNum, ModNamePtr, line, error: INTEGER);
VAR
@@ -39,6 +41,7 @@ VAR
free : PROCEDURE [linux] (ptr: INTEGER);
fini: SOFINI;
trap*: Trap;
PROCEDURE DebugMsg* (lpText, lpCaption: INTEGER);
@@ -89,6 +92,7 @@ END GetSym;
PROCEDURE init* (sp, code: INTEGER);
BEGIN
fini := NIL;
trap := NIL;
SYSTEM.GET(code - 1000H - SYSTEM.SIZE(INTEGER) * 2, dlopen);
SYSTEM.GET(code - 1000H - SYSTEM.SIZE(INTEGER), dlsym);
MainParam := sp;
@@ -121,4 +125,10 @@ BEGIN
END SetFini;
PROCEDURE SetTrap* (_trap: Trap);
BEGIN
trap := _trap
END SetTrap;
END API.
+1 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2020-2022, 2025 Anton Krotov
Copyright (c) 2020-2022, 2025, Anton Krotov
All rights reserved.
*)
+9 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2021, 2023, Anton Krotov
Copyright (c) 2018-2021, 2023, 2025, Anton Krotov
All rights reserved.
*)
@@ -423,6 +423,10 @@ VAR
s, temp: ARRAY 1024 OF CHAR;
BEGIN
IF API.trap # NIL THEN
API.trap(modnum, _module, line, err)
END;
CASE err OF
| 1: s := "assertion failure"
| 2: s := "NIL dereference"
@@ -963,6 +967,10 @@ VAR
s, temp: ARRAY 1024 OF CHAR;
BEGIN
IF API.trap # NIL THEN
API.trap(modnum, _module, line, err)
END;
CASE err OF
| 1: s := "assertion failure"
| 2: s := "NIL dereference"
+12 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2021, 2023, Anton Krotov
Copyright (c) 2018-2021, 2023, 2025, Anton Krotov
All rights reserved.
*)
@@ -31,6 +31,8 @@ TYPE
DLL_ENTRY* = PROCEDURE (hinstDLL, fdwReason, lpvReserved: INTEGER);
Trap = PROCEDURE (ModNum, ModNamePtr, line, error: INTEGER);
VAR
@@ -41,6 +43,8 @@ VAR
thread_detach,
thread_attach: DLL_ENTRY;
trap*: Trap;
PROCEDURE [windows-, KERNEL, ""] ExitProcess (code: INTEGER);
PROCEDURE [windows-, KERNEL, ""] ExitThread (code: INTEGER);
@@ -73,6 +77,7 @@ BEGIN
process_detach := NIL;
thread_detach := NIL;
thread_attach := NIL;
trap := NIL;
base := code - SectionAlignment;
heap := GetProcessHeap()
END init;
@@ -131,4 +136,10 @@ BEGIN
END SetDll;
PROCEDURE SetTrap* (_trap: Trap);
BEGIN
trap := _trap
END SetTrap;
END API.
+1 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2020-2022, 2025 Anton Krotov
Copyright (c) 2020-2022, 2025, Anton Krotov
All rights reserved.
*)
+9 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2021, 2023, Anton Krotov
Copyright (c) 2018-2021, 2023, 2025, Anton Krotov
All rights reserved.
*)
@@ -423,6 +423,10 @@ VAR
s, temp: ARRAY 1024 OF CHAR;
BEGIN
IF API.trap # NIL THEN
API.trap(modnum, _module, line, err)
END;
CASE err OF
| 1: s := "assertion failure"
| 2: s := "NIL dereference"
@@ -963,6 +967,10 @@ VAR
s, temp: ARRAY 1024 OF CHAR;
BEGIN
IF API.trap # NIL THEN
API.trap(modnum, _module, line, err)
END;
CASE err OF
| 1: s := "assertion failure"
| 2: s := "NIL dereference"
+1 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2023, 2025 Anton Krotov
Copyright (c) 2018-2023, 2025, Anton Krotov
All rights reserved.
*)
+2 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2022, Anton Krotov
Copyright (c) 2018-2022, 2025, Anton Krotov
All rights reserved.
*)
@@ -155,6 +155,7 @@ BEGIN
|124: str := "unknown flag"
|125: str := "flag not supported"
|126: str := "type of formal parameter should not be REAL"
|127: str := "NIL is not allowed in constant expressions"
END;
C.StringLn(str);
C.String(" file: "); C.StringLn(fname);
+3 -2
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2022, 2025 Anton Krotov
Copyright (c) 2018-2022, 2025, Anton Krotov
All rights reserved.
*)
@@ -391,7 +391,8 @@ BEGIN
parser.constexp := TRUE;
parser.expression(parser, e);
parser.constexp := FALSE;
check((e.obj = eCONST) & (e._type # PROG.program.stTypes.tNIL), pos, 62);
check(e.obj = eCONST, pos, 62);
check(e._type # PROG.program.stTypes.tNIL, pos, 127);
v := e.value
END ConstExpression;
+1 -1
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2023, 2025 Anton Krotov
Copyright (c) 2018-2023, 2025, Anton Krotov
All rights reserved.
*)
+3 -3
View File
@@ -1,7 +1,7 @@
(*
BSD 2-Clause License
Copyright (c) 2018-2023, 2025 Anton Krotov
Copyright (c) 2018-2023, 2025, Anton Krotov
All rights reserved.
*)
@@ -23,8 +23,8 @@ CONST
max32* = 2147483647;
vMajor* = 1;
vMinor* = 68;
Date* = "05-jun-2025";
vMinor* = 69;
Date* = "06-jun-2025";
FILE_EXT* = ".ob07";
RTL_NAME* = "RTL";