home *** CD-ROM | disk | FTP | other *** search
- /*
- Turbo C - (C) Copyright 1987,1988,1990 by Borland International */
-
- #define S_IREAD 0x0100 /* from SYS\STAT.H */
- #define S_IWRITE 0x0080 /* from SYS\STAT.H */
-
- #define TRUE 1
- #define FALSE 0
-
- #define MSGHEADER "TURBOCALC - ein Turbo C-Demonstrationsprogramm"
- #define MSGKEYPRESS "Mit beliebiger Taste weiter."
- #define MSGCOMMAND " / -> Kommandos, F2 -> Edit"
- #define MSGMEMORY "Freier Speicher:"
- #define MSGERROR "FEHLER"
- #define MSGLOMEM "Kein Platz für diese Zelle im Speicher."
- #define MSGEMPTY "Leer"
- #define MSGTEXT "Text"
- #define MSGVALUE "Wert"
- #define MSGFORMULA "Formel"
- #define MSGAUTOCALC "AutoCalc"
- #define MSGFORMDISPLAY "Form"
- #define MSGFILENAME "Geben Sie den Dateinamen des Rechenblatts ein:"
- #define MSGNAME "Turbo C TurboCalc Spreadsheet"
- #define MSGCOLWIDTH "Neue Spaltenbreite:"
- #define MSGNOOPEN "Fehler beim Öffnen der Datei."
- #define MSGOVERWRITE "Datei existiert bereits. Überschreiben?"
- #define MSGFILELOMEM "Ungenügend Speicherplatz für das Rechenblatt "
- #define MSGNOTURBOCALC "Diese Datei ist kein TurboCalc-Rechenblatt."
- #define MSGNOEXIST "Datei nicht gefunden."
- #define MSGGOTO "Eingabe der Zelladresse:"
- #define MSGBADNUMBER "Eine Zahl zwischen %d und %d eingeben."
- #define MSGBADCELL "Das ist keine gültige Zelladresse."
- #define MSGCELL1 "Adresse der ersten zu formatierenden Zelle: "
- #define MSGCELL2 "Adresse der letzten zu formatierenden Zelle:"
- #define MSGDIFFCOLROW "Spalten- oder Zeilennummer müssen gleich sein."
- #define MSGRIGHTJUST "Rechtsbündige Darstellung?"
- #define MSGDOLLAR "Zahlenwerte im Währungsformat?"
- #define MSGCOMMAS "Kommas nach jeder dritten Dezimalstelle?"
- #define MSGPLACES "Wieviele Nachkommastellen sollen ausgegeben werden?"
- #define MSGCOLUMNS "Ausgabe in 132 Zeichen Breite (Standard = 80)?"
- #define MSGPRINT "Name der Druckdatei (RETURN -> Ausgabe auf Drucker):"
- #define MSGBORDER "Zeilen-/Spaltennummer ebenfalls ausgeben?"
- #define MSGLOADING "Rechenblatt wird geladen..."
- #define MSGSAVING "Rechenblatt wird gespeichert..."
- #define MSGSAVESHEET "Rechenblatt speichern?"
- #define MSGSTACKERROR "Stack-Überlauf bei der Formelauswertung."
-
- #define MENU "Rechenblatt Format Löschen Goto Spalte Zeile Edit Diverses Auto Beenden"
- #define COMMAND "RFLGSZEDAB"
- #define SMENU "Laden Speichern Drucken Neu"
- #define SCOMMAND "LSDN"
- #define CMENU "Einfügen Löschen Breite"
- #define CCOMMAND "ELB"
- #define RMENU "Einfügen Löschen"
- #define RCOMMAND "EL"
- #define UMENU "Neuberechnen Formeldarstellung an/aus"
- #define UCOMMAND "NF"
-
- #define MAXCOLS 100 /* MAXCOLS * MAXROWS sollte <= 10000 sein */
- #define MAXROWS 100
- #define LEFTMARGIN 3
- #define MINCOLWIDTH 3
- #define MAXCOLWIDTH 80 - LEFTMARGIN
- #define SCREENCOLS (80 - LEFTMARGIN) / MINCOLWIDTH + 1
- #define SCREENROWS 20
- #define DEFAULTWIDTH 10
- #define DEFAULTFORMAT 0X42
- #define MAXINPUT 79
- #define MAXPLACES 8
- #define TOPMARGIN 5
- #define PARSERSTACKSIZE 20
-
- #define TEXTCOLOR WHITE
- #define ERRORCOLOR LIGHTRED + BLINK
- #define VALUECOLOR LIGHTCYAN
- #define FORMULACOLOR LIGHTMAGENTA
- #define BLANKCOLOR BLACK
- #define HEADERCOLOR WHITE + (RED << 4)
- #define HIGHLIGHTCOLOR WHITE + (BLUE << 4)
- #define HIGHLIGHTERRORCOLOR WHITE + (BLUE << 4) + BLINK
- #define MSGAUTOCALCCOLOR LIGHTCYAN
- #define MSGFORMDISPLAYCOLOR LIGHTMAGENTA
- #define MSGMEMORYCOLOR LIGHTGREEN
- #define MSGHEADERCOLOR LIGHTCYAN
- #define PROMPTCOLOR YELLOW
- #define COMMANDCOLOR LIGHTCYAN
- #define LOWCOMMANDCOLOR WHITE
- #define MEMORYCOLOR LIGHTRED
- #define CELLTYPECOLOR LIGHTGREEN
- #define CELLCONTENTSCOLOR YELLOW
-
- #define HIGHLIGHT TRUE
- #define NOHIGHLIGHT FALSE
- #define UPDATE TRUE
- #define NOUPDATE FALSE
- #define FORMAT TRUE
- #define NOFORMAT FALSE
- #define LEFT 0
- #define RIGHT 1
- #define UP 2
- #define DOWN 3
- #define TEXT 0
- #define VALUE 1
- #define FORMULA 2
- #define COLADD 0
- #define COLDEL 1
- #define ROWADD 2
- #define ROWDEL 3
- #define OVERWRITE 0X80
- #define RJUSTIFY 0X40
- #define COMMAS 0X20
- #define DOLLAR 0X10
-
- struct CELLREC
- {
- char attrib;
- union
- {
- char text[MAXINPUT + 1];
- double value;
- struct
- {
- double fvalue;
- char formula[MAXINPUT + 1];
- } f;
- } v;
- };
-
- typedef struct CELLREC *CELLPTR;
-
- #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
-
- #define memsize coreleft() - 1000
- #define textcellsize(s) (((strlen(s) >> 1) + 3) << 1)
- #define valuecellsize 12
- #define formulacellsize(s) (((strlen(s) >> 1) + 7) << 1)
-
- #else
-
- #define memsize farcoreleft() - 1000
- #define textcellsize(s) (((strlen(s) >> 1) + 5) << 1)
- #define valuecellsize 16
- #define formulacellsize(s) (((strlen(s) >> 1) + 9) << 1)
-
- #endif
-
- #define BS 8
- #define FORMFEED 12
- #define CR 13
- #define ESC 27
- #define HOMEKEY 327
- #define ENDKEY 335
- #define UPKEY 328
- #define DOWNKEY 336
- #define PGUPKEY 329
- #define PGDNKEY 337
- #define LEFTKEY 331
- #define INSKEY 338
- #define RIGHTKEY 333
- #define DELKEY 339
- #define CTRLLEFTKEY 371
- #define CTRLRIGHTKEY 372
- #define F1 315
- #define F2 316
- #define F3 317
- #define F4 318
- #define F5 319
- #define F6 320
- #define F7 321
- #define F8 322
- #define F9 323
- #define F10 324
-
- void initcursor(void);
- int getkey(void);
- int editstring(char *s, char *legal, int maxlength);
- int getint(int *number, int low, int high);
- void getinput(int c);
- void setcolor(int color);
- void scroll(int direction, int lines, int x1, int y1, int x2, int y2,
- int attrib);
- void setcursor(unsigned int shape);
- void writef(int col, int row, int color, int width, char *format, ...);
- void printcol(void);
- void printrow(void);
- void displaycell(int col, int row, int highlighting, int updating);
- void displaycol(int col, int updating);
- void displayrow(int row, int updating);
- void displayscreen(int updating);
- void clearinput(void);
- void changecursor(int insmode);
- void showcelltype(void);
- void initcolortable(void);
- double parse(char *s, int *att);
- int alloctext(int col, int row, char *s);
- int allocvalue(int col, int row, double amt);
- int allocformula(int col, int row, char *s, double amt);
- void deletecell(int col, int row, int display);
- void printfreemem(void);
- void moverowup(void);
- void moverowdown(void);
- void movecolleft(void);
- void movecolright(void);
- void recalc(void);
- void changeautocalc(int newmode);
- void changeformdisplay(int newmode);
- void errormsg(char *s);
- void colstring(int col, char *colstr);
- void centercolstring(int col, char *colstr);
- void setleftcol(void);
- void setrightcol(void);
- void settoprow(void);
- void setbottomrow(void);
- void movehighlight(void);
- void setlastcol(void);
- void setlastrow(void);
- void act(char *s);
- void initvars(void);
- int getcommand(char *msgstr, char *comstr);
- void mainmenu(void);
- void editcell(CELLPTR ecell);
- int setoflags(int col, int row, int display);
- void clearoflags(int col, int row, int display);
- void updateoflags(int col, int row, int display);
- void loadsheet(char *filename);
- int getcell(int *col, int *row);
- char *cellstring(int col, int row, int *color, int formatting);
- void writeprompt(char *prompt);
- int getyesno(int *yesno, char *prompt);
- void swap(int *val1, int *val2);
- void redrawscreen(void);
- void checkforsave(void);
- void savesheet(void);
- int formulastart(char **input, int *col, int *row);
- int rowwidth(int row);
- void fixformula(int col, int row, int action, int place);
- void clearlastcol(void);
- void run(void);
- void gotocell(void);
-
- #if !defined(MAIN)
-
- extern CELLPTR cell[MAXCOLS][MAXROWS], curcell;
- extern unsigned char format[MAXCOLS][MAXROWS];
- extern unsigned char colwidth[MAXCOLS];
- extern unsigned char colstart[SCREENCOLS];
- extern char formdisplay;
- extern char changed;
- extern char autocalc;
- extern int leftcol, rightcol, toprow, bottomrow, curcol, currow, lastcol,
- lastrow, direction;
- extern long memleft;
- extern char stop;
- extern char matherror;
- extern unsigned int oldcursor, shortcursor, tallcursor, nocursor;
-
- #endif
-