// THIS FILE IS GENERATED AUTOMATICALLY, DO NOT EDIT IT!
// it's un_exported.func.h converted by the GenerateInterface tool.


{
    This file is part of Chentrah,
    Copyright (C) 2004-2012 Anton Rzheshevski (chebmaster@mail.ru).

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/

 **********************************************************************

    This file contains the definitions and initialization code
    for the functions exported from the mothe rmodule to the game module

 **********************************************************************}
{
 en_US:
    Generally, one should use interfaces
      in stead of such perversion.
      Alas, at the time I built this,
      FreePascal didn't yet support the interfaces well.

    Besides, I don't see the point of reworking this mechanism.
      It works, it works well, it is in a way more flexible
      than the interface mechanism, it is safe enough.
      In short, moving from it to interfaces would be just a waste of time.
      
    After reaching a stable version, this list will stop changing,
      except adding new functions maybe.

 ru_RU:
    Знаю, что изврат, но меня ТАК ДОСТАЛО поддерживать
     (а самое страшное - модифицировать) четыре разных
     списка одних и тех же функций в четырёх разных местах.
     Да ещё вручную следить, чтобы все изменения в них
     совпадали до точки...

    Всё худо-бедно держалось пока мне не пришлось массированно править
     списки параметров (переезд с String на PChar).
     Вот тут-то ад и разверсзя... =:(

 **********************************************************************}
{
    This header is used by both the mother executable and the module dlls.
     The mother definition style:
       function A (): integer;
       , so macros are:  = "function", :function = "",  = "".
     The module definition style:
       var A: function (): integer;
       , so macros are:  = "", :function = ":function",  = "".
     The core exporting proc definition style:
       3: p:=@A;
       , so macros are:  = "", e_fun2 = "",  = ":p:=@"
     The module importing proc definition style:
       RegisterProc(3, @A);
       , so macros are:  = "RegisterProc(", e_fun2 = ")",  = ",@"

 **********************************************************************}

// ---------------------- INTERFACING BETWEEN THE MODULE AND THE ENGINE -------

 {$ifndef header} 0003  {$endif}_ValidateVersion :procedure{$ifdef header}(m, n, b: integer); cdecl{$endif};
 {$ifndef header} 0001  {$endif}_ValidateTypesets :procedure{$ifdef header}(i, n: integer); cdecl{$endif};
 {$ifndef header} 0004  {$endif}_ValidateTypesetsEq :procedure{$ifdef header}(n: PAnsiChar; v1, v2: integer); cdecl{$endif};
 {$ifndef header} 0002  {$endif}_ValidateTypesetsLe :procedure{$ifdef header}(n: PAnsiChar; v1, v2: integer); cdecl{$endif};
 {$ifndef header} 0005  {$endif}_RequestExit :procedure{$ifdef header}(); cdecl{$endif};
 {$ifndef header} 0006  {$endif}GoingDownHard :function {$ifdef header}(): boolean; cdecl{$endif};

 {$ifndef header} 0007  {$endif}_cgeSetBackground :procedure{$ifdef header}(FileName: PAnsiChar); cdecl{$endif};
 {$ifndef header} 0107  {$endif}_cgeSetBackgroundPtr :procedure{$ifdef header}(p: pointer; size: integer); cdecl{$endif};
 {$ifndef header} 0108  {$endif}_cgeDrawBackground :procedure{$ifdef header}(); cdecl{$endif};
 {$ifndef header} 0008  {$endif}_cgeHeartBeat :procedure{$ifdef header}(); cdecl{$endif};

 {$ifndef header} 0015  {$endif}GetWindowExists :function {$ifdef header}(): boolean; cdecl{$endif};

 {$ifndef header} 0017  {$endif}_SetConfigInt :procedure {$ifdef header} (section, id: PAnsiChar; Value: integer); cdecl{$endif};
 {$ifndef header} 0018  {$endif}_GetConfigInt :function {$ifdef header} (section, id: PAnsiChar): integer; cdecl{$endif};
 {$ifndef header} 0019  {$endif}_GetConfigIntCh :function {$ifdef header} (section, id: PAnsiChar; min, max: integer): integer; cdecl{$endif};
 {$ifndef header} 0101  {$endif}_SetConfigStr :procedure {$ifdef header} (section, id, Value: PAnsiChar); cdecl{$endif};
 {$ifndef header} 0102  {$endif}_GetConfigStr :function {$ifdef header} (section, id: PAnsiChar): PAnsiChar; cdecl{$endif};

 {$ifndef header} 0020  {$endif}_GetCGM :function {$ifdef header}(): integer; cdecl{$endif}; //reads the message queue;

 {$ifndef header} 0021  {$endif}_MakeSurePathExists :procedure {$ifdef header} (path: PAnsiChar); cdecl{$endif};


// ------------------------------ LOG AND EXCEPTION HANDLING ------------------

 {$ifndef header} 1002  {$endif} {$ifdef cgekernel}_exp_StopDying{$else}StopDying{$endif} :function {$ifdef header}(): PWideChar; cdecl{$endif};

 {$ifndef header} 1003  {$endif}DbgSayA :procedure {$ifdef header}(Yell: PAnsiChar); cdecl{$endif};
// {$ifndef header} 0044  {$endif}HostDieW :procedure {$ifdef header}(txt: PWideChar); cdecl{$endif};
 {$ifndef header} 1004  {$endif}SetDying :procedure {$ifdef header}(d: boolean); cdecl{$endif};

 {$ifndef header} 1005  {$endif}_HostDyellW :procedure {$ifdef header}(txt: PWideChar); cdecl{$endif};
// {$ifndef header} 0117  {$endif}HostRaiseException :procedure {$ifdef header}(); cdecl{$endif};


 {$ifndef header} 1006  {$endif}_HostLogW :procedure {$ifdef header}(txt: PWideChar); cdecl{$endif};
 {$ifndef header} 1007  {$endif}_HostMsg  :function {$ifdef header}(M: TMessageId): PWideChar; cdecl{$endif};
 {$ifndef header} 1008  {$endif}AddLogOK  :procedure {$ifdef header}(); cdecl{$endif};
(*{$ifdef windows}
//DONT NEED IT ANYMORE
 {$ifndef header} 1009  {$endif}CgeTryWrap :procedure {$ifdef header}(backwrapperproc, calledproc: pointer); cdecl{$endif};
{$endif}*)

// --------------------------------- OPENGL HELPERS AND WRAPPERS --------------

 {$ifndef header} 2001  {$endif}_CgeSwapBuffers :procedure{$ifdef header}(); cdecl{$endif};
 {$ifndef header} 2002  {$endif}_CgeBuildAlphaMipmaps :procedure {$ifdef header}(Width, Height: integer; Data: pointer); cdecl{$endif};
 {$ifndef header} 2004  {$endif}{$ifdef cgekernel}exGetGlProcAddress{$else}GetGLProcAddress{$endif} :function {$ifdef header}(ProcName, Suffix: PAnsiChar): Pointer; cdecl{$endif};
 {$ifndef header} 2005  {$endif}{$ifdef cgekernel}exGetGlProcAddress2{$else}GetGLProcAddress2{$endif} :function {$ifdef header}(ProcName, Suffix1, Suffix2: PAnsiChar): Pointer; cdecl{$endif};

 {$ifndef header} 2006  {$endif}GetHigherPowerOf2 :function {$ifdef header}(i: integer): integer; cdecl{$endif};
 {$ifndef header} 2007  {$endif}GetLowerPowerOf2 :function {$ifdef header}(i: integer): integer; cdecl{$endif};


// --------------------------------- SOUND ------------------------------------
 {$ifndef header} 2101  {$endif}{$ifdef cgekernel}exGetALProcAddress{$else}GetALProcAddress{$endif} :function {$ifdef header}(ProcName: PAnsiChar): Pointer; cdecl{$endif};
//the data format is always 16 bits stereo.
 {$ifndef header} 2102  {$endif}CgeNewSoundData :procedure{$ifdef header}(begins: TDateTime; samples, rate: integer; data: pointer); cdecl{$endif};
 {$ifndef header} 2103  {$endif}CgeSetSoundVolume :procedure{$ifdef header}(volume: float); cdecl{$endif};

 {$ifndef header} 2104  {$endif}_PlaySound :procedure{$ifdef header}(Wavfilename: PAnsiChar); cdecl{$endif};



//  -------------------------------- CGE-FILE MANAGEMENT ----------------------
// Rest in peace, paradigm.

// {$ifndef header} 0049  {$endif}OpenCGEFileForWrite :procedure {$ifdef header}(TargetName: PAnsiChar; version: AnsiChar); cdecl{$endif};
// {$ifndef header} 0050  {$endif}OpenCGEFileForRead :procedure {$ifdef header}(SourceName: PAnsiChar; var version: AnsiChar); cdecl{$endif};
// {$ifndef header} 0051  {$endif}ReadFromCGEFile :function {$ifdef header}(var BufferLen: integer): pointer; cdecl{$endif};
// {$ifndef header} 0055  {$endif}AllocCGefileWriteBuffer :function {$ifdef header}(var BufferLen: integer): pointer; cdecl{$endif};
// {$ifndef header} 0052  {$endif}WriteToCGEFile :procedure {$ifdef header} (BufferLen: integer); cdecl{$endif};
// {$ifndef header} 0053  {$endif}CloseCGEFile :procedure {$ifdef header} (FlushToFile: boolean; FileName: PAnsiChar); cdecl{$endif};
// {$ifndef header} 0115  {$endif}EmergencyCloseCGEFile :procedure {$ifdef header} (); cdecl{$endif};
// {$ifndef header} 0069  {$endif}GetCGEFileSessionId :function {$ifdef header}(): int64; cdecl{$endif};


// {$ifndef header} 0071  {$endif}CgeFileExists :function {$ifdef header}(name: PAnsiChar): boolean; cdecl{$endif};
// {$ifndef header} 0072  {$endif}CgeFileRename :procedure {$ifdef header} (fFrom, fTo: PAnsiChar); cdecl{$endif};
 {$ifndef header} 3001  {$endif}_UnmangleFileName :function{$ifdef header}(m: PAnsiChar): pAnsiChar; cdecl{$endif};
 {$ifndef header} 3002  {$endif}_GetFileHash :procedure{$ifdef header}(name: PAnsiChar; phash: pResourceHash); cdecl{$endif};
 {$ifndef header} 3003  {$endif}_GetFileDateTime :function{$ifdef header}(name: PAnsiChar): TDateTime; cdecl{$endif};
 {$ifndef header} 3004  {$endif}_GetIsHashvalid :function{$ifdef header}(phash: pMd5Digest): boolean; cdecl{$endif};


(*
 {$ifndef header} 3005  {$endif}_CreateContainer :function{$ifdef header}(Name: PAnsiChar; Size: integer): pointer; cdecl{$endif};
 {$ifndef header} 3006  {$endif}_GetContainer :function{$ifdef header}(Name: PAnsiChar): pointer; cdecl{$endif};
 {$ifndef header} 3007  {$endif}_GetContainerSize :function{$ifdef header}(Name: PAnsiChar): integer; cdecl{$endif};
 {$ifndef header} 3008  {$endif}_DeleteContainer :procedure{$ifdef header}(Name: PAnsiChar); cdecl{$endif};
 {$ifndef header} 3009  {$endif}_StoreContainerToFile :procedure {$ifdef header} (Name, FileName: PAnsiChar); cdecl{$endif};
 {$ifndef header} 3010  {$endif}_CreateContainerFromFile :function {$ifdef header}(Name, FileName: PAnsiChar; var Size: integer): pointer; cdecl{$endif};
*)
//--------------------------------- RESOURCE MANAGEMENT -----------------------

// {$ifndef header} 0057  {$endif}GetCurrentSessionID :function {$ifdef header}(): int64; cdecl{$endif};
// {$ifndef header} 0058  {$endif}NewSessionID :procedure {$ifdef header} (); cdecl{$endif};

(*
 {$ifndef header} 0111  {$endif}_CgeNewResource :procedure {$ifdef header} (ResType: integer; pname: pinteger; ptoken: pResourceToken); cdecl{$endif};
 {$ifndef header} 0067  {$endif}_CgeDeleteResource :procedure {$ifdef header} (ResType, name: integer; ptoken: PResourceToken); cdecl{$endif};
 {$ifndef header} 0062  {$endif}_UpdateResourceToken :procedure {$ifdef header} (ResType, name: integer; ptoken: PResourceToken); cdecl{$endif};
 {$ifndef header} 0063  {$endif}_UnclaimResource :procedure {$ifdef header} (ResType, name: integer; ptoken: PResourceToken); cdecl{$endif};
 {$ifndef header} 0064  {$endif}_ClaimResource :function {$ifdef header} (ResType: integer; pname: pinteger; ptoken: pResourceToken): longbool; cdecl{$endif};
 {$ifndef header} 0065  {$endif}_ClearUnclaimedResourcesList :procedure {$ifdef header} (); cdecl{$endif};
 {$ifndef header} 0066  {$endif}_DeleteUnclaimedResources :procedure {$ifdef header} (); cdecl{$endif};
*)

 {$ifndef header} 4000  {$endif}GenHash :procedure {$ifdef header} (phash: PResourceHash); cdecl{$endif};
 {$ifndef header} 4001  {$endif}StoreResource :procedure {$ifdef header} (phandle: pDWORD; phash: PResourceHash); cdecl{$endif};
 {$ifndef header} 4002  {$endif}ClaimResource :function {$ifdef header} (phash: PResourceHash): PRes; cdecl{$endif};
 {$ifndef header} 4003  {$endif}GetFirstResource :function {$ifdef header} (): PRes; cdecl{$endif};
 {$ifndef header} 4004  {$endif}GetNextResource :function {$ifdef header} (): PRes; cdecl{$endif};
 {$ifndef header} 4005  {$endif}ClearResourceList :procedure {$ifdef header} (); cdecl{$endif};
 {$ifndef header} 4006  {$endif}HashesMatch :function {$ifdef header} (a, b: PResourceHash): boolean; cdecl{$endif};

//These are used for storing the classes information:
 {$ifndef header} 3011  {$endif}CgeCreateMemoryStream :function {$ifdef header}(): pointer; cdecl{$endif};
 {$ifndef header} 3012  {$endif}CgeDeleteMemoryStream :procedure {$ifdef header}(s: pointer); cdecl{$endif};
 {$ifndef header} 3013  {$endif}CgeSeekMemoryStream :procedure {$ifdef header}(s: pointer; pos: integer); cdecl{$endif};
 {$ifndef header} 3014  {$endif}CgeWriteToMemoryStream :procedure {$ifdef header}(s: pointer; buf: pointer; len: integer); cdecl{$endif};
 {$ifndef header} 3015  {$endif}CgeReadFromMemoryStream :function {$ifdef header}(s: pointer; buf: pointer; len: integer): integer; cdecl{$endif};
 {$ifndef header} 3016  {$endif}CgeWriteIntToMemoryStream :procedure {$ifdef header}(s: pointer; i: integer); cdecl{$endif};
 {$ifndef header} 3017  {$endif}CgeReadIntFromMemoryStream :function {$ifdef header}(s: pointer): integer; cdecl{$endif};
 {$ifndef header} 3018  {$endif}CgeGetMemoryStreamMem :function {$ifdef header}(s: pointer): pointer; cdecl{$endif};
 {$ifndef header} 3019  {$endif}CgeGetMemoryStreamSize :function {$ifdef header}(s: pointer): integer; cdecl{$endif};
 {$ifndef header} 3020  {$endif}CgeMemoryStreamLoadFromFile :procedure {$ifdef header}(s: pointer; name: PAnsiChar); cdecl{$endif};
 {$ifndef header} 3021  {$endif}CgeMemoryStreamSaveToFile :procedure {$ifdef header}(s: pointer; name: PAnsiChar); cdecl{$endif};

//This is a per-module setting!
 {$ifndef header} 3022  {$endif}CgeGetCiMemoryStream :function {$ifdef header}(): pointer; cdecl{$endif};
 {$ifndef header} 3023  {$endif}CgeSetCiMemoryStream :procedure {$ifdef header}(s: pointer); cdecl{$endif};

 {$ifndef header} 3024  {$endif}CgeGetHostMem :function {$ifdef header}(size: integer): pointer; cdecl{$endif};
 {$ifndef header} 3025  {$endif}CgeFreeHostMem :procedure {$ifdef header}(p: pointer); cdecl{$endif};
 {$ifndef header} 3026  {$endif}CgeReallocHostMem :function {$ifdef header}(p: pointer; newsize: integer): pointer; cdecl{$endif};


// -------------------------------- MOUSE POINTER -----------------------------

 {$ifndef header} 3201  {$endif}CgeLoadCursorFromFile :procedure {$ifdef header}(FileName: PAnsiChar; xhotspot, yhotspot: integer); cdecl{$endif};
 {$ifndef header} 3202  {$endif}CgeLoadCursorFromMemory :procedure {$ifdef header}(pfile: pointer; size, xhotspot, yhotspot: integer); cdecl{$endif};
//Remember, kids! 32x32 only!
 {$ifndef header} 3203  {$endif}CgeLoadCursorFromRawPixmap :procedure {$ifdef header}(pixels: pointer; xhotspot, yhotspot: integer); cdecl{$endif};
 {$ifndef header} 3204  {$endif}CgeEmptyCursor :procedure {$ifdef header}(); cdecl{$endif};
 {$ifndef header} 3205  {$endif}CgeStandardCursor :procedure {$ifdef header}(); cdecl{$endif};
 {$ifndef header} 3206  {$endif}CgeHourglassCursor :procedure {$ifdef header}(); cdecl{$endif};

// -------------------------------------- TIMER -------------------------------

// {$ifndef header} 5001  {$endif}_CTimer :function {$ifdef header} (): float; cdecl{$endif};
// {$ifndef header} 5002  {$endif}{$ifdef cgekernel}_exp_Tick{$else}Tick{$endif}:function {$ifdef header}(): longint; cdecl{$endif};
 {$ifndef header} 5003  {$endif}Second :function{$ifdef header}(): double; cdecl{$endif};
 {$ifndef header} 5004  {$endif}UsecByTsc :function{$ifdef header}(ptsc: pqword): double; cdecl{$endif};


//----------------------------------- VAMPYRE IMAGING -------------------------

// {$ifndef header} 1014  {$endif}CgeNewPic :function {$ifdef header} (): pointer; cdecl{$endif};
 {$ifndef header} 6000  {$endif}DeletePic :procedure {$ifdef header} (name: pointer); cdecl{$endif};

// {$ifndef header} 1001  {$endif}LoadNewPic :function {$ifdef header} (FileName: PAnsiChar; phash: pResourceHash): pointer; cdecl{$endif};
 {$ifndef header} 6001  {$endif}LoadPic :function {$ifdef header} (FileName: PAnsiChar): pointer; cdecl{$endif};
 {$ifndef header} 6002  {$endif}LoadPicAs :function {$ifdef header} (FileName: PAnsiChar; format: GLenum): pointer; cdecl{$endif};
 {$ifndef header} 6003  {$endif}LoadPicFromMem :function {$ifdef header} (p: pointer; size: integer): pointer; cdecl{$endif};
 {$ifndef header} 6004  {$endif}LoadPicFromMemAs :function {$ifdef header} (p: pointer; size: integer; format: GLenum): pointer; cdecl{$endif};


 {$ifndef header} 6005  {$endif}CreatePic :function{$ifdef header}(width, height: integer; format: GLuint): pointer; cdecl{$endif};

 {$ifndef header} 6006  {$endif}SavePic :procedure{$ifdef header}(FileName: PAnsiChar; name: pointer); cdecl{$endif};

 {$ifndef header} 6007  {$endif}ResizePic :procedure{$ifdef header}(name: pointer; newwidth, newheight: integer); cdecl{$endif};
 {$ifndef header} 6008  {$endif}ResamplePic :procedure{$ifdef header}(name: pointer; newwidth, newheight: integer; wrap: boolean); cdecl{$endif};
 {$ifndef header} 6009  {$endif}ClonePic :function{$ifdef header}(name1: pointer): pointer; cdecl{$endif};
 {$ifndef header} 6010  {$endif}CloneResamplePic :function{$ifdef header}(name1: pointer; newwidth, newheight: integer; wrap: boolean): pointer; cdecl{$endif};

 {$ifndef header} 6011  {$endif}GetPicFmt :function {$ifdef header} (name: pointer): GLuint; cdecl{$endif};
 {$ifndef header} 6012  {$endif}GetPicPixels :function {$ifdef header} (name: pointer): pointer; cdecl{$endif};
 {$ifndef header} 6013  {$endif}GetPicWidth :function {$ifdef header} (name: pointer): integer; cdecl{$endif};
 {$ifndef header} 6014  {$endif}GetPicHeight :function {$ifdef header} (name: pointer): integer; cdecl{$endif};
 {$ifndef header} 6015  {$endif}GetPicBytes :function {$ifdef header} (name: pointer): integer; cdecl{$endif};

// -------------------------------- FONT MANAGEMENT ---------------------------

 {$ifndef header} 7001  {$endif}cgeffSizeToFace :procedure{$ifdef header}(size: integer; face: Pinteger; zoom: PGLfloat); cdecl{$endif};
 {$ifndef header} 7002  {$endif}cgeffFitStringIntoRectangle :procedure{$ifdef header}(Size, numChars, numLines, Width, Height: integer; fit: PStringFitRec);  cdecl{$endif};
 {$ifndef header} 7003  {$endif}cgeffGetStringWidth :function {$ifdef header} (Size, numChars: integer): GLfloat; cdecl{$endif};
 {$ifndef header} 7004  {$endif}cgeffGetStringHeight :function {$ifdef header} (Size, numLines: integer): GLfloat; cdecl{$endif};

//the caller is responsible for switching to FFP and setting the ortho projection!
 {$ifndef header} 7005  {$endif}cgeffSetRenderState :procedure{$ifdef header}(noshadow: boolean); cdecl{$endif};
 {$ifndef header} 7006  {$endif}cgeffRenderString :procedure{$ifdef header}(fit: PStringFitRec; Left, Top: glFloat; w: PWideChar); cdecl{$endif};


(*
 {$ifndef header} 7007  {$endif}cgeGetProportionalFontName :function {$ifdef header} (index: integer): PAnsiChar; cdecl{$endif};
 {$ifndef header} 7008  {$endif}cgeCalcWordMetrics :procedure {$ifdef header} (
  chars: PWideChar; len, font_index, size, diminish: integer; width, width_condensed: PInteger; UV, UV_condensed: PGLfloat); cdecl{$endif};

*)
(*


//the fonts CGE loads by itself: 0=ChebStyle, 1=Nimbus Sans L.
 {$ifndef header} 2007  {$endif}_foGetSysFont :function {$ifdef header} (index: integer): integer; cdecl{$endif};

//all objects should be created prior, via CgeNewResource(CGE_RESOURCE_FONT, ...)
 {$ifndef header} 2001  {$endif}_foLoadFont :function {$ifdef header} (FileName: PAnsiChar; name: integer): boolean; cdecl{$endif};
 {$ifndef header} 2008  {$endif}_foGetFontname :function {$ifdef header} (index: integer): PAnsiChar; cdecl{$endif};

//This one performs the actual width high and low calculations
//Returns the *actual* character size (culled to min..max supported by the font)
//The array receiving the data must be pre-allocated.
//The string must *not* contain spaces.
 {$ifndef header} 2006  {$endif}_foCalcWord :function {$ifdef header}
  (chars: PWideChar; len, font, size: integer; bold, italic, condensed: boolean; word: PiCharArray;
   texture, shadow: pGLuint): integer; cdecl{$endif};
*)




