mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Make comments more consistent
- Changes most `/* comments */` to `// comments` - Changes `/**` block comments consistently to `/*` - Adds consistent license comments to all files Also renames `T_POP_SET` to `T_Z80_SET`
This commit is contained in:
@@ -20,4 +20,4 @@ void charmap_Add(char *mapping, uint8_t value);
|
||||
size_t charmap_Convert(char const *input, uint8_t *output);
|
||||
size_t charmap_ConvertNext(char const **input, uint8_t **output);
|
||||
|
||||
#endif /* RGBDS_ASM_CHARMAP_H */
|
||||
#endif // RGBDS_ASM_CHARMAP_H
|
||||
|
||||
@@ -28,4 +28,4 @@ int32_t fix_Round(int32_t i);
|
||||
int32_t fix_Ceil(int32_t i);
|
||||
int32_t fix_Floor(int32_t i);
|
||||
|
||||
#endif /* RGBDS_ASM_FIXPOINT_H */
|
||||
#endif // RGBDS_ASM_FIXPOINT_H
|
||||
|
||||
@@ -60,4 +60,4 @@ void fmt_FinishCharacters(struct FormatSpec *fmt);
|
||||
void fmt_PrintString(char *buf, size_t bufLen, struct FormatSpec const *fmt, char const *value);
|
||||
void fmt_PrintNumber(char *buf, size_t bufLen, struct FormatSpec const *fmt, uint32_t value);
|
||||
|
||||
#endif /* RGBDS_FORMAT_SPEC_H */
|
||||
#endif // RGBDS_FORMAT_SPEC_H
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/*
|
||||
* Contains some assembler-wide defines and externs
|
||||
*/
|
||||
// Contains some assembler-wide defines and externs
|
||||
|
||||
#ifndef RGBDS_ASM_FSTACK_H
|
||||
#define RGBDS_ASM_FSTACK_H
|
||||
@@ -21,13 +19,13 @@
|
||||
|
||||
|
||||
struct FileStackNode {
|
||||
struct FileStackNode *parent; /* Pointer to parent node, for error reporting */
|
||||
/* Line at which the parent context was exited; meaningless for the root level */
|
||||
struct FileStackNode *parent; // Pointer to parent node, for error reporting
|
||||
// Line at which the parent context was exited; meaningless for the root level
|
||||
uint32_t lineNo;
|
||||
|
||||
struct FileStackNode *next; /* Next node in the output linked list */
|
||||
bool referenced; /* If referenced, don't free! */
|
||||
uint32_t ID; /* Set only if referenced: ID within the object file, -1 if not output yet */
|
||||
struct FileStackNode *next; // Next node in the output linked list
|
||||
bool referenced; // If referenced, don't free!
|
||||
uint32_t ID; // Set only if referenced: ID within the object file, -1 if not output yet
|
||||
|
||||
enum {
|
||||
NODE_REPT,
|
||||
@@ -36,16 +34,16 @@ struct FileStackNode {
|
||||
} type;
|
||||
};
|
||||
|
||||
struct FileStackReptNode { /* NODE_REPT */
|
||||
struct FileStackReptNode { // NODE_REPT
|
||||
struct FileStackNode node;
|
||||
uint32_t reptDepth;
|
||||
/* WARNING: if changing this type, change overflow check in `fstk_Init` */
|
||||
uint32_t iters[]; /* REPT iteration counts since last named node, in reverse depth order */
|
||||
// WARNING: if changing this type, change overflow check in `fstk_Init`
|
||||
uint32_t iters[]; // REPT iteration counts since last named node, in reverse depth order
|
||||
};
|
||||
|
||||
struct FileStackNamedNode { /* NODE_FILE, NODE_MACRO */
|
||||
struct FileStackNamedNode { // NODE_FILE, NODE_MACRO
|
||||
struct FileStackNode node;
|
||||
char name[]; /* File name for files, file::macro name for macros */
|
||||
char name[]; // File name for files, file::macro name for macros
|
||||
};
|
||||
|
||||
#define DEFAULT_MAX_DEPTH 64
|
||||
@@ -56,11 +54,11 @@ struct MacroArgs;
|
||||
void fstk_Dump(struct FileStackNode const *node, uint32_t lineNo);
|
||||
void fstk_DumpCurrent(void);
|
||||
struct FileStackNode *fstk_GetFileStack(void);
|
||||
/* The lifetime of the returned chars is until reaching the end of that file */
|
||||
// The lifetime of the returned chars is until reaching the end of that file
|
||||
char const *fstk_GetFileName(void);
|
||||
|
||||
void fstk_AddIncludePath(char const *s);
|
||||
/**
|
||||
/*
|
||||
* @param path The user-provided file name
|
||||
* @param fullPath The address of a pointer, which will be made to point at the full path
|
||||
* The pointer's value must be a valid argument to `realloc`, including NULL
|
||||
@@ -81,4 +79,4 @@ bool fstk_Break(void);
|
||||
void fstk_NewRecursionDepth(size_t newDepth);
|
||||
void fstk_Init(char const *mainPath, size_t maxDepth);
|
||||
|
||||
#endif /* RGBDS_ASM_FSTACK_H */
|
||||
#endif // RGBDS_ASM_FSTACK_H
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MAXSTRLEN 255
|
||||
#define MAXSTRLEN 255
|
||||
|
||||
struct LexerState;
|
||||
extern struct LexerState *lexerState;
|
||||
@@ -49,9 +49,7 @@ static inline void lexer_SetGfxDigits(char const digits[4])
|
||||
gfxDigits[3] = digits[3];
|
||||
}
|
||||
|
||||
/*
|
||||
* `path` is referenced, but not held onto..!
|
||||
*/
|
||||
// `path` is referenced, but not held onto..!
|
||||
struct LexerState *lexer_OpenFile(char const *path);
|
||||
struct LexerState *lexer_OpenFileView(char const *path, char *buf, size_t size, uint32_t lineNo);
|
||||
void lexer_RestartRept(uint32_t lineNo);
|
||||
@@ -99,4 +97,4 @@ struct DsArgList {
|
||||
struct Expression *args;
|
||||
};
|
||||
|
||||
#endif /* RGBDS_ASM_LEXER_H */
|
||||
#endif // RGBDS_ASM_LEXER_H
|
||||
|
||||
@@ -34,4 +34,4 @@ uint32_t macro_UseNewUniqueID(void);
|
||||
void macro_ShiftCurrentArgs(int32_t count);
|
||||
uint32_t macro_NbArgs(void);
|
||||
|
||||
#endif
|
||||
#endif // RGBDS_MACRO_H
|
||||
|
||||
@@ -20,7 +20,7 @@ extern bool warnOnHaltNop;
|
||||
extern bool optimizeLoads;
|
||||
extern bool warnOnLdOpt;
|
||||
extern bool verbose;
|
||||
extern bool warnings; /* True to enable warnings, false to disable them. */
|
||||
extern bool warnings; // True to enable warnings, false to disable them.
|
||||
|
||||
extern FILE *dependfile;
|
||||
extern char *targetFileName;
|
||||
@@ -28,4 +28,4 @@ extern bool generatedMissingIncludes;
|
||||
extern bool failedOnMissingInclude;
|
||||
extern bool generatePhonyDeps;
|
||||
|
||||
#endif /* RGBDS_MAIN_H */
|
||||
#endif // RGBDS_MAIN_H
|
||||
|
||||
@@ -22,4 +22,4 @@ void opt_Parse(char const *option);
|
||||
void opt_Push(void);
|
||||
void opt_Pop(void);
|
||||
|
||||
#endif
|
||||
#endif // RGBDS_OPT_H
|
||||
|
||||
@@ -27,4 +27,4 @@ bool out_CreateAssert(enum AssertionType type, struct Expression const *expr,
|
||||
char const *message, uint32_t ofs);
|
||||
void out_WriteObject(void);
|
||||
|
||||
#endif /* RGBDS_ASM_OUTPUT_H */
|
||||
#endif // RGBDS_ASM_OUTPUT_H
|
||||
|
||||
@@ -27,17 +27,13 @@ struct Expression {
|
||||
uint32_t rpnPatchSize; // Size the expression will take in the object file
|
||||
};
|
||||
|
||||
/*
|
||||
* Determines if an expression is known at assembly time
|
||||
*/
|
||||
// Determines if an expression is known at assembly time
|
||||
static inline bool rpn_isKnown(struct Expression const *expr)
|
||||
{
|
||||
return expr->isKnown;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determines if an expression is a symbol suitable for const diffing
|
||||
*/
|
||||
// Determines if an expression is a symbol suitable for const diffing
|
||||
static inline bool rpn_isSymbol(const struct Expression *expr)
|
||||
{
|
||||
return expr->isSymbol;
|
||||
@@ -67,4 +63,4 @@ void rpn_CheckRST(struct Expression *expr, const struct Expression *src);
|
||||
void rpn_CheckNBit(struct Expression const *expr, uint8_t n);
|
||||
int32_t rpn_GetConstVal(struct Expression const *expr);
|
||||
|
||||
#endif /* RGBDS_ASM_RPN_H */
|
||||
#endif // RGBDS_ASM_RPN_H
|
||||
|
||||
@@ -23,8 +23,8 @@ struct Section {
|
||||
char *name;
|
||||
enum SectionType type;
|
||||
enum SectionModifier modifier;
|
||||
struct FileStackNode *src; /* Where the section was defined */
|
||||
uint32_t fileLine; /* Line where the section was defined */
|
||||
struct FileStackNode *src; // Where the section was defined
|
||||
uint32_t fileLine; // Line where the section was defined
|
||||
uint32_t size;
|
||||
uint32_t org;
|
||||
uint32_t bank;
|
||||
@@ -79,4 +79,4 @@ void sect_PopSection(void);
|
||||
|
||||
bool sect_IsSizeKnown(struct Section const NONNULL(name));
|
||||
|
||||
#endif
|
||||
#endif // RGBDS_SECTION_H
|
||||
|
||||
@@ -32,28 +32,28 @@ enum SymbolType {
|
||||
struct Symbol {
|
||||
char name[MAXSYMLEN + 1];
|
||||
enum SymbolType type;
|
||||
bool isExported; /* Whether the symbol is to be exported */
|
||||
bool isBuiltin; /* Whether the symbol is a built-in */
|
||||
bool isExported; // Whether the symbol is to be exported
|
||||
bool isBuiltin; // Whether the symbol is a built-in
|
||||
struct Section *section;
|
||||
struct FileStackNode *src; /* Where the symbol was defined */
|
||||
uint32_t fileLine; /* Line where the symbol was defined */
|
||||
struct FileStackNode *src; // Where the symbol was defined
|
||||
uint32_t fileLine; // Line where the symbol was defined
|
||||
|
||||
bool hasCallback;
|
||||
union {
|
||||
/* If sym_IsNumeric */
|
||||
// If sym_IsNumeric
|
||||
int32_t value;
|
||||
int32_t (*numCallback)(void);
|
||||
/* For SYM_MACRO and SYM_EQUS; TODO: have separate fields */
|
||||
// For SYM_MACRO and SYM_EQUS; TODO: have separate fields
|
||||
struct {
|
||||
size_t macroSize;
|
||||
char *macro;
|
||||
};
|
||||
/* For SYM_EQUS */
|
||||
// For SYM_EQUS
|
||||
char const *(*strCallback)(void);
|
||||
};
|
||||
|
||||
uint32_t ID; /* ID of the symbol in the object file (-1 if none) */
|
||||
struct Symbol *next; /* Next object to output in the object file */
|
||||
uint32_t ID; // ID of the symbol in the object file (-1 if none)
|
||||
struct Symbol *next; // Next object to output in the object file
|
||||
};
|
||||
|
||||
bool sym_IsPC(struct Symbol const *sym);
|
||||
@@ -98,9 +98,7 @@ static inline bool sym_IsExported(struct Symbol const *sym)
|
||||
return sym->isExported;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a string equate's value
|
||||
*/
|
||||
// Get a string equate's value
|
||||
static inline char const *sym_GetStringValue(struct Symbol const *sym)
|
||||
{
|
||||
if (sym->hasCallback)
|
||||
@@ -123,17 +121,11 @@ struct Symbol *sym_AddVar(char const *symName, int32_t value);
|
||||
uint32_t sym_GetPCValue(void);
|
||||
uint32_t sym_GetConstantSymValue(struct Symbol const *sym);
|
||||
uint32_t sym_GetConstantValue(char const *symName);
|
||||
/*
|
||||
* Find a symbol by exact name, bypassing expansion checks
|
||||
*/
|
||||
// Find a symbol by exact name, bypassing expansion checks
|
||||
struct Symbol *sym_FindExactSymbol(char const *symName);
|
||||
/*
|
||||
* Find a symbol by exact name; may not be scoped, produces an error if it is
|
||||
*/
|
||||
// Find a symbol by exact name; may not be scoped, produces an error if it is
|
||||
struct Symbol *sym_FindUnscopedSymbol(char const *symName);
|
||||
/*
|
||||
* Find a symbol, possibly scoped, by name
|
||||
*/
|
||||
// Find a symbol, possibly scoped, by name
|
||||
struct Symbol *sym_FindScopedSymbol(char const *symName);
|
||||
struct Symbol const *sym_GetPC(void);
|
||||
struct Symbol *sym_AddMacro(char const *symName, int32_t defLineNo, char *body, size_t size);
|
||||
@@ -143,8 +135,8 @@ struct Symbol *sym_RedefString(char const *symName, char const *value);
|
||||
void sym_Purge(char const *symName);
|
||||
void sym_Init(time_t now);
|
||||
|
||||
/* Functions to save and restore the current symbol scope. */
|
||||
// Functions to save and restore the current symbol scope.
|
||||
char const *sym_GetCurrentSymbolScope(void);
|
||||
void sym_SetCurrentSymbolScope(char const *newScope);
|
||||
|
||||
#endif /* RGBDS_SYMBOL_H */
|
||||
#endif // RGBDS_SYMBOL_H
|
||||
|
||||
@@ -18,4 +18,4 @@ char const *printChar(int c);
|
||||
*/
|
||||
size_t readUTF8Char(uint8_t *dest, char const *src);
|
||||
|
||||
#endif /* RGBDS_UTIL_H */
|
||||
#endif // RGBDS_UTIL_H
|
||||
|
||||
@@ -91,4 +91,4 @@ _Noreturn void fatalerror(char const *fmt, ...) format_(printf, 1, 2);
|
||||
*/
|
||||
void error(char const *fmt, ...) format_(printf, 1, 2);
|
||||
|
||||
#endif
|
||||
#endif // WARNING_H
|
||||
|
||||
Reference in New Issue
Block a user