home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / gle / gle / edtmain.c < prev    next >
C/C++ Source or Header  |  1992-11-29  |  3KB  |  130 lines

  1. #include "all.h"
  2. #include <math.h>
  3. #ifdef __TURBOC__
  4. #include "conio.h"
  5. #include "bios.h"
  6. #endif
  7. int gotfile;
  8. int gle_debug;
  9. int dev_eps=0;
  10. extern int trace_on;
  11. int text_expand(int n);
  12. int g_get_type(char *s);
  13. int gle_redraw(void);
  14. int scr_init(void);
  15. int scr_end(void);
  16. #define true (!false)
  17. #define false 0
  18. #define dbg if (gle_debug>0)
  19. #ifdef __TURBOC__
  20.     extern unsigned _stklen=45000;
  21. #endif
  22.  
  23. typedef char (*TEXT)[];
  24. int int_edt(char *fname);
  25. int scrinsert(int y);
  26. int scrdeleteline(int y);
  27. int fner(char *s);
  28. int fner_clear(void);
  29. int setoutfile(char *s);
  30. int lineset(int i,char *ss);
  31. int lineinsert(int y, char *ss);
  32. int textinsert(int y);
  33. char *sline(int i);
  34. int text_load(char *f);
  35. int print_out(void);
  36. char *line(int i);
  37. int ncpy(char *d, char *s, int n);
  38. /*------------ GLOBAL VARIABLES --------------*/
  39. char input_file[90];
  40. char *(*gtxt)[];   /* gtxt is a pointer to an array of poiter to char */
  41. int ngtxt=0;
  42. /*---------------------------------------------------------------------------*/
  43. main(int argc, char **argv)
  44. {
  45. char dtype[60];
  46. char fname[60];
  47. static int i,ask_debug,spawn_print,call_menu;
  48.     strcpy(fname,"test.gle");
  49.     for (i=1;i<argc;i++) {
  50.         strupr( argv[i] );
  51.         if (strcmp( argv[i] , "/TRACE")==0) trace_on = true;
  52.         else if (strcmp( argv[i] , "/DEBUG")==0) ask_debug = true;
  53.         else if (strcmp( argv[i] , "/PRINT")==0) spawn_print = true;
  54.         else if (strcmp( argv[i] , "/MENU")==0) call_menu = true;
  55.         else if (strcmp( argv[i] , "/EPS")==0) dev_eps = true;
  56.         else if (strncmp( argv[i] , "/OUT", 4)==0) setoutfile(argv[i]);
  57.         else if (isalpha(*argv[i])) {strcpy(fname, argv[i]); gotfile = true;}
  58.     }
  59. /*    if (argc>1) strcpy(fname,*(++argv)); else strcpy(fname,"test.gle");*/
  60.     scr_init();
  61.  
  62.     if (strchr(fname,'.')==NULL) strcat(fname,".c");
  63.     strcpy(input_file,fname);
  64.     text_expand(500); /* Initially allocate 500 lines of text */
  65.     text_load(fname);
  66.  
  67.     int_edt(fname);
  68.     scr_end();
  69. }
  70. char output_file[80];
  71. setoutfile(char *q)
  72. {
  73.     char *s;
  74.     s = strchr(q,'=');
  75.     if (s==NULL) return;
  76.     strcpy(output_file,s+1);
  77. }
  78.  
  79. /* extras because of missing stuff in gle */
  80. char *tk[500];
  81. char tkbuff[500];
  82. int ntk;
  83. char srclin[300];
  84. char outbuff[300];
  85. int ngerror;
  86. d_tidyup()
  87. {}
  88. gle_redraw()
  89. {}
  90. d_message(char *s)
  91. {
  92.     printf("%s",s);
  93. }
  94. char *gle_top()
  95. {
  96.     char *s;
  97. #ifdef __TURBOC__
  98.     s = getenv("CGLE_TOP");
  99.     if (s!=NULL) return s;
  100.     return "c:\\gle\\";
  101. #else
  102.     return "cgle_top:";
  103. #endif
  104. }
  105. char *gledir(char *fname)
  106. {
  107.      static char fbuff[80];
  108.      strcpy(fbuff,gle_top());
  109.      strcat(fbuff,fname);
  110.      return &fbuff[0];
  111. }
  112. g_get_usersize(double *a, double *b)
  113. {}
  114. g_message(char *s)
  115. {
  116.     printf("%s\n",s);
  117. }
  118. int noscreenio=false;
  119. int abort_flag=false;
  120. freeafont()
  121. {}
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.