project_files/hwc/rtl/fpcrtl.h
changeset 10015 4feced261c68
parent 9264 21df1a0ec9ed
child 10124 aabd1b75d5a3
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
       
     1 #ifndef _FPCRTL_H_
       
     2 #define _FPCRTL_H_
       
     3 
       
     4 #include <stdio.h>
       
     5 #include <stdlib.h>
       
     6 #include <string.h>
       
     7 #include <unistd.h>
       
     8 #include <math.h>
       
     9 
       
    10 #include "SysUtils.h"
       
    11 #include "system.h"
       
    12 #include "misc.h"
       
    13 #include "fileio.h"
       
    14 #include "pmath.h"
       
    15 
       
    16 #ifndef EMSCRIPTEN
       
    17 #if __APPLE__
       
    18 #define main SDL_main
       
    19 #endif
       
    20 #include "GL/glew.h"
       
    21 #endif
       
    22 
       
    23 #define fpcrtl_memcpy                       memcpy
       
    24 
       
    25 #define luapas_lua_gettop                   lua_gettop
       
    26 #define luapas_lua_close                    lua_close
       
    27 #define luapas_lua_createtable              lua_createtable
       
    28 #define luapas_lua_error                    lua_error
       
    29 #define luapas_lua_gc                       lua_gc
       
    30 #define luapas_lua_getfield                 lua_getfield
       
    31 #define luapas_lua_objlen                   lua_objlen
       
    32 #define luapas_lua_call                     lua_call
       
    33 #define luapas_lua_pcall                    lua_pcall
       
    34 #define luapas_lua_pushboolean              lua_pushboolean
       
    35 #define luapas_lua_pushcclosure             lua_pushcclosure
       
    36 #define luapas_lua_pushinteger              lua_pushinteger
       
    37 #define luapas_lua_pushnil                  lua_pushnil
       
    38 #define luapas_lua_pushnumber               lua_pushnumber
       
    39 #define luapas_lua_pushlstring              lua_pushlstring
       
    40 #define luapas_lua_pushstring               lua_pushstring
       
    41 #define luapas_lua_pushvalue                lua_pushvalue
       
    42 #define luapas_lua_rawgeti                  lua_rawgeti
       
    43 #define luapas_lua_setfield                 lua_setfield
       
    44 #define luapas_lua_settop                   lua_settop
       
    45 #define luapas_lua_toboolean                lua_toboolean
       
    46 #define luapas_lua_tointeger                lua_tointeger
       
    47 #define luapas_lua_tolstring                lua_tolstring
       
    48 #define luapas_lua_tonumber                 lua_tonumber
       
    49 #define luapas_lua_type                     lua_type
       
    50 #define luapas_lua_typename                 lua_typename
       
    51 #define luapas_luaL_argerror                luaL_argerror
       
    52 #define luapas_luaL_checkinteger            luaL_checkinteger
       
    53 #define luapas_luaL_checklstring            luaL_checklstring
       
    54 #define luapas_luaL_loadfile                luaL_loadfile
       
    55 #define luapas_luaL_loadstring              luaL_loadstring
       
    56 #define luapas_luaL_newstate                luaL_newstate
       
    57 #define luapas_luaL_optinteger              luaL_optinteger
       
    58 #define luapas_luaL_optlstring              luaL_optlstring
       
    59 #define luapas_luaL_prepbuffer              luaL_prepbuffer
       
    60 #define luapas_luaL_ref                     luaL_ref
       
    61 #define luapas_luaL_unref                   luaL_unref
       
    62 #define luapas_luaopen_base                 luaopen_base
       
    63 #define luapas_luaopen_math                 luaopen_math
       
    64 #define luapas_luaopen_string               luaopen_string
       
    65 #define luapas_luaopen_table                luaopen_table
       
    66 #define luapas_lua_load                     lua_load
       
    67 
       
    68 #define sdlh_IMG_Load                       IMG_Load
       
    69 #define sdlh_IMG_Load_RW                    IMG_Load_RW
       
    70 
       
    71 #ifndef EMSCRIPTEN
       
    72 #define sdlh_Mix_AllocateChannels           Mix_AllocateChannels
       
    73 #define sdlh_Mix_CloseAudio                 Mix_CloseAudio
       
    74 #define sdlh_Mix_FadeInChannelTimed         Mix_FadeInChannelTimed
       
    75 #define sdlh_Mix_FadeInMusic                Mix_FadeInMusic
       
    76 #define sdlh_Mix_FadeOutChannel             Mix_FadeOutChannel
       
    77 #define sdlh_Mix_FreeChunk                  Mix_FreeChunk
       
    78 #define sdlh_Mix_FreeMusic                  Mix_FreeMusic
       
    79 #define sdlh_Mix_HaltChannel                Mix_HaltChannel
       
    80 #define sdlh_Mix_HaltMusic                  Mix_HaltMusic
       
    81 #define sdlh_Mix_LoadMUS                    Mix_LoadMUS
       
    82 #define sdlh_Mix_LoadMUS_RW                 Mix_LoadMUS_RW
       
    83 #define sdlh_Mix_LoadWAV_RW                 Mix_LoadWAV_RW
       
    84 #define sdlh_Mix_OpenAudio                  Mix_OpenAudio
       
    85 #define sdlh_Mix_PauseMusic                 Mix_PauseMusic
       
    86 #define sdlh_Mix_PlayChannelTimed           Mix_PlayChannelTimed
       
    87 #define sdlh_Mix_Playing                    Mix_Playing
       
    88 #define sdlh_Mix_ResumeMusic                Mix_ResumeMusic
       
    89 #define sdlh_Mix_Volume                     Mix_Volume
       
    90 #define sdlh_Mix_VolumeMusic                Mix_VolumeMusic
       
    91 #else
       
    92 #define sdlh_Mix_AllocateChannels           stub_Mix_AllocateChannels
       
    93 #define sdlh_Mix_CloseAudio                 stub_Mix_CloseAudio
       
    94 #define sdlh_Mix_FadeInChannelTimed         stub_Mix_FadeInChannelTimed
       
    95 #define sdlh_Mix_FadeInMusic                stub_Mix_FadeInMusic
       
    96 #define sdlh_Mix_FadeOutChannel             stub_Mix_FadeOutChannel
       
    97 #define sdlh_Mix_FreeChunk                  stub_Mix_FreeChunk
       
    98 #define sdlh_Mix_FreeMusic                  stub_Mix_FreeMusic
       
    99 #define sdlh_Mix_HaltChannel                stub_Mix_HaltChannel
       
   100 #define sdlh_Mix_HaltMusic                  stub_Mix_HaltMusic
       
   101 #define sdlh_Mix_LoadMUS                    stub_Mix_LoadMUS
       
   102 #define sdlh_Mix_LoadMUS_RW                 stub_Mix_LoadMUS_RW
       
   103 #define sdlh_Mix_LoadWAV_RW                 stub_Mix_LoadWAV_RW
       
   104 #define sdlh_Mix_OpenAudio                  stub_Mix_OpenAudio
       
   105 #define sdlh_Mix_PauseMusic                 stub_Mix_PauseMusic
       
   106 #define sdlh_Mix_PlayChannelTimed           stub_Mix_PlayChannelTimed
       
   107 #define sdlh_Mix_Playing                    stub_Mix_Playing
       
   108 #define sdlh_Mix_ResumeMusic                stub_Mix_ResumeMusic
       
   109 #define sdlh_Mix_Volume                     stub_Mix_Volume
       
   110 #define sdlh_Mix_VolumeMusic                stub_Mix_VolumeMusic
       
   111 #endif
       
   112 
       
   113 #define sdlh_SDL_ConvertSurface             SDL_ConvertSurface
       
   114 #define sdlh_SDL_CreateRGBSurface           SDL_CreateRGBSurface
       
   115 #define sdlh_SDL_CreateThread               SDL_CreateThread
       
   116 #define sdlh_SDL_Delay                      SDL_Delay
       
   117 #define sdlh_SDL_EnableKeyRepeat            SDL_EnableKeyRepeat
       
   118 #define sdlh_SDL_EnableUNICODE              SDL_EnableUNICODE
       
   119 #define sdlh_SDL_FillRect                   SDL_FillRect
       
   120 #define sdlh_SDL_FreeSurface                SDL_FreeSurface
       
   121 #define sdlh_SDL_GetError                   SDL_GetError
       
   122 #define sdlh_SDL_GetKeyName                 SDL_GetKeyName
       
   123 #define sdlh_SDL_GetKeyState                SDL_GetKeyState
       
   124 #define sdlh_SDL_GetMouseState              SDL_GetMouseState
       
   125 #define sdlh_SDL_GetRGBA                    SDL_GetRGBA
       
   126 #define sdlh_SDL_GetTicks                   SDL_GetTicks
       
   127 #define sdlh_SDL_GL_SetAttribute            SDL_GL_SetAttribute
       
   128 #define sdlh_SDL_GL_SwapBuffers             SDL_GL_SwapBuffers
       
   129 #define sdlh_SDL_Init                       SDL_Init
       
   130 #define sdlh_SDL_InitSubSystem              SDL_InitSubSystem
       
   131 #define sdlh_SDL_JoystickClose              SDL_JoystickClose
       
   132 #define sdlh_SDL_JoystickEventState         SDL_JoystickEventState
       
   133 #define sdlh_SDL_JoystickName               SDL_JoystickName
       
   134 #define sdlh_SDL_JoystickNumAxes            SDL_JoystickNumAxes
       
   135 #define sdlh_SDL_JoystickNumButtons         SDL_JoystickNumButtons
       
   136 #define sdlh_SDL_JoystickNumHats            SDL_JoystickNumHats
       
   137 #define sdlh_SDL_JoystickOpen               SDL_JoystickOpen
       
   138 #define sdlh_SDL_LockSurface                SDL_LockSurface
       
   139 #define sdlh_SDL_MapRGB                     SDL_MapRGB
       
   140 #define sdlh_SDL_MapRGBA                    SDL_MapRGBA
       
   141 #define sdlh_SDL_NumJoysticks               SDL_NumJoysticks
       
   142 #define sdlh_SDL_PeepEvents                 SDL_PeepEvents
       
   143 #define sdlh_SDL_PumpEvents                 SDL_PumpEvents
       
   144 #define sdlh_SDL_Quit                       SDL_Quit
       
   145 #define sdlh_SDL_RWFromFile                 SDL_RWFromFile
       
   146 #define sdlh_SDL_SetColorKey                SDL_SetColorKey
       
   147 #define sdlh_SDL_SetVideoMode               SDL_SetVideoMode
       
   148 #define sdlh_SDL_WaitThread                 SDL_WaitThread
       
   149 #define sdlh_SDL_CreateMutex                SDL_CreateMutex
       
   150 #define sdlh_SDL_DestroyMutex               SDL_DestroyMutex
       
   151 #define sdlh_SDL_LockMutex                  SDL_mutexP
       
   152 #define sdlh_SDL_UnlockMutex                SDL_mutexV
       
   153 #ifndef EMSCRIPTEN
       
   154 #define sdlh_SDL_ShowCursor                 SDL_ShowCursor
       
   155 #else
       
   156 #define sdlh_SDL_ShowCursor                 SDL_ShowCursor_patch
       
   157 #endif
       
   158 #define sdlh_SDL_UnlockSurface              SDL_UnlockSurface
       
   159 #define sdlh_SDL_UpperBlit                  SDL_UpperBlit
       
   160 #define sdlh_SDL_VideoDriverName            SDL_VideoDriverName
       
   161 #define sdlh_SDL_WarpMouse                  SDL_WarpMouse
       
   162 #define sdlh_SDL_WM_SetCaption              SDL_WM_SetCaption
       
   163 #define sdlh_SDL_WM_SetIcon                 SDL_WM_SetIcon
       
   164 #define sdlh_SDLNet_AddSocket               SDLNet_AddSocket
       
   165 #define sdlh_SDLNet_AllocSocketSet          SDLNet_AllocSocketSet
       
   166 #define sdlh_SDLNet_CheckSockets            SDLNet_CheckSockets
       
   167 #define sdlh_SDLNet_FreeSocketSet           SDLNet_FreeSocketSet
       
   168 #define sdlh_SDLNet_Init                    SDLNet_Init
       
   169 #define sdlh_SDLNet_Quit                    SDLNet_Quit
       
   170 #define sdlh_SDLNet_ResolveHost             SDLNet_ResolveHost
       
   171 #define sdlh_SDLNet_TCP_Close               SDLNet_TCP_Close
       
   172 #define sdlh_SDLNet_TCP_Open                SDLNet_TCP_Open
       
   173 #define sdlh_SDLNet_TCP_Recv                SDLNet_TCP_Recv
       
   174 #define sdlh_SDLNet_TCP_Send                SDLNet_TCP_Send
       
   175 #define sdlh_TTF_Init                       TTF_Init
       
   176 #define sdlh_TTF_OpenFont                   TTF_OpenFont
       
   177 #define sdlh_TTF_OpenFontRW                 TTF_OpenFontRW
       
   178 #define sdlh_TTF_Quit                       TTF_Quit
       
   179 #define sdlh_TTF_RenderUTF8_Blended         TTF_RenderUTF8_Blended
       
   180 #define sdlh_TTF_RenderUTF8_Solid           TTF_RenderUTF8_Solid
       
   181 #define sdlh_TTF_SetFontStyle               TTF_SetFontStyle
       
   182 #define sdlh_TTF_SizeUTF8                   TTF_SizeUTF8
       
   183 
       
   184 #define _strconcat                          fpcrtl_strconcat
       
   185 #define _strappend                          fpcrtl_strappend
       
   186 #define _strprepend                         fpcrtl_strprepend
       
   187 #define _strcompare                         fpcrtl_strcompare
       
   188 #define _strncompare                        fpcrtl_strncompare
       
   189 #define _strcomparec                        fpcrtl_strcomparec
       
   190 #define _chrconcat                          fpcrtl_chrconcat
       
   191 #define _pchar                              fpcrtl_pchar
       
   192 
       
   193 // hooks are implemented in javascript
       
   194 void start_hook(void);
       
   195 void mainloop_hook(void);
       
   196 void clear_filelist_hook(void);
       
   197 void add_file_hook(const char* ptr);
       
   198 void idb_loader_hook();
       
   199 void showcursor_hook();
       
   200 void hidecursor_hook();
       
   201 void drawworld_init_hook();
       
   202 #endif