git » fp-git.git » commit ab11619

windows port

author ecalot
2005-03-24 23:07:01 UTC
committer ecalot
2005-03-24 23:07:01 UTC
parent 2af67182c0805ee5e1f262c398ba7d9abb719a27

windows port

PR/src/Makefile +23 -23
PR/src/Makefile.lcc +197 -119
PR/src/include/common.h +0 -7
PR/src/include/disk.h +7 -1
PR/src/include/pr.h +0 -7
PR/src/lib/layers/disk.c +1 -0

diff --git a/PR/src/Makefile b/PR/src/Makefile
index 139f195..bbac51b 100644
--- a/PR/src/Makefile
+++ b/PR/src/Makefile
@@ -73,7 +73,7 @@ LINKEROPTIONS = $(LINKERRELEASE)
 $(EXEFILE): $(EXEOBJ)
 	$(INFO) Linking files...
 	$(MAKEDIR) bin
-	$(CC) $(OPTIONS) -o bin/pr $(EXEOBJ) 
+	$(CC) $(OPTIONS) -o $(EXEFILE) $(EXEOBJ) 
 	$(INFO) Program successfully compiled
 	$(INFO)
 	$(INFO) Please read readme.txt for syntax information
@@ -112,91 +112,91 @@ $(XMLFILE): resources.xml.gz
 
 import.o: lib/actions/import.c
 	$(INFO) Compiling import module...
-	$(CC) -c lib/actions/import.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/actions/import.c
 
 memory.o: lib/layers/memory.c
 	$(INFO) Compiling memory manager...
-	$(CC) -c lib/layers/memory.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/layers/memory.c
 
 export.o: lib/actions/export.c
 	$(INFO) Compiling export module...
-	$(CC) -c lib/actions/export.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/actions/export.c
 
 compress.o: lib/compression/main.c
 	$(INFO) Compiling compression module...
-	$(CC) -c lib/compression/main.c -o compress.o $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/compression/main.c -o compress.o
 
 lzg_compress.o: lib/compression/lzg_compress.c
 	$(INFO) Compiling LZG compression module...
-	$(CC) -c lib/compression/lzg_compress.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/compression/lzg_compress.c
 
 rle_compress.o: lib/compression/rle_compress.c
 	$(INFO) Compiling RLE compression module...
-	$(CC) -c lib/compression/rle_compress.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/compression/rle_compress.c
 
 lzg_uncompress.o: lib/compression/lzg_uncompress.c
 	$(INFO) Compiling LZG uncompression module...
-	$(CC) -c lib/compression/lzg_uncompress.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/compression/lzg_uncompress.c
 
 rle_uncompress.o: lib/compression/rle_uncompress.c
 	$(INFO) Compiling RLE uncompression module...
-	$(CC) -c lib/compression/rle_uncompress.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/compression/rle_uncompress.c
 
 main.o: console/main.c
 	$(INFO) Compiling command parsing module for standard mode...
-	$(CC) -c console/main.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c console/main.c
 
 pr.o: lib/pr.c
 	$(INFO) Compiling main library primitives for both modes...
-	$(CC) -c lib/pr.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/pr.c
 	
 filedir.o: console/filedir.c
 	$(INFO) Compiling directory and recursive file reading module for standard mode...
-	$(CC) -c console/filedir.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c console/filedir.c
 
 resources.o: lib/resources.c
 	$(INFO) Compiling resource manager module...
-	$(CC) -c lib/resources.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/resources.c
 
 classify.o: lib/actions/classify.c
 	$(INFO) Compiling classification module...
-	$(CC) -c lib/actions/classify.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/actions/classify.c
 
 parse.o: lib/xml/parse.c
 	$(INFO) Compiling XML parsing module...
-	$(CC) -c lib/xml/parse.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/xml/parse.c
 
 search.o: lib/xml/search.c
 	$(INFO) Compiling XML search features...
-	$(CC) -c lib/xml/search.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/xml/search.c
 
 disk.o: lib/layers/disk.c
 	$(INFO) Compiling disk access library...
