// 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: function = "", e_fun2 = "",  = ":p:=@"
     The module importing proc definition style:
       RegisterProc(3, @A);
       , so macros are: function = "RegisterProc(", e_fun2 = ")",  = ",@"

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

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

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

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

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

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

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

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


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

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

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

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


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

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

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

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


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

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



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

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


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


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

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

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

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

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

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

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


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

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

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

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


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

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

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


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

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

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

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

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

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

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


(*
function {$ifndef header} 7007  {$endif}cgeGetProportionalFontName  {$ifdef header} (index: integer): PAnsiChar; cdecl{$endif};
procedure {$ifndef header} 7008  {$endif}cgeCalcWordMetrics  {$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.
function {$ifndef header} 2007  {$endif}_foGetSysFont  {$ifdef header} (index: integer): integer; cdecl{$endif};

//all objects should be created prior, via CgeNewResource(CGE_RESOURCE_FONT, ...)
function {$ifndef header} 2001  {$endif}_foLoadFont  {$ifdef header} (FileName: PAnsiChar; name: integer): boolean; cdecl{$endif};
function {$ifndef header} 2008  {$endif}_foGetFontname  {$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.
function {$ifndef header} 2006  {$endif}_foCalcWord  {$ifdef header}
  (chars: PWideChar; len, font, size: integer; bold, italic, condensed: boolean; word: PiCharArray;
   texture, shadow: pGLuint): integer; cdecl{$endif};
*)




