mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-22 18:32:09 +00:00
typedef'd boolean to make source more readable. added "--test" option
(unused atm). no change in functionality. git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@130 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
bf074b830d
commit
7286e00855
@ -65,6 +65,7 @@ static const char arg_vicelabels[] = "VICE labels filename";
|
||||
#define OPTION_FULLSTOP "fullstop"
|
||||
#define OPTION_IGNORE_ZEROES "ignore-zeroes"
|
||||
#define OPTION_STRICT_SEGMENTS "strict-segments"
|
||||
#define OPTION_TEST "test"
|
||||
// options for "-W"
|
||||
#define OPTIONWNO_LABEL_INDENT "no-label-indent"
|
||||
#define OPTIONWNO_OLD_FOR "no-old-for"
|
||||
@ -146,6 +147,7 @@ static void show_help_and_exit(void)
|
||||
" --" OPTION_MSVC " output errors in MS VS format\n"
|
||||
" --" OPTION_COLOR " uses ANSI color codes for error output\n"
|
||||
" --" OPTION_FULLSTOP " use '.' as pseudo opcode prefix\n"
|
||||
" --" OPTION_TEST " enable experimental features\n"
|
||||
PLATFORM_OPTION_HELP
|
||||
" -V, --" OPTION_VERSION " show version and exit\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
@ -480,6 +482,8 @@ static const char *long_option(const char *string)
|
||||
config.honor_leading_zeroes = FALSE;
|
||||
else if (strcmp(string, OPTION_STRICT_SEGMENTS) == 0)
|
||||
config.segment_warning_is_error = TRUE;
|
||||
else if (strcmp(string, OPTION_TEST) == 0)
|
||||
config.test_new_features = TRUE;
|
||||
PLATFORM_LONGOPTION_CODE
|
||||
else if (strcmp(string, OPTION_COLOR) == 0)
|
||||
config.format_color = TRUE;
|
||||
|
@ -609,7 +609,7 @@ static int expect_operand_or_monadic_operator(void)
|
||||
{
|
||||
struct operator *operator;
|
||||
int ugly_length_kluge;
|
||||
int perform_negation; // actually bool
|
||||
boolean perform_negation;
|
||||
|
||||
SKIPSPACE();
|
||||
switch (GotByte) {
|
||||
|
@ -23,9 +23,9 @@ enum expression_type {
|
||||
struct expression {
|
||||
//enum expression_type type;
|
||||
struct number number;
|
||||
int is_empty; // actually bool: nothing parsed (first character was a delimiter) FIXME - make into its own result type!
|
||||
boolean is_empty; // nothing parsed (first character was a delimiter) FIXME - make into its own result type!
|
||||
int open_parentheses; // number of parentheses still open
|
||||
int is_parenthesized; // actually bool: whole expression was in parentheses (indicating indirect addressing)
|
||||
boolean is_parenthesized; // whole expression was in parentheses (indicating indirect addressing)
|
||||
};
|
||||
|
||||
|
||||
|
13
src/config.h
13
src/config.h
@ -7,7 +7,15 @@
|
||||
#define config_H
|
||||
|
||||
|
||||
// make sure the enum below works with strange compilers, too:
|
||||
#ifdef FALSE
|
||||
#undef FALSE
|
||||
#endif
|
||||
#ifdef TRUE
|
||||
#undef TRUE
|
||||
#endif
|
||||
// types
|
||||
typedef enum { FALSE = 0, TRUE } boolean; // yes, I could include <stdbool.h>, but this source should work with ancient compilers as well...
|
||||
typedef unsigned int scope_t;
|
||||
typedef signed long intval_t; // at least 32 bits
|
||||
typedef unsigned long uintval_t; // just for logical shift right
|
||||
@ -37,11 +45,6 @@ struct number { // either int or float
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
// Boolean values
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,7 @@ void flow_forloop(struct for_loop *loop)
|
||||
loop_counter.val.intval = loop->counter.first;
|
||||
loop_counter.addr_refs = loop->counter.addr_refs;
|
||||
symbol_set_value(loop->symbol, &loop_counter, TRUE);
|
||||
if (loop->old_algo) {
|
||||
if (loop->use_old_algo) {
|
||||
// old algo for old syntax:
|
||||
// if count == 0, skip loop
|
||||
if (loop->counter.last) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Copyright (C) 1998-2020 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// flow control stuff (loops, conditional assembly etc.)
|
||||
@ -19,7 +19,7 @@ struct block {
|
||||
// struct to pass "!for" loop stuff from pseudoopcodes.c to flow.c
|
||||
struct for_loop {
|
||||
struct symbol *symbol;
|
||||
int old_algo; // actually bool
|
||||
boolean use_old_algo;
|
||||
struct {
|
||||
intval_t first,
|
||||
last,
|
||||
@ -32,7 +32,7 @@ struct for_loop {
|
||||
// structs to pass "!do" loop stuff from pseudoopcodes.c to flow.c
|
||||
struct loop_condition {
|
||||
int line; // original line number
|
||||
int is_until; // actually bool (0 for WHILE, 1 for UNTIL)
|
||||
boolean is_until; // so FALSE means WHILE, TRUE means UNTIL)
|
||||
char *body; // pointer to actual expression
|
||||
};
|
||||
struct do_loop {
|
||||
|
@ -133,6 +133,7 @@ void config_default(struct config *conf)
|
||||
conf->msg_stream = stderr; // set to stdout by --use-stdout
|
||||
conf->honor_leading_zeroes = TRUE; // disabled by --ignore-zeroes
|
||||
conf->segment_warning_is_error = FALSE; // enabled by --strict-segments TODO - toggle default?
|
||||
conf->test_new_features = FALSE; // enabled by --test
|
||||
}
|
||||
|
||||
// memory allocation stuff
|
||||
|
15
src/global.h
15
src/global.h
@ -67,15 +67,16 @@ extern int pass_real_errors; // Errors yet
|
||||
struct config {
|
||||
char pseudoop_prefix; // '!' or '.'
|
||||
int process_verbosity; // level of additional output
|
||||
int warn_on_indented_labels; // actually bool: warn if indented label is encountered
|
||||
int warn_on_old_for; // actually bool: warn if "!for" with old syntax is found
|
||||
int warn_on_type_mismatch; // actually bool: use type-checking system
|
||||
boolean warn_on_indented_labels; // warn if indented label is encountered
|
||||
boolean warn_on_old_for; // warn if "!for" with old syntax is found
|
||||
boolean warn_on_type_mismatch; // use type-checking system
|
||||
signed long max_errors; // errors before giving up
|
||||
int format_msvc; // actually bool, enabled by --msvc
|
||||
int format_color; // actually bool, enabled by --color
|
||||
boolean format_msvc; // enabled by --msvc
|
||||
boolean format_color; // enabled by --color
|
||||
FILE *msg_stream; // defaults to stderr, changed to stdout by --use-stdout
|
||||
int honor_leading_zeroes; // actually bool, TRUE, disabled by --ignore-zeroes
|
||||
int segment_warning_is_error; // actually bool, FALSE, enabled by --strict-segments
|
||||
boolean honor_leading_zeroes; // TRUE, disabled by --ignore-zeroes
|
||||
boolean segment_warning_is_error; // FALSE, enabled by --strict-segments
|
||||
boolean test_new_features; // FALSE, enabled by --test
|
||||
};
|
||||
extern struct config config;
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct output {
|
||||
intval_t write_idx; // index of next write
|
||||
intval_t lowest_written; // smallest address used
|
||||
intval_t highest_written; // largest address used
|
||||
int initvalue_set; // actually bool
|
||||
boolean initvalue_set;
|
||||
struct {
|
||||
intval_t start; // start of current segment (or NO_SEGMENT_START)
|
||||
intval_t max; // highest address segment may use
|
||||
|
@ -66,7 +66,7 @@ void notreallypo_setpc(void)
|
||||
read memory limit
|
||||
} else if (strcmp(GlobalDynaBuf->buffer, "name") == 0) {
|
||||
skip '='
|
||||
read segment name */
|
||||
read segment name (quoted string!) */
|
||||
} else {
|
||||
Throw_error("Unknown \"* =\" segment modifier.");
|
||||
return;
|
||||
@ -893,7 +893,7 @@ static enum eos po_for(void) // now GotByte = illegal char
|
||||
ALU_defined_int(&intresult); // read first argument
|
||||
loop.counter.addr_refs = intresult.addr_refs;
|
||||
if (Input_accept_comma()) {
|
||||
loop.old_algo = FALSE; // new format - yay!
|
||||
loop.use_old_algo = FALSE; // new format - yay!
|
||||
if (!config.warn_on_old_for)
|
||||
Throw_first_pass_warning("Found new \"!for\" syntax.");
|
||||
loop.counter.first = intresult.val.intval; // use first argument
|
||||
@ -906,7 +906,7 @@ static enum eos po_for(void) // now GotByte = illegal char
|
||||
}
|
||||
loop.counter.increment = (loop.counter.last < loop.counter.first) ? -1 : 1;
|
||||
} else {
|
||||
loop.old_algo = TRUE; // old format - booo!
|
||||
loop.use_old_algo = TRUE; // old format - booo!
|
||||
if (config.warn_on_old_for)
|
||||
Throw_first_pass_warning("Found old \"!for\" syntax.");
|
||||
if (intresult.val.intval < 0)
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define RELEASE "0.96.5" // update before release FIXME
|
||||
#define CODENAME "Fenchurch" // update before release
|
||||
#define CHANGE_DATE "28 Apr" // update before release FIXME
|
||||
#define CHANGE_DATE "1 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