deleted outdated or unneeded dirs in dlls

This commit is contained in:
David Anderson 2006-07-12 18:25:41 +00:00
parent 0eca298c2a
commit 43b8ea4657
126 changed files with 0 additions and 50743 deletions

View File

@ -1,62 +0,0 @@
#if defined _csstats_included
#endinput
#endif
#define _csstats_included
/* Gets stats from given weapon index. If wpnindex is 0
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* For body hits fields see amxconst.inc. */
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets round stats from given weapon index.*/
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[8],bodyhits[8]);
/* Gets round stats of player. */
native get_user_rstats(index,stats[8],bodyhits[8]);
/* Gets stats with which user have killed/hurt his victim. If victim is 0
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Gets stats with which user have been killed/hurt. If killer is 0
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Resets life, weapon, victims and attackers user stats. */
native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[8],bodyhits[8],name[],len);
/* Returns number of all entries in stats. */
native get_statsnum();
/*
* new stats:
* 0 - total defusions
* 1 - bomb defused
* 2 - bomb plants
* 3 - bomb explosions
*/
native get_user_stats2(index,stats[4]);
native get_stats2(index,stats[4]);

View File

@ -1,256 +0,0 @@
#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 ) {
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 ){
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++;
}
// *****************************************************
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;
}

View File

@ -1,91 +0,0 @@
#ifndef CMISC_H
#define CMISC_H
#include "amxxmodule.h"
#include "CRank.h"
#define CSW_HEGRENADE 4
#define CSW_SMOKEGRENADE 9
#define CSW_FLASHBANG 25
// *****************************************************
// class CPlayer
// *****************************************************
struct CPlayer {
edict_t* pEdict;
char ip[32];
int index;
int aiming;
int current;
float clearStats;
RankSystem::RankStats* rank;
struct PlayerWeapon : Stats {
const char* name;
int ammo;
int clip;
};
PlayerWeapon weapons[MAX_WEAPONS];
PlayerWeapon attackers[33];
PlayerWeapon victims[33];
Stats weaponsRnd[MAX_WEAPONS]; // 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();
};
#endif // CMISC_H

View File

@ -1,308 +0,0 @@
#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);
}

View File

@ -1,122 +0,0 @@
#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 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

View File

@ -1,102 +0,0 @@
MODNAME = csstats_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)

View File

@ -1,178 +0,0 @@
#!/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 = "csstats_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`;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
@echo off
PATH=C:\gcc\bin;%PATH%
make
pause

View File

@ -1,308 +0,0 @@
#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;
bool rankBots;
int gmsgCurWeapon;
int gmsgDeathMsg;
int gmsgDamage;
int gmsgWeaponList;
int gmsgResetHUD;
int gmsgAmmoX;
int gmsgScoreInfo;
int gmsgAmmoPickup;
int gmsgSendAudio;
int gmsgTextMsg;
int gmsgBarTime;
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 },
{ "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 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")) );
RETURN_META(MRES_IGNORED);
}
BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
GET_PLAYER_POINTER(pEntity)->Connect(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;
if ( msg_type < 0 || msg_type >= MAX_REG_MSGS )
msg_type = 0;
function=modMsgs[msg_type];
endfunction=modMsgsEnd[msg_type];
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 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':
g_grenades.put(e, 1.75, CSW_HEGRENADE, pPlayer);
pPlayer->saveShot(CSW_HEGRENADE);
break;
}
}
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);
}
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);
}
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();
}

View File

@ -1,462 +0,0 @@
// Configuration
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
// Module info
#define MODULE_NAME "CSStats"
#define MODULE_VERSION "0.20"
#define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "CSSTATS"
// 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 dettach
#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 dettach
//#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__

View File

@ -1,149 +0,0 @@
# Microsoft Developer Studio Project File - Name="csstats" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=csstats - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "csstats.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "csstats.mak" CFG="csstats - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "csstats - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "csstats - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "csstats - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "release"
# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csstats_EXPORTS" /YX /FD /c
# ADD CPP /nologo /Zp4 /MT /W3 /GX /O2 /I "..\..\metamod" /I "..\..\sdk\common" /I "..\..\sdk\engine" /I "..\..\sdk\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csstats_EXPORTS" /D "JIT" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"release/csstats_amxx.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "csstats - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "debug"
# PROP Intermediate_Dir "debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csstats_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\metamod" /I "..\..\sdk\common" /I "..\..\sdk\engine" /I "..\..\sdk\dlls" /I "..\..\hlsdk\sourcecode\pm_shared" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csstats_EXPORTS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"debug/csstats_amxx.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "csstats - Win32 Release"
# Name "csstats - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\amxxmodule.cpp
# End Source File
# Begin Source File
SOURCE=..\CMisc.cpp
# End Source File
# Begin Source File
SOURCE=..\CRank.cpp
# End Source File
# Begin Source File
SOURCE=..\meta_api.cpp
# End Source File
# Begin Source File
SOURCE=..\rank.cpp
# End Source File
# Begin Source File
SOURCE=..\usermsg.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\amxxmodule.h
# End Source File
# Begin Source File
SOURCE=..\CMisc.h
# End Source File
# Begin Source File
SOURCE=..\CRank.h
# End Source File
# Begin Source File
SOURCE=..\moduleconfig.h
# End Source File
# Begin Source File
SOURCE=..\rank.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,311 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="csstats"
ProjectGUID="{0EEE36AA-5899-48EF-8BBD-DAA65D6F5D35}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\debug"
IntermediateDirectory=".\debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csstats_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\debug/csstats.pch"
AssemblerListingLocation=".\debug/"
ObjectFile=".\debug/"
ProgramDataBaseFileName=".\debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="debug/csstats_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/csstats_amxx.pdb"
ImportLibrary=".\debug/csstats_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/csstats.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\release"
IntermediateDirectory=".\release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csstats_EXPORTS;JIT"
StringPooling="TRUE"
RuntimeLibrary="0"
StructMemberAlignment="3"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\release/csstats.pch"
AssemblerListingLocation=".\release/"
ObjectFile=".\release/"
ProgramDataBaseFileName=".\release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="release/csstats_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\release/csstats_amxx.pdb"
ImportLibrary=".\release/csstats_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/csstats.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\amxxmodule.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CMisc.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CRank.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\meta_api.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\rank.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\usermsg.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csstats_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\amxxmodule.h">
</File>
<File
RelativePath="..\CMisc.h">
</File>
<File
RelativePath="..\CRank.h">
</File>
<File
RelativePath="..\moduleconfig.h">
</File>
<File
RelativePath="..\rank.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,293 +0,0 @@
#include "amxxmodule.h"
#include "rank.h"
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
{
int index = params[1];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int attacker = params[2];
if (attacker<0||attacker>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int victim = params[2];
if (victim<0||victim>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int weapon = params[2];
if (weapon<0||weapon>=MAX_WEAPONS){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int weapon = params[2];
if (weapon<0||weapon>=MAX_WEAPONS){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
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];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
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();
}
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 },
///*******************
{ NULL, NULL }
};

View File

@ -1,84 +0,0 @@
#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])
#ifndef GETPLAYERAUTHID
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
#endif
extern AMX_NATIVE_INFO stats_Natives[];
struct weaponsVault {
char* name;
short int ammoSlot;
};
extern bool rankBots;
extern cvar_t* csstats_rankbots;
extern cvar_t* csstats_pause;
extern weaponsVault weaponData[MAX_WEAPONS];
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 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_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();
#endif // RANK_H

View File

@ -1,195 +0,0 @@
#include "amxxmodule.h"
#include "rank.h"
weaponsVault weaponData[MAX_WEAPONS];
int g_Planter;
int g_Defuser;
void Client_ResetHUD(void* mValue){
if ( mPlayer && mPlayer->IsAlive() )
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<<iId) ) )
break;
wpnList |= (1<<iId);
weaponData[iId].ammoSlot = iSlot;
char* wpnPrefix = strstr( wpnName,"weapon_");
if ( wpnPrefix )
{
weaponData[iId].name = wpnPrefix + 7;
if ( strcmp( weaponData[iId].name, "hegrenade" ) == 0 )
weaponData[iId].name += 2;
}
}
}
void Client_Damage(void* mValue){
static int bits;
static int damage;
static int TK;
static int weapon;
static int aim;
static bool ignore;
static CPlayer *pAttacker;
switch (mState++) {
case 1:
damage = *(int*)mValue;
break;
case 2:
bits = *(int*)mValue;
break;
case 3:
if ( ignore = (!mPlayer || !damage || !*(float*)mValue || bits) ) break;
edict_t *enemy;
enemy = mPlayer->pEdict->v.dmg_inflictor;
if ( FNullEnt( enemy ) )
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 );
break;
case 4:
if ( ignore || mPlayer->IsAlive() )
break;
if ( !pAttacker )
pAttacker = mPlayer;
TK = 0;
if ( (mPlayer->teamId == pAttacker->teamId) && (mPlayer != pAttacker) )
TK = 1;
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TK);
break;
}
}
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();
else if ( szText[11]=='D' && g_Defuser )
GET_PLAYER_POINTER_I(g_Defuser)->saveBDefused();
}
}
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();
}
mState++;
}
void Client_BarTime(void* mValue){
int iTime = *(int*)mValue;
if ( !iTime || !mPlayer->IsAlive() ) return;
if ( iTime == 3 ){
g_Planter = mPlayerIndex;
g_Defuser = 0;
}
else {
mPlayer->saveBDefusing();
g_Defuser = mPlayerIndex;
}
}

