#include "tk.h"


/* Tcl/Tk functions in external modules */
extern int WaitCursorCmd();
extern int NormalCursorCmd();
extern int PGTK_SourceCmd();

/* Map drawing routines */
extern int DrawMapCmd();
extern int MouseLatLonCmd();
extern int GetMapXYCmd();
extern int GetMapLatLonCmd();
extern int MapBoxCmd();

/* Postgres Large Object Handling functions */
extern int PGTKlonames();
extern int PGTKlocopy();
extern int PGTKlopwd();
extern int PGTKlocd();

/* Postgres LIBPQ functions */
extern int PGTKsetdb();
extern int PGTKdb();
extern int PGTKreset();
extern int PGTKfinish();
extern int PGTKexec();
extern int PGTKnportals();
extern int PGTKpnames();
extern int PGTKparray();
extern int PGTKclear();
extern int PGTKrulep();
extern int PGTKntuples();
extern int PGTKngroups();
extern int PGTKntuplesGroup();
extern int PGTKnfieldsGroup();
extern int PGTKfnameGroup();
extern int PGTKfnumberGroup();
extern int PGTKgetgroup();
extern int PGTKnfields();
extern int PGTKfnumber();
extern int PGTKfname();
extern int PGTKftype();
extern int PGTKsametype();
extern int PGTKgetvalue();
extern int PGTKgetline();
extern int PGTKputline();
extern int PGTKendcopy();
extern int PGTKtrace();
extern int PGTKuntrace();

/* Tcl/Tk command interface */
extern int PGTK_RetrieveCmd();
extern int PGTK_APostQuelCmd();
extern int PGTK_XActCmd();
extern int PGTKtuplelist();
extern int PGTKtuplearray();

/* Z39.50 interface */
#ifdef HAVE_Z3950_LIB
extern int TKZ_ClientCmd();
#endif

/* this procedure loads the user defined commands into the interpreter */
LoadPGTKMCmds(interp)
Tcl_Interp *interp;
{
  Tk_Window  w;

  w = Tk_MainWindow(interp);


  Tcl_CreateCommand(interp, "drawmap", DrawMapCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp, "mouselatlon", MouseLatLonCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp, "waitcursor", WaitCursorCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp, "normalcursor", NormalCursorCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp, "getmapxy", GetMapXYCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp, "getmaplatlon", GetMapLatLonCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp, "getmapbox", MapBoxCmd, (ClientData) w,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQsetdb", PGTKsetdb, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQdb", PGTKdb, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQreset", PGTKreset, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQfinish", PGTKfinish, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQexec", PGTKexec, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQnportals", PGTKnportals, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQpnames", PGTKpnames, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQparray", PGTKparray, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQclear", PGTKclear, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQrulep", PGTKrulep, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQntuples", PGTKntuples, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQngroups", PGTKngroups, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQntuplesGroup", PGTKntuplesGroup, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQnfieldsGroup", PGTKnfieldsGroup, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQfnameGroup", PGTKfnameGroup, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQfnumberGroup", PGTKfnumberGroup, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQgetgroup", PGTKgetgroup, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQnfields", PGTKnfields, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQfnumber", PGTKfnumber, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQfname", PGTKfname, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQftype", PGTKftype, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQsametype", PGTKsametype, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQgetvalue", PGTKgetvalue, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQgetline", PGTKgetline, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQputline", PGTKputline, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQendcopy", PGTKendcopy, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQtrace", PGTKtrace, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQuntrace", PGTKuntrace, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQtuplearray", PGTKtuplearray, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQlonames", PGTKlonames, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"lo_names", PGTKlonames, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"lo_ls", PGTKlonames, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQlocopy", PGTKlocopy, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"lo_copy", PGTKlocopy, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQlocd", PGTKlocd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"lo_cd", PGTKlocd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQlopwd", PGTKlopwd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"lo_pwd", PGTKlopwd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQsource", PGTK_SourceCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"retrieve", PGTK_RetrieveCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQretrieve", PGTK_RetrieveCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"fetch", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQfetch", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"pclose", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQclose", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"pappend", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"pgappend", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQappend", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"replace", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQreplace", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"delete", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQdelete", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"create", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQcreate", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"pdestroy", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"pgdestroy", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQdestroy", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"define", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQdefine", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"remove", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQremove", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"copy", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQcopy", PGTK_APostQuelCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"begin", PGTK_XActCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQbegin", PGTK_XActCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"end", PGTK_XActCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQend", PGTK_XActCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"abort", PGTK_XActCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQabort", PGTK_XActCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"tuplelist", PGTKtuplelist, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PQtuplelist", PGTKtuplelist, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"PGTKtuplelist", PGTKtuplelist, (ClientData) NULL,
		    (void (*)()) NULL);
  
#ifdef HAVE_Z3950_LIB
  Tcl_CreateCommand(interp,"Zselect", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"Zfind", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"Zdisplay", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"Zshow", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"Zclose", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"Zset", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  
  Tcl_CreateCommand(interp,"ZSELECT", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"ZFIND", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"ZDISPLAY", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"ZSHOW", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"ZCLOSE", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"ZSET", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  
  Tcl_CreateCommand(interp,"zselect", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"zfind", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"zdisplay", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"zshow", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"zclose", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
  Tcl_CreateCommand(interp,"zset", TKZ_ClientCmd, (ClientData) NULL,
		    (void (*)()) NULL);
#endif  


}
