more bpmpfw shenanigans

This commit is contained in:
souldbminersmwc committed 2026-08-25 13:37:05 -04:00
1 parent 7660650129
commit b20d20edff
54 files changed
+1275 -30

No files matched your search

@@ -0,0 +1,35 @@
#ifndef FSLC_ASSERT_H
#define FSLC_ASSERT_H
#ifndef ALT_FSLC_NAMES
#define fslc_assert assert
#endif /* ALT_FSLC_NAMES */
#ifdef NDEBUG
#define fslc_assert(expr) ((void)0)
#else /* NDEBUG */
/* Note: __PRETTY_FUNCTION__ is GCC specific */
#define fslc_assert(expr) ((expr) ? (void)0 : __fslc_assert_fail(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
#endif /* NDEBUG */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void __fslc_assert_fail(const char *expr, const char *file, unsigned int line, const char *func);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FSLC_ASSERT_H */
@@ -0,0 +1,74 @@
#ifndef FSLC_STDIO_H
#define FSLC_STDIO_H
#include <stdarg.h>
#include <stddef.h>
#ifndef ALT_FSLC_NAMES
#define FSLC_FILE FILE
#define fslc_stdout stdout
#define fslc_stdin stdin
#define fslc_putchar putchar
#define fslc_fputc fputc
#define fslc_fputs fputs
#define fslc_puts puts
#define fslc_vfprintf vfprintf
#define fslc_vprintf vprintf
#define fslc_fprintf fprintf
#define fslc_printf printf
#define fslc_fwrite fwrite
#define fslc_fread fread
#define fslc_getc getc
#define fslc_getchar getchar
#define fslc_ungetc ungetc
#define fslc_fgets fgets
#endif /* ALT_FSLC_NAMES */
typedef struct _FSLC_FILE FSLC_FILE;
struct _FSLC_FILE
{
void *user_ptr;
int (*putc)(int c, FSLC_FILE *stream);
int (*getc)(FSLC_FILE *stream);
void (*pre_output)(FSLC_FILE *stream);
void (*post_output)(FSLC_FILE *stream);
int ungetc_buf;
};
extern FSLC_FILE *fslc_stdout;
extern FSLC_FILE *fslc_stdin;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int fslc_putchar(int c);
int fslc_fputc(int c, FSLC_FILE *stream);
int fslc_fputs(const char *str, FSLC_FILE *stream);
int fslc_puts(const char *str);
int fslc_vfprintf(FSLC_FILE *stream, const char *format, va_list arg);
int fslc_vprintf(const char *format, va_list arg);
int fslc_fprintf(FSLC_FILE *stream, const char *format, ...);
int fslc_printf(const char *format, ...);
size_t fslc_fwrite(const void *ptr, size_t size, size_t count, FSLC_FILE *stream);
size_t fslc_fread(void *ptr, size_t size, size_t count, FSLC_FILE *stream);
int fslc_getc(FSLC_FILE *stream);
int fslc_getchar(void);
int fslc_ungetc(int c, FSLC_FILE *stream);
char *fslc_fgets(char *str, int num, FSLC_FILE *stream);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FSLC_STDIO_H */
@@ -0,0 +1,25 @@
#ifndef FSLC_STDLIB_H
#define FSLC_STDLIB_H
#include <stddef.h>
#ifndef ALT_FSLC_NAMES
#define fslc_bsearch bsearch
#endif /* ALT_FSLC_NAMES */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void *fslc_bsearch(const void *key, const void *base, size_t num, size_t size, int (*cmp_proc)(const void *, const void *));
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FSLC_STDLIB_H */
@@ -0,0 +1,50 @@
#ifndef FSLC_STRING_H
#define FSLC_STRING_H
#include <stddef.h>
#ifndef ALT_FSLC_NAMES
#define fslc_memset memset
#define fslc_memcpy memcpy
#define fslc_memmove memmove
#define fslc_memcmp memcmp
#define fslc_strlen strlen
#define fslc_strcpy strcpy
#define fslc_strncpy strncpy
#define fslc_strcmp strcmp
#define fslc_strncmp strncmp
#define fslc_strchr strchr
#define fslc_strstr strstr
#define fslc_strpbrk strpbrk
#define fslc_strspn strspn
#define fslc_strtok_r strtok_r
#endif /* ALT_FSLC_NAMES */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void *fslc_memset(void *ptr, int value, size_t num);
void *fslc_memcpy(void *dest, const void *src, size_t len);
void *fslc_memmove(void *dest, const void *src, size_t len);
int fslc_memcmp(const void *ptr1, const void *ptr2, size_t num);
size_t fslc_strlen(const char *str);
char *fslc_strcpy(char *dest, const char *src);
char *fslc_strncpy(char *dest, const char *src, size_t len);
int fslc_strcmp(const char *str1, const char *str2);
int fslc_strncmp(const char *str1, const char *str2, size_t num);
char *fslc_strchr(const char *str, int c);
char *fslc_strstr(const char *search_in, const char *search_for);
char *fslc_strpbrk(const char *str, const char *delim);
size_t fslc_strspn(const char *str, const char *delim);
char *fslc_strtok_r(char *str, const char *delim, char **save_p);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FSLC_STRING_H */
@@ -0,0 +1,23 @@
#ifndef FSLC_STDLIBX_H
#define FSLC_STDLIBX_H
#include <stddef.h>
#ifndef ALT_FSLC_NAMES
#define fslc_bsearch_i bsearch_i
#endif /* ALT_FSLC_NAMES */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int fslc_bsearch_i(const void *key, const void *base, size_t num, size_t size, int (*cmp_proc)(const void *, const void *));
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FSLC_STDLIBX_H */
@@ -0,0 +1,33 @@
#ifndef FSLC_STRINGX_H
#define FSLC_STRINGX_H
#include <stddef.h>
#ifndef ALT_FSLC_NAMES
#define fslc_memset_l memset_l
#define fslc_strcpy_e strcpy_e
#define fslc_strncpy_e strncpy_e
#endif /* ALT_FSLC_NAMES */
#if __SIZEOF_LONG__ == 4
#define memset_32 memset_l
#elif __SIZEOF_LONG__ == 8
#define memset_32(A, V, S) memset_l(A, (((unsigned long)(V)<<32)|(V)), S)
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void *fslc_memset_l(void *ptr, unsigned long value, size_t num);
char *fslc_strcpy_e(char *dest, const char *src);
char *fslc_strncpy_e(char *dest, const char *src, size_t len);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FSLC_STRINGX_H */