home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-13 | 48.1 KB | 2,015 lines |
- Newsgroups: comp.sources.misc
- From: lwall@netlabs.com (Larry Wall)
- Subject: v25i062: perl - The perl programming language, Patch13
- Message-ID: <1991Nov13.214304.3635@sparky.imd.sterling.com>
- X-Md4-Signature: 17152091640fcdfbbad255056f547d34
- Date: Wed, 13 Nov 1991 21:43:04 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: lwall@netlabs.com (Larry Wall)
- Posting-number: Volume 25, Issue 62
- Archive-name: perl/patch13
- Environment: UNIX, MS-DOS, OS2
- Patch-To: perl: Volume 18, Issue 19-54
-
- System: perl version 4.0
- Patch #: 13
- Priority: MED-HIGH
- Subject: patch #11, continued
-
- Description:
- See patch #11.
-
- Fix: From rn, say "| patch -p -N -d DIR", where DIR is your perl source
- directory. Outside of rn, say "cd DIR; patch -p -N <thisarticle".
- If you don't have the patch program, apply the following by hand,
- or get patch (version 2.0, latest patchlevel).
-
- After patching:
- *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #18 FIRST ***
-
- If patch indicates that patchlevel is the wrong version, you may need
- to apply one or more previous patches, or the patch may already
- have been applied. See the patchlevel.h file to find out what has or
- has not been applied. In any event, don't continue with the patch.
-
- If you are missing previous patches they can be obtained from me:
-
- Larry Wall
- lwall@netlabs.com
-
- If you send a mail message of the following form it will greatly speed
- processing:
-
- Subject: Command
- @SH mailpatch PATH perl 4.0 LIST
- ^ note the c
-
- where PATH is a return path FROM ME TO YOU either in Internet notation,
- or in bang notation from some well-known host, and LIST is the number
- of one or more patches you need, separated by spaces, commas, and/or
- hyphens. Saying 35- says everything from 35 to the end.
-
-
- Index: patchlevel.h
- Prereq: 12
- 1c1
- < #define PATCHLEVEL 12
- ---
- > #define PATCHLEVEL 13
-
- Index: config_h.SH
- *** config_h.SH.old Tue Nov 5 19:25:44 1991
- --- config_h.SH Tue Nov 5 19:25:45 1991
- ***************
- *** 24,29 ****
- --- 24,30 ----
- * that running config.h.SH again will wipe out any changes you've made.
- * For a more permanent change edit config.sh and rerun config.h.SH.
- */
- + /*SUPPRESS 460*/
-
-
- /* EUNICE
- ***************
- *** 55,61 ****
-
- /* BYTEORDER
- * This symbol contains an encoding of the order of bytes in a long.
- ! * Usual values (in octal) are 01234, 04321, 02143, 03412...
- */
- #define BYTEORDER 0x$byteorder /**/
-
- --- 56,62 ----
-
- /* BYTEORDER
- * This symbol contains an encoding of the order of bytes in a long.
- ! * Usual values (in hex) are 0x1234, 0x4321, 0x2143, 0x3412...
- */
- #define BYTEORDER 0x$byteorder /**/
-
- ***************
- *** 752,760 ****
- --- 753,766 ----
- #$i_my_dir I_MY_DIR /**/
- #$d_dirnamlen DIRNAMLEN /**/
-
- + /* MYMALLOC
- + * This symbol, if defined, indicates that we're using our own malloc.
- + */
- /* MALLOCPTRTYPE
- * This symbol defines the kind of ptr returned by malloc and realloc.
- */
- + #$d_mymalloc MYMALLOC /**/
- +
- #define MALLOCPTRTYPE $mallocptrtype /**/
-
-
-
- Index: cons.c
- *** cons.c.old Tue Nov 5 19:25:47 1991
- --- cons.c Tue Nov 5 19:25:48 1991
- ***************
- *** 1,4 ****
- ! /* $RCSfile: cons.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:31:15 $
- *
- * Copyright (c) 1991, Larry Wall
- *
- --- 1,4 ----
- ! /* $RCSfile: cons.c,v $$Revision: 4.0.1.2 $$Date: 91/11/05 16:15:13 $
- *
- * Copyright (c) 1991, Larry Wall
- *
- ***************
- *** 6,11 ****
- --- 6,15 ----
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: cons.c,v $
- + * Revision 4.0.1.2 91/11/05 16:15:13 lwall
- + * patch11: debugger got confused over nested subroutine definitions
- + * patch11: prepared for ctype implementations that don't define isascii()
- + *
- * Revision 4.0.1.1 91/06/07 10:31:15 lwall
- * patch4: new copyright notice
- * patch4: added global modifier for pattern matches
- ***************
- *** 74,81 ****
- STR *str;
- STR *tmpstr = str_mortal(&str_undef);
-
- ! sprintf(buf,"%s:%ld",stab_val(curcmd->c_filestab)->str_ptr,
- ! (long)subline);
- str = str_make(buf,0);
- str_cat(str,"-");
- sprintf(buf,"%ld",(long)curcmd->c_line);
- --- 78,84 ----
- STR *str;
- STR *tmpstr = str_mortal(&str_undef);
-
- ! sprintf(buf,"%s:%ld",stab_val(curcmd->c_filestab)->str_ptr, subline);
- str = str_make(buf,0);
- str_cat(str,"-");
- sprintf(buf,"%ld",(long)curcmd->c_line);
- ***************
- *** 83,91 ****
- name = str_get(subname);
- stab_fullname(tmpstr,stab);
- hstore(stab_xhash(DBsub), tmpstr->str_ptr, tmpstr->str_cur, str, 0);
- - str_set(subname,"main");
- }
- - subline = 0;
- return sub;
- }
-
- --- 86,92 ----
- ***************
- *** 732,737 ****
- --- 733,739 ----
- arg->arg_type == O_SLT || arg->arg_type == O_SGT) {
- if (arg[1].arg_type == A_STAB || arg[1].arg_type == A_LVAL) {
- if (arg[2].arg_type == A_SINGLE) {
- + /*SUPPRESS 594*/
- char *junk = str_get(arg[2].arg_ptr.arg_str);
-
- cmd->c_stab = arg[1].arg_ptr.arg_stab;
- ***************
- *** 908,914 ****
-
- if (bufptr > oldoldbufptr && bufptr - oldoldbufptr < 200 &&
- oldoldbufptr != oldbufptr && oldbufptr != bufptr) {
- ! while (isspace(*oldoldbufptr))
- oldoldbufptr++;
- strncpy(tmp2buf, oldoldbufptr, bufptr - oldoldbufptr);
- tmp2buf[bufptr - oldoldbufptr] = '\0';
- --- 910,916 ----
-
- if (bufptr > oldoldbufptr && bufptr - oldoldbufptr < 200 &&
- oldoldbufptr != oldbufptr && oldbufptr != bufptr) {
- ! while (isSPACE(*oldoldbufptr))
- oldoldbufptr++;
- strncpy(tmp2buf, oldoldbufptr, bufptr - oldoldbufptr);
- tmp2buf[bufptr - oldoldbufptr] = '\0';
- ***************
- *** 916,922 ****
- }
- else if (bufptr > oldbufptr && bufptr - oldbufptr < 200 &&
- oldbufptr != bufptr) {
- ! while (isspace(*oldbufptr))
- oldbufptr++;
- strncpy(tmp2buf, oldbufptr, bufptr - oldbufptr);
- tmp2buf[bufptr - oldbufptr] = '\0';
- --- 918,924 ----
- }
- else if (bufptr > oldbufptr && bufptr - oldbufptr < 200 &&
- oldbufptr != bufptr) {
- ! while (isSPACE(*oldbufptr))
- oldbufptr++;
- strncpy(tmp2buf, oldbufptr, bufptr - oldbufptr);
- tmp2buf[bufptr - oldbufptr] = '\0';
- ***************
- *** 1083,1088 ****
- --- 1085,1091 ----
- break;
- tail = tail->c_next;
- }
- + /*SUPPRESS 530*/
- for ( ; tail->c_next; tail = tail->c_next) ;
- }
-
- ***************
- *** 1118,1124 ****
- cmd->c_flags &= ~CF_OPTIMIZE; /* clear optimization type */
- cmd->c_flags |= CFT_ARRAY; /* and set it to do the iteration */
- cmd->c_stab = eachstab;
- ! cmd->c_short = str_new(0); /* just to save a field in struct cmd */
- cmd->c_short->str_u.str_useful = -1;
-
- return cmd;
- --- 1121,1127 ----
- cmd->c_flags &= ~CF_OPTIMIZE; /* clear optimization type */
- cmd->c_flags |= CFT_ARRAY; /* and set it to do the iteration */
- cmd->c_stab = eachstab;
- ! cmd->c_short = Str_new(23,0); /* just to save a field in struct cmd */
- cmd->c_short->str_u.str_useful = -1;
-
- return cmd;
- ***************
- *** 1268,1273 ****
- --- 1271,1277 ----
- for (sp = stash->tbl_spatroot;
- sp && sp->spat_next != spat;
- sp = sp->spat_next)
- + /*SUPPRESS 530*/
- ;
- if (sp)
- sp->spat_next = spat->spat_next;
-
- Index: consarg.c
- *** consarg.c.old Tue Nov 5 19:25:51 1991
- --- consarg.c Tue Nov 5 19:25:52 1991
- ***************
- *** 1,4 ****
- ! /* $RCSfile: consarg.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:33:12 $
- *
- * Copyright (c) 1991, Larry Wall
- *
- --- 1,4 ----
- ! /* $RCSfile: consarg.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 16:21:16 $
- *
- * Copyright (c) 1991, Larry Wall
- *
- ***************
- *** 6,11 ****
- --- 6,18 ----
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: consarg.c,v $
- + * Revision 4.0.1.3 91/11/05 16:21:16 lwall
- + * patch11: random cleanup
- + * patch11: added eval {}
- + * patch11: added sort {} LIST
- + * patch11: "foo" x -1 dumped core
- + * patch11: substr() and vec() weren't allowed in an lvalue list
- + *
- * Revision 4.0.1.2 91/06/07 10:33:12 lwall
- * patch4: new copyright notice
- * patch4: length($`), length($&), length($') now optimized to avoid string copy
- ***************
- *** 54,61 ****
- arg[3].arg_ptr.arg_arg = limarg;
- }
- }
- ! else
- arg[3].arg_type = A_NULL;
- arg->arg_type = O_SPLIT;
- spat = arg[2].arg_ptr.arg_spat;
- spat->spat_repl = stab2arg(A_STAB,aadd(stab));
- --- 61,71 ----
- arg[3].arg_ptr.arg_arg = limarg;
- }
- }
- ! else {
- ! arg[3].arg_flags = 0;
- arg[3].arg_type = A_NULL;
- + arg[3].arg_ptr.arg_arg = Nullarg;
- + }
- arg->arg_type = O_SPLIT;
- spat = arg[2].arg_ptr.arg_spat;
- spat->spat_repl = stab2arg(A_STAB,aadd(stab));
- ***************
- *** 154,159 ****
- --- 164,170 ----
-
- arg = op_new(newlen);
- arg->arg_type = type;
- + /*SUPPRESS 560*/
- if (chld = arg1) {
- if (chld->arg_type == O_ITEM &&
- (hoistable[ i = (chld[1].arg_type&A_MASK)] || i == A_LVAL ||
- ***************
- *** 173,178 ****
- --- 184,190 ----
- arg[1].arg_ptr.arg_arg = chld;
- }
- }
- + /*SUPPRESS 560*/
- if (chld = arg2) {
- if (chld->arg_type == O_ITEM &&
- (hoistable[chld[1].arg_type&A_MASK] ||
- ***************
- *** 193,198 ****
- --- 205,211 ----
- arg[2].arg_ptr.arg_arg = chld;
- }
- }
- + /*SUPPRESS 560*/
- if (chld = arg3) {
- if (chld->arg_type == O_ITEM && hoistable[chld[1].arg_type&A_MASK]) {
- arg[3].arg_type = chld[1].arg_type;
- ***************
- *** 300,305 ****
- --- 313,331 ----
- switch (arg->arg_type) {
- default:
- return arg;
- + case O_SORT:
- + if (arg[1].arg_type == A_CMD)
- + arg[1].arg_type |= A_DONT;
- + return arg;
- + case O_EVAL:
- + if (arg[1].arg_type == A_CMD) {
- + arg->arg_type = O_TRY;
- + arg[1].arg_type |= A_DONT;
- + return arg;
- + }
- + CHECK1;
- + arg->arg_type = O_EVALONCE;
- + return arg;
- case O_AELEM:
- CHECK2;
- i = (int)str_gnum(s2);
- ***************
- *** 322,331 ****
- i = (int)str_gnum(s2);
- tmps = str_get(s1);
- str_nset(str,"",0);
- ! STR_GROW(str, i * s1->str_cur + 1);
- ! repeatcpy(str->str_ptr, tmps, s1->str_cur, i);
- ! str->str_cur = i * s1->str_cur;
- ! str->str_ptr[str->str_cur] = '\0';
- break;
- case O_MULTIPLY:
- CHECK12;
- --- 348,359 ----
- i = (int)str_gnum(s2);
- tmps = str_get(s1);
- str_nset(str,"",0);
- ! if (i > 0) {
- ! STR_GROW(str, i * s1->str_cur + 1);
- ! repeatcpy(str->str_ptr, tmps, s1->str_cur, i);
- ! str->str_cur = i * s1->str_cur;
- ! str->str_ptr[str->str_cur] = '\0';
- ! }
- break;
- case O_MULTIPLY:
- CHECK12;
- ***************
- *** 338,344 ****
- if (value == 0.0)
- yyerror("Illegal division by constant zero");
- else
- ! #ifdef cray
- /* insure that 20./5. == 4. */
- {
- double x;
- --- 366,372 ----
- if (value == 0.0)
- yyerror("Illegal division by constant zero");
- else
- ! #ifdef SLOPPYDIVIDE
- /* insure that 20./5. == 4. */
- {
- double x;
- ***************
- *** 497,503 ****
- --- 525,535 ----
- break;
- case O_NOT:
- CHECK1;
- + #ifdef NOTNOT
- + { char xxx = str_true(s1); str_numset(str,(double)!xxx); }
- + #else
- str_numset(str,(double)(!str_true(s1)));
- + #endif
- break;
- case O_COMPLEMENT:
- CHECK1;
- ***************
- *** 704,709 ****
- --- 736,747 ----
- case O_HSLICE: case O_LHSLICE:
- arg1[i].arg_ptr.arg_arg->arg_type = O_LHSLICE;
- break;
- + case O_SUBSTR: case O_VEC:
- + (void)l(arg1[i].arg_ptr.arg_arg);
- + Renewc(arg1[i].arg_ptr.arg_arg->arg_ptr.arg_str, 1,
- + struct lstring, STR);
- + /* grow string struct to hold an lstring struct */
- + break;
- default:
- goto ill_item;
- }
- ***************
- *** 802,811 ****
- Renewc(arg1->arg_ptr.arg_str, 1, struct lstring, STR);
- /* grow string struct to hold an lstring struct */
- }
- ! else if (arg1->arg_type == O_ASSIGN) {
- ! /* if (arg->arg_type == O_CHOP)
- ! arg[1].arg_flags &= ~AF_ARYOK; /* grandfather chop idiom */
- ! }
- else {
- (void)sprintf(tokenbuf,
- "Illegal expression (%s) as lvalue",opname[arg1->arg_type]);
- --- 840,848 ----
- Renewc(arg1->arg_ptr.arg_str, 1, struct lstring, STR);
- /* grow string struct to hold an lstring struct */
- }
- ! else if (arg1->arg_type == O_ASSIGN)
- ! /*SUPPRESS 530*/
- ! ;
- else {
- (void)sprintf(tokenbuf,
- "Illegal expression (%s) as lvalue",opname[arg1->arg_type]);
- ***************
- *** 980,986 ****
- listish(arg)
- ARG *arg;
- {
- ! if (arg->arg_flags & AF_LISTISH)
- arg = make_op(O_LIST,1,arg,Nullarg,Nullarg);
- return arg;
- }
- --- 1017,1023 ----
- listish(arg)
- ARG *arg;
- {
- ! if (arg && arg->arg_flags & AF_LISTISH)
- arg = make_op(O_LIST,1,arg,Nullarg,Nullarg);
- return arg;
- }
-
- Index: usub/curses.mus
- Prereq: 4.0
- *** usub/curses.mus.old Tue Nov 5 19:28:20 1991
- --- usub/curses.mus Tue Nov 5 19:28:20 1991
- ***************
- *** 1,6 ****
- ! /* $Header: curses.mus,v 4.0 91/03/20 01:56:13 lwall Locked $
- *
- * $Log: curses.mus,v $
- * Revision 4.0 91/03/20 01:56:13 lwall
- * 4.0 baseline.
- *
- --- 1,9 ----
- ! /* $RCSfile: curses.mus,v $$Revision: 4.0.1.1 $$Date: 91/11/05 19:06:19 $
- *
- * $Log: curses.mus,v $
- + * Revision 4.0.1.1 91/11/05 19:06:19 lwall
- + * patch11: usub/curses.mus now supports SysV curses
- + *
- * Revision 4.0 91/03/20 01:56:13 lwall
- * 4.0 baseline.
- *
- ***************
- *** 11,32 ****
-
- #include "EXTERN.h"
- #include "perl.h"
- - extern int wantarray;
-
- char *savestr();
-
- #include <curses.h>
-
- static enum uservars {
- UV_curscr,
- UV_stdscr,
- - UV_Def_term,
- - UV_My_term,
- UV_ttytype,
- UV_LINES,
- UV_COLS,
- UV_ERR,
- UV_OK,
- };
-
- static enum usersubs {
- --- 14,63 ----
-
- #include "EXTERN.h"
- #include "perl.h"
-
- char *savestr();
-
- + #undef bool
- #include <curses.h>
-
- + #ifndef A_UNDERLINE
- + #define NOSETATTR
- + #define A_STANDOUT 0x0200
- + #define A_UNDERLINE 0x0100
- + #define A_REVERSE 0x0200
- + #define A_BLINK 0x0400
- + #define A_BOLD 0x0800
- + #define A_ALTCHARSET 0x1000
- + #define A_NORMAL 0
- + #endif
- +
- + #ifdef USG
- + static char *tcbuf = NULL;
- + #endif
- +
- + #ifdef NOSETATTR
- + static unsigned curattr = NORMAL;
- + #endif
- +
- static enum uservars {
- UV_curscr,
- UV_stdscr,
- UV_ttytype,
- UV_LINES,
- UV_COLS,
- UV_ERR,
- UV_OK,
- + #ifdef BSD
- + UV_Def_term,
- + UV_My_term,
- + #endif
- + UV_A_STANDOUT,
- + UV_A_UNDERLINE,
- + UV_A_REVERSE,
- + UV_A_BLINK,
- + UV_A_DIM,
- + UV_A_BOLD,
- + UV_A_NORMAL,
- };
-
- static enum usersubs {
- ***************
- *** 48,54 ****
- US_wdeleteln,
- US_erase,
- US_werase,
- - US_flushok,
- US_idlok,
- US_insch,
- US_winsch,
- --- 79,84 ----
- ***************
- *** 58,65 ****
- US_wmove,
- US_overlay,
- US_overwrite,
- - US_printw,
- - US_wprintw,
- US_refresh,
- US_wrefresh,
- US_standout,
- --- 88,93 ----
- ***************
- *** 76,88 ****
- US_wgetstr,
- US_raw,
- US_noraw,
- - US_scanw,
- - US_wscanw,
- US_baudrate,
- US_delwin,
- US_endwin,
- US_erasechar,
- - US_getcap,
- US_getyx,
- US_inch,
- US_winch,
- --- 104,113 ----
- ***************
- *** 90,96 ****
- US_killchar,
- US_leaveok,
- US_longname,
- - US_fullname,
- US_mvwin,
- US_newwin,
- US_nl,
- --- 115,120 ----
- ***************
- *** 98,104 ****
- US_scrollok,
- US_subwin,
- US_touchline,
- - US_touchoverlap,
- US_touchwin,
- US_unctrl,
- US_gettmode,
- --- 122,127 ----
- ***************
- *** 107,114 ****
- --- 130,157 ----
- US_savetty,
- US_resetty,
- US_setterm,
- + US_attroff,
- + US_wattroff,
- + US_attron,
- + US_wattron,
- + US_attrset,
- + US_wattrset,
- + #ifdef CURSEFMT
- + US_printw, /* remove */
- + US_wprintw, /* remove */
- + US_scanw, /* delete */
- + US_wscanw, /* delete */
- + #endif
- + US_getcap,
- + #ifdef BSD
- + US_flushok,
- + US_fullname,
- + US_touchoverlap,
- US_tstp,
- US__putchar,
- + #endif
- + US_mysub,
- + US_testcallback,
- };
-
- static int usersub();
- ***************
- *** 128,140 ****
-
- MAGICVAR("curscr", UV_curscr);
- MAGICVAR("stdscr", UV_stdscr);
- - MAGICVAR("Def_term",UV_Def_term);
- - MAGICVAR("My_term", UV_My_term);
- MAGICVAR("ttytype", UV_ttytype);
- MAGICVAR("LINES", UV_LINES);
- MAGICVAR("COLS", UV_COLS);
- MAGICVAR("ERR", UV_ERR);
- MAGICVAR("OK", UV_OK);
-
- make_usub("addch", US_addch, usersub, filename);
- make_usub("waddch", US_waddch, usersub, filename);
- --- 171,192 ----
-
- MAGICVAR("curscr", UV_curscr);
- MAGICVAR("stdscr", UV_stdscr);
- MAGICVAR("ttytype", UV_ttytype);
- MAGICVAR("LINES", UV_LINES);
- MAGICVAR("COLS", UV_COLS);
- MAGICVAR("ERR", UV_ERR);
- MAGICVAR("OK", UV_OK);
- + #ifdef BSD
- + MAGICVAR("Def_term",UV_Def_term);
- + MAGICVAR("My_term", UV_My_term);
- + #endif
- + MAGICVAR("A_STANDOUT", UV_A_STANDOUT);
- + MAGICVAR("A_UNDERLINE", UV_A_UNDERLINE);
- + MAGICVAR("A_REVERSE", UV_A_REVERSE);
- + MAGICVAR("A_BLINK", UV_A_BLINK);
- + MAGICVAR("A_DIM", UV_A_DIM);
- + MAGICVAR("A_BOLD", UV_A_BOLD);
- + MAGICVAR("A_NORMAL", UV_A_NORMAL);
-
- make_usub("addch", US_addch, usersub, filename);
- make_usub("waddch", US_waddch, usersub, filename);
- ***************
- *** 154,160 ****
- make_usub("wdeleteln", US_wdeleteln, usersub, filename);
- make_usub("erase", US_erase, usersub, filename);
- make_usub("werase", US_werase, usersub, filename);
- - make_usub("flushok", US_flushok, usersub, filename);
- make_usub("idlok", US_idlok, usersub, filename);
- make_usub("insch", US_insch, usersub, filename);
- make_usub("winsch", US_winsch, usersub, filename);
- --- 206,211 ----
- ***************
- *** 164,171 ****
- make_usub("wmove", US_wmove, usersub, filename);
- make_usub("overlay", US_overlay, usersub, filename);
- make_usub("overwrite", US_overwrite, usersub, filename);
- - make_usub("printw", US_printw, usersub, filename);
- - make_usub("wprintw", US_wprintw, usersub, filename);
- make_usub("refresh", US_refresh, usersub, filename);
- make_usub("wrefresh", US_wrefresh, usersub, filename);
- make_usub("standout", US_standout, usersub, filename);
- --- 215,220 ----
- ***************
- *** 182,194 ****
- make_usub("wgetstr", US_wgetstr, usersub, filename);
- make_usub("raw", US_raw, usersub, filename);
- make_usub("noraw", US_noraw, usersub, filename);
- - make_usub("scanw", US_scanw, usersub, filename);
- - make_usub("wscanw", US_wscanw, usersub, filename);
- make_usub("baudrate", US_baudrate, usersub, filename);
- make_usub("delwin", US_delwin, usersub, filename);
- make_usub("endwin", US_endwin, usersub, filename);
- make_usub("erasechar", US_erasechar, usersub, filename);
- - make_usub("getcap", US_getcap, usersub, filename);
- make_usub("getyx", US_getyx, usersub, filename);
- make_usub("inch", US_inch, usersub, filename);
- make_usub("winch", US_winch, usersub, filename);
- --- 231,240 ----
- ***************
- *** 196,202 ****
- make_usub("killchar", US_killchar, usersub, filename);
- make_usub("leaveok", US_leaveok, usersub, filename);
- make_usub("longname", US_longname, usersub, filename);
- - make_usub("fullname", US_fullname, usersub, filename);
- make_usub("mvwin", US_mvwin, usersub, filename);
- make_usub("newwin", US_newwin, usersub, filename);
- make_usub("nl", US_nl, usersub, filename);
- --- 242,247 ----
- ***************
- *** 204,210 ****
- make_usub("scrollok", US_scrollok, usersub, filename);
- make_usub("subwin", US_subwin, usersub, filename);
- make_usub("touchline", US_touchline, usersub, filename);
- - make_usub("touchoverlap", US_touchoverlap,usersub, filename);
- make_usub("touchwin", US_touchwin, usersub, filename);
- make_usub("unctrl", US_unctrl, usersub, filename);
- make_usub("gettmode", US_gettmode, usersub, filename);
- --- 249,254 ----
- ***************
- *** 213,222 ****
- make_usub("savetty", US_savetty, usersub, filename);
- make_usub("resetty", US_resetty, usersub, filename);
- make_usub("setterm", US_setterm, usersub, filename);
- make_usub("tstp", US_tstp, usersub, filename);
- make_usub("_putchar", US__putchar, usersub, filename);
- ! };
-
- static int
- usersub(ix, sp, items)
- int ix;
- --- 257,353 ----
- make_usub("savetty", US_savetty, usersub, filename);
- make_usub("resetty", US_resetty, usersub, filename);
- make_usub("setterm", US_setterm, usersub, filename);
- + make_usub("getcap", US_getcap, usersub, filename);
- + make_usub("attroff", US_attroff, usersub, filename);
- + make_usub("wattroff", US_wattroff, usersub, filename);
- + make_usub("attron", US_attron, usersub, filename);
- + make_usub("wattron", US_wattron, usersub, filename);
- + make_usub("attrset", US_attrset, usersub, filename);
- + make_usub("wattrset", US_wattrset, usersub, filename);
- + #ifdef CURSEFMT
- + make_usub("printw", US_printw, usersub, filename);
- + make_usub("wprintw", US_wprintw, usersub, filename);
- + make_usub("scanw", US_scanw, usersub, filename);
- + make_usub("wscanw", US_wscanw, usersub, filename);
- + #endif
- + #ifdef BSD
- + make_usub("flushok", US_flushok, usersub, filename);
- + make_usub("fullname", US_fullname, usersub, filename);
- + make_usub("touchoverlap", US_touchoverlap,usersub, filename);
- make_usub("tstp", US_tstp, usersub, filename);
- make_usub("_putchar", US__putchar, usersub, filename);
- ! #endif
- ! make_usub("testcallback", US_testcallback,usersub, filename);
- ! };
- !
- ! #ifdef USG
- ! static char
- ! *getcap(cap)
- ! register char *cap;
- ! {
- ! static char nocaperr[] = "Cannot read termcap entry.";
-
- + extern char *tgetstr();
- +
- + if (tcbuf == NULL) {
- + if ((tcbuf = malloc(1024)) == NULL) {
- + fatal(nocaperr);
- + }
- + if (tgetent(tcbuf, ttytype) == -1) {
- + fatal(nocaperr);
- + }
- + }
- +
- + return (tgetstr(cap, NULL));
- + }
- + #endif
- +
- + #ifdef NOSETATTR
- + #define attron(attr) wattron(stdscr, attr)
- + #define attroff(attr) wattroff(stdscr, attr)
- + #define attset(attr) wattset(stdscr, attr)
- +
- + int
- + wattron(win, attr)
- + WINDOW *win;
- + chtype attr;
- + {
- + curattr |= attr;
- + if (curattr & A_STANDOUT) {
- + return(wstandout(win));
- + } else {
- + return(wstandend(win));
- + }
- + }
- +
- + int
- + wattroff(win, attr)
- + WINDOW *win;
- + chtype attr;
- + {
- + curattr &= (~attr);
- + if (curattr & A_STANDOUT) {
- + return(wstandout(win));
- + } else {
- + return(wstandend(win));
- + }
- + }
- +
- + int
- + wattrset(win, attr)
- + WINDOW *win;
- + chtype attr;
- + {
- + curattr = attr;
- + if (curattr & A_STANDOUT) {
- + return(wstandout(win));
- + } else {
- + return(wstandend(win));
- + }
- + }
- +
- + #endif
- +
- static int
- usersub(ix, sp, items)
- int ix;
- ***************
- *** 300,310 ****
- I WINDOW* win
- END
-
- - CASE int flushok
- - I WINDOW* win
- - I bool boolf
- - END
- -
- CASE int idlok
- I WINDOW* win
- I bool boolf
- --- 431,436 ----
- ***************
- *** 347,381 ****
- I WINDOW* win2
- END
-
- - case US_printw:
- - if (items < 1)
- - fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
- - else {
- - int retval;
- - STR* str = str_new(0);
- -
- - do_sprintf(str, items - 1, st + 1);
- - retval = addstr(str->str_ptr);
- - str_numset(st[0], (double) retval);
- - str_free(str);
- - }
- - return sp;
- -
- - case US_wprintw:
- - if (items < 2)
- - fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
- - else {
- - int retval;
- - STR* str = str_new(0);
- - WINDOW* win = *(WINDOW**) str_get(st[1]);
- -
- - do_sprintf(str, items - 1, st + 1);
- - retval = waddstr(win, str->str_ptr);
- - str_numset(st[0], (double) retval);
- - str_free(str);
- - }
- - return sp;
- -
- CASE int refresh
- END
-
- --- 473,478 ----
- ***************
- *** 410,422 ****
- END
-
- case US_getch:
- ! if (items != 0)
- ! fatal("Usage: &getch()");
- ! else {
- ! int retval;
- char retch;
-
- ! retval = getch();
- if (retval == EOF)
- st[0] = &str_undef;
- else {
- --- 507,519 ----
- END
-
- case US_getch:
- ! if (items != 0)
- ! fatal("Usage: &getch()");
- ! else {
- ! int retval;
- char retch;
-
- ! retval = getch();
- if (retval == EOF)
- st[0] = &str_undef;
- else {
- ***************
- *** 423,440 ****
- retch = retval;
- str_nset(st[0], &retch, 1);
- }
- ! }
- ! return sp;
-
- case US_wgetch:
- ! if (items != 1)
- ! fatal("Usage: &wgetch($win)");
- ! else {
- ! int retval;
- char retch;
- ! WINDOW* win = *(WINDOW**) str_get(st[1]);
-
- ! retval = wgetch(win);
- if (retval == EOF)
- st[0] = &str_undef;
- else {
- --- 520,537 ----
- retch = retval;
- str_nset(st[0], &retch, 1);
- }
- ! }
- ! return sp;
-
- case US_wgetch:
- ! if (items != 1)
- ! fatal("Usage: &wgetch($win)");
- ! else {
- ! int retval;
- char retch;
- ! WINDOW* win = *(WINDOW**) str_get(st[1]);
-
- ! retval = wgetch(win);
- if (retval == EOF)
- st[0] = &str_undef;
- else {
- ***************
- *** 441,456 ****
- retch = retval;
- str_nset(st[0], &retch, 1);
- }
- ! }
- ! return sp;
-
- CASE int getstr
- ! IO char* str
- END
-
- CASE int wgetstr
- I WINDOW* win
- ! IO char* str
- END
-
- CASE int raw
- --- 538,553 ----
- retch = retval;
- str_nset(st[0], &retch, 1);
- }
- ! }
- ! return sp;
-
- CASE int getstr
- ! O char* str
- END
-
- CASE int wgetstr
- I WINDOW* win
- ! O char* str
- END
-
- CASE int raw
- ***************
- *** 472,481 ****
- CASE int erasechar
- END
-
- - CASE char* getcap
- - I char* str
- - END
- -
- case US_getyx:
- if (items != 3)
- fatal("Usage: &getyx($win, $y, $x)");
- --- 569,574 ----
- ***************
- *** 494,500 ****
- str_free(str);
- }
- return sp;
- -
-
- CASE int inch
- END
- --- 587,592 ----
- ***************
- *** 514,528 ****
- I bool boolf
- END
-
- CASE char* longname
- I char* termbuf
- IO char* name
- END
- !
- ! CASE int fullname
- ! I char* termbuf
- ! IO char* name
- END
-
- CASE int mvwin
- I WINDOW* win
- --- 606,622 ----
- I bool boolf
- END
-
- + #ifdef BSD
- CASE char* longname
- I char* termbuf
- IO char* name
- END
- ! #else
- ! CASE char* longname
- ! I char* termbug
- ! I char* name
- END
- + #endif
-
- CASE int mvwin
- I WINDOW* win
- ***************
- *** 563,573 ****
- I int endx
- END
-
- - CASE int touchoverlap
- - I WINDOW* win1
- - I WINDOW* win2
- - END
- -
- CASE int touchwin
- I WINDOW* win
- END
- --- 657,662 ----
- ***************
- *** 600,605 ****
- --- 689,770 ----
- I char* name
- END
-
- + CASE int attroff
- + I chtype str
- + END
- +
- + CASE int wattroff
- + I chtype str
- + END
- +
- + CASE int wattron
- + I chtype str
- + END
- +
- + CASE int attron
- + I chtype str
- + END
- +
- + CASE int attrset
- + I chtype str
- + END
- +
- + CASE int wattrset
- + I chtype str
- + END
- +
- + #ifdef CURSEFMT
- + case US_printw:
- + if (items < 1)
- + fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
- + else {
- + int retval;
- + STR* str = str_new(0);
- +
- + do_sprintf(str, items - 1, st + 1);
- + retval = addstr(str->str_ptr);
- + str_numset(st[0], (double) retval);
- + str_free(str);
- + }
- + return sp;
- +
- + case US_wprintw:
- + if (items < 2)
- + fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
- + else {
- + int retval;
- + STR* str = str_new(0);
- + WINDOW* win = *(WINDOW**) str_get(st[1]);
- +
- + do_sprintf(str, items - 1, st + 1);
- + retval = waddstr(win, str->str_ptr);
- + str_numset(st[0], (double) retval);
- + str_free(str);
- + }
- + return sp;
- +
- + #endif
- +
- + CASE char* getcap
- + I char* str
- + END
- +
- + #ifdef BSD
- + CASE int flushok
- + I WINDOW* win
- + I bool boolf
- + END
- +
- + CASE int fullname
- + I char* termbuf
- + IO char* name
- + END
- +
- + CASE int touchoverlap
- + I WINDOW* win1
- + I WINDOW* win2
- + END
- +
- CASE int tstp
- END
-
- ***************
- *** 607,612 ****
- --- 772,783 ----
- I char ch
- END
-
- + case US_testcallback:
- + sp = callback("callback", sp + items, curcsv->wantarray, 1, items);
- + break;
- +
- + #endif
- +
- default:
- fatal("Unimplemented user-defined subroutine");
- }
- ***************
- *** 622,630 ****
- case UV_COLS:
- str_numset(str, (double)COLS);
- break;
- - case UV_Def_term:
- - str_set(str, Def_term);
- - break;
- case UV_ERR:
- str_numset(str, (double)ERR);
- break;
- --- 793,798 ----
- ***************
- *** 631,639 ****
- case UV_LINES:
- str_numset(str, (double)LINES);
- break;
- - case UV_My_term:
- - str_numset(str, (double)My_term);
- - break;
- case UV_OK:
- str_numset(str, (double)OK);
- break;
- --- 799,804 ----
- ***************
- *** 646,651 ****
- --- 811,845 ----
- case UV_ttytype:
- str_set(str, ttytype);
- break;
- + #ifdef BSD
- + case UV_Def_term:
- + str_set(str, Def_term);
- + break;
- + case UV_My_term:
- + str_numset(str, (double)My_term);
- + break;
- + #endif
- + case UV_A_STANDOUT:
- + str_numset(str, (double)A_STANDOUT);
- + break;
- + case UV_A_UNDERLINE:
- + str_numset(str, (double)A_UNDERLINE);
- + break;
- + case UV_A_REVERSE:
- + str_numset(str, (double)A_REVERSE);
- + break;
- + case UV_A_BLINK:
- + str_numset(str, (double)A_BLINK);
- + break;
- + case UV_A_DIM:
- + str_numset(str, (double)A_DIM);
- + break;
- + case UV_A_BOLD:
- + str_numset(str, (double)A_BOLD);
- + break;
- + case UV_A_NORMAL:
- + str_numset(str, (double)A_NORMAL);
- + break;
- }
- return 0;
- }
- ***************
- *** 659,676 ****
- case UV_COLS:
- COLS = (int)str_gnum(str);
- break;
- - case UV_Def_term:
- - Def_term = savestr(str_get(str)); /* never freed */
- - break;
- case UV_LINES:
- LINES = (int)str_gnum(str);
- break;
- - case UV_My_term:
- - My_term = (bool)str_gnum(str);
- - break;
- case UV_ttytype:
- strcpy(ttytype, str_get(str)); /* hope it fits */
- break;
- }
- return 0;
- }
- --- 853,878 ----
- case UV_COLS:
- COLS = (int)str_gnum(str);
- break;
- case UV_LINES:
- LINES = (int)str_gnum(str);
- break;
- case UV_ttytype:
- strcpy(ttytype, str_get(str)); /* hope it fits */
- + #ifdef USG
- + if (tcbuf != NULL) {
- + free(tcbuf);
- + tcbuf = NULL;
- + }
- + #endif
- break;
- + #ifdef BSD
- + case UV_Def_term:
- + Def_term = savestr(str_get(str)); /* never freed */
- + break;
- + case UV_My_term:
- + My_term = (bool)str_gnum(str);
- + break;
- + #endif
- }
- return 0;
- }
-
- Index: doSH
- *** doSH.old Tue Nov 5 19:25:54 1991
- --- doSH Tue Nov 5 19:25:54 1991
- ***************
- *** 3,8 ****
- --- 3,10 ----
- : if this fails, just run all the .SH files by hand
- . ./config.sh
-
- + rm -f x2p/config.sh
- +
- echo " "
- echo "Doing variable substitutions on .SH files..."
- set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
- ***************
- *** 21,30 ****
- */*)
- dir=`expr X$file : 'X\(.*\)/'`
- file=`expr X$file : 'X.*/\(.*\)'`
- ! (cd $dir && . $file)
- ;;
- *)
- ! . $file
- ;;
- esac
- done
- --- 23,32 ----
- */*)
- dir=`expr X$file : 'X\(.*\)/'`
- file=`expr X$file : 'X.*/\(.*\)'`
- ! (cd $dir && . ./$file)
- ;;
- *)
- ! . ./$file
- ;;
- esac
- done
- ***************
- *** 31,36 ****
- if test -f config.h.SH; then
- if test ! -f config.h; then
- : oops, they left it out of MANIFEST, probably, so do it anyway.
- ! . config.h.SH
- fi
- fi
- --- 33,39 ----
- if test -f config.h.SH; then
- if test ! -f config.h; then
- : oops, they left it out of MANIFEST, probably, so do it anyway.
- ! . ./config.h.SH
- fi
- fi
- + exit 0
-
- Index: doarg.c
- *** doarg.c.old Tue Nov 5 19:25:57 1991
- --- doarg.c Tue Nov 5 19:25:58 1991
- ***************
- *** 1,4 ****
- ! /* $RCSfile: doarg.c,v $$Revision: 4.0.1.3 $$Date: 91/06/10 01:18:41 $
- *
- * Copyright (c) 1991, Larry Wall
- *
- --- 1,4 ----
- ! /* $RCSfile: doarg.c,v $$Revision: 4.0.1.4 $$Date: 91/11/05 16:35:06 $
- *
- * Copyright (c) 1991, Larry Wall
- *
- ***************
- *** 6,11 ****
- --- 6,20 ----
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: doarg.c,v $
- + * Revision 4.0.1.4 91/11/05 16:35:06 lwall
- + * patch11: /$foo/o optimizer could access deallocated data
- + * patch11: minimum match length calculation in regexp is now cumulative
- + * patch11: added some support for 64-bit integers
- + * patch11: prepared for ctype implementations that don't define isascii()
- + * patch11: sprintf() now supports any length of s field
- + * patch11: indirect subroutine calls through magic vars (e.g. &$1) didn't work
- + * patch11: defined(&$foo) and undef(&$foo) didn't work
- + *
- * Revision 4.0.1.3 91/06/10 01:18:41 lwall
- * patch10: pack(hh,1) dumped core
- *
- ***************
- *** 78,86 ****
- spat->spat_regexp = regcomp(m,m+dstr->str_cur,
- spat->spat_flags & SPAT_FOLD);
- if (spat->spat_flags & SPAT_KEEP) {
- arg_free(spat->spat_runtime); /* it won't change, so */
- spat->spat_runtime = Nullarg; /* no point compiling again */
- - scanconst(spat, m, dstr->str_cur);
- hoistmust(spat);
- if (curcmd->c_expr && (curcmd->c_flags & CF_OPTIMIZE) == CFT_EVAL) {
- curcmd->c_flags &= ~CF_OPTIMIZE;
- --- 87,95 ----
- spat->spat_regexp = regcomp(m,m+dstr->str_cur,
- spat->spat_flags & SPAT_FOLD);
- if (spat->spat_flags & SPAT_KEEP) {
- + scanconst(spat, m, dstr->str_cur);
- arg_free(spat->spat_runtime); /* it won't change, so */
- spat->spat_runtime = Nullarg; /* no point compiling again */
- hoistmust(spat);
- if (curcmd->c_expr && (curcmd->c_flags & CF_OPTIMIZE) == CFT_EVAL) {
- curcmd->c_flags &= ~CF_OPTIMIZE;
- ***************
- *** 151,157 ****
- }
- c = str_get(dstr);
- clen = dstr->str_cur;
- ! if (clen <= spat->spat_slen + (int)spat->spat_regexp->regback) {
- /* can do inplace substitution */
- if (regexec(spat->spat_regexp, s, strend, orig, 0,
- str->str_pok & SP_STUDIED ? str : Nullstr, safebase)) {
- --- 160,166 ----
- }
- c = str_get(dstr);
- clen = dstr->str_cur;
- ! if (clen <= spat->spat_regexp->minlen) {
- /* can do inplace substitution */
- if (regexec(spat->spat_regexp, s, strend, orig, 0,
- str->str_pok & SP_STUDIED ? str : Nullstr, safebase)) {
- ***************
- *** 181,186 ****
- --- 190,196 ----
- stack->ary_array[++sp] = arg->arg_ptr.arg_str;
- return sp;
- }
- + /*SUPPRESS 560*/
- else if (i = m - s) { /* faster from front */
- d -= clen;
- m = d;
- ***************
- *** 217,222 ****
- --- 227,233 ----
- if (iters++ > maxiters)
- fatal("Substitution loop");
- m = spat->spat_regexp->startp[0];
- + /*SUPPRESS 560*/
- if (i = m - s) {
- if (s != d)
- (void)bcopy(s,d,i);
- ***************
- *** 407,412 ****
- --- 418,424 ----
- register int len;
- int datumtype;
- STR *fromstr;
- + /*SUPPRESS 442*/
- static char *null10 = "\0\0\0\0\0\0\0\0\0\0";
- static char *space10 = " ";
-
- ***************
- *** 417,422 ****
- --- 429,438 ----
- unsigned int auint;
- long along;
- unsigned long aulong;
- + #ifdef QUAD
- + quad aquad;
- + unsigned quad auquad;
- + #endif
- char *aptr;
- float afloat;
- double adouble;
- ***************
- *** 431,439 ****
- len = index("@Xxu",datumtype) ? 0 : items;
- pat++;
- }
- ! else if (isdigit(*pat)) {
- len = *pat++ - '0';
- ! while (isdigit(*pat))
- len = (len * 10) + (*pat++ - '0');
- }
- else
- --- 447,455 ----
- len = index("@Xxu",datumtype) ? 0 : items;
- pat++;
- }
- ! else if (isDIGIT(*pat)) {
- len = *pat++ - '0';
- ! while (isDIGIT(*pat))
- len = (len * 10) + (*pat++ - '0');
- }
- else
- ***************
- *** 573,579 ****
- items = 0;
- if (datumtype == 'H') {
- for (len = 0; len++ < aint;) {
- ! if (isalpha(*pat))
- items |= ((*pat++ & 15) + 9) & 15;
- else
- items |= *pat++ & 15;
- --- 589,595 ----
- items = 0;
- if (datumtype == 'H') {
- for (len = 0; len++ < aint;) {
- ! if (isALPHA(*pat))
- items |= ((*pat++ & 15) + 9) & 15;
- else
- items |= *pat++ & 15;
- ***************
- *** 587,593 ****
- }
- else {
- for (len = 0; len++ < aint;) {
- ! if (isalpha(*pat))
- items |= (((*pat++ & 15) + 9) & 15) << 4;
- else
- items |= (*pat++ & 15) << 4;
- --- 603,609 ----
- }
- else {
- for (len = 0; len++ < aint;) {
- ! if (isALPHA(*pat))
- items |= (((*pat++ & 15) + 9) & 15) << 4;
- else
- items |= (*pat++ & 15) << 4;
- ***************
- *** 691,696 ****
- --- 707,728 ----
- str_ncat(str,(char*)&along,sizeof(long));
- }
- break;
- + #ifdef QUAD
- + case 'Q':
- + while (len-- > 0) {
- + fromstr = NEXTFROM;
- + auquad = (unsigned quad)str_gnum(fromstr);
- + str_ncat(str,(char*)&auquad,sizeof(unsigned quad));
- + }
- + break;
- + case 'q':
- + while (len-- > 0) {
- + fromstr = NEXTFROM;
- + aquad = (quad)str_gnum(fromstr);
- + str_ncat(str,(char*)&aquad,sizeof(quad));
- + }
- + break;
- + #endif /* QUAD */
- case 'p':
- while (len-- > 0) {
- fromstr = NEXTFROM;
- ***************
- *** 761,784 ****
- register char *t;
- register char *f;
- bool dolong;
- char ch;
- static STR *sargnull = &str_no;
- register char *send;
- char *xs;
- int xlen;
- double value;
- - char *origs;
-
- str_set(str,"");
- len--; /* don't count pattern string */
- ! origs = t = s = str_get(*sarg);
- send = s + (*sarg)->str_cur;
- sarg++;
- for ( ; ; len--) {
- ! if (len <= 0 || !*sarg) {
- ! sarg = &sargnull;
- ! len = 0;
- ! }
- for ( ; t < send && *t != '%'; t++) ;
- if (t >= send)
- break; /* end of format string, ignore extra args */
- --- 793,823 ----
- register char *t;
- register char *f;
- bool dolong;
- + #ifdef QUAD
- + bool doquad;
- + #endif /* QUAD */
- char ch;
- static STR *sargnull = &str_no;
- register char *send;
- + register STR *arg;
- char *xs;
- int xlen;
- + int pre;
- + int post;
- double value;
-
- str_set(str,"");
- len--; /* don't count pattern string */
- ! t = s = str_get(*sarg);
- send = s + (*sarg)->str_cur;
- sarg++;
- for ( ; ; len--) {
- !
- ! /*SUPPRESS 560*/
- ! if (len <= 0 || !(arg = *sarg++))
- ! arg = sargnull;
- !
- ! /*SUPPRESS 530*/
- for ( ; t < send && *t != '%'; t++) ;
- if (t >= send)
- break; /* end of format string, ignore extra args */
- ***************
- *** 785,791 ****
- --- 824,834 ----
- f = t;
- *buf = '\0';
- xs = buf;
- + #ifdef QUAD
- + doquad =
- + #endif /* QUAD */
- dolong = FALSE;
- + pre = post = 0;
- for (t++; t < send; t++) {
- switch (*t) {
- default:
- ***************
- *** 792,798 ****
- ch = *(++t);
- *t = '\0';
- (void)sprintf(xs,f);
- ! len++;
- xlen = strlen(xs);
- break;
- case '0': case '1': case '2': case '3': case '4':
- --- 835,841 ----
- ch = *(++t);
- *t = '\0';
- (void)sprintf(xs,f);
- ! len++, sarg--;
- xlen = strlen(xs);
- break;
- case '0': case '1': case '2': case '3': case '4':
- ***************
- *** 800,811 ****
- case '.': case '#': case '-': case '+': case ' ':
- continue;
- case 'l':
- dolong = TRUE;
- continue;
- case 'c':
- ch = *(++t);
- *t = '\0';
- ! xlen = (int)str_gnum(*(sarg++));
- if (strEQ(f,"%c")) { /* some printfs fail on null chars */
- *xs = xlen;
- xs[1] = '\0';
- --- 843,860 ----
- case '.': case '#': case '-': case '+': case ' ':
- continue;
- case 'l':
- + #ifdef QUAD
- + if (dolong) {
- + dolong = FALSE;
- + doquad = TRUE;
- + } else
- + #endif
- dolong = TRUE;
- continue;
- case 'c':
- ch = *(++t);
- *t = '\0';
- ! xlen = (int)str_gnum(arg);
- if (strEQ(f,"%c")) { /* some printfs fail on null chars */
- *xs = xlen;
- xs[1] = '\0';
- ***************
- *** 822,831 ****
- case 'd':
- ch = *(++t);
- *t = '\0';
- if (dolong)
- ! (void)sprintf(xs,f,(long)str_gnum(*(sarg++)));
- else
- ! (void)sprintf(xs,f,(int)str_gnum(*(sarg++)));
- xlen = strlen(xs);
- break;
- case 'X': case 'O':
- --- 871,885 ----
- case 'd':
- ch = *(++t);
- *t = '\0';
- + #ifdef QUAD
- + if (doquad)
- + (void)sprintf(buf,s,(quad)str_gnum(arg));
- + else
- + #endif
- if (dolong)
- ! (void)sprintf(xs,f,(long)str_gnum(arg));
- else
- ! (void)sprintf(xs,f,(int)str_gnum(arg));
- xlen = strlen(xs);
- break;
- case 'X': case 'O':
- ***************
- *** 834,840 ****
- case 'x': case 'o': case 'u':
- ch = *(++t);
- *t = '\0';
- ! value = str_gnum(*(sarg++));
- if (dolong)
- (void)sprintf(xs,f,U_L(value));
- else
- --- 888,899 ----
- case 'x': case 'o': case 'u':
- ch = *(++t);
- *t = '\0';
- ! value = str_gnum(arg);
- ! #ifdef QUAD
- ! if (doquad)
- ! (void)sprintf(buf,s,(unsigned quad)value);
- ! else
- ! #endif
- if (dolong)
- (void)sprintf(xs,f,U_L(value));
- else
- ***************
- *** 844,862 ****
- case 'E': case 'e': case 'f': case 'G': case 'g':
- ch = *(++t);
- *t = '\0';
- ! (void)sprintf(xs,f,str_gnum(*(sarg++)));
- xlen = strlen(xs);
- break;
- case 's':
- ch = *(++t);
- *t = '\0';
- ! xs = str_get(*sarg);
- ! xlen = (*sarg)->str_cur;
- if (*xs == 'S' && xs[1] == 't' && xs[2] == 'B' && xs[3] == '\0'
- && xlen == sizeof(STBP)) {
- STR *tmpstr = Str_new(24,0);
-
- ! stab_fullname(tmpstr, ((STAB*)(*sarg))); /* a stab value! */
- sprintf(tokenbuf,"*%s",tmpstr->str_ptr);
- /* reformat to non-binary */
- xs = tokenbuf;
- --- 903,921 ----
- case 'E': case 'e': case 'f': case 'G': case 'g':
- ch = *(++t);
- *t = '\0';
- ! (void)sprintf(xs,f,str_gnum(arg));
- xlen = strlen(xs);
- break;
- case 's':
- ch = *(++t);
- *t = '\0';
- ! xs = str_get(arg);
- ! xlen = arg->str_cur;
- if (*xs == 'S' && xs[1] == 't' && xs[2] == 'B' && xs[3] == '\0'
- && xlen == sizeof(STBP)) {
- STR *tmpstr = Str_new(24,0);
-
- ! stab_fullname(tmpstr, ((STAB*)arg)); /* a stab value! */
- sprintf(tokenbuf,"*%s",tmpstr->str_ptr);
- /* reformat to non-binary */
- xs = tokenbuf;
- ***************
- *** 863,872 ****
- xlen = strlen(tokenbuf);
- str_free(tmpstr);
- }
- - sarg++;
- if (strEQ(f,"%s")) { /* some printfs fail on >128 chars */
- ! break; /* so handle simple case */
- }
- strcpy(tokenbuf+64,f); /* sprintf($s,...$s...) */
- *t = ch;
- (void)sprintf(buf,tokenbuf+64,xs);
- --- 922,958 ----
- xlen = strlen(tokenbuf);
- str_free(tmpstr);
- }
- if (strEQ(f,"%s")) { /* some printfs fail on >128 chars */
- ! break; /* so handle simple cases */
- }
- + else if (f[1] == '-') {
- + char *mp = index(f, '.');
- + int min = atoi(f+2);
- +
- + if (xlen < min)
- + post = min - xlen;
- + else if (mp) {
- + int max = atoi(mp+1);
- +
- + if (xlen > max)
- + xlen = max;
- + }
- + break;
- + }
- + else if (isDIGIT(f[1])) {
- + char *mp = index(f, '.');
- + int min = atoi(f+1);
- +
- + if (xlen < min)
- + pre = min - xlen;
- + else if (mp) {
- + int max = atoi(mp+1);
- +
- + if (xlen > max)
- + xlen = max;
- + }
- + break;
- + }
- strcpy(tokenbuf+64,f); /* sprintf($s,...$s...) */
- *t = ch;
- (void)sprintf(buf,tokenbuf+64,xs);
- ***************
- *** 876,884 ****
- }
- /* end of switch, copy results */
- *t = ch;
- ! STR_GROW(str, str->str_cur + (f - s) + len + 1);
- str_ncat(str, s, f - s);
- str_ncat(str, xs, xlen);
- s = t;
- break; /* break from for loop */
- }
- --- 962,978 ----
- }
- /* end of switch, copy results */
- *t = ch;
- ! STR_GROW(str, str->str_cur + (f - s) + xlen + 1 + pre + post);
- str_ncat(str, s, f - s);
- + if (pre) {
- + repeatcpy(str->str_ptr + str->str_cur, " ", 1, pre);
- + str->str_cur += pre;
- + }
- str_ncat(str, xs, xlen);
- + if (post) {
- + repeatcpy(str->str_ptr + str->str_cur, " ", 1, post);
- + str->str_cur += post;
- + }
- s = t;
- break; /* break from for loop */
- }
- ***************
- *** 946,952 ****
- if ((arg[1].arg_type & A_MASK) == A_WORD)
- stab = arg[1].arg_ptr.arg_stab;
- else {
- ! STR *tmpstr = stab_val(arg[1].arg_ptr.arg_stab);
-
- if (tmpstr)
- stab = stabent(str_get(tmpstr),TRUE);
- --- 1040,1046 ----
- if ((arg[1].arg_type & A_MASK) == A_WORD)
- stab = arg[1].arg_ptr.arg_stab;
- else {
- ! STR *tmpstr = STAB_STR(arg[1].arg_ptr.arg_stab);
-
- if (tmpstr)
- stab = stabent(str_get(tmpstr),TRUE);
- ***************
- *** 1034,1040 ****
- HASH *hash;
- int i;
-
- ! makelocal = (arg->arg_flags & AF_LOCAL);
- localizing = makelocal;
- delaymagic = DM_DELAY; /* catch simultaneous items */
-
- --- 1128,1134 ----
- HASH *hash;
- int i;
-
- ! makelocal = (arg->arg_flags & AF_LOCAL) != 0;
- localizing = makelocal;
- delaymagic = DM_DELAY; /* catch simultaneous items */
-
- ***************
- *** 1044,1049 ****
- --- 1138,1144 ----
- */
- if (arg->arg_flags & AF_COMMON) {
- for (relem = firstrelem; relem <= lastrelem; relem++) {
- + /*SUPPRESS 560*/
- if (str = *relem)
- *relem = str_mortal(str);
- }
- ***************
- *** 1179,1185 ****
- }
- }
-
- ! int
- do_study(str,arg,gimme,arglast)
- STR *str;
- ARG *arg;
- --- 1274,1280 ----
- }
- }
-
- ! int /*SUPPRESS 590*/
- do_study(str,arg,gimme,arglast)
- STR *str;
- ARG *arg;
- ***************
- *** 1254,1260 ****
- return retarg;
- }
-
- ! int
- do_defined(str,arg,gimme,arglast)
- STR *str;
- register ARG *arg;
- --- 1349,1355 ----
- return retarg;
- }
-
- ! int /*SUPPRESS 590*/
- do_defined(str,arg,gimme,arglast)
- STR *str;
- register ARG *arg;
- ***************
- *** 1272,1279 ****
- arg = arg[1].arg_ptr.arg_arg;
- type = arg->arg_type;
-
- ! if (type == O_SUBR || type == O_DBSUBR)
- ! retval = stab_sub(arg[1].arg_ptr.arg_stab) != 0;
- else if (type == O_ARRAY || type == O_LARRAY ||
- type == O_ASLICE || type == O_LASLICE )
- retval = ((ary = stab_xarray(arg[1].arg_ptr.arg_stab)) != 0
- --- 1367,1381 ----
- arg = arg[1].arg_ptr.arg_arg;
- type = arg->arg_type;
-
- ! if (type == O_SUBR || type == O_DBSUBR) {
- ! if ((arg[1].arg_type & A_MASK) == A_WORD)
- ! retval = stab_sub(arg[1].arg_ptr.arg_stab) != 0;
- ! else {
- ! STR *tmpstr = STAB_STR(arg[1].arg_ptr.arg_stab);
- !
- ! retval = tmpstr && stab_sub(stabent(str_get(tmpstr),TRUE)) != 0;
- ! }
- ! }
- else if (type == O_ARRAY || type == O_LARRAY ||
- type == O_ASLICE || type == O_LASLICE )
- retval = ((ary = stab_xarray(arg[1].arg_ptr.arg_stab)) != 0
- ***************
- *** 1289,1295 ****
- return retarg;
- }
-
- ! int
- do_undef(str,arg,gimme,arglast)
- STR *str;
- register ARG *arg;
- --- 1391,1397 ----
- return retarg;
- }
-
- ! int /*SUPPRESS 590*/
- do_undef(str,arg,gimme,arglast)
- STR *str;
- register ARG *arg;
- ***************
- *** 1325,1331 ****
- }
- else if (type == O_SUBR || type == O_DBSUBR) {
- stab = arg[1].arg_ptr.arg_stab;
- ! if (stab_sub(stab)) {
- cmd_free(stab_sub(stab)->cmd);
- stab_sub(stab)->cmd = Nullcmd;
- afree(stab_sub(stab)->tosave);
- --- 1427,1441 ----
- }
- else if (type == O_SUBR || type == O_DBSUBR) {
- stab = arg[1].arg_ptr.arg_stab;
- ! if ((arg[1].arg_type & A_MASK) != A_WORD) {
- ! STR *tmpstr = STAB_STR(arg[1].arg_ptr.arg_stab);
- !
- ! if (tmpstr)
- ! stab = stabent(str_get(tmpstr),TRUE);
- ! else
- ! stab = Nullstab;
- ! }
- ! if (stab && stab_sub(stab)) {
- cmd_free(stab_sub(stab)->cmd);
- stab_sub(stab)->cmd = Nullcmd;
- afree(stab_sub(stab)->tosave);
- ***************
- *** 1376,1384 ****
- if (size == 8)
- retnum = s[offset];
- else if (size == 16)
- ! retnum = (s[offset] << 8) + s[offset+1];
- else if (size == 32)
- ! retnum = (s[offset] << 24) + (s[offset + 1] << 16) +
- (s[offset + 2] << 8) + s[offset+3];
- }
-
- --- 1486,1495 ----
- if (size == 8)
- retnum = s[offset];
- else if (size == 16)
- ! retnum = ((unsigned long) s[offset] << 8) + s[offset+1];
- else if (size == 32)
- ! retnum = ((unsigned long) s[offset] << 24) +
- ! ((unsigned long) s[offset + 1] << 16) +
- (s[offset + 2] << 8) + s[offset+3];
- }
-
- ***************
- *** 1458,1463 ****
- --- 1569,1575 ----
- if (str->str_state == SS_HASH) {
- hash = stab_hash(str->str_u.str_stab);
- (void)hiterinit(hash);
- + /*SUPPRESS 560*/
- while (entry = hiternext(hash))
- do_chop(astr,hiterval(hash,entry));
- return;
-
- *** End of Patch 13 ***
- 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.
-