mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-28 13:57:48 +00:00
Split RGBLINK linkerscript parser functions into their own file
This commit is contained in:
@@ -121,7 +121,6 @@ void lexer_SetGfxDigits(char const digits[4]);
|
||||
|
||||
bool lexer_AtTopLevel();
|
||||
void lexer_RestartRept(uint32_t lineNo);
|
||||
void lexer_Init();
|
||||
void lexer_SetMode(LexerMode mode);
|
||||
void lexer_ToggleStringExpansion(bool enable);
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ enum SymbolType {
|
||||
SYM_REF // Forward reference to a label
|
||||
};
|
||||
|
||||
struct Symbol; // For the `sym_IsPC` forward declaration
|
||||
bool sym_IsPC(Symbol const *sym); // For the inline `getSection` method
|
||||
struct Symbol; // Forward declaration for `sym_IsPC`
|
||||
bool sym_IsPC(Symbol const *sym); // Forward declaration for `getSection`
|
||||
|
||||
struct Symbol {
|
||||
std::string name;
|
||||
|
||||
@@ -80,18 +80,6 @@ struct Options {
|
||||
|
||||
extern Options options;
|
||||
|
||||
// Prints the error count, and exits with failure
|
||||
[[noreturn]]
|
||||
void giveUp();
|
||||
// If any error has been emitted thus far, calls `giveUp()`.
|
||||
void requireZeroErrors();
|
||||
// Prints an error, and increments the error count
|
||||
[[gnu::format(printf, 1, 2)]]
|
||||
void error(char const *fmt, ...);
|
||||
// Prints a fatal error, increments the error count, and gives up
|
||||
[[gnu::format(printf, 1, 2), noreturn]]
|
||||
void fatal(char const *fmt, ...);
|
||||
|
||||
struct Palette {
|
||||
// An array of 4 GBC-native (RGB555) colors
|
||||
std::array<uint16_t, 4> colors{UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
|
||||
|
||||
39
include/link/layout.hpp
Normal file
39
include/link/layout.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#ifndef RGBDS_LINK_LAYOUT_HPP
|
||||
#define RGBDS_LINK_LAYOUT_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#include "linkdefs.hpp"
|
||||
|
||||
struct LexerStackEntry {
|
||||
std::filebuf file;
|
||||
std::string path;
|
||||
uint32_t lineNo;
|
||||
|
||||
explicit LexerStackEntry(std::string &&path_) : file(), path(path_), lineNo(1) {}
|
||||
};
|
||||
|
||||
#define scriptError(context, fmt, ...) \
|
||||
::error( \
|
||||
"%s(%" PRIu32 "): " fmt, context.path.c_str(), context.lineNo __VA_OPT__(, ) __VA_ARGS__ \
|
||||
)
|
||||
|
||||
LexerStackEntry &lexer_Context();
|
||||
void lexer_IncludeFile(std::string &&path);
|
||||
void lexer_IncLineNo();
|
||||
bool lexer_Init(char const *linkerScriptName);
|
||||
|
||||
void layout_SetFloatingSectionType(SectionType type);
|
||||
void layout_SetSectionType(SectionType type);
|
||||
void layout_SetSectionType(SectionType type, uint32_t bank);
|
||||
void layout_SetAddr(uint32_t addr);
|
||||
void layout_MakeAddrFloating();
|
||||
void layout_AlignTo(uint32_t alignment, uint32_t offset);
|
||||
void layout_Pad(uint32_t length);
|
||||
void layout_PlaceSection(std::string const &name, bool isOptional);
|
||||
|
||||
#endif // RGBDS_LINK_LAYOUT_HPP
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
struct Options {
|
||||
bool isDmgMode; // -d
|
||||
char const *linkerScriptName; // -l
|
||||
char const *mapFileName; // -m
|
||||
bool noSymInMap; // -M
|
||||
char const *symFileName; // -n
|
||||
@@ -22,9 +21,9 @@ struct Options {
|
||||
uint8_t padValue; // -p
|
||||
bool hasPadValue = false;
|
||||
// Setting these three to 0 disables the functionality
|
||||
uint16_t scrambleROMX = 0; // -S
|
||||
uint8_t scrambleWRAMX = 0;
|
||||
uint8_t scrambleSRAM = 0;
|
||||
uint16_t scrambleROMX; // -S
|
||||
uint8_t scrambleWRAMX;
|
||||
uint8_t scrambleSRAM;
|
||||
bool is32kMode; // -t
|
||||
bool beVerbose; // -v
|
||||
bool isWRAM0Mode; // -w
|
||||
|
||||
Reference in New Issue
Block a user