Skip to content

Commit

Permalink
Compiler.Mod and CompilerCmd.Mod added,
Browse files Browse the repository at this point in the history
Compiler.Tool added,
ocl.bash removed, 
executable ocl added,
Configuration*.Mod replaced by oberon.Mod,
libOberonV4.so etc. split into individual module libraries,
library name pattern is now lib_V4_<module>.so.
Various minor cleanups.
  • Loading branch information
jtempl committed Dec 12, 2016
1 parent a871eaa commit a7d085c
Show file tree
Hide file tree
Showing 56 changed files with 1,049 additions and 552 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@

/V4_ofront/raspbian/Directories.c0
/V4_ofront/linux386/Directories.c0
/V4_ofront/raspbian/TestDir.Mod
/V4_ofront/raspbian/TestGC.Mod
/V4_ofront/raspbian/TestX.Mod
/V4_ofront/linux386/TestGC.Mod
/V4_ofront/linux386/TestGC.c0
/V4_ofront/linux386/TestDir.Mod
/V4_ofront/linux386/Fonttest.Mod
Binary file added V4/Compiler.Tool
Binary file not shown.
Binary file modified V4/Folds.Profile
Binary file not shown.
Binary file modified V4/IFS.Tool
Binary file not shown.
Binary file modified V4/OberonStartup.Mod
Binary file not shown.
Binary file modified V4/OfrontUser.Text
Binary file not shown.
Binary file modified V4/System.Tool
Binary file not shown.
Binary file modified V4_Dialogs/Dialogs.Tool
Binary file not shown.
Binary file removed V4_Dialogs/OberonDialogs.Mod
Binary file not shown.
Binary file removed V4_Dialogs/XIn.Mod
Binary file not shown.
Binary file removed V4_Elems/Bitmaps.Div.Mod
Binary file not shown.
Binary file removed V4_Elems/Bitmaps.Mod
Binary file not shown.
Binary file modified V4_Elems/Elems.Tool
Binary file not shown.
Binary file removed V4_Elems/OberonElems.Mod
Binary file not shown.
18 changes: 0 additions & 18 deletions V4_ofront/linux386/CallMarkStack.c0

This file was deleted.

Binary file modified V4_ofront/linux386/InputTest.Mod
Binary file not shown.
40 changes: 14 additions & 26 deletions V4_ofront/linux386/Modules.Mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
MODULE Modules; (* jt 27.2.95, 3.10.2016 *)

IMPORT SYSTEM, Console, Unix(*for errno*), Kernel;
(* shared libraries are named lib_V4_<Modulename>.so by default. (see also CompilerCmd.Mod).
For prefixes other than "_V4_" define environment variable OBERON_LIBPREFIX *)

IMPORT SYSTEM, Console, Unix(*for errno*), Kernel, Args;

CONST
ModNameLen* = 20;
Expand Down Expand Up @@ -37,6 +40,7 @@ MODULE Modules; (* jt 27.2.95, 3.10.2016 *)
res*: INTEGER;
resMsg*: ARRAY 256 OF CHAR;
imported*, importing*: ModuleName;
libPrefix*: ARRAY 20 OF CHAR;
trace: BOOLEAN; (* log module loading activities on Console *)

PROCEDURE -UseGNU()
Expand Down Expand Up @@ -131,13 +135,11 @@ MODULE Modules; (* jt 27.2.95, 3.10.2016 *)
END
END err;

PROCEDURE Load(name, bodyname: ARRAY OF CHAR; VAR lib: LONGINT; VAR body: ModuleBody;
fullName: BOOLEAN);
PROCEDURE Load(name, bodyname: ARRAY OF CHAR; VAR lib: LONGINT; VAR body: ModuleBody);
VAR libname: ARRAY 256 OF CHAR; rc: LONGINT;
BEGIN
IF fullName THEN COPY(name, libname)
ELSE libname := "lib"; Append(libname, name); Append(libname, ".so")
END;
libname := "lib"; Append(libname, libPrefix);
Append(libname, name); Append(libname, ".so");
IF trace THEN
Console.String(" Modules.Load(libname="); Console.String(libname);
Console.String(", entry="); Console.String(bodyname);
Expand All @@ -155,7 +157,7 @@ MODULE Modules; (* jt 27.2.95, 3.10.2016 *)
END CloseLib;

