mirror of
https://github.com/uffejakobsen/acme.git
synced 2025-08-15 18:27:32 +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:
@@ -48,7 +48,7 @@ void flow_forloop(struct for_loop *loop)
|
|||||||
// switching input makes us lose GotByte. But we know it's '}' anyway!
|
// switching input makes us lose GotByte. But we know it's '}' anyway!
|
||||||
// set up new input
|
// set up new input
|
||||||
loop_input = *Input_now; // copy current input structure into new
|
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
|
// remember old input
|
||||||
outer_input = Input_now;
|
outer_input = Input_now;
|
||||||
// activate new input
|
// activate new input
|
||||||
@@ -163,7 +163,7 @@ void flow_do_while(struct do_while *loop)
|
|||||||
|
|
||||||
// set up new input
|
// set up new input
|
||||||
loop_input = *Input_now; // copy current input structure into new
|
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
|
// remember old input
|
||||||
outer_input = Input_now;
|
outer_input = Input_now;
|
||||||
// activate new input (not useable yet, as pointer and
|
// 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->original_filename = filename;
|
||||||
Input_now->line_number = 1;
|
Input_now->line_number = 1;
|
||||||
Input_now->source_is_ram = FALSE;
|
Input_now->source = INPUTSRC_FILE;
|
||||||
Input_now->state = INPUTSTATE_NORMAL;
|
Input_now->state = INPUTSTATE_NORMAL;
|
||||||
Input_now->src.fd = fd;
|
Input_now->src.fd = fd;
|
||||||
}
|
}
|
||||||
@@ -257,10 +257,16 @@ char GetByte(void)
|
|||||||
// high-level format
|
// high-level format
|
||||||
// Otherwise, the source is a file. This means we will call
|
// Otherwise, the source is a file. This means we will call
|
||||||
// GetFormatted() which will do a shit load of conversions.
|
// 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++);
|
GotByte = *(Input_now->src.ram_ptr++);
|
||||||
else
|
break;
|
||||||
|
case INPUTSRC_FILE:
|
||||||
GotByte = get_processed_from_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 start-of-line was read, increment line counter and repeat
|
||||||
// if (GotByte != CHAR_SOL)
|
// if (GotByte != CHAR_SOL)
|
||||||
// return GotByte;
|
// return GotByte;
|
||||||
@@ -278,12 +284,13 @@ char GetQuotedByte(void)
|
|||||||
{
|
{
|
||||||
int from_file; // must be an int to catch EOF
|
int from_file; // must be an int to catch EOF
|
||||||
|
|
||||||
// if byte source is RAM, then no conversion is necessary,
|
switch (Input_now->source) {
|
||||||
// because in RAM the source already has high-level format
|
case INPUTSRC_RAM:
|
||||||
if (Input_now->source_is_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++);
|
GotByte = *(Input_now->src.ram_ptr++);
|
||||||
// Otherwise, the source is a file.
|
break;
|
||||||
} else {
|
case INPUTSRC_FILE:
|
||||||
// fetch a fresh byte from the current source file
|
// fetch a fresh byte from the current source file
|
||||||
from_file = getc(Input_now->src.fd);
|
from_file = getc(Input_now->src.fd);
|
||||||
IF_WANTED_REPORT_SRCCHAR(from_file);
|
IF_WANTED_REPORT_SRCCHAR(from_file);
|
||||||
@@ -306,7 +313,9 @@ char GetQuotedByte(void)
|
|||||||
default:
|
default:
|
||||||
GotByte = from_file;
|
GotByte = from_file;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Bug_found("InvalidInputSrc", Input_now->source); // FIXME - add to docs!
|
||||||
}
|
}
|
||||||
// now check for end of statement
|
// now check for end of statement
|
||||||
if (GotByte == CHAR_EOS)
|
if (GotByte == CHAR_EOS)
|
||||||
|
@@ -25,10 +25,14 @@ enum inputstate {
|
|||||||
INPUTSTATE_EOB, // send end-of-block after end-of-statement
|
INPUTSTATE_EOB, // send end-of-block after end-of-statement
|
||||||
INPUTSTATE_EOF, // send end-of-file after end-of-statement
|
INPUTSTATE_EOF, // send end-of-file after end-of-statement
|
||||||
};
|
};
|
||||||
|
enum inputsrc {
|
||||||
|
INPUTSRC_FILE,
|
||||||
|
INPUTSRC_RAM
|
||||||
|
};
|
||||||
struct input {
|
struct input {
|
||||||
const char *original_filename; // during RAM reads, too
|
const char *original_filename; // during RAM reads, too
|
||||||
int line_number; // in file (on 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
|
enum inputstate state; // state of input
|
||||||
union {
|
union {
|
||||||
FILE *fd; // file descriptor
|
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
|
// set up new input
|
||||||
new_input.original_filename = actual_macro->def_filename;
|
new_input.original_filename = actual_macro->def_filename;
|
||||||
new_input.line_number = actual_macro->def_line_number;
|
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.state = INPUTSTATE_NORMAL; // FIXME - fix others!
|
||||||
new_input.src.ram_ptr = actual_macro->parameter_list;
|
new_input.src.ram_ptr = actual_macro->parameter_list;
|
||||||
// remember old input
|
// remember old input
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#define RELEASE "0.96.5" // update before release FIXME
|
#define RELEASE "0.96.5" // update before release FIXME
|
||||||
#define CODENAME "Fenchurch" // update before release
|
#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 CHANGE_YEAR "2020" // update before release
|
||||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||||
|
Reference in New Issue
Block a user