TCALCshgbshbvsfsf.zip

  • 12subhu
    了解作者
  • Borland C++
    开发工具
  • 21KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2020-04-23 03:57
    上传日期
fbdgfadfskjdbjksbjvbfjvjsfbjadvgisvdougbdifb
TCALCshgbshbvsfsf.zip
  • TCALC
  • TCALC.H
    7.6KB
  • TCINPUT.C
    4.1KB
  • TCOMMAND.C
    18.5KB
  • TCUTIL.C
    14.8KB
  • TCPARSER.C
    11.9KB
  • TCALC.C
    3.5KB
  • TCDISPLY.C
    6.5KB
  • TCALC.DOC
    2.1KB
  • TCALC.PRJ
    5.7KB
内容介绍
/* Turbo C++ - (C) Copyright 1987-1991 by Borland International */ #include <string.h> #include <mem.h> #include <stdio.h> #include <math.h> #include <io.h> #include <fcntl.h> #include <conio.h> #include "tcalc.h" char *name = MSGNAME; void moverowup(void) /* Moves up 1 row */ { displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (currow > toprow) currow--; else if (toprow != 0) { scroll(DOWN, 1, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); displayrow(--toprow, NOUPDATE); currow--; setbottomrow(); } } /* moverowup */ void moverowdown(void) /* Moves down one row */ { displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (currow < bottomrow) currow++; else if (bottomrow < (MAXROWS - 1)) { scroll(UP, 1, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); toprow++; currow++; setbottomrow(); displayrow(bottomrow, NOUPDATE); } } /* moverowdown */ void movecolleft(void) /* Moves left one column */ { int col, oldleftcol; unsigned char oldcolstart[SCREENCOLS]; oldleftcol = leftcol; movmem(colstart, oldcolstart, sizeof(colstart)); displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (curcol > leftcol) curcol--; else if (leftcol != 0) { curcol--; leftcol--; setrightcol(); setleftcol(); if (oldleftcol <= rightcol) scroll(RIGHT, colstart[oldleftcol - leftcol] - LEFTMARGIN, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); clearlastcol(); for (col = leftcol; col <= oldleftcol - 1; col++) displaycol(col, NOUPDATE); } } /* movecolleft */ void movecolright(void) /* Moves right one column */ { int col, oldleftcol, oldrightcol; unsigned char oldcolstart[SCREENCOLS]; movmem(colstart, oldcolstart, sizeof(colstart)); oldleftcol = leftcol; oldrightcol = rightcol; displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (curcol < rightcol) curcol++; else if (rightcol < (MAXCOLS - 1)) { curcol++; rightcol++; setleftcol(); setrightcol(); if (oldrightcol >= leftcol) scroll(LEFT, oldcolstart[leftcol - oldleftcol] - LEFTMARGIN, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); clearlastcol(); for (col = oldrightcol + 1; col <= rightcol; col++) displaycol(col, NOUPDATE); } } /* movecolright */ void recalc(void) /* Recalculates all of the numbers in the speadsheet */ { int col, row, dummy; for (col = 0; col <= lastcol; col++) { for (row = 0; row <= lastrow; row++) { if ((cell[col][row] != NULL) && (cell[col][row]->attrib == FORMULA)) cell[col][row]->v.f.fvalue = parse(cell[col][row]->v.f.formula, &dummy); } } displayscreen(UPDATE); } /* recalc */ void changeautocalc(int newmode) /* Changes and prints the current AutoCalc value on the screen */ { char s[15]; if (!autocalc && newmode) recalc(); autocalc = newmode; if (autocalc) strcpy(s, MSGAUTOCALC); else s[0] = 0; writef(73, 1, MSGAUTOCALCCOLOR, strlen(MSGAUTOCALC), s); } /* autocalc */ void changeformdisplay(int newmode) /* Changes and prints the current formula display value on the screen */ { char s[15]; formdisplay = newmode; if (formdisplay) strcpy(s, MSGFORMDISPLAY); else s[0] = 0; writef(65, 1, MSGFORMDISPLAYCOLOR, strlen(MSGFORMDISPLAY), s); } /* autocalc */ void editcell(CELLPTR ecell) /* Edits a selected cell */ { char s[MAXINPUT + 1]; if (ecell == NULL) return; switch(ecell->attrib) { case TEXT : strcpy(s, ecell->v.text); break; case VALUE : if (ecell->v.value == HUGE_VAL) strcpy(s, "0"); else sprintf(s, "%.*f", MAXPLACES, ecell->v.value); break; case FORMULA : strcpy(s, ecell->v.f.formula); break; } /* switch */ if (!editstring(s, "", MAXINPUT) || (s[0] == 0)) return; act(s); changed = TRUE; } /* editcell */ void clearsheet(void) /* Clears the current spreadsheet */ { int col, row; for (row = 0; row <= lastrow; row++) { for (col = 0; col <= lastcol; col++) deletecell(col, row, NOUPDATE); } initvars(); setrightcol(); setbottomrow(); displayscreen(NOUPDATE); printfreemem(); changed = FALSE; } /* clearsheet */ struct CELLREC rec; void loadsheet(char *filename) /* Loads a new spreadsheet */ { int size, allocated, reallastcol = 0, reallastrow = 0, file; char check[81]; if (filename[0] == 0) { writeprompt(MSGFILENAME); if (!editstring(filename, "", MAXINPUT)) return; } if (access(filename, 0)) { errormsg(MSGNOEXIST); return; } if ((file = open(filename, O_RDWR | O_BINARY)) == -1) { errormsg(MSGNOOPEN); return; } read(file, check, strlen(name) + 1); if (strcmp(check, name) != 0) { errormsg(MSGNOTURBOCALC); close(file); return; } writef(1, 25, PROMPTCOLOR, 79, MSGLOADING); gotoxy(strlen(MSGLOADING) + 1, 25); clearsheet(); read(file, (char *)&size, 1); read(file, (char *)&lastcol, 2); read(file, (char *)&lastrow, 2); read(file, (char *)&size, 2); read(file, colwidth, sizeof(colwidth)); do { if (read(file, (char *)&curcol, 2) <= 0) break; read(file, (char *)&currow, 2); read(file, &format[curcol][currow], 1); read(file, (char *)&size, 2); read(file, (char *)&rec, size); switch (rec.attrib) { case TEXT : if ((allocated = alloctext(curcol, currow, rec.v.text)) == TRUE) setoflags(curcol, currow, NOUPDATE); break; case VALUE : allocated = allocvalue(curcol, currow, rec.v.value); break; case FORMULA : allocated = allocformula(curcol, currow, rec.v.f.formula, rec.v.f.fvalue); break; } /* switch */ if (!allocated) { errormsg(MSGFILELOMEM); lastrow = reallastrow; lastcol = reallastcol; format[curcol][currow] = DEFAULTFORMAT; break; } else { if (curcol > reallastcol) reallastcol = curcol; if (currow > reallastrow) reallastrow = currow; } } while (TRUE); writef(1, 25, WHITE, strlen(MSGLOADING), ""); gotoxy(1, 25); printfreemem(); close(file); curcol = currow = 0; setrightcol(); displayscreen(NOUPDATE); changed = FALSE; } /* loadsheet */ void savesheet(void) /* Saves the current spreadsheet */ { char filename[MAXINPUT+1], eof = 26; int size, col, row, overwrite, file; CELLPTR cellptr; filename[0] = 0; writeprompt(MSGFILENAME); if (!editstring(filename, "", MAXINPUT)) return; if (!access(filename, 0)) { if (!getyesno(&overwrite, MSGOVERWRITE) || (overwrite == 'N')) return; } if ((file = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE)) == -1) { errormsg(MSGNOOPEN); return; } writef(1, 25, PROMPTCOLOR, 79, MSGSAVING); gotoxy(strlen(MSGSAVING) + 1, 25); write(file, name, strlen(name) + 1); write(file, &eof, 1); write(file, (char *)&lastcol, 2); write(file, (char *)&lastrow, 2); size = MAXCOLS; write(file, (char *)&size, 2); write(file, colwidth, sizeof(colwidth)); for (row = 0; row <= lastrow; row++) { for (col = lastcol; col >= 0; col--) { if (cell[col][row] != NULL) { cellptr = cell[col][row]; switch(cellptr->attrib) { case TEXT : size = strlen(cellptr->v.text) + 2; break; case VALUE : size = sizeof(double) + 1; break; case FORMULA : size = strlen(cellptr->v.f.formula) + 2 + sizeof(double); break; } /* switch */ write(file, (char *)&col, 2); write(file, (char *)&row, 2); write(file, (char *)&format[col][row], 1); write(file, (char *)&size, 2); write(file, (char *)cellptr, size); } } } close(file); writef(1, 25, WHITE, strlen(MSGSAVING), ""); gotoxy(1, 25); changed = FALSE; } /* savesheet */ int pagerows(int row, int toppage, int border) /* Returns the number of rows to print */ { int rows; rows = toppage ? 66 - TOPMARGIN : 66; if (border) rows--;
评论
    相关推荐
    • c++.zip
      LAB OF C++
    • C++ zip解压缩压缩
      只需要包含头文件,就可以进行文件的压缩和解压缩。可查看readme 或者文件中demo 简单易用。
    • C++解压zip
      Test2UnZip 循环依次解压多个zip文件 记录解压时间
    • c/c++zip压缩解压缩
      c/c++zip压缩解压缩,完整源代码和例子
    • C++ZIP.zip
      C++压缩和解压ZIP文件,有演示代码,VS2008开发工具,基于ZipLib库封装。也可以作为学习使用ZipLib的演示而自己去封装
    • c++.zip
      c++.zip
    • c++.zip
      基础的c++学习资料,适合学习c++的程序员参考
    • C++.zip
      适合一开始学c++的童鞋阅读,类型,运算符,类,对象等写的很清楚。
    • C++ zip压缩解压缩源代码
      C++ zip压缩解压缩源代码 压缩时调用 #include "zip.h" HZIP hz = CreateZip("c:\\simple1.zip",0); ZipAdd(hz,"znsimple.bmp", "c:\\simple.bmp"); ZipAdd(hz,"znsimple.txt", "c:\\simple.txt"); ...
    • C++ zip文件压缩与解压模块
      C++开发的专门用于ZIP格式的文件压缩与解压代码,能很好的完成功能通过测试可用