소스 검색

Remove FixFname from Config, introduce module Func

Arthur Yefimov 2 년 전
부모
커밋
208d698a40
6개의 변경된 파일31개의 추가작업 그리고 23개의 파일을 삭제
  1. 3 3
      src/Builder.Mod
  2. 0 12
      src/Config.Mod
  3. 3 3
      src/EditorText.Mod
  4. 16 0
      src/Func.Mod
  5. 5 3
      src/make.bat
  6. 4 2
      src/make.sh

+ 3 - 3
src/Builder.Mod

@@ -16,8 +16,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with Free Oberon.  If not, see <http://www.gnu.org/licenses/>.
 *)
-IMPORT Term, FoStrings, Files, Utf8, Config, Strings, Int, Out, Debug,
-  Env, Dir, Kernel;
+IMPORT Term, FoStrings, Files, Utf8, Config, Func, Strings,
+  Int, Out, Debug, Env, Dir, Kernel;
 
 TYPE
   Module* = POINTER TO ModuleDesc;
@@ -234,7 +234,7 @@ BEGIN ok := TRUE;
   END;
 
   IF ok THEN
-    s := fname$; Config.FixFname(s); Strings.Append(s, cmd);
+    s := fname$; Func.FixFname(s); Strings.Append(s, cmd);
 
     IF main THEN Strings.Append(' -m', cmd)
     ELSIF link & (list # NIL) THEN

+ 0 - 12
src/Config.Mod

@@ -16,18 +16,6 @@ PROCEDURE SetDebug*(deb: BOOLEAN);
 BEGIN debug := deb
 END SetDebug;
 
-(** Replace all / with \ if on Windows *)
-PROCEDURE FixFname*(VAR s: ARRAY OF CHAR);
-VAR i: INTEGER;
-BEGIN
-  IF pathDelimiter = '\' THEN i := 0;
-    WHILE (i # LEN(s)) & (s[i] # 0X) DO
-      IF s[i] = '/' THEN s[i] := '\' END;
-      INC(i)
-    END
-  END
-END FixFname;
-
 BEGIN
   debug := FALSE
 END Config.

+ 3 - 3
src/EditorText.Mod

@@ -16,7 +16,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with Free Oberon.  If not, see <http://www.gnu.org/licenses/>.
 *)
-IMPORT Config, Files, Strings, Out, Utf8;
+IMPORT Config, Func, Files, Strings, Out, Utf8;
 
 CONST
   lineLen = 256;
@@ -377,7 +377,7 @@ VAR f: Files.File; r: Files.Rider;
   success: BOOLEAN;
   L: Line;
 BEGIN success := FALSE;
-  Config.FixFname(fname);
+  Func.FixFname(fname);
   f := Files.New(fname);
   IF f # NIL THEN (*!FIXME error checking is wrong *)
     Files.Set(r, f, 0);
@@ -417,7 +417,7 @@ VAR f: Files.File; r: Files.Rider;
   lf, crlf: INTEGER; (* Count of CR and CRLF line endings *)
 BEGIN success := FALSE; lf := 0; crlf := 0;
   IF fname[0] # 0X THEN
-    Config.FixFname(fname);
+    Func.FixFname(fname);
     f := Files.Old(fname);
     IF f # NIL THEN
       Files.Set(r, f, 0);

+ 16 - 0
src/Func.Mod

@@ -0,0 +1,16 @@
+MODULE Func;
+IMPORT Config;
+
+(** Replace all / with \ if on Windows *)
+PROCEDURE FixFname*(VAR s: ARRAY OF CHAR);
+VAR i: INTEGER;
+BEGIN
+  IF Config.pathDelimiter = '\' THEN i := 0;
+    WHILE (i # LEN(s)) & (s[i] # 0X) DO
+      IF s[i] = '/' THEN s[i] := '\' END;
+      INC(i)
+    END
+  END
+END FixFname;
+
+END Func.

+ 5 - 3
src/make.bat

@@ -14,7 +14,9 @@ SET AR=ar
 SET CCFULL=%CC% -O3 -fno-exceptions -I %OFRDIR%\..\..\Mod\Lib -I %OFRDIR%\Lib\Obj
 
 ECHO ON
-%OFR% -C Config.Mod
+%OFR% -Cw Config.Mod
+@IF ERRORLEVEL 1 GOTO ERR
+%OFR% -7w Func.Mod
 @IF ERRORLEVEL 1 GOTO ERR
 %OFR% -Cw Utf8.Mod
 @IF ERRORLEVEL 1 GOTO ERR
@@ -108,7 +110,7 @@ windres resources.rc resources.o
 
 %CCFULL% -o ..\%PROG1%.exe resources.o ^
   Graph.c TermBox.c ^
-  Config.c Debug.c term\term_win32.c ^
+  Config.c Func.c Debug.c term\term_win32.c ^
   Term.c OV.c FoStrings.c EditorText.c Editor.c Builder.c ^
   FreeOberon.c ^
   ..\Data\bin\FreeOberon.a ^
@@ -122,7 +124,7 @@ windres resources.rc resources.o
 %CCFULL% -o ..\%PROG2%.exe ^
   FoStrings.c Builder.c ^
   Term.c term/term_win32.c ^
-  Config.c Debug.c Fob.c ^
+  Config.c Func.c Debug.c Fob.c ^
   ..\Data\bin\FreeOberon.a ^
   %OFRDIR%\Lib\Ofront.a ^
   -I..\Data\bin\mingw32\include ^

+ 4 - 2
src/make.sh

@@ -16,6 +16,8 @@ CCFULL="$CC -O0 -fno-exceptions -I $OFRDIR/../../Mod/Lib -I $OFRDIR/Lib/Obj"
 
 $OFR -Cw Config.Mod &&
 
+$OFR -Cw Func.Mod &&
+
 $OFR -Cw Utf8.Mod &&
 
 $OFR -Cw Strings.Mod &&
@@ -109,7 +111,7 @@ $AR -crs ../Data/bin/libFreeOberon.a \
 $CCFULL -o ../$PROG1 \
   Graph.c TermBox.c \
   Term.c term/term_linux.c \
-  Config.c Debug.c OV.c FoStrings.c EditorText.c Editor.c Builder.c \
+  Config.c Func.c Debug.c OV.c FoStrings.c EditorText.c Editor.c Builder.c \
   FreeOberon.c \
   ../Data/bin/libFreeOberon.a \
   $OFRDIR/Lib/libOfront.a \
@@ -122,6 +124,6 @@ $CCFULL -o ../$PROG1 \
 $CCFULL -o ../$PROG2 \
   FoStrings.c Builder.c \
   Term.c term/term_linux.c \
-  Config.c Debug.c Fob.c \
+  Config.c Func.c Debug.c Fob.c \
   ../Data/bin/libFreeOberon.a \
   $OFRDIR/Lib/libOfront.a