-	$(CC) -c lib/layers/disk.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/layers/disk.c
 
 dat.o: lib/layers/dat.c
 	$(INFO) Compiling DAT editing library...
-	$(CC) -c lib/layers/dat.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/layers/dat.c
 
 bmp.o: lib/formats/bmp.c
 	$(INFO) Compiling bitmap files support \(bmp\)...
-	$(CC) -c lib/formats/bmp.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/formats/bmp.c
 
 mid.o: lib/formats/mid.c
 	$(INFO) Compiling MIDI audio files support \(mid\)...
-	$(CC) -c lib/formats/mid.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/formats/mid.c
 
 plv.o: lib/formats/plv.c
 	$(INFO) Compiling prince level files support \(plv\)...
-	$(CC) -c lib/formats/plv.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/formats/plv.c
 
 pal.o: lib/formats/pal.c
 	$(INFO) Compiling JASC palette support \(pal\)...
-	$(CC) -c lib/formats/pal.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/formats/pal.c
 
 wav.o: lib/formats/wav.c
 	$(INFO) Compiling digital wave audio support \(wav\)...
-	$(CC) -c lib/formats/wav.c $(OPTIONS)
+	$(CC) $(OPTIONS) -c lib/formats/wav.c
 
 dirent.o: ports/dirent.c
 	$(INFO) Porting the dirent structure...