View File

@ -1,300 +0,0 @@
#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;
}

View File

@ -1,116 +0,0 @@
#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

View File

@ -1,306 +0,0 @@
#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);
}

View File

@ -1,123 +0,0 @@
#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(); // JGHG added this one
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

View File

@ -1,234 +0,0 @@
// 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 <winsock.h>
#endif
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
#include <time.h>
#define MYSQL_QUERY_IS_A_OKAY 0
cvar_t init_csx_sqlstats_host = {"csx_sqlstats_host", "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 init_csx_sqlstats_exportstats = {"csx_sqlstats_exportstats", "0", 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;
cvar_t *csx_sqlstats_exportstats;
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);
CVAR_REGISTER(&init_csx_sqlstats_exportstats);
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);
csx_sqlstats_exportstats = CVAR_GET_POINTER(init_csx_sqlstats_exportstats.name);
}
int Error(MYSQL *mysql)
{
if (mysql == NULL)
return 0;
return mysql_errno(mysql);
}
void RankSystem::saveRankSql()
{
// Don't do anything if cvar says so.
if (csx_sqlstats_exportstats->value == 0.0)
return;
MF_PrintSrvConsole("[CSX Sql] Exporting players' statistics to SQL db...");
clock_t startTime = clock();
MYSQL *mysql = NULL;
mysql = mysql_init(NULL);
/* Attempt to get a port */
int port = 0;
char *p = strchr(csx_sqlstats_host->string, ':');
if (p)
port = atoi(p+1);
/*************************/
//MF_PrintSrvConsole("Host: %s (%d) Port: %d", host, strcspn(csx_sqlstats_host->string, ":"), port);
int 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[2048];
snprintf(query, 2047, "CREATE TABLE IF NOT EXISTS `%s` (`timestamp` int(11) NOT NULL default '0', `stats_authid` varchar(100) NOT NULL default '', `stats_name` varchar(100) NOT NULL default '', `stats_tks` int(11) NOT NULL default '0', `stats_damage` int(11) NOT NULL default '0', `stats_deaths` int(11) NOT NULL default '0', `stats_frags` int(11) NOT NULL default '0', `stats_shots` int(11) NOT NULL default '0', `stats_hits` int(11) NOT NULL default '0', `stats_hs` int(11) NOT NULL default '0', `stats_defusions` int(11) NOT NULL default '0', `stats_defused` int(11) NOT NULL default '0', `stats_plants` int(11) NOT NULL default '0', `stats_explosions` int(11) NOT NULL default '0', `stats_bodyhits0` int(11) NOT NULL default '0', `stats_bodyhits1` int(11) NOT NULL default '0', `stats_bodyhits2` int(11) NOT NULL default '0', `stats_bodyhits3` int(11) NOT NULL default '0', `stats_bodyhits4` int(11) NOT NULL default '0', `stats_bodyhits5` int(11) NOT NULL default '0', `stats_bodyhits6` int(11) NOT NULL default '0', `stats_bodyhits7` int(11) NOT NULL default '0', `stats_bodyhits8` int(11) NOT NULL default '0', `stats_score` int(11) NOT NULL default '0') TYPE=MyISAM",
csx_sqlstats_table->string);
int queryResult = mysql_query(mysql, query);
if (queryResult != MYSQL_QUERY_IS_A_OKAY)
{
error = Error(mysql);
MF_Log("DB Query Create Table If Not Exists failed (%d): %s", error, mysql_error(mysql));
mysql_close(mysql);
return;
}
int exportedRecords = 0;
RankSystem::iterator a = front();
char *authid, *name;
int tks, damage, deaths, kills, shots, hits, hs, defusions, defused, plants, explosions, *bodyHits, score;
time_t now = time(NULL);
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);
score = (*a).score;
snprintf(query, 2047, "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\", `stats_score` = \"%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],
score,
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, 2047, "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`, `stats_score`) VALUES (\"%d\", \"%s\", \"%s\", \"%d\", \"%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],
score
);
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);
}

View File

