Import Tcl 8.6.12
This commit is contained in:
46
pkgs/tdbcpostgres1.1.3/generic/fakepq.h
Normal file
46
pkgs/tdbcpostgres1.1.3/generic/fakepq.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* fakepq.h --
|
||||
*
|
||||
* Minimal replacement for 'pq-fe.h' in the PostgreSQL client
|
||||
* without having a PostgreSQL installation on the build system.
|
||||
* This file comprises only data type, constant and function definitions.
|
||||
*
|
||||
* The programmers of this file believe that it contains material not
|
||||
* subject to copyright under the doctrines of scenes a faire and
|
||||
* of merger of idea and expression. Accordingly, this file is in the
|
||||
* public domain.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef FAKEPQ_H_INCLUDED
|
||||
#define FAKEPQ_H_INCLUDED
|
||||
|
||||
#ifndef MODULE_SCOPE
|
||||
#define MODULE_SCOPE extern
|
||||
#endif
|
||||
|
||||
MODULE_SCOPE Tcl_LoadHandle PostgresqlInitStubs(Tcl_Interp*);
|
||||
|
||||
typedef enum {
|
||||
CONNECTION_OK=0,
|
||||
} ConnStatusType;
|
||||
typedef enum {
|
||||
PGRES_EMPTY_QUERY=0,
|
||||
PGRES_BAD_RESPONSE=5,
|
||||
PGRES_NONFATAL_ERROR=6,
|
||||
PGRES_FATAL_ERROR=7,
|
||||
} ExecStatusType;
|
||||
typedef unsigned int Oid;
|
||||
typedef struct pg_conn PGconn;
|
||||
typedef struct pg_result PGresult;
|
||||
typedef void (*PQnoticeProcessor)(void*, const PGresult*);
|
||||
|
||||
#define PG_DIAG_SQLSTATE 'C'
|
||||
#define PG_DIAG_MESSAGE_PRIMARY 'M'
|
||||
|
||||
#include "pqStubs.h"
|
||||
|
||||
MODULE_SCOPE const pqStubDefs* pqStubs;
|
||||
|
||||
#endif
|
||||
24
pkgs/tdbcpostgres1.1.3/generic/int2ptr_ptr2int.h
Normal file
24
pkgs/tdbcpostgres1.1.3/generic/int2ptr_ptr2int.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Macros used to cast between pointers and integers (e.g. when storing an int
|
||||
* in ClientData), on 64-bit architectures they avoid gcc warning about "cast
|
||||
* to/from pointer from/to integer of different size".
|
||||
*/
|
||||
|
||||
#if !defined(INT2PTR) && !defined(PTR2INT)
|
||||
# if defined(HAVE_INTPTR_T) || defined(intptr_t)
|
||||
# define INT2PTR(p) ((void *)(intptr_t)(p))
|
||||
# define PTR2INT(p) ((int)(intptr_t)(p))
|
||||
# else
|
||||
# define INT2PTR(p) ((void *)(p))
|
||||
# define PTR2INT(p) ((int)(p))
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(UINT2PTR) && !defined(PTR2UINT)
|
||||
# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
|
||||
# define UINT2PTR(p) ((void *)(uintptr_t)(p))
|
||||
# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
|
||||
# else
|
||||
# define UINT2PTR(p) ((void *)(p))
|
||||
# define PTR2UINT(p) ((unsigned int)(p))
|
||||
# endif
|
||||
#endif
|
||||
50
pkgs/tdbcpostgres1.1.3/generic/pqStubDefs.txt
Normal file
50
pkgs/tdbcpostgres1.1.3/generic/pqStubDefs.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
# pqStubDefs.txt --
|
||||
#
|
||||
# Definitions of routines in the PostgreSQL libraries that will be
|
||||
# resolved and imported at run time.
|
||||
#
|
||||
# This file contains only function declarations necessary to
|
||||
# interoperability with the PostgreSQL application programming
|
||||
# interface. The programmers believe that the material in this file is
|
||||
# not subject to copyright, under the doctrines of scenes a faire and
|
||||
# of the merger of idea and expression. Accordingly, this file is in
|
||||
# the public domain.
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
* STUBSTRUCT: pqStubs
|
||||
* LIBRARY: pq
|
||||
|
||||
const char* pg_encoding_to_char(int);
|
||||
void PQclear(PGresult*);
|
||||
int PQclientEncoding(const PGconn*);
|
||||
char* PQcmdTuples(PGresult*);
|
||||
PGconn* PQconnectdb(const char*);
|
||||
char* PQerrorMessage(const PGconn*);
|
||||
PGresult* PQdescribePrepared(PGconn*, const char*);
|
||||
PGresult* PQexec(PGconn*, const char*);
|
||||
PGresult* PQexecPrepared(PGconn*, const char*, int, const char *const*, const int*, const int*, int);
|
||||
char* PQdb(const PGconn *);
|
||||
void PQfinish(PGconn*);
|
||||
char* PQfname(PGresult*, int);
|
||||
int PQfnumber(const PGresult*, const char*);
|
||||
Oid PQftype(const PGresult*, int);
|
||||
int PQgetisnull(const PGresult*, int, int);
|
||||
int PQgetlength(const PGresult*, int, int);
|
||||
char* PQgetvalue(const PGresult*, int, int);
|
||||
char* PQhost(const PGconn*);
|
||||
int PQnfields(const PGresult*);
|
||||
int PQnparams(const PGresult*);
|
||||
int PQntuples(const PGresult*);
|
||||
char* PQoptions(const PGconn*);
|
||||
Oid PQparamtype(const PGresult*, int);
|
||||
char* PQpass(const PGconn*);
|
||||
char* PQport(const PGconn*);
|
||||
PGresult* PQprepare(PGconn*, const char*, const char*, int, const Oid*);
|
||||
char* PQresultErrorField(const PGresult*, int);
|
||||
ExecStatusType PQresultStatus(const PGresult*);
|
||||
int PQsetClientEncoding(PGconn*, const char*);
|
||||
PQnoticeProcessor PQsetNoticeProcessor(PGconn*, PQnoticeProcessor, void*);
|
||||
ConnStatusType PQstatus(PGconn*);
|
||||
char* PQuser(const PGconn*);
|
||||
char* PQtty(const PGconn*);
|
||||
170
pkgs/tdbcpostgres1.1.3/generic/pqStubInit.c
Normal file
170
pkgs/tdbcpostgres1.1.3/generic/pqStubInit.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* pqStubInit.c --
|
||||
*
|
||||
* Stubs tables for the foreign PostgreSQL libraries so that
|
||||
* Tcl extensions can use them without the linker's knowing about them.
|
||||
*
|
||||
* @CREATED@ 2015-06-26 12:55:15Z by genExtStubs.tcl from ../generic/pqStubDefs.txt
|
||||
*
|
||||
* Copyright (c) 2010 by Kevin B. Kenny.
|
||||
*
|
||||
* Please refer to the file, 'license.terms' for the conditions on
|
||||
* redistribution of this file and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <tcl.h>
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "fakepq.h"
|
||||
|
||||
/*
|
||||
* Static data used in this file
|
||||
*/
|
||||
|
||||
/*
|
||||
* Names of the libraries that might contain the PostgreSQL API
|
||||
*/
|
||||
|
||||
#if defined(__CYGWIN__) && !defined(LIBPREFIX)
|
||||
# define LIBPREFIX "cyg"
|
||||
#else
|
||||
# define LIBPREFIX "lib"
|
||||
#endif
|
||||
|
||||
static const char *const pqStubLibNames[] = {
|
||||
/* @LIBNAMES@: DO NOT EDIT THESE NAMES */
|
||||
"pq", NULL
|
||||
/* @END@ */
|
||||
};
|
||||
|
||||
/* ABI Version numbers of the PostgreSQL API that we can cope with */
|
||||
|
||||
static const char pqSuffixes[][4] = {
|
||||
"", ".5"
|
||||
};
|
||||
|
||||
/* Names of the functions that we need from PostgreSQL */
|
||||
|
||||
static const char *const pqSymbolNames[] = {
|
||||
/* @SYMNAMES@: DO NOT EDIT THESE NAMES */
|
||||
"pg_encoding_to_char",
|
||||
"PQclear",
|
||||
"PQclientEncoding",
|
||||
"PQcmdTuples",
|
||||
"PQconnectdb",
|
||||
"PQerrorMessage",
|
||||
"PQdescribePrepared",
|
||||
"PQexec",
|
||||
"PQexecPrepared",
|
||||
"PQdb",
|
||||
"PQfinish",
|
||||
"PQfname",
|
||||
"PQfnumber",
|
||||
"PQftype",
|
||||
"PQgetisnull",
|
||||
"PQgetlength",
|
||||
"PQgetvalue",
|
||||
"PQhost",
|
||||
"PQnfields",
|
||||
"PQnparams",
|
||||
"PQntuples",
|
||||
"PQoptions",
|
||||
"PQparamtype",
|
||||
"PQpass",
|
||||
"PQport",
|
||||
"PQprepare",
|
||||
"PQresultErrorField",
|
||||
"PQresultStatus",
|
||||
"PQsetClientEncoding",
|
||||
"PQsetNoticeProcessor",
|
||||
"PQstatus",
|
||||
"PQuser",
|
||||
"PQtty",
|
||||
NULL
|
||||
/* @END@ */
|
||||
};
|
||||
|
||||
/*
|
||||
* Table containing pointers to the functions named above.
|
||||
*/
|
||||
|
||||
static pqStubDefs pqStubsTable;
|
||||
const pqStubDefs* pqStubs = &pqStubsTable;
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
* PQInitStubs --
|
||||
*
|
||||
* Initialize the Stubs table for the PostgreSQL API
|
||||
*
|
||||
* Results:
|
||||
* Returns the handle to the loaded PostgreSQL client library, or NULL
|
||||
* if the load is unsuccessful. Leaves an error message in the
|
||||
* interpreter.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
MODULE_SCOPE Tcl_LoadHandle
|
||||
PostgresqlInitStubs(Tcl_Interp* interp)
|
||||
{
|
||||
int i;
|
||||
size_t j;
|
||||
int status; /* Status of Tcl library calls */
|
||||
Tcl_Obj* path; /* Path name of a module to be loaded */
|
||||
Tcl_Obj* shlibext; /* Extension to use for load modules */
|
||||
Tcl_LoadHandle handle = NULL;
|
||||
/* Handle to a load module */
|
||||
|
||||
/* Determine the shared library extension */
|
||||
|
||||
status = Tcl_EvalEx(interp, "::info sharedlibextension", -1,
|
||||
TCL_EVAL_GLOBAL);
|
||||
if (status != TCL_OK) return NULL;
|
||||
shlibext = Tcl_GetObjResult(interp);
|
||||
Tcl_IncrRefCount(shlibext);
|
||||
|
||||
/* Walk the list of possible library names to find an PostgreSQL client */
|
||||
|
||||
status = TCL_ERROR;
|
||||
for (i = 0; status == TCL_ERROR && pqStubLibNames[i] != NULL; ++i) {
|
||||
for (j = 0; status == TCL_ERROR && (j < sizeof(pqSuffixes)/sizeof(pqSuffixes[0])); ++j) {
|
||||
path = Tcl_NewStringObj(LIBPREFIX, -1);
|
||||
Tcl_AppendToObj(path, pqStubLibNames[i], -1);
|
||||
#ifdef __CYGWIN__
|
||||
if (*pqSuffixes[j]) {
|
||||
Tcl_AppendToObj(path, "-", -1);
|
||||
Tcl_AppendToObj(path, pqSuffixes[j]+1, -1);
|
||||
}
|
||||
#endif
|
||||
Tcl_AppendObjToObj(path, shlibext);
|
||||
#ifndef __CYGWIN__
|
||||
Tcl_AppendToObj(path, pqSuffixes[j], -1);
|
||||
#endif
|
||||
Tcl_IncrRefCount(path);
|
||||
|
||||
/* Try to load a client library and resolve symbols within it. */
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
status = Tcl_LoadFile(interp, path, pqSymbolNames, 0,
|
||||
&pqStubsTable, &handle);
|
||||
Tcl_DecrRefCount(path);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Either we've successfully loaded a library (status == TCL_OK),
|
||||
* or we've run out of library names (in which case status==TCL_ERROR
|
||||
* and the error message reflects the last unsuccessful load attempt).
|
||||
*/
|
||||
Tcl_DecrRefCount(shlibext);
|
||||
if (status != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
85
pkgs/tdbcpostgres1.1.3/generic/pqStubs.h
Normal file
85
pkgs/tdbcpostgres1.1.3/generic/pqStubs.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
* ../generic/pqStubs.h --
|
||||
*
|
||||
* Stubs for procedures in pqStubDefs.txt
|
||||
*
|
||||
* Generated by genExtStubs.tcl: DO NOT EDIT
|
||||
* 2015-06-26 12:55:15Z
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct pqStubDefs {
|
||||
|
||||
/* Functions from libraries: pq */
|
||||
|
||||
const char* (*pg_encoding_to_charPtr)(int);
|
||||
void (*PQclearPtr)(PGresult*);
|
||||
int (*PQclientEncodingPtr)(const PGconn*);
|
||||
char* (*PQcmdTuplesPtr)(PGresult*);
|
||||
PGconn* (*PQconnectdbPtr)(const char*);
|
||||
char* (*PQerrorMessagePtr)(const PGconn*);
|
||||
PGresult* (*PQdescribePreparedPtr)(PGconn*, const char*);
|
||||
PGresult* (*PQexecPtr)(PGconn*, const char*);
|
||||
PGresult* (*PQexecPreparedPtr)(PGconn*, const char*, int, const char *const*, const int*, const int*, int);
|
||||
char* (*PQdbPtr)(const PGconn *);
|
||||
void (*PQfinishPtr)(PGconn*);
|
||||
char* (*PQfnamePtr)(PGresult*, int);
|
||||
int (*PQfnumberPtr)(const PGresult*, const char*);
|
||||
Oid (*PQftypePtr)(const PGresult*, int);
|
||||
int (*PQgetisnullPtr)(const PGresult*, int, int);
|
||||
int (*PQgetlengthPtr)(const PGresult*, int, int);
|
||||
char* (*PQgetvaluePtr)(const PGresult*, int, int);
|
||||
char* (*PQhostPtr)(const PGconn*);
|
||||
int (*PQnfieldsPtr)(const PGresult*);
|
||||
int (*PQnparamsPtr)(const PGresult*);
|
||||
int (*PQntuplesPtr)(const PGresult*);
|
||||
char* (*PQoptionsPtr)(const PGconn*);
|
||||
Oid (*PQparamtypePtr)(const PGresult*, int);
|
||||
char* (*PQpassPtr)(const PGconn*);
|
||||
char* (*PQportPtr)(const PGconn*);
|
||||
PGresult* (*PQpreparePtr)(PGconn*, const char*, const char*, int, const Oid*);
|
||||
char* (*PQresultErrorFieldPtr)(const PGresult*, int);
|
||||
ExecStatusType (*PQresultStatusPtr)(const PGresult*);
|
||||
int (*PQsetClientEncodingPtr)(PGconn*, const char*);
|
||||
PQnoticeProcessor (*PQsetNoticeProcessorPtr)(PGconn*, PQnoticeProcessor, void*);
|
||||
ConnStatusType (*PQstatusPtr)(PGconn*);
|
||||
char* (*PQuserPtr)(const PGconn*);
|
||||
char* (*PQttyPtr)(const PGconn*);
|
||||
} pqStubDefs;
|
||||
#define pg_encoding_to_char (pqStubs->pg_encoding_to_charPtr)
|
||||
#define PQclear (pqStubs->PQclearPtr)
|
||||
#define PQclientEncoding (pqStubs->PQclientEncodingPtr)
|
||||
#define PQcmdTuples (pqStubs->PQcmdTuplesPtr)
|
||||
#define PQconnectdb (pqStubs->PQconnectdbPtr)
|
||||
#define PQerrorMessage (pqStubs->PQerrorMessagePtr)
|
||||
#define PQdescribePrepared (pqStubs->PQdescribePreparedPtr)
|
||||
#define PQexec (pqStubs->PQexecPtr)
|
||||
#define PQexecPrepared (pqStubs->PQexecPreparedPtr)
|
||||
#define PQdb (pqStubs->PQdbPtr)
|
||||
#define PQfinish (pqStubs->PQfinishPtr)
|
||||
#define PQfname (pqStubs->PQfnamePtr)
|
||||
#define PQfnumber (pqStubs->PQfnumberPtr)
|
||||
#define PQftype (pqStubs->PQftypePtr)
|
||||
#define PQgetisnull (pqStubs->PQgetisnullPtr)
|
||||
#define PQgetlength (pqStubs->PQgetlengthPtr)
|
||||
#define PQgetvalue (pqStubs->PQgetvaluePtr)
|
||||
#define PQhost (pqStubs->PQhostPtr)
|
||||
#define PQnfields (pqStubs->PQnfieldsPtr)
|
||||
#define PQnparams (pqStubs->PQnparamsPtr)
|
||||
#define PQntuples (pqStubs->PQntuplesPtr)
|
||||
#define PQoptions (pqStubs->PQoptionsPtr)
|
||||
#define PQparamtype (pqStubs->PQparamtypePtr)
|
||||
#define PQpass (pqStubs->PQpassPtr)
|
||||
#define PQport (pqStubs->PQportPtr)
|
||||
#define PQprepare (pqStubs->PQpreparePtr)
|
||||
#define PQresultErrorField (pqStubs->PQresultErrorFieldPtr)
|
||||
#define PQresultStatus (pqStubs->PQresultStatusPtr)
|
||||
#define PQsetClientEncoding (pqStubs->PQsetClientEncodingPtr)
|
||||
#define PQsetNoticeProcessor (pqStubs->PQsetNoticeProcessorPtr)
|
||||
#define PQstatus (pqStubs->PQstatusPtr)
|
||||
#define PQuser (pqStubs->PQuserPtr)
|
||||
#define PQtty (pqStubs->PQttyPtr)
|
||||
MODULE_SCOPE const pqStubDefs *pqStubs;
|
||||
3460
pkgs/tdbcpostgres1.1.3/generic/tdbcpostgres.c
Normal file
3460
pkgs/tdbcpostgres1.1.3/generic/tdbcpostgres.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user