OSDN Git Service

modified some WINDOWS-only codes.
[putex/putex.git] / src / texsourc / tex0.c
index c35928e..0586036 100644 (file)
@@ -1,19 +1,19 @@
-#ifdef _WINDOWS
-  #define NOCOMM
-  #define NOSOUND
-  #define NODRIVERS
-  #define STRICT
-  #pragma warning(disable:4115) // kill rpcasync.h complaint
-  #include <windows.h>
-  #define MYLIBAPI __declspec(dllexport)
-#endif
+/* Copyright 2014 Clerk Ma
 
-#pragma warning(disable:4996)
-#pragma warning(disable:4131) // old style declarator
-#pragma warning(disable:4135) // conversion between different integral types 
-#pragma warning(disable:4127) // conditional expression is constant
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-#include <setjmp.h>
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.  */
 
 #define EXTERN extern
 
@@ -57,6 +57,7 @@ INLINE void dvi_out_(ASCII_code op)
 {
   dvi_buf[dvi_ptr] = op;
   incr(dvi_ptr);
+
   if (dvi_ptr == dvi_limit)
     dvi_swap();
 }
@@ -69,10 +70,12 @@ INLINE void succumb (void)
   {
     error();
   }
+
 #ifdef DEBUG
   if (interaction > 0)
     debug_help();
 #endif
+
   history = 3;
   jump_out();
 }
@@ -498,7 +501,6 @@ void sprint_cs_(halfword p)
   }
 }
 /* sec 0518 */
-/* ! I can't find file `  c:/foo/  accents  .tex  '. */
 void print_file_name_(integer n, integer a, integer e)
 {
   slow_print(a);
@@ -526,8 +528,6 @@ void print_write_whatsit_(str_number s, halfword p)
   else print_char('-');
 }
 /* sec 0081 */
-// called from itex.c and tex0.c only  NASTY NASTY!
-// now uses uses non-local goto (longjmp) 1999/Nov/7
 void jump_out (void) 
 {
   close_files_and_terminate();
@@ -844,7 +844,6 @@ void confusion_(char * s)
 /* sec 0037 */
 bool init_terminal (void)
 {
-  register bool Result;
   int flag;
 
   t_open_in();
@@ -857,10 +856,7 @@ bool init_terminal (void)
       incr(cur_input.loc_field);    // step over initial white space
 
     if (cur_input.loc_field < last)
-    {
-      Result = true;
-      return Result;    // there is an input file name
-    }
+      return true;
   }
 
 // failed to find input file name
@@ -880,8 +876,7 @@ bool init_terminal (void)
     {
       show_char('\n');
       show_line("! End of file on the terminal... why?\n", 1);
-      Result = false;
-      return Result;
+      return false;
     }
 
     cur_input.loc_field = first;
@@ -890,10 +885,7 @@ bool init_terminal (void)
       incr(cur_input.loc_field);    // step over intial white space
 
     if (cur_input.loc_field < last)
-    {
-      Result = true;
-      return Result;    // there is an input file name
-    }
+      return true;
 
     sprintf(log_line, "%s\n", "Please type the name of your input file.");
     show_line(log_line, 1);
@@ -1071,6 +1063,7 @@ char * add_string (char *s, char * str_string)
   s += n;
   strcpy(s, "\r\n");
   s += 2;
+
   return s;
 }
 
@@ -1172,7 +1165,7 @@ void term_input (char * term_str, int term_help_lines)
 //    free(helpstring);
 //  }
   show_line("\n", 0);    // force it to show what may be buffered up ???
-  helpstring = NULL;
+  helpstring = NULL;  
 
 #ifdef _WINDOWS
   if (term_str != NULL)
@@ -1406,9 +1399,9 @@ scaled xn_over_d_(scaled x, integer n, integer d)
     positive = false;
   }
 
-  t =(x % 32767L) * n;
-  u =(x / 32768L)* n +(t / 32768L);
-  v =(u % d)* 32768L +(t % 32768L); 
+  t = (x % 32767L) * n;
+  u = (x / 32768L) * n + (t / 32768L);
+  v = (u % d) * 32768L + (t % 32768L); 
 
   if (u / d >= 32768L)
     arith_error = true; 
@@ -1675,6 +1668,7 @@ halfword get_avail (void)
         overflow("main memory size", mem_max + 1 - mem_min);
         return 0;           // abort_flag set
       }
+
       incr(mem_end);        /* then grab from new area */
       p = mem_end;          /* 1993/Dec/14 */
     }