@ -1,404 +0,0 @@
/* 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<cSize; i++)
{
if (v[i] == c)
{
return i;
}
}
return npos;
}
bool is_space(int c)
{
if (c == '\f' || c == '\n' ||
c == '\t' || c == '\r' ||
c == '\v' || c == ' ')
{
return true;
}
return false;
}
void trim()
{
if (!v)
return;
unsigned int i = 0;
unsigned int j = 0;
if (cSize == 1)
{
if (is_space(v[i]))
{
clear();
return;
}
}
unsigned char c0 = v[0];
if (is_space(c0))
{
for (i=0; i<cSize; i++)
{
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==cSize-1)))
{
erase(0, i);
break;
}
}
}
cSize = strlen(v);
if (cSize < 1)
{
return;
}
if (is_space(v[cSize-1]))
{
for (i=cSize-1; 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<cSize; i++)
{
if (i>=start && i<start+num)
{
if (i+num < cSize)
{
v[i] = v[i+num];
} else {
v[i] = 0;
}
copyflag = true;
} else if (copyflag) {
if (i+num < cSize)
{
v[i] = v[i+num];
} else {
v[i] = 0;
}
}
}
cSize -= num;
v[cSize] = 0;
return (*this);
}
String substr(unsigned int index, int num = npos)
{
String ns;
if (index >= 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<index+num; i++)
{
s[j++] = v[i];
}
s[j] = 0;
ns.assign(s);
delete [] s;
return ns;
}
void toLower()
{
if (!v)
return;
unsigned int i = 0;
for (i=0; i<cSize; i++)
{
if (v[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

View File

@ -1,448 +0,0 @@
/* 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 <assert.h>
// Vector
template <class T> 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)
{
for (size_t i=0; i<m_CurrentUsedSize; i++)
newData[i] = m_Data[i];
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)
{
size_t end = (m_Size < size) ? (m_Size) : size;
for (size_t i=0; i<end; i++)
newData[i] = m_Data[i];
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<T>()
{
m_Size = 0;
m_CurrentUsedSize = 0;
m_Data = NULL;
}
CVector<T>(const CVector<T> & other)
{
// copy data
m_Data = new T [other.m_CurrentUsedSize];
m_Size = other.m_CurrentUsedSize;
m_CurrentUsedSize = other.m_CurrentUsedSize;
for (size_t i=0; i<other.m_CurrentUsedSize; i++)
m_Data[i] = other.m_Data[i];
}
~CVector<T>()
{
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__

View File

@ -1,102 +0,0 @@
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)

View File

@ -1,178 +0,0 @@
#!/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`;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
@echo off
PATH=D:\gcc\bin;%PATH%
make
pause

View File

@ -1,85 +0,0 @@
/* 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 <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <screen.h>
#include <limits.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <pthread.h>
#include <termios.h>
/* 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; }

View File

@ -1,832 +0,0 @@
/* 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 <os2.h>
#include <math.h>
#include <io.h>
#include <types.h>
/* 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 <alloca.h> 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 <sys/wait.h> 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 <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to `unsigned' if <sys/types.h> 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 <sys/stat.h> 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 <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define if your <sys/time.h> 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 <asm/atomic.h> (Linux only) */
/* #undef HAVE_ATOMIC_ADD */
/* atomic_sub() from <asm/atomic.h> (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 <alloca.h> header file. */
/* #define HAVE_ALLOCA_H 1 */
/* Define if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define if you have the <asm/termbits.h> header file. */
/* #undef HAVE_ASM_TERMBITS_H */
/* Define if you have the <crypt.h> header file. */
#define HAVE_CRYPT_H 1
/* Define if you have the <curses.h> header file. */
/* #define HAVE_CURSES_H 1 */
/* Define if you have the <dirent.h> header file. */
/* #define HAVE_DIRENT_H 1 */
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define if you have the <floatingpoint.h> header file. */
/* #undef HAVE_FLOATINGPOINT_H */
/* Define if you have the <grp.h> header file. */
/* #define HAVE_GRP_H 1 */
/* Define if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define if you have the <paths.h> header file. */
/* #undef HAVE_PATHS_H */
/* Define if you have the <pwd.h> header file. */
/* #define HAVE_PWD_H 1 */
/* Define if you have the <sched.h> header file. */
/* #undef HAVE_SCHED_H */
/* Define if you have the <select.h> header file. */
/* #undef HAVE_SELECT_H */
/* Define if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <strings.h> header file. */
/* #define HAVE_STRINGS_H 1 */
/* Define if you have the <synch.h> header file. */
/* #undef HAVE_SYNCH_H */
/* Define if you have the <sys/dir.h> header file. */
/* #define HAVE_SYS_DIR_H 1 */
/* Define if you have the <sys/file.h> header file. */
/* #define HAVE_SYS_FILE_H 1 */
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/mman.h> header file. */
/* #undef HAVE_SYS_MMAN_H */
/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/pte.h> header file. */
/* #undef HAVE_SYS_PTE_H */
/* Define if you have the <sys/ptem.h> header file. */
/* #undef HAVE_SYS_PTEM_H */
/* Define if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the <sys/stream.h> header file. */
/* #undef HAVE_SYS_STREAM_H */
/* Define if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define if you have the <sys/utime.h> header file. */
#define HAVE_SYS_UTIME_H 1
/* Define if you have the <sys/vadvise.h> header file. */
/* #undef HAVE_SYS_VADVISE_H */
/* Define if you have the <sys/wait.h> header file. */
/* #define HAVE_SYS_WAIT_H 1 */
/* Define if you have the <term.h> header file. */
/* #undef HAVE_TERM_H */
/* Define if you have the <termbits.h> header file. */
/* #undef HAVE_TERMBITS_H */
/* Define if you have the <termcap.h> header file. */
/* #define HAVE_TERMCAP_H 1 */
/* Define if you have the <termio.h> header file. */
/* /#define HAVE_TERMIO_H 1 */
/* Define if you have the <termios.h> header file. */
/* #define HAVE_TERMIOS_H 1 */
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define if you have the <varargs.h> 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__ */

View File

@ -1,335 +0,0 @@
/* 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 <sys/locking.h>
#include <windows.h>
#include <math.h> /* Because of rint() */
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
#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 <A>
#define my_const_cast(A) const_cast<A>
/* MYSQL OPTIONS */
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#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))

View File

@ -1,93 +0,0 @@
/* 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

View File

@ -1,66 +0,0 @@
/* 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

View File

@ -1,67 +0,0 @@
/* 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

View File

@ -1,66 +0,0 @@
/* 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

View File

@ -1,185 +0,0 @@
/* 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 <my_base.h>
#endif
#ifdef THREAD
#include <my_pthread.h>
#include <thr_lock.h>
#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

View File

@ -1,172 +0,0 @@
/* 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 */

View File

@ -1,254 +0,0 @@
/* 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 <strings.h>
#endif
#if defined(HAVE_STRING_H)
#include <string.h>
#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 <strings.h>
#endif
/* This is needed for the definitions of memcpy... on solaris */
#if defined(HAVE_MEMORY_H) && !defined(__cplusplus)
#include <memory.h>
#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 <assert.h>
#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

View File

@ -1,93 +0,0 @@
/* 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

View File

@ -1,93 +0,0 @@
/* 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 <my_base.h>
#endif
#ifndef _nisam_h
#include <nisam.h>
#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

View File

@ -1,66 +0,0 @@
/* 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

View File

@ -1,59 +0,0 @@
/* 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 <signal.h>
#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

View File

@ -1,52 +0,0 @@
/* 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

View File

@ -1,342 +0,0 @@
/* 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 <my_global.h>
#include <my_dir.h> /* This includes types */
#include <my_sys.h>
#include <m_string.h>
#include <errno.h>
#ifdef MSDOS
#include <share.h> /* Neaded for sopen() */
#endif
#if !defined(USE_MY_FUNC) && !defined(THREAD)
#include <my_nosys.h> /* For faster code, after test */
#endif /* USE_MY_FUNC */
#endif /* stdin */
#include <my_list.h>
/* 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 */

