mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-26 13:02:07 +00:00
Significantly overhaul OPT code
Simplify the mess that was option setting (2 redundant variables !?) Move options to a separate file Have "modules" own their options, and OPT only access them (less redundancy) Simplify code, respect naming conventions better
This commit is contained in:
@@ -30,17 +30,21 @@ static inline void lexer_SetStateAtEOL(struct LexerState *state)
|
||||
lexerStateEOL = state;
|
||||
}
|
||||
|
||||
extern char const *binDigits;
|
||||
extern char const *gfxDigits;
|
||||
extern char binDigits[2];
|
||||
extern char gfxDigits[4];
|
||||
|
||||
static inline void lexer_SetBinDigits(char const *digits)
|
||||
static inline void lexer_SetBinDigits(char const digits[2])
|
||||
{
|
||||
binDigits = digits;
|
||||
binDigits[0] = digits[0];
|
||||
binDigits[1] = digits[1];
|
||||
}
|
||||
|
||||
static inline void lexer_SetGfxDigits(char const *digits)
|
||||
static inline void lexer_SetGfxDigits(char const digits[4])
|
||||
{
|
||||
gfxDigits = digits;
|
||||
gfxDigits[0] = digits[0];
|
||||
gfxDigits[1] = digits[1];
|
||||
gfxDigits[2] = digits[2];
|
||||
gfxDigits[3] = digits[3];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of RGBDS.
|
||||
*
|
||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
||||
* Copyright (c) 1997-2021, Carsten Sorensen and RGBDS contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
@@ -15,19 +15,6 @@
|
||||
|
||||
#include "helpers.h"
|
||||
|
||||
struct sOptions {
|
||||
char binary[2];
|
||||
char gbgfx[4];
|
||||
int32_t fillchar;
|
||||
};
|
||||
|
||||
extern char *tzNewMacro;
|
||||
extern uint32_t ulNewMacroSize;
|
||||
extern int32_t nGBGfxID;
|
||||
extern int32_t nBinaryID;
|
||||
|
||||
extern struct sOptions DefaultOptions;
|
||||
extern struct sOptions CurrentOptions;
|
||||
extern bool haltnop;
|
||||
extern bool optimizeloads;
|
||||
extern bool verbose;
|
||||
@@ -39,10 +26,6 @@ extern bool oGeneratedMissingIncludes;
|
||||
extern bool oFailedOnMissingInclude;
|
||||
extern bool oGeneratePhonyDeps;
|
||||
|
||||
void opt_Push(void);
|
||||
void opt_Pop(void);
|
||||
void opt_Parse(char *s);
|
||||
|
||||
/* TODO: are these really needed? */
|
||||
#define YY_FATAL_ERROR fatalerror
|
||||
|
||||
|
||||
22
include/asm/opt.h
Normal file
22
include/asm/opt.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file is part of RGBDS.
|
||||
*
|
||||
* Copyright (c) 2021, Eldred Habert and RGBDS contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef RGBDS_OPT_H
|
||||
#define RGBDS_OPT_H
|
||||
|
||||
|
||||
void opt_B(char chars[2]);
|
||||
void opt_G(char chars[4]);
|
||||
void opt_P(uint8_t fill);
|
||||
void opt_Parse(char const *option);
|
||||
|
||||
void opt_Push(void);
|
||||
void opt_Pop(void);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "linkdefs.h"
|
||||
|
||||
extern uint8_t fillByte;
|
||||
|
||||
struct Expression;
|
||||
|
||||
struct Section {
|
||||
|
||||
Reference in New Issue
Block a user