mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-25 23:49:25 +00:00
changed a bool to an enum
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@171 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
4eb3ffa149
commit
688c00f31b
@ -48,7 +48,7 @@ void flow_forloop(struct for_loop *loop)
|
||||
// switching input makes us lose GotByte. But we know it's '}' anyway!
|
||||
// set up new input
|
||||
loop_input = *Input_now; // copy current input structure into new
|
||||
loop_input.source_is_ram = TRUE; // set new byte source
|
||||
loop_input.source = INPUTSRC_RAM; // set new byte source
|
||||
// remember old input
|
||||
outer_input = Input_now;
|
||||
// activate new input
|
||||
@ -163,7 +163,7 @@ void flow_do_while(struct do_while *loop)
|
||||
|
||||
// set up new input
|
||||
loop_input = *Input_now; // copy current input structure into new
|
||||
loop_input.source_is_ram = TRUE; // set new byte source
|
||||
loop_input.source = INPUTSRC_RAM; // set new byte source
|
||||
// remember old input
|
||||
outer_input = Input_now;
|
||||
// activate new input (not useable yet, as pointer and
|
||||
|
27
src/input.c
27
src/input.c
@ -47,7 +47,7 @@ void Input_new_file(const char *filename, FILE *fd)
|
||||
{
|
||||
Input_now->original_filename = filename;
|
||||
Input_now->line_number = 1;
|
||||
Input_now->source_is_ram = FALSE;
|
||||
Input_now->source = INPUTSRC_FILE;
|
||||
Input_now->state = INPUTSTATE_NORMAL;
|
||||
Input_now->src.fd = fd;
|
||||
}
|
||||
@ -257,10 +257,16 @@ char GetByte(void)
|
||||
// high-level format
|
||||
// Otherwise, the source is a file. This means we will call
|
||||
// GetFormatted() which will do a shit load of conversions.
|
||||
if (Input_now->source_is_ram)
|
||||
switch (Input_now->source) {
|
||||
case INPUTSRC_RAM:
|
||||
GotByte = *(Input_now->src.ram_ptr++);
|
||||
else
|
||||
break;
|
||||
case INPUTSRC_FILE:
|
||||
GotByte = get_processed_from_file();
|
||||
break;
|
||||
default:
|
||||
Bug_found("InvalidInputSrc", Input_now->source); // FIXME - add to docs
|
||||
}
|
||||
// // if start-of-line was read, increment line counter and repeat
|
||||
// if (GotByte != CHAR_SOL)
|
||||
// return GotByte;
|
||||
@ -278,12 +284,13 @@ char GetQuotedByte(void)
|
||||
{
|
||||
int from_file; // must be an int to catch EOF
|
||||
|
||||
// if byte source is RAM, then no conversion is necessary,
|
||||
// because in RAM the source already has high-level format
|
||||
if (Input_now->source_is_ram) {
|
||||
switch (Input_now->source) {
|
||||
case INPUTSRC_RAM:
|
||||
// if byte source is RAM, then no conversion is necessary,
|
||||
// because in RAM the source already has high-level format
|
||||
GotByte = *(Input_now->src.ram_ptr++);
|
||||
// Otherwise, the source is a file.
|
||||
} else {
|
||||
break;
|
||||
case INPUTSRC_FILE:
|
||||
// fetch a fresh byte from the current source file
|
||||
from_file = getc(Input_now->src.fd);
|
||||
IF_WANTED_REPORT_SRCCHAR(from_file);
|
||||
@ -306,7 +313,9 @@ char GetQuotedByte(void)
|
||||
default:
|
||||
GotByte = from_file;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
Bug_found("InvalidInputSrc", Input_now->source); // FIXME - add to docs!
|
||||
}
|
||||
// now check for end of statement
|
||||
if (GotByte == CHAR_EOS)
|
||||
|
@ -25,10 +25,14 @@ enum inputstate {
|
||||
INPUTSTATE_EOB, // send end-of-block after end-of-statement
|
||||
INPUTSTATE_EOF, // send end-of-file after end-of-statement
|
||||
};
|
||||
enum inputsrc {
|
||||
INPUTSRC_FILE,
|
||||
INPUTSRC_RAM
|
||||
};
|
||||
struct input {
|
||||
const char *original_filename; // during RAM reads, too
|
||||
int line_number; // in file (on RAM reads, too)
|
||||
boolean source_is_ram; // TRUE if RAM, FALSE if file (TODO - change to enum)
|
||||
enum inputsrc source;
|
||||
enum inputstate state; // state of input
|
||||
union {
|
||||
FILE *fd; // file descriptor
|
||||
|
@ -294,7 +294,7 @@ void Macro_parse_call(void) // Now GotByte = dot or first char of macro name
|
||||
// set up new input
|
||||
new_input.original_filename = actual_macro->def_filename;
|
||||
new_input.line_number = actual_macro->def_line_number;
|
||||
new_input.source_is_ram = TRUE;
|
||||
new_input.source = INPUTSRC_RAM;
|
||||
new_input.state = INPUTSTATE_NORMAL; // FIXME - fix others!
|
||||
new_input.src.ram_ptr = actual_macro->parameter_list;
|
||||
// remember old input
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define RELEASE "0.96.5" // update before release FIXME
|
||||
#define CODENAME "Fenchurch" // update before release
|
||||
#define CHANGE_DATE "18 May" // update before release FIXME
|
||||
#define CHANGE_DATE "19 May" // update before release FIXME
|
||||
#define CHANGE_YEAR "2020" // update before release
|
||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||
|
Loading…
Reference in New Issue
Block a user