View File

@ -1,55 +0,0 @@
/* 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 <my_pthread.h>
#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_ */

View File

@ -1,882 +0,0 @@
/* 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 <asm/atomic.h> (Linux only) */
#define HAVE_ATOMIC_ADD 1
/* atomic_sub() from <asm/atomic.h> (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 <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <asm/termbits.h> 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 <crypt.h> header file. */
#define HAVE_CRYPT_H 1
/* Define to 1 if you have the <curses.h> 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 <dirent.h> 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 <dlfcn.h> 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 <fcntl.h> 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 <floatingpoint.h> header file. */
/* #undef HAVE_FLOATINGPOINT_H */
/* Define to 1 if you have the <float.h> 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 <grp.h> header file. */
#define HAVE_GRP_H 1
/* Define to 1 if you have the <ieeefp.h> 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 <inttypes.h> 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 <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <linux/config.h> header file. */
#define HAVE_LINUX_CONFIG_H 1
/* Define to 1 if you have the <locale.h> 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 <malloc.h> 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 <memory.h> 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 <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <paths.h> 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 <pwd.h> 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 <sched.h> 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 <select.h> header file. */
/* #undef HAVE_SELECT_H */
/* Define to 1 if you have the <semaphore.h> 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 <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> 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 <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> 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 <synch.h> header file. */
/* #undef HAVE_SYNCH_H */
/* Define to 1 if you have the <sys/dir.h> header file. */
#define HAVE_SYS_DIR_H 1
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/malloc.h> header file. */
/* #undef HAVE_SYS_MALLOC_H */
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/ptem.h> header file. */
/* #undef HAVE_SYS_PTEM_H */
/* Define to 1 if you have the <sys/pte.h> header file. */
/* #undef HAVE_SYS_PTE_H */
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/stream.h> header file. */
/* #undef HAVE_SYS_STREAM_H */
/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <sys/utime.h> header file. */
/* #undef HAVE_SYS_UTIME_H */
/* Define to 1 if you have the <sys/vadvise.h> header file. */
/* #undef HAVE_SYS_VADVISE_H */
/* Define to 1 if you have the <sys/wait.h> 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 <termbits.h> header file. */
/* #undef HAVE_TERMBITS_H */
/* Define to 1 if you have the <termcap.h> header file. */
#define HAVE_TERMCAP_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <termio.h> header file. */
#define HAVE_TERMIO_H 1
/* Define to 1 if you have the <term.h> 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 <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <utime.h> 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 <varargs.h> 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 <sys/stat.h> 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 <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> 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 <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */

View File

@ -1,93 +0,0 @@
/* 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

View File

@ -1,106 +0,0 @@
/* 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 <sys/stat.h>
/* 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

View File

@ -1,54 +0,0 @@
/* 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

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
/* 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

View File

@ -1,122 +0,0 @@
/* 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 <errno.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_POLL
#include <sys/poll.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#if !defined(alpha_linux_port)
#include <netinet/tcp.h>
#endif
#endif
#if defined(__EMX__)
#include <sys/ioctl.h>
#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

View File

@ -1,31 +0,0 @@
/* 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

View File

@ -1,55 +0,0 @@
/* 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 <io.h> /* Get prototypes for read()... */
#endif
#ifndef HAVE_STDLIB_H
#include <malloc.h>
#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

View File

@ -1,693 +0,0 @@
/* 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 <errno.h>
#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 <thread.h>
#include <synch.h>
#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 <signal.h>
#undef sigwait
#endif
#undef _REENTRANT /* Fix if _REENTRANT is in pthread.h */
#include <pthread.h>
#ifndef _REENTRANT
#define _REENTRANT
#endif
#ifdef HAVE_THR_SETCONCURRENCY
#include <thread.h> /* Probably solaris */
#endif
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif
#ifdef HAVE_SYNCH_H
#include <synch.h>
#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 */

View File

@ -1,64 +0,0 @@
/*
* 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 <semaphore.h>
#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_ */

View File

@ -1,770 +0,0 @@
/* 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 <sys/asynch.h> /* 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 <my_pthread.h>
#endif
#ifndef _m_ctype_h
#include <m_ctype.h> /* for CHARSET_INFO */
#endif
#include <stdarg.h>
#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.h> /* 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 <my_alloc.h>
/* 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 */

View File

@ -1,84 +0,0 @@
/* 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

View File

@ -1,448 +0,0 @@
/* 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 <my_base.h>
#endif
#ifndef _m_ctype_h
#include <m_ctype.h>
#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

View File

@ -1,112 +0,0 @@
/* 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 <my_base.h>
#endif
#ifndef _myisam_h
#include <myisam.h>
#endif
#include <queues.h>
#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

View File

@ -1,229 +0,0 @@
/* 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

View File

@ -1,441 +0,0 @@
/* 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 <sys/types.h>
#ifdef __LCC__
#include <winsock.h> /* 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 */

View File

@ -1,256 +0,0 @@
/* 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

View File

@ -1,34 +0,0 @@
/* 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 */

View File

@ -1,29 +0,0 @@
/* 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 <custom_conf.h>
#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 */

View File

@ -1,258 +0,0 @@
/* 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

View File

@ -1,77 +0,0 @@
/* 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

View File

@ -1,212 +0,0 @@
/* 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 <my_base.h>
#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

View File

@ -1,63 +0,0 @@
/* 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

View File

@ -1,158 +0,0 @@
/* 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 */

View File

@ -1,42 +0,0 @@
/* 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 <vincent.rijmen@esat.kuleuven.ac.be>
@author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
@author Paulo Barreto <paulo.barreto@terra.com.br>
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]);

View File

@ -1,67 +0,0 @@
/* 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

View File

@ -1,29 +0,0 @@
/* 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

View File

@ -1,41 +0,0 @@
/* 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 */

View File

@ -1,24 +0,0 @@
/* 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

View File

@ -1,255 +0,0 @@
/* 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

View File

@ -1,120 +0,0 @@
/* 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 */

View File

@ -1,117 +0,0 @@
/* 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 <my_pthread.h>
#include <my_list.h>
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 */

View File

@ -1,176 +0,0 @@
/* 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 <openssl/ssl.h>
#include <openssl/err.h>
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_ */

View File

@ -1,893 +0,0 @@
/* 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 */

View File

@ -1,388 +0,0 @@
#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;i<MAX_WEAPONS+MAX_CWEAPONS;i++)
weaponData[i].used = false;
RETURN_META(MRES_IGNORED);
}
BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
GET_PLAYER_POINTER(pEntity)->Connect(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);
}

View File

@ -1,462 +0,0 @@
// 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__

View File

@ -1,21 +0,0 @@
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

View File

