home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tc20 / mcalc.h < prev    next >
Text File  |  1988-10-13  |  8KB  |  258 lines

  1. /* Turbo C - (C) Copyright 1987, 1988 by Borland International */
  2.  
  3. #define S_IREAD     0x0100    /* from SYS\STAT.H */
  4. #define S_IWRITE 0x0080    /* from SYS\STAT.H */
  5.  
  6. #define TRUE 1
  7. #define FALSE 0
  8.  
  9. #define MSGHEADER "MicroCalc - ein Turbo C-Demonstrationsprogramm"
  10. #define MSGKEYPRESS "Weiter mit einem beliebigen Tastendruck"
  11. #define MSGCOMMAND "\"/\" -> Kommandos, F2 -> Edit"
  12. #define MSGMEMORY "Freier Speicher: "
  13. #define MSGERROR "FEHLER"
  14. #define MSGLOMEM "Kein Platz für diese Zelle im Speicher!"
  15. #define MSGEMPTY "Leer "
  16. #define MSGTEXT  "Text "
  17. #define MSGVALUE "Wert "
  18. #define MSGFORMULA "Formel"
  19. #define MSGAUTOCALC "AutoCalc"
  20. #define MSGFORMDISPLAY "Form"
  21. #define MSGFILENAME "Geben Sie den Dateinamen des Rechenblatts ein:"
  22. #define MSGNAME "Turbo C MicroCalc Spreadsheet"
  23. #define MSGCOLWIDTH "Neue Spaltenbreite:"
  24. #define MSGNOOPEN "Fehler beim Öffnen der Datei."
  25. #define MSGOVERWRITE "Datei existiert bereits. Überschreiben?"
  26. #define MSGFILELOMEM "Nicht genug Speicherplatz für das gesamte Rechenblatt"
  27. #define MSGNOMICROCALC "Diese Datei ist kein MicroCalc-Rechenblatt."
  28. #define MSGNOEXIST "Datei nicht gefunden."
  29. #define MSGGOTO "Eingabe der Zelladresse:"
  30. #define MSGBADNUMBER "Bitte eine Zahl im Bereich von %d bis %d eingeben!"
  31. #define MSGBADCELL "Hm - das ist keine gültige Zelladresse."
  32. #define MSGCELL1 "Adresse der ersten zu formatierenden Zelle:"
  33. #define MSGCELL2 "Adresse der letzten zu formatierenden Zelle:"
  34. #define MSGDIFFCOLROW "Entweder Spalten- oder Reihennummer müssen gleich sein."
  35. #define MSGRIGHTJUST "Rechsbündige Darstellung?"
  36. #define MSGDOLLAR "Zahlenwerte im Währungsformat?"
  37. #define MSGCOMMAS "Kommas nach jeder dritten Dezimalstelle?"
  38. #define MSGPLACES "Wieviele Stellen nach dem Komma sollen ausgegeben werden?"
  39. #define MSGCOLUMNS "Ausgabe mit 132 Zeichen Breite (Standard = 80)?"
  40. #define MSGPRINT "Name der Druck-Datei (nur RETURN -> Ausgabe auf Drucker):"
  41. #define MSGBORDER "Reihen-/Spaltennummern ebenfalls ausgeben?"
  42. #define MSGLOADING "Rechenblatt wird geladen..."
  43. #define MSGSAVING "Rechenblatt wird gespeichert..."
  44. #define MSGSAVESHEET "Rechenblatt speichern?"
  45. #define MSGSTACKERROR "Stack-Überlauf bei der Formelauswertung."
  46.  
  47. #define MENU "Rechenblatt Format Löschen Goto Spalte Zeile Edit Diverses Auto Beenden"
  48. #define COMMAND "RFLGSZEDAB"
  49. #define SMENU "Laden  Speichern  Drucken  Neu"
  50. #define SCOMMAND "LSDN"
  51. #define CMENU "Einfügen  Löschen  Breite"
  52. #define CCOMMAND "ELB"
  53. #define RMENU "Einfügen  Löschen"
  54. #define RCOMMAND "EL"
  55. #define UMENU "Neuberechnen  Formeldarstellung an/aus"
  56. #define UCOMMAND "NF"
  57.  
  58. #define MAXCOLS 100   /* MAXCOLS * MAXROWS sollte <= 10000 sein */
  59. #define MAXROWS 100
  60. #define LEFTMARGIN 3
  61. #define MINCOLWIDTH 3
  62. #define MAXCOLWIDTH 80 - LEFTMARGIN
  63. #define SCREENCOLS (80 - LEFTMARGIN) / MINCOLWIDTH + 1
  64. #define SCREENROWS 20
  65. #define DEFAULTWIDTH 10
  66. #define DEFAULTFORMAT 0X42
  67. #define MAXINPUT 79
  68. #define MAXPLACES 8
  69. #define TOPMARGIN 5
  70. #define PARSERSTACKSIZE 20
  71.  
  72. #define TEXTCOLOR WHITE
  73. #define ERRORCOLOR LIGHTRED + BLINK
  74. #define VALUECOLOR LIGHTCYAN
  75. #define FORMULACOLOR LIGHTMAGENTA
  76. #define BLANKCOLOR BLACK
  77. #define HEADERCOLOR WHITE + (RED << 4)
  78. #define HIGHLIGHTCOLOR WHITE + (BLUE << 4)
  79. #define HIGHLIGHTERRORCOLOR WHITE + (BLUE << 4) + BLINK
  80. #define MSGAUTOCALCCOLOR LIGHTCYAN
  81. #define MSGFORMDISPLAYCOLOR LIGHTMAGENTA
  82. #define MSGMEMORYCOLOR LIGHTGREEN
  83. #define MSGHEADERCOLOR LIGHTCYAN
  84. #define PROMPTCOLOR YELLOW
  85. #define COMMANDCOLOR LIGHTCYAN
  86. #define LOWCOMMANDCOLOR WHITE
  87. #define MEMORYCOLOR LIGHTRED
  88. #define CELLTYPECOLOR LIGHTGREEN
  89. #define CELLCONTENTSCOLOR YELLOW
  90.  
  91. #define HIGHLIGHT TRUE
  92. #define NOHIGHLIGHT FALSE
  93. #define UPDATE TRUE
  94. #define NOUPDATE FALSE
  95. #define FORMAT TRUE
  96. #define NOFORMAT FALSE
  97. #define LEFT 0
  98. #define RIGHT 1
  99. #define UP 2
  100. #define DOWN 3
  101. #define TEXT 0
  102. #define VALUE 1
  103. #define FORMULA 2
  104. #define COLADD 0
  105. #define COLDEL 1
  106. #define ROWADD 2
  107. #define ROWDEL 3
  108. #define OVERWRITE 0X80
  109. #define RJUSTIFY 0X40
  110. #define COMMAS 0X20
  111. #define DOLLAR 0X10
  112.  
  113. struct CELLREC
  114. {
  115.  char attrib;
  116.  union
  117.  {
  118.   char text[MAXINPUT + 1];
  119.   double value;
  120.   struct
  121.   {
  122.    double fvalue;
  123.    char formula[MAXINPUT + 1];
  124.   } f;
  125.  } v;
  126. };
  127.  
  128. typedef struct CELLREC *CELLPTR;
  129.  
  130. #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  131.  
  132. #define memsize coreleft() - 1000
  133. #define textcellsize(s) (((strlen(s) >> 1) + 3) << 1)
  134. #define valuecellsize 12
  135. #define formulacellsize(s) (((strlen(s) >> 1) + 7) << 1)
  136.  
  137. #else
  138.  
  139. #define memsize farcoreleft() - 1000
  140. #define textcellsize(s) (((strlen(s) >> 1) + 5) << 1)
  141. #define valuecellsize 16
  142. #define formulacellsize(s) (((strlen(s) >> 1) + 9) << 1)
  143.  
  144. #endif
  145.  
  146. #define BS 8
  147. #define FORMFEED 12
  148. #define CR 13
  149. #define ESC 27
  150. #define HOMEKEY 327
  151. #define ENDKEY 335
  152. #define UPKEY 328
  153. #define DOWNKEY 336
  154. #define PGUPKEY 329
  155. #define PGDNKEY 337
  156. #define LEFTKEY 331
  157. #define INSKEY 338
  158. #define RIGHTKEY 333
  159. #define DELKEY 339
  160. #define CTRLLEFTKEY 371
  161. #define CTRLRIGHTKEY 372
  162. #define F1 315
  163. #define F2 316
  164. #define F3 317
  165. #define F4 318
  166. #define F5 319
  167. #define F6 320
  168. #define F7 321
  169. #define F8 322
  170. #define F9 323
  171. #define F10 324
  172.  
  173. void initcursor(void);
  174. int getkey(void);
  175. int editstring(char *s, char *legal, int maxlength);
  176. int getint(int *number, int low, int high);
  177. void getinput(int c);
  178. void setcolor(int color);
  179. void scroll(int direction, int lines, int x1, int y1, int x2, int y2,
  180.             int attrib);
  181. void setcursor(unsigned int shape);
  182. void writef(int col, int row, int color, int width, va_list arg_list, ...);
  183. void printcol(void);
  184. void printrow(void);
  185. void displaycell(int col, int row, int highlighting, int updating);
  186. void displaycol(int col, int updating);
  187. void displayrow(int row, int updating);
  188. void displayscreen(int updating);
  189. void clearinput(void);
  190. void changecursor(int insmode);
  191. void showcelltype(void);
  192. void initcolortable(void);
  193. double parse(char *s, int *att);
  194. int alloctext(int col, int row, char *s);
  195. int allocvalue(int col, int row, double amt);
  196. int allocformula(int col, int row, char *s, double amt);
  197. void deletecell(int col, int row, int display);
  198. void printfreemem(void);
  199. void moverowup(void);
  200. void moverowdown(void);
  201. void movecolleft(void);
  202. void movecolright(void);
  203. void recalc(void);
  204. void changeautocalc(int newmode);
  205. void changeformdisplay(int newmode);
  206. void errormsg(char *s);
  207. void colstring(int col, char *colstr);
  208. void centercolstring(int col, char *colstr);
  209. void setleftcol(void);
  210. void setrightcol(void);
  211. void settoprow(void);
  212. void setbottomrow(void);
  213. void movehighlight(void);
  214. void setlastcol(void);
  215. void setlastrow(void);
  216. void act(char *s);
  217. void initvars(void);
  218. int getcommand(char *msgstr, char *comstr);
  219. void mainmenu(void);
  220. void editcell(CELLPTR ecell);
  221. int setoflags(int col, int row, int display);
  222. void clearoflags(int col, int row, int display);
  223. void updateoflags(int col, int row, int display);
  224. void loadsheet(char *filename);
  225. int getcell(int *col, int *row);
  226. char *cellstring(int col, int row, int *color, int formatting);
  227. void writeprompt(char *prompt);
  228. int getyesno(int *yesno, char *prompt);
  229. void swap(int *val1, int *val2);
  230. void redrawscreen(void);
  231. void checkforsave(void);
  232. void savesheet(void);
  233. int formulastart(char **input, int *col, int *row);
  234. int rowwidth(int row);
  235. void fixformula(int col, int row, int action, int place);
  236. void clearlastcol(void);
  237. void run(void);
  238. void gotocell(void);
  239. int inchrset(char c);
  240.  
  241. #if !defined(MAIN)
  242.  
  243. extern CELLPTR cell[MAXCOLS][MAXROWS], curcell;
  244. extern unsigned char format[MAXCOLS][MAXROWS];
  245. extern unsigned char colwidth[MAXCOLS];
  246. extern unsigned char colstart[SCREENCOLS];
  247. extern char formdisplay;
  248. extern char changed;
  249. extern char autocalc;
  250. extern int leftcol, rightcol, toprow, bottomrow, curcol, currow, lastcol,
  251.  lastrow, direction;
  252. extern long memleft;
  253. extern char stop;
  254. extern char matherror;
  255. extern unsigned int oldcursor, shortcursor, tallcursor, nocursor;
  256.  
  257. #endif
  258.