X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Finterpreter%2Finput.c;h=6615e7751be1e773513d3dae03579ccdfa96cfa8;hb=e4706792d290d4c5cb6a020d2973689efb7457ff;hp=82ca2361356d3da775b066d956e45cde6c30247c;hpb=b3c8ae4e104c93354738d3992fcf0e60e9646490;p=ghc-hetmet.git diff --git a/ghc/interpreter/input.c b/ghc/interpreter/input.c index 82ca236..6615e77 100644 --- a/ghc/interpreter/input.c +++ b/ghc/interpreter/input.c @@ -9,17 +9,15 @@ * included in the distribution. * * $RCSfile: input.c,v $ - * $Revision: 1.14 $ - * $Date: 1999/11/29 18:59:27 $ + * $Revision: 1.27 $ + * $Date: 2000/04/06 00:36:12 $ * ------------------------------------------------------------------------*/ -#include "prelude.h" +#include "hugsbasictypes.h" #include "storage.h" -#include "backend.h" #include "connect.h" -#include "command.h" #include "errors.h" -#include "link.h" + #include #if HAVE_GETDELIM_H #include "getdelim.h" @@ -29,11 +27,11 @@ #include #endif -#if IS_WIN32 || HUGS_FOR_WINDOWS +#if IS_WIN32 #undef IN #endif -#if HAVE_LIBREADLINE && HAVE_READLINE_READLINE_H +#if HAVE_LIBREADLINE && HAVE_READLINE_READLINE_H && HAVE_READLINE_HISTORY_H #define USE_READLINE 1 #else #define USE_READLINE 0 @@ -80,51 +78,51 @@ String preprocessor = 0; * Local function prototypes: * ------------------------------------------------------------------------*/ -static Void local initCharTab Args((Void)); -static Void local fileInput Args((String,Long)); -static Bool local literateMode Args((String)); -static Bool local linecmp Args((String,String)); -static Int local nextLine Args((Void)); -static Void local skip Args((Void)); -static Void local thisLineIs Args((Int)); -static Void local newlineSkip Args((Void)); -static Void local closeAnyInput Args((Void)); - - Int yyparse Args((Void)); /* can't stop yacc making this */ +static Void local initCharTab ( Void ); +static Void local fileInput ( String,Long ); +static Bool local literateMode ( String ); +static Bool local linecmp ( String,String ); +static Int local nextLine ( Void ); +static Void local skip ( Void ); +static Void local thisLineIs ( Int ); +static Void local newlineSkip ( Void ); +static Void local closeAnyInput ( Void ); + + Int yyparse ( Void ); /* can't stop yacc making this */ /* public, but don't advertise */ /* it in a header file. */ -static Void local endToken Args((Void)); -static Text local readOperator Args((Void)); -static Text local readIdent Args((Void)); -static Cell local readRadixNumber Args((Int)); -static Cell local readNumber Args((Void)); -static Cell local readChar Args((Void)); -static Cell local readString Args((Void)); -static Void local saveStrChr Args((Char)); -static Cell local readAChar Args((Bool)); +static Void local endToken ( Void ); +static Text local readOperator ( Void ); +static Text local readIdent ( Void ); +static Cell local readRadixNumber ( Int ); +static Cell local readNumber ( Void ); +static Cell local readChar ( Void ); +static Cell local readString ( Void ); +static Void local saveStrChr ( Char ); +static Cell local readAChar ( Bool ); -static Bool local lazyReadMatches Args((String)); -static Cell local readEscapeChar Args((Bool)); -static Void local skipGap Args((Void)); -static Cell local readCtrlChar Args((Void)); -static Cell local readOctChar Args((Void)); -static Cell local readHexChar Args((Void)); -static Int local readHexDigit Args((Char)); -static Cell local readDecChar Args((Void)); +static Bool local lazyReadMatches ( String ); +static Cell local readEscapeChar ( Bool ); +static Void local skipGap ( Void ); +static Cell local readCtrlChar ( Void ); +static Cell local readOctChar ( Void ); +static Cell local readHexChar ( Void ); +static Int local readHexDigit ( Char ); +static Cell local readDecChar ( Void ); -static Void local goOffside Args((Int)); -static Void local unOffside Args((Void)); -static Bool local canUnOffside Args((Void)); +static Void local goOffside ( Int ); +static Void local unOffside ( Void ); +static Bool local canUnOffside ( Void ); -static Void local skipWhitespace Args((Void)); -static Int local yylex Args((Void)); -static Int local repeatLast Args((Void)); +static Void local skipWhitespace ( Void ); +static Int local yylex ( Void ); +static Int local repeatLast ( Void ); -static Void local parseInput Args((Int)); +static Cell local parseInput ( Int ); -static Bool local doesNotExceed Args((String,Int,Int)); -static Int local stringToInt Args((String,Int)); +static Bool local doesNotExceed ( String,Int,Int ); +static Int local stringToInt ( String,Int ); /* -------------------------------------------------------------------------- @@ -145,14 +143,15 @@ static Text textBang, textDot, textAll, textImplies; static Text textWildcard; static Text textModule, textImport, textInterface, textInstImport; -static Text textHiding, textQualified, textAsMod; +static Text textHiding, textQualified, textAsMod, textPrivileged; static Text textExport, textDynamic, textUUExport; -static Text textUnsafe, textUUAll; +static Text textUnsafe, textUUAll, textUUUsage; Text textCcall; /* ccall */ Text textStdcall; /* stdcall */ Text textNum; /* Num */ +Text textPrelPrim; /* PrelPrim */ Text textPrelude; /* Prelude */ Text textPlus; /* (+) */ @@ -253,7 +252,7 @@ static Void local initCharTab() { /* Initialize char decode table */ * * At the lowest level of input, characters are read one at a time, with the * current character held in c0 and the following (lookahead) character in - * c1. The corrdinates of c0 within the file are held in (column,row). + * c1. The coordinates of c0 within the file are held in (column,row). * The input stream is advanced by one character using the skip() function. * ------------------------------------------------------------------------*/ @@ -563,19 +562,19 @@ static Void local skip() { /* move forward one char in input */ closeAnyInput(); } else if (reading==KEYBOARD) { - allowBreak(); + /* allowBreak(); */ if (c0=='\n') c1 = EOF; else { c1 = nextConsoleChar(); -#if IS_WIN32 && !HUGS_FOR_WINDOWS +#if IS_WIN32 Sleep(0); #endif /* On Win32, hitting ctrl-C causes the next getchar to * fail - returning "-1" to indicate an error. * This is one of the rare cases where "-1" does not mean EOF. */ - if (EOF == c1 && (!feof(stdin) || broken==TRUE)) { + if (EOF == c1 && (!feof(stdin) /* || broken==TRUE */)) { c1 = ' '; } } @@ -1264,7 +1263,7 @@ String readLine() { /* Read command line from input */ * - Otherwise, if no `{' follows the keywords WHERE/LET or OF, a SOFT `{' * is inserted with the column number of the first token after the * WHERE/LET/OF keyword. - * - When a soft indentation is uppermost on the indetation stack with + * - When a soft indentation is uppermost on the indentation stack with * column col' we insert: * `}' in front of token with column"); + textPrelPrim = findText("PrelPrim"); textPrelude = findText("Prelude"); textNum = findText("Num"); textModule = findText("module"); @@ -1742,6 +1716,7 @@ Int what; { textWildcard = findText("_"); textAll = findText("forall"); textUUAll = findText("__forall"); + textUUUsage = findText("__u"); varMinus = mkVar(textMinus); varPlus = mkVar(textPlus); varBang = mkVar(textBang); @@ -1763,7 +1738,6 @@ Int what; { instDefns = NIL; selDefns = NIL; genDefns = NIL; - //primDefns = NIL; unqualImports= NIL; foreignImports= NIL; foreignExports= NIL; @@ -1785,7 +1759,6 @@ Int what; { mark(instDefns); mark(selDefns); mark(genDefns); - //mark(primDefns); mark(unqualImports); mark(foreignImports); mark(foreignExports);