mirror of
https://github.com/uffejakobsen/acme.git
synced 2025-01-11 13:30:15 +00:00
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:
parent
bc0efebb3e
commit
a4943e1f40
@ -191,7 +191,7 @@ void flow_do_while(struct do_while *loop)
|
|||||||
|
|
||||||
// parse or skip a block. Returns whether block's '}' terminator was missing.
|
// parse or skip a block. Returns whether block's '}' terminator was missing.
|
||||||
// afterwards: GotByte = '}'
|
// afterwards: GotByte = '}'
|
||||||
static int skip_or_parse_block(int parse)
|
static int skip_or_parse_block(boolean parse)
|
||||||
{
|
{
|
||||||
if (!parse) {
|
if (!parse) {
|
||||||
Input_skip_or_store_block(FALSE);
|
Input_skip_or_store_block(FALSE);
|
||||||
@ -207,7 +207,7 @@ static int skip_or_parse_block(int parse)
|
|||||||
|
|
||||||
|
|
||||||
// parse {block} [else {block}]
|
// 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.
|
// Parse first block.
|
||||||
// If it's not correctly terminated, return immediately (because
|
// If it's not correctly terminated, return immediately (because
|
||||||
|
@ -58,7 +58,7 @@ extern void flow_do_while(struct do_while *loop);
|
|||||||
// parse a whole source code file
|
// parse a whole source code file
|
||||||
extern void flow_parse_and_close_file(FILE *fd, const char *filename);
|
extern void flow_parse_and_close_file(FILE *fd, const char *filename);
|
||||||
// parse {block} [else {block}]
|
// 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
|
// TODO - add an "else if" possibility
|
||||||
|
|
||||||
|
|
||||||
|
@ -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,
|
// After calling this function, GotByte holds '}'. Unless EOF was found first,
|
||||||
// but then a serious error would have been thrown.
|
// but then a serious error would have been thrown.
|
||||||
// FIXME - use a struct block *ptr argument!
|
// 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;
|
char byte;
|
||||||
int depth = 1; // to find matching block end
|
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)
|
// open file for reading (trying list entries as prefixes)
|
||||||
// "uses_lib" tells whether to access library or to make use of include paths
|
// "uses_lib" tells whether to access library or to make use of include paths
|
||||||
// file name is expected in GlobalDynaBuf
|
// file name is expected in GlobalDynaBuf
|
||||||
FILE *includepaths_open_ro(int uses_lib)
|
FILE *includepaths_open_ro(boolean uses_lib)
|
||||||
{
|
{
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
struct ipi *ipi;
|
struct ipi *ipi;
|
||||||
|
@ -75,7 +75,7 @@ extern void Input_ensure_EOS(void);
|
|||||||
// If "Store" is FALSE, NULL is returned.
|
// If "Store" is FALSE, NULL is returned.
|
||||||
// After calling this function, GotByte holds '}'. Unless EOF was found first,
|
// After calling this function, GotByte holds '}'. Unless EOF was found first,
|
||||||
// but then a serious error would have been thrown.
|
// 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)
|
// 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
|
// 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).
|
// 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)
|
// open file for reading (trying list entries as prefixes)
|
||||||
// "uses_lib" tells whether to access library or to make use of include paths
|
// "uses_lib" tells whether to access library or to make use of include paths
|
||||||
// file name is expected in GlobalDynaBuf
|
// file name is expected in GlobalDynaBuf
|
||||||
extern FILE *includepaths_open_ro(int uses_lib);
|
extern FILE *includepaths_open_ro(boolean uses_lib);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -74,6 +74,7 @@ void notreallypo_setpc(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
vcpu_set_pc(intresult.val.intval, segment_flags);
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
|
// 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
|
// Have a look at "acme.c" for further info
|
||||||
//
|
//
|
||||||
// section stuff (move to symbol.h?)
|
// 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
|
// 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
|
// new scope for locals
|
||||||
local_scope_max += SCOPE_INCREMENT;
|
local_scope_max += SCOPE_INCREMENT;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
|
// 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
|
// Have a look at "acme.c" for further info
|
||||||
//
|
//
|
||||||
// section stuff
|
// section stuff
|
||||||
@ -16,7 +16,7 @@ struct section {
|
|||||||
scope_t cheap_scope; // section's scope for cheap locals
|
scope_t cheap_scope; // section's scope for cheap locals
|
||||||
const char *type; // "Zone", "Subzone" or "Macro"
|
const char *type; // "Zone", "Subzone" or "Macro"
|
||||||
char *title; // zone title, subzone title or macro title
|
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
|
// 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
|
// change scope of cheap locals in given section
|
||||||
extern void section_new_cheap_scope(struct section *section);
|
extern void section_new_cheap_scope(struct section *section);
|
||||||
// setup outermost section
|
// setup outermost section
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#define tree_H
|
#define tree_H
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdio.h> // for FILE
|
#include <stdio.h> // for FILE
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
// macros for pre-defining tree node tables
|
// macros for pre-defining tree node tables
|
||||||
|
@ -9,30 +9,34 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
|
||||||
static int in_address_block = FALSE;
|
static boolean in_address_block = FALSE;
|
||||||
static int in_address_statement = FALSE;
|
static boolean in_address_statement = FALSE;
|
||||||
|
|
||||||
// Functions
|
// 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)
|
void typesystem_force_address_block(void)
|
||||||
{
|
{
|
||||||
int buffer = in_address_block;
|
boolean buffer = in_address_block;
|
||||||
|
|
||||||
in_address_block = TRUE;
|
in_address_block = TRUE;
|
||||||
Parse_optional_block();
|
Parse_optional_block();
|
||||||
in_address_block = buffer;
|
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;
|
in_address_statement = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// warn if result is not integer
|
||||||
void typesystem_want_imm(struct number *result)
|
void typesystem_want_imm(struct number *result)
|
||||||
{
|
{
|
||||||
if (!config.warn_on_type_mismatch)
|
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);
|
//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)
|
void typesystem_want_addr(struct number *result)
|
||||||
{
|
{
|
||||||
if (!config.warn_on_type_mismatch)
|
if (!config.warn_on_type_mismatch)
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
|
|
||||||
// return whether explicit symbol definitions should force "address" mode
|
// 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
|
// parse a block while forcing address mode
|
||||||
extern void typesystem_force_address_block(void);
|
extern void typesystem_force_address_block(void);
|
||||||
// force address mode on or off for the next statement
|
// 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
|
// warn if result is not integer
|
||||||
extern void typesystem_want_imm(struct number *result);
|
extern void typesystem_want_imm(struct number *result);
|
||||||
// warn if result is not address
|
// warn if result is not address
|
||||||
|
Loading…
x
Reference in New Issue
Block a user