home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-09-20 | 26.2 KB | 1,133 lines |
- Newsgroups: comp.sources.misc
- From: uunet!sawmill!prslnk!buhrt (Jeff Buhrt)
- Subject: REPOST: v22i096: sc - The SC Spreadsheet, release 6.16, Patch01b/2
- Message-ID: <1991Sep20.143406.6061@sparky.imd.sterling.com>
- X-Md4-Signature: e1b770411fc08e86cafebaec1e697876
- Date: Fri, 20 Sep 1991 14:34:06 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: uunet!sawmill!prslnk!buhrt (Jeff Buhrt)
- Posting-number: Volume 22, Issue 96
- Archive-name: sc/patch01b
- Environment: UNIX, VMS, MS-DOS
- Patch-To: sc: Volume 20, Issue 35-41
-
- #!/bin/sh
- # this is sc-P.02 (part 2 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file pch616-617 continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 2; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping pch616-617'
- else
- echo 'x - continuing file pch616-617'
- sed 's/^X//' << 'SHAR_EOF' >> 'pch616-617' &&
- X }
- X if ((p->cellerror = cellerror) || (v != p->v)) {
- X p->v = v;
- --- 1372,1379 ----
- X v = (double)0.0;
- X } else {
- X cellerror = CELLOK;
- X gmyrow=i; gmycol=j;
- + v = eval (p->expr);
- X }
- X if ((p->cellerror = cellerror) || (v != p->v)) {
- X p->v = v;
- ***************
- *** 1379,1385 ****
- X double a1;
- X {
- X register struct enode *p;
- ! if (freeenodes)
- X { p = freeenodes;
- X freeenodes = p->e.o.left;
- X }
- --- 1443,1449 ----
- X double a1;
- X {
- X register struct enode *p;
- ! if (freeenodes) /* reuse an already free'd enode */
- X { p = freeenodes;
- X freeenodes = p->e.o.left;
- X }
- ***************
- *** 1396,1402 ****
- X {
- X register struct enode *p;
- X
- ! if (freeenodes)
- X { p = freeenodes;
- X freeenodes = p->e.o.left;
- X }
- --- 1460,1466 ----
- X {
- X register struct enode *p;
- X
- ! if (freeenodes) /* reuse an already free'd enode */
- X { p = freeenodes;
- X freeenodes = p->e.o.left;
- X }
- ***************
- *** 1466,1471 ****
- --- 1530,1536 ----
- X for (dc=vc, sc=minsc; sc<=maxsc; sc++, dc++) {
- X if (p = *ATBL(tbl, sr, sc))
- X { n = lookat (dr, dc);
- + if (n->flags&is_locked) continue;
- X (void) clearent(n);
- X copyent( n, p, dr - sr, dc - sc);
- X }
- ***************
- *** 1692,1697 ****
- --- 1757,1763 ----
- X for (r = minr; r<=maxr; r++)
- X for (c = minc; c<=maxc; c++) {
- X n = lookat (r, c);
- + if (n->flags&is_locked) continue;
- X (void) clearent(n);
- X n->v = start;
- X start += inc;
- ***************
- *** 1712,1717 ****
- --- 1778,1839 ----
- X changed++;
- X }
- X
- + /* lock a range of cells */
- +
- + void
- + lock_cells (v1, v2)
- + struct ent *v1, *v2;
- + {
- + register r,c;
- + register struct ent *n;
- + int maxr, maxc;
- + int minr, minc;
- +
- + maxr = v2->row;
- + maxc = v2->col;
- + minr = v1->row;
- + minc = v1->col;
- + if (minr>maxr) r = maxr, maxr = minr, minr = r;
- + if (minc>maxc) c = maxc, maxc = minc, minc = c;
- + checkbounds(&maxr, &maxc);
- + if (minr < 0) minr = 0;
- + if (minc < 0) minc = 0;
- +
- + for (r = minr; r<=maxr; r++)
- + for (c = minc; c<=maxc; c++) {
- + n = lookat (r, c);
- + n->flags |= is_locked;
- + }
- + }
- +
- + /* unlock a range of cells */
- +
- + void
- + unlock_cells (v1, v2)
- + struct ent *v1, *v2;
- + {
- + register r,c;
- + register struct ent *n;
- + int maxr, maxc;
- + int minr, minc;
- +
- + maxr = v2->row;
- + maxc = v2->col;
- + minr = v1->row;
- + minc = v1->col;
- + if (minr>maxr) r = maxr, maxr = minr, minr = r;
- + if (minc>maxc) c = maxc, maxc = minc, minc = c;
- + checkbounds(&maxr, &maxc);
- + if (minr < 0) minr = 0;
- + if (minc < 0) minc = 0;
- +
- + for (r = minr; r<=maxr; r++)
- + for (c = minc; c<=maxc; c++) {
- + n = lookat (r, c);
- + n->flags &= ~is_locked;
- + }
- + }
- +
- X /* set the numeric part of a cell */
- X void
- X let (v, e)
- ***************
- *** 1749,1756 ****
- X }
- X
- X if (isconstant) {
- ! if (!loading && prescale < (double)0.9999999)
- X val *= prescale;
- X v->v = val;
- X
- X if (!(v->flags & is_strexpr)) {
- --- 1871,1881 ----
- X }
- X
- X if (isconstant) {
- ! /* prescale input unless it has a decimal */
- ! if (!loading && (prescale < (double)0.9999999) &&
- ! (fmod(val, (double)1.0) == (double)0))
- X val *= prescale;
- +
- X v->v = val;
- X
- X if (!(v->flags & is_strexpr)) {
- ***************
- *** 1847,1852 ****
- --- 1972,1981 ----
- X for (r = minr; r <= maxr; r++)
- X for (c = minc; c <= maxc; c++) {
- X n = lookat (r, c);
- + if (n->flags&is_locked) {
- + error("Cell %s%d is locked", coltoa(n->col), n->row);
- + continue;
- + }
- X if (n->format)
- X xfree(n->format);
- X n->format = 0;
- ***************
- *** 2109,2114 ****
- --- 2238,2246 ----
- X case DAY: one_arg( "@day(", e); break;
- X case YEAR: one_arg( "@year(", e); break;
- X case DATE: one_arg( "@date(", e); break;
- + case UPPER: one_arg( "@upper(", e); break;
- + case LOWER: one_arg( "@lower(", e); break;
- + case CAPITAL: one_arg( "@capital(", e); break;
- X case DTS: three_arg( "@dts(", e); break;
- X case TTS: three_arg( "@tts(", e); break;
- X case STON: one_arg( "@ston(", e); break;
- *** 6.16 1991/06/04 18:55:36
- --- lex.c 1991/09/04 14:28:14
- ***************
- *** 7,13 ****
- X *
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3/88, see list of changes.
- ! * $Revision: 6.16 $
- X *
- X */
- X
- --- 7,13 ----
- X *
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3/88, see list of changes.
- ! * $Revision: 6.17 $
- X *
- X */
- X
- ***************
- *** 48,56 ****
- --- 48,64 ----
- X extern YYSTYPE yylval;
- X extern int VMS_read_raw; /*sigh*/
- X #else /* VMS */
- + #if defined(MSDOS)
- + #include "y_tab.h"
- + #else
- X #include "y.tab.h"
- + #endif /* MSDOS */
- X #endif /* VMS */
- X
- + #ifdef hpux
- + extern YYSTYPE yylval;
- + #endif /* hpux */
- +
- X char *strtof();
- X
- X jmp_buf wakeup;
- ***************
- *** 201,218 ****
- X (void) signal(SIGFPE, sig_save);
- X } else if (*p=='"') {
- X char *ptr;
- ! ptr = p+1;
- ! while(*ptr && *ptr++ != '"');
- X ptr = xmalloc((unsigned)(ptr-p));
- X yylval.sval = ptr;
- X p += 1;
- ! while (*p && *p!='"') *ptr++ = *p++;
- X *ptr = 0;
- ! if (*p) p += 1;
- X ret = STRING;
- X } else if (*p=='[') {
- ! while (*p && *p!=']') p++;
- ! if (*p) p++;
- X linelim = p-line;
- X return yylex();
- X } else ret = *p++;
- --- 209,231 ----
- X (void) signal(SIGFPE, sig_save);
- X } else if (*p=='"') {
- X char *ptr;
- ! ptr = p+1; /* "string" or "string\"quoted\"" */
- ! while(*ptr && ((*ptr != '"') || (*(ptr-1) == '\\')))
- ! ptr++;
- X ptr = xmalloc((unsigned)(ptr-p));
- X yylval.sval = ptr;
- X p += 1;
- ! while (*p && ((*p != '"') || (*(p-1) == '\\')))
- ! *ptr++ = *p++;
- X *ptr = 0;
- ! if (*p)
- ! p += 1;
- X ret = STRING;
- X } else if (*p=='[') {
- ! while (*p && *p!=']')
- ! p++;
- ! if (*p)
- ! p++;
- X linelim = p-line;
- X return yylex();
- X } else ret = *p++;
- ***************
- *** 300,306 ****
- X case SMG$K_TRM_RIGHT: c = ctl('f'); break;
- X case SMG$K_TRM_UP: c = ctl('p'); break;
- X case SMG$K_TRM_DOWN: c = ctl('n'); break;
- ! default: c = c & 0x7f;
- X }
- X return (c);
- X }
- --- 313,319 ----
- X case SMG$K_TRM_RIGHT: c = ctl('f'); break;
- X case SMG$K_TRM_UP: c = ctl('p'); break;
- X case SMG$K_TRM_DOWN: c = ctl('n'); break;
- ! default: c = c & A_CHARTEXT;
- X }
- X return (c);
- X }
- ***************
- *** 526,532 ****
- X
- X #endif
- X
- ! #if defined(SYSV2) || defined(SYSV3)
- X
- X void
- X initkbd()
- --- 539,545 ----
- X
- X #endif
- X
- ! #if defined(SYSV2) || defined(SYSV3) || defined(MSDOS)
- X
- X void
- X initkbd()
- ***************
- *** 553,563 ****
- --- 566,595 ----
- X
- X c = getch();
- X switch (c) {
- + #ifdef KEY_LEFT
- X case KEY_LEFT: c = ctl('b'); break;
- + #endif
- + #ifdef KEY_RIGHT
- X case KEY_RIGHT: c = ctl('f'); break;
- + #endif
- + #ifdef KEY_UP
- X case KEY_UP: c = ctl('p'); break;
- + #endif
- + #ifdef KEY_DOWN
- X case KEY_DOWN: c = ctl('n'); break;
- + #endif
- + #ifdef KEY_BACKSPACE
- X case KEY_BACKSPACE: c = ctl('h'); break;
- + #endif
- + #ifdef KEY_NPAGE
- + case KEY_NPAGE: break;
- + #endif
- + #ifdef KEY_PPAGE
- + case KEY_PPAGE: break;
- + #endif
- + #ifdef KEY_HOME
- + case KEY_HOME: break;
- + #endif
- X #ifdef KEY_C1
- X /* This stuff works for a wyse wy75 in ANSI mode under 5.3. Good luck. */
- X /* It is supposed to map the curses keypad back to the numeric equiv. */
- *** 6.16 1991/06/04 18:57:22
- --- psc.c 1991/09/04 14:28:15
- ***************
- *** 17,23 ****
- X * Author: Robert Bond
- X * Adjustments: Jeff Buhrt and Eric Putz
- X */
- ! char *rev = "$Revision: 6.16 $";
- X
- X #include <ctype.h>
- X #include <stdio.h>
- --- 17,23 ----
- X * Author: Robert Bond
- X * Adjustments: Jeff Buhrt and Eric Putz
- X */
- ! char *rev = "$Revision: 6.17 $";
- X
- X #include <ctype.h>
- X #include <stdio.h>
- ***************
- *** 30,38 ****
- X #define EOL 4
- X
- X extern char *optarg;
- ! extern int optind;
- ! char *coltoa();
- ! char *progname;
- X
- X #ifdef SYSV3
- X extern void exit();
- --- 30,39 ----
- X #define EOL 4
- X
- X extern char *optarg;
- ! extern int optind, getopt(), atoi();
- ! char *coltoa();
- ! char *progname;
- ! int getrow(), getcol(), scan();
- X
- X #ifdef SYSV3
- X extern void exit();
- ***************
- *** 240,245 ****
- --- 241,247 ----
- X }
- X }
- X
- + int
- X scan()
- X {
- X register int c;
- ***************
- *** 310,315 ****
- --- 312,318 ----
- X }
- X
- X /* turns [A-Z][A-Z] into a number */
- + int
- X getcol(p)
- X char *p;
- X {
- ***************
- *** 329,334 ****
- --- 332,338 ----
- X }
- X
- X /* given a string turn it into a row number */
- + int
- X getrow(p)
- X char *p;
- X {
- *** 6.16 1991/06/04 18:57:22
- --- range.c 1991/09/04 14:28:15
- ***************
- *** 4,10 ****
- X *
- X * Robert Bond, 4/87
- X *
- ! * $Revision: 6.16 $
- X */
- X
- X #include <sys/types.h>
- --- 4,10 ----
- X *
- X * Robert Bond, 4/87
- X *
- ! * $Revision: 6.17 $
- X */
- X
- X #include <sys/types.h>
- *** 6.16 1991/06/04 18:55:36
- --- sc.c 1991/09/04 14:28:17
- ***************
- *** 8,14 ****
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- X * Currently supported by sequent!sawmill!buhrt (Jeff Buhrt)
- ! * $Revision: 6.16 $
- X *
- X */
- X
- --- 8,14 ----
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- X * Currently supported by sequent!sawmill!buhrt (Jeff Buhrt)
- ! * $Revision: 6.17 $
- X *
- X */
- X
- ***************
- *** 149,154 ****
- --- 149,155 ----
- X p->next = to_fix;
- X to_fix = p;
- X p->flags |= is_deleted;
- + p->flags &= ~is_locked;
- X }
- X
- X /* free deleted cells */
- ***************
- *** 199,205 ****
- --- 200,210 ----
- X
- X int tempx, tempy; /* Temp versions of curx, cury */
- X
- + #if defined(MSDOS)
- + if ((revi = strrchr(argv[0], '\\')) != NULL)
- + #else
- X if ((revi = strrchr(argv[0], '/')) != NULL)
- + #endif
- X progname = revi+1;
- X else
- X progname = argv[0];
- ***************
- *** 209,216 ****
- X argc--;
- X switch (argv[0][1]) {
- X case 'x':
- ! #ifdef VMS
- ! (void) fprintf(stderr, "Crypt not available for VMS\n");
- X exit(1);
- X #else
- X Crypt = 1;
- --- 214,221 ----
- X argc--;
- X switch (argv[0][1]) {
- X case 'x':
- ! #if defined(VMS) || defined(MSDOS)
- ! (void) fprintf(stderr, "Crypt not available for VMS or MS-DOS\n");
- X exit(1);
- X #else
- X Crypt = 1;
- ***************
- *** 293,299 ****
- X #ifdef SIGWINCH
- X /* got a SIGWINCH? */
- X if (hitwinch)
- ! { stopdisp();
- X startdisp();
- X FullUpdate++;
- X }
- --- 298,305 ----
- X #ifdef SIGWINCH
- X /* got a SIGWINCH? */
- X if (hitwinch)
- ! { hitwinch = 0;
- ! stopdisp();
- X startdisp();
- X FullUpdate++;
- X }
- ***************
- *** 321,327 ****
- X #if pyr
- X if ( iscntrl(c) || (c >= 011 && c <= 015) ) /* iscntrl broken in OSx4.1 */
- X #else
- ! if ( iscntrl(c) )
- X #endif
- X switch (c) {
- X #ifdef SIGTSTP
- --- 327,333 ----
- X #if pyr
- X if ( iscntrl(c) || (c >= 011 && c <= 015) ) /* iscntrl broken in OSx4.1 */
- X #else
- ! if ( iscntrl(c) || (c == 020 ) ) /* iscntrl broken in OSx4.1 */
- X #endif
- X switch (c) {
- X #ifdef SIGTSTP
- ***************
- *** 340,345 ****
- --- 346,354 ----
- X FullUpdate++;
- X ClearScreen++;
- X (void) clearok(stdscr,1);
- + /* Centering the display with cursor for middle */
- + if(currow > (LINES-RESROW)/2)
- + strow = currow - ((LINES-RESROW)/2);
- X break;
- X case ctl('x'):
- X FullUpdate++;
- ***************
- *** 629,634 ****
- --- 638,645 ----
- X case '0': case '1': case '2': case '3': case '4':
- X case '5': case '6': case '7': case '8': case '9':
- X case '-': case '.': case '+':
- + if (locked_cell(currow, curcol))
- + break;
- X numeric_field = 1;
- X (void) sprintf(line,"let %s = %c",
- X v_name(currow, curcol), c);
- ***************
- *** 637,642 ****
- --- 648,655 ----
- X break;
- X
- X case '=':
- + if (locked_cell(currow, curcol))
- + break;
- X (void) sprintf(line,"let %s = ",
- X v_name(currow, curcol));
- X linelim = strlen (line);
- ***************
- *** 650,657 ****
- X * "!" forks a shell
- X * "!!" repeats last command
- X */
- ! #ifdef VMS
- ! error("Not implemented on VMS");
- X #else /* VMS */
- X char *shl;
- X int pid, temp;
- --- 663,670 ----
- X * "!" forks a shell
- X * "!!" repeats last command
- X */
- ! #if VMS || MSDOS
- ! error("Not implemented on VMS or MS-DOS");
- X #else /* VMS */
- X char *shl;
- X int pid, temp;
- ***************
- *** 703,712 ****
- X
- X case '/':
- X error (
- ! "Range: x:erase v:value c:copy f:fill d:define s:show u:undefine F:fmt");
- X (void) refresh();
- X
- X switch (nmgetch()) {
- X case 'c':
- X (void) sprintf(line,"copy [dest_range src_range] ");
- X linelim = strlen(line);
- --- 716,737 ----
- X
- X case '/':
- X error (
- ! "Range: x:erase v:value c:copy f:fill d:def l:lock U:unlock s:show u:undef F:fmt");
- X (void) refresh();
- X
- X switch (nmgetch()) {
- + case 'l':
- + (void) sprintf(line,"lock [range] ");
- + linelim = strlen(line);
- + startshow();
- + insert_mode();
- + break;
- + case 'U':
- + (void) sprintf(line,"unlock [range] ");
- + linelim = strlen(line);
- + startshow();
- + insert_mode();
- + break;
- X case 'c':
- X (void) sprintf(line,"copy [dest_range src_range] ");
- X linelim = strlen(line);
- ***************
- *** 926,955 ****
- X help();
- X break;
- X case '"':
- ! (void) sprintf (line, "label %s = \"",
- ! v_name(currow, curcol));
- ! linelim = strlen (line);
- ! insert_mode();
- X break;
- X case '<':
- ! (void) sprintf (line, "leftstring %s = \"",
- ! v_name(currow, curcol));
- ! linelim = strlen (line);
- ! insert_mode();
- X break;
- X case '>':
- ! (void) sprintf (line, "rightstring %s = \"",
- ! v_name(currow, curcol));
- ! linelim = strlen (line);
- ! insert_mode();
- X break;
- X case 'e':
- ! editv (currow, curcol);
- ! edit_mode();
- X break;
- X case 'E':
- ! edits (currow, curcol);
- ! edit_mode();
- X break;
- X case 'f':
- X if (arg == 1)
- --- 951,992 ----
- X help();
- X break;
- X case '"':
- ! if (!locked_cell(currow, curcol)) {
- ! (void) sprintf (line, "label %s = \"",
- ! v_name(currow, curcol));
- ! linelim = strlen (line);
- ! insert_mode();
- ! }
- X break;
- +
- X case '<':
- ! if (!locked_cell(currow, curcol)) {
- ! (void) sprintf (line, "leftstring %s = \"",
- ! v_name(currow, curcol));
- ! linelim = strlen (line);
- ! insert_mode();
- ! }
- X break;
- +
- X case '>':
- ! if (!locked_cell(currow, curcol)) {
- ! (void) sprintf (line, "rightstring %s = \"",
- ! v_name(currow, curcol));
- ! linelim = strlen (line);
- ! insert_mode();
- ! }
- X break;
- X case 'e':
- ! if (!locked_cell(currow, curcol)) {
- ! editv (currow, curcol);
- ! edit_mode();
- ! }
- X break;
- X case 'E':
- ! if (!locked_cell(currow, curcol)) {
- ! edits (currow, curcol);
- ! edit_mode();
- ! }
- X break;
- X case 'f':
- X if (arg == 1)
- ***************
- *** 1043,1061 ****
- X if(calc_order == BYROWS) {
- X for (c1 = curcol; arg-- && c1 < maxcols; c1++) {
- X pp = ATBL(tbl, currow, c1);
- ! if (*pp) {
- ! free_ent(*pp);
- ! *pp = (struct ent *)0;
- ! }
- X }
- X }
- X else {
- X for (c1 = currow; arg-- && c1 < maxrows; c1++) {
- X pp = ATBL(tbl, c1, curcol);
- ! if (*pp) {
- ! free_ent(*pp);
- ! *pp = (struct ent *)0;
- ! }
- X }
- X }
- X sync_refs();
- --- 1080,1102 ----
- X if(calc_order == BYROWS) {
- X for (c1 = curcol; arg-- && c1 < maxcols; c1++) {
- X pp = ATBL(tbl, currow, c1);
- ! if ((*pp) && !locked_cell(currow, curcol)) {
- ! if (*pp) {
- ! free_ent(*pp);
- ! *pp = (struct ent *)0;
- ! }
- ! }
- X }
- X }
- X else {
- X for (c1 = currow; arg-- && c1 < maxrows; c1++) {
- X pp = ATBL(tbl, c1, curcol);
- ! if ((*pp) && !locked_cell(currow, curcol)) {
- ! if (*pp) {
- ! free_ent(*pp);
- ! *pp = (struct ent *)0;
- ! }
- ! }
- X }
- X }
- X sync_refs();
- ***************
- *** 1091,1096 ****
- --- 1132,1144 ----
- X case 'K':
- X backrow((currow-strow+1)+3);
- X break;
- + #ifdef KEY_HOME
- + case KEY_HOME:
- + currow = 0;
- + curcol = 0;
- + FullUpdate++;
- + break;
- + #endif
- X case 'L':
- X forwcol(cols-(curcol-stcol)+1);
- X break;
- ***************
- *** 1197,1208 ****
- X #endif
- X
- X (void) signal(SIGINT, SIG_IGN);
- X (void) signal(SIGQUIT, dump_me);
- X (void) signal(SIGPIPE, quit);
- - (void) signal(SIGTERM, quit);
- X (void) signal(SIGALRM, time_out);
- - (void) signal(SIGFPE, quit);
- X (void) signal(SIGBUS, quit);
- X #ifdef SIGWINCH
- X (void) signal(SIGWINCH, winchg);
- X #endif
- --- 1245,1258 ----
- X #endif
- X
- X (void) signal(SIGINT, SIG_IGN);
- + #if !defined(MSDOS)
- X (void) signal(SIGQUIT, dump_me);
- X (void) signal(SIGPIPE, quit);
- X (void) signal(SIGALRM, time_out);
- X (void) signal(SIGBUS, quit);
- + #endif
- + (void) signal(SIGTERM, quit);
- + (void) signal(SIGFPE, quit);
- X #ifdef SIGWINCH
- X (void) signal(SIGWINCH, winchg);
- X #endif
- ***************
- *** 1216,1221 ****
- --- 1266,1272 ----
- X #endif
- X winchg()
- X { hitwinch++;
- + (void) signal(SIGWINCH, winchg);
- X }
- X #endif
- X
- ***************
- *** 1285,1288 ****
- --- 1336,1369 ----
- X return(yn_ans);
- X }
- X return(0);
- + }
- +
- + /* Returns 1 if cell is locked, 0 otherwise */
- + int
- + locked_cell (r, c)
- + int r, c;
- + {
- + struct ent *p = *ATBL(tbl, r, c);
- + if (p && (p->flags & is_locked)) {
- + error("Cell %s%d is locked", coltoa(c), r) ;
- + return(1);
- + }
- + return(0);
- + }
- +
- + /* Check if area contains locked cells */
- + int
- + any_locked_cells(r1, c1, r2, c2)
- + int r1, c1, r2, c2 ;
- + {
- + int r, c;
- + struct ent *p ;
- +
- + for (r=r1; r<=r2; r++)
- + for (c=c1; c<=c2; c++) {
- + p = *ATBL(tbl, r, c);
- + if (p->flags&is_locked)
- + return(1);
- + }
- + return(0);
- X }
- *** 6.16 1991/06/04 18:57:22
- --- sc.h 1991/09/04 14:28:18
- ***************
- *** 6,15 ****
- X * University of Maryland
- X * R. Bond 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- ! * $Revision: 6.16 $
- X *
- X */
- X
- X #define ATBL(tbl, row, col) (*(tbl + row) + (col))
- X
- X #define MINROWS 100 /* minimum size at startup */
- --- 6,19 ----
- X * University of Maryland
- X * R. Bond 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- ! * $Revision: 6.17 $
- X *
- X */
- X
- + #if defined(MSDOS)
- + #include <stdio.h>
- + #endif
- +
- X #define ATBL(tbl, row, col) (*(tbl + row) + (col))
- X
- X #define MINROWS 100 /* minimum size at startup */
- ***************
- *** 78,83 ****
- --- 82,88 ----
- X /*
- X * Some not too obvious things about the flags:
- X * is_valid means there is a valid number in v.
- + * is_locked means that the cell cannot be edited.
- X * label set means it points to a valid constant string.
- X * is_strexpr set means expr yields a string expression.
- X * If is_strexpr is not set, and expr points to an expression tree, the
- ***************
- *** 189,194 ****
- --- 194,202 ----
- X #define MYROW OP_BASE + 52
- X #define MYCOL OP_BASE + 53
- X #define COLTOA OP_BASE + 54
- + #define UPPER OP_BASE + 55
- + #define LOWER OP_BASE + 56
- + #define CAPITAL OP_BASE + 57
- X
- X /* flag values */
- X #define is_valid 0001
- ***************
- *** 196,201 ****
- --- 204,210 ----
- X #define is_strexpr 0004
- X #define is_leftflush 0010
- X #define is_deleted 0020
- + #define is_locked 0040
- X
- X /* cell error (1st generation (ERROR) or 2nd+ (INVALID)) */
- X #define CELLOK 0
- ***************
- *** 247,252 ****
- --- 256,262 ----
- X extern int showsc, showsr;
- X
- X extern FILE *openout();
- + extern FILE *fdopen(), *fopen();
- X extern char *coltoa();
- X extern char *findhome();
- X extern char *r_name();
- ***************
- *** 254,259 ****
- --- 264,270 ----
- X extern char *v_name();
- X extern char *xmalloc();
- X extern char *xrealloc();
- + extern int any_locked_cells();
- X extern int are_ranges();
- X extern int atocol();
- X extern int cwritefile();
- ***************
- *** 263,268 ****
- --- 274,280 ----
- X extern int format();
- X extern int get_rcqual();
- X extern int growtbl();
- + extern int locked_cell();
- X extern int modcheck();
- X extern int nmgetch();
- X extern int writefile();
- ***************
- *** 327,332 ****
- --- 339,345 ----
- X extern void label();
- X extern void let();
- X extern void list_range();
- + extern void lock_cells();
- X extern void moveto();
- X extern void num_search();
- X extern void opencol();
- ***************
- *** 349,354 ****
- --- 362,368 ----
- X extern void sync_ranges();
- X extern void sync_refs();
- X extern void tblprintfile();
- + extern void unlock_cells();
- X extern void valueize_area();
- X extern void write_fd();
- X extern void write_line();
- *** 6.16 1991/06/04 18:55:36
- --- screen.c 1991/09/04 14:28:18
- ***************
- *** 8,14 ****
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- X * Currently supported by sequent!sawmill!buhrt (Jeff Buhrt)
- ! * $Revision: 6.16 $
- X *
- X */
- X
- --- 8,14 ----
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- X * Currently supported by sequent!sawmill!buhrt (Jeff Buhrt)
- ! * $Revision: 6.17 $
- X *
- X */
- X
- ***************
- *** 436,441 ****
- --- 436,444 ----
- X }
- X if (! printed)
- X (void) addstr ("[]");
- + /* Display if cell is locked */
- + if (p1->flags&is_locked)
- + (void) addstr(" locked");
- X }
- X (void) move(lastmy, lastmx+fwidth[lastcol]);
- X }
- ***************
- *** 486,495 ****
- --- 489,517 ----
- X void
- X startdisp()
- X {
- + #if sun
- + int fd;
- + fd = dup(0);
- + #endif
- + #ifdef TIOCGSIZE
- + { struct ttysize size;
- + if (ioctl(0, TIOCGSIZE, &size) == 0)
- + {
- + LINES = size.ts_lines;
- + COLS = size.ts_cols;
- + }
- + }
- + #endif
- +
- X #ifdef XENIX2_3
- X (void) ioctl (fileno (stdin), TCGETA, & tmio);
- X #endif
- X (void) initscr();
- + #if sun
- + close(0);
- + dup(fd);
- + close(fd);
- + #endif
- X (void) clear();
- X #ifdef VMS
- X VMS_read_raw = 1;
- *** 6.16 1991/06/04 18:57:22
- --- version.c 1991/09/04 14:28:19
- ***************
- *** 4,7 ****
- X * The part after the first colon, except the last char, appears on the screen.
- X */
- X
- ! char *rev = "$Revision: 6.16 $";
- --- 4,7 ----
- X * The part after the first colon, except the last char, appears on the screen.
- X */
- X
- ! char *rev = "$Revision: 6.17 $";
- *** 6.16 1991/06/04 18:57:22
- --- vi.c 1991/09/04 14:28:20
- ***************
- *** 1,7 ****
- X /* SC A Spreadsheet Calculator
- X *
- X * One line vi emulation
- ! * $Revision: 6.16 $
- X */
- X
- X #include <sys/types.h>
- --- 1,7 ----
- X /* SC A Spreadsheet Calculator
- X *
- X * One line vi emulation
- ! * $Revision: 6.17 $
- X */
- X
- X #include <sys/types.h>
- *** 6.16 1991/06/04 18:57:22
- --- vmtbl.c 1991/09/04 14:28:21
- ***************
- *** 8,14 ****
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- X * Currently supported by sequent!sawmill!buhrt (Jeff Buhrt)
- ! * $Revision: 6.16 $
- X *
- X */
- X #ifdef PSC
- --- 8,14 ----
- X * More mods Robert Bond, 12/86
- X * More mods by Alan Silverstein, 3-4/88, see list of changes.
- X * Currently supported by sequent!sawmill!buhrt (Jeff Buhrt)
- ! * $Revision: 6.17 $
- X *
- X */
- X #ifdef PSC
- *** 6.16 1991/06/04 18:57:22
- --- xmalloc.c 1991/09/04 14:28:22
- ***************
- *** 1,6 ****
- X /*
- X * A safer saner malloc, for careless programmers
- ! * $Revision: 6.16 $
- X */
- X
- X #include <stdio.h>
- --- 1,6 ----
- X /*
- X * A safer saner malloc, for careless programmers
- ! * $Revision: 6.17 $
- X */
- X
- X #include <stdio.h>
- SHAR_EOF
- echo 'File pch616-617 is complete' &&
- chmod 0666 pch616-617 ||
- echo 'restore of pch616-617 failed'
- Wc_c="`wc -c < 'pch616-617'`"
- test 72450 -eq "$Wc_c" ||
- echo 'pch616-617: original size 72450, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= torev ==============
- if test -f 'torev' -a X"$1" != X"-c"; then
- echo 'x - skipping torev (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting torev (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'torev' &&
- REVISION=`sed -e '/Revision/!D' -e 's/.*$Revision: \([0-9.]*\) .*/\1/' version.c`
- sed -e s/pname/$name/g -e s/PNAME/$NAME/g \
- X -e "s%#LIBDIR#%$LIBDIR%g" \
- X -e "s/#REVISION#/$REVISION/" $1
- SHAR_EOF
- chmod 0444 torev ||
- echo 'restore of torev failed'
- Wc_c="`wc -c < 'torev'`"
- test 189 -eq "$Wc_c" ||
- echo 'torev: original size 189, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- rm -f _shar_seq_.tmp
- echo You have unpacked the last part
- exit 0
- exit 0 # Just in case...
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-