PROCEDURE ThisMod* (name: ARRAY OF CHAR): Module;
VAR m: Module; bodyname, libname1, libname2: ARRAY 64 OF CHAR;
VAR m: Module; bodyname, libname1, libname2: ARRAY 128 OF CHAR;
body: ModuleBody; lib, rc: LONGINT;
BEGIN
m := modules();
Expand All @@ -170,24 +172,8 @@ MODULE Modules; (* jt 27.2.95, 3.10.2016 *)
IF body # NIL THEN
m := body(); (* no dlclose(lib) because no dlopen *)
ELSE
Load(name, bodyname, lib, body, FALSE);
IF body = NIL THEN
GetSubsys1(name, libname1);
IF libname1[0] # 0X THEN
Load(libname1, bodyname, lib, body, FALSE)
END
END ;
IF body = NIL THEN
GetSubsys2(name, libname2);
IF libname2[0] # 0X THEN
IF (libname2 # libname1) THEN
Load(libname2, bodyname, lib, body, FALSE)
END
END
END ;
IF body = NIL THEN
Load(Kernel.LIB, bodyname, lib, body, FullName(Kernel.LIB))
END ;
(* module looked up in lib<libPrefix><name>.so *)
Load(name, bodyname, lib, body);
IF body # NIL THEN
Kernel.PushTrapCleaner(CloseLib, lib);
m := body(); (* increments reference count of lib *)
Expand Down Expand Up @@ -273,5 +259,7 @@ MODULE Modules; (* jt 27.2.95, 3.10.2016 *)
BEGIN trace := FALSE; Console.String("Modules.TraceOff"); Console.Ln
END TraceOff;

BEGIN installRefLibHandle()
BEGIN
libPrefix := "_V4_"; Args.GetEnv("OBERON_LIBPREFIX", libPrefix);
installRefLibHandle()
END Modules.
Binary file modified V4_ofront/linux386/My.Tool
Binary file not shown.
Binary file added V4_ofront/linux386/Texts
Binary file not shown.
6 changes: 6 additions & 0 deletions V4_ofront/linux386/Unix.Mod
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ TYPE
PROCEDURE -Getegid*(): LONGINT
"getegid()";

PROCEDURE -Setuid*(uid: LONGINT): LONGINT
"setuid(uid)";

PROCEDURE -Seteuid*(euid: LONGINT): LONGINT
"seteuid(euid)";

PROCEDURE -Unlink*(name: Name): LONGINT
"unlink(name)";

Expand Down
45 changes: 45 additions & 0 deletions V4_ofront/linux386/cl.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
#
# This script is called by the command ocl for compiling and linking an Oberon
# module <M> from <M>.c into a shared library lib<outname>.so or,
# if the option -m is specified, into an executable file named <outname>.
#
# SYNOPSIS
# cl.bash M outname options ccOptions
#
# options = "-" {"m" | "V" | "G" | "O"}
# ccOptions = quoted string passed to cc
# m compile into executable main program
# V verbose mode
# G generate debug symbols
# O optimize generated code

if [[ $# != 4 ]]; then
echo "cl.bash: illegal number of arguments"
exit 1
else
opt=""
if [[ $3 =~ .*G.* ]]; then
opt="$opt -g"
fi
if [[ $3 =~ .*O.* ]]; then
opt="$opt -O"
fi
if [[ $3 =~ .*m.* ]]; then
# compile and link <M>.c into executable
rm -f $2
if [[ $3 =~ .*V.* ]]; then
echo "rm -f $2"
echo "cc $opt $1.c -I$OFRONT_HOME/V4_ofront -o $2 -L. -L$OFRONT_HOME/lib $4"
fi
cc $opt $1.c -I$OFRONT_HOME/V4_ofront -o $2 -L. -L$OFRONT_HOME/lib $4
else
# compile and link <M>.c into shared library lib<M>.so
rm -f lib$2.so
if [[ $3 =~ .*V.* ]]; then
echo "rm -f lib$2.so"
echo "cc $opt $1.c -I$OFRONT_HOME/V4_ofront -shared -o lib$2.so -L. -L$OFRONT_HOME/lib $4"
fi
cc $opt $1.c -I$OFRONT_HOME/V4_ofront -shared -o lib$2.so -L. -L$OFRONT_HOME/lib $4
fi
fi
Loading

0 comments on commit a7d085c

Please sign in to comment.