more cleanup

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@139 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2020-05-06 12:27:32 +00:00
parent bc0efebb3e
commit a4943e1f40
10 changed files with 27 additions and 21 deletions

View File

@ -191,7 +191,7 @@ void flow_do_while(struct do_while *loop)
// parse or skip a block. Returns whether block's '}' terminator was missing.
// afterwards: GotByte = '}'
static int skip_or_parse_block(int parse)
static int skip_or_parse_block(boolean parse)
{
if (!parse) {
Input_skip_or_store_block(FALSE);
@ -207,7 +207,7 @@ static int skip_or_parse_block(int parse)
// parse {block} [else {block}]
void flow_parse_block_else_block(int parse_first)
void flow_parse_block_else_block(boolean parse_first)
{
// Parse first block.
// If it's not correctly terminated, return immediately (because

View File

@ -58,7 +58,7 @@ extern void flow_do_while(struct do_while *loop);
// parse a whole source code file
extern void flow_parse_and_close_file(FILE *fd, const char *filename);
// parse {block} [else {block}]
extern void flow_parse_block_else_block(int parse_first);
extern void flow_parse_block_else_block(boolean parse_first);
// TODO - add an "else if" possibility

View File

@ -340,7 +340,7 @@ void Input_ensure_EOS(void) // Now GotByte = first char to test
// After calling this function, GotByte holds '}'. Unless EOF was found first,
// but then a serious error would have been thrown.
// FIXME - use a struct block *ptr argument!
char *Input_skip_or_store_block(int store)
char *Input_skip_or_store_block(boolean store)
{
char byte;
int depth = 1; // to find matching block end
@ -622,7 +622,7 @@ void includepaths_add(const char *path)
// open file for reading (trying list entries as prefixes)
// "uses_lib" tells whether to access library or to make use of include paths
// file name is expected in GlobalDynaBuf
FILE *includepaths_open_ro(int uses_lib)
FILE *includepaths_open_ro(boolean uses_lib)
{
FILE *stream;
struct ipi *ipi;

View File

@ -75,7 +75,7 @@ extern void Input_ensure_EOS(void);
// If "Store" is FALSE, NULL is returned.
// After calling this function, GotByte holds '}'. Unless EOF was found first,
// but then a serious error would have been thrown.
extern char *Input_skip_or_store_block(int store);
extern char *Input_skip_or_store_block(boolean store);
// Read bytes and add to GlobalDynaBuf until the given terminator (or CHAR_EOS)
// is found. Act upon single and double quotes by entering (and leaving) quote
// mode as needed (So the terminator does not terminate when inside quotes).
@ -125,7 +125,7 @@ extern void includepaths_add(const char *path);
// open file for reading (trying list entries as prefixes)
// "uses_lib" tells whether to access library or to make use of include paths
// file name is expected in GlobalDynaBuf
extern FILE *includepaths_open_ro(int uses_lib);
extern FILE *includepaths_open_ro(boolean uses_lib);
#endif

View File

@ -74,6 +74,7 @@ void notreallypo_setpc(void)
}
}
vcpu_set_pc(intresult.val.intval, segment_flags);
// TODO - allow block syntax, so it is possible to put data "somewhere else" and then return to old position
}

View File

@ -1,5 +1,5 @@
// ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
// Copyright (C) 1998-2017 Marco Baye
// Copyright (C) 1998-2020 Marco Baye
// Have a look at "acme.c" for further info
//
// section stuff (move to symbol.h?)
@ -32,7 +32,7 @@ static scope_t cheap_scope_max; // highest scope number yet
// write given info into given structure and activate it
void section_new(struct section *section, const char *type, char *title, int allocated)
void section_new(struct section *section, const char *type, char *title, boolean allocated)
{
// new scope for locals
local_scope_max += SCOPE_INCREMENT;

View File

@ -1,5 +1,5 @@
// ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
// Copyright (C) 1998-2017 Marco Baye
// Copyright (C) 1998-2020 Marco Baye
// Have a look at "acme.c" for further info
//
// section stuff
@ -16,7 +16,7 @@ struct section {
scope_t cheap_scope; // section's scope for cheap locals
const char *type; // "Zone", "Subzone" or "Macro"
char *title; // zone title, subzone title or macro title
int allocated; // whether title was malloc()'d
boolean allocated; // whether title was malloc()'d
};
@ -25,7 +25,7 @@ extern struct section *section_now;
// write given info into given structure and activate it
extern void section_new(struct section *section, const char *type, char *title, int allocated);
extern void section_new(struct section *section, const char *type, char *title, boolean allocated);
// change scope of cheap locals in given section
extern void section_new_cheap_scope(struct section *section);
// setup outermost section

View File

@ -7,8 +7,8 @@
#define tree_H
#include "config.h"
#include <stdio.h> // for FILE
#include "config.h"
// macros for pre-defining tree node tables

View File

@ -9,30 +9,34 @@
#include "global.h"
static int in_address_block = FALSE;
static int in_address_statement = FALSE;
static boolean in_address_block = FALSE;
static boolean in_address_statement = FALSE;
// Functions
int typesystem_says_address(void)
// return whether explicit symbol definitions should force "address" mode
boolean typesystem_says_address(void)
{
return in_address_block | in_address_statement;
return in_address_block || in_address_statement;
}
// parse a block while forcing address mode
void typesystem_force_address_block(void)
{
int buffer = in_address_block;
boolean buffer = in_address_block;
in_address_block = TRUE;
Parse_optional_block();
in_address_block = buffer;
}
void typesystem_force_address_statement(int value)
// force address mode on or off for the next statement
void typesystem_force_address_statement(boolean value)
{
in_address_statement = value;
}
// warn if result is not integer
void typesystem_want_imm(struct number *result)
{
if (!config.warn_on_type_mismatch)
@ -46,6 +50,7 @@ void typesystem_want_imm(struct number *result)
//printf("refcount should be 0, but is %d\n", result->addr_refs);
}
}
// warn if result is not address
void typesystem_want_addr(struct number *result)
{
if (!config.warn_on_type_mismatch)

View File

@ -11,11 +11,11 @@
// return whether explicit symbol definitions should force "address" mode
extern int typesystem_says_address(void);
extern boolean typesystem_says_address(void);
// parse a block while forcing address mode
extern void typesystem_force_address_block(void);
// force address mode on or off for the next statement
extern void typesystem_force_address_statement(int value);
extern void typesystem_force_address_statement(boolean value);
// warn if result is not integer
extern void typesystem_want_imm(struct number *result);
// warn if result is not address