diff --git a/PR/src/Makefile.lcc b/PR/src/Makefile.lcc
index 1cd55d8..dd907da 100644
--- a/PR/src/Makefile.lcc
+++ b/PR/src/Makefile.lcc
@@ -1,119 +1,197 @@
-CC=@lc
-LINKER=@lcclnk
-INFO=@echo
-
-INCLUDE = -Iinclude\ 
-DEFINES = -DWIN32 
-#-DDLL
-OPTIONS = $(INCLUDE) $(DEFINES)
-
-OBJFILES = compile.obj compress.obj extract.obj pr.obj dat.obj resources.obj\
-           tasks.obj disk.obj xmlparse.obj xmlsearch.obj bmp.obj mid.obj\
-           pal.obj wav.obj plv.obj memory.obj\
-           dirent.obj getopt.obj getopt1.obj
-
-EXEFILE  = pr.exe
-
-#main file
-
-$(EXEFILE): $(OBJFILES)
-	$(INFO) Linking files...
-	$(LINKER) $(OBJFILES) -o $(EXEFILE) -s
-	#$(INFO) Making dynamic library...
-	#$(LINKER) $(OBJFILES) -dll pr.def -s -o pr.dll
-	$(INFO) Program successfully compiled
-	$(INFO):
-	$(INFO) Please read readme.txt for syntax information
-	$(INFO):
-
-#command options
-
-clean:
-	$(INFO) Erasing temporary object files...
-	@del *.obj
-
-build: clean all
-
-all: $(EXEFILE)
-
-#files
-
-compile.obj: compile.c
-	$(INFO) Compiling import module...
-	$(CC) $(OPTIONS) -c compile.c
-
-memory.obj: memory.c
-	$(INFO) Compiling memory manager...
-	$(CC) $(OPTIONS) -c memory.c
-
-extract.obj: extract.c
-	$(INFO) Compiling export module...
-	$(CC) $(OPTIONS) -c extract.c
-
-compress.obj: compress.c
-	$(INFO) Compiling compression module...
-	$(CC) $(OPTIONS) -c compress.c
-
-pr.obj: pr.c
-	$(INFO) Compiling main module in standard mode...
-	$(CC) $(OPTIONS) -c pr.c
-
-prlib.obj: pr.c
-	$(INFO) Compiling main module in library mode...
-	$(CC) $(OPTIONS) -DDLL -o prlib.obj -c pr.c
-
-resources.obj: resources.c
-	$(INFO) Compiling resource manager module...
-	$(CC) $(OPTIONS) -c resources.c
-
-tasks.obj: tasks.c
-	$(INFO) Compiling classify module...
-	$(CC) $(OPTIONS) -c tasks.c
-
-dat.obj: dat.c
-	$(INFO) Compiling abstract dat handling library...
-	$(CC) $(OPTIONS) -c dat.c
-
-xmlparse.obj: xmlparse.c
-	$(INFO) Compiling xml parsing module...
-	$(CC) $(OPTIONS) -c xmlparse.c
-
-xmlsearch.obj: xmlsearch.c
-	$(INFO) Compiling xml search features...
-	$(CC) $(OPTIONS) -c xmlsearch.c
-
-disk.obj: disk.c
-	$(INFO) Compiling disk access functions...
-	$(CC) $(OPTIONS) -c disk.c
-
-bmp.obj: formats\bmp.c
-	$(INFO) Compiling bitmap files support (bmp)...
-	$(CC) $(OPTIONS) -c formats\bmp.c
-
-mid.obj: formats\mid.c
-	$(INFO) Compiling midi audio files support (mid)...
-	$(CC) $(OPTIONS) -c formats\mid.c
-
-plv.obj: formats\plv.c
-	$(INFO) Compiling prince level files support (plv)...
-	$(CC) $(OPTIONS) -c formats\plv.c
-
-pal.obj: formats\pal.c
-	$(INFO) Compiling JASC palette support (pal)...
-	$(CC) $(OPTIONS) -c formats\pal.c
-
-wav.obj: formats\wav.c
-	$(INFO) Compiling digital wave audio support (wav)...
-	$(CC) $(OPTIONS) -c formats\wav.c
-
-dirent.obj: ports\dirent.c
-	$(INFO) Porting the dirent structure...
-	$(CC) $(OPTIONS) -c ports\dirent.c
-	
-getopt.obj: ports\getopt.c
-	$(INFO) Porting the Unix-like getopt function (first part)...
-	$(CC) $(OPTIONS) -c ports\getopt.c
-
-getopt1.obj: ports\getopt1.c
-	$(INFO) Porting the Unix-like getopt function (second part)...
-	$(CC) $(OPTIONS) -c ports\getopt1.c
+############
+# Programs #
+############
+
+CC         = @lc
+LINKER     = @lcclnk
+INFO       = @echo
+MAKEDIR    = @mkdir
+REMOVER    = @del
+GZIP       = @gzip
+
+#####################
+# Operating Systems #
+#####################
+
+OS    = Win32
+LINUX = -DNOLINUX
+PORTS = getopt.obj getopt1.obj dirent.obj
+
+####################
+# Compiler options #
+####################
+
+#Libraries: include path and linked libs
+INCLUDE       = -Iinclude\\ 
+DEFINES       = $(LINUX)
+
+#Release type
+TYPE          = Debug
+# RELEASE may be:
+#  -g -Wall -ansi -pedantic        for debug
+#  -O2                             for release
+# LINKERRELEASE may be:
+#  -s                              for release
+RELEASE       = -ansic
+LINKERRELEASE = -s
+
+FILES    = import.obj export.obj resources.obj classify.obj disk.obj\
+           dat.obj bmp.obj mid.obj pal.obj wav.obj plv.obj\
+           memory.obj pr.obj
+
+XML      = parse.obj search.obj
+COMPRESS = compress.obj lzg_compress.obj lzg_uncompress.obj rle_compress.obj rle_uncompress.obj 
+CONSOLE  = main.obj filedir.obj
+
+EXEOBJ   = $(FILES) $(XML) $(COMPRESS) $(CONSOLE) $(PORTS)
+LIBOBJ   = $(FILES) $(XML) $(COMPRESS) $(PORTS)
+
+EXEFILE  = bin\pr.exe
+XMLFILE  = bin\resources.xml
+
+#Use this to temporary remove an option
+OPTIONS       = $(INCLUDE) $(DEFINES) $(RELEASE)
+LINKEROPTIONS = $(LINKERRELEASE)
+
+#main file
+
+$(EXEFILE): $(EXEOBJ)
+	$(INFO) Linking files...
+	$(CC) $(EXEOBJ) -o $(EXEFILE) $(LINKEROPTIONS)
+	$(INFO) Program successfully compiled
+	$(INFO):
+	$(INFO) Please read readme.txt for syntax information
+	$(INFO):
+
+#command options
+.PHONY: clean cleanxml build all lib
+
+clean:
+	$(INFO) Erasing temporary object files...
+	$(REMOVER) *.obj
+	$(REMOVER) $(EXEFILE)
+
+cleanxml:
+	$(INFO) Erasing xml file...
+	$(REMOVER) $(XMLFILE)
+
+build: clean bin\pr
+
+all: $(EXEFILE)
+
+lib: $(LIBOBJ)
+	$(MAKEDIR) bin
+	$(INFO) Making dynamic library...
+	$(CC) $(LIBOBJ) -dll ..\winbins\pr.def -o bin\pr.dll
+	$(INFO) Library successfully compiled
+	$(INFO):
+	$(INFO) Please read readme.coders.txt and pr.h for interfaces
+	$(INFO):
+
+#files
+
+$(XMLFILE): resources.xml.gz
+	$(INFO) Uncompressing resources...
+	$(MAKEDIR) bin
+	$(GZIP) -cd resources.xml.gz >bin\resources.xml
+
+import.obj: lib\actions\import.c
+	$(INFO) Compiling import module...
+	$(CC) $(OPTIONS) -c lib\actions\import.c
+
+memory.obj: lib\layers\memory.c
+	$(INFO) Compiling memory manager...
+	$(CC) $(OPTIONS) -c lib\layers\memory.c
+
+export.obj: lib\actions\export.c
+	$(INFO) Compiling export module...
+	$(CC) $(OPTIONS) -c lib\actions\export.c
+
+compress.obj: lib\compression\main.c
+	$(INFO) Compiling compression module...
+	$(CC) $(OPTIONS) -Focompress.obj -c lib\compression\main.c
+
+lzg_compress.obj: lib\compression\lzg_compress.c
+	$(INFO) Compiling LZG compression module...
+	$(CC) $(OPTIONS) -c lib\compression\lzg_compress.c
+
+rle_compress.obj: lib\compression\rle_compress.c
+	$(INFO) Compiling RLE compression module...
+	$(CC) $(OPTIONS) -c lib\compression\rle_compress.c
+
+lzg_uncompress.obj: lib\compression\lzg_uncompress.c
+	$(INFO) Compiling LZG uncompression module...
+	$(CC) $(OPTIONS) -c lib\compression\lzg_uncompress.c
+
+rle_uncompress.obj: lib\compression\rle_uncompress.c
+	$(INFO) Compiling RLE uncompression module...
+	$(CC) $(OPTIONS) -c lib\compression\rle_uncompress.c
+
+main.obj: console\main.c
+	$(INFO) Compiling command parsing module for standard mode...
+	$(CC) $(OPTIONS) -c console\main.c
+
+pr.obj: lib\pr.c
+	$(INFO) Compiling main library primitives for both modes...
+	$(CC) $(OPTIONS) -c lib\pr.c
+	
+filedir.obj: console\filedir.c
+	$(INFO) Compiling directory and recursive file reading module for standard mode...
+	$(CC) $(OPTIONS) -c console\filedir.c
+
+resources.obj: lib\resources.c
+	$(INFO) Compiling resource manager module...
+	$(CC) $(OPTIONS) -c lib\resources.c
+
+classify.obj: lib\actions\classify.c
+	$(INFO) Compiling classification module...
+	$(CC) $(OPTIONS) -c lib\actions\classify.c
+
+parse.obj: lib\xml\parse.c
+	$(INFO) Compiling XML parsing module...
+	$(CC) $(OPTIONS) -c lib\xml\parse.c
+
+search.obj: lib\xml\search.c
+	$(INFO) Compiling XML search features...
+	$(CC) $(OPTIONS) -c lib\xml\search.c
+
+disk.obj: lib\layers\disk.c
+	$(INFO) Compiling disk access library...
+	$(CC) $(OPTIONS) -c lib\layers\disk.c
+
+dat.obj: lib\layers\dat.c
+	$(INFO) Compiling DAT editing library...
+	$(CC) $(OPTIONS) -c lib\layers\dat.c
+
+bmp.obj: lib\formats\bmp.c
+	$(INFO) Compiling bitmap files support (bmp)...
+	$(CC) $(OPTIONS) -c lib\formats\bmp.c
+
+mid.obj: lib\formats\mid.c
+	$(INFO) Compiling MIDI audio files support (mid)...
+	$(CC) $(OPTIONS) -c lib\formats\mid.c
+
+plv.obj: lib\formats\plv.c
+	$(INFO) Compiling prince level files support (plv)...
+	$(CC) $(OPTIONS) -c lib\formats\plv.c
+
+pal.obj: lib\formats\pal.c
+	$(INFO) Compiling JASC palette support (pal)...
+	$(CC) $(OPTIONS) -c lib\formats\pal.c
+
+wav.obj: lib\formats\wav.c
+	$(INFO) Compiling digital wave audio support (wav)...
+	$(CC) $(OPTIONS) -c lib\formats\wav.c
+
+dirent.obj: ports\dirent.c
+	$(INFO) Porting the dirent structure...
+	$(CC) $(OPTIONS) -c ports\dirent.c
+	
+getopt.obj: ports\getopt.c
+	$(INFO) Porting the Unix-like getopt function (first part)...
+	$(CC) $(OPTIONS) -c ports\getopt.c
+
+getopt1.obj: ports\getopt1.c
+	$(INFO) Porting the Unix-like getopt function (second part)...
+	$(CC) $(OPTIONS) -c ports\getopt1.c
+
diff --git a/PR/src/include/common.h b/PR/src/include/common.h
index 3c4290c..64bc431 100644
--- a/PR/src/include/common.h
+++ b/PR/src/include/common.h
@@ -112,13 +112,6 @@ void prSetOutput(FILE* output);
 /* Define max & min's */
 #define MAX_FILENAME_SIZE        260
 
