Sisyphus repository
Last update: 2017-11-22 14:07:10 +0300 | SRPMs: 17883 | Sign in or Sign up
en ru uk br
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 sources/4th.h      |  9 +++++++++
 sources/cgen_4th.c |  4 ++++
 sources/comp_4th.c | 12 +++++++++---
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/sources/4th.h b/sources/4th.h
index 9b1fa9f..d0ab92c 100644
--- a/sources/4th.h
+++ b/sources/4th.h
@@ -62,10 +62,19 @@
 #define M4BADNAM 28
 #define M4CABORT 29
 
+#ifdef __TURBOC__
 #define CELL_MIN LONG_MIN
 #define CELL_MAX LONG_MAX
+#else
+#define CELL_MIN INT_MIN
+#define CELL_MAX INT_MAX
+#endif
 
+#ifdef __TURBOC__
 typedef long cell;
+#else
+typedef int cell;
+#endif
 typedef unsigned char unit;
 
 typedef struct {
diff --git a/sources/cgen_4th.c b/sources/cgen_4th.c
index 2aaa32c..21c34f3 100644
--- a/sources/cgen_4th.c
+++ b/sources/cgen_4th.c
@@ -143,7 +143,11 @@ static Hcode Object = {\n\
               errs_4th [Object.ErrNo]);\n\
   else\n\
      if (Result != CELL_MIN)\n\
+#ifdef __TURBOC__\n\
         fprintf (stderr, \"Exiting; result: %%ld\\n\", Result);\n\
+#else\n\
+        fprintf (stderr, \"Exiting; result: %%d\\n\", Result);\n\
+#endif\n\
 \n\
   return (Object.ErrNo \? EXIT_FAILURE : EXIT_SUCCESS);\n\
 }\n";
diff --git a/sources/comp_4th.c b/sources/comp_4th.c
index ae10dd3..f0cb124 100644
--- a/sources/comp_4th.c
+++ b/sources/comp_4th.c
@@ -3407,6 +3407,10 @@ the environment for a default directory. When DIR4TH has been defined it
 will retry to open the file.
 */
 
+#ifndef DIR4TH
+#define DIR4TH "/usr/local/share/4th"
+#endif
+
 #ifndef ARCHAIC
   static FILE* DoOpen (char* filename)
 #else
@@ -3418,8 +3422,10 @@ will retry to open the file.
   char* path;                          /* default 4tH directory */
   char* fullname;                      /* pointer to fullname */
                                        /* if open failed and path is set */
-  if (Fp == NULL)                      /* allocate enough space */
-     if ((path = getenv ("DIR4TH")) != NULL)
+  if (Fp == NULL) {                    /* allocate enough space */
+     path = getenv ("DIR4TH");
+     if (path == NULL)
+        path = DIR4TH;
         if ((fullname = (char*) calloc (strlen (path) + strlen (filename) + 1,
            sizeof (char))) != NULL)
            {                           /* construct the full name */
@@ -3427,7 +3433,7 @@ will retry to open the file.
              Fp = fopen (fullname, "rb");
              free (fullname);          /* try to open file and free space */
            }
-
+  }
   return (Fp);                         /* return file pointer */
 }
 
 
© 2009–2017 Igor Zubkov