@ -1,489 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="csx_sql"
ProjectGUID="{1DC4A99A-F23F-4AAE-881C-79D157C91155}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\release"
IntermediateDirectory=".\release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\metamod;..\..\sdk\common;..\..\sdk\engine;..\..\sdk\dlls;..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT"
StringPooling="TRUE"
RuntimeLibrary="0"
StructMemberAlignment="3"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\release/csx.pch"
AssemblerListingLocation=".\release/"
ObjectFile=".\release/"
ProgramDataBaseFileName=".\release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="mysqlclient.lib wsock32.lib"
OutputFile="release/csx_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\release/csx_amxx.pdb"
ImportLibrary=".\release/csx_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/csx.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\debug"
IntermediateDirectory=".\debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\debug/csx.pch"
AssemblerListingLocation=".\debug/"
ObjectFile=".\debug/"
ProgramDataBaseFileName=".\debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="extra\include"
OutputFile="debug/csx_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/csx_amxx.pdb"
ImportLibrary=".\debug/csx_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/csx.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\CMisc.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CRank.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CRank_sql.cpp">
</File>
<File
RelativePath="..\meta_api.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\rank.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\usermsg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\CMisc.h">
</File>
<File
RelativePath="..\CRank.h">
</File>
<File
RelativePath="..\CString.h">
</File>
<File
RelativePath="..\CVector.h">
</File>
<File
RelativePath="..\moduleconfig.h">
</File>
<File
RelativePath="..\rank.h">
</File>
<Filter
Name="MySQL"
Filter="">
<File
RelativePath="..\extra\include\mysql\config-netware.h">
</File>
<File
RelativePath="..\extra\include\mysql\config-os2.h">
</File>
<File
RelativePath="..\extra\include\mysql\config-win.h">
</File>
<File
RelativePath="..\extra\include\mysql\dbug.h">
</File>
<File
RelativePath="..\extra\include\mysql\errmsg.h">
</File>
<File
RelativePath="..\extra\include\mysql\ft_global.h">
</File>
<File
RelativePath="..\extra\include\mysql\hash.h">
</File>
<File
RelativePath="..\extra\include\mysql\heap.h">
</File>
<File
RelativePath="..\extra\include\mysql\m_ctype.h">
</File>
<File
RelativePath="..\extra\include\mysql\m_string.h">
</File>
<File
RelativePath="..\extra\include\mysql\md5.h">
</File>
<File
RelativePath="..\extra\include\mysql\merge.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_aes.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_alarm.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_alloc.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_base.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_bitmap.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_config.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_dbug.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_dir.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_getopt.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_global.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_list.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_net.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_no_pthread.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_nosys.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_pthread.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_semaphore.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_sys.h">
</File>
<File
RelativePath="..\extra\include\mysql\my_tree.h">
</File>
<File
RelativePath="..\extra\include\mysql\myisam.h">
</File>
<File
RelativePath="..\extra\include\mysql\myisammrg.h">
</File>
<File
RelativePath="..\extra\include\mysql\myisampack.h">
</File>
<File
RelativePath="..\extra\include\mysql\mysql.h">
</File>
<File
RelativePath="..\extra\include\mysql\mysql_com.h">
</File>
<File
RelativePath="..\extra\include\mysql\mysql_embed.h">
</File>
<File
RelativePath="..\extra\include\mysql\mysql_version.h">
</File>
<File
RelativePath="..\extra\include\mysql\mysqld_error.h">
</File>
<File
RelativePath="..\extra\include\mysql\mysys_err.h">
</File>
<File
RelativePath="..\extra\include\mysql\nisam.h">
</File>
<File
RelativePath="..\extra\include\mysql\queues.h">
</File>
<File
RelativePath="..\extra\include\mysql\raid.h">
</File>
<File
RelativePath="..\extra\include\mysql\rijndael.h">
</File>
<File
RelativePath="..\extra\include\mysql\sha1.h">
</File>
<File
RelativePath="..\extra\include\mysql\sslopt-case.h">
</File>
<File
RelativePath="..\extra\include\mysql\sslopt-longopts.h">
</File>
<File
RelativePath="..\extra\include\mysql\sslopt-vars.h">
</File>
<File
RelativePath="..\extra\include\mysql\t_ctype.h">
</File>
<File
RelativePath="..\extra\include\mysql\thr_alarm.h">
</File>
<File
RelativePath="..\extra\include\mysql\thr_lock.h">
</File>
<File
RelativePath="..\extra\include\mysql\violite.h">
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<Filter
Name="AMXX Module API"
Filter="">
<File
RelativePath="..\amxxmodule.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\amxxmodule.h">
</File>
</Filter>
<File
RelativePath="..\extra\lib_win32\mysqlclient.lib">
</File>
<File
RelativePath="..\extra\lib_win32\zlib.lib">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,400 +0,0 @@
#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) /* 7 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]);
if (params[7] > 0)
MF_SetAmxString(amx,params[6],(*a).getUnique(),params[7]);
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) /* 4 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]);
if (params[4] > 0)
MF_SetAmxString(amx, params[3], (*a).getUnique(), params[4]);
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;i++){
if ( !weaponData[i].used ){
char* szName = MF_GetAmxString(amx, params[1], 0, &iLen);
char *szLog = MF_GetAmxString(amx, params[3], 0, &iLen);
strcpy(weaponData[i].name,szName);
strcpy(weaponData[i].logname,szLog);
weaponData[i].used = true;
weaponData[i].melee = params[2] ? true:false;
return i;
}
}
MF_PrintSrvConsole("No More Custom Weapon Slots!\n");
return 0;
}
static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
int weapon = params[1];
if ( weapon < MAX_WEAPONS || weapon >= 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 }
};

View File

@ -1,152 +0,0 @@
#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

View File

@ -1,217 +0,0 @@
#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<<iId) ) )
break;
wpnList |= (1<<iId);
weaponData[iId].ammoSlot = iSlot;
if ( strstr( wpnName,"weapon_") )
{
if ( strcmp(wpnName+7,"hegrenade") == 0 )
strcpy(weaponData[iId].name,wpnName+9);
else
strcpy(weaponData[iId].name,wpnName+7);
strcpy(weaponData[iId].logname,weaponData[iId].name);
}
}
}
void Client_Damage(void* mValue){
static int bits;
switch (mState++) {
case 1:
ignore = false;
damage = *(int*)mValue;
break;
case 2:
bits = *(int*)mValue;
break;
case 3:
if (!mPlayer || !damage || bits){
ignore = true;
break;
}
edict_t *enemy;
enemy = mPlayer->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;
}
}

View File

@ -1,67 +0,0 @@
#(C)2004-2005 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson
HLSDK = ../../../hlsdk/SourceCode
MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3
CPP = gcc
NAME = esfmod_amxx
OBJECTS = amxxmodule.cpp esf_anim.cpp esf_base.cpp esf_pdata.cpp esf_avatars.cpp esf_effects.cpp esforces.cpp
LINK =
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
-I$(MM_ROOT) -Lzlib -I$(HLSDK)/common -I$(HLSDK)/pm_shared
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS = $(DEBUG_FLAGS)
else
BIN_DIR = Release
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else
BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
OPT_FLAGS += -march=i686
endif
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
all:
mkdir -p $(BIN_DIR)
mkdir -p $(BIN_DIR)/sdk
$(MAKE) esfmod
amd64:
$(MAKE) all AMD64=true
esfmod: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
debug:
$(MAKE) all DEBUG=true
default: all
clean:
rm -rf Release/*.o
rm -rf Release/$(BINARY)
rm -rf Debug/*.o
rm -rf Debug/$(BINARY)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,699 +0,0 @@
#include <extdll.h>
#include <meta_api.h>
#include <eiface.h>
#include <edict.h>
#include "esforces.h"
//use direction enums
// 0 = any
static cell AMX_NATIVE_CALL esf_is_swooping(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
int dir = params[2];
if (!dir)
{
if (anim >= 36 && anim <= 41)
return 1;
} else if (dir == Direction_Up) {
if (anim == 36)
return 1;
} else if (dir == Direction_Down) {
if (anim == 37)
return 1;
} else if (dir == Direction_Left) {
if (anim == 38)
return 1;
} else if (dir == Direction_Right) {
if (anim == 39)
return 1;
} else if (dir == Direction_Forward) {
if (anim == 40)
return 1;
} else if (dir == Direction_Backward) {
if (anim == 41)
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL esf_is_prepunch(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim >= 121 || anim <= 124)
return 1;
if (anim == 209)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_in_stance(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 126)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_stunned(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 127)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_grappling(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 128)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_crushed(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 208)
return 1;
return 0;
}
//player, combo, [attacked = 0]
static cell AMX_NATIVE_CALL esf_in_combo(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (params[2] == 1)
{
if (params[3])
{
if (pEdict->v.sequence == 213)
return 1;
} else {
if (pEdict->v.sequence == 212)
return 1;
}
} else if (params[2] == 2) {
if (params[3])
{
if (pEdict->v.sequence == 215)
return 1;
} else {
if (pEdict->v.sequence == 214)
return 1;
}
}
return 0;
}
static cell AMX_NATIVE_CALL esf_is_advmeleeing(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim > 128 && anim < 153)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_advmeleed(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim > 152 && anim < 201)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_in_advmelee(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim > 120 && anim < 216)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_blocking(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim <= 42 && anim >= 46)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_kicking(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim <= 47 && anim >= 51)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_kicked(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
//only evens
if (anim >= 52 && anim <= 62 && (anim % 2 == 0))
return 1;
return 0;
}
//1 = kicked
//2 = tumbling
//3 = laying
//4 = thrown to ground
static cell AMX_NATIVE_CALL esf_is_recovered(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
int mode = params[2];
if (mode == 1)
{
//only odds
if (anim >= 53 && anim <= 63 && (anim % 2 == 1))
return 1;
} else if (mode == 2) {
if (anim == 65 || anim == 67 || anim == 69 || anim == 71)
return 1;
return 0;
} else if (mode == 3) {
if (anim == 73 || anim == 75)
return 1;
} else if (mode == 4) {
if (anim >= 105 && anim <= 109)
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL esf_is_flying(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim >= 26 && anim <= 34)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_tumbling(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 64 || anim == 66 || anim == 68 || anim == 70)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_lying(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 72 || anim == 74)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_has_died(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim >= 76 && anim <= 84)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_has_dragonball(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 92)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_threw_dragonball(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 93 || anim == 94)
return 1;
return 0;
}
//1 = kiblast
//2 = generic beam
static cell AMX_NATIVE_CALL esf_is_shooting(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (params[2] == 1)
{
if (anim == 95 || anim == 96)
return 1;
} else if (params[2] == 2) {
if (anim == 98 || anim == 99)
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL esf_transforming(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 101 || anim == 102)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_transform_done(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 103)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_groundthrown(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 104)
return 1;
return 0;
}
//for get_shotstate and get_attack
//1 = kamehameha
//2 = spiritbomb
//3 = galletgun
//4 = finalflash
//5 = renzoku
//6 = kametorpedo
//7 = generic beam
//8 = throw
static cell AMX_NATIVE_CALL esf_get_shotstate(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
int cls = pEdict->v.playerclass;
int attack = params[2];
if (attack == Attack_Kamehameha)
{
if ( (cls == Character_Goku || cls == Character_Gohan))
{
if (anim == 110)
return ESF_CHARGING;
if (anim == 111)
return ESF_CONTROLLING;
}
if (cls == Character_Cell)
{
if (anim == 112)
return ESF_CHARGING;
if (anim == 113)
return ESF_CONTROLLING;
}
} else if (attack == Attack_SpiritBomb) {
if (anim == 112 || anim == 114)
return ESF_CHARGING;
if (anim == 113 || anim == 115)
return ESF_SHOT;
} else if (attack == Attack_GalletGun) {
if (cls == Character_Vegeta)
{
if (anim == 111)
return ESF_CHARGING;
if (anim == 112)
return ESF_CONTROLLING;
}
if (cls == Character_Cell)
{
if (anim == 110)
return ESF_CHARGING;
if (anim == 111)
return ESF_CONTROLLING;
}
} else if (attack == Attack_FinalFlash) {
if (cls == Character_Krillin)
{
if (anim == 119 || anim == 120)
return ESF_SHOT;
}
if (cls == Character_Cell)
{
if (anim == 114 || anim == 115)
return ESF_SHOT;
}
if (anim == 113)
return ESF_CHARGING;
if (anim == 114)
return ESF_CONTROLLING;
} else if (attack == Attack_Renzoku) {
if (anim == 115)
return ESF_CHARGING;
if (anim >= 116 && anim <= 118)
return ESF_SHOOTING;
} else if (attack == Attack_Kametorpedo) {
if (anim == 116)
return ESF_CHARGING;
if (anim == 118)
return ESF_SHOT;
} else if (attack == Attack_GenericBeam) {
if (anim == 97)
return ESF_CHARGING;
} else if (attack == Attack_Throw) {
if (anim == 201 || anim == 203 || anim == 204)
return ESF_CHARGING;
}
return 0;
}
//experimental since animation states overlap not all weapons can be returned
static cell AMX_NATIVE_CALL esf_get_attack(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
int cls = pEdict->v.playerclass;
if ( (cls == Character_Goku || cls == Character_Gohan) )
{
if (anim == 110 || anim == 111)
return Attack_Kamehameha;
} else if (cls == Character_Cell) {
if (anim == 112 || anim == 113)
return Attack_Kamehameha;
if (anim == 110 || anim == 111)
return Attack_GalletGun;
if (anim == 114 || anim == 115)
return Attack_FinalFlash;
} else if (cls == Character_Vegeta) {
if (anim == 111 || anim == 112)
return Attack_GalletGun;
} else if (cls == Character_Krillin) {
if (anim == 119 || anim == 120)
return Attack_FinalFlash;
}
if (anim == 97)
return Attack_GenericBeam;
if (anim == 201 || anim == 203 || anim == 204)
return Attack_Throw;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_swung(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 202 || anim == 206)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_grabbedwall(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 13 ||
anim == 15 ||
anim == 17 ||
anim == 19)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_walljumped(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim == 14 ||
anim == 16 ||
anim == 18 ||
anim == 20)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_in_water(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim >= 21 && anim <= 23)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_powering(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim >= 24 && anim <= 27)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_idle(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int anim = pEdict->v.sequence;
if (anim <=2)
return 1;
return 0;
}
static cell AMX_NATIVE_CALL esf_is_beamjumping(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (pEdict->v.sequence == 100)
return 1;
return 0;
}
AMX_NATIVE_INFO g_AnimationNatives[] = {
{"esf_is_swooping", esf_is_swooping},
{"esf_is_prepunch", esf_is_prepunch},
{"esf_in_stance", esf_in_stance},
{"esf_is_stunned", esf_is_stunned},
{"esf_is_grappling", esf_is_grappling},
{"esf_is_crushed", esf_is_crushed},
{"esf_in_combo", esf_in_combo},
{"esf_is_advmeleeing", esf_is_advmeleeing},
{"esf_is_advmeleed", esf_is_advmeleed},
{"esf_in_advmelee", esf_in_advmelee},
{"esf_is_blocking", esf_is_blocking},
{"esf_is_kicking", esf_is_kicking},
{"esf_is_kicked", esf_is_kicked},
{"esf_is_recovered", esf_is_recovered},
{"esf_is_flying", esf_is_flying},
{"esf_is_tumbling", esf_is_tumbling},
{"esf_is_lying", esf_is_lying},
{"esf_has_died", esf_has_died},
{"esf_has_dragonball", esf_has_dragonball},
{"esf_threw_dragonball", esf_threw_dragonball},
{"esf_is_shooting", esf_is_shooting},
{"esf_transforming", esf_transforming},
{"esf_transform_done", esf_transform_done},
{"esf_groundthrown", esf_groundthrown},
{"esf_get_shotstate", esf_get_shotstate},
{"esf_get_attack", esf_get_attack},
{"esf_is_swung", esf_is_swung},
{"esf_grabbedwall", esf_grabbedwall},
{"esf_walljumped", esf_walljumped},
{"esf_in_water", esf_in_water},
{"esf_is_powering", esf_is_powering},
{"esf_is_idle", esf_is_idle},
{"esf_is_beamjumping", esf_is_beamjumping},
{NULL, NULL},
};

View File

@ -1,119 +0,0 @@
#include <extdll.h>
#include <meta_api.h>
#include <eiface.h>
#include <edict.h>
#include "esforces.h"
int g_Avatars[33] = {0};
static cell AMX_NATIVE_CALL esf_create_avatar(AMX *amx, cell *params)
{
int player = params[1];
CHECKPLAYER(player);
if (g_Avatars[player] == 0)
{
edict_t *pEntity = CREATE_NAMED_ENTITY(MAKE_STRING("env_model"));
if (!pEntity || FNullEnt(pEntity))
return 0;
pEntity->v.movetype = MOVETYPE_FOLLOW;
pEntity->v.aiment = MF_GetPlayerEdict(player);
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL esf_remove_avatar(AMX *amx, cell *params)
{
int player = params[1];
CHECKPLAYER(player);
if (g_Avatars[player])
{
edict_t *pEntity = INDEXENT(g_Avatars[player]);
if (!pEntity || FNullEnt(pEntity))
{
g_Avatars[player] = 0;
return 0;
}
REMOVE_ENTITY(pEntity);
g_Avatars[player] = 0;
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL esf_has_avatar(AMX *amx, cell *params)
{
int player = params[1];
CHECKPLAYER(player);
if (g_Avatars[player])
{
edict_t *pEntity = INDEXENT(g_Avatars[player]);
if (!pEntity || FNullEnt(pEntity))
{
g_Avatars[player] = 0;
return 0;
}
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL esf_avatar_getent(AMX *amx, cell *params)
{
int player = params[1];
CHECKPLAYER(player);
if (g_Avatars[player])
{
edict_t *pEntity = INDEXENT(g_Avatars[player]);
if (!pEntity || FNullEnt(pEntity))
{
g_Avatars[player] = 0;
return 0;
}
return g_Avatars[player];
}
return 0;
}
static cell AMX_NATIVE_CALL esf_avatar_setmodel(AMX *amx, cell *params)
{
int player = params[1];
CHECKPLAYER(player);
if (g_Avatars[player])
{
edict_t *pEntity = INDEXENT(g_Avatars[player]);
if (!pEntity || FNullEnt(pEntity))
{
g_Avatars[player] = 0;
return 0;
}
int len;
const char *str = MF_GetAmxString(amx, params[2], 0, &len);
SET_MODEL(pEntity, STRING(ALLOC_STRING(str)));
return 1;
}
return 0;
}
AMX_NATIVE_INFO g_AvatarNatives[] = {
{"esf_create_avatar", esf_create_avatar},
{"esf_remove_avatar", esf_remove_avatar},
{"esf_has_avatar", esf_has_avatar},
{"esf_avatar_getent", esf_avatar_getent},
{"esf_avatar_setmodel", esf_avatar_setmodel},
{NULL, NULL},
};

View File

@ -1,153 +0,0 @@
#include <extdll.h>
#include <meta_api.h>
#include <eiface.h>
#include <edict.h>
#include "esforces.h"
int g_MaxHealthMsg = 0;
int g_ChargeMsg = 0;
static cell AMX_NATIVE_CALL esf_get_class(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
return pEdict->v.playerclass;
}
static cell AMX_NATIVE_CALL esf_set_class(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
pEdict->v.playerclass = params[2];
return 1;
}
static cell AMX_NATIVE_CALL esf_get_ki(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
return amx_ftoc((REAL)pEdict->v.fuser4);
}
static cell AMX_NATIVE_CALL esf_set_ki(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
REAL ki = amx_ctof(params[2]);
if (ki < 0.0f || ki > 1000.0f)
{
MF_LogError(amx, AMX_ERR_NATIVE, "You cannot set ki above 1000.0!");
return 0;
}
pEdict->v.fuser4 = (float)ki;
return 1;
}
static cell AMX_NATIVE_CALL esf_get_swoopspeed(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
return amx_ftoc((REAL)pEdict->v.fuser1);
}
static cell AMX_NATIVE_CALL esf_set_swoopspeed(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
REAL speed = amx_ctof(params[2]);
pEdict->v.fuser1 = (float)speed;
return 1;
}
static cell AMX_NATIVE_CALL esf_set_health(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int health = params[2];
pEdict->v.health = (float)health;
if (!g_MaxHealthMsg)
{
g_MaxHealthMsg = GET_USER_MSG_ID(PLID, "MaxHealth", NULL);
if (!g_MaxHealthMsg)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find MaxHealth message!");
return 0;
}
}
float vecOrigin[3] = {0.0f,0.0f,0.0f};
MESSAGE_BEGIN(MSG_ONE, g_MaxHealthMsg, vecOrigin, pEdict);
WRITE_BYTE( health );
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL esf_set_chargebar(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
if (!g_ChargeMsg)
{
g_ChargeMsg = GET_USER_MSG_ID(PLID, "Charge", NULL);
if (!g_ChargeMsg)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find Charge message!");
return 0;
}
}
int value = params[2];
float vecOrigin[3] = {0.0f,0.0f,0.0f};
MESSAGE_BEGIN(MSG_ONE, g_ChargeMsg, vecOrigin, pEdict);
WRITE_BYTE(value);
MESSAGE_END();
return 1;
}
AMX_NATIVE_INFO g_BaseNatives[] = {
{"esf_get_class", esf_get_class},
{"esf_set_class", esf_set_class},
{"esf_get_ki", esf_get_ki},
{"esf_set_ki", esf_set_ki},
{"esf_get_swoopspeed", esf_get_swoopspeed},
{"esf_set_swoopspeed", esf_set_swoopspeed},
{"esf_set_health", esf_set_health},
{"esf_set_chargebar", esf_set_chargebar},
{NULL, NULL},
};

View File

@ -1,172 +0,0 @@
#include <extdll.h>
#include <meta_api.h>
#include <eiface.h>
#include <edict.h>
#include "esforces.h"
int g_PowerupMsg = 0;
int g_StopPowerupMsg = 0;
int g_ExplosionMsg = 0;
int g_TransformFX = 0;
int g_StopTransform = 0;
static cell AMX_NATIVE_CALL esf_start_powerup(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
if (!g_PowerupMsg)
{
g_PowerupMsg = GET_USER_MSG_ID(PLID, "Powerup", NULL);
if (!g_PowerupMsg)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find Powerup message!");
return 0;
}
}
MESSAGE_BEGIN(MSG_BROADCAST, g_PowerupMsg);
WRITE_BYTE(index);
WRITE_BYTE(params[2]);
WRITE_BYTE(params[3]);
WRITE_BYTE(params[4]);
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL esf_transformfx_1(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
if (!g_TransformFX)
{
g_TransformFX = GET_USER_MSG_ID(PLID, "TransformFX", NULL);
if (!g_TransformFX)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find TransformFX message!");
return 0;
}
}
MESSAGE_BEGIN(MSG_ALL, g_TransformFX);
WRITE_BYTE(index);
WRITE_BYTE(50);
WRITE_BYTE(75);
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL esf_transformfx_2(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
if (!g_TransformFX)
{
g_TransformFX = GET_USER_MSG_ID(PLID, "TransformFX", NULL);
if (!g_TransformFX)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find TransformFX message!");
return 0;
}
}
MESSAGE_BEGIN(MSG_ALL, g_TransformFX);
WRITE_BYTE(index);
WRITE_BYTE(100);
WRITE_BYTE(75);
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL esf_transformfx_off(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
if (!g_StopTransform)
{
g_StopTransform = GET_USER_MSG_ID(PLID, "StopTransFX", NULL);
if (!g_StopTransform)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find StopTransFX message!");
return 0;
}
}
MESSAGE_BEGIN(MSG_ALL, g_StopTransform);
WRITE_BYTE(index);
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL esf_stop_powerup(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
if (!g_StopPowerupMsg)
{
g_StopPowerupMsg = GET_USER_MSG_ID(PLID, "StopPowerup", NULL);
if (!g_StopPowerupMsg)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find StopPowerup message!");
return 0;
}
}
MESSAGE_BEGIN(MSG_ONE, g_StopPowerupMsg);
WRITE_BYTE(index);
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL esf_explosion(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
if (params[3] < 0 || params[3] >= Explosions_Total)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid explosion id %d", params[3]);
return 0;
}
if (!g_ExplosionMsg)
{
g_ExplosionMsg = GET_USER_MSG_ID(PLID, "Explosion", NULL);
if (!g_ExplosionMsg)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find Explosion message!");
return 0;
}
}
cell *cp = MF_GetAmxAddr(amx, params[1]);
MESSAGE_BEGIN(MSG_BROADCAST, g_ExplosionMsg);
WRITE_COORD( cp[0] );
WRITE_COORD( cp[1] );
WRITE_COORD( cp[2] );
WRITE_LONG( params[2] );
WRITE_BYTE( params[3] );
MESSAGE_END();
return 1;
}
AMX_NATIVE_INFO g_EffectsNatives[] = {
{"esf_start_powerup", esf_start_powerup},
{"esf_stop_powerup", esf_stop_powerup},
{"esf_explosion", esf_explosion},
{"esf_transformfx_1", esf_transformfx_1},
{"esf_transformfx_2", esf_transformfx_2},
{"esf_transformfx_off", esf_transformfx_off},
{NULL, NULL},
};

View File

@ -1,65 +0,0 @@
#include <extdll.h>
#include <meta_api.h>
#include <eiface.h>
#include <edict.h>
#include "esforces.h"
#include "esf_pdata.h"
#define GET_PDATA_D(v,o) ( *((int *)v + (o)) )
#define SET_PDATA_D(v,o,s) ( *((int *)v + (o)) = (s) )
static cell AMX_NATIVE_CALL esf_get_powerlevel(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
return GET_PDATA_D(pEdict->pvPrivateData, ESF_POWERLEVEL1);
}
static cell AMX_NATIVE_CALL esf_set_powerlevel(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
SET_PDATA_D(pEdict->pvPrivateData, ESF_POWERLEVEL1, params[2]);
SET_PDATA_D(pEdict->pvPrivateData, ESF_POWERLEVEL2, params[2]);
return 1;
}
static cell AMX_NATIVE_CALL esf_get_speed(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
return GET_PDATA_D(pEdict->pvPrivateData, ESF_SPEED1);
}
static cell AMX_NATIVE_CALL esf_set_speed(AMX *amx, cell *params)
{
int index = params[1];
CHECKPLAYER(index);
edict_t *pEdict = INDEXENT(index);
int speed = params[2];
SET_PDATA_D(pEdict->pvPrivateData, ESF_SPEED1, speed);
SET_PDATA_D(pEdict->pvPrivateData, ESF_SPEED2, speed);
return 1;
}
AMX_NATIVE_INFO g_PdataNatives[] = {
{"esf_get_powerlevel", esf_get_powerlevel},
{"esf_set_powerlevel", esf_set_powerlevel},
{"esf_get_speed", esf_get_speed},
{"esf_get_speed", esf_get_speed},
{NULL, NULL},
};

View File

@ -1,18 +0,0 @@
#ifndef _INCLUDE_ESF_PDATA_H
#define _INCLUDE_ESF_PDATA_H
//dword aligned offsets!
#ifdef __linux__
#define EXOFF_D 5
#else
#define EXOFF_D 0
#endif
#define ESF_POWERLEVEL1 460 + EXOFF_D
#define ESF_POWERLEVEL2 461 + EXOFF_D
#define ESF_SPEED1 459 + EXOFF_D
#define ESF_SPEED2 462 + EXOFF_D
#endif //_INCLUDE_ESF_PDATA_H

View File

@ -1,21 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "esfmod", "esfmod.vcproj", "{22F17878-9B53-41F7-B01D-668A29A9C92D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{22F17878-9B53-41F7-B01D-668A29A9C92D}.Debug.ActiveCfg = Debug|Win32
{22F17878-9B53-41F7-B01D-668A29A9C92D}.Debug.Build.0 = Debug|Win32
{22F17878-9B53-41F7-B01D-668A29A9C92D}.Release.ActiveCfg = Release|Win32
{22F17878-9B53-41F7-B01D-668A29A9C92D}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

Some files were not shown because too many files have changed in this diff Show More