Skip to content

Commit d9223f1

Browse files
committed
Merge pull request #15 from ninsbl/master
Patch by Jürgen Fischer: don-t-use-file-locking-on-windows and add CMake...
2 parents dfb844d + b10e932 commit d9223f1

File tree

9 files changed

+90
-13
lines changed

9 files changed

+90
-13
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PROJECT(openfyba)
2+
3+
ADD_SUBDIRECTORY(src/GM)
4+
ADD_SUBDIRECTORY(src/UT)
5+
ADD_SUBDIRECTORY(src/FYBA)
6+
ADD_SUBDIRECTORY(doc)

doc/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# docdir = $(datadir)/doc/@PACKAGE@
2+
# doc_DATA = en_EN/translators_needed no_NB/fyba.html no_NB/fyba1.html no_NB/fyba2.html

src/FYBA/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
INCLUDE_DIRECTORIES(../GM ../UT)
2+
3+
IF(UNIX)
4+
ADD_DEFINITIONS(-pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX -DLINUX -fPIC -Wno-write-strings)
5+
ENDIF(UNIX)
6+
7+
ADD_LIBRARY(fyba STATIC
8+
Fyba_Callback.cpp
9+
FYBA_DLL.cpp
10+
FYHO.cpp
11+
FYLD.cpp
12+
FYLH.cpp
13+
fyln.cpp
14+
FYLP.cpp
15+
FYLS.cpp
16+
FYLX.cpp
17+
stdafx.cpp
18+
FYBA.cpp
19+
Fyba_melding.cpp
20+
FYLB.cpp
21+
FYLE.cpp
22+
FYLI.cpp
23+
FYLO.cpp
24+
FYLR.cpp
25+
FYLU.cpp
26+
FYTA.cpp
27+
)
28+
29+
INSTALL(FILES fyba.h DESTINATION include/fyba)
30+
INSTALL(TARGETS fyba ARCHIVE DESTINATION lib)

src/FYBA/FYBA_DLL.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "stdafx.h"
77
#include "fyba.h"
8+
#include <Windows.h>
89

910
BOOL APIENTRY DllMain( HMODULE hModule,
1011
DWORD ul_reason_for_call,

src/FYBA/Fyba_Callback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "stdafx.h"
3030

31-
#include <fyba.h>
31+
#include "fyba.h"
3232

3333
#ifdef WIN32
3434
# include <windows.h>

src/FYBA/Fyba_melding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <windows.h>
3737
#endif
3838

39-
#include <fyba.h>
39+
#include "fyba.h"
4040

4141
//static short sProsent;
4242

src/GM/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
IF(UNIX)
2+
ADD_DEFINITIONS(-pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX -DLINUX -fPIC -Wno-write-strings)
3+
ENDIF(UNIX)
4+
5+
ADD_LIBRARY(gm STATIC GM.cpp stdafx.cpp)
6+
7+
INSTALL(FILES fygm.h DESTINATION include/fyba)
8+
INSTALL(TARGETS gm ARCHIVE DESTINATION lib)

src/UT/CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
IF(UNIX)
2+
ADD_DEFINITIONS(-pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX -DLINUX -fPIC -Wno-write-strings)
3+
ENDIF(UNIX)
4+
5+
ADD_LIBRARY(ut STATIC
6+
ANFORSEL.cpp
7+
DELDIR.cpp
8+
FILNACMP.cpp
9+
INQTID.cpp
10+
UT1.cpp
11+
UT4.cpp
12+
CopyFile.cpp
13+
DELFILE.cpp
14+
MAKEPATH.cpp
15+
stdafx.cpp
16+
UT2.cpp
17+
CREDIR.cpp
18+
DISKINFO.cpp
19+
INQSIZE.cpp
20+
SETSIZE.cpp
21+
StrtPros.cpp
22+
UT3.cpp
23+
stdafx.h
24+
FULLPATH.cpp
25+
SPLITPTH.cpp
26+
)
27+
28+
INSTALL(FILES fyut.h DESTINATION include/fyba)
29+
INSTALL(TARGETS ut ARCHIVE DESTINATION lib)

src/UT/UT1.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ CD Eier.......: STATENS KARTVERK / FYSAK-prosjektet
2323
CD
2424
CD #include...: fyut.h
2525
CD ==================================================================
26-
*/
26+
*/
2727

2828
#include "stdafx.h"
2929

@@ -45,7 +45,7 @@ CD ==================================================================
4545

4646
#ifdef LINUX /*This is just a quick fix. The two parameter versions of these are just not portable.*/
4747
# define strcpy_s strcpy
48-
# define strcat_s strcat
48+
# define strcat_s strcat
4949
#endif
5050

5151
#ifdef WIN32
@@ -368,16 +368,17 @@ _SH_DENYNO : Permits read and write access
368368
_SH_SECURE : Sets secure mode (shared read, exclusive write access).
369369
*/
370370

371-
371+
372372
// ----- Selve filåpningen
373373
if (mode[0] != '\0') {
374-
#ifdef UNIX
375-
fp = fopen(path,mode);
376-
#else
374+
fp = fopen(path,mode);
375+
#if 0
376+
// TODO: File locking on windows
377+
// FIXME: LI_OpenIdxFil always opens in UT_UPDATE mode
377378
if (mode[0] == 'w' || mode[2] == '+')
378379
{
379380
fp = _fsopen(path,mode,_SH_DENYWR); // Sperrer mot at andre åpner filen for skriving, godtar lesing
380-
}
381+
}
381382
else
382383
{
383384
fp = _fsopen(path,mode,_SH_DENYNO);
@@ -415,14 +416,14 @@ _SH_SECURE : Sets secure mode (shared read, exclusive write access).
415416
/* UT_FPRINTF(stderr,strerror(*ierr)); */
416417
}
417418

418-
else
419+
else
419420
{
420421
*ierr = UT_ERROR;
421422
return (NULL);
422423
}
423424

424425
if (*ierr != UT_OK) fp=NULL;
425-
426+
426427
return fp;
427428
}
428429

@@ -553,7 +554,7 @@ SK_EntPnt_UT short UT_ReadLine(FILE *pfil,short llin, char *clin)
553554
ierr = UT_ERROR;
554555
}
555556
break;
556-
557+
557558
} else if (c == '\n') {
558559
*cp = c;
559560
cp++;
@@ -706,7 +707,7 @@ CD pfil FILE i Peker til filstruktur (def i stdio.h)
706707
SK_EntPnt_UT short UT_Save (FILE *pfil)
707708
{
708709
if (fflush(pfil) == EOF) return (UT_ERROR);
709-
710+
710711
return(UT_OK);
711712
}
712713

0 commit comments

Comments
 (0)