diff --git a/dlls/csx_sql/CMisc.cpp b/dlls/csx_sql/CMisc.cpp new file mode 100755 index 00000000..bc664d8a --- /dev/null +++ b/dlls/csx_sql/CMisc.cpp @@ -0,0 +1,300 @@ + + +#include "CMisc.h" +#include "rank.h" + +// ***************************************************** +// class Grenades +// ***************************************************** +void Grenades::put( edict_t* grenade, float time, int type, CPlayer* player ) +{ + Obj* a = new Obj; + if ( a == 0 ) return; + a->player = player; + a->grenade = grenade; + a->time = gpGlobals->time + time; + a->type = type; + a->prev = 0; + a->next = head; + if ( head ) head->prev = a; + head = a; +} + +bool Grenades::find( edict_t* enemy, CPlayer** p, int* type ) +{ + bool found = false; + Obj* a = head; + while ( a ){ + if ( a->time > gpGlobals->time && !found ) { + if ( a->grenade == enemy ) { + found = true; + *p = a->player; + *type = a->type; + } + } + else { + Obj* next = a->next; + if (a->prev) a->prev->next = next; + else head = next; + if (next) next->prev = a->prev; + delete a; + a = next; + continue; + } + a = a->next; + } + + return found; +} + + + +void Grenades::clear() +{ + while(head){ + Obj* a = head->next; + delete head; + head = a; + } +} + +// ***************************************************** +// class CPlayer +// ***************************************************** + +void CPlayer::Disconnect(){ + + if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused + return; + + rank->updatePosition( &life ); + rank = 0; +} + +void CPlayer::PutInServer(){ + + if ( ignoreBots(pEdict) ) + return; + + restartStats(); + const char* name = STRING(pEdict->v.netname); + const char* unique = name; + switch((int)csstats_rank->value) { + case 1: + if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 ) + unique = name; // failed to get authid + break; + case 2: + unique = ip; + } + rank = g_rank.findEntryInRank( unique , name ); +} + +void CPlayer::Connect(const char* address ){ + bot = IsBot(); + strcpy(ip,address); + rank = 0; + clearStats = 0.0f; +} + +void CPlayer::restartStats(bool all) +{ + if ( all ) memset(weapons,0,sizeof(weapons)); + memset(weaponsRnd,0,sizeof(weaponsRnd)); //DEC-Weapon (Round) stats + memset(attackers,0,sizeof(attackers)); + memset(victims,0,sizeof(victims)); + memset(&life,0,sizeof(life)); +} + +void CPlayer::Init( int pi, edict_t* pe ) +{ + pEdict = pe; + index = pi; + current = 0; + clearStats = 0.0f; + rank = 0; +} + +void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){ + + if ( ignoreBots(pEdict,pVictim->pEdict) ) + return; + + if ( pVictim->index == index ){ // killed self + pVictim->weapons[0].deaths++; + pVictim->life.deaths++; + pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats + return; + } + + pVictim->attackers[index].name = weaponData[wweapon].name; + pVictim->attackers[index].kills++; + pVictim->attackers[index].hs += hhs; + pVictim->attackers[index].tks += ttk; + pVictim->attackers[0].kills++; + pVictim->attackers[0].hs += hhs; + pVictim->attackers[0].tks += ttk; + pVictim->weapons[pVictim->current].deaths++; + pVictim->weapons[0].deaths++; + pVictim->life.deaths++; + + + pVictim->weaponsRnd[pVictim->current].deaths++; // DEC-Weapon (round) stats + pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats + + int vi = pVictim->index; + victims[vi].name = weaponData[wweapon].name; + victims[vi].deaths++; + victims[vi].hs += hhs; + victims[vi].tks += ttk; + victims[0].deaths++; + victims[0].hs += hhs; + victims[0].tks += ttk; + + weaponsRnd[wweapon].kills++; // DEC-Weapon (round) stats + weaponsRnd[wweapon].hs += hhs; // DEC-Weapon (round) stats + weaponsRnd[wweapon].tks += ttk; // DEC-Weapon (round) stats + weaponsRnd[0].kills++; // DEC-Weapon (round) stats + weaponsRnd[0].hs += hhs; // DEC-Weapon (round) stats + weaponsRnd[0].tks += ttk; // DEC-Weapon (round) stats + + weapons[wweapon].kills++; + weapons[wweapon].hs += hhs; + weapons[wweapon].tks += ttk; + weapons[0].kills++; + weapons[0].hs += hhs; + weapons[0].tks += ttk; + life.kills++; + life.hs += hhs; + life.tks += ttk; +} + +void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){ + + if ( ignoreBots(pEdict,pVictim->pEdict) ) + return; + + if ( index == pVictim->index ) return; + + pVictim->attackers[index].hits++; + pVictim->attackers[index].damage += ddamage; + pVictim->attackers[index].bodyHits[bbody]++; + pVictim->attackers[0].hits++; + pVictim->attackers[0].damage += ddamage; + pVictim->attackers[0].bodyHits[bbody]++; + + + int vi = pVictim->index; + victims[vi].hits++; + victims[vi].damage += ddamage; + victims[vi].bodyHits[bbody]++; + victims[0].hits++; + victims[0].damage += ddamage; + victims[0].bodyHits[bbody]++; + + weaponsRnd[wweapon].hits++; // DEC-Weapon (round) stats + weaponsRnd[wweapon].damage += ddamage; // DEC-Weapon (round) stats + weaponsRnd[wweapon].bodyHits[bbody]++; // DEC-Weapon (round) stats + weaponsRnd[0].hits++; // DEC-Weapon (round) stats + weaponsRnd[0].damage += ddamage; // DEC-Weapon (round) stats + weaponsRnd[0].bodyHits[bbody]++; // DEC-Weapon (round) stats + + weapons[wweapon].hits++; + weapons[wweapon].damage += ddamage; + weapons[wweapon].bodyHits[bbody]++; + weapons[0].hits++; + weapons[0].damage += ddamage; + weapons[0].bodyHits[bbody]++; + + life.hits++; + life.damage += ddamage; + life.bodyHits[bbody]++; +} + + +void CPlayer::saveShot(int weapon){ + + if ( ignoreBots(pEdict) ) + return; + + victims[0].shots++; + weapons[weapon].shots++; + weapons[0].shots++; + life.shots++; + weaponsRnd[weapon].shots++; // DEC-Weapon (round) stats + weaponsRnd[0].shots++; // DEC-Weapon (round) stats +} + + +void CPlayer::saveBPlant(){ + life.bPlants++; +} + +void CPlayer::saveBExplode(){ + life.bExplosions++; +} + +void CPlayer::saveBDefusing(){ + life.bDefusions++; +} + +void CPlayer::saveBDefused(){ + life.bDefused++; +} + + +// ***************************************************** +// class Forward +// ***************************************************** + +void Forward::put( AMX *a , int i ){ + head = new AmxCall( a, i , head ); +} + + +void Forward::clear(){ + while ( head ) { + AmxCall* a = head->next; + delete head; + head = a; + } +} + +void Forward::exec(int p1,int p2,int p3,int p4,int p5,int p6){ + AmxCall* a = head; + while ( a ){ + MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 6,p1, p2, p3, p4, p5, p6); + a = a->next; + } +} + +void Forward::exec(int p1,int p2,int p3,int p4,int p5){ + AmxCall* a = head; + while ( a ){ + MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 5,p1, p2, p3, p4, p5); + a = a->next; + } +} + +void Forward::exec(int p1,int p2){ + AmxCall* a = head; + while ( a ){ + MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 2,p1, p2); + a = a->next; + } +} + +// ***************************************************** + +bool ignoreBots (edict_t *pEnt, edict_t *pOther){ + if ( !rankBots && ( pEnt->v.flags & FL_FAKECLIENT || ( pOther && pOther->v.flags & FL_FAKECLIENT ) ) ) + return true; + return false; +} + +bool isModuleActive(){ + if ( !(int)CVAR_GET_FLOAT("csstats_pause") ) + return true; + return false; +} + diff --git a/dlls/csx_sql/CMisc.h b/dlls/csx_sql/CMisc.h new file mode 100755 index 00000000..1996f334 --- /dev/null +++ b/dlls/csx_sql/CMisc.h @@ -0,0 +1,116 @@ + + +#ifndef CMISC_H +#define CMISC_H + +#include "amxxmodule.h" +#include "CRank.h" + +#define MAX_CWEAPONS 6 + +#define CSW_HEGRENADE 4 +#define CSW_C4 6 +#define CSW_SMOKEGRENADE 9 +#define CSW_FLASHBANG 25 + +// ***************************************************** +// class CPlayer +// ***************************************************** + +struct CPlayer { + edict_t* pEdict; + char ip[32]; + int index; + int aiming; + int current; + bool bot; + float clearStats; + RankSystem::RankStats* rank; + + struct PlayerWeapon : Stats { + const char* name; + int ammo; + int clip; + }; + + PlayerWeapon weapons[MAX_WEAPONS+MAX_CWEAPONS]; + PlayerWeapon attackers[33]; + PlayerWeapon victims[33]; + Stats weaponsRnd[MAX_WEAPONS+MAX_CWEAPONS]; // DEC-Weapon (Round) stats + Stats life; + + int teamId; + + void Init( int pi, edict_t* pe ); + void Connect(const char* ip ); + void PutInServer(); + void Disconnect(); + void saveKill(CPlayer* pVictim, int weapon, int hs, int tk); + void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming); + void saveShot(int weapon); + + void saveBPlant(); + void saveBExplode(); + void saveBDefusing(); + void saveBDefused(); + + void restartStats(bool all = true); + inline bool IsBot(){ + const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict); + return ( auth && !strcmp( auth , "BOT" ) ); + } + inline bool IsAlive(){ + return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0)); + } +}; + +// ***************************************************** +// class Grenades +// ***************************************************** + +class Grenades +{ + struct Obj + { + CPlayer* player; + edict_t* grenade; + float time; + int type; + Obj* next; + Obj* prev; + } *head; + +public: + Grenades() { head = 0; } + ~Grenades() { clear(); } + void put( edict_t* grenade, float time, int type, CPlayer* player ); + bool find( edict_t* enemy, CPlayer** p, int* type ); + void clear(); +}; + +// ***************************************************** +// class Forward +// ***************************************************** + +class Forward +{ + struct AmxCall { + AMX *amx; + int iFunctionIdx; + AmxCall* next; + AmxCall( AMX *a , int i, AmxCall* n ): amx(a), iFunctionIdx(i), next(n) {} + } *head; +public: + Forward() { head = 0; } + ~Forward() { clear(); } + void clear(); + void put( AMX *a , int i ); + void exec(int p1,int p2,int p3,int p4,int p5,int p6); + void exec(int p1,int p2,int p3,int p4,int p5); + void exec(int p1,int p2); +}; + +#endif // CMISC_H + + + diff --git a/dlls/csx_sql/CRank.cpp b/dlls/csx_sql/CRank.cpp new file mode 100755 index 00000000..92ce3c61 --- /dev/null +++ b/dlls/csx_sql/CRank.cpp @@ -0,0 +1,306 @@ +#include "amxxmodule.h" +#include "CRank.h" +#include "rank.h" + +// ***************************************************** +// class Stats +// ***************************************************** +Stats::Stats(){ + hits = shots = damage = hs = tks = kills = deaths = bDefusions = bDefused = bPlants = bExplosions = 0; + memset( bodyHits , 0 ,sizeof( bodyHits ) ); +} +void Stats::commit(Stats* a){ + hits += a->hits; + shots += a->shots; + damage += a->damage; + hs += a->hs; + tks += a->tks; + kills += a->kills; + deaths += a->deaths; + + bDefusions += a->bDefusions; + bDefused += a->bDefused; + bPlants += a->bPlants; + bExplosions += a->bExplosions; + + for(int i = 1; i < 8; ++i) + bodyHits[i] += a->bodyHits[i]; +} + + +// ***************************************************** +// class RankSystem +// ***************************************************** +RankSystem::RankStats::RankStats( const char* uu, const char* nn, RankSystem* pp ) { + name = 0; + namelen = 0; + unique = 0; + uniquelen = 0; + score = 0; + parent = pp; + id = ++parent->rankNum; + next = prev = 0; + setName( nn ); + setUnique( uu ); +} + +RankSystem::RankStats::~RankStats() { + delete[] name; + delete[] unique; + --parent->rankNum; +} + +void RankSystem::RankStats::setName( const char* nn ) { + delete[] name; + namelen = strlen(nn) + 1; + name = new char[namelen]; + if ( name ) + strcpy( name , nn ); + else + namelen = 0; +} + +void RankSystem::RankStats::setUnique( const char* nn ) { + delete[] unique; + uniquelen = strlen(nn) + 1; + unique = new char[uniquelen]; + if ( unique ) + strcpy( unique , nn ); + else + uniquelen = 0; +} + +RankSystem::RankSystem() { + head = 0; + tail = 0; + rankNum = 0; + calc.code = 0; +} + +RankSystem::~RankSystem() { + clear(); +} + +void RankSystem::put_before( RankStats* a, RankStats* ptr ){ + a->next = ptr; + if ( ptr ){ + a->prev = ptr->prev; + ptr->prev = a; + } + else{ + a->prev = head; + head = a; + } + if ( a->prev ) a->prev->next = a; + else tail = a; +} + +void RankSystem::put_after( RankStats* a, RankStats* ptr ) { + a->prev = ptr; + if ( ptr ){ + a->next = ptr->next; + ptr->next = a; + } + else{ + a->next = tail; + tail = a; + } + if ( a->next ) a->next->prev = a; + else head = a; +} + +void RankSystem::unlink( RankStats* ptr ){ + if (ptr->prev) ptr->prev->next = ptr->next; + else tail = ptr->next; + if (ptr->next) ptr->next->prev = ptr->prev; + else head = ptr->prev; +} + +void RankSystem::clear(){ + while( tail ){ + head = tail->next; + delete tail; + tail = head; + } +} + + + +bool RankSystem::loadCalc(const char* filename, char* error) +{ + if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)|| + (MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)|| + (MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)|| + (MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){ + LOG_CONSOLE( PLID, "Couldn't load plugin (file \"%s\")",filename); + MF_UnloadAmxScript(&calc.amx, &calc.code); + return false; + } + return true; +} + +void RankSystem::unloadCalc() +{ + MF_UnloadAmxScript(&calc.amx , &calc.code); +} + +RankSystem::RankStats* RankSystem::findEntryInRank(const char* unique, const char* name ) +{ + RankStats* a = head; + + while ( a ) + { + if ( strcmp( a->getUnique() ,unique ) == 0 ) + return a; + + a = a->prev; + } + a = new RankStats( unique ,name,this ); + if ( a == 0 ) return 0; + put_after( a , 0 ); + return a; +} + +void RankSystem::updatePos( RankStats* rr , Stats* s ) +{ + rr->addStats( s ); + if ( calc.code ) { + calc.physAddr1[0] = rr->kills; + calc.physAddr1[1] = rr->deaths; + calc.physAddr1[2] = rr->hs; + calc.physAddr1[3] = rr->tks; + calc.physAddr1[4] = rr->shots; + calc.physAddr1[5] = rr->hits; + calc.physAddr1[6] = rr->damage; + + calc.physAddr1[7] = rr->bDefusions; + calc.physAddr1[8] = rr->bDefused; + calc.physAddr1[9] = rr->bPlants; + calc.physAddr1[10] = rr->bExplosions; + + for(int i = 1; i < 8; ++i) + calc.physAddr2[i] = rr->bodyHits[i]; + cell result = 0; + int err; + if ((err = MF_AmxExec(&calc.amx,&result, calc.func ,2,calc.amxAddr1,calc.amxAddr2 )) != AMX_ERR_NONE) + LOG_CONSOLE( PLID, "Run time error %d on line %ld (plugin \"%s\")", err,calc.amx.curline,LOCALINFO("csstats_score")); + rr->score = result; + } + else rr->score = rr->kills - rr->deaths; + + + RankStats* aa = rr->next; + while ( aa && (aa->score <= rr->score) ) { // try to nominate + rr->goUp(); + aa->goDown(); + aa = aa->next; // go to next rank + } + if ( aa != rr->next ) + { + unlink( rr ); + put_before( rr, aa ); + } + else + { + aa = rr->prev; + while ( aa && (aa->score > rr->score) ) { // go down + rr->goDown(); + aa->goUp(); + aa = aa->prev; // go to prev rank + } + if ( aa != rr->prev ){ + unlink( rr ); + put_after( rr, aa ); + } + } + +} + +void RankSystem::loadRank( const char* filename ) +{ + FILE *bfp = fopen( filename , "rb" ); + + if ( !bfp ) return; + + short int i = 0; + fread(&i, 1 , sizeof(short int) , bfp); + + if (i == RANK_VERSION) + { + Stats d; + char unique[64], name[64]; + fread(&i , 1, sizeof(short int), bfp); + + while( i ) + { + fread(name , i,sizeof(char) , bfp); + fread(&i , 1, sizeof(short int), bfp); + fread(unique , i,sizeof(char) , bfp); + fread(&d.tks, 1,sizeof(int), bfp); + fread(&d.damage, 1,sizeof(int), bfp); + fread(&d.deaths, 1,sizeof(int), bfp); + fread(&d.kills, 1,sizeof(int), bfp); + fread(&d.shots, 1,sizeof(int), bfp); + fread(&d.hits, 1,sizeof(int), bfp); + fread(&d.hs, 1,sizeof(int), bfp); + + fread(&d.bDefusions, 1,sizeof(int), bfp); + fread(&d.bDefused, 1,sizeof(int), bfp); + fread(&d.bPlants, 1,sizeof(int), bfp); + fread(&d.bExplosions, 1,sizeof(int), bfp); + + fread(d.bodyHits, 1,sizeof(d.bodyHits), bfp); + fread(&i , 1, sizeof(short int), bfp); + + RankSystem::RankStats* a = findEntryInRank( unique , name ); + + if ( a ) a->updatePosition( &d ); + } + } + fclose(bfp); +} + +void RankSystem::saveRank( const char* filename ) +{ + FILE *bfp = fopen(filename, "wb"); + + if ( !bfp ) return; + + short int i = RANK_VERSION; + + fwrite(&i, 1, sizeof(short int) , bfp); + + RankSystem::iterator a = front(); + + while ( a ) + { + if ( (*a).score != (1<<31) ) // score must be different than mincell + { + fwrite( &(*a).namelen , 1, sizeof(short int), bfp); + fwrite( (*a).name , (*a).namelen , sizeof(char) , bfp); + fwrite( &(*a).uniquelen , 1, sizeof(short int), bfp); + fwrite( (*a).unique , (*a).uniquelen , sizeof(char) , bfp); + fwrite( &(*a).tks, 1, sizeof(int), bfp); + fwrite( &(*a).damage, 1, sizeof(int), bfp); + fwrite( &(*a).deaths, 1, sizeof(int), bfp); + fwrite( &(*a).kills, 1, sizeof(int), bfp); + fwrite( &(*a).shots, 1, sizeof(int), bfp); + fwrite( &(*a).hits, 1, sizeof(int), bfp); + fwrite( &(*a).hs, 1, sizeof(int), bfp); + + fwrite( &(*a).bDefusions, 1, sizeof(int), bfp); + fwrite( &(*a).bDefused, 1, sizeof(int), bfp); + fwrite( &(*a).bPlants, 1, sizeof(int), bfp); + fwrite( &(*a).bExplosions, 1, sizeof(int), bfp); + + fwrite( (*a).bodyHits, 1, sizeof((*a).bodyHits), bfp); + } + + --a; + } + + i = 0; + fwrite( &i , 1, sizeof(short int), bfp); // null terminator + + fclose(bfp); +} diff --git a/dlls/csx_sql/CRank.h b/dlls/csx_sql/CRank.h new file mode 100755 index 00000000..afbbfdfc --- /dev/null +++ b/dlls/csx_sql/CRank.h @@ -0,0 +1,123 @@ + + +#ifndef CRANK_H +#define CRANK_H + +#define RANK_VERSION 11 + +#include "amxxmodule.h" + +// ***************************************************** +// class Stats +// ***************************************************** + +struct Stats { + int hits; + int shots; + int damage; + int hs; + int tks; + int kills; + int deaths; + int bodyHits[9]; //////////////////// + + // SiDLuke start + int bPlants; + int bExplosions; + int bDefusions; + int bDefused; + // SiDLuke end :D + + Stats(); + void commit(Stats* a); +}; + +// ***************************************************** +// class RankSystem +// ***************************************************** + +class RankSystem +{ +public: + class RankStats; + friend class RankStats; + class iterator; + + class RankStats : public Stats { + friend class RankSystem; + friend class iterator; + RankSystem* parent; + RankStats* next; + RankStats* prev; + char* unique; + short int uniquelen; + char* name; + short int namelen; + int score; + int id; + RankStats( const char* uu, const char* nn, RankSystem* pp ); + ~RankStats(); + void setUnique( const char* nn ); + inline void goDown() {++id;} + inline void goUp() {--id;} + inline void addStats(Stats* a) { commit( a ); } + public: + void setName( const char* nn ); + inline const char* getName() const { return name ? name : ""; } + inline const char* getUnique() const { return unique ? unique : ""; } + inline int getPosition() const { return id; } + inline void updatePosition( Stats* points ) { + parent->updatePos( this , points ); + } + }; + +private: + RankStats* head; + RankStats* tail; + int rankNum; + + struct scoreCalc{ + AMX amx; + void* code; + int func; + cell amxAddr1; + cell amxAddr2; + cell *physAddr1; + cell *physAddr2; + } calc; + + void put_before( RankStats* a, RankStats* ptr ); + void put_after( RankStats* a, RankStats* ptr ); + void unlink( RankStats* ptr ); + void updatePos( RankStats* r , Stats* s ); + +public: + + RankSystem(); + ~RankSystem(); + + void saveRank( const char* filename ); + void saveRankSql(); + void loadRank( const char* filename ); + RankStats* findEntryInRank(const char* unique, const char* name ); + bool loadCalc(const char* filename, char* error); + inline int getRankNum( ) const { return rankNum; } + void clear(); + void unloadCalc(); + + class iterator { + RankStats* ptr; + public: + iterator(RankStats* a): ptr(a){} + inline iterator& operator--() { ptr = ptr->prev; return *this;} + inline iterator& operator++() { ptr = ptr->next; return *this; } + inline RankStats& operator*() { return *ptr;} + operator bool () { return (ptr != 0); } + }; + + inline iterator front() { return iterator(head); } + inline iterator begin() { return iterator(tail); } +}; + + +#endif \ No newline at end of file diff --git a/dlls/csx_sql/CRank_sql.cpp b/dlls/csx_sql/CRank_sql.cpp new file mode 100755 index 00000000..10b872f3 --- /dev/null +++ b/dlls/csx_sql/CRank_sql.cpp @@ -0,0 +1,201 @@ +// The good stuff: http://dev.mysql.com/doc/mysql/en/mysql_query.html + +#include "amxxmodule.h" +#include "CRank.h" +#include "rank.h" + +#ifndef __linux__ +#define WINDOWS_LEAN_AND_MEAN +#include +#endif +#include +#include + +#include +#define MYSQL_QUERY_IS_A_OKAY 0 + +cvar_t init_csx_sqlstats_host = {"csx_sqlstats_ip", "127.0.0.1", FCVAR_SPONLY | FCVAR_PROTECTED}; +cvar_t init_csx_sqlstats_username = {"csx_sqlstats_username", "", FCVAR_SPONLY | FCVAR_PROTECTED}; +cvar_t init_csx_sqlstats_password = {"csx_sqlstats_password", "", FCVAR_SPONLY | FCVAR_PROTECTED}; +cvar_t init_csx_sqlstats_db = {"csx_sqlstats_db", "amxmodx_stats_cs", FCVAR_SPONLY | FCVAR_PROTECTED}; +cvar_t init_csx_sqlstats_table = {"csx_sqlstats_table", "cs", FCVAR_SPONLY | FCVAR_PROTECTED}; +cvar_t *csx_sqlstats_host; +cvar_t *csx_sqlstats_username; +cvar_t *csx_sqlstats_password; +cvar_t *csx_sqlstats_db; +cvar_t *csx_sqlstats_table; + +void OnMetaAttach_sql() { + CVAR_REGISTER(&init_csx_sqlstats_host); + CVAR_REGISTER(&init_csx_sqlstats_username); + CVAR_REGISTER(&init_csx_sqlstats_password); + CVAR_REGISTER(&init_csx_sqlstats_db); + CVAR_REGISTER(&init_csx_sqlstats_table); + + csx_sqlstats_host = CVAR_GET_POINTER(init_csx_sqlstats_host.name); + csx_sqlstats_username = CVAR_GET_POINTER(init_csx_sqlstats_username.name); + csx_sqlstats_password = CVAR_GET_POINTER(init_csx_sqlstats_password.name); + csx_sqlstats_db = CVAR_GET_POINTER(init_csx_sqlstats_db.name); + csx_sqlstats_table = CVAR_GET_POINTER(init_csx_sqlstats_table.name); +} + +int Error(MYSQL *mysql) +{ + if (mysql == NULL) + return 0; + + return mysql_errno(mysql); +} + +void RankSystem::saveRankSql() +{ + MF_PrintSrvConsole("[CSX Sql] Exporting players' statistics to SQL db..."); + clock_t startTime = clock(); + time_t now = time(NULL); + + MYSQL *mysql = NULL; + + mysql = mysql_init(NULL); + int port = 0, error = 0; + if (!mysql_real_connect(mysql, csx_sqlstats_host->string, csx_sqlstats_username->string, csx_sqlstats_password->string, NULL, port, NULL, 0)) { + error = Error(mysql); + if (error) { + MF_Log("DB Connection failed (%d): %s", error, mysql_error(mysql)); + mysql_close(mysql); + return; + } + } + + if (mysql_select_db(mysql, csx_sqlstats_db->string) != 0) { + error = Error(mysql); + if (error) { + MF_Log("DB Select DB failed (%d): %s", error, mysql_error(mysql)); + mysql_close(mysql); + return; + } + } + + // Query + char query[1024]; + int exportedRecords = 0; + + RankSystem::iterator a = front(); + + char *authid, *name; + int tks, damage, deaths, kills, shots, hits, hs, defusions, defused, plants, explosions, *bodyHits; + + while ( a ) + { + if ( (*a).score != (1<<31) ) // score must be different than mincell + { + authid = (*a).unique; + if (strcmp(authid, "BOT") == 0 || strcmp(authid, "STEAM_ID_PENDING") == 0) { + --a; + continue; + } + exportedRecords++; + + name = (*a).name; + tks = (*a).tks; + damage = (*a).damage; + deaths = (*a).deaths; + kills = (*a).kills; + shots = (*a).shots; + hits = (*a).hits; + hs = (*a).hs; + defusions = (*a).bDefusions; + defused = (*a).bDefused; + plants = (*a).bPlants; + explosions = (*a).bExplosions; + bodyHits = ((*a).bodyHits); + + _snprintf(query, 1023, "UPDATE `%s` SET `timestamp` = %d, `stats_name` = \"%s\", `stats_tks` = \"%d\", `stats_damage` = \"%d\", `stats_deaths` = \"%d\", `stats_frags` = \"%d\", `stats_shots` = \"%d\", `stats_hits` = \"%d\", `stats_hs` = \"%d\", `stats_defusions` = \"%d\", `stats_defused` = \"%d\", `stats_plants` = \"%d\", `stats_explosions` = \"%d\", `stats_bodyhits0` = \"%d\", `stats_bodyhits1` = \"%d\", `stats_bodyhits2` = \"%d\", `stats_bodyhits3` = \"%d\", `stats_bodyhits4` = \"%d\", `stats_bodyhits5` = \"%d\", `stats_bodyhits6` = \"%d\", `stats_bodyhits7` = \"%d\", `stats_bodyhits8` = \"%d\" WHERE `stats_authid` = \"%s\" LIMIT 1", + csx_sqlstats_table->string, + now, + name, + tks, + damage, + deaths, + kills, + shots, + hits, + hs, + defusions, + defused, + plants, + explosions, + bodyHits[0], + bodyHits[1], + bodyHits[2], + bodyHits[3], + bodyHits[4], + bodyHits[5], + bodyHits[6], + bodyHits[7], + bodyHits[8], + authid); + // + + int queryResult = mysql_query(mysql, query); + if (queryResult != MYSQL_QUERY_IS_A_OKAY) + { + error = Error(mysql); + MF_Log("DB Query Update failed (%d): %s", error, mysql_error(mysql)); + mysql_close(mysql); + return; + } + + if (mysql_affected_rows(mysql) == 0) { + // New player, do insert + _snprintf(query, 1023, "INSERT INTO `%s` (`timestamp`, `stats_authid`, `stats_name`, `stats_tks`, `stats_damage`, `stats_deaths`, `stats_frags`, `stats_shots`, `stats_hits`, `stats_hs`, `stats_defusions`, `stats_defused`, `stats_plants`, `stats_explosions`, `stats_bodyhits0`, `stats_bodyhits1`, `stats_bodyhits2`, `stats_bodyhits3`, `stats_bodyhits4`, `stats_bodyhits5`, `stats_bodyhits6`, `stats_bodyhits7`, `stats_bodyhits8`) VALUES (\"%d\", \"%s\", \"%s\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\")", + csx_sqlstats_table->string, + now, + + authid, + name, + + tks, + damage, + deaths, + kills, + shots, + + hits, + hs, + defusions, + defused, + plants, + + explosions, + + bodyHits[0], + bodyHits[1], + bodyHits[2], + bodyHits[3], + bodyHits[4], + bodyHits[5], + bodyHits[6], + bodyHits[7], + bodyHits[8] + ); + + int queryResult = mysql_query(mysql, query); + if (queryResult != MYSQL_QUERY_IS_A_OKAY) + { + error = Error(mysql); + MF_Log("DB Query Insert failed (%d): %s", error, mysql_error(mysql)); + mysql_close(mysql); + return; + } + } + } + + --a; + } + + // Disconnect + mysql_close(mysql); + + clock_t stopTime = clock(); + MF_PrintSrvConsole("...done! (exported %d records in %.2f seconds)\n", exportedRecords, (double)(stopTime - startTime) / (double)CLOCKS_PER_SEC, stopTime, startTime); +} diff --git a/dlls/csx_sql/CString.h b/dlls/csx_sql/CString.h new file mode 100755 index 00000000..7288eded --- /dev/null +++ b/dlls/csx_sql/CString.h @@ -0,0 +1,404 @@ +/* AMX Mod X +* +* by the AMX Mod X Development Team +* originally developed by OLO +* +* +* 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, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +*/ + +#ifndef _INCLUDE_CSTRING_H +#define _INCLUDE_CSTRING_H + +//by David "BAILOPAN" Anderson +class String +{ +public: + String() + { + v = NULL; + mSize = 0; + cSize = 0; + Grow(2); + assign(""); + } + + ~String() + { + if (v) + delete [] v; + } + + String(const char *src) + { + v = NULL; + mSize = 0; + cSize = 0; assign(src); + } + + String(String &src) + { + v = NULL; + mSize = 0; + cSize = 0; + assign(src.c_str()); + } + + const char *c_str() { return v?v:""; } + const char *c_str() const { return v?v:""; } + + void append(const char *t) + { + Grow(cSize + strlen(t) + 1); + strcat(v, t); + cSize = strlen(v); + } + + void append(const char c) + { + Grow(cSize + 2); + v[cSize] = c; + v[++cSize] = 0; + } + + void append(String &d) + { + const char *t = d.c_str(); + Grow(cSize + strlen(t)); + strcat(v, t); + cSize = strlen(v); + } + + void assign(const String &src) + { + assign(src.c_str()); + } + + void assign(const char *d) + { + if (!d) + { + Grow(1); + cSize = 0; + strcpy(v, ""); + return; + } + Grow(strlen(d)); + if (v) + { + strcpy(v, d); + cSize = strlen(v); + } else { + cSize = 0; + } + } + + void clear() + { + if (v) + { + v[0] = 0; + cSize = 0; + } + } + + int compare (const char *d) + { + if (v) { + if (d) { + return strcmp(v, d); + } else { + return strlen(v); + } + } else { + if (d) { + return strlen(d); + } else { + return 0; + } + } + } + + //Added this for amxx inclusion + bool empty() + { + if (!v || !cSize) + return true; + + return false; + } + + int size() + { + if (!v) + return 0; + return cSize; + } + + const char * _fread(FILE *fp) + { + Grow(512); + char * ret = fgets(v, 511, fp); + cSize = strlen(v); + return ret; + } + + int find(const char c, int index = 0) + { + if (!v) + return npos; + if (index >= (int)cSize || index < 0) + return npos; + unsigned int i = 0; + for (i=index; i=0; i--) + { + if (!is_space(v[i]) + || (is_space(v[i]) && i==0)) + { + erase(i+1, j); + break; + } + j++; + } + } + + if (cSize == 1) + { + if (is_space(v[0])) + { + clear(); + return; + } + } + } + + String & erase(unsigned int start, int num = npos) + { + if (!v) + return (*this); + unsigned int i = 0; + //check for bounds + if (num == npos || start+num > cSize-num+1) + num = cSize - start; + //do the erasing + bool copyflag = false; + for (i=0; i=start && i= cSize || !v) + return ns; + + if (num == npos) + { + num = cSize - index; + } else if (index+num >= cSize) { + num = cSize - index; + } + + unsigned int i = 0, j=0; + char *s = new char[cSize+1]; + + for (i=index; i= 65 && v[i] <= 90) + v[i] |= 32; + } + } + + String & operator = (const String &src) + { + assign(src); + return *this; + } + + String & operator = (const char *src) + { + assign(src); + return *this; + + } + + char operator [] (unsigned int index) + { + if (index > cSize) + { + return -1; + } else { + return v[index]; + } + } + + int at(int a) + { + if (a < 0 || a >= (int)cSize) + return -1; + + return v[a]; + } + + bool at(int at, char c) + { + if (at < 0 || at >= (int)cSize) + return false; + + v[at] = c; + + return true; + } + +private: + void Grow(unsigned int d) + { + if (d<1) + return; + if (d > mSize) + { + mSize = d + 16; // allocate a buffer + char *t = new char[d+1]; + if (v) { + strcpy(t, v); + t[cSize] = 0; + delete [] v; + } + v = t; + mSize = d; + } + } + + char *v; + unsigned int mSize; + unsigned int cSize; +public: + static const int npos = -1; +}; + +#endif //_INCLUDE_CSTRING_H diff --git a/dlls/csx_sql/CVector.h b/dlls/csx_sql/CVector.h new file mode 100755 index 00000000..05538f53 --- /dev/null +++ b/dlls/csx_sql/CVector.h @@ -0,0 +1,444 @@ +/* AMX Mod X +* +* by the AMX Mod X Development Team +* originally developed by OLO +* +* +* 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, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +*/ + +#ifndef __CVECTOR_H__ +#define __CVECTOR_H__ + +#include + +// Vector +template class CVector +{ + bool Grow() + { + // automatic grow + size_t newSize = m_Size * 2; + if (newSize == 0) + newSize = 8; // a good init value + T *newData = new T[newSize]; + if (!newData) + return false; + if (m_Data) + { + memcpy(newData, m_Data, m_Size * sizeof(T)); + delete [] m_Data; + } + m_Data = newData; + m_Size = newSize; + return true; + } + + bool GrowIfNeeded() + { + if (m_CurrentUsedSize >= m_Size) + return Grow(); + else + return true; + } + + bool ChangeSize(size_t size) + { + // change size + if (size == m_Size) + return true; + T *newData = new T[size]; + if (!newData) + return false; + if (m_Data) + { + memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + delete [] m_Data; + } + if (m_Size < size) + m_CurrentSize = size; + m_Data = newData; + m_Size = size; + return true; + } + + void FreeMemIfPossible() + { + + } +protected: + T *m_Data; + size_t m_Size; + size_t m_CurrentUsedSize; + size_t m_CurrentSize; +public: + class iterator + { + protected: + T *m_Ptr; + public: + // constructors / destructors + iterator() + { + m_Ptr = NULL; + } + + iterator(T * ptr) + { + m_Ptr = ptr; + } + + // member functions + T * base() + { + return m_Ptr; + } + + const T * base() const + { + return m_Ptr; + } + + // operators + T & operator*() + { + return *m_Ptr; + } + + T * operator->() + { + return m_Ptr; + } + + iterator & operator++() // preincrement + { + ++m_Ptr; + return (*this); + } + + iterator operator++(int) // postincrement + { + iterator tmp = *this; + ++m_Ptr; + return tmp; + } + + iterator & operator--() // predecrement + { + --m_Ptr; + return (*this); + } + + iterator operator--(int) // postdecrememnt + { + iterator tmp = *this; + --m_Ptr; + return tmp; + } + + bool operator==(T * right) const + { + return (m_Ptr == right); + } + + bool operator==(const iterator & right) const + { + return (m_Ptr == right.m_Ptr); + } + + bool operator!=(T * right) const + { + return (m_Ptr != right); + } + + bool operator!=(const iterator & right) const + { + return (m_Ptr != right.m_Ptr); + } + + iterator & operator+=(size_t offset) + { + m_Ptr += offset; + return (*this); + } + + iterator & operator-=(size_t offset) + { + m_Ptr += offset; + return (*this); + } + + iterator operator+(size_t offset) const + { + iterator tmp(*this); + tmp.m_Ptr += offset; + return tmp; + } + + iterator operator-(size_t offset) const + { + iterator tmp(*this); + tmp.m_Ptr += offset; + return tmp; + } + + T & operator[](size_t offset) + { + return (*(*this + offset)); + } + + const T & operator[](size_t offset) const + { + return (*(*this + offset)); + } + + bool operator<(const iterator & right) const + { + return m_Ptr < right.m_Ptr; + } + + bool operator>(const iterator & right) const + { + return m_Ptr > right.m_Ptr; + } + + bool operator<=(const iterator & right) const + { + return m_Ptr <= right.m_Ptr; + } + + bool operator>=(const iterator & right) const + { + return m_Ptr >= right.m_Ptr; + } + + size_t operator-(const iterator & right) const + { + return m_Ptr - right.m_Ptr; + } + }; + + // constructors / destructors + CVector() + { + m_Size = 0; + m_CurrentUsedSize = 0; + m_Data = NULL; + } + + CVector(const CVector & other) + { + // copy data + m_Data = new T [other.m_Size]; + m_Size = other.m_Size; + m_CurrentUsedSize = other.m_CurrentUsedSize; + memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + } + + ~CVector() + { + clear(); + } + + // interface + size_t size() const + { + return m_CurrentUsedSize; + } + + size_t capacity() const + { + return m_Size; + } + + iterator begin() + { + return iterator(m_Data); + } + + iterator end() + { + return iterator(m_Data + m_CurrentUsedSize); + } + + iterator iterAt(size_t pos) + { + if (pos > m_CurrentUsedSize) + assert(0); + return iterator(m_Data + pos); + } + + bool reserve(size_t newSize) + { + return ChangeSize(newSize); + } + + bool push_back(const T & elem) + { + ++m_CurrentUsedSize; + if (!GrowIfNeeded()) + { + --m_CurrentUsedSize; + return false; + } + + m_Data[m_CurrentUsedSize - 1] = elem; + return true; + } + + void pop_back() + { + --m_CurrentUsedSize; + if (m_CurrentUsedSize < 0) + m_CurrentUsedSize = 0; + // :TODO: free memory sometimes + } + + bool resize(size_t newSize) + { + if (!ChangeSize(newSize)) + return false; + FreeMemIfPossible(); + return true; + } + + bool empty() const + { + return (m_CurrentUsedSize == 0); + } + + T & at(size_t pos) + { + if (pos > m_CurrentUsedSize) + { + assert(0); + } + return m_Data[pos]; + } + + const T & at(size_t pos) const + { + if (pos > m_CurrentUsedSize) + { + assert(0); + } + return m_Data[pos]; + } + + T & operator[](size_t pos) + { + return at(pos); + } + + const T & operator[](size_t pos) const + { + return at(pos); + } + + T & front() + { + if (m_CurrentUsedSize < 1) + { + assert(0); + } + return m_Data[0]; + } + + const T & front() const + { + if (m_CurrentUsedSize < 1) + { + assert(0); + } + return m_Data[0]; + } + + T & back() + { + if (m_CurrentUsedSize < 1) + { + assert(0); + } + return m_Data[m_CurrentUsedSize - 1]; + } + + const T & back() const + { + if (m_CurrentUsedSize < 1) + { + assert(0); + } + return m_Data[m_CurrentUsedSize - 1]; + } + + bool insert(iterator where, const T & value) + { + // we have to insert before + // if it is begin, don't decrement + if (where != m_Data) + --where; + // validate iter + if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) + return false; + + ++m_CurrentUsedSize; + if (!GrowIfNeeded()) + { + --m_CurrentUsedSize; + return false; + } + + memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data)); + memcpy(where.base(), &value, sizeof(T)); + return true; + } + + void erase(iterator where) + { + // validate iter + if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) + return false; + + if (m_CurrentUsedSize > 1) + { + // move + memmove(where.base(), where.base() + 1, m_CurrentUsedSize - 1); + } + + --m_CurrentUsedSize; + // :TODO: free memory sometimes + } + + void clear() + { + m_Size = 0; + m_CurrentUsedSize = 0; + delete [] m_Data; + m_Data = NULL; + } +}; + +#endif // __CVECTOR_H__ + diff --git a/dlls/csx_sql/Makefile b/dlls/csx_sql/Makefile new file mode 100755 index 00000000..3c0c58c3 --- /dev/null +++ b/dlls/csx_sql/Makefile @@ -0,0 +1,102 @@ +MODNAME = csx_amxx +SRCFILES = amxxmodule.cpp CMisc.cpp CRank.cpp meta_api.cpp rank.cpp usermsg.cpp + +EXTRA_LIBS_LINUX = +EXTRA_LIBS_WIN32 = +EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux +EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32 + +EXTRA_INCLUDEDIRS = -Iextra/include -I../amx + +EXTRA_FLAGS = -Dstrcmpi=strcasecmp + +AMXDIR=../amx +SDKSRC=../sdk +METADIR=../metamod + +OBJDIR_LINUX=obj.linux +OBJDIR_WIN32=obj.win32 +SRCDIR=. + +ifdef windir + OS=WIN32 +else + OS=LINUX +endif + +CC_LINUX=gcc +ifeq "$(OS)" "WIN32" + CC_WIN32=gcc + LD_WINDLL=dllwrap + DEFAULT=win32 + CLEAN=clean_win32 +else + CC_WIN32=/usr/local/cross-tools/i386-mingw32msvc/bin/gcc + LD_WINDLL=/usr/local/cross-tools/bin/i386-mingw32msvc-dllwrap + DEFAULT=linux win32 + CLEAN=clean_both +endif + + +LIBFILE_LINUX = $(MODNAME)_i386.so +LIBFILE_WIN32 = $(MODNAME).dll +TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX) +TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32) + +FILES_ALL = *.cpp *.h [A-Z]* *.rc +ifeq "$(OS)" "LINUX" + ASRCFILES := $(shell ls -t $(SRCFILES)) +else + ASRCFILES := $(shell dir /b) +endif +OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o) +OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) + +CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \ + -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ + -malign-jumps=2 -malign-functions=2 -s -DNDEBUG + +INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(AMXDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS) +CFLAGS=-Wall -Wno-unknown-pragmas +ODEF = -DOPT_TYPE=\"optimized\" +CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS) + +DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $< +DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $< +LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@ +LINK_WIN32=$(LD_WINDLL) -mwindows --add-stdcall-alias $(OBJ_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@ + +$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp + $(DO_CC_LINUX) + +$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.cpp + $(DO_CC_WIN32) + +default: $(DEFAULT) + +$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX) + $(LINK_LINUX) + +$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32) + $(LINK_WIN32) + +$(OBJDIR_LINUX): + mkdir $@ + +$(OBJDIR_WIN32): + mkdir $@ + +win32: $(TARGET_WIN32) + +linux: $(TARGET_LINUX) + +clean: $(CLEAN) + +clean_both: + -rm -f $(OBJDIR_LINUX)/* + -rm -f $(OBJDIR_WIN32)/* + +clean_win32: + del /q $(OBJDIR_WIN32) + + diff --git a/dlls/csx_sql/Makefile.pl b/dlls/csx_sql/Makefile.pl new file mode 100755 index 00000000..c695d1b1 --- /dev/null +++ b/dlls/csx_sql/Makefile.pl @@ -0,0 +1,178 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "csx_amxx"; +$sdk = "../../../hlsdk/SourceCode"; +$mm = "../../../metamod/metamod"; +$gccf = "gcc"; + +@CPP_SOURCE_FILES = ("amxxmodule.cpp", "CMisc.cpp", "usermsg.cpp", "meta_api.cpp", "rank.cpp", "CRank.cpp"); + +@C_SOURCE_FILES = (); +my %OPTIONS, %OPT; + +$OPT{"debug"} = "-g -ggdb"; +$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti"; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `$gccf --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +unlink("$outdir/$bin"); +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($ofile))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($ofile))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; +print "$gcc\n"; +`$gcc`; diff --git a/dlls/csx_sql/amxxmodule.cpp b/dlls/csx_sql/amxxmodule.cpp new file mode 100755 index 00000000..5ade3d43 --- /dev/null +++ b/dlls/csx_sql/amxxmodule.cpp @@ -0,0 +1,3047 @@ +/* AMX Mod X +* +* by the AMX Mod X Development Team +* originally developed by OLO +* +* Parts Copyright (C) 2001-2003 Will Day +* +* 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, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +* Description: AMX Mod X Module Interface Functions +*/ + +#include +#include +#include +#include +#include +#include "amxxmodule.h" + +/************* METAMOD SUPPORT *************/ +#ifdef USE_METAMOD + +enginefuncs_t g_engfuncs; +globalvars_t *gpGlobals; + + + +DLL_FUNCTIONS *g_pFunctionTable; +DLL_FUNCTIONS *g_pFunctionTable_Post; +enginefuncs_t *g_pengfuncsTable; +enginefuncs_t *g_pengfuncsTable_Post; +NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; +NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; + + +// GetEntityAPI2 functions +static DLL_FUNCTIONS g_EntityAPI_Table = +{ +#ifdef FN_GameDLLInit + FN_GameDLLInit, +#else + NULL, +#endif +#ifdef FN_DispatchSpawn + FN_DispatchSpawn, +#else + NULL, +#endif +#ifdef FN_DispatchThink + FN_DispatchThink, +#else + NULL, +#endif +#ifdef FN_DispatchUse + FN_DispatchUse, +#else + NULL, +#endif +#ifdef FN_DispatchTouch + FN_DispatchTouch, +#else + NULL, +#endif +#ifdef FN_DispatchBlocked + FN_DispatchBlocked, +#else + NULL, +#endif +#ifdef FN_DispatchKeyValue + FN_DispatchKeyValue, +#else + NULL, +#endif +#ifdef FN_DispatchSave + FN_DispatchSave, +#else + NULL, +#endif +#ifdef FN_DispatchRestore + FN_DispatchRestore, +#else + NULL, +#endif +#ifdef FN_DispatchObjectCollsionBox + FN_DispatchObjectCollsionBox, +#else + NULL, +#endif +#ifdef FN_SaveWriteFields + FN_SaveWriteFields, +#else + NULL, +#endif +#ifdef FN_SaveReadFields + FN_SaveReadFields, +#else + NULL, +#endif +#ifdef FN_SaveGlobalState + FN_SaveGlobalState, +#else + NULL, +#endif +#ifdef FN_RestoreGlobalState + FN_RestoreGlobalState, +#else + NULL, +#endif +#ifdef FN_ResetGlobalState + FN_ResetGlobalState, +#else + NULL, +#endif +#ifdef FN_ClientConnect + FN_ClientConnect, +#else + NULL, +#endif +#ifdef FN_ClientDisconnect + FN_ClientDisconnect, +#else + NULL, +#endif +#ifdef FN_ClientKill + FN_ClientKill, +#else + NULL, +#endif +#ifdef FN_ClientPutInServer + FN_ClientPutInServer, +#else + NULL, +#endif +#ifdef FN_ClientCommand + FN_ClientCommand, +#else + NULL, +#endif +#ifdef FN_ClientUserInfoChanged + FN_ClientUserInfoChanged, +#else + NULL, +#endif +#ifdef FN_ServerActivate + FN_ServerActivate, +#else + NULL, +#endif +#ifdef FN_ServerDeactivate + FN_ServerDeactivate, +#else + NULL, +#endif +#ifdef FN_PlayerPreThink + FN_PlayerPreThink, +#else + NULL, +#endif +#ifdef FN_PlayerPostThink + FN_PlayerPostThink, +#else + NULL, +#endif +#ifdef FN_StartFrame + FN_StartFrame, +#else + NULL, +#endif +#ifdef FN_ParmsNewLevel + FN_ParmsNewLevel, +#else + NULL, +#endif +#ifdef FN_ParmsChangeLevel + FN_ParmsChangeLevel, +#else + NULL, +#endif +#ifdef FN_GetGameDescription + FN_GetGameDescription, +#else + NULL, +#endif +#ifdef FN_PlayerCustomization + FN_PlayerCustomization, +#else + NULL, +#endif +#ifdef FN_SpectatorConnect + FN_SpectatorConnect, +#else + NULL, +#endif +#ifdef FN_SpectatorDisconnect + FN_SpectatorDisconnect, +#else + NULL, +#endif +#ifdef FN_SpectatorThink + FN_SpectatorThink, +#else + NULL, +#endif +#ifdef FN_Sys_Error + FN_Sys_Error, +#else + NULL, +#endif +#ifdef FN_PM_Move + FN_PM_Move, +#else + NULL, +#endif +#ifdef FN_PM_Init + FN_PM_Init, +#else + NULL, +#endif +#ifdef FN_PM_FindTextureType + FN_PM_FindTextureType, +#else + NULL, +#endif +#ifdef FN_SetupVisibility + FN_SetupVisibility, +#else + NULL, +#endif +#ifdef FN_UpdateClientData + FN_UpdateClientData, +#else + NULL, +#endif +#ifdef FN_AddToFullPack + FN_AddToFullPack, +#else + NULL, +#endif +#ifdef FN_CreateBaseline + FN_CreateBaseline, +#else + NULL, +#endif +#ifdef FN_RegisterEncoders + FN_RegisterEncoders, +#else + NULL, +#endif +#ifdef FN_GetWeaponData + FN_GetWeaponData, +#else + NULL, +#endif +#ifdef FN_CmdStart + FN_CmdStart, +#else + NULL, +#endif +#ifdef FN_CmdEnd + FN_CmdEnd, +#else + NULL, +#endif +#ifdef FN_ConnectionlessPacket + FN_ConnectionlessPacket, +#else + NULL, +#endif +#ifdef FN_GetHullBounds + FN_GetHullBounds, +#else + NULL, +#endif +#ifdef FN_CreateInstancedBaselines + FN_CreateInstancedBaselines, +#else + NULL, +#endif +#ifdef FN_InconsistentFile + FN_InconsistentFile, +#else + NULL, +#endif +#ifdef FN_AllowLagCompensation + FN_AllowLagCompensation +#else + NULL +#endif +}; // g_EntityAPI2_Table + +// GetEntityAPI2_Post functions +static DLL_FUNCTIONS g_EntityAPI_Post_Table = +{ +#ifdef FN_GameDLLInit_Post + FN_GameDLLInit_Post, +#else + NULL, +#endif +#ifdef FN_DispatchSpawn_Post + FN_DispatchSpawn_Post, +#else + NULL, +#endif +#ifdef FN_DispatchThink_Post + FN_DispatchThink_Post, +#else + NULL, +#endif +#ifdef FN_DispatchUse_Post + FN_DispatchUse_Post, +#else + NULL, +#endif +#ifdef FN_DispatchTouch_Post + FN_DispatchTouch_Post, +#else + NULL, +#endif +#ifdef FN_DispatchBlocked_Post + FN_DispatchBlocked_Post, +#else + NULL, +#endif +#ifdef FN_DispatchKeyValue_Post + FN_DispatchKeyValue_Post, +#else + NULL, +#endif +#ifdef FN_DispatchSave_Post + FN_DispatchSave_Post, +#else + NULL, +#endif +#ifdef FN_DispatchRestore_Post + FN_DispatchRestore_Post, +#else + NULL, +#endif +#ifdef FN_DispatchObjectCollsionBox_Post + FN_DispatchObjectCollsionBox_Post, +#else + NULL, +#endif +#ifdef FN_SaveWriteFields_Post + FN_SaveWriteFields_Post, +#else + NULL, +#endif +#ifdef FN_SaveReadFields_Post + FN_SaveReadFields_Post, +#else + NULL, +#endif +#ifdef FN_SaveGlobalState_Post + FN_SaveGlobalState_Post, +#else + NULL, +#endif +#ifdef FN_RestoreGlobalState_Post + FN_RestoreGlobalState_Post, +#else + NULL, +#endif +#ifdef FN_ResetGlobalState_Post + FN_ResetGlobalState_Post, +#else + NULL, +#endif +#ifdef FN_ClientConnect_Post + FN_ClientConnect_Post, +#else + NULL, +#endif +#ifdef FN_ClientDisconnect_Post + FN_ClientDisconnect_Post, +#else + NULL, +#endif +#ifdef FN_ClientKill_Post + FN_ClientKill_Post, +#else + NULL, +#endif +#ifdef FN_ClientPutInServer_Post + FN_ClientPutInServer_Post, +#else + NULL, +#endif +#ifdef FN_ClientCommand_Post + FN_ClientCommand_Post, +#else + NULL, +#endif +#ifdef FN_ClientUserInfoChanged_Post + FN_ClientUserInfoChanged_Post, +#else + NULL, +#endif +#ifdef FN_ServerActivate_Post + FN_ServerActivate_Post, +#else + NULL, +#endif +#ifdef FN_ServerDeactivate_Post + FN_ServerDeactivate_Post, +#else + NULL, +#endif +#ifdef FN_PlayerPreThink_Post + FN_PlayerPreThink_Post, +#else + NULL, +#endif +#ifdef FN_PlayerPostThink_Post + FN_PlayerPostThink_Post, +#else + NULL, +#endif +#ifdef FN_StartFrame_Post + FN_StartFrame_Post, +#else + NULL, +#endif +#ifdef FN_ParmsNewLevel_Post + FN_ParmsNewLevel_Post, +#else + NULL, +#endif +#ifdef FN_ParmsChangeLevel_Post + FN_ParmsChangeLevel_Post, +#else + NULL, +#endif +#ifdef FN_GetGameDescription_Post + FN_GetGameDescription_Post, +#else + NULL, +#endif +#ifdef FN_PlayerCustomization_Post + FN_PlayerCustomization_Post, +#else + NULL, +#endif +#ifdef FN_SpectatorConnect_Post + FN_SpectatorConnect_Post, +#else + NULL, +#endif +#ifdef FN_SpectatorDisconnect_Post + FN_SpectatorDisconnect_Post, +#else + NULL, +#endif +#ifdef FN_SpectatorThink_Post + FN_SpectatorThink_Post, +#else + NULL, +#endif +#ifdef FN_Sys_Error_Post + FN_Sys_Error_Post, +#else + NULL, +#endif +#ifdef FN_PM_Move_Post + FN_PM_Move_Post, +#else + NULL, +#endif +#ifdef FN_PM_Init_Post + FN_PM_Init_Post, +#else + NULL, +#endif +#ifdef FN_PM_FindTextureType_Post + FN_PM_FindTextureType_Post, +#else + NULL, +#endif +#ifdef FN_SetupVisibility_Post + FN_SetupVisibility_Post, +#else + NULL, +#endif +#ifdef FN_UpdateClientData_Post + FN_UpdateClientData_Post, +#else + NULL, +#endif +#ifdef FN_AddToFullPack_Post + FN_AddToFullPack_Post, +#else + NULL, +#endif +#ifdef FN_CreateBaseline_Post + FN_CreateBaseline_Post, +#else + NULL, +#endif +#ifdef FN_RegisterEncoders_Post + FN_RegisterEncoders_Post, +#else + NULL, +#endif +#ifdef FN_GetWeaponData_Post + FN_GetWeaponData_Post, +#else + NULL, +#endif +#ifdef FN_CmdStart_Post + FN_CmdStart_Post, +#else + NULL, +#endif +#ifdef FN_CmdEnd_Post + FN_CmdEnd_Post, +#else + NULL, +#endif +#ifdef FN_ConnectionlessPacket_Post + FN_ConnectionlessPacket_Post, +#else + NULL, +#endif +#ifdef FN_GetHullBounds_Post + FN_GetHullBounds_Post, +#else + NULL, +#endif +#ifdef FN_CreateInstancedBaselines_Post + FN_CreateInstancedBaselines_Post, +#else + NULL, +#endif +#ifdef FN_InconsistentFile_Post + FN_InconsistentFile_Post, +#else + NULL, +#endif +#ifdef FN_AllowLagCompensation + FN_AllowLagCompensation, +#else + NULL, +#endif +}; // g_EntityAPI2_Table + +static enginefuncs_t g_EngineFuncs_Table = +{ +#ifdef FN_PrecacheModel + FN_PrecacheModel, +#else + NULL, +#endif +#ifdef FN_PrecacheSound + FN_PrecacheSound, +#else + NULL, +#endif +#ifdef FN_SetModel + FN_SetModel, +#else + NULL, +#endif +#ifdef FN_ModelIndex + FN_ModelIndex, +#else + NULL, +#endif +#ifdef FN_ModelFrames + FN_ModelFrames, +#else + NULL, +#endif +#ifdef FN_SetSize + FN_SetSize, +#else + NULL, +#endif +#ifdef FN_ChangeLevel + FN_ChangeLevel, +#else + NULL, +#endif +#ifdef FN_GetSpawnParms + FN_GetSpawnParms, +#else + NULL, +#endif +#ifdef FN_SaveSpawnParms + FN_SaveSpawnParms, +#else + NULL, +#endif +#ifdef FN_VecToYaw + FN_VecToYaw, +#else + NULL, +#endif +#ifdef FN_VecToAngles + FN_VecToAngles, +#else + NULL, +#endif +#ifdef FN_MoveToOrigin + FN_MoveToOrigin, +#else + NULL, +#endif +#ifdef FN_ChangeYaw + FN_ChangeYaw, +#else + NULL, +#endif +#ifdef FN_ChangePitch + FN_ChangePitch, +#else + NULL, +#endif +#ifdef FN_FindEntityByString + FN_FindEntityByString, +#else + NULL, +#endif +#ifdef FN_GetEntityIllum + FN_GetEntityIllum, +#else + NULL, +#endif +#ifdef FN_FindEntityInSphere + FN_FindEntityInSphere, +#else + NULL, +#endif +#ifdef FN_FindClientInPVS + FN_FindClientInPVS, +#else + NULL, +#endif +#ifdef FN_EntitiesInPVS + FN_EntitiesInPVS, +#else + NULL, +#endif +#ifdef FN_MakeVectors + FN_MakeVectors, +#else + NULL, +#endif +#ifdef FN_AngleVectors + FN_AngleVectors, +#else + NULL, +#endif +#ifdef FN_CreateEntity + FN_CreateEntity, +#else + NULL, +#endif +#ifdef FN_RemoveEntity + FN_RemoveEntity, +#else + NULL, +#endif +#ifdef FN_CreateNamedEntity + FN_CreateNamedEntity, +#else + NULL, +#endif +#ifdef FN_MakeStatic + FN_MakeStatic, +#else + NULL, +#endif +#ifdef FN_EntIsOnFloor + FN_EntIsOnFloor, +#else + NULL, +#endif +#ifdef FN_DropToFloor + FN_DropToFloor, +#else + NULL, +#endif +#ifdef FN_WalkMove + FN_WalkMove, +#else + NULL, +#endif +#ifdef FN_SetOrigin + FN_SetOrigin, +#else + NULL, +#endif +#ifdef FN_EmitSound + FN_EmitSound, +#else + NULL, +#endif +#ifdef FN_EmitAmbientSound + FN_EmitAmbientSound, +#else + NULL, +#endif +#ifdef FN_TraceLine + FN_TraceLine, +#else + NULL, +#endif +#ifdef FN_TraceToss + FN_TraceToss, +#else + NULL, +#endif +#ifdef FN_TraceMonsterHull + FN_TraceMonsterHull, +#else + NULL, +#endif +#ifdef FN_TraceHull + FN_TraceHull, +#else + NULL, +#endif +#ifdef FN_TraceModel + FN_TraceModel, +#else + NULL, +#endif +#ifdef FN_TraceTexture + FN_TraceTexture, +#else + NULL, +#endif +#ifdef FN_TraceSphere + FN_TraceSphere, +#else + NULL, +#endif +#ifdef FN_GetAimVector + FN_GetAimVector, +#else + NULL, +#endif +#ifdef FN_ServerCommand + FN_ServerCommand, +#else + NULL, +#endif +#ifdef FN_ServerExecute + FN_ServerExecute, +#else + NULL, +#endif +#ifdef FN_engClientCommand + FN_engClientCommand, +#else + NULL, +#endif +#ifdef FN_ParticleEffect + FN_ParticleEffect, +#else + NULL, +#endif +#ifdef FN_LightStyle + FN_LightStyle, +#else + NULL, +#endif +#ifdef FN_DecalIndex + FN_DecalIndex, +#else + NULL, +#endif +#ifdef FN_PointContents + FN_PointContents, +#else + NULL, +#endif +#ifdef FN_MessageBegin + FN_MessageBegin, +#else + NULL, +#endif +#ifdef FN_MessageEnd + FN_MessageEnd, +#else + NULL, +#endif +#ifdef FN_WriteByte + FN_WriteByte, +#else + NULL, +#endif +#ifdef FN_WriteChar + FN_WriteChar, +#else + NULL, +#endif +#ifdef FN_WriteShort + FN_WriteShort, +#else + NULL, +#endif +#ifdef FN_WriteLong + FN_WriteLong, +#else + NULL, +#endif +#ifdef FN_WriteAngle + FN_WriteAngle, +#else + NULL, +#endif +#ifdef FN_WriteCoord + FN_WriteCoord, +#else + NULL, +#endif +#ifdef FN_WriteString + FN_WriteString, +#else + NULL, +#endif +#ifdef FN_WriteEntity + FN_WriteEntity, +#else + NULL, +#endif +#ifdef FN_CVarRegister + FN_CVarRegister, +#else + NULL, +#endif +#ifdef FN_CVarGetFloat + FN_CVarGetFloat, +#else + NULL, +#endif +#ifdef FN_CVarGetString + FN_CVarGetString, +#else + NULL, +#endif +#ifdef FN_CVarSetFloat + FN_CVarSetFloat, +#else + NULL, +#endif +#ifdef FN_CVarSetString + FN_CVarSetString, +#else + NULL, +#endif +#ifdef FN_AlertMessage + FN_AlertMessage, +#else + NULL, +#endif +#ifdef FN_EngineFprintf + FN_EngineFprintf, +#else + NULL, +#endif +#ifdef FN_PvAllocEntPrivateData + FN_PvAllocEntPrivateData, +#else + NULL, +#endif +#ifdef FN_PvEntPrivateData + FN_PvEntPrivateData, +#else + NULL, +#endif +#ifdef FN_FreeEntPrivateData + FN_FreeEntPrivateData, +#else + NULL, +#endif +#ifdef FN_SzFromIndex + FN_SzFromIndex, +#else + NULL, +#endif +#ifdef FN_AllocString + FN_AllocString, +#else + NULL, +#endif +#ifdef FN_GetVarsOfEnt + FN_GetVarsOfEnt, +#else + NULL, +#endif +#ifdef FN_PEntityOfEntOffset + FN_PEntityOfEntOffset, +#else + NULL, +#endif +#ifdef FN_EntOffsetOfPEntity + FN_EntOffsetOfPEntity, +#else + NULL, +#endif +#ifdef FN_IndexOfEdict + FN_IndexOfEdict, +#else + NULL, +#endif +#ifdef FN_PEntityOfEntIndex + FN_PEntityOfEntIndex, +#else + NULL, +#endif +#ifdef FN_FindEntityByVars + FN_FindEntityByVars, +#else + NULL, +#endif +#ifdef FN_GetModelPtr + FN_GetModelPtr, +#else + NULL, +#endif +#ifdef FN_RegUserMsg + FN_RegUserMsg, +#else + NULL, +#endif +#ifdef FN_AnimationAutomove + FN_AnimationAutomove, +#else + NULL, +#endif +#ifdef FN_GetBonePosition + FN_GetBonePosition, +#else + NULL, +#endif +#ifdef FN_FunctionFromName + FN_FunctionFromName, +#else + NULL, +#endif +#ifdef FN_NameForFunction + FN_NameForFunction, +#else + NULL, +#endif +#ifdef FN_ClientPrintf + FN_ClientPrintf, +#else + NULL, +#endif +#ifdef FN_ServerPrint + FN_ServerPrint, +#else + NULL, +#endif +#ifdef FN_Cmd_Args + FN_Cmd_Args, +#else + NULL, +#endif +#ifdef FN_Cmd_Argv + FN_Cmd_Argv, +#else + NULL, +#endif +#ifdef FN_Cmd_Argc + FN_Cmd_Argc, +#else + NULL, +#endif +#ifdef FN_GetAttachment + FN_GetAttachment, +#else + NULL, +#endif +#ifdef FN_CRC32_Init + FN_CRC32_Init, +#else + NULL, +#endif +#ifdef FN_CRC32_ProcessBuffer + FN_CRC32_ProcessBuffer, +#else + NULL, +#endif +#ifdef FN_CRC32_ProcessByte + FN_CRC32_ProcessByte, +#else + NULL, +#endif +#ifdef FN_CRC32_Final + FN_CRC32_Final, +#else + NULL, +#endif +#ifdef FN_RandomLong + FN_RandomLong, +#else + NULL, +#endif +#ifdef FN_RandomFloat + FN_RandomFloat, +#else + NULL, +#endif +#ifdef FN_SetView + FN_SetView, +#else + NULL, +#endif +#ifdef FN_Time + FN_Time, +#else + NULL, +#endif +#ifdef FN_CrosshairAngle + FN_CrosshairAngle, +#else + NULL, +#endif +#ifdef FN_LoadFileForMe + FN_LoadFileForMe, +#else + NULL, +#endif +#ifdef FN_FreeFile + FN_FreeFile, +#else + NULL, +#endif +#ifdef FN_EndSection + FN_EndSection, +#else + NULL, +#endif +#ifdef FN_CompareFileTime + FN_CompareFileTime, +#else + NULL, +#endif +#ifdef FN_GetGameDir + FN_GetGameDir, +#else + NULL, +#endif +#ifdef FN_Cvar_RegisterVariable + FN_Cvar_RegisterVariable, +#else + NULL, +#endif +#ifdef FN_FadeClientVolume + FN_FadeClientVolume, +#else + NULL, +#endif +#ifdef FN_SetClientMaxspeed + FN_SetClientMaxspeed, +#else + NULL, +#endif +#ifdef FN_CreateFakeClient + FN_CreateFakeClient, +#else + NULL, +#endif +#ifdef FN_RunPlayerMove + FN_RunPlayerMove, +#else + NULL, +#endif +#ifdef FN_NumberOfEntities + FN_NumberOfEntities, +#else + NULL, +#endif +#ifdef FN_GetInfoKeyBuffer + FN_GetInfoKeyBuffer, +#else + NULL, +#endif +#ifdef FN_InfoKeyValue + FN_InfoKeyValue, +#else + NULL, +#endif +#ifdef FN_SetKeyValue + FN_SetKeyValue, +#else + NULL, +#endif +#ifdef FN_SetClientKeyValue + FN_SetClientKeyValue, +#else + NULL, +#endif +#ifdef FN_IsMapValid + FN_IsMapValid, +#else + NULL, +#endif +#ifdef FN_StaticDecal + FN_StaticDecal, +#else + NULL, +#endif +#ifdef FN_PrecacheGeneric + FN_PrecacheGeneric, +#else + NULL, +#endif +#ifdef FN_GetPlayerUserId + FN_GetPlayerUserId, +#else + NULL, +#endif +#ifdef FN_BuildSoundMsg + FN_BuildSoundMsg, +#else + NULL, +#endif +#ifdef FN_IsDedicatedServer + FN_IsDedicatedServer, +#else + NULL, +#endif +#ifdef FN_CVarGetPointer + FN_CVarGetPointer, +#else + NULL, +#endif +#ifdef FN_GetPlayerWONId + FN_GetPlayerWONId, +#else + NULL, +#endif +#ifdef FN_Info_RemoveKey + FN_Info_RemoveKey, +#else + NULL, +#endif +#ifdef FN_GetPhysicsKeyValue + FN_GetPhysicsKeyValue, +#else + NULL, +#endif +#ifdef FN_SetPhysicsKeyValue + FN_SetPhysicsKeyValue, +#else + NULL, +#endif +#ifdef FN_GetPhysicsInfoString + FN_GetPhysicsInfoString, +#else + NULL, +#endif +#ifdef FN_PrecacheEvent + FN_PrecacheEvent, +#else + NULL, +#endif +#ifdef FN_PlaybackEvent + FN_PlaybackEvent, +#else + NULL, +#endif +#ifdef FN_SetFatPVS + FN_SetFatPVS, +#else + NULL, +#endif +#ifdef FN_SetFatPAS + FN_SetFatPAS, +#else + NULL, +#endif +#ifdef FN_CheckVisibility + FN_CheckVisibility, +#else + NULL, +#endif +#ifdef FN_DeltaSetField + FN_DeltaSetField, +#else + NULL, +#endif +#ifdef FN_DeltaUnsetField + FN_DeltaUnsetField, +#else + NULL, +#endif +#ifdef FN_DeltaAddEncoder + FN_DeltaAddEncoder, +#else + NULL, +#endif +#ifdef FN_GetCurrentPlayer + FN_GetCurrentPlayer, +#else + NULL, +#endif +#ifdef FN_CanSkipPlayer + FN_CanSkipPlayer, +#else + NULL, +#endif +#ifdef FN_DeltaFindField + FN_DeltaFindField, +#else + NULL, +#endif +#ifdef FN_DeltaSetFieldByIndex + FN_DeltaSetFieldByIndex, +#else + NULL, +#endif +#ifdef FN_DeltaUnsetFieldByIndex + FN_DeltaUnsetFieldByIndex, +#else + NULL, +#endif +#ifdef FN_SetGroupMask + FN_SetGroupMask, +#else + NULL, +#endif +#ifdef FN_engCreateInstancedBaseline + FN_engCreateInstancedBaseline, +#else + NULL, +#endif +#ifdef FN_Cvar_DirectSet + FN_Cvar_DirectSet, +#else + NULL, +#endif +#ifdef FN_ForceUnmodified + FN_ForceUnmodified, +#else + NULL, +#endif +#ifdef FN_GetPlayerStats + FN_GetPlayerStats, +#else + NULL, +#endif +#ifdef FN_AddServerCommand + FN_AddServerCommand, +#else + NULL, +#endif +#ifdef FN_Voice_GetClientListening + FN_Voice_GetClientListening, +#else + NULL, +#endif +#ifdef FN_Voice_SetClientListening + FN_Voice_SetClientListening, +#else + NULL, +#endif +#ifdef FN_GetPlayerAuthId + FN_GetPlayerAuthId +#else + NULL +#endif +}; // g_EngineFuncs_Table + + +static enginefuncs_t g_EngineFuncs_Post_Table = +{ +#ifdef FN_PrecacheModel_Post + FN_PrecacheModel_Post, +#else + NULL, +#endif +#ifdef FN_PrecacheSound_Post + FN_PrecacheSound_Post, +#else + NULL, +#endif +#ifdef FN_SetModel_Post + FN_SetModel_Post, +#else + NULL, +#endif +#ifdef FN_ModelIndex_Post + FN_ModelIndex_Post, +#else + NULL, +#endif +#ifdef FN_ModelFrames_Post + FN_ModelFrames_Post, +#else + NULL, +#endif +#ifdef FN_SetSize_Post + FN_SetSize_Post, +#else + NULL, +#endif +#ifdef FN_ChangeLevel_Post + FN_ChangeLevel_Post, +#else + NULL, +#endif +#ifdef FN_GetSpawnParms_Post + FN_GetSpawnParms_Post, +#else + NULL, +#endif +#ifdef FN_SaveSpawnParms_Post + FN_SaveSpawnParms_Post, +#else + NULL, +#endif +#ifdef FN_VecToYaw_Post + FN_VecToYaw_Post, +#else + NULL, +#endif +#ifdef FN_VecToAngles_Post + FN_VecToAngles_Post, +#else + NULL, +#endif +#ifdef FN_MoveToOrigin_Post + FN_MoveToOrigin_Post, +#else + NULL, +#endif +#ifdef FN_ChangeYaw_Post + FN_ChangeYaw_Post, +#else + NULL, +#endif +#ifdef FN_ChangePitch_Post + FN_ChangePitch_Post, +#else + NULL, +#endif +#ifdef FN_FindEntityByString_Post + FN_FindEntityByString_Post, +#else + NULL, +#endif +#ifdef FN_GetEntityIllum_Post + FN_GetEntityIllum_Post, +#else + NULL, +#endif +#ifdef FN_FindEntityInSphere_Post + FN_FindEntityInSphere_Post, +#else + NULL, +#endif +#ifdef FN_FindClientInPVS_Post + FN_FindClientInPVS_Post, +#else + NULL, +#endif +#ifdef FN_EntitiesInPVS_Post + FN_EntitiesInPVS_Post, +#else + NULL, +#endif +#ifdef FN_MakeVectors_Post + FN_MakeVectors_Post, +#else + NULL, +#endif +#ifdef FN_AngleVectors_Post + FN_AngleVectors_Post, +#else + NULL, +#endif +#ifdef FN_CreateEntity_Post + FN_CreateEntity_Post, +#else + NULL, +#endif +#ifdef FN_RemoveEntity_Post + FN_RemoveEntity_Post, +#else + NULL, +#endif +#ifdef FN_CreateNamedEntity_Post + FN_CreateNamedEntity_Post, +#else + NULL, +#endif +#ifdef FN_MakeStatic_Post + FN_MakeStatic_Post, +#else + NULL, +#endif +#ifdef FN_EntIsOnFloor_Post + FN_EntIsOnFloor_Post, +#else + NULL, +#endif +#ifdef FN_DropToFloor_Post + FN_DropToFloor_Post, +#else + NULL, +#endif +#ifdef FN_WalkMove_Post + FN_WalkMove_Post, +#else + NULL, +#endif +#ifdef FN_SetOrigin_Post + FN_SetOrigin_Post, +#else + NULL, +#endif +#ifdef FN_EmitSound_Post + FN_EmitSound_Post, +#else + NULL, +#endif +#ifdef FN_EmitAmbientSound_Post + FN_EmitAmbientSound_Post, +#else + NULL, +#endif +#ifdef FN_TraceLine_Post + FN_TraceLine_Post, +#else + NULL, +#endif +#ifdef FN_TraceToss_Post + FN_TraceToss_Post, +#else + NULL, +#endif +#ifdef FN_TraceMonsterHull_Post + FN_TraceMonsterHull_Post, +#else + NULL, +#endif +#ifdef FN_TraceHull_Post + FN_TraceHull_Post, +#else + NULL, +#endif +#ifdef FN_TraceModel_Post + FN_TraceModel_Post, +#else + NULL, +#endif +#ifdef FN_TraceTexture_Post + FN_TraceTexture_Post, +#else + NULL, +#endif +#ifdef FN_TraceSphere_Post + FN_TraceSphere_Post, +#else + NULL, +#endif +#ifdef FN_GetAimVector_Post + FN_GetAimVector_Post, +#else + NULL, +#endif +#ifdef FN_ServerCommand_Post + FN_ServerCommand_Post, +#else + NULL, +#endif +#ifdef FN_ServerExecute_Post + FN_ServerExecute_Post, +#else + NULL, +#endif +#ifdef FN_engClientCommand_Post + FN_engClientCommand_Post, +#else + NULL, +#endif +#ifdef FN_ParticleEffect_Post + FN_ParticleEffect_Post, +#else + NULL, +#endif +#ifdef FN_LightStyle_Post + FN_LightStyle_Post, +#else + NULL, +#endif +#ifdef FN_DecalIndex_Post + FN_DecalIndex_Post, +#else + NULL, +#endif +#ifdef FN_PointContents_Post + FN_PointContents_Post, +#else + NULL, +#endif +#ifdef FN_MessageBegin_Post + FN_MessageBegin_Post, +#else + NULL, +#endif +#ifdef FN_MessageEnd_Post + FN_MessageEnd_Post, +#else + NULL, +#endif +#ifdef FN_WriteByte_Post + FN_WriteByte_Post, +#else + NULL, +#endif +#ifdef FN_WriteChar_Post + FN_WriteChar_Post, +#else + NULL, +#endif +#ifdef FN_WriteShort_Post + FN_WriteShort_Post, +#else + NULL, +#endif +#ifdef FN_WriteLong_Post + FN_WriteLong_Post, +#else + NULL, +#endif +#ifdef FN_WriteAngle_Post + FN_WriteAngle_Post, +#else + NULL, +#endif +#ifdef FN_WriteCoord_Post + FN_WriteCoord_Post, +#else + NULL, +#endif +#ifdef FN_WriteString_Post + FN_WriteString_Post, +#else + NULL, +#endif +#ifdef FN_WriteEntity_Post + FN_WriteEntity_Post, +#else + NULL, +#endif +#ifdef FN_CVarRegister_Post + FN_CVarRegister_Post, +#else + NULL, +#endif +#ifdef FN_CVarGetFloat_Post + FN_CVarGetFloat_Post, +#else + NULL, +#endif +#ifdef FN_CVarGetString_Post + FN_CVarGetString_Post, +#else + NULL, +#endif +#ifdef FN_CVarSetFloat_Post + FN_CVarSetFloat_Post, +#else + NULL, +#endif +#ifdef FN_CVarSetString_Post + FN_CVarSetString_Post, +#else + NULL, +#endif +#ifdef FN_AlertMessage_Post + FN_AlertMessage_Post, +#else + NULL, +#endif +#ifdef FN_EngineFprintf_Post + FN_EngineFprintf_Post, +#else + NULL, +#endif +#ifdef FN_PvAllocEntPrivateData_Post + FN_PvAllocEntPrivateData_Post, +#else + NULL, +#endif +#ifdef FN_PvEntPrivateData_Post + FN_PvEntPrivateData_Post, +#else + NULL, +#endif +#ifdef FN_FreeEntPrivateData_Post + FN_FreeEntPrivateData_Post, +#else + NULL, +#endif +#ifdef FN_SzFromIndex_Post + FN_SzFromIndex_Post, +#else + NULL, +#endif +#ifdef FN_AllocString_Post + FN_AllocString_Post, +#else + NULL, +#endif +#ifdef FN_GetVarsOfEnt_Post + FN_GetVarsOfEnt_Post, +#else + NULL, +#endif +#ifdef FN_PEntityOfEntOffset_Post + FN_PEntityOfEntOffset_Post, +#else + NULL, +#endif +#ifdef FN_EntOffsetOfPEntity_Post + FN_EntOffsetOfPEntity_Post, +#else + NULL, +#endif +#ifdef FN_IndexOfEdict_Post + FN_IndexOfEdict_Post, +#else + NULL, +#endif +#ifdef FN_PEntityOfEntIndex_Post + FN_PEntityOfEntIndex_Post, +#else + NULL, +#endif +#ifdef FN_FindEntityByVars_Post + FN_FindEntityByVars_Post, +#else + NULL, +#endif +#ifdef FN_GetModelPtr_Post + FN_GetModelPtr_Post, +#else + NULL, +#endif +#ifdef FN_RegUserMsg_Post + FN_RegUserMsg_Post, +#else + NULL, +#endif +#ifdef FN_AnimationAutomove_Post + FN_AnimationAutomove_Post, +#else + NULL, +#endif +#ifdef FN_GetBonePosition_Post + FN_GetBonePosition_Post, +#else + NULL, +#endif +#ifdef FN_FunctionFromName_Post + FN_FunctionFromName_Post, +#else + NULL, +#endif +#ifdef FN_NameForFunction_Post + FN_NameForFunction_Post, +#else + NULL, +#endif +#ifdef FN_ClientPrintf_Post + FN_ClientPrintf_Post, +#else + NULL, +#endif +#ifdef FN_ServerPrint_Post + FN_ServerPrint_Post, +#else + NULL, +#endif +#ifdef FN_Cmd_Args_Post + FN_Cmd_Args_Post, +#else + NULL, +#endif +#ifdef FN_Cmd_Argv_Post + FN_Cmd_Argv_Post, +#else + NULL, +#endif +#ifdef FN_Cmd_Argc_Post + FN_Cmd_Argc_Post, +#else + NULL, +#endif +#ifdef FN_GetAttachment_Post + FN_GetAttachment_Post, +#else + NULL, +#endif +#ifdef FN_CRC32_Init_Post + FN_CRC32_Init_Post, +#else + NULL, +#endif +#ifdef FN_CRC32_ProcessBuffer_Post + FN_CRC32_ProcessBuffer_Post, +#else + NULL, +#endif +#ifdef FN_CRC32_ProcessByte_Post + FN_CRC32_ProcessByte_Post, +#else + NULL, +#endif +#ifdef FN_CRC32_Final_Post + FN_CRC32_Final_Post, +#else + NULL, +#endif +#ifdef FN_RandomLong_Post + FN_RandomLong_Post, +#else + NULL, +#endif +#ifdef FN_RandomFloat_Post + FN_RandomFloat_Post, +#else + NULL, +#endif +#ifdef FN_SetView_Post + FN_SetView_Post, +#else + NULL, +#endif +#ifdef FN_Time_Post + FN_Time_Post, +#else + NULL, +#endif +#ifdef FN_CrosshairAngle_Post + FN_CrosshairAngle_Post, +#else + NULL, +#endif +#ifdef FN_LoadFileForMe_Post + FN_LoadFileForMe_Post, +#else + NULL, +#endif +#ifdef FN_FreeFile_Post + FN_FreeFile_Post, +#else + NULL, +#endif +#ifdef FN_EndSection_Post + FN_EndSection_Post, +#else + NULL, +#endif +#ifdef FN_CompareFileTime_Post + FN_CompareFileTime_Post, +#else + NULL, +#endif +#ifdef FN_GetGameDir_Post + FN_GetGameDir_Post, +#else + NULL, +#endif +#ifdef FN_Cvar_RegisterVariable_Post + FN_Cvar_RegisterVariable_Post, +#else + NULL, +#endif +#ifdef FN_FadeClientVolume_Post + FN_FadeClientVolume_Post, +#else + NULL, +#endif +#ifdef FN_SetClientMaxspeed_Post + FN_SetClientMaxspeed_Post, +#else + NULL, +#endif +#ifdef FN_CreateFakeClient_Post + FN_CreateFakeClient_Post, +#else + NULL, +#endif +#ifdef FN_RunPlayerMove_Post + FN_RunPlayerMove_Post, +#else + NULL, +#endif +#ifdef FN_NumberOfEntities_Post + FN_NumberOfEntities_Post, +#else + NULL, +#endif +#ifdef FN_GetInfoKeyBuffer_Post + FN_GetInfoKeyBuffer_Post, +#else + NULL, +#endif +#ifdef FN_InfoKeyValue_Post + FN_InfoKeyValue_Post, +#else + NULL, +#endif +#ifdef FN_SetKeyValue_Post + FN_SetKeyValue_Post, +#else + NULL, +#endif +#ifdef FN_SetClientKeyValue_Post + FN_SetClientKeyValue_Post, +#else + NULL, +#endif +#ifdef FN_IsMapValid_Post + FN_IsMapValid_Post, +#else + NULL, +#endif +#ifdef FN_StaticDecal_Post + FN_StaticDecal_Post, +#else + NULL, +#endif +#ifdef FN_PrecacheGeneric_Post + FN_PrecacheGeneric_Post, +#else + NULL, +#endif +#ifdef FN_GetPlayerUserId_Post + FN_GetPlayerUserId_Post, +#else + NULL, +#endif +#ifdef FN_BuildSoundMsg_Post + FN_BuildSoundMsg_Post, +#else + NULL, +#endif +#ifdef FN_IsDedicatedServer_Post + FN_IsDedicatedServer_Post, +#else + NULL, +#endif +#ifdef FN_CVarGetPointer_Post + FN_CVarGetPointer_Post, +#else + NULL, +#endif +#ifdef FN_GetPlayerWONId_Post + FN_GetPlayerWONId_Post, +#else + NULL, +#endif +#ifdef FN_Info_RemoveKey_Post + FN_Info_RemoveKey_Post, +#else + NULL, +#endif +#ifdef FN_GetPhysicsKeyValue_Post + FN_GetPhysicsKeyValue_Post, +#else + NULL, +#endif +#ifdef FN_SetPhysicsKeyValue_Post + FN_SetPhysicsKeyValue_Post, +#else + NULL, +#endif +#ifdef FN_GetPhysicsInfoString_Post + FN_GetPhysicsInfoString_Post, +#else + NULL, +#endif +#ifdef FN_PrecacheEvent_Post + FN_PrecacheEvent_Post, +#else + NULL, +#endif +#ifdef FN_PlaybackEvent_Post + FN_PlaybackEvent_Post, +#else + NULL, +#endif +#ifdef FN_SetFatPVS_Post + FN_SetFatPVS_Post, +#else + NULL, +#endif +#ifdef FN_SetFatPAS_Post + FN_SetFatPAS_Post, +#else + NULL, +#endif +#ifdef FN_CheckVisibility_Post + FN_CheckVisibility_Post, +#else + NULL, +#endif +#ifdef FN_DeltaSetField_Post + FN_DeltaSetField_Post, +#else + NULL, +#endif +#ifdef FN_DeltaUnsetField_Post + FN_DeltaUnsetField_Post, +#else + NULL, +#endif +#ifdef FN_DeltaAddEncoder_Post + FN_DeltaAddEncoder_Post, +#else + NULL, +#endif +#ifdef FN_GetCurrentPlayer_Post + FN_GetCurrentPlayer_Post, +#else + NULL, +#endif +#ifdef FN_CanSkipPlayer_Post + FN_CanSkipPlayer_Post, +#else + NULL, +#endif +#ifdef FN_DeltaFindField_Post + FN_DeltaFindField_Post, +#else + NULL, +#endif +#ifdef FN_DeltaSetFieldByIndex_Post + FN_DeltaSetFieldByIndex_Post, +#else + NULL, +#endif +#ifdef FN_DeltaUnsetFieldByIndex_Post + FN_DeltaUnsetFieldByIndex_Post, +#else + NULL, +#endif +#ifdef FN_SetGroupMask_Post + FN_SetGroupMask_Post, +#else + NULL, +#endif +#ifdef FN_engCreateInstancedBaseline_Post + FN_engCreateInstancedBaseline_Post, +#else + NULL, +#endif +#ifdef FN_Cvar_DirectSet_Post + FN_Cvar_DirectSet_Post, +#else + NULL, +#endif +#ifdef FN_ForceUnmodified_Post + FN_ForceUnmodified_Post, +#else + NULL, +#endif +#ifdef FN_GetPlayerStats_Post + FN_GetPlayerStats_Post, +#else + NULL, +#endif +#ifdef FN_AddServerCommand_Post + FN_AddServerCommand_Post, +#else + NULL, +#endif +#ifdef FN_Voice_GetClientListening_Post + FN_Voice_GetClientListening_Post, +#else + NULL, +#endif +#ifdef FN_Voice_SetClientListening_Post + FN_Voice_SetClientListening_Post, +#else + NULL, +#endif +#ifdef FN_GetPlayerAuthId_Post + FN_GetPlayerAuthId_Post +#else + NULL +#endif +}; // g_EngineFuncs_Post_Table + + +static NEW_DLL_FUNCTIONS g_NewFuncs_Table = +{ +#ifdef FN_OnFreeEntPrivateData + FN_OnFreeEntPrivateData, +#else + NULL, +#endif +#ifdef FN_GameShutdown + FN_GameShutdown, +#else + NULL, +#endif +#ifdef FN_ShouldCollide + ShouldCollide, +#else + NULL, +#endif +}; + + +static NEW_DLL_FUNCTIONS g_NewFuncs_Post_Table = +{ +#ifdef FN_OnFreeEntPrivateData_Post + FN_OnFreeEntPrivateData_Post, +#else + NULL, +#endif +#ifdef FN_GameShutdown_Post + FN_GameShutdown_Post, +#else + NULL, +#endif +#ifdef FN_ShouldCollide_Post + ShouldCollide_Post, +#else + NULL, +#endif +}; + +// Global variables from metamod. These variable names are referenced by +// various macros. +meta_globals_t *gpMetaGlobals; // metamod globals +gamedll_funcs_t *gpGamedllFuncs; // gameDLL function tables +mutil_funcs_t *gpMetaUtilFuncs; // metamod utility functions + + +plugin_info_t Plugin_info = { + META_INTERFACE_VERSION, + MODULE_NAME, + MODULE_VERSION, + MODULE_DATE, + MODULE_AUTHOR, + MODULE_URL, + MODULE_LOGTAG, + PT_ANYTIME, + PT_ANYTIME +}; + +/* +C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetEntityAPI; version=%d", interfaceVersion); + if(!pFunctionTable) { + LOG_ERROR(PLID, "GetEntityAPI called with null pFunctionTable"); + return(FALSE); + } + else if(interfaceVersion != INTERFACE_VERSION) { + LOG_ERROR(PLID, "GetEntityAPI version mismatch; requested=%d ours=%d", interfaceVersion, INTERFACE_VERSION); + return(FALSE); + } + memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof( DLL_FUNCTIONS ) ); + + return (TRUE); +} + +C_DLLEXPORT int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetEntityAPI_Post; version=%d", interfaceVersion); + if(!pFunctionTable) { + LOG_ERROR(PLID, "GetEntityAPI_Post called with null pFunctionTable"); + return(FALSE); + } + else if(interfaceVersion != INTERFACE_VERSION) { + LOG_ERROR(PLID, "GetEntityAPI_Post version mismatch; requested=%d ours=%d", interfaceVersion, INTERFACE_VERSION); + return(FALSE); + } + memcpy(pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) ); + + return(TRUE); +} +*/ + +C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetEntityAPI2; version=%d", *interfaceVersion); + if(!pFunctionTable) { + LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable"); + return(FALSE); + } + else if(*interfaceVersion != INTERFACE_VERSION) { + LOG_ERROR(PLID, + "GetEntityAPI2 version mismatch; requested=%d ours=%d", + *interfaceVersion, INTERFACE_VERSION); + //! Tell engine what version we had, so it can figure out who is + //! out of date. + *interfaceVersion = INTERFACE_VERSION; + return(FALSE); + } + memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS)); + g_pFunctionTable=pFunctionTable; + return(TRUE); +} + +C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetEntityAPI2_Post; version=%d", *interfaceVersion); + if(!pFunctionTable) { + LOG_ERROR(PLID, "GetEntityAPI2_Post called with null pFunctionTable"); + return(FALSE); + } + else if(*interfaceVersion != INTERFACE_VERSION) { + LOG_ERROR(PLID, "GetEntityAPI2_Post version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION); + //! Tell engine what version we had, so it can figure out who is out of date. + *interfaceVersion = INTERFACE_VERSION; + return(FALSE); + } + memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) ); + g_pFunctionTable_Post=pFunctionTable; + return(TRUE); +} + +C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetEngineFunctions; version=%d", + *interfaceVersion); + if(!pengfuncsFromEngine) { + LOG_ERROR(PLID, + "GetEngineFunctions called with null pengfuncsFromEngine"); + return(FALSE); + } + else if(*interfaceVersion != ENGINE_INTERFACE_VERSION) { + LOG_ERROR(PLID, + "GetEngineFunctions version mismatch; requested=%d ours=%d", + *interfaceVersion, ENGINE_INTERFACE_VERSION); + // Tell metamod what version we had, so it can figure out who is + // out of date. + *interfaceVersion = ENGINE_INTERFACE_VERSION; + return(FALSE); + } + memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t)); + g_pengfuncsTable=pengfuncsFromEngine; + return TRUE; +} + +C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetEngineFunctions_Post; version=%d", *interfaceVersion); + if(!pengfuncsFromEngine) { + LOG_ERROR(PLID, "GetEngineFunctions_Post called with null pengfuncsFromEngine"); + return(FALSE); + } + else if(*interfaceVersion != ENGINE_INTERFACE_VERSION) { + LOG_ERROR(PLID, "GetEngineFunctions_Post version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION); + // Tell metamod what version we had, so it can figure out who is out of date. + *interfaceVersion = ENGINE_INTERFACE_VERSION; + return(FALSE); + } + memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t)); + g_pengfuncsTable_Post=pengfuncsFromEngine; + return TRUE; + +} + +C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, + int *interfaceVersion) +{ + LOG_DEVELOPER(PLID, "called: GetNewDLLFunctions; version=%d", + *interfaceVersion); + if(!pNewFunctionTable) { + LOG_ERROR(PLID, + "GetNewDLLFunctions called with null pNewFunctionTable"); + return(FALSE); + } + else if(*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) { + LOG_ERROR(PLID, + "GetNewDLLFunctions version mismatch; requested=%d ours=%d", + *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION); + //! Tell engine what version we had, so it can figure out who is + //! out of date. + *interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; + return(FALSE); + } + memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS)); + g_pNewFunctionsTable=pNewFunctionTable; + return TRUE; +} + +C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion ) +{ + LOG_DEVELOPER(PLID, "called: GetNewDLLFunctions_Post; version=%d", *interfaceVersion); + if(!pNewFunctionTable) { + LOG_ERROR(PLID, "GetNewDLLFunctions_Post called with null pNewFunctionTable"); + return(FALSE); + } + else if(*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) { + LOG_ERROR(PLID, "GetNewDLLFunctions_Post version mismatch; requested=%d ours=%d", *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION); + //! Tell engine what version we had, so it can figure out who is out of date. + *interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; + return(FALSE); + } + memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS)); + g_pNewFunctionsTable_Post=pNewFunctionTable; + return TRUE; +} + + +static META_FUNCTIONS g_MetaFunctions_Table = +{ + NULL, + NULL, + GetEntityAPI2, + GetEntityAPI2_Post, + GetNewDLLFunctions, + GetNewDLLFunctions_Post, + GetEngineFunctions, + GetEngineFunctions_Post +}; + +C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs) +{ + if ((int) CVAR_GET_FLOAT("developer") != 0) + UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n", + Plugin_info.logtag, ifvers, Plugin_info.ifvers); + + // Check for valid pMetaUtilFuncs before we continue. + if(!pMetaUtilFuncs) { + UTIL_LogPrintf("[%s] ERROR: Meta_Query called with null pMetaUtilFuncs\n", Plugin_info.logtag); + return(FALSE); + } + + gpMetaUtilFuncs = pMetaUtilFuncs; + + *pPlugInfo = &Plugin_info; + + // Check for interface version compatibility. + if(!FStrEq(ifvers, Plugin_info.ifvers)) { + int mmajor=0, mminor=0, pmajor=0, pminor=0; + LOG_MESSAGE(PLID, "WARNING: meta-interface version mismatch; requested=%s ours=%s", + Plugin_info.logtag, ifvers); + // If plugin has later interface version, it's incompatible (update + // metamod). + sscanf(ifvers, "%d:%d", &mmajor, &mminor); + sscanf(META_INTERFACE_VERSION, "%d:%d", &pmajor, &pminor); + if(pmajor > mmajor || (pmajor==mmajor && pminor > mminor)) { + LOG_ERROR(PLID, "metamod version is too old for this module; update metamod"); + return(FALSE); + } + // If plugin has older major interface version, it's incompatible + // (update plugin). + else if(pmajor < mmajor) { + LOG_ERROR(PLID, "metamod version is incompatible with this module; please find a newer version of this module"); + return(FALSE); + } + // Minor interface is older, but this is guaranteed to be backwards + // compatible, so we warn, but we still accept it. + else if(pmajor==mmajor && pminor < mminor) + LOG_MESSAGE(PLID, "WARNING: metamod version is newer than expected; consider finding a newer version of this module"); + else + LOG_ERROR(PLID, "unexpected version comparison; metavers=%s, mmajor=%d, mminor=%d; plugvers=%s, pmajor=%d, pminor=%d", ifvers, mmajor, mminor, META_INTERFACE_VERSION, pmajor, pminor); + } + +#ifdef FN_META_QUERY + return FN_META_QUERY(); +#endif // FN_META_QUERY + + return 1; +} + + +C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs) +{ + if ( gpGamedllFuncs ){ + LOG_ERROR(PLID,"gpGamedllFuncs already set"); + return(FALSE); + } + + if(now > Plugin_info.loadable) { + LOG_ERROR(PLID, "Can't load module right now"); + return(FALSE); + } + if(!pMGlobals) { + LOG_ERROR(PLID, "Meta_Attach called with null pMGlobals"); + return(FALSE); + } + gpMetaGlobals=pMGlobals; + if(!pFunctionTable) { + LOG_ERROR(PLID, "Meta_Attach called with null pFunctionTable"); + return(FALSE); + } + + memcpy(pFunctionTable, &g_MetaFunctions_Table, sizeof(META_FUNCTIONS)); + gpGamedllFuncs=pGamedllFuncs; + + // Let's go. + +#ifdef FN_META_ATTACH + FN_META_ATTACH(); +#endif // FN_META_ATTACH + + return TRUE; +} + +C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason) +{ + if(now > Plugin_info.unloadable && reason != PNL_CMD_FORCED) { + LOG_ERROR(PLID, "Can't unload plugin right now"); + return(FALSE); + } + +#ifdef FN_META_DETACH + return FN_META_DETACH(); +#endif // FN_META_DETACH + return TRUE; +} + + + +#ifdef __linux__ +// linux prototype +C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) { + +#else +#ifdef _MSC_VER +// MSVC: Simulate __stdcall calling convention +C_DLLEXPORT __declspec(naked) void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) +{ + __asm // Prolog + { + // Save ebp + push ebp + // Set stack frame pointer + mov ebp, esp + // Allocate space for local variables + // The MSVC compiler gives us the needed size in __LOCAL_SIZE. + sub esp, __LOCAL_SIZE + // Push registers + push ebx + push esi + push edi + } +#else // _MSC_VER +#ifdef __GNUC__ +// GCC can also work with this +C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) +{ +#else // __GNUC__ +// compiler not known +#error There is no support (yet) for your compiler. Please use MSVC or GCC compilers or contact the AMX Mod X dev team. +#endif // __GNUC__ +#endif // _MSC_VER +#endif // __linux__ + + // ** Function core <-- + memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); + gpGlobals = pGlobals; + // NOTE! Have to call logging function _after_ copying into g_engfuncs, so + // that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :) + UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag); + // --> ** Function core + +#ifdef _MSC_VER + // Epilog + if (sizeof(int*) == 8) + { // 64 bit + __asm + { + // Pop registers + pop edi + pop esi + pop ebx + // Restore stack frame pointer + mov esp, ebp + // Restore ebp + pop ebp + // 2 * sizeof(int*) = 16 on 64 bit + ret 16 + } + } + else + { // 32 bit + __asm + { + // Pop registers + pop edi + pop esi + pop ebx + // Restore stack frame pointer + mov esp, ebp + // Restore ebp + pop ebp + // 2 * sizeof(int*) = 8 on 32 bit + ret 8 + } + } +#endif // #ifdef _MSC_VER +} + +#endif // #ifdef USE_METAMOD + +/************* AMXX Stuff *************/ + +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + +// *** Globals *** +// Module info +static amxx_module_info_s g_ModuleInfo = +{ + MODULE_NAME, + MODULE_AUTHOR, + MODULE_VERSION, +#ifdef MODULE_RELOAD_ON_MAPCHANGE + 1 +#else // MODULE_RELOAD_ON_MAPCHANGE + 0 +#endif // MODULE_RELOAD_ON_MAPCHANGE +}; + +// Storage for the requested functions +PFN_ADD_NATIVES g_fn_AddNatives; +PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_GET_AMXADDR g_fn_GetAmxAddr; +PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; +PFN_GET_MODNAME g_fn_GetModname; +PFN_GET_AMXSCRIPTNAME g_fn_GetAmxScriptName; +PFN_GET_AMXSCRIPT g_fn_GetAmxScript; +PFN_FIND_AMXSCRIPT_BYAMX g_fn_FindAmxScriptByAmx; +PFN_FIND_AMXSCRIPT_BYNAME g_fn_FindAmxScriptByName; +PFN_SET_AMXSTRING g_fn_SetAmxString; +PFN_GET_AMXSTRING g_fn_GetAmxString; +PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen; +PFN_FORMAT_AMXSTRING g_fn_FormatAmxString; +PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory; +PFN_LOG g_fn_Log; +PFN_LOG_ERROR g_fn_LogErrorFunc; +PFN_RAISE_AMXERROR g_fn_RaiseAmxError; +PFN_REGISTER_FORWARD g_fn_RegisterForward; +PFN_EXECUTE_FORWARD g_fn_ExecuteForward; +PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray; +PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray; +PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA; +PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA; +PFN_IS_PLAYER_VALID g_fn_IsPlayerValid; +PFN_GET_PLAYER_NAME g_fn_GetPlayerName; +PFN_GET_PLAYER_IP g_fn_GetPlayerIP; +PFN_IS_PLAYER_INGAME g_fn_IsPlayerIngame; +PFN_IS_PLAYER_BOT g_fn_IsPlayerBot; +PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized; +PFN_GET_PLAYER_TIME g_fn_GetPlayerTime; +PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime; +PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon; +PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID; +PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths; +PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu; +PFN_GET_PLAYER_KEYS g_fn_GetPlayerKeys; +PFN_IS_PLAYER_ALIVE g_fn_IsPlayerAlive; +PFN_GET_PLAYER_FRAGS g_fn_GetPlayerFrags; +PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; +PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; +PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; +PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +PFN_ALLOCATOR g_fn_Allocator; +PFN_REALLOCATOR g_fn_Reallocator; +PFN_DEALLOCATOR g_fn_Deallocator; +PFN_AMX_EXEC g_fn_AmxExec; +PFN_AMX_EXECV g_fn_AmxExecv; +PFN_AMX_ALLOT g_fn_AmxAllot; +PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; +PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; +PFN_UNLOAD_AMXSCRIPT g_fn_UnloadAmxScript; +PFN_REAL_TO_CELL g_fn_RealToCell; +PFN_CELL_TO_REAL g_fn_CellToReal; +PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward; +PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; +PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; +PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; +PFN_AMX_FINDNATIVE g_fn_AmxFindNative; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; + +// *** Exports *** +C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) +{ + // check parameters + if (!interfaceVersion || !moduleInfo) + return AMXX_PARAM; + + // check interface version + if (*interfaceVersion != AMXX_INTERFACE_VERSION) + { + // Tell amxx core our interface version + *interfaceVersion = AMXX_INTERFACE_VERSION; + return AMXX_IFVERS; + } + + // copy module info + memcpy(moduleInfo, &g_ModuleInfo, sizeof(amxx_module_info_s)); + +#ifdef FN_AMXX_QUERY + FN_AMXX_QUERY(); +#endif // FN_AMXX_QUERY + // Everything ok :) + return AMXX_OK; +} + +// request function +#define REQFUNC(name, fptr, type) if ((fptr = (type)reqFnptrFunc(name)) == 0) return AMXX_FUNC_NOT_PRESENT +// request optional function +#define REQFUNC_OPT(name, fptr, type) fptr = (type)reqFnptrFunc(name) + +C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) +{ + // Check pointer + if (!reqFnptrFunc) + return AMXX_PARAM; + + // Req all known functions + // Misc + REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); + REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); + REQFUNC("Log", g_fn_Log, PFN_LOG); + REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); + REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); + + // Amx scripts + REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); + REQFUNC("FindAmxScriptByAmx", g_fn_FindAmxScriptByAmx, PFN_FIND_AMXSCRIPT_BYAMX); + REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME); + REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT); + REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT); + REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME); + + // String / mem in amx scripts support + REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING); + REQFUNC("GetAmxString", g_fn_GetAmxString, PFN_GET_AMXSTRING); + REQFUNC("GetAmxStringLen", g_fn_GetAmxStringLen, PFN_GET_AMXSTRINGLEN); + REQFUNC("FormatAmxString", g_fn_FormatAmxString, PFN_FORMAT_AMXSTRING); + REQFUNC("CopyAmxMemory", g_fn_CopyAmxMemory, PFN_COPY_AMXMEMORY); + REQFUNC("GetAmxAddr", g_fn_GetAmxAddr, PFN_GET_AMXADDR); + + REQFUNC("amx_Exec", g_fn_AmxExec, PFN_AMX_EXEC); + REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV); + REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC); + REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT); + REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE); + + // Natives / Forwards + REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES); + REQFUNC("RaiseAmxError", g_fn_RaiseAmxError, PFN_RAISE_AMXERROR); + REQFUNC("RegisterForward", g_fn_RegisterForward, PFN_REGISTER_FORWARD); + REQFUNC("RegisterSPForward", g_fn_RegisterSPForward, PFN_REGISTER_SPFORWARD); + REQFUNC("RegisterSPForwardByName", g_fn_RegisterSPForwardByName, PFN_REGISTER_SPFORWARD_BYNAME); + REQFUNC("UnregisterSPForward", g_fn_UnregisterSPForward, PFN_UNREGISTER_SPFORWARD); + REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD); + REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY); + REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY); + REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A); + REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A); + // Player + REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID); + REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME); + REQFUNC("GetPlayerIP", g_fn_GetPlayerIP, PFN_GET_PLAYER_IP); + REQFUNC("IsPlayerInGame", g_fn_IsPlayerIngame, PFN_IS_PLAYER_INGAME); + REQFUNC("IsPlayerBot", g_fn_IsPlayerBot, PFN_IS_PLAYER_BOT); + REQFUNC("IsPlayerAuthorized", g_fn_IsPlayerAuthorized, PFN_IS_PLAYER_AUTHORIZED); + REQFUNC("GetPlayerTime", g_fn_GetPlayerTime, PFN_GET_PLAYER_TIME); + REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME); + REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON); + REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID); + REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM); + REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS); + REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU); + REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS); + REQFUNC("IsPlayerAlive", g_fn_IsPlayerAlive, PFN_IS_PLAYER_ALIVE); + REQFUNC("GetPlayerFrags", g_fn_GetPlayerFrags, PFN_GET_PLAYER_FRAGS); + REQFUNC("IsPlayerConnecting", g_fn_IsPlayerConnecting, PFN_IS_PLAYER_CONNECTING); + REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV); + REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); + REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); + REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); + + // Memory + REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); + REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); + REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); + + REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); + REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); + +#ifdef FN_AMXX_ATTACH + FN_AMXX_ATTACH(); +#endif // FN_AMXX_ATACH + + return AMXX_OK; +} + +C_DLLEXPORT int AMXX_Detach() +{ +#ifdef FN_AMXX_DETACH + FN_AMXX_DETACH(); +#endif // FN_AMXX_DETACH + + return AMXX_OK; +} + +C_DLLEXPORT int AMXX_PluginsLoaded() +{ +#ifdef FN_AMXX_PLUGINSLOADED + FN_AMXX_PLUGINSLOADED(); +#endif // FN_AMXX_PLUGINSLOADED + return AMXX_OK; +} + +// Advanced MF functions +void MF_Log(const char *fmt, ...) +{ + // :TODO: Overflow possible here + char msg[3072]; + va_list arglst; + va_start(arglst, fmt); + vsprintf(msg, fmt, arglst); + va_end(arglst); + + g_fn_Log("[%s] %s", MODULE_NAME, msg); +} + +void MF_LogError(AMX *amx, int err, const char *fmt, ...) +{ + // :TODO: Overflow possible here + char msg[3072]; + va_list arglst; + va_start(arglst, fmt); + vsprintf(msg, fmt, arglst); + va_end(arglst); + + g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg); +} + + +#ifdef _DEBUG +// validate macros +// Makes sure compiler reports errors when macros are invalid +void ValidateMacros_DontCallThis_Smiley() +{ + MF_BuildPathname("str", "str", 0); + MF_FormatAmxString(NULL, 0, 0, NULL); + MF_GetAmxAddr(NULL, 0); + MF_PrintSrvConsole("str", "str", 0); + MF_GetModname(); + MF_GetScriptName(0); + MF_GetScriptAmx(0); + MF_FindScriptByAmx(NULL); + MF_FindScriptByName("str"); + MF_SetAmxString(NULL, 0, "str", 0); + MF_GetAmxString(NULL, 0, 0, 0); + MF_GetAmxStringLen(NULL); + MF_CopyAmxMemory(NULL, NULL, 0); + MF_Log("str", "str", 0); + MF_LogError(NULL, 0, NULL); + MF_RaiseAmxError(NULL, 0); + MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0); + MF_ExecuteForward(0, 0, 0); + MF_PrepareCellArray(NULL, 0); + MF_PrepareCharArray(NULL, 0); + MF_PrepareCellArrayA(NULL, 0, true); + MF_PrepareCharArrayA(NULL, 0, true); + MF_IsPlayerValid(0); + MF_GetPlayerName(0); + MF_GetPlayerIP(0); + MF_IsPlayerIngame(0); + MF_IsPlayerBot(0); + MF_IsPlayerAuthorized(0); + MF_GetPlayerTime(0); + MF_GetPlayerPlayTime(0); + MF_GetPlayerCurweapon(0); + MF_GetPlayerTeamID(0); + MF_GetPlayerTeam(0); + MF_GetPlayerDeaths(0); + MF_GetPlayerMenu(0); + MF_GetPlayerKeys(0); + MF_IsPlayerAlive(0); + MF_GetPlayerFrags(0); + MF_IsPlayerConnecting(0); + MF_IsPlayerHLTV(0); + MF_GetPlayerArmor(0); + MF_GetPlayerHealth(0); + MF_AmxExec(0, 0, 0, 0); + MF_AmxExecv(0, 0, 0, 0, 0); + MF_AmxFindPublic(0, 0, 0); + MF_AmxAllot(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); + MF_UnloadAmxScript(0, 0); + MF_RegisterSPForward(0, 0, 0, 0, 0, 0); + MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); + MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); +} +#endif + +/************* MEMORY *************/ +// undef all defined macros +#undef new +#undef delete +#undef malloc +#undef calloc +#undef realloc +#undef free + +const unsigned int m_alloc_unknown = 0; +const unsigned int m_alloc_new = 1; +const unsigned int m_alloc_new_array = 2; +const unsigned int m_alloc_malloc = 3; +const unsigned int m_alloc_calloc = 4; +const unsigned int m_alloc_realloc = 5; +const unsigned int m_alloc_delete = 6; +const unsigned int m_alloc_delete_array = 7; +const unsigned int m_alloc_free = 8; + +const char *g_Mem_CurrentFilename = "??"; +int g_Mem_CurrentLine = 0; +const char *g_Mem_CurrentFunc = "??"; + +const char *Mem_MakeSourceFile(const char *sourceFile) +{ + static char buffer[512]; + static size_t pos = 0; + if (!pos) + { + // init + buffer[0] = '['; + strcpy(buffer + 1, MODULE_NAME); + pos = strlen(MODULE_NAME) + 1; + buffer[pos++] = ']'; + } + + // convert from absolute path to [modulename]filename + const char *ptr = strrchr(sourceFile, '\\'); + if (ptr) + ptr++; + else + { + ptr = strrchr(sourceFile, '/'); + if (ptr) + ptr++; + else + ptr = sourceFile; + } + strcpy(buffer + pos, ptr); + return buffer; +} + +void Mem_SetOwner(const char *filename, int line, const char *function) +{ + g_Mem_CurrentFilename = filename; + g_Mem_CurrentLine = line; + g_Mem_CurrentFunc = function; +} + +void Mem_ResetGlobals() +{ + Mem_SetOwner("??", 0, "??"); +} + +// raw (re/de)allocators +void * Mem_Allocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, + const unsigned int allocationType, const size_t reportedSize) +{ + if (g_fn_Allocator) + return g_fn_Allocator(Mem_MakeSourceFile(sourceFile), sourceLine, sourceFunc, allocationType, reportedSize); + else + return malloc(reportedSize); +} + +void * Mem_Reallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, + const unsigned int reallocationType, const size_t reportedSize, void *reportedAddress) +{ + if (g_fn_Reallocator) + return g_fn_Reallocator(Mem_MakeSourceFile(sourceFile), sourceLine, sourceFunc, reallocationType, reportedSize, reportedAddress); + else + return realloc(reportedAddress, reportedSize); +} + +void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, + const unsigned int deallocationType, void *reportedAddress) +{ + // If you you get user breakpoint here, something failed :) + // - invalid pointer + // - alloc type mismatch ( for example + // char *a = new char[5]; delete char; + // ) + // - The allocation unit is damaged (for example + // char *a = new char[5]; a[6] = 8; + // ) + // - break on dealloc flag set (somehow) + + if (g_fn_Deallocator) + g_fn_Deallocator(Mem_MakeSourceFile(sourceFile), sourceLine, sourceFunc, deallocationType, reportedAddress); + else + free(reportedAddress); +} + +// new and delete operators +void *operator new(size_t reportedSize) +{ + if (reportedSize == 0) + reportedSize = 1; + void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new, reportedSize); + // :TODO: Handler support ? + if (ptr) + return ptr; + + // allocation failed + return NULL; +} + +void *operator new[](size_t reportedSize) +{ + if (reportedSize == 0) + reportedSize = 1; + void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new_array, reportedSize); + // :TODO: Handler support ? + if (ptr) + return ptr; + + // allocation failed + return NULL; +} + +// Microsoft memory tracking operators +void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) +{ + if (reportedSize == 0) + reportedSize = 1; + void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new, reportedSize); + // :TODO: Handler support ? + if (ptr) + return ptr; + + // allocation failed + return NULL; +} +void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) +{ + if (reportedSize == 0) + reportedSize = 1; + void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new_array, reportedSize); + // :TODO: Handler support ? + if (ptr) + return ptr; + + // allocation failed + return NULL; +} + +void operator delete(void *reportedAddress) +{ + if (!reportedAddress) + return; + + Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete, reportedAddress); +} + +void operator delete[](void *reportedAddress) +{ + if (!reportedAddress) + return; + + Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); +} + +/************* stuff from dlls/util.cpp *************/ +// must come here because cbase.h declares it's own operator new + +#ifdef USE_METAMOD + +// Selected portions of dlls/util.cpp from SDK 2.1. +// Functions copied from there as needed... +// And modified to avoid buffer overflows (argh). + +/*** +* +* Copyright (c) 1999, 2000 Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +/* + +===== util.cpp ======================================================== + + Utility code. Really not optional after all. + +*/ + +#include +#include "sdk_util.h" +#include + +#include // for strncpy(), etc + +#include "osdep.h" // win32 vsnprintf, etc + +char* UTIL_VarArgs( char *format, ... ) +{ + va_list argptr; + static char string[1024]; + + va_start (argptr, format); + vsnprintf (string, sizeof(string), format, argptr); + va_end (argptr); + + return string; +} + + +//========================================================= +// UTIL_LogPrintf - Prints a logged message to console. +// Preceded by LOG: ( timestamp ) < message > +//========================================================= +void UTIL_LogPrintf( char *fmt, ... ) +{ + va_list argptr; + static char string[1024]; + + va_start ( argptr, fmt ); + vsnprintf ( string, sizeof(string), fmt, argptr ); + va_end ( argptr ); + + // Print to server console + ALERT( at_logged, "%s", string ); +} + + +void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, + const char *pMessage) +{ + if ( !pEntity ) + return; + + MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, ENT(pEntity->pev) ); + WRITE_BYTE( TE_TEXTMESSAGE ); + WRITE_BYTE( textparms.channel & 0xFF ); + + WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) ); + WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) ); + WRITE_BYTE( textparms.effect ); + + WRITE_BYTE( textparms.r1 ); + WRITE_BYTE( textparms.g1 ); + WRITE_BYTE( textparms.b1 ); + WRITE_BYTE( textparms.a1 ); + + WRITE_BYTE( textparms.r2 ); + WRITE_BYTE( textparms.g2 ); + WRITE_BYTE( textparms.b2 ); + WRITE_BYTE( textparms.a2 ); + + WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) ); + WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) ); + WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) ); + + if ( textparms.effect == 2 ) + WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) ); + + if ( strlen( pMessage ) < 512 ) + { + WRITE_STRING( pMessage ); + } + else + { + char tmp[512]; + strncpy( tmp, pMessage, 511 ); + tmp[511] = 0; + WRITE_STRING( tmp ); + } + MESSAGE_END(); +} + +short FixedSigned16( float value, float scale ) +{ + int output; + + output = (int) (value * scale); + + if ( output > 32767 ) + output = 32767; + + if ( output < -32768 ) + output = -32768; + + return (short)output; +} + +unsigned short FixedUnsigned16( float value, float scale ) +{ + int output; + + output = (int) (value * scale); + if ( output < 0 ) + output = 0; + if ( output > 0xFFFF ) + output = 0xFFFF; + + return (unsigned short)output; +} +#endif // USE_METAMOD diff --git a/dlls/csx_sql/amxxmodule.h b/dlls/csx_sql/amxxmodule.h new file mode 100755 index 00000000..e0b0e8fa --- /dev/null +++ b/dlls/csx_sql/amxxmodule.h @@ -0,0 +1,2197 @@ +/* + * AMX Mod X Module Interface Functions + * This file may be freely used +*/ + +// prevent double include +#ifndef __AMXXMODULE_H__ +#define __AMXXMODULE_H__ + +// config +#include "moduleconfig.h" + +// metamod include files +#ifdef USE_METAMOD +#include +#include +#include "osdep.h" +#endif // #ifdef USE_METAMOD + +// DLL Export +#undef DLLEXPORT +#ifndef __linux__ +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#define LINUX +#endif + +#undef C_DLLEXPORT +#define C_DLLEXPORT extern "C" DLLEXPORT + +// ***** AMXX stuff ***** + +// module interface version is 1 +#define AMXX_INTERFACE_VERSION 1 + +// amxx module info +struct amxx_module_info_s +{ + const char *name; + const char *author; + const char *version; + int reload; // reload on mapchange when nonzero +}; + + + +// return values from functions called by amxx +#define AMXX_OK 0 /* no error */ +#define AMXX_IFVERS 1 /* interface version */ +#define AMXX_PARAM 2 /* Invalid parameter */ +#define AMXX_FUNC_NOT_PRESENT 3 /* Function not present */ + +// *** Small stuff *** +// The next section is copied from the amx.h file +// Copyright (c) ITB CompuPhase, 1997-2004 + +#if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__ + #include +#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L + /* The ISO C99 defines the int16_t and int_32t types. If the compiler got + * here, these types are probably undefined. + */ + #if defined __FreeBSD__ + #include + #else + typedef short int int16_t; + typedef unsigned short int uint16_t; + #if defined SN_TARGET_PS2 + typedef int int32_t; + typedef unsigned int uint32_t; + #else + typedef long int int32_t; + typedef unsigned long int uint32_t; + #endif + #if defined __WIN32__ || defined _WIN32 || defined WIN32 + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + #define HAVE_I64 + #elif defined __GNUC__ + typedef long long int64_t; + typedef unsigned long long uint64_t; + #define HAVE_I64 + #endif + #endif +#endif + + +/* calling convention for native functions */ +#if !defined AMX_NATIVE_CALL + #define AMX_NATIVE_CALL +#endif +/* calling convention for all interface functions and callback functions */ +#if !defined AMXAPI + #if defined STDECL + #define AMXAPI __stdcall + #elif defined CDECL + #define AMXAPI __cdecl + #else + #define AMXAPI + #endif +#endif +#if !defined AMXEXPORT + #define AMXEXPORT +#endif + + + +#if !defined SMALL_CELL_SIZE + #define SMALL_CELL_SIZE 32 /* by default, use 32-bit cells */ +#endif +#if SMALL_CELL_SIZE==32 + typedef uint32_t ucell; + typedef int32_t cell; + typedef float REAL; +#elif SMALL_CELL_SIZE==64 + typedef uint64_t ucell; + typedef int64_t cell; + typedef double REAL; +#else + #error Unsupported cell size (SMALL_CELL_SIZE) +#endif + +#define UNPACKEDMAX ((1 << (sizeof(cell)-1)*8) - 1) + +struct tagAMX; +typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params); +typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index, + cell *result, cell *params); +typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx); +#if !defined _FAR + #define _FAR +#endif + +#if defined _MSC_VER + #pragma warning(disable:4103) /* disable warning message 4103 that complains + * about pragma pack in a header file */ + #pragma warning(disable:4100) /* "'%$S' : unreferenced formal parameter" */ +#endif + + +#if defined SN_TARGET_PS2 || defined __GNUC__ + #define AMX_NO_ALIGN +#endif + + +#if defined __GNUC__ + #define PACKED __attribute__((packed)) +#else + #define PACKED +#endif + + +#if !defined AMX_NO_ALIGN + #if defined __linux__ + #pragma pack(1) /* structures must be packed (byte-aligned) */ + #else + #pragma pack(push) + #pragma pack(1) /* structures must be packed (byte-aligned) */ + #if defined __TURBOC__ + #pragma option -a- /* "pack" pragma for older Borland compilers */ + #endif + #endif +#endif + +typedef struct { + const char _FAR *name PACKED; + AMX_NATIVE func PACKED; +} AMX_NATIVE_INFO; + +#define AMX_USERNUM 4 + +/* The AMX structure is the internal structure for many functions. Not all + * fields are valid at all times; many fields are cached in local variables. + */ +typedef struct tagAMX { + unsigned char _FAR *base PACKED; /* points to the AMX header ("amxhdr") plus the code, optionally also the data */ + unsigned char _FAR *data PACKED; /* points to separate data+stack+heap, may be NULL */ + AMX_CALLBACK callback PACKED; + AMX_DEBUG debug PACKED; /* debug callback */ + /* for external functions a few registers must be accessible from the outside */ + cell cip PACKED; /* instruction pointer: relative to base + amxhdr->cod */ + cell frm PACKED; /* stack frame base: relative to base + amxhdr->dat */ + cell hea PACKED; /* top of the heap: relative to base + amxhdr->dat */ + cell hlw PACKED; /* bottom of the heap: relative to base + amxhdr->dat */ + cell stk PACKED; /* stack pointer: relative to base + amxhdr->dat */ + cell stp PACKED; /* top of the stack: relative to base + amxhdr->dat */ + int flags PACKED; /* current status, see amx_Flags() */ + /* for assertions and debug hook */ + cell curline PACKED; + cell curfile PACKED; + int dbgcode PACKED; + cell dbgaddr PACKED; + cell dbgparam PACKED; + char _FAR *dbgname PACKED; + /* user data */ + long usertags[AMX_USERNUM] PACKED; + void _FAR *userdata[AMX_USERNUM] PACKED; + /* native functions can raise an error */ + int error PACKED; + /* the sleep opcode needs to store the full AMX status */ + cell pri PACKED; + cell alt PACKED; + cell reset_stk PACKED; + cell reset_hea PACKED; + cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */ + /* support variables for the JIT */ + int reloc_size PACKED; /* required temporary buffer for relocations */ + long code_size PACKED; /* estimated memory footprint of the native code */ +} AMX; + +enum { + AMX_ERR_NONE, + /* reserve the first 15 error codes for exit codes of the abstract machine */ + AMX_ERR_EXIT, /* forced exit */ + AMX_ERR_ASSERT, /* assertion failed */ + AMX_ERR_STACKERR, /* stack/heap collision */ + AMX_ERR_BOUNDS, /* index out of bounds */ + AMX_ERR_MEMACCESS, /* invalid memory access */ + AMX_ERR_INVINSTR, /* invalid instruction */ + AMX_ERR_STACKLOW, /* stack underflow */ + AMX_ERR_HEAPLOW, /* heap underflow */ + AMX_ERR_CALLBACK, /* no callback, or invalid callback */ + AMX_ERR_NATIVE, /* native function failed */ + AMX_ERR_DIVIDE, /* divide by zero */ + AMX_ERR_SLEEP, /* go into sleepmode - code can be restarted */ + + AMX_ERR_MEMORY = 16, /* out of memory */ + AMX_ERR_FORMAT, /* invalid file format */ + AMX_ERR_VERSION, /* file is for a newer version of the AMX */ + AMX_ERR_NOTFOUND, /* function not found */ + AMX_ERR_INDEX, /* invalid index parameter (bad entry point) */ + AMX_ERR_DEBUG, /* debugger cannot run */ + AMX_ERR_INIT, /* AMX not initialized (or doubly initialized) */ + AMX_ERR_USERDATA, /* unable to set user data field (table full) */ + AMX_ERR_INIT_JIT, /* cannot initialize the JIT */ + AMX_ERR_PARAMS, /* parameter error */ + AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */ +}; + +#if !defined AMX_NO_ALIGN + #if defined __linux__ + #pragma pack() /* reset default packing */ + #else + #pragma pack(pop) /* reset previous packing */ + #endif +#endif + + +// ***** declare functions ***** + +#ifdef USE_METAMOD +void UTIL_LogPrintf( char *fmt, ... ); +void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage); +short FixedSigned16( float value, float scale ); +unsigned short FixedUnsigned16( float value, float scale ); + +#ifdef FN_META_QUERY +void FN_META_QUERY(void); +#endif // FN_META_QUERY + +#ifdef FN_META_ATTACH +void FN_META_ATTACH(void); +#endif // FN_META_ATTACH + +#ifdef FN_META_DETACH +void FN_META_DETACH(void); +#endif // FN_META_DETACH + + + + + +#ifdef FN_GameDLLInit +void FN_GameDLLInit(void); +#endif // FN_GameDLLInit + +#ifdef FN_DispatchSpawn +int FN_DispatchSpawn(edict_t *pent); +#endif // FN_DispatchSpawn + +#ifdef FN_DispatchThink +void FN_DispatchThink(edict_t *pent); +#endif // FN_DispatchThink + +#ifdef FN_DispatchUse +void FN_DispatchUse(edict_t *pentUser, edict_t *pentOther); +#endif // FN_DispatchUse + +#ifdef FN_DispatchTouch +void FN_DispatchTouch(edict_t *pentTouched, edict_t *pentOther); +#endif // FN_DispatchTouch + +#ifdef FN_DispatchBlocked +void FN_DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther); +#endif // FN_DispatchBlocked + +#ifdef FN_DispatchKeyValue +void FN_DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd); +#endif // FN_DispatchKeyValue + +#ifdef FN_DispatchSave +void FN_DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData); +#endif // FN_DispatchSave + +#ifdef FN_DispatchRestore +int FN_DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity); +#endif // FN_DispatchRestore + +#ifdef FN_DispatchObjectCollsionBox +void FN_DispatchObjectCollsionBox(edict_t *pent); +#endif // FN_DispatchObjectCollsionBox + +#ifdef FN_SaveWriteFields +void FN_SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount); +#endif // FN_SaveWriteFields + +#ifdef FN_SaveReadFields +void FN_SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount); +#endif // FN_SaveReadFields + +#ifdef FN_SaveGlobalState +void FN_SaveGlobalState(SAVERESTOREDATA *pSaveData); +#endif // FN_SaveGlobalState + +#ifdef FN_RestoreGlobalState +void FN_RestoreGlobalState(SAVERESTOREDATA *pSaveData); +#endif // FN_RestoreGlobalState + +#ifdef FN_ResetGlobalState +void FN_ResetGlobalState(void); +#endif // FN_ResetGlobalState + +#ifdef FN_ClientConnect +BOOL FN_ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ]); +#endif // FN_ClientConnect + +#ifdef FN_ClientDisconnect +void FN_ClientDisconnect(edict_t *pEntity); +#endif // FN_ClientDisconnect + +#ifdef FN_ClientKill +void FN_ClientKill(edict_t *pEntity); +#endif // FN_ClientKill + +#ifdef FN_ClientPutInServer +void FN_ClientPutInServer(edict_t *pEntity); +#endif // FN_ClientPutInServer + +#ifdef FN_ClientCommand +void FN_ClientCommand(edict_t *pEntity); +#endif // FN_ClientCommand + +#ifdef FN_ClientUserInfoChanged +void FN_ClientUserInfoChanged(edict_t *pEntity, char *infobuffer); +#endif // FN_ClientUserInfoChanged + +#ifdef FN_ServerActivate +void FN_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax); +#endif // FN_ServerActivate + +#ifdef FN_ServerDeactivate +void FN_ServerDeactivate(void); +#endif // FN_ServerDeactivate + +#ifdef FN_PlayerPreThink +void FN_PlayerPreThink(edict_t *pEntity); +#endif // FN_PlayerPreThink + +#ifdef FN_PlayerPostThink +void FN_PlayerPostThink(edict_t *pEntity); +#endif // FN_PlayerPostThink + +#ifdef FN_StartFrame +void FN_StartFrame(void); +#endif // FN_StartFrame + +#ifdef FN_ParmsNewLevel +void FN_ParmsNewLevel(void); +#endif // FN_ParmsNewLevel + +#ifdef FN_ParmsChangeLevel +void FN_ParmsChangeLevel(void); +#endif // FN_ParmsChangeLevel + +#ifdef FN_GetGameDescription +const char *FN_GetGameDescription(void); +#endif // FN_GetGameDescription + +#ifdef FN_PlayerCustomization +void FN_PlayerCustomization(edict_t *pEntity, customization_t *pCust); +#endif // FN_PlayerCustomization + +#ifdef FN_SpectatorConnect +void FN_SpectatorConnect(edict_t *pEntity); +#endif // FN_SpectatorConnect + +#ifdef FN_SpectatorDisconnect +void FN_SpectatorDisconnect(edict_t *pEntity); +#endif // FN_SpectatorDisconnect + +#ifdef FN_SpectatorThink +void FN_SpectatorThink(edict_t *pEntity); +#endif // FN_SpectatorThink + +#ifdef FN_Sys_Error +void FN_Sys_Error(const char *error_string); +#endif // FN_Sys_Error + +#ifdef FN_PM_Move +void FN_PM_Move(struct playermove_s *ppmove, int server); +#endif // FN_PM_Move + +#ifdef FN_PM_Init +void FN_PM_Init(struct playermove_s *ppmove); +#endif // FN_PM_Init + +#ifdef FN_PM_FindTextureType +char FN_PM_FindTextureType(char *name); +#endif // FN_PM_FindTextureType + +#ifdef FN_SetupVisibility +void FN_SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas); +#endif // FN_SetupVisibility + +#ifdef FN_UpdateClientData +void FN_UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd); +#endif // FN_UpdateClientData + +#ifdef FN_AddToFullPack +int FN_AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet); +#endif // FN_AddToFullPack + +#ifdef FN_CreateBaseline +void FN_CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs); +#endif // FN_CreateBaseline + +#ifdef FN_RegisterEncoders +void FN_RegisterEncoders(void); +#endif // FN_RegisterEncoders + +#ifdef FN_GetWeaponData +int FN_GetWeaponData(struct edict_s *player, struct weapon_data_s *info); +#endif // FN_GetWeaponData + +#ifdef FN_CmdStart +void FN_CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed); +#endif // FN_CmdStart + +#ifdef FN_CmdEnd +void FN_CmdEnd(const edict_t *player); +#endif // FN_CmdEnd + +#ifdef FN_ConnectionlessPacket +int FN_ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size); +#endif // FN_ConnectionlessPacket + +#ifdef FN_GetHullBounds +int FN_GetHullBounds(int hullnumber, float *mins, float *maxs); +#endif // FN_GetHullBounds + +#ifdef FN_CreateInstancedBaselines +void FN_CreateInstancedBaselines(void); +#endif // FN_CreateInstancedBaselines + +#ifdef FN_InconsistentFile +int FN_InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message); +#endif // FN_InconsistentFile + +#ifdef FN_AllowLagCompensation +int FN_AllowLagCompensation(void); +#endif // FN_AllowLagCompensation + + + + +#ifdef FN_GameDLLInit_Post +void FN_GameDLLInit_Post(void); +#endif // FN_GameDLLInit_Post + +#ifdef FN_DispatchSpawn_Post +int FN_DispatchSpawn_Post(edict_t *pent); +#endif // FN_DispatchSpawn_Post + +#ifdef FN_DispatchThink_Post +void FN_DispatchThink_Post(edict_t *pent); +#endif // FN_DispatchThink_Post + +#ifdef FN_DispatchUse_Post +void FN_DispatchUse_Post(edict_t *pentUser, edict_t *pentOther); +#endif // FN_DispatchUse_Post + +#ifdef FN_DispatchTouch_Post +void FN_DispatchTouch_Post(edict_t *pentTouched, edict_t *pentOther); +#endif // FN_DispatchTouch_Post + +#ifdef FN_DispatchBlocked_Post +void FN_DispatchBlocked_Post(edict_t *pentBlocked, edict_t *pentOther); +#endif // FN_DispatchBlocked_Post + +#ifdef FN_DispatchKeyValue_Post +void FN_DispatchKeyValue_Post(edict_t *pentKeyvalue, KeyValueData *pkvd); +#endif // FN_DispatchKeyValue_Post + +#ifdef FN_DispatchSave_Post +void FN_DispatchSave_Post(edict_t *pent, SAVERESTOREDATA *pSaveData); +#endif // FN_DispatchSave_Post + +#ifdef FN_DispatchRestore_Post +int FN_DispatchRestore_Post(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity); +#endif // FN_DispatchRestore_Post + +#ifdef FN_DispatchObjectCollsionBox_Post +void FN_DispatchObjectCollsionBox_Post(edict_t *pent); +#endif // FN_DispatchObjectCollsionBox_Post + +#ifdef FN_SaveWriteFields_Post +void FN_SaveWriteFields_Post(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount); +#endif // FN_SaveWriteFields_Post + +#ifdef FN_SaveReadFields_Post +void FN_SaveReadFields_Post(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount); +#endif // FN_SaveReadFields_Post + +#ifdef FN_SaveGlobalState_Post +void FN_SaveGlobalState_Post(SAVERESTOREDATA *pSaveData); +#endif // FN_SaveGlobalState_Post + +#ifdef FN_RestoreGlobalState_Post +void FN_RestoreGlobalState_Post(SAVERESTOREDATA *pSaveData); +#endif // FN_RestoreGlobalState_Post + +#ifdef FN_ResetGlobalState_Post +void FN_ResetGlobalState_Post(void); +#endif // FN_ResetGlobalState_Post + +#ifdef FN_ClientConnect_Post +BOOL FN_ClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ]); +#endif // FN_ClientConnect_Post + +#ifdef FN_ClientDisconnect_Post +void FN_ClientDisconnect_Post(edict_t *pEntity); +#endif // FN_ClientDisconnect_Post + +#ifdef FN_ClientKill_Post +void FN_ClientKill_Post(edict_t *pEntity); +#endif // FN_ClientKill_Post + +#ifdef FN_ClientPutInServer_Post +void FN_ClientPutInServer_Post(edict_t *pEntity); +#endif // FN_ClientPutInServer_Post + +#ifdef FN_ClientCommand_Post +void FN_ClientCommand_Post(edict_t *pEntity); +#endif // FN_ClientCommand_Post + +#ifdef FN_ClientUserInfoChanged_Post +void FN_ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer); +#endif // FN_ClientUserInfoChanged_Post + +#ifdef FN_ServerActivate_Post +void FN_ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax); +#endif // FN_ServerActivate_Post + +#ifdef FN_ServerDeactivate_Post +void FN_ServerDeactivate_Post(void); +#endif // FN_ServerDeactivate_Post + +#ifdef FN_PlayerPreThink_Post +void FN_PlayerPreThink_Post(edict_t *pEntity); +#endif // FN_PlayerPreThink_Post + +#ifdef FN_PlayerPostThink_Post +void FN_PlayerPostThink_Post(edict_t *pEntity); +#endif // FN_PlayerPostThink_Post + +#ifdef FN_StartFrame_Post +void FN_StartFrame_Post(void); +#endif // FN_StartFrame_Post + +#ifdef FN_ParmsNewLevel_Post +void FN_ParmsNewLevel_Post(void); +#endif // FN_ParmsNewLevel_Post + +#ifdef FN_ParmsChangeLevel_Post +void FN_ParmsChangeLevel_Post(void); +#endif // FN_ParmsChangeLevel_Post + +#ifdef FN_GetGameDescription_Post +const char *FN_GetGameDescription_Post(void); +#endif // FN_GetGameDescription_Post + +#ifdef FN_PlayerCustomization_Post +void FN_PlayerCustomization_Post(edict_t *pEntity, customization_t *pCust); +#endif // FN_PlayerCustomization_Post + +#ifdef FN_SpectatorConnect_Post +void FN_SpectatorConnect_Post(edict_t *pEntity); +#endif // FN_SpectatorConnect_Post + +#ifdef FN_SpectatorDisconnect_Post +void FN_SpectatorDisconnect_Post(edict_t *pEntity); +#endif // FN_SpectatorDisconnect_Post + +#ifdef FN_SpectatorThink_Post +void FN_SpectatorThink_Post(edict_t *pEntity); +#endif // FN_SpectatorThink_Post + +#ifdef FN_Sys_Error_Post +void FN_Sys_Error_Post(const char *error_string); +#endif // FN_Sys_Error_Post + +#ifdef FN_PM_Move_Post +void FN_PM_Move_Post(struct playermove_s *ppmove, int server); +#endif // FN_PM_Move_Post + +#ifdef FN_PM_Init_Post +void FN_PM_Init_Post(struct playermove_s *ppmove); +#endif // FN_PM_Init_Post + +#ifdef FN_PM_FindTextureType_Post +char FN_PM_FindTextureType_Post(char *name); +#endif // FN_PM_FindTextureType_Post + +#ifdef FN_SetupVisibility_Post +void FN_SetupVisibility_Post(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas); +#endif // FN_SetupVisibility_Post + +#ifdef FN_UpdateClientData_Post +void FN_UpdateClientData_Post(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd); +#endif // FN_UpdateClientData_Post + +#ifdef FN_AddToFullPack_Post +int FN_AddToFullPack_Post(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet); +#endif // FN_AddToFullPack_Post + +#ifdef FN_CreateBaseline_Post +void FN_CreateBaseline_Post(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs); +#endif // FN_CreateBaseline_Post + +#ifdef FN_RegisterEncoders_Post +void FN_RegisterEncoders_Post(void); +#endif // FN_RegisterEncoders_Post + +#ifdef FN_GetWeaponData_Post +int FN_GetWeaponData_Post(struct edict_s *player, struct weapon_data_s *info); +#endif // FN_GetWeaponData_Post + +#ifdef FN_CmdStart_Post +void FN_CmdStart_Post(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed); +#endif // FN_CmdStart_Post + +#ifdef FN_CmdEnd_Post +void FN_CmdEnd_Post(const edict_t *player); +#endif // FN_CmdEnd_Post + +#ifdef FN_ConnectionlessPacket_Post +int FN_ConnectionlessPacket_Post(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size); +#endif // FN_ConnectionlessPacket_Post + +#ifdef FN_GetHullBounds_Post +int FN_GetHullBounds_Post(int hullnumber, float *mins, float *maxs); +#endif // FN_GetHullBounds_Post + +#ifdef FN_CreateInstancedBaselines_Post +void FN_CreateInstancedBaselines_Post(void); +#endif // FN_CreateInstancedBaselines_Post + +#ifdef FN_InconsistentFile_Post +int FN_InconsistentFile_Post(const edict_t *player, const char *filename, char *disconnect_message); +#endif // FN_InconsistentFile_Post + +#ifdef FN_AllowLagCompensation_Post +int FN_AllowLagCompensation_Post(void); +#endif // FN_AllowLagCompensation_Post + + + +#ifdef FN_PrecacheModel +int FN_PrecacheModel(char *s); +#endif // FN_PrecacheModel + +#ifdef FN_PrecacheSound +int FN_PrecacheSound(char *s); +#endif // FN_PrecacheSound + +#ifdef FN_SetModel +void FN_SetModel(edict_t *e, const char *m); +#endif // FN_SetModel + +#ifdef FN_ModelIndex +int FN_ModelIndex(const char *m); +#endif // FN_ModelIndex + +#ifdef FN_ModelFrames +int FN_ModelFrames(int modelIndex); +#endif // FN_ModelFrames + +#ifdef FN_SetSize +void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax); +#endif // FN_SetSize + +#ifdef FN_ChangeLevel +void FN_ChangeLevel(char *s1, char *s2); +#endif // FN_ChangeLevel + +#ifdef FN_GetSpawnParms +void FN_GetSpawnParms(edict_t *ent); +#endif // FN_GetSpawnParms + +#ifdef FN_SaveSpawnParms +void FN_SaveSpawnParms(edict_t *ent); +#endif // FN_SaveSpawnParms + +#ifdef FN_VecToYaw +float FN_VecToYaw(const float *rgflVector); +#endif // FN_VecToYaw + +#ifdef FN_VecToAngles +void FN_VecToAngles(const float *rgflVectorIn, float *rgflVectorOut); +#endif // FN_VecToAngles + +#ifdef FN_MoveToOrigin +void FN_MoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType); +#endif // FN_MoveToOrigin + +#ifdef FN_ChangeYaw +void FN_ChangeYaw(edict_t *ent); +#endif // FN_ChangeYaw + +#ifdef FN_ChangePitch +void FN_ChangePitch(edict_t *ent); +#endif // FN_ChangePitch + +#ifdef FN_FindEntityByString +edict_t *FN_FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); +#endif // FN_FindEntityByString + +#ifdef FN_GetEntityIllum +int FN_GetEntityIllum(edict_t *pEnt); +#endif // FN_GetEntityIllum + +#ifdef FN_FindEntityInSphere +edict_t *FN_FindEntityInSphere(edict_t *pEdictStartSearchAfter, const float *org, float rad); +#endif // FN_FindEntityInSphere + +#ifdef FN_FindClientInPVS +edict_t *FN_FindClientInPVS(edict_t *pEdict); +#endif // FN_FindClientInPVS + +#ifdef FN_EntitiesInPVS +edict_t *FN_EntitiesInPVS(edict_t *pplayer); +#endif // FN_EntitiesInPVS + +#ifdef FN_MakeVectors +void FN_MakeVectors(const float *rgflVector); +#endif // FN_MakeVectors + +#ifdef FN_AngleVectors +void FN_AngleVectors(const float *rgflVector, float *forward, float *right, float *up); +#endif // FN_AngleVectors + +#ifdef FN_CreateEntity +edict_t *FN_CreateEntity(void); +#endif // FN_CreateEntity + +#ifdef FN_RemoveEntity +void FN_RemoveEntity(edict_t *e); +#endif // FN_RemoveEntity + +#ifdef FN_CreateNamedEntity +edict_t *FN_CreateNamedEntity(int className); +#endif // FN_CreateNamedEntity + +#ifdef FN_MakeStatic +void FN_MakeStatic(edict_t *ent); +#endif // FN_MakeStatic + +#ifdef FN_EntIsOnFloor +int FN_EntIsOnFloor(edict_t *ent); +#endif // FN_EntIsOnFloor + +#ifdef FN_DropToFloor +int FN_DropToFloor(edict_t *ent); +#endif // FN_DropToFloor + +#ifdef FN_WalkMove +int FN_WalkMove(edict_t *ent, float yaw, float dist, int iMode); +#endif // FN_WalkMove + +#ifdef FN_SetOrigin +void FN_SetOrigin(edict_t *e, const float *rgflOrigin); +#endif // FN_SetOrigin + +#ifdef FN_EmitSound +void FN_EmitSound(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); +#endif // FN_EmitSound + +#ifdef FN_EmitAmbientSound +void FN_EmitAmbientSound(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); +#endif // FN_EmitAmbientSound + +#ifdef FN_TraceLine +void FN_TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceLine + +#ifdef FN_TraceToss +void FN_TraceToss(edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr); +#endif // FN_TraceToss + +#ifdef FN_TraceMonsterHull +int FN_TraceMonsterHull(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceMonsterHull + +#ifdef FN_TraceHull +void FN_TraceHull(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceHull + +#ifdef FN_TraceModel +void FN_TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); +#endif // FN_TraceModel + +#ifdef FN_TraceTexture +const char *FN_TraceTexture(edict_t *pTextureEntity, const float *v1, const float *v2 ); +#endif // FN_TraceTexture + +#ifdef FN_TraceSphere +void FN_TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceSphere + +#ifdef FN_GetAimVector +void FN_GetAimVector(edict_t *ent, float speed, float *rgflReturn); +#endif // FN_GetAimVector + +#ifdef FN_ServerCommand +void FN_ServerCommand(char *str); +#endif // FN_ServerCommand + +#ifdef FN_ServerExecute +void FN_ServerExecute(void); +#endif // FN_ServerExecute + +#ifdef FN_engClientCommand +void FN_engClientCommand(edict_t *pEdict, char *szFmt, ...); +#endif // FN_engClientCommand + +#ifdef FN_ParticleEffect +void FN_ParticleEffect(const float *org, const float *dir, float color, float count); +#endif // FN_ParticleEffect + +#ifdef FN_LightStyle +void FN_LightStyle(int style, char *val); +#endif // FN_LightStyle + +#ifdef FN_DecalIndex +int FN_DecalIndex(const char *name); +#endif // FN_DecalIndex + +#ifdef FN_PointContents +int FN_PointContents(const float *rgflVector); +#endif // FN_PointContents + +#ifdef FN_MessageBegin +void FN_MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +#endif // FN_MessageBegin + +#ifdef FN_MessageEnd +void FN_MessageEnd(void); +#endif // FN_MessageEnd + +#ifdef FN_WriteByte +void FN_WriteByte(int iValue); +#endif // FN_WriteByte + +#ifdef FN_WriteChar +void FN_WriteChar(int iValue); +#endif // FN_WriteChar + +#ifdef FN_WriteShort +void FN_WriteShort(int iValue); +#endif // FN_WriteShort + +#ifdef FN_WriteLong +void FN_WriteLong(int iValue); +#endif // FN_WriteLong + +#ifdef FN_WriteAngle +void FN_WriteAngle(float flValue); +#endif // FN_WriteAngle + +#ifdef FN_WriteCoord +void FN_WriteCoord(float flValue); +#endif // FN_WriteCoord + +#ifdef FN_WriteString +void FN_WriteString(const char *sz); +#endif // FN_WriteString + +#ifdef FN_WriteEntity +void FN_WriteEntity(int iValue); +#endif // FN_WriteEntity + +#ifdef FN_CVarRegister +void FN_CVarRegister(cvar_t *pCvar); +#endif // FN_CVarRegister + +#ifdef FN_CVarGetFloat +float FN_CVarGetFloat(const char *szVarName); +#endif // FN_CVarGetFloat + +#ifdef FN_CVarGetString +const char *FN_CVarGetString(const char *szVarName); +#endif // FN_CVarGetString + +#ifdef FN_CVarSetFloat +void FN_CVarSetFloat(const char *szVarName, float flValue); +#endif // FN_CVarSetFloat + +#ifdef FN_CVarSetString +void FN_CVarSetString(const char *szVarName, const char *szValue); +#endif // FN_CVarSetString + +#ifdef FN_AlertMessage +void FN_AlertMessage(ALERT_TYPE atype, char *szFmt, ...); +#endif // FN_AlertMessage + +#ifdef FN_EngineFprintf +void FN_EngineFprintf(FILE *pfile, char *szFmt, ...); +#endif // FN_EngineFprintf + +#ifdef FN_PvAllocEntPrivateData +void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb); +#endif // FN_PvAllocEntPrivateData + +#ifdef FN_PvEntPrivateData +void *FN_PvEntPrivateData(edict_t *pEdict); +#endif // FN_PvEntPrivateData + +#ifdef FN_FreeEntPrivateData +void FN_FreeEntPrivateData(edict_t *pEdict); +#endif // FN_FreeEntPrivateData + +#ifdef FN_SzFromIndex +const char *FN_SzFromIndex(int iString); +#endif // FN_SzFromIndex + +#ifdef FN_AllocString +int FN_AllocString(const char *szValue); +#endif // FN_AllocString + +#ifdef FN_GetVarsOfEnt +struct entvars_s *FN_GetVarsOfEnt(edict_t *pEdict); +#endif // FN_GetVarsOfEnt + +#ifdef FN_PEntityOfEntOffset +edict_t *FN_PEntityOfEntOffset(int iEntOffset); +#endif // FN_PEntityOfEntOffset + +#ifdef FN_EntOffsetOfPEntity +int FN_EntOffsetOfPEntity(const edict_t *pEdict); +#endif // FN_EntOffsetOfPEntity + +#ifdef FN_IndexOfEdict +int FN_IndexOfEdict(const edict_t *pEdict); +#endif // FN_IndexOfEdict + +#ifdef FN_PEntityOfEntIndex +edict_t *FN_PEntityOfEntIndex(int iEntIndex); +#endif // FN_PEntityOfEntIndex + +#ifdef FN_FindEntityByVars +edict_t *FN_FindEntityByVars(struct entvars_s *pvars); +#endif // FN_FindEntityByVars + +#ifdef FN_GetModelPtr +void *FN_GetModelPtr(edict_t *pEdict); +#endif // FN_GetModelPtr + +#ifdef FN_RegUserMsg +int FN_RegUserMsg(const char *pszName, int iSize); +#endif // FN_RegUserMsg + +#ifdef FN_AnimationAutomove +void FN_AnimationAutomove(const edict_t *pEdict, float flTime); +#endif // FN_AnimationAutomove + +#ifdef FN_GetBonePosition +void FN_GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles); +#endif // FN_GetBonePosition + +#ifdef FN_FunctionFromName +unsigned long FN_FunctionFromName(const char *pName); +#endif // FN_FunctionFromName + +#ifdef FN_NameForFunction +const char *FN_NameForFunction(unsigned long function); +#endif // FN_NameForFunction + +#ifdef FN_ClientPrintf +void FN_ClientPrintf(edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg); +#endif // FN_ClientPrintf + +#ifdef FN_ServerPrint +void FN_ServerPrint(const char *szMsg); +#endif // FN_ServerPrint + +#ifdef FN_Cmd_Args +const char *FN_Cmd_Args(void); +#endif // FN_Cmd_Args + +#ifdef FN_Cmd_Argv +const char *FN_Cmd_Argv(int argc); +#endif // FN_Cmd_Argv + +#ifdef FN_Cmd_Argc +int FN_Cmd_Argc(void); +#endif // FN_Cmd_Argc + +#ifdef FN_GetAttachment +void FN_GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); +#endif // FN_GetAttachment + +#ifdef FN_CRC32_Init +void FN_CRC32_Init(CRC32_t *pulCRC); +#endif // FN_CRC32_Init + +#ifdef FN_CRC32_ProcessBuffer +void FN_CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len); +#endif // FN_CRC32_ProcessBuffer + +#ifdef FN_CRC32_ProcessByte +void FN_CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); +#endif // FN_CRC32_ProcessByte + +#ifdef FN_CRC32_Final +CRC32_t FN_CRC32_Final(CRC32_t pulCRC); +#endif // FN_CRC32_Final + +#ifdef FN_RandomLong +long FN_RandomLong(long lLow, long lHigh); +#endif // FN_RandomLong + +#ifdef FN_RandomFloat +float FN_RandomFloat(float flLow, float flHigh); +#endif // FN_RandomFloat + +#ifdef FN_SetView +void FN_SetView(const edict_t *pClient, const edict_t *pViewent); +#endif // FN_SetView + +#ifdef FN_Time +float FN_Time(void); +#endif // FN_Time + +#ifdef FN_CrosshairAngle +void FN_CrosshairAngle(const edict_t *pClient, float pitch, float yaw); +#endif // FN_CrosshairAngle + +#ifdef FN_LoadFileForMe +byte *FN_LoadFileForMe(char *filename, int *pLength); +#endif // FN_LoadFileForMe + +#ifdef FN_FreeFile +void FN_FreeFile(void *buffer); +#endif // FN_FreeFile + +#ifdef FN_EndSection +void FN_EndSection(const char *pszSectionName); +#endif // FN_EndSection + +#ifdef FN_CompareFileTime +int FN_CompareFileTime(char *filename1, char *filename2, int *iCompare); +#endif // FN_CompareFileTime + +#ifdef FN_GetGameDir +void FN_GetGameDir(char *szGetGameDir); +#endif // FN_GetGameDir + +#ifdef FN_Cvar_RegisterVariable +void FN_Cvar_RegisterVariable(cvar_t *variable); +#endif // FN_Cvar_RegisterVariable + +#ifdef FN_FadeClientVolume +void FN_FadeClientVolume(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); +#endif // FN_FadeClientVolume + +#ifdef FN_SetClientMaxspeed +void FN_SetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed); +#endif // FN_SetClientMaxspeed + +#ifdef FN_CreateFakeClient +edict_t *FN_CreateFakeClient(const char *netname); +#endif // FN_CreateFakeClient + +#ifdef FN_RunPlayerMove +void FN_RunPlayerMove(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec); +#endif // FN_RunPlayerMove + +#ifdef FN_NumberOfEntities +int FN_NumberOfEntities(void); +#endif // FN_NumberOfEntities + +#ifdef FN_GetInfoKeyBuffer +char *FN_GetInfoKeyBuffer(edict_t *e); +#endif // FN_GetInfoKeyBuffer + +#ifdef FN_InfoKeyValue +char *FN_InfoKeyValue(char *infobuffer, char *key); +#endif // FN_InfoKeyValue + +#ifdef FN_SetKeyValue +void FN_SetKeyValue(char *infobuffer, char *key, char *value); +#endif // FN_SetKeyValue + +#ifdef FN_SetClientKeyValue +void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value); +#endif // FN_SetClientKeyValue + +#ifdef FN_IsMapValid +int FN_IsMapValid(char *filename); +#endif // FN_IsMapValid + +#ifdef FN_StaticDecal +void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex); +#endif // FN_StaticDecal + +#ifdef FN_PrecacheGeneric +int FN_PrecacheGeneric(char *s); +#endif // FN_PrecacheGeneric + +#ifdef FN_GetPlayerUserId +int FN_GetPlayerUserId(edict_t *e ); +#endif // FN_GetPlayerUserId + +#ifdef FN_BuildSoundMsg +void FN_BuildSoundMsg(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +#endif // FN_BuildSoundMsg + +#ifdef FN_IsDedicatedServer +int FN_IsDedicatedServer(void); +#endif // FN_IsDedicatedServer + +#ifdef FN_CVarGetPointer +cvar_t *FN_CVarGetPointer(const char *szVarName); +#endif // FN_CVarGetPointer + +#ifdef FN_GetPlayerWONId +unsigned int FN_GetPlayerWONId(edict_t *e); +#endif // FN_GetPlayerWONId + +#ifdef FN_Info_RemoveKey +void FN_Info_RemoveKey( char *s, const char *key); +#endif // FN_Info_RemoveKey + +#ifdef FN_GetPhysicsKeyValue +const char *FN_GetPhysicsKeyValue(const edict_t *pClient, const char *key); +#endif // FN_GetPhysicsKeyValue + +#ifdef FN_SetPhysicsKeyValue +void FN_SetPhysicsKeyValue(const edict_t *pClient, const char *key, const char *value); +#endif // FN_SetPhysicsKeyValue + +#ifdef FN_GetPhysicsInfoString +const char *FN_GetPhysicsInfoString( const edict_t *pClient); +#endif // FN_GetPhysicsInfoString + +#ifdef FN_PrecacheEvent +unsigned short FN_PrecacheEvent(int type, const char *psz); +#endif // FN_PrecacheEvent + +#ifdef FN_PlaybackEvent +void FN_PlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); +#endif // FN_PlaybackEvent + +#ifdef FN_SetFatPVS +unsigned char *FN_SetFatPVS(float *org); +#endif // FN_SetFatPVS + +#ifdef FN_SetFatPAS +unsigned char *FN_SetFatPAS(float *org); +#endif // FN_SetFatPAS + +#ifdef FN_CheckVisibility +int FN_CheckVisibility(const edict_t *entity, unsigned char *pset); +#endif // FN_CheckVisibility + +#ifdef FN_DeltaSetField +void FN_DeltaSetField(struct delta_s *pFields, const char *fieldname); +#endif // FN_DeltaSetField + +#ifdef FN_DeltaUnsetField +void FN_DeltaUnsetField(struct delta_s *pFields, const char *fieldname); +#endif // FN_DeltaUnsetField + +#ifdef FN_DeltaAddEncoder +void FN_DeltaAddEncoder(char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); +#endif // FN_DeltaAddEncoder + +#ifdef FN_GetCurrentPlayer +int FN_GetCurrentPlayer(void); +#endif // FN_GetCurrentPlayer + +#ifdef FN_CanSkipPlayer +int FN_CanSkipPlayer(const edict_t *player); +#endif // FN_CanSkipPlayer + +#ifdef FN_DeltaFindField +int FN_DeltaFindField(struct delta_s *pFields, const char *fieldname); +#endif // FN_DeltaFindField + +#ifdef FN_DeltaSetFieldByIndex +void FN_DeltaSetFieldByIndex(struct delta_s *pFields, int fieldNumber); +#endif // FN_DeltaSetFieldByIndex + +#ifdef FN_DeltaUnsetFieldByIndex +void FN_DeltaUnsetFieldByIndex(struct delta_s *pFields, int fieldNumber); +#endif // FN_DeltaUnsetFieldByIndex + +#ifdef FN_SetGroupMask +void FN_SetGroupMask(int mask, int op); +#endif // FN_SetGroupMask + +#ifdef FN_engCreateInstancedBaseline +int FN_engCreateInstancedBaseline(int classname, struct entity_state_s *baseline); +#endif // FN_engCreateInstancedBaseline + +#ifdef FN_Cvar_DirectSet +void FN_Cvar_DirectSet(struct cvar_s *var, char *value); +#endif // FN_Cvar_DirectSet + +#ifdef FN_ForceUnmodified +void FN_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, const char *filename); +#endif // FN_ForceUnmodified + +#ifdef FN_GetPlayerStats +void FN_GetPlayerStats(const edict_t *pClient, int *ping, int *packet_loss); +#endif // FN_GetPlayerStats + +#ifdef FN_AddServerCommand +void FN_AddServerCommand(char *cmd_name, void (*function) (void)); +#endif // FN_AddServerCommand + +#ifdef FN_Voice_GetClientListening +qboolean FN_Voice_GetClientListening(int iReceiver, int iSender); +#endif // FN_Voice_GetClientListening + +#ifdef FN_Voice_SetClientListening +qboolean FN_Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen); +#endif // FN_Voice_SetClientListening + +#ifdef FN_GetPlayerAuthId +const char *FN_GetPlayerAuthId(edict_t *e); +#endif // FN_GetPlayerAuthId + + + + + + +#ifdef FN_PrecacheModel_Post +int FN_PrecacheModel_Post(char *s); +#endif // FN_PrecacheModel_Post + +#ifdef FN_PrecacheSound_Post +int FN_PrecacheSound_Post(char *s); +#endif // FN_PrecacheSound_Post + +#ifdef FN_SetModel_Post +void FN_SetModel_Post(edict_t *e, const char *m); +#endif // FN_SetModel_Post + +#ifdef FN_ModelIndex_Post +int FN_ModelIndex_Post(const char *m); +#endif // FN_ModelIndex_Post + +#ifdef FN_ModelFrames_Post +int FN_ModelFrames_Post(int modelIndex); +#endif // FN_ModelFrames_Post + +#ifdef FN_SetSize_Post +void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax); +#endif // FN_SetSize_Post + +#ifdef FN_ChangeLevel_Post +void FN_ChangeLevel_Post(char *s1, char *s2); +#endif // FN_ChangeLevel_Post + +#ifdef FN_GetSpawnParms_Post +void FN_GetSpawnParms_Post(edict_t *ent); +#endif // FN_GetSpawnParms_Post + +#ifdef FN_SaveSpawnParms_Post +void FN_SaveSpawnParms_Post(edict_t *ent); +#endif // FN_SaveSpawnParms_Post + +#ifdef FN_VecToYaw_Post +float FN_VecToYaw_Post(const float *rgflVector); +#endif // FN_VecToYaw_Post + +#ifdef FN_VecToAngles_Post +void FN_VecToAngles_Post(const float *rgflVectorIn, float *rgflVectorOut); +#endif // FN_VecToAngles_Post + +#ifdef FN_MoveToOrigin_Post +void FN_MoveToOrigin_Post(edict_t *ent, const float *pflGoal, float dist, int iMoveType); +#endif // FN_MoveToOrigin_Post + +#ifdef FN_ChangeYaw_Post +void FN_ChangeYaw_Post(edict_t *ent); +#endif // FN_ChangeYaw_Post + +#ifdef FN_ChangePitch_Post +void FN_ChangePitch_Post(edict_t *ent); +#endif // FN_ChangePitch_Post + +#ifdef FN_FindEntityByString_Post +edict_t *FN_FindEntityByString_Post(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); +#endif // FN_FindEntityByString_Post + +#ifdef FN_GetEntityIllum_Post +int FN_GetEntityIllum_Post(edict_t *pEnt); +#endif // FN_GetEntityIllum_Post + +#ifdef FN_FindEntityInSphere_Post +edict_t *FN_FindEntityInSphere_Post(edict_t *pEdictStartSearchAfter, const float *org, float rad); +#endif // FN_FindEntityInSphere_Post + +#ifdef FN_FindClientInPVS_Post +edict_t *FN_FindClientInPVS_Post(edict_t *pEdict); +#endif // FN_FindClientInPVS_Post + +#ifdef FN_EntitiesInPVS_Post +edict_t *FN_EntitiesInPVS_Post(edict_t *pplayer); +#endif // FN_EntitiesInPVS_Post + +#ifdef FN_MakeVectors_Post +void FN_MakeVectors_Post(const float *rgflVector); +#endif // FN_MakeVectors_Post + +#ifdef FN_AngleVectors_Post +void FN_AngleVectors_Post(const float *rgflVector, float *forward, float *right, float *up); +#endif // FN_AngleVectors_Post + +#ifdef FN_CreateEntity_Post +edict_t *FN_CreateEntity_Post(void); +#endif // FN_CreateEntity_Post + +#ifdef FN_RemoveEntity_Post +void FN_RemoveEntity_Post(edict_t *e); +#endif // FN_RemoveEntity_Post + +#ifdef FN_CreateNamedEntity_Post +edict_t *FN_CreateNamedEntity_Post(int className); +#endif // FN_CreateNamedEntity_Post + +#ifdef FN_MakeStatic_Post +void FN_MakeStatic_Post(edict_t *ent); +#endif // FN_MakeStatic_Post + +#ifdef FN_EntIsOnFloor_Post +int FN_EntIsOnFloor_Post(edict_t *ent); +#endif // FN_EntIsOnFloor_Post + +#ifdef FN_DropToFloor_Post +int FN_DropToFloor_Post(edict_t *ent); +#endif // FN_DropToFloor_Post + +#ifdef FN_WalkMove_Post +int FN_WalkMove_Post(edict_t *ent, float yaw, float dist, int iMode); +#endif // FN_WalkMove_Post + +#ifdef FN_SetOrigin_Post +void FN_SetOrigin_Post(edict_t *e, const float *rgflOrigin); +#endif // FN_SetOrigin_Post + +#ifdef FN_EmitSound_Post +void FN_EmitSound_Post(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); +#endif // FN_EmitSound_Post + +#ifdef FN_EmitAmbientSound_Post +void FN_EmitAmbientSound_Post(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); +#endif // FN_EmitAmbientSound_Post + +#ifdef FN_TraceLine_Post +void FN_TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceLine_Post + +#ifdef FN_TraceToss_Post +void FN_TraceToss_Post(edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr); +#endif // FN_TraceToss_Post + +#ifdef FN_TraceMonsterHull_Post +int FN_TraceMonsterHull_Post(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceMonsterHull_Post + +#ifdef FN_TraceHull_Post +void FN_TraceHull_Post(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceHull_Post + +#ifdef FN_TraceModel_Post +void FN_TraceModel_Post(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); +#endif // FN_TraceModel_Post + +#ifdef FN_TraceTexture_Post +const char *FN_TraceTexture_Post(edict_t *pTextureEntity, const float *v1, const float *v2 ); +#endif // FN_TraceTexture_Post + +#ifdef FN_TraceSphere_Post +void FN_TraceSphere_Post(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); +#endif // FN_TraceSphere_Post + +#ifdef FN_GetAimVector_Post +void FN_GetAimVector_Post(edict_t *ent, float speed, float *rgflReturn); +#endif // FN_GetAimVector_Post + +#ifdef FN_ServerCommand_Post +void FN_ServerCommand_Post(char *str); +#endif // FN_ServerCommand_Post + +#ifdef FN_ServerExecute_Post +void FN_ServerExecute_Post(void); +#endif // FN_ServerExecute_Post + +#ifdef FN_engClientCommand_Post +void FN_engClientCommand_Post(edict_t *pEdict, char *szFmt, ...); +#endif // FN_engClientCommand_Post + +#ifdef FN_ParticleEffect_Post +void FN_ParticleEffect_Post(const float *org, const float *dir, float color, float count); +#endif // FN_ParticleEffect_Post + +#ifdef FN_LightStyle_Post +void FN_LightStyle_Post(int style, char *val); +#endif // FN_LightStyle_Post + +#ifdef FN_DecalIndex_Post +int FN_DecalIndex_Post(const char *name); +#endif // FN_DecalIndex_Post + +#ifdef FN_PointContents_Post +int FN_PointContents_Post(const float *rgflVector); +#endif // FN_PointContents_Post + +#ifdef FN_MessageBegin_Post +void FN_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +#endif // FN_MessageBegin_Post + +#ifdef FN_MessageEnd_Post +void FN_MessageEnd_Post(void); +#endif // FN_MessageEnd_Post + +#ifdef FN_WriteByte_Post +void FN_WriteByte_Post(int iValue); +#endif // FN_WriteByte_Post + +#ifdef FN_WriteChar_Post +void FN_WriteChar_Post(int iValue); +#endif // FN_WriteChar_Post + +#ifdef FN_WriteShort_Post +void FN_WriteShort_Post(int iValue); +#endif // FN_WriteShort_Post + +#ifdef FN_WriteLong_Post +void FN_WriteLong_Post(int iValue); +#endif // FN_WriteLong_Post + +#ifdef FN_WriteAngle_Post +void FN_WriteAngle_Post(float flValue); +#endif // FN_WriteAngle_Post + +#ifdef FN_WriteCoord_Post +void FN_WriteCoord_Post(float flValue); +#endif // FN_WriteCoord_Post + +#ifdef FN_WriteString_Post +void FN_WriteString_Post(const char *sz); +#endif // FN_WriteString_Post + +#ifdef FN_WriteEntity_Post +void FN_WriteEntity_Post(int iValue); +#endif // FN_WriteEntity_Post + +#ifdef FN_CVarRegister_Post +void FN_CVarRegister_Post(cvar_t *pCvar); +#endif // FN_CVarRegister_Post + +#ifdef FN_CVarGetFloat_Post +float FN_CVarGetFloat_Post(const char *szVarName); +#endif // FN_CVarGetFloat_Post + +#ifdef FN_CVarGetString_Post +const char *FN_CVarGetString_Post(const char *szVarName); +#endif // FN_CVarGetString_Post + +#ifdef FN_CVarSetFloat_Post +void FN_CVarSetFloat_Post(const char *szVarName, float flValue); +#endif // FN_CVarSetFloat_Post + +#ifdef FN_CVarSetString_Post +void FN_CVarSetString_Post(const char *szVarName, const char *szValue); +#endif // FN_CVarSetString_Post + +#ifdef FN_AlertMessage_Post +void FN_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...); +#endif // FN_AlertMessage_Post + +#ifdef FN_EngineFprintf_Post +void FN_EngineFprintf_Post(FILE *pfile, char *szFmt, ...); +#endif // FN_EngineFprintf_Post + +#ifdef FN_PvAllocEntPrivateData_Post +void *FN_PvAllocEntPrivateData_Post(edict_t *pEdict, long cb); +#endif // FN_PvAllocEntPrivateData_Post + +#ifdef FN_PvEntPrivateData_Post +void *FN_PvEntPrivateData_Post(edict_t *pEdict); +#endif // FN_PvEntPrivateData_Post + +#ifdef FN_FreeEntPrivateData_Post +void FN_FreeEntPrivateData_Post(edict_t *pEdict); +#endif // FN_FreeEntPrivateData_Post + +#ifdef FN_SzFromIndex_Post +const char *FN_SzFromIndex_Post(int iString); +#endif // FN_SzFromIndex_Post + +#ifdef FN_AllocString_Post +int FN_AllocString_Post(const char *szValue); +#endif // FN_AllocString_Post + +#ifdef FN_GetVarsOfEnt_Post +struct entvars_s *FN_GetVarsOfEnt_Post(edict_t *pEdict); +#endif // FN_GetVarsOfEnt_Post + +#ifdef FN_PEntityOfEntOffset_Post +edict_t *FN_PEntityOfEntOffset_Post(int iEntOffset); +#endif // FN_PEntityOfEntOffset_Post + +#ifdef FN_EntOffsetOfPEntity_Post +int FN_EntOffsetOfPEntity_Post(const edict_t *pEdict); +#endif // FN_EntOffsetOfPEntity_Post + +#ifdef FN_IndexOfEdict_Post +int FN_IndexOfEdict_Post(const edict_t *pEdict); +#endif // FN_IndexOfEdict_Post + +#ifdef FN_PEntityOfEntIndex_Post +edict_t *FN_PEntityOfEntIndex_Post(int iEntIndex); +#endif // FN_PEntityOfEntIndex_Post + +#ifdef FN_FindEntityByVars_Post +edict_t *FN_FindEntityByVars_Post(struct entvars_s *pvars); +#endif // FN_FindEntityByVars_Post + +#ifdef FN_GetModelPtr_Post +void *FN_GetModelPtr_Post(edict_t *pEdict); +#endif // FN_GetModelPtr_Post + +#ifdef FN_RegUserMsg_Post +int FN_RegUserMsg_Post(const char *pszName, int iSize); +#endif // FN_RegUserMsg_Post + +#ifdef FN_AnimationAutomove_Post +void FN_AnimationAutomove_Post(const edict_t *pEdict, float flTime); +#endif // FN_AnimationAutomove_Post + +#ifdef FN_GetBonePosition_Post +void FN_GetBonePosition_Post(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles); +#endif // FN_GetBonePosition_Post + +#ifdef FN_FunctionFromName_Post +unsigned long FN_FunctionFromName_Post(const char *pName); +#endif // FN_FunctionFromName_Post + +#ifdef FN_NameForFunction_Post +const char *FN_NameForFunction_Post(unsigned long function); +#endif // FN_NameForFunction_Post + +#ifdef FN_ClientPrintf_Post +void FN_ClientPrintf_Post(edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg); +#endif // FN_ClientPrintf_Post + +#ifdef FN_ServerPrint_Post +void FN_ServerPrint_Post(const char *szMsg); +#endif // FN_ServerPrint_Post + +#ifdef FN_Cmd_Args_Post +const char *FN_Cmd_Args_Post(void); +#endif // FN_Cmd_Args_Post + +#ifdef FN_Cmd_Argv_Post +const char *FN_Cmd_Argv_Post(int argc); +#endif // FN_Cmd_Argv_Post + +#ifdef FN_Cmd_Argc_Post +int FN_Cmd_Argc_Post(void); +#endif // FN_Cmd_Argc_Post + +#ifdef FN_GetAttachment_Post +void FN_GetAttachment_Post(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); +#endif // FN_GetAttachment_Post + +#ifdef FN_CRC32_Init_Post +void FN_CRC32_Init_Post(CRC32_t *pulCRC); +#endif // FN_CRC32_Init_Post + +#ifdef FN_CRC32_ProcessBuffer_Post +void FN_CRC32_ProcessBuffer_Post(CRC32_t *pulCRC, void *p, int len); +#endif // FN_CRC32_ProcessBuffer_Post + +#ifdef FN_CRC32_ProcessByte_Post +void FN_CRC32_ProcessByte_Post(CRC32_t *pulCRC, unsigned char ch); +#endif // FN_CRC32_ProcessByte_Post + +#ifdef FN_CRC32_Final_Post +CRC32_t FN_CRC32_Final_Post(CRC32_t pulCRC); +#endif // FN_CRC32_Final_Post + +#ifdef FN_RandomLong_Post +long FN_RandomLong_Post(long lLow, long lHigh); +#endif // FN_RandomLong_Post + +#ifdef FN_RandomFloat_Post +float FN_RandomFloat_Post(float flLow, float flHigh); +#endif // FN_RandomFloat_Post + +#ifdef FN_SetView_Post +void FN_SetView_Post(const edict_t *pClient, const edict_t *pViewent); +#endif // FN_SetView_Post + +#ifdef FN_Time_Post +float FN_Time_Post(void); +#endif // FN_Time_Post + +#ifdef FN_CrosshairAngle_Post +void FN_CrosshairAngle_Post(const edict_t *pClient, float pitch, float yaw); +#endif // FN_CrosshairAngle_Post + +#ifdef FN_LoadFileForMe_Post +byte *FN_LoadFileForMe_Post(char *filename, int *pLength); +#endif // FN_LoadFileForMe_Post + +#ifdef FN_FreeFile_Post +void FN_FreeFile_Post(void *buffer); +#endif // FN_FreeFile_Post + +#ifdef FN_EndSection_Post +void FN_EndSection_Post(const char *pszSectionName); +#endif // FN_EndSection_Post + +#ifdef FN_CompareFileTime_Post +int FN_CompareFileTime_Post(char *filename1, char *filename2, int *iCompare); +#endif // FN_CompareFileTime_Post + +#ifdef FN_GetGameDir_Post +void FN_GetGameDir_Post(char *szGetGameDir); +#endif // FN_GetGameDir_Post + +#ifdef FN_Cvar_RegisterVariable_Post +void FN_Cvar_RegisterVariable_Post(cvar_t *variable); +#endif // FN_Cvar_RegisterVariable_Post + +#ifdef FN_FadeClientVolume_Post +void FN_FadeClientVolume_Post(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); +#endif // FN_FadeClientVolume_Post + +#ifdef FN_SetClientMaxspeed_Post +void FN_SetClientMaxspeed_Post(const edict_t *pEdict, float fNewMaxspeed); +#endif // FN_SetClientMaxspeed_Post + +#ifdef FN_CreateFakeClient_Post +edict_t *FN_CreateFakeClient_Post(const char *netname); +#endif // FN_CreateFakeClient_Post + +#ifdef FN_RunPlayerMove_Post +void FN_RunPlayerMove_Post(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec); +#endif // FN_RunPlayerMove_Post + +#ifdef FN_NumberOfEntities_Post +int FN_NumberOfEntities_Post(void); +#endif // FN_NumberOfEntities_Post + +#ifdef FN_GetInfoKeyBuffer_Post +char *FN_GetInfoKeyBuffer_Post(edict_t *e); +#endif // FN_GetInfoKeyBuffer_Post + +#ifdef FN_InfoKeyValue_Post +char *FN_InfoKeyValue_Post(char *infobuffer, char *key); +#endif // FN_InfoKeyValue_Post + +#ifdef FN_SetKeyValue_Post +void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value); +#endif // FN_SetKeyValue_Post + +#ifdef FN_SetClientKeyValue_Post +void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value); +#endif // FN_SetClientKeyValue_Post + +#ifdef FN_IsMapValid_Post +int FN_IsMapValid_Post(char *filename); +#endif // FN_IsMapValid_Post + +#ifdef FN_StaticDecal_Post +void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, int modelIndex); +#endif // FN_StaticDecal_Post + +#ifdef FN_PrecacheGeneric_Post +int FN_PrecacheGeneric_Post(char *s); +#endif // FN_PrecacheGeneric_Post + +#ifdef FN_GetPlayerUserId_Post +int FN_GetPlayerUserId_Post(edict_t *e ); +#endif // FN_GetPlayerUserId_Post + +#ifdef FN_BuildSoundMsg_Post +void FN_BuildSoundMsg_Post(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +#endif // FN_BuildSoundMsg_Post + +#ifdef FN_IsDedicatedServer_Post +int FN_IsDedicatedServer_Post(void); +#endif // FN_IsDedicatedServer_Post + +#ifdef FN_CVarGetPointer_Post +cvar_t *FN_CVarGetPointer_Post(const char *szVarName); +#endif // FN_CVarGetPointer_Post + +#ifdef FN_GetPlayerWONId_Post +unsigned int FN_GetPlayerWONId_Post(edict_t *e); +#endif // FN_GetPlayerWONId_Post + +#ifdef FN_Info_RemoveKey_Post +void FN_Info_RemoveKey_Post( char *s, const char *key); +#endif // FN_Info_RemoveKey_Post + +#ifdef FN_GetPhysicsKeyValue_Post +const char *FN_GetPhysicsKeyValue_Post(const edict_t *pClient, const char *key); +#endif // FN_GetPhysicsKeyValue_Post + +#ifdef FN_SetPhysicsKeyValue_Post +void FN_SetPhysicsKeyValue_Post(const edict_t *pClient, const char *key, const char *value); +#endif // FN_SetPhysicsKeyValue_Post + +#ifdef FN_GetPhysicsInfoString_Post +const char *FN_GetPhysicsInfoString_Post( const edict_t *pClient); +#endif // FN_GetPhysicsInfoString_Post + +#ifdef FN_PrecacheEvent_Post +unsigned short FN_PrecacheEvent_Post(int type, const char *psz); +#endif // FN_PrecacheEvent_Post + +#ifdef FN_PlaybackEvent_Post +void FN_PlaybackEvent_Post(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); +#endif // FN_PlaybackEvent_Post + +#ifdef FN_SetFatPVS_Post +unsigned char *FN_SetFatPVS_Post(float *org); +#endif // FN_SetFatPVS_Post + +#ifdef FN_SetFatPAS_Post +unsigned char *FN_SetFatPAS_Post(float *org); +#endif // FN_SetFatPAS_Post + +#ifdef FN_CheckVisibility_Post +int FN_CheckVisibility_Post(const edict_t *entity, unsigned char *pset); +#endif // FN_CheckVisibility_Post + +#ifdef FN_DeltaSetField_Post +void FN_DeltaSetField_Post(struct delta_s *pFields, const char *fieldname); +#endif // FN_DeltaSetField_Post + +#ifdef FN_DeltaUnsetField_Post +void FN_DeltaUnsetField_Post(struct delta_s *pFields, const char *fieldname); +#endif // FN_DeltaUnsetField_Post + +#ifdef FN_DeltaAddEncoder_Post +void FN_DeltaAddEncoder_Post(char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); +#endif // FN_DeltaAddEncoder_Post + +#ifdef FN_GetCurrentPlayer_Post +int FN_GetCurrentPlayer_Post(void); +#endif // FN_GetCurrentPlayer_Post + +#ifdef FN_CanSkipPlayer_Post +int FN_CanSkipPlayer_Post(const edict_t *player); +#endif // FN_CanSkipPlayer_Post + +#ifdef FN_DeltaFindField_Post +int FN_DeltaFindField_Post(struct delta_s *pFields, const char *fieldname); +#endif // FN_DeltaFindField_Post + +#ifdef FN_DeltaSetFieldByIndex_Post +void FN_DeltaSetFieldByIndex_Post(struct delta_s *pFields, int fieldNumber); +#endif // FN_DeltaSetFieldByIndex_Post + +#ifdef FN_DeltaUnsetFieldByIndex_Post +void FN_DeltaUnsetFieldByIndex_Post(struct delta_s *pFields, int fieldNumber); +#endif // FN_DeltaUnsetFieldByIndex_Post + +#ifdef FN_SetGroupMask_Post +void FN_SetGroupMask_Post(int mask, int op); +#endif // FN_SetGroupMask_Post + +#ifdef FN_engCreateInstancedBaseline_Post +int FN_engCreateInstancedBaseline_Post(int classname, struct entity_state_s *baseline); +#endif // FN_engCreateInstancedBaseline_Post + +#ifdef FN_Cvar_DirectSet_Post +void FN_Cvar_DirectSet_Post(struct cvar_s *var, char *value); +#endif // FN_Cvar_DirectSet_Post + +#ifdef FN_ForceUnmodified_Post +void FN_ForceUnmodified_Post(FORCE_TYPE type, float *mins, float *maxs, const char *filename); +#endif // FN_ForceUnmodified_Post + +#ifdef FN_GetPlayerStats_Post +void FN_GetPlayerStats_Post(const edict_t *pClient, int *ping, int *packet_loss); +#endif // FN_GetPlayerStats_Post + +#ifdef FN_AddServerCommand_Post +void FN_AddServerCommand_Post(char *cmd_name, void (*function)(void)); +#endif // FN_AddServerCommand_Post + +#ifdef FN_Voice_GetClientListening_Post +qboolean FN_Voice_GetClientListening_Post(int iReceiver, int iSender); +#endif // FN_Voice_GetClientListening_Post + +#ifdef FN_Voice_SetClientListening_Post +qboolean FN_Voice_SetClientListening_Post(int iReceiver, int iSender, qboolean bListen); +#endif // FN_Voice_SetClientListening_Post + +#ifdef FN_GetPlayerAuthId_Post +const char *FN_GetPlayerAuthId_Post(edict_t *e); +#endif // FN_GetPlayerAuthId + + + + +#ifdef FN_OnFreeEntPrivateData +void FN_OnFreeEntPrivateData(edict_t *pEnt); +#endif // FN_OnFreeEntPrivateData + +#ifdef FN_GameShutdown +void FN_GameShutdown(void); +#endif // FN_GameShutdown + +#ifdef FN_ShouldCollide +int FN_ShouldCollide(edict_t *pentTouched, edict_t *pentOther); +#endif // FN_ShouldCollide + + + + + +#ifdef FN_OnFreeEntPrivateData_Post +void FN_OnFreeEntPrivateData_Post(edict_t *pEnt); +#endif // FN_OnFreeEntPrivateData_Post + +#ifdef FN_GameShutdown_Post +void FN_GameShutdown_Post(void); +#endif // FN_GameShutdown_Post + +#ifdef FN_ShouldCollide_Post +int FN_ShouldCollide_Post(edict_t *pentTouched, edict_t *pentOther); +#endif // FN_ShouldCollide_Post + +#endif // USE_METAMOD + + +#ifdef FN_AMXX_QUERY +void FN_AMXX_QUERY(void); +#endif // FN_AMXX_QUERY + +#ifdef FN_AMXX_ATTACH +void FN_AMXX_ATTACH(void); +#endif // FN_AMXX_ATTACH + +#ifdef FN_AMXX_DETACH +void FN_AMXX_DETACH(void); +#endif // FN_AMXX_DETACH + +#ifdef FN_AMXX_PLUGINSLOADED +void FN_AMXX_PLUGINSLOADED(void); +#endif // FN_AMXX_PLUGINSLOADED + +// ***** Module funcs stuff ***** +enum ForwardExecType +{ + ET_IGNORE = 0, // Ignore return vaue + ET_STOP, // Stop on PLUGIN_HANDLED + ET_STOP2, // Stop on PLUGIN_HANDLED, continue on other values, return biggest return value + ET_CONTINUE, // Continue; return biggest return value +}; + +enum ForwardParam +{ + FP_DONE = -1, // specify this as the last argument + // only tells the function that there are no more arguments + FP_CELL, // normal cell + FP_FLOAT, // float; used as normal cell though + FP_STRING, // string + FP_STRINGEX, // string; will be updated to the last function's value + FP_ARRAY, // array; use the return value of prepareArray. +}; + + +typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); +typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); +typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); +typedef const char * (*PFN_GET_MODNAME) (void); +typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/); +typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/); +typedef int (*PFN_FIND_AMXSCRIPT_BYAMX) (const AMX * /*amx*/); +typedef int (*PFN_FIND_AMXSCRIPT_BYNAME) (const char * /*name*/); +typedef int (*PFN_SET_AMXSTRING) (AMX * /*amx*/, cell /*amx_addr*/, const char * /* source */, int /* max */); +typedef char * (*PFN_GET_AMXSTRING) (AMX * /*amx*/, cell /*amx_addr*/, int /*bufferId*/, int * /*pLen*/); +typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr); +typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/); +typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/); +typedef void (*PFN_LOG) (const char * /*fmt*/, ...); +typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...); +typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/); +typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/); +typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/); +typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/); +typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/); +typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/); +typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/); +typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/); +typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/); +typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/); +typedef int (*PFN_IS_PLAYER_INGAME) (int /*id*/); +typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/); +typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/); +typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/); +typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/); +typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/); +typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/); +typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/); +typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/); +typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/); +typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/); +typedef int (*PFN_GET_PLAYER_KEYS) (int /*id*/); +typedef int (*PFN_IS_PLAYER_ALIVE) (int /*id*/); +typedef int (*PFN_GET_PLAYER_FRAGS) (int /*id*/); +typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); +typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); +typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); +typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + +typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, + const unsigned int /*type*/, const size_t /*size*/); +typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, + const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); +typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, + const unsigned int /*type*/, const void* /*addr*/ ); +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); +typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); +typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); +typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); +typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */); +typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/); +typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/); +typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/); +typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/); +typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); +typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); +typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); + +extern PFN_ADD_NATIVES g_fn_AddNatives; +extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_GET_AMXADDR g_fn_GetAmxAddr; +extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; +extern PFN_GET_MODNAME g_fn_GetModname; +extern PFN_GET_AMXSCRIPTNAME g_fn_GetAmxScriptName; +extern PFN_GET_AMXSCRIPT g_fn_GetAmxScript; +extern PFN_FIND_AMXSCRIPT_BYAMX g_fn_FindAmxScriptByAmx; +extern PFN_FIND_AMXSCRIPT_BYNAME g_fn_FindAmxScriptByName; +extern PFN_SET_AMXSTRING g_fn_SetAmxString; +extern PFN_GET_AMXSTRING g_fn_GetAmxString; +extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen; +extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString; +extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory; +extern PFN_LOG g_fn_Log; +extern PFN_LOG_ERROR g_fn_LogErrorFunc; +extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError; +extern PFN_REGISTER_FORWARD g_fn_RegisterForward; +extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward; +extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray; +extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray; +extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA; +extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA; +extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid; +extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName; +extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP; +extern PFN_IS_PLAYER_INGAME g_fn_IsPlayerIngame; +extern PFN_IS_PLAYER_BOT g_fn_IsPlayerBot; +extern PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized; +extern PFN_GET_PLAYER_TIME g_fn_GetPlayerTime; +extern PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime; +extern PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon; +extern PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID; +extern PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths; +extern PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu; +extern PFN_GET_PLAYER_KEYS g_fn_GetPlayerKeys; +extern PFN_IS_PLAYER_ALIVE g_fn_IsPlayerAlive; +extern PFN_GET_PLAYER_FRAGS g_fn_GetPlayerFrags; +extern PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; +extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; +extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; +extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +extern PFN_AMX_EXEC g_fn_AmxExec; +extern PFN_AMX_EXECV g_fn_AmxExecv; +extern PFN_AMX_ALLOT g_fn_AmxAllot; +extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; +extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; +extern PFN_UNLOAD_AMXSCRIPT g_fn_UnloadAmxScript; +extern PFN_REAL_TO_CELL g_fn_RealToCell; +extern PFN_CELL_TO_REAL g_fn_CellToReal; +extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward; +extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; +extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; +extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; +extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; +extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; +extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; + +#ifdef MAY_NEVER_BE_DEFINED +// Function prototypes for intellisense and similar systems +// They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED +int MF_AddNatives (const AMX_NATIVE_INFO *list) { } +char * MF_BuildPathname (const char * format, ...) { } +cell * MF_GetAmxAddr (AMX * amx, cell offset) { } +void MF_PrintSrvConsole (char * format, ...) { } +const char * MF_GetModname (void) { } +const char * MF_GetScriptName (int id) { } +AMX * MF_GetScriptAmx (int id) { } +int MF_FindScriptByAmx (const AMX * amx) { } +int MF_FindScriptByAmx (const char * name) { } +int MF_SetAmxString (AMX * amx, cell amx_addr, const char * source , int max ) { } +char * MF_GetAmxString (AMX * amx, cell amx_addr, int bufferId, int * pLen) { } +int MF_GetAmxStringLen (const cell *ptr) { } +char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { } +void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { } +void MF_Log (const char * fmt, ...) { } +void MF_LogError (AMX * amx, int err, const char *fmt, ...) { } +int MF_RaiseAmxError (AMX * amx, int error) { } +int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { } +int MF_ExecuteForward (int id, ...) { } +cell MF_PrepareCellArray (cell * ptr, unsigned int size) { } +cell MF_PrepareCharArray (char * ptr, unsigned int size) { } +cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { } +cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { } +int MF_IsPlayerValid (int id) { } +const char * MF_GetPlayerName (int id) { } +const char * MF_GetPlayerIP (int id) { } +int MF_IsPlayerIngame (int id) { } +int MF_IsPlayerBot (int id) { } +int MF_IsPlayerAuthorized (int id) { } +float MF_GetPlayerTime (int id) { } +float MF_GetPlayerPlayTime (int id) { } +int MF_GetPlayerCurweapon (int id) { } +const char * MF_GetPlayerTeam (int id) { } +int MF_GetPlayerTeamID (int id) { } +int MF_GetPlayerDeaths (int id) { } +int MF_GetPlayerMenu (int id) { } +int MF_GetPlayerKeys (int id) { } +int MF_IsPlayerAlive (int id) { } +int MF_GetPlayerFrags (int id) { } +int MF_IsPlayerConnecting (int id) { } +int MF_IsPlayerHLTV (int id) { } +int MF_GetPlayerArmor (int id) { } +int MF_GetPlayerHealth (int id) { } +REAL amx_ctof (cell x) { } +cell amx_ftoc (float x) { } +int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } +int MF_RegisterSPForward (AMX * amx, int func, ...) { } +void MF_UnregisterSPForward (int id) { } +int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } +#endif // MAY_NEVER_BE_DEFINED + +#define MF_AddNatives g_fn_AddNatives +#define MF_BuildPathname g_fn_BuildPathname +#define MF_FormatAmxString g_fn_FormatAmxString +#define MF_GetAmxAddr g_fn_GetAmxAddr +#define MF_PrintSrvConsole g_fn_PrintSrvConsole +#define MF_GetModname g_fn_GetModname +#define MF_GetScriptName g_fn_GetAmxScriptName +#define MF_GetScriptAmx g_fn_GetAmxScript +#define MF_FindScriptByAmx g_fn_FindAmxScriptByAmx +#define MF_FindScriptByName g_fn_FindAmxScriptByName +#define MF_SetAmxString g_fn_SetAmxString +#define MF_GetAmxString g_fn_GetAmxString +#define MF_GetAmxStringLen g_fn_GetAmxStringLen +#define MF_CopyAmxMemory g_fn_CopyAmxMemory +void MF_Log(const char *fmt, ...); +void MF_LogError(AMX *amx, int err, const char *fmt, ...); +#define MF_RaiseAmxError g_fn_RaiseAmxError +#define MF_RegisterForward g_fn_RegisterForward +#define MF_ExecuteForward g_fn_ExecuteForward +#define MF_PrepareCellArray g_fn_PrepareCellArray +#define MF_PrepareCharArray g_fn_PrepareCharArray +#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA +#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA +#define MF_IsPlayerValid g_fn_IsPlayerValid +#define MF_GetPlayerName g_fn_GetPlayerName +#define MF_GetPlayerIP g_fn_GetPlayerIP +#define MF_IsPlayerIngame g_fn_IsPlayerIngame +#define MF_IsPlayerBot g_fn_IsPlayerBot +#define MF_IsPlayerAuthorized g_fn_IsPlayerAuthorized +#define MF_GetPlayerTime g_fn_GetPlayerTime +#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime +#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon +#define MF_GetPlayerTeam g_fn_GetPlayerTeam +#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID +#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths +#define MF_GetPlayerMenu g_fn_GetPlayerMenu +#define MF_GetPlayerKeys g_fn_GetPlayerKeys +#define MF_IsPlayerAlive g_fn_IsPlayerAlive +#define MF_GetPlayerFrags g_fn_GetPlayerFrags +#define MF_IsPlayerConnecting g_fn_IsPlayerConnecting +#define MF_IsPlayerHLTV g_fn_IsPlayerHLTV +#define MF_GetPlayerArmor g_fn_GetPlayerArmor +#define MF_GetPlayerHealth g_fn_GetPlayerHealth +#define MF_AmxExec g_fn_AmxExec +#define MF_AmxExecv g_fn_AmxExecv +#define MF_AmxFindPublic g_fn_AmxFindPublic +#define MF_AmxAllot g_fn_AmxAllot +#define MF_AmxFindNative g_fn_AmxFindNative +#define MF_LoadAmxScript g_fn_LoadAmxScript +#define MF_UnloadAmxScript g_fn_UnloadAmxScript +#define MF_MergeDefinitionFile g_fn_MergeDefinition_File +#define amx_ctof g_fn_CellToReal +#define amx_ftoc g_fn_RealToCell +#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName +#define MF_RegisterSPForward g_fn_RegisterSPForward +#define MF_UnregisterSPForward g_fn_UnregisterSPForward +#define MF_GetPlayerFlags g_fn_GetPlayerFlags +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format + +/*** Memory ***/ +void *operator new(size_t reportedSize); +void *operator new[](size_t reportedSize); +void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine); +void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine); +void operator delete(void *reportedAddress); +void operator delete[](void *reportedAddress); + +// Allocation types +extern const unsigned int m_alloc_unknown; +extern const unsigned int m_alloc_new; +extern const unsigned int m_alloc_new_array; +extern const unsigned int m_alloc_malloc; +extern const unsigned int m_alloc_calloc; +extern const unsigned int m_alloc_realloc; +extern const unsigned int m_alloc_delete; +extern const unsigned int m_alloc_delete_array; +extern const unsigned int m_alloc_free; + +// To be called before new / delete +void Mem_SetOwner(const char *filename, int line, const char *function); +// Actual allocator +void * Mem_Allocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, + const unsigned int allocationType, const size_t reportedSize); +void * Mem_Reallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, + const unsigned int reallocationType, const size_t reportedSize, void *reportedAddress); +void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, + const unsigned int deallocationType, void *reportedAddress); + +// memory macros +#ifndef __FUNCTION__ +#define __FUNCTION__ "??" +#endif + +// call Mem_SetOwner, followed by the actual new operator +#define new (Mem_SetOwner(__FILE__,__LINE__,__FUNCTION__),false) ? NULL : new +// call Mem_SetOwner, followed by the actual delete operator +#define delete (Mem_SetOwner(__FILE__,__LINE__,__FUNCTION__),false) ? Mem_SetOwner("",0,"") : delete +#define malloc(sz) Mem_Allocator (__FILE__,__LINE__,__FUNCTION__,m_alloc_malloc,sz) +#define calloc(sz) Mem_Allocator (__FILE__,__LINE__,__FUNCTION__,m_alloc_calloc,sz) +#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) +#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) + +#endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/csx_sql/compile.bat b/dlls/csx_sql/compile.bat new file mode 100755 index 00000000..60e889c2 --- /dev/null +++ b/dlls/csx_sql/compile.bat @@ -0,0 +1,6 @@ +@echo off +PATH=D:\gcc\bin;%PATH% + +make + +pause diff --git a/dlls/csx_sql/extra/include/mysql/config-netware.h b/dlls/csx_sql/extra/include/mysql/config-netware.h new file mode 100755 index 00000000..dab365a7 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/config-netware.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Defines for netware compatible with MySQL */ + +/* required headers */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* required adjustments */ +#undef HAVE_READDIR_R +#undef HAVE_RWLOCK_INIT +#undef HAVE_SCHED_H +#undef HAVE_SYS_MMAN_H +#undef HAVE_SYNCH_H +#undef HAVE_CRYPT +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_PTHREAD_SIGMASK 1 +#define HAVE_PTHREAD_YIELD_ZERO_ARG 1 +#define HAVE_BROKEN_REALPATH 1 + +/* include the old function apis */ +#define USE_OLD_FUNCTIONS 1 + +/* no case sensitivity */ +#define FN_NO_CASE_SENCE 1 + +/* the thread alarm is not used */ +#define DONT_USE_THR_ALARM 1 + +/* signals do not interrupt sockets */ +#define SIGNALS_DONT_BREAK_READ 1 + +/* signal by closing the sockets */ +#define SIGNAL_WITH_VIO_CLOSE 1 + +/* default directory information */ +#define DEFAULT_MYSQL_HOME "sys:/mysql" +#define PACKAGE "mysql" +#define DEFAULT_BASEDIR "sys:/" +#define SHAREDIR "share/" +#define DEFAULT_CHARSET_HOME "sys:/mysql/" +#define DATADIR "data/" + +/* 64-bit file system calls */ +#define SIZEOF_OFF_T 8 +#define off_t off64_t +#define chsize chsize64 +#define ftruncate ftruncate64 +#define lseek lseek64 +#define pread pread64 +#define pwrite pwrite64 +#define tell tell64 + +/* do not use the extended time in LibC sys\stat.h */ +#define _POSIX_SOURCE + +/* Some macros for portability */ + +#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=(SEC); (ABSTIME).tv_nsec=0; } diff --git a/dlls/csx_sql/extra/include/mysql/config-os2.h b/dlls/csx_sql/extra/include/mysql/config-os2.h new file mode 100755 index 00000000..7e9684ae --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/config-os2.h @@ -0,0 +1,832 @@ +/* Copyright (C) 2000 MySQL AB & Yuri Dario + All the above parties has a full, independent copyright to + the following code, including the right to use the code in + any manner without any demands from the other parties. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* Defines for OS2 to make it compatible for MySQL */ + +#ifndef __CONFIG_OS2_H__ +#define __CONFIG_OS2_H__ + +#include +#include +#include +#include + +/* Define to name of system eg solaris*/ +#define SYSTEM_TYPE "IBM OS/2 Warp" +/* Define to machine type name eg sun10 */ +#define MACHINE_TYPE "i686" +/* Name of package */ +#define PACKAGE "mysql" +/* Version number of package */ +#define VERSION MYSQL_SERVER_VERSION +/* Default socket */ +#define MYSQL_UNIX_ADDR "\\socket\\MySQL" + +#define FN_LIBCHAR '\\' +#define FN_ROOTDIR "\\" +#define MY_NFILE 1024 /* This is only used to save filenames */ + +#define HAVE_ACCESS + +#define DEFAULT_MYSQL_HOME "c:\\mysql" +#define DEFAULT_BASEDIR "C:\\" +#define SHAREDIR "share" +#define DEFAULT_CHARSET_HOME "C:/mysql/" +#define _POSIX_PATH_MAX 255 +#define DWORD ULONG + +#define O_SHARE 0x1000 /* Open file in sharing mode */ +#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ +#define S_IROTH S_IREAD /* for my_lib */ + +#define CANT_DELETE_OPEN_FILES /* saves open files in a list, for delayed delete */ + +#define O_NONBLOCK 0x10 + +#define NO_OPEN_3 /* For my_create() */ +#define SIGQUIT SIGTERM /* No SIGQUIT */ +#define SIGALRM 14 /* Alarm */ + +#define NO_FCNTL_NONBLOCK + +#define EFBIG E2BIG +/*#define ENFILE EMFILE */ +/*#define ENAMETOOLONG (EOS2ERR+2) */ +/*#define ETIMEDOUT 145 */ +/*#define EPIPE 146 */ +#define EROFS 147 + +#define sleep(A) DosSleep((A)*1000) +#define closesocket(A) soclose(A) + +#define F_OK 0 +#define W_OK 2 + +#define bzero(x,y) memset((x),'\0',(y)) +#define bcopy(x,y,z) memcpy((y),(x),(z)) +#define bcmp(x,y,z) memcmp((y),(x),(z)) + +#define F_RDLCK 4 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 0 /* Remove lock. */ + +#define S_IFMT 0x17000 /* Mask for file type */ +#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ + +#define HUGE_PTR + +#ifdef __cplusplus +extern "C" +#endif +double _cdecl rint( double nr); + +DWORD TlsAlloc( void); +BOOL TlsFree( DWORD); +PVOID TlsGetValue( DWORD); +BOOL TlsSetValue( DWORD, PVOID); + +/* support for > 2GB file size */ +#define SIZEOF_OFF_T 8 +#define lseek(A,B,C) _lseek64( A, B, C) +#define tell(A) _lseek64( A, 0, SEEK_CUR) + +void* dlopen( char* path, int flag); +char* dlerror( void); +void* dlsym( void* hmod, char* fn); +void dlclose( void* hmod); + +/* Some typedefs */ +typedef unsigned long long os_off_t; + +/* config.h. Generated automatically by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +/* #undef C_ALLOCA */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +/* #undef CRAY_STACKSEG_END */ + +/* Define if you have alloca, as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define if you have and it should be used (not on Ultrix). */ +/* #define HAVE_ALLOCA_H 1 */ + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if you have a working `mmap' system call. */ +/* #undef HAVE_MMAP */ + +/* Define if system calls automatically restart after interruption + by a signal. */ +/* #undef HAVE_RESTARTABLE_SYSCALLS */ + +/* Define if your struct stat has st_rdev. */ +#define HAVE_ST_RDEV 1 + +/* Define if you have that is POSIX.1 compatible. */ +/* #define HAVE_SYS_WAIT_H 1 */ + +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#define HAVE_TZNAME 1 + +/* Define if utime(file, NULL) sets file's timestamp to the present. */ +#define HAVE_UTIME_NULL 1 + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define as __inline if that's what the C compiler calls it. */ +/* #undef inline */ + +/* Define to `long' if doesn't define. */ +/* #undef off_t */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#define STACK_DIRECTION -1 + +/* Define if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if your declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Version of .frm files */ +#define DOT_FRM_VERSION 6 + +/* READLINE: */ +#define FIONREAD_IN_SYS_IOCTL 1 + +/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ +/* #undef GWINSZ_IN_SYS_IOCTL */ + +/* Do we have FIONREAD */ +#define FIONREAD_IN_SYS_IOCTL 1 + +/* atomic_add() from (Linux only) */ +/* #undef HAVE_ATOMIC_ADD */ + +/* atomic_sub() from (Linux only) */ +/* #undef HAVE_ATOMIC_SUB */ + +/* bool is not defined by all C++ compilators */ +#define HAVE_BOOL 1 + +/* Have berkeley db installed */ +/* #define HAVE_BERKELEY_DB 1 */ + +/* DSB style signals ? */ +/* #undef HAVE_BSD_SIGNALS */ + +/* Can netinet be included */ +/* #undef HAVE_BROKEN_NETINET_INCLUDES */ + +/* READLINE: */ +/* #undef HAVE_BSD_SIGNALS */ + +/* ZLIB and compress: */ +#define HAVE_COMPRESS 1 + +/* Define if we are using OSF1 DEC threads */ +/* #undef HAVE_DEC_THREADS */ + +/* Define if we are using OSF1 DEC threads on 3.2 */ +/* #undef HAVE_DEC_3_2_THREADS */ + +/* fp_except from ieeefp.h */ +/* #undef HAVE_FP_EXCEPT */ + +/* READLINE: */ +/* #undef HAVE_GETPW_DECLS */ + +/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines + this with 6 arguments */ +/* #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE */ + +/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */ +/* #undef HAVE_GETHOSTBYNAME_R_RETURN_INT */ + +/* Define if int8, int16 and int32 types exist */ +/* #undef HAVE_INT_8_16_32 */ + +/* Define if have -lwrap */ +/* #undef HAVE_LIBWRAP */ + +/* Define if we are using Xavier Leroy's LinuxThreads */ +/* #undef HAVE_LINUXTHREADS */ + +/* Do we use user level threads */ +/* #undef HAVE_mit_thread */ + +/* For some non posix threads */ +/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */ + +/* For some non posix threads */ +/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ + +/* READLINE: */ +#define HAVE_POSIX_SIGNALS 0 + +/* sigwait with one argument */ +/* #undef HAVE_NONPOSIX_SIGWAIT */ + +/* pthread_attr_setscope */ +#define HAVE_PTHREAD_ATTR_SETSCOPE 1 + +/* POSIX readdir_r */ +/* #undef HAVE_READDIR_R */ + +/* POSIX sigwait */ +/* #undef HAVE_SIGWAIT */ + +/* crypt */ +#define HAVE_CRYPT 1 + +/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines + this with 8 arguments */ +/* #undef HAVE_SOLARIS_STYLE_GETHOST */ + +/* Timespec has a ts_sec instead of tv_sev */ +#define HAVE_TIMESPEC_TS_SEC 1 + +/* Have the tzname variable */ +#define HAVE_TZNAME 1 + +/* Define if the system files define uchar */ +/* #undef HAVE_UCHAR */ + +/* Define if the system files define uint */ +/* #undef HAVE_UINT */ + +/* Define if the system files define ulong */ +/* #undef HAVE_ULONG */ + +/* UNIXWARE7 threads are not posix */ +/* #undef HAVE_UNIXWARE7_THREADS */ + +/* new UNIXWARE7 threads that are not yet posix */ +/* #undef HAVE_UNIXWARE7_POSIX */ + +/* READLINE: */ +/* #undef HAVE_USG_SIGHOLD */ + +/* Define if want -lwrap */ +/* #undef LIBWRAP */ + +/* mysql client protocoll version */ +#define PROTOCOL_VERSION 10 + +/* Define if qsort returns void */ +#define QSORT_TYPE_IS_VOID 1 + +/* Define as the return type of qsort (int or void). */ +#define RETQSORTTYPE void + +/* Define as the base type of the last arg to accept */ +#define SOCKET_SIZE_TYPE int + +/* Last argument to get/setsockopt */ +/* #undef SOCKOPT_OPTLEN_TYPE */ + +/* #undef SPEED_T_IN_SYS_TYPES */ +/* #undef SPRINTF_RETURNS_PTR */ +#define SPRINTF_RETURNS_INT 1 +/* #undef SPRINTF_RETURNS_GARBAGE */ + +/* #undef STRUCT_DIRENT_HAS_D_FILENO */ +#define STRUCT_DIRENT_HAS_D_INO 1 + +/* Define if you want to have threaded code. This may be undef on client code */ +#define THREAD 1 + +/* Should be client be thread safe */ +/* #undef THREAD_SAFE_CLIENT */ + +/* READLINE: */ +/* #undef TIOCSTAT_IN_SYS_IOCTL */ + +/* Use multi-byte character routines */ +/* #undef USE_MB */ +/* #undef USE_MB_IDENT */ + +/* Use MySQL RAID */ +/* #undef USE_RAID */ + +/* Use strcoll() functions when comparing and sorting. */ +/* #undef USE_STRCOLL */ + +/* READLINE: */ +#define VOID_SIGHANDLER 1 + +/* The number of bytes in a char. */ +#define SIZEOF_CHAR 1 + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a long long. */ +#define SIZEOF_LONG_LONG 8 + +/* Define if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the atod function. */ +/* #undef HAVE_ATOD */ + +/* Define if you have the bcmp function. */ +#define HAVE_BCMP 1 + +/* Define if you have the bfill function. */ +/* #undef HAVE_BFILL */ + +/* Define if you have the bmove function. */ +/* #undef HAVE_BMOVE */ + +/* Define if you have the bzero function. */ +#define HAVE_BZERO 1 + +/* Define if you have the chsize function. */ +#define HAVE_CHSIZE 1 + +/* Define if you have the cuserid function. */ +/* #define HAVE_CUSERID 1 */ + +/* Define if you have the dlerror function. */ +#define HAVE_DLERROR 1 + +/* Define if you have the dlopen function. */ +#define HAVE_DLOPEN 1 + +/* Define if you have the fchmod function. */ +/* #undef HAVE_FCHMOD */ + +/* Define if you have the fcntl function. */ +/* #define HAVE_FCNTL 1 */ + +/* Define if you have the fconvert function. */ +/* #undef HAVE_FCONVERT */ + +/* Define if you have the finite function. */ +/* #undef HAVE_FINITE */ + +/* Define if you have the fpresetsticky function. */ +/* #undef HAVE_FPRESETSTICKY */ + +/* Define if you have the fpsetmask function. */ +/* #undef HAVE_FPSETMASK */ + +/* Define if you have the fseeko function. */ +/* #undef HAVE_FSEEKO */ + +/* Define if you have the ftruncate function. */ +/* #define HAVE_FTRUNCATE 1 */ + +/* Define if you have the getcwd function. */ +#define HAVE_GETCWD 1 + +/* Define if you have the gethostbyaddr_r function. */ +/* #undef HAVE_GETHOSTBYADDR_R */ + +/* Define if you have the gethostbyname_r function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* Define if you have the getpagesize function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define if you have the getpass function. */ +/*#define HAVE_GETPASS 1 */ + +/* Define if you have the getpassphrase function. */ +/* #undef HAVE_GETPASSPHRASE */ + +/* Define if you have the getpwnam function. */ +/* #define HAVE_GETPWNAM 1 */ + +/* Define if you have the getpwuid function. */ +/* #define HAVE_GETPWUID 1 */ + +/* Define if you have the getrlimit function. */ +/* #undef HAVE_GETRLIMIT */ + +/* Define if you have the getrusage function. */ +/* #undef HAVE_GETRUSAGE */ + +/* Define if you have the getwd function. */ +#define HAVE_GETWD 1 + +/* Define if you have the index function. */ +#define HAVE_INDEX 1 + +/* Define if you have the initgroups function. */ +/* #undef HAVE_INITGROUPS */ + +/* Define if you have the localtime_r function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define if you have the locking function. */ +/* #undef HAVE_LOCKING */ + +/* Define if you have the longjmp function. */ +#define HAVE_LONGJMP 1 + +/* Define if you have the lrand48 function. */ +/* #undef HAVE_LRAND48 */ + +/* Define if you have the lstat function. */ +/* #undef HAVE_LSTAT */ + +/* Define if you have the madvise function. */ +/* #undef HAVE_MADVISE */ + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the memmove function. */ +#define HAVE_MEMMOVE 1 + +/* Define if you have the mkstemp function. */ +/* #define HAVE_MKSTEMP 1 */ + +/* Define if you have the mlockall function. */ +/* #undef HAVE_MLOCKALL */ + +/* Define if you have the perror function. */ +#define HAVE_PERROR 1 + +/* Define if you have the poll function. */ +/* #undef HAVE_POLL */ + +/* Define if you have the pread function. */ +/* #undef HAVE_PREAD */ + +/* Define if you have the pthread_attr_create function. */ +/* #undef HAVE_PTHREAD_ATTR_CREATE */ + +/* Define if you have the pthread_attr_setprio function. */ +#define HAVE_PTHREAD_ATTR_SETPRIO 1 + +/* Define if you have the pthread_attr_setschedparam function. */ +/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */ + +/* Define if you have the pthread_attr_setstacksize function. */ +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 + +/* Define if you have the pthread_condattr_create function. */ +/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ + +/* Define if you have the pthread_getsequence_np function. */ +/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */ + +/* Define if you have the pthread_init function. */ +/* #undef HAVE_PTHREAD_INIT */ + +/* Define if you have the pthread_rwlock_rdlock function. */ +/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ + +/* Define if you have the pthread_setprio function. */ +#define HAVE_PTHREAD_SETPRIO 1 + +/* Define if you have the pthread_setprio_np function. */ +/* #undef HAVE_PTHREAD_SETPRIO_NP */ + +/* Define if you have the pthread_setschedparam function. */ +/* #undef HAVE_PTHREAD_SETSCHEDPARAM */ + +/* Define if you have the pthread_sigmask function. */ +#define HAVE_PTHREAD_SIGMASK 1 + +/* Define if you have the putenv function. */ +#define HAVE_PUTENV 1 + +/* Define if you have the readlink function. */ +/* #undef HAVE_READLINK */ + +/* Define if you have the realpath function. */ +/* #undef HAVE_REALPATH */ + +/* Define if you have the rename function. */ +#define HAVE_RENAME 1 + +/* Define if you have the rint function. */ +#define HAVE_RINT 1 + +/* Define if you have the rwlock_init function. */ +/* #undef HAVE_RWLOCK_INIT */ + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setenv function. */ +/* #undef HAVE_SETENV */ + +/* Define if you have the setlocale function. */ +#define HAVE_SETLOCALE 1 + +/* Define if you have the setupterm function. */ +/* #undef HAVE_SETUPTERM */ + +/* Define if you have the sighold function. */ +/* #undef HAVE_SIGHOLD */ + +/* Define if you have the sigset function. */ +/* #undef HAVE_SIGSET */ + +/* Define if you have the sigthreadmask function. */ +/* #undef HAVE_SIGTHREADMASK */ + +/* Define if you have the snprintf function. */ +/* #define HAVE_SNPRINTF 1 */ + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the stpcpy function. */ +/* #undef HAVE_STPCPY */ + +/* Define if you have the strcasecmp function. */ +/* #undef HAVE_STRCASECMP */ + +/* Define if you have the strcoll function. */ +#define HAVE_STRCOLL 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the strnlen function. */ +/* #undef HAVE_STRNLEN */ + +/* Define if you have the strpbrk function. */ +#define HAVE_STRPBRK 1 + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the strtok_r function. */ +/* #undef HAVE_STRTOK_R */ + +/* Define if you have the strtol function. */ +#define HAVE_STRTOL 1 + +/* Define if you have the strtoul function. */ +#define HAVE_STRTOUL 1 + +/* Define if you have the strtoull function. */ +/* #undef HAVE_STRTOULL */ + +/* Define if you have the tcgetattr function. */ +#define HAVE_TCGETATTR 1 + +/* Define if you have the tell function. */ +#define HAVE_TELL 1 + +/* Define if you have the tempnam function. */ +#define HAVE_TEMPNAM 1 + +/* Define if you have the thr_setconcurrency function. */ +/* #undef HAVE_THR_SETCONCURRENCY */ + +/* Define if you have the vidattr function. */ +/* #undef HAVE_VIDATTR */ + +/* Define if you have the header file. */ +/* #define HAVE_ALLOCA_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ASM_TERMBITS_H */ + +/* Define if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_CURSES_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_DIRENT_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_FLOATINGPOINT_H */ + +/* Define if you have the header file. */ +/* #define HAVE_GRP_H 1 */ + +/* Define if you have the header file. */ +/* #undef HAVE_IEEEFP_H */ + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_NDIR_H */ + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_PATHS_H */ + +/* Define if you have the header file. */ +/* #define HAVE_PWD_H 1 */ + +/* Define if you have the header file. */ +/* #undef HAVE_SCHED_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SELECT_H */ + +/* Define if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_STRINGS_H 1 */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYNCH_H */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_DIR_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_FILE_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_MMAN_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PTE_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PTEM_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_STREAM_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_VADVISE_H */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_WAIT_H 1 */ + +/* Define if you have the header file. */ +/* #undef HAVE_TERM_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_TERMBITS_H */ + +/* Define if you have the header file. */ +/* #define HAVE_TERMCAP_H 1 */ + +/* Define if you have the header file. */ +/* /#define HAVE_TERMIO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_VARARGS_H 1 + +/* Define if you have the bind library (-lbind). */ +/* #undef HAVE_LIBBIND */ + +/* Define if you have the c_r library (-lc_r). */ +/* #undef HAVE_LIBC_R */ + +/* Define if you have the compat library (-lcompat). */ +/* #undef HAVE_LIBCOMPAT */ + +/* Define if you have the crypt library (-lcrypt). */ +#define HAVE_LIBCRYPT 1 + +/* Define if you have the dl library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Define if you have the gen library (-lgen). */ +/* #undef HAVE_LIBGEN */ + +/* Define if you have the m library (-lm). */ +#define HAVE_LIBM 1 + +/* Define if you have the nsl library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define if you have the nsl_r library (-lnsl_r). */ +/* #undef HAVE_LIBNSL_R */ + +/* Define if you have the pthread library (-lpthread). */ +/* #undef HAVE_LIBPTHREAD */ + +/* Define if you have the socket library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to make fseeko etc. visible, on some hosts. */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +#endif /* __CONFIG_OS2_H__ */ diff --git a/dlls/csx_sql/extra/include/mysql/config-win.h b/dlls/csx_sql/extra/include/mysql/config-win.h new file mode 100755 index 00000000..e6f03a10 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/config-win.h @@ -0,0 +1,335 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Defines for Win32 to make it compatible for MySQL */ + +#include +#include +#include /* Because of rint() */ +#include +#include +#include + +#if defined(__NT__) +#define SYSTEM_TYPE "NT" +#elif defined(__WIN2000__) +#define SYSTEM_TYPE "WIN2000" +#else +#define SYSTEM_TYPE "Win95/Win98" +#endif + +#if defined(_WIN64) || defined(WIN64) +#define MACHINE_TYPE "ia64" /* Define to machine type name */ +#else +#define MACHINE_TYPE "i32" /* Define to machine type name */ +#ifndef _WIN32 +#define _WIN32 /* Compatible with old source */ +#endif +#ifndef __WIN32__ +#define __WIN32__ +#endif +#endif /* _WIN64 */ +#ifndef __WIN__ +#define __WIN__ /* To make it easier in VC++ */ +#endif + +/* File and lock constants */ +#define O_SHARE 0x1000 /* Open file in sharing mode */ +#ifdef __BORLANDC__ +#define F_RDLCK LK_NBLCK /* read lock */ +#define F_WRLCK LK_NBRLCK /* write lock */ +#define F_UNLCK LK_UNLCK /* remove lock(s) */ +#else +#define F_RDLCK _LK_NBLCK /* read lock */ +#define F_WRLCK _LK_NBRLCK /* write lock */ +#define F_UNLCK _LK_UNLCK /* remove lock(s) */ +#endif + +#define F_EXCLUSIVE 1 /* We have only exclusive locking */ +#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */ +#define F_OK 0 /* parameter to access() */ + +#define S_IROTH S_IREAD /* for my_lib */ + +#ifdef __BORLANDC__ +#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ +#define O_TEMPORARY 0 +#define O_SHORT_LIVED 0 +#define SH_DENYNO _SH_DENYNO +#else +#define O_BINARY _O_BINARY /* compability with MSDOS */ +#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */ +#define O_TEMPORARY _O_TEMPORARY +#define O_SHORT_LIVED _O_SHORT_LIVED +#define SH_DENYNO _SH_DENYNO +#endif +#define NO_OPEN_3 /* For my_create() */ + +#define SIGQUIT SIGTERM /* No SIGQUIT */ + +#undef _REENTRANT /* Crashes something for win32 */ +#undef SAFE_MUTEX /* Can't be used on windows */ + +#define LONGLONG_MIN ((__int64) 0x8000000000000000) +#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF) +#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF) +#define LL(A) ((__int64) A) + +/* Type information */ + +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ +typedef __int64 longlong; +typedef int sigset_t; +#define longlong_defined +/* off_t should not be __int64 because of conflicts in header files; + Use my_off_t or os_off_t instead */ +typedef long off_t; +typedef __int64 os_off_t; +#ifdef _WIN64 +typedef UINT_PTR rf_SetTimer; +#else +typedef unsigned int size_t; +typedef uint rf_SetTimer; +#endif + +#define Socket_defined +#define my_socket SOCKET +#define bool BOOL +#define SIGPIPE SIGINT +#define RETQSORTTYPE void +#define QSORT_TYPE_IS_VOID +#define RETSIGTYPE void +#define SOCKET_SIZE_TYPE int +#define my_socket_defined +#define bool_defined +#define byte_defined +#define HUGE_PTR +#define STDCALL __stdcall /* Used by libmysql.dll */ +#define isnan(X) _isnan(X) +#define finite(X) _finite(X) + +#ifndef UNDEF_THREAD_HACK +#define THREAD +#endif +#define VOID_SIGHANDLER +#define SIZEOF_CHAR 1 +#define SIZEOF_LONG 4 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_OFF_T 8 +#ifdef _WIN64 +#define SIZEOF_CHARP 8 +#else +#define SIZEOF_CHARP 4 +#endif +#define HAVE_BROKEN_NETINET_INCLUDES +#ifdef __NT__ +#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ +#endif + +/* We need to close files to break connections on shutdown */ +#ifndef SIGNAL_WITH_VIO_CLOSE +#define SIGNAL_WITH_VIO_CLOSE +#endif + +/* Use all character sets in MySQL */ +#define USE_MB 1 +#define USE_MB_IDENT 1 +#define USE_STRCOLL 1 + +/* All windows servers should support .sym files */ +#undef USE_SYMDIR +#define USE_SYMDIR + +/* If LOAD DATA LOCAL INFILE should be enabled by default */ +#define ENABLED_LOCAL_INFILE 1 + +/* Convert some simple functions to Posix */ + +#define sigset(A,B) signal((A),(B)) +#define finite(A) _finite(A) +#define sleep(A) Sleep((A)*1000) + +#ifndef __BORLANDC__ +#define access(A,B) _access(A,B) +#endif + +#if defined(__cplusplus) + +inline double rint(double nr) +{ + double f = floor(nr); + double c = ceil(nr); + return (((c-nr) >= (nr-f)) ? f :c); +} + +#ifdef _WIN64 +#define ulonglong2double(A) ((double) (ulonglong) (A)) +#define my_off_t2double(A) ((double) (my_off_t) (A)) + +#else +inline double ulonglong2double(ulonglong value) +{ + longlong nr=(longlong) value; + if (nr >= 0) + return (double) nr; + return (18446744073709551616.0 + (double) nr); +} +#define my_off_t2double(A) ulonglong2double(A) +#endif /* _WIN64 */ +#else +#define inline __inline +#endif /* __cplusplus */ + +#if SIZEOF_OFF_T > 4 +#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) +#define tell(A) _telli64(A) +#endif + +#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; } + +#define STACK_DIRECTION -1 + +/* Optimized store functions for Intel x86 */ + +#ifndef _WIN64 +#define sint2korr(A) (*((int16 *) (A))) +#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0])) : \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0]))) +#define sint4korr(A) (*((long *) (A))) +#define uint2korr(A) (*((uint16 *) (A))) +#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF) +#define uint4korr(A) (*((unsigned long *) (A))) +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint8korr(A) (*((ulonglong *) (A))) +#define sint8korr(A) (*((longlong *) (A))) +#define int2store(T,A) *((uint16*) (T))= (uint16) (A) +#define int3store(T,A) { *(T)= (uchar) ((A));\ + *(T+1)=(uchar) (((uint) (A) >> 8));\ + *(T+2)=(uchar) (((A) >> 16)); } +#define int4store(T,A) *((long *) (T))= (long) (A) +#define int5store(T,A) { *(T)= (uchar)((A));\ + *((T)+1)=(uchar) (((A) >> 8));\ + *((T)+2)=(uchar) (((A) >> 16));\ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); } +#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) + +#define doubleget(V,M) { *((long *) &V) = *((long*) M); \ + *(((long *) &V)+1) = *(((long*) M)+1); } +#define doublestore(T,V) { *((long *) T) = *((long*) &V); \ + *(((long *) T)+1) = *(((long*) &V)+1); } +#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); } +#define float8get(V,M) doubleget((V),(M)) +#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float)) +#define float8store(V,M) doublestore((V),(M)) +#endif /* _WIN64 */ + +#define HAVE_PERROR +#define HAVE_VFPRINT +#define HAVE_RENAME /* Have rename() as function */ +#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */ +#define HAVE_LONG_JMP /* Have long jump function */ +#define HAVE_LOCKING /* have locking() call */ +#define HAVE_ERRNO_AS_DEFINE /* errno is a define */ +#define HAVE_STDLIB /* everything is include in this file */ +#define HAVE_MEMCPY +#define HAVE_MEMMOVE +#define HAVE_GETCWD +#define HAVE_TELL +#define HAVE_TZNAME +#define HAVE_PUTENV +#define HAVE_SELECT +#define HAVE_SETLOCALE +#define HAVE_SOCKET /* Giangi */ +#define HAVE_FLOAT_H +#define HAVE_LIMITS_H +#define HAVE_STDDEF_H +#define HAVE_RINT /* defined in this file */ +#define NO_FCNTL_NONBLOCK /* No FCNTL */ +#define HAVE_ALLOCA +#define HAVE_STRPBRK +#define HAVE_STRSTR +#define HAVE_COMPRESS +#define HAVE_CREATESEMAPHORE +#define HAVE_ISNAN +#define HAVE_FINITE +#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */ +#define HAVE_QUERY_CACHE +#define SPRINTF_RETURNS_INT +#define HAVE_SETFILEPOINTER + +#ifdef NOT_USED +#define HAVE_SNPRINTF /* Gave link error */ +#define _snprintf snprintf +#endif + +#ifdef _MSC_VER +#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */ +#define HAVE_ANSI_INCLUDE +#define HAVE_SYS_UTIME_H +#define HAVE_STRTOUL +#endif +#define my_reinterpret_cast(A) reinterpret_cast +#define my_const_cast(A) const_cast + + +/* MYSQL OPTIONS */ + +#ifdef _CUSTOMCONFIG_ +#include +#else +#define DEFAULT_MYSQL_HOME "c:\\mysql" +#define PACKAGE "mysql" +#define DEFAULT_BASEDIR "C:\\" +#define SHAREDIR "share" +#define DEFAULT_CHARSET_HOME "C:/mysql/" +#endif + +/* File name handling */ + +#define FN_LIBCHAR '\\' +#define FN_ROOTDIR "\\" +#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ +#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ +#define MY_NFILE 1024 + +#define DO_NOT_REMOVE_THREAD_WRAPPERS +#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) +/* The following is only used for statistics, so it should be good enough */ +#ifdef __NT__ /* This should also work on Win98 but .. */ +#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) +#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) +#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) +#else +#define thread_safe_add(V,C,L) \ + pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L)); +#define thread_safe_sub(V,C,L) \ + pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L)); +#define statistic_add(V,C,L) (V)+=(C) +#endif +#define statistic_increment(V,L) thread_safe_increment((V),(L)) diff --git a/dlls/csx_sql/extra/include/mysql/dbug.h b/dlls/csx_sql/extra/include/mysql/dbug.h new file mode 100755 index 00000000..5c88e2e4 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/dbug.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _dbug_h +#define _dbug_h +#ifdef __cplusplus +extern "C" { +#endif +#if !defined(DBUG_OFF) && !defined(_lint) +extern int _db_on_,_no_db_; +extern FILE *_db_fp_; +extern char *_db_process_; +extern int _db_keyword_(const char *keyword); +extern void _db_setjmp_(void); +extern void _db_longjmp_(void); +extern void _db_push_(const char *control); +extern void _db_pop_(void); +extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, + const char **_sfunc_,const char **_sfile_, + uint *_slevel_, char ***); +extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, + uint *_slevel_); +extern void _db_pargs_(uint _line_,const char *keyword); +extern void _db_doprnt_ _VARARGS((const char *format,...)); +extern void _db_dump_(uint _line_,const char *keyword,const char *memory, + uint length); +extern void _db_lock_file(); +extern void _db_unlock_file(); + +#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ + char **_db_framep_; \ + _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ + &_db_framep_) +#define DBUG_LEAVE \ + (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)) +#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);} +#define DBUG_VOID_RETURN {DBUG_LEAVE; return;} +#define DBUG_EXECUTE(keyword,a1) \ + {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} +#define DBUG_PRINT(keyword,arglist) \ + {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} +#define DBUG_PUSH(a1) _db_push_ (a1) +#define DBUG_POP() _db_pop_ () +#define DBUG_PROCESS(a1) (_db_process_ = a1) +#define DBUG_FILE (_db_fp_) +#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) +#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) +#define DBUG_DUMP(keyword,a1,a2)\ + {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}} +#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr) +#define DEBUGGER_OFF _no_db_=1;_db_on_=0; +#define DEBUGGER_ON _no_db_=0 +#define DBUG_LOCK_FILE { _db_lock_file(); } +#define DBUG_UNLOCK_FILE { _db_unlock_file(); } +#define DBUG_ASSERT(A) assert(A) +#else /* No debugger */ + +#define DBUG_ENTER(a1) +#define DBUG_RETURN(a1) return(a1) +#define DBUG_VOID_RETURN return +#define DBUG_EXECUTE(keyword,a1) {} +#define DBUG_PRINT(keyword,arglist) {} +#define DBUG_PUSH(a1) {} +#define DBUG_POP() {} +#define DBUG_PROCESS(a1) {} +#define DBUG_FILE (stderr) +#define DBUG_SETJMP setjmp +#define DBUG_LONGJMP longjmp +#define DBUG_DUMP(keyword,a1,a2) {} +#define DBUG_IN_USE 0 +#define DEBUGGER_OFF +#define DEBUGGER_ON +#define DBUG_LOCK_FILE +#define DBUG_UNLOCK_FILE +#define DBUG_ASSERT(A) {} +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/errmsg.h b/dlls/csx_sql/extra/include/mysql/errmsg.h new file mode 100755 index 00000000..5136af5b --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/errmsg.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Error messages for mysql clients */ +/* error messages for the demon is in share/language/errmsg.sys */ + +#ifdef __cplusplus +extern "C" { +#endif +void init_client_errs(void); +extern const char *client_errors[]; /* Error messages */ +#ifdef __cplusplus +} +#endif + +#define CR_MIN_ERROR 2000 /* For easier client code */ +#define CR_MAX_ERROR 2999 +#if defined(OS2) && defined(MYSQL_SERVER) +#define CER(X) client_errors[(X)-CR_MIN_ERROR] +#else +#define ER(X) client_errors[(X)-CR_MIN_ERROR] +#endif +#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ + +#define CR_UNKNOWN_ERROR 2000 +#define CR_SOCKET_CREATE_ERROR 2001 +#define CR_CONNECTION_ERROR 2002 +#define CR_CONN_HOST_ERROR 2003 +#define CR_IPSOCK_ERROR 2004 +#define CR_UNKNOWN_HOST 2005 +#define CR_SERVER_GONE_ERROR 2006 +#define CR_VERSION_ERROR 2007 +#define CR_OUT_OF_MEMORY 2008 +#define CR_WRONG_HOST_INFO 2009 +#define CR_LOCALHOST_CONNECTION 2010 +#define CR_TCP_CONNECTION 2011 +#define CR_SERVER_HANDSHAKE_ERR 2012 +#define CR_SERVER_LOST 2013 +#define CR_COMMANDS_OUT_OF_SYNC 2014 +#define CR_NAMEDPIPE_CONNECTION 2015 +#define CR_NAMEDPIPEWAIT_ERROR 2016 +#define CR_NAMEDPIPEOPEN_ERROR 2017 +#define CR_NAMEDPIPESETSTATE_ERROR 2018 +#define CR_CANT_READ_CHARSET 2019 +#define CR_NET_PACKET_TOO_LARGE 2020 +#define CR_EMBEDDED_CONNECTION 2021 +#define CR_PROBE_SLAVE_STATUS 2022 +#define CR_PROBE_SLAVE_HOSTS 2023 +#define CR_PROBE_SLAVE_CONNECT 2024 +#define CR_PROBE_MASTER_CONNECT 2025 +#define CR_SSL_CONNECTION_ERROR 2026 +#define CR_MALFORMED_PACKET 2027 + diff --git a/dlls/csx_sql/extra/include/mysql/ft_global.h b/dlls/csx_sql/extra/include/mysql/ft_global.h new file mode 100755 index 00000000..9acdf6aa --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/ft_global.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Written by Sergei A. Golubchik, who has a shared copyright to this code */ + +/* some definitions for full-text indices */ + +/* #include "myisam.h" */ + +#ifndef _ft_global_h +#define _ft_global_h +#ifdef __cplusplus +extern "C" { +#endif + +#define FT_QUERY_MAXLEN 1024 +#define HA_FT_MAXLEN 254 + +typedef struct st_ft_info FT_INFO; +struct _ft_vft +{ + int (*read_next)(FT_INFO *, char *); + float (*find_relevance)(FT_INFO *, byte *, uint); + void (*close_search)(FT_INFO *); + float (*get_relevance)(FT_INFO *); + void (*reinit_search)(FT_INFO *); +}; + +#ifndef FT_CORE +struct st_ft_info +{ + struct _ft_vft *please; /* INTERCAL style :-) */ +}; +#endif + +extern const char *ft_stopword_file; +extern const char *ft_precompiled_stopwords[]; + +extern ulong ft_min_word_len; +extern ulong ft_max_word_len; +extern ulong ft_max_word_len_for_sort; +extern const char *ft_boolean_syntax; + +int ft_init_stopwords(void); +void ft_free_stopwords(void); + +#define FT_NL 0 +#define FT_BOOL 1 +FT_INFO *ft_init_search(uint,void *, uint, byte *, uint, my_bool); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/hash.h b/dlls/csx_sql/extra/include/mysql/hash.h new file mode 100755 index 00000000..e9c8c73c --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/hash.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Dynamic hashing of record with different key-length */ + +#ifndef _hash_h +#define _hash_h +#ifdef __cplusplus +extern "C" { +#endif + +typedef byte *(*hash_get_key)(const byte *,uint*,my_bool); +typedef void (*hash_free_key)(void *); + + /* flags for hash_init */ +#define HASH_CASE_INSENSITIVE 1 + +typedef struct st_hash_info { + uint next; /* index to next key */ + byte *data; /* data for current entry */ +} HASH_LINK; + +typedef struct st_hash { + uint key_offset,key_length; /* Length of key if const length */ + uint records,blength,current_record; + uint flags; + DYNAMIC_ARRAY array; /* Place for hash_keys */ + hash_get_key get_key; + void (*free)(void *); + uint (*calc_hashnr)(const byte *key,uint length); +} HASH; + +#define hash_init(A,B,C,D,E,F,G) _hash_init(A,B,C,D,E,F,G CALLER_INFO) +my_bool _hash_init(HASH *hash,uint default_array_elements, uint key_offset, + uint key_length, hash_get_key get_key, + void (*free_element)(void*), uint flags CALLER_INFO_PROTO); +void hash_free(HASH *tree); +byte *hash_element(HASH *hash,uint idx); +gptr hash_search(HASH *info,const byte *key,uint length); +gptr hash_next(HASH *info,const byte *key,uint length); +my_bool hash_insert(HASH *info,const byte *data); +my_bool hash_delete(HASH *hash,byte *record); +my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length); +void hash_replace(HASH *hash, uint idx, byte *new_row); +my_bool hash_check(HASH *hash); /* Only in debug library */ + +#define hash_clear(H) bzero((char*) (H),sizeof(*(H))) +#define hash_inited(H) ((H)->array.buffer != 0) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/heap.h b/dlls/csx_sql/extra/include/mysql/heap.h new file mode 100755 index 00000000..ed023133 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/heap.h @@ -0,0 +1,185 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file should be included when using heap_database_funktions */ +/* Author: Michael Widenius */ + +#ifndef _heap_h +#define _heap_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _my_base_h +#include +#endif +#ifdef THREAD +#include +#include +#endif + + /* defines used by heap-funktions */ + +#define HP_MAX_LEVELS 4 /* 128^5 records is enough */ +#define HP_PTRS_IN_NOD 128 + + /* struct used with heap_funktions */ + +typedef struct st_heapinfo /* Struct from heap_info */ +{ + ulong records; /* Records in database */ + ulong deleted; /* Deleted records in database */ + ulong max_records; + ulong data_length; + ulong index_length; + uint reclength; /* Length of one record */ + int errkey; + my_bool implicit_emptied; +} HEAPINFO; + + + /* Structs used by heap-database-handler */ + +typedef struct st_heap_ptrs +{ + byte *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */ +} HP_PTRS; + +struct st_level_info +{ + uint free_ptrs_in_block,records_under_level; + HP_PTRS *last_blocks; /* pointers to HP_PTRS or records */ +}; + +typedef struct st_heap_block /* The data is saved in blocks */ +{ + HP_PTRS *root; + struct st_level_info level_info[HP_MAX_LEVELS+1]; + uint levels; + uint records_in_block; /* Records in a heap-block */ + uint recbuffer; /* Length of one saved record */ + ulong last_allocated; /* Blocks allocated, used by keys */ +} HP_BLOCK; + +typedef struct st_hp_keyseg /* Key-portion */ +{ + uint start; /* Start of key in record (from 0) */ + uint length; /* Keylength */ + uint type; + uint null_bit; /* bit set in row+null_pos */ + uint null_pos; +} HP_KEYSEG; + +typedef struct st_hp_keydef /* Key definition with open */ +{ + uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */ + uint keysegs; /* Number of key-segment */ + uint length; /* Length of key (automatic) */ + HP_KEYSEG *seg; + HP_BLOCK block; /* Where keys are saved */ +} HP_KEYDEF; + +typedef struct st_heap_share +{ + HP_BLOCK block; + HP_KEYDEF *keydef; + ulong min_records,max_records; /* Params to open */ + ulong data_length,index_length; + uint records; /* records */ + uint blength; + uint deleted; /* Deleted records in database */ + uint reclength; /* Length of one record */ + uint changed; + uint keys,max_key_length; + uint open_count; + byte *del_link; /* Link to next block with del. rec */ + my_string name; /* Name of "memory-file" */ +#ifdef THREAD + THR_LOCK lock; + pthread_mutex_t intern_lock; /* Locking for use with _locking */ +#endif + my_bool delete_on_close; + LIST open_list; +} HP_SHARE; + +struct st_hp_hash_info; + +typedef struct st_heap_info +{ + HP_SHARE *s; + byte *current_ptr; + struct st_hp_hash_info *current_hash_ptr; + ulong current_record,next_block; + int lastinx,errkey; + int mode; /* Mode of file (READONLY..) */ + uint opt_flag,update; + byte *lastkey; /* Last used key with rkey */ + my_bool implicit_emptied; +#ifdef THREAD + THR_LOCK_DATA lock; +#endif + LIST open_list; +} HP_INFO; + + /* Prototypes for heap-functions */ + +extern HP_INFO* heap_open(const char *name,int mode,uint keys, + HP_KEYDEF *keydef,uint reclength, + ulong max_records,ulong min_reloc); +extern int heap_close(HP_INFO *info); +extern int heap_write(HP_INFO *info,const byte *buff); +extern int heap_update(HP_INFO *info,const byte *old,const byte *newdata); +extern int heap_rrnd(HP_INFO *info,byte *buf,byte *pos); +extern int heap_scan_init(HP_INFO *info); +extern int heap_scan(register HP_INFO *info, byte *record); +extern int heap_delete(HP_INFO *info,const byte *buff); +extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag); +extern int heap_create(const char *name); +extern int heap_delete_table(const char *name); +extern int heap_extra(HP_INFO *info,enum ha_extra_function function); +extern int heap_rename(const char *old_name,const char *new_name); +extern int heap_panic(enum ha_panic_function flag); +extern int heap_rsame(HP_INFO *info,byte *record,int inx); +extern int heap_rnext(HP_INFO *info,byte *record); +extern int heap_rprev(HP_INFO *info,byte *record); +extern int heap_rfirst(HP_INFO *info,byte *record); +extern int heap_rlast(HP_INFO *info,byte *record); +extern void heap_clear(HP_INFO *info); +extern int heap_rkey(HP_INFO *info,byte *record,int inx,const byte *key); +extern gptr heap_find(HP_INFO *info,int inx,const byte *key); +extern int heap_check_heap(HP_INFO *info, my_bool print_status); +extern byte *heap_position(HP_INFO *info); + +/* The following is for programs that uses the old HEAP interface where + pointer to rows where a long instead of a (byte*). +*/ + +#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION) +extern int heap_rrnd_old(HP_INFO *info,byte *buf,ulong pos); +extern ulong heap_position_old(HP_INFO *info); +#endif +#ifdef OLD_HEAP_VERSION +typedef ulong HEAP_PTR; +#define heap_position(A) heap_position_old(A) +#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C) +#else +typedef byte *HEAP_PTR; +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/m_ctype.h b/dlls/csx_sql/extra/include/mysql/m_ctype.h new file mode 100755 index 00000000..b3e50cec --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/m_ctype.h @@ -0,0 +1,172 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + A better inplementation of the UNIX ctype(3) library. + Notes: my_global.h should be included before ctype.h +*/ + +#ifndef _m_ctype_h +#define _m_ctype_h + +#ifdef __cplusplus +extern "C" { +#endif + +#define CHARSET_DIR "charsets/" + +typedef struct charset_info_st +{ + uint number; + const char *name; + uchar *ctype; + uchar *to_lower; + uchar *to_upper; + uchar *sort_order; + + uint strxfrm_multiply; + int (*strcoll)(const uchar *, const uchar *); + int (*strxfrm)(uchar *, const uchar *, int); + int (*strnncoll)(const uchar *, int, const uchar *, int); + int (*strnxfrm)(uchar *, const uchar *, int, int); + my_bool (*like_range)(const char *, uint, pchar, uint, + char *, char *, uint *, uint *); + + uint mbmaxlen; + int (*ismbchar)(const char *, const char *); + my_bool (*ismbhead)(uint); + int (*mbcharlen)(uint); +} CHARSET_INFO; + +/* strings/ctype.c */ +extern CHARSET_INFO *default_charset_info; +extern CHARSET_INFO *find_compiled_charset(uint cs_number); +extern CHARSET_INFO *find_compiled_charset_by_name(const char *name); +extern CHARSET_INFO compiled_charsets[]; +extern uint compiled_charset_number(const char *name); +extern const char *compiled_charset_name(uint charset_number); + +#define MY_CHARSET_UNDEFINED 0 +#define MY_CHARSET_CURRENT (default_charset_info->number) + +/* Don't include std ctype.h when this is included */ +#define _CTYPE_H +#define _CTYPE_H_ +#define _CTYPE_INCLUDED +#define __CTYPE_INCLUDED +#define _CTYPE_USING /* Don't put names in global namespace. */ + +/* Fix things, if ctype.h would have been included before */ +#undef toupper +#undef _toupper +#undef _tolower +#undef toupper +#undef tolower +#undef isalpha +#undef isupper +#undef islower +#undef isdigit +#undef isxdigit +#undef isalnum +#undef isspace +#undef ispunct +#undef isprint +#undef isgraph +#undef iscntrl +#undef isascii +#undef toascii + +#define _U 01 /* Upper case */ +#define _L 02 /* Lower case */ +#define _NMR 04 /* Numeral (digit) */ +#define _SPC 010 /* Spacing character */ +#define _PNT 020 /* Punctuation */ +#define _CTR 040 /* Control character */ +#define _B 0100 /* Blank */ +#define _X 0200 /* heXadecimal digit */ + +#define my_ctype (default_charset_info->ctype) +#define my_to_upper (default_charset_info->to_upper) +#define my_to_lower (default_charset_info->to_lower) +#define my_sort_order (default_charset_info->sort_order) + +#define _toupper(c) (char) my_to_upper[(uchar) (c)] +#define _tolower(c) (char) my_to_lower[(uchar) (c)] +#define toupper(c) (char) my_to_upper[(uchar) (c)] +#define tolower(c) (char) my_to_lower[(uchar) (c)] + +#define isalpha(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L)) +#define isupper(c) ((my_ctype+1)[(uchar) (c)] & _U) +#define islower(c) ((my_ctype+1)[(uchar) (c)] & _L) +#define isdigit(c) ((my_ctype+1)[(uchar) (c)] & _NMR) +#define isxdigit(c) ((my_ctype+1)[(uchar) (c)] & _X) +#define isalnum(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L | _NMR)) +#define isspace(c) ((my_ctype+1)[(uchar) (c)] & _SPC) +#define ispunct(c) ((my_ctype+1)[(uchar) (c)] & _PNT) +#define isprint(c) ((my_ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR | _B)) +#define isgraph(c) ((my_ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR)) +#define iscntrl(c) ((my_ctype+1)[(uchar) (c)] & _CTR) +#define isascii(c) (!((c) & ~0177)) +#define toascii(c) ((c) & 0177) + +#ifdef ctype +#undef ctype +#endif /* ctype */ + +#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L)) +#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U) +#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L) +#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _NMR) +#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _X) +#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L | _NMR)) +#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _SPC) +#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _PNT) +#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR | _B)) +#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR)) +#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _CTR) + +#define use_strcoll(s) ((s)->strcoll != NULL) +#define MY_STRXFRM_MULTIPLY (default_charset_info->strxfrm_multiply) +#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c), (d))) +#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((a), (b), (c), (d))) +#define my_strcoll(s, a, b) ((s)->strcoll((a), (b))) +#define my_like_range(s, a, b, c, d, e, f, g, h) \ + ((s)->like_range((a), (b), (c), (d), (e), (f), (g), (h))) + +#define use_mb(s) ((s)->ismbchar != NULL) +#define MBMAXLEN (default_charset_info->mbmaxlen) +#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b))) +#define my_ismbhead(s, a) ((s)->ismbhead((a))) +#define my_mbcharlen(s, a) ((s)->mbcharlen((a))) + +/* Some macros that should be cleaned up a little */ +#define isvar(c) (isalnum(c) || (c) == '_') +#define isvar_start(c) (isalpha(c) || (c) == '_') +#define tocntrl(c) ((c) & 31) +#define toprint(c) ((c) | 64) + +/* XXX: still need to take care of this one */ +#ifdef MY_CHARSET_TIS620 +#error The TIS620 charset is broken at the moment. Tell tim to fix it. +#define USE_TIS620 +#include "t_ctype.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _m_ctype_h */ diff --git a/dlls/csx_sql/extra/include/mysql/m_string.h b/dlls/csx_sql/extra/include/mysql/m_string.h new file mode 100755 index 00000000..eac1552f --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/m_string.h @@ -0,0 +1,254 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* There may be prolems include all of theese. Try to test in + configure with ones are needed? */ + +/* This is needed for the definitions of strchr... on solaris */ + +#ifndef _m_string_h +#define _m_string_h +#ifndef __USE_GNU +#define __USE_GNU /* We want to use stpcpy */ +#endif +#if defined(HAVE_STRINGS_H) +#include +#endif +#if defined(HAVE_STRING_H) +#include +#endif + +/* Correct some things for UNIXWARE7 */ +#ifdef HAVE_UNIXWARE7_THREADS +#undef HAVE_STRINGS_H +#undef HAVE_MEMORY_H +#define HAVE_MEMCPY +#ifndef HAVE_MEMMOVE +#define HAVE_MEMMOVE +#endif +#undef HAVE_BCMP +#undef bcopy +#undef bcmp +#undef bzero +#endif /* HAVE_UNIXWARE7_THREADS */ +#ifdef _AIX +#undef HAVE_BCMP +#endif + +/* This is needed for the definitions of bzero... on solaris */ +#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread) +#include +#endif + +/* This is needed for the definitions of memcpy... on solaris */ +#if defined(HAVE_MEMORY_H) && !defined(__cplusplus) +#include +#endif + +#if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE) +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memset(A,C,B) bfill((A),(B),(C)) +# define memmove(d, s, n) bmove ((d), (s), (n)) +#elif defined(HAVE_MEMMOVE) +# define bmove(d, s, n) memmove((d), (s), (n)) +#else +# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */ +#endif + +/* Unixware 7 */ +#if !defined(HAVE_BFILL) +# define bfill(A,B,C) memset((A),(C),(B)) +# define bmove_allign(A,B,C) memcpy((A),(B),(C)) +#endif + +#if !defined(HAVE_BCMP) +# define bcopy(s, d, n) memcpy((d), (s), (n)) +# define bcmp(A,B,C) memcmp((A),(B),(C)) +# define bzero(A,B) memset((A),0,(B)) +# define bmove_allign(A,B,C) memcpy((A),(B),(C)) +#endif + +#if defined(__cplusplus) && !defined(OS2) +extern "C" { +#endif + +#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) +#define strmov(A,B) stpcpy((A),(B)) +#ifndef stpcpy +extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ +#endif +#endif + +extern char NEAR _dig_vec[]; /* Declared in int2str() */ + +#ifdef BAD_STRING_COMPILER +#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1) +#else +#define strmov_overlapp(A,B) strmov(A,B) +#define strmake_overlapp(A,B,C) strmake(A,B,C) +#endif + +#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */ +#define memcpy_fixed(A,B,C) bmove((A),(B),(C)) +#else +#define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) +#endif + +#ifdef MSDOS +#undef bmove_allign +#define bmove512(A,B,C) bmove_allign(A,B,C) +#define my_itoa(A,B,C) itoa(A,B,C) +#define my_ltoa(A,B,C) ltoa(A,B,C) +extern void bmove_allign(gptr dst,const gptr src,uint len); +#endif + +#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512) +#define bmove512(A,B,C) memcpy(A,B,C) +#endif + +#ifdef HAVE_purify +#include +#define memcpy_overlap(A,B,C) \ +DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \ +bmove((byte*) key,(byte*) from,(size_t) length); +#else +#define memcpy_overlap(A,B,C) memcpy((A), (B), (C)) +#endif /* HAVE_purify */ + + + /* Prototypes for string functions */ + +#if !defined(bfill) && !defined(HAVE_BFILL) +extern void bfill(gptr dst,uint len,pchar fill); +#endif + +#if !defined(bzero) && !defined(HAVE_BZERO) +extern void bzero(gptr dst,uint len); +#endif + +#if !defined(bcmp) && !defined(HAVE_BCMP) +extern int bcmp(const char *s1,const char *s2,uint len); +#endif +#ifdef HAVE_purify +extern int my_bcmp(const char *s1,const char *s2,uint len); +#undef bcmp +#define bcmp(A,B,C) my_bcmp((A),(B),(C)) +#endif + +#ifndef bmove512 +extern void bmove512(gptr dst,const gptr src,uint len); +#endif + +#if !defined(HAVE_BMOVE) && !defined(bmove) +extern void bmove(char *dst, const char *src,uint len); +#endif + +extern void bmove_upp(char *dst,const char *src,uint len); +extern void bchange(char *dst,uint old_len,const char *src, + uint new_len,uint tot_len); +extern void strappend(char *s,uint len,pchar fill); +extern char *strend(const char *s); +extern char *strcend(const char *, pchar); +extern char *strfield(char *src,int fields,int chars,int blanks, + int tabch); +extern char *strfill(my_string s,uint len,pchar fill); +extern uint strinstr(const char *str,const char *search); +extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search); +extern char *strkey(char *dst,char *head,char *tail,char *flags); +extern char *strmake(char *dst,const char *src,uint length); +#ifndef strmake_overlapp +extern char *strmake_overlapp(char *dst,const char *src, uint length); +#endif + +#ifndef strmov +extern char *strmov(char *dst,const char *src); +#endif +extern char *strnmov(char *dst,const char *src,uint n); +extern char *strsuff(const char *src,const char *suffix); +extern char *strcont(const char *src,const char *set); +extern char *strxcat _VARARGS((char *dst,const char *src, ...)); +extern char *strxmov _VARARGS((char *dst,const char *src, ...)); +extern char *strxcpy _VARARGS((char *dst,const char *src, ...)); +extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...)); +extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...)); +extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...)); + +/* Prototypes of normal stringfunctions (with may ours) */ + +#ifdef WANT_STRING_PROTOTYPES +extern char *strcat(char *, const char *); +extern char *strchr(const char *, pchar); +extern char *strrchr(const char *, pchar); +extern char *strcpy(char *, const char *); +extern int strcmp(const char *, const char *); +#ifndef __GNUC__ +extern size_t strlen(const char *); +#endif +#endif +#ifndef HAVE_STRNLEN +extern uint strnlen(const char *s, uint n); +#endif + +#if !defined(__cplusplus) +#ifndef HAVE_STRPBRK +extern char *strpbrk(const char *, const char *); +#endif +#ifndef HAVE_STRSTR +extern char *strstr(const char *, const char *); +#endif +#endif +extern int is_prefix(const char *, const char *); + +/* Conversion rutins */ + +#ifdef USE_MY_ITOA +extern char *my_itoa(int val,char *dst,int radix); +extern char *my_ltoa(long val,char *dst,int radix); +#endif + +extern char *llstr(longlong value,char *buff); +#ifndef HAVE_STRTOUL +extern long strtol(const char *str, char **ptr, int base); +extern ulong strtoul(const char *str, char **ptr, int base); +#endif + +extern char *int2str(long val,char *dst,int radix); +extern char *int10_to_str(long val,char *dst,int radix); +extern char *str2int(const char *src,int radix,long lower,long upper, + long *val); +#if SIZEOF_LONG == SIZEOF_LONG_LONG +#define longlong2str(A,B,C) int2str((A),(B),(C)) +#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) +#define strtoll(A,B,C) strtol((A),(B),(C)) +#define strtoull(A,B,C) strtoul((A),(B),(C)) +#ifndef HAVE_STRTOULL +#define HAVE_STRTOULL +#endif +#else +#ifdef HAVE_LONG_LONG +extern char *longlong2str(longlong val,char *dst,int radix); +extern char *longlong10_to_str(longlong val,char *dst,int radix); +#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO) +extern longlong strtoll(const char *str, char **ptr, int base); +extern ulonglong strtoull(const char *str, char **ptr, int base); +#endif +#endif +#endif + +#if defined(__cplusplus) && !defined(OS2) +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/md5.h b/dlls/csx_sql/extra/include/mysql/md5.h new file mode 100755 index 00000000..aa4116ff --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/md5.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* MD5.H - header file for MD5C.C + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* GLOBAL.H - RSAREF types and constants + */ + +/* PROTOTYPES should be set to one if and only if the compiler supports + function argument prototyping. +The following makes PROTOTYPES default to 0 if it has not already + been defined with C compiler flags. + */ + +/* egcs 1.1.2 under linux didn't defined it.... :( */ + +#ifndef PROTOTYPES +#define PROTOTYPES 1 /* Assume prototypes */ +#endif + +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; + +/* UINT2 defines a two byte word */ +typedef uint16 UINT2; /* Fix for MySQL / Alpha */ + +/* UINT4 defines a four byte word */ +typedef uint32 UINT4; /* Fix for MySQL / Alpha */ + +/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. +If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it + returns an empty list. + */ +#if PROTOTYPES +#define PROTO_LIST(list) list +#else +#define PROTO_LIST(list) () +#endif +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} my_MD5_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + void my_MD5Init PROTO_LIST ((my_MD5_CTX *)); + void my_MD5Update PROTO_LIST + ((my_MD5_CTX *, unsigned char *, unsigned int)); + void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *)); + +#ifdef __cplusplus +} +#endif diff --git a/dlls/csx_sql/extra/include/mysql/merge.h b/dlls/csx_sql/extra/include/mysql/merge.h new file mode 100755 index 00000000..97cea5fa --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/merge.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file should be included when using merge_isam_funktions */ +/* Author: Michael Widenius */ + +#ifndef _merge_h +#define _merge_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _my_base_h +#include +#endif +#ifndef _nisam_h +#include +#endif + +#define MRG_NAME_EXT ".MRG" + + /* Param to/from mrg_info */ + +typedef struct st_mrg_info /* Struct from h_info */ +{ + ulonglong records; /* Records in database */ + ulonglong deleted; /* Deleted records in database */ + ulonglong recpos; /* Pos for last used record */ + ulonglong data_file_length; + uint reclength; /* Recordlength */ + int errkey; /* With key was dupplicated on err */ + uint options; /* HA_OPTION_... used */ +} MERGE_INFO; + +typedef struct st_mrg_table_info +{ + N_INFO *table; + ulonglong file_offset; +} MRG_TABLE; + +typedef struct st_merge +{ + MRG_TABLE *open_tables,*current_table,*end_table,*last_used_table; + ulonglong records; /* records in tables */ + ulonglong del; /* Removed records */ + ulonglong data_file_length; + uint tables,options,reclength; + my_bool cache_in_use; + LIST open_list; +} MRG_INFO; + +typedef ulong mrg_off_t; + + /* Prototypes for merge-functions */ + +extern int mrg_close(MRG_INFO *file); +extern int mrg_delete(MRG_INFO *file,const byte *buff); +extern MRG_INFO *mrg_open(const char *name,int mode,int wait_if_locked); +extern int mrg_panic(enum ha_panic_function function); +extern int mrg_rfirst(MRG_INFO *file,byte *buf,int inx); +extern int mrg_rkey(MRG_INFO *file,byte *buf,int inx,const byte *key, + uint key_len, enum ha_rkey_function search_flag); +extern int mrg_rrnd(MRG_INFO *file,byte *buf, mrg_off_t pos); +extern int mrg_rsame(MRG_INFO *file,byte *record,int inx); +extern int mrg_update(MRG_INFO *file,const byte *old,const byte *new_rec); +extern int mrg_info(MRG_INFO *file,MERGE_INFO *x,int flag); +extern int mrg_lock_database(MRG_INFO *file,int lock_type); +extern int mrg_create(const char *name,const char **table_names); +extern int mrg_extra(MRG_INFO *file,enum ha_extra_function function); +extern ha_rows mrg_records_in_range(MRG_INFO *info,int inx, + const byte *start_key,uint start_key_len, + enum ha_rkey_function start_search_flag, + const byte *end_key,uint end_key_len, + enum ha_rkey_function end_search_flag); + +extern mrg_off_t mrg_position(MRG_INFO *info); +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_aes.h b/dlls/csx_sql/extra/include/mysql/my_aes.h new file mode 100755 index 00000000..5852baa5 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_aes.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2002 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* Header file for my_aes.c */ +/* Wrapper to give simple interface for MySQL to AES standard encryption */ + +#include "rijndael.h" + +C_MODE_START + +#define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */ + +/* + my_aes_encrypt - Crypt buffer with AES encryption algorithm. + source - Pointer to data for encryption + source_length - size of encryption data + dest - buffer to place encrypted data (must be large enough) + key - Key to be used for encryption + kel_length - Length of the key. Will handle keys of any length + + returns - size of encrypted data, or negative in case of error. +*/ + +int my_aes_encrypt(const char *source, int source_length, char *dest, + const char *key, int key_length); + +/* + my_aes_decrypt - DeCrypt buffer with AES encryption algorithm. + source - Pointer to data for decryption + source_length - size of encrypted data + dest - buffer to place decrypted data (must be large enough) + key - Key to be used for decryption + kel_length - Length of the key. Will handle keys of any length + + returns - size of original data, or negative in case of error. +*/ + + +int my_aes_decrypt(const char *source, int source_length, char *dest, + const char *key, int key_length); + +/* + my_aes_get_size - get size of buffer which will be large enough for encrypted + data + source_length - length of data to be encrypted + + returns - size of buffer required to store encrypted data +*/ + +int my_aes_get_size(int source_length); + +C_MODE_END diff --git a/dlls/csx_sql/extra/include/mysql/my_alarm.h b/dlls/csx_sql/extra/include/mysql/my_alarm.h new file mode 100755 index 00000000..fdfce9c6 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_alarm.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + File to include when we want to use alarm or a loop_counter to display + some information when a program is running +*/ +#ifndef _my_alarm_h +#define _my_alarm_h +#ifdef __cplusplus +extern "C" { +#endif + +extern int volatile my_have_got_alarm; +extern ulong my_time_to_wait_for_lock; + +#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP) +#include +#define ALARM_VARIABLES uint alarm_old=0; \ + sig_return alarm_signal=0 +#define ALARM_INIT my_have_got_alarm=0 ; \ + alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \ + alarm_signal=signal(SIGALRM,my_set_alarm_variable); +#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \ + VOID(alarm(alarm_old)); +#define ALARM_TEST my_have_got_alarm +#ifdef DONT_REMEMBER_SIGNAL +#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \ + VOID(signal(SIGALRM,my_set_alarm_variable));\ + my_have_got_alarm=0; +#else +#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \ + my_have_got_alarm=0; +#endif /* DONT_REMEMBER_SIGNAL */ +#else +#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1 +#define ALARM_INIT +#define ALARM_END +#define ALARM_TEST (alarm_pos++ >= alarm_end_pos) +#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE +#endif /* HAVE_ALARM */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_alloc.h b/dlls/csx_sql/extra/include/mysql/my_alloc.h new file mode 100755 index 00000000..a3dd35d7 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_alloc.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Data structures for mysys/my_alloc.c (root memory allocator) +*/ + +#ifndef _my_alloc_h +#define _my_alloc_h + +#define ALLOC_MAX_BLOCK_TO_DROP 4096 +#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 + +typedef struct st_used_mem +{ /* struct for once_alloc (block) */ + struct st_used_mem *next; /* Next block in use */ + unsigned int left; /* memory left in block */ + unsigned int size; /* size of block */ +} USED_MEM; + + +typedef struct st_mem_root +{ + USED_MEM *free; /* blocks with free memory in it */ + USED_MEM *used; /* blocks almost without free memory */ + USED_MEM *pre_alloc; /* preallocated block */ + /* if block have less memory it will be put in 'used' list */ + unsigned int min_malloc; + unsigned int block_size; /* initial block size */ + unsigned int block_num; /* allocated blocks counter */ + /* + first free block in queue test counter (if it exceed + MAX_BLOCK_USAGE_BEFORE_DROP block will be droped in 'used' list) + */ + unsigned int first_block_usage; + + void (*error_handler)(void); +} MEM_ROOT; +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_base.h b/dlls/csx_sql/extra/include/mysql/my_base.h new file mode 100755 index 00000000..5344d876 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_base.h @@ -0,0 +1,342 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file includes constants used with all databases */ +/* Author: Michael Widenius */ + +#ifndef _my_base_h +#define _my_base_h + +#ifndef stdin /* Included first in handler */ +#define USES_TYPES /* my_dir with sys/types is included */ +#define CHSIZE_USED +#include +#include /* This includes types */ +#include +#include +#include +#ifdef MSDOS +#include /* Neaded for sopen() */ +#endif +#if !defined(USE_MY_FUNC) && !defined(THREAD) +#include /* For faster code, after test */ +#endif /* USE_MY_FUNC */ +#endif /* stdin */ +#include + +/* The following is bits in the flag parameter to ha_open() */ + +#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */ +#define HA_OPEN_WAIT_IF_LOCKED 1 +#define HA_OPEN_IGNORE_IF_LOCKED 2 +#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */ +#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */ +#define HA_OPEN_ABORT_IF_CRASHED 16 +#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */ + + /* The following is parameter to ha_rkey() how to use key */ + +/* We define a complete-field prefix of a key value as a prefix where the +last included field in the prefix contains the full field, not just some bytes +from the start of the field. A partial-field prefix is allowed to +contain only a few first bytes from the last included field. + +Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a +complete-field prefix of a key value as the search key. HA_READ_PREFIX +and HA_READ_PREFIX_LAST could also take a partial-field prefix, but +currently (4.0.10) they are only used with complete-field prefixes. MySQL uses +a padding trick to implement LIKE 'abc%' queries. + +NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a partial-field +prefix because InnoDB currently strips spaces from the end of varchar +fields! */ + +enum ha_rkey_function { + HA_READ_KEY_EXACT, /* Find first record else error */ + HA_READ_KEY_OR_NEXT, /* Record or next record */ + HA_READ_KEY_OR_PREV, /* Record or previous */ + HA_READ_AFTER_KEY, /* Find next rec. after key-record */ + HA_READ_BEFORE_KEY, /* Find next rec. before key-record */ + HA_READ_PREFIX, /* Key which as same prefix */ + HA_READ_PREFIX_LAST, /* Last key with the same prefix */ + HA_READ_MBR_CONTAIN, + HA_READ_MBR_INTERSECT, + HA_READ_MBR_WITHIN, + HA_READ_MBR_DISJOINT, + HA_READ_MBR_EQUAL +}; + + /* Key algorithm types */ + +enum ha_key_alg { + HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */ + HA_KEY_ALG_BTREE= 1, /* B-tree, default one */ + HA_KEY_ALG_RTREE= 2, /* R-tree, for spatial searches */ + HA_KEY_ALG_HASH= 3, /* HASH keys (HEAP tables) */ + HA_KEY_ALG_FULLTEXT= 4 /* FULLTEXT (MyISAM tables) */ +}; + + /* The following is parameter to ha_extra() */ + +enum ha_extra_function { + HA_EXTRA_NORMAL=0, /* Optimize for space (def) */ + HA_EXTRA_QUICK=1, /* Optimize for speed */ + HA_EXTRA_RESET=2, /* Reset database to after open */ + HA_EXTRA_CACHE=3, /* Cash record in HA_rrnd() */ + HA_EXTRA_NO_CACHE=4, /* End cacheing of records (def) */ + HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */ + HA_EXTRA_READCHECK=6, /* Use readcheck (def) */ + HA_EXTRA_KEYREAD=7, /* Read only key to database */ + HA_EXTRA_NO_KEYREAD=8, /* Normal read of records (def) */ + HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */ + HA_EXTRA_KEY_CACHE=10, + HA_EXTRA_NO_KEY_CACHE=11, + HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */ + HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */ + HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */ + HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */ + HA_EXTRA_NO_KEYS=16, /* Remove all update of keys */ + HA_EXTRA_KEYREAD_CHANGE_POS=17, /* Keyread, but change pos */ + /* xxxxchk -r must be used */ + HA_EXTRA_REMEMBER_POS=18, /* Remember pos for next/prev */ + HA_EXTRA_RESTORE_POS=19, + HA_EXTRA_REINIT_CACHE=20, /* init cache from current record */ + HA_EXTRA_FORCE_REOPEN=21, /* Datafile have changed on disk */ + HA_EXTRA_FLUSH, /* Flush tables to disk */ + HA_EXTRA_NO_ROWS, /* Don't write rows */ + HA_EXTRA_RESET_STATE, /* Reset positions */ + HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ + HA_EXTRA_NO_IGNORE_DUP_KEY, + HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE, /* Cursor will not be used for update */ + HA_EXTRA_PREPARE_FOR_DELETE, + HA_EXTRA_PREPARE_FOR_UPDATE /* Remove read cache if problems */ +}; + + /* The following is parameter to ha_panic() */ + +enum ha_panic_function { + HA_PANIC_CLOSE, /* Close all databases */ + HA_PANIC_WRITE, /* Unlock and write status */ + HA_PANIC_READ /* Lock and read keyinfo */ +}; + + /* The following is parameter to ha_create(); keytypes */ + +enum ha_base_keytype { + HA_KEYTYPE_END=0, + HA_KEYTYPE_TEXT=1, /* Key is sorted as letters */ + HA_KEYTYPE_BINARY=2, /* Key is sorted as unsigned chars */ + HA_KEYTYPE_SHORT_INT=3, + HA_KEYTYPE_LONG_INT=4, + HA_KEYTYPE_FLOAT=5, + HA_KEYTYPE_DOUBLE=6, + HA_KEYTYPE_NUM=7, /* Not packed num with pre-space */ + HA_KEYTYPE_USHORT_INT=8, + HA_KEYTYPE_ULONG_INT=9, + HA_KEYTYPE_LONGLONG=10, + HA_KEYTYPE_ULONGLONG=11, + HA_KEYTYPE_INT24=12, + HA_KEYTYPE_UINT24=13, + HA_KEYTYPE_INT8=14, + HA_KEYTYPE_VARTEXT=15, /* Key is sorted as letters */ + HA_KEYTYPE_VARBINARY=16 /* Key is sorted as unsigned chars */ +}; + +#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */ + + /* These flags kan be OR:ed to key-flag */ + +#define HA_NOSAME 1 /* Set if not dupplicated records */ +#define HA_PACK_KEY 2 /* Pack string key to previous key */ +#define HA_AUTO_KEY 16 +#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */ +#define HA_FULLTEXT 128 /* SerG: for full-text search */ +#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */ +#define HA_SPATIAL 1024 /* Alex Barkov: for spatial search */ +#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ + + + /* Automatic bits in key-flag */ + +#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ +#define HA_VAR_LENGTH_KEY 8 +#define HA_NULL_PART_KEY 64 +#ifndef ISAM_LIBRARY +#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */ +#else +/* poor old NISAM has 8-bit flags :-( */ +#define HA_SORT_ALLOWS_SAME 128 /* Intern bit when sorting records */ +#endif +/* + Key has a part that can have end space. If this is an unique key + we have to handle it differently from other unique keys as we can find + many matching rows for one key (becaue end space are not compared) +*/ +#define HA_END_SPACE_KEY 4096 + + /* These flags can be added to key-seg-flag */ + +#define HA_SPACE_PACK 1 /* Pack space in key-seg */ +#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */ +#define HA_VAR_LENGTH 8 +#define HA_NULL_PART 16 +#define HA_BLOB_PART 32 +#define HA_SWAP_KEY 64 +#define HA_REVERSE_SORT 128 /* Sort key in reverse order */ +#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */ + + /* optionbits for database */ +#define HA_OPTION_PACK_RECORD 1 +#define HA_OPTION_PACK_KEYS 2 +#define HA_OPTION_COMPRESS_RECORD 4 +#define HA_OPTION_LONG_BLOB_PTR 8 /* new ISAM format */ +#define HA_OPTION_TMP_TABLE 16 +#define HA_OPTION_CHECKSUM 32 +#define HA_OPTION_DELAY_KEY_WRITE 64 +#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */ +#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */ +#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */ + + /* Bits in flag to create() */ + +#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */ +#define HA_PACK_RECORD 2 /* Request packed record format */ +#define HA_CREATE_TMP_TABLE 4 +#define HA_CREATE_CHECKSUM 8 +#define HA_CREATE_DELAY_KEY_WRITE 64 + + /* Bits in flag to _status */ + +#define HA_STATUS_POS 1 /* Return position */ +#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */ +#define HA_STATUS_TIME 4 /* Return update time */ +#define HA_STATUS_CONST 8 /* Return constants values */ +#define HA_STATUS_VARIABLE 16 +#define HA_STATUS_ERRKEY 32 +#define HA_STATUS_AUTO 64 + + /* Errorcodes given by functions */ + +/* opt_sum_query() assumes these codes are > 1 */ +#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */ +#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */ +#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */ +#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */ +#define HA_ERR_CRASHED 126 /* Indexfile is crashed */ +#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */ +#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */ +#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */ +#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ +#define HA_ERR_OLD_FILE 132 /* old databasfile */ +#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ +#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */ +#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ +#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ +#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ +#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */ +#define HA_ERR_TO_BIG_ROW 139 /* Too big row */ +#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ +#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ +#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ +#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */ +#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ +#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ +#define HA_ERR_LOCK_WAIT_TIMEOUT 146 +#define HA_ERR_LOCK_TABLE_FULL 147 +#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */ +#define HA_ERR_LOCK_DEADLOCK 149 +#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */ +#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */ +#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */ +#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */ + + /* Other constants */ + +#define HA_NAMELEN 64 /* Max length of saved filename */ +#define NO_SUCH_KEY ((uint)~0) /* used as a key no. */ + + /* Intern constants in databases */ + + /* bits in _search */ +#define SEARCH_FIND 1 +#define SEARCH_NO_FIND 2 +#define SEARCH_SAME 4 +#define SEARCH_BIGGER 8 +#define SEARCH_SMALLER 16 +#define SEARCH_SAVE_BUFF 32 +#define SEARCH_UPDATE 64 +#define SEARCH_PREFIX 128 +#define SEARCH_LAST 256 +#define MBR_CONTAIN 512 +#define MBR_INTERSECT 1024 +#define MBR_WITHIN 2048 +#define MBR_DISJOINT 4096 +#define MBR_EQUAL 8192 +#define MBR_DATA 16384 +#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */ +#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */ + + /* bits in opt_flag */ +#define QUICK_USED 1 +#define READ_CACHE_USED 2 +#define READ_CHECK_USED 4 +#define KEY_READ_USED 8 +#define WRITE_CACHE_USED 16 +#define OPT_NO_ROWS 32 + + /* bits in update */ +#define HA_STATE_CHANGED 1 /* Database has changed */ +#define HA_STATE_AKTIV 2 /* Has a current record */ +#define HA_STATE_WRITTEN 4 /* Record is written */ +#define HA_STATE_DELETED 8 +#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */ +#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */ +#define HA_STATE_NO_KEY 64 /* Last read didn't find record */ +#define HA_STATE_KEY_CHANGED 128 +#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */ +#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ +#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ +#define HA_STATE_EXTEND_BLOCK 2048 + +enum en_fieldtype { + FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, + FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO, + FIELD_VARCHAR,FIELD_CHECK +}; + +enum data_file_type { + STATIC_RECORD,DYNAMIC_RECORD,COMPRESSED_RECORD +}; + +/* For number of records */ +#ifdef BIG_TABLES +#define rows2double(A) ulonglong2double(A) +typedef my_off_t ha_rows; +#else +#define rows2double(A) (double) (A) +typedef ulong ha_rows; +#endif + +#define HA_POS_ERROR (~ (ha_rows) 0) +#define HA_OFFSET_ERROR (~ (my_off_t) 0) + +#if SYSTEM_SIZEOF_OFF_T == 4 +#define MAX_FILE_SIZE INT_MAX32 +#else +#define MAX_FILE_SIZE LONGLONG_MAX +#endif + +#endif /* _my_base_h */ diff --git a/dlls/csx_sql/extra/include/mysql/my_bitmap.h b/dlls/csx_sql/extra/include/mysql/my_bitmap.h new file mode 100755 index 00000000..ca0037ad --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_bitmap.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_bitmap_h_ +#define _my_bitmap_h_ + +#include + +#define MY_BIT_NONE (~(uint) 0) + +typedef struct st_bitmap +{ + uchar *bitmap; + uint bitmap_size; + my_bool thread_safe; /* set if several threads access the bitmap */ + /* + mutex will be acquired for the duration of each bitmap operation if + thread_safe flag is set. Otherwise, we optimize by not acquiring the + mutex + */ +#ifdef THREAD + pthread_mutex_t mutex; +#endif +} MY_BITMAP; + +#ifdef __cplusplus +extern "C" { +#endif + extern my_bool bitmap_init(MY_BITMAP *bitmap, uint bitmap_size, + my_bool thread_safe); + extern void bitmap_free(MY_BITMAP *bitmap); + extern void bitmap_set_bit(MY_BITMAP *bitmap, uint bitmap_bit); + extern uint bitmap_set_next(MY_BITMAP *bitmap); + extern void bitmap_set_all(MY_BITMAP* bitmap); + extern my_bool bitmap_is_set(MY_BITMAP* bitmap, uint bitmap_bit); + extern void bitmap_clear_all(MY_BITMAP* bitmap); + extern void bitmap_clear_bit(MY_BITMAP *bitmap, uint bitmap_bit); +#ifdef __cplusplus +} +#endif + +#endif /* _my_bitmap_h_ */ diff --git a/dlls/csx_sql/extra/include/mysql/my_config.h b/dlls/csx_sql/extra/include/mysql/my_config.h new file mode 100755 index 00000000..55e4b6c0 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_config.h @@ -0,0 +1,882 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ +/* acconfig.h + This file is in the public domain. + + Descriptive text for the C preprocessor macros that + the distributed Autoconf macros can define. + No software package will use all of them; autoheader copies the ones + your configure.in uses into your configuration header file templates. + + The entries are in sort -df order: alphabetical, case insensitive, + ignoring punctuation (such as underscores). Although this order + can split up related entries, it makes it easier to check whether + a given entry is in the file. + + Leave the following blank line there!! Autoheader needs it. */ + + +/* #undef C_ALLOCA */ + +/* #undef CRAY_STACKSEG_END */ + +/* Version of .frm files */ +#define DOT_FRM_VERSION 6 + +/* If LOAD DATA LOCAL INFILE should be enabled by default */ +#define ENABLED_LOCAL_INFILE 1 + +/* READLINE: */ +#define FIONREAD_IN_SYS_IOCTL 1 + +/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ +#define GWINSZ_IN_SYS_IOCTL 1 + +/* Handing of large files on Solaris 2.6 */ +#define _FILE_OFFSET_BITS 64 + +/* Do we have FIONREAD */ +#define FIONREAD_IN_SYS_IOCTL 1 + +/* Do we need to define _GNU_SOURCE */ +/* #undef _GNU_SOURCE */ + +/* atomic_add() from (Linux only) */ +#define HAVE_ATOMIC_ADD 1 + +/* atomic_sub() from (Linux only) */ +#define HAVE_ATOMIC_SUB 1 + +/* If we have a working alloca() implementation */ +#define HAVE_ALLOCA 1 + +/* bool is not defined by all C++ compilators */ +#define HAVE_BOOL 1 + +/* Have berkeley db installed */ +#define HAVE_BERKELEY_DB 1 + +/* DSB style signals ? */ +/* #undef HAVE_BSD_SIGNALS */ + +/* Can netinet be included */ +/* #undef HAVE_BROKEN_NETINET_INCLUDES */ + +/* READLINE: */ +/* #undef HAVE_BSD_SIGNALS */ + +/* ZLIB and compress: */ +#define HAVE_COMPRESS 1 + +/* Define if we are using OSF1 DEC threads */ +/* #undef HAVE_DEC_THREADS */ + +/* Define if we are using OSF1 DEC threads on 3.2 */ +/* #undef HAVE_DEC_3_2_THREADS */ + +/* fp_except from ieeefp.h */ +/* #undef HAVE_FP_EXCEPT */ + +/* READLINE: */ +/* #undef HAVE_GETPW_DECLS */ + +/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines + this with 6 arguments */ +#define HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1 + +/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */ +/* #undef HAVE_GETHOSTBYNAME_R_RETURN_INT */ + +/* Define if int8, int16 and int32 types exist */ +/* #undef HAVE_INT_8_16_32 */ + +/* Using Innobase DB */ +#define HAVE_INNOBASE_DB 1 + +/* Using old ISAM tables */ +#define HAVE_ISAM 1 + +/* Define if we have GNU readline */ +/* #undef HAVE_LIBREADLINE */ + +/* Define if have -lwrap */ +/* #undef HAVE_LIBWRAP */ + +/* Define if we are using Xavier Leroy's LinuxThreads */ +#define HAVE_LINUXTHREADS 1 + +/* Do we have lstat */ +#define HAVE_LSTAT 1 + +/* Do we use user level threads */ +/* #undef HAVE_mit_thread */ + +/* For some non posix threads */ +/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */ + +/* For some non posix threads */ +/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ + +/* READLINE: */ +#define HAVE_POSIX_SIGNALS 1 + +/* Well.. */ +/* #undef HAVE_POSIX_SIGSETJMP */ + +/* sigwait with one argument */ +/* #undef HAVE_NONPOSIX_SIGWAIT */ + +/* ORBIT */ +/* #undef HAVE_ORBIT */ + +/* pthread_attr_setscope */ +#define HAVE_PTHREAD_ATTR_SETSCOPE 1 + +/* pthread_yield that doesn't take any arguments */ +#define HAVE_PTHREAD_YIELD_ZERO_ARG 1 + +/* pthread_yield function with one argument */ +/* #undef HAVE_PTHREAD_YIELD_ONE_ARG */ + +/* POSIX readdir_r */ +#define HAVE_READDIR_R 1 + +/* Have Gemini db installed */ +/* #undef HAVE_GEMINI_DB */ + +/* POSIX sigwait */ +#define HAVE_SIGWAIT 1 + +/* crypt */ +#define HAVE_CRYPT 1 + +/* If we want to have query cache */ +#define HAVE_QUERY_CACHE 1 + +/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines + this with 8 arguments */ +/* #undef HAVE_SOLARIS_STYLE_GETHOST */ + +/* MIT pthreads does not support connecting with unix sockets */ +/* #undef HAVE_THREADS_WITHOUT_SOCKETS */ + +/* Timespec has a ts_sec instead of tv_sev */ +/* #undef HAVE_TIMESPEC_TS_SEC */ + +/* Have the tzname variable */ +#define HAVE_TZNAME 1 + +/* Define if the system files define uchar */ +/* #undef HAVE_UCHAR */ + +/* Define if the system files define uint */ +#define HAVE_UINT 1 + +/* Define if the system files define ulong */ +#define HAVE_ULONG 1 + +/* Define if the system files define in_addr_t */ +#define HAVE_IN_ADDR_T 1 + +/* UNIXWARE7 threads are not posix */ +/* #undef HAVE_UNIXWARE7_THREADS */ + +/* new UNIXWARE7 threads that are not yet posix */ +/* #undef HAVE_UNIXWARE7_POSIX */ + +/* OpenSSL */ +#define HAVE_OPENSSL 1 + +/* READLINE: */ +/* #undef HAVE_USG_SIGHOLD */ + +/* Virtual IO */ +#define HAVE_VIO 1 + +/* Handling of large files on Solaris 2.6 */ +/* #undef _LARGEFILE_SOURCE */ + +/* Handling of large files on Solaris 2.6 */ +/* #undef _LARGEFILE64_SOURCE */ + +/* Define if want -lwrap */ +/* #undef LIBWRAP */ + +/* Define to machine type name eg sun10 */ +#define MACHINE_TYPE "i686" + +/* #undef MUST_REINSTALL_SIGHANDLERS */ + +/* Defined to used character set */ +/* #undef MY_CHARSET_CURRENT */ + +/* READLINE: no sys file*/ +/* #undef NO_SYS_FILE */ + +/* Program name */ +#define PACKAGE "mysql" + +/* mysql client protocoll version */ +#define PROTOCOL_VERSION 10 + +/* Define if qsort returns void */ +#define QSORT_TYPE_IS_VOID 1 + +/* Define as the return type of qsort (int or void). */ +#define RETQSORTTYPE void + +/* Size of off_t */ +#define SIZEOF_OFF_T 8 + +/* Define as the base type of the last arg to accept */ +#define SOCKET_SIZE_TYPE socklen_t + +/* Last argument to get/setsockopt */ +/* #undef SOCKOPT_OPTLEN_TYPE */ + +/* #undef SPEED_T_IN_SYS_TYPES */ +/* #undef SPRINTF_RETURNS_PTR */ +#define SPRINTF_RETURNS_INT 1 +/* #undef SPRINTF_RETURNS_GARBAGE */ + +/* Needed to get large file support on HPUX 10.20 */ +/* #undef __STDC_EXT__ */ + +#define STACK_DIRECTION -1 + +/* #undef STRCOLL_BROKEN */ + +/* #undef STRUCT_DIRENT_HAS_D_FILENO */ +#define STRUCT_DIRENT_HAS_D_INO 1 + +/* #undef STRUCT_WINSIZE_IN_SYS_IOCTL */ +/* #undef STRUCT_WINSIZE_IN_TERMIOS */ + +/* Define to name of system eg solaris*/ +#define SYSTEM_TYPE "pc-linux" + +/* Define if you want to have threaded code. This may be undef on client code */ +#define THREAD 1 + +/* Should be client be thread safe */ +#define THREAD_SAFE_CLIENT 1 + +/* READLINE: */ +/* #undef TIOCSTAT_IN_SYS_IOCTL */ + +/* Use multi-byte character routines */ +#define USE_MB 1 +#define USE_MB_IDENT 1 + +/* the pstack backtrace library */ +/* #undef USE_PSTACK */ + +/* Use MySQL RAID */ +#define USE_RAID 1 + +/* Use strcoll() functions when comparing and sorting. */ +#define USE_STRCOLL 1 + +/* Program version */ +#define VERSION "4.0.18" + +/* READLINE: */ +#define VOID_SIGHANDLER 1 + + +/* Leave that blank line there!! Autoheader needs it. + If you're adding to this file, keep in mind: + The entries are in sort -df order: alphabetical, case insensitive, + ignoring punctuation (such as underscores). */ + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASM_TERMBITS_H 1 + +/* Define to 1 if you have the `atod' function. */ +/* #undef HAVE_ATOD */ + +/* Define to 1 if you have the `bcmp' function. */ +#define HAVE_BCMP 1 + +/* Define to 1 if you have the `bfill' function. */ +/* #undef HAVE_BFILL */ + +/* Define to 1 if you have the `bmove' function. */ +/* #undef HAVE_BMOVE */ + +/* Define to 1 if you have the `bzero' function. */ +#define HAVE_BZERO 1 + +/* Define to 1 if you have the `chsize' function. */ +/* #undef HAVE_CHSIZE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CURSES_H 1 + +/* Define to 1 if you have the `cuserid' function. */ +#define HAVE_CUSERID 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the `dlerror' function. */ +#define HAVE_DLERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fcntl' function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fconvert' function. */ +/* #undef HAVE_FCONVERT */ + +/* Define to 1 if you have the `fdatasync' function. */ +#define HAVE_FDATASYNC 1 + +/* Define to 1 if you have the `finite' function. */ +#define HAVE_FINITE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FLOATINGPOINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `fpresetsticky' function. */ +/* #undef HAVE_FPRESETSTICKY */ + +/* Define to 1 if you have the `fpsetmask' function. */ +/* #undef HAVE_FPSETMASK */ + +/* Define to 1 if you have the `fseeko' function. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fsync' function. */ +#define HAVE_FSYNC 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostbyaddr_r' function. */ +#define HAVE_GETHOSTBYADDR_R 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +#define HAVE_GETHOSTBYNAME_R 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getpass' function. */ +#define HAVE_GETPASS 1 + +/* Define to 1 if you have the `getpassphrase' function. */ +/* #undef HAVE_GETPASSPHRASE */ + +/* Define to 1 if you have the `getpwnam' function. */ +#define HAVE_GETPWNAM 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `getwd' function. */ +#define HAVE_GETWD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IEEEFP_H */ + +/* Define to 1 if you have the `index' function. */ +#define HAVE_INDEX 1 + +/* Define to 1 if you have the `initgroups' function. */ +#define HAVE_INITGROUPS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `isnan' function. */ +#define HAVE_ISNAN 1 + +/* Define to 1 if you have the `bind' library (-lbind). */ +/* #undef HAVE_LIBBIND */ + +/* Define to 1 if you have the `compat' library (-lcompat). */ +/* #undef HAVE_LIBCOMPAT */ + +/* Define to 1 if you have the `crypt' library (-lcrypt). */ +#define HAVE_LIBCRYPT 1 + +/* Define to 1 if you have the `c_r' library (-lc_r). */ +/* #undef HAVE_LIBC_R */ + +/* Define to 1 if you have the `dl' library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Define to 1 if you have the `gen' library (-lgen). */ +/* #undef HAVE_LIBGEN */ + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#define HAVE_LIBNSL 1 + +/* Define to 1 if you have the `nsl_r' library (-lnsl_r). */ +/* #undef HAVE_LIBNSL_R */ + +/* Define to 1 if you have the `posix4' library (-lposix4). */ +/* #undef HAVE_LIBPOSIX4 */ + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#define HAVE_LIBPTHREAD 1 + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_CONFIG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `locking' function. */ +/* #undef HAVE_LOCKING */ + +/* Define to 1 if you have the `longjmp' function. */ +#define HAVE_LONGJMP 1 + +/* Define to 1 if you have the `lrand48' function. */ +#define HAVE_LRAND48 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the `madvise' function. */ +#define HAVE_MADVISE 1 + +/* Define to 1 if you have the `mallinfo' function. */ +#define HAVE_MALLINFO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PATHS_H 1 + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define to 1 if you have the `pread' function. */ +#define HAVE_PREAD 1 + +/* Define to 1 if you have the `pthread_attr_create' function. */ +/* #undef HAVE_PTHREAD_ATTR_CREATE */ + +/* Define to 1 if you have the `pthread_attr_getstacksize' function. */ +#define HAVE_PTHREAD_ATTR_GETSTACKSIZE 1 + +/* Define to 1 if you have the `pthread_attr_setprio' function. */ +/* #undef HAVE_PTHREAD_ATTR_SETPRIO */ + +/* Define to 1 if you have the `pthread_attr_setschedparam' function. */ +#define HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1 + +/* Define to 1 if you have the `pthread_attr_setstacksize' function. */ +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 + +/* Define to 1 if you have the `pthread_condattr_create' function. */ +/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ + +/* Define to 1 if you have the `pthread_getsequence_np' function. */ +/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */ + +/* Define to 1 if you have the `pthread_init' function. */ +/* #undef HAVE_PTHREAD_INIT */ + +/* Define to 1 if you have the `pthread_key_delete' function. */ +#define HAVE_PTHREAD_KEY_DELETE 1 + +/* Define to 1 if you have the `pthread_rwlock_rdlock' function. */ +#define HAVE_PTHREAD_RWLOCK_RDLOCK 1 + +/* Define to 1 if you have the `pthread_setprio' function. */ +/* #undef HAVE_PTHREAD_SETPRIO */ + +/* Define to 1 if you have the `pthread_setprio_np' function. */ +/* #undef HAVE_PTHREAD_SETPRIO_NP */ + +/* Define to 1 if you have the `pthread_setschedparam' function. */ +#define HAVE_PTHREAD_SETSCHEDPARAM 1 + +/* Define to 1 if you have the `pthread_sigmask' function. */ +#define HAVE_PTHREAD_SIGMASK 1 + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the `rename' function. */ +#define HAVE_RENAME 1 + +/* Define to 1 if system calls automatically restart after interruption by a + signal. */ +#define HAVE_RESTARTABLE_SYSCALLS 1 + +/* Define to 1 if you have the `rint' function. */ +#define HAVE_RINT 1 + +/* Define to 1 if you have the `rwlock_init' function. */ +/* #undef HAVE_RWLOCK_INIT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SCHED_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SELECT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SEMAPHORE_H 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setupterm' function. */ +/* #undef HAVE_SETUPTERM */ + +/* Define to 1 if you have the `sighold' function. */ +#define HAVE_SIGHOLD 1 + +/* Define to 1 if you have the `sigset' function. */ +#define HAVE_SIGSET 1 + +/* Define to 1 if you have the `sigthreadmask' function. */ +/* #undef HAVE_SIGTHREADMASK */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `stpcpy' function. */ +#define HAVE_STPCPY 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcoll' function. */ +#define HAVE_STRCOLL 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strnlen' function. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if you have the `strpbrk' function. */ +#define HAVE_STRPBRK 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the `strtoull' function. */ +#define HAVE_STRTOULL 1 + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use + `HAVE_STRUCT_STAT_ST_RDEV' instead. */ +#define HAVE_ST_RDEV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYNCH_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_DIR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MALLOC_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PTEM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PTE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STREAM_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VADVISE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR 1 + +/* Define to 1 if you have the `tell' function. */ +/* #undef HAVE_TELL */ + +/* Define to 1 if you have the `tempnam' function. */ +#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMBITS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMCAP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERM_H 1 + +/* Define to 1 if you have the `thr_setconcurrency' function. */ +/* #undef HAVE_THR_SETCONCURRENCY */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ +#define HAVE_UTIME_NULL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_VARARGS_H 1 + +/* Define to 1 if you have the `vidattr' function. */ +/* #undef HAVE_VIDATTR */ + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Name of package */ +#define PACKAGE "mysql" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of a `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of a `char*', as computed by sizeof. */ +#define SIZEOF_CHARP 4 + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Version number of package */ +#define VERSION "4.0.18" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define to make fseeko etc. visible, on some hosts. */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +/* #undef inline */ + +/* Define to `long' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ diff --git a/dlls/csx_sql/extra/include/mysql/my_dbug.h b/dlls/csx_sql/extra/include/mysql/my_dbug.h new file mode 100755 index 00000000..5c88e2e4 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_dbug.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _dbug_h +#define _dbug_h +#ifdef __cplusplus +extern "C" { +#endif +#if !defined(DBUG_OFF) && !defined(_lint) +extern int _db_on_,_no_db_; +extern FILE *_db_fp_; +extern char *_db_process_; +extern int _db_keyword_(const char *keyword); +extern void _db_setjmp_(void); +extern void _db_longjmp_(void); +extern void _db_push_(const char *control); +extern void _db_pop_(void); +extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, + const char **_sfunc_,const char **_sfile_, + uint *_slevel_, char ***); +extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, + uint *_slevel_); +extern void _db_pargs_(uint _line_,const char *keyword); +extern void _db_doprnt_ _VARARGS((const char *format,...)); +extern void _db_dump_(uint _line_,const char *keyword,const char *memory, + uint length); +extern void _db_lock_file(); +extern void _db_unlock_file(); + +#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ + char **_db_framep_; \ + _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ + &_db_framep_) +#define DBUG_LEAVE \ + (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)) +#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);} +#define DBUG_VOID_RETURN {DBUG_LEAVE; return;} +#define DBUG_EXECUTE(keyword,a1) \ + {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} +#define DBUG_PRINT(keyword,arglist) \ + {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} +#define DBUG_PUSH(a1) _db_push_ (a1) +#define DBUG_POP() _db_pop_ () +#define DBUG_PROCESS(a1) (_db_process_ = a1) +#define DBUG_FILE (_db_fp_) +#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) +#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) +#define DBUG_DUMP(keyword,a1,a2)\ + {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}} +#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr) +#define DEBUGGER_OFF _no_db_=1;_db_on_=0; +#define DEBUGGER_ON _no_db_=0 +#define DBUG_LOCK_FILE { _db_lock_file(); } +#define DBUG_UNLOCK_FILE { _db_unlock_file(); } +#define DBUG_ASSERT(A) assert(A) +#else /* No debugger */ + +#define DBUG_ENTER(a1) +#define DBUG_RETURN(a1) return(a1) +#define DBUG_VOID_RETURN return +#define DBUG_EXECUTE(keyword,a1) {} +#define DBUG_PRINT(keyword,arglist) {} +#define DBUG_PUSH(a1) {} +#define DBUG_POP() {} +#define DBUG_PROCESS(a1) {} +#define DBUG_FILE (stderr) +#define DBUG_SETJMP setjmp +#define DBUG_LONGJMP longjmp +#define DBUG_DUMP(keyword,a1,a2) {} +#define DBUG_IN_USE 0 +#define DEBUGGER_OFF +#define DEBUGGER_ON +#define DBUG_LOCK_FILE +#define DBUG_UNLOCK_FILE +#define DBUG_ASSERT(A) {} +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_dir.h b/dlls/csx_sql/extra/include/mysql/my_dir.h new file mode 100755 index 00000000..851b6d8d --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_dir.h @@ -0,0 +1,106 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_dir_h +#define _my_dir_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MY_DIR_H +#define MY_DIR_H + +#include + + /* Defines for my_dir and my_stat */ + +#define MY_S_IFMT S_IFMT /* type of file */ +#define MY_S_IFDIR S_IFDIR /* directory */ +#define MY_S_IFCHR S_IFCHR /* character special */ +#define MY_S_IFBLK S_IFBLK /* block special */ +#define MY_S_IFREG S_IFREG /* regular */ +#define MY_S_IFIFO S_IFIFO /* fifo */ +#define MY_S_ISUID S_ISUID /* set user id on execution */ +#define MY_S_ISGID S_ISGID /* set group id on execution */ +#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */ +#define MY_S_IREAD S_IREAD /* read permission, owner */ +#define MY_S_IWRITE S_IWRITE /* write permission, owner */ +#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */ + +#define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR) +#define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR) +#define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK) +#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG) +#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO) + +#define MY_DONT_SORT 512 /* my_lib; Don't sort files */ +#define MY_WANT_STAT 1024 /* my_lib; stat files */ + + /* typedefs for my_dir & my_stat */ + +#ifdef USE_MY_STAT_STRUCT + +typedef struct my_stat +{ + dev_t st_dev; /* major & minor device numbers */ + ino_t st_ino; /* inode number */ + ushort st_mode; /* file permissons (& suid sgid .. bits) */ + short st_nlink; /* number of links to file */ + ushort st_uid; /* user id */ + ushort st_gid; /* group id */ + dev_t st_rdev; /* more major & minor device numbers (???) */ + off_t st_size; /* size of file */ + time_t st_atime; /* time for last read */ + time_t st_mtime; /* time for last contens modify */ + time_t st_ctime; /* time for last inode or contents modify */ +} MY_STAT; + +#else + +#define MY_STAT struct stat /* Orginal struct have what we need */ + +#endif /* USE_MY_STAT_STRUCT */ + +/* Struct describing one file returned from my_dir */ +typedef struct fileinfo +{ + char *name; + MY_STAT *mystat; +} FILEINFO; + +typedef struct st_my_dir /* Struct returned from my_dir */ +{ + /* + These members are just copies of parts of DYNAMIC_ARRAY structure, + which is allocated right after the end of MY_DIR structure (MEM_ROOT + for storing names is also resides there). We've left them here because + we don't want to change code that uses my_dir. + */ + struct fileinfo *dir_entry; + uint number_off_files; +} MY_DIR; + +extern MY_DIR *my_dir(const char *path,myf MyFlags); +extern void my_dirend(MY_DIR *buffer); +extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags); +extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags); + +#endif /* MY_DIR_H */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_getopt.h b/dlls/csx_sql/extra/include/mysql/my_getopt.h new file mode 100755 index 00000000..3b4551b4 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_getopt.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +C_MODE_START + +enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG, + GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC }; +enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; + +struct my_option +{ + const char *name; /* Name of the option */ + int id; /* unique id or short option */ + const char *comment; /* option comment, for autom. --help */ + gptr *value; /* The variable value */ + gptr *u_max_value; /* The user def. max variable value */ + const char **str_values; /* Pointer to possible values */ + enum get_opt_var_type var_type; + enum get_opt_arg_type arg_type; + longlong def_value; /* Default value */ + longlong min_value; /* Min allowed value */ + longlong max_value; /* Max allowed value */ + longlong sub_size; /* Subtract this from given value */ + long block_size; /* Value should be a mult. of this */ + int app_type; /* To be used by an application */ +}; + +extern char *disabled_my_option; +extern my_bool my_getopt_print_errors; + +extern int handle_options (int *argc, char ***argv, + const struct my_option *longopts, + my_bool (*get_one_option)(int, + const struct my_option *, + char *)); +extern void my_print_help(const struct my_option *options); +extern void my_print_variables(const struct my_option *options); + +ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp); +my_bool getopt_compare_strings(const char *s, const char *t, uint length); +C_MODE_END diff --git a/dlls/csx_sql/extra/include/mysql/my_global.h b/dlls/csx_sql/extra/include/mysql/my_global.h new file mode 100755 index 00000000..e4c0fb44 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_global.h @@ -0,0 +1,1138 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This is the include file that should be included 'first' in every C file. */ + +#ifndef _global_h +#define _global_h + +#ifndef EMBEDDED_LIBRARY +#define HAVE_REPLICATION +#define HAVE_EXTERNAL_CLIENT +#endif + +#if defined( __EMX__) && !defined( MYSQL_SERVER) +/* moved here to use below VOID macro redefinition */ +#define INCL_BASE +#define INCL_NOPMAPI +#include +#endif /* __EMX__ */ + +#ifdef __CYGWIN__ +/* We use a Unix API, so pretend it's not Windows */ +#undef WIN +#undef WIN32 +#undef _WIN +#undef _WIN32 +#undef _WIN64 +#undef __WIN__ +#undef __WIN32__ +#define HAVE_ERRNO_AS_DEFINE +#endif /* __CYGWIN__ */ + +#if defined(i386) && !defined(__i386__) +#define __i386__ +#endif + +/* Macros to make switching between C and C++ mode easier */ +#ifdef __cplusplus +#define C_MODE_START extern "C" { +#define C_MODE_END } +#else +#define C_MODE_START +#define C_MODE_END +#endif + +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) +#include +#elif defined(OS2) +#include +#elif defined(__NETWARE__) +#include +#include +#if defined(__cplusplus) && defined(inline) +#undef inline /* fix configure problem */ +#endif +#else +#include +#if defined(__cplusplus) && defined(inline) +#undef inline /* fix configure problem */ +#endif +#endif /* _WIN32... */ + +/* + The macros below are borrowed from include/linux/compiler.h in the + Linux kernel. Use them to indicate the likelyhood of the truthfulness + of a condition. This serves two purposes - newer versions of gcc will be + able to optimize for branch predication, which could yield siginficant + performance gains in frequently executed sections of the code, and the + other reason to use them is for documentation +*/ + +#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) +#define __builtin_expect(x, expected_value) (x) +#endif + +#define likely(x) __builtin_expect((x),1) +#define unlikely(x) __builtin_expect((x),0) + + +/* Fix problem with S_ISLNK() on Linux */ +#if defined(HAVE_LINUXTHREADS) +#undef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +/* The client defines this to avoid all thread code */ +#if defined(UNDEF_THREADS_HACK) +#undef THREAD +#undef HAVE_mit_thread +#undef HAVE_LINUXTHREADS +#undef HAVE_UNIXWARE7_THREADS +#endif + +#ifdef HAVE_THREADS_WITHOUT_SOCKETS +/* MIT pthreads does not work with unix sockets */ +#undef HAVE_SYS_UN_H +#endif + +#define __EXTENSIONS__ 1 /* We want some extension */ +#ifndef __STDC_EXT__ +#define __STDC_EXT__ 1 /* To get large file support on hpux */ +#endif + +#if defined(THREAD) && !defined(__WIN__) && !defined(OS2) +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ +#endif + +#if !defined(SCO) +#define _REENTRANT 1 /* Some thread libraries require this */ +#endif +#if !defined(_THREAD_SAFE) && !defined(_AIX) +#define _THREAD_SAFE /* Required for OSF1 */ +#endif +#ifndef HAVE_mit_thread +#ifdef HAVE_UNIXWARE7_THREADS +#include +#else +#include /* AIX must have this included first */ +#endif /* HAVE_UNIXWARE7_THREADS */ +#endif /* HAVE_mit_thread */ +#if !defined(SCO) && !defined(_REENTRANT) +#define _REENTRANT 1 /* Threads requires reentrant code */ +#endif +#endif /* THREAD */ + +/* Go around some bugs in different OS and compilers */ +#ifdef _AIX /* By soren@t.dk */ +#define _H_STRINGS +#define _SYS_STREAM_H +/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */ +#define ulonglong2double(A) my_ulonglong2double(A) +#define my_off_t2double(A) my_ulonglong2double(A) +C_MODE_START +double my_ulonglong2double(unsigned long long A); +C_MODE_END +#endif /* _AIX */ + +#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */ +#undef HAVE_SNPRINTF +#endif +#ifdef HAVE_BROKEN_PREAD /* These doesn't work on HPUX 11.x */ +#undef HAVE_PREAD +#undef HAVE_PWRITE +#endif +#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus) +#undef inline +#define inline +#endif + +#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ +#undef HAVE_GETHOSTBYNAME_R +#endif +#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ +#undef HAVE_INITGROUPS +#endif + +/* gcc/egcs issues */ + +#if defined(__GNUC) && defined(__EXCEPTIONS) +#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" +#endif + + +/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ +#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) +#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ +#define __LONG_MAX__ 2147483647 +#endif + +/* Fix problem when linking c++ programs with gcc 3.x */ +#ifdef DEFINE_CXA_PURE_VIRTUAL +#define FIX_GCC_LINKING_PROBLEM extern "C" { int __cxa_pure_virtual() {return 0;} } +#else +#define FIX_GCC_LINKING_PROBLEM +#endif + +/* egcs 1.1.2 has a problem with memcpy on Alpha */ +#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) +#define BAD_MEMCPY +#endif + +/* In Linux-alpha we have atomic.h if we are using gcc */ +#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD) +#define HAVE_ATOMIC_ADD +#define HAVE_ATOMIC_SUB +#endif + +/* In Linux-ia64 including atomic.h will give us an error */ +#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && (defined(__ia64__)||defined(__powerpc64__))) || !defined(THREAD) +#undef HAVE_ATOMIC_ADD +#undef HAVE_ATOMIC_SUB +#endif + +#if defined(_lint) && !defined(lint) +#define lint +#endif +#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) +#define _LONG_LONG 1 /* For AIX string library */ +#endif + +#ifndef stdin +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STDDEF_H +#include +#endif + +#include +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_SYS_TIMEB_H +#include /* Avoid warnings on SCO */ +#endif +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif /* TIME_WITH_SYS_TIME */ +#ifdef HAVE_UNISTD_H +#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) +#define crypt unistd_crypt +#endif +#include +#ifdef HAVE_OPENSSL +#undef crypt +#endif +#endif +#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA) +#undef HAVE_ALLOCA +#undef HAVE_ALLOCA_H +#endif +#ifdef HAVE_ALLOCA_H +#include +#endif +#ifdef HAVE_ATOMIC_ADD +#define __SMP__ +#ifdef HAVE_LINUX_CONFIG_H +#include /* May define CONFIG_SMP */ +#endif +#ifndef CONFIG_SMP +#define CONFIG_SMP +#endif +C_MODE_START +#include +C_MODE_END +#endif +#include /* Recommended by debian */ +/* We need the following to go around a problem with openssl on solaris */ +#if defined(HAVE_CRYPT_H) +#include +#endif + +/* Go around some bugs in different OS and compilers */ +#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H) +#include /* HPUX 10.20 defines ulong here. UGLY !!! */ +#define HAVE_ULONG +#endif +#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */ +#undef HAVE_FINITE +#endif +#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) +/* Fix bug in setrlimit */ +#undef setrlimit +#define setrlimit cma_setrlimit64 +#endif + +#ifdef __QNXNTO__ +/* This has to be after include limits.h */ +#define HAVE_ERRNO_AS_DEFINE +#define HAVE_FCNTL_LOCK +#undef HAVE_FINITE +#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ +#undef LONGLONG_MAX /* standard system library 'limits.h' */ +#endif + +/* We can not live without the following defines */ + +#define USE_MYFUNC 1 /* Must use syscall indirection */ +#define MASTER 1 /* Compile without unireg */ +#define ENGLISH 1 /* Messages in English */ +#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */ +#define USE_REGEX 1 /* We want the use the regex library */ +/* Do not define for ultra sparcs */ +#ifndef OS2 +#define USE_BMOVE512 1 /* Use this unless system bmove is faster */ +#endif + +/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ +#ifdef I_AM_PARANOID +#define DONT_ALLOW_USER_CHANGE 1 +#define DONT_USE_MYSQL_PWD 1 +#endif + +/* Does the system remember a signal handler after a signal ? */ +#ifndef HAVE_BSD_SIGNALS +#define DONT_REMEMBER_SIGNAL +#endif + +/* Define void to stop lint from generating "null effekt" comments */ +#ifndef DONT_DEFINE_VOID +#ifdef _lint +int __void__; +#define VOID(X) (__void__ = (int) (X)) +#else +#undef VOID +#define VOID(X) (X) +#endif +#endif /* DONT_DEFINE_VOID */ + +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) +#define LINT_INIT(var) var=0 /* No uninitialize-warning */ +#else +#define LINT_INIT(var) +#endif + +/* Define some useful general macros */ +#if defined(__cplusplus) && defined(__GNUC__) +#define max(a, b) ((a) >? (b)) +#define min(a, b) ((a) (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#if defined(__EMX__) || !defined(HAVE_UINT) +typedef unsigned int uint; +typedef unsigned short ushort; +#endif + +#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) +#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) +#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; } +#define test(a) ((a) ? 1 : 0) +#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); } +#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); } +#define test_all_bits(a,b) (((a) & (b)) == (b)) +#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) +#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) +#ifndef HAVE_RINT +#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5)) +#endif + +/* Define some general constants */ +#ifndef TRUE +#define TRUE (1) /* Logical true */ +#define FALSE (0) /* Logical false */ +#endif + +#if defined(__GNUC__) +#define function_volatile volatile +#define my_reinterpret_cast(A) reinterpret_cast +#define my_const_cast(A) const_cast +#elif !defined(my_reinterpret_cast) +#define my_reinterpret_cast(A) (A) +#define my_const_cast(A) (A) +#endif +#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) +#define __attribute__(A) +#endif + +/* From old s-system.h */ + +/* + Support macros for non ansi & other old compilers. Since such + things are no longer supported we do nothing. We keep then since + some of our code may still be needed to upgrade old customers. +*/ +#define _VARARGS(X) X +#define _STATIC_VARARGS(X) X +#define _PC(X) X + +#if defined(DBUG_ON) && defined(DBUG_OFF) +#undef DBUG_OFF +#endif + +#if defined(_lint) && !defined(DBUG_OFF) +#define DBUG_OFF +#endif + +#include + +#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ +#define ASCII_BITS_USED 8 /* Bit char used */ +#define NEAR_F /* No near function handling */ + +/* Some types that is different between systems */ + +typedef int File; /* File descriptor */ +#ifndef Socket_defined +typedef int my_socket; /* File descriptor for sockets */ +#define INVALID_SOCKET -1 +#endif +/* Type for fuctions that handles signals */ +#define sig_handler RETSIGTYPE +C_MODE_START +typedef void (*sig_return)();/* Returns type from signal */ +C_MODE_END +#if defined(__GNUC__) && !defined(_lint) +typedef char pchar; /* Mixed prototypes can take char */ +typedef char puchar; /* Mixed prototypes can take char */ +typedef char pbool; /* Mixed prototypes can take char */ +typedef short pshort; /* Mixed prototypes can take short int */ +typedef float pfloat; /* Mixed prototypes can take float */ +#else +typedef int pchar; /* Mixed prototypes can't take char */ +typedef uint puchar; /* Mixed prototypes can't take char */ +typedef int pbool; /* Mixed prototypes can't take char */ +typedef int pshort; /* Mixed prototypes can't take short int */ +typedef double pfloat; /* Mixed prototypes can't take float */ +#endif +C_MODE_START +typedef int (*qsort_cmp)(const void *,const void *); +typedef int (*qsort_cmp2)(void*, const void *,const void *); +C_MODE_END +#ifdef HAVE_mit_thread +#define qsort_t void +#undef QSORT_TYPE_IS_VOID +#define QSORT_TYPE_IS_VOID +#else +#define qsort_t RETQSORTTYPE /* Broken GCC cant handle typedef !!!! */ +#endif +#ifdef HAVE_mit_thread +#define size_socket socklen_t /* Type of last arg to accept */ +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +typedef SOCKET_SIZE_TYPE size_socket; +#endif + +#ifndef SOCKOPT_OPTLEN_TYPE +#define SOCKOPT_OPTLEN_TYPE size_socket +#endif + +/* file create flags */ + +#ifndef O_SHARE /* Probably not windows */ +#define O_SHARE 0 /* Flag to my_open for shared files */ +#ifndef O_BINARY +#define O_BINARY 0 /* Flag to my_open for binary files */ +#endif +#ifndef FILE_BINARY +#define FILE_BINARY O_BINARY /* Flag to my_fopen for binary streams */ +#endif +#ifdef HAVE_FCNTL +#define HAVE_FCNTL_LOCK +#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ +#endif +#endif /* O_SHARE */ + +#ifndef O_TEMPORARY +#define O_TEMPORARY 0 +#endif +#ifndef O_SHORT_LIVED +#define O_SHORT_LIVED 0 +#endif + +/* #define USE_RECORD_LOCK */ + + /* Unsigned types supported by the compiler */ +#define UNSINT8 /* unsigned int8 (char) */ +#define UNSINT16 /* unsigned int16 */ +#define UNSINT32 /* unsigned int32 */ + + /* General constants */ +#define SC_MAXWIDTH 256 /* Max width of screen (for error messages) */ +#define FN_LEN 256 /* Max file name len */ +#define FN_HEADLEN 253 /* Max length of filepart of file name */ +#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */ +#define FN_REFLEN 512 /* Max length of full path-name */ +#define FN_EXTCHAR '.' +#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ +#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ +#define FN_PARENTDIR ".." /* Parentdirectory; Must be a string */ +#define FN_DEVCHAR ':' + +#ifndef FN_LIBCHAR +#ifdef __EMX__ +#define FN_LIBCHAR '\\' +#define FN_ROOTDIR "\\" +#else +#define FN_LIBCHAR '/' +#define FN_ROOTDIR "/" +#endif +#define MY_NFILE 1024 /* This is only used to save filenames */ +#endif + +/* #define EXT_IN_LIBNAME */ +/* #define FN_NO_CASE_SENCE */ +/* #define FN_UPPER_CASE TRUE */ + +/* + Io buffer size; Must be a power of 2 and a multiple of 512. May be + smaller what the disk page size. This influences the speed of the + isam btree library. eg to big to slow. +*/ +#define IO_SIZE 4096 +/* + How much overhead does malloc have. The code often allocates + something like 1024-MALLOC_OVERHEAD bytes +*/ +#ifdef SAFEMALLOC +#define MALLOC_OVERHEAD (8+24+4) +#else +#define MALLOC_OVERHEAD 8 +#endif + /* get memory in huncs */ +#define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) + /* Typical record cash */ +#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) + /* Typical key cash */ +#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD) + + /* Some things that this system doesn't have */ + +#define NO_HASH /* Not needed anymore */ +#ifdef __WIN__ +#define NO_DIR_LIBRARY /* Not standar dir-library */ +#define USE_MY_STAT_STRUCT /* For my_lib */ +#endif + +/* Some things that this system does have */ + +#ifndef HAVE_ITOA +#define USE_MY_ITOA /* There is no itoa */ +#endif + +/* Some defines of functions for portability */ + +#ifndef HAVE_ATOD +#define atod atof +#endif +#ifdef USE_MY_ATOF +#define atof my_atof +extern void init_my_atof(void); +extern double my_atof(const char*); +#endif +#undef remove /* Crashes MySQL on SCO 5.0.0 */ +#ifndef __WIN__ +#ifdef OS2 +#define closesocket(A) soclose(A) +#else +#define closesocket(A) close(A) +#endif +#ifndef ulonglong2double +#define ulonglong2double(A) ((double) (ulonglong) (A)) +#define my_off_t2double(A) ((double) (my_off_t) (A)) +#endif +#endif + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif +#define ulong_to_double(X) ((double) (ulong) (X)) +#define SET_STACK_SIZE(X) /* Not needed on real machines */ + +#if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R) +#define strtok_r(A,B,C) strtok((A),(B)) +#endif + +/* Remove some things that mit_thread break or doesn't support */ +#if defined(HAVE_mit_thread) && defined(THREAD) +#undef HAVE_PREAD +#undef HAVE_REALPATH +#undef HAVE_MLOCK +#undef HAVE_TEMPNAM /* Use ours */ +#undef HAVE_PTHREAD_SETPRIO +#undef HAVE_FTRUNCATE +#undef HAVE_READLINK +#endif + +/* This is from the old m-machine.h file */ + +#if SIZEOF_LONG_LONG > 4 +#define HAVE_LONG_LONG 1 +#endif + +/* + Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define + ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined. + Also on Windows we define these constants by hand in config-win.h. +*/ + +#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) +#define LONGLONG_MIN ((long long) 0x8000000000000000LL) +#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL) +#endif + +#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX) +/* First check for ANSI C99 definition: */ +#ifdef ULLONG_MAX +#define ULONGLONG_MAX ULLONG_MAX +#else +#define ULONGLONG_MAX ((unsigned long long)(~0ULL)) +#endif +#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/ + +#if SIZEOF_LONG == 4 +#define INT_MIN32 (long) 0x80000000L +#define INT_MAX32 (long) 0x7FFFFFFFL +#define INT_MIN24 ((long) 0xff800000L) +#define INT_MAX24 0x007fffffL +#define INT_MIN16 ((short int) 0x8000) +#define INT_MAX16 0x7FFF +#define INT_MIN8 ((char) 0x80) +#define INT_MAX8 ((char) 0x7F) +#else /* Probably Alpha */ +#define INT_MIN32 ((long) (int) 0x80000000) +#define INT_MAX32 ((long) (int) 0x7FFFFFFF) +#define INT_MIN24 ((long) (int) 0xff800000) +#define INT_MAX24 ((long) (int) 0x007fffff) +#define INT_MIN16 ((short int) 0xffff8000) +#define INT_MAX16 ((short int) 0x00007FFF) +#endif + +/* From limits.h instead */ +#ifndef DBL_MIN +#define DBL_MIN 4.94065645841246544e-324 +#define FLT_MIN ((float)1.40129846432481707e-45) +#endif +#ifndef DBL_MAX +#define DBL_MAX 1.79769313486231470e+308 +#define FLT_MAX ((float)3.40282346638528860e+38) +#endif + +/* + Max size that must be added to a so that we know Size to make + adressable obj. +*/ +#if SIZEOF_CHARP == 4 +typedef long my_ptrdiff_t; +#else +typedef long long my_ptrdiff_t; +#endif + +#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) +#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) +/* Size to make adressable obj. */ +#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t))) + /* Offset of filed f in structure t */ +#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) +#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size) +#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B)) + +#define NullS (char *) 0 +/* Nowdays we do not support MessyDos */ +#ifndef NEAR +#define NEAR /* Who needs segments ? */ +#define FAR /* On a good machine */ +#ifndef HUGE_PTR +#define HUGE_PTR +#endif +#endif +#if defined(__IBMC__) || defined(__IBMCPP__) +#define STDCALL _System _Export +#elif !defined( STDCALL) +#define STDCALL +#endif + +/* Typdefs for easyier portability */ + +#if defined(VOIDTYPE) +typedef void *gptr; /* Generic pointer */ +#else +typedef char *gptr; /* Generic pointer */ +#endif +#ifndef HAVE_INT_8_16_32 +typedef char int8; /* Signed integer >= 8 bits */ +typedef short int16; /* Signed integer >= 16 bits */ +#endif +#ifndef HAVE_UCHAR +typedef unsigned char uchar; /* Short for unsigned char */ +#endif +typedef unsigned char uint8; /* Short for unsigned integer >= 8 bits */ +typedef unsigned short uint16; /* Short for unsigned integer >= 16 bits */ + +#if SIZEOF_INT == 4 +#ifndef HAVE_INT_8_16_32 +typedef int int32; +#endif +typedef unsigned int uint32; /* Short for unsigned integer >= 32 bits */ +#elif SIZEOF_LONG == 4 +#ifndef HAVE_INT_8_16_32 +typedef long int32; +#endif +typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */ +#else +error "Neither int or long is of 4 bytes width" +#endif + +#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC) +typedef unsigned long ulong; /* Short for unsigned long */ +#endif +#ifndef longlong_defined +#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 +typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ +typedef long long int longlong; +#else +typedef unsigned long ulonglong; /* ulong or unsigned long long */ +typedef long longlong; +#endif +#endif + +/* typedef used for length of string; Should be unsigned! */ +typedef ulong size_str; + +#ifdef USE_RAID +/* + The following is done with a if to not get problems with pre-processors + with late define evaluation +*/ +#if SIZEOF_OFF_T == 4 +#define SYSTEM_SIZEOF_OFF_T 4 +#else +#define SYSTEM_SIZEOF_OFF_T 8 +#endif +#undef SIZEOF_OFF_T +#define SIZEOF_OFF_T 8 +#else +#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T +#endif /* USE_RAID */ + +#if SIZEOF_OFF_T > 4 +typedef ulonglong my_off_t; +#else +typedef unsigned long my_off_t; +#endif +#define MY_FILEPOS_ERROR (~(my_off_t) 0) +#if !defined(__WIN__) && !defined(OS2) +typedef off_t os_off_t; +#endif + +#if defined(__WIN__) +#define socket_errno WSAGetLastError() +#define SOCKET_EINTR WSAEINTR +#define SOCKET_EAGAIN WSAEINPROGRESS +#define SOCKET_EWOULDBLOCK WSAEINPROGRESS +#define SOCKET_ENFILE ENFILE +#define SOCKET_EMFILE EMFILE +#elif defined(OS2) +#define socket_errno sock_errno() +#define SOCKET_EINTR SOCEINTR +#define SOCKET_EAGAIN SOCEINPROGRESS +#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK +#define SOCKET_ENFILE SOCENFILE +#define SOCKET_EMFILE SOCEMFILE +#define closesocket(A) soclose(A) +#else /* Unix */ +#define socket_errno errno +#define closesocket(A) close(A) +#define SOCKET_EINTR EINTR +#define SOCKET_EAGAIN EAGAIN +#define SOCKET_EWOULDBLOCK EWOULDBLOCK +#define SOCKET_ENFILE ENFILE +#define SOCKET_EMFILE EMFILE +#endif + +typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ +typedef short int15; /* Most effective integer 0 <= x <= 32767 */ +typedef char *my_string; /* String of characters */ +typedef unsigned long size_s; /* Size of strings (In string-funcs) */ +typedef int myf; /* Type of MyFlags in my_funcs */ +#ifndef byte_defined +typedef char byte; /* Smallest addressable unit */ +#endif +typedef char my_bool; /* Small bool */ +#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) +typedef char bool; /* Ordinary boolean values 0 1 */ +#endif + /* Macros for converting *constants* to the right type */ +#define INT8(v) (int8) (v) +#define INT16(v) (int16) (v) +#define INT32(v) (int32) (v) +#define MYF(v) (myf) (v) + +#ifndef LL +#ifdef HAVE_LONG_LONG +#define LL(A) A ## LL +#else +#define LL(A) A ## L +#endif +#endif + +/* + Defines to make it possible to prioritize register assignments. No + longer that important with modern compilers. +*/ +#ifndef USING_X +#define reg1 register +#define reg2 register +#define reg3 register +#define reg4 register +#define reg5 register +#define reg6 register +#define reg7 register +#define reg8 register +#define reg9 register +#define reg10 register +#define reg11 register +#define reg12 register +#define reg13 register +#define reg14 register +#define reg15 register +#define reg16 register +#endif + +/* + Sometimes we want to make sure that the variable is not put into + a register in debugging mode so we can see its value in the core +*/ + +#ifndef DBUG_OFF +#define dbug_volatile volatile +#else +#define dbug_volatile +#endif + +/* Defines for time function */ +#define SCALE_SEC 100 +#define SCALE_USEC 10000 +#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ +#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ + +#ifndef set_timespec +#ifdef HAVE_TIMESPEC_TS_SEC +#define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; } +#else +#define set_timespec(ABSTIME,SEC) \ +{\ + struct timeval tv;\ + gettimeofday(&tv,0);\ + (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ + (ABSTIME).tv_nsec=tv.tv_usec*1000;\ +} +#endif /* HAVE_TIMESPEC_TS_SEC */ +#endif /* set_timespec */ + +/* + Define-funktions for reading and storing in machine independent format + (low byte first) +*/ + +/* Optimized store functions for Intel x86 */ +#if defined(__i386__) && !defined(_WIN64) +#define sint2korr(A) (*((int16 *) (A))) +#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0])) : \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0]))) +#define sint4korr(A) (*((long *) (A))) +#define uint2korr(A) (*((uint16 *) (A))) +#ifdef HAVE_purify +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16)) +#else +#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF) +#endif +#define uint4korr(A) (*((unsigned long *) (A))) +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint8korr(A) (*((ulonglong *) (A))) +#define sint8korr(A) (*((longlong *) (A))) +#define int2store(T,A) *((uint16*) (T))= (uint16) (A) +#define int3store(T,A) { *(T)= (uchar) ((A));\ + *(T+1)=(uchar) (((uint) (A) >> 8));\ + *(T+2)=(uchar) (((A) >> 16)); } +#define int4store(T,A) *((long *) (T))= (long) (A) +#define int5store(T,A) { *(T)= (uchar)((A));\ + *((T)+1)=(uchar) (((A) >> 8));\ + *((T)+2)=(uchar) (((A) >> 16));\ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); } +#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) + +typedef union { + double v; + long m[2]; +} doubleget_union; +#define doubleget(V,M) \ +{ doubleget_union _tmp; \ + _tmp.m[0] = *((long*)(M)); \ + _tmp.m[1] = *(((long*) (M))+1); \ + (V) = _tmp.v; } +#define doublestore(T,V) { *((long *) T) = ((doubleget_union *)&V)->m[0]; \ + *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; } +#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); } +#define float8get(V,M) doubleget((V),(M)) +#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float)) +#define float8store(V,M) doublestore((V),(M)) +#endif /* __i386__ */ + +#ifndef sint2korr +#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\ + ((int16) ((int16) (A)[1]) << 8)) +#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0])) : \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0]))) +#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\ + (((int32) ((uchar) (A)[1]) << 8)) +\ + (((int32) ((uchar) (A)[2]) << 16)) +\ + (((int32) ((int16) (A)[3]) << 24))) +#define sint8korr(A) (longlong) uint8korr(A) +#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\ + ((uint16) ((uchar) (A)[1]) << 8)) +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16)) +#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) (((uint32) ((uchar) (A)[4])) +\ + (((uint32) ((uchar) (A)[5])) << 8) +\ + (((uint32) ((uchar) (A)[6])) << 16) +\ + (((uint32) ((uchar) (A)[7])) << 24))) <<\ + 32)) +#define int2store(T,A) { uint def_temp= (uint) (A) ;\ + *((uchar*) (T))= (uchar)(def_temp); \ + *((uchar*) (T+1))=(uchar)((def_temp >> 8)); } +#define int3store(T,A) { /*lint -save -e734 */\ + *((uchar*)(T))=(uchar) ((A));\ + *((uchar*) (T)+1)=(uchar) (((A) >> 8));\ + *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \ + /*lint -restore */} +#define int4store(T,A) { *(T)=(char) ((A));\ + *((T)+1)=(char) (((A) >> 8));\ + *((T)+2)=(char) (((A) >> 16));\ + *((T)+3)=(char) (((A) >> 24)); } +#define int5store(T,A) { *(T)=((A));\ + *((T)+1)=(((A) >> 8));\ + *((T)+2)=(((A) >> 16));\ + *((T)+3)=(((A) >> 24)); \ + *((T)+4)=(((A) >> 32)); } +#define int8store(T,A) { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \ + int4store((T),def_temp); \ + int4store((T+4),def_temp2); \ + } +#ifdef WORDS_BIGENDIAN +#define float4store(T,A) { *(T)= ((byte *) &A)[3];\ + *((T)+1)=(char) ((byte *) &A)[2];\ + *((T)+2)=(char) ((byte *) &A)[1];\ + *((T)+3)=(char) ((byte *) &A)[0]; } + +#define float4get(V,M) { float def_temp;\ + ((byte*) &def_temp)[0]=(M)[3];\ + ((byte*) &def_temp)[1]=(M)[2];\ + ((byte*) &def_temp)[2]=(M)[1];\ + ((byte*) &def_temp)[3]=(M)[0];\ + (V)=def_temp; } +#define float8store(T,V) { *(T)= ((byte *) &V)[7];\ + *((T)+1)=(char) ((byte *) &V)[6];\ + *((T)+2)=(char) ((byte *) &V)[5];\ + *((T)+3)=(char) ((byte *) &V)[4];\ + *((T)+4)=(char) ((byte *) &V)[3];\ + *((T)+5)=(char) ((byte *) &V)[2];\ + *((T)+6)=(char) ((byte *) &V)[1];\ + *((T)+7)=(char) ((byte *) &V)[0]; } + +#define float8get(V,M) { double def_temp;\ + ((byte*) &def_temp)[0]=(M)[7];\ + ((byte*) &def_temp)[1]=(M)[6];\ + ((byte*) &def_temp)[2]=(M)[5];\ + ((byte*) &def_temp)[3]=(M)[4];\ + ((byte*) &def_temp)[4]=(M)[3];\ + ((byte*) &def_temp)[5]=(M)[2];\ + ((byte*) &def_temp)[6]=(M)[1];\ + ((byte*) &def_temp)[7]=(M)[0];\ + (V) = def_temp; } +#else +#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float)) +#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float)) + +#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) +#define doublestore(T,V) { *(T)= ((byte *) &V)[4];\ + *((T)+1)=(char) ((byte *) &V)[5];\ + *((T)+2)=(char) ((byte *) &V)[6];\ + *((T)+3)=(char) ((byte *) &V)[7];\ + *((T)+4)=(char) ((byte *) &V)[0];\ + *((T)+5)=(char) ((byte *) &V)[1];\ + *((T)+6)=(char) ((byte *) &V)[2];\ + *((T)+7)=(char) ((byte *) &V)[3]; } +#define doubleget(V,M) { double def_temp;\ + ((byte*) &def_temp)[0]=(M)[4];\ + ((byte*) &def_temp)[1]=(M)[5];\ + ((byte*) &def_temp)[2]=(M)[6];\ + ((byte*) &def_temp)[3]=(M)[7];\ + ((byte*) &def_temp)[4]=(M)[0];\ + ((byte*) &def_temp)[5]=(M)[1];\ + ((byte*) &def_temp)[6]=(M)[2];\ + ((byte*) &def_temp)[7]=(M)[3];\ + (V) = def_temp; } +#endif /* __FLOAT_WORD_ORDER */ + +#define float8get(V,M) doubleget((V),(M)) +#define float8store(V,M) doublestore((V),(M)) +#endif /* WORDS_BIGENDIAN */ + +#endif /* sint2korr */ + +/* + Define-funktions for reading and storing in machine format from/to + short/long to/from some place in memory V should be a (not + register) variable, M is a pointer to byte +*/ + +#ifdef WORDS_BIGENDIAN + +#define ushortget(V,M) { V = (uint16) (((uint16) ((uchar) (M)[1]))+\ + ((uint16) ((uint16) (M)[0]) << 8)); } +#define shortget(V,M) { V = (short) (((short) ((uchar) (M)[1]))+\ + ((short) ((short) (M)[0]) << 8)); } +#define longget(V,M) { int32 def_temp;\ + ((byte*) &def_temp)[0]=(M)[0];\ + ((byte*) &def_temp)[1]=(M)[1];\ + ((byte*) &def_temp)[2]=(M)[2];\ + ((byte*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } +#define ulongget(V,M) { uint32 def_temp;\ + ((byte*) &def_temp)[0]=(M)[0];\ + ((byte*) &def_temp)[1]=(M)[1];\ + ((byte*) &def_temp)[2]=(M)[2];\ + ((byte*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } +#define shortstore(T,A) { uint def_temp=(uint) (A) ;\ + *(T+1)=(char)(def_temp); \ + *(T+0)=(char)(def_temp >> 8); } +#define longstore(T,A) { *((T)+3)=((A));\ + *((T)+2)=(((A) >> 8));\ + *((T)+1)=(((A) >> 16));\ + *((T)+0)=(((A) >> 24)); } + +#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double)) +#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double)) +#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong)) +#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong)) + +#else + +#define ushortget(V,M) { V = uint2korr(M); } +#define shortget(V,M) { V = sint2korr(M); } +#define longget(V,M) { V = sint4korr(M); } +#define ulongget(V,M) { V = uint4korr(M); } +#define shortstore(T,V) int2store(T,V) +#define longstore(T,V) int4store(T,V) +#ifndef doubleget +#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double)) +#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double)) +#endif /* doubleget */ +#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong)) +#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong)) + +#endif /* WORDS_BIGENDIAN */ + +/* sprintf does not always return the number of bytes :- */ +#ifdef SPRINTF_RETURNS_INT +#define my_sprintf(buff,args) sprintf args +#else +#ifdef SPRINTF_RETURNS_PTR +#define my_sprintf(buff,args) ((int)(sprintf args - buff)) +#else +#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff)) +#endif +#endif + +#ifndef THREAD +#define thread_safe_increment(V,L) (V)++ +#define thread_safe_add(V,C,L) (V)+=(C) +#define thread_safe_sub(V,C,L) (V)-=(C) +#define statistic_increment(V,L) (V)++ +#define statistic_add(V,C,L) (V)+=(C) +#endif + +#ifdef HAVE_OPENSSL +#include +#if OPENSSL_VERSION_NUMBER < 0x0090700f +#define DES_cblock des_cblock +#define DES_key_schedule des_key_schedule +#define DES_set_key_unchecked(k,ks) des_set_key_unchecked((k),*(ks)) +#define DES_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e) des_ede3_cbc_encrypt((i),(o),(l),*(k1),*(k2),*(k3),(iv),(e)) +#endif +#endif + +#endif /* my_global_h */ diff --git a/dlls/csx_sql/extra/include/mysql/my_list.h b/dlls/csx_sql/extra/include/mysql/my_list.h new file mode 100755 index 00000000..0f56d4c5 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_list.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _list_h_ +#define _list_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_list { + struct st_list *prev,*next; + void *data; +} LIST; + +typedef int (*list_walk_action)(void *,void *); + +extern LIST *list_add(LIST *root,LIST *element); +extern LIST *list_delete(LIST *root,LIST *element); +extern LIST *list_cons(void *data,LIST *root); +extern LIST *list_reverse(LIST *root); +extern void list_free(LIST *root,pbool free_data); +extern uint list_length(LIST *list); +extern int list_walk(LIST *list,list_walk_action action,gptr argument); + +#define rest(a) ((a)->next) +#define list_push(a,b) (a)=list_cons((b),(a)) +#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); } + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_net.h b/dlls/csx_sql/extra/include/mysql/my_net.h new file mode 100755 index 00000000..7b42afa1 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_net.h @@ -0,0 +1,122 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + thread safe version of some common functions: + my_inet_ntoa + + This file is also used to make handling of sockets and ioctl() + portable accross systems. + +*/ + +#ifndef _my_net_h +#define _my_net_h +C_MODE_START + +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_POLL +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__) +#include +#include +#include +#if !defined(alpha_linux_port) +#include +#endif +#endif + +#if defined(__EMX__) +#include +#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C))) +#undef HAVE_FCNTL +#endif /* defined(__EMX__) */ + +#if defined(MSDOS) || defined(__WIN__) +#define O_NONBLOCK 1 /* For emulation of fcntl() */ +#endif + +/* + On OSes which don't have the in_addr_t, we guess that using uint32 is the best + possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit + & Solaris64bit, in_addr_t is equivalent to uint32. And on Linux32bit too. +*/ +#ifndef HAVE_IN_ADDR_T +#define in_addr_t uint32 +#endif + +/* Thread safe or portable version of some functions */ + +void my_inet_ntoa(struct in_addr in, char *buf); + +/* + Handling of gethostbyname_r() +*/ + +#if !defined(HPUX10) +struct hostent; +#endif /* HPUX */ +#if !defined(HAVE_GETHOSTBYNAME_R) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +void my_gethostbyname_r_free(); +#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +#define my_gethostbyname_r_free() +#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX10) +#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) +#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */ + +#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT) +#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +#define my_gethostbyname_r_free() +#else +#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E)) +#define my_gethostbyname_r_free() +#endif /* !defined(HAVE_GETHOSTBYNAME_R) */ + +#ifndef GETHOSTBYNAME_BUFF_SIZE +#define GETHOSTBYNAME_BUFF_SIZE 2048 +#endif + +/* On SCO you get a link error when refering to h_errno */ +#ifdef SCO +#undef h_errno +#define h_errno errno +#endif + +C_MODE_END +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_no_pthread.h b/dlls/csx_sql/extra/include/mysql/my_no_pthread.h new file mode 100755 index 00000000..0a034f78 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_no_pthread.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This undefs some pthread mutex locks when one isn't using threads + to make thread safe code, that should also work in single thread + environment, easier to use. +*/ + +#if !defined(_my_no_pthread_h) && !defined(THREAD) +#define _my_no_pthread_h + +#define pthread_mutex_init(A,B) +#define pthread_mutex_lock(A) +#define pthread_mutex_unlock(A) +#define pthread_mutex_destroy(A) + +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_nosys.h b/dlls/csx_sql/extra/include/mysql/my_nosys.h new file mode 100755 index 00000000..605906f0 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_nosys.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Header to remove use of my_functions in functions where we need speed and + where calls to posix functions should work +*/ +#ifndef _my_nosys_h +#define _my_nosys_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __MY_NOSYS__ +#define __MY_NOSYS__ + +#ifdef MSDOS +#include /* Get prototypes for read()... */ +#endif +#ifndef HAVE_STDLIB_H +#include +#endif + +#undef my_read /* Can be predefined in raid.h */ +#undef my_write +#undef my_seek +#define my_read(a,b,c,d) my_quick_read(a,b,c,d) +#define my_write(a,b,c,d) my_quick_write(a,b,c) +extern uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf myFlags); +extern uint my_quick_write(File Filedes,const byte *Buffer,uint Count); + +#if !defined(SAFEMALLOC) && defined(USE_HALLOC) +#define my_malloc(a,b) halloc(a,1) +#define my_no_flags_free(a) hfree(a) +#endif + +#endif /* __MY_NOSYS__ */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/my_pthread.h b/dlls/csx_sql/extra/include/mysql/my_pthread.h new file mode 100755 index 00000000..40302f48 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_pthread.h @@ -0,0 +1,693 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Defines to make different thread packages compatible */ + +#ifndef _my_pthread_h +#define _my_pthread_h + +#include +#ifndef ETIME +#define ETIME ETIMEDOUT /* For FreeBSD */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#if defined(__WIN__) || defined(OS2) + +#ifdef OS2 +typedef ULONG HANDLE; +typedef ULONG DWORD; +typedef int sigset_t; +#endif + +#ifdef OS2 +typedef HMTX pthread_mutex_t; +#else +typedef CRITICAL_SECTION pthread_mutex_t; +#endif +typedef HANDLE pthread_t; +typedef struct thread_attr { + DWORD dwStackSize ; + DWORD dwCreatingFlag ; + int priority ; +} pthread_attr_t ; + +typedef struct { int dummy; } pthread_condattr_t; + +/* Implementation of posix conditions */ + +typedef struct st_pthread_link { + DWORD thread_id; + struct st_pthread_link *next; +} pthread_link; + +typedef struct { + uint32 waiting; +#ifdef OS2 + HEV semaphore; +#else + HANDLE semaphore; +#endif +} pthread_cond_t; + + +#ifndef OS2 +struct timespec { /* For pthread_cond_timedwait() */ + time_t tv_sec; + long tv_nsec; +}; +#endif + +typedef int pthread_mutexattr_t; +#define win_pthread_self my_thread_var->pthread_self +#ifdef OS2 +#define pthread_handler_decl(A,B) void * _Optlink A(void *B) +typedef void * (_Optlink *pthread_handler)(void *); +#else +#define pthread_handler_decl(A,B) void * __cdecl A(void *B) +typedef void * (__cdecl *pthread_handler)(void *); +#endif + +void win_pthread_init(void); +int win_pthread_setspecific(void *A,void *B,uint length); +int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *); +int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); +int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime); +int pthread_cond_signal(pthread_cond_t *cond); +int pthread_cond_broadcast(pthread_cond_t *cond); +int pthread_cond_destroy(pthread_cond_t *cond); +int pthread_attr_init(pthread_attr_t *connect_att); +int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack); +int pthread_attr_setprio(pthread_attr_t *connect_att,int priority); +int pthread_attr_destroy(pthread_attr_t *connect_att); +struct tm *localtime_r(const time_t *timep,struct tm *tmp); + +void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ + +#ifndef OS2 +#define ETIMEDOUT 145 /* Win32 doesn't have this */ +#define getpid() GetCurrentThreadId() +#endif +#define pthread_self() win_pthread_self +#define HAVE_LOCALTIME_R 1 +#define _REENTRANT 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 + +#ifdef USE_TLS /* For LIBMYSQL.DLL */ +#undef SAFE_MUTEX /* This will cause conflicts */ +#define pthread_key(T,V) DWORD V +#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF) +#define pthread_key_delete(A) TlsFree(A) +#define pthread_getspecific(A) (TlsGetValue(A)) +#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A)) +#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V)) +#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V))) +#define pthread_setspecific(A,B) (!TlsSetValue((A),(B))) +#else +#define pthread_key(T,V) __declspec(thread) T V +#define pthread_key_create(A,B) pthread_dummy(0) +#define pthread_key_delete(A) pthread_dummy(0) +#define pthread_getspecific(A) (&(A)) +#define my_pthread_getspecific(T,A) (&(A)) +#define my_pthread_getspecific_ptr(T,V) (V) +#define my_pthread_setspecific_ptr(T,V) ((T)=(V),0) +#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) +#endif /* USE_TLS */ + +#define pthread_equal(A,B) ((A) == (B)) +#ifdef OS2 +extern int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *); +extern int pthread_mutex_lock (pthread_mutex_t *); +extern int pthread_mutex_unlock (pthread_mutex_t *); +extern int pthread_mutex_destroy (pthread_mutex_t *); +#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A) +#define pthread_kill(A,B) raise(B) +#define pthread_exit(A) pthread_dummy() +#else +#define pthread_mutex_init(A,B) InitializeCriticalSection(A) +#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) +#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT) +#define pthread_mutex_unlock(A) LeaveCriticalSection(A) +#define pthread_mutex_destroy(A) DeleteCriticalSection(A) +#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) +#define pthread_kill(A,B) pthread_dummy(0) +#endif /* OS2 */ + +/* Dummy defines for easier code */ +#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) +#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B) +#define pthread_attr_setscope(A,B) +#define pthread_detach_this_thread() +#define pthread_condattr_init(A) +#define pthread_condattr_destroy(A) + +/*Irena: compiler does not like this: */ +/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */ +#define my_pthread_getprio(thread_id) pthread_dummy(0) + +#elif defined(HAVE_UNIXWARE7_THREADS) + +#include +#include + +#ifndef _REENTRANT +#define _REENTRANT +#endif + +#define HAVE_NONPOSIX_SIGWAIT +#define pthread_t thread_t +#define pthread_cond_t cond_t +#define pthread_mutex_t mutex_t +#define pthread_key_t thread_key_t +typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */ + +#define pthread_key_create(A,B) thr_keycreate((A),(B)) +#define pthread_key_delete(A) thr_keydelete(A) + +#define pthread_handler_decl(A,B) void *A(void *B) +#define pthread_key(T,V) pthread_key_t V + +void * my_pthread_getspecific_imp(pthread_key_t key); +#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B)) +#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V) + +#define pthread_setspecific(A,B) thr_setspecific(A,B) +#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V) + +#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A)) +#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL) +#define pthread_cond_destroy(a) cond_destroy(a) +#define pthread_cond_signal(a) cond_signal(a) +#define pthread_cond_wait(a,b) cond_wait((a),(b)) +#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c)) +#define pthread_cond_broadcast(a) cond_broadcast(a) + +#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL) +#define pthread_mutex_lock(a) mutex_lock(a) +#define pthread_mutex_unlock(a) mutex_unlock(a) +#define pthread_mutex_destroy(a) mutex_destroy(a) + +#define pthread_self() thr_self() +#define pthread_exit(A) thr_exit(A) +#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0) +#define pthread_kill(A,B) thr_kill((A),(B)) +#define HAVE_PTHREAD_KILL + +#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C)) + +extern int my_sigwait(const sigset_t *set,int *sig); + +#define pthread_detach_this_thread() pthread_dummy(0) + +#define pthread_attr_init(A) pthread_dummy(0) +#define pthread_attr_destroy(A) pthread_dummy(0) +#define pthread_attr_setscope(A,B) pthread_dummy(0) +#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) +#define my_pthread_setprio(A,B) pthread_dummy (0) +#define my_pthread_getprio(A) pthread_dummy (0) +#define my_pthread_attr_setprio(A,B) pthread_dummy(0) + +#else /* Normal threads */ + +#ifdef HAVE_rts_threads +#define sigwait org_sigwait +#include +#undef sigwait +#endif +#undef _REENTRANT /* Fix if _REENTRANT is in pthread.h */ +#include +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifdef HAVE_THR_SETCONCURRENCY +#include /* Probably solaris */ +#endif +#ifdef HAVE_SCHED_H +#include +#endif +#ifdef HAVE_SYNCH_H +#include +#endif +#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2)) +#error Requires at least rev 2 of EMX pthreads library. +#endif + +#ifdef __NETWARE__ +void my_pthread_exit(void *status); +#define pthread_exit(A) my_pthread_exit(A) +#endif + +extern int my_pthread_getprio(pthread_t thread_id); + +#define pthread_key(T,V) pthread_key_t V +#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) +#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) +#define pthread_detach_this_thread() +#define pthread_handler_decl(A,B) void *A(void *B) +typedef void *(* pthread_handler)(void *); + +/* Test first for RTS or FSU threads */ + +#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) +#define HAVE_rts_threads +extern int my_pthread_create_detached; +#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +#define PTHREAD_CREATE_DETACHED &my_pthread_create_detached +#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL +#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL +#define USE_ALARM_THREAD +#elif defined(HAVE_mit_thread) +#define USE_ALARM_THREAD +#undef HAVE_LOCALTIME_R +#define HAVE_LOCALTIME_R +#undef HAVE_PTHREAD_ATTR_SETSCOPE +#define HAVE_PTHREAD_ATTR_SETSCOPE +#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE /* If we are running linux */ +#undef HAVE_RWLOCK_T +#undef HAVE_RWLOCK_INIT +#undef HAVE_PTHREAD_RWLOCK_RDLOCK +#undef HAVE_SNPRINTF + +#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) +#define signal(A,B) pthread_signal((A),(void (*)(int)) (B)) +#define my_pthread_attr_setprio(A,B) +#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ + +#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910 +int sigwait(sigset_t *set, int *sig); +#endif + +#if defined(HAVE_UNIXWARE7_POSIX) +#undef HAVE_NONPOSIX_SIGWAIT +#define HAVE_NONPOSIX_SIGWAIT /* sigwait takes only 1 argument */ +#endif + +#ifndef HAVE_NONPOSIX_SIGWAIT +#define my_sigwait(A,B) sigwait((A),(B)) +#else +int my_sigwait(const sigset_t *set,int *sig); +#endif + +#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT +#ifndef SAFE_MUTEX +#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b)) +extern int my_pthread_mutex_init(pthread_mutex_t *mp, + const pthread_mutexattr_t *attr); +#endif /* SAFE_MUTEX */ +#define pthread_cond_init(a,b) my_pthread_cond_init((a),(b)) +extern int my_pthread_cond_init(pthread_cond_t *mp, + const pthread_condattr_t *attr); +#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ + +#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK) +#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C)) +#endif + +#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) +int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ +#endif +#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset) +#define sigset(A,B) do { struct sigaction s; sigset_t set; \ + sigemptyset(&set); \ + s.sa_handler = (B); \ + s.sa_mask = set; \ + s.sa_flags = 0; \ + sigaction((A), &s, (struct sigaction *) NULL); \ + } while (0) +#endif + +#ifndef my_pthread_setprio +#if defined(HAVE_PTHREAD_SETPRIO_NP) /* FSU threads */ +#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B)) +#elif defined(HAVE_PTHREAD_SETPRIO) +#define my_pthread_setprio(A,B) pthread_setprio((A),(B)) +#else +extern void my_pthread_setprio(pthread_t thread_id,int prior); +#endif +#endif + +#ifndef my_pthread_attr_setprio +#ifdef HAVE_PTHREAD_ATTR_SETPRIO +#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B)) +#else +extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority); +#endif +#endif + +#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS) +#define pthread_attr_setscope(A,B) +#undef HAVE_GETHOSTBYADDR_R /* No definition */ +#endif + +#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX) +extern int my_pthread_cond_timedwait(pthread_cond_t *cond, + pthread_mutex_t *mutex, + struct timespec *abstime); +#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) +#endif + +#if defined(OS2) +#define my_pthread_getspecific(T,A) ((T) &(A)) +#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) +#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC) +#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B)) +#else +#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B)) +void *my_pthread_getspecific_imp(pthread_key_t key); +#endif /* OS2 */ + +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *clock, struct tm *res); +#endif + +#ifdef HAVE_PTHREAD_CONDATTR_CREATE +/* DCE threads on HPUX 10.20 */ +#define pthread_condattr_init pthread_condattr_create +#define pthread_condattr_destroy pthread_condattr_delete +#endif + +/* FSU THREADS */ +#if !defined(HAVE_PTHREAD_KEY_DELETE) && !defined(pthread_key_delete) +#define pthread_key_delete(A) pthread_dummy(0) +#endif + +#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */ +#define pthread_cond_destroy(A) pthread_dummy(0) +#define pthread_mutex_destroy(A) pthread_dummy(0) +#define pthread_attr_delete(A) pthread_dummy(0) +#define pthread_condattr_delete(A) pthread_dummy(0) +#define pthread_attr_setstacksize(A,B) pthread_dummy(0) +#define pthread_equal(A,B) ((A) == (B)) +#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b)) +#define pthread_attr_init(A) pthread_attr_create(A) +#define pthread_attr_destroy(A) pthread_attr_delete(A) +#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) +#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) +#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +#define pthread_kill(A,B) pthread_dummy(0) +#undef pthread_detach_this_thread +#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } +#endif + +#ifdef HAVE_DARWIN_THREADS +#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +#define pthread_kill(A,B) pthread_dummy(0) +#define pthread_condattr_init(A) pthread_dummy(0) +#define pthread_condattr_destroy(A) pthread_dummy(0) +#define pthread_signal(A,B) pthread_dummy(0) +#undef pthread_detach_this_thread +#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); } +#undef sigset +#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) +#endif + +#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER) +/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */ +#define pthread_key_create(A,B) \ + pthread_keycreate(A,(B) ?\ + (pthread_destructor_t) (B) :\ + (pthread_destructor_t) pthread_dummy) +#define pthread_attr_init(A) pthread_attr_create(A) +#define pthread_attr_destroy(A) pthread_attr_delete(A) +#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) +#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) +#ifndef pthread_sigmask +#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +#endif +#define pthread_kill(A,B) pthread_dummy(0) +#undef pthread_detach_this_thread +#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } +#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ +#define HAVE_PTHREAD_KILL +#endif + +#endif /* defined(__WIN__) */ + +#if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) +#undef pthread_cond_timedwait +#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c)) +int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime); +#endif + +#if defined(HPUX10) +#define pthread_attr_getstacksize(A,B) my_pthread_attr_getstacksize(A,B) +void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size); +#endif + +#if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) +#undef pthread_mutex_trylock +#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a)) +int my_pthread_mutex_trylock(pthread_mutex_t *mutex); +#endif + + /* safe_mutex adds checking to mutex for easier debugging */ + +#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) +#define SAFE_MUTEX_DETECT_DESTROY +#endif + +typedef struct st_safe_mutex_t +{ + pthread_mutex_t global,mutex; + char *file; + uint line,count; + pthread_t thread; +#ifdef SAFE_MUTEX_DETECT_DESTROY + struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */ +#endif +} safe_mutex_t; + +#ifdef SAFE_MUTEX_DETECT_DESTROY +/* + Used to track the destroying of mutexes. This needs to be a seperate + structure because the safe_mutex_t structure could be freed before + the mutexes are destroyed. +*/ + +typedef struct st_safe_mutex_info_t +{ + struct st_safe_mutex_info_t *next; + struct st_safe_mutex_info_t *prev; + char *init_file; + uint32 init_line; +} safe_mutex_info_t; +#endif /* SAFE_MUTEX_DETECT_DESTROY */ + +int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr, + const char *file, uint line); +int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line); +int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); +int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); +int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, + uint line); +int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, + struct timespec *abstime, const char *file, uint line); +void safe_mutex_global_init(void); +void safe_mutex_end(FILE *file); + + /* Wrappers if safe mutex is actually used */ +#ifdef SAFE_MUTEX +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_mutex_wait +#undef pthread_mutex_timedwait +#undef pthread_mutex_t +#undef pthread_cond_wait +#undef pthread_cond_timedwait +#undef pthread_mutex_trylock +#define pthread_mutex_init(A,B) safe_mutex_init((A),(B),__FILE__,__LINE__) +#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__) +#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) +#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__) +#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__) +#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) +#define pthread_mutex_trylock(A) pthread_mutex_lock(A) +#define pthread_mutex_t safe_mutex_t +#define safe_mutex_assert_owner(mp) DBUG_ASSERT((mp)->count > 0 && pthread_equal(pthread_self(),(mp)->thread)) +#else +#define safe_mutex_assert_owner(mp) +#endif /* SAFE_MUTEX */ + + /* READ-WRITE thread locking */ + +#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */ +#undef HAVE_PTHREAD_RWLOCK_RDLOCK +#undef HAVE_RWLOCK_INIT +#undef HAVE_RWLOCK_T +#endif + +#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) +/* use these defs for simple mutex locking */ +#define rw_lock_t pthread_mutex_t +#define my_rwlock_init(A,B) pthread_mutex_init((A),(B)) +#define rw_rdlock(A) pthread_mutex_lock((A)) +#define rw_wrlock(A) pthread_mutex_lock((A)) +#define rw_tryrdlock(A) pthread_mutex_trylock((A)) +#define rw_trywrlock(A) pthread_mutex_trylock((A)) +#define rw_unlock(A) pthread_mutex_unlock((A)) +#define rwlock_destroy(A) pthread_mutex_destroy((A)) +#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK) +#define rw_lock_t pthread_rwlock_t +#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B)) +#define rw_rdlock(A) pthread_rwlock_rdlock(A) +#define rw_wrlock(A) pthread_rwlock_wrlock(A) +#define rw_tryrdlock(A) pthread_rwlock_tryrdlock((A)) +#define rw_trywrlock(A) pthread_rwlock_trywrlock((A)) +#define rw_unlock(A) pthread_rwlock_unlock(A) +#define rwlock_destroy(A) pthread_rwlock_destroy(A) +#elif defined(HAVE_RWLOCK_INIT) +#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */ +#define rw_lock_t rwlock_t +#endif +#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) +#else +/* Use our own version of read/write locks */ +typedef struct _my_rw_lock_t { + pthread_mutex_t lock; /* lock for structure */ + pthread_cond_t readers; /* waiting readers */ + pthread_cond_t writers; /* waiting writers */ + int state; /* -1:writer,0:free,>0:readers */ + int waiters; /* number of waiting writers */ +} my_rw_lock_t; + +#define rw_lock_t my_rw_lock_t +#define rw_rdlock(A) my_rw_rdlock((A)) +#define rw_wrlock(A) my_rw_wrlock((A)) +#define rw_tryrdlock(A) my_rw_tryrdlock((A)) +#define rw_trywrlock(A) my_rw_trywrlock((A)) +#define rw_unlock(A) my_rw_unlock((A)) +#define rwlock_destroy(A) my_rwlock_destroy((A)) + +extern int my_rwlock_init(my_rw_lock_t *, void *); +extern int my_rwlock_destroy(my_rw_lock_t *); +extern int my_rw_rdlock(my_rw_lock_t *); +extern int my_rw_wrlock(my_rw_lock_t *); +extern int my_rw_unlock(my_rw_lock_t *); +extern int my_rw_tryrdlock(my_rw_lock_t *); +extern int my_rw_trywrlock(my_rw_lock_t *); +#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ + +#define GETHOSTBYADDR_BUFF_SIZE 2048 + +#ifndef HAVE_THR_SETCONCURRENCY +#define thr_setconcurrency(A) pthread_dummy(0) +#endif +#if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_setstacksize) +#define pthread_attr_setstacksize(A,B) pthread_dummy(0) +#endif + +/* Define mutex types */ +#define MY_MUTEX_INIT_SLOW NULL +#define MY_MUTEX_INIT_FAST NULL +#define MY_MUTEX_INIT_ERRCHK NULL +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +extern pthread_mutexattr_t my_fast_mutexattr; +#undef MY_MUTEX_INIT_FAST +#define MY_MUTEX_INIT_FAST &my_fast_mutexattr +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +extern pthread_mutexattr_t my_errchk_mutexattr; +#undef MY_INIT_MUTEX_ERRCHK +#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr +#endif + +extern my_bool my_thread_global_init(void); +extern void my_thread_global_end(void); +extern my_bool my_thread_init(void); +extern void my_thread_end(void); +extern const char *my_thread_name(void); +extern long my_thread_id(void); +extern int pthread_no_free(void *); +extern int pthread_dummy(int); + +/* All thread specific variables are in the following struct */ + +#define THREAD_NAME_SIZE 10 +#if defined(__ia64__) +/* + MySQL can survive with 32K, but some glibc libraries require > 128K stack + To resolve hostnames +*/ +#define DEFAULT_THREAD_STACK (192*1024L) +#else +#define DEFAULT_THREAD_STACK (192*1024L) +#endif + +struct st_my_thread_var +{ + int thr_errno; + pthread_cond_t suspend; + pthread_mutex_t mutex; + pthread_mutex_t * volatile current_mutex; + pthread_cond_t * volatile current_cond; + pthread_t pthread_self; + long id; + int cmp_length; + int volatile abort; + my_bool init; +#ifndef DBUG_OFF + gptr dbug; + char name[THREAD_NAME_SIZE+1]; +#endif +}; + +extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); +#define my_thread_var (_my_thread_var()) +#define my_errno my_thread_var->thr_errno +/* + Keep track of shutdown,signal, and main threads so that my_end() will not + report errors with them +*/ +extern pthread_t shutdown_th, main_th, signal_th; + + /* statistics_xxx functions are for not essential statistic */ + +#ifndef thread_safe_increment +#ifdef HAVE_ATOMIC_ADD +#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V); +#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V); +#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V); +#define statistic_increment(V,L) thread_safe_increment((V),(L)) +#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) +#else +#define thread_safe_increment(V,L) \ + pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L)); +#define thread_safe_add(V,C,L) \ + pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L)); +#define thread_safe_sub(V,C,L) \ + pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L)); +#ifdef SAFE_STATISTICS +#define statistic_increment(V,L) thread_safe_increment((V),(L)) +#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) +#else +#define statistic_increment(V,L) (V)++ +#define statistic_add(V,C,L) (V)+=(C) +#endif /* SAFE_STATISTICS */ +#endif /* HAVE_ATOMIC_ADD */ +#endif /* thread_safe_increment */ + +#ifdef __cplusplus +} +#endif +#endif /* _my_ptread_h */ diff --git a/dlls/csx_sql/extra/include/mysql/my_semaphore.h b/dlls/csx_sql/extra/include/mysql/my_semaphore.h new file mode 100755 index 00000000..7f182bea --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_semaphore.h @@ -0,0 +1,64 @@ +/* + * Module: semaphore.h + * + * Purpose: + * Semaphores aren't actually part of the PThreads standard. + * They are defined by the POSIX Standard: + * + * POSIX 1003.1b-1993 (POSIX.1b) + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright (C) 1998 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA + */ + +/* This is hacked by Monty to be included in mysys library */ + +#ifndef _my_semaphore_h_ +#define _my_semaphore_h_ + +#ifdef THREAD + +C_MODE_START +#ifdef HAVE_SEMAPHORE_H +#include +#elif !defined(__bsdi__) +#ifdef __WIN__ +typedef HANDLE sem_t; +#else +typedef struct { + pthread_mutex_t mutex; + pthread_cond_t cond; + uint count; +} sem_t; +#endif /* __WIN__ */ + +int sem_init(sem_t * sem, int pshared, unsigned int value); +int sem_destroy(sem_t * sem); +int sem_trywait(sem_t * sem); +int sem_wait(sem_t * sem); +int sem_post(sem_t * sem); +int sem_post_multiple(sem_t * sem, unsigned int count); +int sem_getvalue(sem_t * sem, unsigned int * sval); + +#endif /* !__bsdi__ */ + +C_MODE_END + +#endif /* THREAD */ + +#endif /* !_my_semaphore_h_ */ diff --git a/dlls/csx_sql/extra/include/mysql/my_sys.h b/dlls/csx_sql/extra/include/mysql/my_sys.h new file mode 100755 index 00000000..75e22629 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_sys.h @@ -0,0 +1,770 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_sys_h +#define _my_sys_h +C_MODE_START + +#ifdef HAVE_AIOWAIT +#include /* Used by record-cache */ +typedef struct my_aio_result { + aio_result_t result; + int pending; +} my_aio_result; +#endif + +#ifndef THREAD +extern int NEAR my_errno; /* Last error in mysys */ +#else +#include +#endif + +#ifndef _m_ctype_h +#include /* for CHARSET_INFO */ +#endif + +#include + +#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; } +#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} +#define MY_INIT(name); { my_progname= name; my_init(); } + +#define MAXMAPS (4) /* Number of error message maps */ +#define ERRMOD (1000) /* Max number of errors in a map */ +#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */ +#define NRERRBUFFS (2) /* Buffers for parameters */ +#define MY_FILE_ERROR ((uint) ~0) + + /* General bitmaps for my_func's */ +#define MY_FFNF 1 /* Fatal if file not found */ +#define MY_FNABP 2 /* Fatal if not all bytes read/writen */ +#define MY_NABP 4 /* Error if not all bytes read/writen */ +#define MY_FAE 8 /* Fatal if any error */ +#define MY_WME 16 /* Write message on error */ +#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ +#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */ +#define MY_FULL_IO 512 /* For my_read - loop intil I/O + is complete + */ +#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ +#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ +#define MY_COPYTIME 64 /* my_redel() copys time */ +#define MY_DELETE_OLD 256 /* my_create_with_symlink() */ +#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ +#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ +#define MY_REDEL_MAKE_BACKUP 256 +#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ +#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ +#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ +#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ +#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ +#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ +#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ +#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ + +#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ +#define MY_GIVE_INFO 2 /* Give time info about process*/ + +#define ME_HIGHBYTE 8 /* Shift for colours */ +#define ME_NOCUR 1 /* Don't use curses message */ +#define ME_OLDWIN 2 /* Use old window */ +#define ME_BELL 4 /* Ring bell then printing message */ +#define ME_HOLDTANG 8 /* Don't delete last keys */ +#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ +#define ME_WAITTANG 32 /* Wait for a user action */ +#define ME_NOREFRESH 64 /* Dont refresh screen */ +#define ME_NOINPUT 128 /* Dont use the input libary */ +#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ +#define ME_COLOUR2 ((2 << ME_HIGHBYTE)) +#define ME_COLOUR3 ((3 << ME_HIGHBYTE)) + + /* Bits in last argument to fn_format */ +#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ +#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ +#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ +#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */ +#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ +#define MY_RETURN_REAL_PATH 32 /* return full path for file */ +#define MY_SAFE_PATH 64 /* Return NULL if too long path */ +#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ + + /* My seek flags */ +#define MY_SEEK_SET 0 +#define MY_SEEK_CUR 1 +#define MY_SEEK_END 2 + + /* My charsets_list flags */ +#define MY_NO_SETS 0 +#define MY_COMPILED_SETS 1 /* show compiled-in sets */ +#define MY_CONFIG_SETS 2 /* sets that have a *.conf file */ +#define MY_INDEX_SETS 4 /* all sets listed in the Index file */ +#define MY_LOADED_SETS 8 /* the sets that are currently loaded */ + + /* Some constants */ +#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ +#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ +#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */ +#define DEFAULT_KEYCACHE_BLOCK_SIZE 1024 +#define MAX_KEYCACHE_BLOCK_SIZE 16384 + + /* root_alloc flags */ +#define MY_KEEP_PREALLOC 1 +#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */ + + /* defines when allocating data */ + +#ifdef SAFEMALLOC +#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) +#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG ) +#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG ) +#define my_checkmalloc() _sanity( __FILE__, __LINE__ ) +#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG) +#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) +#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) +#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C) +#define QUICK_SAFEMALLOC sf_malloc_quick=1 +#define NORMAL_SAFEMALLOC sf_malloc_quick=0 +extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; +extern ulonglong sf_malloc_mem_limit; + +#define CALLER_INFO_PROTO , const char *sFile, uint uLine +#define CALLER_INFO , __FILE__, __LINE__ +#define ORIG_CALLER_INFO , sFile, uLine +#else +#define my_checkmalloc() +#undef TERMINATE +#define TERMINATE(A) {} +#define QUICK_SAFEMALLOC +#define NORMAL_SAFEMALLOC +extern gptr my_malloc(uint Size,myf MyFlags); +#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG ) +extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags); +extern void my_no_flags_free(gptr ptr); +extern gptr my_memdup(const byte *from,uint length,myf MyFlags); +extern char *my_strdup(const char *from,myf MyFlags); +extern char *my_strdup_with_length(const byte *from, uint length, + myf MyFlags); +#define my_free(PTR,FG) my_no_flags_free(PTR) +#define CALLER_INFO_PROTO /* nothing */ +#define CALLER_INFO /* nothing */ +#define ORIG_CALLER_INFO /* nothing */ +#endif + +#ifdef HAVE_ALLOCA +#if defined(_AIX) && !defined(__GNUC__) +#pragma alloca +#endif /* _AIX */ +#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) +#define alloca __builtin_alloca +#endif /* GNUC */ +#define my_alloca(SZ) alloca((size_t) (SZ)) +#define my_afree(PTR) {} +#else +#define my_alloca(SZ) my_malloc(SZ,MYF(0)) +#define my_afree(PTR) my_free(PTR,MYF(MY_WME)) +#endif /* HAVE_ALLOCA */ + +#ifdef MSDOS +#ifdef __ZTC__ +void * __CDECL halloc(long count,size_t length); +void __CDECL hfree(void *ptr); +#endif +#if defined(USE_HALLOC) +#if defined(_VCM_) || defined(M_IC80386) +#undef USE_HALLOC +#endif +#endif +#ifdef USE_HALLOC +#define malloc(a) halloc((long) (a),1) +#define free(a) hfree(a) +#endif +#endif /* MSDOS */ + +#ifdef HAVE_ERRNO_AS_DEFINE +#include /* errno is a define */ +#else +extern int errno; /* declare errno */ +#endif +extern const char ** NEAR my_errmsg[]; +extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE]; +extern char *home_dir; /* Home directory for user */ +extern char *my_progname; /* program-name (printed in errors) */ +extern char NEAR curr_dir[]; /* Current directory for user */ +extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); +extern int (*fatal_error_handler_hook)(uint my_err, const char *str, + myf MyFlags); + +/* charsets */ +extern uint get_charset_number(const char *cs_name); +extern const char *get_charset_name(uint cs_number); +extern CHARSET_INFO *get_charset(uint cs_number, myf flags); +extern my_bool set_default_charset(uint cs, myf flags); +extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); +extern my_bool set_default_charset_by_name(const char *cs_name, myf flags); +extern void free_charsets(void); +extern char *list_charsets(myf want_flags); /* my_free() this string... */ +extern char *get_charsets_dir(char *buf); + + +/* statistics */ +extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests, + _my_cache_read; +extern ulong _my_blocks_used,_my_blocks_changed; +extern uint key_cache_block_size; +extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; +extern my_bool key_cache_inited, my_init_done; + + /* Point to current my_message() */ +extern void (*my_sigtstp_cleanup)(void), + /* Executed before jump to shell */ + (*my_sigtstp_restart)(void), + (*my_abort_hook)(int); + /* Executed when comming from shell */ +extern int NEAR my_umask, /* Default creation mask */ + NEAR my_umask_dir, + NEAR my_recived_signals, /* Signals we have got */ + NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ + NEAR my_dont_interrupt; /* call remember_intr when set */ +extern my_bool NEAR mysys_uses_curses, my_use_symdir; +extern ulong sf_malloc_cur_memory, sf_malloc_max_memory; + +extern ulong my_default_record_cache_size; +extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, + NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern char wild_many,wild_one,wild_prefix; +extern const char *charsets_dir; +extern char *defaults_extra_file; + +typedef struct wild_file_pack /* Struct to hold info when selecting files */ +{ + uint wilds; /* How many wildcards */ + uint not_pos; /* Start of not-theese-files */ + my_string *wild; /* Pointer to wildcards */ +} WF_PACK; + +typedef struct st_typelib { /* Different types saved here */ + uint count; /* How many types */ + const char *name; /* Name of typelib */ + const char **type_names; +} TYPELIB; + +enum cache_type +{ + READ_CACHE,WRITE_CACHE, + SEQ_READ_APPEND /* sequential read or append */, + READ_FIFO, READ_NET,WRITE_NET}; + +enum flush_type +{ + FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED, FLUSH_FORCE_WRITE +}; + +typedef struct st_record_cache /* Used when cacheing records */ +{ + File file; + int rc_seek,error,inited; + uint rc_length,read_length,reclength; + my_off_t rc_record_pos,end_of_file; + byte *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos; +#ifdef HAVE_AIOWAIT + int use_async_io; + my_aio_result aio_result; +#endif + enum cache_type type; +} RECORD_CACHE; + +enum file_type +{ + UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, + FILE_BY_MKSTEMP, FILE_BY_DUP +}; + +extern struct my_file_info +{ + my_string name; + enum file_type type; +#if defined(THREAD) && !defined(HAVE_PREAD) + pthread_mutex_t mutex; +#endif +} my_file_info[MY_NFILE]; + + +typedef struct st_dynamic_array +{ + char *buffer; + uint elements,max_element; + uint alloc_increment; + uint size_of_element; +} DYNAMIC_ARRAY; + +typedef struct st_dynamic_string +{ + char *str; + uint length,max_length,alloc_increment; +} DYNAMIC_STRING; + +struct st_io_cache; +typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); + +#ifdef THREAD +typedef struct st_io_cache_share +{ + /* to sync on reads into buffer */ + pthread_mutex_t mutex; + pthread_cond_t cond; + int count, total; + /* actual IO_CACHE that filled the buffer */ + struct st_io_cache *active; +#ifdef NOT_YET_IMPLEMENTED + /* whether the structure should be free'd */ + my_bool alloced; +#endif +} IO_CACHE_SHARE; +#endif + +typedef struct st_io_cache /* Used when cacheing files */ +{ + /* Offset in file corresponding to the first byte of byte* buffer. */ + my_off_t pos_in_file; + /* + The offset of end of file for READ_CACHE and WRITE_CACHE. + For SEQ_READ_APPEND it the maximum of the actual end of file and + the position represented by read_end. + */ + my_off_t end_of_file; + /* Points to current read position in the buffer */ + byte *read_pos; + /* the non-inclusive boundary in the buffer for the currently valid read */ + byte *read_end; + byte *buffer; /* The read buffer */ + /* Used in ASYNC_IO */ + byte *request_pos; + + /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */ + byte *write_buffer; + /* + Only used in SEQ_READ_APPEND, and points to the current read position + in the write buffer. Note that reads in SEQ_READ_APPEND caches can + happen from both read buffer (byte* buffer) and write buffer + (byte* write_buffer). + */ + byte *append_read_pos; + /* Points to current write position in the write buffer */ + byte *write_pos; + /* The non-inclusive boundary of the valid write area */ + byte *write_end; + + /* + Current_pos and current_end are convenience variables used by + my_b_tell() and other routines that need to know the current offset + current_pos points to &write_pos, and current_end to &write_end in a + WRITE_CACHE, and &read_pos and &read_end respectively otherwise + */ + byte **current_pos, **current_end; +#ifdef THREAD + /* + The lock is for append buffer used in SEQ_READ_APPEND cache + need mutex copying from append buffer to read buffer. + */ + pthread_mutex_t append_buffer_lock; + /* + The following is used when several threads are reading the + same file in parallel. They are synchronized on disk + accesses reading the cached part of the file asynchronously. + It should be set to NULL to disable the feature. Only + READ_CACHE mode is supported. + */ + IO_CACHE_SHARE *share; +#endif + /* + A caller will use my_b_read() macro to read from the cache + if the data is already in cache, it will be simply copied with + memcpy() and internal variables will be accordinging updated with + no functions invoked. However, if the data is not fully in the cache, + my_b_read() will call read_function to fetch the data. read_function + must never be invoked directly. + */ + int (*read_function)(struct st_io_cache *,byte *,uint); + /* + Same idea as in the case of read_function, except my_b_write() needs to + be replaced with my_b_append() for a SEQ_READ_APPEND cache + */ + int (*write_function)(struct st_io_cache *,const byte *,uint); + /* + Specifies the type of the cache. Depending on the type of the cache + certain operations might not be available and yield unpredicatable + results. Details to be documented later + */ + enum cache_type type; + /* + Callbacks when the actual read I/O happens. These were added and + are currently used for binary logging of LOAD DATA INFILE - when a + block is read from the file, we create a block create/append event, and + when IO_CACHE is closed, we create an end event. These functions could, + of course be used for other things + */ + IO_CACHE_CALLBACK pre_read; + IO_CACHE_CALLBACK post_read; + IO_CACHE_CALLBACK pre_close; + void* arg; /* for use by pre/post_read */ + char *file_name; /* if used with 'open_cached_file' */ + char *dir,*prefix; + File file; /* file descriptor */ + /* + seek_not_done is set by my_b_seek() to inform the upcoming read/write + operation that a seek needs to be preformed prior to the actual I/O + error is 0 if the cache operation was successful, -1 if there was a + "hard" error, and the actual number of I/O-ed bytes if the read/write was + partial. + */ + int seek_not_done,error; + /* buffer_length is memory size allocated for buffer or write_buffer */ + uint buffer_length; + /* read_length is the same as buffer_length except when we use async io */ + uint read_length; + myf myflags; /* Flags used to my_read/my_write */ + /* + alloced_buffer is 1 if the buffer was allocated by init_io_cache() and + 0 if it was supplied by the user. + Currently READ_NET is the only one that will use a buffer allocated + somewhere else + */ + my_bool alloced_buffer; +#ifdef HAVE_AIOWAIT + /* + As inidicated by ifdef, this is for async I/O, which is not currently + used (because it's not reliable on all systems) + */ + uint inited; + my_off_t aio_read_pos; + my_aio_result aio_result; +#endif +} IO_CACHE; + +typedef int (*qsort2_cmp)(const void *, const void *, const void *); + + /* defines for mf_iocache */ + + /* Test if buffer is inited */ +#define my_b_clear(info) (info)->buffer=0 +#define my_b_inited(info) (info)->buffer +#define my_b_EOF INT_MIN + +#define my_b_read(info,Buffer,Count) \ + ((info)->read_pos + (Count) <= (info)->read_end ?\ + (memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \ + ((info)->read_pos+=(Count)),0) :\ + (*(info)->read_function)((info),Buffer,Count)) + +#define my_b_write(info,Buffer,Count) \ + ((info)->write_pos + (Count) <=(info)->write_end ?\ + (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\ + ((info)->write_pos+=(Count)),0) : \ + (*(info)->write_function)((info),(Buffer),(Count))) + +#define my_b_get(info) \ + ((info)->read_pos != (info)->read_end ?\ + ((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\ + _my_b_get(info)) + + /* my_b_write_byte dosn't have any err-check */ +#define my_b_write_byte(info,chr) \ + (((info)->write_pos < (info)->write_end) ?\ + ((*(info)->write_pos++)=(chr)) :\ + (_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr)))) + +#define my_b_fill_cache(info) \ + (((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0)) + +#define my_b_tell(info) ((info)->pos_in_file + \ + (uint) (*(info)->current_pos - (info)->request_pos)) + +/* tell write offset in the SEQ_APPEND cache */ +my_off_t my_b_append_tell(IO_CACHE* info); + +#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \ + *(info)->current_pos) + +#include + + /* Prototypes for mysys and my_func functions */ + +extern int my_copy(const char *from,const char *to,myf MyFlags); +extern int my_append(const char *from,const char *to,myf MyFlags); +extern int my_delete(const char *name,myf MyFlags); +extern int my_getwd(my_string buf,uint size,myf MyFlags); +extern int my_setwd(const char *dir,myf MyFlags); +extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); +extern gptr my_once_alloc(uint Size,myf MyFlags); +extern void my_once_free(void); +extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags); +extern File my_open(const char *FileName,int Flags,myf MyFlags); +extern File my_register_filename(File fd, const char *FileName, + enum file_type type_of_file, + uint error_message_number, myf MyFlags); +extern File my_create(const char *FileName,int CreateFlags, + int AccsesFlags, myf MyFlags); +extern int my_close(File Filedes,myf MyFlags); +extern File my_dup(File file, myf MyFlags); +extern int my_mkdir(const char *dir, int Flags, myf MyFlags); +extern int my_readlink(char *to, const char *filename, myf MyFlags); +extern int my_realpath(char *to, const char *filename, myf MyFlags); +extern File my_create_with_symlink(const char *linkname, const char *filename, + int createflags, int access_flags, + myf MyFlags); +extern int my_delete_with_symlink(const char *name, myf MyFlags); +extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); +extern int my_symlink(const char *content, const char *linkname, myf MyFlags); +extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags); +extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset, + myf MyFlags); +extern int my_rename(const char *from,const char *to,myf MyFlags); +extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags); +extern my_off_t my_tell(File fd,myf MyFlags); +extern uint my_write(File Filedes,const byte *Buffer,uint Count, + myf MyFlags); +extern uint my_pwrite(File Filedes,const byte *Buffer,uint Count, + my_off_t offset,myf MyFlags); +extern uint my_fread(FILE *stream,byte *Buffer,uint Count,myf MyFlags); +extern uint my_fwrite(FILE *stream,const byte *Buffer,uint Count, + myf MyFlags); +extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); +extern my_off_t my_ftell(FILE *stream,myf MyFlags); +extern gptr _mymalloc(uint uSize,const char *sFile, + uint uLine, myf MyFlag); +extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile, + uint uLine, myf MyFlag); +extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...)); +extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag); +extern int _sanity(const char *sFile,unsigned int uLine); +extern gptr _my_memdup(const byte *from,uint length, + const char *sFile, uint uLine,myf MyFlag); +extern my_string _my_strdup(const char *from, const char *sFile, uint uLine, + myf MyFlag); +extern char *_my_strdup_with_length(const byte *from, uint length, + const char *sFile, uint uLine, + myf MyFlag); + +#ifndef TERMINATE +extern void TERMINATE(FILE *file); +#endif +extern void init_glob_errs(void); +extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); +extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); +extern int my_fclose(FILE *fd,myf MyFlags); +extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); +extern int my_sync(File fd, myf my_flags); +extern int my_error _VARARGS((int nr,myf MyFlags, ...)); +extern int my_printf_error _VARARGS((uint my_err, const char *format, + myf MyFlags, ...) + __attribute__ ((format (printf, 2, 4)))); +extern int my_vsnprintf( char *str, size_t n, + const char *format, va_list ap ); +extern int my_snprintf(char* to, size_t n, const char* fmt, ...); +extern int my_message(uint my_err, const char *str,myf MyFlags); +extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); +extern int my_message_curses(uint my_err, const char *str,myf MyFlags); +extern my_bool my_init(void); +extern void my_end(int infoflag); +extern int my_redel(const char *from, const char *to, int MyFlags); +extern int my_copystat(const char *from, const char *to, int MyFlags); +extern my_string my_filename(File fd); + +#ifndef THREAD +extern void dont_break(void); +extern void allow_break(void); +#else +#define dont_break() +#define allow_break() +#endif + +extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); +extern void caseup(my_string str,uint length); +extern void casedn(my_string str,uint length); +extern void caseup_str(my_string str); +extern void casedn_str(my_string str); +extern void case_sort(my_string str,uint length); +extern uint dirname_part(my_string to,const char *name); +extern uint dirname_length(const char *name); +#define base_name(A) (A+dirname_length(A)) +extern int test_if_hard_path(const char *dir_name); +extern char *convert_dirname(char *to, const char *from, const char *from_end); +extern void to_unix_path(my_string name); +extern my_string fn_ext(const char *name); +extern my_string fn_same(my_string toname,const char *name,int flag); +extern my_string fn_format(my_string to,const char *name,const char *dir, + const char *form, uint flag); +extern size_s strlength(const char *str); +extern void pack_dirname(my_string to,const char *from); +extern uint unpack_dirname(my_string to,const char *from); +extern uint cleanup_dirname(my_string to,const char *from); +extern uint system_filename(my_string to,const char *from); +extern my_string unpack_filename(my_string to,const char *from); +extern my_string intern_filename(my_string to,const char *from); +extern my_string directory_file_name(my_string dst, const char *src); +extern int pack_filename(my_string to, const char *name, size_s max_length); +extern my_string my_path(my_string to,const char *progname, + const char *own_pathname_part); +extern my_string my_load_path(my_string to, const char *path, + const char *own_path_prefix); +extern int wild_compare(const char *str,const char *wildstr); +extern my_string my_strcasestr(const char *src,const char *suffix); +extern int my_strcasecmp(const char *s,const char *t); +extern int my_strsortcmp(const char *s,const char *t); +extern int my_casecmp(const char *s,const char *t,uint length); +extern int my_sortcmp(const char *s,const char *t,uint length); +extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len); +extern WF_PACK *wf_comp(my_string str); +extern int wf_test(struct wild_file_pack *wf_pack,const char *name); +extern void wf_end(struct wild_file_pack *buffer); +extern size_s strip_sp(my_string str); +extern void get_date(my_string to,int timeflag,time_t use_time); +extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage); +extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, + uint reclength,enum cache_type type, + pbool use_async_io); +extern int read_cache_record(RECORD_CACHE *info,byte *to); +extern int end_record_cache(RECORD_CACHE *info); +extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, + const byte *record,uint length); +extern int flush_write_cache(RECORD_CACHE *info); +extern long my_clock(void); +extern sig_handler sigtstp_handler(int signal_number); +extern void handle_recived_signals(void); +extern int init_key_cache(ulong use_mem); +extern int resize_key_cache(ulong use_mem); +extern byte *key_cache_read(File file,my_off_t filepos,byte* buff,uint length, + uint block_length,int return_buffer); +extern int key_cache_write(File file,my_off_t filepos,byte* buff,uint length, + uint block_length,int force_write); +extern int flush_key_blocks(int file, enum flush_type type); +extern void end_key_cache(void); +extern sig_handler my_set_alarm_variable(int signo); +extern void my_string_ptr_sort(void *base,uint items,size_s size); +extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, + size_s size_of_element,uchar *buffer[]); +extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size, + qsort2_cmp cmp, void *cmp_argument); +extern qsort2_cmp get_ptr_compare(uint); +extern int init_io_cache(IO_CACHE *info,File file,uint cachesize, + enum cache_type type,my_off_t seek_offset, + pbool use_async_io, myf cache_myflags); +extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, + my_off_t seek_offset,pbool use_async_io, + pbool clear_cache); +extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count); +#ifdef THREAD +extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count); +extern void init_io_cache_share(IO_CACHE *info, + IO_CACHE_SHARE *s, uint num_threads); +extern void remove_io_thread(IO_CACHE *info); +#endif +extern int _my_b_seq_read(IO_CACHE *info,byte *Buffer,uint Count); +extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count); +extern int _my_b_get(IO_CACHE *info); +extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); +extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); +extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count); +extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count); + +extern int my_block_write(IO_CACHE *info, const byte *Buffer, + uint Count, my_off_t pos); +extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock); + +#define flush_io_cache(info) _flush_io_cache((info),1) + +extern int end_io_cache(IO_CACHE *info); +extern uint my_b_fill(IO_CACHE *info); +extern void my_b_seek(IO_CACHE *info,my_off_t pos); +extern uint my_b_gets(IO_CACHE *info, char *to, uint max_length); +extern my_off_t my_b_filelength(IO_CACHE *info); +extern uint my_b_printf(IO_CACHE *info, const char* fmt, ...); +extern uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); +extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, + const char *prefix, uint cache_size, + myf cache_myflags); +extern my_bool real_open_cached_file(IO_CACHE *cache); +extern void close_cached_file(IO_CACHE *cache); +File create_temp_file(char *to, const char *dir, const char *pfx, + int mode, myf MyFlags); +#define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO) +#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) +extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, + uint init_alloc,uint alloc_increment CALLER_INFO_PROTO); +extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element); +extern byte *alloc_dynamic(DYNAMIC_ARRAY *array); +extern byte *pop_dynamic(DYNAMIC_ARRAY*); +extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index); +extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index); +extern void delete_dynamic(DYNAMIC_ARRAY *array); +extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); +extern void freeze_size(DYNAMIC_ARRAY *array); +#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element) +#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) +#define push_dynamic(A,B) insert_dynamic(A,B) + +extern int find_type(my_string x,TYPELIB *typelib,uint full_name); +extern void make_type(my_string to,uint nr,TYPELIB *typelib); +extern const char *get_type(TYPELIB *typelib,uint nr); +extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, + uint init_alloc,uint alloc_increment); +extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); +my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, + uint length); +extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); +extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size); +extern void dynstr_free(DYNAMIC_STRING *str); +#ifdef HAVE_MLOCK +extern byte *my_malloc_lock(uint length,myf flags); +extern void my_free_lock(byte *ptr,myf flags); +#else +#define my_malloc_lock(A,B) my_malloc((A),(B)) +#define my_free_lock(A,B) my_free((A),(B)) +#endif +#define alloc_root_inited(A) ((A)->min_malloc != 0) +extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size, + uint pre_alloc_size); +extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size); +extern void free_root(MEM_ROOT *root, myf MyFLAGS); +extern void set_prealloc_root(MEM_ROOT *root, char *ptr); +extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size, + uint prealloc_size); +extern char *strdup_root(MEM_ROOT *root,const char *str); +extern char *strmake_root(MEM_ROOT *root,const char *str,uint len); +extern char *memdup_root(MEM_ROOT *root,const char *str,uint len); +extern int load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv); +extern void free_defaults(char **argv); +extern void print_defaults(const char *conf_file, const char **groups); +extern my_bool my_compress(byte *, ulong *, ulong *); +extern my_bool my_uncompress(byte *, ulong *, ulong *); +extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); +extern ulong checksum(const byte *mem, uint count); +extern uint my_bit_log2(ulong value); +uint my_count_bits(ulonglong v); +extern void my_sleep(ulong m_seconds); + +#ifdef __WIN__ +extern my_bool have_tcpip; /* Is set if tcpip is used */ +#endif +#ifdef __NETWARE__ +void netware_reg_user(const char *ip, const char *user, + const char *application); +#endif + +C_MODE_END +#include "raid.h" +#endif /* _my_sys_h */ diff --git a/dlls/csx_sql/extra/include/mysql/my_tree.h b/dlls/csx_sql/extra/include/mysql/my_tree.h new file mode 100755 index 00000000..7cc7c615 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/my_tree.h @@ -0,0 +1,84 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _tree_h +#define _tree_h +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_TREE_HIGHT 40 /* = max 1048576 leafs in tree */ +#define ELEMENT_KEY(tree,element)\ +(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\ + *((void**) (element+1))) + +#define tree_set_pointer(element,ptr) *((byte **) (element+1))=((byte*) (ptr)) + +typedef enum { left_root_right, right_root_left } TREE_WALK; +typedef uint32 element_count; +typedef int (*tree_walk_action)(void *,element_count,void *); + +typedef enum { free_init, free_free, free_end } TREE_FREE; +typedef void (*tree_element_free)(void*, TREE_FREE, void *); + +#ifdef MSDOS +typedef struct st_tree_element { + struct st_tree_element *left,*right; + unsigned long count; + uchar colour; /* black is marked as 1 */ +} TREE_ELEMENT; +#else +typedef struct st_tree_element { + struct st_tree_element *left,*right; + uint32 count:31, + colour:1; /* black is marked as 1 */ +} TREE_ELEMENT; +#endif /* MSDOS */ + +typedef struct st_tree { + TREE_ELEMENT *root,null_element; + TREE_ELEMENT **parents[MAX_TREE_HIGHT]; + uint offset_to_key,elements_in_tree,size_of_element,memory_limit,allocated; + qsort_cmp2 compare; + void* custom_arg; + MEM_ROOT mem_root; + my_bool with_delete; + tree_element_free free; +} TREE; + + /* Functions on whole tree */ +void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit, + int size, qsort_cmp2 compare, my_bool with_delete, + tree_element_free free_element, void *custom_arg); +void delete_tree(TREE*); +void reset_tree(TREE*); + /* similar to delete tree, except we do not my_free() blocks in mem_root + */ +#define is_tree_inited(tree) ((tree)->root != 0) + + /* Functions on leafs */ +TREE_ELEMENT *tree_insert(TREE *tree,void *key,uint key_size); +void *tree_search(TREE *tree,void *key); +int tree_walk(TREE *tree,tree_walk_action action, + void *argument, TREE_WALK visit); +int tree_delete(TREE *tree,void *key); + +#define TREE_ELEMENT_EXTRA_SIZE (sizeof(TREE_ELEMENT) + sizeof(void*)) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/myisam.h b/dlls/csx_sql/extra/include/mysql/myisam.h new file mode 100755 index 00000000..87a40b50 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/myisam.h @@ -0,0 +1,448 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file should be included when using myisam_funktions */ + +#ifndef _myisam_h +#define _myisam_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _my_base_h +#include +#endif +#ifndef _m_ctype_h +#include +#endif + + /* defines used by myisam-funktions */ + +/* The following defines can be increased if necessary */ +#define MI_MAX_KEY 32 /* Max allowed keys */ +#define MI_MAX_KEY_SEG 16 /* Max segments for key */ +#define MI_MAX_KEY_LENGTH 500 + +#define MI_MAX_KEY_BUFF (MI_MAX_KEY_LENGTH+MI_MAX_KEY_SEG*6+8+8) +#define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */ +#define MI_MAX_POSSIBLE_KEY 64 /* For myisam_chk */ +#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ +#define MI_NAME_IEXT ".MYI" +#define MI_NAME_DEXT ".MYD" +/* Max extra space to use when sorting keys */ +#define MI_MAX_TEMP_LENGTH 256*1024L*1024L + +/* Possible values for myisam_block_size (must be power of 2) */ +#define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */ +#define MI_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */ +#define MI_MAX_KEY_BLOCK_LENGTH 16384 + +#define mi_portable_sizeof_char_ptr 8 + +typedef uint32 ha_checksum; + + /* Param to/from mi_info */ + +typedef struct st_mi_isaminfo /* Struct from h_info */ +{ + ha_rows records; /* Records in database */ + ha_rows deleted; /* Deleted records in database */ + my_off_t recpos; /* Pos for last used record */ + my_off_t newrecpos; /* Pos if we write new record */ + my_off_t dupp_key_pos; /* Position to record with dupp key */ + my_off_t data_file_length, /* Length of data file */ + max_data_file_length, + index_file_length, + max_index_file_length, + delete_length; + ulong reclength; /* Recordlength */ + ulong mean_reclength; /* Mean recordlength (if packed) */ + ulonglong auto_increment; + ulonglong key_map; /* Which keys are used */ + char *data_file_name, *index_file_name; + uint keys; /* Number of keys in use */ + uint options; /* HA_OPTION_... used */ + int errkey, /* With key was dupplicated on err */ + sortkey; /* clustered by this key */ + File filenr; /* (uniq) filenr for datafile */ + time_t create_time; /* When table was created */ + time_t check_time; + time_t update_time; + uint reflength; + ulong record_offset; + ulong *rec_per_key; /* for sql optimizing */ + uint raid_type,raid_chunks; + ulong raid_chunksize; +} MI_ISAMINFO; + + +typedef struct st_mi_create_info +{ + const char *index_file_name, *data_file_name; /* If using symlinks */ + ha_rows max_rows; + ha_rows reloc_rows; + ulonglong auto_increment; + ulonglong data_file_length; + uint raid_type,raid_chunks; + ulong raid_chunksize; + uint old_options; + uint8 language; + my_bool with_auto_increment; +} MI_CREATE_INFO; + +struct st_myisam_info; /* For referense */ +typedef struct st_myisam_info MI_INFO; + +typedef struct st_mi_keyseg /* Key-portion */ +{ + uint8 type; /* Type of key (for sort) */ + uint8 language; + uint8 null_bit; /* bitmask to test for NULL */ + uint8 bit_start,bit_end; /* if bit field */ + uint16 flag; + uint16 length; /* Keylength */ + uint32 start; /* Start of key in record */ + uint32 null_pos; /* position to NULL indicator */ + CHARSET_INFO *charset; +} MI_KEYSEG; + + +struct st_mi_s_param; + +typedef struct st_mi_keydef /* Key definition with open & info */ +{ + uint16 keysegs; /* Number of key-segment */ + uint16 flag; /* NOSAME, PACK_USED */ + + uint8 key_alg; /* BTREE, RTREE */ + uint16 block_length; /* Length of keyblock (auto) */ + uint16 underflow_block_length; /* When to execute underflow */ + uint16 keylength; /* Tot length of keyparts (auto) */ + uint16 minlength; /* min length of (packed) key (auto) */ + uint16 maxlength; /* max length of (packed) key (auto) */ + uint16 block_size; /* block_size (auto) */ + uint32 version; /* For concurrent read/write */ + + MI_KEYSEG *seg,*end; + int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo, + uchar *page,uchar *key, + uint key_len,uint comp_flag,uchar * *ret_pos, + uchar *buff, my_bool *was_last_key); + uint (*get_key)(struct st_mi_keydef *keyinfo,uint nod_flag,uchar * *page, + uchar *key); + int (*pack_key)(struct st_mi_keydef *keyinfo,uint nod_flag,uchar *next_key, + uchar *org_key, uchar *prev_key, uchar *key, + struct st_mi_s_param *s_temp); + void (*store_key)(struct st_mi_keydef *keyinfo, uchar *key_pos, + struct st_mi_s_param *s_temp); +} MI_KEYDEF; + + +#define MI_UNIQUE_HASH_LENGTH 4 + +typedef struct st_unique_def /* Segment definition of unique */ +{ + uint16 keysegs; /* Number of key-segment */ + uchar key; /* Mapped to which key */ + uint8 null_are_equal; + MI_KEYSEG *seg,*end; +} MI_UNIQUEDEF; + +typedef struct st_mi_decode_tree /* Decode huff-table */ +{ + uint16 *table; + uint quick_table_bits; + byte *intervalls; +} MI_DECODE_TREE; + + +struct st_mi_bit_buff; + +/* + Note that null markers should always be first in a row ! + When creating a column, one should only specify: + type, length, null_bit and null_pos +*/ + +typedef struct st_columndef /* column information */ +{ + int16 type; /* en_fieldtype */ + uint16 length; /* length of field */ + uint32 offset; /* Offset to position in row */ + uint8 null_bit; /* If column may be 0 */ + uint16 null_pos; /* position for null marker */ + +#ifndef NOT_PACKED_DATABASES + void (*unpack)(struct st_columndef *rec,struct st_mi_bit_buff *buff, + uchar *start,uchar *end); + enum en_fieldtype base_type; + uint space_length_bits,pack_type; + MI_DECODE_TREE *huff_tree; +#endif +} MI_COLUMNDEF; + +/* invalidator function reference for Query Cache */ +typedef void (* invalidator_by_filename)(const char * filename); + +extern my_string myisam_log_filename; /* Name of logfile */ +extern uint myisam_block_size; +extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user; +extern my_bool myisam_concurrent_insert; +extern my_off_t myisam_max_temp_length,myisam_max_extra_temp_length; +extern ulong myisam_bulk_insert_tree_size; + + /* Prototypes for myisam-functions */ + +extern int mi_close(struct st_myisam_info *file); +extern int mi_delete(struct st_myisam_info *file,const byte *buff); +extern struct st_myisam_info *mi_open(const char *name,int mode, + uint wait_if_locked); +extern int mi_panic(enum ha_panic_function function); +extern int mi_rfirst(struct st_myisam_info *file,byte *buf,int inx); +extern int mi_rkey(struct st_myisam_info *file,byte *buf,int inx, + const byte *key, + uint key_len, enum ha_rkey_function search_flag); +extern int mi_rlast(struct st_myisam_info *file,byte *buf,int inx); +extern int mi_rnext(struct st_myisam_info *file,byte *buf,int inx); +extern int mi_rnext_same(struct st_myisam_info *info, byte *buf); +extern int mi_rprev(struct st_myisam_info *file,byte *buf,int inx); +extern int mi_rrnd(struct st_myisam_info *file,byte *buf, my_off_t pos); +extern int mi_scan_init(struct st_myisam_info *file); +extern int mi_scan(struct st_myisam_info *file,byte *buf); +extern int mi_rsame(struct st_myisam_info *file,byte *record,int inx); +extern int mi_rsame_with_pos(struct st_myisam_info *file,byte *record, + int inx, my_off_t pos); +extern int mi_update(struct st_myisam_info *file,const byte *old, + byte *new_record); +extern int mi_write(struct st_myisam_info *file,byte *buff); +extern my_off_t mi_position(struct st_myisam_info *file); +extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag); +extern int mi_lock_database(struct st_myisam_info *file,int lock_type); +extern int mi_create(const char *name,uint keys,MI_KEYDEF *keydef, + uint columns, MI_COLUMNDEF *columndef, + uint uniques, MI_UNIQUEDEF *uniquedef, + MI_CREATE_INFO *create_info, uint flags); +extern int mi_delete_table(const char *name); +extern int mi_rename(const char *from, const char *to); +extern int mi_extra(struct st_myisam_info *file, + enum ha_extra_function function, + void *extra_arg); +extern ha_rows mi_records_in_range(struct st_myisam_info *info,int inx, + const byte *start_key,uint start_key_len, + enum ha_rkey_function start_search_flag, + const byte *end_key,uint end_key_len, + enum ha_rkey_function end_search_flag); +extern int mi_log(int activate_log); +extern int mi_is_changed(struct st_myisam_info *info); +extern int mi_delete_all_rows(struct st_myisam_info *info); +extern ulong _mi_calc_blob_length(uint length , const byte *pos); +extern uint mi_get_pointer_length(ulonglong file_length, uint def); + +/* this is used to pass to mysql_myisamchk_table -- by Sasha Pachev */ + +#define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */ +#define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */ + +/* + Definitions needed for myisamchk.c + + Entries marked as "QQ to be removed" are NOT used to + pass check/repair options to mi_check.c. They are used + internally by myisamchk.c or/and ha_myisam.cc and should NOT + be stored together with other flags. They should be removed + from the following list to make addition of new flags possible. +*/ + +#define T_AUTO_INC 1 +#define T_AUTO_REPAIR 2 /* QQ to be removed */ +#define T_BACKUP_DATA 4 +#define T_CALC_CHECKSUM 8 +#define T_CHECK 16 /* QQ to be removed */ +#define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */ +#define T_CREATE_MISSING_KEYS 64 +#define T_DESCRIPT 128 +#define T_DONT_CHECK_CHECKSUM 256 +#define T_EXTEND 512 +#define T_FAST (1L << 10) /* QQ to be removed */ +#define T_FORCE_CREATE (1L << 11) /* QQ to be removed */ +#define T_FORCE_UNIQUENESS (1L << 12) +#define T_INFO (1L << 13) +#define T_MEDIUM (1L << 14) +#define T_QUICK (1L << 15) /* QQ to be removed */ +#define T_READONLY (1L << 16) /* QQ to be removed */ +#define T_REP (1L << 17) +#define T_REP_BY_SORT (1L << 18) /* QQ to be removed */ +#define T_REP_PARALLEL (1L << 19) /* QQ to be removed */ +#define T_RETRY_WITHOUT_QUICK (1L << 20) +#define T_SAFE_REPAIR (1L << 21) +#define T_SILENT (1L << 22) +#define T_SORT_INDEX (1L << 23) /* QQ to be removed */ +#define T_SORT_RECORDS (1L << 24) /* QQ to be removed */ +#define T_STATISTICS (1L << 25) +#define T_UNPACK (1L << 26) +#define T_UPDATE_STATE (1L << 27) +#define T_VERBOSE (1L << 28) +#define T_VERY_SILENT (1L << 29) +#define T_WAIT_FOREVER (1L << 30) +#define T_WRITE_LOOP ((ulong) 1L << 31) + +#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) + +/* + Flags used by myisamchk.c or/and ha_myisam.cc that are NOT passed + to mi_check.c follows: +*/ + +#define TT_USEFRM 1 + +#define O_NEW_INDEX 1 /* Bits set in out_flag */ +#define O_NEW_DATA 2 +#define O_DATA_LOST 4 + +/* these struct is used by my_check to tell it what to do */ + +typedef struct st_sort_key_blocks /* Used when sorting */ +{ + uchar *buff,*end_pos; + uchar lastkey[MI_MAX_POSSIBLE_KEY_BUFF]; + uint last_length; + int inited; +} SORT_KEY_BLOCKS; + +typedef struct st_mi_check_param +{ + ulonglong auto_increment_value; + ulonglong max_data_file_length; + ulonglong keys_in_use; + my_off_t search_after_block; + my_off_t new_file_pos,key_file_blocks; + my_off_t keydata,totaldata,key_blocks,start_check_pos; + ha_rows total_records,total_deleted; + ha_checksum record_checksum,glob_crc; + ulong use_buffers,read_buffer_length,write_buffer_length, + sort_buffer_length,sort_key_blocks; + uint out_flag,warning_printed,error_printed,verbose; + uint opt_sort_key,total_files,max_level; + uint testflag; + uint8 language; + my_bool using_global_keycache, opt_lock_memory, opt_follow_links; + my_bool retry_repair, force_sort, calc_checksum; + char temp_filename[FN_REFLEN],*isam_file_name,*tmpdir; + int tmpfile_createflag; + myf myf_rw; + IO_CACHE read_cache; + ulonglong unique_count[MI_MAX_KEY_SEG+1]; + ha_checksum key_crc[MI_MAX_POSSIBLE_KEY]; + ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY]; + void *thd; + char *db_name,*table_name; + char *op_name; +} MI_CHECK; + + +typedef struct st_sort_info +{ + my_off_t filelength,dupp,buff_length; + ha_rows max_records; + uint current_key, total_keys; + myf myf_rw; + enum data_file_type new_data_file_type; + MI_INFO *info; + MI_CHECK *param; + char *buff; + SORT_KEY_BLOCKS *key_block,*key_block_end; + /* sync things*/ + uint got_error, threads_running; +#ifdef THREAD + pthread_mutex_t mutex; + pthread_cond_t cond; +#endif +} SORT_INFO; + + +typedef struct st_mi_sort_param +{ +#ifdef THREAD + pthread_t thr; +#endif + IO_CACHE read_cache, tempfile, tempfile_for_exceptions; + DYNAMIC_ARRAY buffpek; + ulonglong unique[MI_MAX_KEY_SEG+1]; + my_off_t pos,max_pos,filepos,start_recpos; + uint key, key_length,real_key_length,sortbuff_size; + uint maxbuffers, keys, find_length, sort_keys_length; + my_bool fix_datafile, master; + MI_KEYDEF *keyinfo; + SORT_INFO *sort_info; + uchar **sort_keys; + byte *rec_buff; + void *wordlist, *wordptr; + char *record; + char *tmpdir; + int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); + int (*key_read)(struct st_mi_sort_param *,void *); + int (*key_write)(struct st_mi_sort_param *, const void *); + void (*lock_in_memory)(MI_CHECK *); +} MI_SORT_PARAM; + + +/* functions in mi_check */ +void myisamchk_init(MI_CHECK *param); +int chk_status(MI_CHECK *param, MI_INFO *info); +int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag); +int chk_size(MI_CHECK *param, MI_INFO *info); +int chk_key(MI_CHECK *param, MI_INFO *info); +int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend); +int mi_repair(MI_CHECK *param, register MI_INFO *info, + my_string name, int rep_quick); +int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name); +int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, + const char * name, int rep_quick); +int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, + const char * name, int rep_quick); +int change_to_newfile(const char * filename, const char * old_ext, + const char * new_ext, uint raid_chunks, + myf myflags); +int lock_file(MI_CHECK *param, File file, my_off_t start, int lock_type, + const char *filetype, const char *filename); +void lock_memory(MI_CHECK *param); +int flush_blocks(MI_CHECK *param, File file); +void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, + my_bool repair); +int update_state_info(MI_CHECK *param, MI_INFO *info,uint update); +void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, + ulonglong *unique, ulonglong records); +int filecopy(MI_CHECK *param, File to,File from,my_off_t start, + my_off_t length, const char *type); +int movepoint(MI_INFO *info,byte *record,my_off_t oldpos, + my_off_t newpos, uint prot_key); +int sort_write_record(MI_SORT_PARAM *sort_param); +int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile); +int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulong); +int test_if_almost_full(MI_INFO *info); +int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename); +void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); +my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map, + my_bool force); + +int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows); +void mi_flush_bulk_insert(MI_INFO *info, uint inx); +void mi_end_bulk_insert(MI_INFO *info); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/myisammrg.h b/dlls/csx_sql/extra/include/mysql/myisammrg.h new file mode 100755 index 00000000..ea882450 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/myisammrg.h @@ -0,0 +1,112 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file should be included when using merge_isam_funktions */ + +#ifndef _myisammrg_h +#define _myisammrg_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _my_base_h +#include +#endif +#ifndef _myisam_h +#include +#endif + +#include + +#define MYRG_NAME_EXT ".MRG" + +/* In which table to INSERT rows */ +#define MERGE_INSERT_DISABLED 0 +#define MERGE_INSERT_TO_FIRST 1 +#define MERGE_INSERT_TO_LAST 2 + +extern TYPELIB merge_insert_method; + + /* Param to/from myrg_info */ + +typedef struct st_mymerge_info /* Struct from h_info */ +{ + ulonglong records; /* Records in database */ + ulonglong deleted; /* Deleted records in database */ + ulonglong recpos; /* Pos for last used record */ + ulonglong data_file_length; + uint reclength; /* Recordlength */ + int errkey; /* With key was dupplicated on err */ + uint options; /* HA_OPTION_... used */ + ulong *rec_per_key; /* for sql optimizing */ +} MYMERGE_INFO; + +typedef struct st_myrg_table_info +{ + struct st_myisam_info *table; + ulonglong file_offset; +} MYRG_TABLE; + +typedef struct st_myrg_info +{ + MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table; + ulonglong records; /* records in tables */ + ulonglong del; /* Removed records */ + ulonglong data_file_length; + ulong cache_size; + uint merge_insert_method; + uint tables,options,reclength,keys; + my_bool cache_in_use; + LIST open_list; + QUEUE by_key; + ulong *rec_per_key_part; /* for sql optimizing */ +} MYRG_INFO; + + + /* Prototypes for merge-functions */ + +extern int myrg_close(MYRG_INFO *file); +extern int myrg_delete(MYRG_INFO *file,const byte *buff); +extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked); +extern int myrg_panic(enum ha_panic_function function); +extern int myrg_rfirst(MYRG_INFO *file,byte *buf,int inx); +extern int myrg_rlast(MYRG_INFO *file,byte *buf,int inx); +extern int myrg_rnext(MYRG_INFO *file,byte *buf,int inx); +extern int myrg_rprev(MYRG_INFO *file,byte *buf,int inx); +extern int myrg_rkey(MYRG_INFO *file,byte *buf,int inx,const byte *key, + uint key_len, enum ha_rkey_function search_flag); +extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos); +extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx); +extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec); +extern int myrg_write(MYRG_INFO *info,byte *rec); +extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag); +extern int myrg_lock_database(MYRG_INFO *file,int lock_type); +extern int myrg_create(const char *name, const char **table_names, + uint insert_method, my_bool fix_names); +extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function, + void *extra_arg); +extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv); +extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx, + const byte *start_key,uint start_key_len, + enum ha_rkey_function start_search_flag, + const byte *end_key,uint end_key_len, + enum ha_rkey_function end_search_flag); + +extern ulonglong myrg_position(MYRG_INFO *info); +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/myisampack.h b/dlls/csx_sql/extra/include/mysql/myisampack.h new file mode 100755 index 00000000..6004177c --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/myisampack.h @@ -0,0 +1,229 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Storing of values in high byte first order. + + integer keys and file pointers are stored with high byte first to get + better compression +*/ + +#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\ + ((int16) ((int16) (A)[0]) << 8)) +#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) (uchar) (A)[0]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[2])) : \ + (((uint32) (uchar) (A)[0]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[2]))) +#define mi_sint4korr(A) (int32) (((int32) ((uchar) (A)[3])) +\ + (((int32) ((uchar) (A)[2]) << 8)) +\ + (((int32) ((uchar) (A)[1]) << 16)) +\ + (((int32) ((int16) (A)[0]) << 24))) +#define mi_sint8korr(A) (longlong) mi_uint8korr(A) +#define mi_uint2korr(A) (uint16) (((uint16) ((uchar) (A)[1])) +\ + ((uint16) ((uchar) (A)[0]) << 8)) +#define mi_uint3korr(A) (uint32) (((uint32) ((uchar) (A)[2])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[0])) << 16)) +#define mi_uint4korr(A) (uint32) (((uint32) ((uchar) (A)[3])) +\ + (((uint32) ((uchar) (A)[2])) << 8) +\ + (((uint32) ((uchar) (A)[1])) << 16) +\ + (((uint32) ((uchar) (A)[0])) << 24)) +#define mi_uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[4])) +\ + (((uint32) ((uchar) (A)[3])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[1])) << 24)) +\ + (((ulonglong) ((uchar) (A)[0])) << 32)) +#define mi_uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[5])) +\ + (((uint32) ((uchar) (A)[4])) << 8) +\ + (((uint32) ((uchar) (A)[3])) << 16) +\ + (((uint32) ((uchar) (A)[2])) << 24)) +\ + (((ulonglong) (((uint32) ((uchar) (A)[1])) +\ + (((uint32) ((uchar) (A)[0]) << 8)))) <<\ + 32)) +#define mi_uint7korr(A) ((ulonglong)(((uint32) ((uchar) (A)[6])) +\ + (((uint32) ((uchar) (A)[5])) << 8) +\ + (((uint32) ((uchar) (A)[4])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) (((uint32) ((uchar) (A)[2])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[0])) << 16))) <<\ + 32)) +#define mi_uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[7])) +\ + (((uint32) ((uchar) (A)[6])) << 8) +\ + (((uint32) ((uchar) (A)[5])) << 16) +\ + (((uint32) ((uchar) (A)[4])) << 24)) +\ + (((ulonglong) (((uint32) ((uchar) (A)[3])) +\ + (((uint32) ((uchar) (A)[2])) << 8) +\ + (((uint32) ((uchar) (A)[1])) << 16) +\ + (((uint32) ((uchar) (A)[0])) << 24))) <<\ + 32)) + +#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\ + *((uchar*) ((T)+1))= (uchar)(def_temp); \ + *((uchar*) ((T)+0))= (uchar)(def_temp >> 8); } +#define mi_int3store(T,A) { /*lint -save -e734 */\ + ulong def_temp= (ulong) (A);\ + *(((T)+2))=(char) (def_temp);\ + *((T)+1)= (char) (def_temp >> 8);\ + *((T)+0)= (char) (def_temp >> 16);\ + /*lint -restore */} +#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\ + *((T)+3)=(char) (def_temp);\ + *((T)+2)=(char) (def_temp >> 8);\ + *((T)+1)=(char) (def_temp >> 16);\ + *((T)+0)=(char) (def_temp >> 24); } +#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\ + def_temp2= (ulong) ((A) >> 32);\ + *((T)+4)=(char) (def_temp);\ + *((T)+3)=(char) (def_temp >> 8);\ + *((T)+2)=(char) (def_temp >> 16);\ + *((T)+1)=(char) (def_temp >> 24);\ + *((T)+0)=(char) (def_temp2); } +#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\ + def_temp2= (ulong) ((A) >> 32);\ + *((T)+5)=(char) (def_temp);\ + *((T)+4)=(char) (def_temp >> 8);\ + *((T)+3)=(char) (def_temp >> 16);\ + *((T)+2)=(char) (def_temp >> 24);\ + *((T)+1)=(char) (def_temp2);\ + *((T)+0)=(char) (def_temp2 >> 8); } +#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\ + def_temp2= (ulong) ((A) >> 32);\ + *((T)+6)=(char) (def_temp);\ + *((T)+5)=(char) (def_temp >> 8);\ + *((T)+4)=(char) (def_temp >> 16);\ + *((T)+3)=(char) (def_temp >> 24);\ + *((T)+2)=(char) (def_temp2);\ + *((T)+1)=(char) (def_temp2 >> 8);\ + *((T)+0)=(char) (def_temp2 >> 16); } +#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A), \ + def_temp4= (ulong) ((A) >> 32); \ + mi_int4store((T),def_temp4); \ + mi_int4store((T+4),def_temp3); \ + } + +#ifdef WORDS_BIGENDIAN + +#define mi_float4store(T,A) { *(T)= ((byte *) &A)[0];\ + *((T)+1)=(char) ((byte *) &A)[1];\ + *((T)+2)=(char) ((byte *) &A)[2];\ + *((T)+3)=(char) ((byte *) &A)[3]; } + +#define mi_float4get(V,M) { float def_temp;\ + ((byte*) &def_temp)[0]=(M)[0];\ + ((byte*) &def_temp)[1]=(M)[1];\ + ((byte*) &def_temp)[2]=(M)[2];\ + ((byte*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } + +#define mi_float8store(T,V) { *(T)= ((byte *) &V)[0];\ + *((T)+1)=(char) ((byte *) &V)[1];\ + *((T)+2)=(char) ((byte *) &V)[2];\ + *((T)+3)=(char) ((byte *) &V)[3];\ + *((T)+4)=(char) ((byte *) &V)[4];\ + *((T)+5)=(char) ((byte *) &V)[5];\ + *((T)+6)=(char) ((byte *) &V)[6];\ + *((T)+7)=(char) ((byte *) &V)[7]; } + +#define mi_float8get(V,M) { double def_temp;\ + ((byte*) &def_temp)[0]=(M)[0];\ + ((byte*) &def_temp)[1]=(M)[1];\ + ((byte*) &def_temp)[2]=(M)[2];\ + ((byte*) &def_temp)[3]=(M)[3];\ + ((byte*) &def_temp)[4]=(M)[4];\ + ((byte*) &def_temp)[5]=(M)[5];\ + ((byte*) &def_temp)[6]=(M)[6];\ + ((byte*) &def_temp)[7]=(M)[7]; \ + (V)=def_temp; } +#else + +#define mi_float4store(T,A) { *(T)= ((byte *) &A)[3];\ + *((T)+1)=(char) ((byte *) &A)[2];\ + *((T)+2)=(char) ((byte *) &A)[1];\ + *((T)+3)=(char) ((byte *) &A)[0]; } + +#define mi_float4get(V,M) { float def_temp;\ + ((byte*) &def_temp)[0]=(M)[3];\ + ((byte*) &def_temp)[1]=(M)[2];\ + ((byte*) &def_temp)[2]=(M)[1];\ + ((byte*) &def_temp)[3]=(M)[0];\ + (V)=def_temp; } + +#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) +#define mi_float8store(T,V) { *(T)= ((byte *) &V)[3];\ + *((T)+1)=(char) ((byte *) &V)[2];\ + *((T)+2)=(char) ((byte *) &V)[1];\ + *((T)+3)=(char) ((byte *) &V)[0];\ + *((T)+4)=(char) ((byte *) &V)[7];\ + *((T)+5)=(char) ((byte *) &V)[6];\ + *((T)+6)=(char) ((byte *) &V)[5];\ + *((T)+7)=(char) ((byte *) &V)[4];} + +#define mi_float8get(V,M) { double def_temp;\ + ((byte*) &def_temp)[0]=(M)[3];\ + ((byte*) &def_temp)[1]=(M)[2];\ + ((byte*) &def_temp)[2]=(M)[1];\ + ((byte*) &def_temp)[3]=(M)[0];\ + ((byte*) &def_temp)[4]=(M)[7];\ + ((byte*) &def_temp)[5]=(M)[6];\ + ((byte*) &def_temp)[6]=(M)[5];\ + ((byte*) &def_temp)[7]=(M)[4];\ + (V)=def_temp; } + +#else +#define mi_float8store(T,V) { *(T)= ((byte *) &V)[7];\ + *((T)+1)=(char) ((byte *) &V)[6];\ + *((T)+2)=(char) ((byte *) &V)[5];\ + *((T)+3)=(char) ((byte *) &V)[4];\ + *((T)+4)=(char) ((byte *) &V)[3];\ + *((T)+5)=(char) ((byte *) &V)[2];\ + *((T)+6)=(char) ((byte *) &V)[1];\ + *((T)+7)=(char) ((byte *) &V)[0];} + +#define mi_float8get(V,M) { double def_temp;\ + ((byte*) &def_temp)[0]=(M)[7];\ + ((byte*) &def_temp)[1]=(M)[6];\ + ((byte*) &def_temp)[2]=(M)[5];\ + ((byte*) &def_temp)[3]=(M)[4];\ + ((byte*) &def_temp)[4]=(M)[3];\ + ((byte*) &def_temp)[5]=(M)[2];\ + ((byte*) &def_temp)[6]=(M)[1];\ + ((byte*) &def_temp)[7]=(M)[0];\ + (V)=def_temp; } +#endif /* __FLOAT_WORD_ORDER */ +#endif /* WORDS_BIGENDIAN */ + +/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */ + +#ifdef BIG_TABLES +#define mi_rowstore(T,A) mi_int8store(T,A) +#define mi_rowkorr(T) mi_uint8korr(T) +#else +#define mi_rowstore(T,A) { mi_int4store(T,0); mi_int4store(((T)+4),A); } +#define mi_rowkorr(T) mi_uint4korr((T)+4) +#endif + +#if SIZEOF_OFF_T > 4 +#define mi_sizestore(T,A) mi_int8store(T,A) +#define mi_sizekorr(T) mi_uint8korr(T) +#else +#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR) bfill((char*) (T),8,255); else { mi_int4store((T),0); mi_int4store(((T)+4),A); }} +#define mi_sizekorr(T) mi_uint4korr((T)+4) +#endif diff --git a/dlls/csx_sql/extra/include/mysql/mysql.h b/dlls/csx_sql/extra/include/mysql/mysql.h new file mode 100755 index 00000000..3ffc014c --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/mysql.h @@ -0,0 +1,441 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _mysql_h +#define _mysql_h + +#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ +#undef WIN +#undef _WIN +#undef _WIN32 +#undef _WIN64 +#undef __WIN__ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _global_h /* If not standard header */ +#include +#ifdef __LCC__ +#include /* For windows */ +#endif +typedef char my_bool; +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) +#define __WIN__ +#endif +#if !defined(__WIN__) +#define STDCALL +#else +#define STDCALL __stdcall +#endif +typedef char * gptr; + +#ifndef my_socket_defined +#ifdef __WIN__ +#define my_socket SOCKET +#else +typedef int my_socket; +#endif /* __WIN__ */ +#endif /* my_socket_defined */ +#endif /* _global_h */ + +#include "mysql_com.h" +#include "mysql_version.h" + +extern unsigned int mysql_port; +extern char *mysql_unix_port; + +#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ +#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ + +#ifdef __NETWARE__ +#pragma pack(push, 8) /* 8 byte alignment */ +#endif + +#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) +#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) +#define IS_BLOB(n) ((n) & BLOB_FLAG) +#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR) +#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) +#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR) + +typedef struct st_mysql_field { + char *name; /* Name of column */ + char *table; /* Table of column if column was a field */ + char *org_table; /* Org table name if table was an alias */ + char *db; /* Database for table */ + char *def; /* Default value (set by mysql_list_fields) */ + unsigned long length; /* Width of column */ + unsigned long max_length; /* Max width of selected set */ + unsigned int flags; /* Div flags */ + unsigned int decimals; /* Number of decimals in field */ + enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ +} MYSQL_FIELD; + +typedef char **MYSQL_ROW; /* return data as array of strings */ +typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ + +#if defined(NO_CLIENT_LONG_LONG) +typedef unsigned long my_ulonglong; +#elif defined (__WIN__) +typedef unsigned __int64 my_ulonglong; +#else +typedef unsigned long long my_ulonglong; +#endif + +#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) + +typedef struct st_mysql_rows { + struct st_mysql_rows *next; /* list of rows */ + MYSQL_ROW data; +} MYSQL_ROWS; + +typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ + +#include "my_alloc.h" + +typedef struct st_mysql_data { + my_ulonglong rows; + unsigned int fields; + MYSQL_ROWS *data; + MEM_ROOT alloc; +} MYSQL_DATA; + +struct st_mysql_options { + unsigned int connect_timeout,client_flag; + unsigned int port; + char *host,*init_command,*user,*password,*unix_socket,*db; + char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; + char *ssl_key; /* PEM key file */ + char *ssl_cert; /* PEM cert file */ + char *ssl_ca; /* PEM CA file */ + char *ssl_capath; /* PEM directory of CA-s? */ + char *ssl_cipher; /* cipher to use */ + unsigned long max_allowed_packet; + my_bool use_ssl; /* if to use SSL or not */ + my_bool compress,named_pipe; + /* + On connect, find out the replication role of the server, and + establish connections to all the peers + */ + my_bool rpl_probe; + /* + Each call to mysql_real_query() will parse it to tell if it is a read + or a write, and direct it to the slave or the master + */ + my_bool rpl_parse; + /* + If set, never read from a master,only from slave, when doing + a read that is replication-aware + */ + my_bool no_master_reads; +}; + +enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, + MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, + MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, + MYSQL_OPT_LOCAL_INFILE}; + +enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, + MYSQL_STATUS_USE_RESULT}; + +/* + There are three types of queries - the ones that have to go to + the master, the ones that go to a slave, and the adminstrative + type which must happen on the pivot connectioin +*/ +enum mysql_rpl_type { MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, + MYSQL_RPL_ADMIN }; + + +typedef struct st_mysql { + NET net; /* Communication parameters */ + gptr connector_fd; /* ConnectorFd for SSL */ + char *host,*user,*passwd,*unix_socket,*server_version,*host_info, + *info,*db; + struct charset_info_st *charset; + MYSQL_FIELD *fields; + MEM_ROOT field_alloc; + my_ulonglong affected_rows; + my_ulonglong insert_id; /* id if insert on table with NEXTNR */ + my_ulonglong extra_info; /* Used by mysqlshow */ + unsigned long thread_id; /* Id for connection in server */ + unsigned long packet_length; + unsigned int port,client_flag,server_capabilities; + unsigned int protocol_version; + unsigned int field_count; + unsigned int server_status; + unsigned int server_language; + struct st_mysql_options options; + enum mysql_status status; + my_bool free_me; /* If free in mysql_close */ + my_bool reconnect; /* set to 1 if automatic reconnect */ + char scramble_buff[9]; + + /* + Set if this is the original connection, not a master or a slave we have + added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave() + */ + my_bool rpl_pivot; + /* + Pointers to the master, and the next slave connections, points to + itself if lone connection. + */ + struct st_mysql* master, *next_slave; + + struct st_mysql* last_used_slave; /* needed for round-robin slave pick */ + /* needed for send/read/store/use result to work correctly with replication */ + struct st_mysql* last_used_con; +} MYSQL; + + +typedef struct st_mysql_res { + my_ulonglong row_count; + MYSQL_FIELD *fields; + MYSQL_DATA *data; + MYSQL_ROWS *data_cursor; + unsigned long *lengths; /* column lengths of current row */ + MYSQL *handle; /* for unbuffered reads */ + MEM_ROOT field_alloc; + unsigned int field_count, current_field; + MYSQL_ROW row; /* If unbuffered read */ + MYSQL_ROW current_row; /* buffer to current row */ + my_bool eof; /* Used by mysql_fetch_row */ +} MYSQL_RES; + +#define MAX_MYSQL_MANAGER_ERR 256 +#define MAX_MYSQL_MANAGER_MSG 256 + +#define MANAGER_OK 200 +#define MANAGER_INFO 250 +#define MANAGER_ACCESS 401 +#define MANAGER_CLIENT_ERR 450 +#define MANAGER_INTERNAL_ERR 500 + + + +typedef struct st_mysql_manager +{ + NET net; + char *host,*user,*passwd; + unsigned int port; + my_bool free_me; + my_bool eof; + int cmd_status; + int last_errno; + char* net_buf,*net_buf_pos,*net_data_end; + int net_buf_size; + char last_error[MAX_MYSQL_MANAGER_ERR]; +} MYSQL_MANAGER; + +/* + Set up and bring down the server; to ensure that applications will + work when linked against either the standard client library or the + embedded server library, these functions should be called. +*/ +int STDCALL mysql_server_init(int argc, char **argv, char **groups); +void STDCALL mysql_server_end(void); + +/* + Set up and bring down a thread; these function should be called + for each thread in an application which opens at least one MySQL + connection. All uses of the connection(s) should be between these + function calls. +*/ +my_bool STDCALL mysql_thread_init(void); +void STDCALL mysql_thread_end(void); + +/* + Functions to get information from the MYSQL and MYSQL_RES structures + Should definitely be used if one uses shared libraries. +*/ + +my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); +unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); +my_bool STDCALL mysql_eof(MYSQL_RES *res); +MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, + unsigned int fieldnr); +MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); +MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res); +MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res); + +unsigned int STDCALL mysql_field_count(MYSQL *mysql); +my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); +my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); +unsigned int STDCALL mysql_errno(MYSQL *mysql); +const char * STDCALL mysql_error(MYSQL *mysql); +const char * STDCALL mysql_info(MYSQL *mysql); +unsigned long STDCALL mysql_thread_id(MYSQL *mysql); +const char * STDCALL mysql_character_set_name(MYSQL *mysql); + +MYSQL * STDCALL mysql_init(MYSQL *mysql); +int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, + const char *cert, const char *ca, + const char *capath, const char *cipher); +my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, + const char *passwd, const char *db); +MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, + const char *user, + const char *passwd, + const char *db, + unsigned int port, + const char *unix_socket, + unsigned int clientflag); +void STDCALL mysql_close(MYSQL *sock); +int STDCALL mysql_select_db(MYSQL *mysql, const char *db); +int STDCALL mysql_query(MYSQL *mysql, const char *q); +int STDCALL mysql_send_query(MYSQL *mysql, const char *q, + unsigned long length); +int STDCALL mysql_read_query_result(MYSQL *mysql); +int STDCALL mysql_real_query(MYSQL *mysql, const char *q, + unsigned long length); +/* perform query on master */ +int STDCALL mysql_master_query(MYSQL *mysql, const char *q, + unsigned long length); +int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, + unsigned long length); +/* perform query on slave */ +int STDCALL mysql_slave_query(MYSQL *mysql, const char *q, + unsigned long length); +int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, + unsigned long length); + +/* + enable/disable parsing of all queries to decide if they go on master or + slave +*/ +void STDCALL mysql_enable_rpl_parse(MYSQL* mysql); +void STDCALL mysql_disable_rpl_parse(MYSQL* mysql); +/* get the value of the parse flag */ +int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql); + +/* enable/disable reads from master */ +void STDCALL mysql_enable_reads_from_master(MYSQL* mysql); +void STDCALL mysql_disable_reads_from_master(MYSQL* mysql); +/* get the value of the master read flag */ +int STDCALL mysql_reads_from_master_enabled(MYSQL* mysql); + +enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len); + +/* discover the master and its slaves */ +int STDCALL mysql_rpl_probe(MYSQL* mysql); + +/* set the master, close/free the old one, if it is not a pivot */ +int STDCALL mysql_set_master(MYSQL* mysql, const char* host, + unsigned int port, + const char* user, + const char* passwd); +int STDCALL mysql_add_slave(MYSQL* mysql, const char* host, + unsigned int port, + const char* user, + const char* passwd); + +int STDCALL mysql_shutdown(MYSQL *mysql); +int STDCALL mysql_dump_debug_info(MYSQL *mysql); +int STDCALL mysql_refresh(MYSQL *mysql, + unsigned int refresh_options); +int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); +int STDCALL mysql_ping(MYSQL *mysql); +const char * STDCALL mysql_stat(MYSQL *mysql); +const char * STDCALL mysql_get_server_info(MYSQL *mysql); +const char * STDCALL mysql_get_client_info(void); +unsigned long STDCALL mysql_get_client_version(void); +const char * STDCALL mysql_get_host_info(MYSQL *mysql); +unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); +MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); +MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, + const char *wild); +MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); +int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, + const char *arg); +void STDCALL mysql_free_result(MYSQL_RES *result); +void STDCALL mysql_data_seek(MYSQL_RES *result, + my_ulonglong offset); +MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, + MYSQL_ROW_OFFSET offset); +MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, + MYSQL_FIELD_OFFSET offset); +MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); +unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); +MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); +unsigned long STDCALL mysql_escape_string(char *to,const char *from, + unsigned long from_length); +unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, + char *to,const char *from, + unsigned long length); +void STDCALL mysql_debug(const char *debug); +char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, + char *to, + unsigned long to_length, + const char *from, + unsigned long from_length, + void *param, + char * + (*extend_buffer) + (void *, char *to, + unsigned long *length)); +void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); +unsigned int STDCALL mysql_thread_safe(void); +MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con); +MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, + const char* host, + const char* user, + const char* passwd, + unsigned int port); +void STDCALL mysql_manager_close(MYSQL_MANAGER* con); +int STDCALL mysql_manager_command(MYSQL_MANAGER* con, + const char* cmd, int cmd_len); +int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, + char* res_buf, + int res_buf_size); +#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) + +#ifdef USE_OLD_FUNCTIONS +MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, + const char *user, const char *passwd); +int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); +int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); +#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) +#endif +#define HAVE_MYSQL_REAL_CONNECT + +/* + The following functions are mainly exported because of mysqlbinlog; + They are not for general usage +*/ + +int simple_command(MYSQL *mysql,enum enum_server_command command, + const char *arg, unsigned long length, my_bool skipp_check); +unsigned long net_safe_read(MYSQL* mysql); +int mysql_once_init(void); + +extern my_bool server_inited; + +#ifdef __NETWARE__ +#pragma pack(pop) /* restore alignment */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _mysql_h */ diff --git a/dlls/csx_sql/extra/include/mysql/mysql_com.h b/dlls/csx_sql/extra/include/mysql/mysql_com.h new file mode 100755 index 00000000..e183a0ed --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/mysql_com.h @@ -0,0 +1,256 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* +** Common definition between mysql server & client +*/ + +#ifndef _mysql_com_h +#define _mysql_com_h + +#define NAME_LEN 64 /* Field/table name length */ +#define HOSTNAME_LENGTH 60 +#define USERNAME_LENGTH 16 +#define SERVER_VERSION_LENGTH 60 + +#define LOCAL_HOST "localhost" +#define LOCAL_HOST_NAMEDPIPE "." + +#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) +#define MYSQL_NAMEDPIPE "MySQL" +#define MYSQL_SERVICENAME "MySQL" +#endif /* __WIN__ */ + +enum enum_server_command { + COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, + COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, + COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, + COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, + COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, + COM_END /* Must be last! */ +}; + +#define NOT_NULL_FLAG 1 /* Field can't be NULL */ +#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ +#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ +#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ +#define BLOB_FLAG 16 /* Field is a blob */ +#define UNSIGNED_FLAG 32 /* Field is unsigned */ +#define ZEROFILL_FLAG 64 /* Field is zerofill */ +#define BINARY_FLAG 128 +/* The following are only sent to new clients */ +#define ENUM_FLAG 256 /* field is an enum */ +#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ +#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ +#define SET_FLAG 2048 /* field is a set */ +#define NUM_FLAG 32768 /* Field is num (for clients) */ +#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ +#define GROUP_FLAG 32768 /* Intern: Group field */ +#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ + +#define REFRESH_GRANT 1 /* Refresh grant tables */ +#define REFRESH_LOG 2 /* Start on new log file */ +#define REFRESH_TABLES 4 /* close all tables */ +#define REFRESH_HOSTS 8 /* Flush host cache */ +#define REFRESH_STATUS 16 /* Flush status variables */ +#define REFRESH_THREADS 32 /* Flush thread cache */ +#define REFRESH_SLAVE 64 /* Reset master info and restart slave + thread */ +#define REFRESH_MASTER 128 /* Remove all bin logs in the index + and truncate the index */ + +/* The following can't be set with mysql_refresh() */ +#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ +#define REFRESH_FAST 32768 /* Intern flag */ + +/* RESET (remove all queries) from query cache */ +#define REFRESH_QUERY_CACHE 65536 +#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ +#define REFRESH_DES_KEY_FILE 0x40000L +#define REFRESH_USER_RESOURCES 0x80000L + +#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ +#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ +#define CLIENT_LONG_FLAG 4 /* Get all column flags */ +#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ +#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ +#define CLIENT_COMPRESS 32 /* Can use compression protocol */ +#define CLIENT_ODBC 64 /* Odbc client */ +#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ +#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ +#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ +#define CLIENT_SSL 2048 /* Switch to SSL after handshake */ +#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ +#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ + +#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ +#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ + +#define MYSQL_ERRMSG_SIZE 200 +#define NET_READ_TIMEOUT 30 /* Timeout on read */ +#define NET_WRITE_TIMEOUT 60 /* Timeout on write */ +#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ + +struct st_vio; /* Only C */ +typedef struct st_vio Vio; + +#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ +#define MAX_BLOB_WIDTH 8192 /* Default width for blob */ + +typedef struct st_net { + Vio* vio; + unsigned char *buff,*buff_end,*write_pos,*read_pos; + my_socket fd; /* For Perl DBI/dbd */ + unsigned long max_packet,max_packet_size; + unsigned int last_errno,pkt_nr,compress_pkt_nr; + unsigned int write_timeout, read_timeout, retry_count; + int fcntl; + char last_error[MYSQL_ERRMSG_SIZE]; + unsigned char error; + my_bool return_errno,compress; + /* + The following variable is set if we are doing several queries in one + command ( as in LOAD TABLE ... FROM MASTER ), + and do not want to confuse the client with OK at the wrong time + */ + unsigned long remain_in_buf,length, buf_length, where_b; + unsigned int *return_status; + unsigned char reading_or_writing; + char save_char; + my_bool no_send_ok; + gptr query_cache_query; +} NET; + +#define packet_error (~(unsigned long) 0) + +enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY, + FIELD_TYPE_SHORT, FIELD_TYPE_LONG, + FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE, + FIELD_TYPE_NULL, FIELD_TYPE_TIMESTAMP, + FIELD_TYPE_LONGLONG,FIELD_TYPE_INT24, + FIELD_TYPE_DATE, FIELD_TYPE_TIME, + FIELD_TYPE_DATETIME, FIELD_TYPE_YEAR, + FIELD_TYPE_NEWDATE, + FIELD_TYPE_ENUM=247, + FIELD_TYPE_SET=248, + FIELD_TYPE_TINY_BLOB=249, + FIELD_TYPE_MEDIUM_BLOB=250, + FIELD_TYPE_LONG_BLOB=251, + FIELD_TYPE_BLOB=252, + FIELD_TYPE_VAR_STRING=253, + FIELD_TYPE_STRING=254, + FIELD_TYPE_GEOMETRY=255 +}; + +#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */ +#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */ + +#define net_new_transaction(net) ((net)->pkt_nr=0) + +#ifdef __cplusplus +extern "C" { +#endif + +int my_net_init(NET *net, Vio* vio); +void my_net_local_init(NET *net); +void net_end(NET *net); +void net_clear(NET *net); +int net_flush(NET *net); +int my_net_write(NET *net,const char *packet,unsigned long len); +int net_write_command(NET *net,unsigned char command,const char *packet, + unsigned long len); +int net_real_write(NET *net,const char *packet,unsigned long len); +unsigned long my_net_read(NET *net); + +/* The following function is not meant for normal usage */ +struct sockaddr; +int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, + unsigned int timeout); + +struct rand_struct { + unsigned long seed1,seed2,max_value; + double max_value_dbl; +}; + +#ifdef __cplusplus +} +#endif + + /* The following is for user defined functions */ + +enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT}; + +typedef struct st_udf_args +{ + unsigned int arg_count; /* Number of arguments */ + enum Item_result *arg_type; /* Pointer to item_results */ + char **args; /* Pointer to argument */ + unsigned long *lengths; /* Length of string arguments */ + char *maybe_null; /* Set to 1 for all maybe_null args */ +} UDF_ARGS; + + /* This holds information about the result */ + +typedef struct st_udf_init +{ + my_bool maybe_null; /* 1 if function can return NULL */ + unsigned int decimals; /* for real functions */ + unsigned long max_length; /* For string functions */ + char *ptr; /* free pointer for function data */ + my_bool const_item; /* 0 if result is independent of arguments */ +} UDF_INIT; + + /* Constants when using compression */ +#define NET_HEADER_SIZE 4 /* standard header size */ +#define COMP_HEADER_SIZE 3 /* compression header extra size */ + + /* Prototypes to password functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern unsigned long max_allowed_packet; +extern unsigned long net_buffer_length; + +void randominit(struct rand_struct *,unsigned long seed1, + unsigned long seed2); +double my_rnd(struct rand_struct *); +void make_scrambled_password(char *to,const char *password); +void get_salt_from_password(unsigned long *res,const char *password); +void make_password_from_salt(char *to, unsigned long *hash_res); +char *scramble(char *to,const char *message,const char *password, + my_bool old_ver); +my_bool check_scramble(const char *, const char *message, + unsigned long *salt,my_bool old_ver); +char *get_tty_password(char *opt_message); +void hash_password(unsigned long *result, const char *password); + +/* Some other useful functions */ + +my_bool my_init(void); +int load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv); +my_bool my_thread_init(void); +void my_thread_end(void); + +#ifdef __cplusplus +} +#endif + +#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ + +#endif diff --git a/dlls/csx_sql/extra/include/mysql/mysql_embed.h b/dlls/csx_sql/extra/include/mysql/mysql_embed.h new file mode 100755 index 00000000..bc75c3fb --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/mysql_embed.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Defines that are unique to the embedded version of MySQL */ + +#ifdef EMBEDDED_LIBRARY + +/* Things we don't need in the embedded version of MySQL */ + +#undef HAVE_PSTACK /* No stacktrace */ +#undef HAVE_DLOPEN /* No udf functions */ +#undef HAVE_OPENSSL +#undef HAVE_VIO +#undef HAVE_ISAM + +#define DONT_USE_RAID + +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-embedded" + +#endif /* EMBEDDED_LIBRARY */ diff --git a/dlls/csx_sql/extra/include/mysql/mysql_version.h b/dlls/csx_sql/extra/include/mysql/mysql_version.h new file mode 100755 index 00000000..35faa702 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/mysql_version.h @@ -0,0 +1,29 @@ +/* Copyright Abandoned 1996, 1999, 2001 MySQL AB + This file is public domain and comes with NO WARRANTY of any kind */ + +/* Version numbers for protocol & mysqld */ + +#ifndef _mysql_version_h +#define _mysql_version_h +#ifdef _CUSTOMCONFIG_ +#include +#else +#define PROTOCOL_VERSION 10 +#define MYSQL_SERVER_VERSION "4.0.18" +#define MYSQL_BASE_VERSION "mysqld-4.0" +#ifndef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "" +#endif +#define FRM_VER 6 +#define MYSQL_VERSION_ID 40018 +#define MYSQL_PORT 3306 +#define MYSQL_UNIX_ADDR "/tmp/mysql.sock" +#define MYSQL_CONFIG_NAME "my" +#define MYSQL_COMPILATION_COMMENT "Source distribution" + +/* mysqld compile time options */ +#ifndef MYSQL_CHARSET +#define MYSQL_CHARSET "latin1" +#endif /* MYSQL_CHARSET */ +#endif /* _CUSTOMCONFIG_ */ +#endif /* _mysql_version_h */ diff --git a/dlls/csx_sql/extra/include/mysql/mysqld_error.h b/dlls/csx_sql/extra/include/mysql/mysqld_error.h new file mode 100755 index 00000000..acc9b596 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/mysqld_error.h @@ -0,0 +1,258 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Definefile for error messagenumbers */ + +#define ER_HASHCHK 1000 +#define ER_NISAMCHK 1001 +#define ER_NO 1002 +#define ER_YES 1003 +#define ER_CANT_CREATE_FILE 1004 +#define ER_CANT_CREATE_TABLE 1005 +#define ER_CANT_CREATE_DB 1006 +#define ER_DB_CREATE_EXISTS 1007 +#define ER_DB_DROP_EXISTS 1008 +#define ER_DB_DROP_DELETE 1009 +#define ER_DB_DROP_RMDIR 1010 +#define ER_CANT_DELETE_FILE 1011 +#define ER_CANT_FIND_SYSTEM_REC 1012 +#define ER_CANT_GET_STAT 1013 +#define ER_CANT_GET_WD 1014 +#define ER_CANT_LOCK 1015 +#define ER_CANT_OPEN_FILE 1016 +#define ER_FILE_NOT_FOUND 1017 +#define ER_CANT_READ_DIR 1018 +#define ER_CANT_SET_WD 1019 +#define ER_CHECKREAD 1020 +#define ER_DISK_FULL 1021 +#define ER_DUP_KEY 1022 +#define ER_ERROR_ON_CLOSE 1023 +#define ER_ERROR_ON_READ 1024 +#define ER_ERROR_ON_RENAME 1025 +#define ER_ERROR_ON_WRITE 1026 +#define ER_FILE_USED 1027 +#define ER_FILSORT_ABORT 1028 +#define ER_FORM_NOT_FOUND 1029 +#define ER_GET_ERRNO 1030 +#define ER_ILLEGAL_HA 1031 +#define ER_KEY_NOT_FOUND 1032 +#define ER_NOT_FORM_FILE 1033 +#define ER_NOT_KEYFILE 1034 +#define ER_OLD_KEYFILE 1035 +#define ER_OPEN_AS_READONLY 1036 +#define ER_OUTOFMEMORY 1037 +#define ER_OUT_OF_SORTMEMORY 1038 +#define ER_UNEXPECTED_EOF 1039 +#define ER_CON_COUNT_ERROR 1040 +#define ER_OUT_OF_RESOURCES 1041 +#define ER_BAD_HOST_ERROR 1042 +#define ER_HANDSHAKE_ERROR 1043 +#define ER_DBACCESS_DENIED_ERROR 1044 +#define ER_ACCESS_DENIED_ERROR 1045 +#define ER_NO_DB_ERROR 1046 +#define ER_UNKNOWN_COM_ERROR 1047 +#define ER_BAD_NULL_ERROR 1048 +#define ER_BAD_DB_ERROR 1049 +#define ER_TABLE_EXISTS_ERROR 1050 +#define ER_BAD_TABLE_ERROR 1051 +#define ER_NON_UNIQ_ERROR 1052 +#define ER_SERVER_SHUTDOWN 1053 +#define ER_BAD_FIELD_ERROR 1054 +#define ER_WRONG_FIELD_WITH_GROUP 1055 +#define ER_WRONG_GROUP_FIELD 1056 +#define ER_WRONG_SUM_SELECT 1057 +#define ER_WRONG_VALUE_COUNT 1058 +#define ER_TOO_LONG_IDENT 1059 +#define ER_DUP_FIELDNAME 1060 +#define ER_DUP_KEYNAME 1061 +#define ER_DUP_ENTRY 1062 +#define ER_WRONG_FIELD_SPEC 1063 +#define ER_PARSE_ERROR 1064 +#define ER_EMPTY_QUERY 1065 +#define ER_NONUNIQ_TABLE 1066 +#define ER_INVALID_DEFAULT 1067 +#define ER_MULTIPLE_PRI_KEY 1068 +#define ER_TOO_MANY_KEYS 1069 +#define ER_TOO_MANY_KEY_PARTS 1070 +#define ER_TOO_LONG_KEY 1071 +#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 +#define ER_BLOB_USED_AS_KEY 1073 +#define ER_TOO_BIG_FIELDLENGTH 1074 +#define ER_WRONG_AUTO_KEY 1075 +#define ER_READY 1076 +#define ER_NORMAL_SHUTDOWN 1077 +#define ER_GOT_SIGNAL 1078 +#define ER_SHUTDOWN_COMPLETE 1079 +#define ER_FORCING_CLOSE 1080 +#define ER_IPSOCK_ERROR 1081 +#define ER_NO_SUCH_INDEX 1082 +#define ER_WRONG_FIELD_TERMINATORS 1083 +#define ER_BLOBS_AND_NO_TERMINATED 1084 +#define ER_TEXTFILE_NOT_READABLE 1085 +#define ER_FILE_EXISTS_ERROR 1086 +#define ER_LOAD_INFO 1087 +#define ER_ALTER_INFO 1088 +#define ER_WRONG_SUB_KEY 1089 +#define ER_CANT_REMOVE_ALL_FIELDS 1090 +#define ER_CANT_DROP_FIELD_OR_KEY 1091 +#define ER_INSERT_INFO 1092 +#define ER_INSERT_TABLE_USED 1093 +#define ER_NO_SUCH_THREAD 1094 +#define ER_KILL_DENIED_ERROR 1095 +#define ER_NO_TABLES_USED 1096 +#define ER_TOO_BIG_SET 1097 +#define ER_NO_UNIQUE_LOGFILE 1098 +#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 +#define ER_TABLE_NOT_LOCKED 1100 +#define ER_BLOB_CANT_HAVE_DEFAULT 1101 +#define ER_WRONG_DB_NAME 1102 +#define ER_WRONG_TABLE_NAME 1103 +#define ER_TOO_BIG_SELECT 1104 +#define ER_UNKNOWN_ERROR 1105 +#define ER_UNKNOWN_PROCEDURE 1106 +#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 +#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 +#define ER_UNKNOWN_TABLE 1109 +#define ER_FIELD_SPECIFIED_TWICE 1110 +#define ER_INVALID_GROUP_FUNC_USE 1111 +#define ER_UNSUPPORTED_EXTENSION 1112 +#define ER_TABLE_MUST_HAVE_COLUMNS 1113 +#define ER_RECORD_FILE_FULL 1114 +#define ER_UNKNOWN_CHARACTER_SET 1115 +#define ER_TOO_MANY_TABLES 1116 +#define ER_TOO_MANY_FIELDS 1117 +#define ER_TOO_BIG_ROWSIZE 1118 +#define ER_STACK_OVERRUN 1119 +#define ER_WRONG_OUTER_JOIN 1120 +#define ER_NULL_COLUMN_IN_INDEX 1121 +#define ER_CANT_FIND_UDF 1122 +#define ER_CANT_INITIALIZE_UDF 1123 +#define ER_UDF_NO_PATHS 1124 +#define ER_UDF_EXISTS 1125 +#define ER_CANT_OPEN_LIBRARY 1126 +#define ER_CANT_FIND_DL_ENTRY 1127 +#define ER_FUNCTION_NOT_DEFINED 1128 +#define ER_HOST_IS_BLOCKED 1129 +#define ER_HOST_NOT_PRIVILEGED 1130 +#define ER_PASSWORD_ANONYMOUS_USER 1131 +#define ER_PASSWORD_NOT_ALLOWED 1132 +#define ER_PASSWORD_NO_MATCH 1133 +#define ER_UPDATE_INFO 1134 +#define ER_CANT_CREATE_THREAD 1135 +#define ER_WRONG_VALUE_COUNT_ON_ROW 1136 +#define ER_CANT_REOPEN_TABLE 1137 +#define ER_INVALID_USE_OF_NULL 1138 +#define ER_REGEXP_ERROR 1139 +#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 +#define ER_NONEXISTING_GRANT 1141 +#define ER_TABLEACCESS_DENIED_ERROR 1142 +#define ER_COLUMNACCESS_DENIED_ERROR 1143 +#define ER_ILLEGAL_GRANT_FOR_TABLE 1144 +#define ER_GRANT_WRONG_HOST_OR_USER 1145 +#define ER_NO_SUCH_TABLE 1146 +#define ER_NONEXISTING_TABLE_GRANT 1147 +#define ER_NOT_ALLOWED_COMMAND 1148 +#define ER_SYNTAX_ERROR 1149 +#define ER_DELAYED_CANT_CHANGE_LOCK 1150 +#define ER_TOO_MANY_DELAYED_THREADS 1151 +#define ER_ABORTING_CONNECTION 1152 +#define ER_NET_PACKET_TOO_LARGE 1153 +#define ER_NET_READ_ERROR_FROM_PIPE 1154 +#define ER_NET_FCNTL_ERROR 1155 +#define ER_NET_PACKETS_OUT_OF_ORDER 1156 +#define ER_NET_UNCOMPRESS_ERROR 1157 +#define ER_NET_READ_ERROR 1158 +#define ER_NET_READ_INTERRUPTED 1159 +#define ER_NET_ERROR_ON_WRITE 1160 +#define ER_NET_WRITE_INTERRUPTED 1161 +#define ER_TOO_LONG_STRING 1162 +#define ER_TABLE_CANT_HANDLE_BLOB 1163 +#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 +#define ER_DELAYED_INSERT_TABLE_LOCKED 1165 +#define ER_WRONG_COLUMN_NAME 1166 +#define ER_WRONG_KEY_COLUMN 1167 +#define ER_WRONG_MRG_TABLE 1168 +#define ER_DUP_UNIQUE 1169 +#define ER_BLOB_KEY_WITHOUT_LENGTH 1170 +#define ER_PRIMARY_CANT_HAVE_NULL 1171 +#define ER_TOO_MANY_ROWS 1172 +#define ER_REQUIRES_PRIMARY_KEY 1173 +#define ER_NO_RAID_COMPILED 1174 +#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 +#define ER_KEY_DOES_NOT_EXITS 1176 +#define ER_CHECK_NO_SUCH_TABLE 1177 +#define ER_CHECK_NOT_IMPLEMENTED 1178 +#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 +#define ER_ERROR_DURING_COMMIT 1180 +#define ER_ERROR_DURING_ROLLBACK 1181 +#define ER_ERROR_DURING_FLUSH_LOGS 1182 +#define ER_ERROR_DURING_CHECKPOINT 1183 +#define ER_NEW_ABORTING_CONNECTION 1184 +#define ER_DUMP_NOT_IMPLEMENTED 1185 +#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 +#define ER_INDEX_REBUILD 1187 +#define ER_MASTER 1188 +#define ER_MASTER_NET_READ 1189 +#define ER_MASTER_NET_WRITE 1190 +#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 +#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 +#define ER_UNKNOWN_SYSTEM_VARIABLE 1193 +#define ER_CRASHED_ON_USAGE 1194 +#define ER_CRASHED_ON_REPAIR 1195 +#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 +#define ER_TRANS_CACHE_FULL 1197 +#define ER_SLAVE_MUST_STOP 1198 +#define ER_SLAVE_NOT_RUNNING 1199 +#define ER_BAD_SLAVE 1200 +#define ER_MASTER_INFO 1201 +#define ER_SLAVE_THREAD 1202 +#define ER_TOO_MANY_USER_CONNECTIONS 1203 +#define ER_SET_CONSTANTS_ONLY 1204 +#define ER_LOCK_WAIT_TIMEOUT 1205 +#define ER_LOCK_TABLE_FULL 1206 +#define ER_READ_ONLY_TRANSACTION 1207 +#define ER_DROP_DB_WITH_READ_LOCK 1208 +#define ER_CREATE_DB_WITH_READ_LOCK 1209 +#define ER_WRONG_ARGUMENTS 1210 +#define ER_NO_PERMISSION_TO_CREATE_USER 1211 +#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 +#define ER_LOCK_DEADLOCK 1213 +#define ER_TABLE_CANT_HANDLE_FULLTEXT 1214 +#define ER_CANNOT_ADD_FOREIGN 1215 +#define ER_NO_REFERENCED_ROW 1216 +#define ER_ROW_IS_REFERENCED 1217 +#define ER_CONNECT_TO_MASTER 1218 +#define ER_QUERY_ON_MASTER 1219 +#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 +#define ER_WRONG_USAGE 1221 +#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 +#define ER_CANT_UPDATE_WITH_READLOCK 1223 +#define ER_MIXING_NOT_ALLOWED 1224 +#define ER_DUP_ARGUMENT 1225 +#define ER_USER_LIMIT_REACHED 1226 +#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 +#define ER_LOCAL_VARIABLE 1228 +#define ER_GLOBAL_VARIABLE 1229 +#define ER_NO_DEFAULT 1230 +#define ER_WRONG_VALUE_FOR_VAR 1231 +#define ER_WRONG_TYPE_FOR_VAR 1232 +#define ER_VAR_CANT_BE_READ 1233 +#define ER_CANT_USE_OPTION_HERE 1234 +#define ER_NOT_SUPPORTED_YET 1235 +#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +#define ER_SLAVE_IGNORED_TABLE 1237 /* only the slave SQL thread can be sent this */ +#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 +#define ER_ERROR_MESSAGES 239 diff --git a/dlls/csx_sql/extra/include/mysql/mysys_err.h b/dlls/csx_sql/extra/include/mysql/mysys_err.h new file mode 100755 index 00000000..0ee89e91 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/mysys_err.h @@ -0,0 +1,77 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _mysys_err_h +#define _mysys_err_h +#ifdef __cplusplus +extern "C" { +#endif + +#define GLOB 0 /* Error maps */ +#define GLOBERRS 28 /* Max number of error messages in map's */ +#define EE(X) globerrs[ X ] /* Defines to add error to right map */ + +extern const char * NEAR globerrs[]; /* my_error_messages is here */ + +/* Error message numbers in global map */ +#define EE_FILENOTFOUND 0 +#define EE_CANTCREATEFILE 1 +#define EE_READ 2 +#define EE_WRITE 3 +#define EE_BADCLOSE 4 +#define EE_OUTOFMEMORY 5 +#define EE_DELETE 6 +#define EE_LINK 7 +#define EE_EOFERR 9 +#define EE_CANTLOCK 10 +#define EE_CANTUNLOCK 11 +#define EE_DIR 12 +#define EE_STAT 13 +#define EE_CANT_CHSIZE 14 +#define EE_CANT_OPEN_STREAM 15 +#define EE_GETWD 16 +#define EE_SETWD 17 +#define EE_LINK_WARNING 18 +#define EE_OPEN_WARNING 19 +#define EE_DISK_FULL 20 +#define EE_CANT_MKDIR 21 +#define EE_UNKNOWN_CHARSET 22 +#define EE_OUT_OF_FILERESOURCES 23 +#define EE_CANT_READLINK 24 +#define EE_CANT_SYMLINK 25 +#define EE_REALPATH 26 +#define EE_SYNC 27 + + /* exit codes for all MySQL programs */ + +#define EXIT_UNSPECIFIED_ERROR 1 +#define EXIT_UNKNOWN_OPTION 2 +#define EXIT_AMBIGUOUS_OPTION 3 +#define EXIT_NO_ARGUMENT_ALLOWED 4 +#define EXIT_ARGUMENT_REQUIRED 5 +#define EXIT_VAR_PREFIX_NOT_UNIQUE 6 +#define EXIT_UNKNOWN_VARIABLE 7 +#define EXIT_OUT_OF_MEMORY 8 +#define EXIT_UNKNOWN_SUFFIX 9 +#define EXIT_NO_PTR_TO_VARIABLE 10 +#define EXIT_CANNOT_CONNECT_TO_SERVICE 11 + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/dlls/csx_sql/extra/include/mysql/nisam.h b/dlls/csx_sql/extra/include/mysql/nisam.h new file mode 100755 index 00000000..e8f29991 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/nisam.h @@ -0,0 +1,212 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file should be included when using nisam_funktions */ +/* Author: Michael Widenius */ + +#ifndef _nisam_h +#define _nisam_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _my_base_h +#include +#endif + /* defines used by nisam-funktions */ + +#define N_MAXKEY 16 /* Max allowed keys */ +#define N_MAXKEY_SEG 16 /* Max segments for key */ +#define N_MAX_KEY_LENGTH 256 /* May be increased up to 500 */ +#define N_MAX_KEY_BUFF (N_MAX_KEY_LENGTH+N_MAXKEY_SEG+sizeof(double)-1) +#define N_MAX_POSSIBLE_KEY_BUFF 500+9 + +#define N_NAME_IEXT ".ISM" +#define N_NAME_DEXT ".ISD" +#define NI_POS_ERROR (~ (ulong) 0) + + + /* Param to/from nisam_info */ + +typedef struct st_n_isaminfo /* Struct from h_info */ +{ + ulong records; /* Records in database */ + ulong deleted; /* Deleted records in database */ + ulong recpos; /* Pos for last used record */ + ulong newrecpos; /* Pos if we write new record */ + ulong dupp_key_pos; /* Position to record with dupp key */ + ulong data_file_length, /* Length of data file */ + max_data_file_length, + index_file_length, + max_index_file_length, + delete_length; + uint reclength; /* Recordlength */ + uint mean_reclength; /* Mean recordlength (if packed) */ + uint keys; /* How many keys used */ + uint options; /* HA_OPTION_... used */ + int errkey, /* With key was dupplicated on err */ + sortkey; /* clustered by this key */ + File filenr; /* (uniq) filenr for datafile */ + time_t create_time; /* When table was created */ + time_t isamchk_time; + time_t update_time; + ulong *rec_per_key; /* for sql optimizing */ +} N_ISAMINFO; + + + /* Info saved on file for each info-part */ + +#ifdef __WATCOMC__ +#pragma pack(2) +#define uint uint16 /* Same format as in MSDOS */ +#endif + +#ifdef __ZTC__ +#pragma ZTC align 2 +#define uint uint16 /* Same format as in MSDOS */ +#endif + +typedef struct st_n_save_keyseg /* Key-portion */ +{ + uint8 type; /* Typ av nyckel (f|r sort) */ + uint8 flag; /* HA_DIFF_LENGTH */ + uint16 start; /* Start of key in record */ + uint16 length; /* Keylength */ +} N_SAVE_KEYSEG; + +typedef struct st_n_save_keydef /* Key definition with create & info */ +{ + uint8 flag; /* NOSAME, PACK_USED */ + uint8 keysegs; /* Number of key-segment */ + uint16 block_length; /* Length of keyblock (auto) */ + uint16 keylength; /* Tot length of keyparts (auto) */ + uint16 minlength; /* min length of (packed) key (auto) */ + uint16 maxlength; /* max length of (packed) key (auto) */ +} N_SAVE_KEYDEF; + +typedef struct st_n_save_recinfo /* Info of record */ +{ + int16 type; /* en_fieldtype */ + uint16 length; /* length of field */ +} N_SAVE_RECINFO; + + +#ifdef __ZTC__ +#pragma ZTC align +#undef uint +#endif + +#ifdef __WATCOMC__ +#pragma pack() +#undef uint +#endif + + +struct st_isam_info; /* For referense */ + +#ifndef ISAM_LIBRARY +typedef struct st_isam_info N_INFO; +#endif + +typedef struct st_n_keyseg /* Key-portion */ +{ + N_SAVE_KEYSEG base; +} N_KEYSEG; + + +typedef struct st_n_keydef /* Key definition with open & info */ +{ + N_SAVE_KEYDEF base; + N_KEYSEG seg[N_MAXKEY_SEG+1]; + int (*bin_search)(struct st_isam_info *info,struct st_n_keydef *keyinfo, + uchar *page,uchar *key, + uint key_len,uint comp_flag,uchar * *ret_pos, + uchar *buff); + uint (*get_key)(struct st_n_keydef *keyinfo,uint nod_flag,uchar * *page, + uchar *key); +} N_KEYDEF; + + +typedef struct st_decode_tree /* Decode huff-table */ +{ + uint16 *table; + uint quick_table_bits; + byte *intervalls; +} DECODE_TREE; + + +struct st_bit_buff; + +typedef struct st_n_recinfo /* Info of record */ +{ + N_SAVE_RECINFO base; +#ifndef NOT_PACKED_DATABASES + void (*unpack)(struct st_n_recinfo *rec,struct st_bit_buff *buff, + uchar *start,uchar *end); + enum en_fieldtype base_type; + uint space_length_bits,pack_type; + DECODE_TREE *huff_tree; +#endif +} N_RECINFO; + + +extern my_string nisam_log_filename; /* Name of logfile */ +extern uint nisam_block_size; +extern my_bool nisam_flush; + + /* Prototypes for nisam-functions */ + +extern int nisam_close(struct st_isam_info *file); +extern int nisam_delete(struct st_isam_info *file,const byte *buff); +extern struct st_isam_info *nisam_open(const char *name,int mode, + uint wait_if_locked); +extern int nisam_panic(enum ha_panic_function function); +extern int nisam_rfirst(struct st_isam_info *file,byte *buf,int inx); +extern int nisam_rkey(struct st_isam_info *file,byte *buf,int inx, + const byte *key, + uint key_len, enum ha_rkey_function search_flag); +extern int nisam_rlast(struct st_isam_info *file,byte *buf,int inx); +extern int nisam_rnext(struct st_isam_info *file,byte *buf,int inx); +extern int nisam_rprev(struct st_isam_info *file,byte *buf,int inx); +extern int nisam_rrnd(struct st_isam_info *file,byte *buf,ulong pos); +extern int nisam_rsame(struct st_isam_info *file,byte *record,int inx); +extern int nisam_rsame_with_pos(struct st_isam_info *file,byte *record, + int inx,ulong pos); +extern int nisam_update(struct st_isam_info *file,const byte *old, + const byte *new_record); +extern int nisam_write(struct st_isam_info *file,const byte *buff); +extern int nisam_info(struct st_isam_info *file,N_ISAMINFO *x,int flag); +extern ulong nisam_position(struct st_isam_info *info); +extern int nisam_lock_database(struct st_isam_info *file,int lock_type); +extern int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, + N_RECINFO *recinfo,ulong records, + ulong reloc,uint flags,uint options, + ulong data_file_length); +extern int nisam_extra(struct st_isam_info *file, + enum ha_extra_function function); +extern ulong nisam_records_in_range(struct st_isam_info *info,int inx, + const byte *start_key,uint start_key_len, + enum ha_rkey_function start_search_flag, + const byte *end_key,uint end_key_len, + enum ha_rkey_function end_search_flag); +extern int nisam_log(int activate_log); +extern int nisam_is_changed(struct st_isam_info *info); +extern uint _calc_blob_length(uint length , const byte *pos); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/queues.h b/dlls/csx_sql/extra/include/mysql/queues.h new file mode 100755 index 00000000..ac15b097 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/queues.h @@ -0,0 +1,63 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Code for generell handling of priority Queues. + Implemention of queues from "Algoritms in C" by Robert Sedgewick. + Copyright Monty Program KB. + By monty. +*/ + +#ifndef _queues_h +#define _queues_h +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_queue { + byte **root; + void *first_cmp_arg; + uint elements; + uint max_elements; + uint offset_to_key; /* compare is done on element+offset */ + int max_at_top; /* Set if queue_top gives max */ + int (*compare)(void *, byte *,byte *); +} QUEUE; + +#define queue_top(queue) ((queue)->root[1]) +#define queue_element(queue,index) ((queue)->root[index+1]) +#define queue_end(queue) ((queue)->root[(queue)->elements]) +#define queue_replaced(queue) _downheap(queue,1) +typedef int (*queue_compare)(void *,byte *, byte *); + +int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, + pbool max_at_top, queue_compare compare, + void *first_cmp_arg); +int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, + pbool max_at_top, queue_compare compare, + void *first_cmp_arg); +int resize_queue(QUEUE *queue, uint max_elements); +void delete_queue(QUEUE *queue); +void queue_insert(QUEUE *queue,byte *element); +byte *queue_remove(QUEUE *queue,uint idx); +void _downheap(QUEUE *queue,uint idx); +void queue_fix(QUEUE *queue); +#define is_queue_inited(queue) ((queue)->root != 0) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dlls/csx_sql/extra/include/mysql/raid.h b/dlls/csx_sql/extra/include/mysql/raid.h new file mode 100755 index 00000000..b5a5e665 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/raid.h @@ -0,0 +1,158 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Parser needs these defines always, even if USE_RAID is not defined */ +#define RAID_TYPE_0 1 /* Striping */ +#define RAID_TYPE_x 2 /* Some new modes */ +#define RAID_TYPE_y 3 + +#define RAID_DEFAULT_CHUNKS 4 +#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */ + +C_MODE_START +#define my_raid_type(raid_type) raid_type_string[(int)(raid_type)] +extern const char *raid_type_string[]; +C_MODE_END + +#ifdef DONT_USE_RAID +#undef USE_RAID +#endif +#if defined(USE_RAID) + +#ifdef __GNUC__ +#pragma interface /* gcc class implementation */ +#endif +#include "my_dir.h" + +/* Trap all occurences of my_...() in source and use our wrapper around this function */ + +#ifdef MAP_TO_USE_RAID +#define my_read(A,B,C,D) my_raid_read(A,B,C,D) +#define my_write(A,B,C,D) my_raid_write(A,B,C,D) +#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E) +#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E) +#define my_chsize(A,B,C,D) my_raid_chsize(A,B,C,D) +#define my_close(A,B) my_raid_close(A,B) +#define my_tell(A,B) my_raid_tell(A,B) +#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D) +#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E) +#define my_fstat(A,B,C) my_raid_fstat(A,B,C) +#endif /* MAP_TO_USE_RAID */ + +#ifdef __cplusplus +extern "C" { +#endif + + void init_raid(void); + void end_raid(void); + + bool is_raid(File fd); + File my_raid_create(const char *FileName, int CreateFlags, int access_flags, + uint raid_type, uint raid_chunks, ulong raid_chunksize, + myf MyFlags); + File my_raid_open(const char *FileName, int Flags, + uint raid_type, uint raid_chunks, ulong raid_chunksize, + myf MyFlags); + int my_raid_rename(const char *from, const char *to, uint raid_chunks, + myf MyFlags); + int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags); + int my_raid_redel(const char *old_name, const char *new_name, + uint raid_chunks, myf MyFlags); + + my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags); + my_off_t my_raid_tell(File fd, myf MyFlags); + + uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags); + uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags); + + uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, + myf MyFlags); + uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count, + my_off_t offset, myf MyFlags); + + int my_raid_lock(File,int locktype, my_off_t start, my_off_t length, + myf MyFlags); + int my_raid_chsize(File fd, my_off_t newlength, int filler, myf MyFlags); + int my_raid_close(File, myf MyFlags); + int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags); + +#ifdef __cplusplus +} + +class RaidName { + public: + RaidName(const char *FileName); + ~RaidName(); + bool IsRaid(); + int Rename(const char * from, const char * to, myf MyFlags); + private: + uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ + uint _raid_chunks; /* 1..n */ + ulong _raid_chunksize; /* 1..n in bytes */ +}; + +class RaidFd { + public: + RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize); + ~RaidFd(); + File Create(const char *FileName, int CreateFlags, int access_flags, + myf MyFlags); + File Open(const char *FileName, int Flags, myf MyFlags); + my_off_t Seek(my_off_t pos,int whence,myf MyFlags); + my_off_t Tell(myf MyFlags); + int Write(const byte *Buffer, uint Count, myf MyFlags); + int Read(const byte *Buffer, uint Count, myf MyFlags); + int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags); + int Chsize(File fd, my_off_t newlength, int filler, myf MyFlags); + int Fstat(int fd, MY_STAT *stat_area, myf MyFlags ); + int Close(myf MyFlags); + static bool IsRaid(File fd); + static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */ + private: + + uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ + uint _raid_chunks; /* 1..n */ + ulong _raid_chunksize; /* 1..n in bytes */ + + ulong _total_block; /* We are operating with block no x (can be 0..many). */ + uint _this_block; /* can be 0.._raid_chunks */ + uint _remaining_bytes; /* Maximum bytes that can be written in this block */ + + my_off_t _position; + my_off_t _size; /* Cached file size for faster seek(SEEK_END) */ + File _fd; + File *_fd_vector; /* Array of File */ + off_t *_seek_vector; /* Array of cached seek positions */ + + inline void Calculate() + { + DBUG_ENTER("RaidFd::_Calculate"); + DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu", + (ulong) _position, _raid_chunksize, (ulong) _size)); + + _total_block = (ulong) (_position / _raid_chunksize); + _this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */ + _remaining_bytes = (uint) (_raid_chunksize - + (_position - _total_block * _raid_chunksize)); + DBUG_PRINT("info", + ("_total_block: %d this_block: %d _remaining_bytes:%d", + _total_block, _this_block, _remaining_bytes)); + DBUG_VOID_RETURN; + } +}; + +#endif /* __cplusplus */ +#endif /* USE_RAID */ diff --git a/dlls/csx_sql/extra/include/mysql/rijndael.h b/dlls/csx_sql/extra/include/mysql/rijndael.h new file mode 100755 index 00000000..e286c89c --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/rijndael.h @@ -0,0 +1,42 @@ +/* Copyright (C) 2002 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + rijndael-alg-fst.h + + @version 3.0 (December 2000) + Optimised ANSI C code for the Rijndael cipher (now AES) + @author Vincent Rijmen + @author Antoon Bosselaers + @author Paulo Barreto + + This code is hereby placed in the public domain. + Modified by Peter Zaitsev to fit MySQL coding style. + */ + +#define AES_MAXKC (256/32) +#define AES_MAXKB (256/8) +#define AES_MAXNR 14 + +int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits); +int rijndaelKeySetupDec(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits); +void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, + const uint8 pt[16], uint8 ct[16]); +void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, + const uint8 ct[16], uint8 pt[16]); diff --git a/dlls/csx_sql/extra/include/mysql/sha1.h b/dlls/csx_sql/extra/include/mysql/sha1.h new file mode 100755 index 00000000..1c345469 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/sha1.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This is the header file for code which implements the Secure + Hashing Algorithm 1 as defined in FIPS PUB 180-1 published + April 17, 1995. + + Many of the variable names in this code, especially the + single character names, were used because those were the names + used in the publication. + + Please read the file sha1.c for more information. + + Modified 2002 by Peter Zaitsev to better follow MySQL standards +*/ + + +enum sha_result_codes +{ + SHA_SUCCESS = 0, + SHA_NULL, /* Null pointer parameter */ + SHA_INPUT_TOO_LONG, /* input data too long */ + SHA_STATE_ERROR /* called Input after Result */ +}; + +#define SHA1_HASH_SIZE 20 /* Hash size in bytes */ + +/* + This structure will hold context information for the SHA-1 + hashing operation +*/ + +typedef struct SHA1_CONTEXT +{ + ulonglong Length; /* Message length in bits */ + uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */ + int Computed; /* Is the digest computed? */ + int Corrupted; /* Is the message digest corrupted? */ + int16 Message_Block_Index; /* Index into message block array */ + uint8 Message_Block[64]; /* 512-bit message blocks */ +} SHA1_CONTEXT; + +/* + Function Prototypes +*/ + +C_MODE_START + +int sha1_reset( SHA1_CONTEXT* ); +int sha1_input( SHA1_CONTEXT*, const uint8 *, unsigned int ); +int sha1_result( SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE] ); + +C_MODE_END diff --git a/dlls/csx_sql/extra/include/mysql/sslopt-case.h b/dlls/csx_sql/extra/include/mysql/sslopt-case.h new file mode 100755 index 00000000..ea23c31a --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/sslopt-case.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef HAVE_OPENSSL + case OPT_SSL_KEY: + case OPT_SSL_CERT: + case OPT_SSL_CA: + case OPT_SSL_CAPATH: + case OPT_SSL_CIPHER: + /* + Enable use of SSL if we are using any ssl option + One can disable SSL later by using --skip-ssl or --ssl=0 + */ + opt_use_ssl= 1; + break; +#endif diff --git a/dlls/csx_sql/extra/include/mysql/sslopt-longopts.h b/dlls/csx_sql/extra/include/mysql/sslopt-longopts.h new file mode 100755 index 00000000..397d8baa --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/sslopt-longopts.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef HAVE_OPENSSL + + {"ssl", OPT_SSL_SSL, + "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl", + (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, + {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl)", + (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl)", + (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-ca", OPT_SSL_CA, + "CA file in PEM format (check OpenSSL docs, implies --ssl)", + (gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-capath", OPT_SSL_CAPATH, + "CA directory (check OpenSSL docs, implies --ssl)", + (gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl)", + (gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + +#endif /* HAVE_OPENSSL */ diff --git a/dlls/csx_sql/extra/include/mysql/sslopt-vars.h b/dlls/csx_sql/extra/include/mysql/sslopt-vars.h new file mode 100755 index 00000000..164cf541 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/sslopt-vars.h @@ -0,0 +1,24 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef HAVE_OPENSSL +static my_bool opt_use_ssl = 0; +static char *opt_ssl_key = 0; +static char *opt_ssl_cert = 0; +static char *opt_ssl_ca = 0; +static char *opt_ssl_capath = 0; +static char *opt_ssl_cipher = 0; +#endif diff --git a/dlls/csx_sql/extra/include/mysql/t_ctype.h b/dlls/csx_sql/extra/include/mysql/t_ctype.h new file mode 100755 index 00000000..3e190977 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/t_ctype.h @@ -0,0 +1,255 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved. + Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved. + Permission to use, copy, modify, distribute and sell this software + and its documentation for any purpose is hereby granted without fee, + provided that the above copyright notice appear in all copies. + Smaphan Raruenrom and Pruet Boonma makes no representations about + the suitability of this software for any purpose. It is provided + "as is" without express or implied warranty. +*/ + +/* LC_COLLATE category + Level information */ + +#ifndef _t_ctype_h +#define _t_ctype_h + +#define TOT_LEVELS 5 +#define LAST_LEVEL 4 /* TOT_LEVELS - 1 */ + +#define IGNORE 0 + + +/* level 1 symbols & order */ +enum l1_symbols { + L1_08 = TOT_LEVELS, + L1_18, + L1_28, + L1_38, + L1_48, + L1_58, + L1_68, + L1_78, + L1_88, + L1_98, + L1_A8, + L1_B8, + L1_C8, + L1_D8, + L1_E8, + L1_F8, + L1_G8, + L1_H8, + L1_I8, + L1_J8, + L1_K8, + L1_L8, + L1_M8, + L1_N8, + L1_O8, + L1_P8, + L1_Q8, + L1_R8, + L1_S8, + L1_T8, + L1_U8, + L1_V8, + L1_W8, + L1_X8, + L1_Y8, + L1_Z8, + L1_KO_KAI, + L1_KHO_KHAI, + L1_KHO_KHUAT, + L1_KHO_KHWAI, + L1_KHO_KHON, + L1_KHO_RAKHANG, + L1_NGO_NGU, + L1_CHO_CHAN, + L1_CHO_CHING, + L1_CHO_CHANG, + L1_SO_SO, + L1_CHO_CHOE, + L1_YO_YING, + L1_DO_CHADA, + L1_TO_PATAK, + L1_THO_THAN, + L1_THO_NANGMONTHO, + L1_THO_PHUTHAO, + L1_NO_NEN, + L1_DO_DEK, + L1_TO_TAO, + L1_THO_THUNG, + L1_THO_THAHAN, + L1_THO_THONG, + L1_NO_NU, + L1_BO_BAIMAI, + L1_PO_PLA, + L1_PHO_PHUNG, + L1_FO_FA, + L1_PHO_PHAN, + L1_FO_FAN, + L1_PHO_SAMPHAO, + L1_MO_MA, + L1_YO_YAK, + L1_RO_RUA, + L1_RU, + L1_LO_LING, + L1_LU, + L1_WO_WAEN, + L1_SO_SALA, + L1_SO_RUSI, + L1_SO_SUA, + L1_HO_HIP, + L1_LO_CHULA, + L1_O_ANG, + L1_HO_NOKHUK, + L1_NKHIT, + L1_SARA_A, + L1_MAI_HAN_AKAT, + L1_SARA_AA, + L1_SARA_AM, + L1_SARA_I, + L1_SARA_II, + L1_SARA_UE, + L1_SARA_UEE, + L1_SARA_U, + L1_SARA_UU, + L1_SARA_E, + L1_SARA_AE, + L1_SARA_O, + L1_SARA_AI_MAIMUAN, + L1_SARA_AI_MAIMALAI +}; + +/* level 2 symbols & order */ +enum l2_symbols { + L2_BLANK = TOT_LEVELS, + L2_THAII, + L2_YAMAK, + L2_PINTHU, + L2_GARAN, + L2_TYKHU, + L2_TONE1, + L2_TONE2, + L2_TONE3, + L2_TONE4 +}; + +/* level 3 symbols & order */ +enum l3_symbols { + L3_BLANK = TOT_LEVELS, + L3_SPACE, + L3_NB_SACE, + L3_LOW_LINE, + L3_HYPHEN, + L3_COMMA, + L3_SEMICOLON, + L3_COLON, + L3_EXCLAMATION, + L3_QUESTION, + L3_SOLIDUS, + L3_FULL_STOP, + L3_PAIYAN_NOI, + L3_MAI_YAMOK, + L3_GRAVE, + L3_CIRCUMFLEX, + L3_TILDE, + L3_APOSTROPHE, + L3_QUOTATION, + L3_L_PARANTHESIS, + L3_L_BRACKET, + L3_L_BRACE, + L3_R_BRACE, + L3_R_BRACKET, + L3_R_PARENTHESIS, + L3_AT, + L3_BAHT, + L3_DOLLAR, + L3_FONGMAN, + L3_ANGKHANKHU, + L3_KHOMUT, + L3_ASTERISK, + L3_BK_SOLIDUS, + L3_AMPERSAND, + L3_NUMBER, + L3_PERCENT, + L3_PLUS, + L3_LESS_THAN, + L3_EQUAL, + L3_GREATER_THAN, + L3_V_LINE +}; + +/* level 4 symbols & order */ +enum l4_symbols { + L4_BLANK = TOT_LEVELS, + L4_MIN, + L4_CAP, + L4_EXT +}; + +enum level_symbols { + L_UPRUPR = TOT_LEVELS, + L_UPPER, + L_MIDDLE, + L_LOWER +}; + +#define _is(c) (t_ctype[(c)][LAST_LEVEL]) +#define _level 8 +#define _consnt 16 +#define _ldvowel 32 +#define _fllwvowel 64 +#define _uprvowel 128 +#define _lwrvowel 256 +#define _tone 512 +#define _diacrt1 1024 +#define _diacrt2 2048 +#define _combine 4096 +#define _stone 8192 +#define _tdig 16384 +#define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel) +#define _diacrt (_diacrt1 | _diacrt2) +#define levelof(c) ( _is(c) & _level ) +#define isthai(c) ( (c) >= 128 ) +#define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\ + _tone|_diacrt1|_diacrt2) ) +#define isconsnt(c) ( _is(c) & _consnt ) +#define isldvowel(c) ( _is(c) & _ldvowel ) +#define isfllwvowel(c) ( _is(c) & _fllwvowel ) +#define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) ) +#define isuprvowel(c) ( _is(c) & _uprvowel ) +#define islwrvowel(c) ( _is(c) & _lwrvowel ) +#define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel)) +#define isrearvowel(c) ( _is(c) & _rearvowel ) +#define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) ) +#define istone(c) ( _is(c) & _tone ) +#define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) ) +#define iscombinable(c) ( _is(c) & _combine ) +#define istdigit(c) ( _is(c) & _tdig ) +#define isstone(c) ( _is(c) & _stone ) +#define isdiacrt1(c) ( _is(c) & _diacrt1) +#define isdiacrt2(c) ( _is(c) & _diacrt2) +#define isdiacrt(c) ( _is(c) & _diacrt) + +/* Function prototype called by sql/field.cc */ +void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length); + +#endif diff --git a/dlls/csx_sql/extra/include/mysql/thr_alarm.h b/dlls/csx_sql/extra/include/mysql/thr_alarm.h new file mode 100755 index 00000000..0dbb700b --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/thr_alarm.h @@ -0,0 +1,120 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Prototypes when using thr_alarm library functions */ + +#ifndef _thr_alarm_h +#define _thr_alarm_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef USE_ALARM_THREAD +#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ +#endif +#ifdef HAVE_LINUXTHREADS +#define THR_CLIENT_ALARM SIGALRM +#else +#define THR_CLIENT_ALARM SIGUSR1 +#endif +#ifdef HAVE_rts_threads +#undef USE_ONE_SIGNAL_HAND +#define USE_ALARM_THREAD +#define THR_SERVER_ALARM SIGUSR1 +#else +#define THR_SERVER_ALARM SIGALRM +#endif + +typedef struct st_alarm_info +{ + ulong next_alarm_time; + uint active_alarms; + uint max_used_alarms; +} ALARM_INFO; + +void thr_alarm_info(ALARM_INFO *info); + +#if defined(DONT_USE_THR_ALARM) || !defined(THREAD) + +#define USE_ALARM_THREAD +#undef USE_ONE_SIGNAL_HAND + +typedef my_bool thr_alarm_t; +typedef my_bool ALARM; + +#define thr_alarm_init(A) (*(A))=0 +#define thr_alarm_in_use(A) (*(A) != 0) +#define thr_end_alarm(A) +#define thr_alarm(A,B,C) ((*(A)=1)-1) +/* The following should maybe be (*(A)) */ +#define thr_got_alarm(A) 0 +#define init_thr_alarm(A) +#define thr_alarm_kill(A) +#define resize_thr_alarm(N) +#define end_thr_alarm() + +#else +#if defined(__WIN__) +typedef struct st_thr_alarm_entry +{ + rf_SetTimer crono; +} thr_alarm_entry; + +#elif defined(__EMX__) || defined(OS2) + +typedef struct st_thr_alarm_entry +{ + uint crono; + uint event; +} thr_alarm_entry; + +#else /* System with posix threads */ + +typedef int thr_alarm_entry; + +#define thr_got_alarm(thr_alarm) (**(thr_alarm)) + +#endif /* __WIN__ */ + +typedef thr_alarm_entry* thr_alarm_t; + +typedef struct st_alarm { + ulong expire_time; + thr_alarm_entry alarmed; /* set when alarm is due */ + pthread_t thread; + my_bool malloced; +} ALARM; + +#define thr_alarm_init(A) (*(A))=0 +#define thr_alarm_in_use(A) (*(A)!= 0) +void init_thr_alarm(uint max_alarm); +void resize_thr_alarm(uint max_alarms); +my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff); +void thr_alarm_kill(pthread_t thread_id); +void thr_end_alarm(thr_alarm_t *alarmed); +void end_thr_alarm(my_bool free_structures); +sig_handler process_alarm(int); +#ifndef thr_got_alarm +bool thr_got_alarm(thr_alarm_t *alrm); +#endif + + +#endif /* DONT_USE_THR_ALARM */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _thr_alarm_h */ diff --git a/dlls/csx_sql/extra/include/mysql/thr_lock.h b/dlls/csx_sql/extra/include/mysql/thr_lock.h new file mode 100755 index 00000000..f1bda0ce --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/thr_lock.h @@ -0,0 +1,117 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* For use with thr_lock:s */ + +#ifndef _thr_lock_h +#define _thr_lock_h +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +struct st_thr_lock; +extern ulong locks_immediate,locks_waited ; + +enum thr_lock_type { TL_IGNORE=-1, + TL_UNLOCK, /* UNLOCK ANY LOCK */ + TL_READ, /* Read lock */ + TL_READ_WITH_SHARED_LOCKS, + /* High prior. than TL_WRITE. Allow concurrent insert */ + TL_READ_HIGH_PRIORITY, + /* READ, Don't allow concurrent insert */ + TL_READ_NO_INSERT, + /* + Write lock, but allow other threads to read / write. + Used by BDB tables in MySQL to mark that someone is + reading/writing to the table. + */ + TL_WRITE_ALLOW_WRITE, + /* + Write lock, but allow other threads to read. + Used by ALTER TABLE in MySQL to allow readers + to use the table until ALTER TABLE is finished. + */ + TL_WRITE_ALLOW_READ, + /* + WRITE lock used by concurrent insert. Will allow + READ, if one could use concurrent insert on table. + */ + TL_WRITE_CONCURRENT_INSERT, + /* Write used by INSERT DELAYED. Allows READ locks */ + TL_WRITE_DELAYED, + /* WRITE lock that has lower priority than TL_READ */ + TL_WRITE_LOW_PRIORITY, + /* Normal WRITE lock */ + TL_WRITE, + /* Abort new lock request with an error */ + TL_WRITE_ONLY}; + +extern ulong max_write_lock_count; +extern my_bool thr_lock_inited; +extern enum thr_lock_type thr_upgraded_concurrent_insert_lock; + +typedef struct st_thr_lock_data { + pthread_t thread; + struct st_thr_lock_data *next,**prev; + struct st_thr_lock *lock; + pthread_cond_t *cond; + enum thr_lock_type type; + ulong thread_id; + void *status_param; /* Param to status functions */ +} THR_LOCK_DATA; + +struct st_lock_list { + THR_LOCK_DATA *data,**last; +}; + +typedef struct st_thr_lock { + LIST list; + pthread_mutex_t mutex; + struct st_lock_list read_wait; + struct st_lock_list read; + struct st_lock_list write_wait; + struct st_lock_list write; +/* write_lock_count is incremented for write locks and reset on read locks */ + ulong write_lock_count; + uint read_no_write_count; + void (*get_status)(void*); /* When one gets a lock */ + void (*copy_status)(void*,void*); + void (*update_status)(void*); /* Before release of write */ + my_bool (*check_status)(void *); +} THR_LOCK; + + +my_bool init_thr_lock(void); /* Must be called once/thread */ +void thr_lock_init(THR_LOCK *lock); +void thr_lock_delete(THR_LOCK *lock); +void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, + void *status_param); +int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type); +void thr_unlock(THR_LOCK_DATA *data); +int thr_multi_lock(THR_LOCK_DATA **data,uint count); +void thr_multi_unlock(THR_LOCK_DATA **data,uint count); +void thr_abort_locks(THR_LOCK *lock); +void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread); +void thr_print_locks(void); /* For debugging */ +my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data); +my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data); +#ifdef __cplusplus +} +#endif +#endif /* _thr_lock_h */ diff --git a/dlls/csx_sql/extra/include/mysql/violite.h b/dlls/csx_sql/extra/include/mysql/violite.h new file mode 100755 index 00000000..18f862d4 --- /dev/null +++ b/dlls/csx_sql/extra/include/mysql/violite.h @@ -0,0 +1,176 @@ +/* Copyright (C) 2000 MySQL AB + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Vio Lite. + * Purpose: include file for Vio that will work with C and C++ + */ + +#ifndef vio_violite_h_ +#define vio_violite_h_ + +#include "my_net.h" /* needed because of struct in_addr */ + + +/* Simple vio interface in C; The functions are implemented in violite.c */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, + VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL}; + +#ifndef __WIN__ +#define HANDLE void * +#endif + +Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost); +#ifdef __WIN__ +Vio* vio_new_win32pipe(HANDLE hPipe); +#endif +void vio_delete(Vio* vio); +int vio_close(Vio* vio); + +#ifdef EMBEDDED_LIBRARY +void vio_reset(Vio *vio); +#else +void vio_reset(Vio* vio, enum enum_vio_type type, + my_socket sd, HANDLE hPipe, my_bool localhost); +#endif + +int vio_read(Vio *vio, gptr buf, int size); +int vio_write(Vio *vio, const gptr buf, int size); +int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode); +my_bool vio_is_blocking(Vio *vio); +/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */ +int vio_fastsend(Vio *vio); +/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */ +int vio_keepalive(Vio *vio, my_bool onoff); +/* Whenever we should retry the last read/write operation. */ +my_bool vio_should_retry(Vio *vio); +/* Short text description of the socket for those, who are curious.. */ +const char* vio_description(Vio *vio); +/* Return the type of the connection */ +enum enum_vio_type vio_type(Vio* vio); +/* Return last error number */ +int vio_errno(Vio*vio); +/* Get socket number */ +my_socket vio_fd(Vio*vio); +/* Remote peer's address and name in text form */ +my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port); +/* Remotes in_addr */ +void vio_in_addr(Vio *vio, struct in_addr *in); +my_bool vio_poll_read(Vio *vio,uint timeout); +void vio_timeout(Vio *vio,uint timeout); + +#ifdef HAVE_OPENSSL +#define HEADER_DES_LOCL_H dummy_something +#include +#include + +struct st_VioSSLAcceptorFd +{ + SSL_CTX *ssl_context; + SSL_METHOD *ssl_method; + struct st_VioSSLAcceptorFd *session_id_context; +}; + +/* One copy for client */ +struct st_VioSSLConnectorFd +{ + SSL_CTX *ssl_context; + /* function pointers which are only once for SSL client */ + SSL_METHOD *ssl_method; +}; + +int sslaccept(struct st_VioSSLAcceptorFd*, Vio *, long timeout); +int sslconnect(struct st_VioSSLConnectorFd*, Vio *, long timeout); + +struct st_VioSSLConnectorFd +*new_VioSSLConnectorFd(const char *key_file, const char *cert_file, + const char *ca_file, const char *ca_path, + const char *cipher); +struct st_VioSSLAcceptorFd +*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, + const char *ca_file,const char *ca_path, + const char *cipher); +Vio *new_VioSSL(struct st_VioSSLAcceptorFd *fd, Vio *sd, int state); +#endif + +#ifdef __cplusplus +} +#endif + +#if defined(HAVE_VIO) && !defined(DONT_MAP_VIO) +#define vio_delete(vio) (vio)->viodelete(vio) +#define vio_errno(vio) (vio)->vioerrno(vio) +#define vio_read(vio, buf, size) (vio)->read(vio,buf,size) +#define vio_write(vio, buf, size) (vio)->write(vio, buf, size) +#define vio_blocking(vio, set_blocking_mode, old_mode)\ + (vio)->vioblocking(vio, set_blocking_mode, old_mode) +#define vio_is_blocking(vio) (vio)->is_blocking(vio) +#define vio_fastsend(vio) (vio)->fastsend(vio) +#define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive) +#define vio_should_retry(vio) (vio)->should_retry(vio) +#define vio_close(vio) ((vio)->vioclose)(vio) +#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt) +#define vio_in_addr(vio, in) (vio)->in_addr(vio, in) +#define vio_timeout(vio, seconds) (vio)->timeout(vio, seconds) +#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */ + +/* This enumerator is used in parser - should be always visible */ +enum SSL_type +{ + SSL_TYPE_NOT_SPECIFIED= -1, + SSL_TYPE_NONE, + SSL_TYPE_ANY, + SSL_TYPE_X509, + SSL_TYPE_SPECIFIED +}; + +#ifndef EMBEDDED_LIBRARY +/* This structure is for every connection on both sides */ +struct st_vio +{ + my_socket sd; /* my_socket - real or imaginary */ + HANDLE hPipe; + my_bool localhost; /* Are we from localhost? */ + int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */ + struct sockaddr_in local; /* Local internet address */ + struct sockaddr_in remote; /* Remote internet address */ + enum enum_vio_type type; /* Type of connection */ + char desc[30]; /* String description */ +#ifdef HAVE_VIO + /* function pointers. They are similar for socket/SSL/whatever */ + void (*viodelete)(Vio*); + int (*vioerrno)(Vio*); + int (*read)(Vio*, gptr, int); + int (*write)(Vio*, gptr, int); + int (*vioblocking)(Vio*, my_bool, my_bool *); + my_bool (*is_blocking)(Vio*); + int (*viokeepalive)(Vio*, my_bool); + int (*fastsend)(Vio*); + my_bool (*peer_addr)(Vio*, char *, uint16*); + void (*in_addr)(Vio*, struct in_addr*); + my_bool (*should_retry)(Vio*); + int (*vioclose)(Vio*); + void (*timeout)(Vio*, unsigned int timeout); + void *ssl_arg; +#endif /* HAVE_VIO */ +}; +#endif /* EMBEDDED_LIBRARY */ +#endif /* vio_violite_h_ */ diff --git a/dlls/csx_sql/extra/include/zlib.h b/dlls/csx_sql/extra/include/zlib.h new file mode 100755 index 00000000..52cb529f --- /dev/null +++ b/dlls/csx_sql/extra/include/zlib.h @@ -0,0 +1,893 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.1.4, March 11th, 2002 + + Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef _ZLIB_H +#define _ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.1.4" + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +/* Allowed flush values; see deflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 +/* Possible values of the data_type field */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + the compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + 0.1% larger than avail_in plus 12 bytes. If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may some + introduce some output latency (reading input without producing any output) + except when forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much + output as possible to the output buffer. The flushing behavior of inflate is + not specified for values of the flush parameter other than Z_SYNC_FLUSH + and Z_FINISH, but the current implementation actually flushes as much output + as possible anyway. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster routine + may be used for the single inflate() call. + + If a preset dictionary is needed at this point (see inflateSetDictionary + below), inflate sets strm-adler to the adler32 checksum of the + dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise + it sets strm->adler to the adler32 checksum of all output produced + so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or + an error code as described below. At the end of the stream, inflate() + checks that its computed adler32 checksum is equal to that saved by the + compressor and returns Z_STREAM_END only if the checksum is correct. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect + adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent + (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if no progress is possible or if there was not + enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR + case, the application may then call inflateSync to look for a good + compression block. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match). Filtered data consists mostly of small values with a + somewhat random distribution. In this case, the compression algorithm is + tuned to compress them better. The effect of Z_FILTERED is to force more + Huffman coding and less string matching; it is somewhat intermediate + between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects + the compression ratio but not the correctness of the compressed output even + if it is not set appropriately. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. + + Upon return of this function, strm->adler is set to the Adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. If a compressed stream with a larger window size is given as + input, inflate() will return with the error code Z_DATA_ERROR instead of + trying to allocate a larger window. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative + memLevel). msg is set to null if there is no error message. inflateInit2 + does not perform any decompression apart from reading the zlib header if + present: this will be done by inflate(). (So next_in and avail_in may be + modified, but next_out and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate + if this call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler32 value returned by this call of + inflate. The compressor and decompressor must use exactly the same + dictionary (see deflateSetDictionary). + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least 0.1% larger than + sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h". (See the description + of deflateInit2 for more information about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + const voidp buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); + +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running crc with the bytes buf[0..len-1] and return the updated + crc. If buf is NULL, this function returns the required initial value + for the crc. Pre- and post-conditioning (one's complement) is performed + within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int err)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* _ZLIB_H */ diff --git a/dlls/csx_sql/extra/lib_win32/mysqlclient.lib b/dlls/csx_sql/extra/lib_win32/mysqlclient.lib new file mode 100755 index 00000000..1ff9ce0f Binary files /dev/null and b/dlls/csx_sql/extra/lib_win32/mysqlclient.lib differ diff --git a/dlls/csx_sql/extra/lib_win32/zlib.lib b/dlls/csx_sql/extra/lib_win32/zlib.lib new file mode 100755 index 00000000..c39ef6d5 Binary files /dev/null and b/dlls/csx_sql/extra/lib_win32/zlib.lib differ diff --git a/dlls/csx_sql/meta_api.cpp b/dlls/csx_sql/meta_api.cpp new file mode 100755 index 00000000..20b74c1a --- /dev/null +++ b/dlls/csx_sql/meta_api.cpp @@ -0,0 +1,388 @@ +#include "amxxmodule.h" +#include "rank.h" + +funEventCall modMsgsEnd[MAX_REG_MSGS]; +funEventCall modMsgs[MAX_REG_MSGS]; + +void (*function)(void*); +void (*endfunction)(void*); + +CPlayer players[33]; + +CPlayer* mPlayer; + +int mPlayerIndex; +int mState; + +RankSystem g_rank; + +Grenades g_grenades; + +int iFGrenade; +int iFDeath; +int iFDamage; + +int iFBPlanted; +int iFBDefused; +int iFBPlanting; +int iFBDefusing; +int iFBExplode; + +int g_bombAnnounce; +int g_Planter; +int g_Defuser; + +bool rankBots; + +int gmsgCurWeapon; +int gmsgDeathMsg; +int gmsgDamage; +int gmsgDamageEnd; +int gmsgWeaponList; +int gmsgResetHUD; +int gmsgAmmoX; +int gmsgScoreInfo; +int gmsgAmmoPickup; + +int gmsgSendAudio; +int gmsgTextMsg; +int gmsgBarTime; + +int g_CurrentMsg; + +cvar_t init_csstats_maxsize ={"csstats_maxsize","3500", 0 , 3500.0 }; +cvar_t init_csstats_reset ={"csstats_reset","0"}; +cvar_t init_csstats_rank ={"csstats_rank","0"}; +cvar_t *csstats_maxsize; +cvar_t *csstats_reset; +cvar_t *csstats_rank; + +cvar_t* csstats_rankbots; +cvar_t* csstats_pause; +cvar_t init_csstats_rankbots ={"csstats_rankbots","1"}; +cvar_t init_csstats_pause = {"csstats_pause","0"}; + +struct sUserMsg { + const char* name; + int* id; + funEventCall func; + bool endmsg; +} g_user_msg[] = { + { "CurWeapon" , &gmsgCurWeapon , Client_CurWeapon, false }, + { "Damage" , &gmsgDamage,Client_Damage, false }, + { "Damage" , &gmsgDamageEnd, Client_Damage_End, true }, + { "WeaponList" , &gmsgWeaponList, Client_WeaponList, false }, + { "ResetHUD" , &gmsgResetHUD,Client_ResetHUD, true }, + { "AmmoX" , &gmsgAmmoX, Client_AmmoX , false }, + { "ScoreInfo" , &gmsgScoreInfo, Client_ScoreInfo, false }, + { "AmmoPickup" , &gmsgAmmoPickup, Client_AmmoPickup , false }, + + { "SendAudio" , &gmsgSendAudio , Client_SendAudio , false }, + { "TextMsg" , &gmsgTextMsg , Client_TextMsg , false }, + { "BarTime" , &gmsgBarTime , Client_BarTime , false }, + + { 0 , 0,0,false } +}; + +int RegUserMsg_Post(const char *pszName, int iSize) +{ + for (int i = 0; g_user_msg[ i ].name; ++i ) + { + if ( !*g_user_msg[i].id && strcmp( g_user_msg[ i ].name , pszName ) == 0 ) + { + int id = META_RESULT_ORIG_RET( int ); + + *g_user_msg[ i ].id = id; + + if ( g_user_msg[ i ].endmsg ) + modMsgsEnd[ id ] = g_user_msg[ i ].func; + else + modMsgs[ id ] = g_user_msg[ i ].func; + //break; + } + } + RETURN_META_VALUE(MRES_IGNORED, 0); +} + +const char* get_localinfo( const char* name , const char* def = 0 ) +{ + const char* b = LOCALINFO( (char*)name ); + if (((b==0)||(*b==0)) && def ) + SET_LOCALINFO((char*)name,(char*)(b = def) ); + return b; +} + +void ClientKill(edict_t *pEntity){ + CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); + if ( !pPlayer->IsAlive()) + RETURN_META(MRES_IGNORED); + + MF_ExecuteForward( iFDamage,pPlayer->index , pPlayer->index , 0, 0, 0, 0 ); + pPlayer->saveKill(pPlayer,0,0,0); + MF_ExecuteForward( iFDeath,pPlayer->index, pPlayer->index, 0, 0, 0 ); + + RETURN_META(MRES_IGNORED); +} + +void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){ + + rankBots = (int)csstats_rankbots->value ? true:false; + + for( int i = 1; i <= gpGlobals->maxClients; ++i) + GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i ); + RETURN_META(MRES_IGNORED); +} + +void PlayerPreThink_Post( edict_t *pEntity ) { + if ( !isModuleActive() ) + return; + + CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); + if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time ){ + + if ( !ignoreBots(pEntity) ){ + pPlayer->clearStats = 0.0f; + if (pPlayer->rank) + pPlayer->rank->updatePosition( &pPlayer->life ); + pPlayer->restartStats(false); + } + } + RETURN_META(MRES_IGNORED); +} + +void ServerDeactivate() { + int i; + for( i = 1;i<=gpGlobals->maxClients; ++i){ + CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); + if (pPlayer->rank) pPlayer->Disconnect(); + } + if ( (g_rank.getRankNum() >= (int)csstats_maxsize->value) || ((int)csstats_reset->value == 1 ) ) { + CVAR_SET_FLOAT("csstats_reset",0.0); + g_rank.clear(); // clear before save to file + } + g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("csstats")) ); + g_rank.saveRankSql(); + + + // clear custom weapons info + for ( i=MAX_WEAPONS;iConnect(pszAddress); + RETURN_META_VALUE(MRES_IGNORED, TRUE); +} + +void ClientDisconnect( edict_t *pEntity ) { + CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); + if (pPlayer->rank) pPlayer->Disconnect(); + RETURN_META(MRES_IGNORED); +} + +void ClientPutInServer_Post( edict_t *pEntity ) { + GET_PLAYER_POINTER(pEntity)->PutInServer(); + RETURN_META(MRES_IGNORED); +} + +void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) { + CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); + const char* name = INFOKEY_VALUE(infobuffer,"name"); + const char* oldname = STRING(pEntity->v.netname); + + if ( pPlayer->rank ){ + if ( strcmp(oldname,name) != 0 ) { + if ((int)csstats_rank->value == 0) + pPlayer->rank = g_rank.findEntryInRank( name, name ); + else + pPlayer->rank->setName( name ); + } + } + else if ( pPlayer->IsBot() ) { + pPlayer->Connect( "127.0.0.1" ); + pPlayer->PutInServer(); + } + RETURN_META(MRES_IGNORED); +} + +void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) { + if (ed){ + mPlayerIndex = ENTINDEX(ed); + mPlayer = GET_PLAYER_POINTER_I(mPlayerIndex); + } else { + mPlayerIndex = 0; + mPlayer = 0; + } + mState = 0; + g_CurrentMsg = msg_type; + if ( g_CurrentMsg < 0 || g_CurrentMsg >= MAX_REG_MSGS ) + g_CurrentMsg = 0; + function=modMsgs[g_CurrentMsg]; + endfunction=modMsgsEnd[g_CurrentMsg]; + RETURN_META(MRES_IGNORED); +} + +void MessageEnd_Post(void) { + if (endfunction) (*endfunction)(NULL); + RETURN_META(MRES_IGNORED); +} + +void WriteByte_Post(int iValue) { + if (function) (*function)((void *)&iValue); + RETURN_META(MRES_IGNORED); +} + +void WriteChar_Post(int iValue) { + if (function) (*function)((void *)&iValue); + RETURN_META(MRES_IGNORED); +} + +void WriteShort_Post(int iValue) { + if (function) (*function)((void *)&iValue); + RETURN_META(MRES_IGNORED); +} + +void WriteLong_Post(int iValue) { + if (function) (*function)((void *)&iValue); + RETURN_META(MRES_IGNORED); +} + +void WriteAngle_Post(float flValue) { + if (function) (*function)((void *)&flValue); + RETURN_META(MRES_IGNORED); +} + +void WriteCoord_Post(float flValue) { + if (function) (*function)((void *)&flValue); + RETURN_META(MRES_IGNORED); +} + +void WriteString_Post(const char *sz) { + if (function) (*function)((void *)sz); + RETURN_META(MRES_IGNORED); +} + +void WriteEntity_Post(int iValue) { + if (function) (*function)((void *)&iValue); + RETURN_META(MRES_IGNORED); +} + +void StartFrame_Post(){ + if (g_bombAnnounce){ + switch (g_bombAnnounce){ + case BOMB_PLANTING: + MF_ExecuteForward( iFBPlanting,g_Planter ); + break; + case BOMB_PLANTED: + MF_ExecuteForward( iFBPlanted,g_Planter ); + break; + case BOMB_EXPLODE: + MF_ExecuteForward( iFBExplode,g_Planter,g_Defuser ); + break; + case BOMB_DEFUSING: + MF_ExecuteForward( iFBDefusing,g_Defuser ); + break; + case BOMB_DEFUSED: + MF_ExecuteForward( iFBDefused,g_Defuser ); + break; + } + g_bombAnnounce = 0; + } + RETURN_META(MRES_IGNORED); +} + +void SetModel_Post(edict_t *e, const char *m){ + + if ( !isModuleActive() ) + return; + + if ( e->v.owner && m[7]=='w' && m[8]=='_' ){ + int w_id = 0; + CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner); + switch(m[9]){ + case 'h': + w_id = CSW_HEGRENADE; + g_grenades.put(e, 2.0, 4, pPlayer); + pPlayer->saveShot(CSW_HEGRENADE); + break; + case 'f': + if (m[10]=='l') w_id = CSW_FLASHBANG; + break; + case 's': + if (m[10]=='m') w_id = CSW_SMOKEGRENADE; + break; + } + if ( w_id ) + MF_ExecuteForward( iFGrenade, pPlayer->index, ENTINDEX(e) ,w_id ); + } + + RETURN_META(MRES_IGNORED); +} + +void EmitSound_Post(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch) { + if (sample[0]=='w'&&sample[1]=='e'&&sample[8]=='k'&&sample[9]=='n'&&sample[14]!='d'){ + CPlayer*pPlayer = GET_PLAYER_POINTER(entity); + pPlayer->saveShot(pPlayer->current); + } + RETURN_META(MRES_IGNORED); +} + +void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr) { + if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&& + e&&(e->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&&ptr->iHitgroup) + GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup; + RETURN_META(MRES_IGNORED); +} + +extern void OnMetaAttach_sql(); + +void OnMetaAttach() { + CVAR_REGISTER (&init_csstats_maxsize); + CVAR_REGISTER (&init_csstats_reset); + CVAR_REGISTER (&init_csstats_rank); + csstats_maxsize=CVAR_GET_POINTER(init_csstats_maxsize.name); + csstats_reset=CVAR_GET_POINTER(init_csstats_reset.name); + csstats_rank=CVAR_GET_POINTER(init_csstats_rank.name); + + CVAR_REGISTER (&init_csstats_rankbots); + CVAR_REGISTER (&init_csstats_pause); + csstats_rankbots = CVAR_GET_POINTER(init_csstats_rankbots.name); + csstats_pause = CVAR_GET_POINTER(init_csstats_pause.name); + + OnMetaAttach_sql(); +} + +void OnAmxxAttach(){ + MF_AddNatives(stats_Natives); + const char* path = get_localinfo("csstats_score"); + if ( path && *path ) + { + char error[128]; + g_rank.loadCalc( MF_BuildPathname("%s",path) , error ); + } + + if ( !g_rank.begin() ) + { + g_rank.loadRank( MF_BuildPathname("%s", + get_localinfo("csstats") ) ); + } +} + +void OnAmxxDetach() { + g_grenades.clear(); + g_rank.clear(); + g_rank.unloadCalc(); +} + +void OnPluginsLoaded(){ + iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE); + iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE); + iFBPlanted = MF_RegisterForward("bomb_planted",ET_IGNORE,FP_CELL,FP_DONE); + iFBDefused = MF_RegisterForward("bomb_defused",ET_IGNORE,FP_CELL,FP_DONE); + iFBPlanting = MF_RegisterForward("bomb_planting",ET_IGNORE,FP_CELL,FP_DONE); + iFBDefusing = MF_RegisterForward("bomb_defusing",ET_IGNORE,FP_CELL,FP_DONE); + iFBExplode = MF_RegisterForward("bomb_explode",ET_IGNORE,FP_CELL,FP_CELL,FP_DONE); + iFGrenade = MF_RegisterForward("grenade_throw",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE); +} diff --git a/dlls/csx_sql/moduleconfig.h b/dlls/csx_sql/moduleconfig.h new file mode 100755 index 00000000..873662d0 --- /dev/null +++ b/dlls/csx_sql/moduleconfig.h @@ -0,0 +1,462 @@ +// Configuration + +#ifndef __MODULECONFIG_H__ +#define __MODULECONFIG_H__ + +// Module info +#define MODULE_NAME "CSX" +#define MODULE_VERSION "1.00" +#define MODULE_AUTHOR "AMX Mod X Dev Team" +#define MODULE_URL "http://www.amxmodx.org/" +#define MODULE_LOGTAG "CSX" +// If you want the module not to be reloaded on mapchange, remove / comment out the next line +#define MODULE_RELOAD_ON_MAPCHANGE + +#ifdef __DATE__ +#define MODULE_DATE __DATE__ +#else // __DATE__ +#define MODULE_DATE "Unknown" +#endif // __DATE__ + +// metamod plugin? +#define USE_METAMOD + +// - AMXX Init functions +// Also consider using FN_META_* +// AMXX query +//#define FN_AMXX_QUERY OnAmxxQuery +// AMXX attach +// Do native functions init here (MF_AddNatives) +#define FN_AMXX_ATTACH OnAmxxAttach +// AMXX detach +#define FN_AMXX_DETACH OnAmxxDetach +// All plugins loaded +// Do forward functions init here (MF_RegisterForward) +#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/**** METAMOD ****/ +// If your module doesn't use metamod, you may close the file now :) +#ifdef USE_METAMOD +// ---- +// Hook Functions +// Uncomment these to be called +// You can also change the function name + +// - Metamod init functions +// Also consider using FN_AMXX_* +// Meta query +//#define FN_META_QUERY OnMetaQuery +// Meta attach +#define FN_META_ATTACH OnMetaAttach +// Meta detach +//#define FN_META_DETACH OnMetaDetach + +// (wd) are Will Day's notes +// - GetEntityAPI2 functions +// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */ +// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */ +// #define FN_DispatchThink DispatchThink /* pfnThink() */ +// #define FN_DispatchUse DispatchUse /* pfnUse() */ +// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */ +// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */ +// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */ +// #define FN_DispatchSave DispatchSave /* pfnSave() */ +// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */ +// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */ +// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */ +// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */ +// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */ +// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */ +// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */ +// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */ +#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */ +#define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */ +// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */ +// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */ +// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */ +// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */ +#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */ +// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */ +// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */ +// #define FN_StartFrame StartFrame /* pfnStartFrame() */ +// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */ +// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */ +// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */ +// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */ +// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */ +// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */ +// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */ +// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */ +// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */ +// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */ +// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */ +// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */ +// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */ +// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */ +// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */ +// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */ +// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */ +// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */ +// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */ +// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */ +// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */ +// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */ +// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */ +// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */ + +// - GetEntityAPI2_Post functions +// #define FN_GameDLLInit_Post GameDLLInit_Post +// #define FN_DispatchSpawn_Post DispatchSpawn_Post +// #define FN_DispatchThink_Post DispatchThink_Post +// #define FN_DispatchUse_Post DispatchUse_Post +// #define FN_DispatchTouch_Post DispatchTouch_Post +// #define FN_DispatchBlocked_Post DispatchBlocked_Post +// #define FN_DispatchKeyValue_Post DispatchKeyValue_Post +// #define FN_DispatchSave_Post DispatchSave_Post +// #define FN_DispatchRestore_Post DispatchRestore_Post +// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post +// #define FN_SaveWriteFields_Post SaveWriteFields_Post +// #define FN_SaveReadFields_Post SaveReadFields_Post +// #define FN_SaveGlobalState_Post SaveGlobalState_Post +// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post +// #define FN_ResetGlobalState_Post ResetGlobalState_Post +#define FN_ClientConnect_Post ClientConnect_Post +// #define FN_ClientDisconnect_Post ClientDisconnect_Post +// #define FN_ClientKill_Post ClientKill_Post +#define FN_ClientPutInServer_Post ClientPutInServer_Post +// #define FN_ClientCommand_Post ClientCommand_Post +#define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post +#define FN_ServerActivate_Post ServerActivate_Post +// #define FN_ServerDeactivate_Post ServerDeactivate_Post +#define FN_PlayerPreThink_Post PlayerPreThink_Post +// #define FN_PlayerPostThink_Post PlayerPostThink_Post +#define FN_StartFrame_Post StartFrame_Post +// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post +// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post +// #define FN_GetGameDescription_Post GetGameDescription_Post +// #define FN_PlayerCustomization_Post PlayerCustomization_Post +// #define FN_SpectatorConnect_Post SpectatorConnect_Post +// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post +// #define FN_SpectatorThink_Post SpectatorThink_Post +// #define FN_Sys_Error_Post Sys_Error_Post +// #define FN_PM_Move_Post PM_Move_Post +// #define FN_PM_Init_Post PM_Init_Post +// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post +// #define FN_SetupVisibility_Post SetupVisibility_Post +// #define FN_UpdateClientData_Post UpdateClientData_Post +// #define FN_AddToFullPack_Post AddToFullPack_Post +// #define FN_CreateBaseline_Post CreateBaseline_Post +// #define FN_RegisterEncoders_Post RegisterEncoders_Post +// #define FN_GetWeaponData_Post GetWeaponData_Post +// #define FN_CmdStart_Post CmdStart_Post +// #define FN_CmdEnd_Post CmdEnd_Post +// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post +// #define FN_GetHullBounds_Post GetHullBounds_Post +// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post +// #define FN_InconsistentFile_Post InconsistentFile_Post +// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post + +// - GetEngineAPI functions +// #define FN_PrecacheModel PrecacheModel +// #define FN_PrecacheSound PrecacheSound +// #define FN_SetModel SetModel +// #define FN_ModelIndex ModelIndex +// #define FN_ModelFrames ModelFrames +// #define FN_SetSize SetSize +// #define FN_ChangeLevel ChangeLevel +// #define FN_GetSpawnParms GetSpawnParms +// #define FN_SaveSpawnParms SaveSpawnParms +// #define FN_VecToYaw VecToYaw +// #define FN_VecToAngles VecToAngles +// #define FN_MoveToOrigin MoveToOrigin +// #define FN_ChangeYaw ChangeYaw +// #define FN_ChangePitch ChangePitch +// #define FN_FindEntityByString FindEntityByString +// #define FN_GetEntityIllum GetEntityIllum +// #define FN_FindEntityInSphere FindEntityInSphere +// #define FN_FindClientInPVS FindClientInPVS +// #define FN_EntitiesInPVS EntitiesInPVS +// #define FN_MakeVectors MakeVectors +// #define FN_AngleVectors AngleVectors +// #define FN_CreateEntity CreateEntity +// #define FN_RemoveEntity RemoveEntity +// #define FN_CreateNamedEntity CreateNamedEntity +// #define FN_MakeStatic MakeStatic +// #define FN_EntIsOnFloor EntIsOnFloor +// #define FN_DropToFloor DropToFloor +// #define FN_WalkMove WalkMove +// #define FN_SetOrigin SetOrigin +// #define FN_EmitSound EmitSound +// #define FN_EmitAmbientSound EmitAmbientSound +// #define FN_TraceLine TraceLine +// #define FN_TraceToss TraceToss +// #define FN_TraceMonsterHull TraceMonsterHull +// #define FN_TraceHull TraceHull +// #define FN_TraceModel TraceModel +// #define FN_TraceTexture TraceTexture +// #define FN_TraceSphere TraceSphere +// #define FN_GetAimVector GetAimVector +// #define FN_ServerCommand ServerCommand +// #define FN_ServerExecute ServerExecute +// #define FN_engClientCommand engClientCommand +// #define FN_ParticleEffect ParticleEffect +// #define FN_LightStyle LightStyle +// #define FN_DecalIndex DecalIndex +// #define FN_PointContents PointContents +// #define FN_MessageBegin MessageBegin +// #define FN_MessageEnd MessageEnd +// #define FN_WriteByte WriteByte +// #define FN_WriteChar WriteChar +// #define FN_WriteShort WriteShort +// #define FN_WriteLong WriteLong +// #define FN_WriteAngle WriteAngle +// #define FN_WriteCoord WriteCoord +// #define FN_WriteString WriteString +// #define FN_WriteEntity WriteEntity +// #define FN_CVarRegister CVarRegister +// #define FN_CVarGetFloat CVarGetFloat +// #define FN_CVarGetString CVarGetString +// #define FN_CVarSetFloat CVarSetFloat +// #define FN_CVarSetString CVarSetString +// #define FN_AlertMessage AlertMessage +// #define FN_EngineFprintf EngineFprintf +// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData +// #define FN_PvEntPrivateData PvEntPrivateData +// #define FN_FreeEntPrivateData FreeEntPrivateData +// #define FN_SzFromIndex SzFromIndex +// #define FN_AllocString AllocString +// #define FN_GetVarsOfEnt GetVarsOfEnt +// #define FN_PEntityOfEntOffset PEntityOfEntOffset +// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity +// #define FN_IndexOfEdict IndexOfEdict +// #define FN_PEntityOfEntIndex PEntityOfEntIndex +// #define FN_FindEntityByVars FindEntityByVars +// #define FN_GetModelPtr GetModelPtr +// #define FN_RegUserMsg RegUserMsg +// #define FN_AnimationAutomove AnimationAutomove +// #define FN_GetBonePosition GetBonePosition +// #define FN_FunctionFromName FunctionFromName +// #define FN_NameForFunction NameForFunction +// #define FN_ClientPrintf ClientPrintf +// #define FN_ServerPrint ServerPrint +// #define FN_Cmd_Args Cmd_Args +// #define FN_Cmd_Argv Cmd_Argv +// #define FN_Cmd_Argc Cmd_Argc +// #define FN_GetAttachment GetAttachment +// #define FN_CRC32_Init CRC32_Init +// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer +// #define FN_CRC32_ProcessByte CRC32_ProcessByte +// #define FN_CRC32_Final CRC32_Final +// #define FN_RandomLong RandomLong +// #define FN_RandomFloat RandomFloat +// #define FN_SetView SetView +// #define FN_Time Time +// #define FN_CrosshairAngle CrosshairAngle +// #define FN_LoadFileForMe LoadFileForMe +// #define FN_FreeFile FreeFile +// #define FN_EndSection EndSection +// #define FN_CompareFileTime CompareFileTime +// #define FN_GetGameDir GetGameDir +// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable +// #define FN_FadeClientVolume FadeClientVolume +// #define FN_SetClientMaxspeed SetClientMaxspeed +// #define FN_CreateFakeClient CreateFakeClient +// #define FN_RunPlayerMove RunPlayerMove +// #define FN_NumberOfEntities NumberOfEntities +// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer +// #define FN_InfoKeyValue InfoKeyValue +// #define FN_SetKeyValue SetKeyValue +// #define FN_SetClientKeyValue SetClientKeyValue +// #define FN_IsMapValid IsMapValid +// #define FN_StaticDecal StaticDecal +// #define FN_PrecacheGeneric PrecacheGeneric +// #define FN_GetPlayerUserId GetPlayerUserId +// #define FN_BuildSoundMsg BuildSoundMsg +// #define FN_IsDedicatedServer IsDedicatedServer +// #define FN_CVarGetPointer CVarGetPointer +// #define FN_GetPlayerWONId GetPlayerWONId +// #define FN_Info_RemoveKey Info_RemoveKey +// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue +// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue +// #define FN_GetPhysicsInfoString GetPhysicsInfoString +// #define FN_PrecacheEvent PrecacheEvent +// #define FN_PlaybackEvent PlaybackEvent +// #define FN_SetFatPVS SetFatPVS +// #define FN_SetFatPAS SetFatPAS +// #define FN_CheckVisibility CheckVisibility +// #define FN_DeltaSetField DeltaSetField +// #define FN_DeltaUnsetField DeltaUnsetField +// #define FN_DeltaAddEncoder DeltaAddEncoder +// #define FN_GetCurrentPlayer GetCurrentPlayer +// #define FN_CanSkipPlayer CanSkipPlayer +// #define FN_DeltaFindField DeltaFindField +// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex +// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex +// #define FN_SetGroupMask SetGroupMask +// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline +// #define FN_Cvar_DirectSet Cvar_DirectSet +// #define FN_ForceUnmodified ForceUnmodified +// #define FN_GetPlayerStats GetPlayerStats +// #define FN_AddServerCommand AddServerCommand +// #define FN_Voice_GetClientListening Voice_GetClientListening +// #define FN_Voice_SetClientListening Voice_SetClientListening +// #define FN_GetPlayerAuthId GetPlayerAuthId + +// - GetEngineAPI_Post functions +// #define FN_PrecacheModel_Post PrecacheModel_Post +// #define FN_PrecacheSound_Post PrecacheSound_Post +#define FN_SetModel_Post SetModel_Post +// #define FN_ModelIndex_Post ModelIndex_Post +// #define FN_ModelFrames_Post ModelFrames_Post +// #define FN_SetSize_Post SetSize_Post +// #define FN_ChangeLevel_Post ChangeLevel_Post +// #define FN_GetSpawnParms_Post GetSpawnParms_Post +// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post +// #define FN_VecToYaw_Post VecToYaw_Post +// #define FN_VecToAngles_Post VecToAngles_Post +// #define FN_MoveToOrigin_Post MoveToOrigin_Post +// #define FN_ChangeYaw_Post ChangeYaw_Post +// #define FN_ChangePitch_Post ChangePitch_Post +// #define FN_FindEntityByString_Post FindEntityByString_Post +// #define FN_GetEntityIllum_Post GetEntityIllum_Post +// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post +// #define FN_FindClientInPVS_Post FindClientInPVS_Post +// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post +// #define FN_MakeVectors_Post MakeVectors_Post +// #define FN_AngleVectors_Post AngleVectors_Post +// #define FN_CreateEntity_Post CreateEntity_Post +// #define FN_RemoveEntity_Post RemoveEntity_Post +// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post +// #define FN_MakeStatic_Post MakeStatic_Post +// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post +// #define FN_DropToFloor_Post DropToFloor_Post +// #define FN_WalkMove_Post WalkMove_Post +// #define FN_SetOrigin_Post SetOrigin_Post +#define FN_EmitSound_Post EmitSound_Post +// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post +#define FN_TraceLine_Post TraceLine_Post +// #define FN_TraceToss_Post TraceToss_Post +// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post +// #define FN_TraceHull_Post TraceHull_Post +// #define FN_TraceModel_Post TraceModel_Post +// #define FN_TraceTexture_Post TraceTexture_Post +// #define FN_TraceSphere_Post TraceSphere_Post +// #define FN_GetAimVector_Post GetAimVector_Post +// #define FN_ServerCommand_Post ServerCommand_Post +// #define FN_ServerExecute_Post ServerExecute_Post +// #define FN_engClientCommand_Post engClientCommand_Post +// #define FN_ParticleEffect_Post ParticleEffect_Post +// #define FN_LightStyle_Post LightStyle_Post +// #define FN_DecalIndex_Post DecalIndex_Post +// #define FN_PointContents_Post PointContents_Post +#define FN_MessageBegin_Post MessageBegin_Post +#define FN_MessageEnd_Post MessageEnd_Post +#define FN_WriteByte_Post WriteByte_Post +#define FN_WriteChar_Post WriteChar_Post +#define FN_WriteShort_Post WriteShort_Post +#define FN_WriteLong_Post WriteLong_Post +#define FN_WriteAngle_Post WriteAngle_Post +#define FN_WriteCoord_Post WriteCoord_Post +#define FN_WriteString_Post WriteString_Post +#define FN_WriteEntity_Post WriteEntity_Post +// #define FN_CVarRegister_Post CVarRegister_Post +// #define FN_CVarGetFloat_Post CVarGetFloat_Post +// #define FN_CVarGetString_Post CVarGetString_Post +// #define FN_CVarSetFloat_Post CVarSetFloat_Post +// #define FN_CVarSetString_Post CVarSetString_Post +// #define FN_AlertMessage_Post AlertMessage_Post +// #define FN_EngineFprintf_Post EngineFprintf_Post +// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post +// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post +// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post +// #define FN_SzFromIndex_Post SzFromIndex_Post +// #define FN_AllocString_Post AllocString_Post +// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post +// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post +// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post +// #define FN_IndexOfEdict_Post IndexOfEdict_Post +// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post +// #define FN_FindEntityByVars_Post FindEntityByVars_Post +// #define FN_GetModelPtr_Post GetModelPtr_Post +#define FN_RegUserMsg_Post RegUserMsg_Post +// #define FN_AnimationAutomove_Post AnimationAutomove_Post +// #define FN_GetBonePosition_Post GetBonePosition_Post +// #define FN_FunctionFromName_Post FunctionFromName_Post +// #define FN_NameForFunction_Post NameForFunction_Post +// #define FN_ClientPrintf_Post ClientPrintf_Post +// #define FN_ServerPrint_Post ServerPrint_Post +// #define FN_Cmd_Args_Post Cmd_Args_Post +// #define FN_Cmd_Argv_Post Cmd_Argv_Post +// #define FN_Cmd_Argc_Post Cmd_Argc_Post +// #define FN_GetAttachment_Post GetAttachment_Post +// #define FN_CRC32_Init_Post CRC32_Init_Post +// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post +// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post +// #define FN_CRC32_Final_Post CRC32_Final_Post +// #define FN_RandomLong_Post RandomLong_Post +// #define FN_RandomFloat_Post RandomFloat_Post +// #define FN_SetView_Post SetView_Post +// #define FN_Time_Post Time_Post +// #define FN_CrosshairAngle_Post CrosshairAngle_Post +// #define FN_LoadFileForMe_Post LoadFileForMe_Post +// #define FN_FreeFile_Post FreeFile_Post +// #define FN_EndSection_Post EndSection_Post +// #define FN_CompareFileTime_Post CompareFileTime_Post +// #define FN_GetGameDir_Post GetGameDir_Post +// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post +// #define FN_FadeClientVolume_Post FadeClientVolume_Post +// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post +// #define FN_CreateFakeClient_Post CreateFakeClient_Post +// #define FN_RunPlayerMove_Post RunPlayerMove_Post +// #define FN_NumberOfEntities_Post NumberOfEntities_Post +// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post +// #define FN_InfoKeyValue_Post InfoKeyValue_Post +// #define FN_SetKeyValue_Post SetKeyValue_Post +// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post +// #define FN_IsMapValid_Post IsMapValid_Post +// #define FN_StaticDecal_Post StaticDecal_Post +// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post +// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post +// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post +// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post +// #define FN_CVarGetPointer_Post CVarGetPointer_Post +// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post +// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post +// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post +// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post +// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post +// #define FN_PrecacheEvent_Post PrecacheEvent_Post +// #define FN_PlaybackEvent_Post PlaybackEvent_Post +// #define FN_SetFatPVS_Post SetFatPVS_Post +// #define FN_SetFatPAS_Post SetFatPAS_Post +// #define FN_CheckVisibility_Post CheckVisibility_Post +// #define FN_DeltaSetField_Post DeltaSetField_Post +// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post +// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post +// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post +// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post +// #define FN_DeltaFindField_Post DeltaFindField_Post +// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post +// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post +// #define FN_SetGroupMask_Post SetGroupMask_Post +// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post +// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post +// #define FN_ForceUnmodified_Post ForceUnmodified_Post +// #define FN_GetPlayerStats_Post GetPlayerStats_Post +// #define FN_AddServerCommand_Post AddServerCommand_Post +// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post +// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post +// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post + +// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData +// #define FN_GameShutdown GameShutdown +// #define FN_ShouldCollide ShouldCollide + +// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post +// #define FN_GameShutdown_Post GameShutdown_Post +// #define FN_ShouldCollide_Post ShouldCollide_Post + + +#endif // USE_METAMOD + +#endif // __MODULECONFIG_H__ \ No newline at end of file diff --git a/dlls/csx_sql/msvc/csx.sln b/dlls/csx_sql/msvc/csx.sln new file mode 100755 index 00000000..433753c0 --- /dev/null +++ b/dlls/csx_sql/msvc/csx.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csx", "csx.vcproj", "{1DC4A99A-F23F-4AAE-881C-79D157C91155}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Debug.ActiveCfg = Debug|Win32 + {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Debug.Build.0 = Debug|Win32 + {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.ActiveCfg = Release|Win32 + {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/dlls/csx_sql/msvc/csx.suo b/dlls/csx_sql/msvc/csx.suo new file mode 100755 index 00000000..a394b92a Binary files /dev/null and b/dlls/csx_sql/msvc/csx.suo differ diff --git a/dlls/csx_sql/msvc/csx.vcproj b/dlls/csx_sql/msvc/csx.vcproj new file mode 100755 index 00000000..9f4f1463 --- /dev/null +++ b/dlls/csx_sql/msvc/csx.vcproj @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dlls/csx_sql/rank.cpp b/dlls/csx_sql/rank.cpp new file mode 100755 index 00000000..61d6e735 --- /dev/null +++ b/dlls/csx_sql/rank.cpp @@ -0,0 +1,397 @@ + + +#include "amxxmodule.h" +#include "rank.h" + + +static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */ +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + int attacker = params[2]; + CHECK_PLAYERRANGE(attacker); + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (pPlayer->attackers[attacker].hits){ + cell *cpStats = MF_GetAmxAddr(amx,params[3]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]); + CPlayer::PlayerWeapon* stats = &pPlayer->attackers[attacker]; + cpStats[0] = stats->kills; + cpStats[1] = stats->deaths; + cpStats[2] = stats->hs; + cpStats[3] = stats->tks; + cpStats[4] = stats->shots; + cpStats[5] = stats->hits; + cpStats[6] = stats->damage; + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = stats->bodyHits[i]; + if (params[6] && attacker && stats->name ) + MF_SetAmxString(amx,params[5],stats->name,params[6]); + return 1; + } + return 0; +} + +static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */ +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + int victim = params[2]; + CHECK_PLAYERRANGE(victim); + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (pPlayer->victims[victim].hits){ + cell *cpStats = MF_GetAmxAddr(amx,params[3]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]); + CPlayer::PlayerWeapon* stats = &pPlayer->victims[victim]; + cpStats[0] = stats->kills; + cpStats[1] = stats->deaths; + cpStats[2] = stats->hs; + cpStats[3] = stats->tks; + cpStats[4] = stats->shots; + cpStats[5] = stats->hits; + cpStats[6] = stats->damage; + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = stats->bodyHits[i]; + if (params[6] && victim && stats->name) + MF_SetAmxString(amx,params[5],stats->name,params[6]); + return 1; + } + return 0; +} + +static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end) +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + int weapon = params[2]; + if (weapon<0||weapon>=MAX_WEAPONS+MAX_CWEAPONS){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon); + return 0; + } + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (pPlayer->weaponsRnd[weapon].shots){ + cell *cpStats = MF_GetAmxAddr(amx,params[3]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]); + Stats* stats = &pPlayer->weaponsRnd[weapon]; + cpStats[0] = stats->kills; + cpStats[1] = stats->deaths; + cpStats[2] = stats->hs; + cpStats[3] = stats->tks; + cpStats[4] = stats->shots; + cpStats[5] = stats->hits; + cpStats[6] = stats->damage; + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = stats->bodyHits[i]; + return 1; + } + return 0; +} + +static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */ +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + int weapon = params[2]; + if (weapon<0||weapon>=MAX_WEAPONS+MAX_CWEAPONS){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon); + return 0; + } + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (pPlayer->weapons[weapon].shots){ + cell *cpStats = MF_GetAmxAddr(amx,params[3]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]); + CPlayer::PlayerWeapon* stats = &pPlayer->weapons[weapon]; + cpStats[0] = stats->kills; + cpStats[1] = stats->deaths; + cpStats[2] = stats->hs; + cpStats[3] = stats->tks; + cpStats[4] = stats->shots; + cpStats[5] = stats->hits; + cpStats[6] = stats->damage; + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = stats->bodyHits[i]; + return 1; + } + return 0; +} + +static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */ +{ + int index = params[1]; + CHECK_PLAYER(index); + GET_PLAYER_POINTER_I(index)->restartStats(); + return 1; +} + +static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */ +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (pPlayer->rank){ + cell *cpStats = MF_GetAmxAddr(amx,params[2]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]); + cpStats[0] = pPlayer->life.kills; + cpStats[1] = pPlayer->life.deaths; + cpStats[2] = pPlayer->life.hs; + cpStats[3] = pPlayer->life.tks; + cpStats[4] = pPlayer->life.shots; + cpStats[5] = pPlayer->life.hits; + cpStats[6] = pPlayer->life.damage; + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = pPlayer->life.bodyHits[i]; + return 1; + } + return 0; +} + +static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */ +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if ( pPlayer->rank ){ + cell *cpStats = MF_GetAmxAddr(amx,params[2]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]); + cpStats[0] = pPlayer->rank->kills; + cpStats[1] = pPlayer->rank->deaths; + cpStats[2] = pPlayer->rank->hs; + cpStats[3] = pPlayer->rank->tks; + cpStats[4] = pPlayer->rank->shots; + cpStats[5] = pPlayer->rank->hits; + cpStats[6] = pPlayer->rank->damage; + + cpStats[7] = pPlayer->rank->getPosition(); + + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = pPlayer->rank->bodyHits[i]; + return pPlayer->rank->getPosition(); + } + return 0; + +} + +static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param */ +{ + int index = params[1]; + CHECK_PLAYERRANGE(index); + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if ( pPlayer->rank ){ + cell *cpStats = MF_GetAmxAddr(amx,params[2]); + + cpStats[0] = pPlayer->rank->bDefusions; + cpStats[1] = pPlayer->rank->bDefused; + cpStats[2] = pPlayer->rank->bPlants; + cpStats[3] = pPlayer->rank->bExplosions; + + return pPlayer->rank->getPosition(); + } + return 0; +} + +static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */ +{ + + int index = params[1] + 1; + + for(RankSystem::iterator a = g_rank.front(); a ;--a){ + if ((*a).getPosition() == index) { + cell *cpStats = MF_GetAmxAddr(amx,params[2]); + cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]); + cpStats[0] = (*a).kills; + cpStats[1] = (*a).deaths; + cpStats[2] = (*a).hs; + cpStats[3] = (*a).tks; + cpStats[4] = (*a).shots; + cpStats[5] = (*a).hits; + cpStats[6] = (*a).damage; + + cpStats[7] = (*a).getPosition(); + + MF_SetAmxString(amx,params[4],(*a).getName(),params[5]); + for(int i = 1; i < 8; ++i) + cpBodyHits[i] = (*a).bodyHits[i]; + return --a ? index : 0; + } + } + + return 0; +} + +static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 3 param */ +{ + + int index = params[1] + 1; + + for(RankSystem::iterator a = g_rank.front(); a ;--a){ + if ((*a).getPosition() == index) { + cell *cpStats = MF_GetAmxAddr(amx,params[2]); + + cpStats[0] = (*a).bDefusions; + cpStats[1] = (*a).bDefused; + cpStats[2] = (*a).bPlants; + cpStats[3] = (*a).bExplosions; + + return --a ? index : 0; + } + } + + return 0; +} + +static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params) +{ + return g_rank.getRankNum(); +} + +static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,melee=0,logname + int i,iLen; + for ( i=MAX_WEAPONS;i= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){ // only for custom weapons + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon); + return 0; + } + + int att = params[2]; + CHECK_PLAYERRANGE(att); + + int vic = params[3]; + CHECK_PLAYERRANGE(vic); + + int dmg = params[4]; + if ( dmg<1 ){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid damage %d", dmg); + return 0; + } + + int aim = params[5]; + if ( aim < 0 || aim > 7 ){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid aim %d", aim); + return 0; + } + + CPlayer* pAtt = GET_PLAYER_POINTER_I(att); + CPlayer* pVic = GET_PLAYER_POINTER_I(vic); + + pVic->pEdict->v.dmg_inflictor = NULL; + pAtt->saveHit( pVic , weapon , dmg, aim ); + + if ( !pAtt ) pAtt = pVic; + int TA = 0; + if ( (pVic->teamId == pAtt->teamId) && ( pVic != pAtt) ) + TA = 1; + MF_ExecuteForward( iFDamage,pAtt->index, pVic->index, dmg, weapon, aim, TA ); + + if ( pVic->IsAlive() ) + return 1; + + pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA); + MF_ExecuteForward( iFDeath,pAtt->index, pVic->index, weapon, aim, TA ); + + return 1; +} + +static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid + int index = params[2]; + CHECK_PLAYERRANGE(index); + + int weapon = params[1]; + if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon); + return 0; + } + + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + pPlayer->saveShot(weapon); + + return 1; +} + +static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){ + int id = params[1]; + if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id); + return 0; + } + return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]); +} + +static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){ + int id = params[1]; + if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id); + return 0; + } + return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]); +} + +static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){ + int id = params[1]; + if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id); + return 0; + } + if ( id == 29 ) + return 1; + return weaponData[id].melee ? 1:0; +} + +static cell AMX_NATIVE_CALL get_maxweapons(AMX *amx, cell *params){ + return MAX_WEAPONS+MAX_CWEAPONS; +} + +static cell AMX_NATIVE_CALL get_stats_size(AMX *amx, cell *params){ + return 8; +} + +AMX_NATIVE_INFO stats_Natives[] = { + { "get_stats", get_stats}, + { "get_stats2", get_stats2}, + { "get_statsnum", get_statsnum}, + { "get_user_astats", get_user_astats }, + { "get_user_rstats", get_user_rstats }, + { "get_user_lstats", get_user_rstats }, // for backward compatibility + { "get_user_stats", get_user_stats }, + { "get_user_stats2", get_user_stats2 }, + { "get_user_vstats", get_user_vstats }, + { "get_user_wrstats", get_user_wrstats}, // DEC-Weapon(Round) Stats + { "get_user_wstats", get_user_wstats}, + { "reset_user_wstats", reset_user_wstats }, + + // Custom Weapon Support + { "custom_weapon_add", register_cwpn }, + { "custom_weapon_dmg", custom_wpn_dmg }, + { "custom_weapon_shot", custom_wpn_shot }, + + { "xmod_get_wpnname", get_wpnname }, + { "xmod_get_wpnlogname", get_wpnlogname }, + { "xmod_is_melee_wpn", is_melee }, + { "xmod_get_maxweapons", get_maxweapons }, + { "xmod_get_stats_size", get_stats_size }, + + //*************************************** + //{ "get_weaponname", get_wpnname }, + + ///******************* + { NULL, NULL } +}; + diff --git a/dlls/csx_sql/rank.h b/dlls/csx_sql/rank.h new file mode 100755 index 00000000..62db6cf5 --- /dev/null +++ b/dlls/csx_sql/rank.h @@ -0,0 +1,152 @@ +#ifndef RANK_H +#define RANK_H + +#include "amxxmodule.h" +#include "CMisc.h" +#include "CRank.h" + +#define GET_PLAYER_POINTER(e) (&players[ENTINDEX(e)]) +#define GET_PLAYER_POINTER_I(i) (&players[i]) + +extern AMX_NATIVE_INFO stats_Natives[]; + +struct weaponsVault { + char name[32]; + char logname[16]; + short int ammoSlot; + bool used; + bool melee; +}; + +extern bool rankBots; +extern cvar_t* csstats_rankbots; +extern cvar_t* csstats_pause; + +extern int iFGrenade; +extern int iFDeath; +extern int iFDamage; + +extern int iFBPlanted; +extern int iFBDefused; +extern int iFBPlanting; +extern int iFBDefusing; +extern int iFBExplode; + +extern int g_bombAnnounce; +extern int g_Planter; +extern int g_Defuser; + +#define BOMB_PLANTING 1 +#define BOMB_PLANTED 2 +#define BOMB_EXPLODE 3 +#define BOMB_DEFUSING 4 +#define BOMB_DEFUSED 5 + +extern weaponsVault weaponData[MAX_WEAPONS+MAX_CWEAPONS]; + +typedef void (*funEventCall)(void*); +extern funEventCall modMsgsEnd[MAX_REG_MSGS]; +extern funEventCall modMsgs[MAX_REG_MSGS]; + +extern void (*function)(void*); +extern void (*endfunction)(void*); + +extern cvar_t *csstats_maxsize; +extern cvar_t* csstats_rank; +extern cvar_t* csstats_reset; + +extern Grenades g_grenades; + +extern RankSystem g_rank; + +extern CPlayer players[33]; + +extern CPlayer* mPlayer; + +extern int mPlayerIndex; + +extern int mState; + +extern int gmsgCurWeapon; +extern int gmsgDamageEnd; +extern int gmsgDamage; +extern int gmsgWeaponList; +extern int gmsgResetHUD; +extern int gmsgAmmoX; +extern int gmsgScoreInfo; +extern int gmsgAmmoPickup; + +extern int gmsgSendAudio; +extern int gmsgTextMsg; +extern int gmsgBarTime; + +void Client_AmmoX(void*); +void Client_CurWeapon(void*); +void Client_Damage(void*); +void Client_WeaponList(void*); +void Client_AmmoPickup(void*); +void Client_Damage_End(void*); +void Client_ScoreInfo(void*); +void Client_ResetHUD(void*); + +void Client_SendAudio(void*); +void Client_TextMsg(void*); +void Client_BarTime(void*); + +bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL ); +bool isModuleActive(); + +#define CHECK_ENTITY(x) \ + if (x < 0 || x > gpGlobals->maxEntities) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \ + return 0; \ + } else { \ + if (x <= gpGlobals->maxClients) { \ + if (!MF_IsPlayerIngame(x)) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \ + return 0; \ + } \ + } else { \ + if (x != 0 && FNullEnt(INDEXENT(x))) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \ + return 0; \ + } \ + } \ + } + +#define CHECK_PLAYER(x) \ + if (x < 1 || x > gpGlobals->maxClients) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \ + return 0; \ + } else { \ + if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \ + return 0; \ + } \ + } + +#define CHECK_PLAYERRANGE(x) \ + if (x > gpGlobals->maxClients || x < 0) \ + { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \ + return 0; \ + } + +#define CHECK_NONPLAYER(x) \ + if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \ + return 0; \ + } else { \ + if (FNullEnt(INDEXENT(x))) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \ + return 0; \ + } \ + } + +#define GETEDICT(n) \ + ((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n)) + +#endif // RANK_H + + + diff --git a/dlls/csx_sql/usermsg.cpp b/dlls/csx_sql/usermsg.cpp new file mode 100755 index 00000000..a8103ffb --- /dev/null +++ b/dlls/csx_sql/usermsg.cpp @@ -0,0 +1,217 @@ +#include "amxxmodule.h" +#include "rank.h" + +weaponsVault weaponData[MAX_WEAPONS+MAX_CWEAPONS]; + +int damage; +int TA; +int weapon; +int aim; +bool ignore; +CPlayer *pAttacker; + + +void Client_ResetHUD(void* mValue){ + if ( mPlayer ){ + mPlayer->clearStats = gpGlobals->time + 0.25f; + } +} + +void Client_WeaponList(void* mValue){ + static int wpnList; + static int iSlot; + static const char* wpnName; + + switch (mState++) { + case 0: + wpnName = (const char*)mValue; + break; + case 1: + iSlot = *(int*)mValue; + break; + case 7: + int iId = *(int*)mValue; + if ( (iId < 0 || iId >= MAX_WEAPONS ) || ( wpnList & (1<pEdict->v.dmg_inflictor; + + if ( FNullEnt( enemy ) ){ + ignore = true; + break; + } + + aim = 0; + weapon = 0; + pAttacker = NULL; + + if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) { + pAttacker = GET_PLAYER_POINTER(enemy); + aim = pAttacker->aiming; + weapon = pAttacker->current; + pAttacker->saveHit( mPlayer , weapon , damage, aim); + break; + } + if( g_grenades.find(enemy , &pAttacker , &weapon ) ) + pAttacker->saveHit( mPlayer , weapon , damage, aim ); + else if ( strcmp("grenade",STRING(enemy->v.classname))==0 ) // ? more checks ? + weapon = CSW_C4; + } +} + +void Client_Damage_End(void* mValue){ + if ( ignore ) + return; + + if ( !pAttacker ) pAttacker = mPlayer; + TA = 0; + if ( (mPlayer->teamId == pAttacker->teamId) && (mPlayer != pAttacker) ) + TA = 1; + + MF_ExecuteForward( iFDamage,pAttacker->index , mPlayer->index , damage, weapon, aim, TA ); + + if ( !mPlayer->IsAlive() ){ + if ( weapon != CSW_C4 ) + pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA); + MF_ExecuteForward( iFDeath,pAttacker->index, mPlayer->index, weapon, aim, TA ); + } +} + +void Client_CurWeapon(void* mValue){ + static int iState; + static int iId; + switch (mState++){ + case 0: + iState = *(int*)mValue; + break; + case 1: + if (!iState) break; + iId = *(int*)mValue; + break; + case 2: + if (!mPlayer || !iState ) break; + int iClip = *(int*)mValue; + if ((iClip > -1) && (iClip < mPlayer->weapons[iId].clip)) + mPlayer->saveShot(iId); + mPlayer->weapons[iId].clip = iClip; + mPlayer->current = iId; + } +} + +void Client_AmmoX(void* mValue){ + static int iAmmo; + switch (mState++){ + case 0: + iAmmo = *(int*)mValue; + break; + case 1: + if (!mPlayer ) break; + for(int i = 1; i < MAX_WEAPONS ; ++i) + if (iAmmo == weaponData[i].ammoSlot) + mPlayer->weapons[i].ammo = *(int*)mValue; + } +} + +void Client_AmmoPickup(void* mValue){ + static int iSlot; + switch (mState++){ + case 0: + iSlot = *(int*)mValue; + break; + case 1: + if (!mPlayer ) break; + for(int i = 1; i < MAX_WEAPONS ; ++i) + if (weaponData[i].ammoSlot == iSlot) + mPlayer->weapons[i].ammo += *(int*)mValue; + } +} + +void Client_ScoreInfo(void* mValue){ + static int index; + switch (mState++){ + case 0: + index = *(int*)mValue; + break; + case 4: + if ( index > 0 && index <= gpGlobals->maxClients ) + GET_PLAYER_POINTER_I( index )->teamId = *(int*)mValue; + } +} + +void Client_SendAudio(void* mValue){ + static const char* szText; + if ( mState == 1 ){ + szText = (const char*)mValue; + if ( !mPlayer && szText[7]=='B' ) { + if ( szText[11]=='P' && g_Planter ){ + GET_PLAYER_POINTER_I(g_Planter)->saveBPlant(); + g_bombAnnounce = BOMB_PLANTED; + } + else if ( szText[11]=='D' && g_Defuser ){ + GET_PLAYER_POINTER_I(g_Defuser)->saveBDefused(); + g_bombAnnounce = BOMB_DEFUSED; + } + + } + } + mState++; +} + +void Client_TextMsg(void* mValue){ + static const char* szText; + if ( !mPlayer && mState==1 ){ + szText = (const char*)mValue; + if ( szText[1]=='T' && szText[8]=='B' && g_Planter ){ + GET_PLAYER_POINTER_I(g_Planter)->saveBExplode(); + g_bombAnnounce = BOMB_EXPLODE; + } + } + mState++; +} + +void Client_BarTime(void* mValue){ + int iTime = *(int*)mValue; + if ( !iTime || !mPlayer->IsAlive() ) return; + if ( iTime == 3 ){ + g_Planter = mPlayerIndex; + g_bombAnnounce = BOMB_PLANTING; + g_Defuser = 0; + } + else { + mPlayer->saveBDefusing(); + g_Defuser = mPlayerIndex; + g_bombAnnounce = BOMB_DEFUSING; + } +} +