Skip to content

Commit 10fd924

Browse files
adding (void) to a few functions to match the protos
mention lack of INSTR
1 parent 7729211 commit 10fd924

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

doc/TODO

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ WB = Wang BASIC
99
PA = Palo Alto Tiny BASIC
1010
BP - DEC BASIC-PLUS
1111

12+
- add INSTR and variations thereof
13+
1214
- need to allow multiple INPUTs on a single line, currently it requires a CR between values
1315

1416
- test and error on incorrect nesting of FOR loops, which we currently ignore

src/list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
2424
* Creates an empty list node. Private method.
2525
*/
2626
list_t* _lst_alloc(void);
27-
list_t* _lst_alloc() {
27+
list_t* _lst_alloc(void) {
2828
list_t *node = (list_t *)malloc(sizeof(list_t));
2929
if (node == NULL)
3030
return NULL;

src/retrobasic.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static char* number_to_hex_string(const double d)
523523
}
524524

525525
/* number of jiffies since program start (or reset) 1/60th in Commodore/Atari format */
526-
static int elapsed_jiffies() {
526+
static int elapsed_jiffies(void) {
527527
struct timeval current_time, elapsed_time, reset_delta;
528528

529529
// get the delta between the original start time and the reset time (likely zero)
@@ -2167,8 +2167,10 @@ static void perform_statement(list_t *statement_entry)
21672167
if (statement->parms.generic_parameter != NULL) {
21682168
value_t message = evaluate_expression(statement->parms.generic_parameter);
21692169
printf("STOP: %s\n", message.string);
2170+
} else {
2171+
printf("STOPped at line: %d\n", current_line());
21702172
}
2171-
exit(0);
2173+
exit(EXIT_SUCCESS);
21722174
}
21732175
break;
21742176

@@ -2227,7 +2229,7 @@ static void perform_statement(list_t *statement_entry)
22272229

22282230
default:
22292231
printf("Unimplemented statement %d\n", statement->type);
2230-
exit(0);
2232+
exit(EXIT_FAILURE);
22312233
} //end switch
22322234
}
22332235
}
@@ -2257,20 +2259,20 @@ static void print_symbol(void *key, void *value, void *unused)
22572259
// return FALSE;
22582260
//}
22592261
/* used for VARLIST in those versions of BASIC that support it */
2260-
static void print_variables() {
2262+
static void print_variables(void) {
22612263
lst_foreach(interpreter_state.variable_values, print_symbol, NULL);
22622264
printf("\n\n");
22632265
}
22642266
/* used for CLEAR, NEW and similar instructions. */
2265-
static void delete_variables() {
2267+
static void delete_variables(void) {
22662268
lst_free_everything(interpreter_state.variable_values);
22672269
interpreter_state.variable_values = NULL;
22682270
}
2269-
static void delete_functions() {
2271+
static void delete_functions(void) {
22702272
lst_free_everything(interpreter_state.functions);
22712273
interpreter_state.functions = NULL;
22722274
}
2273-
static void delete_lines() {
2275+
static void delete_lines(void) {
22742276
for(int i = MAXLINE - 1; i >= 0; i--) {
22752277
if (interpreter_state.lines[i] != NULL) {
22762278
lst_free(interpreter_state.lines[i]);
@@ -2279,7 +2281,7 @@ static void delete_lines() {
22792281
}
22802282

22812283
/* set up empty trees to store variables and user functions as we find them */
2282-
void interpreter_setup()
2284+
void interpreter_setup(void)
22832285
{
22842286
interpreter_state.variable_values = NULL;
22852287
interpreter_state.functions = NULL;

src/scan.l

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,11 @@ SUBSTRING\$ { return SUBSTR; }
131131
/* system functions */
132132
TAB { return TAB; }
133133
SPC { return SPC; }
134-
PEEK { return PEEK; } // also EXAM (North Star) and FETCH (Digital Group Opus)
134+
SPA { return SPC; } // from HP, same as SPC
135+
PEEK { return PEEK; } // also EXAM (North Star) and FETCH (Digital Group Opus)
135136
FRE { return FRE; }
136137
USR { return USR; }
137138
LIN { return LIN; }
138-
/* aliases for SPC */
139-
SPA { return SPC; } // from HP, same as above
140-
SPACE\$ { return SPC; } // returns a string with spaces, doesn't just output it, but we allow assignment anyway so this works
141139

142140
/* various operators and punctuation */
143141
[:,;()\[\]\^=+\-*/\<\>\&] { return yytext[0]; }
@@ -173,6 +171,7 @@ CONVERT { return CONVERT; }
173171
UCASE\$ { return UCASE; }
174172
LCASE\$ { return LCASE; }
175173
STRING\$ { return STRNG; } // returns n copies of a given string
174+
SPACE\$ { return SPC; } // returns n spaces as a value, which is how our SPC works anyway
176175

177176
/* commodore-style TIME and TIME$ */
178177
TIME\$ { return TIME_STR; }

src/statistics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static void is_integer(void *key, void *value, void *user_data)
102102

103103
/* prints out various statistics from the static code,
104104
or if the write_stats flag is on, writes them to a file */
105-
void print_statistics()
105+
void print_statistics(void)
106106
{
107107
int lines_total = 0, line_min = MAXLINE + 1, line_max = -1;
108108
double linenum_1_digit = 0.0, linenum_2_digit = 0.0, linenum_3_digit = 0.0, linenum_4_digit = 0.0, linenum_5_digit = 0.0;

0 commit comments

Comments
 (0)