Explorar el Código

static stubs from c-loader removed

Alexander Shiryaev hace 12 años
padre
commit
55ddfccdc8

BIN
BlackBox/Lin/Mod/Console.odc → BlackBox/Lin/Mod/Obsd.Console.odc


+ 2 - 2
BlackBox/Lin/Mod/Console.txt → BlackBox/Lin/Mod/Obsd.Console.txt

@@ -1,6 +1,6 @@
 MODULE LinConsole;
 
-	(* THIS IS TEXT COPY OF OpenBUGS Lin/Mod/Console.odc *)
+	(* THIS IS TEXT COPY OF Obsd.Console.odc *)
 	(* DO NOT EDIT *)
 
 	IMPORT
@@ -28,7 +28,7 @@ MODULE LinConsole;
 			i: INTEGER;
 			str: POINTER TO ARRAY [untagged] OF SHORTCHAR; 
 	BEGIN
-		str := LinLibc.fgets(ss, strLen, LinLibc.stdin);
+		str := LinLibc.fgets(ss, strLen, SYSTEM.ADR(LinLibc.__sF[0])); (* Shiryaev A. V.: OpenBSD *)
 		IF (str = NIL) THEN 
 			(* if end of file, then ss is not changed by fgets and NIL is returned. 
 			    We return an empty string here *)

+ 16 - 6
BlackBox/Lin/Mod/Obsd.Libc.txt

@@ -453,9 +453,19 @@ MODULE LinLibc ["libc.so.66.0"];
 
 		time_t* = INTEGER; (* OpenBSD 5.2 /usr/include/i386/_types.h: 32-bit *)
 
+		FILE = ARRAY [untagged] 88 OF BYTE; (* OpenBSD 5.2 /usr/include/stdio.h *)
+
 	VAR
-		(* timezone*: INTEGER; (* seconds from GMT *) *) (* OpenBSD *)
-		stdin*, stdout*, stderr* : PtrFILE; (* OpenBSD: wrapper *)
+		(* timezone*: INTEGER; (* seconds from GMT *) *) (* OpenBSD: not present *)
+		(* stdin*, stdout*, stderr* : PtrFILE; (* OpenBSD: not present *) *)
+
+		(* OpenBSD: stdin, stdout, stderr *)
+			__sF*: ARRAY [untagged] 3 OF FILE; (* OpenBSD 5.2 /usr/include/stdio.h *)
+			(*
+				stdin = SYSTEM.ADR(__sF[0])
+				stdout = SYSTEM.ADR(__sF[1])
+				stderr = SYSTEM.ADR(__sF[2])
+			*)
 
 	PROCEDURE [ccall] calloc* (nmemb, size: size_t): PtrVoid;
 	PROCEDURE [ccall] clock* (): clock_t;
