mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +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:
@@ -6,7 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Assigning all sections a place */
|
||||
// Assigning all sections a place
|
||||
#ifndef RGBDS_LINK_ASSIGN_H
|
||||
#define RGBDS_LINK_ASSIGN_H
|
||||
|
||||
@@ -14,14 +14,10 @@
|
||||
|
||||
extern uint64_t nbSectionsToAssign;
|
||||
|
||||
/**
|
||||
* Assigns all sections a slice of the address space
|
||||
*/
|
||||
// Assigns all sections a slice of the address space
|
||||
void assign_AssignSections(void);
|
||||
|
||||
/**
|
||||
* `free`s all assignment memory that was allocated.
|
||||
*/
|
||||
// `free`s all assignment memory that was allocated
|
||||
void assign_Cleanup(void);
|
||||
|
||||
#endif /* RGBDS_LINK_ASSIGN_H */
|
||||
#endif // RGBDS_LINK_ASSIGN_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Declarations that all modules use, as well as `main` and related */
|
||||
// Declarations that all modules use, as well as `main` and related
|
||||
#ifndef RGBDS_LINK_MAIN_H
|
||||
#define RGBDS_LINK_MAIN_H
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "helpers.h"
|
||||
|
||||
/* Variables related to CLI options */
|
||||
// Variables related to CLI options
|
||||
extern bool isDmgMode;
|
||||
extern char *linkerScriptName;
|
||||
extern char const *mapFileName;
|
||||
@@ -35,7 +35,7 @@ extern bool disablePadding;
|
||||
|
||||
struct FileStackNode {
|
||||
struct FileStackNode *parent;
|
||||
/* Line at which the parent context was exited; meaningless for the root level */
|
||||
// Line at which the parent context was exited; meaningless for the root level
|
||||
uint32_t lineNo;
|
||||
|
||||
enum {
|
||||
@@ -44,21 +44,21 @@ struct FileStackNode {
|
||||
NODE_MACRO,
|
||||
} type;
|
||||
union {
|
||||
char *name; /* NODE_FILE, NODE_MACRO */
|
||||
struct { /* NODE_REPT */
|
||||
char *name; // NODE_FILE, NODE_MACRO
|
||||
struct { // NODE_REPT
|
||||
uint32_t reptDepth;
|
||||
uint32_t *iters;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/* Helper macro for printing verbose-mode messages */
|
||||
// Helper macro for printing verbose-mode messages
|
||||
#define verbosePrint(...) do { \
|
||||
if (beVerbose) \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
/*
|
||||
* Dump a file stack to stderr
|
||||
* @param node The leaf node to dump the context of
|
||||
*/
|
||||
@@ -73,7 +73,7 @@ void error(struct FileStackNode const *where, uint32_t lineNo,
|
||||
_Noreturn void fatal(struct FileStackNode const *where, uint32_t lineNo,
|
||||
char const *fmt, ...) format_(printf, 3, 4);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Opens a file if specified, and aborts on error.
|
||||
* @param fileName The name of the file to open; if NULL, no file will be opened
|
||||
* @param mode The mode to open the file with
|
||||
@@ -87,4 +87,4 @@ FILE *openFile(char const *fileName, char const *mode);
|
||||
fclose(tmp); \
|
||||
} while (0)
|
||||
|
||||
#endif /* RGBDS_LINK_MAIN_H */
|
||||
#endif // RGBDS_LINK_MAIN_H
|
||||
|
||||
@@ -6,37 +6,37 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Declarations related to processing of object (.o) files */
|
||||
// Declarations related to processing of object (.o) files
|
||||
|
||||
#ifndef RGBDS_LINK_OBJECT_H
|
||||
#define RGBDS_LINK_OBJECT_H
|
||||
|
||||
/**
|
||||
/*
|
||||
* Read an object (.o) file, and add its info to the data structures.
|
||||
* @param fileName A path to the object file to be read
|
||||
* @param i The ID of the file
|
||||
*/
|
||||
void obj_ReadFile(char const *fileName, unsigned int i);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Perform validation on the object files' contents
|
||||
*/
|
||||
void obj_DoSanityChecks(void);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Evaluate all assertions
|
||||
*/
|
||||
void obj_CheckAssertions(void);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Sets up object file reading
|
||||
* @param nbFiles The number of object files that will be read
|
||||
*/
|
||||
void obj_Setup(unsigned int nbFiles);
|
||||
|
||||
/**
|
||||
/*
|
||||
* `free`s all object memory that was allocated.
|
||||
*/
|
||||
void obj_Cleanup(void);
|
||||
|
||||
#endif /* RGBDS_LINK_OBJECT_H */
|
||||
#endif // RGBDS_LINK_OBJECT_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Outputting the result of linking */
|
||||
// Outputting the result of linking
|
||||
#ifndef RGBDS_LINK_OUTPUT_H
|
||||
#define RGBDS_LINK_OUTPUT_H
|
||||
|
||||
@@ -14,22 +14,22 @@
|
||||
|
||||
#include "link/section.h"
|
||||
|
||||
/**
|
||||
/*
|
||||
* Registers a section for output.
|
||||
* @param section The section to add
|
||||
*/
|
||||
void out_AddSection(struct Section const *section);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Finds an assigned section overlapping another one.
|
||||
* @param section The section that is being overlapped
|
||||
* @return A section overlapping it
|
||||
*/
|
||||
struct Section const *out_OverlappingSection(struct Section const *section);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Writes all output (bin, sym, map) files.
|
||||
*/
|
||||
void out_WriteFiles(void);
|
||||
|
||||
#endif /* RGBDS_LINK_OUTPUT_H */
|
||||
#endif // RGBDS_LINK_OUTPUT_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Applying patches to SECTIONs */
|
||||
// Applying patches to SECTIONs
|
||||
#ifndef RGBDS_LINK_PATCH_H
|
||||
#define RGBDS_LINK_PATCH_H
|
||||
|
||||
@@ -27,15 +27,15 @@ struct Assertion {
|
||||
struct Assertion *next;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Checks all assertions
|
||||
* @return true if assertion failed
|
||||
*/
|
||||
void patch_CheckAssertions(struct Assertion *assertion);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Applies all SECTIONs' patches to them
|
||||
*/
|
||||
void patch_ApplyPatches(void);
|
||||
|
||||
#endif /* RGBDS_LINK_PATCH_H */
|
||||
#endif // RGBDS_LINK_PATCH_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Parsing a linker script */
|
||||
// Parsing a linker script
|
||||
#ifndef RGBDS_LINK_SCRIPT_H
|
||||
#define RGBDS_LINK_SCRIPT_H
|
||||
|
||||
@@ -24,15 +24,15 @@ struct SectionPlacement {
|
||||
|
||||
extern uint64_t script_lineNo;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Parses the linker script to return the next section constraint
|
||||
* @return A pointer to a struct, or NULL on EOF. The pointer shouldn't be freed
|
||||
*/
|
||||
struct SectionPlacement *script_NextSection(void);
|
||||
|
||||
/**
|
||||
/*
|
||||
* `free`s all assignment memory that was allocated.
|
||||
*/
|
||||
void script_Cleanup(void);
|
||||
|
||||
#endif /* RGBDS_LINK_SCRIPT_H */
|
||||
#endif // RGBDS_LINK_SCRIPT_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Assigning all sections a place */
|
||||
// Assigning all sections a place
|
||||
#ifndef RGBDS_LINK_SDAS_OBJ_H
|
||||
#define RGBDS_LINK_SDAS_OBJ_H
|
||||
|
||||
@@ -16,4 +16,4 @@ struct FileStackNode;
|
||||
|
||||
void sdobj_ReadFile(struct FileStackNode const *fileName, FILE *file);
|
||||
|
||||
#endif /* RGBDS_LINK_SDAS_OBJ_H */
|
||||
#endif // RGBDS_LINK_SDAS_OBJ_H
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Declarations manipulating symbols */
|
||||
// Declarations manipulating symbols
|
||||
#ifndef RGBDS_LINK_SECTION_H
|
||||
#define RGBDS_LINK_SECTION_H
|
||||
|
||||
/* GUIDELINE: external code MUST NOT BE AWARE of the data structure used!! */
|
||||
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!!
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -41,7 +41,7 @@ struct Patch {
|
||||
};
|
||||
|
||||
struct Section {
|
||||
/* Info contained in the object files */
|
||||
// Info contained in the object files
|
||||
char *name;
|
||||
uint16_t size;
|
||||
uint16_t offset;
|
||||
@@ -56,14 +56,14 @@ struct Section {
|
||||
bool isAlignFixed;
|
||||
uint16_t alignMask;
|
||||
uint16_t alignOfs;
|
||||
uint8_t *data; /* Array of size `size`*/
|
||||
uint8_t *data; // Array of size `size`
|
||||
uint32_t nbPatches;
|
||||
struct Patch *patches;
|
||||
/* Extra info computed during linking */
|
||||
// Extra info computed during linking
|
||||
struct Symbol **fileSymbols;
|
||||
uint32_t nbSymbols;
|
||||
struct Symbol **symbols;
|
||||
struct Section *nextu; /* The next "component" of this unionized sect */
|
||||
struct Section *nextu; // The next "component" of this unionized sect
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -76,27 +76,27 @@ struct Section {
|
||||
*/
|
||||
void sect_ForEach(void (*callback)(struct Section *, void *), void *arg);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Registers a section to be processed.
|
||||
* @param section The section to register.
|
||||
*/
|
||||
void sect_AddSection(struct Section *section);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Finds a section by its name.
|
||||
* @param name The name of the section to look for
|
||||
* @return A pointer to the section, or NULL if it wasn't found
|
||||
*/
|
||||
struct Section *sect_GetSection(char const *name);
|
||||
|
||||
/**
|
||||
/*
|
||||
* `free`s all section memory that was allocated.
|
||||
*/
|
||||
void sect_CleanupSections(void);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Checks if all sections meet reasonable criteria, such as max size
|
||||
*/
|
||||
void sect_DoSanityChecks(void);
|
||||
|
||||
#endif /* RGBDS_LINK_SECTION_H */
|
||||
#endif // RGBDS_LINK_SECTION_H
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* Declarations manipulating symbols */
|
||||
// Declarations manipulating symbols
|
||||
#ifndef RGBDS_LINK_SYMBOL_H
|
||||
#define RGBDS_LINK_SYMBOL_H
|
||||
|
||||
/* GUIDELINE: external code MUST NOT BE AWARE of the data structure used!! */
|
||||
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!!
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
struct FileStackNode;
|
||||
|
||||
struct Symbol {
|
||||
/* Info contained in the object files */
|
||||
// Info contained in the object files
|
||||
char *name;
|
||||
enum ExportLevel type;
|
||||
char const *objFileName;
|
||||
@@ -31,7 +31,7 @@ struct Symbol {
|
||||
int32_t offset;
|
||||
int32_t value;
|
||||
};
|
||||
/* Extra info computed during linking */
|
||||
// Extra info computed during linking
|
||||
struct Section *section;
|
||||
};
|
||||
|
||||
@@ -47,16 +47,16 @@ void sym_ForEach(void (*callback)(struct Symbol *, void *), void *arg);
|
||||
|
||||
void sym_AddSymbol(struct Symbol *symbol);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Finds a symbol in all the defined symbols.
|
||||
* @param name The name of the symbol to look for
|
||||
* @return A pointer to the symbol, or NULL if not found.
|
||||
*/
|
||||
struct Symbol *sym_GetSymbol(char const *name);
|
||||
|
||||
/**
|
||||
/*
|
||||
* `free`s all symbol memory that was allocated.
|
||||
*/
|
||||
void sym_CleanupSymbols(void);
|
||||
|
||||
#endif /* RGBDS_LINK_SYMBOL_H */
|
||||
#endif // RGBDS_LINK_SYMBOL_H
|
||||
|
||||
Reference in New Issue
Block a user