mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 23:19:19 +02:00
glfw integration
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -67,4 +67,5 @@ Debug/
|
||||
tmp/
|
||||
bin/
|
||||
ipch/
|
||||
ref/
|
||||
*.aps
|
||||
|
||||
38
Camera.cpp
38
Camera.cpp
@@ -61,8 +61,8 @@ void TCamera::OnCursorMove(double x, double y)
|
||||
void TCamera::Update()
|
||||
{
|
||||
// ABu: zmiana i uniezaleznienie predkosci od FPS
|
||||
double a = (Console::Pressed(VK_SHIFT) ? 5.00 : 1.00);
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
double a = ( Global::shiftState ? 5.00 : 1.00);
|
||||
if (Global::ctrlState)
|
||||
a = a * 100;
|
||||
// OldVelocity=Velocity;
|
||||
if (FreeFlyModeFlag == true)
|
||||
@@ -75,40 +75,6 @@ void TCamera::Update()
|
||||
Velocity.y += a;
|
||||
if (Console::Pressed(Global::Keys[k_MechDown]))
|
||||
Velocity.y -= a;
|
||||
// McZapkie-170402: zeby nie bylo konfliktow
|
||||
/*
|
||||
if (Console::Pressed(VkKeyScan('d')))
|
||||
Velocity.x+= a*Timer::GetDeltaTime();
|
||||
if (Console::Pressed(VkKeyScan('a')))
|
||||
Velocity.x-= a*Timer::GetDeltaTime();
|
||||
if (Console::Pressed(VkKeyScan('w')))
|
||||
Velocity.z-= a*Timer::GetDeltaTime();
|
||||
if (Console::Pressed(VkKeyScan('s')))
|
||||
Velocity.z+= a*Timer::GetDeltaTime();
|
||||
|
||||
if (Console::Pressed(VK_NUMPAD4) || Console::Pressed(VK_NUMPAD7) ||
|
||||
Console::Pressed(VK_NUMPAD1))
|
||||
Yaw+= +1*M_PI*Timer::GetDeltaTime();
|
||||
|
||||
if (Console::Pressed(VK_NUMPAD6) || Console::Pressed(VK_NUMPAD9) ||
|
||||
Console::Pressed(VK_NUMPAD3))
|
||||
Yaw+= -1*M_PI*Timer::GetDeltaTime();
|
||||
|
||||
if (Pressed(VK_NUMPAD2) || Console::Pressed(VK_NUMPAD1) ||
|
||||
Console::Pressed(VK_NUMPAD3))
|
||||
Pitch+= -1*M_PI*Timer::GetDeltaTime();
|
||||
|
||||
if (Console::Pressed(VK_NUMPAD8) || Console::Pressed(VK_NUMPAD7) ||
|
||||
Console::Pressed(VK_NUMPAD9))
|
||||
Pitch+= +1*M_PI*Timer::GetDeltaTime();
|
||||
if (Console::Pressed(VkKeyScan('.')))
|
||||
Roll+= -1*M_PI*Timer::GetDeltaTime();
|
||||
if (Console::Pressed(VkKeyScan(',')))
|
||||
Roll+= +1*M_PI*Timer::GetDeltaTime();
|
||||
|
||||
if (Console::Pressed(VK_NUMPAD5))
|
||||
Pitch=Roll= 0.0f;
|
||||
*/
|
||||
|
||||
// McZapkie-170402: poruszanie i rozgladanie we free takie samo jak w follow
|
||||
if (Console::Pressed(Global::Keys[k_MechRight]))
|
||||
|
||||
@@ -356,7 +356,10 @@ void Console::BitsUpdate(int mask)
|
||||
|
||||
bool Console::Pressed(int x)
|
||||
{ // na razie tak - czyta się tylko klawiatura
|
||||
return Global::bActive && (GetKeyState(x) < 0);
|
||||
if( glfwGetKey( Global::window, x ) == GLFW_TRUE )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
void Console::ValueSet(int x, double y)
|
||||
@@ -453,7 +456,7 @@ void Console::Update()
|
||||
else
|
||||
{ // błąd komunikacji - zapauzować symulację?
|
||||
if (!(Global::iPause & 8)) // jeśli jeszcze nie oflagowana
|
||||
Global::iTextMode = VK_F1; // pokazanie czasu/pauzy
|
||||
Global::iTextMode = GLFW_KEY_F1; // pokazanie czasu/pauzy
|
||||
Global::iPause |= 8; // tak???
|
||||
PoKeys55[0]->Connect(); // próba ponownego podłączenia
|
||||
}
|
||||
|
||||
Binary file not shown.
2
DynObj.h
2
DynObj.h
@@ -473,7 +473,7 @@ public: // modele składowe pojazdu
|
||||
// McZapkie-260202
|
||||
void LoadMMediaFile(std::string BaseDir, std::string TypeName, std::string ReplacableSkin);
|
||||
|
||||
inline double ABuGetDirection() // ABu.
|
||||
inline double ABuGetDirection() const // ABu.
|
||||
{
|
||||
return (Axle1.GetTrack() == MyTrack ? Axle1.GetDirection() : Axle0.GetDirection());
|
||||
};
|
||||
|
||||
838
EU07.cpp
838
EU07.cpp
@@ -21,10 +21,6 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
||||
|
||||
#include <dsound.h> //_clear87() itp.
|
||||
|
||||
#include "opengl/glew.h"
|
||||
#include "opengl/wglew.h"
|
||||
#include "opengl/ARB_Multisample.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Logs.h"
|
||||
#include "Console.h"
|
||||
@@ -32,484 +28,73 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
||||
#include "World.h"
|
||||
#include "Mover.h"
|
||||
|
||||
#pragma comment( lib, "glfw3dll.lib" )
|
||||
#pragma comment( lib, "glew32.lib" )
|
||||
#pragma comment( lib, "glu32.lib" )
|
||||
#pragma comment( lib, "opengl32.lib" )
|
||||
#pragma comment( lib, "glu32.lib" )
|
||||
#pragma comment( lib, "dsound.lib" )
|
||||
#pragma comment( lib, "winmm.lib" )
|
||||
#pragma comment( lib, "setupapi.lib" )
|
||||
#pragma comment( lib, "python27.lib" )
|
||||
#pragma comment (lib, "dbghelp.lib")
|
||||
|
||||
HDC hDC = NULL; // Private GDI Device Context
|
||||
HGLRC hRC = NULL; // Permanent Rendering Context
|
||||
HWND hWnd = NULL; // Holds Our Window Handle
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
|
||||
#endif
|
||||
|
||||
TWorld World;
|
||||
|
||||
// bool active=TRUE; //window active flag set to TRUE by default
|
||||
bool fullscreen = TRUE; // fullscreen flag set to fullscreen mode by default
|
||||
int WindowWidth = 800;
|
||||
int WindowHeight = 600;
|
||||
int Bpp = 32;
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc
|
||||
|
||||
//#include "dbgForm.h"
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
|
||||
{
|
||||
// _clear87();
|
||||
// _control87(MCW_EM, MCW_EM);
|
||||
glewInit();
|
||||
|
||||
if( !GLEW_VERSION_1_4 ) {
|
||||
// experimental: require at least openGL 1.4
|
||||
Error( "This application requires openGL version 1.4 (or better)" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// hunter-271211: przeniesione
|
||||
// AllocConsole();
|
||||
// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
|
||||
|
||||
// ShaXbee-121209: Wlaczenie obslugi tablic wierzcholkow
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
Global::pWorld = &World; // Ra: wskaźnik potrzebny do usuwania pojazdów
|
||||
return World.Init(hWnd, hDC); // true jeśli wszystko pójdzie dobrze
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // resize and initialize the GL Window
|
||||
{
|
||||
Global::ScreenWidth = WindowWidth = width;
|
||||
Global::ScreenHeight = WindowHeight = height;
|
||||
if (height == 0) // prevent a divide by zero by
|
||||
height = 1; // making height equal one
|
||||
glViewport(0, 0, width, height); // Reset The Current Viewport
|
||||
/*
|
||||
glMatrixMode(GL_PROJECTION); // select the Projection Matrix
|
||||
glLoadIdentity(); // reset the Projection Matrix
|
||||
// calculate the aspect ratio of the window
|
||||
gluPerspective(45.0f, (GLdouble)width / (GLdouble)height, 0.2f, 2500.0f);
|
||||
glMatrixMode(GL_MODELVIEW); // select the Modelview Matrix
|
||||
glLoadIdentity(); // reset the Modelview Matrix
|
||||
*/
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
GLvoid KillGLWindow(GLvoid) // properly kill the window
|
||||
{
|
||||
if (hRC) // Do We Have A Rendering Context?
|
||||
{
|
||||
if (!wglMakeCurrent(NULL, NULL)) // are we able to release the DC and RC contexts?
|
||||
{
|
||||
ErrorLog("Fail: window releasing");
|
||||
MessageBox(NULL, "Release of DC and RC failed.", "SHUTDOWN ERROR",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
if (!wglDeleteContext(hRC)) // are we able to delete the RC?
|
||||
{
|
||||
ErrorLog("Fail: rendering context releasing");
|
||||
MessageBox(NULL, "Release rendering context failed.", "SHUTDOWN ERROR",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
hRC = NULL; // set RC to NULL
|
||||
}
|
||||
|
||||
if (hDC && !ReleaseDC(hWnd, hDC)) // are we able to release the DC?
|
||||
{
|
||||
ErrorLog("Fail: device context releasing");
|
||||
MessageBox(NULL, "Release device context failed.", "SHUTDOWN ERROR",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
hDC = NULL; // set DC to NULL
|
||||
}
|
||||
|
||||
if (hWnd && !DestroyWindow(hWnd)) // are we able to destroy the window?
|
||||
{
|
||||
ErrorLog("Fail: window destroying");
|
||||
MessageBox(NULL, "Could not release hWnd.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
|
||||
hWnd = NULL; // set hWnd to NULL
|
||||
}
|
||||
|
||||
if (fullscreen) // Are We In Fullscreen Mode?
|
||||
{
|
||||
ChangeDisplaySettings(NULL, 0); // if so switch back to the desktop
|
||||
ShowCursor(TRUE); // show mouse pointer
|
||||
}
|
||||
// KillFont();
|
||||
}
|
||||
|
||||
/* This code creates our OpenGL Window. Parameters are: *
|
||||
* title - title to appear at the top of the window *
|
||||
* width - width of the GL Window or fullscreen mode *
|
||||
* height - height of the GL Window or fullscreen mode *
|
||||
* bits - number of bits to use for color (8/16/24/32) *
|
||||
* fullscreenflag - use fullscreen mode (TRUE) or windowed mode (FALSE) */
|
||||
|
||||
BOOL CreateGLWindow(char *title, int width, int height, int bits, bool fullscreenflag)
|
||||
{
|
||||
GLuint PixelFormat; // holds the results after searching for a match
|
||||
HINSTANCE hInstance; // holds the instance of the application
|
||||
WNDCLASS wc; // windows class structure
|
||||
DWORD dwExStyle; // window extended style
|
||||
DWORD dwStyle; // window style
|
||||
RECT WindowRect; // grabs rectangle upper left / lower right values
|
||||
WindowRect.left = (long)0; // set left value to 0
|
||||
WindowRect.right = (long)width; // set right value to requested width
|
||||
WindowRect.top = (long)0; // set top value to 0
|
||||
WindowRect.bottom = (long)height; // set bottom value to requested height
|
||||
|
||||
fullscreen = fullscreenflag; // set the global fullscreen flag
|
||||
|
||||
hInstance = GetModuleHandle(NULL); // grab an instance for our window
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // redraw on size, and own DC for window.
|
||||
wc.lpfnWndProc = (WNDPROC)WndProc; // wndproc handles messages
|
||||
wc.cbClsExtra = 0; // no extra window data
|
||||
wc.cbWndExtra = 0; // no extra window data
|
||||
wc.hInstance = hInstance; // set the instance
|
||||
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // load the default icon
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // load the arrow pointer
|
||||
wc.hbrBackground = NULL; // no background required for GL
|
||||
wc.lpszMenuName = NULL; // we don't want a menu
|
||||
wc.lpszClassName = "EU07"; // nazwa okna do komunikacji zdalnej
|
||||
// // Set The Class Name
|
||||
|
||||
if (!arbMultisampleSupported) // tylko dla pierwszego okna
|
||||
if (!RegisterClass(&wc)) // Attempt To Register The Window Class
|
||||
{
|
||||
ErrorLog("Fail: window class registeration");
|
||||
MessageBox(NULL, "Failed to register the window class.", "ERROR",
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
|
||||
if (fullscreen) // Attempt Fullscreen Mode?
|
||||
{
|
||||
DEVMODE dmScreenSettings; // device mode
|
||||
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // makes sure memory's cleared
|
||||
dmScreenSettings.dmSize = sizeof(dmScreenSettings); // size of the devmode structure
|
||||
|
||||
// tolaris-240403: poprawka na odswiezanie monitora
|
||||
// locate primary monitor...
|
||||
if (Global::bAdjustScreenFreq)
|
||||
{
|
||||
POINT point;
|
||||
point.x = 0;
|
||||
point.y = 0;
|
||||
MONITORINFOEX monitorinfo;
|
||||
monitorinfo.cbSize = sizeof(MONITORINFOEX);
|
||||
::GetMonitorInfo(::MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY), &monitorinfo);
|
||||
// ..and query for highest supported refresh rate
|
||||
unsigned int refreshrate = 0;
|
||||
int i = 0;
|
||||
while (::EnumDisplaySettings(monitorinfo.szDevice, i, &dmScreenSettings))
|
||||
{
|
||||
if (i > 0)
|
||||
if (dmScreenSettings.dmPelsWidth == (unsigned int)width)
|
||||
if (dmScreenSettings.dmPelsHeight == (unsigned int)height)
|
||||
if (dmScreenSettings.dmBitsPerPel == (unsigned int)bits)
|
||||
if (dmScreenSettings.dmDisplayFrequency > refreshrate)
|
||||
refreshrate = dmScreenSettings.dmDisplayFrequency;
|
||||
++i;
|
||||
}
|
||||
// fill refresh rate info for screen mode change
|
||||
dmScreenSettings.dmDisplayFrequency = refreshrate;
|
||||
dmScreenSettings.dmFields = DM_DISPLAYFREQUENCY;
|
||||
}
|
||||
dmScreenSettings.dmPelsWidth = width; // selected screen width
|
||||
dmScreenSettings.dmPelsHeight = height; // selected screen height
|
||||
dmScreenSettings.dmBitsPerPel = bits; // selected bits per pixel
|
||||
dmScreenSettings.dmFields =
|
||||
dmScreenSettings.dmFields | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
// Try to set selected mode and get results. NOTE: CDS_FULLSCREEN gets rid of start bar.
|
||||
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
// If the mode fails, offer two options. Quit or use windowed mode.
|
||||
ErrorLog("Fail: full screen");
|
||||
if (MessageBox(NULL, "The requested fullscreen mode is not supported by\nyour video "
|
||||
"card. Use windowed mode instead?",
|
||||
"EU07", MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
|
||||
{
|
||||
fullscreen = FALSE; // Windowed Mode Selected. Fullscreen = FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pop Up A Message Box Letting User Know The Program Is Closing.
|
||||
Error("Program will now close.");
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fullscreen) // Are We Still In Fullscreen Mode?
|
||||
{
|
||||
dwExStyle = WS_EX_APPWINDOW; // Window Extended Style
|
||||
dwStyle = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // Windows Style
|
||||
ShowCursor(FALSE); // Hide Mouse Pointer
|
||||
}
|
||||
else
|
||||
{
|
||||
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window Extended Style
|
||||
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // Windows Style
|
||||
}
|
||||
|
||||
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE,
|
||||
dwExStyle); // Adjust Window To True Requested Size
|
||||
|
||||
// Create The Window
|
||||
if (NULL ==
|
||||
(hWnd = CreateWindowEx(dwExStyle, // Extended Style For The Window
|
||||
"EU07", // Class Name
|
||||
title, // Window Title
|
||||
dwStyle | // Defined Window Style
|
||||
WS_CLIPSIBLINGS | // Required Window Style
|
||||
WS_CLIPCHILDREN, // Required Window Style
|
||||
0,
|
||||
0, // Window Position
|
||||
WindowRect.right - WindowRect.left, // Calculate Window Width
|
||||
WindowRect.bottom - WindowRect.top, // Calculate Window Height
|
||||
NULL, // No Parent Window
|
||||
NULL, // No Menu
|
||||
hInstance, // Instance
|
||||
NULL))) // Dont Pass Anything To WM_CREATE
|
||||
{
|
||||
KillGLWindow(); // Reset The Display
|
||||
ErrorLog("Fail: window creation");
|
||||
MessageBox(NULL, "Window creation error.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
|
||||
static PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||
1, // Version Number
|
||||
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||
PFD_DOUBLEBUFFER, // Must Support Double Buffering
|
||||
PFD_TYPE_RGBA, // Request An RGBA Format
|
||||
bits, // Select Our Color Depth
|
||||
0,
|
||||
0, 0, 0, 0, 0, // Color Bits Ignored
|
||||
0, // No Alpha Buffer
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
24, // 32Bit Z-Buffer (Depth Buffer)
|
||||
0, // No Stencil Buffer
|
||||
0, // No Auxiliary Buffer
|
||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
0, // Reserved
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
};
|
||||
|
||||
if (NULL == (hDC = GetDC(hWnd))) // Did We Get A Device Context?
|
||||
{
|
||||
KillGLWindow(); // Reset The Display
|
||||
ErrorLog("Fail: device context");
|
||||
MessageBox(NULL, "Can't create a GL device context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
|
||||
/*
|
||||
Our first pass, Multisampling hasn't been created yet, so we create a window normally
|
||||
If it is supported, then we're on our second pass
|
||||
that means we want to use our pixel format for sampling
|
||||
so set PixelFormat to arbMultiSampleformat instead
|
||||
*/
|
||||
if (!arbMultisampleSupported)
|
||||
{
|
||||
if (NULL == (PixelFormat =
|
||||
ChoosePixelFormat(hDC, &pfd))) // Did Windows Find A Matching Pixel Format?
|
||||
{
|
||||
KillGLWindow(); // Reset The Display
|
||||
ErrorLog("Fail: pixelformat");
|
||||
MessageBox(NULL, "Can't find a suitable pixelformat.", "ERROR",
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
}
|
||||
else
|
||||
PixelFormat = arbMultisampleFormat;
|
||||
|
||||
if (!SetPixelFormat(hDC, PixelFormat, &pfd)) // Are We Able To Set The Pixel Format?
|
||||
{
|
||||
KillGLWindow(); // Reset The Display
|
||||
ErrorLog("Fail: pixelformat");
|
||||
MessageBox(NULL, "Can't set the pixelformat.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
|
||||
if (NULL == (hRC = wglCreateContext(hDC))) // Are We Able To Get A Rendering Context?
|
||||
{
|
||||
KillGLWindow(); // Reset The Display
|
||||
ErrorLog("Fail: OpenGL rendering context creation");
|
||||
MessageBox(NULL, "Can't create a GL rendering context.", "ERROR",
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(hDC, hRC)) // Try To Activate The Rendering Context
|
||||
{
|
||||
KillGLWindow(); // Reset The Display
|
||||
ErrorLog("Fail: OpenGL rendering context activation");
|
||||
MessageBox(NULL, "Can't activate the GL rendering context.", "ERROR",
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // Return FALSE
|
||||
}
|
||||
|
||||
/*
|
||||
Now that our window is created, we want to queary what samples are available
|
||||
we call our InitMultiSample window
|
||||
if we return a valid context, we want to destroy our current window
|
||||
and create a new one using the multisample interface.
|
||||
*/
|
||||
if (Global::iMultisampling)
|
||||
if (!arbMultisampleSupported)
|
||||
if ((Global::iMultisampling =
|
||||
InitMultisample(hInstance, hWnd, pfd, 1 << Global::iMultisampling)) != 0)
|
||||
{
|
||||
// WriteConsoleOnly("Opening second window for multisampling of
|
||||
// "+AnsiString(Global::iMultisampling)+" samples.");
|
||||
KillGLWindow(); // reset the display
|
||||
return CreateGLWindow(title, width, height, bits, fullscreenflag); // rekurencja
|
||||
}
|
||||
|
||||
ShowWindow(hWnd, SW_SHOW); // show the window
|
||||
SetForegroundWindow(hWnd); // slightly higher priority
|
||||
SetFocus(hWnd); // sets keyboard focus to the window
|
||||
ReSizeGLScene(width, height); // set up our perspective GL screen
|
||||
|
||||
if (!InitGL()) // initialize our newly created GL Window
|
||||
{
|
||||
KillGLWindow(); // reset the display
|
||||
ErrorLog("Fail: OpenGL initialization");
|
||||
MessageBox(NULL, "Initialization Failed.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE; // return FALSE
|
||||
}
|
||||
return TRUE; // success
|
||||
}
|
||||
|
||||
static int mx = 0, my = 0;
|
||||
static POINT mouse;
|
||||
|
||||
static int test = 0;
|
||||
/**/
|
||||
// ************ Globals ************
|
||||
//
|
||||
#define MYDISPLAY 1
|
||||
|
||||
PCOPYDATASTRUCT pDane;
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, // handle for this window
|
||||
UINT uMsg, // message for this window
|
||||
WPARAM wParam, // additional message information
|
||||
LPARAM lParam) // additional message information
|
||||
void window_resize_callback( GLFWwindow *window, int w, int h )
|
||||
{
|
||||
RECT rect;
|
||||
switch (uMsg) // check for windows messages
|
||||
{
|
||||
case WM_PASTE: //[Ctrl]+[V] potrzebujemy do innych celów
|
||||
return 0;
|
||||
case WM_COPYDATA: // obsługa danych przesłanych przez program sterujący
|
||||
pDane = (PCOPYDATASTRUCT)lParam;
|
||||
if (pDane->dwData == 'EU07') // sygnatura danych
|
||||
World.OnCommandGet((DaneRozkaz *)(pDane->lpData));
|
||||
break;
|
||||
case WM_ACTIVATE: // watch for window activate message
|
||||
// case WM_ACTIVATEAPP:
|
||||
{ // Ra: uzależnienie aktywności od bycia na wierzchu
|
||||
Global::bActive = (LOWORD(wParam) != WA_INACTIVE);
|
||||
if (Global::bInactivePause) // jeśli ma być pauzowanie okna w tle
|
||||
if (Global::bActive)
|
||||
Global::iPause &= ~4; // odpauzowanie, gdy jest na pierwszym planie
|
||||
else
|
||||
Global::iPause |= 4; // włączenie pauzy, gdy nieaktywy
|
||||
if (Global::bActive)
|
||||
SetCursorPos(mx, my);
|
||||
ShowCursor(!Global::bActive);
|
||||
/*
|
||||
if (!HIWORD(wParam)) //check minimization state
|
||||
active=TRUE; //program is active
|
||||
else
|
||||
active=FALSE; //program is no longer active
|
||||
*/
|
||||
return 0; // return to the message loop
|
||||
}
|
||||
case WM_SYSCOMMAND: // intercept system commands
|
||||
{
|
||||
switch (wParam) // check system calls
|
||||
{
|
||||
case 61696: // F10
|
||||
World.OnKeyDown(VK_F10);
|
||||
return 0;
|
||||
case SC_SCREENSAVE: // screensaver trying to start?
|
||||
case SC_MONITORPOWER: // monitor trying to enter powersave?
|
||||
return 0; // prevent from happening
|
||||
}
|
||||
break; // exit
|
||||
Global::ScreenWidth = w;
|
||||
Global::ScreenHeight = h;
|
||||
::glViewport( 0, 0, w, h );
|
||||
}
|
||||
|
||||
void cursor_pos_callback( GLFWwindow *window, double x, double y )
|
||||
{
|
||||
World.OnMouseMove( x * 0.005, y * 0.01 );
|
||||
::glfwSetCursorPos( window, 0.0, 0.0 );
|
||||
}
|
||||
|
||||
void key_callback( GLFWwindow *window, int key, int scancode, int action, int mods )
|
||||
{
|
||||
Global::shiftState = ( mods & GLFW_MOD_SHIFT ) ? true : false;
|
||||
Global::ctrlState = ( mods & GLFW_MOD_CONTROL ) ? true : false;
|
||||
|
||||
if( ( key == GLFW_KEY_LEFT_SHIFT )
|
||||
|| ( key == GLFW_KEY_LEFT_CONTROL )
|
||||
|| ( key == GLFW_KEY_LEFT_ALT )
|
||||
|| ( key == GLFW_KEY_RIGHT_SHIFT )
|
||||
|| ( key == GLFW_KEY_RIGHT_CONTROL )
|
||||
|| ( key == GLFW_KEY_RIGHT_ALT ) ) {
|
||||
// don't bother passing these
|
||||
return;
|
||||
}
|
||||
case WM_CLOSE: // did we receive a close message?
|
||||
|
||||
if( action == GLFW_PRESS || action == GLFW_REPEAT )
|
||||
{
|
||||
PostQuitMessage(0); // send a quit message [Alt]+[F4]
|
||||
return 0; // jump back
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
// mx= 100;//Global::iWindowWidth/2;
|
||||
// my= 100;//Global::iWindowHeight/2;
|
||||
// SetCursorPos(Global::iWindowWidth/2,Global::iWindowHeight/2);
|
||||
// m_x= LOWORD(lParam);
|
||||
// m_y= HIWORD(lParam);
|
||||
GetCursorPos(&mouse);
|
||||
if (Global::bActive && ((mouse.x != mx) || (mouse.y != my)))
|
||||
World.OnKeyDown( key );
|
||||
|
||||
switch( key )
|
||||
{
|
||||
World.OnMouseMove(double(mouse.x - mx) * 0.005, double(mouse.y - my) * 0.01);
|
||||
SetCursorPos(mx, my);
|
||||
}
|
||||
return 0; // jump back
|
||||
}
|
||||
case WM_KEYUP:
|
||||
if (Global::bActive)
|
||||
{
|
||||
World.OnKeyUp(wParam);
|
||||
return 0;
|
||||
}
|
||||
case WM_KEYDOWN:
|
||||
if (Global::bActive)
|
||||
{
|
||||
if (wParam != 17) // bo naciśnięcia [Ctrl] nie ma po co przekazywać
|
||||
if (wParam != 145) //[Scroll Lock] też nie
|
||||
World.OnKeyDown(wParam);
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_ESCAPE: //[Esc] pauzuje tylko bez Debugmode
|
||||
if (DebugModeFlag)
|
||||
case GLFW_KEY_ESCAPE: {
|
||||
//[Esc] pauzuje tylko bez Debugmode
|
||||
if( DebugModeFlag )
|
||||
break;
|
||||
case 19: //[Pause]
|
||||
if (Global::iPause & 1) // jeśli pauza startowa
|
||||
|
||||
if( Global::iPause & 1 ) // jeśli pauza startowa
|
||||
Global::iPause &= ~1; // odpauzowanie, gdy po wczytaniu miało nie startować
|
||||
else if (!(Global::iMultiplayer & 2)) // w multiplayerze pauza nie ma sensu
|
||||
if (!Console::Pressed(VK_CONTROL)) // z [Ctrl] to radiostop jest
|
||||
// Ra: poniższe nie ma sensu, bo brak komunikacji natychmiast zapauzuje
|
||||
// ponownie
|
||||
// if (Global::iPause&8) //jeśli pauza związana z brakiem komunikacji z
|
||||
// PoKeys
|
||||
// Global::iPause&=~10; //odpauzowanie pauzy PoKeys (chyba nic nie da) i
|
||||
// ewentualnie klawiszowej również
|
||||
// else
|
||||
else if( !( Global::iMultiplayer & 2 ) ) // w multiplayerze pauza nie ma sensu
|
||||
if( !Global::ctrlState ) // z [Ctrl] to radiostop jest
|
||||
Global::iPause ^= 2; // zmiana stanu zapauzowania
|
||||
if (Global::iPause) // jak pauza
|
||||
Global::iTextMode = VK_F1; // to wyświetlić zegar i informację
|
||||
if( Global::iPause ) // jak pauza
|
||||
Global::iTextMode = GLFW_KEY_F1; // to wyświetlić zegar i informację
|
||||
break;
|
||||
case VK_F7:
|
||||
if (DebugModeFlag)
|
||||
{ // siatki wyświetlane tyko w trybie testowym
|
||||
}
|
||||
case GLFW_KEY_F7:
|
||||
if( DebugModeFlag ) { // siatki wyświetlane tyko w trybie testowym
|
||||
Global::bWireFrame = !Global::bWireFrame;
|
||||
if( true == Global::bWireFrame ) {
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||
@@ -521,69 +106,52 @@ LRESULT CALLBACK WndProc(HWND hWnd, // handle for this window
|
||||
// Ra: jeszcze usunąć siatki ze skompilowanych obiektów!
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0; // jump back
|
||||
case WM_CHAR:
|
||||
}
|
||||
else if( action == GLFW_RELEASE )
|
||||
{
|
||||
/*
|
||||
switch ((TCHAR) wParam)
|
||||
{
|
||||
// case 'q':
|
||||
// done= true;
|
||||
// KillGLWindow();
|
||||
// PostQuitMessage(0);
|
||||
// DestroyWindow( hWnd );
|
||||
// break;
|
||||
};
|
||||
*/
|
||||
return 0;
|
||||
World.OnKeyUp( key );
|
||||
}
|
||||
case WM_SIZE: // resize the OpenGL window
|
||||
{
|
||||
ReSizeGLScene(LOWORD(lParam), HIWORD(lParam)); // LoWord=Width, HiWord=Height
|
||||
if (GetWindowRect(hWnd, &rect))
|
||||
{ // Ra: zmiana rozmiaru okna bez przesuwania myszy
|
||||
// mx=WindowWidth/2+rect.left; // horizontal position
|
||||
// my=WindowHeight/2+rect.top; // vertical position
|
||||
// SetCursorPos(mx,my);
|
||||
}
|
||||
return 0; // jump back
|
||||
}
|
||||
case WM_MOVE: // przesuwanie okna?
|
||||
{
|
||||
mx = WindowWidth / 2 + LOWORD(lParam); // horizontal position
|
||||
my = WindowHeight / 2 + HIWORD(lParam); // vertical position
|
||||
// SetCursorPos(mx,my);
|
||||
break;
|
||||
}
|
||||
case WM_PAINT:
|
||||
{ // odrysowanie okna
|
||||
break;
|
||||
}
|
||||
// case WM_ERASEBKGND: //Process this message to keep Windows from erasing background.
|
||||
case MM_JOY1BUTTONDOWN:
|
||||
{
|
||||
// WriteLog("Joystick button "+AnsiString(wParam));
|
||||
break;
|
||||
}
|
||||
case WM_CREATE:
|
||||
/* Capture the joystick. If this fails, beep and display
|
||||
* error, then quit.
|
||||
*/
|
||||
if (joySetCapture(hWnd, JOYSTICKID1, 0, FALSE))
|
||||
{
|
||||
// MessageBeep(MB_ICONEXCLAMATION);
|
||||
// MessageBox(hWnd,"Couldn't capture the joystick",NULL,MB_OK|MB_ICONEXCLAMATION);
|
||||
// return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// pass all unhandled messages to DefWindowProc
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
};
|
||||
}
|
||||
|
||||
void focus_callback( GLFWwindow *window, int focus )
|
||||
{
|
||||
if( Global::bInactivePause ) // jeśli ma być pauzowanie okna w tle
|
||||
if( focus )
|
||||
Global::iPause &= ~4; // odpauzowanie, gdy jest na pierwszym planie
|
||||
else
|
||||
Global::iPause |= 4; // włączenie pauzy, gdy nieaktywy
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
extern "C"
|
||||
{
|
||||
GLFWAPI HWND glfwGetWin32Window( GLFWwindow* window );
|
||||
}
|
||||
|
||||
HWND Hwnd;
|
||||
WNDPROC BaseWindowProc;
|
||||
|
||||
LRESULT APIENTRY WndProc( HWND hWnd, // handle for this window
|
||||
UINT uMsg, // message for this window
|
||||
WPARAM wParam, // additional message information
|
||||
LPARAM lParam) // additional message information
|
||||
{
|
||||
switch( uMsg ) // check for windows messages
|
||||
{
|
||||
case WM_COPYDATA: {
|
||||
// obsługa danych przesłanych przez program sterujący
|
||||
pDane = (PCOPYDATASTRUCT)lParam;
|
||||
if( pDane->dwData == 'EU07' ) // sygnatura danych
|
||||
World.OnCommandGet( (DaneRozkaz *)( pDane->lpData ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// pass all unhandled messages to DefWindowProc
|
||||
return CallWindowProc( BaseWindowProc, Hwnd, uMsg, wParam, lParam );
|
||||
};
|
||||
|
||||
void make_minidump( ::EXCEPTION_POINTERS* e ) {
|
||||
|
||||
auto hDbgHelp = ::LoadLibraryA( "dbghelp" );
|
||||
@@ -632,14 +200,11 @@ LONG CALLBACK unhandled_handler( ::EXCEPTION_POINTERS* e ) {
|
||||
}
|
||||
#endif
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, // instance
|
||||
HINSTANCE hPrevInstance, // previous instance
|
||||
LPSTR lpCmdLine, // command line parameters
|
||||
int nCmdShow) // window show state
|
||||
{
|
||||
int main( int argc, char *argv[] ) {
|
||||
|
||||
#if defined(_MSC_VER) && defined (_DEBUG)
|
||||
// memory leaks
|
||||
_CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF );
|
||||
_CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF );
|
||||
// floating point operation errors
|
||||
auto state = _clearfp();
|
||||
state = _control87( 0, 0 );
|
||||
@@ -650,138 +215,133 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
|
||||
::SetUnhandledExceptionFilter( unhandled_handler );
|
||||
#endif
|
||||
|
||||
MSG msg; // windows message structure
|
||||
BOOL done = FALSE; // bool variable to exit loop
|
||||
fullscreen = true;
|
||||
DeleteFile("errors.txt"); // usunięcie starego
|
||||
Global::LoadIniFile("eu07.ini"); // teraz dopiero można przejrzeć plik z ustawieniami
|
||||
Global::InitKeys("keys.ini"); // wczytanie mapowania klawiszy - jest na stałe
|
||||
if( !glfwInit() )
|
||||
return -1;
|
||||
|
||||
// hunter-271211: ukrywanie konsoli
|
||||
if (Global::iWriteLogEnabled & 2)
|
||||
{
|
||||
DeleteFile( "errors.txt" );
|
||||
Global::LoadIniFile( "eu07.ini" );
|
||||
Global::InitKeys();
|
||||
|
||||
// hunter-271211: ukrywanie konsoli
|
||||
if( Global::iWriteLogEnabled & 2 ) {
|
||||
AllocConsole();
|
||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
|
||||
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), FOREGROUND_GREEN );
|
||||
}
|
||||
std::string commandline( lpCmdLine ); // parametry uruchomienia
|
||||
if( false == commandline.empty() )
|
||||
{ // analizowanie parametr�w
|
||||
cParser parser( commandline );
|
||||
std::string token;
|
||||
do {
|
||||
parser.getTokens();
|
||||
token.clear();
|
||||
parser >> token;
|
||||
|
||||
if( token == "-s" )
|
||||
{ // nazwa scenerii
|
||||
parser.getTokens();
|
||||
parser >> Global::SceneryFile;
|
||||
}
|
||||
else if( token == "-v")
|
||||
{ // nazwa wybranego pojazdu
|
||||
parser.getTokens();
|
||||
parser >> Global::asHumanCtrlVehicle;
|
||||
}
|
||||
else if( token == "-modifytga" )
|
||||
{ // wykonanie modyfikacji wszystkich plików TGA
|
||||
Global::iModifyTGA = -1; // specjalny tryb wykonania totalnej modyfikacji
|
||||
}
|
||||
else if( token == "-e3d" )
|
||||
{ // wygenerowanie wszystkich plików E3D
|
||||
if (Global::iConvertModels > 0)
|
||||
Global::iConvertModels = -Global::iConvertModels; // specjalny tryb
|
||||
else
|
||||
Global::iConvertModels = -7; // z optymalizacją, bananami i prawidłowym Opacity
|
||||
}
|
||||
for( int i = 1; i < argc; i++ ) {
|
||||
std::string token( argv[ i ] );
|
||||
|
||||
if( token == "-modifytga" )
|
||||
Global::iModifyTGA = -1;
|
||||
else if( token == "-e3d" ) {
|
||||
if( Global::iConvertModels > 0 )
|
||||
Global::iConvertModels = -Global::iConvertModels;
|
||||
else
|
||||
Error(
|
||||
"Program usage: EU07 [-s sceneryfilepath] [-v vehiclename] [-modifytga] [-e3d]",
|
||||
!Global::iWriteLogEnabled);
|
||||
}
|
||||
while( false == token.empty() );
|
||||
Global::iConvertModels = -7; // z optymalizacją, bananami i prawidłowym Opacity
|
||||
}
|
||||
else if( i + 1 < argc && token == "-s" )
|
||||
Global::SceneryFile = std::string( argv[ ++i ] );
|
||||
else if( i + 1 < argc && token == "-v" ) {
|
||||
std::string v( argv[ ++i ] );
|
||||
std::transform( v.begin(), v.end(), v.begin(), ::tolower );
|
||||
Global::asHumanCtrlVehicle = v;
|
||||
}
|
||||
else {
|
||||
std::cout << "usage: " << std::string( argv[ 0 ] ) << " [-s sceneryfilepath] "
|
||||
<< "[-v vehiclename] [-modifytga] [-e3d]" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* MC: usunalem tymczasowo bo sie gryzlo z nowym parserem - 8.6.2003
|
||||
AnsiString csp=AnsiString(Global::szSceneryFile);
|
||||
csp=csp.Delete(csp.Pos(AnsiString(strrchr(Global::szSceneryFile,'/')))+1,csp.Length());
|
||||
Global::asCurrentSceneryPath=csp;
|
||||
*/
|
||||
|
||||
fullscreen = Global::bFullScreen;
|
||||
WindowWidth = Global::iWindowWidth;
|
||||
WindowHeight = Global::iWindowHeight;
|
||||
Bpp = Global::iBpp;
|
||||
if (Bpp != 32)
|
||||
Bpp = 16;
|
||||
// create our OpenGL window
|
||||
if (!CreateGLWindow(const_cast<char*>(Global::asHumanCtrlVehicle.c_str()), WindowWidth, WindowHeight, Bpp,
|
||||
fullscreen))
|
||||
return 0; // quit if window was not created
|
||||
SetForegroundWindow(hWnd);
|
||||
// match requested video mode to current to allow for
|
||||
// fullwindow creation when resolution is the same
|
||||
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||
const GLFWvidmode *vmode = glfwGetVideoMode( monitor );
|
||||
|
||||
glfwWindowHint( GLFW_RED_BITS, vmode->redBits );
|
||||
glfwWindowHint( GLFW_GREEN_BITS, vmode->greenBits );
|
||||
glfwWindowHint( GLFW_BLUE_BITS, vmode->blueBits );
|
||||
glfwWindowHint( GLFW_REFRESH_RATE, vmode->refreshRate );
|
||||
|
||||
glfwWindowHint( GLFW_AUTO_ICONIFY, GLFW_FALSE );
|
||||
glfwWindowHint( GLFW_SAMPLES, 1 << Global::iMultisampling );
|
||||
|
||||
if( Global::bFullScreen ) {
|
||||
// match screen dimensions with selected monitor, for 'borderless window' in fullscreen mode
|
||||
Global::iWindowWidth = vmode->width;
|
||||
Global::iWindowHeight = vmode->height;
|
||||
}
|
||||
|
||||
GLFWwindow *window =
|
||||
glfwCreateWindow( Global::iWindowWidth, Global::iWindowHeight,
|
||||
"EU07", Global::bFullScreen ? monitor : nullptr, nullptr );
|
||||
|
||||
if( !window ) {
|
||||
std::cout << "failed to create window" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
glfwMakeContextCurrent( window );
|
||||
glfwSwapInterval( 0 ); //vsync // NOTE: disabled, as slight drop below refresh rate seems to cause drastic drop in framerate
|
||||
glfwSetInputMode( window, GLFW_CURSOR, GLFW_CURSOR_DISABLED ); //capture cursor
|
||||
glfwSetCursorPos( window, 0.0, 0.0 );
|
||||
glfwSetFramebufferSizeCallback( window, window_resize_callback );
|
||||
glfwSetCursorPosCallback( window, cursor_pos_callback );
|
||||
glfwSetKeyCallback( window, key_callback );
|
||||
glfwSetWindowFocusCallback( window, focus_callback );
|
||||
{
|
||||
int width, height;
|
||||
glfwGetFramebufferSize( window, &width, &height );
|
||||
window_resize_callback( window, width, height );
|
||||
}
|
||||
|
||||
if( glewInit() != GLEW_OK ) {
|
||||
std::cout << "failed to init GLEW" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
// setup wrapper for base glfw window proc, to handle copydata messages
|
||||
Hwnd = glfwGetWin32Window( window );
|
||||
BaseWindowProc = (WNDPROC)::SetWindowLongPtr( Hwnd, GWLP_WNDPROC, (LONG)WndProc );
|
||||
// switch off the topmost flag
|
||||
::SetWindowPos( Hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
|
||||
#endif
|
||||
|
||||
GfxRenderer.Init();
|
||||
|
||||
// McZapkie: proba przeplukania klawiatury
|
||||
Global::pWorld = &World; // Ra: wskaźnik potrzebny do usuwania pojazdów
|
||||
if( !World.Init( window ) ) {
|
||||
std::cout << "failed to init TWorld" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Console *pConsole = new Console(); // Ra: nie wiem, czy ma to sens, ale jakoś zainicjowac trzeba
|
||||
while (Console::Pressed(VK_F10))
|
||||
Error("Keyboard buffer problem - press F10"); // na Windows 98 lubi się to pojawiać
|
||||
int iOldSpeed, iOldDelay;
|
||||
SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &iOldSpeed, 0);
|
||||
SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &iOldDelay, 0);
|
||||
SystemParametersInfo(SPI_SETKEYBOARDSPEED, 20, NULL, 0);
|
||||
// SystemParametersInfo(SPI_SETKEYBOARDDELAY,10,NULL,0);
|
||||
if (!joyGetNumDevs())
|
||||
WriteLog("No joystick");
|
||||
if (Global::iModifyTGA < 0)
|
||||
{ // tylko modyfikacja TGA, bez uruchamiania symulacji
|
||||
|
||||
if( !joyGetNumDevs() )
|
||||
WriteLog( "No joystick" );
|
||||
if( Global::iModifyTGA < 0 ) { // tylko modyfikacja TGA, bez uruchamiania symulacji
|
||||
Global::iMaxTextureSize = 64; //żeby nie zamulać pamięci
|
||||
World.ModifyTGA(); // rekurencyjne przeglądanie katalogów
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global::iConvertModels < 0)
|
||||
{
|
||||
else {
|
||||
if( Global::iConvertModels < 0 ) {
|
||||
Global::iConvertModels = -Global::iConvertModels;
|
||||
World.CreateE3D("models\\"); // rekurencyjne przeglądanie katalogów
|
||||
World.CreateE3D("dynamic\\", true);
|
||||
World.CreateE3D( "models\\" ); // rekurencyjne przeglądanie katalogów
|
||||
World.CreateE3D( "dynamic\\", true );
|
||||
} // po zrobieniu E3D odpalamy normalnie scenerię, by ją zobaczyć
|
||||
// else
|
||||
//{//główna pętla programu
|
||||
|
||||
Console::On(); // włączenie konsoli
|
||||
while (!done) // loop that runs while done=FALSE
|
||||
{
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) // is there a message waiting?
|
||||
{
|
||||
if (msg.message == WM_QUIT) // have we received a quit message?
|
||||
done = TRUE; // if so
|
||||
else // if not, deal with window messages
|
||||
{
|
||||
// if (msg.message==WM_CHAR)
|
||||
// World.OnKeyDown(msg.wParam);
|
||||
TranslateMessage(&msg); // translate the message
|
||||
DispatchMessage(&msg); // dispatch the message
|
||||
}
|
||||
}
|
||||
else // if there are no messages
|
||||
{
|
||||
// draw the scene, watch for quit messages
|
||||
// DrawGLScene()
|
||||
// if (!pause)
|
||||
// if (Global::bInactivePause?Global::bActive:true) //tak nie, bo spada z góry
|
||||
if (World.Update()) // Was There A Quit Received?
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
else
|
||||
done = true; //[F10] or DrawGLScene signalled a quit
|
||||
}
|
||||
while( !glfwWindowShouldClose( window ) && World.Update() ) {
|
||||
glfwSwapBuffers( window );
|
||||
glfwPollEvents();
|
||||
}
|
||||
Console::Off(); // wyłączenie konsoli (komunikacji zwrotnej)
|
||||
}
|
||||
SystemParametersInfo(SPI_SETKEYBOARDSPEED, iOldSpeed, NULL, 0);
|
||||
SystemParametersInfo(SPI_SETKEYBOARDDELAY, iOldDelay, NULL, 0);
|
||||
delete pConsole; // deaktywania sterownika
|
||||
TPythonInterpreter::killInstance();
|
||||
|
||||
// shutdown
|
||||
KillGLWindow(); // kill the window
|
||||
return (msg.wParam); // exit the program
|
||||
TPythonInterpreter::killInstance();
|
||||
delete pConsole;
|
||||
|
||||
glfwDestroyWindow( window );
|
||||
glfwTerminate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
194
Globals.cpp
194
Globals.cpp
@@ -49,7 +49,9 @@ bool Global::bOpenGL_1_5 = false; // czy są dostępne funkcje OpenGL 1.5
|
||||
double Global::fLuminance = 1.0; // jasność światła do automatycznego zapalania
|
||||
float Global::SunAngle = 0.0f;
|
||||
int Global::iReCompile = 0; // zwiększany, gdy trzeba odświeżyć siatki
|
||||
HWND Global::hWnd = NULL; // uchwyt okna
|
||||
GLFWwindow *Global::window;
|
||||
bool Global::shiftState;
|
||||
bool Global::ctrlState;
|
||||
int Global::ScreenWidth = 1;
|
||||
int Global::ScreenHeight = 1;
|
||||
float Global::ZoomFactor = 1.0f;
|
||||
@@ -956,7 +958,7 @@ void Global::ConfigParse(cParser &Parser)
|
||||
fFpsMax = fFpsAverage +
|
||||
fFpsDeviation; // górna granica FPS, przy której promień scenerii będzie zwiększany
|
||||
if (iPause)
|
||||
iTextMode = VK_F1; // jak pauza, to pokazać zegar
|
||||
iTextMode = GLFW_KEY_F1; // jak pauza, to pokazać zegar
|
||||
/* this won't execute anymore with the old parser removed
|
||||
// TBD: remove, or launch depending on passed flag?
|
||||
if (qp)
|
||||
@@ -979,131 +981,93 @@ void Global::ConfigParse(cParser &Parser)
|
||||
*/
|
||||
}
|
||||
|
||||
void Global::InitKeys(std::string asFileName)
|
||||
{
|
||||
// if (FileExists(asFileName))
|
||||
// {
|
||||
// Error("Chwilowo plik keys.ini nie jest obsługiwany. Ładuję standardowe
|
||||
// ustawienia.\nKeys.ini file is temporarily not functional, loading default keymap...");
|
||||
/* TQueryParserComp *Parser;
|
||||
Parser=new TQueryParserComp(NULL);
|
||||
Parser->LoadStringToParse(asFileName);
|
||||
void Global::InitKeys() {
|
||||
Keys[ k_IncMainCtrl ] = GLFW_KEY_KP_ADD;
|
||||
Keys[ k_IncMainCtrlFAST ] = GLFW_KEY_KP_ADD;
|
||||
Keys[ k_DecMainCtrl ] = GLFW_KEY_KP_SUBTRACT;
|
||||
Keys[ k_DecMainCtrlFAST ] = GLFW_KEY_KP_SUBTRACT;
|
||||
Keys[ k_IncScndCtrl ] = GLFW_KEY_KP_DIVIDE;
|
||||
Keys[ k_IncScndCtrlFAST ] = GLFW_KEY_KP_DIVIDE;
|
||||
Keys[ k_DecScndCtrl ] = GLFW_KEY_KP_MULTIPLY;
|
||||
Keys[ k_DecScndCtrlFAST ] = GLFW_KEY_KP_MULTIPLY;
|
||||
|
||||
for (int keycount=0; keycount<MaxKeys; keycount++)
|
||||
{
|
||||
Keys[keycount]=Parser->GetNextSymbol().ToInt();
|
||||
}
|
||||
Keys[ k_IncLocalBrakeLevel ] = GLFW_KEY_KP_1;
|
||||
Keys[ k_DecLocalBrakeLevel ] = GLFW_KEY_KP_7;
|
||||
Keys[ k_IncBrakeLevel ] = GLFW_KEY_KP_3;
|
||||
Keys[ k_DecBrakeLevel ] = GLFW_KEY_KP_9;
|
||||
Keys[ k_Releaser ] = GLFW_KEY_KP_6;
|
||||
Keys[ k_EmergencyBrake ] = GLFW_KEY_KP_0;
|
||||
Keys[ k_Brake3 ] = GLFW_KEY_KP_8;
|
||||
Keys[ k_Brake2 ] = GLFW_KEY_KP_5;
|
||||
Keys[ k_Brake1 ] = GLFW_KEY_KP_2;
|
||||
Keys[ k_Brake0 ] = GLFW_KEY_KP_4;
|
||||
Keys[ k_WaveBrake ] = GLFW_KEY_KP_DECIMAL;
|
||||
|
||||
delete Parser;
|
||||
*/
|
||||
// }
|
||||
// else
|
||||
{
|
||||
Keys[k_IncMainCtrl] = VK_ADD;
|
||||
Keys[k_IncMainCtrlFAST] = VK_ADD;
|
||||
Keys[k_DecMainCtrl] = VK_SUBTRACT;
|
||||
Keys[k_DecMainCtrlFAST] = VK_SUBTRACT;
|
||||
Keys[k_IncScndCtrl] = VK_DIVIDE;
|
||||
Keys[k_IncScndCtrlFAST] = VK_DIVIDE;
|
||||
Keys[k_DecScndCtrl] = VK_MULTIPLY;
|
||||
Keys[k_DecScndCtrlFAST] = VK_MULTIPLY;
|
||||
///*NORMALNE
|
||||
Keys[k_IncLocalBrakeLevel] = VK_NUMPAD1; // VK_NUMPAD7;
|
||||
// Keys[k_IncLocalBrakeLevelFAST]=VK_END; //VK_HOME;
|
||||
Keys[k_DecLocalBrakeLevel] = VK_NUMPAD7; // VK_NUMPAD1;
|
||||
// Keys[k_DecLocalBrakeLevelFAST]=VK_HOME; //VK_END;
|
||||
Keys[k_IncBrakeLevel] = VK_NUMPAD3; // VK_NUMPAD9;
|
||||
Keys[k_DecBrakeLevel] = VK_NUMPAD9; // VK_NUMPAD3;
|
||||
Keys[k_Releaser] = VK_NUMPAD6;
|
||||
Keys[k_EmergencyBrake] = VK_NUMPAD0;
|
||||
Keys[k_Brake3] = VK_NUMPAD8;
|
||||
Keys[k_Brake2] = VK_NUMPAD5;
|
||||
Keys[k_Brake1] = VK_NUMPAD2;
|
||||
Keys[k_Brake0] = VK_NUMPAD4;
|
||||
Keys[k_WaveBrake] = VK_DECIMAL;
|
||||
//*/
|
||||
/*MOJE
|
||||
Keys[k_IncLocalBrakeLevel]=VK_NUMPAD3; //VK_NUMPAD7;
|
||||
Keys[k_IncLocalBrakeLevelFAST]=VK_NUMPAD3; //VK_HOME;
|
||||
Keys[k_DecLocalBrakeLevel]=VK_DECIMAL; //VK_NUMPAD1;
|
||||
Keys[k_DecLocalBrakeLevelFAST]=VK_DECIMAL; //VK_END;
|
||||
Keys[k_IncBrakeLevel]=VK_NUMPAD6; //VK_NUMPAD9;
|
||||
Keys[k_DecBrakeLevel]=VK_NUMPAD9; //VK_NUMPAD3;
|
||||
Keys[k_Releaser]=VK_NUMPAD5;
|
||||
Keys[k_EmergencyBrake]=VK_NUMPAD0;
|
||||
Keys[k_Brake3]=VK_NUMPAD2;
|
||||
Keys[k_Brake2]=VK_NUMPAD1;
|
||||
Keys[k_Brake1]=VK_NUMPAD4;
|
||||
Keys[k_Brake0]=VK_NUMPAD7;
|
||||
Keys[k_WaveBrake]=VK_NUMPAD8;
|
||||
*/
|
||||
Keys[k_AntiSlipping] = VK_RETURN;
|
||||
Keys[k_Sand] = VkKeyScan('s');
|
||||
Keys[k_Main] = VkKeyScan('m');
|
||||
Keys[k_Active] = VkKeyScan('w');
|
||||
Keys[k_Battery] = VkKeyScan('j');
|
||||
Keys[k_DirectionForward] = VkKeyScan('d');
|
||||
Keys[k_DirectionBackward] = VkKeyScan('r');
|
||||
Keys[k_Fuse] = VkKeyScan('n');
|
||||
Keys[k_Compressor] = VkKeyScan('c');
|
||||
Keys[k_Converter] = VkKeyScan('x');
|
||||
Keys[k_MaxCurrent] = VkKeyScan('f');
|
||||
Keys[k_CurrentAutoRelay] = VkKeyScan('g');
|
||||
Keys[k_BrakeProfile] = VkKeyScan('b');
|
||||
Keys[k_CurrentNext] = VkKeyScan('z');
|
||||
Keys[ k_AntiSlipping ] = GLFW_KEY_KP_ENTER;
|
||||
Keys[ k_Sand ] = 'S';
|
||||
Keys[ k_Main ] = 'M';
|
||||
Keys[ k_Active ] = 'W';
|
||||
Keys[ k_Battery ] = 'J';
|
||||
Keys[ k_DirectionForward ] = 'D';
|
||||
Keys[ k_DirectionBackward ] = 'R';
|
||||
Keys[ k_Fuse ] = 'N';
|
||||
Keys[ k_Compressor ] = 'C';
|
||||
Keys[ k_Converter ] = 'X';
|
||||
Keys[ k_MaxCurrent ] = 'F';
|
||||
Keys[ k_CurrentAutoRelay ] = 'G';
|
||||
Keys[ k_BrakeProfile ] = 'B';
|
||||
Keys[ k_CurrentNext ] = 'Z';
|
||||
|
||||
Keys[k_Czuwak] = VkKeyScan(' ');
|
||||
Keys[k_Horn] = VkKeyScan('a');
|
||||
Keys[k_Horn2] = VkKeyScan('a');
|
||||
Keys[ k_Czuwak ] = ' ';
|
||||
Keys[ k_Horn ] = 'A';
|
||||
Keys[ k_Horn2 ] = 'A';
|
||||
|
||||
Keys[k_FailedEngineCutOff] = VkKeyScan('e');
|
||||
Keys[ k_FailedEngineCutOff ] = 'E';
|
||||
|
||||
Keys[k_MechUp] = VK_PRIOR;
|
||||
Keys[k_MechDown] = VK_NEXT;
|
||||
Keys[k_MechLeft] = VK_LEFT;
|
||||
Keys[k_MechRight] = VK_RIGHT;
|
||||
Keys[k_MechForward] = VK_UP;
|
||||
Keys[k_MechBackward] = VK_DOWN;
|
||||
Keys[ k_MechUp ] = GLFW_KEY_PAGE_UP;
|
||||
Keys[ k_MechDown ] = GLFW_KEY_PAGE_DOWN;
|
||||
Keys[ k_MechLeft ] = GLFW_KEY_LEFT;
|
||||
Keys[ k_MechRight ] = GLFW_KEY_RIGHT;
|
||||
Keys[ k_MechForward ] = GLFW_KEY_UP;
|
||||
Keys[ k_MechBackward ] = GLFW_KEY_DOWN;
|
||||
|
||||
Keys[k_CabForward] = VK_HOME;
|
||||
Keys[k_CabBackward] = VK_END;
|
||||
Keys[ k_CabForward ] = GLFW_KEY_HOME;
|
||||
Keys[ k_CabBackward ] = GLFW_KEY_END;
|
||||
|
||||
Keys[k_Couple] = VK_INSERT;
|
||||
Keys[k_DeCouple] = VK_DELETE;
|
||||
Keys[ k_Couple ] = GLFW_KEY_INSERT;
|
||||
Keys[ k_DeCouple ] = GLFW_KEY_DELETE;
|
||||
|
||||
Keys[k_ProgramQuit] = VK_F10;
|
||||
// Keys[k_ProgramPause]=VK_F3;
|
||||
Keys[k_ProgramHelp] = VK_F1;
|
||||
// Keys[k_FreeFlyMode]=VK_F4;
|
||||
Keys[k_WalkMode] = VK_F5;
|
||||
Keys[ k_ProgramQuit ] = GLFW_KEY_F10;
|
||||
Keys[ k_ProgramHelp ] = GLFW_KEY_F1;
|
||||
Keys[ k_WalkMode ] = GLFW_KEY_F5;
|
||||
|
||||
Keys[k_OpenLeft] = VkKeyScan(',');
|
||||
Keys[k_OpenRight] = VkKeyScan('.');
|
||||
Keys[k_CloseLeft] = VkKeyScan(',');
|
||||
Keys[k_CloseRight] = VkKeyScan('.');
|
||||
Keys[k_DepartureSignal] = VkKeyScan('/');
|
||||
Keys[ k_OpenLeft ] = ',';
|
||||
Keys[ k_OpenRight ] = '.';
|
||||
Keys[ k_CloseLeft ] = ',';
|
||||
Keys[ k_CloseRight ] = '.';
|
||||
Keys[ k_DepartureSignal ] = '/';
|
||||
|
||||
// Winger 160204 - obsluga pantografow
|
||||
Keys[k_PantFrontUp] = VkKeyScan('p'); // Ra: zamieniony przedni z tylnym
|
||||
Keys[k_PantFrontDown] = VkKeyScan('p');
|
||||
Keys[k_PantRearUp] = VkKeyScan('o');
|
||||
Keys[k_PantRearDown] = VkKeyScan('o');
|
||||
// Winger 020304 - ogrzewanie
|
||||
Keys[k_Heating] = VkKeyScan('h');
|
||||
Keys[k_LeftSign] = VkKeyScan('y');
|
||||
Keys[k_UpperSign] = VkKeyScan('u');
|
||||
Keys[k_RightSign] = VkKeyScan('i');
|
||||
Keys[k_EndSign] = VkKeyScan('t');
|
||||
// Winger 160204 - obsluga pantografow
|
||||
Keys[ k_PantFrontUp ] = 'P'; // Ra: zamieniony przedni z tylnym
|
||||
Keys[ k_PantFrontDown ] = 'P';
|
||||
Keys[ k_PantRearUp ] = 'O';
|
||||
Keys[ k_PantRearDown ] = 'O';
|
||||
// Winger 020304 - ogrzewanie
|
||||
Keys[ k_Heating ] = 'H';
|
||||
Keys[ k_LeftSign ] = 'Y';
|
||||
Keys[ k_UpperSign ] = 'U';
|
||||
Keys[ k_RightSign ] = 'I';
|
||||
Keys[ k_EndSign ] = 'T';
|
||||
|
||||
Keys[k_SmallCompressor] = VkKeyScan('v');
|
||||
Keys[k_StLinOff] = VkKeyScan('l');
|
||||
// ABu 090305 - przyciski uniwersalne, do roznych bajerow :)
|
||||
Keys[k_Univ1] = VkKeyScan('[');
|
||||
Keys[k_Univ2] = VkKeyScan(']');
|
||||
Keys[k_Univ3] = VkKeyScan(';');
|
||||
Keys[k_Univ4] = VkKeyScan('\'');
|
||||
}
|
||||
Keys[ k_SmallCompressor ] = 'V';
|
||||
Keys[ k_StLinOff ] = 'L';
|
||||
// ABu 090305 - przyciski uniwersalne, do roznych bajerow :)
|
||||
Keys[ k_Univ1 ] = '[';
|
||||
Keys[ k_Univ2 ] = ']';
|
||||
Keys[ k_Univ3 ] = ';';
|
||||
Keys[ k_Univ4 ] = '\'';
|
||||
}
|
||||
|
||||
/*
|
||||
vector3 Global::GetCameraPosition()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include <string>
|
||||
#include <Windows.h>
|
||||
#include "renderer.h"
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "glfw/glfw3.h"
|
||||
#include "dumb3d.h"
|
||||
|
||||
// definicje klawiszy
|
||||
@@ -208,7 +209,7 @@ class Global
|
||||
// McZapkie-170602: zewnetrzna definicja pojazdu uzytkownika
|
||||
static std::string asHumanCtrlVehicle;
|
||||
static void LoadIniFile(std::string asFileName);
|
||||
static void InitKeys(std::string asFileName);
|
||||
static void InitKeys();
|
||||
inline static Math3D::vector3 GetCameraPosition()
|
||||
{
|
||||
return pCameraPosition;
|
||||
@@ -262,7 +263,9 @@ class Global
|
||||
static double fLuminance; // jasność światła do automatycznego zapalania
|
||||
static float SunAngle; // angle of the sun relative to horizon
|
||||
static int iMultiplayer; // blokada działania niektórych eventów na rzecz kominikacji
|
||||
static HWND hWnd; // uchwyt okna
|
||||
static GLFWwindow *window;
|
||||
static bool shiftState; //m7todo: brzydko
|
||||
static bool ctrlState;
|
||||
static int ScreenWidth; // current window dimensions. TODO: move it to renderer
|
||||
static int ScreenHeight;
|
||||
static float ZoomFactor; // determines current camera zoom level. TODO: move it to the renderer
|
||||
|
||||
37
Ground.cpp
37
Ground.cpp
@@ -16,9 +16,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "stdafx.h"
|
||||
#include "Ground.h"
|
||||
|
||||
#include "opengl/glew.h"
|
||||
#include "opengl/glut.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Logs.h"
|
||||
#include "usefull.h"
|
||||
@@ -43,6 +40,11 @@ http://mozilla.org/MPL/2.0/.
|
||||
#define _PROBLEND 1
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
extern "C"
|
||||
{
|
||||
GLFWAPI HWND glfwGetWin32Window( GLFWwindow* window ); //m7todo: potrzebne do directsound
|
||||
}
|
||||
|
||||
bool bCondition; // McZapkie: do testowania warunku na event multiple
|
||||
string LogComment;
|
||||
|
||||
@@ -312,7 +314,7 @@ void TGroundNode::RenderVBO()
|
||||
if (EvLaunch->Render())
|
||||
if ((EvLaunch->dRadius < 0) || (mgn < EvLaunch->dRadius))
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT) && EvLaunch->Event2 != NULL)
|
||||
if (Global::shiftState && EvLaunch->Event2 != NULL)
|
||||
Global::AddToQuery(EvLaunch->Event2, NULL);
|
||||
else if (EvLaunch->Event1 != NULL)
|
||||
Global::AddToQuery(EvLaunch->Event1, NULL);
|
||||
@@ -549,7 +551,7 @@ void TGroundNode::RenderHidden()
|
||||
if ((EvLaunch->dRadius < 0) || (mgn < EvLaunch->dRadius))
|
||||
{
|
||||
WriteLog("Eventlauncher " + asName);
|
||||
if (Console::Pressed(VK_SHIFT) && (EvLaunch->Event2))
|
||||
if (Global::shiftState && (EvLaunch->Event2))
|
||||
Global::AddToQuery(EvLaunch->Event2, NULL);
|
||||
else if (EvLaunch->Event1)
|
||||
Global::AddToQuery(EvLaunch->Event1, NULL);
|
||||
@@ -2506,11 +2508,11 @@ void TGround::FirstInit()
|
||||
WriteLog("FirstInit is done");
|
||||
};
|
||||
|
||||
bool TGround::Init(std::string asFile, HDC hDC)
|
||||
bool TGround::Init(std::string File)
|
||||
{ // główne wczytywanie scenerii
|
||||
if (ToLower(asFile).substr(0, 7) == "scenery")
|
||||
asFile = asFile.erase(0, 8); // Ra: usunięcie niepotrzebnych znaków - zgodność wstecz z 2003
|
||||
WriteLog("Loading scenery from " + asFile);
|
||||
if (ToLower(File).substr(0, 7) == "scenery")
|
||||
File = File.erase(0, 8); // Ra: usunięcie niepotrzebnych znaków - zgodność wstecz z 2003
|
||||
WriteLog("Loading scenery from " + File);
|
||||
Global::pGround = this;
|
||||
// pTrain=NULL;
|
||||
pOrigin = aRotate = vector3(0, 0, 0); // zerowanie przesunięcia i obrotu
|
||||
@@ -2518,7 +2520,7 @@ bool TGround::Init(std::string asFile, HDC hDC)
|
||||
// TFileStream *fs;
|
||||
// int size;
|
||||
std::string subpath = Global::asCurrentSceneryPath; // "scenery/";
|
||||
cParser parser(asFile, cParser::buffer_FILE, subpath, Global::bLoadTraction);
|
||||
cParser parser(File, cParser::buffer_FILE, subpath, Global::bLoadTraction);
|
||||
std::string token;
|
||||
|
||||
/*
|
||||
@@ -5037,6 +5039,7 @@ bool TGround::RenderAlphaVBO(vector3 pPosition)
|
||||
return true;
|
||||
};
|
||||
|
||||
#ifdef _WINDOWS
|
||||
//---------------------------------------------------------------------------
|
||||
void TGround::Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{ // wysłanie komunikatu do sterującego
|
||||
@@ -5060,7 +5063,7 @@ void TGround::WyslijEvent(const std::string &e, const std::string &d)
|
||||
cData.dwData = 'EU07'; // sygnatura
|
||||
cData.cbData = 12 + i + j; // 8+dwa liczniki i dwa zera kończące
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + e + " sent" );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -5077,7 +5080,7 @@ void TGround::WyslijUszkodzenia(const std::string &t, char fl)
|
||||
cData.dwData = 'EU07'; // sygnatura
|
||||
cData.cbData = 11 + i; // 8+licznik i zero kończące
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -5093,7 +5096,7 @@ void TGround::WyslijString(const std::string &t, int n)
|
||||
cData.dwData = 'EU07'; // sygnatura
|
||||
cData.cbData = 10 + i; // 8+licznik i zero kończące
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -5172,7 +5175,7 @@ void TGround::WyslijNamiary(TGroundNode *t)
|
||||
cData.cbData = 10 + i + j; // 8+licznik i zero kończące
|
||||
cData.lpData = &r;
|
||||
// WriteLog("Ramka gotowa");
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||
// WriteLog("Ramka poszla!");
|
||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t->asName + " sent");
|
||||
};
|
||||
@@ -5215,7 +5218,7 @@ void TGround::WyslijObsadzone()
|
||||
cData.cbData = 8 + 1984; // 8+licznik i zero kończące
|
||||
cData.lpData = &r;
|
||||
// WriteLog("Ramka gotowa");
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||
CommLog( Now() + " " + std::to_string(r.iComm) + " obsadzone" + " sent");
|
||||
}
|
||||
|
||||
@@ -5239,8 +5242,10 @@ void TGround::WyslijParam(int nr, int fl)
|
||||
cData.dwData = 'EU07'; // sygnatura
|
||||
cData.cbData = 12 + i; // 12+rozmiar danych
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||
};
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
4
Ground.h
4
Ground.h
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "VBO.h"
|
||||
#include "Classes.h"
|
||||
#include "ResourceManager.h"
|
||||
@@ -323,7 +323,7 @@ class TGround
|
||||
TGround();
|
||||
~TGround();
|
||||
void Free();
|
||||
bool Init(std::string asFile, HDC hDC);
|
||||
bool Init( std::string File );
|
||||
void FirstInit();
|
||||
void InitTracks();
|
||||
void InitTraction();
|
||||
|
||||
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#ifndef Model3dH
|
||||
#define Model3dH
|
||||
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "Parser.h"
|
||||
#include "dumb3d.h"
|
||||
#include "Float3d.h"
|
||||
|
||||
@@ -9,7 +9,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Segment.h"
|
||||
#include "opengl/glew.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Logs.h"
|
||||
|
||||
@@ -17,7 +17,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "texture.h"
|
||||
|
||||
#include <ddraw.h>
|
||||
#include "opengl/glew.h"
|
||||
|
||||
#include "usefull.h"
|
||||
#include "globals.h"
|
||||
@@ -639,6 +638,7 @@ texture_manager::GetTextureId( std::string Filename, std::string const &Dir, int
|
||||
|
||||
if( true == filename.empty() ) {
|
||||
// there's nothing matching in the databank nor on the disk, report failure
|
||||
ErrorLog( "Texture file missing: \"" + Filename + "\"" );
|
||||
return npos;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
|
||||
enum class resource_state {
|
||||
none,
|
||||
|
||||
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#ifndef TEXTURE_DDS_H
|
||||
#define TEXTURE_DDS_H 1
|
||||
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
2
Track.h
2
Track.h
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "Segment.h"
|
||||
#include "Texture.h"
|
||||
|
||||
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "VBO.h"
|
||||
#include "dumb3d.h"
|
||||
|
||||
|
||||
132
Train.cpp
132
Train.cpp
@@ -394,7 +394,7 @@ void TTrain::OnKeyDown(int cKey)
|
||||
// isEztOer=(mvControlled->TrainType==dt_EZT)&&(mvControlled->Mains)&&(mvOccupied->BrakeSubsystem==ss_ESt)&&(mvControlled->ActiveDir!=0);
|
||||
// isEztOer=((mvControlled->TrainType==dt_EZT)&&(mvControlled->Battery==true)&&(mvControlled->EpFuse==true)&&(mvOccupied->BrakeSubsystem==Oerlikon)&&(mvControlled->ActiveDir!=0));
|
||||
|
||||
if (GetAsyncKeyState(VK_SHIFT) < 0)
|
||||
if (Global::shiftState)
|
||||
{ // wciśnięty [Shift]
|
||||
if (cKey == Global::Keys[k_IncMainCtrlFAST]) // McZapkie-200702: szybkie
|
||||
// przelaczanie na poz.
|
||||
@@ -409,7 +409,7 @@ void TTrain::OnKeyDown(int cKey)
|
||||
else if (cKey == Global::Keys[k_DirectionBackward])
|
||||
{
|
||||
if (mvOccupied->Radio == false)
|
||||
if (GetAsyncKeyState(VK_CONTROL) >= 0)
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
@@ -561,7 +561,7 @@ void TTrain::OnKeyDown(int cKey)
|
||||
int CouplNr = -2;
|
||||
if (!FreeFlyModeFlag)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState)
|
||||
if (mvOccupied->BrakeDelaySwitch(bdelay_R + bdelay_M))
|
||||
{
|
||||
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
||||
@@ -588,7 +588,7 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
if (temp)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState)
|
||||
if (temp->MoverParameters->BrakeDelaySwitch(bdelay_R + bdelay_M))
|
||||
{
|
||||
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
||||
@@ -658,7 +658,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
{ // Ra: dźwięk, gdy razem z [Shift]
|
||||
if ((mvControlled->TrainType & dt_EZT) ? mvControlled == mvOccupied :
|
||||
!mvOccupied->ActiveCab) // tylko w maszynowym
|
||||
if (Console::Pressed(VK_CONTROL)) // z [Ctrl]
|
||||
if (Global::ctrlState) // z [Ctrl]
|
||||
mvControlled->bPantKurek3 = true; // zbiornik pantografu połączony
|
||||
// jest ze zbiornikiem głównym
|
||||
// (pompowanie nie ma sensu)
|
||||
@@ -671,7 +671,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
dsbSwitch->Play(0, 0, 0); // dźwięk tylko po naciśnięciu klawisza
|
||||
}
|
||||
}
|
||||
else if (cKey == VkKeyScan('q')) // ze Shiftem - włączenie AI
|
||||
else if (cKey == GLFW_KEY_Q) // ze Shiftem - włączenie AI
|
||||
{ // McZapkie-240302 - wlaczanie automatycznego pilota (zadziala tylko w
|
||||
// trybie debugmode)
|
||||
if (DynamicObject->Mechanik)
|
||||
@@ -760,7 +760,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
// przyciemnienia pod Univ4)
|
||||
else if (cKey == Global::Keys[k_Univ3])
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
if (bCabLight == false) //(ggCabLightButton.GetValue()==0)
|
||||
{
|
||||
@@ -788,7 +788,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
// hunter-091012: dzwiek dla przyciemnienia swiatelka w kabinie
|
||||
else if (cKey == Global::Keys[k_Univ4])
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
if (bCabLightDim == false) //(ggCabLightDimButton.GetValue()==0)
|
||||
{
|
||||
@@ -891,7 +891,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
{
|
||||
if (false == (mvOccupied->LightsPosNo > 0))
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
if ((Global::ctrlState) &&
|
||||
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu.
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
@@ -1011,7 +1011,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
SetLights();
|
||||
}
|
||||
}
|
||||
else if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
else if ((Global::ctrlState) &&
|
||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
{
|
||||
//------------------------------
|
||||
@@ -1066,7 +1066,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
{
|
||||
if (false == (mvOccupied->LightsPosNo > 0))
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
if ((Global::ctrlState) &&
|
||||
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
@@ -1238,7 +1238,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
// World.cpp
|
||||
if (!FreeFlyModeFlag)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState)
|
||||
if ((mvOccupied->LocalBrake == ManualBrake) || (mvOccupied->MBrake == true))
|
||||
{
|
||||
mvOccupied->IncManualBrakeLevel(1);
|
||||
@@ -1256,7 +1256,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
// World.cpp
|
||||
if (!FreeFlyModeFlag)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState)
|
||||
if ((mvOccupied->LocalBrake == ManualBrake) || (mvOccupied->MBrake == true))
|
||||
mvOccupied->DecManualBrakeLevel(1);
|
||||
else
|
||||
@@ -1350,7 +1350,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
// mvOccupied->IncBrakeLevel());
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->BrakeCtrlPosNo / 2 +
|
||||
(mvOccupied->BrakeHandle == FV4a ? 1 : 0));
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState)
|
||||
mvOccupied->BrakeLevelSet(
|
||||
mvOccupied->Handle->GetPos(bh_NP)); // yB: czy ten stos funkcji nie
|
||||
// powinien być jako oddzielna
|
||||
@@ -1369,7 +1369,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
}
|
||||
else if (cKey == Global::Keys[k_Brake0])
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
mvOccupied->BrakeCtrlPos2 = 0; // wyrownaj kapturek
|
||||
}
|
||||
@@ -1431,7 +1431,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
else if (cKey == Global::Keys[k_Fuse])
|
||||
//---------------
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0) // z controlem
|
||||
if( Global::ctrlState ) // z controlem
|
||||
{
|
||||
ggConverterFuseButton.PutValue(1); // hunter-261211
|
||||
if ((mvControlled->Mains == false) && (ggConverterButton.GetValue() == 0) &&
|
||||
@@ -1472,7 +1472,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
}
|
||||
else if (cKey == Global::Keys[k_DirectionBackward]) // r
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if( Global::ctrlState )
|
||||
{ // wciśnięty [Ctrl]
|
||||
if (mvOccupied->Radio == true)
|
||||
{
|
||||
@@ -1554,7 +1554,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
int CouplNr = -2;
|
||||
if (!FreeFlyModeFlag)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if( Global::ctrlState )
|
||||
if (mvOccupied->BrakeDelaySwitch(bdelay_R))
|
||||
{
|
||||
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
||||
@@ -1581,7 +1581,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
}
|
||||
if (temp)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if( Global::ctrlState )
|
||||
if (temp->MoverParameters->BrakeDelaySwitch(bdelay_R))
|
||||
{
|
||||
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
||||
@@ -1646,7 +1646,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
{ // Ra: bez [Shift] też dać dźwięk
|
||||
if ((mvControlled->TrainType & dt_EZT) ? mvControlled == mvOccupied :
|
||||
!mvOccupied->ActiveCab) // tylko w maszynowym
|
||||
if (Console::Pressed(VK_CONTROL)) // z [Ctrl]
|
||||
if (Global::ctrlState) // z [Ctrl]
|
||||
mvControlled->bPantKurek3 =
|
||||
false; // zbiornik pantografu połączony jest z małą sprężarką
|
||||
// (pompowanie ma sens, ale potem trzeba przełączyć)
|
||||
@@ -1661,7 +1661,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
}
|
||||
// McZapkie-240302 - wylaczanie automatycznego pilota (w trybie ~debugmode
|
||||
// mozna tylko raz)
|
||||
else if (cKey == VkKeyScan('q')) // bez Shift
|
||||
else if (cKey == GLFW_KEY_Q) // bez Shift
|
||||
{
|
||||
if (DynamicObject->Mechanik)
|
||||
DynamicObject->Mechanik->TakeControl(false);
|
||||
@@ -1983,7 +1983,7 @@ if
|
||||
// przyciemnienia pod Univ4)
|
||||
else if (cKey == Global::Keys[k_Univ3])
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
if (bCabLight == true) //(ggCabLightButton.GetValue()!=0)
|
||||
{
|
||||
@@ -2010,7 +2010,7 @@ if
|
||||
// hunter-091012: dzwiek dla przyciemnienia swiatelka w kabinie
|
||||
else if (cKey == Global::Keys[k_Univ4])
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
if (bCabLightDim == true) //(ggCabLightDimButton.GetValue()!=0)
|
||||
{
|
||||
@@ -2091,7 +2091,7 @@ if
|
||||
{
|
||||
if (false == (mvOccupied->LightsPosNo > 0))
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
if( ( Global::ctrlState ) &&
|
||||
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
@@ -2204,7 +2204,7 @@ if
|
||||
SetLights();
|
||||
}
|
||||
}
|
||||
else if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
else if( ( Global::ctrlState ) &&
|
||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
{
|
||||
//------------------------------
|
||||
@@ -2258,7 +2258,7 @@ if
|
||||
{
|
||||
if (false == (mvOccupied->LightsPosNo > 0))
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
if( ( Global::ctrlState ) &&
|
||||
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
@@ -2384,7 +2384,7 @@ if
|
||||
{
|
||||
// McZapkie: poruszanie sie po kabinie, w updatemechpos zawarte sa wiezy
|
||||
|
||||
auto step = 60.0f * Timer::GetDeltaTime();
|
||||
auto step = 1.5f;
|
||||
auto const camerayaw = Global::pCamera->Yaw;
|
||||
Math3D::vector3 direction( 0.0f, 0.0f, step );
|
||||
direction.RotateY( camerayaw );
|
||||
@@ -2398,7 +2398,7 @@ if
|
||||
right *= -1.0f;
|
||||
}
|
||||
// if (!GetAsyncKeyState(VK_SHIFT)<0) // bez shifta
|
||||
if (!Console::Pressed(VK_CONTROL)) // gdy [Ctrl] zwolniony (dodatkowe widoki)
|
||||
if( !Global::ctrlState ) // gdy [Ctrl] zwolniony (dodatkowe widoki)
|
||||
{
|
||||
if (cKey == Global::Keys[k_MechLeft])
|
||||
{
|
||||
@@ -2443,7 +2443,7 @@ if
|
||||
if (DebugModeFlag)
|
||||
{ // przesuwanie składu o 100m
|
||||
TDynamicObject *d = DynamicObject;
|
||||
if (cKey == VkKeyScan('['))
|
||||
if (cKey == GLFW_KEY_LEFT_BRACKET)
|
||||
{
|
||||
while (d)
|
||||
{
|
||||
@@ -2457,7 +2457,7 @@ if
|
||||
d = d->Prev(); // w drugą stronę też
|
||||
}
|
||||
}
|
||||
else if (cKey == VkKeyScan(']'))
|
||||
else if (cKey == GLFW_KEY_RIGHT_BRACKET)
|
||||
{
|
||||
while (d)
|
||||
{
|
||||
@@ -2472,12 +2472,12 @@ if
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cKey == VkKeyScan('-'))
|
||||
if (cKey == GLFW_KEY_MINUS)
|
||||
{ // zmniejszenie numeru kanału radiowego
|
||||
if (iRadioChannel > 0)
|
||||
--iRadioChannel; // 0=wyłączony
|
||||
}
|
||||
else if (cKey == VkKeyScan('='))
|
||||
else if (cKey == GLFW_KEY_EQUAL)
|
||||
{ // zmniejszenie numeru kanału radiowego
|
||||
if (iRadioChannel < 8)
|
||||
++iRadioChannel; // 0=wyłączony
|
||||
@@ -2487,7 +2487,7 @@ if
|
||||
|
||||
void TTrain::OnKeyUp(int cKey)
|
||||
{ // zwolnienie klawisza
|
||||
if (GetAsyncKeyState(VK_SHIFT) < 0)
|
||||
if (Global::shiftState)
|
||||
{ // wciśnięty [Shift]
|
||||
}
|
||||
else
|
||||
@@ -2548,6 +2548,7 @@ void TTrain::UpdateMechPosition(double dt)
|
||||
// shake *= 1.25;
|
||||
}
|
||||
vMechVelocity -= (shake + vMechVelocity * 100) * (fMechSpringX + fMechSpringY + fMechSpringZ) / (200);
|
||||
// vMechVelocity -= vMechVelocity * iVel * dt;
|
||||
// shake *= 0.95 * dt; // shake damping
|
||||
|
||||
// McZapkie:
|
||||
@@ -2558,15 +2559,15 @@ void TTrain::UpdateMechPosition(double dt)
|
||||
vMechVelocity.y = -vMechVelocity.y;
|
||||
// ABu011104: 5*pMechShake.y, zeby ladnie pudlem rzucalo :)
|
||||
pNewMechPosition = pMechOffset + vector3(1.5 * pMechShake.x, 2.0 * pMechShake.y, 1.5 * pMechShake.z);
|
||||
vMechMovement = 0.5 * vMechMovement;
|
||||
// vMechMovement = 0.5 * vMechMovement;
|
||||
}
|
||||
else
|
||||
{ // hamowanie rzucania przy spadku FPS
|
||||
pMechShake -= pMechShake * std::min(dt, 1.0); // po tym chyba potrafią zostać jakieś ułamki, które powodują zjazd
|
||||
pMechOffset += vMechMovement * dt;
|
||||
vMechVelocity.y = 0.5 * vMechVelocity.y;
|
||||
vMechVelocity.y -= vMechVelocity.y * 50.0 * dt;
|
||||
pNewMechPosition = pMechOffset + vector3(pMechShake.x, 5 * pMechShake.y, pMechShake.z);
|
||||
vMechMovement = 0.5 * vMechMovement;
|
||||
// vMechMovement = 0.5 * vMechMovement;
|
||||
}
|
||||
// numer kabiny (-1: kabina B)
|
||||
if (DynamicObject->Mechanik) // może nie być?
|
||||
@@ -2613,6 +2614,13 @@ void TTrain::UpdateMechPosition(double dt)
|
||||
pMechPosition = DynamicObject->mMatrix *
|
||||
pNewMechPosition; // położenie względem środka pojazdu w układzie scenerii
|
||||
pMechPosition += DynamicObject->GetPosition();
|
||||
|
||||
// framerate-independent speed reduction that doesn't break at high framerates...
|
||||
vMechMovement -= vMechMovement * 50.0 * dt;
|
||||
if( vMechMovement.LengthSquared() < 0.01 ) {
|
||||
vMechMovement = Math3D::vector3();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
bool TTrain::Update( double const Deltatime )
|
||||
@@ -4195,7 +4203,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
if (Console::Pressed(Global::Keys[k_Horn]))
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if (Global::shiftState)
|
||||
{
|
||||
SetFlag(mvOccupied->WarningSignal, 2);
|
||||
mvOccupied->WarningSignal &= (255 - 1);
|
||||
@@ -4226,7 +4234,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
//----------------
|
||||
// hunter-141211: wyl. szybki zalaczony i wylaczony przeniesiony z
|
||||
// OnKeyPress()
|
||||
if (Console::Pressed(VK_SHIFT) && Console::Pressed(Global::Keys[k_Main]))
|
||||
if (Global::shiftState && Console::Pressed(Global::Keys[k_Main]))
|
||||
{
|
||||
fMainRelayTimer += dt;
|
||||
ggMainOnButton.PutValue(1);
|
||||
@@ -4260,7 +4268,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
//---
|
||||
|
||||
if (!Console::Pressed(VK_SHIFT) && Console::Pressed(Global::Keys[k_Main]))
|
||||
if (!Global::shiftState && Console::Pressed(Global::Keys[k_Main]))
|
||||
{
|
||||
ggMainOffButton.PutValue(1);
|
||||
if (mvControlled->MainSwitch(false))
|
||||
@@ -4399,7 +4407,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggAntiSlipButton.UpdateValue(0);
|
||||
//-----------------
|
||||
// hunter-261211: przetwornica i sprezarka
|
||||
if (Console::Pressed(VK_SHIFT) &&
|
||||
if (Global::shiftState &&
|
||||
Console::Pressed(Global::Keys[k_Converter])) // NBMX 14-09-2003: przetwornica wl
|
||||
{ //(mvControlled->CompressorPower<2)
|
||||
ggConverterButton.PutValue(1);
|
||||
@@ -4425,14 +4433,14 @@ bool TTrain::Update( double const Deltatime )
|
||||
// if (
|
||||
// Console::Pressed(VK_SHIFT)&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
||||
// ) //NBMX 14-09-2003: sprezarka wl
|
||||
if (Console::Pressed(VK_SHIFT) && Console::Pressed(Global::Keys[k_Compressor]) &&
|
||||
if (Global::shiftState && Console::Pressed(Global::Keys[k_Compressor]) &&
|
||||
(mvControlled->CompressorPower < 2)) // hunter-091012: tak jest poprawnie
|
||||
{ // hunter-110212: poprawka dla EZT
|
||||
ggCompressorButton.PutValue(1);
|
||||
mvControlled->CompressorSwitch(true);
|
||||
}
|
||||
|
||||
if (!Console::Pressed(VK_SHIFT) &&
|
||||
if (!Global::shiftState &&
|
||||
Console::Pressed(Global::Keys[k_Converter])) // NBMX 14-09-2003: przetwornica wl
|
||||
{
|
||||
ggConverterButton.PutValue(0);
|
||||
@@ -4445,7 +4453,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
// if (
|
||||
// !Console::Pressed(VK_SHIFT)&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
||||
// ) //NBMX 14-09-2003: sprezarka wl
|
||||
if (!Console::Pressed(VK_SHIFT) && Console::Pressed(Global::Keys[k_Compressor]) &&
|
||||
if (!Global::shiftState && Console::Pressed(Global::Keys[k_Compressor]) &&
|
||||
(mvControlled->CompressorPower < 2)) // hunter-091012: tak jest poprawnie
|
||||
{ // hunter-110212: poprawka dla EZT
|
||||
ggCompressorButton.PutValue(0);
|
||||
@@ -4504,7 +4512,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (!DebugModeFlag)
|
||||
{
|
||||
if (ggUniversal1Button.SubModel)
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if( Global::shiftState )
|
||||
ggUniversal1Button.IncValue(dt / 2);
|
||||
else
|
||||
ggUniversal1Button.DecValue(dt / 2);
|
||||
@@ -4520,7 +4528,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (!DebugModeFlag)
|
||||
{
|
||||
if (ggUniversal2Button.SubModel)
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if( Global::shiftState )
|
||||
ggUniversal2Button.IncValue(dt / 2);
|
||||
else
|
||||
ggUniversal2Button.DecValue(dt / 2);
|
||||
@@ -4530,9 +4538,9 @@ bool TTrain::Update( double const Deltatime )
|
||||
// hunter-091012: zrobione z uwzglednieniem przelacznika swiatla
|
||||
if (Console::Pressed(Global::Keys[k_Univ3]))
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if( Global::shiftState )
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
bCabLight = true;
|
||||
if (ggCabLightButton.SubModel)
|
||||
@@ -4555,7 +4563,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
bCabLight = false;
|
||||
if (ggCabLightButton.SubModel)
|
||||
@@ -4659,9 +4667,9 @@ bool TTrain::Update( double const Deltatime )
|
||||
// swiatla
|
||||
if (Console::Pressed(Global::Keys[k_Univ4]))
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if( Global::shiftState )
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
bCabLightDim = true;
|
||||
if (ggCabLightDimButton.SubModel)
|
||||
@@ -4677,7 +4685,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
bCabLightDim = false;
|
||||
if (ggCabLightDimButton.SubModel)
|
||||
@@ -4717,7 +4725,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
// ((mvOccupied->BrakeHandle==FV4a)&&(Console::Pressed(Global::Keys[k_IncBrakeLevel])))
|
||||
if ((Console::Pressed(Global::Keys[k_IncBrakeLevel])))
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
// mvOccupied->BrakeCtrlPos2-=dt/20.0;
|
||||
// if (mvOccupied->BrakeCtrlPos2<-1.5) mvOccupied->BrakeCtrlPos2=-1.5;
|
||||
@@ -4732,7 +4740,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
// ((mvOccupied->BrakeHandle==FV4a)&&(Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
||||
if ((Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
// mvOccupied->BrakeCtrlPos2+=(mvOccupied->BrakeCtrlPos2>2?0:dt/20.0);
|
||||
// if (mvOccupied->BrakeCtrlPos2<-3) mvOccupied->BrakeCtrlPos2=-3;
|
||||
@@ -4748,7 +4756,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
if ((mvOccupied->BrakeHandle == FV4a) && (Console::Pressed(Global::Keys[k_IncBrakeLevel])))
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
mvOccupied->BrakeCtrlPos2 -= dt / 20.0;
|
||||
if (mvOccupied->BrakeCtrlPos2 < -1.5)
|
||||
@@ -4765,7 +4773,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
if ((mvOccupied->BrakeHandle == FV4a) && (Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
||||
{
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
mvOccupied->BrakeCtrlPos2 += (mvOccupied->BrakeCtrlPos2 > 2 ? 0 : dt / 20.0);
|
||||
if (mvOccupied->BrakeCtrlPos2 < -3)
|
||||
@@ -4818,7 +4826,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
if (Console::Pressed(Global::Keys[k_Main])) //[]
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if (Global::shiftState)
|
||||
ggMainButton.PutValue(1);
|
||||
else
|
||||
ggMainButton.PutValue(0);
|
||||
@@ -4843,7 +4851,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if (Global::shiftState)
|
||||
{
|
||||
// if (Console::Pressed(k_CurrentNext))
|
||||
{ // Ra: było pod VK_F3
|
||||
@@ -4858,7 +4866,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
{
|
||||
// if (Console::Pressed(k_CurrentNext))
|
||||
{ // Ra: było pod VK_F3
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
if ((mvOccupied->EpFuseSwitch(false)))
|
||||
{
|
||||
@@ -4887,7 +4895,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
// Winger 010304 PantAllDownButton
|
||||
if (Console::Pressed(Global::Keys[k_PantFrontUp]))
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if (Global::shiftState)
|
||||
ggPantFrontButton.PutValue(1);
|
||||
else
|
||||
ggPantAllDownButton.PutValue(1);
|
||||
@@ -4900,7 +4908,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
if (Console::Pressed(Global::Keys[k_PantRearUp]))
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if( Global::shiftState )
|
||||
ggPantRearButton.PutValue(1);
|
||||
else
|
||||
ggPantFrontButtonOff.PutValue(1);
|
||||
@@ -5041,10 +5049,10 @@ bool TTrain::Update( double const Deltatime )
|
||||
//światło wewnętrzne przygaszone (255 216 176)
|
||||
if( mvOccupied->ConverterFlag == true ) {
|
||||
// jasnosc dla zalaczonej przetwornicy
|
||||
DynamicObject->InteriorLightLevel = 0.75f;
|
||||
DynamicObject->InteriorLightLevel = 0.4f;
|
||||
}
|
||||
else {
|
||||
DynamicObject->InteriorLightLevel = 0.375f;
|
||||
DynamicObject->InteriorLightLevel = 0.2f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class TTrackFollower
|
||||
~TTrackFollower();
|
||||
TTrack * SetCurrentTrack(TTrack *pTrack, int end);
|
||||
bool Move(double fDistance, bool bPrimary);
|
||||
inline TTrack * GetTrack()
|
||||
inline TTrack * GetTrack() const
|
||||
{
|
||||
return pCurrentTrack;
|
||||
};
|
||||
@@ -43,7 +43,7 @@ class TTrackFollower
|
||||
return vAngles.x;
|
||||
}; // przechyłka policzona przy ustalaniu pozycji
|
||||
//{return pCurrentSegment->GetRoll(fCurrentDistance)*fDirection;}; //zamiast liczyć można pobrać
|
||||
inline double GetDirection()
|
||||
inline double GetDirection() const
|
||||
{
|
||||
return fDirection;
|
||||
}; // zwrot na torze
|
||||
|
||||
1
VBO.cpp
1
VBO.cpp
@@ -9,7 +9,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "VBO.h"
|
||||
#include "opengl/glew.h"
|
||||
#include "usefull.h"
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
530
World.cpp
530
World.cpp
@@ -15,9 +15,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "stdafx.h"
|
||||
#include "World.h"
|
||||
|
||||
#include "opengl/glew.h"
|
||||
#include "opengl/glut.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Logs.h"
|
||||
#include "MdlMngr.h"
|
||||
@@ -45,6 +42,11 @@ TDynamicObject *Controlled = NULL; // pojazd, który prowadzimy
|
||||
|
||||
const double fTimeMax = 1.00; //[s] maksymalny czas aktualizacji w jednek klatce
|
||||
|
||||
extern "C"
|
||||
{
|
||||
GLFWAPI HWND glfwGetWin32Window( GLFWwindow* window ); //m7todo: potrzebne do directsound
|
||||
}
|
||||
|
||||
TWorld::TWorld()
|
||||
{
|
||||
// randomize();
|
||||
@@ -90,10 +92,11 @@ void TWorld::TrainDelete(TDynamicObject *d)
|
||||
Global::pUserDynamic = NULL; // tego też nie ma
|
||||
};
|
||||
|
||||
GLvoid TWorld::glPrint(const char *txt) // custom GL "Print" routine
|
||||
GLvoid TWorld::glPrint( std::string const &Text ) // custom GL "Print" routine
|
||||
{ // wypisywanie tekstu 2D na ekranie
|
||||
if (!txt)
|
||||
if (true == Text.empty())
|
||||
return;
|
||||
/*
|
||||
if (Global::bGlutFont)
|
||||
{ // tekst generowany przez GLUT
|
||||
int i, len = strlen(txt);
|
||||
@@ -101,10 +104,11 @@ GLvoid TWorld::glPrint(const char *txt) // custom GL "Print" routine
|
||||
glutBitmapCharacterDLL(GLUT_BITMAP_8_BY_13, txt[i]); // funkcja linkowana dynamicznie
|
||||
}
|
||||
else
|
||||
*/
|
||||
{ // generowanie przez Display Lists
|
||||
glPushAttrib(GL_LIST_BIT); // pushes the display list bits
|
||||
glListBase(base - 32); // sets the base character to 32
|
||||
glCallLists(strlen(txt), GL_UNSIGNED_BYTE, txt); // draws the display list text
|
||||
glCallLists(Text.size(), GL_UNSIGNED_BYTE, Text.c_str()); // draws the display list text
|
||||
glPopAttrib(); // pops the display list bits
|
||||
}
|
||||
}
|
||||
@@ -164,10 +168,12 @@ BOOL GetDisplayMonitorInfo(int nDeviceIndex, LPSTR lpszMonitorInfo)
|
||||
}
|
||||
*/
|
||||
|
||||
bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
{
|
||||
auto timestart = std::chrono::system_clock::now();
|
||||
Global::hWnd = NhWnd; // do WM_COPYDATA
|
||||
bool TWorld::Init( GLFWwindow *w ) {
|
||||
|
||||
auto timestart = std::chrono::system_clock::now();
|
||||
|
||||
window = w;
|
||||
Global::window = w; // do WM_COPYDATA
|
||||
Global::pCamera = &Camera; // Ra: wskaźnik potrzebny do likwidacji drgań
|
||||
Global::detonatoryOK = true;
|
||||
WriteLog("Starting MaSzyna rail vehicle simulator.");
|
||||
@@ -187,15 +193,11 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
std::string glver = ((char *)glGetString(GL_VERSION));
|
||||
WriteLog("OpenGL Version:");
|
||||
WriteLog(glver);
|
||||
if ((glver == "1.5.1") || (glver == "1.5.2"))
|
||||
{
|
||||
Error("Niekompatybilna wersja openGL - dwuwymiarowy tekst nie bedzie wyswietlany!");
|
||||
WriteLog("WARNING! This OpenGL version is not fully compatible with simulator!");
|
||||
WriteLog("UWAGA! Ta wersja OpenGL nie jest w pelni kompatybilna z symulatorem!");
|
||||
Global::detonatoryOK = false;
|
||||
if( !GLEW_VERSION_1_4 ) {
|
||||
std::cout << "required opengl >= 1.4" << std::endl;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
Global::detonatoryOK = true;
|
||||
|
||||
// Ra: umieszczone w EU07.cpp jakoś nie chce działać
|
||||
while( glver.rfind( '.' ) > glver.find( '.' ) ) {
|
||||
glver = glver.substr( 0, glver.rfind( '.' ) - 1 ); // obcięcie od drugiej kropki
|
||||
@@ -224,15 +226,6 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog((char *)glGetString(GL_EXTENSIONS));
|
||||
if (GLEW_ARB_vertex_buffer_object) // czy jest VBO w karcie graficznej
|
||||
{
|
||||
if( std::string( (char *)glGetString(GL_VENDOR) ).find("Intel") != std::string::npos ) // wymuszenie tylko dla kart Intel
|
||||
{ // karty Intel nie nadają się do grafiki 3D, ale robimy wyjątek, bo to w końcu symulator
|
||||
Global::iMultisampling =
|
||||
0; // to robi problemy na "Intel(R) HD Graphics Family" - czarny ekran
|
||||
if (Global::fOpenGL >=
|
||||
1.4) // 1.4 miało obsługę VBO, ale bez opcji modyfikacji fragmentu bufora
|
||||
Global::bUseVBO = true; // VBO włączane tylko, jeśli jest obsługa oraz nie ustawiono
|
||||
// niższego numeru
|
||||
}
|
||||
if (Global::bUseVBO)
|
||||
WriteLog("Ra: The VBO is found and will be used.");
|
||||
else
|
||||
@@ -270,7 +263,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
glLoadIdentity();
|
||||
|
||||
glClearDepth( 1.0f ); // ZBuffer Value
|
||||
glClearColor( 51.0f / 255.0f, 106.0f / 255.0f, 85.0f / 255.0f, 1.0f ); // Background Color
|
||||
glClearColor( 51.0f / 255.0f, 102.0f / 255.0f, 85.0f / 255.0f, 1.0f ); // Background Color
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Clear screen and depth buffer
|
||||
|
||||
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
|
||||
@@ -344,55 +337,35 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
/*--------------------Render Initialization End---------------------*/
|
||||
|
||||
WriteLog("Font init"); // początek inicjacji fontów 2D
|
||||
if (Global::bGlutFont) // jeśli wybrano GLUT font, próbujemy zlinkować GLUT32.DLL
|
||||
{
|
||||
UINT mode = SetErrorMode(SEM_NOOPENFILEERRORBOX); // aby nie wrzeszczał, że znaleźć nie może
|
||||
hinstGLUT32 = LoadLibrary(TEXT("GLUT32.DLL")); // get a handle to the DLL module
|
||||
SetErrorMode(mode);
|
||||
// If the handle is valid, try to get the function address.
|
||||
if (hinstGLUT32)
|
||||
glutBitmapCharacterDLL =
|
||||
(FglutBitmapCharacter)GetProcAddress(hinstGLUT32, "glutBitmapCharacter");
|
||||
else
|
||||
WriteLog("Missed GLUT32.DLL.");
|
||||
if (glutBitmapCharacterDLL)
|
||||
WriteLog("Used font from GLUT32.DLL.");
|
||||
else
|
||||
Global::bGlutFont = false; // nie udało się, trzeba spróbować na Display List
|
||||
}
|
||||
if (!Global::bGlutFont)
|
||||
{ // jeśli bezGLUTowy font
|
||||
HFONT font; // Windows Font ID
|
||||
base = glGenLists(96); // storage for 96 characters
|
||||
font = CreateFont(-15, // height of font
|
||||
0, // width of font
|
||||
0, // angle of escapement
|
||||
0, // orientation angle
|
||||
FW_BOLD, // font weight
|
||||
FALSE, // italic
|
||||
FALSE, // underline
|
||||
FALSE, // strikeout
|
||||
ANSI_CHARSET, // character set identifier
|
||||
OUT_TT_PRECIS, // output precision
|
||||
CLIP_DEFAULT_PRECIS, // clipping precision
|
||||
ANTIALIASED_QUALITY, // output quality
|
||||
FF_DONTCARE | DEFAULT_PITCH, // family and pitch
|
||||
"Courier New"); // font name
|
||||
SelectObject(hDC, font); // selects the font we want
|
||||
wglUseFontBitmapsA(hDC, 32, 96, base); // builds 96 characters starting at character 32
|
||||
WriteLog("Display Lists font used."); //+AnsiString(glGetError())
|
||||
}
|
||||
HFONT font; // Windows Font ID
|
||||
base = ::glGenLists(96); // storage for 96 characters
|
||||
HDC hDC = ::GetDC( glfwGetWin32Window( window ) );
|
||||
font = ::CreateFont( -MulDiv( 10, ::GetDeviceCaps( hDC, LOGPIXELSY ), 72 ), // height of font
|
||||
0, // width of font
|
||||
0, // angle of escapement
|
||||
0, // orientation angle
|
||||
(Global::bGlutFont ? FW_MEDIUM : FW_HEAVY), // font weight
|
||||
FALSE, // italic
|
||||
FALSE, // underline
|
||||
FALSE, // strikeout
|
||||
DEFAULT_CHARSET, // character set identifier
|
||||
OUT_DEFAULT_PRECIS, // output precision
|
||||
CLIP_DEFAULT_PRECIS, // clipping precision
|
||||
(Global::bGlutFont ? CLEARTYPE_QUALITY : PROOF_QUALITY), // output quality
|
||||
DEFAULT_PITCH | FF_DONTCARE, // family and pitch
|
||||
"Lucida Console"); // font name
|
||||
::SelectObject(hDC, font); // selects the font we want
|
||||
::wglUseFontBitmapsA(hDC, 32, 96, base); // builds 96 characters starting at character 32
|
||||
WriteLog("Display Lists font used."); //+AnsiString(glGetError())
|
||||
WriteLog("Font init OK"); //+AnsiString(glGetError())
|
||||
|
||||
Timer::ResetTimers();
|
||||
|
||||
hWnd = NhWnd;
|
||||
glColor4f(1.0f, 3.0f, 3.0f, 0.0f);
|
||||
// SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
// glClear(GL_COLOR_BUFFER_BIT);
|
||||
// glFlush();
|
||||
|
||||
SetForegroundWindow(hWnd);
|
||||
WriteLog("Sound Init");
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
@@ -427,75 +400,46 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex2f( -widthratio, 1.0f ); // top left of the texture and quad
|
||||
glEnd();
|
||||
//~logo; Ra: to jest bez sensu zapis
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.85f * widthratio, -0.25f);
|
||||
glPrint("Uruchamianie / Initializing...");
|
||||
glRasterPos2f(-0.85f * widthratio, -0.30f);
|
||||
glPrint("Dzwiek / Sound...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
|
||||
glColor3f(0.0f, 0.0f, 0.0f);
|
||||
glRasterPos2f(-0.85f * widthratio, -0.25f);
|
||||
glPrint("Uruchamianie / Initializing...");
|
||||
glfwSwapBuffers( window );
|
||||
|
||||
/*-----------------------Sound Initialization-----------------------*/
|
||||
TSoundsManager::Init(hWnd);
|
||||
// TSoundsManager::LoadSounds( "" );
|
||||
/*---------------------Sound Initialization End---------------------*/
|
||||
glRasterPos2f( -0.85f * widthratio, -0.30f );
|
||||
glPrint( "Dzwiek / Sound..." );
|
||||
|
||||
TSoundsManager::Init( glfwGetWin32Window( window ) );
|
||||
WriteLog("Sound Init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f * widthratio, -0.30f);
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f(-0.25f * widthratio, -0.30f);
|
||||
glPrint("OK.");
|
||||
glfwSwapBuffers( window );
|
||||
/*---------------------Sound Initialization End---------------------*/
|
||||
|
||||
int i;
|
||||
|
||||
Paused = true;
|
||||
WriteLog("Textures init");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.85f * widthratio, -0.35f);
|
||||
glPrint("Tekstury / Textures...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
/*
|
||||
TTexturesManager.Init();
|
||||
*/
|
||||
glRasterPos2f(-0.85f * widthratio, -0.35f);
|
||||
glPrint("Tekstury / Textures...");
|
||||
glfwSwapBuffers( window );
|
||||
WriteLog("Textures init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.25f * widthratio, -0.35f );
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f( -0.25f * widthratio, -0.35f );
|
||||
glPrint("OK.");
|
||||
glfwSwapBuffers( window );
|
||||
|
||||
WriteLog("Models init");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.85f * widthratio, -0.40f );
|
||||
glPrint("Modele / Models...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
// McZapkie: dodalem sciezke zeby mozna bylo definiowac skad brac modele ale to malo eleganckie
|
||||
// TModelsManager::LoadModels(asModelsPatch);
|
||||
glRasterPos2f( -0.85f * widthratio, -0.40f );
|
||||
glPrint("Modele / Models...");
|
||||
glfwSwapBuffers( window );
|
||||
TModelsManager::Init();
|
||||
WriteLog("Models init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.25f * widthratio, -0.40f );
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f( -0.25f * widthratio, -0.40f );
|
||||
glPrint("OK.");
|
||||
glfwSwapBuffers( window );
|
||||
|
||||
WriteLog("Ground init");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.85f * widthratio, -0.45f );
|
||||
glPrint("Sceneria / Scenery (please wait)...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f( -0.85f * widthratio, -0.45f );
|
||||
glPrint("Sceneria / Scenery (please wait)...");
|
||||
glfwSwapBuffers( window );
|
||||
|
||||
#ifndef EU07_USE_OLD_LIGHTING_MODEL
|
||||
// setup lighting
|
||||
@@ -514,16 +458,14 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
Global::DayLight.diffuse[ 2 ] = 231.0 / 255.0;
|
||||
#endif
|
||||
|
||||
Ground.Init(Global::SceneryFile, hDC);
|
||||
Ground.Init(Global::SceneryFile);
|
||||
// Global::tSinceStart= 0;
|
||||
Environment.init();
|
||||
WriteLog("Ground init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.25f * widthratio, -0.45f );
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f( -0.25f * widthratio, -0.45f );
|
||||
glColor3f( 0.0f, 0.0f, 0.0f );
|
||||
glPrint( "OK." );
|
||||
glfwSwapBuffers( window );
|
||||
|
||||
// TTrack *Track=Ground.FindGroundNode("train_start",TP_TRACK)->pTrack;
|
||||
|
||||
@@ -535,12 +477,10 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
Camera.Init(Global::pFreeCameraInit[0], Global::pFreeCameraInitAngle[0]);
|
||||
|
||||
char buff[255] = "Player train init: ";
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.85f * widthratio, -0.50f );
|
||||
glPrint("Przygotowanie kabiny do sterowania...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f( -0.85f * widthratio, -0.50f );
|
||||
glColor3f( 0.0f, 0.0f, 0.0f );
|
||||
glPrint( "Przygotowanie kabiny do sterowania..." );
|
||||
glfwSwapBuffers( window );
|
||||
|
||||
strcat(buff, Global::asHumanCtrlVehicle.c_str());
|
||||
WriteLog(buff);
|
||||
@@ -556,24 +496,20 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
mvControlled = Controlled->ControlledFind()->MoverParameters;
|
||||
Global::pUserDynamic = Controlled; // renerowanie pojazdu względem kabiny
|
||||
WriteLog("Player train init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.25f * widthratio, -0.50f );
|
||||
glPrint("OK.");
|
||||
}
|
||||
glRasterPos2f( -0.25f * widthratio, -0.50f );
|
||||
glColor3f( 0.0f, 0.0f, 0.0f );
|
||||
glPrint( "OK." );
|
||||
FollowView();
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glfwSwapBuffers( window );
|
||||
}
|
||||
else
|
||||
{
|
||||
Error("Player train init failed!");
|
||||
FreeFlyModeFlag = true; // Ra: automatycznie włączone latanie
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.85f * widthratio, -0.50f );
|
||||
glPrint("Blad inicjalizacji sterowanego pojazdu!");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
glRasterPos2f( -0.85f * widthratio, -0.50f );
|
||||
glColor3f( 0.0f, 0.0f, 0.0f );
|
||||
glPrint( "Blad inicjalizacji sterowanego pojazdu!" );
|
||||
glfwSwapBuffers( window );
|
||||
Controlled = NULL;
|
||||
mvControlled = NULL;
|
||||
Camera.Type = tp_Free;
|
||||
@@ -584,14 +520,12 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
if (Global::asHumanCtrlVehicle != "ghostview")
|
||||
{
|
||||
Error("Player train not exist!");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f( -0.85f * widthratio, -0.55f );
|
||||
glPrint("Wybrany pojazd nie istnieje w scenerii!");
|
||||
}
|
||||
glRasterPos2f( -0.85f * widthratio, -0.55f );
|
||||
glColor3f( 0.0f, 0.0f, 0.0f );
|
||||
glPrint( "Wybrany pojazd nie istnieje w scenerii!" );
|
||||
}
|
||||
FreeFlyModeFlag = true; // Ra: automatycznie włączone latanie
|
||||
SwapBuffers(hDC); // swap buffers (double buffering)
|
||||
glfwSwapBuffers( window );
|
||||
Controlled = NULL;
|
||||
mvControlled = NULL;
|
||||
Camera.Type = tp_Free;
|
||||
@@ -636,44 +570,10 @@ void TWorld::OnKeyDown(int cKey)
|
||||
// na każdy kod wirtualny niech przypadają 4 bajty: 2 dla naciśnięcia i 2 dla zwolnienia
|
||||
// powtórzone 256 razy da 1kB na każdy stan przełączników, łącznie będzie 4kB pierwszej tabeli
|
||||
// przekodowania
|
||||
if (!Global::iPause)
|
||||
{ // podczas pauzy klawisze nie działają
|
||||
std::string info = "Key pressed: [";
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
info += "Shift]+[";
|
||||
if (Console::Pressed(VK_CONTROL))
|
||||
info += "Ctrl]+[";
|
||||
if (cKey > 192) // coś tam jeszcze ciekawego jest?
|
||||
{
|
||||
if (cKey < 255) // 255 to [Fn] w laptopach
|
||||
WriteLog(info + (char)(cKey - 128) + "]");
|
||||
}
|
||||
else if (cKey >= 186)
|
||||
WriteLog(info + std::string(";=,-./~").substr(cKey - 186, 1) + "]");
|
||||
else if (cKey > 123) // coś tam jeszcze ciekawego jest?
|
||||
WriteLog(info + std::to_string(cKey) + "]"); // numer klawisza
|
||||
else if (cKey >= 112) // funkcyjne
|
||||
WriteLog(info + "F" + std::to_string(cKey - 111) + "]");
|
||||
else if (cKey >= 96)
|
||||
WriteLog(info + "Num" + std::string("0123456789*+?-./").substr(cKey - 96, 1) + "]");
|
||||
else if (((cKey >= '0') && (cKey <= '9')) || ((cKey >= 'A') && (cKey <= 'Z')) ||
|
||||
(cKey == ' '))
|
||||
WriteLog(info + (char)(cKey) + "]");
|
||||
else if (cKey == '-')
|
||||
WriteLog(info + "Insert]");
|
||||
else if (cKey == '.')
|
||||
WriteLog(info + "Delete]");
|
||||
else if (cKey == '$')
|
||||
WriteLog(info + "Home]");
|
||||
else if (cKey == '#')
|
||||
WriteLog(info + "End]");
|
||||
else if (cKey > 'Z') //żeby nie logować kursorów
|
||||
WriteLog(info + std::to_string(cKey) + "]"); // numer klawisza
|
||||
}
|
||||
if ((cKey <= '9') ? (cKey >= '0') : false) // klawisze cyfrowe
|
||||
{
|
||||
int i = cKey - '0'; // numer klawisza
|
||||
if (Console::Pressed(VK_SHIFT))
|
||||
if (Global::shiftState)
|
||||
{ // z [Shift] uruchomienie eventu
|
||||
if (!Global::iPause) // podczas pauzy klawisze nie działają
|
||||
if (KeyEvents[i])
|
||||
@@ -681,8 +581,8 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
else // zapamiętywanie kamery może działać podczas pauzy
|
||||
if (FreeFlyModeFlag) // w trybie latania można przeskakiwać do ustawionych kamer
|
||||
if ((Global::iTextMode != VK_F12) &&
|
||||
(Global::iTextMode != VK_F3)) // ograniczamy użycie kamer
|
||||
if( ( Global::iTextMode != GLFW_KEY_F12 ) &&
|
||||
( Global::iTextMode != GLFW_KEY_F3 ) ) // ograniczamy użycie kamer
|
||||
{
|
||||
if ((!Global::pFreeCameraInit[i].x && !Global::pFreeCameraInit[i].y &&
|
||||
!Global::pFreeCameraInit[i].z))
|
||||
@@ -714,30 +614,30 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
// będzie jeszcze załączanie sprzęgów z [Ctrl]
|
||||
}
|
||||
else if ((cKey >= VK_F1) ? (cKey <= VK_F12) : false)
|
||||
else if( ( cKey >= GLFW_KEY_F1 ) && ( cKey <= GLFW_KEY_F12 ) )
|
||||
{
|
||||
switch (cKey) {
|
||||
|
||||
case VK_F1: {
|
||||
case GLFW_KEY_F1: {
|
||||
if( DebugModeFlag ) {
|
||||
// additional time speedup keys in debug mode
|
||||
if( Console::Pressed( VK_CONTROL ) ) {
|
||||
if( Global::ctrlState ) {
|
||||
// ctrl-f3
|
||||
GlobalTime->UpdateMTableTime( 20.0 * 60.0 );
|
||||
}
|
||||
else if( Console::Pressed( VK_SHIFT ) ) {
|
||||
else if( Global::shiftState ) {
|
||||
// shift-f3
|
||||
GlobalTime->UpdateMTableTime( 5.0 * 60.0 );
|
||||
}
|
||||
}
|
||||
if( ( false == Console::Pressed( VK_CONTROL ) )
|
||||
&& ( false == Console::Pressed( VK_SHIFT ) ) ) {
|
||||
if( ( false == Global::ctrlState )
|
||||
&& ( false == Global::shiftState ) ) {
|
||||
// czas i relacja
|
||||
if( Global::iTextMode == cKey ) {
|
||||
// wyłączenie napisów, chyba że pauza
|
||||
Global::iTextMode =
|
||||
( Global::iPause && ( cKey != VK_F1 ) ?
|
||||
VK_F1 :
|
||||
( Global::iPause && ( cKey != GLFW_KEY_F1 ) ?
|
||||
GLFW_KEY_F1 :
|
||||
0 );
|
||||
}
|
||||
else
|
||||
@@ -745,58 +645,58 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VK_F2: {
|
||||
case GLFW_KEY_F2: {
|
||||
// parametry pojazdu
|
||||
if( Global::iTextMode == cKey ) {
|
||||
// jeśli kolejne naciśnięcie
|
||||
++Global::iScreenMode[ cKey - VK_F1 ]; // kolejny ekran
|
||||
++Global::iScreenMode[ cKey - GLFW_KEY_F1 ]; // kolejny ekran
|
||||
}
|
||||
else {
|
||||
// pierwsze naciśnięcie daje pierwszy (tzn. zerowy) ekran
|
||||
Global::iTextMode = cKey;
|
||||
Global::iScreenMode[ cKey - VK_F1 ] = 0;
|
||||
Global::iScreenMode[ cKey - GLFW_KEY_F1 ] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VK_F3: {
|
||||
case GLFW_KEY_F3: {
|
||||
Global::iTextMode = cKey;
|
||||
break;
|
||||
}
|
||||
case VK_F4: {
|
||||
case GLFW_KEY_F4: {
|
||||
|
||||
InOutKey( !Console::Pressed( VK_SHIFT ) ); // distant view with Shift, short distance step out otherwise
|
||||
InOutKey( !Global::shiftState ); // distant view with Shift, short distance step out otherwise
|
||||
break;
|
||||
}
|
||||
case VK_F5: {
|
||||
case GLFW_KEY_F5: {
|
||||
// przesiadka do innego pojazdu
|
||||
Global::iTextMode = cKey;
|
||||
break;
|
||||
}
|
||||
case VK_F6: {
|
||||
case GLFW_KEY_F6: {
|
||||
Global::iTextMode = cKey;
|
||||
// przyspieszenie symulacji do testowania scenerii... uwaga na FPS!
|
||||
if( DebugModeFlag ) {
|
||||
|
||||
if( Console::Pressed( VK_CONTROL ) ) { Global::fTimeSpeed = ( Console::Pressed( VK_SHIFT ) ? 60.0 : 20.0 ); }
|
||||
else { Global::fTimeSpeed = ( Console::Pressed( VK_SHIFT ) ? 5.0 : 1.0 ); }
|
||||
if( Global::ctrlState ) { Global::fTimeSpeed = ( Global::shiftState ? 60.0 : 20.0 ); }
|
||||
else { Global::fTimeSpeed = ( Global::shiftState ? 5.0 : 1.0 ); }
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VK_F8: {
|
||||
case GLFW_KEY_F8: {
|
||||
Global::iTextMode = cKey;
|
||||
// FPS
|
||||
break;
|
||||
}
|
||||
case VK_F9: {
|
||||
case GLFW_KEY_F9: {
|
||||
Global::iTextMode = cKey;
|
||||
// wersja, typ wyświetlania, błędy OpenGL
|
||||
break;
|
||||
}
|
||||
case VK_F10: {
|
||||
case GLFW_KEY_F10: {
|
||||
if( Global::iTextMode == cKey ) {
|
||||
Global::iTextMode =
|
||||
( Global::iPause && ( cKey != VK_F1 ) ?
|
||||
VK_F1 :
|
||||
( Global::iPause && ( cKey != GLFW_KEY_F1 ) ?
|
||||
GLFW_KEY_F1 :
|
||||
0 ); // wyłączenie napisów, chyba że pauza
|
||||
}
|
||||
else {
|
||||
@@ -804,10 +704,10 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VK_F12: {
|
||||
case GLFW_KEY_F12: {
|
||||
// coś tam jeszcze
|
||||
if( Console::Pressed( VK_CONTROL )
|
||||
&& Console::Pressed( VK_SHIFT ) )
|
||||
if( Global::ctrlState
|
||||
&& Global::shiftState )
|
||||
DebugModeFlag = !DebugModeFlag; // taka opcjonalna funkcja, może się czasem przydać
|
||||
else
|
||||
Global::iTextMode = cKey;
|
||||
@@ -817,7 +717,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
// if (cKey!=VK_F4)
|
||||
return; // nie są przekazywane do pojazdu wcale
|
||||
}
|
||||
if (Global::iTextMode == VK_F10) // wyświetlone napisy klawiszem F10
|
||||
if( Global::iTextMode == GLFW_KEY_F10 ) // wyświetlone napisy klawiszem F10
|
||||
{ // i potwierdzenie
|
||||
if( cKey == 'Y' ) {
|
||||
// flaga wyjścia z programu
|
||||
@@ -826,9 +726,9 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
return; // nie przekazujemy do pociągu
|
||||
}
|
||||
else if ((Global::iTextMode == VK_F12) ? (cKey >= '0') && (cKey <= '9') : false)
|
||||
else if ((Global::iTextMode == GLFW_KEY_F12) ? (cKey >= '0') && (cKey <= '9') : false)
|
||||
{ // tryb konfiguracji debugmode (przestawianie kamery już wyłączone
|
||||
if (!Console::Pressed(VK_SHIFT)) // bez [Shift]
|
||||
if (!Global::shiftState) // bez [Shift]
|
||||
{
|
||||
if (cKey == '1')
|
||||
Global::iWriteLogEnabled ^= 1; // włącz/wyłącz logowanie do pliku
|
||||
@@ -862,7 +762,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
TDynamicObject *temp = Global::DynamicNearest();
|
||||
if (temp)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0) // z ctrl odcinanie
|
||||
if (Global::ctrlState < 0) // z ctrl odcinanie
|
||||
{
|
||||
temp->MoverParameters->BrakeStatus ^= 128;
|
||||
}
|
||||
@@ -879,8 +779,8 @@ void TWorld::OnKeyDown(int cKey)
|
||||
TDynamicObject *temp = Global::DynamicNearest();
|
||||
if (temp)
|
||||
{
|
||||
if (Console::Pressed(VK_SHIFT) ? temp->MoverParameters->IncBrakeMult() :
|
||||
temp->MoverParameters->DecBrakeMult())
|
||||
if (Global::shiftState ? temp->MoverParameters->IncBrakeMult() :
|
||||
temp->MoverParameters->DecBrakeMult())
|
||||
if (Train)
|
||||
{ // dźwięk oczywiście jest w kabinie
|
||||
Train->dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
@@ -902,9 +802,9 @@ void TWorld::OnKeyDown(int cKey)
|
||||
CouplNr = 0; // z [-1,1] zrobić [0,1]
|
||||
int mask, set = 0; // Ra: [Shift]+[Ctrl]+[T] odpala mi jakąś idiotyczną zmianę
|
||||
// tapety pulpitu :/
|
||||
if (GetAsyncKeyState(VK_SHIFT) < 0) // z [Shift] zapalanie
|
||||
if (Global::shiftState < 0) // z [Shift] zapalanie
|
||||
set = mask = 64; // bez [Ctrl] założyć tabliczki
|
||||
else if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
else if (Global::ctrlState < 0)
|
||||
set = mask = 2 + 32; // z [Ctrl] zapalić światła czerwone
|
||||
else
|
||||
mask = 2 + 32 + 64; // wyłączanie ściąga wszystko
|
||||
@@ -924,7 +824,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
TDynamicObject *temp = Global::DynamicNearest();
|
||||
if (temp)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState < 0)
|
||||
if ((temp->MoverParameters->LocalBrake == ManualBrake) ||
|
||||
(temp->MoverParameters->MBrake == true))
|
||||
temp->MoverParameters->IncManualBrakeLevel(1);
|
||||
@@ -944,7 +844,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
TDynamicObject *temp = Global::DynamicNearest();
|
||||
if (temp)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (Global::ctrlState < 0)
|
||||
if ((temp->MoverParameters->LocalBrake == ManualBrake) ||
|
||||
(temp->MoverParameters->MBrake == true))
|
||||
temp->MoverParameters->DecManualBrakeLevel(1);
|
||||
@@ -1021,19 +921,25 @@ void TWorld::DistantView( bool const Near )
|
||||
else if( nullptr != pDynamicNearest ) { vehicle = pDynamicNearest; }
|
||||
else { return; }
|
||||
|
||||
auto const cab =
|
||||
( vehicle->MoverParameters->ActiveCab == 0 ?
|
||||
1 :
|
||||
vehicle->MoverParameters->ActiveCab );
|
||||
auto const left = vehicle->VectorLeft() * cab;
|
||||
|
||||
if( true == Near ) {
|
||||
|
||||
Camera.Pos =
|
||||
vector3( Camera.Pos.x, vehicle->GetPosition().y, Camera.Pos.z )
|
||||
+ vehicle->VectorLeft() * vehicle->MoverParameters->ActiveCab * vehicle->GetWidth()
|
||||
+ vector3( 1.25 * vehicle->MoverParameters->ActiveCab, 1.6, 0.0 );
|
||||
+ left * vehicle->GetWidth()
|
||||
+ vector3( 1.25 * left.x, 1.6, 1.25 * left.z );
|
||||
}
|
||||
else {
|
||||
|
||||
Camera.Pos =
|
||||
vehicle->GetPosition()
|
||||
+ vehicle->VectorFront() * vehicle->MoverParameters->ActiveCab * 50.0
|
||||
+ vector3( -10.0, 1.6, 0.0 );
|
||||
+ vector3( -10.0 * left.x, 1.6, -10.0 * left.z );
|
||||
}
|
||||
|
||||
Camera.LookAt = vehicle->GetPosition();
|
||||
@@ -1157,7 +1063,7 @@ bool TWorld::Update()
|
||||
*/
|
||||
iCheckFPS = 0.25 * Timer::GetFPS(); // tak za 0.25 sekundy sprawdzić ponownie (jeszcze przycina?)
|
||||
}
|
||||
Timer::UpdateTimers(Global::iPause);
|
||||
Timer::UpdateTimers(Global::iPause != 0);
|
||||
if( (Global::iPause == false)
|
||||
|| (m_init == false) )
|
||||
{ // jak pauza, to nie ma po co tego przeliczać
|
||||
@@ -1193,20 +1099,7 @@ bool TWorld::Update()
|
||||
int n = int(iter); // ile kroków jako int
|
||||
fTimeBuffer -= iter * fMaxDt; // reszta czasu na potem (do bufora)
|
||||
if (n > 20)
|
||||
n = 20; // Ra: jeżeli FPS jest zatrważająco niski, to fizyka nie może zająć całkowicie
|
||||
// procesora
|
||||
#if 0
|
||||
Ground.UpdatePhys(fMaxDt,n); //Ra: teraz czas kroku jest (względnie) stały
|
||||
if (DebugModeFlag)
|
||||
if (Global::bActive) //nie przyspieszać, gdy jedzie w tle :)
|
||||
if (GetAsyncKeyState(VK_ESCAPE)<0)
|
||||
{//yB dodał przyspieszacz fizyki
|
||||
Ground.UpdatePhys(fMaxDt,n);
|
||||
Ground.UpdatePhys(fMaxDt,n);
|
||||
Ground.UpdatePhys(fMaxDt,n);
|
||||
Ground.UpdatePhys(fMaxDt,n); //w sumie 5 razy
|
||||
}
|
||||
#endif
|
||||
n = 20; // Ra: jeżeli FPS jest zatrważająco niski, to fizyka nie może zająć całkowicie procesora
|
||||
}
|
||||
// awaria PoKeys mogła włączyć pauzę - przekazać informację
|
||||
if (Global::iMultiplayer) // dajemy znać do serwera o wykonaniu
|
||||
@@ -1229,10 +1122,11 @@ bool TWorld::Update()
|
||||
// blablabla
|
||||
// Ground.UpdatePhys(dt,n); //na razie tu //2014-12: yB przeniósł do Ground.Update() :(
|
||||
Ground.Update(dt, n); // tu zrobić tylko coklatkową aktualizację przesunięć
|
||||
|
||||
if (DebugModeFlag)
|
||||
if (Global::bActive) // nie przyspieszać, gdy jedzie w tle :)
|
||||
if (GetAsyncKeyState(VK_ESCAPE) < 0)
|
||||
{ // yB dodał przyspieszacz fizyki
|
||||
if( Console::Pressed( GLFW_KEY_ESCAPE ) ) {
|
||||
// yB dodał przyspieszacz fizyki
|
||||
Ground.Update(dt, n);
|
||||
Ground.Update(dt, n);
|
||||
Ground.Update(dt, n);
|
||||
@@ -1278,56 +1172,54 @@ bool TWorld::Update()
|
||||
|
||||
void
|
||||
TWorld::Update_Camera( double const Deltatime ) {
|
||||
|
||||
// Console::Update(); //tu jest zależne od FPS, co nie jest korzystne
|
||||
if( Global::bActive ) { // obsługa ruchu kamery tylko gdy okno jest aktywne
|
||||
if( Console::Pressed( VK_LBUTTON ) ) {
|
||||
Camera.Reset(); // likwidacja obrotów - patrzy horyzontalnie na południe
|
||||
// if (!FreeFlyModeFlag) //jeśli wewnątrz - patrzymy do tyłu
|
||||
// Camera.LookAt=Train->pMechPosition-Normalize(Train->GetDirection())*10;
|
||||
if( Controlled ? LengthSquared3( Controlled->GetPosition() - Camera.Pos ) < 2250000 :
|
||||
false ) // gdy bliżej niż 1.5km
|
||||
Camera.LookAt = Controlled->GetPosition();
|
||||
else {
|
||||
TDynamicObject *d =
|
||||
Ground.DynamicNearest( Camera.Pos, 300 ); // szukaj w promieniu 300m
|
||||
if( !d )
|
||||
d = Ground.DynamicNearest( Camera.Pos,
|
||||
1000 ); // dalej szukanie, jesli bliżej nie ma
|
||||
if( d && pDynamicNearest ) // jeśli jakiś jest znaleziony wcześniej
|
||||
if( 100.0 * LengthSquared3( d->GetPosition() - Camera.Pos ) >
|
||||
LengthSquared3( pDynamicNearest->GetPosition() - Camera.Pos ) )
|
||||
d = pDynamicNearest; // jeśli najbliższy nie jest 10 razy bliżej niż
|
||||
// poprzedni najbliższy, zostaje poprzedni
|
||||
if( d )
|
||||
pDynamicNearest = d; // zmiana na nowy, jeśli coś znaleziony niepusty
|
||||
if( pDynamicNearest )
|
||||
Camera.LookAt = pDynamicNearest->GetPosition();
|
||||
}
|
||||
if( FreeFlyModeFlag )
|
||||
Camera.RaLook(); // jednorazowe przestawienie kamery
|
||||
}
|
||||
else if( Console::Pressed( VK_RBUTTON ) ) { //||Console::Pressed(VK_F4))
|
||||
FollowView( false ); // bez wyciszania dźwięków
|
||||
}
|
||||
else if( true == Console::Pressed( VK_MBUTTON ) ) {
|
||||
// middle mouse button controls zoom.
|
||||
Global::ZoomFactor = std::min( 4.5f, Global::ZoomFactor + 15.0f * static_cast<float>(Deltatime) );
|
||||
}
|
||||
else if( false == Console::Pressed( VK_MBUTTON ) ) {
|
||||
// reset zoom level if the button is no longer held down.
|
||||
// NOTE: yes, this is terrible way to go about it. it'll do for now.
|
||||
Global::ZoomFactor = std::max( 1.0f, Global::ZoomFactor - 15.0f * static_cast<float>( Deltatime ) );
|
||||
}
|
||||
|
||||
/*
|
||||
else if( Global::iTextMode == -1 ) { // tu mozna dodac dopisywanie do logu przebiegu lokomotywy
|
||||
WriteLog( "Number of textures used: " + std::to_string( Global::iTextures ) );
|
||||
return false;
|
||||
if( glfwGetMouseButton( window, GLFW_MOUSE_BUTTON_LEFT ) == GLFW_PRESS ) {
|
||||
Camera.Reset(); // likwidacja obrotów - patrzy horyzontalnie na południe
|
||||
// if (!FreeFlyModeFlag) //jeśli wewnątrz - patrzymy do tyłu
|
||||
// Camera.LookAt=Train->pMechPosition-Normalize(Train->GetDirection())*10;
|
||||
if( Controlled ? LengthSquared3( Controlled->GetPosition() - Camera.Pos ) < 2250000 :
|
||||
false ) // gdy bliżej niż 1.5km
|
||||
Camera.LookAt = Controlled->GetPosition();
|
||||
else {
|
||||
TDynamicObject *d =
|
||||
Ground.DynamicNearest( Camera.Pos, 300 ); // szukaj w promieniu 300m
|
||||
if( !d )
|
||||
d = Ground.DynamicNearest( Camera.Pos,
|
||||
1000 ); // dalej szukanie, jesli bliżej nie ma
|
||||
if( d && pDynamicNearest ) // jeśli jakiś jest znaleziony wcześniej
|
||||
if( 100.0 * LengthSquared3( d->GetPosition() - Camera.Pos ) >
|
||||
LengthSquared3( pDynamicNearest->GetPosition() - Camera.Pos ) )
|
||||
d = pDynamicNearest; // jeśli najbliższy nie jest 10 razy bliżej niż
|
||||
// poprzedni najbliższy, zostaje poprzedni
|
||||
if( d )
|
||||
pDynamicNearest = d; // zmiana na nowy, jeśli coś znaleziony niepusty
|
||||
if( pDynamicNearest )
|
||||
Camera.LookAt = pDynamicNearest->GetPosition();
|
||||
}
|
||||
*/
|
||||
Camera.Update(); // uwzględnienie ruchu wywołanego klawiszami
|
||||
} // koniec bloku pomijanego przy nieaktywnym oknie
|
||||
if( FreeFlyModeFlag )
|
||||
Camera.RaLook(); // jednorazowe przestawienie kamery
|
||||
}
|
||||
else if( glfwGetMouseButton( window, GLFW_MOUSE_BUTTON_RIGHT ) == GLFW_PRESS ) { //||Console::Pressed(VK_F4))
|
||||
FollowView( false ); // bez wyciszania dźwięków
|
||||
}
|
||||
else if( glfwGetMouseButton( window, GLFW_MOUSE_BUTTON_MIDDLE ) == GLFW_PRESS ) {
|
||||
// middle mouse button controls zoom.
|
||||
Global::ZoomFactor = std::min( 4.5f, Global::ZoomFactor + 15.0f * static_cast<float>( Deltatime ) );
|
||||
}
|
||||
else if( glfwGetMouseButton( window, GLFW_MOUSE_BUTTON_MIDDLE ) != GLFW_PRESS ) {
|
||||
// reset zoom level if the button is no longer held down.
|
||||
// NOTE: yes, this is terrible way to go about it. it'll do for now.
|
||||
Global::ZoomFactor = std::max( 1.0f, Global::ZoomFactor - 15.0f * static_cast<float>( Deltatime ) );
|
||||
}
|
||||
|
||||
/*
|
||||
else if( Global::iTextMode == -1 ) { // tu mozna dodac dopisywanie do logu przebiegu lokomotywy
|
||||
WriteLog( "Number of textures used: " + std::to_string( Global::iTextures ) );
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
Camera.Update(); // uwzględnienie ruchu wywołanego klawiszami
|
||||
|
||||
if( Camera.Type == tp_Follow ) {
|
||||
if( Train ) { // jeśli jazda w kabinie, przeliczyć trzeba parametry kamery
|
||||
@@ -1338,26 +1230,17 @@ TWorld::Update_Camera( double const Deltatime ) {
|
||||
tempangle =
|
||||
Controlled->VectorFront() * ( Controlled->MoverParameters->ActiveCab == -1 ? -1 : 1 );
|
||||
modelrotate = atan2( -tempangle.x, tempangle.z );
|
||||
if( Console::Pressed( VK_CONTROL ) ? ( Console::Pressed( Global::Keys[ k_MechLeft ] ) ||
|
||||
if( Global::ctrlState ? ( Console::Pressed( Global::Keys[ k_MechLeft ] ) ||
|
||||
Console::Pressed( Global::Keys[ k_MechRight ] ) ) :
|
||||
false ) { // jeśli lusterko lewe albo prawe (bez rzucania na razie)
|
||||
bool lr = Console::Pressed( Global::Keys[ k_MechLeft ] );
|
||||
#if 0
|
||||
Camera.Pos = Train->MirrorPosition( lr ); //robocza wartość
|
||||
if( Controlled->MoverParameters->ActiveCab<0 ) lr = !lr; //w drugiej kabinie odwrotnie jest środek
|
||||
Camera.LookAt = Controlled->GetPosition() + vector3( lr ? 2.0 : -2.0, Camera.Pos.y, 0 ); //trochę na zewnątrz, użyć szerokości pojazdu
|
||||
//Camera.LookAt=Train->pMechPosition+Train->GetDirection()*Train->Dynamic()->MoverParameters->ActiveCab;
|
||||
Camera.Pos += Controlled->GetPosition();
|
||||
//Camera.RaLook(); //jednorazowe przestawienie kamery
|
||||
Camera.Yaw = 0; //odchylenie na bok od Camera.LookAt
|
||||
#else
|
||||
// Camera.Yaw powinno być wyzerowane, aby po powrocie patrzeć do przodu
|
||||
Camera.Pos =
|
||||
Controlled->GetPosition() + Train->MirrorPosition( lr ); // pozycja lusterka
|
||||
Camera.Yaw = 0; // odchylenie na bok od Camera.LookAt
|
||||
if( Train->Dynamic()->MoverParameters->ActiveCab == 0 )
|
||||
Camera.LookAt = Camera.Pos - Train->GetDirection(); // gdy w korytarzu
|
||||
else if( Console::Pressed( VK_SHIFT ) ) { // patrzenie w bok przez szybę
|
||||
else if( Global::shiftState ) { // patrzenie w bok przez szybę
|
||||
Camera.LookAt = Camera.Pos -
|
||||
( lr ? -1 : 1 ) * Train->Dynamic()->VectorLeft() *
|
||||
Train->Dynamic()->MoverParameters->ActiveCab;
|
||||
@@ -1371,7 +1254,6 @@ TWorld::Update_Camera( double const Deltatime ) {
|
||||
Global::SetCameraRotation( M_PI -
|
||||
modelrotate ); // tu już trzeba uwzględnić lusterka
|
||||
}
|
||||
#endif
|
||||
Camera.Roll =
|
||||
atan( Train->pMechShake.x * Train->fMechRoll ); // hustanie kamery na boki
|
||||
Camera.Pitch =
|
||||
@@ -1529,7 +1411,7 @@ bool TWorld::Render()
|
||||
glMatrixMode( GL_PROJECTION ); // select the Projection Matrix
|
||||
glLoadIdentity(); // reset the Projection Matrix
|
||||
// calculate the aspect ratio of the window
|
||||
gluPerspective( Global::FieldOfView / Global::ZoomFactor, (GLdouble)Global::ScreenWidth / (GLdouble)Global::ScreenHeight, 0.1f * Global::ZoomFactor, 2500.0f * Global::ZoomFactor );
|
||||
gluPerspective( Global::FieldOfView / Global::ZoomFactor, (GLdouble)Global::ScreenWidth / std::max((GLdouble)Global::ScreenHeight, 1.0), 0.1f * Global::ZoomFactor, 2500.0f * Global::ZoomFactor );
|
||||
|
||||
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity();
|
||||
@@ -1831,7 +1713,7 @@ TWorld::Render_UI() {
|
||||
glMatrixMode( GL_PROJECTION ); // select the Projection Matrix
|
||||
glLoadIdentity(); // reset the Projection Matrix
|
||||
// calculate the aspect ratio of the window
|
||||
gluPerspective( 45.0f, (GLdouble)Global::ScreenWidth / (GLdouble)Global::ScreenHeight, 0.2f, 2500.0f );
|
||||
gluPerspective( 45.0f, (GLdouble)Global::ScreenWidth / std::max((GLdouble)Global::ScreenHeight, 1.0), 0.2f, 2500.0f );
|
||||
glMatrixMode( GL_MODELVIEW ); // Select The Modelview Matrix
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -1851,8 +1733,8 @@ TWorld::Render_UI() {
|
||||
if (Console::Pressed(VK_F6))
|
||||
{Global::slowmotion=false;};*/
|
||||
|
||||
if( Global::iTextMode == VK_F8 ) {
|
||||
Global::iViewMode = VK_F8;
|
||||
if( Global::iTextMode == GLFW_KEY_F8 ) {
|
||||
Global::iViewMode = GLFW_KEY_F8;
|
||||
OutText1 = "FPS: ";
|
||||
OutText1 += to_string( Timer::GetFPS(), 2 );
|
||||
//OutText1 += sprintf();
|
||||
@@ -1986,15 +1868,15 @@ TWorld::Render_UI() {
|
||||
glDepthFunc( GL_ALWAYS );
|
||||
glDisable( GL_LIGHTING );
|
||||
if( Controlled )
|
||||
SetWindowText( hWnd, Controlled->MoverParameters->Name.c_str() );
|
||||
glfwSetWindowTitle( window, Controlled->MoverParameters->Name.c_str() );
|
||||
else
|
||||
SetWindowText( hWnd, Global::SceneryFile.c_str() ); // nazwa scenerii
|
||||
glfwSetWindowTitle( window, Global::SceneryFile.c_str() ); // nazwa scenerii
|
||||
GfxRenderer.Bind( 0 );
|
||||
glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0f, 0.0f, -0.50f );
|
||||
|
||||
if( Global::iTextMode == VK_F1 ) { // tekst pokazywany po wciśnięciu [F1]
|
||||
if( Global::iTextMode == GLFW_KEY_F1 ) { // tekst pokazywany po wciśnięciu [F1]
|
||||
// Global::iViewMode=VK_F1;
|
||||
glColor3f( 1.0f, 1.0f, 1.0f ); // a, damy białym
|
||||
OutText1 =
|
||||
@@ -2019,16 +1901,16 @@ TWorld::Render_UI() {
|
||||
OutText3 = ""; // Pomoc w sterowaniu - [F9]";
|
||||
// OutText3=AnsiString(Global::pCameraRotationDeg); //kąt kamery względem północy
|
||||
}
|
||||
else if( Global::iTextMode == VK_F12 ) { // opcje włączenia i wyłączenia logowania
|
||||
else if( Global::iTextMode == GLFW_KEY_F12 ) { // opcje włączenia i wyłączenia logowania
|
||||
OutText1 = "[0] Debugmode " + std::string( DebugModeFlag ? "(on)" : "(off)" );
|
||||
OutText2 = "[1] log.txt " + std::string( ( Global::iWriteLogEnabled & 1 ) ? "(on)" : "(off)" );
|
||||
OutText3 = "[2] Console " + std::string( ( Global::iWriteLogEnabled & 2 ) ? "(on)" : "(off)" );
|
||||
}
|
||||
else if( Global::iTextMode == VK_F2 ) { // ABu: info dla najblizszego pojazdu!
|
||||
else if( Global::iTextMode == GLFW_KEY_F2 ) { // ABu: info dla najblizszego pojazdu!
|
||||
TDynamicObject *tmp = FreeFlyModeFlag ? Ground.DynamicNearest( Camera.Pos ) :
|
||||
Controlled; // w trybie latania lokalizujemy wg mapy
|
||||
if( tmp ) {
|
||||
if( Global::iScreenMode[ Global::iTextMode - VK_F1 ] == 0 ) { // jeśli domyślny ekran po pierwszym naciśnięciu
|
||||
if( Global::iScreenMode[ Global::iTextMode - GLFW_KEY_F1 ] == 0 ) { // jeśli domyślny ekran po pierwszym naciśnięciu
|
||||
OutText3 = "";
|
||||
OutText1 = "Vehicle name: " + tmp->MoverParameters->Name;
|
||||
// yB OutText1+="; d: "+FloatToStrF(tmp->ABuGetDirection(),ffFixed,2,0);
|
||||
@@ -2222,7 +2104,7 @@ TWorld::Render_UI() {
|
||||
tmp->NextConnected->GetName() + ":" +
|
||||
to_string( tmp->MoverParameters->Couplers[ 1 ].CouplingFlag ) :
|
||||
std::string( "NULL" ) );
|
||||
if( Console::Pressed( VK_F2 ) ) {
|
||||
if( Console::Pressed( GLFW_KEY_F2 ) ) {
|
||||
WriteLog( OutText1 );
|
||||
WriteLog( OutText2 );
|
||||
WriteLog( OutText3 );
|
||||
@@ -2297,7 +2179,7 @@ TWorld::Render_UI() {
|
||||
// OutText3="enrot="+FloatToStrF(Controlled->MoverParameters->enrot,ffFixed,6,2);
|
||||
// OutText3="; n="+FloatToStrF(Controlled->MoverParameters->n,ffFixed,6,2);
|
||||
} // koniec treści podstawowego ekranu FK_V2
|
||||
else if( Global::iTextMode == VK_F5 ) { // przesiadka do innego pojazdu
|
||||
else if( Global::iTextMode == GLFW_KEY_F5 ) { // przesiadka do innego pojazdu
|
||||
if( FreeFlyModeFlag ) // jeśli tryb latania
|
||||
{
|
||||
TDynamicObject *tmp = Ground.DynamicNearest( Camera.Pos, 50, true ); //łapiemy z obsadą
|
||||
@@ -2354,7 +2236,7 @@ TWorld::Render_UI() {
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if( Global::iTextMode == VK_F10 ) { // tu mozna dodac dopisywanie do logu przebiegu lokomotywy
|
||||
else if( Global::iTextMode == GLFW_KEY_F10 ) { // tu mozna dodac dopisywanie do logu przebiegu lokomotywy
|
||||
// Global::iViewMode=VK_F10;
|
||||
// return false;
|
||||
OutText1 = ( "To quit press [Y] key." );
|
||||
@@ -2553,7 +2435,7 @@ TWorld::Render_UI() {
|
||||
|
||||
if( Global::detonatoryOK ) {
|
||||
// if (Console::Pressed(VK_F9)) ShowHints(); //to nie działa prawidłowo - prosili wyłączyć
|
||||
if( Global::iTextMode == VK_F9 ) { // informacja o wersji, sposobie wyświetlania i błędach OpenGL
|
||||
if( Global::iTextMode == GLFW_KEY_F9 ) { // informacja o wersji, sposobie wyświetlania i błędach OpenGL
|
||||
// Global::iViewMode=VK_F9;
|
||||
OutText1 = Global::asVersion; // informacja o wersji
|
||||
OutText2 = std::string( "Rendering mode: " ) + ( Global::bUseVBO ? "VBO" : "Display Lists" );
|
||||
@@ -2566,7 +2448,7 @@ TWorld::Render_UI() {
|
||||
Global::Bezogonkow( ( (char *)gluErrorString( err ) ) );
|
||||
}
|
||||
}
|
||||
if( Global::iTextMode == VK_F3 ) { // wyświetlenie rozkładu jazdy, na razie jakkolwiek
|
||||
if( Global::iTextMode == GLFW_KEY_F3 ) { // wyświetlenie rozkładu jazdy, na razie jakkolwiek
|
||||
TDynamicObject *tmp = FreeFlyModeFlag ?
|
||||
Ground.DynamicNearest( Camera.Pos ) :
|
||||
Controlled; // w trybie latania lokalizujemy wg mapy
|
||||
@@ -3038,6 +2920,8 @@ world_environment::update() {
|
||||
void
|
||||
world_environment::render() {
|
||||
|
||||
GfxRenderer.Bind( 0 );
|
||||
|
||||
::glDisable( GL_LIGHTING );
|
||||
::glDisable( GL_FOG );
|
||||
::glDisable( GL_DEPTH_TEST );
|
||||
|
||||
10
World.h
10
World.h
@@ -17,6 +17,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "stars.h"
|
||||
#include "skydome.h"
|
||||
#include "mczapkie/mover.h"
|
||||
#include "glfw/glfw3.h"
|
||||
|
||||
// wrapper for environment elements -- sky, sun, stars, clouds etc
|
||||
class world_environment {
|
||||
@@ -40,9 +41,10 @@ class TWorld
|
||||
void DistantView( bool const Near = false );
|
||||
|
||||
public:
|
||||
bool Init(HWND NhWnd, HDC hDC);
|
||||
HWND hWnd;
|
||||
GLvoid glPrint(const char *fmt);
|
||||
bool Init( GLFWwindow *w );
|
||||
bool InitPerformed() { return m_init; }
|
||||
GLFWwindow *window;
|
||||
GLvoid glPrint(std::string const &Text);
|
||||
void OnKeyDown(int cKey);
|
||||
void OnKeyUp(int cKey);
|
||||
// void UpdateWindow();
|
||||
@@ -68,7 +70,7 @@ class TWorld
|
||||
world_environment Environment;
|
||||
TTrain *Train;
|
||||
TDynamicObject *pDynamicNearest;
|
||||
bool Paused;
|
||||
bool Paused{ true };
|
||||
GLuint base; // numer DL dla znaków w napisach
|
||||
texture_manager::size_type light; // numer tekstury dla smugi
|
||||
TEvent *KeyEvents[10]; // eventy wyzwalane z klawiaury
|
||||
|
||||
@@ -9,7 +9,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#ifndef GeometryH
|
||||
#define GeometryH
|
||||
|
||||
#include "opengl/glew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "dumb3d.h"
|
||||
using namespace Math3D;
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -65,7 +65,14 @@ light_array::update() {
|
||||
( ( lightbits & 4 ) ? 1 : 0 ) +
|
||||
( ( lightbits & 16 ) ? 1 : 0 );
|
||||
|
||||
light.intensity = 0.15f * light.count; // TODO: intensity can be affected further by dim switch or other factors
|
||||
if( light.count > 0 ) {
|
||||
// TODO: intensity can be affected further by dim switch or other factors
|
||||
light.intensity = std::max( 0.0f, std::log( (float)light.count + 1.0f ) );
|
||||
// light.intensity = std::max( 0.0f, std::log( (float)light.count + 3.0f ) );
|
||||
}
|
||||
else {
|
||||
light.intensity = 0.0f;
|
||||
}
|
||||
|
||||
// crude catch for unmanned modules which share the light state with the controlled unit.
|
||||
// why don't they get their own light bits btw ._.
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)console;$(SolutionDir)mczapkie;$(SolutionDir)opengl;$(SolutionDir)python/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)console;$(SolutionDir)mczapkie;$(SolutionDir)ref/glfw/include;$(SolutionDir)ref/glew/include;$(SolutionDir)ref/python/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
@@ -60,8 +60,8 @@
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(DXSKD_DIR)lib/$(PlatformShortName);$(SolutionDir)ref/glew/lib/$(PlatformShortName);$(SolutionDir)ref/glfw/lib/$(PlatformShortName);$(SolutionDir)ref/python/lib/$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(DXSKD_DIR)lib/$(PlatformShortName);$(SolutionDir)opengl;$(SolutionDir)python/libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@@ -70,17 +70,17 @@
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)console;$(SolutionDir)mczapkie;$(SolutionDir)opengl;$(SolutionDir)python/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)console;$(SolutionDir)mczapkie;$(SolutionDir)ref/glfw/include;$(SolutionDir)ref/glew/include;$(SolutionDir)ref/python/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DXSKD_DIR)lib/$(PlatformShortName);$(SolutionDir)opengl;$(SolutionDir)python/libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(DXSKD_DIR)lib/$(PlatformShortName);$(SolutionDir)ref/glew/lib/$(PlatformShortName);$(SolutionDir)ref/glfw/lib/$(PlatformShortName);$(SolutionDir)ref/python/lib/$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -116,7 +116,6 @@
|
||||
<ClCompile Include="Model3d.cpp" />
|
||||
<ClCompile Include="mtable.cpp" />
|
||||
<ClCompile Include="Names.cpp" />
|
||||
<ClCompile Include="opengl\ARB_Multisample.cpp" />
|
||||
<ClCompile Include="parser.cpp" />
|
||||
<ClCompile Include="PyInt.cpp" />
|
||||
<ClCompile Include="RealSound.cpp" />
|
||||
@@ -179,12 +178,8 @@
|
||||
<ClInclude Include="Model3d.h" />
|
||||
<ClInclude Include="mtable.h" />
|
||||
<ClInclude Include="Names.h" />
|
||||
<ClInclude Include="opengl\arb_multisample.h" />
|
||||
<ClInclude Include="opengl\glew.h" />
|
||||
<ClInclude Include="opengl\wglew.h" />
|
||||
<ClInclude Include="parser.h" />
|
||||
<ClInclude Include="PyInt.h" />
|
||||
<ClInclude Include="python\include\Python.h" />
|
||||
<ClInclude Include="RealSound.h" />
|
||||
<ClInclude Include="renderer.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
@@ -217,10 +212,6 @@
|
||||
<ItemGroup>
|
||||
<Image Include="eu07.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -13,18 +13,12 @@
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\opengl">
|
||||
<UniqueIdentifier>{d91dfdb6-7d84-4b52-a16a-bad302b45e3c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mczapkie">
|
||||
<UniqueIdentifier>{fafd38ab-4c2a-48c8-8e66-ad0d928573b3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\console">
|
||||
<UniqueIdentifier>{2d73d7b2-5252-499c-963a-88fa3cb1af53}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\opengl">
|
||||
<UniqueIdentifier>{aec51dd3-af67-4f08-9dcb-889f673ad7c9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\mczapkie">
|
||||
<UniqueIdentifier>{36684428-8a48-435f-bca4-a24d9bfe2587}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -156,9 +150,6 @@
|
||||
<ClCompile Include="World.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opengl\ARB_Multisample.cpp">
|
||||
<Filter>Source Files\opengl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mczapkie\friction.cpp">
|
||||
<Filter>Source Files\mczapkie</Filter>
|
||||
</ClCompile>
|
||||
@@ -206,12 +197,6 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="opengl\glew.h">
|
||||
<Filter>Header Files\opengl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opengl\arb_multisample.h">
|
||||
<Filter>Header Files\opengl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Globals.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -266,9 +251,6 @@
|
||||
<ClInclude Include="Float3d.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="python\include\Python.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -341,9 +323,6 @@
|
||||
<ClInclude Include="AnimModel.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opengl\wglew.h">
|
||||
<Filter>Header Files\opengl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wavread.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -409,8 +388,4 @@
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "arb_multisample.h"
|
||||
#include "glew.h"
|
||||
#include "wglew.h"
|
||||
#include "gl/glew.h"
|
||||
#include "gl/wglew.h"
|
||||
|
||||
// Declairations We'll Use
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
|
||||
711
opengl/GLUT.H
711
opengl/GLUT.H
@@ -1,711 +0,0 @@
|
||||
#ifndef __glut_h__
|
||||
#define __glut_h__
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
|
||||
|
||||
/* This program is freely distributable without licensing fees and is
|
||||
provided without guarantee or warrantee expressed or implied. This
|
||||
program is -not- in the public domain. */
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
/* GLUT 3.7 now tries to avoid including <windows.h>
|
||||
to avoid name space pollution, but Win32's <GL/gl.h>
|
||||
needs APIENTRY and WINGDIAPI defined properly. */
|
||||
# if 0
|
||||
/* This would put tons of macros and crap in our clean name space. */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# else
|
||||
/* XXX This is from Win32's <windef.h> */
|
||||
# ifndef APIENTRY
|
||||
# define GLUT_APIENTRY_DEFINED
|
||||
# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)
|
||||
# define APIENTRY __stdcall
|
||||
# else
|
||||
# define APIENTRY
|
||||
# endif
|
||||
# endif
|
||||
/* XXX This is from Win32's <winnt.h> */
|
||||
# ifndef CALLBACK
|
||||
# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
|
||||
# define CALLBACK __stdcall
|
||||
# else
|
||||
# define CALLBACK
|
||||
# endif
|
||||
# endif
|
||||
/* XXX This is from Win32's <wingdi.h> and <winnt.h> */
|
||||
# ifndef WINGDIAPI
|
||||
# define GLUT_WINGDIAPI_DEFINED
|
||||
# define WINGDIAPI __declspec(dllimport)
|
||||
# endif
|
||||
/* XXX This is from Win32's <ctype.h> */
|
||||
# ifndef _WCHAR_T_DEFINED
|
||||
typedef unsigned short wchar_t;
|
||||
# define _WCHAR_T_DEFINED
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#define GLUT_BUILDING_LIB /* disable automatic library usage for GLUT */
|
||||
/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
|
||||
in your compile preprocessor options. */
|
||||
# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
|
||||
# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
|
||||
/* To enable automatic SGI OpenGL for Windows library usage for GLUT,
|
||||
define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
|
||||
# ifdef GLUT_USE_SGI_OPENGL
|
||||
# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
|
||||
# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
|
||||
# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */
|
||||
# else
|
||||
# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
|
||||
# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
|
||||
# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* To disable supression of annoying warnings about floats being promoted
|
||||
to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
|
||||
options. */
|
||||
# ifndef GLUT_NO_WARNING_DISABLE
|
||||
# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
|
||||
# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
|
||||
# endif
|
||||
|
||||
/* Win32 has an annoying issue where there are multiple C run-time
|
||||
libraries (CRTs). If the executable is linked with a different CRT
|
||||
from the GLUT DLL, the GLUT DLL will not share the same CRT static
|
||||
data seen by the executable. In particular, atexit callbacks registered
|
||||
in the executable will not be called if GLUT calls its (different)
|
||||
exit routine). GLUT is typically built with the
|
||||
"/MD" option (the CRT with multithreading DLL support), but the Visual
|
||||
C++ linker default is "/ML" (the single threaded CRT).
|
||||
|
||||
One workaround to this issue is requiring users to always link with
|
||||
the same CRT as GLUT is compiled with. That requires users supply a
|
||||
non-standard option. GLUT 3.7 has its own built-in workaround where
|
||||
the executable's "exit" function pointer is covertly passed to GLUT.
|
||||
GLUT then calls the executable's exit function pointer to ensure that
|
||||
any "atexit" calls registered by the application are called if GLUT
|
||||
needs to exit.
|
||||
|
||||
Note that the __glut*WithExit routines should NEVER be called directly.
|
||||
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
|
||||
|
||||
/* XXX This is from Win32's <process.h> */
|
||||
# if !defined(_MSC_VER) && !defined(__cdecl)
|
||||
/* Define __cdecl for non-Microsoft compilers. */
|
||||
# define __cdecl
|
||||
# define GLUT_DEFINED___CDECL
|
||||
# endif
|
||||
# ifndef _CRTIMP
|
||||
# ifdef _NTSDK
|
||||
/* Definition compatible with NT SDK */
|
||||
# define _CRTIMP
|
||||
# else
|
||||
/* Current definition */
|
||||
# ifdef _DLL
|
||||
# define _CRTIMP __declspec(dllimport)
|
||||
# else
|
||||
# define _CRTIMP
|
||||
# endif
|
||||
# endif
|
||||
# define GLUT_DEFINED__CRTIMP
|
||||
# endif
|
||||
|
||||
/* GLUT API entry point declarations for Win32. */
|
||||
# ifdef GLUT_BUILDING_LIB
|
||||
# define GLUTAPI __declspec(dllexport)
|
||||
# else
|
||||
# ifdef _DLL
|
||||
# define GLUTAPI __declspec(dllimport)
|
||||
# else
|
||||
# define GLUTAPI extern
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* GLUT callback calling convention for Win32. */
|
||||
# define GLUTCALLBACK __cdecl
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# ifndef GLUT_BUILDING_LIB
|
||||
//extern _CRTIMP void __cdecl exit(int);
|
||||
# endif
|
||||
#else
|
||||
/* non-Win32 case. */
|
||||
/* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */
|
||||
# define APIENTRY
|
||||
# define GLUT_APIENTRY_DEFINED
|
||||
# define CALLBACK
|
||||
/* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */
|
||||
# define GLUTAPI extern
|
||||
# define GLUTCALLBACK
|
||||
/* Prototype exit for the non-Win32 case (see above). */
|
||||
extern void exit(int);
|
||||
#endif
|
||||
|
||||
/**
|
||||
GLUT API revision history:
|
||||
|
||||
GLUT_API_VERSION is updated to reflect incompatible GLUT
|
||||
API changes (interface changes, semantic changes, deletions,
|
||||
or additions).
|
||||
|
||||
GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
|
||||
|
||||
GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
|
||||
extension. Supports new input devices like tablet, dial and button
|
||||
box, and Spaceball. Easy to query OpenGL extensions.
|
||||
|
||||
GLUT_API_VERSION=3 glutMenuStatus added.
|
||||
|
||||
GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
|
||||
glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
|
||||
video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
|
||||
glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
|
||||
glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
|
||||
**/
|
||||
#ifndef GLUT_API_VERSION /* allow this to be overriden */
|
||||
#define GLUT_API_VERSION 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
GLUT implementation revision history:
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
|
||||
API revisions and implementation revisions (ie, bug fixes).
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
|
||||
GLUT Xlib-based implementation. 11/29/94
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
|
||||
GLUT Xlib-based implementation providing GLUT version 2
|
||||
interfaces.
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
|
||||
and video resize. 1/3/97
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
|
||||
|
||||
GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
|
||||
**/
|
||||
#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
|
||||
#define GLUT_XLIB_IMPLEMENTATION 15
|
||||
#endif
|
||||
|
||||
/* Display mode bit masks. */
|
||||
#define GLUT_RGB 0
|
||||
#define GLUT_RGBA GLUT_RGB
|
||||
#define GLUT_INDEX 1
|
||||
#define GLUT_SINGLE 0
|
||||
#define GLUT_DOUBLE 2
|
||||
#define GLUT_ACCUM 4
|
||||
#define GLUT_ALPHA 8
|
||||
#define GLUT_DEPTH 16
|
||||
#define GLUT_STENCIL 32
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
#define GLUT_MULTISAMPLE 128
|
||||
#define GLUT_STEREO 256
|
||||
#endif
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
#define GLUT_LUMINANCE 512
|
||||
#endif
|
||||
|
||||
/* Mouse buttons. */
|
||||
#define GLUT_LEFT_BUTTON 0
|
||||
#define GLUT_MIDDLE_BUTTON 1
|
||||
#define GLUT_RIGHT_BUTTON 2
|
||||
|
||||
/* Mouse button state. */
|
||||
#define GLUT_DOWN 0
|
||||
#define GLUT_UP 1
|
||||
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
/* function keys */
|
||||
#define GLUT_KEY_F1 1
|
||||
#define GLUT_KEY_F2 2
|
||||
#define GLUT_KEY_F3 3
|
||||
#define GLUT_KEY_F4 4
|
||||
#define GLUT_KEY_F5 5
|
||||
#define GLUT_KEY_F6 6
|
||||
#define GLUT_KEY_F7 7
|
||||
#define GLUT_KEY_F8 8
|
||||
#define GLUT_KEY_F9 9
|
||||
#define GLUT_KEY_F10 10
|
||||
#define GLUT_KEY_F11 11
|
||||
#define GLUT_KEY_F12 12
|
||||
/* directional keys */
|
||||
#define GLUT_KEY_LEFT 100
|
||||
#define GLUT_KEY_UP 101
|
||||
#define GLUT_KEY_RIGHT 102
|
||||
#define GLUT_KEY_DOWN 103
|
||||
#define GLUT_KEY_PAGE_UP 104
|
||||
#define GLUT_KEY_PAGE_DOWN 105
|
||||
#define GLUT_KEY_HOME 106
|
||||
#define GLUT_KEY_END 107
|
||||
#define GLUT_KEY_INSERT 108
|
||||
#endif
|
||||
|
||||
/* Entry/exit state. */
|
||||
#define GLUT_LEFT 0
|
||||
#define GLUT_ENTERED 1
|
||||
|
||||
/* Menu usage state. */
|
||||
#define GLUT_MENU_NOT_IN_USE 0
|
||||
#define GLUT_MENU_IN_USE 1
|
||||
|
||||
/* Visibility state. */
|
||||
#define GLUT_NOT_VISIBLE 0
|
||||
#define GLUT_VISIBLE 1
|
||||
|
||||
/* Window status state. */
|
||||
#define GLUT_HIDDEN 0
|
||||
#define GLUT_FULLY_RETAINED 1
|
||||
#define GLUT_PARTIALLY_RETAINED 2
|
||||
#define GLUT_FULLY_COVERED 3
|
||||
|
||||
/* Color index component selection values. */
|
||||
#define GLUT_RED 0
|
||||
#define GLUT_GREEN 1
|
||||
#define GLUT_BLUE 2
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Stroke font constants (use these in GLUT program). */
|
||||
#define GLUT_STROKE_ROMAN ((void*)0)
|
||||
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
|
||||
|
||||
/* Bitmap font constants (use these in GLUT program). */
|
||||
#define GLUT_BITMAP_9_BY_15 ((void*)2)
|
||||
#define GLUT_BITMAP_8_BY_13 ((void*)3)
|
||||
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
|
||||
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
|
||||
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
|
||||
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
|
||||
#endif
|
||||
#else
|
||||
/* Stroke font opaque addresses (use constants instead in source code). */
|
||||
GLUTAPI void *glutStrokeRoman;
|
||||
GLUTAPI void *glutStrokeMonoRoman;
|
||||
|
||||
/* Stroke font constants (use these in GLUT program). */
|
||||
#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
|
||||
#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
|
||||
|
||||
/* Bitmap font opaque addresses (use constants instead in source code). */
|
||||
GLUTAPI void *glutBitmap9By15;
|
||||
GLUTAPI void *glutBitmap8By13;
|
||||
GLUTAPI void *glutBitmapTimesRoman10;
|
||||
GLUTAPI void *glutBitmapTimesRoman24;
|
||||
GLUTAPI void *glutBitmapHelvetica10;
|
||||
GLUTAPI void *glutBitmapHelvetica12;
|
||||
GLUTAPI void *glutBitmapHelvetica18;
|
||||
|
||||
/* Bitmap font constants (use these in GLUT program). */
|
||||
#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
|
||||
#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
|
||||
#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
|
||||
#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
|
||||
#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
|
||||
#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* glutGet parameters. */
|
||||
#define GLUT_WINDOW_X ((GLenum) 100)
|
||||
#define GLUT_WINDOW_Y ((GLenum) 101)
|
||||
#define GLUT_WINDOW_WIDTH ((GLenum) 102)
|
||||
#define GLUT_WINDOW_HEIGHT ((GLenum) 103)
|
||||
#define GLUT_WINDOW_BUFFER_SIZE ((GLenum) 104)
|
||||
#define GLUT_WINDOW_STENCIL_SIZE ((GLenum) 105)
|
||||
#define GLUT_WINDOW_DEPTH_SIZE ((GLenum) 106)
|
||||
#define GLUT_WINDOW_RED_SIZE ((GLenum) 107)
|
||||
#define GLUT_WINDOW_GREEN_SIZE ((GLenum) 108)
|
||||
#define GLUT_WINDOW_BLUE_SIZE ((GLenum) 109)
|
||||
#define GLUT_WINDOW_ALPHA_SIZE ((GLenum) 110)
|
||||
#define GLUT_WINDOW_ACCUM_RED_SIZE ((GLenum) 111)
|
||||
#define GLUT_WINDOW_ACCUM_GREEN_SIZE ((GLenum) 112)
|
||||
#define GLUT_WINDOW_ACCUM_BLUE_SIZE ((GLenum) 113)
|
||||
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE ((GLenum) 114)
|
||||
#define GLUT_WINDOW_DOUBLEBUFFER ((GLenum) 115)
|
||||
#define GLUT_WINDOW_RGBA ((GLenum) 116)
|
||||
#define GLUT_WINDOW_PARENT ((GLenum) 117)
|
||||
#define GLUT_WINDOW_NUM_CHILDREN ((GLenum) 118)
|
||||
#define GLUT_WINDOW_COLORMAP_SIZE ((GLenum) 119)
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
#define GLUT_WINDOW_NUM_SAMPLES ((GLenum) 120)
|
||||
#define GLUT_WINDOW_STEREO ((GLenum) 121)
|
||||
#endif
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
#define GLUT_WINDOW_CURSOR ((GLenum) 122)
|
||||
#endif
|
||||
#define GLUT_SCREEN_WIDTH ((GLenum) 200)
|
||||
#define GLUT_SCREEN_HEIGHT ((GLenum) 201)
|
||||
#define GLUT_SCREEN_WIDTH_MM ((GLenum) 202)
|
||||
#define GLUT_SCREEN_HEIGHT_MM ((GLenum) 203)
|
||||
#define GLUT_MENU_NUM_ITEMS ((GLenum) 300)
|
||||
#define GLUT_DISPLAY_MODE_POSSIBLE ((GLenum) 400)
|
||||
#define GLUT_INIT_WINDOW_X ((GLenum) 500)
|
||||
#define GLUT_INIT_WINDOW_Y ((GLenum) 501)
|
||||
#define GLUT_INIT_WINDOW_WIDTH ((GLenum) 502)
|
||||
#define GLUT_INIT_WINDOW_HEIGHT ((GLenum) 503)
|
||||
#define GLUT_INIT_DISPLAY_MODE ((GLenum) 504)
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
#define GLUT_ELAPSED_TIME ((GLenum) 700)
|
||||
#endif
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
|
||||
#define GLUT_WINDOW_FORMAT_ID ((GLenum) 123)
|
||||
#endif
|
||||
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
/* glutDeviceGet parameters. */
|
||||
#define GLUT_HAS_KEYBOARD ((GLenum) 600)
|
||||
#define GLUT_HAS_MOUSE ((GLenum) 601)
|
||||
#define GLUT_HAS_SPACEBALL ((GLenum) 602)
|
||||
#define GLUT_HAS_DIAL_AND_BUTTON_BOX ((GLenum) 603)
|
||||
#define GLUT_HAS_TABLET ((GLenum) 604)
|
||||
#define GLUT_NUM_MOUSE_BUTTONS ((GLenum) 605)
|
||||
#define GLUT_NUM_SPACEBALL_BUTTONS ((GLenum) 606)
|
||||
#define GLUT_NUM_BUTTON_BOX_BUTTONS ((GLenum) 607)
|
||||
#define GLUT_NUM_DIALS ((GLenum) 608)
|
||||
#define GLUT_NUM_TABLET_BUTTONS ((GLenum) 609)
|
||||
#endif
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
|
||||
#define GLUT_DEVICE_IGNORE_KEY_REPEAT ((GLenum) 610)
|
||||
#define GLUT_DEVICE_KEY_REPEAT ((GLenum) 611)
|
||||
#define GLUT_HAS_JOYSTICK ((GLenum) 612)
|
||||
#define GLUT_OWNS_JOYSTICK ((GLenum) 613)
|
||||
#define GLUT_JOYSTICK_BUTTONS ((GLenum) 614)
|
||||
#define GLUT_JOYSTICK_AXES ((GLenum) 615)
|
||||
#define GLUT_JOYSTICK_POLL_RATE ((GLenum) 616)
|
||||
#endif
|
||||
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
/* glutLayerGet parameters. */
|
||||
#define GLUT_OVERLAY_POSSIBLE ((GLenum) 800)
|
||||
#define GLUT_LAYER_IN_USE ((GLenum) 801)
|
||||
#define GLUT_HAS_OVERLAY ((GLenum) 802)
|
||||
#define GLUT_TRANSPARENT_INDEX ((GLenum) 803)
|
||||
#define GLUT_NORMAL_DAMAGED ((GLenum) 804)
|
||||
#define GLUT_OVERLAY_DAMAGED ((GLenum) 805)
|
||||
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
|
||||
/* glutVideoResizeGet parameters. */
|
||||
#define GLUT_VIDEO_RESIZE_POSSIBLE ((GLenum) 900)
|
||||
#define GLUT_VIDEO_RESIZE_IN_USE ((GLenum) 901)
|
||||
#define GLUT_VIDEO_RESIZE_X_DELTA ((GLenum) 902)
|
||||
#define GLUT_VIDEO_RESIZE_Y_DELTA ((GLenum) 903)
|
||||
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA ((GLenum) 904)
|
||||
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA ((GLenum) 905)
|
||||
#define GLUT_VIDEO_RESIZE_X ((GLenum) 906)
|
||||
#define GLUT_VIDEO_RESIZE_Y ((GLenum) 907)
|
||||
#define GLUT_VIDEO_RESIZE_WIDTH ((GLenum) 908)
|
||||
#define GLUT_VIDEO_RESIZE_HEIGHT ((GLenum) 909)
|
||||
#endif
|
||||
|
||||
/* glutUseLayer parameters. */
|
||||
#define GLUT_NORMAL ((GLenum) 0)
|
||||
#define GLUT_OVERLAY ((GLenum) 1)
|
||||
|
||||
/* glutGetModifiers return mask. */
|
||||
#define GLUT_ACTIVE_SHIFT 1
|
||||
#define GLUT_ACTIVE_CTRL 2
|
||||
#define GLUT_ACTIVE_ALT 4
|
||||
|
||||
/* glutSetCursor parameters. */
|
||||
/* Basic arrows. */
|
||||
#define GLUT_CURSOR_RIGHT_ARROW 0
|
||||
#define GLUT_CURSOR_LEFT_ARROW 1
|
||||
/* Symbolic cursor shapes. */
|
||||
#define GLUT_CURSOR_INFO 2
|
||||
#define GLUT_CURSOR_DESTROY 3
|
||||
#define GLUT_CURSOR_HELP 4
|
||||
#define GLUT_CURSOR_CYCLE 5
|
||||
#define GLUT_CURSOR_SPRAY 6
|
||||
#define GLUT_CURSOR_WAIT 7
|
||||
#define GLUT_CURSOR_TEXT 8
|
||||
#define GLUT_CURSOR_CROSSHAIR 9
|
||||
/* Directional cursors. */
|
||||
#define GLUT_CURSOR_UP_DOWN 10
|
||||
#define GLUT_CURSOR_LEFT_RIGHT 11
|
||||
/* Sizing cursors. */
|
||||
#define GLUT_CURSOR_TOP_SIDE 12
|
||||
#define GLUT_CURSOR_BOTTOM_SIDE 13
|
||||
#define GLUT_CURSOR_LEFT_SIDE 14
|
||||
#define GLUT_CURSOR_RIGHT_SIDE 15
|
||||
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
|
||||
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
|
||||
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
|
||||
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
|
||||
/* Inherit from parent window. */
|
||||
#define GLUT_CURSOR_INHERIT 100
|
||||
/* Blank cursor. */
|
||||
#define GLUT_CURSOR_NONE 101
|
||||
/* Fullscreen crosshair (if available). */
|
||||
#define GLUT_CURSOR_FULL_CROSSHAIR 102
|
||||
#endif
|
||||
|
||||
/* GLUT initialization sub-API. */
|
||||
GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
|
||||
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
|
||||
GLUTAPI void APIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
|
||||
#ifndef GLUT_BUILDING_LIB
|
||||
static void APIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
|
||||
#define glutInit glutInit_ATEXIT_HACK
|
||||
#endif
|
||||
#endif
|
||||
GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
|
||||
GLUTAPI void APIENTRY glutInitDisplayString(const char *string);
|
||||
#endif
|
||||
GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
|
||||
GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
|
||||
GLUTAPI void APIENTRY glutMainLoop(void);
|
||||
|
||||
/* GLUT window sub-API. */
|
||||
GLUTAPI int APIENTRY glutCreateWindow(const char *title);
|
||||
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
|
||||
GLUTAPI int APIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
|
||||
#ifndef GLUT_BUILDING_LIB
|
||||
static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
|
||||
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
|
||||
#endif
|
||||
#endif
|
||||
GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
|
||||
GLUTAPI void APIENTRY glutDestroyWindow(int win);
|
||||
GLUTAPI void APIENTRY glutPostRedisplay(void);
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
|
||||
GLUTAPI void APIENTRY glutPostWindowRedisplay(int win);
|
||||
#endif
|
||||
GLUTAPI void APIENTRY glutSwapBuffers(void);
|
||||
GLUTAPI int APIENTRY glutGetWindow(void);
|
||||
GLUTAPI void APIENTRY glutSetWindow(int win);
|
||||
GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
|
||||
GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
|
||||
GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
|
||||
GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
|
||||
GLUTAPI void APIENTRY glutPopWindow(void);
|
||||
GLUTAPI void APIENTRY glutPushWindow(void);
|
||||
GLUTAPI void APIENTRY glutIconifyWindow(void);
|
||||
GLUTAPI void APIENTRY glutShowWindow(void);
|
||||
GLUTAPI void APIENTRY glutHideWindow(void);
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
GLUTAPI void APIENTRY glutFullScreen(void);
|
||||
GLUTAPI void APIENTRY glutSetCursor(int cursor);
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
|
||||
GLUTAPI void APIENTRY glutWarpPointer(int x, int y);
|
||||
#endif
|
||||
|
||||
/* GLUT overlay sub-API. */
|
||||
GLUTAPI void APIENTRY glutEstablishOverlay(void);
|
||||
GLUTAPI void APIENTRY glutRemoveOverlay(void);
|
||||
GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
|
||||
GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
|
||||
GLUTAPI void APIENTRY glutPostWindowOverlayRedisplay(int win);
|
||||
#endif
|
||||
GLUTAPI void APIENTRY glutShowOverlay(void);
|
||||
GLUTAPI void APIENTRY glutHideOverlay(void);
|
||||
#endif
|
||||
|
||||
/* GLUT menu sub-API. */
|
||||
GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
|
||||
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
|
||||
GLUTAPI int APIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
|
||||
#ifndef GLUT_BUILDING_LIB
|
||||
static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
|
||||
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
|
||||
#endif
|
||||
#endif
|
||||
GLUTAPI void APIENTRY glutDestroyMenu(int menu);
|
||||
GLUTAPI int APIENTRY glutGetMenu(void);
|
||||
GLUTAPI void APIENTRY glutSetMenu(int menu);
|
||||
GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
|
||||
GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
|
||||
GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
|
||||
GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
|
||||
GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
|
||||
GLUTAPI void APIENTRY glutAttachMenu(int button);
|
||||
GLUTAPI void APIENTRY glutDetachMenu(int button);
|
||||
|
||||
/* GLUT window callback sub-API. */
|
||||
GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
|
||||
GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
|
||||
GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
|
||||
GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
|
||||
GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
|
||||
GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
|
||||
GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
|
||||
GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
|
||||
GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
|
||||
GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
|
||||
GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
|
||||
GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
|
||||
GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
|
||||
GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
|
||||
GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
|
||||
GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
|
||||
GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
|
||||
GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
|
||||
GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
|
||||
GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
|
||||
#endif
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
|
||||
GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
|
||||
GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
|
||||
GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* GLUT color index sub-API. */
|
||||
GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
|
||||
GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
|
||||
GLUTAPI void APIENTRY glutCopyColormap(int win);
|
||||
|
||||
/* GLUT state retrieval sub-API. */
|
||||
GLUTAPI int APIENTRY glutGet(GLenum type);
|
||||
GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
|
||||
#if (GLUT_API_VERSION >= 2)
|
||||
/* GLUT extension support sub-API */
|
||||
GLUTAPI int APIENTRY glutExtensionSupported(const char *name);
|
||||
#endif
|
||||
#if (GLUT_API_VERSION >= 3)
|
||||
GLUTAPI int APIENTRY glutGetModifiers(void);
|
||||
GLUTAPI int APIENTRY glutLayerGet(GLenum type);
|
||||
#endif
|
||||
|
||||
/* GLUT font sub-API */
|
||||
GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
|
||||
GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
|
||||
GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
|
||||
GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
|
||||
GLUTAPI int APIENTRY glutBitmapLength(void *font, const unsigned char *string);
|
||||
GLUTAPI int APIENTRY glutStrokeLength(void *font, const unsigned char *string);
|
||||
#endif
|
||||
|
||||
/* GLUT pre-built models sub-API */
|
||||
GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutWireCube(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
|
||||
GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
|
||||
GLUTAPI void APIENTRY glutWireDodecahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidDodecahedron(void);
|
||||
GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutWireOctahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidOctahedron(void);
|
||||
GLUTAPI void APIENTRY glutWireTetrahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidTetrahedron(void);
|
||||
GLUTAPI void APIENTRY glutWireIcosahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidIcosahedron(void);
|
||||
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
|
||||
/* GLUT video resize sub-API. */
|
||||
GLUTAPI int APIENTRY glutVideoResizeGet(GLenum param);
|
||||
GLUTAPI void APIENTRY glutSetupVideoResizing(void);
|
||||
GLUTAPI void APIENTRY glutStopVideoResizing(void);
|
||||
GLUTAPI void APIENTRY glutVideoResize(int x, int y, int width, int height);
|
||||
GLUTAPI void APIENTRY glutVideoPan(int x, int y, int width, int height);
|
||||
|
||||
/* GLUT debugging sub-API. */
|
||||
GLUTAPI void APIENTRY glutReportErrors(void);
|
||||
#endif
|
||||
|
||||
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
|
||||
/* GLUT device control sub-API. */
|
||||
/* glutSetKeyRepeat modes. */
|
||||
#define GLUT_KEY_REPEAT_OFF 0
|
||||
#define GLUT_KEY_REPEAT_ON 1
|
||||
#define GLUT_KEY_REPEAT_DEFAULT 2
|
||||
|
||||
/* Joystick button masks. */
|
||||
#define GLUT_JOYSTICK_BUTTON_A 1
|
||||
#define GLUT_JOYSTICK_BUTTON_B 2
|
||||
#define GLUT_JOYSTICK_BUTTON_C 4
|
||||
#define GLUT_JOYSTICK_BUTTON_D 8
|
||||
|
||||
GLUTAPI void APIENTRY glutIgnoreKeyRepeat(int ignore);
|
||||
GLUTAPI void APIENTRY glutSetKeyRepeat(int repeatMode);
|
||||
GLUTAPI void APIENTRY glutForceJoystickFunc(void);
|
||||
|
||||
/* GLUT game mode sub-API. */
|
||||
/* glutGameModeGet. */
|
||||
#define GLUT_GAME_MODE_ACTIVE ((GLenum) 0)
|
||||
#define GLUT_GAME_MODE_POSSIBLE ((GLenum) 1)
|
||||
#define GLUT_GAME_MODE_WIDTH ((GLenum) 2)
|
||||
#define GLUT_GAME_MODE_HEIGHT ((GLenum) 3)
|
||||
#define GLUT_GAME_MODE_PIXEL_DEPTH ((GLenum) 4)
|
||||
#define GLUT_GAME_MODE_REFRESH_RATE ((GLenum) 5)
|
||||
#define GLUT_GAME_MODE_DISPLAY_CHANGED ((GLenum) 6)
|
||||
|
||||
GLUTAPI void APIENTRY glutGameModeString(const char *string);
|
||||
GLUTAPI int APIENTRY glutEnterGameMode(void);
|
||||
GLUTAPI void APIENTRY glutLeaveGameMode(void);
|
||||
GLUTAPI int APIENTRY glutGameModeGet(GLenum mode);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_APIENTRY_DEFINED
|
||||
# undef GLUT_APIENTRY_DEFINED
|
||||
# undef APIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_WINGDIAPI_DEFINED
|
||||
# undef GLUT_WINGDIAPI_DEFINED
|
||||
# undef WINGDIAPI
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_DEFINED___CDECL
|
||||
# undef GLUT_DEFINED___CDECL
|
||||
# undef __cdecl
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_DEFINED__CRTIMP
|
||||
# undef GLUT_DEFINED__CRTIMP
|
||||
# undef _CRTIMP
|
||||
#endif
|
||||
|
||||
#endif /* __glut_h__ */
|
||||
12180
opengl/glew.c
12180
opengl/glew.c
File diff suppressed because it is too large
Load Diff
20113
opengl/glew.h
20113
opengl/glew.h
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
6495
opengl/glext.h
6495
opengl/glext.h
File diff suppressed because it is too large
Load Diff
Binary file not shown.
1427
opengl/wglew.h
1427
opengl/wglew.h
File diff suppressed because it is too large
Load Diff
929
opengl/wglext.h
929
opengl/wglext.h
@@ -1,929 +0,0 @@
|
||||
#ifndef __wglext_h_
|
||||
#define __wglext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2010 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* wglext.h last updated 2011/04/13 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define WGL_WGLEXT_VERSION 23
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_out
|
||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
||||
#define WGL_GPU_RAM_AMD 0x21A3
|
||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_create_context_es2_profile
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
|
||||
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
|
||||
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#endif
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#endif
|
||||
#ifndef WGL_NV_present_video
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#endif
|
||||
#ifndef WGL_NV_video_output
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#endif
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
DECLARE_HANDLE(HPGPUNV);
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
|
||||
typedef struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
} GPU_DEVICE, *PGPU_DEVICE;
|
||||
#endif
|
||||
#ifndef WGL_NV_video_capture
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
||||
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
||||
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
||||
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
||||
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
||||
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_ARB_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_ARB_create_context_profile 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_ARB_create_context_robustness 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
||||
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
||||
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
||||
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
||||
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
||||
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
|
||||
extern int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
extern void WINAPI wglFreeMemoryNV (void *pointer);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
||||
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
||||
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
||||
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
||||
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
||||
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
||||
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
||||
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
||||
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
||||
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
||||
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
||||
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
||||
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
||||
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
||||
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NV_present_video 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
||||
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#define WGL_NV_swap_group 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
||||
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
||||
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
||||
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
||||
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_AMD_gpu_association 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
||||
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
||||
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
||||
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
||||
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
||||
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
||||
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_NV_multisample_coverage 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_NV_DX_interop 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
|
||||
extern HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
|
||||
extern BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
|
||||
extern HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
extern BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
|
||||
extern BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
|
||||
extern BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
extern BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
|
||||
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,535 +0,0 @@
|
||||
/* File automatically generated by Parser/asdl_c.py. */
|
||||
|
||||
#include "asdl.h"
|
||||
|
||||
typedef struct _mod *mod_ty;
|
||||
|
||||
typedef struct _stmt *stmt_ty;
|
||||
|
||||
typedef struct _expr *expr_ty;
|
||||
|
||||
typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,
|
||||
Param=6 } expr_context_ty;
|
||||
|
||||
typedef struct _slice *slice_ty;
|
||||
|
||||
typedef enum _boolop { And=1, Or=2 } boolop_ty;
|
||||
|
||||
typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7,
|
||||
RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 }
|
||||
operator_ty;
|
||||
|
||||
typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
|
||||
|
||||
typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
|
||||
In=9, NotIn=10 } cmpop_ty;
|
||||
|
||||
typedef struct _comprehension *comprehension_ty;
|
||||
|
||||
typedef struct _excepthandler *excepthandler_ty;
|
||||
|
||||
typedef struct _arguments *arguments_ty;
|
||||
|
||||
typedef struct _keyword *keyword_ty;
|
||||
|
||||
typedef struct _alias *alias_ty;
|
||||
|
||||
|
||||
enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
|
||||
Suite_kind=4};
|
||||
struct _mod {
|
||||
enum _mod_kind kind;
|
||||
union {
|
||||
struct {
|
||||
asdl_seq *body;
|
||||
} Module;
|
||||
|
||||
struct {
|
||||
asdl_seq *body;
|
||||
} Interactive;
|
||||
|
||||
struct {
|
||||
expr_ty body;
|
||||
} Expression;
|
||||
|
||||
struct {
|
||||
asdl_seq *body;
|
||||
} Suite;
|
||||
|
||||
} v;
|
||||
};
|
||||
|
||||
enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
|
||||
Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7,
|
||||
For_kind=8, While_kind=9, If_kind=10, With_kind=11,
|
||||
Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14,
|
||||
Assert_kind=15, Import_kind=16, ImportFrom_kind=17,
|
||||
Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21,
|
||||
Break_kind=22, Continue_kind=23};
|
||||
struct _stmt {
|
||||
enum _stmt_kind kind;
|
||||
union {
|
||||
struct {
|
||||
identifier name;
|
||||
arguments_ty args;
|
||||
asdl_seq *body;
|
||||
asdl_seq *decorator_list;
|
||||
} FunctionDef;
|
||||
|
||||
struct {
|
||||
identifier name;
|
||||
asdl_seq *bases;
|
||||
asdl_seq *body;
|
||||
asdl_seq *decorator_list;
|
||||
} ClassDef;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
} Return;
|
||||
|
||||
struct {
|
||||
asdl_seq *targets;
|
||||
} Delete;
|
||||
|
||||
struct {
|
||||
asdl_seq *targets;
|
||||
expr_ty value;
|
||||
} Assign;
|
||||
|
||||
struct {
|
||||
expr_ty target;
|
||||
operator_ty op;
|
||||
expr_ty value;
|
||||
} AugAssign;
|
||||
|
||||
struct {
|
||||
expr_ty dest;
|
||||
asdl_seq *values;
|
||||
bool nl;
|
||||
} Print;
|
||||
|
||||
struct {
|
||||
expr_ty target;
|
||||
expr_ty iter;
|
||||
asdl_seq *body;
|
||||
asdl_seq *orelse;
|
||||
} For;
|
||||
|
||||
struct {
|
||||
expr_ty test;
|
||||
asdl_seq *body;
|
||||
asdl_seq *orelse;
|
||||
} While;
|
||||
|
||||
struct {
|
||||
expr_ty test;
|
||||
asdl_seq *body;
|
||||
asdl_seq *orelse;
|
||||
} If;
|
||||
|
||||
struct {
|
||||
expr_ty context_expr;
|
||||
expr_ty optional_vars;
|
||||
asdl_seq *body;
|
||||
} With;
|
||||
|
||||
struct {
|
||||
expr_ty type;
|
||||
expr_ty inst;
|
||||
expr_ty tback;
|
||||
} Raise;
|
||||
|
||||
struct {
|
||||
asdl_seq *body;
|
||||
asdl_seq *handlers;
|
||||
asdl_seq *orelse;
|
||||
} TryExcept;
|
||||
|
||||
struct {
|
||||
asdl_seq *body;
|
||||
asdl_seq *finalbody;
|
||||
} TryFinally;
|
||||
|
||||
struct {
|
||||
expr_ty test;
|
||||
expr_ty msg;
|
||||
} Assert;
|
||||
|
||||
struct {
|
||||
asdl_seq *names;
|
||||
} Import;
|
||||
|
||||
struct {
|
||||
identifier module;
|
||||
asdl_seq *names;
|
||||
int level;
|
||||
} ImportFrom;
|
||||
|
||||
struct {
|
||||
expr_ty body;
|
||||
expr_ty globals;
|
||||
expr_ty locals;
|
||||
} Exec;
|
||||
|
||||
struct {
|
||||
asdl_seq *names;
|
||||
} Global;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
} Expr;
|
||||
|
||||
} v;
|
||||
int lineno;
|
||||
int col_offset;
|
||||
};
|
||||
|
||||
enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
|
||||
IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
|
||||
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
|
||||
Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15,
|
||||
Num_kind=16, Str_kind=17, Attribute_kind=18,
|
||||
Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22};
|
||||
struct _expr {
|
||||
enum _expr_kind kind;
|
||||
union {
|
||||
struct {
|
||||
boolop_ty op;
|
||||
asdl_seq *values;
|
||||
} BoolOp;
|
||||
|
||||
struct {
|
||||
expr_ty left;
|
||||
operator_ty op;
|
||||
expr_ty right;
|
||||
} BinOp;
|
||||
|
||||
struct {
|
||||
unaryop_ty op;
|
||||
expr_ty operand;
|
||||
} UnaryOp;
|
||||
|
||||
struct {
|
||||
arguments_ty args;
|
||||
expr_ty body;
|
||||
} Lambda;
|
||||
|
||||
struct {
|
||||
expr_ty test;
|
||||
expr_ty body;
|
||||
expr_ty orelse;
|
||||
} IfExp;
|
||||
|
||||
struct {
|
||||
asdl_seq *keys;
|
||||
asdl_seq *values;
|
||||
} Dict;
|
||||
|
||||
struct {
|
||||
asdl_seq *elts;
|
||||
} Set;
|
||||
|
||||
struct {
|
||||
expr_ty elt;
|
||||
asdl_seq *generators;
|
||||
} ListComp;
|
||||
|
||||
struct {
|
||||
expr_ty elt;
|
||||
asdl_seq *generators;
|
||||
} SetComp;
|
||||
|
||||
struct {
|
||||
expr_ty key;
|
||||
expr_ty value;
|
||||
asdl_seq *generators;
|
||||
} DictComp;
|
||||
|
||||
struct {
|
||||
expr_ty elt;
|
||||
asdl_seq *generators;
|
||||
} GeneratorExp;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
} Yield;
|
||||
|
||||
struct {
|
||||
expr_ty left;
|
||||
asdl_int_seq *ops;
|
||||
asdl_seq *comparators;
|
||||
} Compare;
|
||||
|
||||
struct {
|
||||
expr_ty func;
|
||||
asdl_seq *args;
|
||||
asdl_seq *keywords;
|
||||
expr_ty starargs;
|
||||
expr_ty kwargs;
|
||||
} Call;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
} Repr;
|
||||
|
||||
struct {
|
||||
object n;
|
||||
} Num;
|
||||
|
||||
struct {
|
||||
string s;
|
||||
} Str;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
identifier attr;
|
||||
expr_context_ty ctx;
|
||||
} Attribute;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
slice_ty slice;
|
||||
expr_context_ty ctx;
|
||||
} Subscript;
|
||||
|
||||
struct {
|
||||
identifier id;
|
||||
expr_context_ty ctx;
|
||||
} Name;
|
||||
|
||||
struct {
|
||||
asdl_seq *elts;
|
||||
expr_context_ty ctx;
|
||||
} List;
|
||||
|
||||
struct {
|
||||
asdl_seq *elts;
|
||||
expr_context_ty ctx;
|
||||
} Tuple;
|
||||
|
||||
} v;
|
||||
int lineno;
|
||||
int col_offset;
|
||||
};
|
||||
|
||||
enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4};
|
||||
struct _slice {
|
||||
enum _slice_kind kind;
|
||||
union {
|
||||
struct {
|
||||
expr_ty lower;
|
||||
expr_ty upper;
|
||||
expr_ty step;
|
||||
} Slice;
|
||||
|
||||
struct {
|
||||
asdl_seq *dims;
|
||||
} ExtSlice;
|
||||
|
||||
struct {
|
||||
expr_ty value;
|
||||
} Index;
|
||||
|
||||
} v;
|
||||
};
|
||||
|
||||
struct _comprehension {
|
||||
expr_ty target;
|
||||
expr_ty iter;
|
||||
asdl_seq *ifs;
|
||||
};
|
||||
|
||||
enum _excepthandler_kind {ExceptHandler_kind=1};
|
||||
struct _excepthandler {
|
||||
enum _excepthandler_kind kind;
|
||||
union {
|
||||
struct {
|
||||
expr_ty type;
|
||||
expr_ty name;
|
||||
asdl_seq *body;
|
||||
} ExceptHandler;
|
||||
|
||||
} v;
|
||||
int lineno;
|
||||
int col_offset;
|
||||
};
|
||||
|
||||
struct _arguments {
|
||||
asdl_seq *args;
|
||||
identifier vararg;
|
||||
identifier kwarg;
|
||||
asdl_seq *defaults;
|
||||
};
|
||||
|
||||
struct _keyword {
|
||||
identifier arg;
|
||||
expr_ty value;
|
||||
};
|
||||
|
||||
struct _alias {
|
||||
identifier name;
|
||||
identifier asname;
|
||||
};
|
||||
|
||||
|
||||
#define Module(a0, a1) _Py_Module(a0, a1)
|
||||
mod_ty _Py_Module(asdl_seq * body, PyArena *arena);
|
||||
#define Interactive(a0, a1) _Py_Interactive(a0, a1)
|
||||
mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
|
||||
#define Expression(a0, a1) _Py_Expression(a0, a1)
|
||||
mod_ty _Py_Expression(expr_ty body, PyArena *arena);
|
||||
#define Suite(a0, a1) _Py_Suite(a0, a1)
|
||||
mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
|
||||
#define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6)
|
||||
stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
|
||||
asdl_seq * decorator_list, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6)
|
||||
stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body,
|
||||
asdl_seq * decorator_list, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
|
||||
stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||
#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
|
||||
stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena
|
||||
*arena);
|
||||
#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4)
|
||||
stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
|
||||
lineno, int col_offset, PyArena *arena);
|
||||
#define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
|
||||
stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
|
||||
orelse, int lineno, int col_offset, PyArena *arena);
|
||||
#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
||||
int col_offset, PyArena *arena);
|
||||
#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
||||
int col_offset, PyArena *arena);
|
||||
#define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body,
|
||||
int lineno, int col_offset, PyArena *arena);
|
||||
#define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
|
||||
int lineno, int col_offset, PyArena *arena);
|
||||
#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4)
|
||||
stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
|
||||
stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3)
|
||||
stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||
*arena);
|
||||
#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
|
||||
lineno, int col_offset, PyArena *arena);
|
||||
#define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5)
|
||||
stmt_ty _Py_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3)
|
||||
stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||
*arena);
|
||||
#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3)
|
||||
stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||
#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2)
|
||||
stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena);
|
||||
#define Break(a0, a1, a2) _Py_Break(a0, a1, a2)
|
||||
stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena);
|
||||
#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2)
|
||||
stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena);
|
||||
#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5)
|
||||
expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
|
||||
PyArena *arena);
|
||||
#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5)
|
||||
expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3)
|
||||
expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
|
||||
#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5)
|
||||
expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
|
||||
lineno, int col_offset, PyArena *arena);
|
||||
#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
|
||||
expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||
#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
|
||||
expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
|
||||
int lineno, int col_offset, PyArena *arena);
|
||||
#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
|
||||
expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
|
||||
starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
|
||||
*arena);
|
||||
#define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3)
|
||||
expr_ty _Py_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||
#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
|
||||
expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
|
||||
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
|
||||
expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
|
||||
#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
|
||||
expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
|
||||
lineno, int col_offset, PyArena *arena);
|
||||
#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5)
|
||||
expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
|
||||
lineno, int col_offset, PyArena *arena);
|
||||
#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4)
|
||||
expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
||||
col_offset, PyArena *arena);
|
||||
#define Ellipsis(a0) _Py_Ellipsis(a0)
|
||||
slice_ty _Py_Ellipsis(PyArena *arena);
|
||||
#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3)
|
||||
slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
|
||||
#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1)
|
||||
slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena);
|
||||
#define Index(a0, a1) _Py_Index(a0, a1)
|
||||
slice_ty _Py_Index(expr_ty value, PyArena *arena);
|
||||
#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3)
|
||||
comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
|
||||
ifs, PyArena *arena);
|
||||
#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5)
|
||||
excepthandler_ty _Py_ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body,
|
||||
int lineno, int col_offset, PyArena *arena);
|
||||
#define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4)
|
||||
arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, identifier
|
||||
kwarg, asdl_seq * defaults, PyArena *arena);
|
||||
#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2)
|
||||
keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena);
|
||||
#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
|
||||
alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena);
|
||||
|
||||
PyObject* PyAST_mod2obj(mod_ty t);
|
||||
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
|
||||
int PyAST_Check(PyObject* obj);
|
||||
@@ -1,178 +0,0 @@
|
||||
#ifndef Py_PYTHON_H
|
||||
#define Py_PYTHON_H
|
||||
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
|
||||
|
||||
/* Include nearly all Python header files */
|
||||
|
||||
#include "patchlevel.h"
|
||||
#include "pyconfig.h"
|
||||
#include "pymacconfig.h"
|
||||
|
||||
/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the
|
||||
* old symbol for the benefit of extension modules written before then
|
||||
* that may be conditionalizing on it. The core doesn't use it anymore.
|
||||
*/
|
||||
#ifndef WITH_CYCLE_GC
|
||||
#define WITH_CYCLE_GC 1
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef UCHAR_MAX
|
||||
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
|
||||
#endif
|
||||
|
||||
#if UCHAR_MAX != 255
|
||||
#error "Python's source code assumes C's unsigned char is an 8-bit type."
|
||||
#endif
|
||||
|
||||
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
|
||||
#define _SGI_MP_SOURCE
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef NULL
|
||||
# error "Python.h requires that stdio.h define NULL."
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* For size_t? */
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* CAUTION: Build setups should ensure that NDEBUG is defined on the
|
||||
* compiler command line when building Python in release mode; else
|
||||
* assert() calls won't be removed.
|
||||
*/
|
||||
#include <assert.h>
|
||||
|
||||
#include "pyport.h"
|
||||
|
||||
/* pyconfig.h or pyport.h may or may not define DL_IMPORT */
|
||||
#ifndef DL_IMPORT /* declarations for DLL import/export */
|
||||
#define DL_IMPORT(RTYPE) RTYPE
|
||||
#endif
|
||||
#ifndef DL_EXPORT /* declarations for DLL import/export */
|
||||
#define DL_EXPORT(RTYPE) RTYPE
|
||||
#endif
|
||||
|
||||
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
|
||||
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
|
||||
*/
|
||||
#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
|
||||
#define PYMALLOC_DEBUG
|
||||
#endif
|
||||
#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
|
||||
#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
|
||||
#endif
|
||||
#include "pymath.h"
|
||||
#include "pymem.h"
|
||||
|
||||
#include "object.h"
|
||||
#include "objimpl.h"
|
||||
|
||||
#include "pydebug.h"
|
||||
|
||||
#include "unicodeobject.h"
|
||||
#include "intobject.h"
|
||||
#include "boolobject.h"
|
||||
#include "longobject.h"
|
||||
#include "floatobject.h"
|
||||
#ifndef WITHOUT_COMPLEX
|
||||
#include "complexobject.h"
|
||||
#endif
|
||||
#include "rangeobject.h"
|
||||
#include "stringobject.h"
|
||||
#include "memoryobject.h"
|
||||
#include "bufferobject.h"
|
||||
#include "bytesobject.h"
|
||||
#include "bytearrayobject.h"
|
||||
#include "tupleobject.h"
|
||||
#include "listobject.h"
|
||||
#include "dictobject.h"
|
||||
#include "enumobject.h"
|
||||
#include "setobject.h"
|
||||
#include "methodobject.h"
|
||||
#include "moduleobject.h"
|
||||
#include "funcobject.h"
|
||||
#include "classobject.h"
|
||||
#include "fileobject.h"
|
||||
#include "cobject.h"
|
||||
#include "pycapsule.h"
|
||||
#include "traceback.h"
|
||||
#include "sliceobject.h"
|
||||
#include "cellobject.h"
|
||||
#include "iterobject.h"
|
||||
#include "genobject.h"
|
||||
#include "descrobject.h"
|
||||
#include "warnings.h"
|
||||
#include "weakrefobject.h"
|
||||
|
||||
#include "codecs.h"
|
||||
#include "pyerrors.h"
|
||||
|
||||
#include "pystate.h"
|
||||
|
||||
#include "pyarena.h"
|
||||
#include "modsupport.h"
|
||||
#include "pythonrun.h"
|
||||
#include "ceval.h"
|
||||
#include "sysmodule.h"
|
||||
#include "intrcheck.h"
|
||||
#include "import.h"
|
||||
|
||||
#include "abstract.h"
|
||||
|
||||
#include "compile.h"
|
||||
#include "eval.h"
|
||||
|
||||
#include "pyctype.h"
|
||||
#include "pystrtod.h"
|
||||
#include "pystrcmp.h"
|
||||
#include "dtoa.h"
|
||||
|
||||
/* _Py_Mangle is defined in compile.c */
|
||||
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
|
||||
|
||||
/* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */
|
||||
#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
|
||||
|
||||
/* PyArg_NoArgs should not be necessary.
|
||||
Set ml_flags in the PyMethodDef to METH_NOARGS. */
|
||||
#define PyArg_NoArgs(v) PyArg_Parse(v, "")
|
||||
|
||||
/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
|
||||
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
|
||||
|
||||
#include "pyfpe.h"
|
||||
|
||||
/* These definitions must match corresponding definitions in graminit.h.
|
||||
There's code in compile.c that checks that they are the same. */
|
||||
#define Py_single_input 256
|
||||
#define Py_file_input 257
|
||||
#define Py_eval_input 258
|
||||
|
||||
#ifdef HAVE_PTH
|
||||
/* GNU pth user-space thread support */
|
||||
#include <pth.h>
|
||||
#endif
|
||||
|
||||
/* Define macros for inline documentation. */
|
||||
#define PyDoc_VAR(name) static char name[]
|
||||
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
|
||||
#ifdef WITH_DOC_STRINGS
|
||||
#define PyDoc_STR(str) str
|
||||
#else
|
||||
#define PyDoc_STR(str) ""
|
||||
#endif
|
||||
|
||||
#endif /* !Py_PYTHON_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
#ifndef Py_ASDL_H
|
||||
#define Py_ASDL_H
|
||||
|
||||
typedef PyObject * identifier;
|
||||
typedef PyObject * string;
|
||||
typedef PyObject * object;
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum {false, true} bool;
|
||||
#endif
|
||||
|
||||
/* It would be nice if the code generated by asdl_c.py was completely
|
||||
independent of Python, but it is a goal the requires too much work
|
||||
at this stage. So, for example, I'll represent identifiers as
|
||||
interned Python strings.
|
||||
*/
|
||||
|
||||
/* XXX A sequence should be typed so that its use can be typechecked. */
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
void *elements[1];
|
||||
} asdl_seq;
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
int elements[1];
|
||||
} asdl_int_seq;
|
||||
|
||||
asdl_seq *asdl_seq_new(int size, PyArena *arena);
|
||||
asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena);
|
||||
|
||||
#define asdl_seq_GET(S, I) (S)->elements[(I)]
|
||||
#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
|
||||
#ifdef Py_DEBUG
|
||||
#define asdl_seq_SET(S, I, V) { \
|
||||
int _asdl_i = (I); \
|
||||
assert((S) && _asdl_i < (S)->size); \
|
||||
(S)->elements[_asdl_i] = (V); \
|
||||
}
|
||||
#else
|
||||
#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
|
||||
#endif
|
||||
|
||||
#endif /* !Py_ASDL_H */
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef Py_AST_H
|
||||
#define Py_AST_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags,
|
||||
const char *, PyArena *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_AST_H */
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
#ifndef Py_BITSET_H
|
||||
#define Py_BITSET_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Bitset interface */
|
||||
|
||||
#define BYTE char
|
||||
|
||||
typedef BYTE *bitset;
|
||||
|
||||
bitset newbitset(int nbits);
|
||||
void delbitset(bitset bs);
|
||||
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
|
||||
int addbit(bitset bs, int ibit); /* Returns 0 if already set */
|
||||
int samebitset(bitset bs1, bitset bs2, int nbits);
|
||||
void mergebitset(bitset bs1, bitset bs2, int nbits);
|
||||
|
||||
#define BITSPERBYTE (8*sizeof(BYTE))
|
||||
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
|
||||
|
||||
#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
|
||||
#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
|
||||
#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
|
||||
#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_BITSET_H */
|
||||
@@ -1,36 +0,0 @@
|
||||
/* Boolean object interface */
|
||||
|
||||
#ifndef Py_BOOLOBJECT_H
|
||||
#define Py_BOOLOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef PyIntObject PyBoolObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyBool_Type;
|
||||
|
||||
#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
|
||||
|
||||
/* Py_False and Py_True are the only two bools in existence.
|
||||
Don't forget to apply Py_INCREF() when returning either!!! */
|
||||
|
||||
/* Don't use these directly */
|
||||
PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct;
|
||||
|
||||
/* Use these macros */
|
||||
#define Py_False ((PyObject *) &_Py_ZeroStruct)
|
||||
#define Py_True ((PyObject *) &_Py_TrueStruct)
|
||||
|
||||
/* Macros for returning Py_True or Py_False, respectively */
|
||||
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
|
||||
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
|
||||
|
||||
/* Function to return a bool from a C long */
|
||||
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_BOOLOBJECT_H */
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
/* Buffer object interface */
|
||||
|
||||
/* Note: the object's structure is private */
|
||||
|
||||
#ifndef Py_BUFFEROBJECT_H
|
||||
#define Py_BUFFEROBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyBuffer_Type;
|
||||
|
||||
#define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type)
|
||||
|
||||
#define Py_END_OF_BUFFER (-1)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base,
|
||||
Py_ssize_t offset, Py_ssize_t size);
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base,
|
||||
Py_ssize_t offset,
|
||||
Py_ssize_t size);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size);
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_BUFFEROBJECT_H */
|
||||
@@ -1,57 +0,0 @@
|
||||
/* ByteArray object interface */
|
||||
|
||||
#ifndef Py_BYTEARRAYOBJECT_H
|
||||
#define Py_BYTEARRAYOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Type PyByteArrayObject represents a mutable array of bytes.
|
||||
* The Python API is that of a sequence;
|
||||
* the bytes are mapped to ints in [0, 256).
|
||||
* Bytes are not characters; they may be used to encode characters.
|
||||
* The only way to go between bytes and str/unicode is via encoding
|
||||
* and decoding.
|
||||
* For the convenience of C programmers, the bytes type is considered
|
||||
* to contain a char pointer, not an unsigned char pointer.
|
||||
*/
|
||||
|
||||
/* Object layout */
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD
|
||||
/* XXX(nnorwitz): should ob_exports be Py_ssize_t? */
|
||||
int ob_exports; /* how many buffer exports */
|
||||
Py_ssize_t ob_alloc; /* How many bytes allocated */
|
||||
char *ob_bytes;
|
||||
} PyByteArrayObject;
|
||||
|
||||
/* Type object */
|
||||
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
|
||||
|
||||
/* Type check macros */
|
||||
#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
|
||||
#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type)
|
||||
|
||||
/* Direct API functions */
|
||||
PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t);
|
||||
PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *);
|
||||
PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
|
||||
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
|
||||
|
||||
/* Macros, trading safety for speed */
|
||||
#define PyByteArray_AS_STRING(self) \
|
||||
(assert(PyByteArray_Check(self)), \
|
||||
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string)
|
||||
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self))
|
||||
|
||||
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_BYTEARRAYOBJECT_H */
|
||||
@@ -1,75 +0,0 @@
|
||||
#ifndef Py_BYTES_CTYPE_H
|
||||
#define Py_BYTES_CTYPE_H
|
||||
|
||||
/*
|
||||
* The internal implementation behind PyString (bytes) and PyBytes (buffer)
|
||||
* methods of the given names, they operate on ASCII byte strings.
|
||||
*/
|
||||
extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
|
||||
extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
|
||||
extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
|
||||
extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
|
||||
extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
|
||||
extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
|
||||
extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
|
||||
|
||||
/* These store their len sized answer in the given preallocated *result arg. */
|
||||
extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
|
||||
extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
|
||||
extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
|
||||
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
|
||||
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
|
||||
|
||||
/* Shared __doc__ strings. */
|
||||
extern const char _Py_isspace__doc__[];
|
||||
extern const char _Py_isalpha__doc__[];
|
||||
extern const char _Py_isalnum__doc__[];
|
||||
extern const char _Py_isdigit__doc__[];
|
||||
extern const char _Py_islower__doc__[];
|
||||
extern const char _Py_isupper__doc__[];
|
||||
extern const char _Py_istitle__doc__[];
|
||||
extern const char _Py_lower__doc__[];
|
||||
extern const char _Py_upper__doc__[];
|
||||
extern const char _Py_title__doc__[];
|
||||
extern const char _Py_capitalize__doc__[];
|
||||
extern const char _Py_swapcase__doc__[];
|
||||
|
||||
/* These are left in for backward compatibility and will be removed
|
||||
in 2.8/3.2 */
|
||||
#define ISLOWER(c) Py_ISLOWER(c)
|
||||
#define ISUPPER(c) Py_ISUPPER(c)
|
||||
#define ISALPHA(c) Py_ISALPHA(c)
|
||||
#define ISDIGIT(c) Py_ISDIGIT(c)
|
||||
#define ISXDIGIT(c) Py_ISXDIGIT(c)
|
||||
#define ISALNUM(c) Py_ISALNUM(c)
|
||||
#define ISSPACE(c) Py_ISSPACE(c)
|
||||
|
||||
#undef islower
|
||||
#define islower(c) undefined_islower(c)
|
||||
#undef isupper
|
||||
#define isupper(c) undefined_isupper(c)
|
||||
#undef isalpha
|
||||
#define isalpha(c) undefined_isalpha(c)
|
||||
#undef isdigit
|
||||
#define isdigit(c) undefined_isdigit(c)
|
||||
#undef isxdigit
|
||||
#define isxdigit(c) undefined_isxdigit(c)
|
||||
#undef isalnum
|
||||
#define isalnum(c) undefined_isalnum(c)
|
||||
#undef isspace
|
||||
#define isspace(c) undefined_isspace(c)
|
||||
|
||||
/* These are left in for backward compatibility and will be removed
|
||||
in 2.8/3.2 */
|
||||
#define TOLOWER(c) Py_TOLOWER(c)
|
||||
#define TOUPPER(c) Py_TOUPPER(c)
|
||||
|
||||
#undef tolower
|
||||
#define tolower(c) undefined_tolower(c)
|
||||
#undef toupper
|
||||
#define toupper(c) undefined_toupper(c)
|
||||
|
||||
/* this is needed because some docs are shared from the .o, not static */
|
||||
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
|
||||
|
||||
#endif /* !Py_BYTES_CTYPE_H */
|
||||
@@ -1,27 +0,0 @@
|
||||
#define PyBytesObject PyStringObject
|
||||
#define PyBytes_Type PyString_Type
|
||||
|
||||
#define PyBytes_Check PyString_Check
|
||||
#define PyBytes_CheckExact PyString_CheckExact
|
||||
#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED
|
||||
#define PyBytes_AS_STRING PyString_AS_STRING
|
||||
#define PyBytes_GET_SIZE PyString_GET_SIZE
|
||||
#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS
|
||||
|
||||
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyBytes_FromFormatV PyString_FromFormatV
|
||||
#define PyBytes_FromFormat PyString_FromFormat
|
||||
#define PyBytes_Size PyString_Size
|
||||
#define PyBytes_AsString PyString_AsString
|
||||
#define PyBytes_Repr PyString_Repr
|
||||
#define PyBytes_Concat PyString_Concat
|
||||
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
|
||||
#define _PyBytes_Resize _PyString_Resize
|
||||
#define _PyBytes_Eq _PyString_Eq
|
||||
#define PyBytes_Format PyString_Format
|
||||
#define _PyBytes_FormatLong _PyString_FormatLong
|
||||
#define PyBytes_DecodeEscape PyString_DecodeEscape
|
||||
#define _PyBytes_Join _PyString_Join
|
||||
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
|
||||
#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping
|
||||
@@ -1,73 +0,0 @@
|
||||
#ifndef Py_CSTRINGIO_H
|
||||
#define Py_CSTRINGIO_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
|
||||
This header provides access to cStringIO objects from C.
|
||||
Functions are provided for calling cStringIO objects and
|
||||
macros are provided for testing whether you have cStringIO
|
||||
objects.
|
||||
|
||||
Before calling any of the functions or macros, you must initialize
|
||||
the routines with:
|
||||
|
||||
PycString_IMPORT
|
||||
|
||||
This would typically be done in your init function.
|
||||
|
||||
*/
|
||||
|
||||
#define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI"
|
||||
|
||||
#define PycString_IMPORT \
|
||||
PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\
|
||||
PycStringIO_CAPSULE_NAME, 0))
|
||||
|
||||
/* Basic functions to manipulate cStringIO objects from C */
|
||||
|
||||
static struct PycStringIO_CAPI {
|
||||
|
||||
/* Read a string from an input object. If the last argument
|
||||
is -1, the remainder will be read.
|
||||
*/
|
||||
int(*cread)(PyObject *, char **, Py_ssize_t);
|
||||
|
||||
/* Read a line from an input object. Returns the length of the read
|
||||
line as an int and a pointer inside the object buffer as char** (so
|
||||
the caller doesn't have to provide its own buffer as destination).
|
||||
*/
|
||||
int(*creadline)(PyObject *, char **);
|
||||
|
||||
/* Write a string to an output object*/
|
||||
int(*cwrite)(PyObject *, const char *, Py_ssize_t);
|
||||
|
||||
/* Get the output object as a Python string (returns new reference). */
|
||||
PyObject *(*cgetvalue)(PyObject *);
|
||||
|
||||
/* Create a new output object */
|
||||
PyObject *(*NewOutput)(int);
|
||||
|
||||
/* Create an input object from a Python string
|
||||
(copies the Python string reference).
|
||||
*/
|
||||
PyObject *(*NewInput)(PyObject *);
|
||||
|
||||
/* The Python types for cStringIO input and output objects.
|
||||
Note that you can do input on an output object.
|
||||
*/
|
||||
PyTypeObject *InputType, *OutputType;
|
||||
|
||||
} *PycStringIO;
|
||||
|
||||
/* These can be used to test if you have one */
|
||||
#define PycStringIO_InputCheck(O) \
|
||||
(Py_TYPE(O)==PycStringIO->InputType)
|
||||
#define PycStringIO_OutputCheck(O) \
|
||||
(Py_TYPE(O)==PycStringIO->OutputType)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_CSTRINGIO_H */
|
||||
@@ -1,28 +0,0 @@
|
||||
/* Cell object interface */
|
||||
|
||||
#ifndef Py_CELLOBJECT_H
|
||||
#define Py_CELLOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *ob_ref; /* Content of the cell or NULL when empty */
|
||||
} PyCellObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCell_Type;
|
||||
|
||||
#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
|
||||
PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
|
||||
|
||||
#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref)
|
||||
#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_TUPLEOBJECT_H */
|
||||
@@ -1,153 +0,0 @@
|
||||
#ifndef Py_CEVAL_H
|
||||
#define Py_CEVAL_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Interface to random parts in ceval.c */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
|
||||
PyObject *, PyObject *, PyObject *);
|
||||
|
||||
/* Inline this */
|
||||
#define PyEval_CallObject(func,arg) \
|
||||
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
|
||||
const char *format, ...);
|
||||
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
|
||||
const char *methodname,
|
||||
const char *format, ...);
|
||||
|
||||
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
|
||||
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
||||
|
||||
struct _frame; /* Avoid including frameobject.h */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
|
||||
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
|
||||
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
|
||||
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
|
||||
PyAPI_FUNC(int) PyEval_GetRestricted(void);
|
||||
|
||||
/* Look at the current frame's (if any) code's co_flags, and turn on
|
||||
the corresponding compiler flags in cf->cf_flags. Return 1 if any
|
||||
flag was set, else return 0. */
|
||||
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
||||
|
||||
PyAPI_FUNC(int) Py_FlushLine(void);
|
||||
|
||||
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
|
||||
PyAPI_FUNC(int) Py_MakePendingCalls(void);
|
||||
|
||||
/* Protection against deeply nested recursive calls */
|
||||
PyAPI_FUNC(void) Py_SetRecursionLimit(int);
|
||||
PyAPI_FUNC(int) Py_GetRecursionLimit(void);
|
||||
|
||||
#define Py_EnterRecursiveCall(where) \
|
||||
(_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
|
||||
_Py_CheckRecursiveCall(where))
|
||||
#define Py_LeaveRecursiveCall() \
|
||||
(--PyThreadState_GET()->recursion_depth)
|
||||
PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
|
||||
PyAPI_DATA(int) _Py_CheckRecursionLimit;
|
||||
#ifdef USE_STACKCHECK
|
||||
# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
|
||||
#else
|
||||
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
||||
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
|
||||
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
|
||||
|
||||
/* this used to be handled on a per-thread basis - now just two globals */
|
||||
PyAPI_DATA(volatile int) _Py_Ticker;
|
||||
PyAPI_DATA(int) _Py_CheckInterval;
|
||||
|
||||
/* Interface for threads.
|
||||
|
||||
A module that plans to do a blocking system call (or something else
|
||||
that lasts a long time and doesn't touch Python data) can allow other
|
||||
threads to run as follows:
|
||||
|
||||
...preparations here...
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
...blocking system call here...
|
||||
Py_END_ALLOW_THREADS
|
||||
...interpret result here...
|
||||
|
||||
The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
|
||||
{}-surrounded block.
|
||||
To leave the block in the middle (e.g., with return), you must insert
|
||||
a line containing Py_BLOCK_THREADS before the return, e.g.
|
||||
|
||||
if (...premature_exit...) {
|
||||
Py_BLOCK_THREADS
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
An alternative is:
|
||||
|
||||
Py_BLOCK_THREADS
|
||||
if (...premature_exit...) {
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
Py_UNBLOCK_THREADS
|
||||
|
||||
For convenience, that the value of 'errno' is restored across
|
||||
Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
|
||||
|
||||
WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
|
||||
Py_END_ALLOW_THREADS!!!
|
||||
|
||||
The function PyEval_InitThreads() should be called only from
|
||||
initthread() in "threadmodule.c".
|
||||
|
||||
Note that not yet all candidates have been converted to use this
|
||||
mechanism!
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
|
||||
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
|
||||
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
|
||||
PyAPI_FUNC(void) PyEval_InitThreads(void);
|
||||
PyAPI_FUNC(void) PyEval_AcquireLock(void);
|
||||
PyAPI_FUNC(void) PyEval_ReleaseLock(void);
|
||||
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
|
||||
|
||||
#define Py_BEGIN_ALLOW_THREADS { \
|
||||
PyThreadState *_save; \
|
||||
_save = PyEval_SaveThread();
|
||||
#define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
|
||||
#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
|
||||
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
|
||||
}
|
||||
|
||||
#else /* !WITH_THREAD */
|
||||
|
||||
#define Py_BEGIN_ALLOW_THREADS {
|
||||
#define Py_BLOCK_THREADS
|
||||
#define Py_UNBLOCK_THREADS
|
||||
#define Py_END_ALLOW_THREADS }
|
||||
|
||||
#endif /* !WITH_THREAD */
|
||||
|
||||
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_CEVAL_H */
|
||||
@@ -1,83 +0,0 @@
|
||||
|
||||
/* Class object interface */
|
||||
|
||||
/* Revealing some structures (not for general use) */
|
||||
|
||||
#ifndef Py_CLASSOBJECT_H
|
||||
#define Py_CLASSOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *cl_bases; /* A tuple of class objects */
|
||||
PyObject *cl_dict; /* A dictionary */
|
||||
PyObject *cl_name; /* A string */
|
||||
/* The following three are functions or NULL */
|
||||
PyObject *cl_getattr;
|
||||
PyObject *cl_setattr;
|
||||
PyObject *cl_delattr;
|
||||
PyObject *cl_weakreflist; /* List of weak references */
|
||||
} PyClassObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyClassObject *in_class; /* The class object */
|
||||
PyObject *in_dict; /* A dictionary */
|
||||
PyObject *in_weakreflist; /* List of weak references */
|
||||
} PyInstanceObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *im_func; /* The callable object implementing the method */
|
||||
PyObject *im_self; /* The instance it is bound to, or NULL */
|
||||
PyObject *im_class; /* The class that asked for the method */
|
||||
PyObject *im_weakreflist; /* List of weak references */
|
||||
} PyMethodObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;
|
||||
|
||||
#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
|
||||
#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
|
||||
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,
|
||||
PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
|
||||
|
||||
/* Look up attribute with name (a string) on instance object pinst, using
|
||||
* only the instance and base class dicts. If a descriptor is found in
|
||||
* a class dict, the descriptor is returned without calling it.
|
||||
* Returns NULL if nothing found, else a borrowed reference to the
|
||||
* value associated with name in the dict in which name was found.
|
||||
* The point of this routine is that it never calls arbitrary Python
|
||||
* code, so is always "safe": all it does is dict lookups. The function
|
||||
* can't fail, never sets an exception, and NULL is not an error (it just
|
||||
* means "not found").
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
|
||||
|
||||
/* Macros for direct access to these values. Type checks are *not*
|
||||
done, so use with care. */
|
||||
#define PyMethod_GET_FUNCTION(meth) \
|
||||
(((PyMethodObject *)meth) -> im_func)
|
||||
#define PyMethod_GET_SELF(meth) \
|
||||
(((PyMethodObject *)meth) -> im_self)
|
||||
#define PyMethod_GET_CLASS(meth) \
|
||||
(((PyMethodObject *)meth) -> im_class)
|
||||
|
||||
PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);
|
||||
|
||||
PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_CLASSOBJECT_H */
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
CObjects are marked Pending Deprecation as of Python 2.7.
|
||||
The full schedule for 2.x is as follows:
|
||||
- CObjects are marked Pending Deprecation in Python 2.7.
|
||||
- CObjects will be marked Deprecated in Python 2.8
|
||||
(if there is one).
|
||||
- CObjects will be removed in Python 2.9 (if there is one).
|
||||
|
||||
Additionally, for the Python 3.x series:
|
||||
- CObjects were marked Deprecated in Python 3.1.
|
||||
- CObjects will be removed in Python 3.2.
|
||||
|
||||
You should switch all use of CObjects to capsules. Capsules
|
||||
have a safer and more consistent API. For more information,
|
||||
see Include/pycapsule.h, or read the "Capsules" topic in
|
||||
the "Python/C API Reference Manual".
|
||||
|
||||
Python 2.7 no longer uses CObjects itself; all objects which
|
||||
were formerly CObjects are now capsules. Note that this change
|
||||
does not by itself break binary compatibility with extensions
|
||||
built for previous versions of Python--PyCObject_AsVoidPtr()
|
||||
has been changed to also understand capsules.
|
||||
|
||||
*/
|
||||
|
||||
/* original file header comment follows: */
|
||||
|
||||
/* C objects to be exported from one extension module to another.
|
||||
|
||||
C objects are used for communication between extension modules.
|
||||
They provide a way for an extension module to export a C interface
|
||||
to other extension modules, so that extension modules can use the
|
||||
Python import mechanism to link to one another.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef Py_COBJECT_H
|
||||
#define Py_COBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCObject_Type;
|
||||
|
||||
#define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type)
|
||||
|
||||
/* Create a PyCObject from a pointer to a C object and an optional
|
||||
destructor function. If the second argument is non-null, then it
|
||||
will be called with the first argument if and when the PyCObject is
|
||||
destroyed.
|
||||
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr(
|
||||
void *cobj, void (*destruct)(void*));
|
||||
|
||||
|
||||
/* Create a PyCObject from a pointer to a C object, a description object,
|
||||
and an optional destructor function. If the third argument is non-null,
|
||||
then it will be called with the first and second arguments if and when
|
||||
the PyCObject is destroyed.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc(
|
||||
void *cobj, void *desc, void (*destruct)(void*,void*));
|
||||
|
||||
/* Retrieve a pointer to a C object from a PyCObject. */
|
||||
PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *);
|
||||
|
||||
/* Retrieve a pointer to a description object from a PyCObject. */
|
||||
PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *);
|
||||
|
||||
/* Import a pointer to a C object from a module using a PyCObject. */
|
||||
PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name);
|
||||
|
||||
/* Modify a C object. Fails (==0) if object has a destructor. */
|
||||
PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj);
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
void *cobject;
|
||||
void *desc;
|
||||
void (*destructor)(void *);
|
||||
} PyCObject;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_COBJECT_H */
|
||||
@@ -1,107 +0,0 @@
|
||||
/* Definitions for bytecode */
|
||||
|
||||
#ifndef Py_CODE_H
|
||||
#define Py_CODE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Bytecode object */
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
int co_argcount; /* #arguments, except *args */
|
||||
int co_nlocals; /* #local variables */
|
||||
int co_stacksize; /* #entries needed for evaluation stack */
|
||||
int co_flags; /* CO_..., see below */
|
||||
PyObject *co_code; /* instruction opcodes */
|
||||
PyObject *co_consts; /* list (constants used) */
|
||||
PyObject *co_names; /* list of strings (names used) */
|
||||
PyObject *co_varnames; /* tuple of strings (local variable names) */
|
||||
PyObject *co_freevars; /* tuple of strings (free variable names) */
|
||||
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
|
||||
/* The rest doesn't count for hash/cmp */
|
||||
PyObject *co_filename; /* string (where it was loaded from) */
|
||||
PyObject *co_name; /* string (name, for reference) */
|
||||
int co_firstlineno; /* first source line number */
|
||||
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See
|
||||
Objects/lnotab_notes.txt for details. */
|
||||
void *co_zombieframe; /* for optimization only (see frameobject.c) */
|
||||
PyObject *co_weakreflist; /* to support weakrefs to code objects */
|
||||
} PyCodeObject;
|
||||
|
||||
/* Masks for co_flags above */
|
||||
#define CO_OPTIMIZED 0x0001
|
||||
#define CO_NEWLOCALS 0x0002
|
||||
#define CO_VARARGS 0x0004
|
||||
#define CO_VARKEYWORDS 0x0008
|
||||
#define CO_NESTED 0x0010
|
||||
#define CO_GENERATOR 0x0020
|
||||
/* The CO_NOFREE flag is set if there are no free or cell variables.
|
||||
This information is redundant, but it allows a single flag test
|
||||
to determine whether there is any extra work to be done when the
|
||||
call frame it setup.
|
||||
*/
|
||||
#define CO_NOFREE 0x0040
|
||||
|
||||
#if 0
|
||||
/* This is no longer used. Stopped defining in 2.5, do not re-use. */
|
||||
#define CO_GENERATOR_ALLOWED 0x1000
|
||||
#endif
|
||||
#define CO_FUTURE_DIVISION 0x2000
|
||||
#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */
|
||||
#define CO_FUTURE_WITH_STATEMENT 0x8000
|
||||
#define CO_FUTURE_PRINT_FUNCTION 0x10000
|
||||
#define CO_FUTURE_UNICODE_LITERALS 0x20000
|
||||
|
||||
/* This should be defined if a future statement modifies the syntax.
|
||||
For example, when a keyword is added.
|
||||
*/
|
||||
#if 1
|
||||
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
|
||||
#endif
|
||||
|
||||
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCode_Type;
|
||||
|
||||
#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type)
|
||||
#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))
|
||||
|
||||
/* Public interface */
|
||||
PyAPI_FUNC(PyCodeObject *) PyCode_New(
|
||||
int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
|
||||
PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
|
||||
/* same as struct above */
|
||||
|
||||
/* Creates a new empty code object with the specified source location. */
|
||||
PyAPI_FUNC(PyCodeObject *)
|
||||
PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
|
||||
|
||||
/* Return the line number associated with the specified bytecode index
|
||||
in this code object. If you just need the line number of a frame,
|
||||
use PyFrame_GetLineNumber() instead. */
|
||||
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
|
||||
|
||||
/* for internal use only */
|
||||
#define _PyCode_GETCODEPTR(co, pp) \
|
||||
((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \
|
||||
((co)->co_code, 0, (void **)(pp)))
|
||||
|
||||
typedef struct _addr_pair {
|
||||
int ap_lower;
|
||||
int ap_upper;
|
||||
} PyAddrPair;
|
||||
|
||||
/* Update *bounds to describe the first and one-past-the-last instructions in the
|
||||
same line as lasti. Return the number of that line.
|
||||
*/
|
||||
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
|
||||
int lasti, PyAddrPair *bounds);
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
|
||||
PyObject *names, PyObject *lineno_obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_CODE_H */
|
||||
@@ -1,167 +0,0 @@
|
||||
#ifndef Py_CODECREGISTRY_H
|
||||
#define Py_CODECREGISTRY_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
|
||||
Python Codec Registry and support functions
|
||||
|
||||
|
||||
Written by Marc-Andre Lemburg (mal@lemburg.com).
|
||||
|
||||
Copyright (c) Corporation for National Research Initiatives.
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* Register a new codec search function.
|
||||
|
||||
As side effect, this tries to load the encodings package, if not
|
||||
yet done, to make sure that it is always first in the list of
|
||||
search functions.
|
||||
|
||||
The search_function's refcount is incremented by this function. */
|
||||
|
||||
PyAPI_FUNC(int) PyCodec_Register(
|
||||
PyObject *search_function
|
||||
);
|
||||
|
||||
/* Codec register lookup API.
|
||||
|
||||
Looks up the given encoding and returns a CodecInfo object with
|
||||
function attributes which implement the different aspects of
|
||||
processing the encoding.
|
||||
|
||||
The encoding string is looked up converted to all lower-case
|
||||
characters. This makes encodings looked up through this mechanism
|
||||
effectively case-insensitive.
|
||||
|
||||
If no codec is found, a KeyError is set and NULL returned.
|
||||
|
||||
As side effect, this tries to load the encodings package, if not
|
||||
yet done. This is part of the lazy load strategy for the encodings
|
||||
package.
|
||||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
/* Generic codec based encoding API.
|
||||
|
||||
object is passed through the encoder function found for the given
|
||||
encoding using the error handling method defined by errors. errors
|
||||
may be NULL to use the default method defined for the codec.
|
||||
|
||||
Raises a LookupError in case no encoder can be found.
|
||||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Encode(
|
||||
PyObject *object,
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Generic codec based decoding API.
|
||||
|
||||
object is passed through the decoder function found for the given
|
||||
encoding using the error handling method defined by errors. errors
|
||||
may be NULL to use the default method defined for the codec.
|
||||
|
||||
Raises a LookupError in case no encoder can be found.
|
||||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
||||
PyObject *object,
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* --- Codec Lookup APIs --------------------------------------------------
|
||||
|
||||
All APIs return a codec object with incremented refcount and are
|
||||
based on _PyCodec_Lookup(). The same comments w/r to the encoding
|
||||
name also apply to these APIs.
|
||||
|
||||
*/
|
||||
|
||||
/* Get an encoder function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Encoder(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
/* Get a decoder function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_Decoder(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
/* Get a IncrementalEncoder object for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Get a IncrementalDecoder object function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
|
||||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Get a StreamReader factory function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
|
||||
const char *encoding,
|
||||
PyObject *stream,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Get a StreamWriter factory function for the given encoding. */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
|
||||
const char *encoding,
|
||||
PyObject *stream,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* Unicode encoding error handling callback registry API */
|
||||
|
||||
/* Register the error handling callback function error under the given
|
||||
name. This function will be called by the codec when it encounters
|
||||
unencodable characters/undecodable bytes and doesn't know the
|
||||
callback name, when name is specified as the error parameter
|
||||
in the call to the encode/decode function.
|
||||
Return 0 on success, -1 on error */
|
||||
PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
|
||||
|
||||
/* Lookup the error handling callback function registered under the given
|
||||
name. As a special case NULL can be passed, in which case
|
||||
the error handling callback for "strict" will be returned. */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
|
||||
|
||||
/* raise exc as an exception */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
|
||||
|
||||
/* ignore the unicode error, skipping the faulty input */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
|
||||
|
||||
/* replace the unicode encode error with ? or U+FFFD */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
|
||||
|
||||
/* replace the unicode encode error with XML character references */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
|
||||
|
||||
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
|
||||
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_CODECREGISTRY_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
#ifndef Py_COMPILE_H
|
||||
#define Py_COMPILE_H
|
||||
|
||||
#include "code.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public interface */
|
||||
struct _node; /* Declare the existence of this type */
|
||||
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
|
||||
|
||||
/* Future feature support */
|
||||
|
||||
typedef struct {
|
||||
int ff_features; /* flags set by future statements */
|
||||
int ff_lineno; /* line number of last future statement */
|
||||
} PyFutureFeatures;
|
||||
|
||||
#define FUTURE_NESTED_SCOPES "nested_scopes"
|
||||
#define FUTURE_GENERATORS "generators"
|
||||
#define FUTURE_DIVISION "division"
|
||||
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
|
||||
#define FUTURE_WITH_STATEMENT "with_statement"
|
||||
#define FUTURE_PRINT_FUNCTION "print_function"
|
||||
#define FUTURE_UNICODE_LITERALS "unicode_literals"
|
||||
|
||||
|
||||
struct _mod; /* Declare the existence of this type */
|
||||
PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *,
|
||||
PyCompilerFlags *, PyArena *);
|
||||
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_COMPILE_H */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Complex number structure */
|
||||
|
||||
#ifndef Py_COMPLEXOBJECT_H
|
||||
#define Py_COMPLEXOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
double real;
|
||||
double imag;
|
||||
} Py_complex;
|
||||
|
||||
/* Operations on complex numbers from complexmodule.c */
|
||||
|
||||
#define c_sum _Py_c_sum
|
||||
#define c_diff _Py_c_diff
|
||||
#define c_neg _Py_c_neg
|
||||
#define c_prod _Py_c_prod
|
||||
#define c_quot _Py_c_quot
|
||||
#define c_pow _Py_c_pow
|
||||
#define c_abs _Py_c_abs
|
||||
|
||||
PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex);
|
||||
PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex);
|
||||
PyAPI_FUNC(Py_complex) c_neg(Py_complex);
|
||||
PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex);
|
||||
PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
|
||||
PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex);
|
||||
PyAPI_FUNC(double) c_abs(Py_complex);
|
||||
|
||||
|
||||
/* Complex object interface */
|
||||
|
||||
/*
|
||||
PyComplexObject represents a complex number with double-precision
|
||||
real and imaginary parts.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
Py_complex cval;
|
||||
} PyComplexObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyComplex_Type;
|
||||
|
||||
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
|
||||
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
||||
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
|
||||
|
||||
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
|
||||
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
|
||||
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
|
||||
|
||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||
(Advanced String Formatting). */
|
||||
PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
|
||||
char *format_spec,
|
||||
Py_ssize_t format_spec_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_COMPLEXOBJECT_H */
|
||||
@@ -1,239 +0,0 @@
|
||||
/* datetime.h
|
||||
*/
|
||||
|
||||
#ifndef DATETIME_H
|
||||
#define DATETIME_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Fields are packed into successive bytes, each viewed as unsigned and
|
||||
* big-endian, unless otherwise noted:
|
||||
*
|
||||
* byte offset
|
||||
* 0 year 2 bytes, 1-9999
|
||||
* 2 month 1 byte, 1-12
|
||||
* 3 day 1 byte, 1-31
|
||||
* 4 hour 1 byte, 0-23
|
||||
* 5 minute 1 byte, 0-59
|
||||
* 6 second 1 byte, 0-59
|
||||
* 7 usecond 3 bytes, 0-999999
|
||||
* 10
|
||||
*/
|
||||
|
||||
/* # of bytes for year, month, and day. */
|
||||
#define _PyDateTime_DATE_DATASIZE 4
|
||||
|
||||
/* # of bytes for hour, minute, second, and usecond. */
|
||||
#define _PyDateTime_TIME_DATASIZE 6
|
||||
|
||||
/* # of bytes for year, month, day, hour, minute, second, and usecond. */
|
||||
#define _PyDateTime_DATETIME_DATASIZE 10
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
long hashcode; /* -1 when unknown */
|
||||
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
|
||||
int seconds; /* 0 <= seconds < 24*3600 is invariant */
|
||||
int microseconds; /* 0 <= microseconds < 1000000 is invariant */
|
||||
} PyDateTime_Delta;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD /* a pure abstract base clase */
|
||||
} PyDateTime_TZInfo;
|
||||
|
||||
|
||||
/* The datetime and time types have hashcodes, and an optional tzinfo member,
|
||||
* present if and only if hastzinfo is true.
|
||||
*/
|
||||
#define _PyTZINFO_HEAD \
|
||||
PyObject_HEAD \
|
||||
long hashcode; \
|
||||
char hastzinfo; /* boolean flag */
|
||||
|
||||
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
|
||||
* convenient to cast to, when getting at the hastzinfo member of objects
|
||||
* starting with _PyTZINFO_HEAD.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
_PyTZINFO_HEAD
|
||||
} _PyDateTime_BaseTZInfo;
|
||||
|
||||
/* All time objects are of PyDateTime_TimeType, but that can be allocated
|
||||
* in two ways, with or without a tzinfo member. Without is the same as
|
||||
* tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an
|
||||
* internal struct used to allocate the right amount of space for the
|
||||
* "without" case.
|
||||
*/
|
||||
#define _PyDateTime_TIMEHEAD \
|
||||
_PyTZINFO_HEAD \
|
||||
unsigned char data[_PyDateTime_TIME_DATASIZE];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
_PyDateTime_TIMEHEAD
|
||||
} _PyDateTime_BaseTime; /* hastzinfo false */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
_PyDateTime_TIMEHEAD
|
||||
PyObject *tzinfo;
|
||||
} PyDateTime_Time; /* hastzinfo true */
|
||||
|
||||
|
||||
/* All datetime objects are of PyDateTime_DateTimeType, but that can be
|
||||
* allocated in two ways too, just like for time objects above. In addition,
|
||||
* the plain date type is a base class for datetime, so it must also have
|
||||
* a hastzinfo member (although it's unused there).
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
_PyTZINFO_HEAD
|
||||
unsigned char data[_PyDateTime_DATE_DATASIZE];
|
||||
} PyDateTime_Date;
|
||||
|
||||
#define _PyDateTime_DATETIMEHEAD \
|
||||
_PyTZINFO_HEAD \
|
||||
unsigned char data[_PyDateTime_DATETIME_DATASIZE];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
_PyDateTime_DATETIMEHEAD
|
||||
} _PyDateTime_BaseDateTime; /* hastzinfo false */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
_PyDateTime_DATETIMEHEAD
|
||||
PyObject *tzinfo;
|
||||
} PyDateTime_DateTime; /* hastzinfo true */
|
||||
|
||||
|
||||
/* Apply for date and datetime instances. */
|
||||
#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
|
||||
((PyDateTime_Date*)o)->data[1])
|
||||
#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2])
|
||||
#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3])
|
||||
|
||||
#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4])
|
||||
#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5])
|
||||
#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6])
|
||||
#define PyDateTime_DATE_GET_MICROSECOND(o) \
|
||||
((((PyDateTime_DateTime*)o)->data[7] << 16) | \
|
||||
(((PyDateTime_DateTime*)o)->data[8] << 8) | \
|
||||
((PyDateTime_DateTime*)o)->data[9])
|
||||
|
||||
/* Apply for time instances. */
|
||||
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
|
||||
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
|
||||
#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
|
||||
#define PyDateTime_TIME_GET_MICROSECOND(o) \
|
||||
((((PyDateTime_Time*)o)->data[3] << 16) | \
|
||||
(((PyDateTime_Time*)o)->data[4] << 8) | \
|
||||
((PyDateTime_Time*)o)->data[5])
|
||||
|
||||
|
||||
/* Define structure for C API. */
|
||||
typedef struct {
|
||||
/* type objects */
|
||||
PyTypeObject *DateType;
|
||||
PyTypeObject *DateTimeType;
|
||||
PyTypeObject *TimeType;
|
||||
PyTypeObject *DeltaType;
|
||||
PyTypeObject *TZInfoType;
|
||||
|
||||
/* constructors */
|
||||
PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
|
||||
PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
|
||||
PyObject*, PyTypeObject*);
|
||||
PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
|
||||
PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
|
||||
|
||||
/* constructors for the DB API */
|
||||
PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*);
|
||||
PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*);
|
||||
|
||||
} PyDateTime_CAPI;
|
||||
|
||||
#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
|
||||
|
||||
|
||||
/* "magic" constant used to partially protect against developer mistakes. */
|
||||
#define DATETIME_API_MAGIC 0x414548d5
|
||||
|
||||
#ifdef Py_BUILD_CORE
|
||||
|
||||
/* Macros for type checking when building the Python core. */
|
||||
#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType)
|
||||
#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType)
|
||||
|
||||
#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
|
||||
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType)
|
||||
|
||||
#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
|
||||
#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType)
|
||||
|
||||
#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
|
||||
#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType)
|
||||
|
||||
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType)
|
||||
|
||||
#else
|
||||
|
||||
/* Define global variable for the C API and a macro for setting it. */
|
||||
static PyDateTime_CAPI *PyDateTimeAPI = NULL;
|
||||
|
||||
#define PyDateTime_IMPORT \
|
||||
PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
|
||||
|
||||
/* Macros for type checking when not building the Python core. */
|
||||
#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
|
||||
#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType)
|
||||
|
||||
#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
|
||||
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType)
|
||||
|
||||
#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
|
||||
#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType)
|
||||
|
||||
#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
|
||||
#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType)
|
||||
|
||||
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType)
|
||||
|
||||
/* Macros for accessing constructors in a simplified fashion. */
|
||||
#define PyDate_FromDate(year, month, day) \
|
||||
PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
|
||||
|
||||
#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
|
||||
PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
|
||||
min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
|
||||
|
||||
#define PyTime_FromTime(hour, minute, second, usecond) \
|
||||
PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
|
||||
Py_None, PyDateTimeAPI->TimeType)
|
||||
|
||||
#define PyDelta_FromDSU(days, seconds, useconds) \
|
||||
PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
|
||||
PyDateTimeAPI->DeltaType)
|
||||
|
||||
/* Macros supporting the DB API. */
|
||||
#define PyDateTime_FromTimestamp(args) \
|
||||
PyDateTimeAPI->DateTime_FromTimestamp( \
|
||||
(PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
|
||||
|
||||
#define PyDate_FromTimestamp(args) \
|
||||
PyDateTimeAPI->Date_FromTimestamp( \
|
||||
(PyObject*) (PyDateTimeAPI->DateType), args)
|
||||
|
||||
#endif /* Py_BUILD_CORE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,94 +0,0 @@
|
||||
/* Descriptors */
|
||||
#ifndef Py_DESCROBJECT_H
|
||||
#define Py_DESCROBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef PyObject *(*getter)(PyObject *, void *);
|
||||
typedef int (*setter)(PyObject *, PyObject *, void *);
|
||||
|
||||
typedef struct PyGetSetDef {
|
||||
char *name;
|
||||
getter get;
|
||||
setter set;
|
||||
char *doc;
|
||||
void *closure;
|
||||
} PyGetSetDef;
|
||||
|
||||
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
|
||||
void *wrapped);
|
||||
|
||||
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
|
||||
void *wrapped, PyObject *kwds);
|
||||
|
||||
struct wrapperbase {
|
||||
char *name;
|
||||
int offset;
|
||||
void *function;
|
||||
wrapperfunc wrapper;
|
||||
char *doc;
|
||||
int flags;
|
||||
PyObject *name_strobj;
|
||||
};
|
||||
|
||||
/* Flags for above struct */
|
||||
#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
|
||||
|
||||
/* Various kinds of descriptor objects */
|
||||
|
||||
#define PyDescr_COMMON \
|
||||
PyObject_HEAD \
|
||||
PyTypeObject *d_type; \
|
||||
PyObject *d_name
|
||||
|
||||
typedef struct {
|
||||
PyDescr_COMMON;
|
||||
} PyDescrObject;
|
||||
|
||||
typedef struct {
|
||||
PyDescr_COMMON;
|
||||
PyMethodDef *d_method;
|
||||
} PyMethodDescrObject;
|
||||
|
||||
typedef struct {
|
||||
PyDescr_COMMON;
|
||||
struct PyMemberDef *d_member;
|
||||
} PyMemberDescrObject;
|
||||
|
||||
typedef struct {
|
||||
PyDescr_COMMON;
|
||||
PyGetSetDef *d_getset;
|
||||
} PyGetSetDescrObject;
|
||||
|
||||
typedef struct {
|
||||
PyDescr_COMMON;
|
||||
struct wrapperbase *d_base;
|
||||
void *d_wrapped; /* This can be any function pointer */
|
||||
} PyWrapperDescrObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
|
||||
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
|
||||
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
|
||||
struct PyMemberDef *);
|
||||
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
||||
struct PyGetSetDef *);
|
||||
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
||||
struct wrapperbase *, void *);
|
||||
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
|
||||
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyProperty_Type;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_DESCROBJECT_H */
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
#ifndef Py_DICTOBJECT_H
|
||||
#define Py_DICTOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Dictionary object type -- mapping from hashable object to object */
|
||||
|
||||
/* The distribution includes a separate file, Objects/dictnotes.txt,
|
||||
describing explorations into dictionary design and optimization.
|
||||
It covers typical dictionary use patterns, the parameters for
|
||||
tuning dictionaries, and several ideas for possible optimizations.
|
||||
*/
|
||||
|
||||
/*
|
||||
There are three kinds of slots in the table:
|
||||
|
||||
1. Unused. me_key == me_value == NULL
|
||||
Does not hold an active (key, value) pair now and never did. Unused can
|
||||
transition to Active upon key insertion. This is the only case in which
|
||||
me_key is NULL, and is each slot's initial state.
|
||||
|
||||
2. Active. me_key != NULL and me_key != dummy and me_value != NULL
|
||||
Holds an active (key, value) pair. Active can transition to Dummy upon
|
||||
key deletion. This is the only case in which me_value != NULL.
|
||||
|
||||
3. Dummy. me_key == dummy and me_value == NULL
|
||||
Previously held an active (key, value) pair, but that was deleted and an
|
||||
active pair has not yet overwritten the slot. Dummy can transition to
|
||||
Active upon key insertion. Dummy slots cannot be made Unused again
|
||||
(cannot have me_key set to NULL), else the probe sequence in case of
|
||||
collision would have no way to know they were once active.
|
||||
|
||||
Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to
|
||||
hold a search finger. The me_hash field of Unused or Dummy slots has no
|
||||
meaning otherwise.
|
||||
*/
|
||||
|
||||
/* PyDict_MINSIZE is the minimum size of a dictionary. This many slots are
|
||||
* allocated directly in the dict object (in the ma_smalltable member).
|
||||
* It must be a power of 2, and at least 4. 8 allows dicts with no more
|
||||
* than 5 active entries to live in ma_smalltable (and so avoid an
|
||||
* additional malloc); instrumentation suggested this suffices for the
|
||||
* majority of dicts (consisting mostly of usually-small instance dicts and
|
||||
* usually-small dicts created to pass keyword arguments).
|
||||
*/
|
||||
#define PyDict_MINSIZE 8
|
||||
|
||||
typedef struct {
|
||||
/* Cached hash code of me_key. Note that hash codes are C longs.
|
||||
* We have to use Py_ssize_t instead because dict_popitem() abuses
|
||||
* me_hash to hold a search finger.
|
||||
*/
|
||||
Py_ssize_t me_hash;
|
||||
PyObject *me_key;
|
||||
PyObject *me_value;
|
||||
} PyDictEntry;
|
||||
|
||||
/*
|
||||
To ensure the lookup algorithm terminates, there must be at least one Unused
|
||||
slot (NULL key) in the table.
|
||||
The value ma_fill is the number of non-NULL keys (sum of Active and Dummy);
|
||||
ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL
|
||||
values == the number of Active items).
|
||||
To avoid slowing down lookups on a near-full table, we resize the table when
|
||||
it's two-thirds full.
|
||||
*/
|
||||
typedef struct _dictobject PyDictObject;
|
||||
struct _dictobject {
|
||||
PyObject_HEAD
|
||||
Py_ssize_t ma_fill; /* # Active + # Dummy */
|
||||
Py_ssize_t ma_used; /* # Active */
|
||||
|
||||
/* The table contains ma_mask + 1 slots, and that's a power of 2.
|
||||
* We store the mask instead of the size because the mask is more
|
||||
* frequently needed.
|
||||
*/
|
||||
Py_ssize_t ma_mask;
|
||||
|
||||
/* ma_table points to ma_smalltable for small tables, else to
|
||||
* additional malloc'ed memory. ma_table is never NULL! This rule
|
||||
* saves repeated runtime null-tests in the workhorse getitem and
|
||||
* setitem calls.
|
||||
*/
|
||||
PyDictEntry *ma_table;
|
||||
PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
|
||||
PyDictEntry ma_smalltable[PyDict_MINSIZE];
|
||||
};
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyDict_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictItems_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
|
||||
|
||||
#define PyDict_Check(op) \
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
|
||||
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
|
||||
#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type)
|
||||
#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type)
|
||||
#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
|
||||
/* This excludes Values, since they are not sets. */
|
||||
# define PyDictViewSet_Check(op) \
|
||||
(PyDictKeys_Check(op) || PyDictItems_Check(op))
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyDict_New(void);
|
||||
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
|
||||
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
|
||||
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
|
||||
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
|
||||
PyAPI_FUNC(int) PyDict_Next(
|
||||
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
|
||||
PyAPI_FUNC(int) _PyDict_Next(
|
||||
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
|
||||
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
|
||||
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
|
||||
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
|
||||
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
|
||||
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
|
||||
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
|
||||
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash);
|
||||
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
||||
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
||||
|
||||
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
|
||||
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
|
||||
|
||||
/* PyDict_Merge updates/merges from a mapping object (an object that
|
||||
supports PyMapping_Keys() and PyObject_GetItem()). If override is true,
|
||||
the last occurrence of a key wins, else the first. The Python
|
||||
dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
|
||||
*/
|
||||
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
|
||||
PyObject *other,
|
||||
int override);
|
||||
|
||||
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
|
||||
iterable objects of length 2. If override is true, the last occurrence
|
||||
of a key wins, else the first. The Python dict constructor dict(seq2)
|
||||
is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
|
||||
*/
|
||||
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
|
||||
PyObject *seq2,
|
||||
int override);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
|
||||
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
|
||||
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_DICTOBJECT_H */
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef PY_NO_SHORT_FLOAT_REPR
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
|
||||
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
|
||||
int *decpt, int *sign, char **rve);
|
||||
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef Py_ENUMOBJECT_H
|
||||
#define Py_ENUMOBJECT_H
|
||||
|
||||
/* Enumerate Object */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyEnum_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyReversed_Type;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !Py_ENUMOBJECT_H */
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef Py_ERRCODE_H
|
||||
#define Py_ERRCODE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Error codes passed around between file input, tokenizer, parser and
|
||||
interpreter. This is necessary so we can turn them into Python
|
||||
exceptions at a higher level. Note that some errors have a
|
||||
slightly different meaning when passed from the tokenizer to the
|
||||
parser than when passed from the parser to the interpreter; e.g.
|
||||
the parser only returns E_EOF when it hits EOF immediately, and it
|
||||
never returns E_OK. */
|
||||
|
||||
#define E_OK 10 /* No error */
|
||||
#define E_EOF 11 /* End Of File */
|
||||
#define E_INTR 12 /* Interrupted */
|
||||
#define E_TOKEN 13 /* Bad token */
|
||||
#define E_SYNTAX 14 /* Syntax error */
|
||||
#define E_NOMEM 15 /* Ran out of memory */
|
||||
#define E_DONE 16 /* Parsing complete */
|
||||
#define E_ERROR 17 /* Execution error */
|
||||
#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */
|
||||
#define E_OVERFLOW 19 /* Node had too many children */
|
||||
#define E_TOODEEP 20 /* Too many indentation levels */
|
||||
#define E_DEDENT 21 /* No matching outer block for dedent */
|
||||
#define E_DECODE 22 /* Error in decoding into Unicode */
|
||||
#define E_EOFS 23 /* EOF in triple-quoted string */
|
||||
#define E_EOLS 24 /* EOL in single-quoted string */
|
||||
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_ERRCODE_H */
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
/* Interface to execute compiled code */
|
||||
|
||||
#ifndef Py_EVAL_H
|
||||
#define Py_EVAL_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co,
|
||||
PyObject *globals,
|
||||
PyObject *locals,
|
||||
PyObject **args, int argc,
|
||||
PyObject **kwds, int kwdc,
|
||||
PyObject **defs, int defc,
|
||||
PyObject *closure);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_EVAL_H */
|
||||
@@ -1,97 +0,0 @@
|
||||
|
||||
/* File object interface */
|
||||
|
||||
#ifndef Py_FILEOBJECT_H
|
||||
#define Py_FILEOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
FILE *f_fp;
|
||||
PyObject *f_name;
|
||||
PyObject *f_mode;
|
||||
int (*f_close)(FILE *);
|
||||
int f_softspace; /* Flag used by 'print' command */
|
||||
int f_binary; /* Flag which indicates whether the file is
|
||||
open in binary (1) or text (0) mode */
|
||||
char* f_buf; /* Allocated readahead buffer */
|
||||
char* f_bufend; /* Points after last occupied position */
|
||||
char* f_bufptr; /* Current buffer position */
|
||||
char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */
|
||||
int f_univ_newline; /* Handle any newline convention */
|
||||
int f_newlinetypes; /* Types of newlines seen */
|
||||
int f_skipnextlf; /* Skip next \n */
|
||||
PyObject *f_encoding;
|
||||
PyObject *f_errors;
|
||||
PyObject *weakreflist; /* List of weak references */
|
||||
int unlocked_count; /* Num. currently running sections of code
|
||||
using f_fp with the GIL released. */
|
||||
int readable;
|
||||
int writable;
|
||||
} PyFileObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyFile_Type;
|
||||
|
||||
#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)
|
||||
#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);
|
||||
PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);
|
||||
PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);
|
||||
PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors);
|
||||
PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,
|
||||
int (*)(FILE *));
|
||||
PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);
|
||||
PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *);
|
||||
PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
||||
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
||||
PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);
|
||||
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
||||
|
||||
/* The default encoding used by the platform file system APIs
|
||||
If non-NULL, this is different than the default encoding for strings
|
||||
*/
|
||||
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
||||
|
||||
/* Routines to replace fread() and fgets() which accept any of \r, \n
|
||||
or \r\n as line terminators.
|
||||
*/
|
||||
#define PY_STDIOTEXTMODE "b"
|
||||
char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
|
||||
size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
|
||||
|
||||
/* A routine to do sanity checking on the file mode string. returns
|
||||
non-zero on if an exception occurred
|
||||
*/
|
||||
int _PyFile_SanitizeMode(char *mode);
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1400
|
||||
/* A routine to check if a file descriptor is valid on Windows. Returns 0
|
||||
* and sets errno to EBADF if it isn't. This is to avoid Assertions
|
||||
* from various functions in the Windows CRT beginning with
|
||||
* Visual Studio 2005
|
||||
*/
|
||||
int _PyVerify_fd(int fd);
|
||||
#elif defined _MSC_VER && _MSC_VER >= 1200
|
||||
/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */
|
||||
#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)
|
||||
#else
|
||||
#define _PyVerify_fd(A) (1) /* dummy */
|
||||
#endif
|
||||
|
||||
/* A routine to check if a file descriptor can be select()-ed. */
|
||||
#ifdef HAVE_SELECT
|
||||
#define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
|
||||
#else
|
||||
#define _PyIsSelectable_fd(FD) (1)
|
||||
#endif /* HAVE_SELECT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_FILEOBJECT_H */
|
||||
@@ -1,140 +0,0 @@
|
||||
|
||||
/* Float object interface */
|
||||
|
||||
/*
|
||||
PyFloatObject represents a (double precision) floating point number.
|
||||
*/
|
||||
|
||||
#ifndef Py_FLOATOBJECT_H
|
||||
#define Py_FLOATOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
double ob_fval;
|
||||
} PyFloatObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
||||
|
||||
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
||||
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
|
||||
|
||||
/* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases,
|
||||
the rounding noise created by various operations is suppressed, while
|
||||
giving plenty of precision for practical use. */
|
||||
|
||||
#define PyFloat_STR_PRECISION 12
|
||||
|
||||
#ifdef Py_NAN
|
||||
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
||||
#endif
|
||||
|
||||
#define Py_RETURN_INF(sign) do \
|
||||
if (copysign(1., sign) == 1.) { \
|
||||
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
||||
} else { \
|
||||
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
||||
} while(0)
|
||||
|
||||
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
||||
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
||||
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
|
||||
|
||||
/* Return Python float from string PyObject. Second argument ignored on
|
||||
input, and, if non-NULL, NULL is stored into *junk (this tried to serve a
|
||||
purpose once but can't be made to work as intended). */
|
||||
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk);
|
||||
|
||||
/* Return Python float from C double. */
|
||||
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
|
||||
|
||||
/* Extract C double from Python float. The macro version trades safety for
|
||||
speed. */
|
||||
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
|
||||
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
|
||||
|
||||
/* Write repr(v) into the char buffer argument, followed by null byte. The
|
||||
buffer must be "big enough"; >= 100 is very safe.
|
||||
PyFloat_AsReprString(buf, x) strives to print enough digits so that
|
||||
PyFloat_FromString(buf) then reproduces x exactly. */
|
||||
PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v);
|
||||
|
||||
/* Write str(v) into the char buffer argument, followed by null byte. The
|
||||
buffer must be "big enough"; >= 100 is very safe. Note that it's
|
||||
unusual to be able to get back the float you started with from
|
||||
PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to
|
||||
preserve precision across conversions. */
|
||||
PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v);
|
||||
|
||||
/* _PyFloat_{Pack,Unpack}{4,8}
|
||||
*
|
||||
* The struct and pickle (at least) modules need an efficient platform-
|
||||
* independent way to store floating-point values as byte strings.
|
||||
* The Pack routines produce a string from a C double, and the Unpack
|
||||
* routines produce a C double from such a string. The suffix (4 or 8)
|
||||
* specifies the number of bytes in the string.
|
||||
*
|
||||
* On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
|
||||
* these functions work by copying bits. On other platforms, the formats the
|
||||
* 4- byte format is identical to the IEEE-754 single precision format, and
|
||||
* the 8-byte format to the IEEE-754 double precision format, although the
|
||||
* packing of INFs and NaNs (if such things exist on the platform) isn't
|
||||
* handled correctly, and attempting to unpack a string containing an IEEE
|
||||
* INF or NaN will raise an exception.
|
||||
*
|
||||
* On non-IEEE platforms with more precision, or larger dynamic range, than
|
||||
* 754 supports, not all values can be packed; on non-IEEE platforms with less
|
||||
* precision, or smaller dynamic range, not all values can be unpacked. What
|
||||
* happens in such cases is partly accidental (alas).
|
||||
*/
|
||||
|
||||
/* The pack routines write 4 or 8 bytes, starting at p. le is a bool
|
||||
* argument, true if you want the string in little-endian format (exponent
|
||||
* last, at p+3 or p+7), false if you want big-endian format (exponent
|
||||
* first, at p).
|
||||
* Return value: 0 if all is OK, -1 if error (and an exception is
|
||||
* set, most likely OverflowError).
|
||||
* There are two problems on non-IEEE platforms:
|
||||
* 1): What this does is undefined if x is a NaN or infinity.
|
||||
* 2): -0.0 and +0.0 produce the same string.
|
||||
*/
|
||||
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
|
||||
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
||||
|
||||
/* Used to get the important decimal digits of a double */
|
||||
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
|
||||
PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
|
||||
|
||||
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
|
||||
* argument, true if the string is in little-endian format (exponent
|
||||
* last, at p+3 or p+7), false if big-endian (exponent first, at p).
|
||||
* Return value: The unpacked double. On error, this is -1.0 and
|
||||
* PyErr_Occurred() is true (and an exception is set, most likely
|
||||
* OverflowError). Note that on a non-IEEE platform this will refuse
|
||||
* to unpack a string that represents a NaN or infinity.
|
||||
*/
|
||||
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
|
||||
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
|
||||
|
||||
/* free list api */
|
||||
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
|
||||
|
||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||
(Advanced String Formatting). */
|
||||
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
|
||||
char *format_spec,
|
||||
Py_ssize_t format_spec_len);
|
||||
|
||||
/* Round a C double x to the closest multiple of 10**-ndigits. Returns a
|
||||
Python float on success, or NULL (with an appropriate exception set) on
|
||||
failure. Used in builtin_round in bltinmodule.c. */
|
||||
PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_FLOATOBJECT_H */
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
/* Frame object interface */
|
||||
|
||||
#ifndef Py_FRAMEOBJECT_H
|
||||
#define Py_FRAMEOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int b_type; /* what kind of block this is */
|
||||
int b_handler; /* where to jump to find handler */
|
||||
int b_level; /* value stack level to pop to */
|
||||
} PyTryBlock;
|
||||
|
||||
typedef struct _frame {
|
||||
PyObject_VAR_HEAD
|
||||
struct _frame *f_back; /* previous frame, or NULL */
|
||||
PyCodeObject *f_code; /* code segment */
|
||||
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
|
||||
PyObject *f_globals; /* global symbol table (PyDictObject) */
|
||||
PyObject *f_locals; /* local symbol table (any mapping) */
|
||||
PyObject **f_valuestack; /* points after the last local */
|
||||
/* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
|
||||
Frame evaluation usually NULLs it, but a frame that yields sets it
|
||||
to the current stack top. */
|
||||
PyObject **f_stacktop;
|
||||
PyObject *f_trace; /* Trace function */
|
||||
|
||||
/* If an exception is raised in this frame, the next three are used to
|
||||
* record the exception info (if any) originally in the thread state. See
|
||||
* comments before set_exc_info() -- it's not obvious.
|
||||
* Invariant: if _type is NULL, then so are _value and _traceback.
|
||||
* Desired invariant: all three are NULL, or all three are non-NULL. That
|
||||
* one isn't currently true, but "should be".
|
||||
*/
|
||||
PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
|
||||
|
||||
PyThreadState *f_tstate;
|
||||
int f_lasti; /* Last instruction if called */
|
||||
/* Call PyFrame_GetLineNumber() instead of reading this field
|
||||
directly. As of 2.3 f_lineno is only valid when tracing is
|
||||
active (i.e. when f_trace is set). At other times we use
|
||||
PyCode_Addr2Line to calculate the line from the current
|
||||
bytecode index. */
|
||||
int f_lineno; /* Current line number */
|
||||
int f_iblock; /* index in f_blockstack */
|
||||
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
||||
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
||||
} PyFrameObject;
|
||||
|
||||
|
||||
/* Standard object interface */
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
||||
|
||||
#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
|
||||
#define PyFrame_IsRestricted(f) \
|
||||
((f)->f_builtins != (f)->f_tstate->interp->builtins)
|
||||
|
||||
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
||||
PyObject *, PyObject *);
|
||||
|
||||
|
||||
/* The rest of the interface is specific for frame objects */
|
||||
|
||||
/* Block management functions */
|
||||
|
||||
PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
|
||||
PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
|
||||
|
||||
/* Extend the value stack */
|
||||
|
||||
PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);
|
||||
|
||||
/* Conversions between "fast locals" and locals in dictionary */
|
||||
|
||||
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
|
||||
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
||||
|
||||
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
|
||||
|
||||
/* Return the line of code the frame is currently executing. */
|
||||
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_FRAMEOBJECT_H */
|
||||
@@ -1,76 +0,0 @@
|
||||
|
||||
/* Function object interface */
|
||||
|
||||
#ifndef Py_FUNCOBJECT_H
|
||||
#define Py_FUNCOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Function objects and code objects should not be confused with each other:
|
||||
*
|
||||
* Function objects are created by the execution of the 'def' statement.
|
||||
* They reference a code object in their func_code attribute, which is a
|
||||
* purely syntactic object, i.e. nothing more than a compiled version of some
|
||||
* source code lines. There is one code object per source code "fragment",
|
||||
* but each code object can be referenced by zero or many function objects
|
||||
* depending only on how many times the 'def' statement in the source was
|
||||
* executed so far.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *func_code; /* A code object */
|
||||
PyObject *func_globals; /* A dictionary (other mappings won't do) */
|
||||
PyObject *func_defaults; /* NULL or a tuple */
|
||||
PyObject *func_closure; /* NULL or a tuple of cell objects */
|
||||
PyObject *func_doc; /* The __doc__ attribute, can be anything */
|
||||
PyObject *func_name; /* The __name__ attribute, a string object */
|
||||
PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */
|
||||
PyObject *func_weakreflist; /* List of weak references */
|
||||
PyObject *func_module; /* The __module__ attribute, can be anything */
|
||||
|
||||
/* Invariant:
|
||||
* func_closure contains the bindings for func_code->co_freevars, so
|
||||
* PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code)
|
||||
* (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0).
|
||||
*/
|
||||
} PyFunctionObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyFunction_Type;
|
||||
|
||||
#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);
|
||||
PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);
|
||||
PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
|
||||
|
||||
/* Macros for direct access to these values. Type checks are *not*
|
||||
done, so use with care. */
|
||||
#define PyFunction_GET_CODE(func) \
|
||||
(((PyFunctionObject *)func) -> func_code)
|
||||
#define PyFunction_GET_GLOBALS(func) \
|
||||
(((PyFunctionObject *)func) -> func_globals)
|
||||
#define PyFunction_GET_MODULE(func) \
|
||||
(((PyFunctionObject *)func) -> func_module)
|
||||
#define PyFunction_GET_DEFAULTS(func) \
|
||||
(((PyFunctionObject *)func) -> func_defaults)
|
||||
#define PyFunction_GET_CLOSURE(func) \
|
||||
(((PyFunctionObject *)func) -> func_closure)
|
||||
|
||||
/* The classmethod and staticmethod types lives here, too */
|
||||
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyStaticMethod_Type;
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_FUNCOBJECT_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
/* Generator object interface */
|
||||
|
||||
#ifndef Py_GENOBJECT_H
|
||||
#define Py_GENOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _frame; /* Avoid including frameobject.h */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
/* The gi_ prefix is intended to remind of generator-iterator. */
|
||||
|
||||
/* Note: gi_frame can be NULL if the generator is "finished" */
|
||||
struct _frame *gi_frame;
|
||||
|
||||
/* True if generator is being executed. */
|
||||
int gi_running;
|
||||
|
||||
/* The code object backing the generator */
|
||||
PyObject *gi_code;
|
||||
|
||||
/* List of weak reference. */
|
||||
PyObject *gi_weakreflist;
|
||||
} PyGenObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
||||
|
||||
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
||||
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
|
||||
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_GENOBJECT_H */
|
||||
@@ -1,87 +0,0 @@
|
||||
/* Generated by Parser/pgen */
|
||||
|
||||
#define single_input 256
|
||||
#define file_input 257
|
||||
#define eval_input 258
|
||||
#define decorator 259
|
||||
#define decorators 260
|
||||
#define decorated 261
|
||||
#define funcdef 262
|
||||
#define parameters 263
|
||||
#define varargslist 264
|
||||
#define fpdef 265
|
||||
#define fplist 266
|
||||
#define stmt 267
|
||||
#define simple_stmt 268
|
||||
#define small_stmt 269
|
||||
#define expr_stmt 270
|
||||
#define augassign 271
|
||||
#define print_stmt 272
|
||||
#define del_stmt 273
|
||||
#define pass_stmt 274
|
||||
#define flow_stmt 275
|
||||
#define break_stmt 276
|
||||
#define continue_stmt 277
|
||||
#define return_stmt 278
|
||||
#define yield_stmt 279
|
||||
#define raise_stmt 280
|
||||
#define import_stmt 281
|
||||
#define import_name 282
|
||||
#define import_from 283
|
||||
#define import_as_name 284
|
||||
#define dotted_as_name 285
|
||||
#define import_as_names 286
|
||||
#define dotted_as_names 287
|
||||
#define dotted_name 288
|
||||
#define global_stmt 289
|
||||
#define exec_stmt 290
|
||||
#define assert_stmt 291
|
||||
#define compound_stmt 292
|
||||
#define if_stmt 293
|
||||
#define while_stmt 294
|
||||
#define for_stmt 295
|
||||
#define try_stmt 296
|
||||
#define with_stmt 297
|
||||
#define with_item 298
|
||||
#define except_clause 299
|
||||
#define suite 300
|
||||
#define testlist_safe 301
|
||||
#define old_test 302
|
||||
#define old_lambdef 303
|
||||
#define test 304
|
||||
#define or_test 305
|
||||
#define and_test 306
|
||||
#define not_test 307
|
||||
#define comparison 308
|
||||
#define comp_op 309
|
||||
#define expr 310
|
||||
#define xor_expr 311
|
||||
#define and_expr 312
|
||||
#define shift_expr 313
|
||||
#define arith_expr 314
|
||||
#define term 315
|
||||
#define factor 316
|
||||
#define power 317
|
||||
#define atom 318
|
||||
#define listmaker 319
|
||||
#define testlist_comp 320
|
||||
#define lambdef 321
|
||||
#define trailer 322
|
||||
#define subscriptlist 323
|
||||
#define subscript 324
|
||||
#define sliceop 325
|
||||
#define exprlist 326
|
||||
#define testlist 327
|
||||
#define dictorsetmaker 328
|
||||
#define classdef 329
|
||||
#define arglist 330
|
||||
#define argument 331
|
||||
#define list_iter 332
|
||||
#define list_for 333
|
||||
#define list_if 334
|
||||
#define comp_iter 335
|
||||
#define comp_for 336
|
||||
#define comp_if 337
|
||||
#define testlist1 338
|
||||
#define encoding_decl 339
|
||||
#define yield_expr 340
|
||||
@@ -1,93 +0,0 @@
|
||||
|
||||
/* Grammar interface */
|
||||
|
||||
#ifndef Py_GRAMMAR_H
|
||||
#define Py_GRAMMAR_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "bitset.h" /* Sigh... */
|
||||
|
||||
/* A label of an arc */
|
||||
|
||||
typedef struct {
|
||||
int lb_type;
|
||||
char *lb_str;
|
||||
} label;
|
||||
|
||||
#define EMPTY 0 /* Label number 0 is by definition the empty label */
|
||||
|
||||
/* A list of labels */
|
||||
|
||||
typedef struct {
|
||||
int ll_nlabels;
|
||||
label *ll_label;
|
||||
} labellist;
|
||||
|
||||
/* An arc from one state to another */
|
||||
|
||||
typedef struct {
|
||||
short a_lbl; /* Label of this arc */
|
||||
short a_arrow; /* State where this arc goes to */
|
||||
} arc;
|
||||
|
||||
/* A state in a DFA */
|
||||
|
||||
typedef struct {
|
||||
int s_narcs;
|
||||
arc *s_arc; /* Array of arcs */
|
||||
|
||||
/* Optional accelerators */
|
||||
int s_lower; /* Lowest label index */
|
||||
int s_upper; /* Highest label index */
|
||||
int *s_accel; /* Accelerator */
|
||||
int s_accept; /* Nonzero for accepting state */
|
||||
} state;
|
||||
|
||||
/* A DFA */
|
||||
|
||||
typedef struct {
|
||||
int d_type; /* Non-terminal this represents */
|
||||
char *d_name; /* For printing */
|
||||
int d_initial; /* Initial state */
|
||||
int d_nstates;
|
||||
state *d_state; /* Array of states */
|
||||
bitset d_first;
|
||||
} dfa;
|
||||
|
||||
/* A grammar */
|
||||
|
||||
typedef struct {
|
||||
int g_ndfas;
|
||||
dfa *g_dfa; /* Array of DFAs */
|
||||
labellist g_ll;
|
||||
int g_start; /* Start symbol of the grammar */
|
||||
int g_accel; /* Set if accelerators present */
|
||||
} grammar;
|
||||
|
||||
/* FUNCTIONS */
|
||||
|
||||
grammar *newgrammar(int start);
|
||||
dfa *adddfa(grammar *g, int type, char *name);
|
||||
int addstate(dfa *d);
|
||||
void addarc(dfa *d, int from, int to, int lbl);
|
||||
dfa *PyGrammar_FindDFA(grammar *g, int type);
|
||||
|
||||
int addlabel(labellist *ll, int type, char *str);
|
||||
int findlabel(labellist *ll, int type, char *str);
|
||||
char *PyGrammar_LabelRepr(label *lb);
|
||||
void translatelabels(grammar *g);
|
||||
|
||||
void addfirstsets(grammar *g);
|
||||
|
||||
void PyGrammar_AddAccelerators(grammar *g);
|
||||
void PyGrammar_RemoveAccelerators(grammar *);
|
||||
|
||||
void printgrammar(grammar *g, FILE *fp);
|
||||
void printnonterminals(grammar *g, FILE *fp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_GRAMMAR_H */
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
/* Module definition and import interface */
|
||||
|
||||
#ifndef Py_IMPORT_H
|
||||
#define Py_IMPORT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
|
||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
||||
char *name, PyObject *co, char *pathname);
|
||||
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
||||
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
|
||||
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
|
||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *);
|
||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
|
||||
PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
|
||||
|
||||
#define PyImport_ImportModuleEx(n, g, l, f) \
|
||||
PyImport_ImportModuleLevel(n, g, l, f, -1)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
|
||||
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
||||
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
|
||||
PyAPI_FUNC(void) PyImport_Cleanup(void);
|
||||
PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
|
||||
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
|
||||
#else
|
||||
#define _PyImport_AcquireLock()
|
||||
#define _PyImport_ReleaseLock() 1
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
|
||||
const char *, PyObject *, char *, size_t, FILE **, PyObject **);
|
||||
PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
|
||||
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
|
||||
|
||||
PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
|
||||
PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
|
||||
|
||||
struct _inittab {
|
||||
char *name;
|
||||
void (*initfunc)(void);
|
||||
};
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
|
||||
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
||||
|
||||
PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void));
|
||||
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
|
||||
|
||||
struct _frozen {
|
||||
char *name;
|
||||
unsigned char *code;
|
||||
int size;
|
||||
};
|
||||
|
||||
/* Embedding apps may change this pointer to point to their favorite
|
||||
collection of frozen modules: */
|
||||
|
||||
PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_IMPORT_H */
|
||||
@@ -1,80 +0,0 @@
|
||||
|
||||
/* Integer object interface */
|
||||
|
||||
/*
|
||||
PyIntObject represents a (long) integer. This is an immutable object;
|
||||
an integer cannot change its value after creation.
|
||||
|
||||
There are functions to create new integer objects, to test an object
|
||||
for integer-ness, and to get the integer value. The latter functions
|
||||
returns -1 and sets errno to EBADF if the object is not an PyIntObject.
|
||||
None of the functions should be applied to nil objects.
|
||||
|
||||
The type PyIntObject is (unfortunately) exposed here so we can declare
|
||||
_Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this.
|
||||
*/
|
||||
|
||||
#ifndef Py_INTOBJECT_H
|
||||
#define Py_INTOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
long ob_ival;
|
||||
} PyIntObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyInt_Type;
|
||||
|
||||
#define PyInt_Check(op) \
|
||||
PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS)
|
||||
#define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
||||
#endif
|
||||
PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
|
||||
PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t);
|
||||
PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t);
|
||||
PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
|
||||
PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
|
||||
PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
|
||||
#ifdef HAVE_LONG_LONG
|
||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(long) PyInt_GetMax(void);
|
||||
|
||||
/* Macro, trading safety for speed */
|
||||
#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
|
||||
|
||||
/* These aren't really part of the Int object, but they're handy; the protos
|
||||
* are necessary for systems that need the magic of PyAPI_FUNC and that want
|
||||
* to have stropmodule as a dynamically loaded module instead of building it
|
||||
* into the main Python shared library/DLL. Guido thinks I'm weird for
|
||||
* building it this way. :-) [cjh]
|
||||
*/
|
||||
PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
|
||||
PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
|
||||
|
||||
/* free list api */
|
||||
PyAPI_FUNC(int) PyInt_ClearFreeList(void);
|
||||
|
||||
/* Convert an integer to the given base. Returns a string.
|
||||
If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'.
|
||||
If newstyle is zero, then use the pre-2.6 behavior of octal having
|
||||
a leading "0" */
|
||||
PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle);
|
||||
|
||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||
(Advanced String Formatting). */
|
||||
PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj,
|
||||
char *format_spec,
|
||||
Py_ssize_t format_spec_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_INTOBJECT_H */
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
#ifndef Py_INTRCHECK_H
|
||||
#define Py_INTRCHECK_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
|
||||
PyAPI_FUNC(void) PyOS_InitInterrupts(void);
|
||||
PyAPI_FUNC(void) PyOS_AfterFork(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_INTRCHECK_H */
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef Py_ITEROBJECT_H
|
||||
#define Py_ITEROBJECT_H
|
||||
/* Iterators (the basic kind, over a sequence) */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
|
||||
|
||||
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
|
||||
|
||||
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_ITEROBJECT_H */
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
|
||||
/* List object interface */
|
||||
|
||||
/*
|
||||
Another generally useful object type is an list of object pointers.
|
||||
This is a mutable type: the list items can be changed, and items can be
|
||||
added or removed. Out-of-range indices or non-list objects are ignored.
|
||||
|
||||
*** WARNING *** PyList_SetItem does not increment the new item's reference
|
||||
count, but does decrement the reference count of the item it replaces,
|
||||
if not nil. It does *decrement* the reference count if it is *not*
|
||||
inserted in the list. Similarly, PyList_GetItem does not increment the
|
||||
returned item's reference count.
|
||||
*/
|
||||
|
||||
#ifndef Py_LISTOBJECT_H
|
||||
#define Py_LISTOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD
|
||||
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
|
||||
PyObject **ob_item;
|
||||
|
||||
/* ob_item contains space for 'allocated' elements. The number
|
||||
* currently in use is ob_size.
|
||||
* Invariants:
|
||||
* 0 <= ob_size <= allocated
|
||||
* len(list) == ob_size
|
||||
* ob_item == NULL implies ob_size == allocated == 0
|
||||
* list.sort() temporarily sets allocated to -1 to detect mutations.
|
||||
*
|
||||
* Items must normally not be NULL, except during construction when
|
||||
* the list is not yet visible outside the function that builds it.
|
||||
*/
|
||||
Py_ssize_t allocated;
|
||||
} PyListObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyList_Type;
|
||||
|
||||
#define PyList_Check(op) \
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
||||
#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
|
||||
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
|
||||
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
|
||||
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
|
||||
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
|
||||
PyAPI_FUNC(int) PyList_Sort(PyObject *);
|
||||
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
||||
|
||||
/* Macro, trading safety for speed */
|
||||
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
|
||||
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
|
||||
#define PyList_GET_SIZE(op) Py_SIZE(op)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_LISTOBJECT_H */
|
||||
@@ -1,103 +0,0 @@
|
||||
#ifndef Py_LONGINTREPR_H
|
||||
#define Py_LONGINTREPR_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* This is published for the benefit of "friend" marshal.c only. */
|
||||
|
||||
/* Parameters of the long integer representation. There are two different
|
||||
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
|
||||
integer type, and one set for 15-bit digits with each digit stored in an
|
||||
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
|
||||
configure time or in pyport.h, is used to decide which digit size to use.
|
||||
|
||||
Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'
|
||||
should be an unsigned integer type able to hold all integers up to
|
||||
PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type,
|
||||
and that overflow is handled by taking the result modulo 2**N for some N >
|
||||
PyLong_SHIFT. The majority of the code doesn't care about the precise
|
||||
value of PyLong_SHIFT, but there are some notable exceptions:
|
||||
|
||||
- long_pow() requires that PyLong_SHIFT be divisible by 5
|
||||
|
||||
- PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8
|
||||
|
||||
- long_hash() requires that PyLong_SHIFT is *strictly* less than the number
|
||||
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
|
||||
conversion functions
|
||||
|
||||
- the long <-> size_t/Py_ssize_t conversion functions expect that
|
||||
PyLong_SHIFT is strictly less than the number of bits in a size_t
|
||||
|
||||
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
|
||||
|
||||
The values 15 and 30 should fit all of the above requirements, on any
|
||||
platform.
|
||||
*/
|
||||
|
||||
#if PYLONG_BITS_IN_DIGIT == 30
|
||||
#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \
|
||||
defined HAVE_INT64_T && defined HAVE_INT32_T)
|
||||
#error "30-bit long digits requested, but the necessary types are not available on this platform"
|
||||
#endif
|
||||
typedef PY_UINT32_T digit;
|
||||
typedef PY_INT32_T sdigit; /* signed variant of digit */
|
||||
typedef PY_UINT64_T twodigits;
|
||||
typedef PY_INT64_T stwodigits; /* signed variant of twodigits */
|
||||
#define PyLong_SHIFT 30
|
||||
#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */
|
||||
#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */
|
||||
#elif PYLONG_BITS_IN_DIGIT == 15
|
||||
typedef unsigned short digit;
|
||||
typedef short sdigit; /* signed variant of digit */
|
||||
typedef unsigned long twodigits;
|
||||
typedef long stwodigits; /* signed variant of twodigits */
|
||||
#define PyLong_SHIFT 15
|
||||
#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */
|
||||
#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */
|
||||
#else
|
||||
#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"
|
||||
#endif
|
||||
#define PyLong_BASE ((digit)1 << PyLong_SHIFT)
|
||||
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
|
||||
|
||||
/* b/w compatibility with Python 2.5 */
|
||||
#define SHIFT PyLong_SHIFT
|
||||
#define BASE PyLong_BASE
|
||||
#define MASK PyLong_MASK
|
||||
|
||||
#if PyLong_SHIFT % 5 != 0
|
||||
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
|
||||
#endif
|
||||
|
||||
/* Long integer representation.
|
||||
The absolute value of a number is equal to
|
||||
SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)
|
||||
Negative numbers are represented with ob_size < 0;
|
||||
zero is represented by ob_size == 0.
|
||||
In a normalized number, ob_digit[abs(ob_size)-1] (the most significant
|
||||
digit) is never zero. Also, in all cases, for all valid i,
|
||||
0 <= ob_digit[i] <= MASK.
|
||||
The allocation function takes care of allocating extra memory
|
||||
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
|
||||
|
||||
CAUTION: Generic code manipulating subtypes of PyVarObject has to
|
||||
aware that longs abuse ob_size's sign bit.
|
||||
*/
|
||||
|
||||
struct _longobject {
|
||||
PyObject_VAR_HEAD
|
||||
digit ob_digit[1];
|
||||
};
|
||||
|
||||
PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
|
||||
|
||||
/* Return a copy of src. */
|
||||
PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_LONGINTREPR_H */
|
||||
@@ -1,134 +0,0 @@
|
||||
#ifndef Py_LONGOBJECT_H
|
||||
#define Py_LONGOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Long (arbitrary precision) integer object interface */
|
||||
|
||||
typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyLong_Type;
|
||||
|
||||
#define PyLong_Check(op) \
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
|
||||
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromDouble(double);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t);
|
||||
PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
|
||||
PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
|
||||
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
|
||||
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
|
||||
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
|
||||
|
||||
/* For use by intobject.c only */
|
||||
#define _PyLong_AsSsize_t PyLong_AsSsize_t
|
||||
#define _PyLong_FromSize_t PyLong_FromSize_t
|
||||
#define _PyLong_FromSsize_t PyLong_FromSsize_t
|
||||
PyAPI_DATA(int) _PyLong_DigitValue[256];
|
||||
|
||||
/* _PyLong_Frexp returns a double x and an exponent e such that the
|
||||
true value is approximately equal to x * 2**e. e is >= 0. x is
|
||||
0.0 if and only if the input is 0 (in which case, e and x are both
|
||||
zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
|
||||
possible if the number of bits doesn't fit into a Py_ssize_t, sets
|
||||
OverflowError and returns -1.0 for x, 0 for e. */
|
||||
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
|
||||
|
||||
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
|
||||
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
|
||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
|
||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
|
||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
|
||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
||||
#endif
|
||||
|
||||
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
|
||||
v must not be NULL, and must be a normalized long.
|
||||
There are no error cases.
|
||||
*/
|
||||
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
|
||||
|
||||
|
||||
/* _PyLong_NumBits. Return the number of bits needed to represent the
|
||||
absolute value of a long. For example, this returns 1 for 1 and -1, 2
|
||||
for 2 and -2, and 2 for 3 and -3. It returns 0 for 0.
|
||||
v must not be NULL, and must be a normalized long.
|
||||
(size_t)-1 is returned and OverflowError set if the true result doesn't
|
||||
fit in a size_t.
|
||||
*/
|
||||
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
|
||||
|
||||
/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
|
||||
base 256, and return a Python long with the same numeric value.
|
||||
If n is 0, the integer is 0. Else:
|
||||
If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB;
|
||||
else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the
|
||||
LSB.
|
||||
If is_signed is 0/false, view the bytes as a non-negative integer.
|
||||
If is_signed is 1/true, view the bytes as a 2's-complement integer,
|
||||
non-negative if bit 0x80 of the MSB is clear, negative if set.
|
||||
Error returns:
|
||||
+ Return NULL with the appropriate exception set if there's not
|
||||
enough memory to create the Python long.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
|
||||
const unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
|
||||
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
|
||||
v to a base-256 integer, stored in array bytes. Normally return 0,
|
||||
return -1 on error.
|
||||
If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at
|
||||
bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and
|
||||
the LSB at bytes[n-1].
|
||||
If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes
|
||||
are filled and there's nothing special about bit 0x80 of the MSB.
|
||||
If is_signed is 1/true, bytes is filled with the 2's-complement
|
||||
representation of v's value. Bit 0x80 of the MSB is the sign bit.
|
||||
Error returns (-1):
|
||||
+ is_signed is 0 and v < 0. TypeError is set in this case, and bytes
|
||||
isn't altered.
|
||||
+ n isn't big enough to hold the full mathematical value of v. For
|
||||
example, if is_signed is 0 and there are more digits in the v than
|
||||
fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
|
||||
being large enough to hold a sign bit. OverflowError is set in this
|
||||
case, but bytes holds the least-signficant n bytes of the true value.
|
||||
*/
|
||||
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
|
||||
unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
|
||||
/* _PyLong_Format: Convert the long to a string object with given base,
|
||||
appending a base prefix of 0[box] if base is 2, 8 or 16.
|
||||
Add a trailing "L" if addL is non-zero.
|
||||
If newstyle is zero, then use the pre-2.6 behavior of octal having
|
||||
a leading "0", instead of the prefix "0o" */
|
||||
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle);
|
||||
|
||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||
(Advanced String Formatting). */
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj,
|
||||
char *format_spec,
|
||||
Py_ssize_t format_spec_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_LONGOBJECT_H */
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
/* Interface for marshal.c */
|
||||
|
||||
#ifndef Py_MARSHAL_H
|
||||
#define Py_MARSHAL_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define Py_MARSHAL_VERSION 2
|
||||
|
||||
PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
|
||||
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
|
||||
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int);
|
||||
|
||||
PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *);
|
||||
PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
|
||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
|
||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
|
||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_MARSHAL_H */
|
||||
@@ -1,74 +0,0 @@
|
||||
/* Memory view object. In Python this is available as "memoryview". */
|
||||
|
||||
#ifndef Py_MEMORYOBJECT_H
|
||||
#define Py_MEMORYOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
|
||||
|
||||
#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
|
||||
|
||||
/* Get a pointer to the underlying Py_buffer of a memoryview object. */
|
||||
#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
|
||||
/* Get a pointer to the PyObject from which originates a memoryview object. */
|
||||
#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
|
||||
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
|
||||
int buffertype,
|
||||
char fort);
|
||||
|
||||
/* Return a contiguous chunk of memory representing the buffer
|
||||
from an object in a memory view object. If a copy is made then the
|
||||
base object for the memory view will be a *new* bytes object.
|
||||
|
||||
Otherwise, the base-object will be the object itself and no
|
||||
data-copying will be done.
|
||||
|
||||
The buffertype argument can be PyBUF_READ, PyBUF_WRITE,
|
||||
PyBUF_SHADOW to determine whether the returned buffer
|
||||
should be READONLY, WRITABLE, or set to update the
|
||||
original buffer if a copy must be made. If buffertype is
|
||||
PyBUF_WRITE and the buffer is not contiguous an error will
|
||||
be raised. In this circumstance, the user can use
|
||||
PyBUF_SHADOW to ensure that a a writable temporary
|
||||
contiguous buffer is returned. The contents of this
|
||||
contiguous buffer will be copied back into the original
|
||||
object after the memoryview object is deleted as long as
|
||||
the original object is writable and allows setting an
|
||||
exclusive write lock. If this is not allowed by the
|
||||
original object, then a BufferError is raised.
|
||||
|
||||
If the object is multi-dimensional and if fortran is 'F',
|
||||
the first dimension of the underlying array will vary the
|
||||
fastest in the buffer. If fortran is 'C', then the last
|
||||
dimension will vary the fastest (C-style contiguous). If
|
||||
fortran is 'A', then it does not matter and you will get
|
||||
whatever the object decides is more efficient.
|
||||
|
||||
A new reference is returned that must be DECREF'd when finished.
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
|
||||
/* create new if bufptr is NULL
|
||||
will be a new bytesobject in base */
|
||||
|
||||
|
||||
/* The struct is declared here so that macros can work, but it shouldn't
|
||||
be considered public. Don't access those fields directly, use the macros
|
||||
and functions instead! */
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *base;
|
||||
Py_buffer view;
|
||||
} PyMemoryViewObject;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_MEMORYOBJECT_H */
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef Py_METAGRAMMAR_H
|
||||
#define Py_METAGRAMMAR_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define MSTART 256
|
||||
#define RULE 257
|
||||
#define RHS 258
|
||||
#define ALT 259
|
||||
#define ITEM 260
|
||||
#define ATOM 261
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_METAGRAMMAR_H */
|
||||
@@ -1,93 +0,0 @@
|
||||
|
||||
/* Method object interface */
|
||||
|
||||
#ifndef Py_METHODOBJECT_H
|
||||
#define Py_METHODOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is about the type 'builtin_function_or_method',
|
||||
not Python methods in user-defined classes. See classobject.h
|
||||
for the latter. */
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCFunction_Type;
|
||||
|
||||
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
|
||||
|
||||
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
|
||||
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
|
||||
PyObject *);
|
||||
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
|
||||
|
||||
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
|
||||
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
|
||||
|
||||
/* Macros for direct access to these values. Type checks are *not*
|
||||
done, so use with care. */
|
||||
#define PyCFunction_GET_FUNCTION(func) \
|
||||
(((PyCFunctionObject *)func) -> m_ml -> ml_meth)
|
||||
#define PyCFunction_GET_SELF(func) \
|
||||
(((PyCFunctionObject *)func) -> m_self)
|
||||
#define PyCFunction_GET_FLAGS(func) \
|
||||
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
|
||||
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
|
||||
|
||||
struct PyMethodDef {
|
||||
const char *ml_name; /* The name of the built-in function/method */
|
||||
PyCFunction ml_meth; /* The C function that implements it */
|
||||
int ml_flags; /* Combination of METH_xxx flags, which mostly
|
||||
describe the args expected by the C func */
|
||||
const char *ml_doc; /* The __doc__ attribute, or NULL */
|
||||
};
|
||||
typedef struct PyMethodDef PyMethodDef;
|
||||
|
||||
PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
|
||||
|
||||
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
|
||||
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
|
||||
PyObject *);
|
||||
|
||||
/* Flag passed to newmethodobject */
|
||||
#define METH_OLDARGS 0x0000
|
||||
#define METH_VARARGS 0x0001
|
||||
#define METH_KEYWORDS 0x0002
|
||||
/* METH_NOARGS and METH_O must not be combined with the flags above. */
|
||||
#define METH_NOARGS 0x0004
|
||||
#define METH_O 0x0008
|
||||
|
||||
/* METH_CLASS and METH_STATIC are a little different; these control
|
||||
the construction of methods for a class. These cannot be used for
|
||||
functions in modules. */
|
||||
#define METH_CLASS 0x0010
|
||||
#define METH_STATIC 0x0020
|
||||
|
||||
/* METH_COEXIST allows a method to be entered eventhough a slot has
|
||||
already filled the entry. When defined, the flag allows a separate
|
||||
method, "__contains__" for example, to coexist with a defined
|
||||
slot like sq_contains. */
|
||||
|
||||
#define METH_COEXIST 0x0040
|
||||
|
||||
typedef struct PyMethodChain {
|
||||
PyMethodDef *methods; /* Methods of this type */
|
||||
struct PyMethodChain *link; /* NULL or base type */
|
||||
} PyMethodChain;
|
||||
|
||||
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
|
||||
const char *);
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyMethodDef *m_ml; /* Description of the C function to call */
|
||||
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
|
||||
PyObject *m_module; /* The __module__ attribute, can be anything */
|
||||
} PyCFunctionObject;
|
||||
|
||||
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_METHODOBJECT_H */
|
||||
@@ -1,134 +0,0 @@
|
||||
|
||||
#ifndef Py_MODSUPPORT_H
|
||||
#define Py_MODSUPPORT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Module support interface */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
|
||||
to mean Py_ssize_t */
|
||||
#ifdef PY_SSIZE_T_CLEAN
|
||||
#define PyArg_Parse _PyArg_Parse_SizeT
|
||||
#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
|
||||
#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
|
||||
#define PyArg_VaParse _PyArg_VaParse_SizeT
|
||||
#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
|
||||
#define Py_BuildValue _Py_BuildValue_SizeT
|
||||
#define Py_VaBuildValue _Py_VaBuildValue_SizeT
|
||||
#else
|
||||
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
|
||||
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
|
||||
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
||||
const char *, char **, ...);
|
||||
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
|
||||
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
|
||||
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
|
||||
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw);
|
||||
|
||||
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
|
||||
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
||||
const char *, char **, va_list);
|
||||
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
|
||||
|
||||
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
|
||||
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
|
||||
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
|
||||
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
|
||||
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
|
||||
|
||||
#define PYTHON_API_VERSION 1013
|
||||
#define PYTHON_API_STRING "1013"
|
||||
/* The API version is maintained (independently from the Python version)
|
||||
so we can detect mismatches between the interpreter and dynamically
|
||||
loaded modules. These are diagnosed by an error message but
|
||||
the module is still loaded (because the mismatch can only be tested
|
||||
after loading the module). The error message is intended to
|
||||
explain the core dump a few seconds later.
|
||||
|
||||
The symbol PYTHON_API_STRING defines the same value as a string
|
||||
literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
|
||||
|
||||
Please add a line or two to the top of this log for each API
|
||||
version change:
|
||||
|
||||
22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
|
||||
|
||||
19-Aug-2002 GvR 1012 Changes to string object struct for
|
||||
interning changes, saving 3 bytes.
|
||||
|
||||
17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
|
||||
|
||||
25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
|
||||
PyFrame_New(); Python 2.1a2
|
||||
|
||||
14-Mar-2000 GvR 1009 Unicode API added
|
||||
|
||||
3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
|
||||
|
||||
3-Dec-1998 GvR 1008 Python 1.5.2b1
|
||||
|
||||
18-Jan-1997 GvR 1007 string interning and other speedups
|
||||
|
||||
11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
|
||||
|
||||
30-Jul-1996 GvR Slice and ellipses syntax added
|
||||
|
||||
23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
|
||||
|
||||
7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
|
||||
|
||||
10-Jan-1995 GvR Renamed globals to new naming scheme
|
||||
|
||||
9-Jan-1995 GvR Initial version (incompatible with older API)
|
||||
*/
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
/* Special defines for Windows versions used to live here. Things
|
||||
have changed, and the "Version" is now in a global string variable.
|
||||
Reason for this is that this for easier branding of a "custom DLL"
|
||||
without actually needing a recompile. */
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
#if SIZEOF_SIZE_T != SIZEOF_INT
|
||||
/* On a 64-bit system, rename the Py_InitModule4 so that 2.4
|
||||
modules cannot get loaded into a 2.5 interpreter */
|
||||
#define Py_InitModule4 Py_InitModule4_64
|
||||
#endif
|
||||
|
||||
#ifdef Py_TRACE_REFS
|
||||
/* When we are tracing reference counts, rename Py_InitModule4 so
|
||||
modules compiled with incompatible settings will generate a
|
||||
link-time error. */
|
||||
#if SIZEOF_SIZE_T != SIZEOF_INT
|
||||
#undef Py_InitModule4
|
||||
#define Py_InitModule4 Py_InitModule4TraceRefs_64
|
||||
#else
|
||||
#define Py_InitModule4 Py_InitModule4TraceRefs
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
|
||||
const char *doc, PyObject *self,
|
||||
int apiver);
|
||||
|
||||
#define Py_InitModule(name, methods) \
|
||||
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
|
||||
PYTHON_API_VERSION)
|
||||
|
||||
#define Py_InitModule3(name, methods, doc) \
|
||||
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
|
||||
PYTHON_API_VERSION)
|
||||
|
||||
PyAPI_DATA(char *) _Py_PackageContext;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_MODSUPPORT_H */
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
/* Module object interface */
|
||||
|
||||
#ifndef Py_MODULEOBJECT_H
|
||||
#define Py_MODULEOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyModule_Type;
|
||||
|
||||
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
||||
#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyModule_New(const char *);
|
||||
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
|
||||
PyAPI_FUNC(char *) PyModule_GetName(PyObject *);
|
||||
PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *);
|
||||
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_MODULEOBJECT_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
/* Parse tree node interface */
|
||||
|
||||
#ifndef Py_NODE_H
|
||||
#define Py_NODE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _node {
|
||||
short n_type;
|
||||
char *n_str;
|
||||
int n_lineno;
|
||||
int n_col_offset;
|
||||
int n_nchildren;
|
||||
struct _node *n_child;
|
||||
} node;
|
||||
|
||||
PyAPI_FUNC(node *) PyNode_New(int type);
|
||||
PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
|
||||
char *str, int lineno, int col_offset);
|
||||
PyAPI_FUNC(void) PyNode_Free(node *n);
|
||||
|
||||
/* Node access functions */
|
||||
#define NCH(n) ((n)->n_nchildren)
|
||||
|
||||
#define CHILD(n, i) (&(n)->n_child[i])
|
||||
#define RCHILD(n, i) (CHILD(n, NCH(n) + i))
|
||||
#define TYPE(n) ((n)->n_type)
|
||||
#define STR(n) ((n)->n_str)
|
||||
|
||||
/* Assert that the type of a node is what we expect */
|
||||
#define REQ(n, type) assert(TYPE(n) == (type))
|
||||
|
||||
PyAPI_FUNC(void) PyNode_ListTree(node *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_NODE_H */
|
||||
@@ -1,996 +0,0 @@
|
||||
#ifndef Py_OBJECT_H
|
||||
#define Py_OBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Object and type object interface */
|
||||
|
||||
/*
|
||||
Objects are structures allocated on the heap. Special rules apply to
|
||||
the use of objects to ensure they are properly garbage-collected.
|
||||
Objects are never allocated statically or on the stack; they must be
|
||||
accessed through special macros and functions only. (Type objects are
|
||||
exceptions to the first rule; the standard types are represented by
|
||||
statically initialized type objects, although work on type/class unification
|
||||
for Python 2.2 made it possible to have heap-allocated type objects too).
|
||||
|
||||
An object has a 'reference count' that is increased or decreased when a
|
||||
pointer to the object is copied or deleted; when the reference count
|
||||
reaches zero there are no references to the object left and it can be
|
||||
removed from the heap.
|
||||
|
||||
An object has a 'type' that determines what it represents and what kind
|
||||
of data it contains. An object's type is fixed when it is created.
|
||||
Types themselves are represented as objects; an object contains a
|
||||
pointer to the corresponding type object. The type itself has a type
|
||||
pointer pointing to the object representing the type 'type', which
|
||||
contains a pointer to itself!).
|
||||
|
||||
Objects do not float around in memory; once allocated an object keeps
|
||||
the same size and address. Objects that must hold variable-size data
|
||||
can contain pointers to variable-size parts of the object. Not all
|
||||
objects of the same type have the same size; but the size cannot change
|
||||
after allocation. (These restrictions are made so a reference to an
|
||||
object can be simply a pointer -- moving an object would require
|
||||
updating all the pointers, and changing an object's size would require
|
||||
moving it if there was another object right next to it.)
|
||||
|
||||
Objects are always accessed through pointers of the type 'PyObject *'.
|
||||
The type 'PyObject' is a structure that only contains the reference count
|
||||
and the type pointer. The actual memory allocated for an object
|
||||
contains other data that can only be accessed after casting the pointer
|
||||
to a pointer to a longer structure type. This longer type must start
|
||||
with the reference count and type fields; the macro PyObject_HEAD should be
|
||||
used for this (to accommodate for future changes). The implementation
|
||||
of a particular object type can cast the object pointer to the proper
|
||||
type and back.
|
||||
|
||||
A standard interface exists for objects that contain an array of items
|
||||
whose size is determined when the object is allocated.
|
||||
*/
|
||||
|
||||
/* Py_DEBUG implies Py_TRACE_REFS. */
|
||||
#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS)
|
||||
#define Py_TRACE_REFS
|
||||
#endif
|
||||
|
||||
/* Py_TRACE_REFS implies Py_REF_DEBUG. */
|
||||
#if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG)
|
||||
#define Py_REF_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef Py_TRACE_REFS
|
||||
/* Define pointers to support a doubly-linked list of all live heap objects. */
|
||||
#define _PyObject_HEAD_EXTRA \
|
||||
struct _object *_ob_next; \
|
||||
struct _object *_ob_prev;
|
||||
|
||||
#define _PyObject_EXTRA_INIT 0, 0,
|
||||
|
||||
#else
|
||||
#define _PyObject_HEAD_EXTRA
|
||||
#define _PyObject_EXTRA_INIT
|
||||
#endif
|
||||
|
||||
/* PyObject_HEAD defines the initial segment of every PyObject. */
|
||||
#define PyObject_HEAD \
|
||||
_PyObject_HEAD_EXTRA \
|
||||
Py_ssize_t ob_refcnt; \
|
||||
struct _typeobject *ob_type;
|
||||
|
||||
#define PyObject_HEAD_INIT(type) \
|
||||
_PyObject_EXTRA_INIT \
|
||||
1, type,
|
||||
|
||||
#define PyVarObject_HEAD_INIT(type, size) \
|
||||
PyObject_HEAD_INIT(type) size,
|
||||
|
||||
/* PyObject_VAR_HEAD defines the initial segment of all variable-size
|
||||
* container objects. These end with a declaration of an array with 1
|
||||
* element, but enough space is malloc'ed so that the array actually
|
||||
* has room for ob_size elements. Note that ob_size is an element count,
|
||||
* not necessarily a byte count.
|
||||
*/
|
||||
#define PyObject_VAR_HEAD \
|
||||
PyObject_HEAD \
|
||||
Py_ssize_t ob_size; /* Number of items in variable part */
|
||||
#define Py_INVALID_SIZE (Py_ssize_t)-1
|
||||
|
||||
/* Nothing is actually declared to be a PyObject, but every pointer to
|
||||
* a Python object can be cast to a PyObject*. This is inheritance built
|
||||
* by hand. Similarly every pointer to a variable-size Python object can,
|
||||
* in addition, be cast to PyVarObject*.
|
||||
*/
|
||||
typedef struct _object {
|
||||
PyObject_HEAD
|
||||
} PyObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD
|
||||
} PyVarObject;
|
||||
|
||||
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
|
||||
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
|
||||
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
|
||||
|
||||
/*
|
||||
Type objects contain a string containing the type name (to help somewhat
|
||||
in debugging), the allocation parameters (see PyObject_New() and
|
||||
PyObject_NewVar()),
|
||||
and methods for accessing objects of the type. Methods are optional, a
|
||||
nil pointer meaning that particular kind of access is not available for
|
||||
this type. The Py_DECREF() macro uses the tp_dealloc method without
|
||||
checking for a nil pointer; it should always be implemented except if
|
||||
the implementation can guarantee that the reference count will never
|
||||
reach zero (e.g., for statically allocated type objects).
|
||||
|
||||
NB: the methods for certain type groups are now contained in separate
|
||||
method blocks.
|
||||
*/
|
||||
|
||||
typedef PyObject * (*unaryfunc)(PyObject *);
|
||||
typedef PyObject * (*binaryfunc)(PyObject *, PyObject *);
|
||||
typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *);
|
||||
typedef int (*inquiry)(PyObject *);
|
||||
typedef Py_ssize_t (*lenfunc)(PyObject *);
|
||||
typedef int (*coercion)(PyObject **, PyObject **);
|
||||
typedef PyObject *(*intargfunc)(PyObject *, int) Py_DEPRECATED(2.5);
|
||||
typedef PyObject *(*intintargfunc)(PyObject *, int, int) Py_DEPRECATED(2.5);
|
||||
typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t);
|
||||
typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t);
|
||||
typedef int(*intobjargproc)(PyObject *, int, PyObject *);
|
||||
typedef int(*intintobjargproc)(PyObject *, int, int, PyObject *);
|
||||
typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *);
|
||||
typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
|
||||
typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
|
||||
|
||||
|
||||
|
||||
/* int-based buffer interface */
|
||||
typedef int (*getreadbufferproc)(PyObject *, int, void **);
|
||||
typedef int (*getwritebufferproc)(PyObject *, int, void **);
|
||||
typedef int (*getsegcountproc)(PyObject *, int *);
|
||||
typedef int (*getcharbufferproc)(PyObject *, int, char **);
|
||||
/* ssize_t-based buffer interface */
|
||||
typedef Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **);
|
||||
typedef Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **);
|
||||
typedef Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *);
|
||||
typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **);
|
||||
|
||||
|
||||
/* Py3k buffer interface */
|
||||
typedef struct bufferinfo {
|
||||
void *buf;
|
||||
PyObject *obj; /* owned reference */
|
||||
Py_ssize_t len;
|
||||
Py_ssize_t itemsize; /* This is Py_ssize_t so it can be
|
||||
pointed to by strides in simple case.*/
|
||||
int readonly;
|
||||
int ndim;
|
||||
char *format;
|
||||
Py_ssize_t *shape;
|
||||
Py_ssize_t *strides;
|
||||
Py_ssize_t *suboffsets;
|
||||
Py_ssize_t smalltable[2]; /* static store for shape and strides of
|
||||
mono-dimensional buffers. */
|
||||
void *internal;
|
||||
} Py_buffer;
|
||||
|
||||
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
|
||||
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
|
||||
|
||||
/* Flags for getting buffers */
|
||||
#define PyBUF_SIMPLE 0
|
||||
#define PyBUF_WRITABLE 0x0001
|
||||
/* we used to include an E, backwards compatible alias */
|
||||
#define PyBUF_WRITEABLE PyBUF_WRITABLE
|
||||
#define PyBUF_FORMAT 0x0004
|
||||
#define PyBUF_ND 0x0008
|
||||
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
|
||||
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
|
||||
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
|
||||
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
|
||||
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
|
||||
|
||||
#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE)
|
||||
#define PyBUF_CONTIG_RO (PyBUF_ND)
|
||||
|
||||
#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE)
|
||||
#define PyBUF_STRIDED_RO (PyBUF_STRIDES)
|
||||
|
||||
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT)
|
||||
#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT)
|
||||
|
||||
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT)
|
||||
#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT)
|
||||
|
||||
|
||||
#define PyBUF_READ 0x100
|
||||
#define PyBUF_WRITE 0x200
|
||||
#define PyBUF_SHADOW 0x400
|
||||
/* end Py3k buffer interface */
|
||||
|
||||
typedef int (*objobjproc)(PyObject *, PyObject *);
|
||||
typedef int (*visitproc)(PyObject *, void *);
|
||||
typedef int (*traverseproc)(PyObject *, visitproc, void *);
|
||||
|
||||
typedef struct {
|
||||
/* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all
|
||||
arguments are guaranteed to be of the object's type (modulo
|
||||
coercion hacks -- i.e. if the type's coercion function
|
||||
returns other types, then these are allowed as well). Numbers that
|
||||
have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both*
|
||||
arguments for proper type and implement the necessary conversions
|
||||
in the slot functions themselves. */
|
||||
|
||||
binaryfunc nb_add;
|
||||
binaryfunc nb_subtract;
|
||||
binaryfunc nb_multiply;
|
||||
binaryfunc nb_divide;
|
||||
binaryfunc nb_remainder;
|
||||
binaryfunc nb_divmod;
|
||||
ternaryfunc nb_power;
|
||||
unaryfunc nb_negative;
|
||||
unaryfunc nb_positive;
|
||||
unaryfunc nb_absolute;
|
||||
inquiry nb_nonzero;
|
||||
unaryfunc nb_invert;
|
||||
binaryfunc nb_lshift;
|
||||
binaryfunc nb_rshift;
|
||||
binaryfunc nb_and;
|
||||
binaryfunc nb_xor;
|
||||
binaryfunc nb_or;
|
||||
coercion nb_coerce;
|
||||
unaryfunc nb_int;
|
||||
unaryfunc nb_long;
|
||||
unaryfunc nb_float;
|
||||
unaryfunc nb_oct;
|
||||
unaryfunc nb_hex;
|
||||
/* Added in release 2.0 */
|
||||
binaryfunc nb_inplace_add;
|
||||
binaryfunc nb_inplace_subtract;
|
||||
binaryfunc nb_inplace_multiply;
|
||||
binaryfunc nb_inplace_divide;
|
||||
binaryfunc nb_inplace_remainder;
|
||||
ternaryfunc nb_inplace_power;
|
||||
binaryfunc nb_inplace_lshift;
|
||||
binaryfunc nb_inplace_rshift;
|
||||
binaryfunc nb_inplace_and;
|
||||
binaryfunc nb_inplace_xor;
|
||||
binaryfunc nb_inplace_or;
|
||||
|
||||
/* Added in release 2.2 */
|
||||
/* The following require the Py_TPFLAGS_HAVE_CLASS flag */
|
||||
binaryfunc nb_floor_divide;
|
||||
binaryfunc nb_true_divide;
|
||||
binaryfunc nb_inplace_floor_divide;
|
||||
binaryfunc nb_inplace_true_divide;
|
||||
|
||||
/* Added in release 2.5 */
|
||||
unaryfunc nb_index;
|
||||
} PyNumberMethods;
|
||||
|
||||
typedef struct {
|
||||
lenfunc sq_length;
|
||||
binaryfunc sq_concat;
|
||||
ssizeargfunc sq_repeat;
|
||||
ssizeargfunc sq_item;
|
||||
ssizessizeargfunc sq_slice;
|
||||
ssizeobjargproc sq_ass_item;
|
||||
ssizessizeobjargproc sq_ass_slice;
|
||||
objobjproc sq_contains;
|
||||
/* Added in release 2.0 */
|
||||
binaryfunc sq_inplace_concat;
|
||||
ssizeargfunc sq_inplace_repeat;
|
||||
} PySequenceMethods;
|
||||
|
||||
typedef struct {
|
||||
lenfunc mp_length;
|
||||
binaryfunc mp_subscript;
|
||||
objobjargproc mp_ass_subscript;
|
||||
} PyMappingMethods;
|
||||
|
||||
typedef struct {
|
||||
readbufferproc bf_getreadbuffer;
|
||||
writebufferproc bf_getwritebuffer;
|
||||
segcountproc bf_getsegcount;
|
||||
charbufferproc bf_getcharbuffer;
|
||||
getbufferproc bf_getbuffer;
|
||||
releasebufferproc bf_releasebuffer;
|
||||
} PyBufferProcs;
|
||||
|
||||
|
||||
typedef void (*freefunc)(void *);
|
||||
typedef void (*destructor)(PyObject *);
|
||||
typedef int (*printfunc)(PyObject *, FILE *, int);
|
||||
typedef PyObject *(*getattrfunc)(PyObject *, char *);
|
||||
typedef PyObject *(*getattrofunc)(PyObject *, PyObject *);
|
||||
typedef int (*setattrfunc)(PyObject *, char *, PyObject *);
|
||||
typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *);
|
||||
typedef int (*cmpfunc)(PyObject *, PyObject *);
|
||||
typedef PyObject *(*reprfunc)(PyObject *);
|
||||
typedef long (*hashfunc)(PyObject *);
|
||||
typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int);
|
||||
typedef PyObject *(*getiterfunc) (PyObject *);
|
||||
typedef PyObject *(*iternextfunc) (PyObject *);
|
||||
typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *);
|
||||
typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *);
|
||||
typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
|
||||
typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
|
||||
typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t);
|
||||
|
||||
typedef struct _typeobject {
|
||||
PyObject_VAR_HEAD
|
||||
const char *tp_name; /* For printing, in format "<module>.<name>" */
|
||||
Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
|
||||
|
||||
/* Methods to implement standard operations */
|
||||
|
||||
destructor tp_dealloc;
|
||||
printfunc tp_print;
|
||||
getattrfunc tp_getattr;
|
||||
setattrfunc tp_setattr;
|
||||
cmpfunc tp_compare;
|
||||
reprfunc tp_repr;
|
||||
|
||||
/* Method suites for standard classes */
|
||||
|
||||
PyNumberMethods *tp_as_number;
|
||||
PySequenceMethods *tp_as_sequence;
|
||||
PyMappingMethods *tp_as_mapping;
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
hashfunc tp_hash;
|
||||
ternaryfunc tp_call;
|
||||
reprfunc tp_str;
|
||||
getattrofunc tp_getattro;
|
||||
setattrofunc tp_setattro;
|
||||
|
||||
/* Functions to access object as input/output buffer */
|
||||
PyBufferProcs *tp_as_buffer;
|
||||
|
||||
/* Flags to define presence of optional/expanded features */
|
||||
long tp_flags;
|
||||
|
||||
const char *tp_doc; /* Documentation string */
|
||||
|
||||
/* Assigned meaning in release 2.0 */
|
||||
/* call function for all accessible objects */
|
||||
traverseproc tp_traverse;
|
||||
|
||||
/* delete references to contained objects */
|
||||
inquiry tp_clear;
|
||||
|
||||
/* Assigned meaning in release 2.1 */
|
||||
/* rich comparisons */
|
||||
richcmpfunc tp_richcompare;
|
||||
|
||||
/* weak reference enabler */
|
||||
Py_ssize_t tp_weaklistoffset;
|
||||
|
||||
/* Added in release 2.2 */
|
||||
/* Iterators */
|
||||
getiterfunc tp_iter;
|
||||
iternextfunc tp_iternext;
|
||||
|
||||
/* Attribute descriptor and subclassing stuff */
|
||||
struct PyMethodDef *tp_methods;
|
||||
struct PyMemberDef *tp_members;
|
||||
struct PyGetSetDef *tp_getset;
|
||||
struct _typeobject *tp_base;
|
||||
PyObject *tp_dict;
|
||||
descrgetfunc tp_descr_get;
|
||||
descrsetfunc tp_descr_set;
|
||||
Py_ssize_t tp_dictoffset;
|
||||
initproc tp_init;
|
||||
allocfunc tp_alloc;
|
||||
newfunc tp_new;
|
||||
freefunc tp_free; /* Low-level free-memory routine */
|
||||
inquiry tp_is_gc; /* For PyObject_IS_GC */
|
||||
PyObject *tp_bases;
|
||||
PyObject *tp_mro; /* method resolution order */
|
||||
PyObject *tp_cache;
|
||||
PyObject *tp_subclasses;
|
||||
PyObject *tp_weaklist;
|
||||
destructor tp_del;
|
||||
|
||||
/* Type attribute cache version tag. Added in version 2.6 */
|
||||
unsigned int tp_version_tag;
|
||||
|
||||
#ifdef COUNT_ALLOCS
|
||||
/* these must be last and never explicitly initialized */
|
||||
Py_ssize_t tp_allocs;
|
||||
Py_ssize_t tp_frees;
|
||||
Py_ssize_t tp_maxalloc;
|
||||
struct _typeobject *tp_prev;
|
||||
struct _typeobject *tp_next;
|
||||
#endif
|
||||
} PyTypeObject;
|
||||
|
||||
|
||||
/* The *real* layout of a type object when allocated on the heap */
|
||||
typedef struct _heaptypeobject {
|
||||
/* Note: there's a dependency on the order of these members
|
||||
in slotptr() in typeobject.c . */
|
||||
PyTypeObject ht_type;
|
||||
PyNumberMethods as_number;
|
||||
PyMappingMethods as_mapping;
|
||||
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
|
||||
so that the mapping wins when both
|
||||
the mapping and the sequence define
|
||||
a given operator (e.g. __getitem__).
|
||||
see add_operators() in typeobject.c . */
|
||||
PyBufferProcs as_buffer;
|
||||
PyObject *ht_name, *ht_slots;
|
||||
/* here are optional user slots, followed by the members. */
|
||||
} PyHeapTypeObject;
|
||||
|
||||
/* access macro to the members which are floating "behind" the object */
|
||||
#define PyHeapType_GET_MEMBERS(etype) \
|
||||
((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))
|
||||
|
||||
|
||||
/* Generic type check */
|
||||
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
|
||||
#define PyObject_TypeCheck(ob, tp) \
|
||||
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
|
||||
PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
|
||||
PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
|
||||
|
||||
#define PyType_Check(op) \
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
|
||||
#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
|
||||
|
||||
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
|
||||
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
|
||||
PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **);
|
||||
PyAPI_FUNC(unsigned int) PyType_ClearCache(void);
|
||||
PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);
|
||||
|
||||
/* Generic operations on objects */
|
||||
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
|
||||
PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
|
||||
#define PyObject_Bytes PyObject_Str
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *);
|
||||
#endif
|
||||
PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
|
||||
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
|
||||
PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
|
||||
PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
|
||||
PyObject *, PyObject *);
|
||||
PyAPI_FUNC(long) PyObject_Hash(PyObject *);
|
||||
PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_IsTrue(PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_Not(PyObject *);
|
||||
PyAPI_FUNC(int) PyCallable_Check(PyObject *);
|
||||
PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **);
|
||||
PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **);
|
||||
|
||||
PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *);
|
||||
|
||||
/* A slot function whose address we need to compare */
|
||||
extern int _PyObject_SlotCompare(PyObject *, PyObject *);
|
||||
/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes
|
||||
dict as the last parameter. */
|
||||
PyAPI_FUNC(PyObject *)
|
||||
_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int)
|
||||
_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *,
|
||||
PyObject *, PyObject *);
|
||||
|
||||
|
||||
/* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a
|
||||
list of strings. PyObject_Dir(NULL) is like __builtin__.dir(),
|
||||
returning the names of the current locals. In this case, if there are
|
||||
no current locals, NULL is returned, and PyErr_Occurred() is false.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *);
|
||||
|
||||
|
||||
/* Helpers for printing recursive container types */
|
||||
PyAPI_FUNC(int) Py_ReprEnter(PyObject *);
|
||||
PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
|
||||
|
||||
/* Helpers for hash functions */
|
||||
PyAPI_FUNC(long) _Py_HashDouble(double);
|
||||
PyAPI_FUNC(long) _Py_HashPointer(void*);
|
||||
|
||||
typedef struct {
|
||||
long prefix;
|
||||
long suffix;
|
||||
} _Py_HashSecret_t;
|
||||
PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
|
||||
|
||||
#ifdef Py_DEBUG
|
||||
PyAPI_DATA(int) _Py_HashSecret_Initialized;
|
||||
#endif
|
||||
|
||||
/* Helper for passing objects to printf and the like */
|
||||
#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj))
|
||||
|
||||
/* Flag bits for printing: */
|
||||
#define Py_PRINT_RAW 1 /* No string quotes etc. */
|
||||
|
||||
/*
|
||||
`Type flags (tp_flags)
|
||||
|
||||
These flags are used to extend the type structure in a backwards-compatible
|
||||
fashion. Extensions can use the flags to indicate (and test) when a given
|
||||
type structure contains a new feature. The Python core will use these when
|
||||
introducing new functionality between major revisions (to avoid mid-version
|
||||
changes in the PYTHON_API_VERSION).
|
||||
|
||||
Arbitration of the flag bit positions will need to be coordinated among
|
||||
all extension writers who publically release their extensions (this will
|
||||
be fewer than you might expect!)..
|
||||
|
||||
Python 1.5.2 introduced the bf_getcharbuffer slot into PyBufferProcs.
|
||||
|
||||
Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value.
|
||||
|
||||
Code can use PyType_HasFeature(type_ob, flag_value) to test whether the
|
||||
given type object has a specified feature.
|
||||
|
||||
NOTE: when building the core, Py_TPFLAGS_DEFAULT includes
|
||||
Py_TPFLAGS_HAVE_VERSION_TAG; outside the core, it doesn't. This is so
|
||||
that extensions that modify tp_dict of their own types directly don't
|
||||
break, since this was allowed in 2.5. In 3.0 they will have to
|
||||
manually remove this flag though!
|
||||
*/
|
||||
|
||||
/* PyBufferProcs contains bf_getcharbuffer */
|
||||
#define Py_TPFLAGS_HAVE_GETCHARBUFFER (1L<<0)
|
||||
|
||||
/* PySequenceMethods contains sq_contains */
|
||||
#define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1)
|
||||
|
||||
/* This is here for backwards compatibility. Extensions that use the old GC
|
||||
* API will still compile but the objects will not be tracked by the GC. */
|
||||
#define Py_TPFLAGS_GC 0 /* used to be (1L<<2) */
|
||||
|
||||
/* PySequenceMethods and PyNumberMethods contain in-place operators */
|
||||
#define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3)
|
||||
|
||||
/* PyNumberMethods do their own coercion */
|
||||
#define Py_TPFLAGS_CHECKTYPES (1L<<4)
|
||||
|
||||
/* tp_richcompare is defined */
|
||||
#define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5)
|
||||
|
||||
/* Objects which are weakly referencable if their tp_weaklistoffset is >0 */
|
||||
#define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6)
|
||||
|
||||
/* tp_iter is defined */
|
||||
#define Py_TPFLAGS_HAVE_ITER (1L<<7)
|
||||
|
||||
/* New members introduced by Python 2.2 exist */
|
||||
#define Py_TPFLAGS_HAVE_CLASS (1L<<8)
|
||||
|
||||
/* Set if the type object is dynamically allocated */
|
||||
#define Py_TPFLAGS_HEAPTYPE (1L<<9)
|
||||
|
||||
/* Set if the type allows subclassing */
|
||||
#define Py_TPFLAGS_BASETYPE (1L<<10)
|
||||
|
||||
/* Set if the type is 'ready' -- fully initialized */
|
||||
#define Py_TPFLAGS_READY (1L<<12)
|
||||
|
||||
/* Set while the type is being 'readied', to prevent recursive ready calls */
|
||||
#define Py_TPFLAGS_READYING (1L<<13)
|
||||
|
||||
/* Objects support garbage collection (see objimp.h) */
|
||||
#define Py_TPFLAGS_HAVE_GC (1L<<14)
|
||||
|
||||
/* These two bits are preserved for Stackless Python, next after this is 17 */
|
||||
#ifdef STACKLESS
|
||||
#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15)
|
||||
#else
|
||||
#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0
|
||||
#endif
|
||||
|
||||
/* Objects support nb_index in PyNumberMethods */
|
||||
#define Py_TPFLAGS_HAVE_INDEX (1L<<17)
|
||||
|
||||
/* Objects support type attribute cache */
|
||||
#define Py_TPFLAGS_HAVE_VERSION_TAG (1L<<18)
|
||||
#define Py_TPFLAGS_VALID_VERSION_TAG (1L<<19)
|
||||
|
||||
/* Type is abstract and cannot be instantiated */
|
||||
#define Py_TPFLAGS_IS_ABSTRACT (1L<<20)
|
||||
|
||||
/* Has the new buffer protocol */
|
||||
#define Py_TPFLAGS_HAVE_NEWBUFFER (1L<<21)
|
||||
|
||||
/* These flags are used to determine if a type is a subclass. */
|
||||
#define Py_TPFLAGS_INT_SUBCLASS (1L<<23)
|
||||
#define Py_TPFLAGS_LONG_SUBCLASS (1L<<24)
|
||||
#define Py_TPFLAGS_LIST_SUBCLASS (1L<<25)
|
||||
#define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26)
|
||||
#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27)
|
||||
#define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28)
|
||||
#define Py_TPFLAGS_DICT_SUBCLASS (1L<<29)
|
||||
#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30)
|
||||
#define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31)
|
||||
|
||||
#define Py_TPFLAGS_DEFAULT_EXTERNAL ( \
|
||||
Py_TPFLAGS_HAVE_GETCHARBUFFER | \
|
||||
Py_TPFLAGS_HAVE_SEQUENCE_IN | \
|
||||
Py_TPFLAGS_HAVE_INPLACEOPS | \
|
||||
Py_TPFLAGS_HAVE_RICHCOMPARE | \
|
||||
Py_TPFLAGS_HAVE_WEAKREFS | \
|
||||
Py_TPFLAGS_HAVE_ITER | \
|
||||
Py_TPFLAGS_HAVE_CLASS | \
|
||||
Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
|
||||
Py_TPFLAGS_HAVE_INDEX | \
|
||||
0)
|
||||
#define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \
|
||||
Py_TPFLAGS_HAVE_VERSION_TAG)
|
||||
|
||||
#ifdef Py_BUILD_CORE
|
||||
#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_CORE
|
||||
#else
|
||||
#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL
|
||||
#endif
|
||||
|
||||
#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0)
|
||||
#define PyType_FastSubclass(t,f) PyType_HasFeature(t,f)
|
||||
|
||||
|
||||
/*
|
||||
The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement
|
||||
reference counts. Py_DECREF calls the object's deallocator function when
|
||||
the refcount falls to 0; for
|
||||
objects that don't contain references to other objects or heap memory
|
||||
this can be the standard function free(). Both macros can be used
|
||||
wherever a void expression is allowed. The argument must not be a
|
||||
NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead.
|
||||
The macro _Py_NewReference(op) initialize reference counts to 1, and
|
||||
in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional
|
||||
bookkeeping appropriate to the special build.
|
||||
|
||||
We assume that the reference count field can never overflow; this can
|
||||
be proven when the size of the field is the same as the pointer size, so
|
||||
we ignore the possibility. Provided a C int is at least 32 bits (which
|
||||
is implicitly assumed in many parts of this code), that's enough for
|
||||
about 2**31 references to an object.
|
||||
|
||||
XXX The following became out of date in Python 2.2, but I'm not sure
|
||||
XXX what the full truth is now. Certainly, heap-allocated type objects
|
||||
XXX can and should be deallocated.
|
||||
Type objects should never be deallocated; the type pointer in an object
|
||||
is not considered to be a reference to the type object, to save
|
||||
complications in the deallocation function. (This is actually a
|
||||
decision that's up to the implementer of each new type so if you want,
|
||||
you can count such references to the type object.)
|
||||
|
||||
*** WARNING*** The Py_DECREF macro must have a side-effect-free argument
|
||||
since it may evaluate its argument multiple times. (The alternative
|
||||
would be to mace it a proper function or assign it to a global temporary
|
||||
variable first, both of which are slower; and in a multi-threaded
|
||||
environment the global variable trick is not safe.)
|
||||
*/
|
||||
|
||||
/* First define a pile of simple helper macros, one set per special
|
||||
* build symbol. These either expand to the obvious things, or to
|
||||
* nothing at all when the special mode isn't in effect. The main
|
||||
* macros can later be defined just once then, yet expand to different
|
||||
* things depending on which special build options are and aren't in effect.
|
||||
* Trust me <wink>: while painful, this is 20x easier to understand than,
|
||||
* e.g, defining _Py_NewReference five different times in a maze of nested
|
||||
* #ifdefs (we used to do that -- it was impenetrable).
|
||||
*/
|
||||
#ifdef Py_REF_DEBUG
|
||||
PyAPI_DATA(Py_ssize_t) _Py_RefTotal;
|
||||
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname,
|
||||
int lineno, PyObject *op);
|
||||
PyAPI_FUNC(PyObject *) _PyDict_Dummy(void);
|
||||
PyAPI_FUNC(PyObject *) _PySet_Dummy(void);
|
||||
PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
|
||||
#define _Py_INC_REFTOTAL _Py_RefTotal++
|
||||
#define _Py_DEC_REFTOTAL _Py_RefTotal--
|
||||
#define _Py_REF_DEBUG_COMMA ,
|
||||
#define _Py_CHECK_REFCNT(OP) \
|
||||
{ if (((PyObject*)OP)->ob_refcnt < 0) \
|
||||
_Py_NegativeRefcount(__FILE__, __LINE__, \
|
||||
(PyObject *)(OP)); \
|
||||
}
|
||||
#else
|
||||
#define _Py_INC_REFTOTAL
|
||||
#define _Py_DEC_REFTOTAL
|
||||
#define _Py_REF_DEBUG_COMMA
|
||||
#define _Py_CHECK_REFCNT(OP) /* a semicolon */;
|
||||
#endif /* Py_REF_DEBUG */
|
||||
|
||||
#ifdef COUNT_ALLOCS
|
||||
PyAPI_FUNC(void) inc_count(PyTypeObject *);
|
||||
PyAPI_FUNC(void) dec_count(PyTypeObject *);
|
||||
#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP))
|
||||
#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP))
|
||||
#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees--
|
||||
#define _Py_COUNT_ALLOCS_COMMA ,
|
||||
#else
|
||||
#define _Py_INC_TPALLOCS(OP)
|
||||
#define _Py_INC_TPFREES(OP)
|
||||
#define _Py_DEC_TPFREES(OP)
|
||||
#define _Py_COUNT_ALLOCS_COMMA
|
||||
#endif /* COUNT_ALLOCS */
|
||||
|
||||
#ifdef Py_TRACE_REFS
|
||||
/* Py_TRACE_REFS is such major surgery that we call external routines. */
|
||||
PyAPI_FUNC(void) _Py_NewReference(PyObject *);
|
||||
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
|
||||
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
|
||||
PyAPI_FUNC(void) _Py_PrintReferences(FILE *);
|
||||
PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *);
|
||||
PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
|
||||
|
||||
#else
|
||||
/* Without Py_TRACE_REFS, there's little enough to do that we expand code
|
||||
* inline.
|
||||
*/
|
||||
#define _Py_NewReference(op) ( \
|
||||
_Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \
|
||||
_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
|
||||
Py_REFCNT(op) = 1)
|
||||
|
||||
#define _Py_ForgetReference(op) _Py_INC_TPFREES(op)
|
||||
|
||||
#define _Py_Dealloc(op) ( \
|
||||
_Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \
|
||||
(*Py_TYPE(op)->tp_dealloc)((PyObject *)(op)))
|
||||
#endif /* !Py_TRACE_REFS */
|
||||
|
||||
#define Py_INCREF(op) ( \
|
||||
_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
|
||||
((PyObject*)(op))->ob_refcnt++)
|
||||
|
||||
#define Py_DECREF(op) \
|
||||
do { \
|
||||
if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
|
||||
--((PyObject*)(op))->ob_refcnt != 0) \
|
||||
_Py_CHECK_REFCNT(op) \
|
||||
else \
|
||||
_Py_Dealloc((PyObject *)(op)); \
|
||||
} while (0)
|
||||
|
||||
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
|
||||
* and tp_dealloc implementatons.
|
||||
*
|
||||
* Note that "the obvious" code can be deadly:
|
||||
*
|
||||
* Py_XDECREF(op);
|
||||
* op = NULL;
|
||||
*
|
||||
* Typically, `op` is something like self->containee, and `self` is done
|
||||
* using its `containee` member. In the code sequence above, suppose
|
||||
* `containee` is non-NULL with a refcount of 1. Its refcount falls to
|
||||
* 0 on the first line, which can trigger an arbitrary amount of code,
|
||||
* possibly including finalizers (like __del__ methods or weakref callbacks)
|
||||
* coded in Python, which in turn can release the GIL and allow other threads
|
||||
* to run, etc. Such code may even invoke methods of `self` again, or cause
|
||||
* cyclic gc to trigger, but-- oops! --self->containee still points to the
|
||||
* object being torn down, and it may be in an insane state while being torn
|
||||
* down. This has in fact been a rich historic source of miserable (rare &
|
||||
* hard-to-diagnose) segfaulting (and other) bugs.
|
||||
*
|
||||
* The safe way is:
|
||||
*
|
||||
* Py_CLEAR(op);
|
||||
*
|
||||
* That arranges to set `op` to NULL _before_ decref'ing, so that any code
|
||||
* triggered as a side-effect of `op` getting torn down no longer believes
|
||||
* `op` points to a valid object.
|
||||
*
|
||||
* There are cases where it's safe to use the naive code, but they're brittle.
|
||||
* For example, if `op` points to a Python integer, you know that destroying
|
||||
* one of those can't cause problems -- but in part that relies on that
|
||||
* Python integers aren't currently weakly referencable. Best practice is
|
||||
* to use Py_CLEAR() even if you can't think of a reason for why you need to.
|
||||
*/
|
||||
#define Py_CLEAR(op) \
|
||||
do { \
|
||||
if (op) { \
|
||||
PyObject *_py_tmp = (PyObject *)(op); \
|
||||
(op) = NULL; \
|
||||
Py_DECREF(_py_tmp); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Macros to use in case the object pointer may be NULL: */
|
||||
#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
|
||||
#define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)
|
||||
|
||||
/*
|
||||
These are provided as conveniences to Python runtime embedders, so that
|
||||
they can have object code that is not dependent on Python compilation flags.
|
||||
*/
|
||||
PyAPI_FUNC(void) Py_IncRef(PyObject *);
|
||||
PyAPI_FUNC(void) Py_DecRef(PyObject *);
|
||||
|
||||
/*
|
||||
_Py_NoneStruct is an object of undefined type which can be used in contexts
|
||||
where NULL (nil) is not suitable (since NULL often means 'error').
|
||||
|
||||
Don't forget to apply Py_INCREF() when returning this value!!!
|
||||
*/
|
||||
PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */
|
||||
#define Py_None (&_Py_NoneStruct)
|
||||
|
||||
/* Macro for returning Py_None from a function */
|
||||
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
|
||||
|
||||
/*
|
||||
Py_NotImplemented is a singleton used to signal that an operation is
|
||||
not implemented for a given type combination.
|
||||
*/
|
||||
PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
|
||||
#define Py_NotImplemented (&_Py_NotImplementedStruct)
|
||||
|
||||
/* Rich comparison opcodes */
|
||||
#define Py_LT 0
|
||||
#define Py_LE 1
|
||||
#define Py_EQ 2
|
||||
#define Py_NE 3
|
||||
#define Py_GT 4
|
||||
#define Py_GE 5
|
||||
|
||||
/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE.
|
||||
* Defined in object.c.
|
||||
*/
|
||||
PyAPI_DATA(int) _Py_SwappedOp[];
|
||||
|
||||
/*
|
||||
Define staticforward and statichere for source compatibility with old
|
||||
C extensions.
|
||||
|
||||
The staticforward define was needed to support certain broken C
|
||||
compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the
|
||||
static keyword when it was used with a forward declaration of a static
|
||||
initialized structure. Standard C allows the forward declaration with
|
||||
static, and we've decided to stop catering to broken C compilers.
|
||||
(In fact, we expect that the compilers are all fixed eight years later.)
|
||||
*/
|
||||
|
||||
#define staticforward static
|
||||
#define statichere static
|
||||
|
||||
|
||||
/*
|
||||
More conventions
|
||||
================
|
||||
|
||||
Argument Checking
|
||||
-----------------
|
||||
|
||||
Functions that take objects as arguments normally don't check for nil
|
||||
arguments, but they do check the type of the argument, and return an
|
||||
error if the function doesn't apply to the type.
|
||||
|
||||
Failure Modes
|
||||
-------------
|
||||
|
||||
Functions may fail for a variety of reasons, including running out of
|
||||
memory. This is communicated to the caller in two ways: an error string
|
||||
is set (see errors.h), and the function result differs: functions that
|
||||
normally return a pointer return NULL for failure, functions returning
|
||||
an integer return -1 (which could be a legal return value too!), and
|
||||
other functions return 0 for success and -1 for failure.
|
||||
Callers should always check for errors before using the result. If
|
||||
an error was set, the caller must either explicitly clear it, or pass
|
||||
the error on to its caller.
|
||||
|
||||
Reference Counts
|
||||
----------------
|
||||
|
||||
It takes a while to get used to the proper usage of reference counts.
|
||||
|
||||
Functions that create an object set the reference count to 1; such new
|
||||
objects must be stored somewhere or destroyed again with Py_DECREF().
|
||||
Some functions that 'store' objects, such as PyTuple_SetItem() and
|
||||
PyList_SetItem(),
|
||||
don't increment the reference count of the object, since the most
|
||||
frequent use is to store a fresh object. Functions that 'retrieve'
|
||||
objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also
|
||||
don't increment
|
||||
the reference count, since most frequently the object is only looked at
|
||||
quickly. Thus, to retrieve an object and store it again, the caller
|
||||
must call Py_INCREF() explicitly.
|
||||
|
||||
NOTE: functions that 'consume' a reference count, like
|
||||
PyList_SetItem(), consume the reference even if the object wasn't
|
||||
successfully stored, to simplify error handling.
|
||||
|
||||
It seems attractive to make other functions that take an object as
|
||||
argument consume a reference count; however, this may quickly get
|
||||
confusing (even the current practice is already confusing). Consider
|
||||
it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at
|
||||
times.
|
||||
*/
|
||||
|
||||
|
||||
/* Trashcan mechanism, thanks to Christian Tismer.
|
||||
|
||||
When deallocating a container object, it's possible to trigger an unbounded
|
||||
chain of deallocations, as each Py_DECREF in turn drops the refcount on "the
|
||||
next" object in the chain to 0. This can easily lead to stack faults, and
|
||||
especially in threads (which typically have less stack space to work with).
|
||||
|
||||
A container object that participates in cyclic gc can avoid this by
|
||||
bracketing the body of its tp_dealloc function with a pair of macros:
|
||||
|
||||
static void
|
||||
mytype_dealloc(mytype *p)
|
||||
{
|
||||
... declarations go here ...
|
||||
|
||||
PyObject_GC_UnTrack(p); // must untrack first
|
||||
Py_TRASHCAN_SAFE_BEGIN(p)
|
||||
... The body of the deallocator goes here, including all calls ...
|
||||
... to Py_DECREF on contained objects. ...
|
||||
Py_TRASHCAN_SAFE_END(p)
|
||||
}
|
||||
|
||||
CAUTION: Never return from the middle of the body! If the body needs to
|
||||
"get out early", put a label immediately before the Py_TRASHCAN_SAFE_END
|
||||
call, and goto it. Else the call-depth counter (see below) will stay
|
||||
above 0 forever, and the trashcan will never get emptied.
|
||||
|
||||
How it works: The BEGIN macro increments a call-depth counter. So long
|
||||
as this counter is small, the body of the deallocator is run directly without
|
||||
further ado. But if the counter gets large, it instead adds p to a list of
|
||||
objects to be deallocated later, skips the body of the deallocator, and
|
||||
resumes execution after the END macro. The tp_dealloc routine then returns
|
||||
without deallocating anything (and so unbounded call-stack depth is avoided).
|
||||
|
||||
When the call stack finishes unwinding again, code generated by the END macro
|
||||
notices this, and calls another routine to deallocate all the objects that
|
||||
may have been added to the list of deferred deallocations. In effect, a
|
||||
chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces,
|
||||
with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL.
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*);
|
||||
PyAPI_FUNC(void) _PyTrash_destroy_chain(void);
|
||||
PyAPI_DATA(int) _PyTrash_delete_nesting;
|
||||
PyAPI_DATA(PyObject *) _PyTrash_delete_later;
|
||||
|
||||
#define PyTrash_UNWIND_LEVEL 50
|
||||
|
||||
#define Py_TRASHCAN_SAFE_BEGIN(op) \
|
||||
if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \
|
||||
++_PyTrash_delete_nesting;
|
||||
/* The body of the deallocator is here. */
|
||||
#define Py_TRASHCAN_SAFE_END(op) \
|
||||
--_PyTrash_delete_nesting; \
|
||||
if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \
|
||||
_PyTrash_destroy_chain(); \
|
||||
} \
|
||||
else \
|
||||
_PyTrash_deposit_object((PyObject*)op);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_OBJECT_H */
|
||||
@@ -1,354 +0,0 @@
|
||||
/* The PyObject_ memory family: high-level object memory interfaces.
|
||||
See pymem.h for the low-level PyMem_ family.
|
||||
*/
|
||||
|
||||
#ifndef Py_OBJIMPL_H
|
||||
#define Py_OBJIMPL_H
|
||||
|
||||
#include "pymem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* BEWARE:
|
||||
|
||||
Each interface exports both functions and macros. Extension modules should
|
||||
use the functions, to ensure binary compatibility across Python versions.
|
||||
Because the Python implementation is free to change internal details, and
|
||||
the macros may (or may not) expose details for speed, if you do use the
|
||||
macros you must recompile your extensions with each Python release.
|
||||
|
||||
Never mix calls to PyObject_ memory functions with calls to the platform
|
||||
malloc/realloc/ calloc/free, or with calls to PyMem_.
|
||||
*/
|
||||
|
||||
/*
|
||||
Functions and macros for modules that implement new object types.
|
||||
|
||||
- PyObject_New(type, typeobj) allocates memory for a new object of the given
|
||||
type, and initializes part of it. 'type' must be the C structure type used
|
||||
to represent the object, and 'typeobj' the address of the corresponding
|
||||
type object. Reference count and type pointer are filled in; the rest of
|
||||
the bytes of the object are *undefined*! The resulting expression type is
|
||||
'type *'. The size of the object is determined by the tp_basicsize field
|
||||
of the type object.
|
||||
|
||||
- PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size
|
||||
object with room for n items. In addition to the refcount and type pointer
|
||||
fields, this also fills in the ob_size field.
|
||||
|
||||
- PyObject_Del(op) releases the memory allocated for an object. It does not
|
||||
run a destructor -- it only frees the memory. PyObject_Free is identical.
|
||||
|
||||
- PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't
|
||||
allocate memory. Instead of a 'type' parameter, they take a pointer to a
|
||||
new object (allocated by an arbitrary allocator), and initialize its object
|
||||
header fields.
|
||||
|
||||
Note that objects created with PyObject_{New, NewVar} are allocated using the
|
||||
specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is
|
||||
enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG
|
||||
is also #defined.
|
||||
|
||||
In case a specific form of memory management is needed (for example, if you
|
||||
must use the platform malloc heap(s), or shared memory, or C++ local storage or
|
||||
operator new), you must first allocate the object with your custom allocator,
|
||||
then pass its pointer to PyObject_{Init, InitVar} for filling in its Python-
|
||||
specific fields: reference count, type pointer, possibly others. You should
|
||||
be aware that Python no control over these objects because they don't
|
||||
cooperate with the Python memory manager. Such objects may not be eligible
|
||||
for automatic garbage collection and you have to make sure that they are
|
||||
released accordingly whenever their destructor gets called (cf. the specific
|
||||
form of memory management you're using).
|
||||
|
||||
Unless you have specific memory management requirements, use
|
||||
PyObject_{New, NewVar, Del}.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Raw object memory interface
|
||||
* ===========================
|
||||
*/
|
||||
|
||||
/* Functions to call the same malloc/realloc/free as used by Python's
|
||||
object allocator. If WITH_PYMALLOC is enabled, these may differ from
|
||||
the platform malloc/realloc/free. The Python object allocator is
|
||||
designed for fast, cache-conscious allocation of many "small" objects,
|
||||
and with low hidden memory overhead.
|
||||
|
||||
PyObject_Malloc(0) returns a unique non-NULL pointer if possible.
|
||||
|
||||
PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n).
|
||||
PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory
|
||||
at p.
|
||||
|
||||
Returned pointers must be checked for NULL explicitly; no action is
|
||||
performed on failure other than to return NULL (no warning it printed, no
|
||||
exception is set, etc).
|
||||
|
||||
For allocating objects, use PyObject_{New, NewVar} instead whenever
|
||||
possible. The PyObject_{Malloc, Realloc, Free} family is exposed
|
||||
so that you can exploit Python's small-block allocator for non-object
|
||||
uses. If you must use these routines to allocate object memory, make sure
|
||||
the object gets initialized via PyObject_{Init, InitVar} after obtaining
|
||||
the raw memory.
|
||||
*/
|
||||
PyAPI_FUNC(void *) PyObject_Malloc(size_t);
|
||||
PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t);
|
||||
PyAPI_FUNC(void) PyObject_Free(void *);
|
||||
|
||||
|
||||
/* Macros */
|
||||
#ifdef WITH_PYMALLOC
|
||||
#ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */
|
||||
PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes);
|
||||
PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes);
|
||||
PyAPI_FUNC(void) _PyObject_DebugFree(void *p);
|
||||
PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p);
|
||||
PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p);
|
||||
PyAPI_FUNC(void) _PyObject_DebugMallocStats(void);
|
||||
PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes);
|
||||
PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes);
|
||||
PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p);
|
||||
PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p);
|
||||
PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes);
|
||||
PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes);
|
||||
PyAPI_FUNC(void) _PyMem_DebugFree(void *p);
|
||||
#define PyObject_MALLOC _PyObject_DebugMalloc
|
||||
#define PyObject_Malloc _PyObject_DebugMalloc
|
||||
#define PyObject_REALLOC _PyObject_DebugRealloc
|
||||
#define PyObject_Realloc _PyObject_DebugRealloc
|
||||
#define PyObject_FREE _PyObject_DebugFree
|
||||
#define PyObject_Free _PyObject_DebugFree
|
||||
|
||||
#else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */
|
||||
#define PyObject_MALLOC PyObject_Malloc
|
||||
#define PyObject_REALLOC PyObject_Realloc
|
||||
#define PyObject_FREE PyObject_Free
|
||||
#endif
|
||||
|
||||
#else /* ! WITH_PYMALLOC */
|
||||
#define PyObject_MALLOC PyMem_MALLOC
|
||||
#define PyObject_REALLOC PyMem_REALLOC
|
||||
#define PyObject_FREE PyMem_FREE
|
||||
|
||||
#endif /* WITH_PYMALLOC */
|
||||
|
||||
#define PyObject_Del PyObject_Free
|
||||
#define PyObject_DEL PyObject_FREE
|
||||
|
||||
/* for source compatibility with 2.2 */
|
||||
#define _PyObject_Del PyObject_Free
|
||||
|
||||
/*
|
||||
* Generic object allocator interface
|
||||
* ==================================
|
||||
*/
|
||||
|
||||
/* Functions */
|
||||
PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
|
||||
PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *,
|
||||
PyTypeObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
|
||||
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
|
||||
|
||||
#define PyObject_New(type, typeobj) \
|
||||
( (type *) _PyObject_New(typeobj) )
|
||||
#define PyObject_NewVar(type, typeobj, n) \
|
||||
( (type *) _PyObject_NewVar((typeobj), (n)) )
|
||||
|
||||
/* Macros trading binary compatibility for speed. See also pymem.h.
|
||||
Note that these macros expect non-NULL object pointers.*/
|
||||
#define PyObject_INIT(op, typeobj) \
|
||||
( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
|
||||
#define PyObject_INIT_VAR(op, typeobj, size) \
|
||||
( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
|
||||
|
||||
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
|
||||
|
||||
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
|
||||
vrbl-size object with nitems items, exclusive of gc overhead (if any). The
|
||||
value is rounded up to the closest multiple of sizeof(void *), in order to
|
||||
ensure that pointer fields at the end of the object are correctly aligned
|
||||
for the platform (this is of special importance for subclasses of, e.g.,
|
||||
str or long, so that pointers can be stored after the embedded data).
|
||||
|
||||
Note that there's no memory wastage in doing this, as malloc has to
|
||||
return (at worst) pointer-aligned memory anyway.
|
||||
*/
|
||||
#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0
|
||||
# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2"
|
||||
#endif
|
||||
|
||||
#define _PyObject_VAR_SIZE(typeobj, nitems) \
|
||||
(size_t) \
|
||||
( ( (typeobj)->tp_basicsize + \
|
||||
(nitems)*(typeobj)->tp_itemsize + \
|
||||
(SIZEOF_VOID_P - 1) \
|
||||
) & ~(SIZEOF_VOID_P - 1) \
|
||||
)
|
||||
|
||||
#define PyObject_NEW(type, typeobj) \
|
||||
( (type *) PyObject_Init( \
|
||||
(PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) )
|
||||
|
||||
#define PyObject_NEW_VAR(type, typeobj, n) \
|
||||
( (type *) PyObject_InitVar( \
|
||||
(PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\
|
||||
(typeobj), (n)) )
|
||||
|
||||
/* This example code implements an object constructor with a custom
|
||||
allocator, where PyObject_New is inlined, and shows the important
|
||||
distinction between two steps (at least):
|
||||
1) the actual allocation of the object storage;
|
||||
2) the initialization of the Python specific fields
|
||||
in this storage with PyObject_{Init, InitVar}.
|
||||
|
||||
PyObject *
|
||||
YourObject_New(...)
|
||||
{
|
||||
PyObject *op;
|
||||
|
||||
op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
|
||||
if (op == NULL)
|
||||
return PyErr_NoMemory();
|
||||
|
||||
PyObject_Init(op, &YourTypeStruct);
|
||||
|
||||
op->ob_field = value;
|
||||
...
|
||||
return op;
|
||||
}
|
||||
|
||||
Note that in C++, the use of the new operator usually implies that
|
||||
the 1st step is performed automatically for you, so in a C++ class
|
||||
constructor you would start directly with PyObject_Init/InitVar
|
||||
*/
|
||||
|
||||
/*
|
||||
* Garbage Collection Support
|
||||
* ==========================
|
||||
*/
|
||||
|
||||
/* C equivalent of gc.collect(). */
|
||||
PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
|
||||
|
||||
/* Test if a type has a GC head */
|
||||
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
|
||||
|
||||
/* Test if an object has a GC head */
|
||||
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
|
||||
(Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
|
||||
|
||||
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
|
||||
#define PyObject_GC_Resize(type, op, n) \
|
||||
( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
|
||||
|
||||
/* for source compatibility with 2.2 */
|
||||
#define _PyObject_GC_Del PyObject_GC_Del
|
||||
|
||||
/* GC information is stored BEFORE the object structure. */
|
||||
typedef union _gc_head {
|
||||
struct {
|
||||
union _gc_head *gc_next;
|
||||
union _gc_head *gc_prev;
|
||||
Py_ssize_t gc_refs;
|
||||
} gc;
|
||||
long double dummy; /* force worst-case alignment */
|
||||
} PyGC_Head;
|
||||
|
||||
extern PyGC_Head *_PyGC_generation0;
|
||||
|
||||
#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1)
|
||||
|
||||
#define _PyGC_REFS_UNTRACKED (-2)
|
||||
#define _PyGC_REFS_REACHABLE (-3)
|
||||
#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4)
|
||||
|
||||
/* Tell the GC to track this object. NB: While the object is tracked the
|
||||
* collector it must be safe to call the ob_traverse method. */
|
||||
#define _PyObject_GC_TRACK(o) do { \
|
||||
PyGC_Head *g = _Py_AS_GC(o); \
|
||||
if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \
|
||||
Py_FatalError("GC object already tracked"); \
|
||||
g->gc.gc_refs = _PyGC_REFS_REACHABLE; \
|
||||
g->gc.gc_next = _PyGC_generation0; \
|
||||
g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \
|
||||
g->gc.gc_prev->gc.gc_next = g; \
|
||||
_PyGC_generation0->gc.gc_prev = g; \
|
||||
} while (0);
|
||||
|
||||
/* Tell the GC to stop tracking this object.
|
||||
* gc_next doesn't need to be set to NULL, but doing so is a good
|
||||
* way to provoke memory errors if calling code is confused.
|
||||
*/
|
||||
#define _PyObject_GC_UNTRACK(o) do { \
|
||||
PyGC_Head *g = _Py_AS_GC(o); \
|
||||
assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \
|
||||
g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \
|
||||
g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \
|
||||
g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \
|
||||
g->gc.gc_next = NULL; \
|
||||
} while (0);
|
||||
|
||||
/* True if the object is currently tracked by the GC. */
|
||||
#define _PyObject_GC_IS_TRACKED(o) \
|
||||
((_Py_AS_GC(o))->gc.gc_refs != _PyGC_REFS_UNTRACKED)
|
||||
|
||||
/* True if the object may be tracked by the GC in the future, or already is.
|
||||
This can be useful to implement some optimizations. */
|
||||
#define _PyObject_GC_MAY_BE_TRACKED(obj) \
|
||||
(PyObject_IS_GC(obj) && \
|
||||
(!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
|
||||
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t);
|
||||
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
|
||||
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(void) PyObject_GC_Track(void *);
|
||||
PyAPI_FUNC(void) PyObject_GC_UnTrack(void *);
|
||||
PyAPI_FUNC(void) PyObject_GC_Del(void *);
|
||||
|
||||
#define PyObject_GC_New(type, typeobj) \
|
||||
( (type *) _PyObject_GC_New(typeobj) )
|
||||
#define PyObject_GC_NewVar(type, typeobj, n) \
|
||||
( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
|
||||
|
||||
|
||||
/* Utility macro to help write tp_traverse functions.
|
||||
* To use this macro, the tp_traverse function must name its arguments
|
||||
* "visit" and "arg". This is intended to keep tp_traverse functions
|
||||
* looking as much alike as possible.
|
||||
*/
|
||||
#define Py_VISIT(op) \
|
||||
do { \
|
||||
if (op) { \
|
||||
int vret = visit((PyObject *)(op), arg); \
|
||||
if (vret) \
|
||||
return vret; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* This is here for the sake of backwards compatibility. Extensions that
|
||||
* use the old GC API will still compile but the objects will not be
|
||||
* tracked by the GC. */
|
||||
#define PyGC_HEAD_SIZE 0
|
||||
#define PyObject_GC_Init(op)
|
||||
#define PyObject_GC_Fini(op)
|
||||
#define PyObject_AS_GC(op) (op)
|
||||
#define PyObject_FROM_GC(op) (op)
|
||||
|
||||
|
||||
/* Test if a type supports weak references */
|
||||
#define PyType_SUPPORTS_WEAKREFS(t) \
|
||||
(PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \
|
||||
&& ((t)->tp_weaklistoffset > 0))
|
||||
|
||||
#define PyObject_GET_WEAKREFS_LISTPTR(o) \
|
||||
((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_OBJIMPL_H */
|
||||
@@ -1,162 +0,0 @@
|
||||
#ifndef Py_OPCODE_H
|
||||
#define Py_OPCODE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Instruction opcodes for compiled code */
|
||||
|
||||
#define STOP_CODE 0
|
||||
#define POP_TOP 1
|
||||
#define ROT_TWO 2
|
||||
#define ROT_THREE 3
|
||||
#define DUP_TOP 4
|
||||
#define ROT_FOUR 5
|
||||
#define NOP 9
|
||||
|
||||
#define UNARY_POSITIVE 10
|
||||
#define UNARY_NEGATIVE 11
|
||||
#define UNARY_NOT 12
|
||||
#define UNARY_CONVERT 13
|
||||
|
||||
#define UNARY_INVERT 15
|
||||
|
||||
#define BINARY_POWER 19
|
||||
|
||||
#define BINARY_MULTIPLY 20
|
||||
#define BINARY_DIVIDE 21
|
||||
#define BINARY_MODULO 22
|
||||
#define BINARY_ADD 23
|
||||
#define BINARY_SUBTRACT 24
|
||||
#define BINARY_SUBSCR 25
|
||||
#define BINARY_FLOOR_DIVIDE 26
|
||||
#define BINARY_TRUE_DIVIDE 27
|
||||
#define INPLACE_FLOOR_DIVIDE 28
|
||||
#define INPLACE_TRUE_DIVIDE 29
|
||||
|
||||
#define SLICE 30
|
||||
/* Also uses 31-33 */
|
||||
|
||||
#define STORE_SLICE 40
|
||||
/* Also uses 41-43 */
|
||||
|
||||
#define DELETE_SLICE 50
|
||||
/* Also uses 51-53 */
|
||||
|
||||
#define STORE_MAP 54
|
||||
#define INPLACE_ADD 55
|
||||
#define INPLACE_SUBTRACT 56
|
||||
#define INPLACE_MULTIPLY 57
|
||||
#define INPLACE_DIVIDE 58
|
||||
#define INPLACE_MODULO 59
|
||||
#define STORE_SUBSCR 60
|
||||
#define DELETE_SUBSCR 61
|
||||
|
||||
#define BINARY_LSHIFT 62
|
||||
#define BINARY_RSHIFT 63
|
||||
#define BINARY_AND 64
|
||||
#define BINARY_XOR 65
|
||||
#define BINARY_OR 66
|
||||
#define INPLACE_POWER 67
|
||||
#define GET_ITER 68
|
||||
|
||||
#define PRINT_EXPR 70
|
||||
#define PRINT_ITEM 71
|
||||
#define PRINT_NEWLINE 72
|
||||
#define PRINT_ITEM_TO 73
|
||||
#define PRINT_NEWLINE_TO 74
|
||||
#define INPLACE_LSHIFT 75
|
||||
#define INPLACE_RSHIFT 76
|
||||
#define INPLACE_AND 77
|
||||
#define INPLACE_XOR 78
|
||||
#define INPLACE_OR 79
|
||||
#define BREAK_LOOP 80
|
||||
#define WITH_CLEANUP 81
|
||||
#define LOAD_LOCALS 82
|
||||
#define RETURN_VALUE 83
|
||||
#define IMPORT_STAR 84
|
||||
#define EXEC_STMT 85
|
||||
#define YIELD_VALUE 86
|
||||
#define POP_BLOCK 87
|
||||
#define END_FINALLY 88
|
||||
#define BUILD_CLASS 89
|
||||
|
||||
#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
|
||||
|
||||
#define STORE_NAME 90 /* Index in name list */
|
||||
#define DELETE_NAME 91 /* "" */
|
||||
#define UNPACK_SEQUENCE 92 /* Number of sequence items */
|
||||
#define FOR_ITER 93
|
||||
#define LIST_APPEND 94
|
||||
|
||||
#define STORE_ATTR 95 /* Index in name list */
|
||||
#define DELETE_ATTR 96 /* "" */
|
||||
#define STORE_GLOBAL 97 /* "" */
|
||||
#define DELETE_GLOBAL 98 /* "" */
|
||||
#define DUP_TOPX 99 /* number of items to duplicate */
|
||||
#define LOAD_CONST 100 /* Index in const list */
|
||||
#define LOAD_NAME 101 /* Index in name list */
|
||||
#define BUILD_TUPLE 102 /* Number of tuple items */
|
||||
#define BUILD_LIST 103 /* Number of list items */
|
||||
#define BUILD_SET 104 /* Number of set items */
|
||||
#define BUILD_MAP 105 /* Always zero for now */
|
||||
#define LOAD_ATTR 106 /* Index in name list */
|
||||
#define COMPARE_OP 107 /* Comparison operator */
|
||||
#define IMPORT_NAME 108 /* Index in name list */
|
||||
#define IMPORT_FROM 109 /* Index in name list */
|
||||
#define JUMP_FORWARD 110 /* Number of bytes to skip */
|
||||
|
||||
#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning
|
||||
of code */
|
||||
#define JUMP_IF_TRUE_OR_POP 112 /* "" */
|
||||
#define JUMP_ABSOLUTE 113 /* "" */
|
||||
#define POP_JUMP_IF_FALSE 114 /* "" */
|
||||
#define POP_JUMP_IF_TRUE 115 /* "" */
|
||||
|
||||
#define LOAD_GLOBAL 116 /* Index in name list */
|
||||
|
||||
#define CONTINUE_LOOP 119 /* Start of loop (absolute) */
|
||||
#define SETUP_LOOP 120 /* Target address (relative) */
|
||||
#define SETUP_EXCEPT 121 /* "" */
|
||||
#define SETUP_FINALLY 122 /* "" */
|
||||
|
||||
#define LOAD_FAST 124 /* Local variable number */
|
||||
#define STORE_FAST 125 /* Local variable number */
|
||||
#define DELETE_FAST 126 /* Local variable number */
|
||||
|
||||
#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
|
||||
/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
|
||||
#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
|
||||
#define MAKE_FUNCTION 132 /* #defaults */
|
||||
#define BUILD_SLICE 133 /* Number of items */
|
||||
|
||||
#define MAKE_CLOSURE 134 /* #free vars */
|
||||
#define LOAD_CLOSURE 135 /* Load free variable from closure */
|
||||
#define LOAD_DEREF 136 /* Load and dereference from closure cell */
|
||||
#define STORE_DEREF 137 /* Store into cell */
|
||||
|
||||
/* The next 3 opcodes must be contiguous and satisfy
|
||||
(CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */
|
||||
#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */
|
||||
#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */
|
||||
#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */
|
||||
|
||||
#define SETUP_WITH 143
|
||||
|
||||
/* Support for opargs more than 16 bits long */
|
||||
#define EXTENDED_ARG 145
|
||||
|
||||
#define SET_ADD 146
|
||||
#define MAP_ADD 147
|
||||
|
||||
|
||||
enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE,
|
||||
PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
|
||||
|
||||
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_OPCODE_H */
|
||||
@@ -1,55 +0,0 @@
|
||||
#ifndef Py_OSDEFS_H
|
||||
#define Py_OSDEFS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Operating system dependencies */
|
||||
|
||||
/* Mod by chrish: QNX has WATCOM, but isn't DOS */
|
||||
#if !defined(__QNX__)
|
||||
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)
|
||||
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
||||
#define MAXPATHLEN 260
|
||||
#define SEP '/'
|
||||
#define ALTSEP '\\'
|
||||
#else
|
||||
#define SEP '\\'
|
||||
#define ALTSEP '/'
|
||||
#define MAXPATHLEN 256
|
||||
#endif
|
||||
#define DELIM ';'
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RISCOS
|
||||
#define SEP '.'
|
||||
#define MAXPATHLEN 256
|
||||
#define DELIM ','
|
||||
#endif
|
||||
|
||||
|
||||
/* Filename separator */
|
||||
#ifndef SEP
|
||||
#define SEP '/'
|
||||
#endif
|
||||
|
||||
/* Max pathname length */
|
||||
#ifndef MAXPATHLEN
|
||||
#if defined(PATH_MAX) && PATH_MAX > 1024
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#else
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Search path entry delimiter */
|
||||
#ifndef DELIM
|
||||
#define DELIM ':'
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_OSDEFS_H */
|
||||
@@ -1,64 +0,0 @@
|
||||
|
||||
/* Parser-tokenizer link interface */
|
||||
|
||||
#ifndef Py_PARSETOK_H
|
||||
#define Py_PARSETOK_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int error;
|
||||
const char *filename;
|
||||
int lineno;
|
||||
int offset;
|
||||
char *text;
|
||||
int token;
|
||||
int expected;
|
||||
} perrdetail;
|
||||
|
||||
#if 0
|
||||
#define PyPARSE_YIELD_IS_KEYWORD 0x0001
|
||||
#endif
|
||||
|
||||
#define PyPARSE_DONT_IMPLY_DEDENT 0x0002
|
||||
|
||||
#if 0
|
||||
#define PyPARSE_WITH_IS_KEYWORD 0x0003
|
||||
#endif
|
||||
|
||||
#define PyPARSE_PRINT_IS_FUNCTION 0x0004
|
||||
#define PyPARSE_UNICODE_LITERALS 0x0008
|
||||
|
||||
|
||||
|
||||
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
|
||||
perrdetail *);
|
||||
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
|
||||
char *, char *, perrdetail *);
|
||||
|
||||
PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
|
||||
perrdetail *, int);
|
||||
PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *,
|
||||
int, char *, char *,
|
||||
perrdetail *, int);
|
||||
PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *,
|
||||
int, char *, char *,
|
||||
perrdetail *, int *);
|
||||
|
||||
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
|
||||
const char *,
|
||||
grammar *, int,
|
||||
perrdetail *, int);
|
||||
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *,
|
||||
const char *,
|
||||
grammar *, int,
|
||||
perrdetail *, int *);
|
||||
|
||||
/* Note that he following function is defined in pythonrun.c not parsetok.c. */
|
||||
PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_PARSETOK_H */
|
||||
@@ -1,43 +0,0 @@
|
||||
|
||||
/* Newfangled version identification scheme.
|
||||
|
||||
This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL
|
||||
was available. To test for presence of the scheme, test for
|
||||
defined(PY_MAJOR_VERSION).
|
||||
|
||||
When the major or minor version changes, the VERSION variable in
|
||||
configure.in must also be changed.
|
||||
|
||||
There is also (independent) API version information in modsupport.h.
|
||||
*/
|
||||
|
||||
/* Values for PY_RELEASE_LEVEL */
|
||||
#define PY_RELEASE_LEVEL_ALPHA 0xA
|
||||
#define PY_RELEASE_LEVEL_BETA 0xB
|
||||
#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */
|
||||
#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */
|
||||
/* Higher for patch releases */
|
||||
|
||||
/* Version parsed out into numeric values */
|
||||
/*--start constants--*/
|
||||
#define PY_MAJOR_VERSION 2
|
||||
#define PY_MINOR_VERSION 7
|
||||
#define PY_MICRO_VERSION 3
|
||||
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
|
||||
#define PY_RELEASE_SERIAL 0
|
||||
|
||||
/* Version as a string */
|
||||
#define PY_VERSION "2.7.3"
|
||||
/*--end constants--*/
|
||||
|
||||
/* Subversion Revision number of this file (not of the repository). Empty
|
||||
since Mercurial migration. */
|
||||
#define PY_PATCHLEVEL_REVISION ""
|
||||
|
||||
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
|
||||
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
|
||||
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
|
||||
(PY_MINOR_VERSION << 16) | \
|
||||
(PY_MICRO_VERSION << 8) | \
|
||||
(PY_RELEASE_LEVEL << 4) | \
|
||||
(PY_RELEASE_SERIAL << 0))
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef Py_PGEN_H
|
||||
#define Py_PGEN_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Parser generator interface */
|
||||
|
||||
extern grammar *meta_grammar(void);
|
||||
|
||||
struct _node;
|
||||
extern grammar *pgen(struct _node *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_PGEN_H */
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef Py_PGENHEADERS_H
|
||||
#define Py_PGENHEADERS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Include files and extern declarations used by most of the parser. */
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
||||
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
|
||||
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||
|
||||
#define addarc _Py_addarc
|
||||
#define addbit _Py_addbit
|
||||
#define adddfa _Py_adddfa
|
||||
#define addfirstsets _Py_addfirstsets
|
||||
#define addlabel _Py_addlabel
|
||||
#define addstate _Py_addstate
|
||||
#define delbitset _Py_delbitset
|
||||
#define dumptree _Py_dumptree
|
||||
#define findlabel _Py_findlabel
|
||||
#define mergebitset _Py_mergebitset
|
||||
#define meta_grammar _Py_meta_grammar
|
||||
#define newbitset _Py_newbitset
|
||||
#define newgrammar _Py_newgrammar
|
||||
#define pgen _Py_pgen
|
||||
#define printgrammar _Py_printgrammar
|
||||
#define printnonterminals _Py_printnonterminals
|
||||
#define printtree _Py_printtree
|
||||
#define samebitset _Py_samebitset
|
||||
#define showtree _Py_showtree
|
||||
#define tok_dump _Py_tok_dump
|
||||
#define translatelabels _Py_translatelabels
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_PGENHEADERS_H */
|
||||
@@ -1,176 +0,0 @@
|
||||
|
||||
#ifndef Py_CURSES_H
|
||||
#define Py_CURSES_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards
|
||||
** against multiple definition of wchar_t.
|
||||
*/
|
||||
#ifdef _BSD_WCHAR_T_DEFINED_
|
||||
#define _WCHAR_T
|
||||
#endif
|
||||
|
||||
/* the following define is necessary for OS X 10.6; without it, the
|
||||
Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
|
||||
can't get at the WINDOW flags field. */
|
||||
#define NCURSES_OPAQUE 0
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
|
||||
** against multiple definition of wchar_t and wint_t.
|
||||
*/
|
||||
#ifdef _XOPEN_SOURCE_EXTENDED
|
||||
#ifndef __FreeBSD_version
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
#if __FreeBSD_version >= 500000
|
||||
#ifndef __wchar_t
|
||||
#define __wchar_t
|
||||
#endif
|
||||
#ifndef __wint_t
|
||||
#define __wint_t
|
||||
#endif
|
||||
#else
|
||||
#ifndef _WCHAR_T
|
||||
#define _WCHAR_T
|
||||
#endif
|
||||
#ifndef _WINT_T
|
||||
#define _WINT_T
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#ifdef HAVE_TERM_H
|
||||
/* for tigetstr, which is not declared in SysV curses */
|
||||
#include <term.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NCURSES_H
|
||||
/* configure was checking <curses.h>, but we will
|
||||
use <ncurses.h>, which has all these features. */
|
||||
#ifndef WINDOW_HAS_FLAGS
|
||||
#define WINDOW_HAS_FLAGS 1
|
||||
#endif
|
||||
#ifndef MVWDELCH_IS_EXPRESSION
|
||||
#define MVWDELCH_IS_EXPRESSION 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PyCurses_API_pointers 4
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
WINDOW *win;
|
||||
} PyCursesWindowObject;
|
||||
|
||||
#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type)
|
||||
|
||||
#define PyCurses_CAPSULE_NAME "_curses._C_API"
|
||||
|
||||
|
||||
#ifdef CURSES_MODULE
|
||||
/* This section is used when compiling _cursesmodule.c */
|
||||
|
||||
#else
|
||||
/* This section is used in modules that use the _cursesmodule API */
|
||||
|
||||
static void **PyCurses_API;
|
||||
|
||||
#define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0])
|
||||
#define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;}
|
||||
#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;}
|
||||
#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;}
|
||||
|
||||
#define import_curses() \
|
||||
PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);
|
||||
|
||||
#endif
|
||||
|
||||
/* general error messages */
|
||||
static char *catchall_ERR = "curses function returned ERR";
|
||||
static char *catchall_NULL = "curses function returned NULL";
|
||||
|
||||
/* Function Prototype Macros - They are ugly but very, very useful. ;-)
|
||||
|
||||
X - function name
|
||||
TYPE - parameter Type
|
||||
ERGSTR - format string for construction of the return value
|
||||
PARSESTR - format string for argument parsing
|
||||
*/
|
||||
|
||||
#define NoArgNoReturnFunction(X) \
|
||||
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||
{ \
|
||||
PyCursesInitialised \
|
||||
return PyCursesCheckERR(X(), # X); }
|
||||
|
||||
#define NoArgOrFlagNoReturnFunction(X) \
|
||||
static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
int flag = 0; \
|
||||
PyCursesInitialised \
|
||||
switch(PyTuple_Size(args)) { \
|
||||
case 0: \
|
||||
return PyCursesCheckERR(X(), # X); \
|
||||
case 1: \
|
||||
if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \
|
||||
if (flag) return PyCursesCheckERR(X(), # X); \
|
||||
else return PyCursesCheckERR(no ## X (), # X); \
|
||||
default: \
|
||||
PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \
|
||||
return NULL; } }
|
||||
|
||||
#define NoArgReturnIntFunction(X) \
|
||||
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||
{ \
|
||||
PyCursesInitialised \
|
||||
return PyInt_FromLong((long) X()); }
|
||||
|
||||
|
||||
#define NoArgReturnStringFunction(X) \
|
||||
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||
{ \
|
||||
PyCursesInitialised \
|
||||
return PyString_FromString(X()); }
|
||||
|
||||
#define NoArgTrueFalseFunction(X) \
|
||||
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||
{ \
|
||||
PyCursesInitialised \
|
||||
if (X () == FALSE) { \
|
||||
Py_INCREF(Py_False); \
|
||||
return Py_False; \
|
||||
} \
|
||||
Py_INCREF(Py_True); \
|
||||
return Py_True; }
|
||||
|
||||
#define NoArgNoReturnVoidFunction(X) \
|
||||
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||
{ \
|
||||
PyCursesInitialised \
|
||||
X(); \
|
||||
Py_INCREF(Py_None); \
|
||||
return Py_None; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !defined(Py_CURSES_H) */
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* An arena-like memory interface for the compiler.
|
||||
*/
|
||||
|
||||
#ifndef Py_PYARENA_H
|
||||
#define Py_PYARENA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _arena PyArena;
|
||||
|
||||
/* PyArena_New() and PyArena_Free() create a new arena and free it,
|
||||
respectively. Once an arena has been created, it can be used
|
||||
to allocate memory via PyArena_Malloc(). Pointers to PyObject can
|
||||
also be registered with the arena via PyArena_AddPyObject(), and the
|
||||
arena will ensure that the PyObjects stay alive at least until
|
||||
PyArena_Free() is called. When an arena is freed, all the memory it
|
||||
allocated is freed, the arena releases internal references to registered
|
||||
PyObject*, and none of its pointers are valid.
|
||||
XXX (tim) What does "none of its pointers are valid" mean? Does it
|
||||
XXX mean that pointers previously obtained via PyArena_Malloc() are
|
||||
XXX no longer valid? (That's clearly true, but not sure that's what
|
||||
XXX the text is trying to say.)
|
||||
|
||||
PyArena_New() returns an arena pointer. On error, it
|
||||
returns a negative number and sets an exception.
|
||||
XXX (tim): Not true. On error, PyArena_New() actually returns NULL,
|
||||
XXX and looks like it may or may not set an exception (e.g., if the
|
||||
XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on
|
||||
XXX and an exception is set; OTOH, if the internal
|
||||
XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
|
||||
XXX an exception is not set in that case).
|
||||
*/
|
||||
PyAPI_FUNC(PyArena *) PyArena_New(void);
|
||||
PyAPI_FUNC(void) PyArena_Free(PyArena *);
|
||||
|
||||
/* Mostly like malloc(), return the address of a block of memory spanning
|
||||
* `size` bytes, or return NULL (without setting an exception) if enough
|
||||
* new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with
|
||||
* size=0 does not guarantee to return a unique pointer (the pointer
|
||||
* returned may equal one or more other pointers obtained from
|
||||
* PyArena_Malloc()).
|
||||
* Note that pointers obtained via PyArena_Malloc() must never be passed to
|
||||
* the system free() or realloc(), or to any of Python's similar memory-
|
||||
* management functions. PyArena_Malloc()-obtained pointers remain valid
|
||||
* until PyArena_Free(ar) is called, at which point all pointers obtained
|
||||
* from the arena `ar` become invalid simultaneously.
|
||||
*/
|
||||
PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size);
|
||||
|
||||
/* This routine isn't a proper arena allocation routine. It takes
|
||||
* a PyObject* and records it so that it can be DECREFed when the
|
||||
* arena is freed.
|
||||
*/
|
||||
PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !Py_PYARENA_H */
|
||||
@@ -1,56 +0,0 @@
|
||||
|
||||
/* Capsule objects let you wrap a C "void *" pointer in a Python
|
||||
object. They're a way of passing data through the Python interpreter
|
||||
without creating your own custom type.
|
||||
|
||||
Capsules are used for communication between extension modules.
|
||||
They provide a way for an extension module to export a C interface
|
||||
to other extension modules, so that extension modules can use the
|
||||
Python import mechanism to link to one another.
|
||||
|
||||
For more information, please see "c-api/capsule.html" in the
|
||||
documentation.
|
||||
*/
|
||||
|
||||
#ifndef Py_CAPSULE_H
|
||||
#define Py_CAPSULE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCapsule_Type;
|
||||
|
||||
typedef void (*PyCapsule_Destructor)(PyObject *);
|
||||
|
||||
#define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type)
|
||||
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCapsule_New(
|
||||
void *pointer,
|
||||
const char *name,
|
||||
PyCapsule_Destructor destructor);
|
||||
|
||||
PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name);
|
||||
|
||||
PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule);
|
||||
|
||||
PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule);
|
||||
|
||||
PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule);
|
||||
|
||||
PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name);
|
||||
|
||||
PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer);
|
||||
|
||||
PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor);
|
||||
|
||||
PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name);
|
||||
|
||||
PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context);
|
||||
|
||||
PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_CAPSULE_H */
|
||||
@@ -1,759 +0,0 @@
|
||||
#ifndef Py_CONFIG_H
|
||||
#define Py_CONFIG_H
|
||||
|
||||
/* pyconfig.h. NOT Generated automatically by configure.
|
||||
|
||||
This is a manually maintained version used for the Watcom,
|
||||
Borland and Microsoft Visual C++ compilers. It is a
|
||||
standard part of the Python distribution.
|
||||
|
||||
WINDOWS DEFINES:
|
||||
The code specific to Windows should be wrapped around one of
|
||||
the following #defines
|
||||
|
||||
MS_WIN64 - Code specific to the MS Win64 API
|
||||
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
|
||||
MS_WINDOWS - Code specific to Windows, but all versions.
|
||||
MS_WINCE - Code specific to Windows CE
|
||||
Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
|
||||
|
||||
Also note that neither "_M_IX86" or "_MSC_VER" should be used for
|
||||
any purpose other than "Windows Intel x86 specific" and "Microsoft
|
||||
compiler specific". Therefore, these should be very rare.
|
||||
|
||||
|
||||
NOTE: The following symbols are deprecated:
|
||||
NT, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT
|
||||
MS_CORE_DLL.
|
||||
|
||||
WIN32 is still required for the locale module.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#define MS_WINCE
|
||||
#endif
|
||||
|
||||
/* Deprecated USE_DL_EXPORT macro - please use Py_BUILD_CORE */
|
||||
#ifdef USE_DL_EXPORT
|
||||
# define Py_BUILD_CORE
|
||||
#endif /* USE_DL_EXPORT */
|
||||
|
||||
/* Visual Studio 2005 introduces deprecation warnings for
|
||||
"insecure" and POSIX functions. The insecure functions should
|
||||
be replaced by *_s versions (according to Microsoft); the
|
||||
POSIX functions by _* versions (which, according to Microsoft,
|
||||
would be ISO C conforming). Neither renaming is feasible, so
|
||||
we just silence the warnings. */
|
||||
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#endif
|
||||
#ifndef _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
/* Windows CE does not have these */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_IO_H
|
||||
#define HAVE_SYS_UTIME_H
|
||||
#define HAVE_TEMPNAM
|
||||
#define HAVE_TMPFILE
|
||||
#define HAVE_TMPNAM
|
||||
#define HAVE_CLOCK
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_HYPOT
|
||||
#define HAVE_STRFTIME
|
||||
#define DONT_HAVE_SIG_ALARM
|
||||
#define DONT_HAVE_SIG_PAUSE
|
||||
#define LONG_BIT 32
|
||||
#define WORD_BIT 32
|
||||
#define PREFIX ""
|
||||
#define EXEC_PREFIX ""
|
||||
|
||||
#define MS_WIN32 /* only support win32 and greater. */
|
||||
#define MS_WINDOWS
|
||||
#ifndef PYTHONPATH
|
||||
# define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
|
||||
#endif
|
||||
#define NT_THREADS
|
||||
#define WITH_THREAD
|
||||
#ifndef NETSCAPE_PI
|
||||
#define USE_SOCKET
|
||||
#endif
|
||||
|
||||
/* CE6 doesn't have strdup() but _strdup(). Assume the same for earlier versions. */
|
||||
#if defined(MS_WINCE)
|
||||
# include <stdlib.h>
|
||||
# define strdup _strdup
|
||||
#endif
|
||||
|
||||
#ifdef MS_WINCE
|
||||
/* Windows CE does not support environment variables */
|
||||
#define getenv(v) (NULL)
|
||||
#define environ (NULL)
|
||||
#endif
|
||||
|
||||
/* Compiler specific defines */
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* Microsoft C defines _MSC_VER */
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
|
||||
* This is horridly tricky, because the stringization operator only works
|
||||
* on macro arguments, and doesn't evaluate macros passed *as* arguments.
|
||||
* Attempts simpler than the following appear doomed to produce "_MSC_VER"
|
||||
* literally in the string.
|
||||
*/
|
||||
#define _Py_PASTE_VERSION(SUFFIX) \
|
||||
("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]")
|
||||
/* e.g., this produces, after compile-time string catenation,
|
||||
* ("[MSC v.1200 32 bit (Intel)]")
|
||||
*
|
||||
* _Py_STRINGIZE(_MSC_VER) expands to
|
||||
* _Py_STRINGIZE1((_MSC_VER)) expands to
|
||||
* _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
|
||||
* it's scanned again for macros and so further expands to (under MSVC 6)
|
||||
* _Py_STRINGIZE2(1200) which then expands to
|
||||
* "1200"
|
||||
*/
|
||||
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
||||
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
||||
#define _Py_STRINGIZE2(X) #X
|
||||
|
||||
/* MSVC defines _WINxx to differentiate the windows platform types
|
||||
|
||||
Note that for compatibility reasons _WIN32 is defined on Win32
|
||||
*and* on Win64. For the same reasons, in Python, MS_WIN32 is
|
||||
defined on Win32 *and* Win64. Win32 only code must therefore be
|
||||
guarded as follows:
|
||||
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
||||
Some modules are disabled on Itanium processors, therefore we
|
||||
have MS_WINI64 set for those targets, otherwise MS_WINX64
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
#define MS_WIN64
|
||||
#endif
|
||||
|
||||
/* set the COMPILER */
|
||||
#ifdef MS_WIN64
|
||||
#if defined(_M_IA64)
|
||||
#define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)")
|
||||
#define MS_WINI64
|
||||
#elif defined(_M_X64) || defined(_M_AMD64)
|
||||
#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
|
||||
#define MS_WINX64
|
||||
#else
|
||||
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
|
||||
#endif
|
||||
#endif /* MS_WIN64 */
|
||||
|
||||
/* set the version macros for the windows headers */
|
||||
#ifdef MS_WINX64
|
||||
/* 64 bit only runs on XP or greater */
|
||||
#define Py_WINVER _WIN32_WINNT_WINXP
|
||||
#define Py_NTDDI NTDDI_WINXP
|
||||
#else
|
||||
/* Python 2.6+ requires Windows 2000 or greater */
|
||||
#ifdef _WIN32_WINNT_WIN2K
|
||||
#define Py_WINVER _WIN32_WINNT_WIN2K
|
||||
#else
|
||||
#define Py_WINVER 0x0500
|
||||
#endif
|
||||
#define Py_NTDDI NTDDI_WIN2KSP4
|
||||
#endif
|
||||
|
||||
/* We only set these values when building Python - we don't want to force
|
||||
these values on extensions, as that will affect the prototypes and
|
||||
structures exposed in the Windows headers. Even when building Python, we
|
||||
allow a single source file to override this - they may need access to
|
||||
structures etc so it can optionally use new Windows features if it
|
||||
determines at runtime they are available.
|
||||
*/
|
||||
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE)
|
||||
#ifndef NTDDI_VERSION
|
||||
#define NTDDI_VERSION Py_NTDDI
|
||||
#endif
|
||||
#ifndef WINVER
|
||||
#define WINVER Py_WINVER
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT Py_WINVER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* _W64 is not defined for VC6 or eVC4 */
|
||||
#ifndef _W64
|
||||
#define _W64
|
||||
#endif
|
||||
|
||||
/* Define like size_t, omitting the "unsigned" */
|
||||
#ifdef MS_WIN64
|
||||
typedef __int64 ssize_t;
|
||||
#else
|
||||
typedef _W64 int ssize_t;
|
||||
#endif
|
||||
#define HAVE_SSIZE_T 1
|
||||
|
||||
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
||||
#ifdef _M_IX86
|
||||
#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
|
||||
#else
|
||||
#define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
|
||||
#endif
|
||||
#endif /* MS_WIN32 && !MS_WIN64 */
|
||||
|
||||
typedef int pid_t;
|
||||
|
||||
#include <float.h>
|
||||
#define Py_IS_NAN _isnan
|
||||
#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
|
||||
#define Py_IS_FINITE(X) _finite(X)
|
||||
#define copysign _copysign
|
||||
#define hypot _hypot
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* define some ANSI types that are not defined in earlier Win headers */
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
/* This file only exists in VC 6.0 or higher */
|
||||
#include <basetsd.h>
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* The Borland compiler defines __BORLANDC__ */
|
||||
/* XXX These defines are likely incomplete, but should be easy to fix. */
|
||||
#ifdef __BORLANDC__
|
||||
#define COMPILER "[Borland]"
|
||||
|
||||
#ifdef _WIN32
|
||||
/* tested with BCC 5.5 (__BORLANDC__ >= 0x0550)
|
||||
*/
|
||||
|
||||
typedef int pid_t;
|
||||
/* BCC55 seems to understand __declspec(dllimport), it is used in its
|
||||
own header files (winnt.h, ...) - so we can do nothing and get the default*/
|
||||
|
||||
#undef HAVE_SYS_UTIME_H
|
||||
#define HAVE_UTIME_H
|
||||
#define HAVE_DIRENT_H
|
||||
|
||||
/* rename a few functions for the Borland compiler */
|
||||
#include <io.h>
|
||||
#define _chsize chsize
|
||||
#define _setmode setmode
|
||||
|
||||
#else /* !_WIN32 */
|
||||
#error "Only Win32 and later are supported"
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
#endif /* BORLANDC */
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* egcs/gnu-win32 defines __GNUC__ and _WIN32 */
|
||||
#if defined(__GNUC__) && defined(_WIN32)
|
||||
/* XXX These defines are likely incomplete, but should be easy to fix.
|
||||
They should be complete enough to build extension modules. */
|
||||
/* Suggested by Rene Liebscher <R.Liebscher@gmx.de> to avoid a GCC 2.91.*
|
||||
bug that requires structure imports. More recent versions of the
|
||||
compiler don't exhibit this bug.
|
||||
*/
|
||||
#if (__GNUC__==2) && (__GNUC_MINOR__<=91)
|
||||
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
|
||||
#endif
|
||||
|
||||
#define COMPILER "[gcc]"
|
||||
#define hypot _hypot
|
||||
#define PY_LONG_LONG long long
|
||||
#define PY_LLONG_MIN LLONG_MIN
|
||||
#define PY_LLONG_MAX LLONG_MAX
|
||||
#define PY_ULLONG_MAX ULLONG_MAX
|
||||
#endif /* GNUC */
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* lcc-win32 defines __LCC__ */
|
||||
#if defined(__LCC__)
|
||||
/* XXX These defines are likely incomplete, but should be easy to fix.
|
||||
They should be complete enough to build extension modules. */
|
||||
|
||||
#define COMPILER "[lcc-win32]"
|
||||
typedef int pid_t;
|
||||
/* __declspec() is supported here too - do nothing to get the defaults */
|
||||
|
||||
#endif /* LCC */
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* End of compilers - finish up */
|
||||
|
||||
#ifndef NO_STDIO_H
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* 64 bit ints are usually spelt __int64 unless compiler has overridden */
|
||||
#define HAVE_LONG_LONG 1
|
||||
#ifndef PY_LONG_LONG
|
||||
# define PY_LONG_LONG __int64
|
||||
# define PY_LLONG_MAX _I64_MAX
|
||||
# define PY_LLONG_MIN _I64_MIN
|
||||
# define PY_ULLONG_MAX _UI64_MAX
|
||||
#endif
|
||||
|
||||
/* For Windows the Python core is in a DLL by default. Test
|
||||
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
||||
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
|
||||
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
|
||||
# define MS_COREDLL /* deprecated old symbol */
|
||||
#endif /* !MS_NO_COREDLL && ... */
|
||||
|
||||
/* All windows compilers that use this header support __declspec */
|
||||
#define HAVE_DECLSPEC_DLL
|
||||
|
||||
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
|
||||
#ifdef MS_COREDLL
|
||||
# ifndef Py_BUILD_CORE /* not building the core - must be an ext */
|
||||
# if defined(_MSC_VER)
|
||||
/* So MSVC users need not specify the .lib file in
|
||||
their Makefile (other compilers are generally
|
||||
taken care of by distutils.) */
|
||||
# ifdef _DEBUG
|
||||
# pragma comment(lib,"python27_d.lib")
|
||||
# else
|
||||
# pragma comment(lib,"python27.lib")
|
||||
# endif /* _DEBUG */
|
||||
# endif /* _MSC_VER */
|
||||
# endif /* Py_BUILD_CORE */
|
||||
#endif /* MS_COREDLL */
|
||||
|
||||
#if defined(MS_WIN64)
|
||||
/* maintain "win32" sys.platform for backward compatibility of Python code,
|
||||
the Win64 API should be close enough to the Win32 API to make this
|
||||
preferable */
|
||||
# define PLATFORM "win32"
|
||||
# define SIZEOF_VOID_P 8
|
||||
# define SIZEOF_TIME_T 8
|
||||
# define SIZEOF_OFF_T 4
|
||||
# define SIZEOF_FPOS_T 8
|
||||
# define SIZEOF_HKEY 8
|
||||
# define SIZEOF_SIZE_T 8
|
||||
/* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
|
||||
sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t).
|
||||
On Win64 the second condition is not true, but if fpos_t replaces off_t
|
||||
then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
|
||||
should define this. */
|
||||
# define HAVE_LARGEFILE_SUPPORT
|
||||
#elif defined(MS_WIN32)
|
||||
# define PLATFORM "win32"
|
||||
# define HAVE_LARGEFILE_SUPPORT
|
||||
# define SIZEOF_VOID_P 4
|
||||
# define SIZEOF_OFF_T 4
|
||||
# define SIZEOF_FPOS_T 8
|
||||
# define SIZEOF_HKEY 4
|
||||
# define SIZEOF_SIZE_T 4
|
||||
/* MS VS2005 changes time_t to an 64-bit type on all platforms */
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# define SIZEOF_TIME_T 8
|
||||
# else
|
||||
# define SIZEOF_TIME_T 4
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
# define Py_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MS_WIN32
|
||||
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_LONG 4
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SIZEOF_DOUBLE 8
|
||||
#define SIZEOF_FLOAT 4
|
||||
|
||||
/* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version number of 1200.
|
||||
Microsoft eMbedded Visual C++ 4.0 has a version number of 1201 and doesn't
|
||||
define these.
|
||||
If some compiler does not provide them, modify the #if appropriately. */
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER > 1300
|
||||
#define HAVE_UINTPTR_T 1
|
||||
#define HAVE_INTPTR_T 1
|
||||
#else
|
||||
/* VC6, VS 2002 and eVC4 don't support the C99 LL suffix for 64-bit integer literals */
|
||||
#define Py_LL(x) x##I64
|
||||
#endif /* _MSC_VER > 1200 */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#endif
|
||||
|
||||
/* define signed and unsigned exact-width 32-bit and 64-bit types, used in the
|
||||
implementation of Python long integers. */
|
||||
#ifndef PY_UINT32_T
|
||||
#if SIZEOF_INT == 4
|
||||
#define HAVE_UINT32_T 1
|
||||
#define PY_UINT32_T unsigned int
|
||||
#elif SIZEOF_LONG == 4
|
||||
#define HAVE_UINT32_T 1
|
||||
#define PY_UINT32_T unsigned long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PY_UINT64_T
|
||||
#if SIZEOF_LONG_LONG == 8
|
||||
#define HAVE_UINT64_T 1
|
||||
#define PY_UINT64_T unsigned PY_LONG_LONG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PY_INT32_T
|
||||
#if SIZEOF_INT == 4
|
||||
#define HAVE_INT32_T 1
|
||||
#define PY_INT32_T int
|
||||
#elif SIZEOF_LONG == 4
|
||||
#define HAVE_INT32_T 1
|
||||
#define PY_INT32_T long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PY_INT64_T
|
||||
#if SIZEOF_LONG_LONG == 8
|
||||
#define HAVE_INT64_T 1
|
||||
#define PY_INT64_T PY_LONG_LONG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Fairly standard from here! */
|
||||
|
||||
/* Define to 1 if you have the `copysign' function. */
|
||||
#define HAVE_COPYSIGN 1
|
||||
|
||||
/* Define to 1 if you have the `isinf' macro. */
|
||||
#define HAVE_DECL_ISINF 1
|
||||
|
||||
/* Define to 1 if you have the `isnan' function. */
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #define const */
|
||||
|
||||
/* Define to 1 if you have the <conio.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_CONIO_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <direct.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_DIRECT_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have dirent.h. */
|
||||
/* #define DIRENT 1 */
|
||||
|
||||
/* Define to the type of elements in the array set by `getgroups'.
|
||||
Usually this is either `int' or `gid_t'. */
|
||||
/* #undef GETGROUPS_T */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef gid_t */
|
||||
|
||||
/* Define if your struct tm has tm_zone. */
|
||||
/* #undef HAVE_TM_ZONE */
|
||||
|
||||
/* Define if you don't have tm_zone but do have the external array
|
||||
tzname. */
|
||||
#define HAVE_TZNAME
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define if you don't have dirent.h, but have ndir.h. */
|
||||
/* #undef NDIR */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you don't have dirent.h, but have sys/dir.h. */
|
||||
/* #undef SYSDIR */
|
||||
|
||||
/* Define if you don't have dirent.h, but have sys/ndir.h. */
|
||||
/* #undef SYSNDIR */
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
/* #undef TIME_WITH_SYS_TIME */
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #define TM_IN_SYS_TIME 1 */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef uid_t */
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
/* #undef VOID_CLOSEDIR */
|
||||
|
||||
/* Define if getpgrp() must be called as getpgrp(0)
|
||||
and (consequently) setpgrp() as setpgrp(0, 0). */
|
||||
/* #undef GETPGRP_HAVE_ARGS */
|
||||
|
||||
/* Define this if your time.h defines altzone */
|
||||
/* #define HAVE_ALTZONE */
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_PUTENV
|
||||
#endif
|
||||
|
||||
/* Define if your compiler supports function prototypes */
|
||||
#define HAVE_PROTOTYPES
|
||||
|
||||
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
|
||||
(which you can't on SCO ODT 3.0). */
|
||||
/* #undef SYS_SELECT_WITH_SYS_TIME */
|
||||
|
||||
/* Define if you want documentation strings in extension modules */
|
||||
#define WITH_DOC_STRINGS 1
|
||||
|
||||
/* Define if you want to compile in rudimentary thread support */
|
||||
/* #undef WITH_THREAD */
|
||||
|
||||
/* Define if you want to use the GNU readline library */
|
||||
/* #define WITH_READLINE 1 */
|
||||
|
||||
/* Define if you want to have a Unicode type. */
|
||||
#define Py_USING_UNICODE
|
||||
|
||||
/* Define as the size of the unicode type. */
|
||||
/* This is enough for unicodeobject.h to do the "right thing" on Windows. */
|
||||
#define Py_UNICODE_SIZE 2
|
||||
|
||||
/* Use Python's own small-block memory-allocator. */
|
||||
#define WITH_PYMALLOC 1
|
||||
|
||||
/* Define if you have clock. */
|
||||
/* #define HAVE_CLOCK */
|
||||
|
||||
/* Define when any dynamic module loading is enabled */
|
||||
#define HAVE_DYNAMIC_LOADING
|
||||
|
||||
/* Define if you have ftime. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_FTIME
|
||||
#endif
|
||||
|
||||
/* Define if you have getpeername. */
|
||||
#define HAVE_GETPEERNAME
|
||||
|
||||
/* Define if you have getpgrp. */
|
||||
/* #undef HAVE_GETPGRP */
|
||||
|
||||
/* Define if you have getpid. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_GETPID
|
||||
#endif
|
||||
|
||||
/* Define if you have gettimeofday. */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
|
||||
/* Define if you have getwd. */
|
||||
/* #undef HAVE_GETWD */
|
||||
|
||||
/* Define if you have lstat. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
/* Define if you have the mktime function. */
|
||||
#define HAVE_MKTIME
|
||||
|
||||
/* Define if you have nice. */
|
||||
/* #undef HAVE_NICE */
|
||||
|
||||
/* Define if you have readlink. */
|
||||
/* #undef HAVE_READLINK */
|
||||
|
||||
/* Define if you have select. */
|
||||
/* #undef HAVE_SELECT */
|
||||
|
||||
/* Define if you have setpgid. */
|
||||
/* #undef HAVE_SETPGID */
|
||||
|
||||
/* Define if you have setpgrp. */
|
||||
/* #undef HAVE_SETPGRP */
|
||||
|
||||
/* Define if you have setsid. */
|
||||
/* #undef HAVE_SETSID */
|
||||
|
||||
/* Define if you have setvbuf. */
|
||||
#define HAVE_SETVBUF
|
||||
|
||||
/* Define if you have siginterrupt. */
|
||||
/* #undef HAVE_SIGINTERRUPT */
|
||||
|
||||
/* Define if you have symlink. */
|
||||
/* #undef HAVE_SYMLINK */
|
||||
|
||||
/* Define if you have tcgetpgrp. */
|
||||
/* #undef HAVE_TCGETPGRP */
|
||||
|
||||
/* Define if you have tcsetpgrp. */
|
||||
/* #undef HAVE_TCSETPGRP */
|
||||
|
||||
/* Define if you have times. */
|
||||
/* #undef HAVE_TIMES */
|
||||
|
||||
/* Define if you have uname. */
|
||||
/* #undef HAVE_UNAME */
|
||||
|
||||
/* Define if you have waitpid. */
|
||||
/* #undef HAVE_WAITPID */
|
||||
|
||||
/* Define to 1 if you have the `wcscoll' function. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_WCSCOLL 1
|
||||
#endif
|
||||
|
||||
/* Define if the zlib library has inflateCopy */
|
||||
#define HAVE_ZLIB_COPY 1
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_ERRNO_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_FCNTL_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <process.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_PROCESS_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <stdarg.h> prototypes. */
|
||||
#define HAVE_STDARG_PROTOTYPES
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#define HAVE_STDDEF_H 1
|
||||
|
||||
/* Define if you have the <sys/audioio.h> header file. */
|
||||
/* #undef HAVE_SYS_AUDIOIO_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
/* #define HAVE_SYS_PARAM_H 1 */
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #define HAVE_SYS_SELECT_H 1 */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
/* #define HAVE_SYS_TIME_H 1 */
|
||||
|
||||
/* Define if you have the <sys/times.h> header file. */
|
||||
/* #define HAVE_SYS_TIMES_H 1 */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#ifndef MS_WINCE
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#endif
|
||||
|
||||
/* 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/utsname.h> header file. */
|
||||
/* #define HAVE_SYS_UTSNAME_H 1 */
|
||||
|
||||
/* Define if you have the <thread.h> header file. */
|
||||
/* #undef HAVE_THREAD_H */
|
||||
|
||||
/* 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 the compiler provides a wchar.h header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
/* #undef HAVE_LIBDL */
|
||||
|
||||
/* Define if you have the mpc library (-lmpc). */
|
||||
/* #undef HAVE_LIBMPC */
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#define HAVE_LIBNSL 1
|
||||
|
||||
/* Define if you have the seq library (-lseq). */
|
||||
/* #undef HAVE_LIBSEQ */
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#define HAVE_LIBSOCKET 1
|
||||
|
||||
/* Define if you have the sun library (-lsun). */
|
||||
/* #undef HAVE_LIBSUN */
|
||||
|
||||
/* Define if you have the termcap library (-ltermcap). */
|
||||
/* #undef HAVE_LIBTERMCAP */
|
||||
|
||||
/* Define if you have the termlib library (-ltermlib). */
|
||||
/* #undef HAVE_LIBTERMLIB */
|
||||
|
||||
/* Define if you have the thread library (-lthread). */
|
||||
/* #undef HAVE_LIBTHREAD */
|
||||
|
||||
/* WinSock does not use a bitmask in select, and uses
|
||||
socket handles greater than FD_SETSIZE */
|
||||
#define Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
|
||||
|
||||
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the
|
||||
least significant byte first */
|
||||
#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1
|
||||
|
||||
#endif /* !Py_CONFIG_H */
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef PYCTYPE_H
|
||||
#define PYCTYPE_H
|
||||
|
||||
#define PY_CTF_LOWER 0x01
|
||||
#define PY_CTF_UPPER 0x02
|
||||
#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
|
||||
#define PY_CTF_DIGIT 0x04
|
||||
#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
|
||||
#define PY_CTF_SPACE 0x08
|
||||
#define PY_CTF_XDIGIT 0x10
|
||||
|
||||
PyAPI_DATA(const unsigned int) _Py_ctype_table[256];
|
||||
|
||||
/* Unlike their C counterparts, the following macros are not meant to
|
||||
* handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
|
||||
* must be a signed/unsigned char. */
|
||||
#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
|
||||
#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
|
||||
#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
|
||||
#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
|
||||
#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
|
||||
#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
|
||||
#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
|
||||
|
||||
PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256];
|
||||
PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256];
|
||||
|
||||
#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
|
||||
#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
|
||||
|
||||
#endif /* !PYCTYPE_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
#ifndef Py_PYDEBUG_H
|
||||
#define Py_PYDEBUG_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(int) Py_DebugFlag;
|
||||
PyAPI_DATA(int) Py_VerboseFlag;
|
||||
PyAPI_DATA(int) Py_InteractiveFlag;
|
||||
PyAPI_DATA(int) Py_InspectFlag;
|
||||
PyAPI_DATA(int) Py_OptimizeFlag;
|
||||
PyAPI_DATA(int) Py_NoSiteFlag;
|
||||
PyAPI_DATA(int) Py_BytesWarningFlag;
|
||||
PyAPI_DATA(int) Py_UseClassExceptionsFlag;
|
||||
PyAPI_DATA(int) Py_FrozenFlag;
|
||||
PyAPI_DATA(int) Py_TabcheckFlag;
|
||||
PyAPI_DATA(int) Py_UnicodeFlag;
|
||||
PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
|
||||
PyAPI_DATA(int) Py_DivisionWarningFlag;
|
||||
PyAPI_DATA(int) Py_DontWriteBytecodeFlag;
|
||||
PyAPI_DATA(int) Py_NoUserSiteDirectory;
|
||||
/* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed,
|
||||
on the command line, and is used in 2.2 by ceval.c to make all "/" divisions
|
||||
true divisions (which they will be in 3.0). */
|
||||
PyAPI_DATA(int) _Py_QnewFlag;
|
||||
/* Warn about 3.x issues */
|
||||
PyAPI_DATA(int) Py_Py3kWarningFlag;
|
||||
PyAPI_DATA(int) Py_HashRandomizationFlag;
|
||||
|
||||
/* this is a wrapper around getenv() that pays attention to
|
||||
Py_IgnoreEnvironmentFlag. It should be used for getting variables like
|
||||
PYTHONPATH and PYTHONHOME from the environment */
|
||||
#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
|
||||
|
||||
PyAPI_FUNC(void) Py_FatalError(const char *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_PYDEBUG_H */
|
||||
@@ -1,328 +0,0 @@
|
||||
#ifndef Py_ERRORS_H
|
||||
#define Py_ERRORS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Error objects */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
} PyBaseExceptionObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *msg;
|
||||
PyObject *filename;
|
||||
PyObject *lineno;
|
||||
PyObject *offset;
|
||||
PyObject *text;
|
||||
PyObject *print_file_and_line;
|
||||
} PySyntaxErrorObject;
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *encoding;
|
||||
PyObject *object;
|
||||
Py_ssize_t start;
|
||||
Py_ssize_t end;
|
||||
PyObject *reason;
|
||||
} PyUnicodeErrorObject;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *code;
|
||||
} PySystemExitObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *myerrno;
|
||||
PyObject *strerror;
|
||||
PyObject *filename;
|
||||
} PyEnvironmentErrorObject;
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *myerrno;
|
||||
PyObject *strerror;
|
||||
PyObject *filename;
|
||||
PyObject *winerror;
|
||||
} PyWindowsErrorObject;
|
||||
#endif
|
||||
|
||||
/* Error handling definitions */
|
||||
|
||||
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
|
||||
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
|
||||
PyAPI_FUNC(void) PyErr_Clear(void);
|
||||
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
|
||||
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
|
||||
|
||||
#ifdef Py_DEBUG
|
||||
#define _PyErr_OCCURRED() PyErr_Occurred()
|
||||
#else
|
||||
#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type)
|
||||
#endif
|
||||
|
||||
/* Error testing and normalization */
|
||||
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
|
||||
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
|
||||
|
||||
/* */
|
||||
|
||||
#define PyExceptionClass_Check(x) \
|
||||
(PyClass_Check((x)) || (PyType_Check((x)) && \
|
||||
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)))
|
||||
|
||||
#define PyExceptionInstance_Check(x) \
|
||||
(PyInstance_Check((x)) || \
|
||||
PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS))
|
||||
|
||||
#define PyExceptionClass_Name(x) \
|
||||
(PyClass_Check((x)) \
|
||||
? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \
|
||||
: (char *)(((PyTypeObject*)(x))->tp_name))
|
||||
|
||||
#define PyExceptionInstance_Class(x) \
|
||||
((PyInstance_Check((x)) \
|
||||
? (PyObject*)((PyInstanceObject*)(x))->in_class \
|
||||
: (PyObject*)((x)->ob_type)))
|
||||
|
||||
|
||||
/* Predefined exceptions */
|
||||
|
||||
PyAPI_DATA(PyObject *) PyExc_BaseException;
|
||||
PyAPI_DATA(PyObject *) PyExc_Exception;
|
||||
PyAPI_DATA(PyObject *) PyExc_StopIteration;
|
||||
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
|
||||
PyAPI_DATA(PyObject *) PyExc_StandardError;
|
||||
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
|
||||
PyAPI_DATA(PyObject *) PyExc_LookupError;
|
||||
|
||||
PyAPI_DATA(PyObject *) PyExc_AssertionError;
|
||||
PyAPI_DATA(PyObject *) PyExc_AttributeError;
|
||||
PyAPI_DATA(PyObject *) PyExc_EOFError;
|
||||
PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
|
||||
PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
|
||||
PyAPI_DATA(PyObject *) PyExc_IOError;
|
||||
PyAPI_DATA(PyObject *) PyExc_OSError;
|
||||
PyAPI_DATA(PyObject *) PyExc_ImportError;
|
||||
PyAPI_DATA(PyObject *) PyExc_IndexError;
|
||||
PyAPI_DATA(PyObject *) PyExc_KeyError;
|
||||
PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
|
||||
PyAPI_DATA(PyObject *) PyExc_MemoryError;
|
||||
PyAPI_DATA(PyObject *) PyExc_NameError;
|
||||
PyAPI_DATA(PyObject *) PyExc_OverflowError;
|
||||
PyAPI_DATA(PyObject *) PyExc_RuntimeError;
|
||||
PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
|
||||
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
|
||||
PyAPI_DATA(PyObject *) PyExc_IndentationError;
|
||||
PyAPI_DATA(PyObject *) PyExc_TabError;
|
||||
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
|
||||
PyAPI_DATA(PyObject *) PyExc_SystemError;
|
||||
PyAPI_DATA(PyObject *) PyExc_SystemExit;
|
||||
PyAPI_DATA(PyObject *) PyExc_TypeError;
|
||||
PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
|
||||
PyAPI_DATA(PyObject *) PyExc_UnicodeError;
|
||||
PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
|
||||
PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
|
||||
PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
|
||||
PyAPI_DATA(PyObject *) PyExc_ValueError;
|
||||
PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
|
||||
#ifdef MS_WINDOWS
|
||||
PyAPI_DATA(PyObject *) PyExc_WindowsError;
|
||||
#endif
|
||||
#ifdef __VMS
|
||||
PyAPI_DATA(PyObject *) PyExc_VMSError;
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyObject *) PyExc_BufferError;
|
||||
|
||||
PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst;
|
||||
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
|
||||
|
||||
/* Predefined warning categories */
|
||||
PyAPI_DATA(PyObject *) PyExc_Warning;
|
||||
PyAPI_DATA(PyObject *) PyExc_UserWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_FutureWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_ImportWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
|
||||
PyAPI_DATA(PyObject *) PyExc_BytesWarning;
|
||||
|
||||
|
||||
/* Convenience functions */
|
||||
|
||||
PyAPI_FUNC(int) PyErr_BadArgument(void);
|
||||
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
|
||||
PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
|
||||
PyObject *, const char *);
|
||||
#ifdef MS_WINDOWS
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
|
||||
PyObject *, const Py_UNICODE *);
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
|
||||
Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
|
||||
int, const char *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
|
||||
int, const char *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
|
||||
int, const Py_UNICODE *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
|
||||
PyObject *,int, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
|
||||
PyObject *,int, const char *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
|
||||
PyObject *,int, const Py_UNICODE *);
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
/* Export the old function so that the existing API remains available: */
|
||||
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
|
||||
PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno);
|
||||
/* Mask the old API with a call to the new API for code compiled under
|
||||
Python 2.0: */
|
||||
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
|
||||
|
||||
/* Function to create a new exception */
|
||||
PyAPI_FUNC(PyObject *) PyErr_NewException(
|
||||
char *name, PyObject *base, PyObject *dict);
|
||||
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
|
||||
char *name, char *doc, PyObject *base, PyObject *dict);
|
||||
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
|
||||
|
||||
/* In sigcheck.c or signalmodule.c */
|
||||
PyAPI_FUNC(int) PyErr_CheckSignals(void);
|
||||
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
|
||||
|
||||
/* In signalmodule.c */
|
||||
int PySignal_SetWakeupFd(int fd);
|
||||
|
||||
/* Support for adding program text to SyntaxErrors */
|
||||
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
|
||||
PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
/* The following functions are used to create and modify unicode
|
||||
exceptions from C */
|
||||
|
||||
/* create a UnicodeDecodeError object */
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
|
||||
const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
|
||||
|
||||
/* create a UnicodeEncodeError object */
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
|
||||
const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
|
||||
|
||||
/* create a UnicodeTranslateError object */
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
|
||||
const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
|
||||
|
||||
/* get the encoding attribute */
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
|
||||
|
||||
/* get the object attribute */
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
|
||||
|
||||
/* get the value of the start attribute (the int * may not be NULL)
|
||||
return 0 on success, -1 on failure */
|
||||
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
|
||||
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
|
||||
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
|
||||
|
||||
/* assign a new value to the start attribute
|
||||
return 0 on success, -1 on failure */
|
||||
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
|
||||
|
||||
/* get the value of the end attribute (the int *may not be NULL)
|
||||
return 0 on success, -1 on failure */
|
||||
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
|
||||
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
|
||||
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
|
||||
|
||||
/* assign a new value to the end attribute
|
||||
return 0 on success, -1 on failure */
|
||||
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
|
||||
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
|
||||
|
||||
/* get the value of the reason attribute */
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
|
||||
|
||||
/* assign a new value to the reason attribute
|
||||
return 0 on success, -1 on failure */
|
||||
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
|
||||
PyObject *, const char *);
|
||||
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
|
||||
PyObject *, const char *);
|
||||
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
|
||||
PyObject *, const char *);
|
||||
#endif
|
||||
|
||||
|
||||
/* These APIs aren't really part of the error implementation, but
|
||||
often needed to format error messages; the native C lib APIs are
|
||||
not available on all platforms, which is why we provide emulations
|
||||
for those platforms in Python/mysnprintf.c,
|
||||
WARNING: The return value of snprintf varies across platforms; do
|
||||
not rely on any particular behavior; eventually the C99 defn may
|
||||
be reliable.
|
||||
*/
|
||||
#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
|
||||
# define HAVE_SNPRINTF
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
|
||||
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
|
||||
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
|
||||
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_ERRORS_H */
|
||||
@@ -1,48 +0,0 @@
|
||||
/* Stuff to export relevant 'expat' entry points from pyexpat to other
|
||||
* parser modules, such as cElementTree. */
|
||||
|
||||
/* note: you must import expat.h before importing this module! */
|
||||
|
||||
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
|
||||
#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
|
||||
|
||||
struct PyExpat_CAPI
|
||||
{
|
||||
char* magic; /* set to PyExpat_CAPI_MAGIC */
|
||||
int size; /* set to sizeof(struct PyExpat_CAPI) */
|
||||
int MAJOR_VERSION;
|
||||
int MINOR_VERSION;
|
||||
int MICRO_VERSION;
|
||||
/* pointers to selected expat functions. add new functions at
|
||||
the end, if needed */
|
||||
const XML_LChar * (*ErrorString)(enum XML_Error code);
|
||||
enum XML_Error (*GetErrorCode)(XML_Parser parser);
|
||||
XML_Size (*GetErrorColumnNumber)(XML_Parser parser);
|
||||
XML_Size (*GetErrorLineNumber)(XML_Parser parser);
|
||||
enum XML_Status (*Parse)(
|
||||
XML_Parser parser, const char *s, int len, int isFinal);
|
||||
XML_Parser (*ParserCreate_MM)(
|
||||
const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite,
|
||||
const XML_Char *namespaceSeparator);
|
||||
void (*ParserFree)(XML_Parser parser);
|
||||
void (*SetCharacterDataHandler)(
|
||||
XML_Parser parser, XML_CharacterDataHandler handler);
|
||||
void (*SetCommentHandler)(
|
||||
XML_Parser parser, XML_CommentHandler handler);
|
||||
void (*SetDefaultHandlerExpand)(
|
||||
XML_Parser parser, XML_DefaultHandler handler);
|
||||
void (*SetElementHandler)(
|
||||
XML_Parser parser, XML_StartElementHandler start,
|
||||
XML_EndElementHandler end);
|
||||
void (*SetNamespaceDeclHandler)(
|
||||
XML_Parser parser, XML_StartNamespaceDeclHandler start,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
void (*SetProcessingInstructionHandler)(
|
||||
XML_Parser parser, XML_ProcessingInstructionHandler handler);
|
||||
void (*SetUnknownEncodingHandler)(
|
||||
XML_Parser parser, XML_UnknownEncodingHandler handler,
|
||||
void *encodingHandlerData);
|
||||
void (*SetUserData)(XML_Parser parser, void *userData);
|
||||
/* always add new stuff to the end! */
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user