This commit is contained in:
2025-05-25 23:37:40 +03:00
commit 7f054e2904
79 changed files with 4850 additions and 0 deletions

96
public/tier0/lib.h Normal file
View File

@@ -0,0 +1,96 @@
#ifndef TIER0_STDLIB_H
#define TIER0_STDLIB_H
#include "stdint.h"
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
// TODO: bad stuff, reimplement it
//-----------------------------------------------------------------------------
// string.h
//-----------------------------------------------------------------------------
#define V_memcpy memcpy
#define V_memmove memmove
#define V_memchr memchr
#define V_memcmp memcmp
#define V_memset memset
#define V_strcat strcat
#define V_strncat strncat
#define V_strchr strchr
#define V_strrchr strrchr
#define V_strcmp strcmp
#define V_strncmp strncmp
#define V_strcoll strcoll
#define V_strcpy strcpy
#define V_strncpy strncpy
#define V_strlen strlen
#define V_strnlen strnlen
#define V_strspn strspn
#define V_strcspn strcspn
#define V_strpbrk strpbrk
#define V_strstr strstr
#define V_strtok strtok
#define V_strxfrm strxfrm
//-----------------------------------------------------------------------------
// stdio.h
//-----------------------------------------------------------------------------
#define V_fclose fclose
#define V_fopen fopen
#define V_freopen freopen
#define V_fdopen fdopen
#define V_remove remove
#define V_rename rename
#define V_rewind rewind
#define V_tmpfile tmpfile
#define V_feof feof
#define V_ferror ferror
#define V_fflush fflush
#define V_fgetpos fgetpos
#define V_fgetc getc
#define V_fgets gets
#define V_fputc putc
#define V_fputs puts
#define V_ftell ftell
#define V_fseek fseek
#define V_fsetpos fsetpos
#define V_fread fread
#define V_fwrite fwrite
#define V_getc getc
#define V_getchar getchar
#define V_gets gets
#define V_printf printf
#define V_vprintf vprintf
#define V_fprintf fprintf
#define V_vfprintf vfprintf
#define V_sprintf sprintf
#define V_snprintf snprintf
#define V_vsprintf vsprintf
#define V_vsnprintf vsnprintf
#define V_perror perror
#define V_putc putc
#define V_putchar putchar
#define V_fputchar fputchar
#define V_scanf scanf
#define V_vscanf vscanf
#define V_fscanf fscanf
#define V_vfscanf vfscanf
#define V_vsscanf vsscanf
#define V_setbuf setbuf
#define V_setvbuf setvbuf
#define V_tmpnam tmpnam
#define V_ungetc ungetc
#define V_puts puts
//-----------------------------------------------------------------------------
// stdlib.h
//-----------------------------------------------------------------------------
#define V_atoi atoi
#define V_atof atof
#endif

10
public/tier0/mem.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef TIER0_MEM_H
#define TIER0_MEM_H
#include "platform.h"
#include "lib.h"
PLATFORM_INTERFACE void *V_malloc( int nSize );
PLATFORM_INTERFACE void V_free( void *pMem );
PLATFORM_INTERFACE void *V_realloc( void *pMem, int nSize );
#endif

51
public/tier0/platform.h Normal file
View File

@@ -0,0 +1,51 @@
#ifndef TIER0_PLATFORM_H
#define TIER0_PLATFORM_H
#include "stdint.h"
#include "stddef.h"
#define DLL_EXPORT extern "C" __attribute__ ((visibility("default")))
#define DLL_IMPORT extern "C"
#define DLL_CLASS_EXPORT __attribute__ ((visibility("default")))
#define DLL_CLASS_IMPORT
#define DLL_GLOBAL_EXPORT extern __attribute ((visibility("default")))
#define DLL_GLOBAL_IMPORT extern
#ifdef TIER0_STATIC
#else
#ifdef TIER0_IMPLEMENTATION
#define PLATFORM_INTERFACE DLL_EXPORT
#define PLATFORM_OVERLOAD DLL_GLOBAL_EXPORT
#define PLATFORM_CLASS DLL_CLASS_EXPORT
#else
#define PLATFORM_INTERFACE DLL_IMPORT
#define PLATFORM_OVERLOAD DLL_GLOBAL_IMPORT
#define PLATFORM_CLASS DLL_CLASS_IMPORT
#endif
#endif
#define interface class
#define abstract_class class
PLATFORM_INTERFACE void Plat_FatalErrorFunc( const char *szFormat, ... );
typedef void( *ListDirCallbackFn )( const char *szPath );
PLATFORM_INTERFACE void Plat_ListDirRecursive( const char *szPath, ListDirCallbackFn file, ListDirCallbackFn dir );
PLATFORM_INTERFACE void Plat_ListDir( const char *szPath, ListDirCallbackFn file, ListDirCallbackFn dir );
PLATFORM_INTERFACE char *Plat_GetExtension( const char *szPath );
PLATFORM_INTERFACE void Plat_TrapSignals( void (*pfn)() );
PLATFORM_INTERFACE void Plat_Backtrace( void );
PLATFORM_INTERFACE void *Plat_LoadLibrary( const char *psz );
PLATFORM_INTERFACE void *Plat_GetProc( void *lib, const char *psz );
PLATFORM_INTERFACE void Plat_UnloadLibrary( void *psz );
PLATFORM_INTERFACE double Plat_GetTime( void );
#endif