mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
(And REPT.) Not exactly a *recursion* limit, more like a *stack depth* limit, but calling it "recursion" conveys its purpose better. The default of 64 is super overkill: even in a a project with what I believe to be above-average levels of nesting, the level only peaked at 6. Keeping in mind the purpose of this is to catch infinite recursion, which is still caught quickly (in usual cases, anyways), this default seems sensible. And it passes tests. What more do you need?
51 lines
1.0 KiB
C
51 lines
1.0 KiB
C
/*
|
|
* This file is part of RGBDS.
|
|
*
|
|
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
/*
|
|
* Contains some assembler-wide defines and externs
|
|
*/
|
|
|
|
#ifndef RGBDS_ASM_FSTACK_H
|
|
#define RGBDS_ASM_FSTACK_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
#include "asm/asm.h"
|
|
#include "asm/lexer.h"
|
|
|
|
#include "types.h"
|
|
|
|
struct sContext {
|
|
YY_BUFFER_STATE FlexHandle;
|
|
struct sSymbol *pMacro;
|
|
struct sContext *pNext;
|
|
char tzFileName[_MAX_PATH + 1];
|
|
char *tzMacroArgs[MAXMACROARGS + 1];
|
|
int32_t nLine;
|
|
uint32_t nStatus;
|
|
FILE *pFile;
|
|
char *pREPTBlock;
|
|
uint32_t nREPTBlockCount;
|
|
uint32_t nREPTBlockSize;
|
|
};
|
|
|
|
extern unsigned int nMaxFileStackDepth;
|
|
|
|
void fstk_RunInclude(char *tzFileName);
|
|
void fstk_RunMacroArg(int32_t s);
|
|
void fstk_Init(char *s);
|
|
void fstk_Dump(void);
|
|
void fstk_AddIncludePath(char *s);
|
|
uint32_t fstk_RunMacro(char *s);
|
|
void fstk_RunRept(uint32_t count);
|
|
FILE *fstk_FindFile(char *fname, char **incPathUsed);
|
|
int32_t fstk_GetLine(void);
|
|
|
|
#endif /* RGBDS_ASM_FSTACK_H */
|