-/*
+/*
* SYNOPSIS: ick_parseargs(argc,argv)
* FILE : ick_parseargs.c
* AUTHOR : Steve Swales
* PURPOSE: Parse arguments for INTERCAL programs.
*
LICENSE TERMS
- Copyright (C) 1996 Eric S. Raymond
+ Copyright (C) 1996 Eric S. Raymond
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This file contains optimizations used by the C-INTERCAL compiler.
LICENSE TERMS
- Copyright (C) 1996 Eric S. Raymond
+ Copyright (C) 1996 Eric S. Raymond
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
/* There are some flow idioms that maybe should be optimized. The most
common is the NEXTing idiom for if(), which looks like this:
-
+
DO (1) NEXT
block 2
escape via NEXTING or COMEFROM
}
do
{
- optflag = optimize_pass1(np);
+ optflag = optimize_pass1(np);
} while(optflag); /* Keep optimizing until no optimizations are found */
if(optdebug && optdebug != 3) explexpr(np,stderr);
if(optdebug == 3) prexpr(np,stderr,0);
break;
}
}
-
-
-
explexpr(np->rval, fp);
(void) fprintf(fp, ")");
break;
-
+
case C_NOT:
(void) fprintf(fp, "(~ ");
explexpr(np->rval, fp);
(void) fprintf(fp, ")");
- break;
+ break;
case C_NOTEQUAL:
(void) fprintf(fp, "(");
(void) fprintf(fp, " BY ");
explexpr(np->rval, fp);
break;
-
- default:
+
+ default:
ick_lose(IE778, emitlineno, (const char*) NULL);
/*@-unreachable@*/ break; /*@=unreachable@*/
}
/* This should never be reached */
ick_lose(IE778, emitlineno, (const char*) NULL);
/*@-unreachable@*/ break; /*@=unreachable@*/
-
+
case SUB:
{
(void) fprintf(fp, "ick_aref(");
prexpr(np->rval, fp, freenode);
(void) fprintf(fp, ")");
break;
-
+
case C_NOT:
(void) fprintf(fp, "(~");
tempint=np->rval->width; /* AIS */
(void) fprintf(fp, " & ick_Max_small)");
else
(void) fprintf(fp, " & ick_Max_large)");
- break;
+ break;
/* AIS: I added the rest of the cases */
case C_NOTEQUAL:
prexpr(np->rval, fp, freenode);
(void) fprintf(fp, ")");
break;
-
+
case C_LSHIFTBY:
(void) fprintf(fp, "(");
prexpr(np->lval, fp, freenode);
* We link these to the compiler, too, in order to do constant folding
*
LICENSE TERMS
- Copyright (C) 1996 Eric S. Raymond
+ Copyright (C) 1996 Eric S. Raymond
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
* ick_lose.c -- report INTERCAL compile- or run-time error
*
LICENSE TERMS
- Copyright (C) 1996 Eric S. Raymond
+ Copyright (C) 1996 Eric S. Raymond
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* ick_lose.h --- error message strings */
/*
- * Note: these error message texts, with one exception, are direct from
+ * Note: these error message texts, with one exception, are direct from
* the Princeton compiler (INTERCAL-72) sources (transmitted by Don Woods).
* The one exception is IE632, which in INTERCAL-72 had the error message
* PROGRAM ATTEMPTED TO EXIT WITHOUT ERROR MESSAGE
* ESR's "THE NEXT STACK HAS RUPTURED!..." has been retained on the grounds
* that it is more obscure and much funnier. For context, find a copy of
- * Joe Haldeman's SF short story "A !Tangled Web", ick_first published in
+ * Joe Haldeman's SF short story "A !Tangled Web", ick_first published in
* Analog magazine in September 1981 and later anthologized in the author's
* "Infinite Dreams" (Ace 1985).
*/
* to fulfill the requirement for Ancient Roman localization.
*
LICENSE TERMS
- Copyright (C) 1996 Eric S. Raymond
+ Copyright (C) 1996 Eric S. Raymond
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifdef SIGBUS
(void) signal(SIGBUS, abend);
#endif /* SIGBUS */
-
+
if (!nocompilerbug) {
#ifdef USG
srand48(time(NULL) + getpid());
/* AIS: Possibly link in the debugger yuk and/or libickmt.a here. */
/* AIS: Added -g support. */
/* AIS: Added argv[0] (now path) to the -I, -L settings. */
-
+
textlinecount=0; /* AIS: If there are no files, there's
no need to free any textlines */
while ((c = myfgetc(ifp)) != EOF)
}
/* perpet.c ends here */
-
{
pickinit();
/* degenerated code */
- ick_restart:
+ ick_restart:
top:
switch(ick_skipto)
{
case 0:
$G
}
-
+
#ifdef YUK
- if(yukloop) goto ick_restart;
+ if(yukloop) goto ick_restart;
#endif
ick_lose(IE633, $J, (const char *)0);
$H
-
+
return 0;
}
$Q
/*****************************************************************************
-NAME
+NAME
unravel.c -- multithreading and backtracking support for C-INTERCAL
LICENSE TERMS
* ickthread objects. choicepoint creates a choicepoint or marks a
* choicepoint as stale; choiceahead eliminates a choicepoint;
* choiceback eliminates a stale choicepoint or returns to a fresh
- * choicepoint.
+ * choicepoint.
*
*********************************************************************/
}
if(ick_printflow) fluputs("(ahead)");
-
+
/* This code works by converting topchoice back to a thread and placing it
just before the current thread, and then killing it. First, the data from
this thread, apart from the choicepoint stack, must be saved. */
i = tailcount;
tvp = ick_tailforget;
ick_tailforget = malloc(i * sizeof *ick_tailforget);
- if(!ick_tailforget) ick_lose(IE991, errlineno, (const char *) NULL);
+ if(!ick_tailforget) ick_lose(IE991, errlineno, (const char *) NULL);
memcpy(ick_tailforget, tvp, i * sizeof *ick_tailforget);
i = hybridcount;
tvp = ick_hyforget;
ick_hyforget = malloc(i * sizeof *ick_hyforget);
- if(!ick_hyforget) ick_lose(IE991, errlineno, (const char *) NULL);
+ if(!ick_hyforget) ick_lose(IE991, errlineno, (const char *) NULL);
memcpy(ick_hyforget, tvp, i * sizeof *ick_hyforget);
/* duplicate data stored in arrays */
isb->save.a->data.hybrid = (ick_type32*)malloc(prod * sizeof(ick_type32));
if(!isb->save.a->data.hybrid) ick_lose(IE991, errlineno, (const char *) NULL);
memcpy(isb->save.a->data.hybrid, isb2->save.a->data.hybrid,
- prod * sizeof(ick_type32));
+ prod * sizeof(ick_type32));
}
isb2 = isb->ick_next;
}
/*@-unqualifiedtrans@*/ /* it is only at this point */
free(ick_next); /* Free NEXT stack */
/*@=unqualifiedtrans@*/
-
+
ickmt_prev->ick_next = ickmt_cur->ick_next;
if(ickmt_cur->ick_next == ickmt_cur)
{
/* OK, so I've spaghettified this procedure slightly by using goto
instead of if. But I was so deep into figuring out setjmp/longjmp,
a goto seemed crystal-clear by comparison. */
-
+
/* save variables */
ickmt_cur->dsi->varforget[0] = ick_onespots;
ickmt_cur->dsi->varforget[1] = ick_twospots;
/* load choicepoints */
if(!choicing) topchoice = ickmt_cur->choicepoint;
-
+
/* load ick_stashbox */
/*@-onlytrans@*/ /* ditto */
ick_first = ickmt_cur->dsi->sb;
}
}
}
- }
+ }
if(writelines||broken)
{
/* write line that we're on */
if(yukvars[i].vartype==ick_TAIL)
ick_tailforget[yukvars[i].intername]=*buf=='i';
if(yukvars[i].vartype==ick_HYBRID)
- ick_hyforget[yukvars[i].intername]=*buf=='i';
+ ick_hyforget[yukvars[i].intername]=*buf=='i';
}
}
}
}
else
(void) puts("Don't know which line you mean.");
- break;
+ break;
case 's':
singlestep=1;
writelines=1;
with decent accuracy under DOS. DJGPP implements timer types 0, 1,
and 2, so it will 'work' with the default value of 2, but the results
you get will be basically meaningless as the base information can't
- be accurately obtained (the resolution is slightly worse than 50ms,
+ be accurately obtained (the resolution is slightly worse than 50ms,
which is far too slow for profiling). */
#ifndef YPTIMERTIME
# ifdef HAVE_GETHRTIME