@@ -513,11 +523,11 @@ MODULE LinLibc ["libc.so.66.0"];
 	(* PROCEDURE [ccall] sigsetjmp* ["__sigsetjmp"] (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; *)
 	PROCEDURE [ccall] sigsetjmp* (VAR env: sigjmp_buf; savemask: INTEGER): INTEGER; (* OpenBSD *)
 
-(*
-	PROCEDURE [ccall] stat* (filename: PtrSTR; VAR buf: stat_t): INTEGER;   stat is a macro and expands to __xstat(3, filename, buf)
-*)
-	(* OpenBSD: wrapper *)
+	(* OpenBSD *)
+	PROCEDURE [ccall] stat* (filename: PtrSTR; VAR buf: stat_t): INTEGER;  (* stat is a macro and expands to __xstat(3, filename, buf) *)
+(* OpenBSD: __xstat not present
 	PROCEDURE [ccall] __xstat* (version: INTEGER; filename: PtrSTR; VAR buf: stat_t): INTEGER;
+*)
 
 	PROCEDURE [ccall] strftime* (s: PtrSTR; max: size_t; format: PtrSTR; ptm: tm): size_t;
 	PROCEDURE [ccall] time* (VAR [nil] t: time_t): time_t;

BIN
BlackBox/Lin/Mod/Obsd.linHostFiles.odc


+ 5 - 5
BlackBox/Lin/Mod/Obsd.linHostFiles.txt

@@ -197,7 +197,7 @@ MODULE HostFiles;
 		VAR s: ShortName;
 	BEGIN
 		s := SHORT(fname);
-		res := LinLibc.__xstat(3, s, buf); (* macro expansion of "stat" *)
+		res := LinLibc.stat(s, buf); (* Shiryaev A. V.: OpenBSD *)
 	END Stat;
 	
 	PROCEDURE ModeToAttr (mode: SET; OUT attr: SET; OUT isDir: BOOLEAN);
@@ -1002,7 +1002,7 @@ MODULE HostFiles;
 				WHILE dp # NIL DO
 					IF (dp.d_name # ".") & (dp.d_name # "..") & (LEN(dp.d_name$) < LEN(info.name)) THEN
 						fname := ss + "/" + dp.d_name;
-						res := LinLibc.__xstat(3, fname, buf); (* macro expansion of "stat" *)
+						res := LinLibc.stat(fname, buf); (* Shiryaev A. V.: OpenBSD *)
 						ModeToAttr(buf.st_mode, attr, isDir);
 						IF ~isDir THEN	
 							info := first; last := NIL; s := dp.d_name$;
@@ -1039,7 +1039,7 @@ MODULE HostFiles;
 					WHILE dp # NIL DO
 						IF (dp.d_name # ".") & (dp.d_name # "..") & (LEN(dp.d_name$) < LEN(info.name)) THEN
 							fname := ss + "/" + dp.d_name;
-							res := LinLibc.__xstat(3, fname, buf); (* macro expansion of "stat" *)
+							res := LinLibc.stat(fname, buf); (* Shiryaev A. V.: OpenBSD *)
 							ModeToAttr(buf.st_mode, attr, isDir);
 							IF ~isDir THEN	
 								info := first; last := NIL; s := dp.d_name$;
@@ -1093,7 +1093,7 @@ MODULE HostFiles;
 				WHILE dp # NIL DO
 					IF (dp.d_name # ".") & (dp.d_name # "..") & (LEN(dp.d_name$) < LEN(info.name)) THEN
 						fname := ss + "/" + dp.d_name;
-						res := LinLibc.__xstat(3, fname, buf); (* macro expansion of "stat" *)
+						res := LinLibc.stat(fname, buf); (* Shiryaev A. V.: OpenBSD *)
 						ModeToAttr(buf.st_mode, attr, isDir);
 						IF isDir THEN	
 							info := first; last := NIL; s := dp.d_name$;
@@ -1119,7 +1119,7 @@ MODULE HostFiles;
 					WHILE dp # NIL DO
 						IF (dp.d_name # ".") & (dp.d_name # "..") & (LEN(dp.d_name$) < LEN(info.name)) THEN
 							fname := ss + "/" + dp.d_name;
-							res := LinLibc.__xstat(3, fname, buf); (* macro expansion of "stat" *)
+							res := LinLibc.stat(fname, buf); (* Shiryaev A. V.: OpenBSD *)
 							ModeToAttr(buf.st_mode, attr, isDir);
 							IF isDir THEN	
 								info := first; last := NIL; s := dp.d_name$;

+ 1 - 4
BlackBox/build

@@ -12,7 +12,7 @@ LindevCompiler.Compile('System/Mod', 'Strings.txt')
 LindevCompiler.Compile('System/Mod', 'Meta.txt')
 LindevCompiler.Compile('System/Mod', 'Dialog.txt')
 
-LindevCompiler.Compile('Lin/Mod', 'Console.txt')
+LindevCompiler.Compile('Lin/Mod', 'Obsd.Console.txt')
 LindevCompiler.Compile('Lin/Mod', 'Obsd.linHostFiles.txt')
 
 LindevCompiler.Compile('System/Mod', 'Stores.txt')
@@ -65,10 +65,7 @@ LindevCompiler.Compile('Std/Mod', 'ETHConv.txt')
 LindevCompiler.Compile('Std/Mod', 'Headers.txt')
 LindevCompiler.Compile('Std/Mod', 'Links.txt')
 
-LindevCompiler.Compile('Lin/Mod', 'Obsd.linHostFiles.txt')
 LindevCompiler.Compile('Std/Mod', 'Loader.txt')
-LindevCompiler.Compile('System/Mod', 'Console.txt')
-LindevCompiler.Compile('Lin/Mod', 'Console.txt')
 LindevCompiler.Compile('Lin/Mod', 'Kernel_so_init.txt')
 
 # LindevCompiler.Compile('Std/Mod', 'Log.txt')

+ 1 - 1
BlackBox/build-lindev

@@ -26,7 +26,7 @@ LindevCompiler.Compile('Lindev/Mod', 'CPV486.txt')
 LindevCompiler.Compile('Lindev/Mod', 'Compiler.txt')
 LindevCompiler.Compile('Lindev/Mod', 'ElfLinker16.txt')
 
-LindevCompiler.Compile('Lin/Mod', 'Console.txt')
+LindevCompiler.Compile('Lin/Mod', 'Obsd.Console.txt')
 LindevCompiler.Compile('Lin/Mod', 'Obsd.linHostFiles.txt')
 
 ### simple dev interpreter (include LindevCompiler and LindevElfLinker)

BIN
BlackBox/libBB.so


+ 5 - 2
README

@@ -31,7 +31,6 @@ Files:
 		OpenBUGS:
 			Dev/Mod/ElfLinker16.odc
 			Dev/Docu/ElfLinker.odc
-			Lin/Mod/Console.odc
 			System/Mod/Console.odc
 			Docu/OpenBUGS-License.odc
 		http://forum.oberoncore.ru/viewtopic.php?f=34&t=1159&sid=3e82517160caa46c64331178c1b61e95:
@@ -46,8 +45,12 @@ Files:
 				Kernel.InitModule
 					mprotect added
 		Lin/Mod/Obsd.linHostFiles.odc:
-			OpenBUGS Lin/Mod/linHostFiles.odc:
+			OpenBUGS Lin/Mod/linHostFiles.odc: 
 				size_t specific
+				__xstat -> stat
+		Lin/Mod/Obsd.Console.odc:
+			OpenBUGS Lin/Mod/Console.odc:
+				stdin -> SYSTEM.ADR(__sF[0])
 		Lin/Mod/Obsd.Libc.txt:
 			OpenBUGS Lin/Mod/Libc.odc:
 				OpenBSD-specific

+ 2 - 2
c/Makefile

@@ -1,9 +1,9 @@
 all: lindev BlackBox
 
-BlackBox: BlackBox.c openbsd.c
+BlackBox: BlackBox.c
 	${CC} ${CFLAGS} -O0 -g -o ${.TARGET} ${.ALLSRC} -L. -lBB -Wl,-E
 
-lindev: BlackBox1.c openbsd.c
+lindev: BlackBox1.c
 	${CC} ${CFLAGS} -O0 -g -o ${.TARGET} ${.ALLSRC} -L . -lBB0
 
 clean:

+ 0 - 33
c/openbsd.c

@@ -1,33 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <setjmp.h>
-#include <stdio.h>
-
-#include <errno.h>
-
-/*
-int __sigsetjmp(sigjmp_buf env, int savemask)
-{
-	printf("__sigsetjmp ...\n");
-	return sigsetjmp(env, savemask);
-}
-*/
-
-int __xstat (int version, const char *path, struct stat *sb)
-{
-	if (version != 3) {
-		printf("WARNING: __xstat: %d %s\n", version, path);
-	}
-	return stat(path, sb); /* XXX */
-}
-
-#undef stdin
-void * stdin = (&__sF[0]);
-
-#undef stdout
-void * stdout = (&__sF[1]);
-
-#undef stderr
-void * stderr = (&__sF[2]);