Checkpoint.
This commit is contained in:
parent
5f1cf8e6fb
commit
b237df90f9
19 changed files with 324 additions and 283 deletions
|
|
@ -1 +1 @@
|
|||
exec /usr/bin/egrep -n "$1" *.[chyl]
|
||||
grep $1 *.[ch]
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ void frameside(int type, Attr *desc) /* create and remember sides */
|
|||
int n;
|
||||
char buf[100];
|
||||
|
||||
n = 0; /* gcc */
|
||||
|
||||
nsides++;
|
||||
switch (type) {
|
||||
case 0: /* no side specified; kludge up all */
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ extern char *grow(char *, char *, int, int);
|
|||
extern int lineno;
|
||||
extern int synerr;
|
||||
extern int codegen;
|
||||
extern char tempfile[];
|
||||
extern char *tempfile;
|
||||
extern FILE *tfd;
|
||||
|
||||
extern Point ptmin, ptmax;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ char *delimstr(char *s) /* get body of X ... X */
|
|||
return tostring(buf);
|
||||
}
|
||||
|
||||
int
|
||||
baldelim(int c, char *s) /* replace c by balancing entry in s */
|
||||
{
|
||||
for ( ; *s; s += 2)
|
||||
|
|
@ -175,6 +176,7 @@ void dodef(Obj *stp) /* collect args and switch input to defn */
|
|||
pushsrc(Macro, stp->val);
|
||||
}
|
||||
|
||||
int
|
||||
getarg(char *p) /* pick up single argument, store in p, return length */
|
||||
{
|
||||
int n, c, npar;
|
||||
|
|
@ -215,6 +217,7 @@ extern int thru;
|
|||
extern Obj *thrudef;
|
||||
extern char *untilstr;
|
||||
|
||||
int
|
||||
input(void)
|
||||
{
|
||||
register int c;
|
||||
|
|
@ -230,10 +233,13 @@ input(void)
|
|||
return *ep++ = c;
|
||||
}
|
||||
|
||||
int
|
||||
nextchar(void)
|
||||
{
|
||||
register int c;
|
||||
|
||||
c = 0; /* gcc */
|
||||
|
||||
loop:
|
||||
switch (srcp->type) {
|
||||
case Free: /* free string */
|
||||
|
|
@ -384,6 +390,7 @@ void do_thru(void) /* read one line, make into a macro expansion */
|
|||
pushsrc(Macro, thrudef->val);
|
||||
}
|
||||
|
||||
int
|
||||
unput(int c)
|
||||
{
|
||||
if (++pb >= pbuf + sizeof pbuf)
|
||||
|
|
@ -533,7 +540,7 @@ void copy(void) /* begin input from file, etc. */
|
|||
FILE *fin;
|
||||
|
||||
if (newfile) {
|
||||
if ((fin = fopen(unsharp(newfile), "r")) == NULL)
|
||||
if ((fin = fopen(newfile, "r")) == NULL)
|
||||
ERROR "can't open file %s", newfile FATAL;
|
||||
curfile++;
|
||||
curfile->fin = fin;
|
||||
|
|
|
|||
|
|
@ -2,20 +2,20 @@
|
|||
#include <signal.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "grap.h"
|
||||
#include "y.tab.h"
|
||||
|
||||
extern char *unsharp(char*);
|
||||
|
||||
int dbg = 0;
|
||||
|
||||
#ifndef GRAPDEFINES
|
||||
#define GRAPDEFINES "#9/sys/lib/grap.defines"
|
||||
#endif
|
||||
char *lib_defines = GRAPDEFINES;
|
||||
char *lib_defines;
|
||||
|
||||
int lib = 1; /* 1 to include lib_defines */
|
||||
FILE *tfd = NULL;
|
||||
char tempfile[L_tmpnam];
|
||||
char *tempfile;
|
||||
|
||||
int synerr = 0;
|
||||
int codegen = 0; /* 1=>output for this picture; 0=>no output */
|
||||
|
|
@ -32,17 +32,22 @@ char *version = "version Dec 30, 1995";
|
|||
extern int yyparse(void);
|
||||
extern void setdefaults(void);
|
||||
extern void getdata(void);
|
||||
extern int unlink(char *);
|
||||
|
||||
/* extern int unlink(char *); */ /* in unistd.h */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
extern void onintr(int), fpecatch(int);
|
||||
|
||||
lib_defines = unsharp("#9/lib/grap.defines");
|
||||
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
||||
signal(SIGINT, onintr);
|
||||
signal(SIGFPE, fpecatch);
|
||||
cmdname = argv[0];
|
||||
tmpnam(tempfile);
|
||||
tempfile = strdup("grap.XXXXXX");
|
||||
mkstemp(tempfile);
|
||||
while (argc > 1 && *argv[1] == '-') {
|
||||
switch (argv[1][1]) {
|
||||
case 'd':
|
||||
|
|
@ -85,7 +90,7 @@ main(int argc, char *argv[])
|
|||
|
||||
void onintr(int n)
|
||||
{
|
||||
n;
|
||||
//n;
|
||||
if (!dbg)
|
||||
unlink(tempfile);
|
||||
exit(1);
|
||||
|
|
@ -114,11 +119,11 @@ static struct {
|
|||
char *name;
|
||||
double val;
|
||||
} defaults[] ={
|
||||
"frameht", FRAMEHT,
|
||||
"framewid", FRAMEWID,
|
||||
"ticklen", TICKLEN,
|
||||
"slop", SLOP,
|
||||
NULL, 0
|
||||
{ "frameht", FRAMEHT },
|
||||
{ "framewid", FRAMEWID },
|
||||
{ "ticklen", TICKLEN },
|
||||
{ "slop", SLOP },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
void setdefaults(void) /* set default sizes for variables */
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ void do_first(void) /* done at first .G1: definitions, etc. */
|
|||
sprintf(buf, "define pid /%d/\n", getpid());
|
||||
pbstr(buf);
|
||||
if (lib != 0) {
|
||||
if ((fp = fopen(unsharp(lib_defines), "r")) != NULL) {
|
||||
if ((fp = fopen(lib_defines, "r")) != NULL) {
|
||||
sprintf(buf1, "copy \"%s\"\n", lib_defines);
|
||||
pbstr(buf1);
|
||||
fclose(fp);
|
||||
|
|
@ -226,8 +226,8 @@ void opentemp(void)
|
|||
if (tfd != NULL)
|
||||
fclose(tfd);
|
||||
if (tfd != stdout) {
|
||||
// if (tfd != NULL)
|
||||
// fclose(tfd);
|
||||
if (tfd != NULL)
|
||||
fclose(tfd);
|
||||
if ((tfd = fopen(tempfile, "w")) == NULL) {
|
||||
fprintf(stderr, "grap: can't open %s\n", tempfile);
|
||||
exit(1);
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ char *desc_str(Attr *a) /* convert DOT to "dotted", etc. */
|
|||
return p;
|
||||
}
|
||||
|
||||
int
|
||||
sidelog(int logflag, int side) /* figure out whether to scale a side */
|
||||
{
|
||||
if ((logflag & XFLAG) && ((side & (BOT|TOP)) || side == 0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue