zap trailing whitespace and tabs
This commit is contained in:
parent
8b897ac235
commit
2990d002be
@ -549,7 +549,7 @@ slot_mix_badd(struct slot *s, adata_t *odata)
|
||||
|
||||
odone = 0;
|
||||
otodo = dev_round;
|
||||
if (s->skip > 0) {
|
||||
if (s->skip > 0) {
|
||||
ocnt = otodo;
|
||||
if (ocnt > s->skip)
|
||||
ocnt = s->skip;
|
||||
|
@ -626,7 +626,7 @@ int input(void) /* get next lexical input character */
|
||||
|
||||
void unput(int c) /* put lexical character back on input */
|
||||
{
|
||||
if (c == '\n')
|
||||
if (c == '\n')
|
||||
lineno--;
|
||||
if (yysptr >= yysbuf + sizeof(yysbuf))
|
||||
FATAL("pushed back too much: %.20s...", yysbuf);
|
||||
|
@ -2292,7 +2292,7 @@ Cell *gensub(Node **a, int nnn) /* global selective substitute */
|
||||
FATAL("gensub doesn't support backreferences (subst \"%s\")", rptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
if (whichm >= 0 && whichm != num) {
|
||||
num++;
|
||||
|
@ -5,17 +5,17 @@
|
||||
* Changes for banner(1)
|
||||
*
|
||||
* @(#)Copyright (c) 1995, Simon J. Gerraty.
|
||||
*
|
||||
*
|
||||
* This is free software. It comes with NO WARRANTY.
|
||||
* Permission to use, modify and distribute this source code
|
||||
* Permission to use, modify and distribute this source code
|
||||
* is granted subject to the following conditions.
|
||||
* 1/ that the above copyright notice and this notice
|
||||
* are preserved in all copies and that due credit be given
|
||||
* to the author.
|
||||
* 2/ that any changes to this code are clearly commented
|
||||
* as such so that the author does not get blamed for bugs
|
||||
* 1/ that the above copyright notice and this notice
|
||||
* are preserved in all copies and that due credit be given
|
||||
* to the author.
|
||||
* 2/ that any changes to this code are clearly commented
|
||||
* as such so that the author does not get blamed for bugs
|
||||
* other than his own.
|
||||
*
|
||||
*
|
||||
* Please send copies of changes and bug-fixes to:
|
||||
* sjg@zen.void.oz.au
|
||||
*/
|
||||
@ -72,7 +72,7 @@ scnline(int key, char *p, int c)
|
||||
* banner(1) does is more consistent.
|
||||
*/
|
||||
c = '#';
|
||||
|
||||
|
||||
for (scnwidth = WIDTH; --scnwidth;) {
|
||||
key <<= 1;
|
||||
*p++ = key & 0200 ? c : BACKGND;
|
||||
@ -135,7 +135,7 @@ scan_out(int scfd, char *scsp, int dlm)
|
||||
while (*--strp == BACKGND && strp >= outbuf)
|
||||
;
|
||||
strp++;
|
||||
*strp++ = '\n';
|
||||
*strp++ = '\n';
|
||||
(void) write(scfd, outbuf, strp-outbuf);
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char word[10+1]; /* strings limited to 10 chars */
|
||||
|
||||
|
||||
if (pledge("stdio", NULL) == -1)
|
||||
err(1, "pledge");
|
||||
|
||||
|
@ -3,19 +3,19 @@
|
||||
|
||||
/*
|
||||
* Various defines needed for code lifted from lpd.
|
||||
*
|
||||
*
|
||||
* @(#)Copyright (c) 1995, Simon J. Gerraty.
|
||||
*
|
||||
*
|
||||
* This is free software. It comes with NO WARRANTY.
|
||||
* Permission to use, modify and distribute this source code
|
||||
* Permission to use, modify and distribute this source code
|
||||
* is granted subject to the following conditions.
|
||||
* 1/ that the above copyright notice and this notice
|
||||
* are preserved in all copies and that due credit be given
|
||||
* to the author.
|
||||
* 2/ that any changes to this code are clearly commented
|
||||
* as such so that the author does not get blamed for bugs
|
||||
* 1/ that the above copyright notice and this notice
|
||||
* are preserved in all copies and that due credit be given
|
||||
* to the author.
|
||||
* 2/ that any changes to this code are clearly commented
|
||||
* as such so that the author does not get blamed for bugs
|
||||
* other than his own.
|
||||
*
|
||||
*
|
||||
* Please send copies of changes and bug-fixes to:
|
||||
* sjg@zen.void.oz.au
|
||||
*/
|
||||
|
@ -4,17 +4,17 @@
|
||||
/*
|
||||
* Changes for banner(1)
|
||||
* @(#)Copyright (c) 1995, Simon J. Gerraty.
|
||||
*
|
||||
*
|
||||
* This is free software. It comes with NO WARRANTY.
|
||||
* Permission to use, modify and distribute this source code
|
||||
* Permission to use, modify and distribute this source code
|
||||
* is granted subject to the following conditions.
|
||||
* 1/ that the above copyright notice and this notice
|
||||
* are preserved in all copies and that due credit be given
|
||||
* to the author.
|
||||
* 2/ that any changes to this code are clearly commented
|
||||
* as such so that the author does not get blamed for bugs
|
||||
* 1/ that the above copyright notice and this notice
|
||||
* are preserved in all copies and that due credit be given
|
||||
* to the author.
|
||||
* 2/ that any changes to this code are clearly commented
|
||||
* as such so that the author does not get blamed for bugs
|
||||
* other than his own.
|
||||
*
|
||||
*
|
||||
* Please send copies of changes and bug-fixes to:
|
||||
* sjg@zen.void.oz.au
|
||||
*/
|
||||
@ -187,7 +187,7 @@
|
||||
char scnkey[][HEIGHT] = /* this is relatively easy to modify */
|
||||
/* just look: */
|
||||
{
|
||||
|
||||
|
||||
/* <sjg> this is the real banner char set */
|
||||
{
|
||||
c_______,
|
||||
|
@ -52,7 +52,7 @@ tstpcont(int sig)
|
||||
if (sig == SIGTSTP) {
|
||||
signal(SIGCONT, tstpcont);
|
||||
gettty(&ttyedit);
|
||||
settty(&ttysaved);
|
||||
settty(&ttysaved);
|
||||
} else {
|
||||
signal(SIGTSTP, tstpcont);
|
||||
settty(&ttyedit);
|
||||
|
@ -248,7 +248,7 @@ week(int day, int month, int year)
|
||||
int firstday;
|
||||
int firstsunday;
|
||||
int shift;
|
||||
|
||||
|
||||
if (mflag)
|
||||
return isoweek(day, month, year);
|
||||
|
||||
@ -261,7 +261,7 @@ week(int day, int month, int year)
|
||||
shift = 1;
|
||||
if (yearday < firstsunday)
|
||||
return (1);
|
||||
if (firstweekday > THURSDAY - 1)
|
||||
if (firstweekday > THURSDAY - 1)
|
||||
shift = 2;
|
||||
return ((((yearday + 1) - (weekday - 1)) / 7) + shift);
|
||||
}
|
||||
@ -291,7 +291,7 @@ isoweek(int day, int month, int year)
|
||||
return 53 - (g - s) / 5;
|
||||
else if (n > 364 + s)
|
||||
return 1;
|
||||
else
|
||||
else
|
||||
return n/7 + 1;
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ yearly(int year)
|
||||
for (row = 0; row < 6; row++) {
|
||||
for (which_cal = 0; which_cal < 3; which_cal++) {
|
||||
p = lineout + which_cal * (week_len + 2);
|
||||
|
||||
|
||||
dp = &days[month + which_cal][row * 7];
|
||||
firstday = SPACE;
|
||||
for (col = 0; col < 7; col++, p += DAY_LEN) {
|
||||
|
@ -24,7 +24,7 @@
|
||||
04/17 An unexpected party (LOTR)
|
||||
04/23 Crowning of King Ellesar (LOTR)
|
||||
05/19 Arwen leaves Lorien to wed King Ellesar (LOTR)
|
||||
05/25 Towel Day (The Hitchhiker's Guide to the Galaxy)
|
||||
05/25 Towel Day (The Hitchhiker's Guide to the Galaxy)
|
||||
06/11 Sauron attacks Osgilliath (LOTR)
|
||||
06/13 Bilbo returns to Bag End (LOTR)
|
||||
06/23 Wedding of Ellesar & Arwen (LOTR)
|
||||
|
@ -450,7 +450,7 @@
|
||||
11/21 Birmingham Pub Bombings by the IRA kill 21 people, 1974
|
||||
11/22 John F. Kennedy is assassinated in Dallas, Texas, 1963
|
||||
11/23 The first edition of Life is published. 1936
|
||||
11/24 Alleged assassin Lee Harvey Oswald is killed by
|
||||
11/24 Alleged assassin Lee Harvey Oswald is killed by
|
||||
Jack Ruby in Dallas, Texas, 1963
|
||||
11/25 Alfred Nobel invents dynamite, 1867
|
||||
11/26 Last flight ever with a Concorde made over Bristol, UK, 2003
|
||||
|
@ -333,7 +333,7 @@
|
||||
08/12 Maurice Greene is born in London, 1696
|
||||
08/12 Leos Janacek dies in Ostrava, Czechoslovakia, 1928
|
||||
08/13 Dan Fogelberg is born in Peoria, Illinois, 1951
|
||||
08/13 The Bayreuth Festspielhaus opens with the first complete
|
||||
08/13 The Bayreuth Festspielhaus opens with the first complete
|
||||
performance of Wagner's "Ring Cycle", 1876
|
||||
08/13 John Ireland is born, 1879
|
||||
08/13 Jules Emile Frederic Massenet dies, 1912
|
||||
@ -520,7 +520,7 @@
|
||||
12/18 Horatio Parker dies in Cedarhurst, New York, 1919
|
||||
12/21 Frank Zappa is born in Baltimore, 1940
|
||||
12/21 Silvestre Revueltas born in Santiago Papasquiaro, Durango, Mexico, 1899
|
||||
12/22 Beethoven's Symphony No. 5 and Symphony No. 6 premier, under
|
||||
12/22 Beethoven's Symphony No. 5 and Symphony No. 6 premier, under
|
||||
rehearsed, at Theater an der Wien in Vienna, Austria, 1808
|
||||
12/22 Edgard Varese is born in France, 1883
|
||||
12/22 Jean-Joseph Mouret dies in Charenton, France, 1738
|
||||
|
@ -30,7 +30,7 @@ Easter+39 Christi Himmelfahrt
|
||||
03/21* Frühlingsanfang
|
||||
06/21* Sommeranfang
|
||||
09/21* Herbstanfang
|
||||
12/21* Winteranfang
|
||||
12/21* Winteranfang
|
||||
|
||||
/* Sommer- und Winterzeit */
|
||||
03/SundayLast Anfang der Sommerzeit
|
||||
|
@ -12,8 +12,8 @@ LANG=hr_HR.UTF-8
|
||||
/* slobodni državni praznici */
|
||||
01/01 Nova godina
|
||||
05/01 Prvi maj
|
||||
|
||||
|
||||
|
||||
|
||||
/* slobodni kršćanski praznici */
|
||||
Easter-2 Veliki petak
|
||||
Easter Uskrs
|
||||
@ -29,7 +29,7 @@ Easter+39 Uzašašće
|
||||
06/21* Početak ljeta
|
||||
09/21* Početak jesena
|
||||
12/21* Početak zime
|
||||
|
||||
|
||||
/* ljetno vrijeme */
|
||||
03/SundayLast Početak ljetnog vremena
|
||||
10/SundayLast Kraj ljetnog vremena
|
||||
|
@ -219,7 +219,7 @@ CALENDAR=julian
|
||||
на овес с ячменем. Пронеси, Господи, Калиника мороком, а не морозом.
|
||||
07/30 Силин день. На Силы и Селуяна рожь бывает пьяна (т.е. полна зерном
|
||||
и клонится к земле). На Силу рожь посеянная родится сильно, а
|
||||
ведьмы обмирают, опившись молока.
|
||||
ведьмы обмирают, опившись молока.
|
||||
|
||||
08/01 Первый, мокрый, медовый Спас. Пчелиный праздник. На Маковея собирают
|
||||
мак. Дождь на Маковея - мало пожаров. Во что Маковея, в то и
|
||||
|
@ -38,7 +38,7 @@ struct track_info {
|
||||
char *file;
|
||||
SLIST_ENTRY(track_info) track_list;
|
||||
char type;
|
||||
int speed;
|
||||
int speed;
|
||||
};
|
||||
SLIST_HEAD(track_head, track_info);
|
||||
extern struct track_head tracks;
|
||||
|
@ -133,7 +133,7 @@ main(int argc, char *argv[])
|
||||
max_bufd_lines = strtonum(optarg, 1,
|
||||
(INT_MAX - BUFFER_MARGIN) / 2, &errstr) * 2;
|
||||
if (errstr != NULL)
|
||||
errx(1, "bad -l argument, %s: %s", errstr,
|
||||
errx(1, "bad -l argument, %s: %s", errstr,
|
||||
optarg);
|
||||
break;
|
||||
case 'x': /* do not compress spaces into tabs */
|
||||
|
@ -113,7 +113,7 @@ main(int argc, char *argv[])
|
||||
putchar('\b');
|
||||
if (width > 1 && p[1] == '\b')
|
||||
putchar('\b');
|
||||
}
|
||||
}
|
||||
if (width > 1 && p[1] == '\b')
|
||||
p++;
|
||||
column -= width;
|
||||
|
@ -83,4 +83,4 @@ extern int null_write(void *, const char *, int);
|
||||
extern int null_close(void *, struct z_info *, const char *, struct stat *);
|
||||
extern int null_flush(void *, int);
|
||||
|
||||
extern void setfile(const char *, int, struct stat *);
|
||||
extern void setfile(const char *, int, struct stat *);
|
||||
|
@ -463,5 +463,5 @@ do_lineno(const char *expr)
|
||||
if (reps-- == 0)
|
||||
break;
|
||||
lastline += tgtline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ endtok: if (sp > tok) {
|
||||
/* hell... truncate it */
|
||||
if (sp == tok + sizeof tok - 1)
|
||||
*sp = EOS;
|
||||
else
|
||||
else
|
||||
*sp++ = c;
|
||||
token = YES;
|
||||
}
|
||||
@ -385,7 +385,7 @@ hash_entry(void)
|
||||
/* hell... truncate it */
|
||||
if (sp == tok + sizeof tok - 1)
|
||||
*sp = EOS;
|
||||
else
|
||||
else
|
||||
*sp++ = c;
|
||||
}
|
||||
*sp = EOS;
|
||||
@ -401,7 +401,7 @@ hash_entry(void)
|
||||
/* hell... truncate it */
|
||||
if (sp == tok + sizeof tok - 1)
|
||||
*sp = EOS;
|
||||
else
|
||||
else
|
||||
*sp++ = c;
|
||||
if (GETC(==, EOF))
|
||||
return;
|
||||
@ -446,7 +446,7 @@ str_entry(int c)
|
||||
/* hell... truncate it */
|
||||
if (sp == tok + sizeof tok - 1)
|
||||
*sp = EOS;
|
||||
else
|
||||
else
|
||||
*sp++ = c;
|
||||
if (GETC(==, EOF))
|
||||
return (NO);
|
||||
|
@ -837,7 +837,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
struct msghdr msghdr;
|
||||
char m[RECVCMSGBUFLEN];
|
||||
} cmsgbuf;
|
||||
|
||||
|
||||
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
|
||||
|
||||
build_msghdr_recv(sock, cmsgbuf.m, dev, &msghdr, iov, &read_count);
|
||||
@ -997,7 +997,7 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
struct msghdr msghdr;
|
||||
char m[SENDCMSGBUFLEN];
|
||||
} cmsgbuf;
|
||||
|
||||
|
||||
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
|
||||
|
||||
build_msghdr_send(sock, cmsgbuf.m, dev, &msghdr, iov, &write_count);
|
||||
|
@ -166,7 +166,7 @@ main(int argc, char *argv[])
|
||||
case FTS_D: /* Ignore. */
|
||||
break;
|
||||
case FTS_DP:
|
||||
p->fts_parent->fts_number +=
|
||||
p->fts_parent->fts_number +=
|
||||
p->fts_number += p->fts_statp->st_blocks;
|
||||
if (cflag)
|
||||
totalblocks += p->fts_statp->st_blocks;
|
||||
|
@ -61,7 +61,7 @@ struct macro {
|
||||
};
|
||||
|
||||
/*
|
||||
* FCode header -- assumes big-endian machine,
|
||||
* FCode header -- assumes big-endian machine,
|
||||
* otherwise the bits need twiddling.
|
||||
*/
|
||||
struct fcode_header {
|
||||
@ -72,21 +72,21 @@ struct fcode_header {
|
||||
};
|
||||
|
||||
/* Tokenizer tokens */
|
||||
enum toktypes {
|
||||
enum toktypes {
|
||||
TOK_OCTAL = 8,
|
||||
TOK_DECIMAL = 10,
|
||||
TOK_HEX = 16,
|
||||
|
||||
TOK_NUMBER,
|
||||
TOK_STRING_LIT,
|
||||
TOK_NUMBER,
|
||||
TOK_STRING_LIT,
|
||||
TOK_C_LIT,
|
||||
TOK_PSTRING,
|
||||
TOK_PSTRING,
|
||||
TOK_TOKENIZE,
|
||||
TOK_COMMENT,
|
||||
TOK_COLON,
|
||||
TOK_SEMICOLON,
|
||||
TOK_COMMENT,
|
||||
TOK_COLON,
|
||||
TOK_SEMICOLON,
|
||||
TOK_TOSTRING,
|
||||
|
||||
|
||||
/* These are special */
|
||||
TOK_ABORT_S,
|
||||
TOK_AGAIN,
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* $OpenBSD: fgen.l,v 1.15 2022/12/26 19:16:00 jmc Exp $ */
|
||||
/* $NetBSD: fgen.l,v 1.37 2016/03/08 20:13:44 christos Exp $ */
|
||||
/* FLEX input for FORTH input file scanner */
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 1998 Eduardo Horvath.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -72,7 +72,7 @@ static struct fcode *dictionary = NULL;
|
||||
static struct macro *aliases = NULL;
|
||||
static int outf = 1; /* stdout */
|
||||
static int state = 0;
|
||||
static int nextfcode = 0x800;
|
||||
static int nextfcode = 0x800;
|
||||
static int numbase = TOK_HEX;
|
||||
static long outpos;
|
||||
static char *outbuf = NULL;
|
||||
@ -152,16 +152,16 @@ erealloc(void *p, size_t sz)
|
||||
|
||||
\'.\' { ltoken.type = TOK_C_LIT; ltoken.text = yytext; return <oken; }
|
||||
|
||||
\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_STRING_LIT; ltoken.text = yytext;
|
||||
\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_STRING_LIT; ltoken.text = yytext;
|
||||
return <oken; } /* String started by `"' or `."' */
|
||||
|
||||
\.\({white}*(\\\"|[^)])*\) { ltoken.type = TOK_PSTRING; ltoken.text = yytext;
|
||||
\.\({white}*(\\\"|[^)])*\) { ltoken.type = TOK_PSTRING; ltoken.text = yytext;
|
||||
return <oken; } /* String of type `.(.....)' */
|
||||
|
||||
\.\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_PSTRING; ltoken.text = yytext;
|
||||
\.\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_PSTRING; ltoken.text = yytext;
|
||||
return <oken; }
|
||||
|
||||
[aA][bB][oO][rR][tT]\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_ABORT_S;
|
||||
[aA][bB][oO][rR][tT]\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_ABORT_S;
|
||||
ltoken.text = yytext; return <oken; }
|
||||
|
||||
"(" { ltoken.type = TOK_COMMENT; ltoken.text = yytext;
|
||||
@ -233,7 +233,7 @@ erealloc(void *p, size_t sz)
|
||||
[eE][xX][tT][eE][rR][nN][aA][lL] { ltoken.type = TOK_EXTERNAL; ltoken.text = yytext;
|
||||
return <oken; }
|
||||
|
||||
[fF][cC][oO][dD][eE]-[vV][eE][rR][sS][iI][oO][nN]2 {
|
||||
[fF][cC][oO][dD][eE]-[vV][eE][rR][sS][iI][oO][nN]2 {
|
||||
ltoken.type = TOK_FCODE_VERSION2; ltoken.text = yytext;
|
||||
return <oken; }
|
||||
|
||||
@ -281,7 +281,7 @@ erealloc(void *p, size_t sz)
|
||||
|
||||
[sS][tT][aA][rR][tT][0124] { ltoken.type = TOK_STARTX; ltoken.text = yytext;
|
||||
return <oken; }
|
||||
|
||||
|
||||
[tT][hH][eE][nN] { ltoken.type = TOK_THEN; ltoken.text = yytext;
|
||||
return <oken; }
|
||||
|
||||
@ -778,7 +778,7 @@ cvt(const char *s, char **e, int base)
|
||||
for (c = *s; (c = *s); s++) {
|
||||
|
||||
/* Ignore `.' */
|
||||
if (c == '.')
|
||||
if (c == '.')
|
||||
continue;
|
||||
if (c >= '0' && c <= '9')
|
||||
c -= '0';
|
||||
@ -838,9 +838,9 @@ fadd(struct fcode *dict, struct fcode *new)
|
||||
new->type = FCODE;
|
||||
ASSERT(dict->type == FCODE);
|
||||
if (!res) {
|
||||
/*
|
||||
/*
|
||||
* Duplicate entry. Give the old name the new FCode
|
||||
* number.
|
||||
* number.
|
||||
*/
|
||||
dict->num = new->num;
|
||||
return (0);
|
||||
@ -850,7 +850,7 @@ fadd(struct fcode *dict, struct fcode *new)
|
||||
return fadd(dict->l, new);
|
||||
else {
|
||||
if (debug > 5)
|
||||
printf("fadd: new FCode `%s' is %lx\n",
|
||||
printf("fadd: new FCode `%s' is %lx\n",
|
||||
new->name, new->num);
|
||||
new->l = new->r = NULL;
|
||||
dict->l = new;
|
||||
@ -860,7 +860,7 @@ fadd(struct fcode *dict, struct fcode *new)
|
||||
return fadd(dict->r, new);
|
||||
else {
|
||||
if (debug > 5)
|
||||
printf("fadd: new FCode `%s' is %lx\n",
|
||||
printf("fadd: new FCode `%s' is %lx\n",
|
||||
new->name, new->num);
|
||||
new->l = new->r = NULL;
|
||||
dict->r = new;
|
||||
@ -881,12 +881,12 @@ flookup(struct fcode *dict, const char *str)
|
||||
res = strcmp(dict->name, str);
|
||||
ASSERT(dict->type == FCODE);
|
||||
if (debug > 5)
|
||||
printf("flookup: `%s' and `%s' %s match\n",
|
||||
printf("flookup: `%s' and `%s' %s match\n",
|
||||
str, dict->name, res?"don't":"do");
|
||||
if (!res) return (dict);
|
||||
if (res < 0)
|
||||
return (flookup(dict->l, str));
|
||||
else
|
||||
else
|
||||
return (flookup(dict->r, str));
|
||||
|
||||
}
|
||||
@ -914,7 +914,7 @@ aadd(struct macro *dict, struct macro *new)
|
||||
new->l = new->r = NULL;
|
||||
dict->l = new;
|
||||
if (debug > 5)
|
||||
printf("aadd: new alias `%s' to `%s'\n",
|
||||
printf("aadd: new alias `%s' to `%s'\n",
|
||||
new->name, new->equiv);
|
||||
}
|
||||
} else {
|
||||
@ -924,7 +924,7 @@ aadd(struct macro *dict, struct macro *new)
|
||||
new->l = new->r = NULL;
|
||||
dict->r = new;
|
||||
if (debug > 5)
|
||||
printf("aadd: new alias `%s' to `%s'\n",
|
||||
printf("aadd: new alias `%s' to `%s'\n",
|
||||
new->name, new->equiv);
|
||||
}
|
||||
}
|
||||
@ -945,7 +945,7 @@ alookup(struct macro *dict, const char *str)
|
||||
if (!res) return (dict);
|
||||
if (res < 0)
|
||||
return (alookup(dict->l, str));
|
||||
else
|
||||
else
|
||||
return (alookup(dict->r, str));
|
||||
|
||||
}
|
||||
@ -989,11 +989,11 @@ static int
|
||||
apply_macros(YY_BUFFER_STATE yinput, const char *str)
|
||||
{
|
||||
struct macro *xform = alookup(aliases, str);
|
||||
|
||||
|
||||
if (xform) {
|
||||
YY_BUFFER_STATE newbuf;
|
||||
|
||||
if (debug > 1)
|
||||
if (debug > 1)
|
||||
printf("Expanding %s to %s\n", str, xform->equiv);
|
||||
|
||||
newbuf = yy_scan_string(xform->equiv);
|
||||
@ -1039,10 +1039,10 @@ main(int argc, char *argv[])
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
|
||||
if (argc != 1)
|
||||
usage();
|
||||
|
||||
|
||||
infile = argv[0];
|
||||
|
||||
/*
|
||||
@ -1056,7 +1056,7 @@ main(int argc, char *argv[])
|
||||
emit(hdrtype);
|
||||
outpos = sizeof(*fheader);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Do it.
|
||||
*/
|
||||
if ((inf = fopen(infile, "r")) == NULL)
|
||||
@ -1109,10 +1109,10 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
switch (token->type) {
|
||||
case TOK_NUMBER:
|
||||
STATE(token->text, "TOK_NUMBER");
|
||||
{
|
||||
{
|
||||
char *end;
|
||||
Cell value;
|
||||
|
||||
|
||||
if (tokenizer) {
|
||||
push(strtol(token->text, &end, 16));
|
||||
break;
|
||||
@ -1122,7 +1122,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
token_err(yylineno, infile, yytext,
|
||||
"illegal number conversion");
|
||||
|
||||
/*
|
||||
/*
|
||||
* If this is a 64-bit value we need to store two literals
|
||||
* and issue a `lxjoin' to combine them. But that's a future
|
||||
* project.
|
||||
@ -1132,7 +1132,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
spit((value>>16)&0x0ff);
|
||||
spit((value>>8)&0x0ff);
|
||||
spit(value&0x0ff);
|
||||
if ((value>>32) != value && (value>>32) != 0 &&
|
||||
if ((value>>32) != value && (value>>32) != 0 &&
|
||||
(value>>32) != -1) {
|
||||
emit("b(lit)");
|
||||
spit((value>>56)&0x0ff);
|
||||
@ -1151,12 +1151,12 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
spit(0);
|
||||
spit(token->text[1]);
|
||||
break;
|
||||
case TOK_STRING_LIT:
|
||||
case TOK_STRING_LIT:
|
||||
STATE(token->text, "TOK_STRING_LIT:");
|
||||
{
|
||||
size_t len;
|
||||
char *p = token->text;
|
||||
|
||||
|
||||
++p; /* Skip the quote */
|
||||
len = strlen(++p); /* Skip the 1st space */
|
||||
|
||||
@ -1174,7 +1174,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
sspit(p);
|
||||
}
|
||||
break;
|
||||
case TOK_PSTRING:
|
||||
case TOK_PSTRING:
|
||||
STATE(token->text, "TOK_PSTRING:");
|
||||
{
|
||||
size_t len;
|
||||
@ -1239,21 +1239,21 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
/* The next pass should tokenize the FCODE number */
|
||||
emit("b(')");
|
||||
break;
|
||||
case TOK_COMMENT:
|
||||
case TOK_COMMENT:
|
||||
STATE(token->text, "TOK_COMMENT:");
|
||||
do {
|
||||
off = input();
|
||||
} while ((off != ')') && (off != '\n') &&
|
||||
} while ((off != ')') && (off != '\n') &&
|
||||
(off != EOF));
|
||||
break;
|
||||
case TOK_COLON:
|
||||
case TOK_COLON:
|
||||
STATE(token->text, "TOK_COLON:");
|
||||
|
||||
token = yylex();
|
||||
if (token == NULL)
|
||||
token_err(yylineno, infile, yytext,
|
||||
"EOF in colon definition");
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
@ -1267,7 +1267,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
free(fcode);
|
||||
}
|
||||
if (debug)
|
||||
printf("Adding %s to dictionary\n", token->text);
|
||||
printf("Adding %s to dictionary\n", token->text);
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1283,7 +1283,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
last_token = fcode->name;
|
||||
defining = 1;
|
||||
break;
|
||||
case TOK_SEMICOLON:
|
||||
case TOK_SEMICOLON:
|
||||
STATE(token->text, "TOK_SEMICOLON:");
|
||||
emit("b(;)");
|
||||
defining = 0;
|
||||
@ -1325,7 +1325,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
free((void *)alias->name);
|
||||
free(alias);
|
||||
return;
|
||||
}
|
||||
}
|
||||
alias->equiv = estrdup(token->text);
|
||||
if (!aadd(aliases, alias)) {
|
||||
free((void *)alias->name);
|
||||
@ -1371,13 +1371,13 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
warnx("EOF in colon definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1404,13 +1404,13 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
warnx("EOF in constant definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1443,13 +1443,13 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
warnx("EOF in create definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1496,7 +1496,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
token_err(yylineno, infile, NULL,
|
||||
"Illegal number conversion: %s", token->text);
|
||||
|
||||
/*
|
||||
/*
|
||||
* If this is a 64-bit value we need to store two literals
|
||||
* and issue a `lxjoin' to combine them. But that's a future
|
||||
* project.
|
||||
@ -1524,13 +1524,13 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
warnx("EOF in colon definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1563,7 +1563,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
* it generates the FCode and returns, with outpos at b2. We then
|
||||
* calculate the offsets, put them in the right slots and finishup.
|
||||
*/
|
||||
|
||||
|
||||
if (token->text[0] == '?')
|
||||
emit("b(?do)");
|
||||
else
|
||||
@ -1595,7 +1595,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
/* revert to the end */
|
||||
outpos = pos;
|
||||
break;
|
||||
case TOK_ENDCASE:
|
||||
case TOK_ENDCASE:
|
||||
STATE(token->text, "TOK_ENDCASE:");
|
||||
emit("b(endcase)");
|
||||
pos = outpos; /* Remember where we need to branch to */
|
||||
@ -1611,7 +1611,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
/* Load next offset to process */
|
||||
disp = (signed char)(outbuf[outpos]);
|
||||
if (offsetsize == 16) {
|
||||
disp = (disp << 8) |
|
||||
disp = (disp << 8) |
|
||||
(unsigned char)outbuf[outpos+1];
|
||||
}
|
||||
next = outpos + disp;
|
||||
@ -1631,7 +1631,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
STATE(token->text, "TOK_ENDOF");
|
||||
off = pop();
|
||||
emit("b(endof)");
|
||||
/*
|
||||
/*
|
||||
* Save back pointer in the offset field so we can traverse
|
||||
* the linked list and patch it in the endcase.
|
||||
*/
|
||||
@ -1665,7 +1665,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
outpos = pos;
|
||||
break;
|
||||
case TOK_FCODE_END:
|
||||
/*
|
||||
/*
|
||||
* Another tokenizer directive.
|
||||
*
|
||||
* This should generate end0 and finish filling in
|
||||
@ -1675,19 +1675,19 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
return;
|
||||
case TOK_FIELD:
|
||||
STATE(token->text, "TOK_FIELD");
|
||||
|
||||
|
||||
token = yylex();
|
||||
if (token == NULL) {
|
||||
warnx("EOF in field definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1701,7 +1701,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
spit(fcode->num);
|
||||
emit("b(field)");
|
||||
break;
|
||||
|
||||
|
||||
case TOK_HEX:
|
||||
STATE(token->text, "TOK_HEX");
|
||||
if (token->text[1] != '#') {
|
||||
@ -1729,7 +1729,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
errx(EXIT_FAILURE, "Illegal number"
|
||||
" conversion:%s:%d: %s\n",
|
||||
infile, yylineno, yytext);
|
||||
/*
|
||||
/*
|
||||
* If this is a 64-bit value we need to store two literals
|
||||
* and issue a `lxjoin' to combine them. But that's a future
|
||||
* project.
|
||||
@ -1813,7 +1813,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
" conversion:%s:%d: %s\n",
|
||||
infile, yylineno, yytext);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* If this is a 64-bit value we need to store two literals
|
||||
* and issue a `lxjoin' to combine them. But that's a future
|
||||
* project.
|
||||
@ -1844,7 +1844,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
* `endcase'. Here we will generate a temporary
|
||||
* offset of the `of' associated with the `endof'.
|
||||
* Then in `endcase' we should be pointing just
|
||||
* after the offset of the last `endof' so we
|
||||
* after the offset of the last `endof' so we
|
||||
* calculate the offset and thread our way backwards
|
||||
* searching for the previous `b(case)' or `b(endof)'.
|
||||
*/
|
||||
@ -1912,13 +1912,13 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
warnx("EOF in value definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -1940,13 +1940,13 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
warnx("EOF in variable definition");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Add new code to dictionary */
|
||||
fcode = emalloc(sizeof(*fcode));
|
||||
fcode->num = nextfcode++;
|
||||
fcode->name = estrdup(token->text);
|
||||
fadd(dictionary, fcode);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
emit("new-token");
|
||||
else {
|
||||
@ -2002,7 +2002,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
}
|
||||
infile = estrdup(token->text);
|
||||
if (mark_fload) {
|
||||
/*
|
||||
/*
|
||||
* Insert commands to print out the
|
||||
* filename into the instruction
|
||||
* stream
|
||||
@ -2026,7 +2026,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
yy_delete_buffer(inbuf);
|
||||
fclose(inf);
|
||||
if (mark_fload) {
|
||||
/*
|
||||
/*
|
||||
* Insert commands to print out the
|
||||
* filename into the instruction
|
||||
* stream
|
||||
@ -2052,7 +2052,7 @@ tokenize(YY_BUFFER_STATE yinput)
|
||||
if (emit(token->text)) {
|
||||
#if 0
|
||||
/*
|
||||
* Call an external command
|
||||
* Call an external command
|
||||
*
|
||||
* XXXXX assumes it will always find the command
|
||||
*/
|
||||
@ -2185,7 +2185,7 @@ offspit(long n)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
yywrap(void)
|
||||
{
|
||||
/* Always generate EOF */
|
||||
|
@ -20,7 +20,7 @@
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@ -296,7 +296,7 @@ getmsg(int fd, char *cptr, char quote)
|
||||
|
||||
if (quote && *cptr == quote) {
|
||||
++cptr;
|
||||
}
|
||||
}
|
||||
|
||||
clen = strlen(cptr) + 1;
|
||||
if (clen > msglen) {
|
||||
@ -367,7 +367,7 @@ getmsg(int fd, char *cptr, char quote)
|
||||
* escape ' and ", let's accept
|
||||
* them escaped and not complain.
|
||||
* (XPG4 states that '\' should be
|
||||
* ignored when not used in a
|
||||
* ignored when not used in a
|
||||
* valid escape sequence)
|
||||
*/
|
||||
*tptr++ = '"';
|
||||
|
@ -127,7 +127,7 @@ dfn_pre_visit(nltype *parentp)
|
||||
bool
|
||||
dfn_numbered(nltype *childp)
|
||||
{
|
||||
|
||||
|
||||
return ( childp -> toporder != DFN_NAN && childp -> toporder != DFN_BUSY );
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ dfn_findcycle(nltype *childp)
|
||||
* if what we think is the top of the cycle
|
||||
* has a cyclehead field, then it's not really the
|
||||
* head of the cycle, which is really what we want
|
||||
*/
|
||||
*/
|
||||
if ( cycleheadp -> cyclehead != cycleheadp ) {
|
||||
cycleheadp = cycleheadp -> cyclehead;
|
||||
# ifdef DEBUG
|
||||
|
@ -224,15 +224,15 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
* print the dynamic profile
|
||||
*/
|
||||
printgprof( timesortnlp );
|
||||
printgprof( timesortnlp );
|
||||
/*
|
||||
* print the flat profile
|
||||
*/
|
||||
printprof();
|
||||
printprof();
|
||||
/*
|
||||
* print the index
|
||||
*/
|
||||
printindex();
|
||||
printindex();
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -410,7 +410,7 @@ readsamples(FILE *pfile)
|
||||
{
|
||||
UNIT sample;
|
||||
int i;
|
||||
|
||||
|
||||
if (samples == 0) {
|
||||
samples = calloc(sampbytes, sizeof (UNIT));
|
||||
if (samples == 0)
|
||||
@ -491,7 +491,7 @@ asgnsamples(void)
|
||||
svalue0 = nl[j].svalue;
|
||||
svalue1 = nl[j+1].svalue;
|
||||
/*
|
||||
* if high end of tick is below entry address,
|
||||
* if high end of tick is below entry address,
|
||||
* go for next tick.
|
||||
*/
|
||||
if (pch < svalue0)
|
||||
@ -508,7 +508,7 @@ asgnsamples(void)
|
||||
if (debug & SAMPLEDEBUG) {
|
||||
printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %ld overlap\n",
|
||||
nl[j].value/sizeof(UNIT), svalue0, svalue1,
|
||||
nl[j].name,
|
||||
nl[j].name,
|
||||
overlap * time / scale, overlap);
|
||||
}
|
||||
# endif /* DEBUG */
|
||||
|
@ -105,4 +105,4 @@ index the index of this child in the call graph listing,
|
||||
fields as a function entry. Below it are listed
|
||||
the members of the cycle, and their contributions
|
||||
to the time and call counts of the cycle.
|
||||
|
||||
|
||||
|
@ -15,13 +15,13 @@ seconds function alone. This is the major sort for this
|
||||
|
||||
calls the number of times this function was invoked, if
|
||||
this function is profiled, else blank.
|
||||
|
||||
|
||||
self the average number of milliseconds spent in this
|
||||
ms/call function per call, if this function is profiled,
|
||||
else blank.
|
||||
|
||||
total the average number of milliseconds spent in this
|
||||
ms/call function and its descendents per call, if this
|
||||
ms/call function and its descendents per call, if this
|
||||
function is profiled, else blank.
|
||||
|
||||
name the name of the function. This is the minor sort
|
||||
@ -29,4 +29,4 @@ name the name of the function. This is the minor sort
|
||||
the function in the gprof listing. If the index is
|
||||
in parenthesis it shows where it would appear in
|
||||
the gprof listing if it were to be printed.
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ extern int cyclecnt; /* the number of cycles found */
|
||||
#define DFN_BUSY -1
|
||||
#define DFN_NAN 0
|
||||
|
||||
/*
|
||||
/*
|
||||
* namelist entries for cycle headers.
|
||||
* the number of discovered cycles.
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
/*
|
||||
* look up an address in a sorted-by-address namelist
|
||||
* this deals with misses by mapping them to the next lower
|
||||
* this deals with misses by mapping them to the next lower
|
||||
* entry point.
|
||||
*/
|
||||
nltype *
|
||||
|
@ -88,7 +88,7 @@ timecmp(const void *v1, const void *v2)
|
||||
void
|
||||
flatprofheader()
|
||||
{
|
||||
|
||||
|
||||
if (bflag)
|
||||
printblurb( _PATH_FLAT_BLURB );
|
||||
printf("\ngranularity: each sample hit covers %ld byte(s)",
|
||||
@ -268,7 +268,7 @@ totalcmp(const void *v1, const void *v2)
|
||||
return 1;
|
||||
if ( np1 -> ncall > np2 -> ncall )
|
||||
return -1;
|
||||
if ( np1 -> ncall < np2 -> ncall )
|
||||
if ( np1 -> ncall < np2 -> ncall )
|
||||
return 1;
|
||||
return strcmp( np1 -> name , np2 -> name );
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ check_type:
|
||||
if (ps.in_decl && !ps.block_init)
|
||||
if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) {
|
||||
ps.dumped_decl_indent = 1;
|
||||
snprintf(e_code, (l_code - e_code) + 5,
|
||||
snprintf(e_code, (l_code - e_code) + 5,
|
||||
"\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token);
|
||||
e_code += strlen(e_code);
|
||||
CHECK_SIZE_CODE;
|
||||
|
@ -316,18 +316,18 @@ compute_label_target(void)
|
||||
|
||||
/*
|
||||
* Copyright (C) 1976 by the Board of Trustees of the University of Illinois
|
||||
*
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NAME: fill_buffer
|
||||
*
|
||||
*
|
||||
* FUNCTION: Reads one block of input into input_buffer
|
||||
*
|
||||
*
|
||||
* HISTORY: initial coding November 1976 D A Willcox of CAC 1/7/77 A
|
||||
* Willcox of CAC Added check for switch back to partly full input
|
||||
* buffer from temporary buffer
|
||||
*
|
||||
*
|
||||
*/
|
||||
void
|
||||
fill_buffer(void)
|
||||
@ -420,31 +420,31 @@ fill_buffer(void)
|
||||
|
||||
/*
|
||||
* Copyright (C) 1976 by the Board of Trustees of the University of Illinois
|
||||
*
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NAME: pad_output
|
||||
*
|
||||
*
|
||||
* FUNCTION: Writes tabs and spaces to move the current column up to the desired
|
||||
* position.
|
||||
*
|
||||
*
|
||||
* ALGORITHM: Put tabs and/or blanks into pobuf, then write pobuf.
|
||||
*
|
||||
*
|
||||
* PARAMETERS: current integer The current column target
|
||||
* target integer The desired column
|
||||
*
|
||||
*
|
||||
* RETURNS: Integer value of the new column. (If current >= target, no action is
|
||||
* taken, and current is returned.
|
||||
*
|
||||
*
|
||||
* GLOBALS: None
|
||||
*
|
||||
*
|
||||
* CALLS: write (sys)
|
||||
*
|
||||
*
|
||||
* CALLED BY: dump_line
|
||||
*
|
||||
*
|
||||
* HISTORY: initial coding November 1976 D A Willcox of CAC
|
||||
*
|
||||
*
|
||||
*/
|
||||
int
|
||||
pad_output(int current, int target)
|
||||
@ -472,23 +472,23 @@ pad_output(int current, int target)
|
||||
|
||||
/*
|
||||
* Copyright (C) 1976 by the Board of Trustees of the University of Illinois
|
||||
*
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NAME: count_spaces
|
||||
*
|
||||
*
|
||||
* FUNCTION: Find out where printing of a given string will leave the current
|
||||
* character position on output.
|
||||
*
|
||||
*
|
||||
* ALGORITHM: Run thru input string and add appropriate values to current
|
||||
* position.
|
||||
*
|
||||
*
|
||||
* RETURNS: Integer value of position after printing "buffer" starting in column
|
||||
* "current".
|
||||
*
|
||||
*
|
||||
* HISTORY: initial coding November 1976 D A Willcox of CAC
|
||||
*
|
||||
*
|
||||
*/
|
||||
int
|
||||
count_spaces(int current, char *buffer)
|
||||
|
@ -202,7 +202,7 @@ lexi(void)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!(seensfx & 1) &&
|
||||
if (!(seensfx & 1) &&
|
||||
(*buf_ptr == 'F' || *buf_ptr == 'f')) {
|
||||
CHECK_SIZE_TOKEN;
|
||||
*e_token++ = *buf_ptr++;
|
||||
|
@ -1523,7 +1523,7 @@ main(int argc, char *argv[])
|
||||
argv[optind], tfile[termcount]);
|
||||
|
||||
status = _nc_read_file_entry(tfile[termcount],
|
||||
&entries[termcount].tterm);
|
||||
&entries[termcount].tterm);
|
||||
#else
|
||||
(void) fprintf(stderr, "%s: terminfo files not supported\n",
|
||||
_nc_progname);
|
||||
|
@ -516,7 +516,7 @@ ktrcmsghdr(char *data, socklen_t len)
|
||||
printf("SCM_RIGHTS, data=");
|
||||
fds = (int *)CMSG_DATA(cmsg);
|
||||
for (i = 0;
|
||||
cmsg->cmsg_len > CMSG_LEN(sizeof(int) * i)
|
||||
cmsg->cmsg_len > CMSG_LEN(sizeof(int) * i)
|
||||
&& (char *)fds + (i + 1) * sizeof(int) <=
|
||||
data + len;
|
||||
i++) {
|
||||
@ -595,7 +595,7 @@ ktrstruct(char *buf, size_t buflen)
|
||||
sizeof(ss.ss_len))
|
||||
goto invalid;
|
||||
memcpy(&ss, data, datalen);
|
||||
if ((ss.ss_family != AF_UNIX &&
|
||||
if ((ss.ss_family != AF_UNIX &&
|
||||
datalen < sizeof(struct sockaddr)) || datalen != ss.ss_len)
|
||||
goto invalid;
|
||||
ktrsockaddr((struct sockaddr *)&ss);
|
||||
|
@ -456,7 +456,7 @@ dosocktypename (int arg, int show_type)
|
||||
{
|
||||
int type = arg & 0xff; /* XXX */
|
||||
int or = 0;
|
||||
|
||||
|
||||
printf("%#x<", arg);
|
||||
if (show_type || type) {
|
||||
or = 1;
|
||||
|
@ -151,7 +151,7 @@ main(int argc, char *argv[])
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
|
||||
if ((pidset && *argv) || (!pidset && !*argv && clear != CLEAR))
|
||||
usage();
|
||||
|
||||
@ -192,7 +192,7 @@ main(int argc, char *argv[])
|
||||
(void)umask(omask);
|
||||
(void)close(fd);
|
||||
|
||||
if (*argv) {
|
||||
if (*argv) {
|
||||
if (is_ltrace) {
|
||||
if (setenv("LD_TRACE_PLT", inherit ? "i" : "", 1) < 0)
|
||||
err(1, "setenv(LD_TRACE_PLT)");
|
||||
|
@ -420,7 +420,7 @@ want(struct utmp *bp, int check)
|
||||
|
||||
if (check) {
|
||||
/*
|
||||
* some entries, such as ftp and uucp, will
|
||||
* some entries, such as ftp and uucp, will
|
||||
* include process name plus id; exclude entries
|
||||
* that start with 'console' and 'tty' from
|
||||
* having the process id stripped.
|
||||
|
@ -265,9 +265,9 @@ aldap_search(struct aldap *ldap, char *basedn, enum scope scope, char *filter,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
c = ber;
|
||||
c = ber;
|
||||
ber = ober_printf_elements(ber, "sEEddb", basedn, (long long)scope,
|
||||
(long long)LDAP_DEREF_NEVER, sizelimit,
|
||||
(long long)LDAP_DEREF_NEVER, sizelimit,
|
||||
timelimit, typesonly);
|
||||
if (ber == NULL) {
|
||||
ldap->err = ALDAP_ERR_OPERATION_FAILED;
|
||||
@ -339,7 +339,7 @@ aldap_create_page_control(struct ber_element *elm, int size,
|
||||
fail:
|
||||
if (ber != NULL)
|
||||
ober_free_elements(ber);
|
||||
ober_free(&c);
|
||||
ober_free(&c);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
@ -451,7 +451,7 @@ parsefail:
|
||||
}
|
||||
|
||||
struct aldap_page_control *
|
||||
aldap_parse_page_control(struct ber_element *control, size_t len)
|
||||
aldap_parse_page_control(struct ber_element *control, size_t len)
|
||||
{
|
||||
char *oid, *s;
|
||||
char *encoded;
|
||||
|
@ -75,7 +75,7 @@ struct aldap_message {
|
||||
} search;
|
||||
} body;
|
||||
struct ber_element *references;
|
||||
struct aldap_page_control *page;
|
||||
struct aldap_page_control *page;
|
||||
};
|
||||
|
||||
enum aldap_protocol {
|
||||
|
@ -107,7 +107,7 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
(void)time(&now);
|
||||
t = localtime(&now);
|
||||
while (t->tm_hour > hours ||
|
||||
while (t->tm_hour > hours ||
|
||||
(t->tm_hour == hours && t->tm_min >= minutes)) {
|
||||
if (twentyfour)
|
||||
hours += 24;
|
||||
|
@ -54,7 +54,7 @@ ccl_contains(const int cclp, const int ch)
|
||||
|
||||
/* ccladd - add a single character to a ccl */
|
||||
|
||||
void
|
||||
void
|
||||
ccladd(cclp, ch)
|
||||
int cclp;
|
||||
int ch;
|
||||
@ -92,7 +92,7 @@ ccladd(cclp, ch)
|
||||
|
||||
/* dump_cclp - same thing as list_character_set, but for cclps. */
|
||||
|
||||
static void
|
||||
static void
|
||||
dump_cclp(FILE * file, int cclp)
|
||||
{
|
||||
int i;
|
||||
@ -189,7 +189,7 @@ ccl_set_union(int a, int b)
|
||||
|
||||
/* cclinit - return an empty ccl */
|
||||
|
||||
int
|
||||
int
|
||||
cclinit()
|
||||
{
|
||||
if (++lastccl >= current_maxccls) {
|
||||
@ -230,7 +230,7 @@ cclinit()
|
||||
|
||||
/* cclnegate - negate the given ccl */
|
||||
|
||||
void
|
||||
void
|
||||
cclnegate(cclp)
|
||||
int cclp;
|
||||
{
|
||||
@ -246,7 +246,7 @@ cclnegate(cclp)
|
||||
* has a non-zero value in the cset array.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
list_character_set(file, cset)
|
||||
FILE *file;
|
||||
int cset[];
|
||||
@ -288,7 +288,7 @@ list_character_set(file, cset)
|
||||
* @param c2 the upper end of the range
|
||||
* @return true if [c1-c2] is not ambiguous for a caseless scanner.
|
||||
*/
|
||||
bool
|
||||
bool
|
||||
range_covers_case(int c1, int c2)
|
||||
{
|
||||
int i, o;
|
||||
@ -306,14 +306,14 @@ range_covers_case(int c1, int c2)
|
||||
/** Reverse the case of a character, if possible.
|
||||
* @return c if case-reversal does not apply.
|
||||
*/
|
||||
int
|
||||
int
|
||||
reverse_case(int c)
|
||||
{
|
||||
return isupper(c) ? tolower(c) : (islower(c) ? toupper(c) : c);
|
||||
}
|
||||
|
||||
/** Return true if c is uppercase or lowercase. */
|
||||
bool
|
||||
bool
|
||||
has_case(int c)
|
||||
{
|
||||
return (isupper(c) || islower(c)) ? true : false;
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
/* ccl2ecl - convert character classes to set of equivalence classes */
|
||||
|
||||
void
|
||||
void
|
||||
ccl2ecl(void)
|
||||
{
|
||||
int i, ich, newlen, cclp, ccls, cclmec;
|
||||
@ -78,7 +78,7 @@ ccl2ecl(void)
|
||||
* Returned is the number of classes.
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
cre8ecs(int *fwd, int *bck, int num)
|
||||
{
|
||||
int i, j, numcl;
|
||||
@ -115,7 +115,7 @@ cre8ecs(int *fwd, int *bck, int num)
|
||||
* NUL_mapping is the value which NUL (0) should be mapped to.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
mkeccl(u_char *ccls, int lenccl, int *fwd, int *bck, int llsiz, int NUL_mapping)
|
||||
{
|
||||
int cclp, oldec, newec;
|
||||
@ -206,7 +206,7 @@ mkeccl(u_char *ccls, int lenccl, int *fwd, int *bck, int llsiz, int NUL_mapping)
|
||||
|
||||
/* mkechar - create equivalence class for single character */
|
||||
|
||||
void
|
||||
void
|
||||
mkechar(int tch, int *fwd, int *bck)
|
||||
{
|
||||
/*
|
||||
|
@ -125,7 +125,7 @@ filter_create_int(struct filter * chain,
|
||||
* @param chain The head of the chain.
|
||||
* @return true on success.
|
||||
*/
|
||||
bool
|
||||
bool
|
||||
filter_apply_chain(struct filter * chain)
|
||||
{
|
||||
int pid, pipes[2];
|
||||
@ -201,7 +201,7 @@ filter_apply_chain(struct filter * chain)
|
||||
* @param max_len the maximum length of the chain.
|
||||
* @return the resulting length of the chain.
|
||||
*/
|
||||
int
|
||||
int
|
||||
filter_truncate(struct filter * chain, int max_len)
|
||||
{
|
||||
int len = 1;
|
||||
@ -223,7 +223,7 @@ filter_truncate(struct filter * chain, int max_len)
|
||||
* The header file name is in extra.
|
||||
* @return 0 (zero) on success, and -1 on failure.
|
||||
*/
|
||||
int
|
||||
int
|
||||
filter_tee_header(struct filter * chain)
|
||||
{
|
||||
/*
|
||||
@ -337,7 +337,7 @@ filter_tee_header(struct filter * chain)
|
||||
* not user code. This also happens to be a good place to squeeze multiple
|
||||
* blank lines into a single blank line.
|
||||
*/
|
||||
int
|
||||
int
|
||||
filter_fix_linedirs(struct filter * chain)
|
||||
{
|
||||
char *buf;
|
||||
|
@ -15,10 +15,10 @@
|
||||
%# through m4. Macros beginning with `m4_' will be processed.
|
||||
%# The quoting is "[[" and "]]" so we don't interfere with
|
||||
%# user code.
|
||||
%#
|
||||
%#
|
||||
%# All generate macros for the m4 stage contain the text "m4" or "M4"
|
||||
%# in them. This is to distinguish them from CPP macros.
|
||||
%# The exception to this rule is YY_G, which is an m4 macro,
|
||||
%# The exception to this rule is YY_G, which is an m4 macro,
|
||||
%# but it needs to be remain short because it is used everywhere.
|
||||
%#
|
||||
/* A lexical scanner generated by flex */
|
||||
@ -31,7 +31,7 @@ m4_changecom
|
||||
m4_changequote
|
||||
m4_changequote([[, ]])
|
||||
|
||||
%#
|
||||
%#
|
||||
%# Lines in this skeleton starting with a "%" character are "control lines"
|
||||
%# and affect the generation of the scanner. The possible control codes are
|
||||
%# listed and processed in misc.c.
|
||||
@ -217,7 +217,7 @@ m4preproc_include(`flexint.h')
|
||||
|
||||
%if-c++-only
|
||||
/* begin standard C++ headers. */
|
||||
#include <iostream>
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
@ -250,13 +250,13 @@ m4preproc_include(`flexint.h')
|
||||
%# e.g.,
|
||||
%# The function prototype
|
||||
%# int foo(int x, char* y);
|
||||
%#
|
||||
%#
|
||||
%# ...should be written as
|
||||
%# int foo M4_YY_PARAMS(int x, char* y);
|
||||
%#
|
||||
%#
|
||||
%# ...which could possibly generate
|
||||
%# int foo ();
|
||||
%#
|
||||
%#
|
||||
m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
|
||||
[[
|
||||
m4_define( [[M4_YY_PARAMS]], [[()]])
|
||||
@ -331,7 +331,7 @@ m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
|
||||
#define yy_flex_debug YY_G(yy_flex_debug_r)
|
||||
|
||||
m4_define( [[M4_YY_INCR_LINENO]],
|
||||
[[
|
||||
[[
|
||||
do{ yylineno++;
|
||||
yycolumn=0;
|
||||
}while(0)
|
||||
@ -344,7 +344,7 @@ m4_define( [[M4_YY_INCR_LINENO]],
|
||||
%if-not-reentrant
|
||||
|
||||
m4_define( [[M4_YY_INCR_LINENO]],
|
||||
[[
|
||||
[[
|
||||
yylineno++;
|
||||
]])
|
||||
|
||||
@ -493,7 +493,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
|
||||
[[
|
||||
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
|
||||
* access to the local variable yy_act. Since yyless() is a macro, it would break
|
||||
* existing scanners that call yyless() from OUTSIDE yylex.
|
||||
* existing scanners that call yyless() from OUTSIDE yylex.
|
||||
* One obvious solution it to make yy_act a global. I tried that, and saw
|
||||
* a 5% performance hit in a non-yylineno scanner, because yy_act is
|
||||
* normally declared as a register variable-- so it is not worth it.
|
||||
@ -588,7 +588,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
@ -1175,7 +1175,7 @@ int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
|
||||
|
||||
/** Describes a mapping from a serialized table id to its deserialized state in
|
||||
* this scanner. This is the bridge between our "generic" deserialization code
|
||||
* and the specifics of this scanner.
|
||||
* and the specifics of this scanner.
|
||||
*/
|
||||
struct yytbl_dmap {
|
||||
enum yytbl_id dm_id;/**< table identifier */
|
||||
@ -2272,10 +2272,10 @@ void yyFlexLexer::yyensure_buffer_stack(void)
|
||||
M4_YY_CALL_LAST_ARG);
|
||||
if ( ! YY_G(yy_buffer_stack) )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
|
||||
|
||||
|
||||
|
||||
|
||||
memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
|
||||
|
||||
YY_G(yy_buffer_stack_max) = num_to_alloc;
|
||||
YY_G(yy_buffer_stack_top) = 0;
|
||||
return;
|
||||
@ -2311,7 +2311,7 @@ m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
|
||||
* @param base the character buffer
|
||||
* @param size the size in bytes of the character buffer
|
||||
* M4_YY_DOC_PARAM
|
||||
* @return the newly allocated buffer state object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
|
||||
{
|
||||
@ -2543,7 +2543,7 @@ m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
|
||||
int yyget_lineno YYFARGS0(void)
|
||||
{
|
||||
M4_YY_DECL_GUTS_VAR();
|
||||
|
||||
|
||||
m4_ifdef( [[M4_YY_REENTRANT]],
|
||||
[[
|
||||
if (! YY_CURRENT_BUFFER)
|
||||
@ -2563,7 +2563,7 @@ m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
|
||||
int yyget_column YYFARGS0(void)
|
||||
{
|
||||
M4_YY_DECL_GUTS_VAR();
|
||||
|
||||
|
||||
m4_ifdef( [[M4_YY_REENTRANT]],
|
||||
[[
|
||||
if (! YY_CURRENT_BUFFER)
|
||||
@ -2830,20 +2830,20 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
|
||||
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* By setting to 0xAA, we expose bugs in
|
||||
yy_init_globals. Leave at 0x00 for releases. */
|
||||
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
|
||||
|
||||
|
||||
yyset_extra (yy_user_defined, *ptr_yy_globals);
|
||||
|
||||
|
||||
return yy_init_globals ( *ptr_yy_globals );
|
||||
}
|
||||
|
||||
@ -3118,7 +3118,7 @@ static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Read a table while mapping its contents to the local array.
|
||||
/** Read a table while mapping its contents to the local array.
|
||||
* @param dmap used to performing mapping
|
||||
* @return 0 on success
|
||||
*/
|
||||
@ -3163,7 +3163,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
|
||||
|
||||
if(M4_YY_TABLES_VERIFY)
|
||||
/* We point to the array itself */
|
||||
p = dmap->dm_arr;
|
||||
p = dmap->dm_arr;
|
||||
else
|
||||
/* We point to the address of a pointer. */
|
||||
*dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
|
||||
@ -3210,7 +3210,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
|
||||
rv = yytbl_read8 (&t8, rd);
|
||||
t32 = t8;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */
|
||||
return -1;
|
||||
}
|
||||
@ -3267,7 +3267,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
|
||||
YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if( M4_YY_TABLES_VERIFY)
|
||||
v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
|
||||
else
|
||||
@ -3278,7 +3278,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
|
||||
YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
|
||||
}else
|
||||
((struct yy_trans_info **) p)[0] = v;
|
||||
|
||||
|
||||
/* increment p */
|
||||
p = (struct yy_trans_info **) p + 1;
|
||||
}
|
||||
@ -3394,7 +3394,7 @@ int yytables_fload YYFARGS1(FILE *, fp)
|
||||
|
||||
/** Destroy the loaded tables, freeing memory, etc.. */
|
||||
int yytables_destroy YYFARGS0(void)
|
||||
{
|
||||
{
|
||||
struct yytbl_dmap *dmap=0;
|
||||
|
||||
if(!M4_YY_TABLES_VERIFY){
|
||||
|
@ -10,7 +10,7 @@
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@ -27,7 +27,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
|
@ -84,7 +84,7 @@ get_state_decl(void)
|
||||
|
||||
/* Indent to the current level. */
|
||||
|
||||
void
|
||||
void
|
||||
do_indent()
|
||||
{
|
||||
int i = indent_level * 8;
|
||||
@ -128,7 +128,7 @@ mkeoltbl(void)
|
||||
}
|
||||
|
||||
/* Generate the table for possible eol matches. */
|
||||
static void
|
||||
static void
|
||||
geneoltbl()
|
||||
{
|
||||
int i;
|
||||
@ -153,7 +153,7 @@ geneoltbl()
|
||||
|
||||
/* Generate the code to keep backing-up information. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_backing_up()
|
||||
{
|
||||
if (reject || num_backing_up == 0)
|
||||
@ -175,7 +175,7 @@ gen_backing_up()
|
||||
|
||||
/* Generate the code to perform the backing up. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_bu_action()
|
||||
{
|
||||
if (reject || num_backing_up == 0)
|
||||
@ -238,7 +238,7 @@ mkctbl(void)
|
||||
* The offset is base[nxt[i]] - (base of current state)]. That's
|
||||
* just the difference between the starting points of the two
|
||||
* involved states (to - from).
|
||||
*
|
||||
*
|
||||
* First, though, we need to find some way to put in our end-of-buffer
|
||||
* flags and states. We do this by making a state with absolutely no
|
||||
* transitions. We put it at the end of the table.
|
||||
@ -341,7 +341,7 @@ mkssltbl(void)
|
||||
|
||||
/* genctbl - generates full speed compressed transition table */
|
||||
|
||||
void
|
||||
void
|
||||
genctbl()
|
||||
{
|
||||
int i;
|
||||
@ -359,7 +359,7 @@ genctbl()
|
||||
* The offset is base[nxt[i]] - (base of current state)]. That's
|
||||
* just the difference between the starting points of the two
|
||||
* involved states (to - from).
|
||||
*
|
||||
*
|
||||
* First, though, we need to find some way to put in our end-of-buffer
|
||||
* flags and states. We do this by making a state with absolutely no
|
||||
* transitions. We put it at the end of the table.
|
||||
@ -475,7 +475,7 @@ mkecstbl(void)
|
||||
|
||||
/* Generate equivalence-class tables. */
|
||||
|
||||
void
|
||||
void
|
||||
genecs()
|
||||
{
|
||||
int i, j;
|
||||
@ -511,7 +511,7 @@ genecs()
|
||||
|
||||
/* Generate the code to find the action number. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_find_action()
|
||||
{
|
||||
if (fullspd)
|
||||
@ -689,7 +689,7 @@ mkftbl(void)
|
||||
|
||||
/* genftbl - generate full transition table */
|
||||
|
||||
void
|
||||
void
|
||||
genftbl()
|
||||
{
|
||||
int i;
|
||||
@ -724,7 +724,7 @@ genftbl()
|
||||
|
||||
/* Generate the code to find the next compressed-table state. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_next_compressed_state(char_map)
|
||||
char *char_map;
|
||||
{
|
||||
@ -770,7 +770,7 @@ gen_next_compressed_state(char_map)
|
||||
|
||||
/* Generate the code to find the next match. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_next_match()
|
||||
{
|
||||
/*
|
||||
@ -872,7 +872,7 @@ gen_next_match()
|
||||
|
||||
/* Generate the code to find the next state. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_next_state(worry_about_NULs)
|
||||
int worry_about_NULs;
|
||||
{ /* NOTE - changes in here should be reflected
|
||||
@ -939,7 +939,7 @@ gen_next_state(worry_about_NULs)
|
||||
|
||||
/* Generate the code to make a NUL transition. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_NUL_trans()
|
||||
{ /* NOTE - changes in here should be reflected
|
||||
* in gen_next_match() */
|
||||
@ -1024,7 +1024,7 @@ gen_NUL_trans()
|
||||
|
||||
/* Generate the code to find the start state. */
|
||||
|
||||
void
|
||||
void
|
||||
gen_start_state()
|
||||
{
|
||||
if (fullspd) {
|
||||
@ -1055,7 +1055,7 @@ gen_start_state()
|
||||
|
||||
/* gentabs - generate data statements for the transition tables */
|
||||
|
||||
void
|
||||
void
|
||||
gentabs()
|
||||
{
|
||||
int i, j, k, *accset, nacc, *acc_array, total_states;
|
||||
@ -1080,7 +1080,7 @@ gentabs()
|
||||
if (reject) {
|
||||
/*
|
||||
* Write out accepting list and pointer list.
|
||||
*
|
||||
*
|
||||
* First we generate the "yy_acclist" array. In the process, we
|
||||
* compute the indices that will go into the "yy_accept"
|
||||
* array, and save the indices in the dfaacc array.
|
||||
@ -1474,7 +1474,7 @@ gentabs()
|
||||
* current indentation level, adding a final newline.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
indent_put2s(fmt, arg)
|
||||
const char *fmt, *arg;
|
||||
{
|
||||
@ -1488,7 +1488,7 @@ indent_put2s(fmt, arg)
|
||||
* newline.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
indent_puts(str)
|
||||
const char *str;
|
||||
{
|
||||
@ -1500,7 +1500,7 @@ indent_puts(str)
|
||||
/* make_tables - generate transition tables and finishes generating output file
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
make_tables()
|
||||
{
|
||||
int i;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
extern int yylex();
|
||||
|
||||
int
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
|
@ -23,7 +23,7 @@
|
||||
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
||||
/* PURPOSE. */
|
||||
|
||||
int
|
||||
int
|
||||
yywrap(void)
|
||||
{
|
||||
return 1;
|
||||
|
@ -58,7 +58,7 @@ struct sko_state {
|
||||
};
|
||||
static struct sko_state *sko_stack = 0;
|
||||
static int sko_len = 0, sko_sz = 0;
|
||||
static void
|
||||
static void
|
||||
sko_push(bool dc)
|
||||
{
|
||||
if (!sko_stack) {
|
||||
@ -76,7 +76,7 @@ sko_push(bool dc)
|
||||
sko_stack[sko_len].dc = dc;
|
||||
sko_len++;
|
||||
}
|
||||
static void
|
||||
static void
|
||||
sko_peek(bool * dc)
|
||||
{
|
||||
if (sko_len <= 0)
|
||||
@ -84,7 +84,7 @@ sko_peek(bool * dc)
|
||||
if (dc)
|
||||
*dc = sko_stack[sko_len - 1].dc;
|
||||
}
|
||||
static void
|
||||
static void
|
||||
sko_pop(bool * dc)
|
||||
{
|
||||
sko_peek(dc);
|
||||
@ -94,7 +94,7 @@ sko_pop(bool * dc)
|
||||
}
|
||||
|
||||
/* Append "#define defname value\n" to the running buffer. */
|
||||
void
|
||||
void
|
||||
action_define(defname, value)
|
||||
const char *defname;
|
||||
int value;
|
||||
@ -121,7 +121,7 @@ action_define(defname, value)
|
||||
* @param defname The macro name.
|
||||
* @param value The macro value, can be NULL, which is the same as the empty string.
|
||||
*/
|
||||
void
|
||||
void
|
||||
action_m4_define(const char *defname, const char *value)
|
||||
{
|
||||
char buf[MAXLINE];
|
||||
@ -139,7 +139,7 @@ action_m4_define(const char *defname, const char *value)
|
||||
}
|
||||
|
||||
/* Append "new_text" to the running buffer. */
|
||||
void
|
||||
void
|
||||
add_action(new_text)
|
||||
const char *new_text;
|
||||
{
|
||||
@ -190,7 +190,7 @@ allocate_array(size, element_size)
|
||||
|
||||
/* all_lower - true if a string is all lower-case */
|
||||
|
||||
int
|
||||
int
|
||||
all_lower(str)
|
||||
char *str;
|
||||
{
|
||||
@ -206,7 +206,7 @@ all_lower(str)
|
||||
|
||||
/* all_upper - true if a string is all upper-case */
|
||||
|
||||
int
|
||||
int
|
||||
all_upper(str)
|
||||
char *str;
|
||||
{
|
||||
@ -222,7 +222,7 @@ all_upper(str)
|
||||
|
||||
/* intcmp - compares two integers for use by qsort. */
|
||||
|
||||
int
|
||||
int
|
||||
intcmp(const void *a, const void *b)
|
||||
{
|
||||
return *(const int *) a - *(const int *) b;
|
||||
@ -234,7 +234,7 @@ intcmp(const void *a, const void *b)
|
||||
* and exits.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
check_char(c)
|
||||
int c;
|
||||
{
|
||||
@ -252,7 +252,7 @@ check_char(c)
|
||||
|
||||
/* clower - replace upper-case letter to lower-case */
|
||||
|
||||
u_char
|
||||
u_char
|
||||
clower(c)
|
||||
int c;
|
||||
{
|
||||
@ -311,7 +311,7 @@ copy_unsigned_string(str)
|
||||
|
||||
/* cclcmp - compares two characters for use by qsort with '\0' sorting last. */
|
||||
|
||||
int
|
||||
int
|
||||
cclcmp(const void *a, const void *b)
|
||||
{
|
||||
if (!*(const u_char *) a)
|
||||
@ -325,7 +325,7 @@ cclcmp(const void *a, const void *b)
|
||||
|
||||
/* dataend - finish up a block of data declarations */
|
||||
|
||||
void
|
||||
void
|
||||
dataend()
|
||||
{
|
||||
/* short circuit any output */
|
||||
@ -344,7 +344,7 @@ dataend()
|
||||
|
||||
/* dataflush - flush generated data statements */
|
||||
|
||||
void
|
||||
void
|
||||
dataflush()
|
||||
{
|
||||
/* short circuit any output */
|
||||
@ -368,7 +368,7 @@ dataflush()
|
||||
|
||||
/* flexerror - report an error message and terminate */
|
||||
|
||||
void
|
||||
void
|
||||
flexerror(msg)
|
||||
const char *msg;
|
||||
{
|
||||
@ -379,7 +379,7 @@ flexerror(msg)
|
||||
|
||||
/* flexfatal - report a fatal error message and terminate */
|
||||
|
||||
void
|
||||
void
|
||||
flexfatal(msg)
|
||||
const char *msg;
|
||||
{
|
||||
@ -391,7 +391,7 @@ flexfatal(msg)
|
||||
|
||||
/* htoi - convert a hexadecimal digit string to an integer value */
|
||||
|
||||
int
|
||||
int
|
||||
htoi(str)
|
||||
u_char str[];
|
||||
{
|
||||
@ -405,7 +405,7 @@ htoi(str)
|
||||
|
||||
/* lerrif - report an error message formatted with one integer argument */
|
||||
|
||||
void
|
||||
void
|
||||
lerrif(msg, arg)
|
||||
const char *msg;
|
||||
int arg;
|
||||
@ -419,7 +419,7 @@ lerrif(msg, arg)
|
||||
|
||||
/* lerrsf - report an error message formatted with one string argument */
|
||||
|
||||
void
|
||||
void
|
||||
lerrsf(msg, arg)
|
||||
const char *msg, arg[];
|
||||
{
|
||||
@ -433,7 +433,7 @@ lerrsf(msg, arg)
|
||||
|
||||
/* lerrsf_fatal - as lerrsf, but call flexfatal */
|
||||
|
||||
void
|
||||
void
|
||||
lerrsf_fatal(msg, arg)
|
||||
const char *msg, arg[];
|
||||
{
|
||||
@ -447,7 +447,7 @@ lerrsf_fatal(msg, arg)
|
||||
|
||||
/* line_directive_out - spit out a "#line" statement */
|
||||
|
||||
void
|
||||
void
|
||||
line_directive_out(output_file, do_infile)
|
||||
FILE *output_file;
|
||||
int do_infile;
|
||||
@ -498,7 +498,7 @@ line_directive_out(output_file, do_infile)
|
||||
* representing where the user's section 1 definitions end
|
||||
* and the prolog begins
|
||||
*/
|
||||
void
|
||||
void
|
||||
mark_defs1()
|
||||
{
|
||||
defs1_offset = 0;
|
||||
@ -511,7 +511,7 @@ mark_defs1()
|
||||
/* mark_prolog - mark the current position in the action array as
|
||||
* representing the end of the action prolog
|
||||
*/
|
||||
void
|
||||
void
|
||||
mark_prolog()
|
||||
{
|
||||
action_array[action_index++] = '\0';
|
||||
@ -524,7 +524,7 @@ mark_prolog()
|
||||
*
|
||||
* Generates a data statement initializing the current 2-D array to "value".
|
||||
*/
|
||||
void
|
||||
void
|
||||
mk2data(value)
|
||||
int value;
|
||||
{
|
||||
@ -554,7 +554,7 @@ mk2data(value)
|
||||
* Generates a data statement initializing the current array element to
|
||||
* "value".
|
||||
*/
|
||||
void
|
||||
void
|
||||
mkdata(value)
|
||||
int value;
|
||||
{
|
||||
@ -580,7 +580,7 @@ mkdata(value)
|
||||
|
||||
/* myctoi - return the integer represented by a string of digits */
|
||||
|
||||
int
|
||||
int
|
||||
myctoi(array)
|
||||
const char *array;
|
||||
{
|
||||
@ -594,7 +594,7 @@ myctoi(array)
|
||||
|
||||
/* myesc - return character corresponding to escape sequence */
|
||||
|
||||
u_char
|
||||
u_char
|
||||
myesc(array)
|
||||
u_char array[];
|
||||
{
|
||||
@ -685,7 +685,7 @@ myesc(array)
|
||||
|
||||
/* otoi - convert an octal digit string to an integer value */
|
||||
|
||||
int
|
||||
int
|
||||
otoi(str)
|
||||
u_char str[];
|
||||
{
|
||||
@ -700,14 +700,14 @@ otoi(str)
|
||||
* generated scanner, keeping track of the line count.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
out(str)
|
||||
const char *str;
|
||||
{
|
||||
fputs(str, stdout);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
out_dec(fmt, n)
|
||||
const char *fmt;
|
||||
int n;
|
||||
@ -715,7 +715,7 @@ out_dec(fmt, n)
|
||||
fprintf(stdout, fmt, n);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
out_dec2(fmt, n1, n2)
|
||||
const char *fmt;
|
||||
int n1, n2;
|
||||
@ -723,7 +723,7 @@ out_dec2(fmt, n1, n2)
|
||||
fprintf(stdout, fmt, n1, n2);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
out_hex(fmt, x)
|
||||
const char *fmt;
|
||||
unsigned int x;
|
||||
@ -731,21 +731,21 @@ out_hex(fmt, x)
|
||||
fprintf(stdout, fmt, x);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
out_str(fmt, str)
|
||||
const char *fmt, str[];
|
||||
{
|
||||
fprintf(stdout, fmt, str);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
out_str3(fmt, s1, s2, s3)
|
||||
const char *fmt, s1[], s2[], s3[];
|
||||
{
|
||||
fprintf(stdout, fmt, s1, s2, s3);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
out_str_dec(fmt, str, n)
|
||||
const char *fmt, str[];
|
||||
int n;
|
||||
@ -753,14 +753,14 @@ out_str_dec(fmt, str, n)
|
||||
fprintf(stdout, fmt, str, n);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
outc(c)
|
||||
int c;
|
||||
{
|
||||
fputc(c, stdout);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
outn(str)
|
||||
const char *str;
|
||||
{
|
||||
@ -773,7 +773,7 @@ outn(str)
|
||||
* @param val The definition; may be NULL.
|
||||
* @return buf
|
||||
*/
|
||||
void
|
||||
void
|
||||
out_m4_define(const char *def, const char *val)
|
||||
{
|
||||
const char *fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n";
|
||||
@ -853,7 +853,7 @@ reallocate_array(array, size, element_size)
|
||||
* Copies skelfile or skel array to stdout until a line beginning with
|
||||
* "%%" or EOF is found.
|
||||
*/
|
||||
void
|
||||
void
|
||||
skelout()
|
||||
{
|
||||
char buf_storage[MAXLINE];
|
||||
@ -968,7 +968,7 @@ skelout()
|
||||
* element_n. Formats the output with spaces and carriage returns.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
transition_struct_out(element_v, element_n)
|
||||
int element_v, element_n;
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ void mkxtion PROTO((int, int));
|
||||
* accepting_number becomes mach's accepting number.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
add_accept(mach, accepting_number)
|
||||
int mach, accepting_number;
|
||||
{
|
||||
@ -81,7 +81,7 @@ add_accept(mach, accepting_number)
|
||||
* num - the number of copies of singl to be present in newsng
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
copysingl(singl, num)
|
||||
int singl, num;
|
||||
{
|
||||
@ -98,7 +98,7 @@ copysingl(singl, num)
|
||||
|
||||
/* dumpnfa - debugging routine to write out an nfa */
|
||||
|
||||
void
|
||||
void
|
||||
dumpnfa(state1)
|
||||
int state1;
|
||||
|
||||
@ -155,7 +155,7 @@ dumpnfa(state1)
|
||||
* states accessible by the arrays firstst and lastst
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
dupmachine(mach)
|
||||
int mach;
|
||||
{
|
||||
@ -203,7 +203,7 @@ dupmachine(mach)
|
||||
* context has variable length.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
finish_rule(mach, variable_trail_rule, headcnt, trailcnt,
|
||||
pcont_act)
|
||||
int mach, variable_trail_rule, headcnt, trailcnt, pcont_act;
|
||||
@ -318,7 +318,7 @@ finish_rule(mach, variable_trail_rule, headcnt, trailcnt,
|
||||
* FIRST is set to new by the operation. last is unmolested.
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
link_machines(first, last)
|
||||
int first, last;
|
||||
{
|
||||
@ -346,7 +346,7 @@ link_machines(first, last)
|
||||
* The "beginning" states are the epsilon closure of the first state
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
mark_beginning_as_normal(mach)
|
||||
int mach;
|
||||
{
|
||||
@ -389,7 +389,7 @@ mark_beginning_as_normal(mach)
|
||||
* more mkbranch's. Compare with mkor()
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkbranch(first, second)
|
||||
int first, second;
|
||||
{
|
||||
@ -418,7 +418,7 @@ mkbranch(first, second)
|
||||
* new - a new state which matches the closure of "state"
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkclos(state)
|
||||
int state;
|
||||
{
|
||||
@ -440,7 +440,7 @@ mkclos(state)
|
||||
* 2. mach is destroyed by the call
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkopt(mach)
|
||||
int mach;
|
||||
{
|
||||
@ -478,7 +478,7 @@ mkopt(mach)
|
||||
* the number of epsilon states needed
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkor(first, second)
|
||||
int first, second;
|
||||
{
|
||||
@ -533,7 +533,7 @@ mkor(first, second)
|
||||
* new - a machine matching the positive closure of "state"
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkposcl(state)
|
||||
int state;
|
||||
{
|
||||
@ -562,7 +562,7 @@ mkposcl(state)
|
||||
* if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach"
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkrep(mach, lb, ub)
|
||||
int mach, lb, ub;
|
||||
{
|
||||
@ -608,7 +608,7 @@ mkrep(mach, lb, ub)
|
||||
* that it admittedly is)
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
mkstate(sym)
|
||||
int sym;
|
||||
{
|
||||
@ -685,7 +685,7 @@ mkstate(sym)
|
||||
* stateto - the state to which the transition is to be made
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
mkxtion(statefrom, stateto)
|
||||
int statefrom, stateto;
|
||||
{
|
||||
@ -704,7 +704,7 @@ mkxtion(statefrom, stateto)
|
||||
|
||||
/* new_rule - initialize for a new rule */
|
||||
|
||||
void
|
||||
void
|
||||
new_rule()
|
||||
{
|
||||
if (++num_rules >= current_max_rules) {
|
||||
|
@ -76,7 +76,7 @@ optspec_t flexopts[] = {
|
||||
,
|
||||
{"--case-insensitive", OPT_CASE_INSENSITIVE, 0}
|
||||
, /* Generate case-insensitive scanner. */
|
||||
|
||||
|
||||
{"-C[aefFmr]", OPT_COMPRESSION,
|
||||
"Specify degree of table compression (default is -Cem)"},
|
||||
{"-+", OPT_CPLUSPLUS, 0}
|
||||
|
@ -32,7 +32,7 @@
|
||||
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
|
||||
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
||||
/* PURPOSE. */
|
||||
|
||||
|
||||
#ifndef OPTIONS_H
|
||||
#define OPTIONS_H
|
||||
#include "scanopt.h"
|
||||
|
@ -291,7 +291,7 @@ flexrule : '^' rule
|
||||
{
|
||||
if ( scon_stk_ptr > 0 )
|
||||
build_eof_action();
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
/* This EOF applies to all start conditions
|
||||
@ -422,7 +422,7 @@ rule : re2 re
|
||||
num_rules | YY_TRAILING_HEAD_MASK );
|
||||
variable_trail_rule = true;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
trailcnt = rulelen;
|
||||
|
||||
@ -774,7 +774,7 @@ fullccl:
|
||||
| braceccl
|
||||
;
|
||||
|
||||
braceccl:
|
||||
braceccl:
|
||||
|
||||
'[' ccl ']' { $$ = $2; }
|
||||
|
||||
@ -832,7 +832,7 @@ ccl : ccl CHAR '-' CHAR
|
||||
if (sf_case_ins() && has_case($2) && has_case($4)){
|
||||
$2 = reverse_case ($2);
|
||||
$4 = reverse_case ($4);
|
||||
|
||||
|
||||
for ( i = $2; i <= $4; ++i )
|
||||
ccladd( $1, i );
|
||||
|
||||
@ -878,14 +878,14 @@ ccl : ccl CHAR '-' CHAR
|
||||
}
|
||||
;
|
||||
|
||||
ccl_expr:
|
||||
ccl_expr:
|
||||
CCE_ALNUM { CCL_EXPR(isalnum); }
|
||||
| CCE_ALPHA { CCL_EXPR(isalpha); }
|
||||
| CCE_BLANK { CCL_EXPR(isblank); }
|
||||
| CCE_CNTRL { CCL_EXPR(iscntrl); }
|
||||
| CCE_DIGIT { CCL_EXPR(isdigit); }
|
||||
| CCE_GRAPH { CCL_EXPR(isgraph); }
|
||||
| CCE_LOWER {
|
||||
| CCE_LOWER {
|
||||
CCL_EXPR(islower);
|
||||
if (sf_case_ins())
|
||||
CCL_EXPR(isupper);
|
||||
@ -910,7 +910,7 @@ ccl_expr:
|
||||
| CCE_NEG_PUNCT { CCL_NEG_EXPR(ispunct); }
|
||||
| CCE_NEG_SPACE { CCL_NEG_EXPR(isspace); }
|
||||
| CCE_NEG_XDIGIT { CCL_NEG_EXPR(isxdigit); }
|
||||
| CCE_NEG_LOWER {
|
||||
| CCE_NEG_LOWER {
|
||||
if ( sf_case_ins() )
|
||||
warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
|
||||
else
|
||||
@ -923,7 +923,7 @@ ccl_expr:
|
||||
CCL_NEG_EXPR(isupper);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
string : string CHAR
|
||||
{
|
||||
if ( $2 == nlch )
|
||||
|
@ -225,7 +225,7 @@ M4QEND "]]"
|
||||
<EXTENDED_COMMENT>{
|
||||
")" yy_pop_state();
|
||||
[^\n\)]+ ;
|
||||
{NL} ++linenum;
|
||||
{NL} ++linenum;
|
||||
}
|
||||
|
||||
<LINEDIR>{
|
||||
@ -725,7 +725,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
|
||||
if (lex_compat || posix_compat){
|
||||
/* Push back the "?#" and treat it like a normal parens. */
|
||||
yyless(1);
|
||||
sf_push();
|
||||
sf_push();
|
||||
return '(';
|
||||
}
|
||||
else
|
||||
|
@ -586,7 +586,7 @@ static int scanopt_err (s, opt_offset, is_short, err)
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Internal. Match str against the regex ^--([^=]+)(=(.*))?
|
||||
* return 1 if *looks* like a long option.
|
||||
@ -634,7 +634,7 @@ static int matchlongopt (str, optname, optlen, arg, arglen)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Internal. Look up long or short option by name.
|
||||
* Long options must match a non-ambiguous prefix, or exact match.
|
||||
@ -704,7 +704,7 @@ static int find_opt (s, lookup_long, optstart, len, err_code, opt_offset)
|
||||
|
||||
return *err_code ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int scanopt (svoid, arg, optindex)
|
||||
scanopt_t *svoid;
|
||||
|
@ -32,7 +32,7 @@
|
||||
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
|
||||
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
||||
/* PURPOSE. */
|
||||
|
||||
|
||||
#ifndef SCANOPT_H
|
||||
#define SCANOPT_H
|
||||
|
||||
@ -77,7 +77,7 @@ extern "C" {
|
||||
/* Used internally by scanopt() to maintain state. */
|
||||
/* Never modify these value directly. */
|
||||
typedef void *scanopt_t;
|
||||
|
||||
|
||||
|
||||
/* Initializes scanner and checks option list for errors.
|
||||
* Parameters:
|
||||
|
@ -33,14 +33,14 @@
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "flexdef.h"
|
||||
#include "tables.h"
|
||||
|
||||
/** Convert size_t to t_flag.
|
||||
* @param n in {1,2,4}
|
||||
* @return YYTD_DATA*.
|
||||
* @return YYTD_DATA*.
|
||||
*/
|
||||
#define BYTES2TFLAG(n)\
|
||||
(((n) == sizeof(flex_int8_t))\
|
||||
@ -329,7 +329,7 @@ int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v)
|
||||
|
||||
/** Extract data element [i] from array data tables treated as a single flat array of integers.
|
||||
* Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
|
||||
* of structs.
|
||||
* of structs.
|
||||
* @param tbl data table
|
||||
* @param i index into array.
|
||||
* @return data[i]
|
||||
@ -353,7 +353,7 @@ static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i)
|
||||
|
||||
/** Set data element [i] in array data tables treated as a single flat array of integers.
|
||||
* Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
|
||||
* of structs.
|
||||
* of structs.
|
||||
* @param tbl data table
|
||||
* @param i index into array.
|
||||
* @param newval new value for data[i]
|
||||
|
@ -33,7 +33,7 @@
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TABLES_H
|
||||
#define TABLES_H
|
||||
|
||||
|
@ -3,42 +3,42 @@
|
||||
#ifdef FLEX_SCANNER
|
||||
/*
|
||||
dnl tables_shared.c - tables serialization code
|
||||
dnl
|
||||
dnl
|
||||
dnl Copyright (c) 1990 The Regents of the University of California.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl
|
||||
dnl This code is derived from software contributed to Berkeley by
|
||||
dnl Vern Paxson.
|
||||
dnl
|
||||
dnl
|
||||
dnl The United States Government has rights in this work pursuant
|
||||
dnl to contract no. DE-AC03-76SF00098 between the United States
|
||||
dnl Department of Energy and the University of California.
|
||||
dnl
|
||||
dnl
|
||||
dnl This file is part of flex.
|
||||
dnl
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl
|
||||
dnl
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl
|
||||
dnl
|
||||
dnl Neither the name of the University nor the names of its contributors
|
||||
dnl may be used to endorse or promote products derived from this software
|
||||
dnl without specific prior written permission.
|
||||
dnl
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
dnl PURPOSE.
|
||||
dnl
|
||||
dnl
|
||||
*/
|
||||
|
||||
|
||||
/* This file is meant to be included in both the skeleton and the actual
|
||||
* flex code (hence the name "_shared").
|
||||
* flex code (hence the name "_shared").
|
||||
*/
|
||||
#ifndef yyskel_static
|
||||
#define yyskel_static static
|
||||
@ -54,7 +54,7 @@ dnl
|
||||
|
||||
/** Get the number of integers in this table. This is NOT the
|
||||
* same thing as the number of elements.
|
||||
* @param td the table
|
||||
* @param td the table
|
||||
* @return the number of integers in the table
|
||||
*/
|
||||
yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
|
||||
|
@ -34,7 +34,7 @@ dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
dnl PURPOSE.
|
||||
|
||||
|
||||
dnl
|
||||
dnl This file is meant to be included in both the skeleton and the actual
|
||||
dnl flex code (hence the name "_shared").
|
||||
|
@ -80,7 +80,7 @@ int tbldiff PROTO((int[], int, int[]));
|
||||
* cost only one difference.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
bldtbl(state, statenum, totaltrans, comstate, comfreq)
|
||||
int state[], statenum, totaltrans, comstate, comfreq;
|
||||
{
|
||||
@ -230,7 +230,7 @@ bldtbl(state, statenum, totaltrans, comstate, comfreq)
|
||||
* classes.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
cmptmps()
|
||||
{
|
||||
int tmpstorage[CSIZE + 1];
|
||||
@ -298,7 +298,7 @@ cmptmps()
|
||||
|
||||
/* expand_nxt_chk - expand the next check arrays */
|
||||
|
||||
void
|
||||
void
|
||||
expand_nxt_chk()
|
||||
{
|
||||
int old_max = current_max_xpairs;
|
||||
@ -333,7 +333,7 @@ expand_nxt_chk()
|
||||
* and an action number will be added in [-1].
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
find_table_space(state, numtrans)
|
||||
int *state, numtrans;
|
||||
{
|
||||
@ -434,7 +434,7 @@ find_table_space(state, numtrans)
|
||||
* Initializes "firstfree" to be one beyond the end of the table. Initializes
|
||||
* all "chk" entries to be zero.
|
||||
*/
|
||||
void
|
||||
void
|
||||
inittbl()
|
||||
{
|
||||
int i;
|
||||
@ -466,7 +466,7 @@ inittbl()
|
||||
|
||||
/* mkdeftbl - make the default, "jam" table entries */
|
||||
|
||||
void
|
||||
void
|
||||
mkdeftbl()
|
||||
{
|
||||
int i;
|
||||
@ -517,7 +517,7 @@ mkdeftbl()
|
||||
* state array.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
mkentry(state, numchars, statenum, deflink, totaltrans)
|
||||
int *state;
|
||||
int numchars, statenum, deflink, totaltrans;
|
||||
@ -635,7 +635,7 @@ mkentry(state, numchars, statenum, deflink, totaltrans)
|
||||
* has only one out-transition
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
mk1tbl(state, sym, onenxt, onedef)
|
||||
int state, sym, onenxt, onedef;
|
||||
{
|
||||
@ -662,7 +662,7 @@ mk1tbl(state, sym, onenxt, onedef)
|
||||
|
||||
/* mkprot - create new proto entry */
|
||||
|
||||
void
|
||||
void
|
||||
mkprot(state, statenum, comstate)
|
||||
int state[], statenum, comstate;
|
||||
{
|
||||
@ -700,7 +700,7 @@ mkprot(state, statenum, comstate)
|
||||
* to it
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
mktemplate(state, statenum, comstate)
|
||||
int state[], statenum, comstate;
|
||||
{
|
||||
@ -754,7 +754,7 @@ mktemplate(state, statenum, comstate)
|
||||
|
||||
/* mv2front - move proto queue element to front of queue */
|
||||
|
||||
void
|
||||
void
|
||||
mv2front(qelm)
|
||||
int qelm;
|
||||
{
|
||||
@ -782,7 +782,7 @@ mv2front(qelm)
|
||||
* Transnum is the number of out-transitions for the state.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
place_state(state, statenum, transnum)
|
||||
int *state, statenum, transnum;
|
||||
{
|
||||
@ -827,7 +827,7 @@ place_state(state, statenum, transnum)
|
||||
* no room, we process the sucker right now.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
stack1(statenum, sym, nextstate, deflink)
|
||||
int statenum, sym, nextstate, deflink;
|
||||
{
|
||||
@ -858,7 +858,7 @@ stack1(statenum, sym, nextstate, deflink)
|
||||
* number is "numecs" minus the number of "SAME_TRANS" entries in "ext".
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
tbldiff(state, pr, ext)
|
||||
int state[], pr, ext[];
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ sub get_symbollist($self, $filepath, $regex, $objlist)
|
||||
tsay {"generating symbol list in file: $filepath"};
|
||||
tsay {"object list is @$objlist" };
|
||||
my $symbols = LT::UList->new;
|
||||
open(my $sh, '-|', 'nm', '--', @$objlist) or
|
||||
open(my $sh, '-|', 'nm', '--', @$objlist) or
|
||||
die "Error running nm on object list @$objlist\n";
|
||||
my $c = 0;
|
||||
while (my $line = <$sh>) {
|
||||
|
@ -59,7 +59,7 @@ sub chdir($self, $dir)
|
||||
|
||||
sub compile($self, @l)
|
||||
{
|
||||
$self->command("compile", @l);
|
||||
$self->command("compile", @l);
|
||||
}
|
||||
|
||||
sub execute($self, @l)
|
||||
@ -125,7 +125,7 @@ sub command($self, $mode, @l)
|
||||
if ($mode eq "compile"){
|
||||
say "@l" if $verbose || $dry;
|
||||
} else {
|
||||
say "libtool: $mode: @l" if $verbose || $dry;
|
||||
say "libtool: $mode: @l" if $verbose || $dry;
|
||||
}
|
||||
if (!$dry) {
|
||||
$self->command_run(@l);
|
||||
|
@ -154,7 +154,7 @@ sub new($class, $string, $code)
|
||||
my @alternates = split(/\|/, $string);
|
||||
|
||||
bless {
|
||||
alt => [map { Option->factory($_); } @alternates],
|
||||
alt => [map { Option->factory($_); } @alternates],
|
||||
code => $code
|
||||
}, $class;
|
||||
}
|
||||
@ -190,7 +190,7 @@ sub add_option_accessor($self, $option, $isarray)
|
||||
my $access = $option;
|
||||
$access =~ s/^\-//;
|
||||
$access =~ s/-/_/g;
|
||||
my $actual = $isarray ?
|
||||
my $actual = $isarray ?
|
||||
sub($self) {
|
||||
$self->{opt}{$option} //= [];
|
||||
if (wantarray) {
|
||||
@ -232,7 +232,7 @@ sub create_options($self, @l)
|
||||
};
|
||||
}
|
||||
}
|
||||
push(@options,
|
||||
push(@options,
|
||||
Options->new($opt, $code)->setup($self, $isarray));
|
||||
}
|
||||
return @options;
|
||||
|
@ -55,11 +55,11 @@ sub run($class, $ltprog, $gp, $ltconfig)
|
||||
my @pie_flags = ();
|
||||
|
||||
$gp->handle_permuted_options('o:!@',
|
||||
qr{\-Wc\,(.*)},
|
||||
sub {
|
||||
qr{\-Wc\,(.*)},
|
||||
sub {
|
||||
$gp->keep_for_later(split(/\,/, shift));
|
||||
},
|
||||
'Xcompiler:',
|
||||
'Xcompiler:',
|
||||
sub {
|
||||
$gp->keep_for_later($_[2]);
|
||||
},
|
||||
@ -70,12 +70,12 @@ sub run($class, $ltprog, $gp, $ltconfig)
|
||||
'no-suppress', # we just ignore that one
|
||||
'prefer-pic', sub { $pic_mode = 1; },
|
||||
'prefer-non-pic', sub { $pic_mode = 0; },
|
||||
'static',
|
||||
sub {
|
||||
$pic = 0;
|
||||
'static',
|
||||
sub {
|
||||
$pic = 0;
|
||||
$nonpic = 1;
|
||||
},
|
||||
'shared',
|
||||
'shared',
|
||||
sub {
|
||||
if (!$pic) {
|
||||
shortdie "bad configuration: can't build shared library";
|
||||
|
@ -535,7 +535,7 @@ sub find_first_lib($self, $lib, $dirs, $gp)
|
||||
# -Lfoo, -lfoo, foo.a, foo.la
|
||||
# recursively find .la files corresponding to -l flags; if there is no .la
|
||||
# file, just inspect the library file itself for any dependencies.
|
||||
sub internal_parse_linkargs1($self, $deplibs, $gp, $dirs, $libs, $args,
|
||||
sub internal_parse_linkargs1($self, $deplibs, $gp, $dirs, $libs, $args,
|
||||
$level = 0)
|
||||
{
|
||||
tsay {"parse_linkargs1, level: $level"};
|
||||
@ -791,7 +791,7 @@ sub common1($self, $parser, $gp, $deplibs, $libdirs, $dirs, $libs)
|
||||
$parser->resolve_la($deplibs, $libdirs);
|
||||
my $orderedlibs = LT::UList->new;
|
||||
my $staticlibs = [];
|
||||
my $args = $parser->parse_linkargs2($gp, $orderedlibs, $staticlibs,
|
||||
my $args = $parser->parse_linkargs2($gp, $orderedlibs, $staticlibs,
|
||||
$dirs, $libs);
|
||||
|
||||
my $tiedlibs = tied(@$orderedlibs);
|
||||
|
@ -35,7 +35,7 @@ use File::Basename;
|
||||
|
||||
sub link
|
||||
{
|
||||
my ($linker, $self, $ltprog, $ltconfig, $la, $fname, $odir, $shared,
|
||||
my ($linker, $self, $ltprog, $ltconfig, $la, $fname, $odir, $shared,
|
||||
$objs, $dirs, $libs, $deplibs, $libdirs, $parser, $gp) = @_;
|
||||
|
||||
tsay {"creating link command for library (linked ",
|
||||
@ -176,7 +176,7 @@ sub link
|
||||
if @$staticlibs;
|
||||
push @cmd, "-L$symlinkdir", @libflags if @libflags;
|
||||
|
||||
my @e = $linker->export_symbols($ltconfig,
|
||||
my @e = $linker->export_symbols($ltconfig,
|
||||
"$odir/$ltdir/$la", $gp, @$objs, @$staticlibs);
|
||||
push(@cmd, join(',', "-Wl", @e)) if @e;
|
||||
push @cmd, join(',', "-Wl", @linkeropts) if @linkeropts;
|
||||
|
@ -37,7 +37,7 @@ use File::Basename;
|
||||
|
||||
sub link
|
||||
{
|
||||
my ($linker, $self, $ltprog, $ltconfig, $dirs, $libs, $deplibs,
|
||||
my ($linker, $self, $ltprog, $ltconfig, $dirs, $libs, $deplibs,
|
||||
$libdirs, $parser, $gp) = @_;
|
||||
|
||||
tsay {"linking program (", ($gp->static ? "not " : ""),
|
||||
@ -81,7 +81,7 @@ sub link
|
||||
tprint {"key = $k - "};
|
||||
my $r = ref($libs->{$k});
|
||||
tsay {"ref = $r"};
|
||||
$libs->create($k)->resolve_library($dirs, 1, $gp->static,
|
||||
$libs->create($k)->resolve_library($dirs, 1, $gp->static,
|
||||
ref($self));
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ sub link
|
||||
}
|
||||
}
|
||||
|
||||
push(@linkeropts, $linker->export_symbols($ltconfig,
|
||||
push(@linkeropts, $linker->export_symbols($ltconfig,
|
||||
"$odir/$ltdir/$fname", $gp, @{$self->{objlist}}, @$staticlibs));
|
||||
|
||||
@cmd = @$ltprog;
|
||||
|
@ -63,27 +63,27 @@ sub TIEARRAY($class, @p)
|
||||
# presence of particular item, call the method below on the reference
|
||||
# returned by tie() or tied() instead.
|
||||
sub exists($self, $key)
|
||||
{
|
||||
return exists $self->[0]{$key};
|
||||
{
|
||||
return exists $self->[0]{$key};
|
||||
}
|
||||
|
||||
sub indexof($self, $key)
|
||||
{
|
||||
return exists($self->[0]{$key}) ? ($self->[0]{$key} - 1) : undef;
|
||||
{
|
||||
return exists($self->[0]{$key}) ? ($self->[0]{$key} - 1) : undef;
|
||||
}
|
||||
|
||||
sub FETCHSIZE($self)
|
||||
{
|
||||
return scalar(@$self) - 1;
|
||||
{
|
||||
return scalar(@$self) - 1;
|
||||
}
|
||||
|
||||
sub STORE($, $, $)
|
||||
{
|
||||
{
|
||||
die "overwriting elements is unimplemented";
|
||||
}
|
||||
|
||||
sub DELETE($, $)
|
||||
{
|
||||
{
|
||||
die "delete is unimplemented";
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
.include <bsd.own.mk>
|
||||
|
||||
MAN=libtool.1
|
||||
NOPROG=
|
||||
NOPROG=
|
||||
|
||||
PACKAGES= \
|
||||
LT/Archive.pm \
|
||||
@ -25,7 +25,7 @@ PACKAGES= \
|
||||
|
||||
LIBBASE=/usr/libdata/perl5
|
||||
|
||||
realinstall:
|
||||
realinstall:
|
||||
.for d in LT LT/Mode LT/Mode/Link
|
||||
${INSTALL} -d -o ${LIBOWN} -g ${LIBGRP} -m ${DIRMODE} \
|
||||
${DESTDIR}${LIBBASE}/$d
|
||||
|
@ -124,7 +124,7 @@ sub load_subclass
|
||||
}
|
||||
}
|
||||
|
||||
my $mode_maker = { compile => 'LT::Mode::Compile',
|
||||
my $mode_maker = { compile => 'LT::Mode::Compile',
|
||||
clean => 'LT::Mode::Clean',
|
||||
execute => 'LT::Mode::Execute',
|
||||
finish => 'LT::Mode::Finish',
|
||||
@ -239,9 +239,9 @@ sub add_tag
|
||||
{
|
||||
my ($self, $value) = @_;
|
||||
if ($value =~ m/[^\-\w,\/]/) {
|
||||
shortdie "invalid tag name: $value";
|
||||
shortdie "invalid tag name: $value";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
if (grep {$value eq $_} @known_tags) {
|
||||
$self->{tags}{$value} = 1;
|
||||
} else {
|
||||
@ -321,8 +321,8 @@ unless ($ARGV[0] eq 'install' && $ARGV[1] =~ m/^-[bcCdpSsBfgmo]/) {
|
||||
my $gp = LT::Options->new;
|
||||
$gp->handle_options(
|
||||
'-config' => \&config,
|
||||
'-debug|x' => sub {
|
||||
LT::Trace->set(1);
|
||||
'-debug|x' => sub {
|
||||
LT::Trace->set(1);
|
||||
LT::Exec->verbose_run;
|
||||
},
|
||||
'-dry-run|-dryrun|n' => sub { LT::Exec->dry_run; },
|
||||
@ -341,7 +341,7 @@ $gp->handle_options(
|
||||
'-quiet|-silent|-no-verbose' => sub { $verbose = 0; },
|
||||
'-verbose|-no-silent|-no-quiet|v' => sub {$verbose = 1;},
|
||||
'-tag=' => sub { $gp->add_tag($_[2]); },
|
||||
'-version' => sub {
|
||||
'-version' => sub {
|
||||
say "libtool (not (GNU libtool)) ", $ltconfig->version;
|
||||
exit 0;
|
||||
},
|
||||
|
@ -53,7 +53,7 @@ sortopt="-u -T $TMPDIR"
|
||||
sortcmd="$sort"
|
||||
|
||||
# Input already sorted
|
||||
case X"$1" in
|
||||
case X"$1" in
|
||||
X-nosort|X-presort) sortcmd=cat; sortopt=;shift;;
|
||||
esac
|
||||
|
||||
|
@ -100,14 +100,14 @@ and
|
||||
.UC GCOS .
|
||||
Its primary use has been as a
|
||||
front end for Ratfor for those
|
||||
cases where parameterless macros
|
||||
cases where parameterless macros
|
||||
are not adequately powerful.
|
||||
It has also been used for languages as disparate as C and Cobol.
|
||||
M4 is particularly suited for functional languages like Fortran, PL/I and C
|
||||
since macros are specified in a functional notation.
|
||||
.PP
|
||||
M4 provides features seldom found even in much larger
|
||||
macro processors,
|
||||
macro processors,
|
||||
including
|
||||
.IP " \(bu"
|
||||
arguments
|
||||
@ -259,7 +259,7 @@ define(N, 100)
|
||||
...
|
||||
if (NNN > 100)
|
||||
.P2
|
||||
the variable
|
||||
the variable
|
||||
.UL NNN
|
||||
is absolutely unrelated to the defined macro
|
||||
.UL N ,
|
||||
@ -278,7 +278,7 @@ What happens if
|
||||
.UL N
|
||||
is redefined?
|
||||
Or, to say it another way, is
|
||||
.UL M
|
||||
.UL M
|
||||
defined as
|
||||
.UL N
|
||||
or as 100?
|
||||
@ -286,7 +286,7 @@ In M4,
|
||||
the latter is true _
|
||||
.UL M
|
||||
is 100, so even if
|
||||
.UL N
|
||||
.UL N
|
||||
subsequently changes,
|
||||
.UL M
|
||||
does not.
|
||||
@ -315,10 +315,10 @@ Now
|
||||
.UL M
|
||||
is defined to be the string
|
||||
.UL N ,
|
||||
so when you ask for
|
||||
so when you ask for
|
||||
.UL M
|
||||
later, you'll always get the value of
|
||||
.UL N
|
||||
.UL N
|
||||
at that time
|
||||
(because the
|
||||
.UL M
|
||||
@ -330,7 +330,7 @@ Quoting
|
||||
.PP
|
||||
The more general solution is to delay the expansion of
|
||||
the arguments of
|
||||
.UL define
|
||||
.UL define
|
||||
by
|
||||
.ul
|
||||
quoting
|
||||
@ -345,7 +345,7 @@ define(M, `N')
|
||||
the quotes around the
|
||||
.UL N
|
||||
are stripped off as the argument is being collected,
|
||||
but they have served their purpose, and
|
||||
but they have served their purpose, and
|
||||
.UL M
|
||||
is defined as
|
||||
the string
|
||||
@ -385,7 +385,7 @@ define(100, 200)
|
||||
.P2
|
||||
This statement is ignored by M4, since you can only define things that look
|
||||
like names, but it obviously doesn't have the effect you wanted.
|
||||
To really redefine
|
||||
To really redefine
|
||||
.UL N ,
|
||||
you must delay the evaluation by quoting:
|
||||
.P1
|
||||
@ -418,7 +418,7 @@ undefine(`N')
|
||||
removes the definition of
|
||||
.UL N .
|
||||
(Why are the quotes absolutely necessary?)
|
||||
Built-ins can be removed with
|
||||
Built-ins can be removed with
|
||||
.UL undefine ,
|
||||
as in
|
||||
.P1
|
||||
@ -426,7 +426,7 @@ undefine(`define')
|
||||
.P2
|
||||
but once you remove one, you can never get it back.
|
||||
.PP
|
||||
The built-in
|
||||
The built-in
|
||||
.UL ifdef
|
||||
provides a way to determine if a macro is currently defined.
|
||||
In particular, M4 has pre-defined the names
|
||||
@ -462,7 +462,7 @@ Within the replacement text for a macro
|
||||
.UL define )
|
||||
any occurrence of
|
||||
.UL $n
|
||||
will be replaced by the
|
||||
will be replaced by the
|
||||
.UL n th
|
||||
argument when the macro
|
||||
is actually used.
|
||||
@ -586,13 +586,13 @@ is
|
||||
and 36 bits on
|
||||
.UC GCOS .
|
||||
.PP
|
||||
As a simple example, suppose we want
|
||||
As a simple example, suppose we want
|
||||
.UL M
|
||||
to be
|
||||
to be
|
||||
.UL 2**N+1 .
|
||||
Then
|
||||
.P1
|
||||
define(N, 3)
|
||||
define(N, 3)
|
||||
define(M, `eval(2**N+1)')
|
||||
.P2
|
||||
As a matter of principle, it is advisable
|
||||
@ -629,7 +629,7 @@ cannot be accessed.
|
||||
To get some control over this situation, the alternate form
|
||||
.UL sinclude
|
||||
can be used;
|
||||
.UL sinclude
|
||||
.UL sinclude
|
||||
(``silent include'')
|
||||
says nothing and continues if it can't access the file.
|
||||
.PP
|
||||
@ -643,8 +643,8 @@ divert(n)
|
||||
all subsequent output is put onto the end of a temporary file
|
||||
referred to as
|
||||
.UL n .
|
||||
Diverting to this file is stopped by another
|
||||
.UL divert
|
||||
Diverting to this file is stopped by another
|
||||
.UL divert
|
||||
command;
|
||||
in particular,
|
||||
.UL divert
|
||||
@ -666,7 +666,7 @@ brings back all diversions in numeric order, and
|
||||
with arguments brings back the selected diversions
|
||||
in the order given.
|
||||
The act of undiverting discards the diverted stuff,
|
||||
as does diverting into a diversion
|
||||
as does diverting into a diversion
|
||||
whose number is not between 0 and 9 inclusive.
|
||||
.PP
|
||||
The value of
|
||||
@ -727,7 +727,7 @@ compares the two strings
|
||||
.UL a
|
||||
and
|
||||
.UL b .
|
||||
If these are identical,
|
||||
If these are identical,
|
||||
.UL ifelse
|
||||
returns
|
||||
the string
|
||||
@ -776,7 +776,7 @@ ifelse(a, b, c)
|
||||
.P2
|
||||
is
|
||||
.UL c
|
||||
if
|
||||
if
|
||||
.UL a
|
||||
matches
|
||||
.UL b ,
|
||||
@ -808,7 +808,7 @@ position
|
||||
and is
|
||||
.UL n
|
||||
characters long.
|
||||
If
|
||||
If
|
||||
.UL n
|
||||
is omitted, the rest of the string is returned,
|
||||
so
|
||||
@ -819,7 +819,7 @@ is
|
||||
.P1
|
||||
ow is the time
|
||||
.P2
|
||||
If
|
||||
If
|
||||
.UL i
|
||||
or
|
||||
.UL n
|
||||
@ -863,22 +863,22 @@ are deleted; as a limiting case,
|
||||
if
|
||||
.UL t
|
||||
is not present at all,
|
||||
characters from
|
||||
characters from
|
||||
.UL f
|
||||
are deleted from
|
||||
are deleted from
|
||||
.UL s .
|
||||
So
|
||||
.P1
|
||||
translit(s, aeiou)
|
||||
.P2
|
||||
deletes vowels from
|
||||
deletes vowels from
|
||||
.UL s .
|
||||
.PP
|
||||
There is also a built-in called
|
||||
.UL dnl
|
||||
which deletes all characters that follow it up to
|
||||
and including the next newline;
|
||||
it is useful mainly for throwing away
|
||||
it is useful mainly for throwing away
|
||||
empty lines that otherwise tend to clutter up M4 output.
|
||||
For example, if you say
|
||||
.P1
|
||||
|
@ -34,7 +34,7 @@
|
||||
# @(#)sqroot.m4 8.1 (Berkeley) 6/6/93
|
||||
#
|
||||
|
||||
define(square_root,
|
||||
define(square_root,
|
||||
`ifelse(eval($1<0),1,negative-square-root,
|
||||
`square_root_aux($1, 1, eval(($1+1)/2))')')
|
||||
define(square_root_aux,
|
||||
|
@ -81,7 +81,7 @@ divert(0)
|
||||
define(abc,xxx)
|
||||
ifdef(`abc',defined,undefined)
|
||||
#
|
||||
# v7 m4 does this wrong. The right output is
|
||||
# v7 m4 does this wrong. The right output is
|
||||
# this is A vEry lon sEntEnCE
|
||||
# see m4 documentation for translit.
|
||||
#
|
||||
@ -118,7 +118,7 @@ square_root(21372)
|
||||
#
|
||||
[taken from the 'Clemson University Computer Newsletter',
|
||||
September 1981, pp. 6-7]
|
||||
|
||||
|
||||
I am a wizard in the magical Kingdom of Transformation and I
|
||||
slay dragons for a living. Actually, I am a systems programmer.
|
||||
One of the problems with systems programming is explaining to
|
||||
@ -127,7 +127,7 @@ describe my job are totally meaningless to them. Usually my response
|
||||
to questions about my work is to say as little as possible. For
|
||||
instance, if someone asks what happened at work this week, I say
|
||||
"Nothing much" and then I change the subject.
|
||||
|
||||
|
||||
With the assistance of my brother, a mechanical engineer, I have devised
|
||||
an analogy that everyone can understand. The analogy describes the
|
||||
"Kingdom of Transformation" where travelers wander and are magically
|
||||
@ -136,7 +136,7 @@ The purpose of the computer is to change information to a more meaningful
|
||||
forma. The law of conservation applies here: The computer never creates
|
||||
and never intentionally destroys data. With no further ado, let us travel
|
||||
to the Kingdom of Transformation:
|
||||
|
||||
|
||||
In a land far, far away, there is a magical kingdom called the Kingdom of
|
||||
Transformation. A king rules over this land and employs a Council of
|
||||
Wizardry. The main purpose of this kingdom is to provide a way for
|
||||
@ -145,39 +145,39 @@ is done by allowing the citizens to enter the kingdom at one of its ports
|
||||
and to travel any of the many routes in the kingdom. They are magically
|
||||
transformed along the way. The income of the Kingdom of Transformation
|
||||
comes from the many toll roads within its boundaries.
|
||||
|
||||
|
||||
The Kingdom of Transformation was created when several kingdoms got
|
||||
together and discovered a mutual need for new talents and abilities for
|
||||
citizens. They employed CTK, Inc. (Creators of Transformation, Inc.) to
|
||||
create this kingdom. CTK designed the country, its transportation routes,
|
||||
and its laws of transformation, and created the major highway system.
|
||||
|
||||
|
||||
Hazards
|
||||
=======
|
||||
|
||||
|
||||
Because magic is not truly controllable, CTK invariably, but unknowingly,
|
||||
creates dragons. Dragons are huge fire-breathing beasts which sometimes
|
||||
injure or kill travelers. Fortunately, they do not travel, but always
|
||||
remain near their den.
|
||||
|
||||
|
||||
Other hazards also exist which are potentially harmful. As the roads
|
||||
become older and more weatherbeaten, pot-holes will develop, trees will
|
||||
fall on travelers, etc. CTK maintenance men are called to fix these
|
||||
problems.
|
||||
|
||||
|
||||
Wizards
|
||||
=======
|
||||
|
||||
|
||||
The wizards play a major role in creating and maintaining the kingdom but
|
||||
get little credit for their work because it is performed secretly. The
|
||||
wizards do not wan the workers or travelers to learn their incantations
|
||||
because many laws would be broken and chaos would result.
|
||||
|
||||
|
||||
CTK's grand design is always general enough to be applicable in many
|
||||
different situations. As a result, it is often difficult to use. The
|
||||
first duty of the wizards is to tailor the transformation laws so as to be
|
||||
more beneficial and easier to use in their particular environment.
|
||||
|
||||
|
||||
After creation of the kingdom, a major duty of the wizards is to search for
|
||||
and kill dragons. If travelers do not return on time or if they return
|
||||
injured, the ruler of the country contacts the wizards. If the wizards
|
||||
@ -187,7 +187,7 @@ If not, they must determine if the cause was a road hazard or a dragon. If
|
||||
the suspect a road hazard, they call in a CTK maintenance man to locate the
|
||||
hazard and to eliminate it, as in repairing the pothole in the road. If
|
||||
they think that cause was a dragon, then they must find and slay it.
|
||||
|
||||
|
||||
The most difficult part of eliminating a dragon is finding it. Sometimes
|
||||
the wizard magically knows where the dragon's lair it, but often the wizard
|
||||
must send another traveler along the same route and watch to see where he
|
||||
@ -195,26 +195,26 @@ disappears. This sounds like a failsafe method for finding dragons (and a
|
||||
suicide mission for thr traveler) but the second traveler does not always
|
||||
disappear. Some dragons eat any traveler who comes too close; others are
|
||||
very picky.
|
||||
|
||||
|
||||
The wizards may call in CTK who designed the highway system and
|
||||
transformation laws to help devise a way to locate the dragon. CTK also
|
||||
helps provide the right spell or incantation to slay the dragon. (There is
|
||||
no general spell to slay dragons; each dragon must be eliminated with a
|
||||
different spell.)
|
||||
|
||||
|
||||
Because neither CTK nor wizards are perfect, spells to not always work
|
||||
correctly. At best, nothing happens when the wrong spell is uttered. At
|
||||
worst, the dragon becomes a much larger dragon or multiplies into several
|
||||
smaller ones. In either case, new spells must be found.
|
||||
|
||||
|
||||
If all existing dragons are quiet (i.e. have eaten sufficiently), wizards
|
||||
have time to do other things. They hide in castles and practice spells and
|
||||
incantations. They also devise shortcuts for travelers and new laws of
|
||||
transformation.
|
||||
|
||||
|
||||
Changes in the Kingdom
|
||||
======================
|
||||
|
||||
|
||||
As new transformation kingdoms are created and old ones are maintained,
|
||||
CTK, Inc. is constantly learning new things. It learns ways to avoid
|
||||
creating some of the dragons that they have previously created. It also
|
||||
@ -224,7 +224,7 @@ The wizards determine when is a good time to implement this new design.
|
||||
This is when the tourist season is slow or when no important travelers
|
||||
(VIPs) are to arrive. The kingdom must be closed for the actual
|
||||
implementation and is leter reopened as a new and better place to go.
|
||||
|
||||
|
||||
A final question you might ask is what happens when the number of tourists
|
||||
becomes too great for the kingdom to handle in a reasonable period of time
|
||||
(i.e., the tourist lines at the ports are too long). The Kingdom of
|
||||
@ -232,7 +232,7 @@ Transformation has three options: (1) shorten the paths that a tourist must
|
||||
travel, or (2) convince CTK to develop a faster breed of horses so that the
|
||||
travelers can finish sooner, or (3) annex more territories so that the
|
||||
kingdom can handle more travelers.
|
||||
|
||||
|
||||
Thus ends the story of the Kingdom of Transformation. I hope this has
|
||||
explained my job to you: I slay dragons for a living.
|
||||
|
||||
|
@ -180,14 +180,14 @@ expand_builtin(const char *argv[], int argc, int td)
|
||||
if (argc > 3) {
|
||||
base = strtonum(argv[3], 2, 36, &errstr);
|
||||
if (errstr) {
|
||||
m4errx(1, "expr: base is %s: %s.",
|
||||
m4errx(1, "expr: base is %s: %s.",
|
||||
errstr, argv[3]);
|
||||
}
|
||||
}
|
||||
if (argc > 4) {
|
||||
maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr);
|
||||
if (errstr) {
|
||||
m4errx(1, "expr: maxdigits is %s: %s.",
|
||||
m4errx(1, "expr: maxdigits is %s: %s.",
|
||||
errstr, argv[4]);
|
||||
}
|
||||
}
|
||||
@ -299,7 +299,7 @@ expand_builtin(const char *argv[], int argc, int td)
|
||||
case PASTTYPE:
|
||||
if (argc > 2)
|
||||
if (!dopaste(argv[2]))
|
||||
err(1, "%s at line %lu: paste(%s)",
|
||||
err(1, "%s at line %lu: paste(%s)",
|
||||
CURRENT_NAME, CURRENT_LINE, argv[2]);
|
||||
break;
|
||||
|
||||
@ -351,7 +351,7 @@ expand_builtin(const char *argv[], int argc, int td)
|
||||
if (argc > 2) {
|
||||
n = strtonum(argv[2], INT_MIN, INT_MAX, &errstr);
|
||||
if (errstr)
|
||||
m4errx(1, "divert: argument is %s: %s.",
|
||||
m4errx(1, "divert: argument is %s: %s.",
|
||||
errstr, argv[2]);
|
||||
if (n != 0) {
|
||||
dodiv(n);
|
||||
@ -908,11 +908,11 @@ dosub(const char *argv[], int argc)
|
||||
* map every character of s1 that is specified in from
|
||||
* into s3 and replace in s. (source s1 remains untouched)
|
||||
*
|
||||
* This is derived from the a standard implementation of map(s,from,to)
|
||||
* function of ICON language. Within mapvec, we replace every character
|
||||
* of "from" with the corresponding character in "to".
|
||||
* If "to" is shorter than "from", than the corresponding entries are null,
|
||||
* which means that those characters disappear altogether.
|
||||
* This is derived from the a standard implementation of map(s,from,to)
|
||||
* function of ICON language. Within mapvec, we replace every character
|
||||
* of "from" with the corresponding character in "to".
|
||||
* If "to" is shorter than "from", than the corresponding entries are null,
|
||||
* which means that those characters disappear altogether.
|
||||
*/
|
||||
static void
|
||||
map(char *dest, const char *src, const char *from, const char *to)
|
||||
@ -1002,7 +1002,7 @@ handledash(char *buffer, char *end, const char *src)
|
||||
if (src[1] == '-' && src[2]) {
|
||||
unsigned char i;
|
||||
if ((unsigned char)src[0] <= (unsigned char)src[2]) {
|
||||
for (i = (unsigned char)src[0];
|
||||
for (i = (unsigned char)src[0];
|
||||
i <= (unsigned char)src[2]; i++) {
|
||||
*p++ = i;
|
||||
if (p == end) {
|
||||
@ -1011,7 +1011,7 @@ handledash(char *buffer, char *end, const char *src)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = (unsigned char)src[0];
|
||||
for (i = (unsigned char)src[0];
|
||||
i >= (unsigned char)src[2]; i--) {
|
||||
*p++ = i;
|
||||
if (p == end) {
|
||||
|
@ -184,10 +184,10 @@ static void addchar(int);
|
||||
static char *twiddle(const char *);
|
||||
static char *getstring(void);
|
||||
static void exit_regerror(int, regex_t *, const char *);
|
||||
static void do_subst(const char *, regex_t *, const char *, const char *,
|
||||
static void do_subst(const char *, regex_t *, const char *, const char *,
|
||||
regmatch_t *);
|
||||
static void do_regexpindex(const char *, regex_t *, const char *, regmatch_t *);
|
||||
static void do_regexp(const char *, regex_t *, const char *, const char *,
|
||||
static void do_regexp(const char *, regex_t *, const char *, const char *,
|
||||
regmatch_t *);
|
||||
static void add_sub(int, const char *, regex_t *, regmatch_t *);
|
||||
static void add_replace(const char *, regex_t *, const char *, regmatch_t *);
|
||||
@ -316,7 +316,7 @@ add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm
|
||||
}
|
||||
|
||||
static void
|
||||
do_subst(const char *string, regex_t *re, const char *source,
|
||||
do_subst(const char *string, regex_t *re, const char *source,
|
||||
const char *replace, regmatch_t *pm)
|
||||
{
|
||||
int error;
|
||||
@ -357,7 +357,7 @@ do_subst(const char *string, regex_t *re, const char *source,
|
||||
}
|
||||
|
||||
static void
|
||||
do_regexp(const char *string, regex_t *re, const char *source,
|
||||
do_regexp(const char *string, regex_t *re, const char *source,
|
||||
const char *replace, regmatch_t *pm)
|
||||
{
|
||||
int error;
|
||||
@ -375,7 +375,7 @@ do_regexp(const char *string, regex_t *re, const char *source,
|
||||
}
|
||||
|
||||
static void
|
||||
do_regexpindex(const char *string, regex_t *re, const char *source,
|
||||
do_regexpindex(const char *string, regex_t *re, const char *source,
|
||||
regmatch_t *pm)
|
||||
{
|
||||
int error;
|
||||
@ -485,7 +485,7 @@ dopatsubst(const char *argv[], int argc)
|
||||
if (error != 0)
|
||||
exit_regerror(error, &re, source);
|
||||
|
||||
pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t),
|
||||
pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t),
|
||||
NULL);
|
||||
do_subst(argv[2], &re, source,
|
||||
argc > 4 && argv[4] != NULL ? argv[4] : "", pmatch);
|
||||
|
@ -292,7 +292,7 @@ keep(char *ptr)
|
||||
kept_capacity *= 2;
|
||||
else
|
||||
kept_capacity = 50;
|
||||
kept = xreallocarray(kept, kept_capacity,
|
||||
kept = xreallocarray(kept, kept_capacity,
|
||||
sizeof(char *), "Out of memory while saving %d strings\n",
|
||||
kept_capacity);
|
||||
}
|
||||
@ -300,7 +300,7 @@ keep(char *ptr)
|
||||
}
|
||||
|
||||
static int
|
||||
string_in_use(const char *ptr)
|
||||
string_in_use(const char *ptr)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i <= sp; i++) {
|
||||
@ -321,7 +321,7 @@ free_definition(char *ptr)
|
||||
if (!string_in_use(kept[i])) {
|
||||
kept_size--;
|
||||
free(kept[i]);
|
||||
if (i != kept_size)
|
||||
if (i != kept_size)
|
||||
kept[i] = kept[kept_size];
|
||||
i--;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ struct input_file {
|
||||
mstack[sp].sstr = macro_getdef(p)->defn;\
|
||||
sstack[sp] = STORAGE_MACRO; \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* . .
|
||||
|
@ -52,7 +52,7 @@ expr : expr '+' expr { $$ = $1 + $3; }
|
||||
}
|
||||
$$ = $1 / $3;
|
||||
}
|
||||
| expr '%' expr {
|
||||
| expr '%' expr {
|
||||
if ($3 == 0) {
|
||||
yyerror("modulo zero");
|
||||
exit(1);
|
||||
|
@ -698,7 +698,7 @@ matchsubj(char *str, int mesg)
|
||||
else
|
||||
strlcpy(lastscan, str, sizeof(lastscan));
|
||||
mp = &message[mesg-1];
|
||||
|
||||
|
||||
/*
|
||||
* Now look, ignoring case, for the word in the string.
|
||||
*/
|
||||
|
@ -536,7 +536,7 @@ elide(struct name *names)
|
||||
np = np->n_flink;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Now t points to the last entry with the same name
|
||||
* as np. Make np point beyond t.
|
||||
|
@ -369,7 +369,7 @@ mail1(struct header *hp, int printheaders)
|
||||
}
|
||||
if ((cp = value("record")) != NULL)
|
||||
(void)savemail(expand(cp), mtf);
|
||||
|
||||
|
||||
/* Setup sendmail arguments. */
|
||||
*ap++ = "sendmail";
|
||||
*ap++ = "-i";
|
||||
|
@ -112,7 +112,7 @@ argcount(char **argv)
|
||||
char **ap;
|
||||
|
||||
for (ap = argv; *ap++ != NULL;)
|
||||
;
|
||||
;
|
||||
return(ap - argv - 1);
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ mod:
|
||||
isz++;
|
||||
if (strchr(" \t.", p[*pos + isz]) == NULL)
|
||||
isz++;
|
||||
|
||||
|
||||
fontesc = mandoc_font(p + *pos, isz);
|
||||
|
||||
switch (fontesc) {
|
||||
|
@ -398,7 +398,7 @@ locale_endline(struct termp *p)
|
||||
p->line++;
|
||||
if ((int)p->tcol->offset > p->ti)
|
||||
p->tcol->offset -= p->ti;
|
||||
else
|
||||
else
|
||||
p->tcol->offset = 0;
|
||||
p->ti = 0;
|
||||
putwchar(L'\n');
|
||||
|
@ -1250,7 +1250,7 @@ ps_endline(struct termp *p)
|
||||
|
||||
if ((int)p->tcol->offset > p->ti)
|
||||
p->tcol->offset -= p->ti;
|
||||
else
|
||||
else
|
||||
p->tcol->offset = 0;
|
||||
p->ti = 0;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
/*
|
||||
* Due to incompatible behaviour between "standard" emacs and
|
||||
* ctags word traversing, '_' character's value is changed on
|
||||
* ctags word traversing, '_' character's value is changed on
|
||||
* the fly in ctags mode, hence non-const.
|
||||
*/
|
||||
char cinfo[256] = {
|
||||
|
@ -263,7 +263,7 @@ getindent(const struct line *lp, int *curi)
|
||||
if (!firstnwsp && !isspace(c)) {
|
||||
if (c == '#')
|
||||
cppp = TRUE;
|
||||
firstnwsp = TRUE;
|
||||
firstnwsp = TRUE;
|
||||
}
|
||||
if (c == '\\')
|
||||
escp = !escp;
|
||||
|
@ -786,7 +786,7 @@ refreshbuffer(struct buffer *bp)
|
||||
|
||||
/* remark any previously deleted files with a 'D' */
|
||||
if (ddel)
|
||||
redelete(bp);
|
||||
redelete(bp);
|
||||
|
||||
/* find dot line */
|
||||
bp->b_dotp = bfirstlp(bp);
|
||||
@ -989,7 +989,7 @@ redelete(struct buffer *bp)
|
||||
/* reset the deleted file buffer flag until a deleted file is found */
|
||||
bp->b_flag &= ~BFDIREDDEL;
|
||||
|
||||
for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) {
|
||||
for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) {
|
||||
bp->b_dotp = lp;
|
||||
if ((p = findfname(lp, p)) == NULL) {
|
||||
nlp = lforw(lp);
|
||||
@ -998,7 +998,7 @@ redelete(struct buffer *bp)
|
||||
plen = strlen(p);
|
||||
SLIST_FOREACH_SAFE(d1, &delhead, entry, dt) {
|
||||
fnlen = strlen(d1->fn);
|
||||
if ((plen == fnlen) &&
|
||||
if ((plen == fnlen) &&
|
||||
(strncmp(p, d1->fn, plen) == 0)) {
|
||||
lputc(bp->b_dotp, 0, DDELCHAR);
|
||||
bp->b_flag |= BFDIREDDEL;
|
||||
@ -1006,7 +1006,7 @@ redelete(struct buffer *bp)
|
||||
if (SLIST_EMPTY(&delhead)) {
|
||||
finished = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finished)
|
||||
@ -1035,7 +1035,7 @@ createlist(struct buffer *bp)
|
||||
int ret = FALSE;
|
||||
|
||||
for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) {
|
||||
/*
|
||||
/*
|
||||
* Check if the line has 'D' on the first char and if a valid
|
||||
* filename can be extracted from it.
|
||||
*/
|
||||
@ -1070,7 +1070,7 @@ createlist(struct buffer *bp)
|
||||
SLIST_INSERT_HEAD(&delhead, d2, entry);
|
||||
else
|
||||
SLIST_INSERT_AFTER(d1, d2, entry);
|
||||
d1 = d2;
|
||||
d1 = d2;
|
||||
}
|
||||
ret = TRUE;
|
||||
nlp = lforw(lp);
|
||||
|
@ -842,7 +842,7 @@ ewprintf(const char *fmt, ...)
|
||||
* Printf style formatting. This is called by "ewprintf" to provide
|
||||
* formatting services to its clients. The move to the start of the
|
||||
* echo line, and the erase to the end of the echo line, is done by
|
||||
* the caller.
|
||||
* the caller.
|
||||
* %c prints the "name" of the supplied character.
|
||||
* %k prints the name of the current key (and takes no arguments).
|
||||
* %d prints a decimal integer
|
||||
|
@ -605,7 +605,7 @@ buffsave(struct buffer *bp)
|
||||
"Save anyway")) != TRUE)
|
||||
return (s);
|
||||
}
|
||||
|
||||
|
||||
if (makebackup && (bp->b_flag & BFBAK)) {
|
||||
s = fbackupfile(bp->b_fname);
|
||||
/* hard error */
|
||||
|
@ -736,7 +736,7 @@ expandtilde(const char *fn)
|
||||
plen = strlcpy(path, pw->pw_dir, sizeof(path));
|
||||
if (plen == 0 || path[plen - 1] != '/') {
|
||||
if (strlcat(path, "/", sizeof(path)) >= sizeof(path)) {
|
||||
dobeep();
|
||||
dobeep();
|
||||
ewprintf("Path too long");
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
*
|
||||
* If you do want to do some testing, you can add some lines to your .mg file
|
||||
* like:
|
||||
*
|
||||
*
|
||||
* 1. Give multiple arguments to a function that usually would accept only one:
|
||||
* (find-file "a.txt" "b.txt" "c.txt")
|
||||
*
|
||||
@ -42,7 +42,7 @@
|
||||
* 7. oh so many things....
|
||||
* [...]
|
||||
* n. implement user definable functions.
|
||||
*
|
||||
*
|
||||
* Notes:
|
||||
* - Currently calls to excline() from this file have the line length and
|
||||
* line number set to zero.
|
||||
@ -98,13 +98,13 @@ struct expentry {
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure for scheme keywords.
|
||||
* Structure for scheme keywords.
|
||||
*/
|
||||
#define NUMSCHKEYS 4
|
||||
#define MAXLENSCHKEYS 17 /* 17 = longest keyword (16) + 1 */
|
||||
|
||||
char scharkey[NUMSCHKEYS][MAXLENSCHKEYS] =
|
||||
{
|
||||
{
|
||||
"define",
|
||||
"list",
|
||||
"if",
|
||||
@ -304,7 +304,7 @@ parse(char *begp, const char *par1, const char *par2, int blkid, int expctr,
|
||||
if (doregex(regs, begp))
|
||||
return(exitinterpreter(NULL, NULL, FALSE));
|
||||
|
||||
/* mg function name regex */
|
||||
/* mg function name regex */
|
||||
regs = "^[A-Za-z-]+$";
|
||||
if (doregex(regs, begp))
|
||||
return(excline(begp, 0, 0));
|
||||
@ -467,7 +467,7 @@ multiarg(char *cmdp, char *argbuf, int numparams)
|
||||
if (*p != ' ') {
|
||||
if (*p == '"') {
|
||||
if (inquote == 1)
|
||||
inquote = 0;
|
||||
inquote = 0;
|
||||
else
|
||||
inquote = 1;
|
||||
}
|
||||
@ -614,7 +614,7 @@ founddef(char *defstr, int blkid, int expctr, int hasval, int elen)
|
||||
expandvals(NULL, valp, defnam);
|
||||
defnam = NULL;
|
||||
}
|
||||
*vendp = ' ';
|
||||
*vendp = ' ';
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ expandvals(char *cmdp, char *valp, char *bp)
|
||||
if (*p != ' ') {
|
||||
if (*p == '"') {
|
||||
if (inquote == 1)
|
||||
inquote = 0;
|
||||
inquote = 0;
|
||||
else
|
||||
inquote = 1;
|
||||
}
|
||||
@ -658,12 +658,12 @@ expandvals(char *cmdp, char *valp, char *bp)
|
||||
continue;
|
||||
/* terminate arg string */
|
||||
if (*p == ' ') {
|
||||
*p = '\0';
|
||||
*p = '\0';
|
||||
}
|
||||
endp = p + 1;
|
||||
excbuf[0] = '\0';
|
||||
varbuf[0] = '\0';
|
||||
contbuf[0] = '\0';
|
||||
contbuf[0] = '\0';
|
||||
sizof = sizeof(varbuf);
|
||||
v = varbuf;
|
||||
regs = "[\"]+.*[\"]+";
|
||||
@ -680,7 +680,7 @@ expandvals(char *cmdp, char *valp, char *bp)
|
||||
|
||||
(void)(strlcat(varbuf, contbuf,
|
||||
sizof) >= sizof);
|
||||
|
||||
|
||||
argbuf[0] = ' ';
|
||||
argbuf[1] = '\0';
|
||||
(void)(strlcat(argbuf, varbuf,
|
||||
@ -709,7 +709,7 @@ expandvals(char *cmdp, char *valp, char *bp)
|
||||
return (dobeep_msg("strlcat error"));
|
||||
}
|
||||
/* v1->v_count++;*/
|
||||
|
||||
|
||||
if (fin)
|
||||
break;
|
||||
|
||||
@ -894,7 +894,7 @@ getenvironmentvariable(char *ptr, char *dobuf, int dosiz)
|
||||
return (dobeep_msg("strlcat error"));
|
||||
if (strlcat(dobuf, q, dosiz) >= dosiz)
|
||||
return (dobeep_msg("strlcat error"));
|
||||
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
@ -932,14 +932,14 @@ stringappend(char *ptr, char *dobuf, int dosiz)
|
||||
v = v + 1;
|
||||
}
|
||||
if (strlcat(f, v, sizof) >= sizof)
|
||||
return (dobeep_msg("strlcat error"));
|
||||
return (dobeep_msg("strlcat error"));
|
||||
} else {
|
||||
if (p[0] == '"' && p[strlen(p) - 1] == '"' ) {
|
||||
p[strlen(p) - 1] = '\0';
|
||||
p = p + 1;
|
||||
}
|
||||
if (strlcat(f, p, sizof) >= sizof)
|
||||
return (dobeep_msg("strlcat error"));
|
||||
return (dobeep_msg("strlcat error"));
|
||||
}
|
||||
if (fin)
|
||||
break;
|
||||
|
@ -169,7 +169,7 @@ linsert(int n, int c)
|
||||
|
||||
if ((s = checkdirty(curbp)) != TRUE)
|
||||
return (s);
|
||||
|
||||
|
||||
if (curbp->b_flag & BFREADONLY) {
|
||||
dobeep();
|
||||
ewprintf("Buffer is read only");
|
||||
@ -281,7 +281,7 @@ lnewline_at(struct line *lp1, int doto)
|
||||
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
|
||||
if (wp->w_linep == lp1)
|
||||
wp->w_linep = lp2;
|
||||
if (wp->w_dotline >= tcurwpdotline &&
|
||||
if (wp->w_dotline >= tcurwpdotline &&
|
||||
wp->w_bufp == curwp->w_bufp)
|
||||
wp->w_dotline++;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $OpenBSD: log.c,v 1.13 2022/12/26 19:16:02 jmc Exp $ */
|
||||
|
||||
/*
|
||||
/*
|
||||
* This file is in the public domain.
|
||||
*
|
||||
* Author: Mark Lumsden <mark@showcomplex.com>
|
||||
@ -9,27 +9,27 @@
|
||||
|
||||
/*
|
||||
* Record a history of an mg session for temporal debugging.
|
||||
* Sometimes pressing a key will set the scene for a bug only visible
|
||||
* Sometimes pressing a key will set the scene for a bug only visible
|
||||
* dozens of keystrokes later. gdb has its limitations in this scenario.
|
||||
*
|
||||
* Note this file is not compiled into mg by default, you will need to
|
||||
* amend the 'Makefile' for that to happen. Because of this, the code
|
||||
* is subject to bit-rot. However, I know myself and others have
|
||||
* written similar functionally often enough, that recording the below
|
||||
* is subject to bit-rot. However, I know myself and others have
|
||||
* written similar functionally often enough, that recording the below
|
||||
* in a code repository could aid the development efforts of mg, even
|
||||
* if it requires a bit of effort to get working. The current code is
|
||||
* written in the spirit of debugging (quickly and perhaps not ideal,
|
||||
* but it does what is required well enough). Should debugging become
|
||||
* more formalised within mg, then I would expect that to change.
|
||||
*
|
||||
* If you open a file with long lines to run through this debugging
|
||||
* If you open a file with long lines to run through this debugging
|
||||
* code, you may run into problems with the 1st fprintf statement in
|
||||
* in the mglog_lines() function. mg sometimes segvs at a strlen call
|
||||
* in fprintf - possibly something to do with the format string?
|
||||
* "%s%p b^%p f.%p %d %d\t%c|%s\n"
|
||||
* When I get time I will look into it. But since my debugging
|
||||
* When I get time I will look into it. But since my debugging
|
||||
* generally revolves around a file like:
|
||||
*
|
||||
*
|
||||
* abc
|
||||
* def
|
||||
* ghk
|
||||
@ -347,7 +347,7 @@ mgloginit(void)
|
||||
mglogfile_interpreter = "interpreter.log";
|
||||
mglogfile_misc = "misc.log";
|
||||
|
||||
/*
|
||||
/*
|
||||
* Change mgloglevel for desired level of logging.
|
||||
* log.h has relevant level info.
|
||||
*/
|
||||
@ -384,7 +384,7 @@ mgloginit(void)
|
||||
return (FALSE);
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
|
@ -26,7 +26,7 @@ static int do_gotoeop(int, int, int *);
|
||||
/*
|
||||
* Move to start of paragraph.
|
||||
* Move backwards by line, checking from the 1st character forwards for the
|
||||
* existence a non-space. If a non-space character is found, move to the
|
||||
* existence a non-space. If a non-space character is found, move to the
|
||||
* preceding line. Keep doing this until a line with only spaces is found or
|
||||
* the start of buffer.
|
||||
*/
|
||||
@ -320,7 +320,7 @@ markpara(int f, int n)
|
||||
|
||||
/*
|
||||
* Transpose the current paragraph with the following paragraph. If invoked
|
||||
* multiple times, transpose to the n'th paragraph. If invoked between
|
||||
* multiple times, transpose to the n'th paragraph. If invoked between
|
||||
* paragraphs, move to the previous paragraph, then continue.
|
||||
*/
|
||||
int
|
||||
@ -341,14 +341,14 @@ transposepara(int f, int n)
|
||||
(void)gotoeop(FFRAND, 1);
|
||||
|
||||
/* take a note of buffer flags - we may need them */
|
||||
flg = curbp->b_flag;
|
||||
flg = curbp->b_flag;
|
||||
|
||||
/* clean out kill buffer then kill region */
|
||||
kdelete();
|
||||
if ((status = killregion(FFRAND, 1)) != TRUE)
|
||||
return (status);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Now step through n paragraphs. If we reach the end of buffer,
|
||||
* stop and paste the killed region back, then display a message.
|
||||
*/
|
||||
@ -356,7 +356,7 @@ transposepara(int f, int n)
|
||||
ewprintf("Cannot transpose paragraph, end of buffer reached.");
|
||||
(void)gotobop(FFRAND, i);
|
||||
(void)yank(FFRAND, 1);
|
||||
curbp->b_flag = flg;
|
||||
curbp->b_flag = flg;
|
||||
return (FALSE);
|
||||
}
|
||||
(void)yank(FFRAND, 1);
|
||||
@ -391,7 +391,7 @@ findpara(void)
|
||||
if (lforw(curwp->w_dotp) == curbp->b_headp)
|
||||
return (FALSE);
|
||||
|
||||
curwp->w_dotp = lforw(curwp->w_dotp);
|
||||
curwp->w_dotp = lforw(curwp->w_dotp);
|
||||
curwp->w_dotline++;
|
||||
} while (1);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user