-/* Path defines */
-#ifdef UNIX
- #define DIR_SEPARATOR           '/'
-#else
- #define DIR_SEPARATOR           '\\'
-#endif
-
 /***************************************************************\
 |                        L A N G U A G E                        |
 \***************************************************************/
diff --git a/PR/src/include/disk.h b/PR/src/include/disk.h
index 071f3c1..1b32fdf 100644
--- a/PR/src/include/disk.h
+++ b/PR/src/include/disk.h
@@ -49,7 +49,13 @@ disk.h: Princed Resources : Disk Access & File handling functions headers
 #define SIZE_OF_FILE     256*1024
 #define MAX_FILENAME_SIZE        260
 
-#define DIR_SEPARATOR '/'
+/* Path defines */
+#ifndef WIN32
+ #define DIR_SEPARATOR           '/'
+#else
+ #define DIR_SEPARATOR           '\\'
+#endif
+
 
 typedef enum {eFile,eDirectory,eNotFound}whatIs;
 
diff --git a/PR/src/include/pr.h b/PR/src/include/pr.h
index 3c4290c..64bc431 100644
--- a/PR/src/include/pr.h
+++ b/PR/src/include/pr.h
@@ -112,13 +112,6 @@ void prSetOutput(FILE* output);
 /* Define max & min's */
 #define MAX_FILENAME_SIZE        260
 
-/* Path defines */
-#ifdef UNIX
- #define DIR_SEPARATOR           '/'
-#else
- #define DIR_SEPARATOR           '\\'
-#endif
-
 /***************************************************************\
 |                        L A N G U A G E                        |
 \***************************************************************/
diff --git a/PR/src/lib/layers/disk.c b/PR/src/lib/layers/disk.c
index de95076..4881882 100644
--- a/PR/src/lib/layers/disk.c
+++ b/PR/src/lib/layers/disk.c
@@ -71,6 +71,7 @@ disk.c: Princed Resources : Disk Access & File handling functions
 	#ifdef DISK_DIR_SCANING
 		#include "direntwin.h"
 	#endif
+	#include <conio.h> /* getche */
 	#define osIndepGetCharacter() getche()
 #endif