diff --git a/libs/pvb/include/pvserver/BMP.h b/libs/pvb/include/pvserver/BMP.h new file mode 100644 index 0000000..2e483bf --- /dev/null +++ b/libs/pvb/include/pvserver/BMP.h @@ -0,0 +1,70 @@ +/*************************************************************************** + BMP.h - description + ------------------- + begin : Sun Okt 12 2001 + copyright : (C) 2000 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +typedef struct mytagBITMAPFILEHEADER +{ // bmfh + unsigned short int bfType; + unsigned short int bfSize[2]; + unsigned short int bfReserved1; + unsigned short int bfReserved2; + unsigned short int bfOffBits[2]; +} myBITMAPFILEHEADER; + +typedef struct mytagBITMAPINFOHEADER{ // bmih + unsigned int biSize; + unsigned int biWidth; + unsigned int biHeight; + unsigned short int biPlanes; + unsigned short int biBitCount; + unsigned int biCompression; + unsigned int biSizeImage; + unsigned int biXPelsPerMeter; + unsigned int biYPelsPerMeter; + unsigned int biClrUsed; + unsigned int biClrImportant; +} myBITMAPINFOHEADER; + +typedef struct mytagBITMAPCOREHEADER { // bmch + unsigned int bcSize; + unsigned short int bcWidth; + unsigned short int bcHeight; + unsigned short int bcPlanes; + unsigned short int bcBitCount; +} myBITMAPCOREHEADER; + +typedef struct mytagRGBTRIPLE { // rgbt + unsigned char rgbtBlue; + unsigned char rgbtGreen; + unsigned char rgbtRed; +} myRGBTRIPLE; + +typedef struct mytagRGBQUAD { // rgbq + unsigned char rgbBlue; + unsigned char rgbGreen; + unsigned char rgbRed; + unsigned char rgbReserved; +} myRGBQUAD; + +/* following BITMAPFILEHEADER */ +typedef struct mytagBITMAPINFO { + myBITMAPINFOHEADER bmiHeader; + myRGBQUAD bmiColors[1]; +} myBITMAPINFO; + +/* following BITMAPFILEHEADER */ +typedef struct my_BITMAPCOREINFO { // bmci + myBITMAPCOREHEADER bmciHeader; + myRGBTRIPLE bmciColors[1]; +} myBITMAPCOREINFO; diff --git a/libs/pvb/include/pvserver/dxf.h b/libs/pvb/include/pvserver/dxf.h new file mode 100644 index 0000000..1f50e35 --- /dev/null +++ b/libs/pvb/include/pvserver/dxf.h @@ -0,0 +1,415 @@ +/*==================================================================== + + This software was written by Ian L. Kaplan, Chief Fat Bear, Bear Products + International. Use of this software, for any purpose, is granted on two + conditions: + + 1. This copyright notice must be included with the software + or any software derived from it. + + 2. The risk of using this software is accepted by the user. No + warranty as to its usefulness or functionality is provided + or implied. The author and Bear Products International provides + no support. + + ====================================================================*/ +#ifndef DXF2GL_H +#define DXF2GL_H + +#include +#include +#include +#include + +// These rather convoluted ifndef's are required because both FALSE, TRUE +// and BOOLEAN are defined by various windows and windows/nt headers. When +// these headers are included, a redefine error results without these ifndefs. +// +typedef enum { +#ifndef FALSE + FALSE = 0, +#endif +#ifndef TRUE + TRUE = 1, +#endif + BOGUS +} BoolVals; + +#ifndef _WIN32 + typedef int BOOLEAN; +#endif + +/* FileAccess - a class for opening and reading ASCII files. + + Public functions: + FileAccess constructor - The argument to this constructor is + the file name. The constructor will + open the file and set the variable + FileOpenOK (which can be accessed via + FileOK). + FileAccess destructor - Close the file + get_line - get a line for the file and return it as a null + terminated string. +*/ +class FileAccess { + + // Variables + private: + FILE *FilePtr; + BOOLEAN FileOpenOK; + + protected: + + public: + + // Class Functions + private: + //OpenFile(char *FileName); + void file_error(const char *msg); + protected: + public: + FileAccess(const char *FileName = "" ); + ~FileAccess(void); + BOOLEAN FileOK(void) { return FileOpenOK; } + BOOLEAN get_line(char *LineBuf, const int BufSize); +}; // FileAccess + +/* + The page_pool object is designed to support rapid memory allocation + and deallocation of all allocated memory, once the object is no + longer needed. By using a block allocation scheme, the overhead of + memory allocation is greatly reduced, compared to "malloc" (or new). + Deallocation of large blocks of memory is also much faster than + calling free for every allocated block of memory. + + The page_pool allocator allocates blocks of memory in "page_size" + increments. The page_size variable is set at start-up and contains + the system virtual memory page size. + + The page_pool object contains the virtual function "add_to_list" + which can be implemented by the inherited function + ordered_list. Ordered list is a class that supports ordered list + insertion and deletion. In this case, this is used to support an + ordered list of free memory blocks. The ordered list is only + needed if the page_pool is used as the base for a memory allocater + that can allocate from a free list. +*/ + +class page_pool { +private: // typedefs and variables + typedef struct page_chain_struct + { void *block; + unsigned int bytes_used; + unsigned int block_size; + page_chain_struct *next_page; + } page_chain; + + // The min_block_size is the smallest block that will be returned by the + // page_pool allocater. The max_block_size is the largest memory block + // that can be requested. Ideally, this should be a multiple of the page + // size. + typedef enum { min_block_size = 96, max_block_size = 1024 * 8 } bogus; + page_chain *page_list_head; + page_chain *current_page; + static unsigned int page_size; // system page size, shared by all instances + +private: // class functions + static unsigned int GetSysPageSize(void); + page_chain *new_block( unsigned int block_size ); + void *add_block( unsigned int block_size ); + +public: // class functions + page_pool(void); + ~page_pool(void); + void *page_alloc( unsigned int block_size ); + void print_page_pool_info(void); + virtual void add_to_list(void *addr, unsigned int size); +}; // class page_pool + +/* + A 3D graphic object can be described as a list of polygons. Each + of these polygons consists of three or more points in 3D space + (e.g., x, y, z coordinates). + + The FaceList object will construct a list of polygon faces read from + a DXF file. Two DXF file polygon formats are supported: + + - 3DFACE + - POLYLINE + + The "face" structure member "f" is a pointer to an array of points. + This point array is dynamically allocated. The minimum number of + points that can be allocated for a polygon is four (a 3DFACE polygon + may only consist of three points, in which case the last point is + unused). + + Although during creating there is a distinction made between DXF + 3DFACE objects and POLYLINE objects, the class represents both as + polygon faces and no such distinction exists when the polygon + list is read. + + The object supplies the following public functions for creating a + polygon list: + + add_3DFACE_point - Add a 3D point to a 3DFACE polygon + add_poly_point - Add a 3D point to a POLYLINE polygon + + get_new_3DFACE - Create a new 3DFACE polygon + get_new_poly_face - Create a new POLYLINE polygon + + Once the polygon list is created, it can be read using the following + functions: + + GetListStart - Return a handle for the start of the polygon face + list + GetFace - Get a polygon face, given a list handle + GetNextFace - Get the next polygon face in the list + +*/ +class FaceList { + public: + typedef enum {MinSize = 4} bogus; // minimum number of points + typedef enum {Xcoord, Ycoord, Zcoord} bogus2; + + typedef struct { float v[3]; } vect; // a point in the 3D plane + + typedef struct { vect *f; // an array of 3D points + int point_cnt; // number of points currently alloc'ed + int point_max; // max points + } face; + + typedef void *ListHandle; + + private: + typedef struct FaceListStruct { face cur_face; + struct FaceListStruct *next_face; + } FaceElem; + page_pool mem; + FaceElem *ListHead; + FaceElem *ListTail; + + private: + void add_point(face *cur_face, float x, float y, float z); + // void GrowFace( face *cur_face ); + + public: + FaceList(void) { ListHead = NULL; + ListTail = NULL; + } + void add_3DFACE_point(float x, float y, float z ); + void add_poly_point(float x, float y, float z); + void get_new_3DFACE(void); + void get_new_poly_face(int polypont); + ListHandle GetListStart(void) { return (ListHandle)ListHead; } + face *GetFace( ListHandle handle) + { return &((FaceElem *)handle)->cur_face; } + ListHandle GetNextFace( ListHandle handle ) + { return (ListHandle)((FaceElem *)handle)->next_face; } + void print(void); +}; + +// +// The gl_token enumeration defines the tokens that are returned by the +// scanner and are used by the parser in attempting to recognize the +// components of a DXF file. +// +typedef enum { bad_gl_token, + section, + header, + endsec, + seqend, + blocks, + block, + endblk, + vertex, + tables, + table, + layer, + contin, + endtab, + entities, + three_d_face, + end_of_file, + polyline, + integer, + real, + name, + last_gl_token } gl_token; + +/* + This file contains the stack object definition. The scanner + requires two token look ahead to resolve things like the EOF token + sequence. If this sequence is checked for, but not found, it is + necessary to "back up" the input stream. This is done via the token + stack. + + Note that a DXF file may contain both integer and float values. + Two versions of "push_token" are implemented, one with an integer + value and one with a float value. The integer version may be used + with just a token value, in which case the default value will be + used for the integer. +*/ +class token_stack { + public: + typedef union { int intval; + float realval; + } token_union; + + typedef struct { gl_token token; + token_union val; + } token_stack_type; + + private: + typedef enum {MaxTokens = 10} bogus1; + token_stack_type token_stack_buf[ MaxTokens ]; + int token_sp; + + public: + token_stack(void) { token_sp = MaxTokens; } + BOOLEAN StackHasItems(void) { return token_sp < MaxTokens; } + void push_token( gl_token token, int intval = 0 ); + void push_token( gl_token token, float realval ); + token_stack_type pop_token(void); +}; + +/* + This file contains the scanner object that tokenizes the input + stream. The scanner either returns a reserved word (e.g., section + or three_d_face), "name" (an identifier, such as a layer name or + face name), integer or real. The various DXF markers (e.g., the 70 + marker or 0 for start) are returned as integers. This scanner is + designed as a front end for a program that reads a DXF file and + displays it as a 3D wire frame, using openGL (hense then "GL" + naming). + + Scanning and parsing a DXF file is difficult, because the DXF file + format seems to have grown over time in an ad hoc manner. Further, + the documentation is obscure and/or incomplete. While parsing the + file, it is sometimes necessary to "back up". To support this, a + stack is maintained. Input tokens and values can be "pushed" onto + this stack and re-read. The token_stack class supports this feature. + +*/ +class GL_scanner { + // variables + private: + token_stack stack; + float gl_float; + int gl_int; + FileAccess *MyFileObj; + + typedef enum {WordBufSize = 40} bogus2; + char WordBuf[ WordBufSize ]; + protected: + public: + + // class functions + private: + gl_token scan_number(char *cptr); + gl_token scan_word(char *cptr); + gl_token gl_name_lookup(void); + protected: + public: + GL_scanner( FileAccess *FileObj ) { MyFileObj = FileObj; } + float get_gl_float() { return gl_float; } + int get_gl_int() { return gl_int; } + char *get_gl_name() { return WordBuf; } + gl_token get_next_token(void); + BOOLEAN token_in_stack(void) { return stack.StackHasItems(); } + gl_token get_token_from_stack(); + void put_token_in_stack(const gl_token token); + void put_token_in_stack(const gl_token token, int DX_val) + { stack.push_token(token, DX_val); } + void print_token(const gl_token token); +}; + + +/* This file contains the parser object that processes the DXF file. + The class function GL_GetFaceList returns the Face list for the + 3D DXF object. + */ +class MinMax { + private: + float min; + float max; + public: + typedef enum {MAXVAL = 1024*1000} bogus; + // The initial values of max and min should be way beyond any reasonable + // range. + MinMax(void) { min = (float)MAXVAL; max = (float)(-(MAXVAL)); } + void SetMinMax( float val ) { if (val < min) + min = val; + if (val > max) + max = val; + } + float GetMin(void) { return min; } + float GetMax(void) { return max; } +}; + +class GL_object { + // variables + private: + GL_scanner *GL_scan; + protected: + public: + MinMax PointRange; + + // class functions + private: + void set_min_max(); + void undo(gl_token token); + BOOLEAN IsEndSec(void); + BOOLEAN IsStart(void); + BOOLEAN IsName(void); + BOOLEAN IsTable(void); + BOOLEAN IsLayerName(void); + BOOLEAN Is3DFace(void); + BOOLEAN IsEndSet(void); + float GetCoord(void); + void get_3DFACE_point(FaceList *FaceObjPtr); + void get_poly_point(FaceList *FaceObjPtr); + void SkipSection(void); + void Get3DFACE(FaceList *&CurObj); + void GetPolyLine(FaceList *&CurObj); + protected: + public: + GL_object(FileAccess *FileObj ) { GL_scan = new GL_scanner( FileObj ); }; + ~GL_object(void) { delete GL_scan; } + FaceList *GL_GetFaceList(void); +}; // GL_object + +typedef enum { DXF_start = 0, + DXF_textval = 1, + DXF_name = 2, + DXF_othername1 = 3, + DXF_othername2 = 4, + DXF_entity_handle = 5, + DXF_line_type = 6, + DXF_text_style = 7, + DXF_layer_name = 8, + DXF_var_name = 9, + DXF_primary_X = 10, + DXF_other_X_1 = 11, + DXF_primary_Y = 20, + DXF_other_Y_1 = 21, + DXF_other_Z = 31, + DXF_elevation = 38, + DXF_thickness = 39, + DXF_floatvals = 40, + DXF_repeat = 49, + DXF_angle1 = 50, DXF_angle2 = 51, + DXF_angle3 = 52, DXF_angle4 = 53, + DXF_angle5 = 54, DXF_angle6 = 55, + DXF_angle7 = 56, DXF_angle8 = 57, + DXF_angle9 = 58, + DXF_colornum = 62, + DXF_entities_flg = 66, + DXF_ent_ident = 67, + DXF_SeventyFlag = 70, + DXF_SeventyOneFlag= 71, + DXF_SeventyTwoFlag= 72, + DXF_view_state = 69, + DXF_comment = 999 } DXF_values; + +#endif + diff --git a/libs/pvb/include/pvserver/gl.h b/libs/pvb/include/pvserver/gl.h new file mode 100644 index 0000000..01bcb49 --- /dev/null +++ b/libs/pvb/include/pvserver/gl.h @@ -0,0 +1,2272 @@ +/* modified by R. Lehrig for ProcessViewServer under Windows */ +/* $Id: gl.h,v 1.1.1.1 2003/07/24 08:16:24 lehrig Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.4 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is 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 Software. + * + * THE SOFTWARE IS 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 + * BRIAN PAUL 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef __gl_h_ +#define __gl_h_ + +#if defined(USE_MGL_NAMESPACE) +//#include "gl_mangle.h" +#endif + + +/********************************************************************** + * Begin system-specific stuff. + */ +#if defined(__BEOS__) +#include /* to get some BeOS-isms */ +#endif + +#if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) +#define OPENSTEP +#endif + +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) +#define __WIN32__ +#endif + +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) +# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# endif /* _STATIC_MESA support */ +# define GLAPIENTRY __stdcall +#else +/* non-Windows compilation */ +# define GLAPI extern +# define GLAPIENTRY +#endif /* WIN32 / CYGWIN bracket */ + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) +//#include +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif +/* + * End system-specific stuff. + **********************************************************************/ + + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 + + + +/* + * + * Datatypes + * + */ +#ifdef CENTERLINE_CLPP +#define signed +#endif +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + + + +/* + * + * Constants + * + */ + +/* Boolean values */ +#define GL_FALSE 0x0 +#define GL_TRUE 0x1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0x0 +#define GL_ONE 0x1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_COEFF 0x0A00 +#define GL_DOMAIN 0x0A02 +#define GL_ORDER 0x0A01 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SCISSOR_BOX 0x0C10 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 + +/* GL 1.1 texturing */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 + +/* GL 1.2 texturing */ +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A + +/* Internal texture formats (GL 1.1) */ +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0x0 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + + +/* OpenGL 1.2 */ +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E + + + +/* + * OpenGL 1.2 imaging subset (NOT IMPLEMENTED BY MESA) + */ +/* GL_EXT_color_table */ +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +/* GL_EXT_convolution and GL_HP_convolution_border_modes */ +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +/* GL_SGI_color_matrix */ +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +/* GL_EXT_histogram */ +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +/* GL_EXT_blend_color, GL_EXT_blend_minmax */ +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 + + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF + + + + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export on +#endif + + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY glClearColor( GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha ); + +GLAPI void GLAPIENTRY glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, + GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY glPopAttrib( void ); + + +GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY glGetError( void ); + +GLAPI const GLubyte* GLAPIENTRY glGetString( GLenum name ); + +GLAPI void GLAPIENTRY glFinish( void ); + +GLAPI void GLAPIENTRY glFlush( void ); + +GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); + + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); + + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY glPushMatrix( void ); + +GLAPI void GLAPIENTRY glPopMatrix( void ); + +GLAPI void GLAPIENTRY glLoadIdentity( void ); + +GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); + +GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY glEndList( void ); + +GLAPI void GLAPIENTRY glCallList( GLuint list ); + +GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY glListBase( GLuint base ); + + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY glEnd( void ); + + +GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY glIndexi( GLint c ); +GLAPI void GLAPIENTRY glIndexs( GLshort c ); +GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); + + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, void **params ); + +GLAPI void GLAPIENTRY glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); + + + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLint mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLint mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLint mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + + + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY glMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); +GLAPI void GLAPIENTRY glMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); + + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY glInitNames( void ); + +GLAPI void GLAPIENTRY glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY glPushName( GLuint name ); + +GLAPI void GLAPIENTRY glPopName( void ); + + + +/* 1.2 functions */ +GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + + +/* 1.2 imaging extension functions */ + +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + + + +/* + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) + */ +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); + +#endif /* GL_ARB_multitexture */ + + + + +#if defined(GL_GLEXT_LEGACY) + + +/* + * 1. GL_EXT_abgr + */ +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 + +#define GL_ABGR_EXT 0x8000 + +#endif /* GL_EXT_abgr */ + + + +/* + * 2. GL_EXT_blend_color + */ +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 + +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 + +GLAPI void GLAPIENTRY glBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +#endif /* GL_EXT_blend_color */ + + + +/* + * 3. GL_EXT_polygon_offset + */ +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 + +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 + +GLAPI void GLAPIENTRY glPolygonOffsetEXT( GLfloat factor, GLfloat bias ); + +#endif /* GL_EXT_polygon_offset */ + + + +/* + * 6. GL_EXT_texture3D + */ +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 + +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A + +GLAPI void GLAPIENTRY glTexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +#endif /* GL_EXT_texture3D */ + + + +/* + * 20. GL_EXT_texture_object + */ +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 + +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 + +GLAPI void GLAPIENTRY glGenTexturesEXT( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTexturesEXT( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTextureEXT( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); + +#endif /* GL_EXT_texture_object */ + + + +/* + * 27. GL_EXT_rescale_normal + */ +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 + +#define GL_RESCALE_NORMAL_EXT 0x803A + +#endif /* GL_EXT_rescale_normal */ + + + +/* + * 30. GL_EXT_vertex_array + */ +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 + +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 + +GLAPI void GLAPIENTRY glVertexPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointerEXT( GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointerEXT( GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointerEXT( GLsizei stride, GLsizei count, const GLboolean *ptr ); + +GLAPI void GLAPIENTRY glGetPointervEXT( GLenum pname, void **params ); + +GLAPI void GLAPIENTRY glArrayElementEXT( GLint i ); + +GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ); + +#endif /* GL_EXT_vertex_array */ + + + +/* + * 35. GL_SGIS_texture_edge_clamp + */ +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 + +#define GL_CLAMP_TO_EDGE_SGIS 0x812F + +#endif /* GL_SGIS_texture_edge_clamp */ + + + +/* + * 37. GL_EXT_blend_minmax + */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 + +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 + +GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); + +#endif /* GL_EXT_blend_minmax */ + + + +/* + * 38. GL_EXT_blend_subtract (requires GL_EXT_blend_max ) + */ +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 + +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B + +#endif /* GL_EXT_blend_subtract */ + + + +/* + * 39. GL_EXT_blend_logic_op + */ +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 + +/* No new tokens or functions */ + +#endif /* GL_EXT_blend_logic_op */ + + + +/* + * 54. GL_EXT_point_parameters + */ +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 + +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 + +GLAPI void GLAPIENTRY glPointParameterfEXT( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPointParameterfvEXT( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glPointParameterfSGIS(GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPointParameterfvSGIS(GLenum pname, const GLfloat *params); + +#endif /* GL_EXT_point_parameters */ + + + +/* + * 78. GL_EXT_paletted_texture + */ +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 + +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 + +GLAPI void GLAPIENTRY glColorTableEXT( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTableEXT( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ); + +GLAPI void GLAPIENTRY glGetColorTableEXT( GLenum target, GLenum format, GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfvEXT( GLenum target, GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameterivEXT( GLenum target, GLenum pname, GLint *params ); + +#endif /* GL_EXT_paletted_texture */ + + + +/* + * 79. GL_EXT_clip_volume_hint + */ +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 + +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 + +#endif /* GL_EXT_clip_volume_hint */ + + + +/* + * 97. GL_EXT_compiled_vertex_array + */ +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 + +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 + +GLAPI void GLAPIENTRY glLockArraysEXT( GLint first, GLsizei count ); +GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); + +#endif /* GL_EXT_compiled_vertex_array */ + +/* + * 137. GL_HP_occlusion_test + */ +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 + +#endif /* GL_HP_occlusion_test */ + + +/* + * 141. GL_EXT_shared_texture_palette (req's GL_EXT_paletted_texture) + */ +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 + +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB + +#endif /* GL_EXT_shared_texture_palette */ + + + +/* + * 176. GL_EXT_stencil_wrap + */ +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 + +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 + +#endif /* GL_EXT_stencil_wrap */ + + + +/* + * 179. GL_NV_texgen_reflection + */ +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 + +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 + +#endif /* GL_NV_texgen_reflection */ + + + +/* + * 185. GL_EXT_texture_env_add + */ +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 + +/* No new tokens or functions */ + +#endif /* GL_EXT_texture_env_add */ + + + + + +/* + * 197. GL_MESA_window_pos + */ +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 + +GLAPI void GLAPIENTRY glWindowPos2iMESA( GLint x, GLint y ); +GLAPI void GLAPIENTRY glWindowPos2sMESA( GLshort x, GLshort y ); +GLAPI void GLAPIENTRY glWindowPos2fMESA( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glWindowPos2dMESA( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glWindowPos2ivMESA( const GLint *p ); +GLAPI void GLAPIENTRY glWindowPos2svMESA( const GLshort *p ); +GLAPI void GLAPIENTRY glWindowPos2fvMESA( const GLfloat *p ); +GLAPI void GLAPIENTRY glWindowPos2dvMESA( const GLdouble *p ); +GLAPI void GLAPIENTRY glWindowPos3iMESA( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glWindowPos3sMESA( GLshort x, GLshort y, GLshort z ); +GLAPI void GLAPIENTRY glWindowPos3fMESA( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glWindowPos3dMESA( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glWindowPos3ivMESA( const GLint *p ); +GLAPI void GLAPIENTRY glWindowPos3svMESA( const GLshort *p ); +GLAPI void GLAPIENTRY glWindowPos3fvMESA( const GLfloat *p ); +GLAPI void GLAPIENTRY glWindowPos3dvMESA( const GLdouble *p ); +GLAPI void GLAPIENTRY glWindowPos4iMESA( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glWindowPos4sMESA( GLshort x, GLshort y, GLshort z, GLshort w ); +GLAPI void GLAPIENTRY glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glWindowPos4dMESA( GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void GLAPIENTRY glWindowPos4ivMESA( const GLint *p ); +GLAPI void GLAPIENTRY glWindowPos4svMESA( const GLshort *p ); +GLAPI void GLAPIENTRY glWindowPos4fvMESA( const GLfloat *p ); +GLAPI void GLAPIENTRY glWindowPos4dvMESA( const GLdouble *p ); + +#endif /* GL_MESA_window_pos */ + + + +/* + * 196. GL_MESA_resize_bufffers + */ +#ifndef GL_MESA_resize_bufffers +#define GL_MESA_resize_buffers 1 + +GLAPI void GLAPIENTRY glResizeBuffersMESA( void ); + +#endif /* GL_MESA_resize_bufffers */ + + + +/* + * 220. GL_EXT_texture_env_dot3 + */ +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 + +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 + +#endif /* GL_EXT_texture_env_dot3 */ + + +#else /* GL_GLEXT_LEGACY */ + +//#include + +#endif /* GL_GLEXT_LEGACY */ + + + +/********************************************************************** + * Begin system-specific stuff + */ +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export off +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import off +#endif +/* + * End system-specific stuff + **********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ diff --git a/libs/pvb/include/pvserver/processviewserver.h b/libs/pvb/include/pvserver/processviewserver.h new file mode 100644 index 0000000..34e9793 --- /dev/null +++ b/libs/pvb/include/pvserver/processviewserver.h @@ -0,0 +1,4206 @@ +/*************************************************************************** + processviewserver.h - description + ------------------- + begin : Son Nov 12 09:43:38 CET 2000 + copyright : (C) 2000 by R. Lehrig + : Angel Maza + : Martin Bangieff + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +/* Definitions (Events, Fonts, Colors ...) */ + +#ifndef PROCESSVIEWSERVER_H +#define PROCESSVIEWSERVER_H + +const char pvserver_version[] = "5.1.7"; + +// define WIN +#ifdef _WIN32 +#define PVWIN32 +#include +#include +#define RL_RTLD_LAZY 0 +#endif + +//*** define platform ************************* +// define unix if not already defined +#ifdef __unix__ +#ifndef unix +#define unix +#endif +#endif +#ifdef unix +#define PVUNIX +#include +#define RL_RTLD_LAZY RTLD_LAZY +#endif +//********************************************* + +#include +#include +/* +#ifdef __VMS +#include "vmsgl.h" +#endif +#ifdef _WIN32 +#include "vmsgl.h" +#endif +#ifdef unix +//#include +#include "vmsgl.h" +#endif +*/ +#include "vmsgl.h" + +#ifndef USE_INETD +#include "wthread.h" +#endif + +/** @defgroup DefinesAndEnums Defines and Enums + * These are the Defines and Enums + * @{ */ +/** #define USE_INETD // comment this out if you want to use inetd instead of a multithreaded server +*/ + +#define pv_STDIN 0 +#define pv_STDOUT 1 +//#define pv_CACHE /* do file chaching, comment out if not wanted */ + +#define MAX_PRINTF_LENGTH 1024 /*! max length of pvPrintf buffer (must be less than or equal to MAX_PRINTF_LENGTH of ProcessViewBrowser) */ +#define MAX_EVENT_LENGTH 1024 /*! max length of an event */ +#define MAX_CLIENTS 100 /*! max number of clients */ + +enum MainWindowIds { +ID_ROOTWIDGET = 0, /// # pvHide(p,ID_EDITBAR) pvShow(p,ID_EDITBAR) +ID_EDITBAR = -1, /// # pvHide(p,ID_TOOLBAR) pvShow(p,ID_TOOLBAR) +ID_TOOLBAR = -2, /// # pvHide(p,ID_STATUSBAR) pvShow(p,ID_STATUSBAR) +ID_STATUSBAR = -3, /// # pvResize(p,ID_MAINWINDOW,width,height) +ID_MAINWINDOW = -4, /// # pvHide(p,ID_HELP) pvShow(p,ID_HELP) +ID_HELP = -5, /// # pvPrintf(p,ID_COOKIE,"%s=%s",cookie_name,cookie_values) pvPrintf(p,ID_COOKIE,cookie_name) +ID_COOKIE = -6, /// # pvPrintf(p,ID_TAB,"%s", "title"); +ID_TAB = -7, /// # pvText(p,ID_OPTIONS); +ID_OPTIONS = -8, +ID_DOCK_WIDGETS = -1000 /// # leave some space for dock widgets +}; + +#define MAX_DOCK_WIDGETS 32 + +/* these are the possible events */ +enum PvEvent { +NULL_EVENT=1, +BUTTON_EVENT, +TEXT_EVENT, +SLIDER_EVENT, +CHECKBOX_EVENT, +RADIOBUTTON_EVENT, +GL_IDLE_EVENT, +GL_PAINT_EVENT, +GL_INITIALIZE_EVENT, +GL_RESIZE_EVENT, +TAB_EVENT, +TABLE_CLICKED_EVENT, +TABLE_TEXT_EVENT, +SELECTION_EVENT, +CLIPBOARD_EVENT, +BUTTON_PRESSED_EVENT, +BUTTON_RELEASED_EVENT, +RIGHT_MOUSE_EVENT, +KEYBOARD_EVENT, +PLOT_MOUSE_MOVED_EVENT, +PLOT_MOUSE_PRESSED_EVENT, +PLOT_MOUSE_RELEASED_EVENT, +USER_EVENT, +MOUSE_OVER_EVENT +}; + +/* these are the supported widget types */ +enum +{ +TQWidget = 0, +TQPushButton, +TQLabel, +TQLineEdit, +TQComboBox, +TQLCDNumber, +TQButtonGroup, +TQRadio, +TQCheck, +TQSlider, +TQFrame, +TQImage, +TQDraw, +TQGl, +TQTabWidget, +TQGroupBox, +TQListBox, +TQTable, +TQSpinBox, +TQDial, +TQProgressBar, +TQMultiLineEdit, +TQTextBrowser, +TQListView, +TQIconView, +TQVtk, +TQwtPlotWidget, +TQwtScale, +TQwtThermo, +TQwtKnob, +TQwtCounter, +TQwtWheel, +TQwtSlider, +TQwtDial, +TQwtCompass, +TQwtAnalogClock, +TQDateEdit, +TQTimeEdit, +TQDateTimeEdit, +TQToolBox, +TQVbox, +TQHbox, +TQGrid, +TQCustomWidget +}; + +/* these are the linestyles used in line(x,y,n) */ +enum Linestyle { +LINESTYLE_NONE=0, +LINESTYLE_CIRCLE, +LINESTYLE_CROSS, +LINESTYLE_RECT +}; + +/* these are the available fonts */ +#define HELVETICA "Helvetica" +#define TIMES "Times" +#define COURIER "Courier" +#define OLDENGLISH "OldEnglish" +#define SYSTEM "System" +#define ANYSTYLE "AnyStyle" + +/* font weight */ +enum Weight { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 }; + +/* font alignment */ +enum FontAlignment { /* */ +ALIGN_LEFT=0, /* example */ +ALIGN_CENTER, /* example */ +ALIGN_RIGHT, /* example */ +ALIGN_VERT_CENTER /* e */ +}; /* x */ + /* a */ + /* m */ + /* p */ + /* l */ + /* e */ + +// alignment used in QLabel, QLineEdit +enum AlignmentFlags { + AlignAuto = 0x0000, // text alignment + AlignLeft = 0x0001, + AlignRight = 0x0002, + AlignHCenter = 0x0004, + AlignJustify = 0x0008, + AlignHorizontal_Mask = AlignLeft | AlignRight | AlignHCenter | AlignJustify, + AlignTop = 0x0010, + AlignBottom = 0x0020, + AlignVCenter = 0x0040, + AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter, + AlignCenter = AlignVCenter | AlignHCenter +}; + +enum TextFlags { + SingleLine = 0x0080, // misc. flags + DontClip = 0x0100, + ExpandTabs = 0x0200, + ShowPrefix = 0x0400, + WordBreak = 0x0800, + BreakAnywhere = 0x1000, + DontPrint = 0x2000, + Underline = 0x01000000, + Overline = 0x02000000, + StrikeOut = 0x04000000, + IncludeTrailingSpaces = 0x08000000, + NoAccel = 0x4000 +}; + +enum TextCursor { + NoMove = 0, // Keep the cursor where it is + Start, // Move to the start of the document. + StartOfLine, // Move to the start of the current line. + StartOfBlock, // Move to the start of the current block. + StartOfWord, // Move to the start of the current word. + PreviousBlock, // Move to the start of the previous block. + PreviousCharacter, // Move to the previous character. + PreviousWord, // Move to the beginning of the previous word. + Up, // Move up one line. + Left, // Move left one character. + WordLeft, // Move left one word. + End, // Move to the end of the document. + EndOfLine, // Move to the end of the current line. + EndOfWord, // Move to the end of the current word. + EndOfBlock, // Move to the end of the current block. + NextBlock, // Move to the beginning of the next block. + NextCharacter, // Move to the next character. + NextWord, // Move to the next word. + Down, // Move down one line. + Right, // Move right one character. + WordRight +}; + +/* font italic can be one of this */ +enum FontNormalItalic +{ + NORMAL = 0, + ITALIC = 1 +}; + +/* insertion policies for QComboBox */ +enum Policy { NoInsertion=0, AtTop, AtCurrent, AtBottom, AfterCurrent, BeforeCurrent }; + +/* some predefined colors */ +#define RED 255,0,0 +#define GREEN 0,255,0 +#define BLUE 0,0,255 +#define WHITE 255,255,255 +#define BLACK 0,0,0 +#define YELLOW 255,255,0 +#define LILA 255,0,255 +#define CYAN 0,255,255 +#define DARK_GREY 128,128,128 +#define LIGHT_GREY 180,180,180 +#define WHEAT 213,213,154 +#define DARK_RED 128,0,0 +#define DARK_GREEN 0,128,0 +#define DARK_LILA 128,0,128 +#define DARK_CYAN 0,128,128 +#define DARK_YELLOW 200,200,0 +#define DARK_BLUE 0,0,128 + +/* definition for LCD numbers */ +enum Mode { HEX=0, DEC, OCT, BINx }; +enum Mode2 { Hex=0, Dec, Oct, Bin }; +enum SegmentStyle { Outline=0, Filled, Flat }; + +/* definitions for QSlider */ +enum ORIENTATION +{ + HORIZONTAL = 0, + VERTICAL = 1 +}; + +enum Orientation +{ + Horizontal = HORIZONTAL, + Vertical = VERTICAL +}; + +/* definitions for MouseShape */ +enum MouseShape { + ArrowCursor = 0, // The standard arrow cursor. + UpArrowCursor = 1, // An arrow pointing upwards toward the top of the screen. + CrossCursor = 2, // A crosshair cursor, + //typically used to help the user accurately select a point on the screen. + WaitCursor = 3, // An hourglass or watch cursor, + // usually shown during operations that prevent the user + // from interacting with the application. + IBeamCursor = 4, // A caret or ibeam cursor, indicating that a widget can accept and display text input. + SizeVerCursor = 5, // A cursor used for elements that are used to vertically resize top-level windows. + SizeHorCursor = 6, // A cursor used for elements that are used to horizontally resize top-level windows. + SizeFDiagCursor = 8, // A cursor used for elements that are used to diagonally resize top-level + // windows at their top-left and bottom-right corners. + SizeBDiagCursor = 7, // A cursor used for elements that are used to diagonally resize top-level + // windows at their top-right and bottom-left corners. + SizeAllCursor = 9, // A cursor used for elements that are used to resize top-level windows in any direction. + BlankCursor = 10, // A blank/invisible cursor, typically used when the cursor shape needs to be hidden. + SplitVCursor = 11, // A cursor used for vertical splitters, indicating that a handle can be + // dragged horizontally to adjust the use of available space. + SplitHCursor = 12, // A cursor used for horizontal splitters, indicating that a handle can be + // dragged vertically to adjust the use of available space. + PointingHandCursor = 13, // A pointing hand cursor that is typically used for clickable elements + // such as hyperlinks. + ForbiddenCursor = 14, // A slashed circle cursor, typically used during drag and drop operations to + // indicate that dragged content cannot be dropped on particular widgets + // or inside certain regions. + OpenHandCursor = 17, // A cursor representing an open hand, typically used to indicate that the area + // under the cursor is the visible part of a canvas that the user + // can click and drag in order to scroll around. + ClosedHandCursor = 18, // A cursor representing an open hand, typically used to indicate that a + // dragging operation is in progress that involves scrolling. + WhatsThisCursor = 15, // An arrow with a question mark, typically used + BusyCursor = 16 +}; + +/* definitions for QFrame */ +enum Shape { +NoFrame = 0, /* no frame */ +Box = 0x0001, /* rectangular box */ +Panel = 0x0002, /* rectangular panel */ +WinPanel = 0x0003, /* rectangular panel (Windows) */ +HLine = 0x0004, /* horizontal line */ +VLine = 0x0005, /* vertical line */ +StyledPanel = 0x0006, /* rectangular panel depending on the GUI style */ +PopupPanel = 0x0007, /* rectangular panel depending on the GUI style */ +MenuBarPanel = 0x0008, +ToolBarPanel = 0x0009, +LineEditPanel = 0x000a, +TabWidgetPanel = 0x000b, +GroupBoxPanel = 0x000c, +MShape = 0x000f /* mask for the shape */ +}; + +enum Shadow{ +Plain = 0x0010, /* plain line */ +Raised = 0x0020, /* raised shadow effect */ +Sunken = 0x0030, /* sunken shadow effect */ +MShadow = 0x00f0 }; /* mask for the shadow */ + +enum FileDialogs{ +FileOpenDialog = 0, +FileSaveDialog, +FindDirectoryDialog}; + +enum MessageBoxTypes{ +BoxInformation = 0, +BoxWarning, +BoxCritical}; + +enum MessageBoxButtons{ +MessageBoxOk = 0x00000400, +MessageBoxOpen = 0x00002000, +MessageBoxSave = 0x00000800, +MessageBoxCancel = 0x00400000, +MessageBoxClose = 0x00200000, +MessageBoxDiscard = 0x00800000, +MessageBoxApply = 0x02000000, +MessageBoxReset = 0x04000000, +MessageBoxRestoreDefaults = 0x08000000, +MessageBoxHelp = 0x01000000, +MessageBoxSaveAll = 0x00001000, +MessageBoxYes = 0x00004000, +MessageBoxYesToAll = 0x00008000, +MessageBoxNo = 0x00010000, +MessageBoxNoToAll = 0x00020000, +MessageBoxAbort = 0x00040000, +MessageBoxRetry = 0x00080000, +MessageBoxIgnore = 0x00100000, +MessageBoxNoButton +}; + +enum TextBrowserPos{ +Home = 0, +Forward, +Backward, +Reload}; + +enum TabWidgetPos{ +Top = 0, +Bottom}; + +enum KeyboardModifiers{ +ShiftButton = 4, +ControlButton = 3, +AltButton = 2, +NormalKey = 1 +}; + +enum KeyCodes{ +Key_Escape = 0x1000000, +Key_Pause = 0x1000008, +Key_Print = 0x1000009, +Key_SysReq = 0x100000a, +Key_PageUp = 0x1000016, +Key_PageDown = 0x1000017, +Key_F1 = 0x1000030, +Key_F2 = 0x1000031, +Key_F3 = 0x1000032, +Key_F4 = 0x1000033, +Key_F5 = 0x1000034, +Key_F6 = 0x1000035, +Key_F7 = 0x1000036, +Key_F8 = 0x1000037, +Key_F9 = 0x1000038, +Key_F10 = 0x1000039, +Key_F11 = 0x100003a, +Key_F12 = 0x100003b +}; + +enum QpwLegend { BottomLegend = 0, TopLegend, LeftLegend, RightLegend}; +enum QwtAxis { yLeft, yRight, xBottom, xTop, axisCnt }; +enum QwtAutoscale { pvNone = 0, IncludeRef = 1, Symmetric = 2, Floating = 4, Logarithmic = 8, Inverted = 16 }; +enum ScalePosition { ScaleLeft, ScaleRight, ScaleTop, ScaleBottom }; +enum ThermoPosition { ThermoNone, ThermoLeft, ThermoRight, ThermoTop, ThermoBottom}; +enum KnobSymbol { KnobLine, KnobDot }; +enum CounterButton { CounterButton1, CounterButton2, CounterButton3, CounterButtonCnt }; +enum SliderScalePos { SliderNone, SliderLeft, SliderRight, SliderTop, SliderBottom }; +enum SliderBGSTYLE { SliderBgTrough = 0x1, SliderBgSlot = 0x2, SliderBgBoth = SliderBgTrough | SliderBgSlot}; +enum DialShadow { DialPlain = Plain, DialRaised = Raised, DialSunken = Sunken }; +enum DialMode { RotateNeedle, RotateScale }; +enum DialNeedle { QwtDialNeedle1 = 1, QwtDialNeedle2, QwtDialNeedle3, QwtDialNeedle4, QwtDialLineNeedle, QwtDialArrowNeedle}; +enum CompassNeedle { QwtCompassNeedle1 = 1, QwtCompassNeedle2, QwtCompassNeedle3, QwtCompassNeedle4, QwtCompassLineNeedle }; +enum PenStyle { NoPen, SolidLine, DashLine, DotLine, DashDotLine, DashDotDotLine, MPenStyle = 0x0f }; +enum MarkerSymbol { MarkerNone, MarkerEllipse, MarkerRect, MarkerDiamond, MarkerTriangle, MarkerDTriangle, MarkerUTriangle, MarkerLTriangle, MarkerRTriangle, MarkerCross, MarkerXCross, MarkerStyleCnt }; + +enum ButtonClicked { NoButton = 0, LeftButton, MiddleButton, RightButton }; + +enum Order { DMY, MDY, YMD, YDM }; + +enum SetTextOption { HTML_HEADER = 1, HTML_STYLE, HTML_BODY }; + +typedef struct +{ + int event; + int i; + char text[MAX_EVENT_LENGTH]; +} +PARSE_EVENT_STRUCT; + +/* thread parameters */ +typedef struct _PARAM_ +{ + int s; /* socket */ + int os; /* original socket */ + int port; /* our port */ + int language; /* language or DEFAULT_LANGUAGE */ + int convert_units; /* 1 if units must be converted */ + FILE *fp; /* filepointer */ + int sleep; /* sleep time in milliseconds */ + int (*cleanup)(void *); /* cleanup for user code */ + void *app_data; /* application data for cleanup */ + void *user; /* pointer to user data */ + char *clipboard; /* pointer to clipboard text | NULL */ + long clipboard_length; /* sizeof clipboard contents */ + int modal; /* modal dialog */ + int (*readData)(void *d); /* modal dialog */ + int (*showData)(_PARAM_ *p, void *d); /* modal dialog */ + void *modal_d; /* modal dialog */ + void *modalUserData; /* modal dialog */ + PARSE_EVENT_STRUCT parse_event_struct; + float *x; /* array buffer for script language */ + float *y; /* array buffer for script language */ + int nxy; /* number of elements in arry */ + char url[MAX_PRINTF_LENGTH]; /* url the client is using */ + char initial_mask[MAX_PRINTF_LENGTH]; /* initial mask user wants to see */ + char file_prefix[32]; /* prefix for temporary files */ + /* files with this prefix will be */ + /* deleted on connection lost */ + int free; /* free structure */ + char version[32]; /* pvbrowser VERSION of client */ + char pvserver_version[32]; /* pvserver VERSION */ + int exit_on_bind_error; /* exit if we can not bind on port */ + int hello_counter; /* for thread timeout if no @hello */ + int local_milliseconds; /* time of last call to select() */ + int force_null_event; /* force null_event for better update */ + /* if the user has tabs within his */ + /* client the invisible tab are */ + /* paused by default */ + int allow_pause; /* 0 not allowed else allowed */ + int pause; /* pause=1 if tab invisible else 0 */ + /* you can test pause in NULL_EVENT */ + int my_pvlock_count; /* used to avoid deadlock by repeated */ + /* call of pvlock */ + int num_additional_widgets; /* additional widgets after */ + /* ID_END_OF_WIDGETS */ + int mouse_x, mouse_y; /* last mouse pos when pressed */ + char *mytext; /* buffer for internal use only */ + const char *communication_plugin; /* pointer to commandline arg or NULL */ + int use_communication_plugin; /* can also be set at runtime */ + char lang_section[32]; /* use pvSelectLanguage() */ + char *mytext2; /* temp used in language translation */ + int http; /* 0|1 talk http */ + FILE *fptmp; /* temporary file pointer */ + int fhdltmp; /* temporary file handle */ + int iclientsocket; /* 0 <= iclientsockert < MAX_CLIENTS index into clientsocket[] */ + int is_binary; /* 0 for text message 1 otherwise */ + int button; /* last clicked button */ +}PARAM; + +#ifndef __VMS +typedef int (*plugin_pvAccept)(PARAM *p); +typedef int (*plugin_pvtcpsend_binary)(PARAM *p, const char *buf, int len); +typedef int (*plugin_pvtcpreceive)(PARAM *p, char *buf, int maxlen); +typedef int (*plugin_pvtcpreceive_binary)(PARAM *p, char *buf, int maxlen); +typedef int (*plugin_closesocket)(int s, PARAM *p); +#endif + +#define DEFAULT_LANGUAGE 0 + +#ifndef pvtr +#define pvtr(txt) txt +#endif + +enum UNIT_CONVERSION +{ + MM2INCH = 1, + INCH2MM , + CM2FOOT , + FOOT2CM , + CM2YARD , + YARD2CM , + KM2MILE , + MILE2KM , + KM2NAUTICAL_MILE , + NAUTICAL_MILE2KM , + QMM2SQINCH , + SQINCH2QMM , + QCM2SQFOOT , + SQFOOT2QCM , + QM2SQYARD , + SQYARD2QM , + QM2ACRE , + ACRE2QM , + QKM2SQMILE , + SQMILE2QKM , + ML2TEASPOON , + TEASPOON2ML , + ML2TABLESPOON , + TABLESPOON2ML , + ML2OUNCE , + OUNCE2ML , + L2CUP , + CUP2L , + L2PINT , + PINT2L , + L2QUART , + QUART2L , + L2GALLON , + GALLON2L , + GR2OUNCE , + OUNCE2GR , + KG2POUND , + POUND2KG , + T2TON , + TON2T , + C2FAHRENHEIT , + FAHRENHEIT2C +}; + +static const char null_string[] = ""; + +enum TextEvents +{ + PLAIN_TEXT_EVENT = 0, + SVG_LEFT_BUTTON_PRESSED, + SVG_MIDDLE_BUTTON_PRESSED, + SVG_RIGHT_BUTTON_PRESSED, + SVG_LEFT_BUTTON_RELEASED, + SVG_MIDDLE_BUTTON_RELEASED, + SVG_RIGHT_BUTTON_RELEASED, + SVG_BOUNDS_ON_ELEMENT, + SVG_MATRIX_FOR_ELEMENT, + WIDGET_GEOMETRY, + PARENT_WIDGET_ID +}; + +typedef struct +{ + int i[10]; + int i0,i1,i2,i3,i4,i5,i6,i7,i8,i9; +}IntegerArray; + +typedef struct +{ + float f[10]; + int f0,f1,f2,f3,f4,f5,f6,f7,f8,f9; +}FloatArray; + +typedef struct +{ + int millisecond; + int second; + int minute; + int hour; + int day; + int month; + int year; +}pvTime; + +typedef struct +{ + int s; // socket + int version; // ip version 4|6 + unsigned char adr[16]; // remote ip address +}pvAddressTableItem; + +typedef struct +{ + pvAddressTableItem adr[MAX_CLIENTS]; +}pvAddressTable; + +/* this is for convenience when you want to write files */ +#define PARAM_P PARAM p;pvInit(0,NULL,&p); + +/* wait with pvWait(INITIALIZE_GL) before you initialize you OpenGL scene */ +#define INITIALIZE_GL "initializeGL" +#define RESIZE_GL "resizeGL" + +/** @} */ // end of group + +/** @defgroup IniAndGlobal Initialisation and global routines + * These routines are used for initialisation. And also some global usable routines are available. + * @{ */ +int glencode_set_param(PARAM *p); +/*!
+If you access variables that are global to the server or
+if you want to use malloc() and free()
+you must surround the operations with
+pvlock() and pvunlock()
+because these operations are not thread save.
+
*/ +int pvlock(PARAM *p); +/*!
+If you access variables that are global to the server or
+if you want to use malloc() and free()
+you must surround the operations with
+pvlock() and pvunlock()
+because these operations are not thread save.
+
*/ +int pvunlock(PARAM *p); +/*!
+Same as system(command); but portable
+
*/ +int pvsystem(const char *command); +/*!
+Get local time
+
*/ +void pvGetLocalTime(pvTime *pvtime); +/*!
+Test if access is allowed by files "allow.ipv4" and "deny.ipv4" in your local directory
+adr := dottet ip address
+trace = 1 print messages on stdout
+trace = 0 do not print messages on stdout
+return = 1 access allowed
+return = 0 access is not allowed
+
+Example allow.ipv4:
+1.0.0.127/32         # allow localhost
+192.168.1.0/24       # allow 192.168.1.0 - 192.168.1.255
+# insert more areas here
+
+Example deny.ipv4:
+# deny a individual address
+192.168.2.14/32
+# insert more areas here
+
+The number behind the / is the number of significant bits of the ip address.
+Every pvserver will evaluate "allow.ipv4 and "deny.ipv4" when client connects.
+
*/ +int pvIsAccessAllowed(const char *adr, int trace); +/*!
+Send version of pvserver to client
+
*/ +int pvSendVersion(PARAM *p); +/*!
+Allocate x,y array for script language
+
*/ +int pvXYAllocate(PARAM *p, int n); +/*!
+Get integer array from string for script language
+
*/ +int getIntegers(const char *text, IntegerArray *ia); +/*!
+Get integer array from string for script language
+
*/ +int getFloats(const char *text, FloatArray *fa); +/*!
+Get text in parentesis from text for script language
+
*/ +const char *getTextFromText(const char *text); +/*!
+Set x,y array for script language
+
*/ +int pvSetXY(PARAM *p, int i, float x, float y); +/*!
+Get a pointer to the socket for script language
+
*/ +int *pvGetSocketPointer(PARAM *p); +/*!
+see pvInit
+Init for script languages
+
*/ +int pvInitInternal(PARAM *p); +/*!
+(Test) pvInit must be called in main(). It interprets the command line switches that it knows.
+Afterwards you can interpret your command line switches. It is possible to set p.user to data
+of your choice. This data will be available in the worker threads. (Caution: the worker threads are
+only allowed to read the p.user data because it is shared among all clients)
+Then there must be a while(1) in which new clients are accepted. For each client a new thread
+is created.
+
+ int main(int ac, char **av)
+ {
+ PARAM p;
+ int   s;
+
+   pvInit(ac,av,&p);
+   // here you may interpret ac,av and set p.user to your data
+   while(1)
+   {
+     s = pvAccept(&p);
+     if(s != -1) pvCreateThread(&p,s);
+   }
+   return 0;
+ }
+
*/ +int pvInit(int ac, char **av, PARAM *p); +/*!
+see pvInit
+
*/ +int pvAccept(PARAM *p); +/*!
+see pvInit
+
*/ +int pvCreateThread(PARAM *p, int s); +/*!
+Get the initial mask the user wants to see
+p->initial_mask is a string identifying the initial mask 
+
*/ +int pvGetInitialMask(PARAM *p); +/*!
+pvMain is your main worker thread. It could look as follows.
+The main worker thread is never closed. It will be closed automatically when the client disconnects.
+
+int pvMain(PARAM *p)
+{
+int ret;
+
+  // here you can initialize your worker thread
+  pvSetCleanup(p,your_exit_handler,your_app_data); // if cleanup is necessary
+  pvResize(p,0,970,600);  // this will resize your working area
+  ret = showMask1(p);
+  while(1)
+  {
+    switch(ret)
+    {
+      case 1:
+        ret = showMask1(p);
+        break;
+      case 2:
+        ret = showMask2(p);
+        break;
+      case 3:
+        ret = showMask3(p);
+        break;
+      default:
+        return 0;
+    }
+  }
+}
+
*/ +int pvMain(PARAM *p); +/*!
+If it is necessary to cleanup your application when the main worker thread terminates
+you can set an exit handler that receives the data in app_data.
+Call this function in pvMain. See also pvMain.
+
*/ +int pvSetCleanup(PARAM *p, int (*cleanup)(void *), void *app_data); +/*!
+If it is necessary to cleanup your application when the main worker thread terminates
+you can set an exit handler that receives the data in app_data.
+Call this function in pvMain. See also pvMain.
+
*/ +char *pvGetEvent(PARAM *p); +/*!
+This function will return the next event as soon as it is available.
+The maximum wait time is p->sleep in milliseconds (default 100).
+You can specify a different wait time on the commandline (-sleep=1000)
+
+Example:
+
+ int showMask1(PARAM *p)
+ {
+ DATA d;
+ char event[MAX_EVENT_LENGTH];
+ int  i;
+ char text[MAX_EVENT_LENGTH];
+
+   defineMask1(p);
+   readData1(&d); // from shared memory or out of database
+   showData1(p,&d);
+   while(1)
+   {
+     pvPollEvent(p,event);
+     switch(pvParseEvent(event, &i, text))
+     {
+       case NULL_EVENT:
+         readData1(&d); // from shared memory or out of database
+         showData1(p,&d);
+         break;
+       case BUTTON_EVENT:
+         ...
+         break;
+       case TEXT_EVENT:
+         ...
+         break;
+       default:
+         printf("UNKNOWN_EVENT id=\%d \%s\\n",i,text);
+         break;
+     }
+   }
+ }
+
*/ +int pvPollEvent(PARAM *p, char *event); +/*!
+waits for an event.
+
*/ +int pvWait(PARAM *p, const char *pattern); +/*!
+update OpenGL widget
+
*/ +int pvGlUpdate(PARAM *p, int id); +/*!
+Sleep for milliseconds.
+
*/ +int pvSleep(int milliseconds); +/*!
+Output a warning message.
+
*/ +int pvWarning(PARAM *p, const char *text); +/*!
+Output a fatal message and terminate the whole server.
+
*/ +int pvMainFatal(PARAM *p, const char *text); +/*!
+Output a fatal message and terminate the worker thread.
+
*/ +int pvThreadFatal(PARAM *p, const char *text); +/*!
+Output a screenHint for calculating the zoom factor
+Optimal screen width=w height=h .
+
*/ +int pvScreenHint(PARAM *p, int w, int h); +/*!
+Set mouse shape
+#MouseShape.
+
*/ +int pvSetMouseShape(PARAM *p, int shape); +/*!
+Set whatsThis text
+Allowed Widgets: all Widgets
+
*/ +int pvSetWhatsThis(PARAM *p, int id, const char *text); +/*!
+printf whatsThis text
+Allowed Widgets: all Widgets
+
*/ +int pvWhatsThisPrintf(PARAM *p, int id, const char *format, ...); +/*!
+Run command on client.
+command := pdf | img | svg | txt | csv | html | audio | video | save_as
+See view.pdf, view.img, view.svg ... within pvbrowser options.
+
*/ +int pvClientCommand(PARAM *p, const char *command, const char *filename, int downloadFile=0); +/*!
+Write "text" to a file "filename" in temp directory at client.
+
*/ +int pvWriteTextToFileAtClient(PARAM *p, const char *text, const char *filename); +/*!
+Zoom the whole mask.
+Zoom factor in percent.
+
*/ +int pvZoomMask(PARAM *p, int percent); +/*!
+Set the URL which will be used for Help->Manual within pvbrowser.
+default: index.html
+You could also set the URL of a webserver which hosts your documentation.
+Example:
+pvSetManualUrl(p,"http://your.server.org");
+
*/ +int pvSetManualUrl(PARAM *p, const char *url); +/*!
+Select the section for language translations with the pvtr() macro.
+
+processviewserver.h defines the macro
+#define pvtr(txt) txt
+
+If you use something like pvSetText(p,id,pvtr("Hello World"));
+the above macro will return the original untranslated text.
+
+If you #include "rlinifile.h" the macro pvtr will be redefined to
+#define pvtr(txt) rltranslate2(p->lang_section,txt)
+Thus the subroutine rltranslate2() will be called.
+This routine will also return the untranslated text until you call
+
+rlSetTranslator("GERMAN","translation.ini");
+
+within your main() program.
+The above call to rlSetTranslator() will read the ini file "translation.ini" and
+set the default section to "GERMAN".
+This will be the default language within your pvserver.
+
+If your translation.ini looks like
+[GERMAN]
+Hello World=Hallo Welt
+
+the call to pvtr("Hello World") will return "Hallo Welt".
+If there is no translation for a phrase then the original untranslated text will be returned.
+
+Now you might want that each client can choose his own language.
+This can be done by calling
+
+pvSelectLanguage(p,"YOUR_LANGUAGE");
+
+within pvMain() or one of your masks.
+Hint: after changing the language you should return from the mask
+with a return value that will call the mask again and will show the mask in the new language.
+
+If the strings within the ini file include "=" characters you must quote them as "\=".
+Also tabs and newline characters must be quoted as "\t" and "\n".
+Within the graphical designer of pvdevelop you must use 2 quotes instead of one "\\=", "\\t" and "\\n".
+
+Background:
+We use an INI file for language translation.
+The section names the language.
+The original text is used to select the translation.
+
*/ +int pvSelectLanguage(PARAM *p, const char *section); + +/*!
+This function is intended for script languages.
+It will translate text to different languages.
+See pvSelectLanguage()
+C/C++ pvservers may use the pvtr(txt) macro instead.
+
*/ +//const char *pvTr(PARAM *p, const char *text); +/** @} */ // end of group + +/** @defgroup Contruction Construction + * These are the construction routines for the widgets. + * Normally you need not to use them because these calls are generated by ui2pvc. + * @{ */ + +/*!
+Call this function first when you want to define a new mask.
+Your enum for the mask should always contain ID_END_OF_WIDGETS as the last element.
+
+Example:
+
+pvStartDefinition(p,ID_END_OF_WIDGETS);
+
+You can allocate space for additional widgets after ID_END_OF_WIDGETS by setting 
+p->num_additional_widgets = number;
+
*/ +int pvStartDefinition(PARAM *p, int num_objects); +/*!
+Creates a new QWidget. It's id can be used to identify it. It's parent widget is parent.
+You can set one widget on top of another widget if you set parent to the parent widgets id.
+When parent == 0 the widget will be set on the background screen (ID_MAIN_WIDGET).
+QWidget draws nothing, but it is useful to group objects hierarchically.
+
+Functions that apply to this widget:
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+
*/ +int pvQWidget(PARAM *p, int id, int parent); + +/*!
+Layout Vbox
+
*/ +int pvQLayoutVbox(PARAM *p, int id, int parent); + +/*!
+Layout Hbox
+
*/ +int pvQLayoutHbox(PARAM *p, int id, int parent); + +/*!
+Layout Grid
+
*/ +int pvQLayoutGrid(PARAM *p, int id, int parent); + +/*!
+Creates a new QLabel. See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetAlignment()
+pvSetText()
+pvPrintf()
+pvSetBackgroundColor()
+pvText()
+pvSetStyle()
+pvSetMovie()
+pvMovieControl()
+pvMovieSpeed()
+
*/ +int pvQLabel(PARAM *p, int id, int parent); +/*!
+editable = 0  not editable
+editable = 1  user can edit combo box
+#Policy.
+Creates a new QComboBox. See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetAlignment()
+pvSetText()
+pvPrintf()
+pvClear()
+pvInsertItem()
+pvRemoveItem()
+pvRemoveItemByName()
+pvSetCurrentItem()
+pvSetEditable()
+
*/ +int pvQComboBox(PARAM *p, int id, int parent, int editable, int policy); +/*!
+Creates a new QLineEdit. See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetAlignment()
+pvSetText()
+pvPrintf()
+pvText()
+pvSetEditable()
+pvSetStyle()
+pvSetEchoMode()
+
*/ +int pvQLineEdit(PARAM *p, int id, int parent); +/*!
+Creates a new QPushButton. See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetText()
+pvPrintf()
+pvSetPixmap()
+pvText()
+
*/ +int pvQPushButton(PARAM *p, int id, int parent); +/*!
+Creates a new QLCDNumber.
+#Mode. #SegmentStyle.
+enum Mode         { HEX=0, DEC, OCT, BIN };
+enum SegmentStyle { Outline=0, Filled, Flat };
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvDisplayNum()
+pvDisplayFloat()
+pvDisplayStr()
+pvSetStyle()
+
*/ +int pvQLCDNumber(PARAM *p, int id, int parent, int numDigits, int segmentStyle, int mode); +/*!
+Creates a new QSlider. See also pvQWidget().
+orientation = HORIZONTAL|VERTICAL
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetMinValue()
+pvSetMaxValue()
+pvSetValue()
+
*/ +int pvQSlider(PARAM *p, int id, int parent, int minValue, int maxValue, int pageStep, int value, int orientation); +/*!
+Creates a new QButtonGroup. See also pvQWidget().
+orientation = HORIZONTAL|VERTICAL
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+
*/ +int pvQButtonGroup(PARAM *p, int id, int parent, int columns, int orientation, const char *title); +/*!
+Creates a new QRadioButton. See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetText()
+pvPrintf()
+pvSetChecked()
+
*/ +int pvQRadioButton(PARAM *p, int id, int parent); +/*!
+Creates a new QCheckBox. See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetText()
+pvPrintf()
+pvSetChecked()
+
*/ +int pvQCheckBox(PARAM *p, int id, int parent); +/*!
+Creates a new QFrame. See also pvQWidget().
+#Shape. #Shadow.
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetStyle()
+
*/ +int pvQFrame(PARAM *p, int id, int parent, int shape, int shadow, int line_width, int margin); +/*!
+Creates a new QDrawWidget. See also pvQWidget().
+This type of widget can be used to draw diagrams and whatever you want.
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetSelector()
+pvPrintSvgOnPrinter()
+pvRenderTreeDump()
+pvSetBufferTransparency()
+pvSaveDrawBuffer()
+See Module: Graphics
+
*/ +int pvQDraw(PARAM *p, int id, int parent); +/*!
+Creates a new QImage. See also pvQWidget().
+
+If you specify the name of a 8bpp bmp file:
+w = width of image will be returned   (w must be a multiple of 2)
+h = height of image will be returned  (h must be a multiple of 2)
+depth = number of bits per pixel (currently only 8 is supported)
+A color of red=1 green=1 blue=1 will be treated as transparent
+
+If you specify any other file format:
+1) The format must be supported by Qt
+2) you have to download the file to the client first
+   see: int pvDownloadFile(PARAM *p, const char *filename);
+w = 0
+h = 0
+depth = 0
+will be returned
+
+Using Qt Designer:
+Insert a QFrame
+set paletteBackgroundPixmap in the Property Editor pane and select a graphics file
+set whatsThis=filename in the Property Editor pane
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetImage()
+pvSetBufferedJpgImage()
+pvPassThroughOneJpegFrame()
+pvSendJpegFrame()
+ 
*/ +int pvQImage(PARAM *p, int id, int parent, const char *imagename, int *w=NULL, int *h=NULL, int *depth=NULL); +/*!
+Creates a new OpenGL Widget . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+See Module: OpenGL
+
*/ +int pvQGL(PARAM *p, int id, int parent); +/*!
+Creates a new QTabWidget . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetValue()
+pvSetTabPosition()
+pvEnableTabBar()
+
*/ +int pvQTabWidget(PARAM *p, int id, int parent); +/*!
+Creates a new QToolBox . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetValue()
+pvSetStyle()
+
*/ +int pvQToolBox(PARAM *p, int id, int parent); +/*!
+Creates a new QGroupBox . See also pvQWidget().
+orientation = HORIZONTAL|VERTICAL
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetStyle()
+
*/ +int pvQGroupBox(PARAM *p, int id, int parent, int columns, int orientation, const char *title); +/*!
+Creates a new QListBox . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvClear()
+pvChangeItem()
+pvInsertItem()
+pvRemoveItem()
+pvRemoveItemByName()
+pvSelection()
+pvSetMultiSelection()
+pvListBoxSetSelected();
+
*/ +int pvQListBox(PARAM *p, int id, int parent); +/*!
+Creates a new QTable . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetTableText()
+pvSetTableButton()
+pvSetTableCheckBox()
+pvSetTableComboBox()
+pvSetTableLabel()
+pvTablePrintf()
+pvClear();
+pvSetColumnWidth()
+pvSetRowHeight()
+pvSetWordWrap()
+pvSetTablePixmap()
+pvEnsureCellVisible()
+pvSetEditable()
+pvTableSetEnabled()
+pvTableSetHeaderResizeEnabled()
+pvSetNumRows()
+pvSetNumCols()
+pvInsertRows()
+pvInsertColumns()
+pvRemoveRow()
+pvRemoveColumn()
+pvSetTableTextAlignment();
+pvSave()
+pvMysqldump()
+pvCSVcreate()
+pvCSVdump()
+pvCSV()
+
*/ +int pvQTable(PARAM *p, int id, int parent, int rows, int columns); +/*!
+Creates a new QSpinBox . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetMinValue()
+pvSetMaxValue()
+pvSetValue()
+
*/ +int pvQSpinBox(PARAM *p, int id, int parent, int min, int max, int step); +/*!
+Creates a new QDial . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetMinValue()
+pvSetMaxValue()
+pvSetValue()
+
*/ +int pvQDial(PARAM *p, int id, int parent, int min, int max, int page_step, int value); +/*!
+Creates a new QProgressBar . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetMinValue()
+pvSetMaxValue()
+pvSetValue()
+pvSetStyle()
+
*/ +int pvQProgressBar(PARAM *p, int id, int parent, int total_steps, int orientation = Horizontal); +/*!
+Creates a new QMultiLineEdit . See also pvQWidget().
+editable = 0|1
+if max_lines == -1 then no limit
+Because of port from Qt3->Qt4 max_lines must be ignored.
+Please use pvSetValue() instead.
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetText()
+pvPrintf()
+pvClear()
+pvText()
+pvSetEditable()
+pvSetValue()
+pvMoveCursor()
+
*/ +int pvQMultiLineEdit(PARAM *p, int id, int parent, int editable, int max_lines); +/*!
+Creates a new QTextBrowser . See also pvQWidget().
+QTextBrowser is now a WebKit Widget
+editable = 0|1
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetText()
+pvPrintf()
+pvSetSource()
+pvMoveContent()
+pvMoveCursor()
+pvScrollToAnchor()
+pvSetZoomFactor()
+pvPrintHtmlOnPrinter()
+
*/ +int pvQTextBrowser(PARAM *p, int id, int parent); +/*!
+Creates a new QListView . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvClear()
+pvAddColumn()
+pvRemoveAllColumns()
+pvSetListViewText()
+pvListViewPrintf()
+pvListViewSetSelected()
+pvSetListViewPixmap()
+pvRemoveListViewItem()
+pvSelection()
+pvSetMultiSelection()
+pvSetSorting()
+pvListViewEnsureVisible()
+pvListViewSetHidden()
+pvListViewSetStandardPopupMenu()
+
*/ +int pvQListView(PARAM *p, int id, int parent); +/*!
+Creates a new QIconView . See also pvQWidget().
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvClear()
+pvRemoveIconViewItem()
+pvSetIconViewItem()
+
*/ +int pvQIconView(PARAM *p, int id, int parent); +/*!
+Creates a new QVtkTclWidget . See also pvQWidget().
+
+You can use this widget to use VTK for 3D Graphics.
+Use pvVtkTcl()          to send single Tcl commands.
+Use pvVtkTclPrintf()    to send single Tcl commands (use like printf).
+Use pvVtkTclScript()    to send Tcl programs.
+
+The constructor also runs the Tcl commands:
+package require vtk
+package require vtkinteraction
+package require vtktesting
+vtkRenderer renderer4
+vtkRenderer renderer3
+vtkRenderer renderer2
+vtkRenderer renderer
+
+renderer4 is connected to your widget !!!
+renderer3 is connected to your widget !!!
+renderer2 is connected to your widget !!!
+renderer  is connected to your widget !!!
+
+The destructor also runs the Tcl command:
+vtkCommand DeleteAllObjects
+
*/ +int pvQVtkTclWidget(PARAM *p, int id, int parent); +/*!
+Call this function to create a QWT Plot Widget.
+nCurves = Max Number of Curves in Plot
+nMarker = Max Number of Markers in Plot
+
+See Module: QwtPlotWidget 
+
*/ +int pvQwtPlotWidget(PARAM *p, int id, int parent, int nCurves, int nMarker); +/*!
+Call this function to create a QwtScale.
+
+See Module: QwtScale 
+
*/ +int pvQwtScale(PARAM *p, int id, int parent, int pos); +/*!
+Call this function to create a QwtThermo.
+
+See Module: QwtThermo 
+
*/ +int pvQwtThermo(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtKnob.
+
+See Module: QwtKnob
+
*/ +int pvQwtKnob(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtCounter.
+
+See Module: QwtCounter 
+
*/ +int pvQwtCounter(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtWheel.
+
+See Module: QwtWheel 
+
*/ +int pvQwtWheel(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtSlider.
+
+See Module: QwtSlider 
+
*/ +int pvQwtSlider(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtDial.
+
+See Module: QwtDial 
+
*/ +int pvQwtDial(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtCompass.
+
+See Module: QwtCompass 
+
*/ +int pvQwtCompass(PARAM *p, int id, int parent); +/*!
+Call this function to create a QwtAnalogClock.
+
+See Module: QwtAnalog Clock 
+
*/ +int pvQwtAnalogClock(PARAM *p, int id, int parent); +/*!
+create a QDateEdit widget.
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetDate()
+pvSetMinDate()
+pvSetMaxDate()
+pvSetDateOrder()
+
*/ +int pvQDateEdit(PARAM *p, int id, int parent); +/*!
+create a QTimeEdit widget.
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetTime()
+pvSetMinTime()
+pvSetMaxTime()
+pvSetTimeEditDisplay()
+
*/ +int pvQTimeEdit(PARAM *p, int id, int parent); +/*!
+create a QDateTimeEdit widget.
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetDate()
+pvSetMinDate()
+pvSetMaxDate()
+pvSetTime()
+pvSetMinTime()
+pvSetMaxTime()
+pvSetDateOrder()
+
*/ +int pvQDateTimeEdit(PARAM *p, int id, int parent); +/*!
+create a QCustomWidget provided by a plugin.
+name := "/library/widgettype<:arg>" defined by the whats_this property in the designer.
+        library is the name without the platform dependend extension (.so, .dll, .dylib).
+        The library_filename will be PVB_WIDGET_PLUGINDIR/library.platform_extension.
+        PVB_WIDGET_PLUGINDIR is defined in the pvbrowser ini file.
+arg  := argument for the widget constructor defined by the whats_this property in the designer. 
+
+Functions that apply to this widget:
+pvSetWhatsThis()
+pvWhatsThisPrintf()
+pvToolTip()
+pvSetGeometry()
+pvSetMinSize()
+pvSetMaxSize()
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+pvSetStyleSheet()
+pvPrintfStyleSheet();
+pvSetPaletteBackgroundColor()
+pvSetPaletteForegroundColor()
+pvSetFontColor()
+pvSetFont()
+pvSetEnabled()
+pvSetFocus()
+pvCopyToClipboard()
+pvSaveAsBmp()
+pvSetWidgetProperty()
+
*/ +int pvQCustomWidget(PARAM *p, int id, int parent, const char *name, const char *arg=NULL); +/*!
+Call this function when you are finished with the definition of your mask.
+
*/ +int pvEndDefinition(PARAM *p); +/*!
+add widget or layout to layout.
+
*/ +int pvAddWidgetOrLayout(PARAM *p, int id, int item, int row, int col); +/*!
+add stretch to layout
+
*/ +int pvAddStretch(PARAM *p, int id, int param); +/*!
+set TAB order.
+
*/ +int pvTabOrder(PARAM *p, int id1, int id2); +/*!
+delete widget and it's children.
+
*/ +int pvDeleteWidget(PARAM *p, int id); +/** @} */ // end of group + + +/** @defgroup Output Output + * These are the output routines + * @{ */ +/*!
+Set program Title.
+
*/ +int pvSetCaption(PARAM *p, const char *text); +/*!
+Play Sound. filename should point to a *.wav audio file. First pvDownloadFile(PARAM *p, const char *filename);
+
*/ +int pvPlaySound(PARAM *p, const char *filename); +/*!
+Output a beep.
+
*/ +int pvBeep(PARAM *p); +/*!
+Output status message.
+If r = g = b = -1 -> normal background color
+
*/ +int pvStatusMessage(PARAM *p, int r, int g, int b, const char *format, ...); +/*!
+Set a QToolTip for the widget. It will be displayed near the widget when you move over.
+
*/ +int pvToolTip(PARAM *p, int id, const char *text); +/*!
+Set the text of a widget.
+option := -1 || HTML_HEADER || HTML_STYLE || HTML_BODY
+Allowed widgets: QLabel, QPushButton, QLineEdit, QMultiLineEdit, QComboBox, QRadioButton, QCheckBox, QTextBrowser
+
*/ +int pvSetTextEx(PARAM *p, int id, const char *text, int option); +/*!
+Set the text of a widget.
+Allowed widgets: QLabel, QPushButton, QLineEdit, QMultiLineEdit, QComboBox, QRadioButton, QCheckBox, QTextBrowser
+
*/ +int pvSetText(PARAM *p, int id, const char *text); +/*!
+Set the text of a widget.
+The functions works like printf()
+Allowed widgets: QLabel, QPushButton, QLineEdit, QMultiLineEdit, QComboBox, QRadioButton, QCheckBox, QTextBrowser, QGroupBox
+
*/ +int pvPrintf(PARAM *p, int id, const char *format, ...); +/*!
+Set the style sheet of a widget. (See Qt documentation for style sheets)
+Allowed widgets: all widgets
+id := id_of_widget or ID_ROOTWIDGET, ID_EDITBAR, ID_TOOLBAR, ID_STATUSBAR, ID_MAINWINDOW or id_of_dock_widget
+
*/ +int pvSetStyleSheet(PARAM *p, int id, const char *text); +/*!
+Printf the style sheet of a widget. (See Qt documentation for style sheets)
+The functions works like printf()
+Allowed widgets: all widgets
+id := id_of_widget or ID_ROOTWIDGET, ID_EDITBAR, ID_TOOLBAR, ID_STATUSBAR, ID_MAINWINDOW or  id_of_dock_widget
+
*/ +int pvPrintfStyleSheet(PARAM *p, int id, const char *format, ...); +/*!
+Set the minimum value of a widget.
+Allowed widgets: QSlider, QSpinBox, QDial, QProgressBar
+
*/ +int pvSetMinValue(PARAM *p, int id, int value); +/*!
+Set the maximum value of a widget.
+Allowed widgets: QSlider, QSpinBox, QDial, QProgressBar
+
*/ +int pvSetMaxValue(PARAM *p, int id, int value); +/*!
+Set the value of a widget.
+Allowed widgets: QSlider, QSpinBox, QDial, QProgressBar, QTabWidget, QToolBox
+For QMultiLineEdit set maxlines = value
+
*/ +int pvSetValue(PARAM *p, int id, int value); +/*!
+Clear the content of a widget.
+Allowed widgets: QTable, QListBox, QComboBox, QMultiLineEdit, QListView, QIconView
+
*/ +int pvClear(PARAM *p, int id); +/*!
+Set the content of a widget.
+if bmp_file == NULL no pixmap is drawn
+else bmp_file = name of PNG file or an 8bpp bitmap file
+Allowed widgets: QListBox
+
*/ +int pvChangeItem(PARAM *p, int id, int index, const char *bmp_file, const char *text, int download_icon=1); +/*!
+Insert an item.
+if bmp_file == NULL no pixmap is drawn
+else bmp_file = name of PNG file or an 8bpp bitmap file
+if index == -1 append text at the end of the list
+Allowed widgets: QListBox, QComboBox
+
*/ +int pvInsertItem(PARAM *p, int id, int index, const char *bmp_file, const char *text, int download_icon=1); +/*!
+Remove an item.
+Allowed widgets: QListBox, QComboBox
+
*/ +int pvRemoveItem(PARAM *p, int id, int index); +/*!
+Remove an item by it's name.
+Allowed widgets: QListBox, QComboBox
+
*/ +int pvRemoveItemByName(PARAM *p, int id, const char *name); +/*!
+Add a Column in a QListView.
+Allowed widgets: QListView
+
*/ +int pvAddColumn(PARAM *p, int id, const char *text, int size); +/*!
+Remove all Columns in a QListView.
+Allowed widgets: QListView
+
*/ +int pvRemoveAllColumns(PARAM *p, int id); +/*!
+Set the text of a table cell.
+if x == -1 then set row text
+if y == -1 then set column text
+
+Example for colored table cells:
+pvTableText(p,Table1,0,0,"color(255,0,0)this is the cell text");
+prepend: color(r,g,b)
+
+Allowed widgets: QTable
+
*/ +int pvSetTableText(PARAM *p, int id, int x, int y, const char *text); +/*!
+Set a table cell to Button.
+Allowed widgets: QTable
+
*/ +int pvSetTableButton(PARAM *p, int id, int x, int y, const char *text); +/*!
+Set a table cell to CheckBox.
+Allowed widgets: QTable
+
*/ +int pvSetTableCheckBox(PARAM *p, int id, int x, int y, int state, const char *text); +/*!
+Set a table cell to ComboBox.
+
+example:
+pvSetTableComboBox(p,Table1,2,1,1,"choice1,choice2,choice3");
+
+You can add a # in front of choice in order to make it the selectedChoice.
+example: make choice2 the selectedChoice
+pvSetTableComboBox(p,Table1,2,1,1,"choice1,#choice2,choice3");
+
+Allowed widgets: QTable
+
*/ +int pvSetTableComboBox(PARAM *p, int id, int x, int y, int editable, const char *textlist); +/*!
+Set a table cell to label
+Allowed widgets: QTable
+
*/ +int pvSetTableLabel(PARAM *p, int id, int x, int y, const char *text); +/*!
+Set the text of a table cell.
+Works as printf(format,...);
+if x == -1 then set row text
+if y == -1 then set column text
+
+Example for colored table cells:
+pvTablePrintf(p,Table1,0,0,"color(255,0,0)this is the cell text");
+prepend: color(r,g,b)
+
+Allowed widgets: QTable
+
*/ +int pvTablePrintf(PARAM *p, int id, int x, int y, const char *format, ...); +/*!
+Set the text alignment of a table cell.
+
+alignment :=
+  AlignLeft     # Aligns with the left edge.
+  AlignRight    # Aligns with the right edge.
+  AlignHCenter  # Centers horizontally in the available space.
+  AlignJustify  # Justifies the text in the available space.
+
+Allowed widgets: QTable
+
*/ +int pvSetTableTextAlignment(PARAM *p, int id, int x, int y, int alignment); +/*!
+Run mysqldump and populate table.
+See: mysqldump --help
+Runs: mysqldump -X command
+
+Allowed widgets: QTable
+
*/ +int pvMysqldump(PARAM *p, int id, const char *command); +/*!
+dump CSV file and populate table.
+
+Allowed widgets: QTable
+
*/ +int pvCSVdump(PARAM *p, int id, const char *filename, char delimitor='\t'); +/*!
+create CSV file by calling "command > filename".
+
*/ +int pvCSVcreate(PARAM *p, const char *command, const char *filename); +/*!
+dump CSV file to table=id by calling "command".
+
*/ +int pvCSV(PARAM *p, int id, const char *command, char delimitor='\t'); +/*!
+Set the text of a ListViewItem.
+example:
+path = "/dir/subdir/subsubdir"
+path := similar to a unix directory path
+
+Example for colored cells:
+pvSetListViewText(p,myListView,"/path/to",0,"color(255,0,0)this is the colored text");
+prepend: color(r,g,b)
+
+Allowed widgets: QListView
+
*/ +int pvSetListViewText(PARAM *p, int id, const char *path, int column, const char *text); +/*!
+Set the text of a ListViewItem.
+Works as printf(format,...);
+example:
+path = "/dir/subdir/subsubdir"
+path := similar to a unix directory path
+
+Example for colored cells:
+pvListViewPrintf(p,myListView,"/path/to",0,"color(255,0,0)this is the colored text");
+prepend: color(r,g,b)
+
+Allowed widgets: QListView
+
*/ +int pvListViewPrintf(PARAM *p, int id, const char *path, int column, const char *format, ...); +/*!
+selected = 0 | 1 | 2
+if selected == 0 item is unselected
+if selected == 1 item is selected
+if selected == 2 item is selected and all other tree branches are closed
+
*/ +int pvListViewSetSelected(PARAM *p, int id, const char *path, int column, int selected); +/*!
+selected = 0 | 1 | 2
+if selected == 0 item is unselected
+if selected == 1 item is selected
+
*/ +int pvListBoxSetSelected(PARAM *p, int id, int index, int selected); +#define pvSetColumnWith pvSetColumnWidth +/*!
+Set the width of a table column.
+if column == -1 then 
+  set border width
+  if width >  0  -> set width
+  if width == 0  -> hide
+  if width == -1 -> resize to contents
+Allowed widgets: QTable
+
*/ +int pvSetColumnWidth(PARAM *p, int id, int column, int width); +/*!
+Set the height of a table row.
+if row == -1 then set border height
+if row >= 0 && height == -1 then set autoresizeRowToContents=1
+if row >= 0 && height == -2 then set autoresizeRowToContents=0
+default autoresizeRowToContents=0
+Allowed widgets: QTable
+
*/ +int pvSetRowHeight(PARAM *p, int id, int row, int height); +/*!
+Set word wrap for table.
+wrap = 0 | 1
+Allowed widgets: QTable
+
*/ +int pvSetWordWrap(PARAM *p, int id, int wrap); +/*!
+Set the pixmap.
+Use PNG file.
+
+also:
+bmp_file = name of an 8bpp bitmap file
+if bmp_file == NULL reset pixmap
+Allowed widgets: QPushButton
+
*/ +int pvSetPixmap(PARAM *p, int id, const char *bmp_file, int download_icon=1); +/*!
+Set the pixmap of a table cell.
+Use PNG file.
+
+also:
+bmp_file = name of an 8bpp bitmap file
+Allowed widgets: QTable
+
*/ +int pvSetTablePixmap(PARAM *p, int id, int x, int y, const char *bmp_file, int download_icon=1); +/*!
+Set the file to show in QTextBrowser.
+html_file = file to start with
+or
+http://webpage.url
+Allowed widgets: QTextBrowser
+
*/ +int pvSetSource(PARAM *p, int id, const char *html_file); +/*!
+Set a new image in an existing image.
+if(rotate == +90) then rotate +90 degrees
+if(rotate == -90) then rotate -90 degrees
+Allowed widgets: QImage
+
*/ +int pvSetImage(PARAM *p, int id, const char *filename, int rotate=0); +/*!
+Set a new image in an existing image.
+For example get a frame from a MJPG webcam with the rlWebcam method
+  int getFrameBuffer(unsigned char *buffer, int maxbuffer, int timeout=3000);
+and send it to the pvbrowser client with this function.
+if(rotate == +90) then rotate +90 degrees
+if(rotate == -90) then rotate -90 degrees
+Allowed widgets: QImage
+
*/ +int pvSetBufferedJpgImage(PARAM *p, int id, const unsigned char *buffer, int buffersize, int rotate=0); +/*!
+Set the transparency for the drawing buffer.
+"int a;" is in the range of 0-255 where 0 is fully transparent and 255 is fully opaque
+Allowed widgets: QDraw
+
*/ +int pvSetBufferTransparency(PARAM *p, int id, int a); +/*!
+Set the background color of the widget.
+Allowed widgets: QLabel, QDraw
+
*/ +int pvSetBackgroundColor(PARAM *p, int id, int r, int g, int b); +/*!
+Set the background color of the widget.
+r=-1,g=-1,b=-1 := unsetPalette()
+Allowed widgets: all widgets
+
*/ +int pvSetPaletteBackgroundColor(PARAM *p, int id, int r, int g, int b); +/*!
+Set the foreground color of the widget.
+r=-1,g=-1,b=-1 := unsetPalette()
+Allowed widgets: all widgets
+
*/ +int pvSetPaletteForegroundColor(PARAM *p, int id, int r, int g, int b); +/*!
+Set the font color of the widget.
+r=-1,g=-1,b=-1 := unsetPalette()
+Allowed widgets: QMultiLineEdit
+
*/ +int pvSetFontColor(PARAM *p, int id, int r, int g, int b); +/*!
+Set the font of the widget. The font will be propagated to all children.
+pointsize (in pitch)
+bold      = 0|1
+italic    = 0|1
+underline = 0|1
+strikeout = 0|1
+Allowed widgets: all widgets
+
*/ +int pvSetFont(PARAM *p, int id, const char *family, int pointsize, int bold, int italic , int underline, int strikeout); +/*!
+Display num on a QLCDNumber
+
*/ +int pvDisplayNum(PARAM *p, int id, int num); +/*!
+Display float on a QLCDNumber
+
*/ +int pvDisplayFloat(PARAM *p, int id, float val); +/*!
+Display string on a QLCDNumber
+
*/ +int pvDisplayStr(PARAM *p, int id, const char *str); +/*!
+Add a Tab to an QTabDialog
+id       := id of TabWidget
+id_child := id of the QWidget for this tab
+str      := text on the tab
+
*/ +int pvAddTab(PARAM *p, int id, int id_child, const char *str); +/*!
+example:
+path = "/dir/subdir/subsubdir"
+path := similar to a unix directory path
+Set a QListView pixmap
+Use PNG file.
+
*/ +int pvSetListViewPixmap(PARAM *p, int id, const char *path, const char *bmp_file, int column, int download_icon=1); +/*!
+example:
+path = "/dir/subdir/subsubdir"
+path := similar to a unix directory path
+Remove a QListView item
+
*/ +int pvRemoveListViewItem(PARAM *p, int id, const char *path); +/*!
+Remove a QIconView item
+
*/ +int pvRemoveIconViewItem(PARAM *p, int id, const char *text); +/*!
+Insert a QIconViewItem pixmap and text
+
*/ +int pvSetIconViewItem(PARAM *p, int id, const char *bmp_file, const char *text, int download_icon=1); +/*!
+Set date order, enum Order { DMY, MDY, YMD, YDM }
+allowed widgets: QDateEdit, QDateTimeEdit
+
*/ +int pvSetDateOrder(PARAM *p, int id, int order); +/*!
+Set date
+allowed widgets: QDateEdit, QDateTimeEdit
+
*/ +int pvSetDate(PARAM *p, int id, int year, int month, int day); +/*!
+Set min date
+allowed widgets: QDateEdit, QDateTimeEdit
+
*/ +int pvSetMinDate(PARAM *p, int id, int year, int month, int day); +/*!
+Set max date
+allowed widgets: QDateEdit, QDateTimeEdit
+
*/ +int pvSetMaxDate(PARAM *p, int id, int year, int month, int day); +/*!
+Set time
+allowed widgets: QTimeEdit, QDateTimeEdit
+
*/ +int pvSetTime(PARAM *p, int id, int hour, int minute, int second=0, int msec=0); +/*!
+Set time
+allowed widgets: QTimeEdit, QDateTimeEdit
+
*/ +int pvSetMinTime(PARAM *p, int id, int hour, int minute, int second=0, int msec=0); +/*!
+Set time
+allowed widgets: QTimeEdit, QDateTimeEdit
+
*/ +int pvSetMaxTime(PARAM *p, int id, int hour, int minute, int second=0, int msec=0); +/*!
+Ensure that the table cell is visible, scroll if necessary
+allowed widgets: QTable
+
*/ +int pvEnsureCellVisible(PARAM *p, int id, int row, int col=1); +/*!
+Move the cursor
+allowed widgets: QTextBrowser, QMultiLineEdit
+cursor := #TextCursor
+
*/ +int pvMoveCursor(PARAM *p, int id, int cursor); +/*!
+Scroll to anchor
+allowed widgets: QTextBrowser
+
*/ +int pvScrollToAnchor(PARAM *p, int id, const char *anchor); +/*!
+Set zoom factor of the HTML page
+allowed widgets: QTextBrowser
+
*/ +int pvSetZoomFactor(PARAM *p, int id, float factor); +/*!
+Print the HTML page on a printer
+allowed widgets: QTextBrowser
+
*/ +int pvPrintHtmlOnPrinter(PARAM *p, int id); +/*!
+Set a property of a custom widget.
+See the documentation of the custom widget plugin.
+allowed widgets: QCustomWidget
+
*/ +int pvSetWidgetProperty(PARAM *p, int id, const char *name, const char *value); +/*!
+Pass 1 JPEG frame from a camera or other source to the pvbrowser client.
+Allowed widgets: QImage
+
*/ +int pvPassThroughOneJpegFrame(PARAM *p, int id, int source_fhdl, int inputIsSocket=1, int rotate=0); +/*!
+Send 1 JPEG frame from a camera or other source to the pvbrowser client.
+Allowed widgets: QImage
+
*/ +int pvSendJpegFrame(PARAM *p, int id, unsigned char *frame, int rotate=0); +/*!
+Send a RGBA image to the pvbrowser client.
+Allowed widgets: QImage
+
*/ +int pvSendRGBA(PARAM *p, int id, const unsigned char *image, int width, int height, int rotate=0); +/*!
+Save rendered buffer as PNG or JPG file in temporary directory.
+filename is without path.
+Allowed widgets: QDrawWidget
+
*/ +int pvSaveDrawBuffer(PARAM *p, int id, const char *filename); +/** @} */ // end of group + +/** @defgroup Input Input + * These are the input routines + * @{ */ +/*!
+Request a waitpid() call on the client.
+The response is send as TEXT_MESSAGE with id=ID_MAINWINDOW.
+waitpid_response=%d
+
*/ +int pvWaitpid(PARAM *p); +/*!
+Request the text from the widget. The text will arrive in an TEXT_EVENT.
+In case of a QMultiLineEdit the text will arrive in a CLIPBOARD_EVENT.
+Allowed widgets: QLabel, QPushButton, QLineEdit, QMultiLineEdit
+
*/ +int pvText(PARAM *p, int id); +/*!
+Request a jpeg from the widget. The jpeg will arrive in an CLIPBOARD_EVENT.
+Allowed widgets: QWidget, QImage, QDraw, QwtPlot
+
*/ +int pvRequestJpeg(PARAM *p, int id); +/*!
+Request the geometry from the widget. The text will arrive in an TEXT_EVENT.
+geometry:x,y,width,height
+Allowed widgets: all widgets
+
*/ +int pvRequestGeometry(PARAM *p, int id); +/*!
+Request the parent id for the widget. The text will arrive in an TEXT_EVENT.
+parent:parent
+Allowed widgets: all widgets
+
*/ +int pvRequestParentWidgetId(PARAM *p, int id); +/*!
+Request the selected items from a QListBox or QListView. The text will arrive in an SELECTION_EVENT.
+Allowed widgets: QListBox, QListView
+
*/ +int pvSelection(PARAM *p, int id); +/*!
+Request the bounds of an object within a SVG graphic.
+The response will arrive in a TEXT_EVENT
+Response: name=x,y,width,height
+Allowed widgets: QDrawWidget
+
*/ +int pvRequestSvgBoundsOnElement(PARAM *p, int id, const char *objectname); +/*!
+Request the matrix for an object within a SVG graphic.
+The response will arrive in a TEXT_EVENT
+Response: name=m11, m12, m21, m22, det, dx, dy
+Allowed widgets: QDrawWidget
+
*/ +int pvRequestSvgMatrixForElement(PARAM *p, int id, const char *objectname); +/** @} */ // end of group + +/** @defgroup State State + * These are the state routines + * @{ */ +/*!
+Move within html page.
+pos = Home|Backward|Forward|Reload
+or
+pos = Qt::KeyboardModifiers ored with ascii key. Where key >= ' ' && key < 128
+      Qt::NoModifier      0x00000000  No modifier key is pressed.
+      Qt::ShiftModifier   0x02000000  A Shift key on the keyboard is pressed.
+      Qt::ControlModifier 0x04000000  A Ctrl key on the keyboard is pressed.
+      Qt::AltModifier     0x08000000  An Alt key on the keyboard is pressed.
+Allowed widgets: QTextBrowser
+
*/ +int pvMoveContent(PARAM *p, int id, int pos); +/*!
+Set the Geometry of the widget.
+
*/ +int pvSetGeometry(PARAM *p, int id, int x, int y, int w, int h); +/*!
+Set the Minimum Size of the widget.
+
*/ +int pvSetMinSize(PARAM *p, int id, int w, int h); +/*!
+Set the Maximum Size of the widget.
+
*/ +int pvSetMaxSize(PARAM *p, int id, int w, int h); +/*!
+Set Alignment. #AlignmentFlags
+Allowed widgets: QLabel QLineEdit
+
*/ +int pvSetAlignment(PARAM *p, int id, int alignment); +/*!
+Set the state (0,1) of a button
+Allowed widgets: QRadioButton, QCheckBox
+
*/ +int pvSetChecked(PARAM *p, int id, int state); +/*!
+Move the widget to a new position.
+
*/ +int pvMove(PARAM *p, int id, int x, int y); +/*!
+Resize the widget.
+See also #MainWindowIds.
+
*/ +int pvResize(PARAM *p, int id, int w, int h); +/*!
+Hide the widget.
+See also #MainWindowIds.
+
*/ +int pvHide(PARAM *p, int id); +/*!
+Show the widget.
+See also #MainWindowIds.
+
*/ +int pvShow(PARAM *p, int id); +/*!
+Reparent a widget
+All widgets allowed
+
*/ +int pvSetParent(PARAM *p, int id, int id_parent); +/*!
+Set multi selection of QListBox, QListView.
+mode = 0=SingleSelection|1=MultiSelection|2=NoSelection
+
*/ +int pvSetMultiSelection(PARAM *p, int id, int mode); +/*!
+Set echo mode of QLineEdit.
+mode = 0=NoEcho|1=Normal|2=Password
+
*/ +int pvSetEchoMode(PARAM *p, int id, int mode); +/*!
+Set editable 0|1
+Allowed widgets QLineEdit, QMultiLineEdit, QTable, QComboBox
+
*/ +int pvSetEditable(PARAM *p, int id, int editable); +/*!
+Set enabled 0|1
+Allowed widgets all widgets
+
*/ +int pvSetEnabled(PARAM *p, int id, int enabled); +/*!
+Set keyboad focus
+Allowed widgets all widgets
+
*/ +int pvSetFocus(PARAM *p, int id); +/*!
+Set enabled 0|1
+Allowed widgets QTable
+
*/ +int pvTableSetEnabled(PARAM *p, int id, int x, int y, int enabled); +/*!
+horizontal = 0 is vertical
+horizontal = 1 is horizontal
+enabled := 0|1
+section := section in horizontal or vertical direction
+Allowed widgets QTable
+
*/ +int pvTableSetHeaderResizeEnabled(PARAM *p, int id, int horizontal ,int enabled, int section); +/*!
+Sort column
+mode=0 decending
+mode=1 ascendin
+column=-1 do not allow sorting (this is the default)
+Allowed widgets QListView
+
*/ +int pvSetSorting(PARAM *p, int id, int column, int mode); +/*!
+Set tab position 0=Top | 1=Bottom | 2=West | 3=East
+Allowed widgets QTabWidget
+
*/ +int pvSetTabPosition(PARAM *p, int id, int pos); +/*!
+Enable the TabBar 0=disable | 1=enable
+Allowed widgets QTabWidget
+
*/ +int pvEnableTabBar(PARAM *p, int id, int state); +/*!
+Set num rows in table
+Allowed widgets QTable
+
*/ +int pvSetNumRows(PARAM *p, int id, int num); +/*!
+Set num cols in table
+Allowed widgets QTable
+
*/ +int pvSetNumCols(PARAM *p, int id, int num); +/*!
+Insert count rows
+Allowed widgets QTable
+
*/ +int pvInsertRows(PARAM *p, int id, int row, int count=1); +/*!
+Insert count columns
+Allowed widgets QTable
+
*/ +int pvInsertColumns(PARAM *p, int id, int col, int count=1); +/*!
+Remove a row
+Allowed widgets QTable
+
*/ +int pvRemoveRow(PARAM *p, int id, int row); +/*!
+Remove a colum
+Allowed widgets QTable
+
*/ +int pvRemoveColumn(PARAM *p, int id, int col); +/*!
+Set current item
+Allowed widgets QComboBox
+
*/ +int pvSetCurrentItem(PARAM *p, int id, int index); +/*!
+Set display of time edit
+values may be 0 or 1
+Allowed widgets QTimeEdit
+
*/ +int pvSetTimeEditDisplay(PARAM *p, int id, int hour, int minute, int second, int ampm); +/*!
+Ensures that the given item is visible.
+example:
+path = "/dir/subdir/subsubdir"
+path := similar to a unix directory path
+Allowed widgets QListView
+
*/ +int pvListViewEnsureVisible(PARAM *p, int id, const char *path); +/*!
+Opens/Closes the given item.
+open = 0 | 1
+example:
+path = "/dir/subdir/subsubdir"
+path := similar to a unix directory path
+Allowed widgets QListView
+
*/ +int pvListViewSetOpen(PARAM *p, int id, const char *path, int open); +/*!
+Hide or show column
+
*/ +int pvListViewSetHidden(PARAM *p, int id, int column, int hidden); +/*!
+Set standard popup menu of list view.
+standard_menu = 0 do not show standard popup menu
+standard_menu = 1 show standard popup menu and do not allow to hide column 1
+standard_menu = N show standard popup menu and do not allow to hide column N
+
*/ +int pvListViewSetStandardPopupMenu(PARAM *p, int id, int standard_menu); +/*!
+Set style of QLabel or QFrame
+#Shape. #Shadow.
+
+if parameter == -1 -> do not set this paramter
+
+Allowed widgets QLabel QLineEdit QFrame QGroupBox QLCDNumber QProgressBar QToolBox
+
*/ +int pvSetStyle(PARAM *p, int id, int shape, int shadow, int line_width, int margin); +/*!
+Set to an animated MNG or GIF
+background = 0|1
+
+Allowed widgets QLabel
+
*/ +int pvSetMovie(PARAM *p, int id, int background, const char *filename); +/*!
+step == -2 restart
+step == -1 unpause
+step == 0  pause
+step >  0  step step steps
+
+Allowed widgets QLabel
+
*/ +int pvMovieControl(PARAM *p, int id, int step); +/*!
+speed in percent
+
+Allowed widgets QLabel
+
*/ +int pvMovieSpeed(PARAM *p, int id, int speed); +/*!
+add tab icon
+
+Allowed widgets QTabWidget QToolBox
+
*/ +int pvAddTabIcon(PARAM *p, int id, int position, const char *bmp_file, int download_icon=1); +/*!
+set cell widget within a table
+
+Allowed widgets QTable
+
*/ +int pvSetCellWidget(PARAM *p, int id, int parent, int row, int column); +/*!
+set margins within layout
+
+Allowed widgets Layouts
+
*/ +int pvSetContentsMargins(PARAM *p, int id, int xleft, int ytop, int xright, int ybottom); +/*!
+set spacing within layout
+
+Allowed widgets Layouts
+
*/ +int pvSetSpacing(PARAM *p, int id, int param); +/** @} */ // end of group + + +/** @defgroup VTK Visualization Tool Kit + * These are the vtk output routines + * @{ */ +/*!
+Send a single Tcl command to the widget
+
*/ +int pvVtkTcl(PARAM *p, int id, const char *tcl_command); +/*!
+Send a single Tcl command to the widget. Used like printf()
+
*/ +int pvVtkTclPrintf(PARAM *p, int id, const char *format, ...); +/*!
+Send a file with Tcl commands to the widget.
+
*/ +int pvVtkTclScript(PARAM *p, int id, const char *filename); +/** @} */ // end of group + +/** @defgroup Hyperlink Hyperlink + * These are the hyperlink routines + * @{ */ +/*!
+Connect to a different server.
+eg. link = "pv://hostname:5050"
+If you add "+" at the beginning of the URL a new pvbrowser will be started with that URL.
+eg. link = "+pv://hostname:5050"
+
*/ +int pvHyperlink(PARAM *p, const char *link); +/** @} */ // end of group + +/** @defgroup Misc Misc + * These are the misc routines + * @{ */ +/*!
+Send a USER_EVENT to ourself
+
*/ +int pvSendUserEvent(PARAM *p, int id, const char *text); +/*!
+write the following to file
+during the file is open nothing will be send to tcp
+return=0 failure
+return=1 success
+
*/ +int pvWriteFile(PARAM *p, const char *filename, int width, int height); +/*!
+close the open file
+
*/ +int pvCloseFile(PARAM *p); +/*!
+The function will get the "" surrounded text out of command.
+This is useful to retrieve the text from an event.
+Used in Script languages
+
*/ +char *pvGetTextParam(PARAM *p, const char *command); +/*!
+The function will get the "" surrounded text out of command.
+This is useful to retrieve the text from an event.
+
*/ +int pvGetText(const char *command, char *text); +/*!
+This fuction will parse the event. It is a stub for script languages.
+
*/ +PARSE_EVENT_STRUCT *pvParseEventStruct(PARAM *p, const char *event); +/*!
+This fuction will parse the event. It returns the event. If there is a text in the event
+it will be returned. Otherwise *text will be '\\0'.
+
*/ +int pvParseEvent(const char *event, int *id, char *text); +/*!
+Copy the widget to the clipboard.
+Allowed widgets: all widgets
+
*/ +int pvCopyToClipboard(PARAM *p, int id); +/*!
+Print the contents of the widget on a printer. The user will see the print dialog.
+Allowed widgets: all widgets
+
*/ +int pvPrint(PARAM *p, int id); +/*!
+Save the widget to file on local node. The user will see a SaveAs dialog.
+Allowed widgets: QTable
+
*/ +int pvSave(PARAM *p, int id); +/*!
+Save the widget to a file on the client computer. (vector form)
+Allowed widgets: QDraw
+
*/ +int pvSave(PARAM *p, int id, const char *filename); +/*!
+Save the widget to a file on the client computer. (bitmap file)
+Allowed widgets: all widgets
+
*/ +int pvSaveAsBmp(PARAM *p, int id, const char *filename); +/*!
+Dump the HTML or SVG code on the client.
+Allowed widgets: QTextBrowser/WebKit widget for HTML and QDraw/SVG widget for SVG
+
*/ +int pvHtmlOrSvgDump(PARAM *p, int id, const char *filename); +/*!
+Dump the SVG rendering data to a SVG file on the client.
+Allowed widgets: QDraw/SVG widget
+
*/ +int pvRenderTreeDump(PARAM *p, int id, const char *filename); +/*!
+send file to browser
+
*/ +int pvSendFile(PARAM *p, const char *filename); +/*!
+download file to temp directory of the browser
+The file in the temp directory is called newname
+
*/ +int pvDownloadFileAs(PARAM *p, const char *filename, const char *newname); +/*!
+download file to temp directory of the browser
+
*/ +int pvDownloadFile(PARAM *p, const char *filename); + +/*!
+Set the limit of clients the pvserver accepts from 1 ip address 
+
*/ +int pvSetMaxClientsPerIpAdr(int max_clients); +/*!
+Get the limit of clients the pvserver accepts from 1 ip address 
+
*/ +int pvMaxClientsPerIpAdr(); +/*!
+Set the total limit of clients the pvserver accepts 
+0 < max_clients <= MAX_CLIENTS
+
*/ +int pvSetMaxClients(int max_clients); +/*!
+Set the total limit of clients the pvserver accepts 
+0 < max_clients <= MAX_CLIENTS
+
*/ +int pvMaxClients(); +/*!
+Get the table of connected clients.
+It is an array of MAX_CLIENT elements.
+
*/ +const pvAddressTableItem *pvGetAdrTableItem(); + +/*!
+read all pending messages from tcp
+
*/ +int pvClearMessageQueue(PARAM *p); +int pvtcpsend(PARAM *p, const char *buf, int len); +int pvtcpsendstring(PARAM *p, const char *buf); +int pvtcpsend_binary(PARAM *p, const char *buf, int len); +int pvtcpreceive(PARAM *p, char *buf, int maxlen); +int pvtcpreceive_binary(PARAM *p, char *buf, int maxlen); + +/** @} */ // end of group + +/** @defgroup http http helper functions + * These functions you can use to act as httpd. + * It is possible to implement your pvserver to act as pvbrowser server and httpd at the same time. + * Please read the manual in PDF format. + * + * Note: You must use the -http option to start your pvserver. + * + * ./pvs -http + * + * This will suppress the automatic sending of pvsVersion() at pvserver startup. + * + * The full HTTP/1.1 specification can be found here: + * + * https://www.w3.org/Protocols/rfc2616/rfc2616.html + * + * In future we might add more helper function based on this specification. + * But you can implement helper functions at your own using. + * + * int pvtcpsend(PARAM *p, const char *buf, int len); + * + * int pvtcpsendstring(PARAM *p, const char *buf); + * + * int pvtcpsend_binary(PARAM *p, const char *buf, int len); + * + * int pvtcpreceive(PARAM *p, char *buf, int maxlen); + * + * int pvtcpreceive_binary(PARAM *p, char *buf, int maxlen); + * + * Your own httpd helper functions could be included within the upstream project. + * Please take care that the helper functions are usefull for wide use cases. + * @{ */ +/*!
+send http response using chunks
+
+Example:
+  pvtcpsendstring(p,
+    "HTTP/1.1 200 OK\n"
+    "Date: Wed, 05 Aug 2015 14:10:30 GMT\n"
+    "Server: Apache/2.2.4 (Linux/SUSE)\n"
+    "X-Powered-By: PHP/5.2.11\n"
+    "Keep-Alive: timeout=150, max=1000\n"
+    "Connection: Keep-Alive\n"
+    "Transfer-Encoding: chunked\n"
+    "Content-Type: text/html\n"
+    "\n");
+  pvSendHttpChunks(p,"test.html");
+
*/ +int pvSendHttpChunks(PARAM *p, const char *filename); +/*!
+send http response using Content-Length
+
+Example: 
+  sprintf(buf,"HTTP/1.1 200 OK\n"); 
+  pvtcpsendstring(p,buf); 
+  sprintf(buf,"Server: pvserver-%s\n", pvserver_version); 
+  pvtcpsendstring(p,buf); 
+  sprintf(buf,"Keep-Alive: timeout=15, max=100\n"); 
+  pvtcpsendstring(p,buf); 
+  sprintf(buf,"Connection: Keep-Alive\n"); 
+  pvtcpsendstring(p,buf); 
+  sprintf(buf,"Content-Type: text/html\n"); 
+  pvtcpsendstring(p,buf); 
+  pvSendHttpContentLength(p,"test.html"); 
+
*/ +int pvSendHttpContentLength(PARAM *p, const char *filename); +/*!
+send http response file
+default Content-Type = text/html
+
*/ +int pvSendHttpResponseFile(PARAM *p, const char *filename, const char *content_type="text/html"); +/*!
+send http response using HTML text.
+
*/ +int pvSendHttpResponse(PARAM *p, const char *html); +/** @} */ // end of group + +/** @defgroup OpenGL OpenGL + * These are the routines that you must use when you want OpenGL. + * You can use any OpenGL function between pvGlBegin() and pvGlEnd() . + * + * You can also send files that are generated by our code generators + * e.G. Autocad DWF2OpenGL + * @{ */ +/*!
+Call this function when you want to begin with OpenGL commands
+
*/ +int pvGlBegin(PARAM *p, int id); +// /*!
+// This class is for reading a font for use within OpenGL 
+// 
*/ +class glFont +{ +public: + glFont(); + ~glFont(); + /*!
+  read font file
+  
*/ + int read(const char *filename); + /*!
+  get lineHeight
+  
*/ + int lineHeight(); + /*!
+  get width of a character
+  
*/ + int charWidth(unsigned char c); + /*!
+  get width of string
+  
*/ + int stringWidth(const char *str); + /*!
+  draw string at position x,y
+  push matrix, translate and rotate first if you want to place it in 3D
+  
*/ + void drawString(float x, float y, const char *str); + /*!
+  zoom all texts. default: zoom=1.0
+  
*/ + void setZoom(float factor); + /*!
+  rotate font in degree angle.
+  
*/ + void setRotation(int angle); + /*!
+  for internal use only.
+  
*/ + void setFontSize(int pitch, float factor); + +private: + // Information about a glyph. Tex_y2 can be calculated from tex_y1 + // and _tex_line_height (see below). Advance is the width of the + // glyph in screen space. + struct Glyph + { + float tex_x1, tex_y1, tex_x2; + int advance; + }; + // An array to store the glyphs. + //Glyph* _glyphs; + Glyph _glyphs[256]; + // A table to quickly get the glyph belonging to a character. + Glyph* _table[256]; + // The line height, in screen space and in texture space, and the + // OpenGL id of the font texture. + GLuint _line_height, _texture; + float _tex_line_height; + double zoom,zoom0; + int angle_128x128; +}; +/*!
+send OpenGL file to pvbrowser
+
+return: number of entries within listarray
+
+This file could be generated by our Autocad DWF2OpenGL generator for example.
+
*/ +int pvSendOpenGL(PARAM *p, const char *filename, GLuint *listarray, int max_array, glFont *proportional=NULL, glFont *fixed=NULL); +/*!
+Call this function when you are finished with OpenGL commands
+
*/ +int pvGlEnd(PARAM *p); +/** @} */ // end of group + +/** @defgroup Dialogs Dialogs + * Some dialogs + * @{ */ +/*!
+Open a file selection dialog on the client
+id_return is send in a TEXT_EVENT
+type = FileOpenDialog|FileSaveDialog|FindDirectoryDialog
+#FileDialogs.
+
*/ +int pvFileDialog(PARAM *p, int id_return, int type); +/*!
+Open a PopupMenu on the client
+id_return is send in a TEXT_EVENT
+The Text will be the selected item or ""
+Example for text:
+menu1,menu2,,menu3
+(Two commas means, separator)
+You can add a checkbox in front of each entry with "#c(1)"
+You can add a icon in front of each entry with "#i(name.png)"
+Example for text:
+"menu1,,#c(1)#i(icon.png)menu2,#c(0)menu3,#i(icon.png)menu4"
+
*/ +int pvPopupMenu(PARAM *p, int id_return, const char *text); +/*!
+Open a MessageBox on the client
+id_return is send in a SLIDER_EVENT
+type = BoxInformation|BoxWarning|BoxCritical
+#MessageBoxTypes.
+if buttonX == 0 the button is not shown
+#MessageBoxButtons
+
*/ +int pvMessageBox(PARAM *p, int id_return, int type, const char *text, int button0, int button1, int button2); +/*!
+Open a InputDialog on the client
+id_return is send in a TEXT_EVENT
+if user clicked Cancel TEXT_EVENT will return ""
+
*/ +int pvInputDialog(PARAM *p, int id_return, const char *text, const char *default_text); +/*!
+Open and run a modal dialog box
+
*/ +#define readDataCast int (*)(void *) +#define showDataCast int (*)(PARAM *, void *) +int pvRunModalDialog(PARAM *p, int width, int height, int (*showMask)(PARAM *p), void *userData, + int (*readData)(void *d), + int (*showData)(PARAM *p, void *d), + void *d); +/*!
+For script languages:
+pvRunModalDialogScript(...)
+mask->show()
+pvTerminateModalDialog(...)
+
*/ +int pvRunModalDialogScript(PARAM *p, int width, int height); +/*!
+Terminate the modal dialog box
+
*/ +int pvTerminateModalDialog(PARAM *p); +/*!
+Call this function from a ModalDialog in order to update the base window
+
*/ +int pvUpdateBaseWindow(PARAM *p); +/*!
+Call this function from a script language
+pvUpdateBaseWindowOnOff($p,1);
+base->readData();
+base->showData();
+pvUpdateBaseWindowOnOff($p,0);
+
*/ +int pvUpdateBaseWindowOnOff(PARAM *p, int onoff); +/*!
+This function will add a QDockWidget (floating modeless docking dialog)
+
+title       := title of the docking dialog
+dock_id     := ID_DOCK_WIDGETS + n . Where n = 0...31 MAX_DOCK_WIDGETS 
+root_id     := id of root object. root_id is the id of a widget out of the designed widgets. 
+               The root object will be reparent to the dock widget. Thus disappering in the main mask.
+allow_close := 0|1 allow the user to close (hide) the dialog
+floating    := 0|1 moveable by user
+allow_X     := 0|1 allow dock widget to be docked on the according position. 
+
+Functions that apply to dock_id:
+pvSetGeometry();
+pvMove();
+pvResize();
+pvHide();
+pvShow();
+
+You can control the size of the area occupied for the dock area by specifying the
+min/man size property of the root_id widget.
+
*/ +int pvAddDockWidget(PARAM *p,const char *title, int dock_id, int root_id, int allow_close=0, int floating=1, int allow_left=1, int allow_right=0, int allow_top=0, int allow_bottom=0); +/*!
+This function will delete the DockWidget.
+You may reuse the widgets within the DockWidget for other purposes.
+If delete_widgets == 1 the widgets within the dock will be deleted.
+If delete_widgets == 0 the widgets within the dock will be reparent to the main widget of the mask.
+
*/ +int pvDeleteDockWidget(PARAM *p, int dock_id, int delete_widget=0); +/** @} */ // end of group + +/** @defgroup QwtPlotWidget QwtPlotWidget + * Commands for the QwtPlotWidget + * @{ */ +/*!
+Set/Overwrite a curve
+c = index of curve
+count = number of coordinates in x,y
+
*/ +int qpwSetCurveData(PARAM *p, int id, int c, int count, double *x, double *y); +/*!
+Set/Overwrite a curve
+See pvXYAllocate
+c = index of curve
+
*/ +int qpwSetBufferedCurveData(PARAM *p, int id, int c); +/*!
+replot the widget
+
*/ +int qpwReplot(PARAM *p, int id); +/*!
+Set the title of the plot
+
*/ +int qpwSetTitle(PARAM *p, int id, const char *text); +/*!
+Set the background color of the canvas
+
*/ +int qpwSetCanvasBackground(PARAM *p, int id, int r, int g, int b); +/*!
+val = 0|1
+
*/ +int qpwEnableOutline(PARAM *p, int id, int val); +/*!
+Set outine pen color
+
*/ +int qpwSetOutlinePen(PARAM *p, int id, int r, int g, int b); +/*!
+val = 0|1
+
*/ +int qpwSetAutoLegend(PARAM *p, int id, int val); +/*!
+val = 0|1
+
*/ +int qpwEnableLegend(PARAM *p, int id, int val); +/*!
+pos = Left   |
+      Right  |
+      Top    |
+      Bottom |
+      Center |
+
*/ +int qpwSetLegendPos(PARAM *p, int id, int pos); +/*!
+style = #Shape | #Shadow
+
*/ +int qpwSetLegendFrameStyle(PARAM *p, int id, int style); +/*!
+enable grid
+
*/ +int qpwEnableGridXMin(PARAM *p, int id); +/*!
+style = #PenStyle.
+
*/ +int qpwSetGridMajPen(PARAM *p, int id, int r, int g, int b, int style); +/*!
+style = #PenStyle.
+
*/ +int qpwSetGridMinPen(PARAM *p, int id, int r, int g, int b, int style); +/*!
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwEnableAxis(PARAM *p, int id, int pos); +/*!
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwSetAxisTitle(PARAM *p, int id, int pos, const char *text); +/*!
+pos = yLeft | yRight | xBottom | xTop
+val = #QwtAutoscale.
+
*/ +int qpwSetAxisOptions(PARAM *p, int id, int pos, int val); +/*!
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwSetAxisMaxMajor(PARAM *p, int id, int pos, int val); +/*!
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwSetAxisMaxMinor(PARAM *p, int id, int pos, int val); +/*!
+index = index of curve 0...
+
*/ +int qpwInsertCurve(PARAM *p, int id, int index, const char *text); +/*!
+index = index of curve 0...
+
*/ +int qpwRemoveCurve(PARAM *p, int id, int index); +/*!
+index = index of curve 0...
+style = #PenStyle.
+
*/ +int qpwSetCurvePen(PARAM *p, int id, int index, int r, int g, int b, int width=1, int style=SolidLine); +/*!
+index = index of curve 0...
+symbol = #MarkerSymbol.
+
*/ +int qpwSetCurveSymbol(PARAM *p, int id, int index, int symbol, int r1, int g1, int b1, + int r2, int g2, int b2, + int w, int h); +/*!
+index = index of curve 0...
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwSetCurveYAxis(PARAM *p, int id, int index, int pos); +/*!
+index = index of marker 0...
+
*/ +int qpwInsertMarker(PARAM *p, int id, int index); +/*!
+index = index of marker 0...
+style = NoLine | HLine | VLine | Cross
+
*/ +int qpwSetMarkerLineStyle(PARAM *p, int id, int index, int style); +/*!
+index = index of marker 0...
+style =
+
*/ +int qpwSetMarkerPos(PARAM *p, int id, int index, float x, float y); +/*!
+index = index of marker 0...
+
*/ +int qpwSetMarkerLabelAlign(PARAM *p, int id, int index, int align); +/*!
+index = index of marker 0...
+style =
+
*/ +int qpwSetMarkerPen(PARAM *p, int id, int index, int r, int g, int b, int style); +/*!
+number = Number of Marker
+text = Text to out
+
*/ +int qpwSetMarkerLabel(PARAM *p, int id, int number, const char * text); +/*!
+index = index of marker 0...
+style =
+
*/ +int qpwSetMarkerFont(PARAM *p, int id, int index, const char *family, int size, int style); +/*!
+index = index of marker 0...
+symbol = #MarkerSymbol.
+
*/ +int qpwSetMarkerSymbol(PARAM *p, int id, int index, int symbol, int r1, int g1, int b1, + int r2, int g2, int b2, + int w, int h); +/*!
+index = index of marker 0...
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwInsertLineMarker(PARAM *p, int id, int index, const char *text, int pos); +/*!
+pos = yLeft | yRight | xBottom | xTop
+text = format yyyy-MM-dd hh:mm:ss as QDateTime.toString
+
*/ +int qpwSetAxisScaleDraw( PARAM *p, int id, int pos, const char * text ); +/*!
+pos = yLeft | yRight | xBottom | xTop
+
*/ +int qpwSetAxisScale( PARAM *p, int id, int pos, float min, float max, float step); +/** @} */ // end of group + +/* These fuctions can only be used on a QDrawWidget */ +/********* graphic functions ********************************************************/ + +/** @defgroup Graphics Graphics + * These are the graphis routines usable with pyQDrawWidget() + * @{ */ +/*!
+Zoom the image in X direction. (default: zoom=1.0)
+If zoom < 0.0 then keep aspect ratio, factor = |zoom|.
+
*/ +int pvSetZoomX(PARAM *p, int id, float zoom); +/*!
+Zoom the image in Y direction. (default: zoom=1.0)
+If zoom < 0.0 then keep aspect ratio, factor = |zoom|.
+
*/ +int pvSetZoomY(PARAM *p, int id, float zoom); +/*!
+Call this function before you write graphical commands to a file.
+
*/ +int gWriteFile(const char *file); +/*!
+Call this function after you have written graphical commands to a file.
+
*/ +int gCloseFile(); +/*!
+Call this function before you start drawing the widget.
+
*/ +int gBeginDraw(PARAM *p, int id); +/*!
+Draws a rectangle frame. Later you can use it's coordinates to draw xAxis, yAxiy and ryAxis.
+
*/ +int gBox(PARAM *p, int x, int y, int w, int h); +/*!
+Draws a filled rectangle.
+
*/ +int gRect(PARAM *p, int x, int y, int w, int h); +/*!
+Call this function when you are finished with drawing.
+
*/ +int gEndDraw(PARAM *p); +/*!
+Draw a line from the actual position to x,y.
+
*/ +int gLineTo(PARAM *p, int x, int y); +/*!
+Draw a line in a Axis.
+See pvXYAllocate
+See also #Linestyle.
+
*/ +int gBufferedLine(PARAM *p); +/*!
+Draw a line in a Axis n=number of values in x,y.
+See also #Linestyle.
+
*/ +int gLine(PARAM *p, float *x, float *y, int n); +/*!
+Move to x,y.
+
*/ +int gMoveTo(PARAM *p, int x, int y); +/*!
+Draw a Axis on the right side of the diagram.
+It starts with start in steps of delta until end is reached.
+
*/ +int gRightYAxis(PARAM *p, float start, float delta, float end, int draw); +/*!
+Set the drawing color.
+
*/ +int gSetColor(PARAM *p, int r, int g, int b); +/*!
+Set the line width
+
*/ +int gSetWidth(PARAM *p, int w); +/*!
+style = #PenStyle.
+
*/ +int gSetStyle(PARAM *p, int style); +/*!
+Draw an arc. For circle write:
+  gDrawArc(p,x-radius/2,y-radius/2,radius/2,radius/2,0,360);
+
*/ +int gDrawArc(PARAM *p, int x, int y, int w, int h, int start_angle, int angle_length); +/*!
+Draw an pie (filled part of a circle) . For filled circle write:
+  gDrawArc(p,x-radius/2,y-radius/2,radius/2,radius/2,0,360);
+
*/ +int gDrawPie(PARAM *p, int x, int y, int w, int h, int start_angle, int angle_length); +/*!
+x,y is an array with the edge points.
+n is the number of points
+
*/ +int gDrawPolygon(PARAM *p, int *x, int *y, int n); +/*!
+Set a font. For the availabe fonts see Definitions (Events, Fonts, Colors ...)
+
*/ +int gSetFont(PARAM *p, const char *family, int size, int weight, int italic); +/*!
+Set the linestyle of a line in the Axis. You can draw a simple line or a line with centered symbols.
+
*/ +int gSetLinestyle(PARAM *p, int style); +/*!
+Draw a text at x,y.
+For alignment see Definitions (Events, Fonts, Colors ...)
+
*/ +int gText(PARAM *p, int x, int y, const char *text, int alignment); +/*!
+Draw a text at x,y in Axis.
+For alignment see Definitions (Events, Fonts, Colors ...)
+
*/ +int gTextInAxis(PARAM *p, float x, float y, const char *text, int alignment); +/*!
+Set the format in which the Axis is drawn.
+default: "%f"
+For example set
+"%5.2f"
+if you want two digits behind the .
+
*/ +int gSetFloatFormat(PARAM *p, const char *text); +/*!
+Draw a Axis on the bottom of the diagram.
+It starts with start in steps of delta until end is reached.
+
*/ +int gXAxis(PARAM *p, float start, float delta, float end, int draw); +/*!
+Draw a Axis on the left side of the diagram.
+It starts with start in steps of delta until end is reached.
+
*/ +int gYAxis(PARAM *p, float start, float delta, float end, int draw); +/*!
+Draw a grid orthogonal to the x-axis in the diagram.
+
*/ +int gXGrid(PARAM *p); +/*!
+Draw a grid orthogonal to the y-axis in the diagram.
+
*/ +int gYGrid(PARAM *p); +/*!
+This is a convenience function that draws a box and write the xlabel ylabel and rylabel
+in the given font.
+If one of the text parameters is NULL no text is drawn for that item.
+
*/ +int gBoxWithText(PARAM *p, int x, int y, int w, int h, int fontsize, const char *xlabel, const char *ylabel, const char *rylabel); +/*!
+Write a comment in the metafile
+
*/ +int gComment(PARAM *p, const char *comment); +/*!
+Play SVG file
+You have to download the file first using:
+int pvDownloadFile(PARAM *p, const char *filename);
+
+Attention:
+This is a deprecated function.
+It only works with the Qt3 version of pvbrowser client.
+Now use rlSvgAnumator from rllib.
+
*/ +int gPlaySVG(PARAM *p, const char *filename); +/*!
+Play SVG string over the socket
+
+Attention:
+This is a deprecated function.
+It only works with the Qt3 version of pvbrowser client.
+Now use rlSvgAnumator from rllib.
+
*/ +int gSocketPlaySVG(PARAM *p, const char *svgstring); +/*!
+Translate the graphic
+
*/ +int gTranslate(PARAM *p, float x, float y); +/*!
+Rotate the graphic
+Rotates the coordinate system angle degrees counterclockwise.
+
*/ +int gRotate(PARAM *p, float angle); +/*!
+Scale the graphic
+
*/ +int gScale(PARAM *p, float sx, float sy); +/*!
+Set Selector in QDraw Widget 0|1
+default 1
+
*/ +int pvSetSelector(PARAM *p, int id, int state); +/*!
+Print the SVG on the QDraw widget on a printer
+
*/ +int pvPrintSvgOnPrinter(PARAM *p, int id); + +/** @} */ // end of group + +/** @defgroup QwtScale QwtScale + * QwtScale Widget + * @{ */ +/*!
+
*/ +int qwtScaleSetTitle(PARAM *p, int id, const char *text); +/*!
+
*/ +int qwtScaleSetTitleColor(PARAM *p, int id, int r, int g, int b); +/*!
+
*/ +int qwtScaleSetTitleFont(PARAM *p, int id, const char *family, int pointsize, int bold, int italic, int underline, int strikeout); +/*!
+#ScalePosition.
+
*/ +int qwtScaleSetTitleAlignment(PARAM *p, int id, int flags); +/*!
+
*/ +int qwtScaleSetBorderDist(PARAM *p, int id, int start, int end); +/*!
+
*/ +int qwtScaleSetBaselineDist(PARAM *p, int id, int bd); +/*!
+
*/ +int qwtScaleSetScaleDiv(PARAM *p, int id, float lBound, float hBound, int maxMaj, int maxMin, int log, float step, int ascend); +/*!
+
*/ +int qwtScaleSetLabelFormat(PARAM *p, int id, int f, int prec, int fieldWidth); +/*!
+#ScalePosition.
+
*/ +int qwtScaleSetLabelAlignment(PARAM *p, int id, int align); +/*!
+
*/ +int qwtScaleSetLabelRotation(PARAM *p, int id, float rotation); +/*!
+#ScalePosition.
+
*/ +int qwtScaleSetPosition(PARAM *p, int id, int position); +/** @} */ // end of group +/** @defgroup QwtThermo QwtThermo + * QwtThermo Widget + * @{ */ +/*!
+logarithmic = 0 | 1
+
*/ +int qwtThermoSetScale(PARAM *p, int id, float min, float max, float step, int logarithmic); +/*!
+orientation = HORIZONTAL|VERTICAL
+#ThermoPosition.
+
*/ +int qwtThermoSetOrientation(PARAM *p, int id, int orientation, int position); +/*!
+
*/ +int qwtThermoSetBorderWidth(PARAM *p, int id, int width); +/*!
+
*/ +int qwtThermoSetFillColor(PARAM *p, int id, int r, int g, int b); +/*!
+
*/ +int qwtThermoSetAlarmColor(PARAM *p, int id, int r, int g, int b); +/*!
+
*/ +int qwtThermoSetAlarmLevel(PARAM *p, int id, float level); +/*!
+
*/ +int qwtThermoSetAlarmEnabled(PARAM *p, int id, int tf); +/*!
+
*/ +int qwtThermoSetPipeWidth(PARAM *p, int id, int width); +/*!
+
*/ +int qwtThermoSetRange(PARAM *p, int id, float vmin, float vmax, float step=0.0f); +/*!
+
*/ +int qwtThermoSetMargin(PARAM *p, int id, int margin); +/*!
+
*/ +int qwtThermoSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtKnob QwtKnob + * QwtKnob Widget + * @{ */ +/*!
+logarithmic = 0 | 1
+
*/ +int qwtKnobSetScale(PARAM *p, int id, float min, float max, float step, int logarithmic); +/*!
+
*/ +int qwtKnobSetMass(PARAM *p, int id, float mass); +/*!
+orientation = HORIZONTAL|VERTICAL
+
*/ +int qwtKnobSetOrientation(PARAM *p, int id, int orientation); +/*!
+rdonly = 0 | 1
+
*/ +int qwtKnobSetReadOnly(PARAM *p, int id, int rdonly); +/*!
+
*/ +int qwtKnobSetKnobWidth(PARAM *p, int id, int width); +/*!
+
*/ +int qwtKnobSetTotalAngle(PARAM *p, int id, float angle); +/*!
+
*/ +int qwtKnobSetBorderWidth(PARAM *p, int id, int width); +/*!
+#KnobSymbol.
+
*/ +int qwtKnobSetSymbol(PARAM *p, int id, int symbol); +/*!
+
*/ +int qwtKnobSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtCounter QwtCounter + * QwtCounter Widget + * @{ */ +/*!
+
*/ +int qwtCounterSetStep(PARAM *p, int id, float step); +/*!
+
*/ +int qwtCounterSetMinValue(PARAM *p, int id, float value); +/*!
+
*/ +int qwtCounterSetMaxValue(PARAM *p, int id, float value); +/*!
+
*/ +int qwtCounterSetStepButton1(PARAM *p, int id, int n); +/*!
+
*/ +int qwtCounterSetStepButton2(PARAM *p, int id, int n); +/*!
+
*/ +int qwtCounterSetStepButton3(PARAM *p, int id, int n); +/*!
+
*/ +int qwtCounterSetNumButtons(PARAM *p, int id, int n); +/*!
+#CounterButton.
+
*/ +int qwtCounterSetIncSteps(PARAM *p, int id, int button, int n); +/*!
+
*/ +int qwtCounterSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtWheel QwtWheel + * QwtWheel Widget + * @{ */ +/*!
+
*/ +int qwtWheelSetMass(PARAM *p, int id, float mass); +/*!
+orientation = HORIZONTAL|VERTICAL
+
*/ +int qwtWheelSetOrientation(PARAM *p, int id, int orientation); +/*!
+rdonly = 0 | 1
+
*/ +int qwtWheelSetReadOnly(PARAM *p, int id, int rdonly); +/*!
+
*/ +int qwtWheelSetTotalAngle(PARAM *p, int id, float angle); +/*!
+
*/ +int qwtWheelSetTickCnt(PARAM *p, int id, int cnt); +/*!
+
*/ +int qwtWheelSetViewAngle(PARAM *p, int id, float angle); +/*!
+
*/ +int qwtWheelSetInternalBorder(PARAM *p, int id, int width); +/*!
+
*/ +int qwtWheelSetWheelWidth(PARAM *p, int id, int width); +/*!
+
*/ +int qwtWheelSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtSlider QwtSlider + * QwtSlider Widget + * @{ */ +/*!
+logarithmic = 0 | 1
+
*/ +int qwtSliderSetScale(PARAM *p, int id, float min, float max, float step, int logarithmic); +/*!
+
*/ +int qwtSliderSetMass(PARAM *p, int id, float mass); +/*!
+orientation = HORIZONTAL|VERTICAL
+
*/ +int qwtSliderSetOrientation(PARAM *p, int id, int orientation); +/*!
+rdonly = 0 | 1
+
*/ +int qwtSliderSetReadOnly(PARAM *p, int id, int rdonly); +/*!
+#SliderBGSTYLE.
+
*/ +int qwtSliderSetBgStyle(PARAM *p, int id, int style); +/*!
+
*/ +int qwtSliderSetScalePos(PARAM *p, int id, int pos); +/*!
+
*/ +int qwtSliderSetThumbLength(PARAM *p, int id, int length); +/*!
+
*/ +int qwtSliderSetThumbWidth(PARAM *p, int id, int width); +/*!
+
*/ +int qwtSliderSetBorderWidth(PARAM *p, int id, int width); +/*!
+
*/ +int qwtSliderSetMargins(PARAM *p, int id, int x, int y); +/*!
+
*/ +int qwtSliderSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtCompass QwtCompass + * QwtCompass Widget + * @{ */ +/*!
+
*/ +int qwtCompassSetSimpleCompassRose(PARAM *p, int id, int numThorns, int numThornLevels, float width=0.2f); +/*!
+
*/ +int qwtCompassSetRange(PARAM *p, int id, float vmin, float vmax, float step=0.0f); +/*!
+
*/ +int qwtCompassSetMass(PARAM *p, int id, float mass); +/*!
+rdonly = 0 | 1
+
*/ +int qwtCompassSetReadOnly(PARAM *p, int id, int rdonly); +/*!
+#DialShadow.
+
*/ +int qwtCompassSetFrameShadow(PARAM *p, int id, int shadow); +/*!
+
*/ +int qwtCompassShowBackground(PARAM *p, int id, int show); +/*!
+
*/ +int qwtCompassSetLineWidth(PARAM *p, int id, int width); +/*!
+#DialMode.
+
*/ +int qwtCompassSetMode(PARAM *p, int id, int mode); +/*!
+
*/ +int qwtCompassSetWrapping(PARAM *p, int id, int wrap); +/*!
+
*/ +int qwtCompassSetScale(PARAM *p, int id, int maxMajIntv, int maxMinIntv, float step); +/*!
+
*/ +int qwtCompassSetScaleArc(PARAM *p, int id, float min, float max); +/*!
+
*/ +int qwtCompassSetOrigin(PARAM *p, int id, float o); +/*!
+which = #CompassNeedle.
+
*/ +int qwtCompassSetNeedle(PARAM *p, int id, int which, int r1=0, int g1=0, int b1=0, int r2=255, int g2=255, int b2=255, int r3=128, int g3=128, int b3=128); +/*!
+
*/ +int qwtCompassSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtDial QwtDial + * QwtDial Widget + * @{ */ +/*!
+
*/ +int qwtDialSetRange(PARAM *p, int id, float vmin, float vmax, float step=0.0f); +/*!
+
*/ +int qwtDialSetMass(PARAM *p, int id, float mass); +/*!
+rdonly = 0 | 1
+
*/ +int qwtDialSetReadOnly(PARAM *p, int id, int rdonly); +/*!
+#DialShadow.
+
*/ +int qwtDialSetFrameShadow(PARAM *p, int id, int shadow); +/*!
+
*/ +int qwtDialShowBackground(PARAM *p, int id, int show); +/*!
+
*/ +int qwtDialSetLineWidth(PARAM *p, int id, int width); +/*!
+#DialMode.
+
*/ +int qwtDialSetMode(PARAM *p, int id, int mode); +/*!
+
*/ +int qwtDialSetWrapping(PARAM *p, int id, int wrap); +/*!
+
*/ +int qwtDialSetScale(PARAM *p, int id, int maxMajIntv, int maxMinIntv, float step); +/*!
+
*/ +int qwtDialSetScaleArc(PARAM *p, int id, float min, float max); +/*!
+
*/ +int qwtDialSetOrigin(PARAM *p, int id, float o); +/*!
+which = #DialNeedle.
+
*/ +int qwtDialSetNeedle(PARAM *p, int id, int which, int r1=0, int g1=0, int b1=0, int r2=255, int g2=255, int b2=255, int r3=128, int g3=128, int b3=128); +/*!
+
*/ +int qwtDialSetValue(PARAM *p, int id, float value); +/** @} */ // end of group +/** @defgroup QwtAnalogClock QwtAnalogClock + * QwtAnalogClock Widget + * @{ */ +/*!
+
*/ +int qwtAnalogClockSetTime(PARAM *p, int id, int hour, int minute, int second); +/*!
+
*/ +int qwtAnalogClockSetMass(PARAM *p, int id, float mass); +/*!
+rdonly = 0 | 1
+
*/ +int qwtAnalogClockSetReadOnly(PARAM *p, int id, int rdonly); +/*!
+#DialShadow.
+
*/ +int qwtAnalogClockSetFrameShadow(PARAM *p, int id, int shadow); +/*!
+
*/ +int qwtAnalogClockShowBackground(PARAM *p, int id, int show); +/*!
+
*/ +int qwtAnalogClockSetLineWidth(PARAM *p, int id, int width); +/*!
+#DialMode.
+
*/ +int qwtAnalogClockSetMode(PARAM *p, int id, int mode); +/*!
+
*/ +int qwtAnalogClockSetWrapping(PARAM *p, int id, int wrap); +/*!
+
*/ +int qwtAnalogClockSetScale(PARAM *p, int id, int maxMajIntv, int maxMinIntv, float step); +/*!
+
*/ +int qwtAnalogClockSetScaleArc(PARAM *p, int id, float min, float max); +/*!
+
*/ +int qwtAnalogClockSetOrigin(PARAM *p, int id, float o); +/*!
+which = #CompassNeedle.
+if(which==QwtCompassNeedle1)    QwtCompassNeedle1(r1,g1,b1);
+if(which==QwtCompassNeedle2)    QwtCompassNeedle2(r1,g1,b1, r2,g2,b2);
+if(which==QwtCompassNeedle3)    QwtCompassNeedle3(r1,g1,b1, r2,g2,b2);
+if(which==QwtCompassNeedle4)    QwtCompassNeedle4(r1,g1,b1, r2,g2,b2, r3,g3,b3);
+if(which==QwtCompassLineNeedle) QwtCompassLineNeedle(r1,g1,b1);
+
*/ +int qwtAnalogClockSetNeedle(PARAM *p, int id, int which, int r1=0, int g1=0, int b1=0, int r2=255, int g2=255, int b2=255, int r3=128, int g3=128, int b3=128); +/*!
+
*/ +int qwtAnalogClockSetValue(PARAM *p, int id, float value); +/** @} */ // end of group + +/** @defgroup UnitConversion UnitConversion + * unit + * @{ */ +/*!
+#UNIT_CONVERSION.
+
*/ +float unit(PARAM *p, float val, int conversion); +/** @} */ // end of group + +/** @defgroup TextEvents TextEvents + * These are parsing functions for TEXT_EVENT + *
+ *  Example for useing TEXT_EVENTS:
+ *  ------------------------------------------
+ *  static int slotTextEvent(PARAM *p, int id, DATA *d, const char *text)
+ *  {
+ *    if(p == NULL || id == 0 || d == NULL || text == NULL) return -1;
+ *    float x,y,w,h;
+ *    float m11,m12,m21,m22,det,dx,dy;
+ *    switch(textEventType(text))
+ *    {
+ *      case PLAIN_TEXT_EVENT:
+ *        printf("plain\n");
+ *        break;
+ *      case WIDGET_GEOMETRY:
+ *        int X,Y,W,H;
+ *        getGeometry(text,&X,&Y,&W,&H);
+ *        printf("geometry(%d)=%d,%d,%d,%d\n",id,X,Y,W,H);
+ *        break;
+ *      case PARENT_WIDGET_ID:
+ *        int PID;
+ *        getParentWidgetId(text,&PID);
+ *        printf("parent(%d)=%d\n",id,PID);
+ *        break;
+ *      case SVG_LEFT_BUTTON_PRESSED:
+ *        printf("left pressed\n");
+ *        printf("objectname=%s\n",svgObjectName(text));
+ *        break;
+ *      case SVG_MIDDLE_BUTTON_PRESSED:
+ *        printf("middle pressed\n");
+ *        printf("objectname=%s\n",svgObjectName(text));
+ *        break;
+ *      case SVG_RIGHT_BUTTON_PRESSED:
+ *        printf("right pressed\n");
+ *        printf("objectname=%s\n",svgObjectName(text));
+ *        break;
+ *      case SVG_LEFT_BUTTON_RELEASED:
+ *        printf("left released\n");
+ *        printf("objectname=%s\n",svgObjectName(text));
+ *        break;
+ *      case SVG_MIDDLE_BUTTON_RELEASED:
+ *        printf("middle released\n");
+ *        printf("objectname=%s\n",svgObjectName(text));
+ *        break;
+ *      case SVG_RIGHT_BUTTON_RELEASED:
+ *        printf("right released\n");
+ *        break;
+ *      case SVG_BOUNDS_ON_ELEMENT:
+ *        getSvgBoundsOnElement(text, &x, &y, &w, &h);
+ *        printf("bounds object=%s xywh=%f,%f,%f,%f\n",svgObjectName(text),x,y,w,h);
+ *        break;
+ *      case SVG_MATRIX_FOR_ELEMENT:
+ *        getSvgMatrixForElement(text, &m11, &m12, &m21, &m22, &det, &dx, &dy);
+ *        printf("matrix object=%s m=%f,%f,%f,%f det=%f dx=%f dy=%f\n",svgObjectName(text),
+ *                                 m11,m12,m21,m22,det,dx,dy);
+ *        break;
+ *      default:
+ *        printf("default\n");
+ *        break;
+ *    }
+ *    return 0;
+ *  }
+ *  
+ * + * @{ */ +/*!
+Return the enum #TextEvents
+Allowed widgets: QDrawWidget
+
*/ +int textEventType(const char *text); +/*!
+Returns the object name within a SVG graphic from a TEXT_EVENT
+or "" if not found
+Allowed widgets: QDrawWidget
+
*/ +const char *svgObjectName(const char *text); +/*!
+Returns the bounds on object within a SVG graphic from a TEXT_EVENT
+Allowed widgets: QDrawWidget
+
*/ +int getSvgBoundsOnElement(const char *text, float *x, float *y, float *width, float *height); +/*!
+Returns the matrix for object within a SVG graphic from a TEXT_EVENT
+Allowed widgets: QDrawWidget
+
*/ +int getSvgMatrixForElement(const char *text, float *m11, float *m12, float *m21, float *m22, + float *det, float *dx, float *dy); +/*!
+Returns the geometry for a widget from a TEXT_EVENT
+Allowed widgets: all widgets
+
*/ +int getGeometry(const char *text, int *x, int *y, int *width, int *height); +/*!
+Returns the parent id for a widget from a TEXT_EVENT
+Allowed widgets: all widgets
+
*/ +int getParentWidgetId(const char *text, int *parent); +/** @} */ // end of group + +/** @defgroup Classe Classes from pvslib + * Here are classes for the pvslib. + * @{ */ +/*!
+Use this class for manageing p->num_additional_widgets by widget names
+Example:
+
+typedef struct // (todo: define your data structure here)
+{
+  pvWidgetIdManager mgr;
+}
+DATA;
+
+static int slotInit(PARAM *p, DATA *d)
+{
+  if(p == NULL || d == NULL) return -1;
+  int id;
+          
+  d->mgr.init(p,ID_END_OF_WIDGETS);
+
+  id = d->mgr.newId("test1");
+  pvQPushButton(p,id,0);
+  pvSetGeometry(p,id,270,40,100,30);
+  pvSetText(p,id,"test1");
+  pvShow(p,id);
+
+  return 0;
+}                                                      }
+
+static int slotButtonPressedEvent(PARAM *p, int id, DATA *d)
+{
+  if(p == NULL || id == 0 || d == NULL) return -1;
+  if(id == obj1)
+  {
+    printf("knowns id's:\n");
+    int i = d->mgr.first();
+    while(i > 0)
+    {
+      printf("name=%s id=%d\n", d->mgr.name(i),i);
+      i = d->mgr.next();
+    }
+  }
+  return 0;
+}
+
+
*/ +#ifndef __VMS +#include +#include +#include +#include + +class pvWidgetIdManager +{ +public: + pvWidgetIdManager(); + virtual ~pvWidgetIdManager(); + int init(PARAM *p, int id_start); + virtual int newId(const char *name); + virtual int deleteWidget(PARAM *p, const char *name); + virtual int id(const char *name); + virtual int isInMap(const char *name); + int isInMap(int id); + int firstId(); + int nextId(); + int endId(); + const char *name(int id); + int idStart(); + virtual int readEnumFromMask(const char *maskname); +private: + int insertBasicId(int id, const char *name); + int id_start, num_additional_widgets; + int *free; + std::map id_list; + std::multimap ::iterator it; +}; +#endif +/** @} */ // end of group + +#endif diff --git a/libs/pvb/include/pvserver/processviewserver_string.h b/libs/pvb/include/pvserver/processviewserver_string.h new file mode 100644 index 0000000..889ed05 --- /dev/null +++ b/libs/pvb/include/pvserver/processviewserver_string.h @@ -0,0 +1,72 @@ +// You may use this header if you use C++ string's +// avoid casts with .c_str() +// Warning: This file is NOT maintained on a regular basis, so some functions may be missing +// If you observe this please contact: R. Lehrig lehrig@t-online.de +#ifndef _PROCESS_VIEW_SERVER_STRING_H_ +#define _PROCESS_VIEW_SERVER_STRING_H_ +#include "processviewserver.h" +#include +using namespace std; + +inline int pvWait(PARAM *p, string pattern) { return pvWait(p, pattern.c_str()); } +inline int pvWarning(PARAM *p, string text) { return pvWarning(p, text.c_str()); } +inline int pvMainFatal(PARAM *p, string text) { return pvMainFatal(p, text.c_str()); } +inline int pvThreadFatal(PARAM *p, string text) { return pvThreadFatal(p, text.c_str()); } +inline int pvQButtonGroup(PARAM *p, int id, int parent, int columns, int orientation, string title) { return pvQButtonGroup(p, id, parent, columns, orientation, title.c_str()); } +inline int pvQImage(PARAM *p, int id, int parent, string imagename, int *w, int *h, int *depth) { return pvQImage(p, id, parent, imagename.c_str(), w, h, depth); } +inline int pvQGroupBox(PARAM *p, int id, int parent, int columns, int orientation, string title) { return pvQGroupBox(p, id, parent, columns, orientation, title.c_str()); } +inline int pvSetCaption(PARAM *p, string text) { return pvSetCaption(p, text.c_str()); } +inline int pvToolTip(PARAM *p, int id, string text) { return pvToolTip(p, id, text.c_str()); } +inline int pvSetText(PARAM *p, int id, string text) { return pvSetText(p, id, text.c_str()); } +inline int pvChangeItem(PARAM *p, int id, int index, string bmp_file, string text) { return pvChangeItem(p, id, index, bmp_file.c_str(), text.c_str()); } +inline int pvInsertItem(PARAM *p, int id, int index, string bmp_file, string text) { return pvInsertItem(p, id, index, bmp_file.c_str(), text.c_str()); } +inline int pvRemoveItemByName(PARAM *p, int id, string name) { return pvRemoveItemByName(p, id, name.c_str()); } +inline int pvAddColumn(PARAM *p, int id, string text, int size) { return pvAddColumn(p, id, text.c_str(), size); } +inline int pvSetTableText(PARAM *p, int id, int x, int y, string text) { return pvSetTableText(p, id, x, y, text.c_str()); } +inline int pvSetTableCheckBox(PARAM *p, int id, int x, int y, int state, string text) { return pvSetTableCheckBox(p, id, x, y, state, text.c_str()); } +inline int pvSetTableComboBox(PARAM *p, int id, int x, int y, int editable, string textlist) { return pvSetTableComboBox(p, id, x, y, editable, textlist.c_str()); } +inline int pvSetListViewText(PARAM *p, int id, string path, int column, string text) { return pvSetListViewText(p, id, path.c_str(), column, text.c_str()); } +inline int pvSetPixmap(PARAM *p, int id, string bmp_file) { return pvSetPixmap(p, id, bmp_file.c_str()); } +inline int pvSetTablePixmap(PARAM *p, int id, int x, int y, string bmp_file) { return pvSetTablePixmap(p, id, x, y, bmp_file.c_str()); } +inline int pvSetSource(PARAM *p, int id, string html_file) { return pvSetSource(p, id, html_file.c_str()); } +inline int pvSetImage(PARAM *p, int id, string filename) { return pvSetImage(p, id, filename.c_str()); } +inline int pvSetFont(PARAM *p, int id, string family, int pointsize, int bold, int italic , int underline, int strikeout) { return pvSetFont(p, id, family.c_str(), pointsize, bold, italic , underline, strikeout); } +inline int pvDisplayStr(PARAM *p, int id, string str) { return pvDisplayStr(p, id, str.c_str()); } +inline int pvAddTab(PARAM *p, int id, int id_child, string str) { return pvAddTab(p, id, id_child, str.c_str()); } +inline int pvSetListViewPixmap(PARAM *p, int id, string path, string bmp_file, int column) { return pvSetListViewPixmap(p, id, path.c_str(), bmp_file.c_str(), column); } +inline int pvRemoveListViewItem(PARAM *p, int id, string path) { return pvRemoveListViewItem(p, id, path.c_str()); } +inline int pvRemoveIconViewItem(PARAM *p, int id, string text) { return pvRemoveIconViewItem(p, id, text.c_str()); } +inline int pvSetIconViewItem(PARAM *p, int id, string bmp_file, string text) { return pvSetIconViewItem(p, id, bmp_file.c_str(), text.c_str()); } +inline int pvListViewEnsureVisible(PARAM *p, int id, string path) { return pvListViewEnsureVisible(p, id, path.c_str()); } +inline int pvListViewSetOpen(PARAM *p, int id, string path, int open) { return pvListViewSetOpen(p, id, path.c_str(), open); } +inline int pvVtkTcl(PARAM *p, int id, string tcl_command) { return pvVtkTcl(p, id, tcl_command.c_str()); } +inline int pvVtkTclScript(PARAM *p, int id, string filename) { return pvVtkTclScript(p, id, filename.c_str()); } +inline int pvHyperlink(PARAM *p, string link) { return pvHyperlink(p, link.c_str()); } +inline int pvWriteFile(PARAM *p, string filename, int width, int height) { return pvWriteFile(p, filename.c_str(), width, height); } +inline int pvSave(PARAM *p, int id, string filename) { return pvSave(p, id, filename.c_str()); } +inline int pvSaveAsBmp(PARAM *p, int id, string filename) { return pvSaveAsBmp(p, id, filename.c_str()); } +inline int pvSendFile(PARAM *p, string filename) { return pvSendFile(p, filename.c_str()); } +inline int pvDownloadFileAs(PARAM *p, string filename, string newname) { return pvDownloadFileAs(p, filename.c_str(), newname.c_str()); } +inline int pvDownloadFile(PARAM *p, string filename) { return pvDownloadFile(p, filename.c_str()); } +inline int pvPopupMenu(PARAM *p, int id_return, string text) { return pvPopupMenu(p, id_return, text.c_str()); } +inline int pvMessageBox(PARAM *p, int id_return, int type, string text, int button0, int button1, int button2) { return pvMessageBox(p, id_return, type, text.c_str(), button0, button1, button2); } +inline int pvInputDialog(PARAM *p, int id_return, string text, string default_text) { return pvInputDialog(p, id_return, text.c_str(), default_text.c_str()); } +inline int qpwSetTitle(PARAM *p, int id, string text) { return qpwSetTitle(p, id, text.c_str()); } +inline int qpwSetAxisTitle(PARAM *p, int id, int pos, string text) { return qpwSetAxisTitle(p, id, pos, text.c_str()); } +inline int qpwInsertCurve(PARAM *p, int id, int index, string text) { return qpwInsertCurve(p, id, index, text.c_str()); } +inline int qpwSetMarkerLabel(PARAM *p, int id, int number, string text) { return qpwSetMarkerLabel(p, id, number, text.c_str()); } +inline int qpwSetMarkerFont(PARAM *p, int id, int index, string family, int size, int style) { return qpwSetMarkerFont(p, id, index, family.c_str(), size, style); } +inline int qpwInsertLineMarker(PARAM *p, int id, int index, string text, int pos) { return qpwInsertLineMarker(p, id, index, text.c_str(), pos); } +inline int qpwSetAxisScaleDraw( PARAM *p, int id, int pos, string text ) { return qpwSetAxisScaleDraw( p, id, pos, text.c_str() ); } +inline int gWriteFile(string file) { return gWriteFile(file.c_str()); } +inline int gSetFont(PARAM *p, string family, int size, int weight, int italic) { return gSetFont(p, family.c_str(), size, weight, italic); } +inline int gText(PARAM *p, int x, int y, string text, int alignment) { return gText(p, x, y, text.c_str(), alignment); } +inline int gTextInAxis(PARAM *p, float x, float y, string text, int alignment) { return gTextInAxis(p, x, y, text.c_str(), alignment); } +inline int gSetFloatFormat(PARAM *p, string text) { return gSetFloatFormat(p, text.c_str()); } +inline int gBoxWithText(PARAM *p, int x, int y, int w, int h, int fontsize, string xlabel, string ylabel, string rylabel) { return gBoxWithText(p, x, y, w, h, fontsize, xlabel.c_str(), ylabel.c_str(), rylabel.c_str()); } +inline int gComment(PARAM *p, string comment) { return gComment(p, comment.c_str()); } +inline int gPlaySVG(PARAM *p, string filename) { return gPlaySVG(p, filename.c_str()); } +inline int qwtScaleSetTitle(PARAM *p, int id, string text) { return qwtScaleSetTitle(p, id, text.c_str()); } +inline int qwtScaleSetTitleFont(PARAM *p, int id, string family, int pointsize, int bold, int italic, int underline, int strikeout) { return qwtScaleSetTitleFont(p, id, family.c_str(), pointsize, bold, italic, underline, strikeout); } + +#endif diff --git a/libs/pvb/include/pvserver/pvapp--.h b/libs/pvb/include/pvserver/pvapp--.h new file mode 100644 index 0000000..095ae3e --- /dev/null +++ b/libs/pvb/include/pvserver/pvapp--.h @@ -0,0 +1,31 @@ +/*************************************************************************** + pvapp.h - description + ------------------- + begin : Sun Nov 12 2000 + copyright : (C) 2000 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef _PVAPP_H_ +#define _PVAPP_H_ + +#include "processviewserver.h" + +int show_mask1(PARAM *p); +int show_mask2(PARAM *p); +int show_mask3(PARAM *p); +int show_mask4(PARAM *p); +int show_periodic(PARAM *p); +int show_maskvtk(PARAM *p); +int show_qwt(PARAM *p); +int show_modal1(PARAM *p); + +#endif diff --git a/libs/pvb/include/pvserver/pvbImage.h b/libs/pvb/include/pvserver/pvbImage.h new file mode 100644 index 0000000..df95d4c --- /dev/null +++ b/libs/pvb/include/pvserver/pvbImage.h @@ -0,0 +1,36 @@ +/*************************************************************************** + pvbImage.h - description + ------------------- + begin : Sun Okt 12 2001 + copyright : (C) 2000 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +#include "BMP.h" + +typedef struct +{ + unsigned char b,g,r,reserved; +}LUT; + +typedef struct +{ + int w,h,bpp,nLut; + LUT *lut; + void *image; +} +PVB_IMAGE; + +PVB_IMAGE *pvbImageRead(const char *filename); +void pvbImageFree(PVB_IMAGE *pvbImage); + +int pvmyread(int fhdl, char *cptr, int len); +int pvopenBinary(const char *filename); diff --git a/libs/pvb/include/pvserver/vmsgl.h b/libs/pvb/include/pvserver/vmsgl.h new file mode 100644 index 0000000..48d392c --- /dev/null +++ b/libs/pvb/include/pvserver/vmsgl.h @@ -0,0 +1,2272 @@ +/* $Id: vmsgl.h,v 1.1.1.1 2003/07/24 08:16:24 lehrig Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.4 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is 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 Software. + * + * THE SOFTWARE IS 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 + * BRIAN PAUL 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef __gl_h_ +#define __gl_h_ + +#if defined(USE_MGL_NAMESPACE) +#include "gl_mangle.h" +#endif + + +/********************************************************************** + * Begin system-specific stuff. + */ +#if defined(__BEOS__) +#include /* to get some BeOS-isms */ +#endif + +#if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) +#define OPENSTEP +#endif + +/* +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) +#define __WIN32__ +#endif + +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) +# if defined(_MSC_VER) && defined(BUILD_GL32) // tag specify we're building mesa as a DLL +# define GLAPI __declspec(dllexport) +# elif defined(_MSC_VER) && defined(_DLL) // tag specifying we're building for DLL runtime support +# define GLAPI __declspec(dllimport) +# else // for use with static link lib build of Win32 edition only +# define GLAPI extern +# endif // _STATIC_MESA support +# define GLAPIENTRY __stdcall +#else +// non-Windows compilation +# define GLAPI extern +# define GLAPIENTRY +#endif // WIN32 / CYGWIN bracket +*/ + +#define GLAPI extern +#define GLAPIENTRY + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif +/* + * End system-specific stuff. + **********************************************************************/ + + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 + + + +/* + * + * Datatypes + * + */ +#ifdef CENTERLINE_CLPP +#define signed +#endif +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + + + +/* + * + * Constants + * + */ + +/* Boolean values */ +#define GL_FALSE 0x0 +#define GL_TRUE 0x1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0x0 +#define GL_ONE 0x1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_COEFF 0x0A00 +#define GL_DOMAIN 0x0A02 +#define GL_ORDER 0x0A01 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SCISSOR_BOX 0x0C10 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 + +/* GL 1.1 texturing */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 + +/* GL 1.2 texturing */ +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A + +/* Internal texture formats (GL 1.1) */ +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0x0 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + + +/* OpenGL 1.2 */ +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E + + + +/* + * OpenGL 1.2 imaging subset (NOT IMPLEMENTED BY MESA) + */ +/* GL_EXT_color_table */ +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +/* GL_EXT_convolution and GL_HP_convolution_border_modes */ +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +/* GL_SGI_color_matrix */ +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +/* GL_EXT_histogram */ +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +/* GL_EXT_blend_color, GL_EXT_blend_minmax */ +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 + + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF + + + + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export on +#endif + + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY glClearColor( GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha ); + +GLAPI void GLAPIENTRY glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, + GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY glPopAttrib( void ); + + +GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY glGetError( void ); + +GLAPI const GLubyte* GLAPIENTRY glGetString( GLenum name ); + +GLAPI void GLAPIENTRY glFinish( void ); + +GLAPI void GLAPIENTRY glFlush( void ); + +GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); + + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); + + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY glPushMatrix( void ); + +GLAPI void GLAPIENTRY glPopMatrix( void ); + +GLAPI void GLAPIENTRY glLoadIdentity( void ); + +GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); + +GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY glEndList( void ); + +GLAPI void GLAPIENTRY glCallList( GLuint list ); + +GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY glListBase( GLuint base ); + + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY glEnd( void ); + + +GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY glIndexi( GLint c ); +GLAPI void GLAPIENTRY glIndexs( GLshort c ); +GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); + + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, void **params ); + +GLAPI void GLAPIENTRY glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); + + + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLint mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLint mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLint mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + + + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY glMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); +GLAPI void GLAPIENTRY glMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); + + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY glInitNames( void ); + +GLAPI void GLAPIENTRY glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY glPushName( GLuint name ); + +GLAPI void GLAPIENTRY glPopName( void ); + + + +/* 1.2 functions */ +GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + + +/* 1.2 imaging extension functions */ + +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + + + +/* + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) + */ +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); + +#endif /* GL_ARB_multitexture */ + + + + +#if defined(GL_GLEXT_LEGACY) + + +/* + * 1. GL_EXT_abgr + */ +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 + +#define GL_ABGR_EXT 0x8000 + +#endif /* GL_EXT_abgr */ + + + +/* + * 2. GL_EXT_blend_color + */ +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 + +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 + +GLAPI void GLAPIENTRY glBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +#endif /* GL_EXT_blend_color */ + + + +/* + * 3. GL_EXT_polygon_offset + */ +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 + +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 + +GLAPI void GLAPIENTRY glPolygonOffsetEXT( GLfloat factor, GLfloat bias ); + +#endif /* GL_EXT_polygon_offset */ + + + +/* + * 6. GL_EXT_texture3D + */ +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 + +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A + +GLAPI void GLAPIENTRY glTexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +#endif /* GL_EXT_texture3D */ + + + +/* + * 20. GL_EXT_texture_object + */ +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 + +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 + +GLAPI void GLAPIENTRY glGenTexturesEXT( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTexturesEXT( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTextureEXT( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); + +#endif /* GL_EXT_texture_object */ + + + +/* + * 27. GL_EXT_rescale_normal + */ +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 + +#define GL_RESCALE_NORMAL_EXT 0x803A + +#endif /* GL_EXT_rescale_normal */ + + + +/* + * 30. GL_EXT_vertex_array + */ +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 + +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 + +GLAPI void GLAPIENTRY glVertexPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointerEXT( GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointerEXT( GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointerEXT( GLsizei stride, GLsizei count, const GLboolean *ptr ); + +GLAPI void GLAPIENTRY glGetPointervEXT( GLenum pname, void **params ); + +GLAPI void GLAPIENTRY glArrayElementEXT( GLint i ); + +GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ); + +#endif /* GL_EXT_vertex_array */ + + + +/* + * 35. GL_SGIS_texture_edge_clamp + */ +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 + +#define GL_CLAMP_TO_EDGE_SGIS 0x812F + +#endif /* GL_SGIS_texture_edge_clamp */ + + + +/* + * 37. GL_EXT_blend_minmax + */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 + +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 + +GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); + +#endif /* GL_EXT_blend_minmax */ + + + +/* + * 38. GL_EXT_blend_subtract (requires GL_EXT_blend_max ) + */ +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 + +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B + +#endif /* GL_EXT_blend_subtract */ + + + +/* + * 39. GL_EXT_blend_logic_op + */ +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 + +/* No new tokens or functions */ + +#endif /* GL_EXT_blend_logic_op */ + + + +/* + * 54. GL_EXT_point_parameters + */ +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 + +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 + +GLAPI void GLAPIENTRY glPointParameterfEXT( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPointParameterfvEXT( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glPointParameterfSGIS(GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPointParameterfvSGIS(GLenum pname, const GLfloat *params); + +#endif /* GL_EXT_point_parameters */ + + + +/* + * 78. GL_EXT_paletted_texture + */ +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 + +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 + +GLAPI void GLAPIENTRY glColorTableEXT( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTableEXT( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ); + +GLAPI void GLAPIENTRY glGetColorTableEXT( GLenum target, GLenum format, GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfvEXT( GLenum target, GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameterivEXT( GLenum target, GLenum pname, GLint *params ); + +#endif /* GL_EXT_paletted_texture */ + + + +/* + * 79. GL_EXT_clip_volume_hint + */ +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 + +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 + +#endif /* GL_EXT_clip_volume_hint */ + + + +/* + * 97. GL_EXT_compiled_vertex_array + */ +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 + +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 + +GLAPI void GLAPIENTRY glLockArraysEXT( GLint first, GLsizei count ); +GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); + +#endif /* GL_EXT_compiled_vertex_array */ + +/* + * 137. GL_HP_occlusion_test + */ +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 + +#endif /* GL_HP_occlusion_test */ + + +/* + * 141. GL_EXT_shared_texture_palette (req's GL_EXT_paletted_texture) + */ +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 + +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB + +#endif /* GL_EXT_shared_texture_palette */ + + + +/* + * 176. GL_EXT_stencil_wrap + */ +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 + +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 + +#endif /* GL_EXT_stencil_wrap */ + + + +/* + * 179. GL_NV_texgen_reflection + */ +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 + +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 + +#endif /* GL_NV_texgen_reflection */ + + + +/* + * 185. GL_EXT_texture_env_add + */ +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 + +/* No new tokens or functions */ + +#endif /* GL_EXT_texture_env_add */ + + + + + +/* + * 197. GL_MESA_window_pos + */ +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 + +GLAPI void GLAPIENTRY glWindowPos2iMESA( GLint x, GLint y ); +GLAPI void GLAPIENTRY glWindowPos2sMESA( GLshort x, GLshort y ); +GLAPI void GLAPIENTRY glWindowPos2fMESA( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glWindowPos2dMESA( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glWindowPos2ivMESA( const GLint *p ); +GLAPI void GLAPIENTRY glWindowPos2svMESA( const GLshort *p ); +GLAPI void GLAPIENTRY glWindowPos2fvMESA( const GLfloat *p ); +GLAPI void GLAPIENTRY glWindowPos2dvMESA( const GLdouble *p ); +GLAPI void GLAPIENTRY glWindowPos3iMESA( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glWindowPos3sMESA( GLshort x, GLshort y, GLshort z ); +GLAPI void GLAPIENTRY glWindowPos3fMESA( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glWindowPos3dMESA( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glWindowPos3ivMESA( const GLint *p ); +GLAPI void GLAPIENTRY glWindowPos3svMESA( const GLshort *p ); +GLAPI void GLAPIENTRY glWindowPos3fvMESA( const GLfloat *p ); +GLAPI void GLAPIENTRY glWindowPos3dvMESA( const GLdouble *p ); +GLAPI void GLAPIENTRY glWindowPos4iMESA( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glWindowPos4sMESA( GLshort x, GLshort y, GLshort z, GLshort w ); +GLAPI void GLAPIENTRY glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glWindowPos4dMESA( GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void GLAPIENTRY glWindowPos4ivMESA( const GLint *p ); +GLAPI void GLAPIENTRY glWindowPos4svMESA( const GLshort *p ); +GLAPI void GLAPIENTRY glWindowPos4fvMESA( const GLfloat *p ); +GLAPI void GLAPIENTRY glWindowPos4dvMESA( const GLdouble *p ); + +#endif /* GL_MESA_window_pos */ + + + +/* + * 196. GL_MESA_resize_bufffers + */ +#ifndef GL_MESA_resize_bufffers +#define GL_MESA_resize_buffers 1 + +GLAPI void GLAPIENTRY glResizeBuffersMESA( void ); + +#endif /* GL_MESA_resize_bufffers */ + + + +/* + * 220. GL_EXT_texture_env_dot3 + */ +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 + +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 + +#endif /* GL_EXT_texture_env_dot3 */ + + +#else /* GL_GLEXT_LEGACY */ + +#include "vmsglext.h" + +#endif /* GL_GLEXT_LEGACY */ + + + +/********************************************************************** + * Begin system-specific stuff + */ +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export off +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import off +#endif +/* + * End system-specific stuff + **********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ diff --git a/libs/pvb/include/pvserver/vmsglext.h b/libs/pvb/include/pvserver/vmsglext.h new file mode 100644 index 0000000..774d572 --- /dev/null +++ b/libs/pvb/include/pvserver/vmsglext.h @@ -0,0 +1,3054 @@ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +#define GL_GLEXT_VERSION 7 + +#ifndef GL_VERSION_1_2 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE3_RGB_EXT 0x8583 +#define GL_SOURCE4_RGB_EXT 0x8584 +#define GL_SOURCE5_RGB_EXT 0x8585 +#define GL_SOURCE6_RGB_EXT 0x8586 +#define GL_SOURCE7_RGB_EXT 0x8587 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_SOURCE3_ALPHA_EXT 0x858B +#define GL_SOURCE4_ALPHA_EXT 0x858C +#define GL_SOURCE5_ALPHA_EXT 0x858D +#define GL_SOURCE6_ALPHA_EXT 0x858E +#define GL_SOURCE7_ALPHA_EXT 0x858F +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND3_RGB_EXT 0x8593 +#define GL_OPERAND4_RGB_EXT 0x8594 +#define GL_OPERAND5_RGB_EXT 0x8595 +#define GL_OPERAND6_RGB_EXT 0x8596 +#define GL_OPERAND7_RGB_EXT 0x8597 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#define GL_OPERAND3_ALPHA_EXT 0x859B +#define GL_OPERAND4_ALPHA_EXT 0x859C +#define GL_OPERAND5_ALPHA_EXT 0x859D +#define GL_OPERAND6_ALPHA_EXT 0x859E +#define GL_OPERAND7_ALPHA_EXT 0x859F +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x01 +#define GL_REPLACE_MIDDLE_SUN 0x02 +#define GL_REPLACE_OLDEST_SUN 0x03 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW_MATRIX1_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + + +/*************************************************************/ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +extern void APIENTRY glBlendEquation (GLenum); +extern void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +extern void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +extern void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +extern void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +extern void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +extern void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +extern void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +extern void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +extern void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +extern void APIENTRY glResetHistogram (GLenum); +extern void APIENTRY glResetMinmax (GLenum); +extern void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glActiveTextureARB (GLenum); +extern void APIENTRY glClientActiveTextureARB (GLenum); +extern void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +extern void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +extern void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +extern void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +extern void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +extern void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +extern void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +extern void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +extern void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +extern void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +extern void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +extern void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +extern void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +extern void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +extern void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +extern void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +extern void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +extern void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +extern void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +extern void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +extern void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +extern void APIENTRY glSamplePassARB (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPASSARBPROC) (GLenum pass); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, void *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +extern void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +extern void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +extern void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +extern void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +extern void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +extern void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +extern void APIENTRY glResetHistogramEXT (GLenum); +extern void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +extern void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +extern void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +extern void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +extern void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +extern void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +extern void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +extern void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +extern void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +extern void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +extern GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +extern void APIENTRY glBindTextureEXT (GLenum, GLuint); +extern void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +extern void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +extern GLboolean APIENTRY glIsTextureEXT (GLuint); +extern void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +extern void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +extern void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +extern void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glArrayElementEXT (GLint); +extern void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +extern void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +extern void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +extern void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRY * PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +extern void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +extern void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +extern void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +extern void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +extern void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +extern void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +extern GLint APIENTRY glGetInstrumentsSGIX (void); +extern void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +extern GLint APIENTRY glPollInstrumentsSGIX (GLint *); +extern void APIENTRY glReadInstrumentsSGIX (GLint); +extern void APIENTRY glStartInstrumentsSGIX (void); +extern void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRY * PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRY * PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRY * PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRY * PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRY * PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRY * PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +extern void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +extern void APIENTRY glDeformSGIX (GLbitfield); +extern void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRY * PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRY * PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRY * PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +extern void APIENTRY glGetFogFuncSGIS (const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRY * PFNGLGETFOGFUNCSGISPROC) (const GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +extern void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +extern void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +extern void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +extern void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +extern void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +extern void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +extern void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +extern void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +extern void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glLockArraysEXT (GLint, GLsizei); +extern void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +extern void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +extern void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +extern void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +extern void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +extern void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +extern void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +extern void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +extern void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +extern void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +extern void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +extern void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +extern void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +extern void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +extern void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glApplyTextureEXT (GLenum); +extern void APIENTRY glTextureLightEXT (GLenum); +extern void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glAsyncMarkerSGIX (GLuint); +extern GLint APIENTRY glFinishAsyncSGIX (GLuint *); +extern GLint APIENTRY glPollAsyncSGIX (GLuint *); +extern GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +extern void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +extern GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +extern void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +extern void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +extern void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +extern void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +extern void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +extern void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +extern void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +extern void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +extern void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +extern void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +extern void APIENTRY glSecondaryColor3ivEXT (const GLint *); +extern void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +extern void APIENTRY glSecondaryColor3svEXT (const GLshort *); +extern void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +extern void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +extern void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +extern void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +extern void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +extern void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +extern void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +extern void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFogCoordfEXT (GLfloat); +extern void APIENTRY glFogCoordfvEXT (const GLfloat *); +extern void APIENTRY glFogCoorddEXT (GLdouble); +extern void APIENTRY glFogCoorddvEXT (const GLdouble *); +extern void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +extern void APIENTRY glTangent3bvEXT (const GLbyte *); +extern void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glTangent3dvEXT (const GLdouble *); +extern void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTangent3fvEXT (const GLfloat *); +extern void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +extern void APIENTRY glTangent3ivEXT (const GLint *); +extern void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +extern void APIENTRY glTangent3svEXT (const GLshort *); +extern void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +extern void APIENTRY glBinormal3bvEXT (const GLbyte *); +extern void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glBinormal3dvEXT (const GLdouble *); +extern void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glBinormal3fvEXT (const GLfloat *); +extern void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +extern void APIENTRY glBinormal3ivEXT (const GLint *); +extern void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +extern void APIENTRY glBinormal3svEXT (const GLshort *); +extern void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRY * PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRY * PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRY * PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRY * PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRY * PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRY * PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRY * PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRY * PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRY * PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRY * PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +extern void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +extern void APIENTRY glGlobalAlphaFactoriSUN (GLint); +extern void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +extern void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +extern void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +extern void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +extern void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glReplacementCodeuiSUN (GLuint); +extern void APIENTRY glReplacementCodeusSUN (GLushort); +extern void APIENTRY glReplacementCodeubSUN (GLubyte); +extern void APIENTRY glReplacementCodeuivSUN (const GLuint *); +extern void APIENTRY glReplacementCodeusvSUN (const GLushort *); +extern void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +extern void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +extern void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +extern void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +extern void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +extern void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLenum *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLenum, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLenum *, const GLubyte *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLenum rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLenum rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLenum *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLenum rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glVertexWeightfEXT (GLfloat); +extern void APIENTRY glVertexWeightfvEXT (const GLfloat *); +extern void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFlushVertexArrayRangeNV (void); +extern void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei size, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +extern void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +extern void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +extern void APIENTRY glCombinerParameteriNV (GLenum, GLint); +extern void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +extern void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +extern void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +extern void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +extern void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +extern void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +extern void APIENTRY glWindowPos2dvMESA (const GLdouble *); +extern void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +extern void APIENTRY glWindowPos2fvMESA (const GLfloat *); +extern void APIENTRY glWindowPos2iMESA (GLint, GLint); +extern void APIENTRY glWindowPos2ivMESA (const GLint *); +extern void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +extern void APIENTRY glWindowPos2svMESA (const GLshort *); +extern void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glWindowPos3dvMESA (const GLdouble *); +extern void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glWindowPos3fvMESA (const GLfloat *); +extern void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +extern void APIENTRY glWindowPos3ivMESA (const GLint *); +extern void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +extern void APIENTRY glWindowPos3svMESA (const GLshort *); +extern void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +extern void APIENTRY glWindowPos4dvMESA (const GLdouble *); +extern void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glWindowPos4fvMESA (const GLfloat *); +extern void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +extern void APIENTRY glWindowPos4ivMESA (const GLint *); +extern void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +extern void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glMultiModeDrawArraysIBM (GLenum, const GLint *, const GLsizei *, GLsizei, GLint); +extern void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +extern void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +extern void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGI_vertex_preclip +#define GL_SGI_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/pvb/include/pvserver/wthread.h b/libs/pvb/include/pvserver/wthread.h new file mode 100644 index 0000000..fce6c82 --- /dev/null +++ b/libs/pvb/include/pvserver/wthread.h @@ -0,0 +1,122 @@ +/*************************************************************************** + wthread.h - description + ------------------- + begin : Sun Nov 12 2000 + copyright : (C) 2000 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/*********************************************************************************** + +Wrapper for posix threads (UNIX,VMS,windows) + +(C) R. Lehrig 2000 lehrig@t-online.de + +***********************************************************************************/ + +#ifndef _WTHREAD_H_ +#define _WTHREAD_H_ + +#include "processviewserver.h" + +#ifdef PVWIN32 +#define WTREAD_GNUC1 ( __GNUC__ * 1000 ) + __GNUC_MINOR__ +#if WTREAD_GNUC1 < 4008 +#define PVWIN32THREAD +#endif +#include +#include +#endif + +#include +#include + +#ifdef PVWIN32THREAD +#ifndef _WRAPTHREAD_ +#ifndef _RL_WTHREAD_H_ +typedef unsigned long int pthread_t; + +/* Attributes for threads */ +struct __sched_param +{ + int sched_priority; +}; + +typedef struct +{ + int __detachstate; + int __schedpolicy; + struct __sched_param __schedparam; + int __inheritsched; + int __scope; + size_t __guardsize; + int __stackaddr_set; + void *__stackaddr; + size_t __stacksize; +}pthread_attr_t; + +typedef HANDLE pthread_mutex_t; +//old typedef CRITICAL_SECTION pthread_mutex_t; +typedef long pthread_mutexattr_t; +#endif +#endif + +#else /* VMS or UNIX or new GCC on Windows*/ +#ifndef WIN_PTHREADS_H +#include +#endif +#endif /* end of MSWINDOWS */ + +#ifndef _WRAPTHREAD_ +#ifndef _RL_WTHREAD_H_ +typedef struct +{ +#ifdef PVWIN32THREAD + int cmax; + HANDLE hSemaphore; +#else + int cmax; + int nready; + pthread_mutex_t mutex; + pthread_cond_t cond; +#endif +}WSEMAPHORE; +#endif +#endif + +/* function prototypes */ +#ifndef __VMS +#ifdef __cplusplus +extern "C" { +#endif +#endif +int pvthread_attr_init(pthread_attr_t *attr); +int pvthread_create(pthread_t *tid, const pthread_attr_t *attr, + void *(*func)(void*), void *arg); +void pvthread_close_handle(pthread_t *tid); +void pvthread_exit(void *status); +int pvthread_join(pthread_t tid, void **status); +int pvthread_mutex_init(pthread_mutex_t *mptr, const pthread_mutexattr_t *attr); +int pvthread_mutex_destroy(pthread_mutex_t *mptr); +int pvthread_mutex_lock(pthread_mutex_t *mptr); +int pvthread_mutex_trylock(pthread_mutex_t *mptr); +int pvthread_mutex_unlock(pthread_mutex_t *mptr); +int pvthread_cancel(pthread_t tid); +int pvinit_semaphore(WSEMAPHORE *s, int cmax); +int pvincrement_semaphore(WSEMAPHORE *s); +int pvwait_semaphore(WSEMAPHORE *s); +int pvthread_sleep(long msec); +#ifndef __VMS +#ifdef __cplusplus +}; +#endif +#endif + +#endif diff --git a/libs/pvb/include/rllib/CIFUSER.H b/libs/pvb/include/rllib/CIFUSER.H new file mode 100644 index 0000000..8e87621 --- /dev/null +++ b/libs/pvb/include/rllib/CIFUSER.H @@ -0,0 +1,838 @@ +/* ******************************************************************* + + FILENAME : CIFUSER.H + + ------------------------------------------------------------------------- + CREATETED : R. Mayer, Hilscher GmbH + DATE : 28.11.95 + PROJEKT : CIF device driver + ========================================================================= + + DISCRIPTION + + User interface definition. + + * + * Filename: + * $Workfile: CIFUSER.H $ $Revision: 21 $ + * Last Modification: + * $Author: Sebastian $ + * $Modtime: 6.04.04 11:52 $ + * + * Targets: + * Win32/ANSI : yes + * Win32/Unicode: yes + * WinCE : yes + * + ========================================================================= + + CHANGES + + version name date description + ------------------------------------------------------------------------- + V1.300 MY 26.01.04 - Review + - changes from Harald + BOARD_INFO and BOARD_INFOEX included + - include "windows.h" removed + + V1.202 MY 10.12.00 - CIF100 Rev.5 changes included + + V1.201 MY 10.12.00 - Parameter definition of DevDMADown changed + + V1.200 MY 15.03.00 - New CIF100 definitions included + + V1.100 MY 19.09.99 - Function for performance test included + + V1.023 MY 06.09.01 - Error number for configuration check + + V1.022 MY 23.04.01 - Error number extended and + DMA driver errors included + - CIF 100 specific definitions included + - Definition for CIF_TKIT included + + V1.021 MY 23.08.99 - Definition against multiple inclusion + added + + V1.020 MY 22.03.99 - New Function DevDownload included + - Definitions for download modes included + + V1.011 MY 20.02.98 - SPC_CONTROL_SET/CLEAR included + + V1.010 MY 28.10.97 - Modes in DevExchangeIOErr changed from + 0,1,2 to 2,3,4 + + V1.009 MY 16.09.97 - MS-C++ support include (#ifdef _cplusplus) + - DevPutMessage(), pvData renamed into + ptMessage + - Function: DevReadWriteRAW() + DevExchangeIOEx() + DevExchangeIOErr() included. + - MSG.data in MSG_STRUCT reduced to + 255 Byte, which is the max. data length. + - New reset definition BOOTSTART included, + to save parameters on CIF40 + - PcWatchDog into HostWatchDog renamed + - Error numbers -6, -26, -27 included + - Reset mode BOOTSTART included + - New handshake and definitions for + state field transfer included + + V1.008 MY 05.06.97 - GETMESSAGECMD, size of message included, + to prevent overwriting of user buffer + + V1.007 MY 05.06.97 - static definition of the + IOSEND and IORECEIVE data area removed + - BOARD_INFOEX structure and function + DevGetBoardInfoEx included + + V1.006 MY 25.04.97 - function DevGetExtendedInfo included + + V1.005 MY 30.11.96 - function DevExtendedData, DevGetMBXData + included + - error -25 included + + V1.004 MY 18.06.96 - IO function IOCTLREADSEND + included + + V1.003 MY 25.04.96 - IO function IOCTLEXIO + IOGETPARAM + IOSETHOST + included + + V1.002 MY 28.02.96 - function DevGetMBXState included + - Variable name MSG_STRUC.daten + changed into data + + V1.001 MY 31.01.96 - user interface changed + + V1.000 MY + + + ******************************************************************** */ + +/* prevent multiple inclusion */ +#ifndef __CIFUSER_H +#define __CIFUSER_H + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + + +#ifdef __cplusplus + extern "C" { +#endif /* _cplusplus */ + +/* ------------------------------------------------------------------------------------ */ +/* global definitions */ +/* ------------------------------------------------------------------------------------ */ + +#define MAX_DEV_BOARDS 4 /* maximum numbers of boards */ + +/* ------------------------------------------------------------------------------------ */ +/* driver errors */ +/* ------------------------------------------------------------------------------------ */ + +#define DRV_NO_ERROR 0 /* no error */ +#define DRV_BOARD_NOT_INITIALIZED -1 /* DRIVER Board not initialized */ +#define DRV_INIT_STATE_ERROR -2 /* DRIVER Error in internal init state */ +#define DRV_READ_STATE_ERROR -3 /* DRIVER Error in internal read state */ +#define DRV_CMD_ACTIVE -4 /* DRIVER Command on this channel is active */ +#define DRV_PARAMETER_UNKNOWN -5 /* DRIVER Unknown parameter in function occured */ +#define DRV_WRONG_DRIVER_VERSION -6 /* DRIVER Version is incompatible with DLL */ + +#define DRV_PCI_SET_CONFIG_MODE -7 /* DRIVER Error during PCI set run mode */ +#define DRV_PCI_READ_DPM_LENGTH -8 /* DRIVER Could not read PCI dual port memory length */ +#define DRV_PCI_SET_RUN_MODE -9 /* DRIVER Error during PCI set run mode */ + +#define DRV_DEV_DPM_ACCESS_ERROR -10 /* DEVICE Dual port ram not accessable(board not found)*/ +#define DRV_DEV_NOT_READY -11 /* DEVICE Not ready (ready flag failed) */ +#define DRV_DEV_NOT_RUNNING -12 /* DEVICE Not running (running flag failed) */ +#define DRV_DEV_WATCHDOG_FAILED -13 /* DEVICE Watchdog test failed */ +#define DRV_DEV_OS_VERSION_ERROR -14 /* DEVICE Signals wrong OS version */ +#define DRV_DEV_SYSERR -15 /* DEVICE Error in dual port flags */ +#define DRV_DEV_MAILBOX_FULL -16 /* DEVICE Send mailbox is full */ +#define DRV_DEV_PUT_TIMEOUT -17 /* DEVICE PutMessage timeout */ +#define DRV_DEV_GET_TIMEOUT -18 /* DEVICE GetMessage timeout */ +#define DRV_DEV_GET_NO_MESSAGE -19 /* DEVICE No message available */ +#define DRV_DEV_RESET_TIMEOUT -20 /* DEVICE RESET command timeout */ +#define DRV_DEV_NO_COM_FLAG -21 /* DEVICE COM-flag not set */ +#define DRV_DEV_EXCHANGE_FAILED -22 /* DEVICE IO data exchange failed */ +#define DRV_DEV_EXCHANGE_TIMEOUT -23 /* DEVICE IO data exchange timeout */ +#define DRV_DEV_COM_MODE_UNKNOWN -24 /* DEVICE IO data mode unknown */ +#define DRV_DEV_FUNCTION_FAILED -25 /* DEVICE Function call failed */ +#define DRV_DEV_DPMSIZE_MISMATCH -26 /* DEVICE DPM size differs from configuration */ +#define DRV_DEV_STATE_MODE_UNKNOWN -27 /* DEVICE State mode unknown */ +#define DRV_DEV_HW_PORT_IS_USED -28 /* DEVICE Output port already in use */ + +/* Error from Interface functions */ +#define DRV_USR_OPEN_ERROR -30 /* USER Driver not opened (device driver not loaded) */ +#define DRV_USR_INIT_DRV_ERROR -31 /* USER Can't connect with device */ +#define DRV_USR_NOT_INITIALIZED -32 /* USER Board not initialized (DevInitBoard not called)*/ +#define DRV_USR_COMM_ERR -33 /* USER IOCTRL function failed */ +#define DRV_USR_DEV_NUMBER_INVALID -34 /* USER Parameter DeviceNumber invalid */ +#define DRV_USR_INFO_AREA_INVALID -35 /* USER Parameter InfoArea unknown */ +#define DRV_USR_NUMBER_INVALID -36 /* USER Parameter Number invalid */ +#define DRV_USR_MODE_INVALID -37 /* USER Parameter Mode invalid */ +#define DRV_USR_MSG_BUF_NULL_PTR -38 /* USER NULL pointer assignment */ +#define DRV_USR_MSG_BUF_TOO_SHORT -39 /* USER Message buffer too short */ +#define DRV_USR_SIZE_INVALID -40 /* USER Parameter Size invalid */ +#define DRV_USR_SIZE_ZERO -42 /* USER Parameter Size with zero length */ +#define DRV_USR_SIZE_TOO_LONG -43 /* USER Parameter Size too long */ +#define DRV_USR_DEV_PTR_NULL -44 /* USER Device address null pointer */ +#define DRV_USR_BUF_PTR_NULL -45 /* USER Pointer to buffer is a null pointer */ + +#define DRV_USR_SENDSIZE_TOO_LONG -46 /* USER SendSize parameter too long */ +#define DRV_USR_RECVSIZE_TOO_LONG -47 /* USER ReceiveSize parameter too long */ +#define DRV_USR_SENDBUF_PTR_NULL -48 /* USER Pointer to buffer is a null pointer */ +#define DRV_USR_RECVBUF_PTR_NULL -49 /* USER Pointer to buffer is a null pointer */ + +#define DRV_DMA_INSUFF_MEM -50 /* DMA Memory allocation error */ +#define DRV_DMA_TIMEOUT_CH4 -51 /* DMA Read I/O timeout */ +#define DRV_DMA_TIMEOUT_CH5 -52 /* DMA Write I/O timeout */ +#define DRV_DMA_TIMEOUT_CH6 -53 /* DMA PCI transfer timeout */ +#define DRV_DMA_TIMEOUT_CH7 -54 /* DMA Download timeout */ + +#define DRV_DMA_DB_DOWN_FAIL -55 /* DMA Database download failed */ +#define DRV_DMA_FW_DOWN_FAIL -56 /* DMA Firmware download failed */ +#define DRV_CLEAR_DB_FAIL -57 /* DMA Clear database on the device failed */ + +#define DRV_DEV_NO_VIRTUAL_MEM -60 /* USER Virtual memory not available */ +#define DRV_DEV_UNMAP_VIRTUAL_MEM -61 /* USER Unmap virtual memory failed */ + +#define DRV_GENERAL_ERROR -70 /* DRIVER General error */ +#define DRV_DMA_ERROR -71 /* DRIVER General DMA error */ +#define DRV_WDG_IO_ERROR -74 /* DRIVER I/O WatchDog failed */ +#define DRV_WDG_DEV_ERROR -75 /* DRIVER Device WatchDog failed */ + +#define DRV_USR_DRIVER_UNKNOWN -80 /* USER driver unknown */ +#define DRV_USR_DEVICE_NAME_INVALID -81 /* USER device name invalid */ +#define DRV_USR_DEVICE_NAME_UKNOWN -82 /* USER device name unknown */ +#define DRV_USR_DEVICE_FUNC_NOTIMPL -83 /* USER device function not implemented */ + +#define DRV_USR_FILE_OPEN_FAILED -100 /* USER File not opened */ +#define DRV_USR_FILE_SIZE_ZERO -101 /* USER File size zero */ +#define DRV_USR_FILE_NO_MEMORY -102 /* USER Not enough memory to load file */ +#define DRV_USR_FILE_READ_FAILED -103 /* USER File read failed */ +#define DRV_USR_INVALID_FILETYPE -104 /* USER File type invalid */ +#define DRV_USR_FILENAME_INVALID -105 /* USER File name not valid */ + +#define DRV_FW_FILE_OPEN_FAILED -110 /* USER Firmware file not opened */ +#define DRV_FW_FILE_SIZE_ZERO -111 /* USER Firmware file size zero */ +#define DRV_FW_FILE_NO_MEMORY -112 /* USER Not enough memory to load firmware file */ +#define DRV_FW_FILE_READ_FAILED -113 /* USER Firmware file read failed */ +#define DRV_FW_INVALID_FILETYPE -114 /* USER Firmware file type invalid */ +#define DRV_FW_FILENAME_INVALID -115 /* USER Firmware file name not valid */ +#define DRV_FW_DOWNLOAD_ERROR -116 /* USER Firmware file download error */ +#define DRV_FW_FILENAME_NOT_FOUND -117 /* USER Firmware file not found in the internal table */ +#define DRV_FW_BOOTLOADER_ACTIVE -118 /* USER Firmware file BOOTLOADER active */ +#define DRV_FW_NO_FILE_PATH -119 /* USER Firmware file no file path */ + +#define DRV_CF_FILE_OPEN_FAILED -120 /* USER Configuration file not opend */ +#define DRV_CF_FILE_SIZE_ZERO -121 /* USER Configuration file size zero */ +#define DRV_CF_FILE_NO_MEMORY -122 /* USER Not enough memory to load configuration file */ +#define DRV_CF_FILE_READ_FAILED -123 /* USER Configuration file read failed */ +#define DRV_CF_INVALID_FILETYPE -124 /* USER Configuration file type invalid */ +#define DRV_CF_FILENAME_INVALID -125 /* USER Configuration file name not valid */ +#define DRV_CF_DOWNLOAD_ERROR -126 /* USER Configuration file download error */ +#define DRV_CF_FILE_NO_SEGMENT -127 /* USER No flash segment in the configuration file */ +#define DRV_CF_DIFFERS_FROM_DBM -128 /* USER Configuration file differs from database */ + +#define DRV_DBM_SIZE_ZERO -131 /* USER Database size zero */ +#define DRV_DBM_NO_MEMORY -132 /* USER Not enough memory to upload database */ +#define DRV_DBM_READ_FAILED -133 /* USER Database read failed */ +#define DRV_DBM_NO_FLASH_SEGMENT -136 /* USER Database segment unknown */ + +#define DEV_CF_INVALID_DESCRIPT_VERSION -150/* CONFIG Version of the descript table invalid */ +#define DEV_CF_INVALID_INPUT_OFFSET -151/* CONFIG Input offset is invalid */ +#define DEV_CF_NO_INPUT_SIZE -152/* CONFIG Input size is 0 */ +#define DEV_CF_MISMATCH_INPUT_SIZE -153/* CONFIG Input size does not match configuration */ +#define DEV_CF_INVALID_OUTPUT_OFFSET -154/* CONFIG Invalid output offset */ +#define DEV_CF_NO_OUTPUT_SIZE -155/* CONFIG Output size is 0 */ +#define DEV_CF_MISMATCH_OUTPUT_SIZE -156/* CONFIG Output size does not match configuration */ +#define DEV_CF_STN_NOT_CONFIGURED -157/* CONFIG Station not configured */ +#define DEV_CF_CANNOT_GET_STN_CONFIG -158/* CONFIG Cannot get the Station configuration */ +#define DEV_CF_MODULE_DEF_MISSING -159/* CONFIG Module definition is missing */ +#define DEV_CF_MISMATCH_EMPTY_SLOT -160/* CONFIG Empty slot mismatch */ +#define DEV_CF_MISMATCH_INPUT_OFFSET -161/* CONFIG Input offset mismatch */ +#define DEV_CF_MISMATCH_OUTPUT_OFFSET -162/* CONFIG Output offset mismatch */ +#define DEV_CF_MISMATCH_DATA_TYPE -163/* CONFIG Data type mismatch */ +#define DEV_CF_MODULE_DEF_MISSING_NO_SI -164/* CONFIG Module definition is missing,(no Slot/Idx) */ + +#define DRV_RCS_ERROR_OFFSET 1000 /* RCS error number start */ + +/* ------------------------------------------------------------------------------------ */ +/* message definition */ +/* ------------------------------------------------------------------------------------ */ + +#pragma pack(1) + +/* max. length is 288 Bytes, max message length is 255 + 8 Bytes */ +typedef struct tagMSG_STRUC { + unsigned char rx; + unsigned char tx; + unsigned char ln; + unsigned char nr; + unsigned char a; + unsigned char f; + unsigned char b; + unsigned char e; + unsigned char data[255]; + unsigned char dummy[25]; /* for compatibility with older definitions (288 Bytes) */ +} MSG_STRUC; + +#pragma pack() + +/* ------------------------------------------------------------------------------------ */ +/* INFO structure definitions */ +/* ------------------------------------------------------------------------------------ */ + +#pragma pack(1) + +/* DEVRESET */ + +#define COLDSTART 2 +#define WARMSTART 3 +#define BOOTSTART 4 + +/* DEVMBXINFO */ + +#define DEVICE_MBX_EMPTY 0 +#define DEVICE_MBX_FULL 1 +#define HOST_MBX_EMPTY 0 +#define HOST_MBX_FULL 1 + +/* TRIGGERWATCHDOG */ + +#define WATCHDOG_STOP 0 +#define WATCHDOG_START 1 + +/* GETINFO InfoArea definitions */ + +#define GET_DRIVER_INFO 1 +#define GET_VERSION_INFO 2 +#define GET_FIRMWARE_INFO 3 +#define GET_TASK_INFO 4 +#define GET_RCS_INFO 5 +#define GET_DEV_INFO 6 +#define GET_IO_INFO 7 +#define GET_IO_SEND_DATA 8 +#define GET_CIF_PLC_DRIVER_INFO 10 + +/* HOST mode definition */ + +#define HOST_NOT_READY 0 +#define HOST_READY 1 + +/* DEVREADWRITERAW / DEVREADWRITEDPMDATA */ + +#define PARAMETER_READ 1 +#define PARAMETER_WRITE 2 + +/* STATE definition */ + +#define STATE_ERR_NON 0 +#define STATE_ERR 1 + +#define STATE_MODE_2 2 +#define STATE_MODE_3 3 +#define STATE_MODE_4 4 + +/* DEVSPECIALCONTROL */ + +#define SPECIAL_CONTROL_CLEAR 0 +#define SPECIAL_CONTROL_SET 1 + +/* DEVDOWNLOAD */ + +#define FIRMWARE_DOWNLOAD 1 +#define CONFIGURATION_DOWNLOAD 2 + +// DEVHWIOPORT +#define HW_PORT_SET_OUTPUT 1 +#define HW_PORT_CLEAR_OUTPUT 2 +#define HW_PORT_READ_INPUT 3 + +/* DEVMEMORYPTR */ +#define MEMORY_PTR_CREATE 1 +#define MEMORY_PTR_RELEASE 2 + + +/* ------------------------------------------------------------------------------------ */ +/* INFO structure definitions */ +/* ------------------------------------------------------------------------------------ */ +/* Device exchange IO information */ +typedef struct tagIOINFO { + unsigned char bComBit; /* Actual state of the COM bit */ + unsigned char bIOExchangeMode; /* Actual data exchange mode (0..5) */ + unsigned long ulIOExchangeCnt; /* Exchange IO counter */ +} IOINFO; + +/* Device version information */ +typedef struct tagVERSIONINFO { /* Device serial number and OS versions */ + unsigned long ulDate; + unsigned long ulDeviceNo; + unsigned long ulSerialNo; + unsigned long ulReserved; + unsigned char abPcOsName0[4]; + unsigned char abPcOsName1[4]; + unsigned char abPcOsName2[4]; + unsigned char abOemIdentifier[4]; +} VERSIONINFO; + +/* Device firmware information */ +typedef struct tagFIRMWAREINFO { + unsigned char abFirmwareName[16]; /* Firmware name */ + unsigned char abFirmwareVersion[16]; /* Firmware version */ +} FIRMWAREINFO; + +/* Device task state information */ +typedef struct tagTASKSTATE { + unsigned char abTaskState[64]; /* Task state field */ +} TASKSTATE; + +/* Device task paramater data */ +typedef struct tagTASKPARAM { + unsigned char abTaskParameter[64]; /* Task parameter field */ +} TASKPARAM; + +/* Device raw data structure */ +typedef struct tagRAWDATA { + unsigned char abRawData[1022]; /* Definition of the last kByte */ +} RAWDATA; + +/* Device task information */ +typedef struct tagTASKINFO { + struct { + unsigned char abTaskName[8]; /* Task name */ + unsigned short usTaskVersion; /* Task version */ + unsigned char bTaskCondition; /* Actual task condition */ + unsigned char abreserved[5]; /* n.c. */ + } tTaskInfo [7]; +} TASKINFO; + +/* Device operating system (RCS) information */ +typedef struct tagRCSINFO { + unsigned short usRcsVersion; /* Device operating system (RCS) version */ + unsigned char bRcsError; /* Operating system errors */ + unsigned char bHostWatchDog; /* Host watchdog value */ + unsigned char bDevWatchDog; /* Device watchdog value */ + unsigned char bSegmentCount; /* RCS segment free counter */ + unsigned char bDeviceAdress; /* RCS device base address */ + unsigned char bDriverType; /* RCS driver type */ +} RCSINFO; + +/* Device description */ +typedef struct tagDEVINFO { + unsigned char bDpmSize; /* Device dpm size (2,8...) */ + unsigned char bDevType; /* Device type (manufactor code) */ + unsigned char bDevModel; /* Device model (manufactor code) */ + unsigned char abDevIdentifier[3]; /* Device identification characters */ +} DEVINFO; + +#pragma pack() + +/* ------------------------------------------------------------------------------------ */ +/* driver info structure definitions */ +/* ------------------------------------------------------------------------------------ */ + +#pragma pack(1) + +/* Board information structure */ +typedef struct tagBOARD { + unsigned short usBoardNumber; /* DRV board number */ + unsigned short usAvailable; /* DRV board is available */ + unsigned long ulPhysicalAddress; /* DRV physical DPM address */ + unsigned short usIrqNumber; /* DRV irq number */ +} BOARD; +typedef struct tagBOARD_INFO{ + unsigned char abDriverVersion[16]; /* DRV driver information string */ + BOARD tBoard [MAX_DEV_BOARDS]; +} BOARD_INFO; + +/* Internal driver state information structure */ +typedef struct tagDRIVERINFO{ + unsigned long ulOpenCnt; /* DevOpen() counter */ + unsigned long ulCloseCnt; /* DevClose() counter */ + unsigned long ulReadCnt; /* Number of DevGetMessage commands */ + unsigned long ulWriteCnt; /* Number of DevPutMessage commands */ + unsigned long ulIRQCnt; /* Number of board interrupts */ + unsigned char bInitMsgFlag; /* Actual init sate */ + unsigned char bReadMsgFlag; /* Actual read mailbox state */ + unsigned char bWriteMsgFlag; /* Actual write mailbox state */ + unsigned char bLastFunction; /* Last driver function */ + unsigned char bWriteState; /* Actual write command state */ + unsigned char bReadState; /* Actual read command state */ + unsigned char bHostFlags; /* Actual host flags */ + unsigned char bMyDevFlags; /* Actual device falgs */ + unsigned char bExIOFlag; /* Actual IO flags */ + unsigned long ulExIOCnt; /* DevExchangeIO() counter */ +} DRIVERINFO; + +/* Extended board information structure */# +typedef struct tagBOARD_EX { + unsigned short usBoardNumber; /* DRV board number */ + unsigned short usAvailable; /* DRV board is available */ + unsigned long ulPhysicalAddress; /* DRV physical DPM address */ + unsigned short usIrqNumber; /* DRV irq number */ + DRIVERINFO tDriverInfo; /* Driver information */ + FIRMWAREINFO tFirmware; + DEVINFO tDeviceInfo; + RCSINFO tRcsInfo; + VERSIONINFO tVersion; +} BOARD_EX; + +typedef struct tagBOARD_INFOEX{ + unsigned char abDriverVersion[16]; /* DRV driver information string */ + BOARD_EX tBoard [MAX_DEV_BOARDS]; +} BOARD_INFOEX; + +/* Communication state field structure */ +typedef struct tagCOMSTATE { + unsigned short usMode; /* Actual STATE mode */ + unsigned short usStateFlag; /* State flag */ + unsigned char abState[64]; /* State area */ +} COMSTATE; + +/* State information in bLastFunction */ +#define FKT_OPEN 1 +#define FKT_CLOSE 2 +#define FKT_READ 3 +#define FKT_WRITE 4 +#define FKT_IO 5 +/* State information in bWriteState and bReadState */ +#define STATE_IN 0x01 +#define STATE_WAIT 0x02 +#define STATE_OUT 0x03 +#define STATE_IN_IRQ 0x04 + +#pragma pack() + +/* ------------------------------------------------------------------------------------ */ +/* CIF100 special function definitions */ +/* ------------------------------------------------------------------------------------ */ +#pragma pack(1) + +/*--------------------------*/ +/* Device DMA download */ +/*--------------------------*/ +#define DEV_DMA_DOWN_FW 1 +#define DEV_DMA_DOWN_DB 2 + +/*--------------------------*/ +/* Device BACKUP RAM */ +/*--------------------------*/ +#define DEV_BACKUP_RAM_READ 1 +#define DEV_BACKUP_RAM_WRITE 2 + +/*--------------------------*/ +/* Device Timer */ +/*--------------------------*/ +#define DEV_TIMER_CTRL_START 1 +#define DEV_TIMER_CTRL_STOP 2 +#define DEV_TIMER_MODE_NORMAL 1 +#define DEV_TIMER_MODE_NMI 2 +#define DEV_TIMER_RESOLUTION_100US 0 +#define DEV_TIMER_RESOLUTION_1MS 1 + +/*----------------------------*/ +/* PLC information structure */ +/*----------------------------*/ +typedef struct tagCIF_PLC_DRIVER_INFO { + char *pbInput; + unsigned long ulInputSize; + char *pbOutput; + unsigned long ulOutputSize; + TASKSTATE *ptTaskState; /* Take this pointer and cast it to the protocol spez. structure */ + unsigned long ulNVRAMSize; + char *pbNVRAM; +} CIF_PLC_DRIVER_INFO; + +#ifndef CIF_TKIT + #ifndef NT_FUNCTIONS_INCLUDED + #define LARGE_INTEGER int + #endif + /*--------------------------*/ + /* Performance test */ + /*--------------------------*/ + #define PERFORMANCE_START 1 + #define PERFORMANCE_GETDATA 2 + #define PERFORMANCE_STOP 3 + #define PERFORMANCE_NETWORK 4 + + typedef struct tagPERFORMANCE_DATA { + unsigned short usDevNumber; /* IN Board number */ + unsigned short usMeasurementMode; /* IN READ-WRITE-ONCE-CYCLIC */ + + unsigned char fActive; /* Performence measurement activ */ + unsigned char fNetwork; /* IN inclusive/exclusive Network */ + unsigned char bSendValue; /* IN value for performence test */ + unsigned long dwRecvLen; /* IN receive size for interrupt */ + + LARGE_INTEGER ilLIfreq; /* OUT Timer frequency */ + + LARGE_INTEGER ilTickStartW; /* OUT WriteSTART */ + LARGE_INTEGER ilTickEndW; /* OUT WriteEND */ + + LARGE_INTEGER ilTickStartR; /* OUT ReadSTART */ + LARGE_INTEGER ilTickEndR; /* OUT ReadEND */ + + LARGE_INTEGER ilTickStartCycle; + LARGE_INTEGER ilTickEndCycle; + + LARGE_INTEGER ilCycleTime; + LARGE_INTEGER ilTransferTime; + } PERFORMANCE_DATA_PVB; // appended _PVB because original name lead to name conflict on win32 + + /*--------------------------*/ + /* Device RAM test test */ + /*--------------------------*/ + #define DEVRAMTEST_START 1 + #define DEVRAMTEST_DOIT 2 + #define DEVRAMTEST_RESULT 3 + #define DEVRAMTEST_STOP 4 + + typedef struct tagDEV_RAM_TEST { + unsigned short usBoard; /* IN Board number */ + unsigned short usMode; /* IN start, test, result, stop */ + + unsigned char fActive; /* DMA RAM test active */ + unsigned char fWrite; /* Function writing */ + unsigned char fRead; /* Function reading */ + unsigned long dwDevStartAd; + unsigned long dwDataLen; + unsigned char ucPattern; + unsigned long dwCycleCnt; + unsigned long dwDMAerrCnt_W; /* DMA error count writing */ + unsigned long dwDMAerrCnt_R; /* DMA error count reading */ + unsigned long dwDATAerrCnt; + } DEV_RAM_TEST; + + /*--------------------------*/ + /* Logfile */ + /*--------------------------*/ + #define LOGFILE_HEAD 1 + #define LOGFILE_REPORT 2 + #define LOGFILE_ERROR 4 + #define LOGFILE_DATA_MSG 8 + + #define LOGFILE_DATA_LENGTH 300 + typedef struct tagDEV_LOGFILE_DATA { + unsigned char bSeparator; /* Seperator */ + unsigned char bIdent; /* Identification */ + unsigned long ulLength; /* Data length */ + LARGE_INTEGER ilSystemTime; /* Time stamp */ + unsigned short usBoardNumber; /* Board number */ + long lErrorNumber; /* Error number */ + unsigned char abData[LOGFILE_DATA_LENGTH]; /* Data */ + } DEV_LOGFILE_DATA; +#endif /* !Toolkit definition */ + +#pragma pack() + +/* ------------------------------------------------------------------------------------ */ +/* Configuration file definition */ +/* ------------------------------------------------------------------------------------ */ +/* Descript tabel version definition */ +#define RECORD_TYPE_LESS_THEN_2300 0x01 +#define RECORD_TYPE_EQUAL_HIGHER_2300 0x02 + +/* ------------------------------------------------------------------------------------ */ +/* Function prototypes */ +/* ------------------------------------------------------------------------------------ */ +#ifndef CIF_TKIT + short APIENTRY DevOpenDriver ( unsigned short usDevNumber); + + short APIENTRY DevCloseDriver ( unsigned short usDevNumber); + + short APIENTRY DevGetBoardInfo ( unsigned short usDevNumber, + unsigned short usSize, + void *pvData); + + short APIENTRY DevInitBoard ( unsigned short usDevNumber, + void *pDevAddress); + + short APIENTRY DevExitBoard ( unsigned short usDevNumber); + + short APIENTRY DevPutTaskParameter ( unsigned short usDevNumber, + unsigned short usNumber, + unsigned short usSize, + void *pvData); + + short APIENTRY DevReset ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long ulTimeout); + + short APIENTRY DevPutMessage ( unsigned short usDevNumber, + MSG_STRUC *ptMessage, + unsigned long ulTimeout); + + short APIENTRY DevGetMessage ( unsigned short usDevNumber, + unsigned short usSize, + MSG_STRUC *ptMessage, + unsigned long ulTimeout); + + short APIENTRY DevGetTaskState ( unsigned short usDevNumber, + unsigned short usNumber, + unsigned short usSize, + void *pvData); + + short APIENTRY DevGetMBXState ( unsigned short usDevNumber, + unsigned short *pusDevMBXState, + unsigned short *pusHostMBXState); + + short APIENTRY DevTriggerWatchDog ( unsigned short usDevNumber, + unsigned short usFunction, + unsigned short *usDevWatchDog); + + short APIENTRY DevGetInfo ( unsigned short usDevNumber, + unsigned short usFunction, + unsigned short usSize, + void *pvData); + + short APIENTRY DevGetTaskParameter ( unsigned short usDevNumber, + unsigned short usNumber, + unsigned short usSize, + void *pvData); + + short APIENTRY DevExchangeIO ( unsigned short usDevNumber, + unsigned short usSendOffset, + unsigned short usSendSize, + void *pvSendData, + unsigned short usReceiveOffset, + unsigned short usReceiveSize, + void *pvReceiveData, + unsigned long ulTimeout); + + short APIENTRY DevReadSendData ( unsigned short usDevNumber, + unsigned short usOffset, + unsigned short usSize, + void *pvData); + + short APIENTRY DevSetHostState ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long ulTimeout); + + short APIENTRY DevExtendedData ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usSize, + void *pvData); + + short APIENTRY DevGetMBXData ( unsigned short usDevNumber, + unsigned short usHostSize, + void *pvHostData, + unsigned short usDevSize, + void *pvDevData); + + short APIENTRY DevGetBoardInfoEx ( unsigned short usDevNumber, + unsigned short usSize, + void *pvData); + + short APIENTRY DevExchangeIOEx ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usSendOffset, + unsigned short usSendSize, + void *pvSendData, + unsigned short usReceiveOffset, + unsigned short usReceiveSize, + void *pvReceiveData, + unsigned long ulTimeout); + + short APIENTRY DevExchangeIOErr ( unsigned short usDevNumber, + unsigned short usSendOffset, + unsigned short usSendSize, + void *pvSendData, + unsigned short usReceiveOffset, + unsigned short usReceiveSize, + void *pvReceiveData, + COMSTATE *ptState, + unsigned long ulTimeout); + + short APIENTRY DevReadWriteDPMRaw ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usOffset, + unsigned short usSize, + void *pvData); + + short APIENTRY DevSpecialControl ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short *pusCtrlAck); + + short APIENTRY DevDownload ( unsigned short usDevNumber, + unsigned short usMode, + unsigned char *pszFileName, + DWORD *pdwBytes); + + short APIENTRY DevReadWriteDPMData ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usOffset, + unsigned short usSize, + void *pvData); + + /*-------------------*/ + /* Special functions */ + /*-------------------*/ + short APIENTRY DevGetDPMPtr ( unsigned short usMode, + unsigned short usDevNumber, + void *pvUserData, + unsigned long *pulDPMSize, + unsigned char **pDPMBase, + long *plError); + + /*---------------------------*/ + /* CIF100 spezific functions */ + /*---------------------------*/ + short APIENTRY DevPerformance ( void *ptData); + short APIENTRY DevRAMTest ( void *ptData); + + short APIENTRY DevTimer ( unsigned short usDevNumber, + unsigned short usControl, + unsigned short usMode, + unsigned short usResolution, + char bTickCount); + + short APIENTRY DevBackupRAM ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long ulOffset, + unsigned long ulSize, + void *pvData); + + short APIENTRY DevRAMrw ( unsigned short usDevNumber, + unsigned long ulDevStartAdd, + unsigned short usDataLen, + void *pvSendData, + void *pvReceiveData, + unsigned long ulTimeout); + + short APIENTRY DevDMAdown ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long ulTimeout); + + short APIENTRY DevClearConfig ( unsigned short usDevNumber); + + short APIENTRY DevIsPLCDataReady ( unsigned short usDevNumber, + unsigned short *pusState); + + short APIENTRY DevExchangePLCData ( unsigned short usDevNumber, + unsigned short usSendSize, + unsigned short usReceiveSize, + unsigned long ulTimeout); + + short APIENTRY DevHWPortControl ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short *pusState); + + short APIENTRY DevMemoryPtr ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long usSize, + CIF_PLC_DRIVER_INFO *ptPLCData); + + +#endif /* !Toolkit definition */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CIFUSER_H */ + diff --git a/libs/pvb/include/rllib/asc_user.h b/libs/pvb/include/rllib/asc_user.h new file mode 100644 index 0000000..4b857bf --- /dev/null +++ b/libs/pvb/include/rllib/asc_user.h @@ -0,0 +1,133 @@ +/* ******************************************************************* + + FILENAME : ASC_USER.H + + ------------------------------------------------------------------------- + CREATED BY : R. Mayer, Hilscher GmbH + CREATED AT : 29.05.96 + PROJECT : ASC + ========================================================================= + + FUNCTION : + User interface ASCII protocol + + ========================================================================= + + CHANGES OF REVISIONS : + + Version Name Date Change + ------------------------------------------------------------------------- + + V1.000 Mayer 29.05.96 Created + + ******************************************************************** */ + +#if defined( _MSC_VER) /* Microsoft C */ + #pragma pack(1) /* Byte Alignment */ +#endif + +/* ======================================================================== */ +/* Protocol definition */ +/* ======================================================================== */ + +/* Mode */ + +#define ASC_MODE_SLAVE 0 +#define ASC_MODE_MASTER 1 + +/* Stop mode */ + +#define ASC_ENDMODE_TIMEOUT 0 /* Timeout */ +#define ASC_ENDMODE_ID 1 /* Identifier */ +#define ASC_ENDMODE_QUITT 2 /* Acknowledg telegram */ +#define ASC_ENDMODE_ID_QUITT 3 /* Identifier / Acknowledg telegram */ +#define ASC_ENDMODE_NUMBER 4 /* Character number */ +#define ASC_ENDMODE_DEFNUMBER 5 /* Predefined character number */ + +/* Checksum */ + +#define ASC_CHKSUM_NONE 0 +#define ASC_CHKSUM_BIN7 1 +#define ASC_CHKSUM_BIN8 2 +#define ASC_CHKSUM_BCC 3 +#define ASC_CHKSUM_BCC_ASCII 4 + +/* Checksum area */ + +#define ASC_CHK_AREA_DATA_ONLY 0 /* Data only */ +#define ASC_CHK_AREA_DATA_STARTID 1 /* Data with start identifier */ +#define ASC_CHK_AREA_DATA_ENDID 2 /* Data with stop identifier */ +#define ASC_CHK_AREA_FULL 3 /* Full telegram */ + +/* Filter */ + +#define ASC_FILTER_NONE 0 +#define ASC_FILTER_DOUBLE_CHAR 1 + +/* Timeouts */ + +#define ASC_TIMEOUT_NONE 0 + +/* Telegram definition */ + +#define ASC_TELEGRAM_LENGTH_ZERO 0 + +/* Telegram sequenz */ + +#define ASC_TELEGRAM_SEQUENZ_NONE 0 + + +/* ======================================================================== */ +/* Protocol parameter structure */ +/* ======================================================================== */ + +typedef struct ASC_PARAMETRtag { + unsigned char bScl; /* Communication line number */ + unsigned char bRtsControl; /* RTS control */ + unsigned char bBaudrate; /* Baudrate */ + unsigned char bDataBits; /* Number of data bits */ + unsigned char bStopBits; /* Number of stop bits */ + unsigned char bParityBit; /* Parity */ + unsigned char bMode; /* Mode */ + unsigned char bEndMode; /* End mode */ + unsigned char bCheckMode; /* Check mode */ + unsigned char bCheckArea; /* Check area */ + unsigned char bFilterMode; /* Filter mode */ + unsigned short usFilterCharacter; /* Filter characters */ + unsigned short usTelTimeout; /* Telegram timeout */ + unsigned short usStartTimeout; /* Telegram start timeout */ + unsigned short usCharTimeout; /* Charater timeout */ + unsigned char bRetries; /* Telegram retries */ + unsigned char bErrorLed; /* Mode of the error LED */ + unsigned char bTelStartLen; /* Telegram start length */ + unsigned char bTelStart[8]; /* Start telegram */ + unsigned char bTelEndLen; /* End telegram length */ + unsigned char bTelEnd[8]; /* End telegram */ + unsigned char bTelAckLen; /* ACK telegram length */ + unsigned char bTelAck[8]; /* ACK telegram */ + unsigned char bTelNackLen; /* NACK telegram length */ + unsigned char bTelNack[8]; /* NACK telegram */ + unsigned char bTelDeviceLen; /* Device telegram length */ + unsigned short usTelFollowTime;/* Telegram following time */ +} ASC_PARAMETER; + +/* ======================================================================== */ +/* Protocol task state structure */ +/* ======================================================================== */ + +typedef struct ASC_STATEtag { + unsigned char bTaskState; /* Task state */ + unsigned long ulTxCount; /* Transmitt telegram count */ + unsigned long ulRxCount; /* Receive telegram count */ + unsigned short usTxErrorCount; /* Transmitt error count */ + unsigned short usRxErrorCount; /* Receive error count */ + unsigned short usErrorBits; /* Error bits */ + unsigned char bError; /* Last error */ +} ASC_STATE; + + +#if defined( _MSC_VER) /* Microsoft C */ + #pragma pack() /* Byte Alignment */ +#endif + +/* === eof 'USER.H' === */ diff --git a/libs/pvb/include/rllib/cif_dev.h b/libs/pvb/include/rllib/cif_dev.h new file mode 100644 index 0000000..6de355e --- /dev/null +++ b/libs/pvb/include/rllib/cif_dev.h @@ -0,0 +1,234 @@ +/* ******************************************************************* + + cif_dev.h + + ------------------------------------------------------------------------- + CREATETED : D. Tsaava, Hilscher GmbH + DATE : 18.07.2000 + PROJEKT : CIF device driver + ========================================================================= + + DISCRIPTION + + Include file for CIF device driver, DPM layout . + + ========================================================================= + + CHANGES + + version name date Discription + March 2001 + Juli 2004 Redesigned for the 2.6 Kernel + Copyright changed to GNU Lesser GPL +------------------------------------------------------------------------- + + V2.601 + + NOTE: as groundwork for this header served Windows version of + the CIF device driver + + ======================== Copyright ===================================== + + Copyright (C) 2004 Hilscher GmbH + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ======================================================================== +******************************************************************** */ +#ifndef CIF_DEV_H +# define CIF_DEV_H + +#ifndef STRICT /* Check Typdefinition */ + #define STRICT +#endif + +#ifndef _GNUC_ +# define _GNUC_ +#endif /* _GNUC_ */ + +/* ---------------------------------------------------------------------------------- */ +/* DEV definitions */ +/* ---------------------------------------------------------------------------------- */ + +#define DRV_ACTIV_STATE1 2 /* DEV board is in the registery */ +#define DRV_ACTIV_STATE2 TRUE /* DEV board is tested and ready */ + +#define NUM_OF_DRV_NAMES 3 /* Number of possible driver names */ +#define DEVNAMELEN 3 /* Size of DEV name in DPM */ + +#define HW_INTERRUPT_DISABLE 0x00 +#define HW_INTERRUPT_ENABLE 0x01 + +#define BUS_TYPE_PCI 0x01 +#define BUS_TYPE_ISA 0x02 + +/* ------------------------------------------------------------------------------------ */ +/* PCI/CPCI card definitions */ +/* ------------------------------------------------------------------------------------ */ + +#define VENDOR_ID 0x10B5 /* PLX technology */ +#define SUBVENDOR_ID 0x10B5 /* PLX-PCI chip */ + +#define SUBSYSTEM_ID_1 0x1080 /* Hilscher CIF50 boards */ +#define DEVICE_ID_1 0x9050 /* PLX-PCI chip */ + +#define SUBSYSTEM_ID_2 0x2695 /* Hilscher newer CIF50 & CIF80 boards */ +#define DEVICE_ID_2 0x9030 /* PLX-PCI chip */ +/* ------------------------------------------------------------------------------------ */ + +/* Local Control Register Offsets */ +#define PCI_INTCTRLSTS_REG 0x4C + +#ifndef CIF_MAJOR +#define CIF_MAJOR 0 /* dynamic major by default */ +#endif + +#ifndef CIF_MAX_BOARDS +#define CIF_MAX_BOARDS 4 /* Board-0 through Board-3 */ +#endif + +/* ------------------------------------------------------------------------------------ */ +/* DPM structure */ +/* ------------------------------------------------------------------------------------ */ +#ifdef _GNUC_ +# ifndef PACKED +# define PACKED __attribute__((packed, aligned(1))) +# endif /* PACKED */ +#else +# define PACKED +#endif + +typedef struct tagDPM_MEMORY{ + /* DPM size is flexible, now using pointers */ + /* for addressing the send and receive area */ + MSG_STRUC tDevMbx PACKED; /* Mailbox PC --> DEV (288 Bytes)*/ + VERSIONINFO tDevVersion PACKED; /* DEV version information ( 32 Bytes)*/ + MSG_STRUC tPcMbx PACKED; /* Mailbox DEV --> PC (288 Bytes)*/ + FIRMWAREINFO tFiwInfo PACKED; /* Firmware info ( 32 Bytes)*/ + TASKPARAM tKpt1Param PACKED; /* Task 1 interface parameter ( 64 Bytes)*/ + TASKPARAM tKpt2Param PACKED; /* Task 2 interface parameter ( 64 Bytes)*/ + TASKSTATE tKpt1State PACKED; /* Task 1 state ( 64 Bytes)*/ + TASKSTATE tKpt2State PACKED; /* Task 2 state ( 64 Bytes)*/ + TASKINFO tTaskInfo PACKED; /* Task 1 to 7 info field (112 Bytes)*/ + RCSINFO tRcsInfo PACKED; /* RCS information ( 8 Bytes)*/ + DEVINFO tDevInfo PACKED; /* DEV information ( 6 Bytes)*/ + unsigned char HostFlags PACKED; /* DPM communication DEV->PC(PcFlags) ( 1 Byte )*/ + unsigned char DevFlags PACKED; /* DPM communication PC->DEV(CifFlags)( 1 Byte )*/ +} DPM_MEMORY; + +/* ------------------------------------------------------------------------------------ */ +/* DPM flag definition */ +/* ------------------------------------------------------------------------------------ */ + +// Host flags (HOST_FLAGS) written by the device +#define HOSTCOM_FLAG 0x01 +#define DEVACK_FLAG 0x02 +#define PDACK_FLAG 0x04 +#define STATECOM_FLAG 0x08 +#define SPCACK_FLAG 0x10 +#define COM_FLAG 0x20 +#define RUN_FLAG 0x40 +#define READY_FLAG 0x80 + +// Device flags (DEV_FLAGS) written by the host +#define HOSTACK_FLAG 0x01 +#define DEVCOM_FLAG 0x02 +#define PDCOM_FLAG 0x04 +#define STATEACK_FLAG 0x08 +#define SPCCOM_FLAG 0x10 +#define NOTREADY_FLAG 0x20 +#define INIT_FLAG 0x40 +#define RESET_FLAG 0x80 + +/* ------------------------------------------------------------------------------------ */ +/* driver state definitions */ +/* ------------------------------------------------------------------------------------ */ + +#define INI_MSG_WAIT 0x00 +#define INI_MSG_RUN 0x40 +#define INI_MSG_RDY 0x80 +#define INI_MSG_RDYRUN 0xC0 + +#define COM_FLAG_RDY 0x20 + +#define RESET_MSG_NON 0x00 +#define RESET_MSG_RUN 0x01 + +#define EXCHGIO_NON 0x00 +#define EXCHGIO_EQUAL 0x01 +#define EXCHGIO_NOT_EQUAL 0x02 + +#ifndef CIF_NR_DEVS +#define CIF_NR_DEVS 4 +#endif + +/* + * Split minors in two parts + */ +#define TYPE(dev) (MINOR(dev) >> 4) /* high nibble */ +#define NUM(dev) (MINOR(dev) & 0xf) /* low nibble */ +/* ------------------------------------------------------------------------------------ */ +/* DEV instance structure */ +/* ------------------------------------------------------------------------------------ */ +typedef struct tagDEV_INSTANCE { + struct tagDEV_INSTANCE *next; /* linked list of Devices, see CIF_MAX_BOARDS = 4 */ + unsigned short usBoard; // Internal board number + void * pvIntSynch; // Interrupt synchronization + unsigned char ucPCIBusNumber; // PCI bus number + unsigned char ucBusType; // PCI, ISA + unsigned long ulBoardAddress; // physical memory address + unsigned long ulDPMSize; // DPM size of the DEV + unsigned long ulDPMByteSize; // DPM size in bytes + unsigned short usBoardIrq; // Interrupt number of the DEV + unsigned short usBoardIrq_scanned; // Interrupt number of the DEV + unsigned char * IrqCtrlRegAddr; // + void * pvVirtualIrq; // Virtual Interrupt + unsigned short usRcsError; // DEV-Error during startup + short sDrvInitError; // DRV-Error during startup + unsigned char bActive; // Board is active + unsigned char * pDpmBase; // Virtual DPM start address + DPM_MEMORY * ptDpmAddress; // Virtual DPM address last kbyte + unsigned char * pbDpmSendArea; // Virtual DPM IO address send area + unsigned char * pbDpmReceiveArea; // Virtual DPM IO address receive area + unsigned char * pbHostFlags; // Pointer to HostFlags (PcFlags) + unsigned char * pbDevFlags; // Pointer to DevFlags (CifFlags) + unsigned short usOpenCounter; // Number of Applikations + spinlock_t mutex; // SMP synchronization + wait_queue_head_t pInitSemaphore; + wait_queue_head_t pReadSemaphore; + wait_queue_head_t pWriteSemaphore; + wait_queue_head_t pExIOSemaphore; + unsigned char bInitState; // Driver init state + unsigned char bReadState; // Driver read state + unsigned char bWriteState; // Driver write state + unsigned char bExIOEqState; // Driver exchange IO EQUAL state + unsigned char bExIONeqState; // Driver exchange IO NOT EQUAL state + unsigned char bCOMEqState; // Driver COM state wait on EQUAL + unsigned char bCOMNeqState; // Driver COM state wait on NOT EQUAL + unsigned char bInitMsgFlag; // Init message activ flag + unsigned char bReadMsgFlag; // Read message available flag + unsigned char bWriteMsgFlag; // Write message done flag + unsigned char bStateFlag; // State flag + unsigned char bExIOFlag; // Exchange IO flag + unsigned char bHostFlags; + unsigned char bMyDevFlags; + unsigned short usSpecialRcsError; // DEV-Error during startup + DRIVERINFO tStateInfo; + /* Structure extention for PCMCIA kernel 2.6.18 */ + struct pcmcia_device *p_dev; + dev_node_t node; +} DEV_INSTANCE; + +#endif /* CIF_DEV_H */ diff --git a/libs/pvb/include/rllib/cif_dev_i.h b/libs/pvb/include/rllib/cif_dev_i.h new file mode 100644 index 0000000..fcd1b57 --- /dev/null +++ b/libs/pvb/include/rllib/cif_dev_i.h @@ -0,0 +1,638 @@ +/* ******************************************************************* + cifdev_i.h + + ------------------------------------------------------------------------- + CREATETED : D. Tsaava, Hilscher GmbH + DATE : 18.07.2000 + PROJEKT : CIF device driver + ========================================================================= + + DISCRIPTION + + Internal driver interface definition + + ========================================================================= + + CHANGES + + version name date Discription + March 2001 + Juli 2004 Redesigned for the 2.6 Kernel + Copyright changed to GNU Lesser GPL + ------------------------------------------------------------------------- + V2.601 + + NOTE: as groundwork for this header served Windows version of + the CIF device driver + + ======================== Copyright ===================================== + + Copyright (C) 2004 Hilscher GmbH + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ======================================================================== +******************************************************************** */ +#ifndef CIFDEV_I_H +# define CIFDEV_I_H + +#ifdef _cplusplus + extern "C" { +#endif /* _cplusplus */ + +#ifndef _GNUC_ +# define _GNUC_ +#endif /* _GNUC_ */ + +/* ------------------------------------------------------------------------------------ */ +/* global definitions */ +/* ------------------------------------------------------------------------------------ */ + +#define MAX_DEV_BOARDS 4 // maximum numbers of boards + +/* ------------------------------------------------------------------------------------ */ +/* driver errors */ +/* ------------------------------------------------------------------------------------ */ + +#define DRV_NO_ERROR 0 // no error +#define DRV_BOARD_NOT_INITIALIZED -1 // DRIVER board not initialized +#define DRV_INIT_STATE_ERROR -2 // DRIVER error in internal init state +#define DRV_READ_STATE_ERROR -3 // DRIVER error in internal read state +#define DRV_CMD_ACTIVE -4 // DRIVER command on this chanal is activ +#define DRV_PARAMETER_UNKNOWN -5 // DRIVER unknown parameter in function occured +#define DRV_WRONG_DRIVER_VERSION -6 // DRIVER driver version is incompatible with DLL + +#define DRV_PCI_SET_CONFIG_MODE -7 // DRIVER error during PCI set config mode +#define DRV_PCI_READ_DPM_LENGTH -8 // DRIVER could not read PCI DPM length +#define DRV_PCI_SET_RUN_MODE -9 // DRIVER error during PCI set run mode + +#define DRV_DEV_DPM_ACCESS_ERROR -10 // DEVICE dual port ram not accessable +#define DRV_DEV_NOT_READY -11 // DEVICE not ready (ready flag failed) +#define DRV_DEV_NOT_RUNNING -12 // DEVICE not running (running flag failed) +#define DRV_DEV_WATCHDOG_FAILED -13 // DEVICE watch dog test failed +#define DRV_DEV_OS_VERSION_ERROR -14 // DEVICE signals wrong OS version +#define DRV_DEV_SYSERR -15 // DEVICE error in dual port flags +#define DRV_DEV_MAILBOX_FULL -16 // DEVICE send mailbox is full +#define DRV_DEV_PUT_TIMEOUT -17 // DEVICE PutMessage timeout +#define DRV_DEV_GET_TIMEOUT -18 // DEVICE GetMessage timeout +#define DRV_DEV_GET_NO_MESSAGE -19 // DEVICE no message available +#define DRV_DEV_RESET_TIMEOUT -20 // DEVICE RESET command timeout +#define DRV_DEV_NO_COM_FLAG -21 // DEVICE COM-flag not set +#define DRV_DEV_EXCHANGE_FAILED -22 // DEVICE IO data exchange failed +#define DRV_DEV_EXCHANGE_TIMEOUT -23 // DEVICE IO data exchange timeout +#define DRV_DEV_COM_MODE_UNKNOWN -24 // DEVICE IO data mode unknown +#define DRV_DEV_FUNCTION_FAILED -25 // DEVICE Function call failed +#define DRV_DEV_DPMSIZE_MISMATCH -26 // DEVICE DPM size differs from configuration +#define DRV_DEV_STATE_MODE_UNKNOWN -27 // DEVICE State mode unknown + +// Error from Interface functions +#define DRV_USR_OPEN_ERROR -30 // USER driver not opened +#define DRV_USR_INIT_DRV_ERROR -31 // USER can't connect with DEV board +#define DRV_USR_NOT_INITIALIZED -32 // USER board not initialized +#define DRV_USR_COMM_ERR -33 // USER IOCTRL function faild +#define DRV_USR_DEV_NUMBER_INVALID -34 // USER parameter for DEV number invalid +#define DRV_USR_INFO_AREA_INVALID -35 // USER parameter InfoArea unknown +#define DRV_USR_NUMBER_INVALID -36 // USER parameter Number invalid +#define DRV_USR_MODE_INVALID -37 // USER parameter Mode invalid +#define DRV_USR_MSG_BUF_NULL_PTR -38 // USER NULL pointer assignment +#define DRV_USR_MSG_BUF_TOO_SHORT -39 // USER Messagebuffer too short +#define DRV_USR_SIZE_INVALID -40 // USER size parameter invalid +#define DRV_USR_SIZE_ZERO -42 // USER size parameter with zero length +#define DRV_USR_SIZE_TOO_LONG -43 // USER size parameter too long +#define DRV_USR_DEV_PTR_NULL -44 // USER device address null pointer +#define DRV_USR_BUF_PTR_NULL -45 // USER pointer to buffer is a null pointer + +#define DRV_USR_SENDSIZE_TOO_LONG -46 // USER SendSize parameter too long +#define DRV_USR_RECVSIZE_TOO_LONG -47 // USER ReceiveSize parameter too long +#define DRV_USR_SENDBUF_PTR_NULL -48 // USER pointer to buffer is a null pointer +#define DRV_USR_RECVBUF_PTR_NULL -49 // USER pointer to buffer is a null pointer + +#define DRV_DEV_NO_VIRTUAL_MEM -60 // DEVICE Virtual memory not available +#define DRV_DEV_UNMAP_VIRTUAL_MEM -61 // DEVICE Unmap virtual memory failed +#define DRV_DEV_REQUEST_IRQ_FAILED -62 // DEVICE Request irq failed + +#define DRV_USR_FILE_OPEN_FAILED -100 // USER file not opend +#define DRV_USR_FILE_SIZE_ZERO -101 // USER file size zero +#define DRV_USR_FILE_NO_MEMORY -102 // USER not enough memory to load file +#define DRV_USR_FILE_READ_FAILED -103 // USER file read failed +#define DRV_USR_INVALID_FILETYPE -104 // USER file type invalid +#define DRV_USR_FILENAME_INVALID -105 // USER file name not valid + +#define DRV_RCS_ERROR_OFFSET 1000 // RCS error number start + + +/* ------------------------------------------------------------------------------------ */ +/* message definition */ +/* ------------------------------------------------------------------------------------ */ + +#ifdef _GNUC_ +# ifndef PACKED +# define PACKED __attribute__((packed, aligned(1))) +# endif /* PACKED */ +#else +# define PACKED +#endif + +#ifndef CIFUSER_H_INCLUDED +// max. length is 255 + 8 Bytes +typedef struct tagMSG_STRUC { + unsigned char rx PACKED; + unsigned char tx PACKED; + unsigned char ln PACKED; + unsigned char nr PACKED; + unsigned char a PACKED; + unsigned char f PACKED; + unsigned char b PACKED; + unsigned char e PACKED; + unsigned char data[255] PACKED; + unsigned char dummy[25] PACKED; +} MSG_STRUC; +#endif + +/* ------------------------------------------------------------------------------------ */ +/* DEV DPM DATA structures */ +/* ------------------------------------------------------------------------------------ */ + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagIOINFO { + unsigned char bComBit PACKED; + unsigned char bIOExchangeMode PACKED; + unsigned long ulIOExchangeCnt PACKED; +} IOINFO; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagVERSIONINFO { /* DEV serial number and OS versions */ + unsigned long ulDate PACKED PACKED; + unsigned long ulDeviceNo PACKED; + unsigned long ulSerialNo PACKED; + unsigned long ulReserved PACKED; + unsigned char PcOsName0[4] PACKED; + unsigned char PcOsName1[4] PACKED; + unsigned char PcOsName2[4] PACKED; + unsigned char OemIdentifier[4] PACKED; +} VERSIONINFO; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagFIRMWAREINFO { + unsigned char FirmwareName[16] PACKED; + unsigned char FirmwareVersion[16] PACKED; +} FIRMWAREINFO; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagTASKSTATE { + unsigned char TaskState[64] PACKED; +} TASKSTATE; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagTASKPARAM { + unsigned char TaskParameter[64] PACKED; +} TASKPARAM; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagRAWDATA { + unsigned char abRawData[1022] PACKED; +} RAWDATA; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagTASKINFO { + struct { + char TaskName[8] PACKED; /* Task name */ + unsigned short Version PACKED; /* Task version */ + unsigned char TaskCondition PACKED; + unsigned char reserved[5] PACKED; /* n.c. */ + } tInfo [7]; +} TASKINFO; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagRCSINFO { + unsigned short RcsVersion PACKED; /* Operationsystem Version */ + unsigned char RcsError PACKED; + unsigned char HostWatchDog PACKED; + unsigned char DevWatchDog PACKED; + unsigned char SegmentCount PACKED; + unsigned char DeviceAdress PACKED; + unsigned char DriverType PACKED; +} RCSINFO; +#endif + +#ifndef CIFUSER_H_INCLUDED +typedef struct tagDEVINFO { + unsigned char DpmSize PACKED; + unsigned char DevType PACKED; + unsigned char DevModel PACKED; + unsigned char DevIdentifier[3] PACKED; +} DEVINFO; +#endif + +/* ------------------------------------------------------------------------------------ */ +/* driver info structure definitions */ +/* ------------------------------------------------------------------------------------ */ + +// Board information structure +#ifndef CIFUSER_H_INCLUDED +typedef struct tagBOARD_INFO{ + unsigned char abDriverVersion[16] PACKED; // DRV driver information string + struct { + unsigned short usBoard PACKED; // DRV board number + unsigned short usAvailable PACKED; // DRV board is available + unsigned long ulPhysicalAddress PACKED; // DRV physical DPM address + unsigned short usIrq PACKED; // DRV irq number + } tBoard [MAX_DEV_BOARDS]; + unsigned short usBoards_detected PACKED; +} BOARD_INFO; +#endif + +// Driver information structure +#ifndef CIFUSER_H_INCLUDED +typedef struct tagDRIVERINFO{ + unsigned long OpenCnt PACKED; // number of driver open + unsigned long CloseCnt PACKED; // number of driver close + unsigned long ReadCnt PACKED; // number of DevGetMessage commands + unsigned long WriteCnt PACKED; // number of DevPutMessage commands + unsigned long IRQCnt PACKED; // number of IRQs + unsigned char InitMsgFlag PACKED; // DPM state init + unsigned char ReadMsgFlag PACKED; // DPM state read message + unsigned char WriteMsgFlag PACKED; // DPM state write message + unsigned char LastFunction PACKED; // DRV last function in driver + unsigned char WriteState PACKED; // DRV actual write state + unsigned char ReadState PACKED; // DRV actual read state + unsigned char HostFlags PACKED; // DPM HostFlags (PcFlags) + unsigned char MyDevFlags PACKED; // DPM (internal) DevFlags + unsigned char ExComBit PACKED; // COM bit + unsigned long ExIOCnt PACKED; // IO data exchange count +} DRIVERINFO; +#endif + +// Extended board information structure +#ifndef CIFUSER_H_INCLUDED +typedef struct tagBOARD_INFOEX{ + unsigned char abDriverVersion[16] PACKED; // DRV driver information string + struct { + unsigned short usBoard PACKED; // DRV board number + unsigned short usAvailable PACKED; // DRV board is available + unsigned long ulPhysicalAddress PACKED; // DRV physical DPM address + unsigned short usIrq PACKED; // DRV irq number + DRIVERINFO tDriverInfo PACKED; // Driver information + FIRMWAREINFO tFirmware PACKED; + DEVINFO tDeviceInfo PACKED; + RCSINFO tRcsInfo PACKED; + VERSIONINFO tVersion PACKED; + } tBoard [MAX_DEV_BOARDS]; +} BOARD_INFOEX; +#endif + +// State field structure +#ifndef CIFUSER_H_INCLUDED +typedef struct tagCOMSTATE { + unsigned short usMode PACKED; // Actual STATE mode + unsigned short usStateFlag PACKED; // State flag + unsigned char abState[64] PACKED; // State area +} COMSTATE; +#endif + +// state information in bLastFunction +#define FKT_OPEN 1; +#define FKT_CLOSE 2; +#define FKT_READ 3; +#define FKT_WRITE 4; +#define FKT_IO 5; +// state information in bWriteState and bReadState +#define STATE_IN 0x01; +#define STATE_WAIT 0x02; +#define STATE_OUT 0x03; +#define STATE_IN_IRQ 0x04; + +/* ------------------------------------------------------------------------------------ */ +/* IOCTRL data structures */ +/* ------------------------------------------------------------------------------------ */ + +// IOCTRL funktion defines, always step 8 +/* + * Ioctl definitions + */ + +/* Use 'c' as magic number */ +#define CIF_IOC_MAGIC 'c' + +#define CIF_IOCRESET _IO(CIF_IOC_MAGIC, 0) + +#define CIF_IOCTLNOFUNCTION _IO (CIF_IOC_MAGIC, 0) +#define CIF_IOCTLBOARDINFO _IOWR(CIF_IOC_MAGIC, 1, char[256]) +#define CIF_IOCTLINITDRV _IOWR(CIF_IOC_MAGIC, 2, char[13]) +#define CIF_IOCTLPARAMETER _IOW (CIF_IOC_MAGIC, 3, char[71]) +#define CIF_IOCTLRESETDEV _IOW (CIF_IOC_MAGIC, 4, char[13]) +#define CIF_IOCTLPUTMSG _IO (CIF_IOC_MAGIC, 5) +#define CIF_IOCTLGETMSG _IO (CIF_IOC_MAGIC, 6) +#define CIF_IOCTLTASKSTATE _IO (CIF_IOC_MAGIC, 7) +#define CIF_IOCTLMBXINFO _IO (CIF_IOC_MAGIC, 8) +#define CIF_IOCTLTRIGGERWD _IO (CIF_IOC_MAGIC, 9) +#define CIF_IOCTLGETINFO _IO (CIF_IOC_MAGIC, 10) +#define CIF_IOCTLEXITDRV _IO (CIF_IOC_MAGIC, 11) +#define CIF_IOCTLGETPARAMETER _IO (CIF_IOC_MAGIC, 12) +#define CIF_IOCTLEXIO _IO (CIF_IOC_MAGIC, 13) +#define CIF_IOCTLSETHOST _IO (CIF_IOC_MAGIC, 14) +#define CIF_IOCTLREADSEND _IO (CIF_IOC_MAGIC, 15) +#define CIF_IOCTLEXTDATA _IO (CIF_IOC_MAGIC, 16) +#define CIF_IOCTLGETMBX _IO (CIF_IOC_MAGIC, 17) +#define CIF_IOCTLBOARDINFOEX _IO (CIF_IOC_MAGIC, 18) + +#define CIF_IOCTLEXIOEX _IO (CIF_IOC_MAGIC, 19) +#define CIF_IOCTLEXIOERR _IO (CIF_IOC_MAGIC, 20) +#define CIF_IOCTLRWRAW _IO (CIF_IOC_MAGIC, 21) +#define CIF_IOCTLSPCONTROL _IO (CIF_IOC_MAGIC, 22) +#define CIF_IOCTLGETDPMPTR _IO (CIF_IOC_MAGIC, 23) +#define CIF_IOCTLRWDPMDATA _IO (CIF_IOC_MAGIC, 24) + +#define CIF_IOCTL_IRQ_POLL _IOWR(CIF_IOC_MAGIC, 25, char[13]) + +#define CIF_IOC_MAXNR 25 + +// interface structure for ioctl's +typedef struct cif_ioctl_data { + unsigned long lInpBuffLen PACKED; + unsigned long lOutBuffLen PACKED; + unsigned char *pInpBuff PACKED; + unsigned char *pOutBuff PACKED; +} cif_ioctl_data; + +// SET BOARD OPERATION MODE +typedef struct tagDEVIO_SETOPMODE { + unsigned short usBoard PACKED; + unsigned short usMode PACKED; // Interrupt/polling mode + unsigned short usIrq PACKED; + short sError PACKED; +} DEVIO_SETOPMODE; + +// GETBOARDINFORMATION +typedef struct tagDEVIO_GETBOARDINFOCMD { + unsigned short usDevNumber PACKED; // n.a. + unsigned short usInfoLen PACKED; // Information length + BOARD_INFO *ptBoardInfo PACKED; + short sError PACKED; +} DEVIO_GETBOARDINFOCMD; + +// Extnded GETBOARDINFORMATION +typedef struct tagDEVIO_GETBOARDINFOEXCMD { + unsigned short usDevNumber PACKED; // n.a. + unsigned short usInfoLen PACKED; // Information length + BOARD_INFOEX * ptBoard PACKED; + short sError PACKED; +} DEVIO_GETBOARDINFOEXCMD; + +// RESETDEV + +#define COLDSTART 2 +#define WARMSTART 3 +#define BOOTSTART 4 + +typedef struct tagDEVIO_RESETCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usMode PACKED; // DEV function + unsigned long ulTimeout PACKED; // Service timeout + unsigned long ulDpmSize PACKED; + short sError PACKED; +} DEVIO_RESETCMD; + +// PUTTASKPARAMETER +typedef struct tagDEVIO_PUTPARAMETERCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usTaskParamNum PACKED; // Number of the parameter area + unsigned short usTaskParamLen PACKED; // Lenght of parameter data + unsigned char TaskParameter[64] PACKED; + short sError PACKED; +} DEVIO_PUTPARAMETERCMD; + +// PUTMESSAGE +typedef struct tagDEVIO_PUTMESSAGECMD { + unsigned short usBoard PACKED; // DEV board number + MSG_STRUC tMsg PACKED; // Message data + unsigned long ulTimeout PACKED; // Service timeout + short sError PACKED; +} DEVIO_PUTMESSAGECMD; + +// GETMESSAGE +typedef struct tagDEVIO_GETMESSAGECMD { + unsigned short usBoard PACKED; // DEV board number + unsigned long ulTimeout PACKED; // Service timeout + unsigned long ulMsgSize PACKED; // User message buffer size + MSG_STRUC tMsg PACKED; // Message data + short sError PACKED; +} DEVIO_GETMESSAGECMD; + +// GETTASKSTATE +typedef struct tagDEVIO_GETTASKSTATECMD { + unsigned char ucBoard PACKED; // DEV board number + unsigned short usStateNum PACKED; // Task state field number + unsigned short usStateLen PACKED; // Lenght of state data + unsigned char TaskState[64] PACKED; + short sError PACKED; +} DEVIO_GETTASKSTATECMD; + +// DEVMBXINFO + +#define DEVICE_MBX_EMPTY 0 +#define DEVICE_MBX_FULL 1 +#define HOST_MBX_EMPTY 0 +#define HOST_MBX_FULL 1 +#define HOST_MBX_SYSERR 2 + +typedef struct tagDEVIO_MBXINFOCMD { + unsigned char ucBoard PACKED; // DEV board number + unsigned short usDevMbxState PACKED; // State of the device mailbox + unsigned short usHostMbxState PACKED; // State of the host mailbox + short sError PACKED; +} DEVIO_MBXINFOCMD; + +// Board operation mode +#define POLLING_MODE 0 +#define INTERRUPT_MODE 1 + +// TRIGGERWATCHDOG and SETHOSTSTATE +#define WATCHDOG_STOP 0 +#define WATCHDOG_START 1 +#define HOST_NOT_READY 0 +#define HOST_READY 1 +#define SPECIAL_CONTROL_CLEAR 0 +#define SPECIAL_CONTROL_SET 1 + +typedef struct tagDEVIO_TRIGGERCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usMode PACKED; // DEV function + unsigned long ulTimeout PACKED; // DEV timeout + unsigned short usTriggerValue PACKED; // DEV trigger value + short sError PACKED; +} DEVIO_TRIGGERCMD; + +// GETINFO +// InfoArea definitions + +#define GET_DRIVER_INFO 1 +#define GET_VERSION_INFO 2 +#define GET_FIRMWARE_INFO 3 +#define GET_TASK_INFO 4 +#define GET_RCS_INFO 5 +#define GET_DEV_INFO 6 +#define GET_IO_INFO 7 +#define GET_IO_SEND_DATA 8 + +typedef struct tagDEVIO_GETDEVINFOCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usInfoArea PACKED; // Number of info area + unsigned short usInfoLen PACKED; // Lenght of info data + unsigned char * pabInfoData PACKED; // Pointer to info data area + short sError PACKED; +} DEVIO_GETDEVINFOCMD; + +// EXITDRV +typedef struct tagDEVIO_EXITCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usDrvOpenCount PACKED; // dr�er opencount + short sError PACKED; +} DEVIO_EXITCMD; + +// GETTASKPARAMETER +typedef struct tagDEVIO_GETPARAMETERCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usTaskParamNum PACKED; // Number of the parameter area + unsigned short usTaskParamLen PACKED; // Lenght of parameter data + unsigned char TaskParameter[64] PACKED; + short sError PACKED; +} DEVIO_GETPARAMETERCMD; + +// EXIO +typedef struct tagDEVIO_EXIOCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usSendOffset PACKED; // Byte offset send data + unsigned short usSendLen PACKED; // Length of send data + unsigned char *pabSendData PACKED; // Send data buffer + unsigned short usReceiveOffset PACKED; // Byte offset receive data + unsigned short usReceiveLen PACKED; // Length of receive data + unsigned char *pabReceiveData PACKED; // Receive data buffer + unsigned long ulTimeout PACKED; // Service timeout + short sError PACKED; +} DEVIO_EXIOCMD; + +// EXIOEX +typedef struct tagDEVIO_EXIOCMDEX { + unsigned short usBoard PACKED; // DEV board number + unsigned short usSendOffset PACKED; // Byte offset send data + unsigned short usSendLen PACKED; // Length of send data + unsigned char * pabSendData PACKED; // Send data buffer + unsigned short usReceiveOffset PACKED; // Byte offset receive data + unsigned short usReceiveLen PACKED; // Length of receive data + unsigned char * pabReceiveData PACKED; // Receive data buffer + unsigned long ulTimeout PACKED; // Service timeout + short sError PACKED; // --- Equal to "ExcahangeIOCmd" + unsigned short usMode PACKED; // External exchange mode +} DEVIO_EXIOCMDEX; + +// EXIOERR +#define STATE_ERR_NON 0 +#define STATE_ERR 1 + +#define STATE_MODE_2 2 +#define STATE_MODE_3 3 +#define STATE_MODE_4 4 + +typedef struct tagDEVIO_EXIOCMDERR { + unsigned short usBoard PACKED; // DEV board number + unsigned short usSendOffset PACKED; // Byte offset send data + unsigned short usSendLen PACKED; // Length of send data + unsigned char *pabSendData PACKED; // Send data buffer + unsigned short usReceiveOffset PACKED; // Byte offset receive data + unsigned short usReceiveLen PACKED; // Length of receive data + unsigned char *pabReceiveData PACKED; // Receive data buffer + unsigned long ulTimeout PACKED; // Service timeout + short sError PACKED; // --- Equal to "ExcahangeIOCmd" + COMSTATE *ptStateData PACKED; // State data buffer +} DEVIO_EXIOCMDERR; + +// READIO +typedef struct tagDEVIO_READSENDCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usReadOffset PACKED; // Byte offset send/receive data + unsigned short usReadLen PACKED; // Length of send/receive data + unsigned char * pabReadData PACKED; // Read send data buffer + short sError PACKED; +} DEVIO_READSENDCMD; + +// ExtData +#define EXTDATASIZE 20 +typedef struct tagDEVIO_EXTDATACMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usMode PACKED; // DEV mode + unsigned char *pabExtData PACKED; // DEV Extended data + short sError PACKED; +} DEVIO_EXTDATACMD; + +// GetMbxData +typedef struct tagDEVIO_GETMBXCMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usDevLen PACKED; // DEV length of dev data + unsigned short usHostLen PACKED; // DEV length of host data + unsigned char abHostMbx[288] PACKED; // DEV pointer to host data buffer + unsigned char abDevMbx[288] PACKED; // DEV pointer to device data buffer + short sError PACKED; +} DEVIO_GETMBXCMD; + +// ReadWriteRawData +#define PARAMETER_READ 1 +#define PARAMETER_WRITE 2 +typedef struct tagDEVIO_RWRAWDATACMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usMode PACKED; // DEV read or write + unsigned short usOffset PACKED; // DEV offset in the DPM last kByte + unsigned short usLen PACKED; // DEV length of data + unsigned char *pabData PACKED; // DEV pointer to data buffer + short sError PACKED; +} DEVIO_RWRAWDATACMD; +// ReadWriteDPMData +typedef struct tagDEVIO_RWDPMDATACMD { + unsigned short usBoard PACKED; // DEV board number + unsigned short usMode PACKED; // DEV read or write + unsigned short usOffset PACKED; // DEV offset in the DPM last kByte + unsigned short usLen PACKED; // DEV length of data + unsigned char *pabData PACKED; // DEV pointer to data buffer + short sError PACKED; +} DEVIO_RWDPMDATACMD; + + +// GetDPMPtr +#define DPM_PTR_OPEN_DRV 1 +#define DPM_PTR_OPEN_USR 2 +#define DPM_PTR_CLOSE 3 + +typedef struct tagDEVIO_GETDPMPTR { + unsigned short usMode PACKED; // DEV mode + unsigned short usBoard PACKED; // DEV board number + void *pvUserData PACKED; // DEV user data for pmi + unsigned long *pulDPMSize PACKED; // DEV DPM size in bytes + unsigned char **pDPMBase PACKED; // DEV pointer to data buffer + unsigned long lError PACKED; // DEV system error + short sError PACKED; // DEV driver error +} DEVIO_GETDPMPTR; + +#ifdef _cplusplus + } +#endif + +#endif /* CIFDEV_I_H */ diff --git a/libs/pvb/include/rllib/cif_types.h b/libs/pvb/include/rllib/cif_types.h new file mode 100644 index 0000000..4fd9cc7 --- /dev/null +++ b/libs/pvb/include/rllib/cif_types.h @@ -0,0 +1,71 @@ +/* ******************************************************************* + + cif_types.h + + ------------------------------------------------------------------------- + CREATETED : D. Tsaava, Hilscher GmbH + DATE : 18.07.2000 + PROJEKT : CIF device driver + ========================================================================= + + DISCRIPTION + + Includefile for CIF device driver, DPM layout . + + ========================================================================= + + CHANGES + + version name date Discription + March 2001 + Juli 2004 Redesigned for the 2.6 Kernel + Copyright changed to GNU Lesser GPL +------------------------------------------------------------------------- + + V2.601 + + ======================== Copyright ===================================== + + Copyright (C) 2004 Hilscher GmbH + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ========================================================================= + ******************************************************************** */ +#ifndef CIF_TYPES_H +# define CIF_TYPES_H + +/* Macros for debugging */ +#undef DBG_PRN /* undef it, just in case */ +#ifdef CIF_DEBUG +# define CIF_PRN(function, lineno,fmt,args...) printk(fmt,function,lineno,##args) +# define DBG_PRN(fmt,args...) CIF_PRN((__FUNCTION__),(__LINE__),KERN_INFO __FILE__"::%s(L%.4d): "fmt,##args) +#else +# define DBG_PRN(fmt, args...) /* not debugging: nothing */ +#endif + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +#ifndef BOOL +# define BOOL int +#endif + +#endif /* CIF_TYPES_H */ diff --git a/libs/pvb/include/rllib/cif_user.h b/libs/pvb/include/rllib/cif_user.h new file mode 100644 index 0000000..30a9edc --- /dev/null +++ b/libs/pvb/include/rllib/cif_user.h @@ -0,0 +1,495 @@ +/* ******************************************************************* + + cif_user.h + + ------------------------------------------------------------------------- + CREATETED : D. Tsaava, Hilscher GmbH + DATE : 18.07.2000 + PROJEKT : CIF device driver + ========================================================================= + + DISCRIPTION + + User interface definition. + + ========================================================================= + + CHANGES + + version name date Discription + + Juli 2004 Copyright changed to GNU Lesser GPL +------------------------------------------------------------------------- + V2.000 + + NOTE: The Code from the Windows version of the driver related to + driver API was taken over for the most part unchanged + + ======================== Copyright ===================================== + + Copyright (C) 2004 Hilscher GmbH + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ======================================================================== +******************************************************************** */ + +/* prevent multiple inclusion */ +#ifndef CIFUSER_H_INCLUDED + #define CIFUSER_H_INCLUDED + +//#ifdef __cplusplus +// extern "C" { +//#endif /* _cplusplus */ + +#ifndef _GNUC_ +# define _GNUC_ +#endif /* _GNUC_ */ + +/* ------------------------------------------------------------------------------------ */ +/* global definitions */ +/* ------------------------------------------------------------------------------------ */ + +#define MAX_DEV_BOARDS 4 // maximum numbers of boards + +/* ------------------------------------------------------------------------------------ */ +/* driver errors */ +/* ------------------------------------------------------------------------------------ */ + +#define DRV_NO_ERROR 0 // no error +#define DRV_BOARD_NOT_INITIALIZED -1 // DRIVER Board not initialized +#define DRV_INIT_STATE_ERROR -2 // DRIVER Error in internal init state +#define DRV_READ_STATE_ERROR -3 // DRIVER Error in internal read state +#define DRV_CMD_ACTIVE -4 // DRIVER Command on this channel is activ +#define DRV_PARAMETER_UNKNOWN -5 // DRIVER Unknown parameter in function occured +#define DRV_WRONG_DRIVER_VERSION -6 // DRIVER Version is incompatible with DLL + +#define DRV_PCI_SET_CONFIG_MODE -7 // DRIVER Error during PCI set run mode +#define DRV_PCI_READ_DPM_LENGTH -8 // DRIVER Could not read PCI dual port memory length +#define DRV_PCI_SET_RUN_MODE -9 // DRIVER Error during PCI set run mode + +#define DRV_DEV_DPM_ACCESS_ERROR -10 // DEVICE Dual port ram not accessable(board not found) +#define DRV_DEV_NOT_READY -11 // DEVICE Not ready (ready flag failed) +#define DRV_DEV_NOT_RUNNING -12 // DEVICE Not running (running flag failed) +#define DRV_DEV_WATCHDOG_FAILED -13 // DEVICE Watchdog test failed +#define DRV_DEV_OS_VERSION_ERROR -14 // DEVICE Signals wrong OS version +#define DRV_DEV_SYSERR -15 // DEVICE Error in dual port flags +#define DRV_DEV_MAILBOX_FULL -16 // DEVICE Send mailbox is full +#define DRV_DEV_PUT_TIMEOUT -17 // DEVICE PutMessage timeout +#define DRV_DEV_GET_TIMEOUT -18 // DEVICE GetMessage timeout +#define DRV_DEV_GET_NO_MESSAGE -19 // DEVICE No message available +#define DRV_DEV_RESET_TIMEOUT -20 // DEVICE RESET command timeout +#define DRV_DEV_NO_COM_FLAG -21 // DEVICE COM-flag not set +#define DRV_DEV_EXCHANGE_FAILED -22 // DEVICE IO data exchange failed +#define DRV_DEV_EXCHANGE_TIMEOUT -23 // DEVICE IO data exchange timeout +#define DRV_DEV_COM_MODE_UNKNOWN -24 // DEVICE IO data mode unknown +#define DRV_DEV_FUNCTION_FAILED -25 // DEVICE Function call failed +#define DRV_DEV_DPMSIZE_MISMATCH -26 // DEVICE DPM size differs from configuration +#define DRV_DEV_STATE_MODE_UNKNOWN -27 // DEVICE State mode unknown + +// Error from Interface functions +#define DRV_USR_OPEN_ERROR -30 // USER Driver not opened (device driver not loaded) +#define DRV_USR_INIT_DRV_ERROR -31 // USER Can't connect with device +#define DRV_USR_NOT_INITIALIZED -32 // USER Board not initialized (DevInitBoard not called) +#define DRV_USR_COMM_ERR -33 // USER IOCTRL function failed +#define DRV_USR_DEV_NUMBER_INVALID -34 // USER Parameter DeviceNumber invalid +#define DRV_USR_INFO_AREA_INVALID -35 // USER Parameter InfoArea unknown +#define DRV_USR_NUMBER_INVALID -36 // USER Parameter Number invalid +#define DRV_USR_MODE_INVALID -37 // USER Parameter Mode invalid +#define DRV_USR_MSG_BUF_NULL_PTR -38 // USER NULL pointer assignment +#define DRV_USR_MSG_BUF_TOO_SHORT -39 // USER Message buffer too short +#define DRV_USR_SIZE_INVALID -40 // USER Parameter Size invalid +#define DRV_USR_SIZE_ZERO -42 // USER Parameter Size with zero length +#define DRV_USR_SIZE_TOO_LONG -43 // USER Parameter Size too long +#define DRV_USR_DEV_PTR_NULL -44 // USER Device address null pointer +#define DRV_USR_BUF_PTR_NULL -45 // USER Pointer to buffer is a null pointer + +#define DRV_USR_SENDSIZE_TOO_LONG -46 // USER Parameter SendSize too long +#define DRV_USR_RECVSIZE_TOO_LONG -47 // USER Parameter ReceiveSize too long +#define DRV_USR_SENDBUF_PTR_NULL -48 // USER Pointer to send buffer is a null pointer +#define DRV_USR_RECVBUF_PTR_NULL -49 // USER Pointer to receive buffer is a null pointer + +#define DRV_DEV_NO_VIRTUAL_MEM -60 // DEVICE Virtual memory not available +#define DRV_DEV_UNMAP_VIRTUAL_MEM -61 // DEVICE Unmap virtual memory failed +#define DRV_DEV_REQUEST_IRQ_FAILED -62 // DEVICE Request irq failed + +#define DRV_USR_FILE_OPEN_FAILED -100 // USER file not opend +#define DRV_USR_FILE_SIZE_ZERO -101 // USER file size zero +#define DRV_USR_FILE_NO_MEMORY -102 // USER not enough memory to load file +#define DRV_USR_FILE_READ_FAILED -103 // USER file read failed +#define DRV_USR_INVALID_FILETYPE -104 // USER file type invalid +#define DRV_USR_FILENAME_INVALID -105 // USER file name not valid + +#define DRV_RCS_ERROR_OFFSET 1000 // RCS error number start + + +#ifdef _GNUC_ +# ifndef PACKED +# define PACKED __attribute__((packed, aligned(1))) +# endif /* PACKED */ +#else +# define PACKED +#endif + +/* ------------------------------------------------------------------------------------ */ +/* message definition */ +/* ------------------------------------------------------------------------------------ */ + +// max. length is 288 Bytes, max message length is 255 + 8 Bytes +typedef struct tagMSG_STRUC { + unsigned char rx PACKED; + unsigned char tx PACKED; + unsigned char ln PACKED; + unsigned char nr PACKED; + unsigned char a PACKED; + unsigned char f PACKED; + unsigned char b PACKED; + unsigned char e PACKED; + unsigned char data[255] PACKED; + unsigned char dummy[25] PACKED; // for compatibility with older definitions (288 Bytes) +} MSG_STRUC; + +/* ------------------------------------------------------------------------------------ */ +/* INFO structure definitions */ +/* ------------------------------------------------------------------------------------ */ + +// Board operation mode +#define POLLING_MODE 0 +#define INTERRUPT_MODE 1 + +// DEVRESET +#define COLDSTART 2 +#define WARMSTART 3 +#define BOOTSTART 4 + +// DEVMBXINFO +#define DEVICE_MBX_EMPTY 0 +#define DEVICE_MBX_FULL 1 +#define HOST_MBX_EMPTY 0 +#define HOST_MBX_FULL 1 + +// TRIGGERWATCHDOG +#define WATCHDOG_STOP 0 +#define WATCHDOG_START 1 + +// GETINFO InfoArea definitions +#define GET_DRIVER_INFO 1 +#define GET_VERSION_INFO 2 +#define GET_FIRMWARE_INFO 3 +#define GET_TASK_INFO 4 +#define GET_RCS_INFO 5 +#define GET_DEV_INFO 6 +#define GET_IO_INFO 7 +#define GET_IO_SEND_DATA 8 + +// HOST mode definition +#define HOST_NOT_READY 0 +#define HOST_READY 1 + +// DEVREADWRITERAW +#define PARAMETER_READ 1 +#define PARAMETER_WRITE 2 + +// STATE definition +#define STATE_ERR_NON 0 +#define STATE_ERR 1 + +#define STATE_MODE_2 2 +#define STATE_MODE_3 3 +#define STATE_MODE_4 4 + +// DEVSPECIALCONTROL +#define SPECIAL_CONTROL_CLEAR 0 +#define SPECIAL_CONTROL_SET 1 + +// DEVDOWNLOAD +#define FIRMWARE_DOWNLOAD 1 +#define CONFIGURATION_DOWNLOAD 2 + +// Device exchange IO information +typedef struct tagIOINFO { + unsigned char bComBit PACKED; /* Actual state of the COM bit */ + unsigned char bIOExchangeMode PACKED; /* Actual data exchange mode (0..5) */ + unsigned long ulIOExchangeCnt PACKED; /* Exchange IO counter */ +} IOINFO; + +// Device version information +typedef struct tagVERSIONINFO { /* DEV serial number and OS versions */ + unsigned long ulDate PACKED; + unsigned long ulDeviceNo PACKED; + unsigned long ulSerialNo PACKED; + unsigned long ulReserved PACKED; + unsigned char abPcOsName0[4] PACKED; + unsigned char abPcOsName1[4] PACKED; + unsigned char abPcOsName2[4] PACKED; + unsigned char abOemIdentifier[4] PACKED; +} VERSIONINFO; + +// Device firmware information +typedef struct tagFIRMWAREINFO { + unsigned char abFirmwareName[16] PACKED; /* Firmware name */ + unsigned char abFirmwareVersion[16] PACKED; /* Firmware version */ +} FIRMWAREINFO; + +// Device task state information +typedef struct tagTASKSTATE { + unsigned char abTaskState[64] PACKED; /* Task state field */ +} TASKSTATE; + +// Device task paramater data +typedef struct tagTASKPARAM { + unsigned char abTaskParameter[64] PACKED; /* Task parameter field */ +} TASKPARAM; + +// Device raw data structure +typedef struct tagRAWDATA { + unsigned char abRawData[1022] PACKED; /* Definition of the last kByte */ +} RAWDATA; + +// Device task information +typedef struct tagTASKINFO { + struct { + unsigned char abTaskName[8] PACKED; /* Task name */ + unsigned short usTaskVersion PACKED; /* Task version */ + unsigned char bTaskCondition PACKED; /* Actual task condition */ + unsigned char abreserved[5] PACKED; /* n.c. */ + } tTaskInfo [7]; +} TASKINFO; + +// Device operating system (RCS) information +typedef struct tagRCSINFO { + unsigned short usRcsVersion PACKED; /* Device operating system (RCS) version */ + unsigned char bRcsError PACKED; /* Operating system errors */ + unsigned char bHostWatchDog PACKED; /* Host watchdog value */ + unsigned char bDevWatchDog PACKED; /* Device watchdog value */ + unsigned char bSegmentCount PACKED; /* RCS segment free counter */ + unsigned char bDeviceAdress PACKED; /* RCS device base address */ + unsigned char bDriverType PACKED; /* RCS driver type */ +} RCSINFO; + +// Device description +typedef struct tagDEVINFO { + unsigned char bDpmSize PACKED; /* Device dpm size (2,8...) */ + unsigned char bDevType PACKED; /* Device type (manufactor code) */ + unsigned char bDevModel PACKED; /* Device model (manufactor code) */ + unsigned char abDevIdentifier[3] PACKED; /* Device identification characters */ +} DEVINFO; + +/* ------------------------------------------------------------------------------------ */ +/* driver info structure definitions */ +/* ------------------------------------------------------------------------------------ */ + +// Board information structure +typedef struct tagBOARD_INFO{ + unsigned char abDriverVersion[16] PACKED; // DRV driver information string + struct { + unsigned short usBoard PACKED; // DRV board number + unsigned short usAvailable PACKED; // DRV board is available + unsigned long ulPhysicalAddress PACKED; // DRV physical DPM address + unsigned short usIrq PACKED; // DRV irq number + } tBoard [MAX_DEV_BOARDS]; + unsigned short usBoards_detected PACKED; +} BOARD_INFO; + +// Internal driver state information structure +typedef struct tagDRIVERINFO{ + unsigned long ulOpenCnt PACKED; // DevOpen() counter + unsigned long CloseCnt PACKED; // number of driver close + unsigned long ulReadCnt PACKED; // Number of DevGetMessage commands + unsigned long ulWriteCnt PACKED; // Number of DevPutMessage commands + unsigned long ulIRQCnt PACKED; // Number of board interrupts + unsigned char bInitMsgFlag PACKED; // Actual init sate + unsigned char bReadMsgFlag PACKED; // Actual read mailbox state + unsigned char bWriteMsgFlag PACKED; // Actual write mailbox state + unsigned char bLastFunction PACKED; // Last driver function + unsigned char bWriteState PACKED; // Actual write command state + unsigned char bReadState PACKED; // Actual read command state + unsigned char bHostFlags PACKED; // Actual host flags + unsigned char bMyDevFlags PACKED; // Actual device falgs + unsigned char bExIOFlag PACKED; // Actual IO flags + unsigned long ulExIOCnt PACKED; // DevExchangeIO() counter +} DRIVERINFO; + +// Extended board information structure +typedef struct tagBOARD_INFOEX{ + unsigned char abDriverVersion[16] PACKED; // DRV driver information string + struct { + unsigned short usBoard PACKED; // DRV board number + unsigned short usAvailable PACKED; // DRV board is available + unsigned long ulPhysicalAddress PACKED; // DRV physical DPM address + unsigned short usIrq PACKED; // DRV irq number + DRIVERINFO tDriverInfo PACKED; // Driver information + FIRMWAREINFO tFirmware PACKED; + DEVINFO tDeviceInfo PACKED; + RCSINFO tRcsInfo PACKED; + VERSIONINFO tVersion PACKED; + } tBoard [MAX_DEV_BOARDS]; +} BOARD_INFOEX; + +// Communication state field structure +typedef struct tagCOMSTATE { + unsigned short usMode PACKED; // Actual STATE mode + unsigned short usStateFlag PACKED; // State flag + unsigned char abState[64] PACKED; // State area +} COMSTATE; + +// state information in bLastFunction +#define FKT_OPEN 1; +#define FKT_CLOSE 2; +#define FKT_READ 3; +#define FKT_WRITE 4; +#define FKT_IO 5; +// state information in bWriteState and bReadState +#define STATE_IN 0x01; +#define STATE_WAIT 0x02; +#define STATE_OUT 0x03; +#define STATE_IN_IRQ 0x04; + +/* ------------------------------------------------------------------------------------ */ +/* funcion prototypes */ +/* ------------------------------------------------------------------------------------ */ + +extern short DevOpenDriver ( void); + +extern short DevCloseDriver ( void); + +extern short DevGetBoardInfo ( BOARD_INFO *pvData); + +extern short DevInitBoard ( unsigned short usDevNumber); + +extern short DevExitBoard ( unsigned short usDevNumber); + +extern short DevPutTaskParameter ( unsigned short usDevNumber, + unsigned short usNumber, + unsigned short usSize, + void *pvData); + +extern short DevReset ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long ulTimeout); + +extern short DevPutMessage ( unsigned short usDevNumber, + MSG_STRUC *ptMessage, + unsigned long ulTimeout); + +extern short DevGetMessage ( unsigned short usDevNumber, + unsigned short usSize, + MSG_STRUC *ptMessage, + unsigned long ulTimeout); + +extern short DevGetTaskState ( unsigned short usDevNumber, + unsigned short usNumber, + unsigned short usSize, + void *pvData); + +extern short DevGetMBXState ( unsigned short usDevNumber, + unsigned short *pusDevMBXState, + unsigned short *pusHostMBXState); + +extern short DevTriggerWatchDog ( unsigned short usDevNumber, + unsigned short usFunction, + unsigned short *usDevWatchDog); + +extern short DevGetInfo ( unsigned short usDevNumber, + unsigned short usFunction, + unsigned short usSize, + void *pvData); + +extern short DevGetTaskParameter ( unsigned short usDevNumber, + unsigned short usNumber, + unsigned short usSize, + void *pvData); + +extern short DevExchangeIO ( unsigned short usDevNumber, + unsigned short usSendOffset, + unsigned short usSendSize, + void *pvSendData, + unsigned short usReceiveOffset, + unsigned short usReceiveSize, + void *pvReceiveData, + unsigned long ulTimeout); + +extern short DevReadSendData ( unsigned short usDevNumber, + unsigned short usOffset, + unsigned short usSize, + void *pvData); + +extern short DevSetHostState ( unsigned short usDevNumber, + unsigned short usMode, + unsigned long ulTimeout); + +extern short DevExtendedData ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usSize, + void *pvData); + +extern short DevGetMBXData ( unsigned short usDevNumber, + unsigned short usHostSize, + void *pvHostData, + unsigned short usDevSize, + void *pvDevData); + +extern short DevGetBoardInfoEx ( void *pvData); + +extern short DevExchangeIOEx ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usSendOffset, + unsigned short usSendSize, + void *pvSendData, + unsigned short usReceiveOffset, + unsigned short usReceiveSize, + void *pvReceiveData, + unsigned long ulTimeout); + +extern short DevExchangeIOErr ( unsigned short usDevNumber, + unsigned short usSendOffset, + unsigned short usSendSize, + void *pvSendData, + unsigned short usReceiveOffset, + unsigned short usReceiveSize, + void *pvReceiveData, + COMSTATE *ptState, + unsigned long ulTimeout); + +extern short DevReadWriteDPMRaw ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usOffset, + unsigned short usSize, + void *pvData); + +extern short DevSpecialControl ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short *pusCtrlAck); + +extern short DevDownload ( unsigned short usDevNumber, + unsigned short usMode, + unsigned char *pszFileName, + unsigned long *pdwBytes); + +extern short DevReadWriteDPMData ( unsigned short usDevNumber, + unsigned short usMode, + unsigned short usOffset, + unsigned short usSize, + void *pvData); + +extern short DevSetOpMode ( unsigned short usBoard, + unsigned short usMode , + unsigned short *usIrq ); + +//#ifdef __cplusplus +//} +//#endif + +#endif // ifndef CIFUSER_H_INCLUDED diff --git a/libs/pvb/include/rllib/defines.h b/libs/pvb/include/rllib/defines.h new file mode 100644 index 0000000..3ca87f6 --- /dev/null +++ b/libs/pvb/include/rllib/defines.h @@ -0,0 +1,16 @@ +/* prevent multiple inclusion */ +#ifndef DRVSUDEF_H_INCLUDED + #define DRVSUDEF_H_INCLUDED + +/* Device state flags */ +#define DRV_OPEN 0x8000 +#define DEV_INIT 0x0100 +#define DEV_INFO 0x0200 +#define DEV_INFO_FI 0x0400 +#define HOST_RDY 0x0800 +#define BOARD_0 0x0001 +#define BOARD_1 0x0002 +#define BOARD_2 0x0004 +#define BOARD_3 0x0008 + +#endif // DRVSUDEF_H_INCLUDED diff --git a/libs/pvb/include/rllib/log.h b/libs/pvb/include/rllib/log.h new file mode 100644 index 0000000..87ea4ad --- /dev/null +++ b/libs/pvb/include/rllib/log.h @@ -0,0 +1,13 @@ +#ifndef log__ +#define log__ +#define LOG1(x) fprintf(stderr,x) +#define LOG2(x,y) fprintf(stderr,x,y) +#define LOG3(a,b,c) fprintf(stderr,a,b,c) +#define LOG4(a,b,c,d) fprintf(stderr,a,b,c,d) +#define LOG5(a,b,c,d,e) fprintf(stderr,a,b,c,d,e) +#define FLUSH fflush(stderr) + +#define LOG_1(a) fprintf(stderr,a) +#define LOG_2(a,b) fprintf(stderr,a,b) + +#endif diff --git a/libs/pvb/include/rllib/nodave.h b/libs/pvb/include/rllib/nodave.h new file mode 100644 index 0000000..6a56330 --- /dev/null +++ b/libs/pvb/include/rllib/nodave.h @@ -0,0 +1,837 @@ +/* + Part of Libnodave, a free communication libray for Siemens S7 200/300/400 via + the MPI adapter 6ES7 972-0CA22-0XAC + or MPI adapter 6ES7 972-0CA23-0XAC + or TS adapter 6ES7 972-0CA33-0XAC + or MPI adapter 6ES7 972-0CA11-0XAC, + IBH-NetLink or CPs 243, 343 and 443 + + (C) Thomas Hergenhahn (thomas.hergenhahn@web.de) 2002..2004 + + Libnodave is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Libnodave is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Libnodave; see the file COPYING. If not, write to + the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef CPLUSPLUS +extern "C" { +#endif + +#ifndef __nodave +#define __nodave + +#ifdef LINUX +#define DECL2 +#define EXPORTSPEC +typedef struct { + int rfd; + int wfd; +} _daveOSserialType; +#include +#else +#ifdef CYGWIN +typedef struct { + int rfd; + int wfd; +} _daveOSserialType; +#include +#else +#ifdef BCCWIN +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +//#define DECL2 WINAPI +#define DECL2 +#define EXPORTSPEC +/* + #ifdef DOEXPORT + #define EXPORTSPEC __declspec (dllexport) + #else + #define EXPORTSPEC __declspec (dllimport) + #endif +*/ +typedef struct { + HANDLE rfd; + HANDLE wfd; +} _daveOSserialType; +#else +#error Fill in what you need for your OS or API. +#endif +#endif +#endif + +/* + Define this if your system doesn't have byteswap.h or if you experience difficulties with + the inline functions +*/ + +/* this is now done in the Makefile: */ +/* #define LINUX */ + +/* #include "log.h" */ +/* + some frequently used ASCII control codes: +*/ +#define DLE 0x10 +#define ETX 0x03 +#define STX 0x02 +#define SYN 0x16 +#define NAK 0x15 +/* + Protocol types to be used with newInterface: +*/ +#define daveProtoMPI 0 /* MPI for S7 300/400 */ +#define daveProtoMPI2 1 /* MPI for S7 300/400, "Andrew's version" */ +#define daveProtoMPI3 2 /* MPI for S7 300/400, Step 7 Version, not yet implemented */ +#define daveProtoPPI 10 /* PPI for S7 200 */ + +#define daveProtoISOTCP 122 /* ISO over TCP */ +#define daveProtoISOTCP243 123 /* ISO over TCP with CP243 */ + +#define daveProtoMPI_IBH 223 /* MPI with IBH NetLink MPI to ethernet gateway */ +#define daveProtoPPI_IBH 224 /* PPI with IBH NetLink PPI to ethernet gateway */ + +/* + * ProfiBus speed constants: +*/ +#define daveSpeed9k 0 +#define daveSpeed19k 1 +#define daveSpeed187k 2 +#define daveSpeed500k 3 +#define daveSpeed1500k 4 +#define daveSpeed45k 5 +#define daveSpeed93k 6 + +/* + Some MPI function codes (yet unused ones may be incorrect). +*/ +#define daveFuncOpenS7Connection 0xF0 +#define daveFuncRead 0x04 +#define daveFuncWrite 0x05 +#define daveFuncStartUpload 0x1D +#define daveFuncUpload 0x1E +#define daveFuncEndUpload 0x1F +/* + S7 specific constants: +*/ +#define daveBlockType_OB '8' +#define daveBlockType_DB 'A' +#define daveBlockType_SDB 'B' +#define daveBlockType_FC 'C' +#define daveBlockType_SFC 'D' +#define daveBlockType_FB 'E' +#define daveBlockType_SFB 'F' +/* + Use these constants for parameter "area" in daveReadBytes and daveWriteBytes +*/ +#define daveSysInfo 0x3 /* System info of 200 family */ +#define daveSysFlags 0x5 /* System flags of 200 family */ +#define daveAnaIn 0x6 /* analog inputs of 200 family */ +#define daveAnaOut 0x7 /* analog outputs of 200 family */ + +#define daveInputs 0x81 +#define daveOutputs 0x82 +#define daveFlags 0x83 +#define daveDB 0x84 /* data blocks */ +#define daveDI 0x85 /* not tested */ +#define daveLocal 0x86 /* not tested */ +#define daveV 0x87 /* don't know what it is */ +#define daveCounter 28 +#define daveTimer 29 +#define daveCounter200 30 +#define daveTimer200 31 + +/** + Library specific: +**/ +/* + Result codes. Genarally, 0 means ok, + >0 are results (also errors) reported by the PLC + <0 means error reported by library code. +*/ +#define daveResOK 0 /* means all ok */ +#define daveResMultipleBitsNotSupported 6 /* CPU tells it does not support to read a bit block with a */ + /* length other than 1 bit. */ +#define daveResItemNotAvailable200 3 /* means a a piece of data is not available in the CPU, e.g. */ + /* when trying to read a non existing DB or bit bloc of length<>1 */ + /* This code seems to be specific to 200 family. */ + +#define daveResItemNotAvailable 10 /* means a a piece of data is not available in the CPU, e.g. */ + /* when trying to read a non existing DB */ + +#define daveAddressOutOfRange 5 /* means the data address is beyond the CPUs address range */ +#define daveWriteDataSizeMismatch 7 /* means the write data size doesn't fit item size */ +#define daveResCannotEvaluatePDU -123 +#define daveResCPUNoData -124 +#define daveUnknownError -125 +#define daveEmptyResultError -126 +#define daveEmptyResultSetError -127 +/* + error code to message string conversion: + Call this function to get an explanation for error codes returned by other functions. +*/ +EXPORTSPEC char * DECL2 daveStrerror(int code); + +/* + Max number of bytes in a single message. + An upper limit for MPI over serial is: + 8 transport header + +2*240 max PDU len *2 if every character were a DLE + +3 DLE,ETX and BCC + = 491 + + Later I saw some programs offering up to 960 bytes in PDU size negotiation + + Max number of bytes in a single message. + An upper limit for MPI over serial is: + 8 transport header + +2*960 max PDU len *2 if every character were a DLE + +3 DLE,ETX and BCC + = 1931 + + For now, we take the rounded max of all this to determine our buffer size. This is ok + for PC systems, where one k less or more doesn't matter. +*/ +#define daveMaxRawLen 2048 +/* + Some definitions for debugging: +*/ +#define daveDebugRawRead 0x01 /* Show the single bytes received */ +#define daveDebugSpecialChars 0x02 /* Show when special chars are read */ +#define daveDebugRawWrite 0x04 /* Show the single bytes written */ +#define daveDebugListReachables 0x08 /* Show the steps when determine devices in MPI net */ +#define daveDebugInitAdapter 0x10 /* Show the steps when Initilizing the MPI adapter */ +#define daveDebugConnect 0x20 /* Show the steps when connecting a PLC */ +#define daveDebugPacket 0x40 +#define daveDebugByte 0x80 +#define daveDebugCompare 0x100 +#define daveDebugExchange 0x200 +#define daveDebugPDU 0x400 /* debug PDU handling */ +#define daveDebugUpload 0x800 /* debug PDU loading program blocks from PLC */ +#define daveDebugMPI 0x1000 +#define daveDebugPrintErrors 0x2000 /* Print error messages */ +#define daveDebugPassive 0x4000 + + +#define daveDebugAll 0xffff +/* + IBH-NetLink packet types: +*/ +#define _davePtEmpty -2 +#define _davePtMPIAck -3 +#define _davePtUnknownMPIFunc -4 +#define _davePtUnknownPDUFunc -5 +#define _davePtReadResponse 1 +#define _davePtWriteResponse 2 + + +extern EXPORTSPEC int daveDebug; + +EXPORTSPEC void DECL2 setDebug(int nDebug); +/* + Some data types: +*/ +#define uc unsigned char +#define us unsigned short +#define u32 unsigned int + +/* + This is a wrapper for the serial or ethernet interface. This is here to make porting easier. +*/ + +typedef struct _daveConnection daveConnection; +typedef struct _daveInterface daveInterface; + +/* + Helper struct to manage PDUs. This is NOT the part of the packet I would call PDU, but + a set of pointers that ease access to the "private parts" of a PDU. +*/ +typedef struct { + uc * header; /* pointer to start of PDU (PDU header) */ + uc * param; /* pointer to start of parameters inside PDU */ + uc * data; /* pointer to start of data inside PDU */ + uc * udata; /* pointer to start of data inside PDU */ + int hlen; /* header length */ + int plen; /* parameter length */ + int dlen; /* data length */ + int udlen; /* user or result data length */ +} PDU; + +/* + Definitions of prototypes for the protocol specific functions. The library "switches" + protocol by setting pointers to the protol specific implementations. +*/ +typedef int (*_initAdapterFunc) (); +typedef int (*_connectPLCFunc) (); +typedef int (*_disconnectPLCFunc) (); +typedef int (*_disconnectAdapterFunc) (); +typedef int (*_exchangeFunc) (daveConnection *, PDU *); +typedef int (*_sendMessageFunc) (daveConnection *, PDU *); +typedef int (*_getResponseFunc) (daveConnection *); +typedef int (*_listReachablePartnersFunc) (daveInterface * di, char * buf); + +/* + This groups an interface together with some information about it's properties + in the library's context. +*/ +struct _daveInterface { + _daveOSserialType fd; /* some handle for the serial interface */ + int users; /* a counter used when multiple PLCs are accessed via */ + /* the same serial interface and adapter. */ + int localMPI; /* the adapter's MPI address */ + char * name; /* just a name that can be used in programs dealing with multiple */ + /* daveInterfaces */ + int timeout; /* Timeout in microseconds used in transort. */ + int protocol; /* The kind of transport protocol used on this interface. */ + int speed; /* The MPI or Profibus speed */ + int ackPos; /* position of some packet number that has to be repeated in ackknowledges */ + int nextConnection; + _initAdapterFunc initAdapter; /* pointers to the protocol */ + _connectPLCFunc connectPLC; /* specific implementations */ + _disconnectPLCFunc disconnectPLC; /* of these functions */ + _disconnectAdapterFunc disconnectAdapter; + _exchangeFunc exchange; + _sendMessageFunc sendMessage; + _getResponseFunc getResponse; + _listReachablePartnersFunc listReachablePartners; +}; + +EXPORTSPEC +daveInterface * DECL2 daveNewInterface(_daveOSserialType nfd, char * nname, int localMPI, int protocol, int speed); + +/* + This is the packet header used by IBH ethernet NetLink. +*/ +typedef struct { + uc ch1; // logical connection or channel ? + uc ch2; // logical connection or channel ? + uc len; // number of bytes counted from the ninth one. + uc packetNumber; // a counter, response packets refer to request packets + us sFlags; // my guess + us rFlags; // my interpretation +} IBHpacket; + +/* + Header for MPI packets on IBH-NetLink: +*/ + +typedef struct { + uc src_conn; + uc dst_conn; + uc MPI; + uc localMPI; + uc len; + uc func; + uc packetNumber; +} MPIheader; + +typedef struct { + uc src_conn; + uc dst_conn; + uc MPI; + uc xxx1; + uc xxx2; + uc xx22; + uc len; + uc func; + uc packetNumber; +} MPIheader2; + + +/* + This holds data for a PLC connection; +*/ + +struct _daveConnection { + daveInterface * iface; /* pointer to used interface */ + int MPIAdr; /* The PLC's address */ + int messageNumber; /* current message number */ + int needAckNumber; /* message number we need ackknowledge for */ + int AnswLen; /* length of last message */ + PDU rcvdPDU; + MPIheader templ; /* template of MPI Header, setup once, copied in and then modified */ + uc msgIn[daveMaxRawLen]; + uc msgOut[daveMaxRawLen]; + uc * resultPointer; /* used to retrieve single values from the result byte array */ + uc * _resultPointer; + int PDUstartO; /* position of PDU in outgoing messages. This is different for different transport methodes. */ + int PDUstartI; /* position of PDU in incoming messages. This is different for different transport methodes. */ + int rack; /* rack number for ISO over TCP */ + int slot; /* slot number for ISO over TCP */ + int maxPDUlength; + int connectionNumber; + int connectionNumber2; + uc packetNumber; /* packetNumber in transport layer */ +}; + +/* + Setup a new connection structure using an initialized + daveInterface and PLC's MPI address. +*/ +EXPORTSPEC +daveConnection * DECL2 daveNewConnection(daveInterface * di, int MPI,int rack, int slot); + + +typedef struct { + uc type[2]; + unsigned short count; +} daveBlockTypeEntry; + +typedef struct { + unsigned short number; + uc type[2]; +} daveBlockEntry; + +typedef struct { + uc type[2]; + uc x1[2]; /* 00 4A */ + uc w1[2]; /* some word var? */ + char pp[2]; /* allways 'pp' */ + uc x2[4]; /* 00 4A */ + unsigned short number; /* the block's number */ + uc x3[26]; /* ? */ + unsigned short length; /* the block's length */ + uc x4[16]; + uc name[8]; + uc x5[12]; +} daveBlockInfo; +/** + PDU handling: + PDU is the central structure present in S7 communication. + It is composed of a 10 or 12 byte header,a parameter block and a data block. + When reading or writing values, the data field is itself composed of a data + header followed by payload data +**/ +typedef struct { + uc P; /* allways 0x32 */ + uc type; /* Header type, one of 1,2,3 or 7. type 2 and 3 headers are two bytes longer. */ + uc a,b; /* currently unknown. Maybe it can be used for long numbers? */ + us number; /* A number. This can be used to make sure a received answer */ + /* corresponds to the request with the same number. */ + us plen; /* length of parameters which follow this header */ + us dlen; /* length of data which follow the parameters */ + uc result[2]; /* only present in type 2 and 3 headers. This contains error information. */ +} PDUHeader; +/* + set up the header. Needs valid header pointer in the struct p points to. +*/ +EXPORTSPEC void DECL2 _daveInitPDUheader(PDU * p, int type); +/* + add parameters after header, adjust pointer to data. + needs valid header +*/ +EXPORTSPEC void DECL2 _daveAddParam(PDU * p,uc * param,us len); +/* + add data after parameters, set dlen + needs valid header,and valid parameters. +*/ +EXPORTSPEC void DECL2 _daveAddData(PDU * p,void * data,int len); +/* + add values after value header in data, adjust dlen and data count. + needs valid header,parameters,data,dlen +*/ +EXPORTSPEC void DECL2 _daveAddValue(PDU * p,void * data,int len); +/* + add data in user data. Add a user data header, if not yet present. +*/ +EXPORTSPEC void DECL2 _daveAddUserData(PDU * p, uc * da, int len); +/* + set up pointers to the fields of a received message +*/ +EXPORTSPEC int DECL2 _daveSetupReceivedPDU(daveConnection * dc,PDU * p); +/* + Get the eror code from a PDU, if one. +*/ +EXPORTSPEC int DECL2 daveGetPDUerror(PDU * p); +/* + send PDU to PLC and retrieve the answer +*/ +EXPORTSPEC int DECL2 _daveExchange(daveConnection * dc,PDU *p); +/* + retrieve the answer +*/ +EXPORTSPEC int DECL2 daveGetResponse(daveConnection * dc); +/* + send PDU to PLC +*/ +EXPORTSPEC int DECL2 daveSendMessage(daveConnection * dc, PDU * p); + +/****** + + Utilities: + +****/ +/* + Hex dump PDU: +*/ +EXPORTSPEC void DECL2 _daveDumpPDU(PDU * p); + +/* + This is an extended memory compare routine. It can handle don't care and stop flags + in the sample data. A stop flag lets it return success, if there were no mismatches + up to this point. +*/ +EXPORTSPEC int DECL2 _daveMemcmp(us * a, uc *b, size_t len); + +/* + Hex dump. Write the name followed by len bytes written in hex and a newline: +*/ +EXPORTSPEC void DECL2 _daveDump(char * name,uc*b,int len); + +/* + name Objects: +*/ +EXPORTSPEC char * DECL2 daveBlockName(uc bn); +EXPORTSPEC char * DECL2 daveAreaName(uc n); + +/* + Data conversion convenience functions: +*/ + +EXPORTSPEC int DECL2 daveGetByte(daveConnection * dc); + +EXPORTSPEC float DECL2 daveGetFloat(daveConnection * dc); + +EXPORTSPEC int DECL2 daveGetInteger(daveConnection * dc); + +EXPORTSPEC unsigned int DECL2 daveGetDWORD(daveConnection * dc); + +EXPORTSPEC unsigned int DECL2 daveGetUnsignedInteger(daveConnection * dc); + +EXPORTSPEC unsigned int DECL2 daveGetWORD(daveConnection * dc); + +EXPORTSPEC int DECL2 daveGetByteat(daveConnection * dc, int pos); + +EXPORTSPEC unsigned int DECL2 daveGetWORDat(daveConnection * dc, int pos); + +EXPORTSPEC unsigned int DECL2 daveGetDWORDat(daveConnection * dc, int pos); + +EXPORTSPEC float DECL2 daveGetFloatat(daveConnection * dc, int pos); + +/* +int daveGetBytesLeft(daveConnection * dc) { + return ( dc->AnswLen-(int)(dc->resultPointer)+(int)(dc->rcvdPDU.data)); +} +*/ +EXPORTSPEC float DECL2 toPLCfloat(float ff); + +EXPORTSPEC short DECL2 bswap_16(short ff); + +EXPORTSPEC int DECL2 bswap_32(int ff); + +/** + Newer conversion routines. As the terms WORD, INT, INTEGER etc have different meanings + for users of different programming languages and compilers, I choose to provide a new + set of conversion routines named according to the bit length of the value used. The 'U' + or 'S' stands for unsigned or signed. +**/ +/* + Get a value from the position b points to. B is typically a pointer to a buffer that has + been filled with daveReadBytes: +*/ +EXPORTSPEC int DECL2 daveGetS8from(uc *b); +EXPORTSPEC int DECL2 daveGetU8from(uc *b); +EXPORTSPEC int DECL2 daveGetS16from(uc *b); +EXPORTSPEC int DECL2 daveGetU16from(uc *b); +EXPORTSPEC int DECL2 daveGetS32from(uc *b); +EXPORTSPEC unsigned int DECL2 daveGetU32from(uc *b); +EXPORTSPEC float DECL2 daveGetFloatfrom(uc *b); +/* + Get a value from the current position in the last result read on the connection dc. + This will increment an internal pointer, so the next value is read from the position + following this value. +*/ +EXPORTSPEC int DECL2 daveGetS8(daveConnection * dc); +EXPORTSPEC int DECL2 daveGetU8(daveConnection * dc); +EXPORTSPEC int DECL2 daveGetS16(daveConnection * dc); +EXPORTSPEC int DECL2 daveGetU16(daveConnection * dc); +EXPORTSPEC int DECL2 daveGetS32(daveConnection * dc); +EXPORTSPEC unsigned int DECL2 daveGetU32(daveConnection * dc); +/* + Get a value from a given position in the last result read on the connection dc. +*/ +EXPORTSPEC int DECL2 daveGetS8at(daveConnection * dc, int pos); +EXPORTSPEC int DECL2 daveGetU8at(daveConnection * dc, int pos); +EXPORTSPEC int DECL2 daveGetS16at(daveConnection * dc, int pos); +EXPORTSPEC int DECL2 daveGetU16at(daveConnection * dc, int pos); +EXPORTSPEC int DECL2 daveGetS32at(daveConnection * dc, int pos); +EXPORTSPEC unsigned int DECL2 daveGetU32at(daveConnection * dc, int pos); +/* + put one byte into buffer b: +*/ +EXPORTSPEC uc * DECL2 davePut8(uc *b,int v); +EXPORTSPEC uc * DECL2 davePut16(uc *b,int v); +EXPORTSPEC uc * DECL2 davePut32(uc *b,int v); +EXPORTSPEC uc * DECL2 davePutFloat(uc *b,float v); +EXPORTSPEC void DECL2 davePut8at(uc *b, int pos, int v); +EXPORTSPEC void DECL2 davePut16at(uc *b, int pos, int v); +EXPORTSPEC void DECL2 davePut32at(uc *b, int pos, int v); +EXPORTSPEC void DECL2 davePutFloatat(uc *b,int pos, float v); +/** + Timer and Counter conversion functions: +**/ +/* + get time in seconds from current read position: +*/ +EXPORTSPEC float DECL2 daveGetSeconds(daveConnection * dc); +/* + get time in seconds from random position: +*/ +EXPORTSPEC float DECL2 daveGetSecondsAt(daveConnection * dc, int pos); +/* + get counter value from current read position: +*/ +EXPORTSPEC int DECL2 daveGetCounterValue(daveConnection * dc); +/* + get counter value from random read position: +*/ +EXPORTSPEC int DECL2 daveGetCounterValueAt(daveConnection * dc,int pos); + +/* + Functions to load blocks from PLC: +*/ +EXPORTSPEC void DECL2 _daveConstructUpload(PDU *p,char blockType, int blockNr); + +EXPORTSPEC void DECL2 _daveConstructDoUpload(PDU * p, int uploadID); + +EXPORTSPEC void DECL2 _daveConstructEndUpload(PDU * p, int uploadID); +/* + Get the PLC's order code as ASCIIZ. Buf must provide space for + 21 characters at least. +*/ + +#define daveOrderCodeSize 21 +EXPORTSPEC int DECL2 daveGetOrderCode(daveConnection * dc,char * buf); +/* + connect to a PLC. returns 0 on success. +*/ + +EXPORTSPEC int DECL2 daveConnectPLC(daveConnection * dc); +/* + Read len bytes from the PLC. Start determines the first byte. + Area denotes whether the data comes from FLAGS, DATA BLOCKS, + INPUTS or OUTPUTS. The reading and writing of other data + like timers and counters is not supported. + DB is the number of the data block to be used. Set it to zero + for other area types. + Buffer is a pointer to a memory block provided by the calling + program. If the pointer is not NULL, the result data will be copied thereto. + Hence it must be big enough to take up the result. + In any case, you can also retrieve the result data using the get macros + on the connection pointer. + + FIXME: Existence of DB is not checked. + There is no error message for nonexistent data blocks. + There is no check for max. message len or + automatic splitting into multiple messages. +*/ + +EXPORTSPEC int DECL2 daveReadBytes(daveConnection * dc, int area, int DB, int start, int len, void * buffer); +/* + Write len bytes from buffer to the PLC. + Start determines the first byte. + Area denotes whether the data goes to FLAGS, DATA BLOCKS, + INPUTS or OUTPUTS. The writing of other data + like timers and counters is not supported. + DB is the number of the data block to be used. Set it to zero + for other area types. + FIXME: Existence of DB is not checked. + There is no error message for nonexistent data blocks. + There is no check for max. message len or + automatic splitting into multiple messages. +*/ +EXPORTSPEC int DECL2 daveWriteBytes(daveConnection * dc,int area, int DB, int start, int len, void * buffer); + +/* + Bit manipulation: +*/ +EXPORTSPEC int DECL2 daveReadBits(daveConnection * dc, int area, int DB, int start, int len, void * buffer); +EXPORTSPEC int DECL2 daveWriteBits(daveConnection * dc,int area, int DB, int start, int len, void * buffer); +/* + PLC diagnostic and inventory functions: +*/ +EXPORTSPEC int DECL2 daveReadSZL(daveConnection * dc, int ID, int index, void * buf); +EXPORTSPEC int DECL2 daveListBlocksOfType(daveConnection * dc,uc type,daveBlockEntry * buf); +EXPORTSPEC int DECL2 daveListBlocks(daveConnection * dc,daveBlockTypeEntry * buf); +/* + PLC program read functions: +*/ +EXPORTSPEC int DECL2 initUpload(daveConnection * dc,char blockType, int blockNr, int * uploadID); +EXPORTSPEC int DECL2 doUpload(daveConnection*dc, int * more, uc**buffer, int*len, int uploadID); +EXPORTSPEC int DECL2 endUpload(daveConnection*dc, int uploadID); + +EXPORTSPEC int DECL2 daveStop(daveConnection*dc); +EXPORTSPEC int DECL2 daveStart(daveConnection*dc); + +/* + Multiple variable support: +*/ +typedef struct { + int error; + int length; + uc * bytes; +} daveResult; + +typedef struct { + int numResults; + daveResult * results; +} daveResultSet; + + +/* use this to initialize a multivariable read: */ +EXPORTSPEC void DECL2 davePrepareReadRequest(daveConnection * dc, PDU *p); +/* Adds a new variable to a prepared request: */ +EXPORTSPEC void DECL2 daveAddVarToReadRequest(PDU *p, int area, int DBnum, int start, int bytes); +/* Executes the complete request. */ +EXPORTSPEC int DECL2 daveExecReadRequest(daveConnection * dc, PDU *p, daveResultSet * rl); +/* Lets the functions daveGet work on the n-th result: */ +EXPORTSPEC int DECL2 daveUseResult(daveConnection * dc, daveResultSet rl, int n); +/* Frees the memory occupied by the result structure */ +EXPORTSPEC void DECL2 daveFreeResults(daveResultSet * rl); +/* Adds a new bit variable to a prepared request: */ +EXPORTSPEC void DECL2 daveAddBitVarToReadRequest(PDU *p, int area, int DBnum, int start, int byteCount); + +/* use this to initialize a multivariable write: */ +EXPORTSPEC void DECL2 davePrepareWriteRequest(daveConnection * dc, PDU *p); +/* Adds a new variable to a prepared request: */ +EXPORTSPEC void DECL2 daveAddVarToWriteRequest(PDU *p, int area, int DBnum, int start, int bytes, void * buffer); +/* Adds a new bit variable to a prepared write request: */ +EXPORTSPEC void DECL2 daveAddBitVarToWriteRequest(PDU *p, int area, int DBnum, int start, int byteCount, void * buffer); +/* Executes the complete request. */ +EXPORTSPEC int DECL2 daveExecWriteRequest(daveConnection * dc, PDU *p, daveResultSet * rl); + + +EXPORTSPEC int DECL2 daveInitAdapter(daveInterface * di); +EXPORTSPEC int DECL2 daveConnectPLC(daveConnection * dc); +EXPORTSPEC int DECL2 daveDisconnectPLC(daveConnection * dc); + +EXPORTSPEC int DECL2 daveDisconnectAdapter(daveInterface * di); +EXPORTSPEC int DECL2 daveListReachablePartners(daveInterface * di,char * buf); + +EXPORTSPEC int DECL2 _daveReturnOkDummy(void * dummy); +EXPORTSPEC int DECL2 _daveListReachablePartnersDummy(daveInterface * di,char * buf); + +EXPORTSPEC int DECL2 _daveNegPDUlengthRequest(daveConnection * dc, PDU *p); + +/* MPI specific functions */ + +#define daveMPIReachable 0x30 +#define daveMPIunused 0x10 +#define davePartnerListSize 126 + +EXPORTSPEC int DECL2 _daveListReachablePartnersMPI(daveInterface * di,char * buf); +EXPORTSPEC int DECL2 _daveInitAdapterMPI1(daveInterface * di); +EXPORTSPEC int DECL2 _daveInitAdapterMPI2(daveInterface * di); +EXPORTSPEC int DECL2 _daveConnectPLCMPI1(daveConnection * dc); +EXPORTSPEC int DECL2 _daveConnectPLCMPI2(daveConnection * dc); +EXPORTSPEC int DECL2 _daveDisconnectPLCMPI(daveConnection * dc); +EXPORTSPEC int DECL2 _daveDisconnectAdapterMPI(daveInterface * di); +EXPORTSPEC int DECL2 _daveExchangeMPI(daveConnection * dc,PDU * p1); + +EXPORTSPEC int DECL2 _daveListReachablePartnersMPI3(daveInterface * di,char * buf); +EXPORTSPEC int DECL2 _daveInitAdapterMPI3(daveInterface * di); +EXPORTSPEC int DECL2 _daveConnectPLCMPI3(daveConnection * dc); +EXPORTSPEC int DECL2 _daveDisconnectPLCMPI3(daveConnection * dc); +EXPORTSPEC int DECL2 _daveDisconnectAdapterMPI3(daveInterface * di); +EXPORTSPEC int DECL2 _daveExchangeMPI3(daveConnection * dc,PDU * p1); + +/* ISO over TCP specific functions */ +EXPORTSPEC int DECL2 _daveExchangeTCP(daveConnection * dc,PDU * p1); +EXPORTSPEC int DECL2 _daveConnectPLCTCP(daveConnection * dc); +/* + make internal PPI functions available for experimental use: +*/ +EXPORTSPEC int DECL2 _daveExchangePPI(daveConnection * dc,PDU * p1); +EXPORTSPEC void DECL2 _daveSendLength(daveInterface * di, int len); +EXPORTSPEC void DECL2 _daveSendRequestData(daveConnection * dc, int alt); +EXPORTSPEC void DECL2 _daveSendIt(daveInterface * di, uc * b, int size); +EXPORTSPEC int DECL2 _daveGetResponsePPI(daveConnection *dc); +EXPORTSPEC int DECL2 _daveReadChars(daveInterface * di, uc *b, int tmo, int max); +EXPORTSPEC int DECL2 _daveConnectPLCPPI(daveConnection * dc); + +/* + make internal MPI functions available for experimental use: +*/ +EXPORTSPEC int DECL2 _daveReadMPI(daveInterface * di, uc *b); +EXPORTSPEC void DECL2 _daveSendSingle(daveInterface * di, uc c); +EXPORTSPEC int DECL2 _daveSendAck(daveConnection * dc, int nr); +EXPORTSPEC int DECL2 _daveGetAck(daveInterface*di, int nr); +EXPORTSPEC int DECL2 _daveSendDialog2(daveConnection * dc, int size); +EXPORTSPEC int DECL2 _daveSendWithPrefix(daveConnection * dc, uc * b, int size); +EXPORTSPEC int DECL2 _daveSendWithPrefix2(daveConnection * dc, int size); +EXPORTSPEC int DECL2 _daveSendWithCRC(daveInterface * di, uc *b, int size); +EXPORTSPEC int DECL2 _daveReadSingle(daveInterface * di); +EXPORTSPEC int DECL2 _daveReadOne(daveInterface * di, uc *b); +EXPORTSPEC int DECL2 _daveReadMPI2(daveInterface * di, uc *b); +EXPORTSPEC int DECL2 _daveGetResponseMPI(daveConnection *dc); +EXPORTSPEC int DECL2 _daveSendMessageMPI(daveConnection * dc, PDU * p); + +/* + make internal ISO_TCP functions available for experimental use: +*/ +/* + Read one complete packet. The bytes 3 and 4 contain length information. +*/ +EXPORTSPEC int DECL2 _daveReadISOPacket(daveInterface * di,uc *b); +EXPORTSPEC int DECL2 _daveGetResponseISO_TCP(daveConnection *dc); + + +typedef uc * (*userReadFunc) (int , int, int, int, int *); +typedef void (*userWriteFunc) (int , int, int, int, int *,uc *); +extern userReadFunc readCallBack; +extern userWriteFunc writeCallBack; + +void _daveConstructReadResponse(PDU * p); +void _daveConstructWriteResponse(PDU * p); +void _daveConstructBadReadResponse(PDU * p); +void _daveHandleRead(PDU * p1,PDU * p2); +EXPORTSPEC void _daveHandleWrite(PDU * p1,PDU * p2); +/* + make internal IBH functions available for experimental use: +*/ +EXPORTSPEC int DECL2 _daveReadIBHPacket(daveInterface * di,uc *b); +EXPORTSPEC int DECL2 _daveWriteIBH(daveInterface * di, void * buffer, int len); +EXPORTSPEC int DECL2 _davePackPDU(daveConnection * dc,PDU *p); +EXPORTSPEC void DECL2 _daveSendIBHNetAck(daveConnection * dc); +EXPORTSPEC int DECL2 _daveExchangeIBH(daveConnection * dc, PDU * p); +EXPORTSPEC int DECL2 _daveConnectPLC_IBH(daveConnection*dc); +EXPORTSPEC int DECL2 _daveDisconnectPLC_IBH(daveConnection*dc); +EXPORTSPEC void DECL2 _daveSendMPIAck2(daveConnection *dc); +EXPORTSPEC int DECL2 _daveGetResponseMPI_IBH(daveConnection *dc); +EXPORTSPEC int DECL2 _daveSendMessageMPI_IBH(daveConnection * dc, PDU * p); +EXPORTSPEC int DECL2 _daveListReachablePartnersMPI_IBH(daveInterface *di, char * buf); + +#endif /* _nodave */ + +#ifdef CPLUSPLUS + } +#endif + + +/* + Changes: + 07/19/04 added the definition of daveExchange(). + 09/09/04 applied patch for variable Profibus speed from Andrew Rostovtsew. + 09/09/04 applied patch from Bryan D. Payne to make this compile under Cygwin and/or newer gcc. + 12/09/04 added daveReadBits(), daveWriteBits() + 12/09/04 added some more comments. + 12/09/04 changed declaration of _daveMemcmp to use typed pointers. + 01/15/04 generic getResponse, more internal functions, use a single dummy to replace + initAdapterDummy, + 01/26/05 replaced _daveConstructReadRequest by the sequence prepareReadRequest, addVarToReadRequest + 01/26/05 added multiple write + 02/02/05 added readIBHpacket + 02/06/05 replaced _daveConstructBitWriteRequest by the sequence prepareWriteRequest, addBitVarToWriteRequest + 02/08/05 removed inline functions. +*/ diff --git a/libs/pvb/include/rllib/nvr_user.h b/libs/pvb/include/rllib/nvr_user.h new file mode 100644 index 0000000..3e92289 --- /dev/null +++ b/libs/pvb/include/rllib/nvr_user.h @@ -0,0 +1,76 @@ +/* ******************************************************************* + + FILENAME : NVR_USER.H + + ------------------------------------------------------------------------- + CREATED BY : R. Mayer, Hilscher GmbH + CREATED AT : 29.05.96 + PROJECT : NVR + ========================================================================= + + FUNCTION : + User interface NVR protocol + + ========================================================================= + + CHANGES OF REVISIONS : + + Version Name Date Change + ------------------------------------------------------------------------- + + V1.000 Mayer 29.05.96 Created + + ******************************************************************** */ + +#if defined( _MSC_VER) /* Microsoft C */ + #pragma pack(1) /* Byte Alignment */ +#endif + +/* ======================================================================== */ +/* Protocol definition */ +/* ======================================================================== */ + +#define NVR_MODE_MSB_LSB 0 +#define NVR_MODE_LSB_MSB 1 +#define NVR_MODE_BYTE 2 +#define NVR_MODE_TRANSPARENT 3 + + +/* ======================================================================== */ +/* Protocol parameter structure */ +/* ======================================================================== */ + +typedef struct NVR_PARAMETRtag { + unsigned char bScl; /* Communication line number */ + unsigned char bRtsControl; /* RTS control */ + unsigned char bBaudrate; /* Baudrate */ + unsigned char bDataBits; /* Number of data bits */ + unsigned char bStopBits; /* Number of stop bits */ + unsigned char bParityBit; /* Parity */ + unsigned char bPriority; /* Priority */ + unsigned short usTimeout; /* Timeout */ + unsigned char bReceiveMode; /* Receive mode */ + unsigned char bSendMode; /* Send mode */ + unsigned char bErrorLed; /* Mode of the error LED */ +} NVR_PARAMETER; + +/* ======================================================================== */ +/* Protocol task state structure */ +/* ======================================================================== */ + +typedef struct NVR_STATEtag { + unsigned char bTaskState; /* Task state */ + unsigned long ulTxCount; /* Transmitt telegram count */ + unsigned long ulRxCount; /* Receive telegram count */ + unsigned char bTxRetryCount; /* Number of transmitt retries */ + unsigned char bRxRetryCount; /* Number of receive retries */ + unsigned short usTxErrorCount; /* Transmitt error count */ + unsigned short usRxErrorCount; /* Receive error count */ + unsigned short usErrorBits; /* Error bits */ + unsigned char bError; /* Last error */ +} NVR_STATE; + + +#if defined( _MSC_VER) /* Microsoft C */ + #pragma pack() /* Byte Alignment */ +#endif diff --git a/libs/pvb/include/rllib/objdir.h b/libs/pvb/include/rllib/objdir.h new file mode 100644 index 0000000..d297c62 --- /dev/null +++ b/libs/pvb/include/rllib/objdir.h @@ -0,0 +1,124 @@ +/*************************************************************************** + rlcanopen.cpp - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by Marc Brutigam, Christian Wilmes, R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + + +#ifndef OBJDIR +#define OBJDIR + +#include + using std::cin; + using std::cout; + +#include "rlinifile.h" +#include +#include +#include + +#define ACSII_CODE_CARRIAGE_RETURN 13 + +//! class which handles the object directory of a node +class ObjDir +{ + public: + //! enum contains all values saved in one objdir entry + enum Obj_Parameters{ + OBJNUMBER, + SUBNUMBER, + PARAMETERNAME, + OBJECTTYPE, + DATATYPE, + ACCESSTYPE, + DEFAULTVALUE, + PDOMAPPING + }; + + //! empty constructor not yet implemented + ObjDir(); + + //! nothing to do. QPtrVector Destructor performs memory cleanup. + ~ObjDir(); + + /*! main constructor builds object directory. It recieves a pointer to a + rlIniFile object which is allready initialized with an EDS file. Calls + countobj to resize QPtrVector. Calls extraktobj to extrakt all objects + from an eds-object category (MandatoryObjects or OptionalObjects). */ + ObjDir(rlIniFile* _ini); + + /*! returns a specific parameter identified by _paramtype from an object + directory entry, identified by objectindex and subindex. */ + QString get_objparameter( Obj_Parameters _paramtype, int _obj, int _sub ); + + //! iterates through whole objectdir and returns 1 when given object exists + int OVAdressExists( int _obj, int _sub ); + + private: + /*! this class contains all data of an object diretory entry*/ + class ObjItem + { + public: + /*! constructor initializes item-data */ + ObjItem( QString _objnumber, + QString _subnumber, + QString _parametername, + QString _objecttype, + QString _datatype, + QString _accesstype, + QString _defaultvalue, + QString _pdomapping ): + objnumber (_objnumber), + subnumber (_subnumber), + parametername (_parametername), + objecttype (_objecttype), + datatype (_datatype), + accesstype (_accesstype), + defaultvalue (_defaultvalue), + pdomapping (_pdomapping) {}; + + QString objnumber; + QString subnumber; + QString parametername; + QString objecttype; + QString datatype; + QString accesstype; + QString defaultvalue; + QString pdomapping; + }; + + //! object which manages a dynamic list of all objects in memory + QPtrVector objstorage; + + //! pointer to inifile, previously initialized by cannode object + rlIniFile* ini; + + //! output function for debbuging purposes only + void dout(const char* _str); + + /*! creates a new ObjItem and adds it to the objstorage. iniheadline must + be generated previously from objectindex and subindex number */ + int additem(QString _objname, QString _iniheadline, int _subint); + + /*! iterates through all items of given category. extracts objnames. + iterates through all subindexes of objname and calls additem. */ + int extraktobj(QString _categoryname, int _objcount); + + /*! similar to extraktobj but only counts number of available objects */ + int countobj(QString _categoryname, int _objcount); + + int itemcount; +}; + + +#endif diff --git a/libs/pvb/include/rllib/rcs_user.h b/libs/pvb/include/rllib/rcs_user.h new file mode 100644 index 0000000..79efb75 --- /dev/null +++ b/libs/pvb/include/rllib/rcs_user.h @@ -0,0 +1,251 @@ +/* ******************************************************************* + + FILENAME : RCS_USER.H + + ------------------------------------------------------------------------- + CREATED BY : R.Mayer, Hilscher GmbH + CREATED AT : 10.05.96 + PROJECT : global + ========================================================================= + + FUNCTION : + General RCS definitions + + ========================================================================= + + CHANGES OF REVISIONS : + + Version Name Date Change + ------------------------------------------------------------------------- + + V1.002 Mayer 14.05.98 RCS_TELEGRAMHEADERDATA_10 structure included + + V1.001 Mayer 29.05.96 Task errors included + + V1.000 Mayer 10.05.96 created from the file rc090203.h + + ******************************************************************** */ + +//#ifdef __cplusplus +//} +//#endif + +#if defined( _MSC_VER) /* Microsoft C */ + #pragma pack(1) /* Byte Alignment */ +#endif + +/* ======================================================================== */ +/* General task errors */ +/* ======================================================================== */ + +#define TASK_F_OK 0 +#define TASK_F_NO_COMMUNICATION 1 +#define TASK_F_IDLE 2 + +#define TASK_F_INIT_BASE 50 + +#define TASK_F_PARITY 100 +#define TASK_F_FRAMING 101 +#define TASK_F_OVERRUN 102 +#define TASK_F_DATACOUNT 103 +#define TASK_F_CHECKSUM 104 +#define TASK_F_TIMEOUT 105 +#define TASK_F_PROTOCOL 106 +#define TASK_F_DATA 107 +#define TASK_F_NACK 108 + +#define TASK_F_PROTOCOL_BASE 110 + +#define TASK_F_MESSAGEHEADER 150 +#define TASK_F_MESSAGESIZE 151 +#define TASK_F_MESSAGECOMMAND 152 +#define TASK_F_MESSAGESTRUCTURE 153 +#define TASK_F_MESSAGEERROR 154 +#define TASK_F_MESSAGETIMEOUT 155 + +#define TASK_F_TELEGRAMHEADER 160 +#define TASK_F_DEVICE_ADR 161 +#define TASK_F_DATA_AREA 162 +#define TASK_F_DATA_ADR 163 +#define TASK_F_DATA_IDX 164 +#define TASK_F_DATA_CNT 165 +#define TASK_F_DATA_TYPE 166 +#define TASK_F_FUNCTION 167 + +#define TASK_F_MESSAGE_BASE 170 + +#define TASK_F_NOT_INITIALIZED 200 +#define TASK_F_BUSY 201 +#define TASK_F_SEGMENT 202 +#define TASK_F_USER 203 + +#define TASK_F_DATABASE 210 +#define TASK_F_DATABASE_WRITE 211 +#define TASK_F_DATABASE_READ 212 +#define TASK_F_STRUCTURE 213 +#define TASK_F_PARAMETER 214 +#define TASK_F_CONFIGURATION 215 +#define TASK_F_FUNCTIONLIST 216 +#define TASK_F_SYSTEM 217 + +#define TASK_F_SYSTEM_BASE 220 + + +/* ======================================================================== */ +/* Task commands */ +/* ======================================================================== */ + +#define TASK_B_10 16 /* RCS_TELEGRAMHEADER_10 */ +#define TASK_B_11 17 /* Task specific */ + + +/* ======================================================================== */ +/* Message definitions */ +/* ======================================================================== */ + +/* ----------------- Definition of the standard telegram header ----------- */ +/* Keyword: MESSAGE ---------------------------------------------------- */ +/* TelegramFunCtion */ + +#define TASK_TFC_UNUSED 0 +#define TASK_TFC_READ 1 +#define TASK_TFC_WRITE 2 +#define TASK_TFC_QUERRY 3 + +/* TelegramDataArea */ +/* 'data_area' */ + +#define TASK_TDA_UNUSED 0 +#define TASK_TDA_BIT 1 +#define TASK_TDA_BYTE 2 +#define TASK_TDA_WORD 3 +#define TASK_TDA_DWORD 4 +#define TASK_TDA_FLOAT 5 + +/* TelegramDataType */ +/* 'data_type' for MOTOROLA data types ! */ +/* For INTEL data types, the 'RCS_TDT_IDF_MASK' flag must be set */ + +#define TASK_TDT_UNUSED 0 +#define TASK_TDT_BOOLEAN 1 +#define TASK_TDT_INT8 2 +#define TASK_TDT_INT16 3 +#define TASK_TDT_INT32 4 +#define TASK_TDT_UINT8 5 +#define TASK_TDT_UINT16 6 +#define TASK_TDT_UINT32 7 +#define TASK_TDT_FLOAT 8 +#define TASK_TDT_ASCII 9 +#define TASK_TDT_STRING 10 +#define TASK_TDT_BIT 14 + +#define TASK_TDT_IDF_MSK 0X80 + +/* ======================================================================== */ +/* Message structure definitions */ +/* ======================================================================== */ + +/* -------------------- General RCS definitions -------------------------- */ +/* Keyword: MESSAGE ------------------------------------------------------ */ + +#define RCS_SEGMENT_LEN 288 +#define RCS_MESSAGEHEADER_LEN 8 +#define RCS_TELEGRAMHEADER_LEN 8 + +/* ------------------------ RCS message definition ------------------------ */ + +typedef struct RCS_MESSAGEHEADERtag { + unsigned char rx; /* receiver */ + unsigned char tx; /* transmitter */ + unsigned char ln; /* lenght */ + unsigned char nr; /* number */ + unsigned char a; /* answer */ + unsigned char f; /* fault */ + unsigned char b; /* command */ + unsigned char e; /* extension */ +} RCS_MESSAGEHEADER; + +typedef struct RCS_MESSAGEtag { + unsigned char rx; /* receiver */ + unsigned char tx; /* transmitter */ + unsigned char ln; /* lenght */ + unsigned char nr; /* number */ + unsigned char a; /* answer */ + unsigned char f; /* fault */ + unsigned char b; /* command */ + unsigned char e; /* extension */ + unsigned char d[ RCS_SEGMENT_LEN-RCS_MESSAGEHEADER_LEN ]; /* data */ +} RCS_MESSAGE; + + +/* ----------------- Standard telegram header ----------------------------- */ +/* Keyword: MESSAGE, TASK_B_10 --------------------------------------------*/ + +typedef struct RCS_TELEGRAMHEADER_10tag { + unsigned char device_adr; /* device address */ + unsigned char data_area; /* data area */ + unsigned short data_adr; /* data address */ + unsigned char data_idx; /* data index */ + unsigned char data_cnt; /* data count */ + unsigned char data_type; /* data type */ + unsigned char function; /* function */ +} RCS_TELEGRAMHEADER_10; + +typedef struct RCS_MESSAGETELEGRAMHEADER_10_tag { + unsigned char rx; /* receiver */ + unsigned char tx; /* transmitter */ + unsigned char ln; /* lenght */ + unsigned char nr; /* number */ + unsigned char a; /* answer */ + unsigned char f; /* fault */ + unsigned char b; /* command */ + unsigned char e; /* extension */ + unsigned char device_adr; /* device address */ + unsigned char data_area; /* data area */ + unsigned short data_adr; /* data address */ + unsigned char data_idx; /* data index */ + unsigned char data_cnt; /* data count */ + unsigned char data_type; /* data type */ + unsigned char function; /* function */ +} RCS_MESSAGETELEGRAMHEADER_10; + +typedef struct RCS_TELEGRAMHEADERDATA_10tag { + unsigned char device_adr; + unsigned char data_area; + unsigned short data_adr; + unsigned char data_idx; + unsigned char data_cnt; + unsigned char data_type; + unsigned char function; + unsigned char d[ RCS_SEGMENT_LEN-RCS_MESSAGEHEADER_LEN-RCS_TELEGRAMHEADER_LEN]; +} RCS_TELEGRAMHEADERDATA_10; + +typedef struct RCS_MESSAGETELEGRAM_10tag { + unsigned char rx; /* receiver */ + unsigned char tx; /* transmitter */ + unsigned char ln; /* lenght */ + unsigned char nr; /* number */ + unsigned char a; /* answer */ + unsigned char f; /* fault */ + unsigned char b; /* command */ + unsigned char e; /* extension */ + unsigned char device_adr; /* device address */ + unsigned char data_area; /* data area */ + unsigned short data_adr; /* data address */ + unsigned char data_idx; /* data index */ + unsigned char data_cnt; /* data count */ + unsigned char data_type; /* data type */ + unsigned char function; /* function */ + unsigned char d[ RCS_SEGMENT_LEN-RCS_MESSAGEHEADER_LEN-RCS_TELEGRAMHEADER_LEN]; +} RCS_MESSAGETELEGRAM_10; + + +#if defined( _MSC_VER) /* Microsoft C */ + #pragma pack() /* Byte Alignment */ +#endif + +//#ifdef __cplusplus +//} +//#endif + +/* === eof 'RCS_USER.H' === */ diff --git a/libs/pvb/include/rllib/rcsdef.h b/libs/pvb/include/rllib/rcsdef.h new file mode 100644 index 0000000..c7aefea --- /dev/null +++ b/libs/pvb/include/rllib/rcsdef.h @@ -0,0 +1,139 @@ +/* ******************************************************************* + + FILENAME : RcsDef.h + + ------------------------------------------------------------------------- + CREATED BY : R.Mayer, Hilscher GmbH + CREATED AT : 10.03.97 + PROJECT : + ========================================================================= + + FUNCTION / CLASSDESCRIPTION: + + ========================================================================= + + CHANGES OF REVISIONS : + + Version Name Date Change + ------------------------------------------------------------------------- + + 1.000 RM 10.03.97 Created + + ******************************************************************** */ +// Prevent multiple inclusion +#ifndef __RCSDEF_H__ +#define __RCSDEF_H__ + +#ifdef _cplusplus + extern "C" { +#endif /* _cplusplus */ + + #define FIRMWARE_DOWNLOAD 1 + #define CONFIGURATION_DOWNLOAD 2 + + /* ======================================================================== */ + /* Message definitions */ + /* ======================================================================== */ + + #define RCS_TASK 0x00 /* Number of RCS */ + #define PLC_TASK 0x02 /* Number for PLC_TASK */ + + #define MSG_SYSTEM_TX 0xFF /* Transmitter for system functions number */ + + #define RCS_B_TASK_STATE 4 // Task state + + /************************************************************************** */ + /* Genaral RCS commands */ + /************************************************************************** */ + + #define RCS_B_SYSFKT 1 + #define RCS_B_TASKFKT 2 + #define RCS_B_DIAGNOSE 3 + #define RCS_B_STRUCTFNC 4 + #define RCS_B_TRACE 5 + #define RCS_B_LOADFKT 6 + #define RCS_B_DBMFKT 10 + + /* ----------------------- */ + /* Message extension masks */ + /* ----------------------- */ + + #define RCS_FIFO_MSK 0 + #define RCS_LIFO_MSK 1 + #define RCS_NAK_MSK 2 + + #define RCS_NORM_MSK 0 + #define RCS_FIRST_MSK 4 + #define RCS_CONT_MSK 8 + #define RCS_LAST_MSK 0x0C + #define RCS_SEQ_MSK 0x0C + + /* ------------------ */ + /* Mode definitions */ + /* ------------------ */ + + #define MODE_NEUSTART 0 /* Command: B_SYSFKT */ + #define MODE_KALTSTART 1 /* Command: B_SYSFKT */ + #define MODE_WARMSTART 2 /* Command: B_SYSFKT */ + #define MODE_ZYKL_STATUS_STOP 3 /* Command: B_SYSFKT */ + #define MODE_FWVERSION 4 /* Command: B_SYSFKT */ + #define MODE_GET_PROJ_WERTE_HW 5 /* Command: B_SYSFKT */ + #define MODE_GET_PROJ_WERTE_SW 6 /* Command: B_SYSFKT */ + #define MODE_SHOW_DYN_SYSSTAT 7 /* Command: B_SYSFKT */ + #define MODE_SETTIME 9 /* not implemented yet */ + #define MODE_SET_DEVICE_DATA 9 /* not implemented yet */ + #define MODE_MODUL_RCS 11 /* Command: B_SYSFKT */ + #define MODE_MODUL_LIB 12 /* Command: B_SYSFKT */ + #define MODE_MODUL_MCL 13 /* Command: B_SYSFKT */ + #define MODE_MODUL_LIB 12 /* Command: B_SYSFKT */ + #define MODE_MODUL_MCL 13 /* Command: B_SYSFKT */ + #define MODE_DISTRIBUTOR_DRIVER 14 /* Command: B_SYSFKT ->function 1 = insert */ + #define MODE_PRINT_DRIVER 15 /* Command: B_SYSFKT */ + #define MODE_GET_RCS_ERROR 16 /* Command: B_SYSFKT */ + + #define MODE_PRINT_DEVICE 1 /* NO mode, only for MENU.H */ + #define MODE_PRINT_DEVICE_DRIVER 2 /* NO mode, only for MENU.H */ + + #define MODE_START_STOP_STAT 0 /* Command: B_TASKFKT */ + #define MODE_START_STOP 1 /* Command: B_TASKFKT */ + #define MODE_TASK_VERSION 2 /* Command: B_TASKFKT */ + #define MODE_ZYKL_STATUS 3 /* Command: B_TASKFKT */ + #define MODE_SHOW_FUELLST 4 /* Command: B_TASKFKT */ + #define MODE_SHOW_TIMER 5 /* Command: B_TASKFKT */ + + #define MODE_DIAG_MEM_READ_SINGLE 0x0 /* Command: B_DIAGNOSE */ + #define MODE_DIAG_MEM_WRITE_SINGLE 0x1 /* Command: B_DIAGNOSE */ + #define MODE_DIAG_IO_READ_SINGLE 0x2 /* Command: B_STRUKTFKT */ + #define MODE_DIAG_IO_WRITE_SINGLE 0x3 /* Command: B_STRUKTFKT */ + #define MODE_DIAG_ZYKL 0x10 /* Command: B_STRUKTFKT */ + #define MODE_DIAG_MEM_READ_ZYKL 0x10 /* Command: B_STRUKTFKT */ + #define MODE_DIAG_MEM_WRITE_ZYKL 0x11 /* Command: B_STRUKTFKT */ + #define MODE_DIAG_IO_READ_ZYKL 0x12 /* Command: B_STRUKTFKT */ + #define MODE_DIAG_IO_WRITE_ZYKL 0x13 /* Command: B_STRUKTFKT */ + + #define MODE_ZYKL_TASK_STRUK 0 /* Command: B_STRUKTFKT */ + #define MODE_INIT_INFO_STRUK 1 /* Command: B_STRUKTFKT */ + #define MODE_WRITE_STRUK 2 /* Command: B_STRUKTFKT */ + + #define MODE_START_TRACE 0 /* Command: B_TRACE */ + #define MODE_DEL_TRACE_PUF 1 /* Command: B_TRACE */ + + #define MODE_UPLOAD_BINAER 0 /* Command: B_LOADFKT */ + #define MODE_DOWNLOAD_BINAER 1 /* Command: B_LOADFKT */ + #define MODE_UPLOAD_DBM 2 /* Command: B_LOADFKT */ + #define MODE_DOWNLOAD_DBM 3 /* Command: B_LOADFKT */ + #define MODE_DEL_FLASH 4 /* Command: B_LOADFKT */ + #define MODE_GET_FLASH_DIR 5 /* Command: B_LOADFKT */ + #define MODE_URLADEN 6 /* Command: B_LOADFKT */ + #define MODE_LONG_BINLOAD 7 /* Command: B_LOADFKT */ + #define MODE_FREE_DRIVER 8 /* Command: B_LOADFKT */ + #define MODE_RESET_DEVICE 10 /* Command: B_LOADFKT */ + +/* ------------------------------------------------------------------------------------ */ +#ifdef _cplusplus + } +#endif + +#endif +// ======== eof 'RcsDef.h' ======== + diff --git a/libs/pvb/include/rllib/rl3964r.h b/libs/pvb/include/rllib/rl3964r.h new file mode 100644 index 0000000..7ff6e86 --- /dev/null +++ b/libs/pvb/include/rllib/rl3964r.h @@ -0,0 +1,63 @@ +/*************************************************************************** + rl3964r.h - description + ------------------- + begin : Wed Jan 14 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_3964R_H_ +#define _RL_3964R_H_ + +#include "rldefine.h" +#include "rlserial.h" +#include "rlthread.h" + +/*!
+This class implements the siemens 3964R dust protocol.
+The read messages must be handled within the callback routine.
+
*/ +class rl3964R +{ + public: + enum priorityEnum + { + highPriority = 0, + lowPriority + }; + + rl3964R(int _priority = highPriority); + virtual ~rl3964R(); + int open(const char *devicename, int _baudrate = B9600); + int close(); + int setReadCallback( void (*_readCallback)(const unsigned char *buf, int len)); + int write(const unsigned char *buf, int len); + + int send(); + int receive(); + rlThread receiver; + rlSerial tty; + int state; + int priority; + int run; + int debug; + int dprintf(const char *format, ...); + private: + void (*readCallback)(const unsigned char *buf, int len); + unsigned char tel_send[512]; + unsigned char tel_receive[512]; + int tel_send_length; + int tel_receive_length; + int isOpen; + int send_result; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlbuffer.h b/libs/pvb/include/rllib/rlbuffer.h new file mode 100644 index 0000000..367102f --- /dev/null +++ b/libs/pvb/include/rllib/rlbuffer.h @@ -0,0 +1,46 @@ +/*************************************************************************** + rlbuffer.h - description + ------------------- + begin : Sun Aug 24 2014 + copyright : (C) 2014 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_BUFFER_H_ +#define _RL_BUFFER_H_ + +#include "rldefine.h" + +/*!
+class for handling memory buffers.
+
*/ +class rlBuffer +{ +public: + rlBuffer(); + virtual ~rlBuffer(); + int resize(int size); + int size(); + int setText(const char *text); + char *line(int i); + void *adr; + char *c; + unsigned char *uc; + int *i; + unsigned int *ui; + long *l; + unsigned long *ul; + float *f; + double *d; + +private: + int _size; +}; +#endif diff --git a/libs/pvb/include/rllib/rlbussignaldatabase.h b/libs/pvb/include/rllib/rlbussignaldatabase.h new file mode 100644 index 0000000..30d0a05 --- /dev/null +++ b/libs/pvb/include/rllib/rlbussignaldatabase.h @@ -0,0 +1,45 @@ +/*************************************************************************** + rlbussignaldatabase.h - description + ------------------- + begin : Mon Aug 02 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_BUSSIGNAL_DATABASE_H_ +#define _RL_BUSSIGNAL_DATABASE_H_ + +#include "rldefine.h" + +class rlBussignalDatabase +{ + public: + rlBussignalDatabase(); + virtual ~rlBussignalDatabase(); + int openDatabase(const char *database, const char *table); + int writeDatabaseInt(const char *item, int val); + int writeDatabaseIntArray(const char *item, int *val, int len); + int writeDatabaseFloat(const char *item, float val); + int writeDatabaseFloatArray(const char *item, float *val, int len); + int writeDatabaseString(const char *item, char *val); + int readDatabase(const char *item, char *type, char *value); + int closeDatabase(); + private: + int writeDatabaseString(const char *item); + int myquery(const char *query); + void *database; + void *connection; + char *databaseName; + char *tableName; + char buf[rl_PRINTF_LENGTH]; + char typebuf[16]; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlcannode.h b/libs/pvb/include/rllib/rlcannode.h new file mode 100644 index 0000000..12d3c60 --- /dev/null +++ b/libs/pvb/include/rllib/rlcannode.h @@ -0,0 +1,137 @@ +/*************************************************************************** + cannode.h - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + authors : Marc Br�tigam, Christian Wilmes + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +#ifndef NODE +#define NODE + +#include "rldefine.h" +#include + using std::cin; + using std::cout; +#include +#include +#include +#include + +#include "rlcanopenstructs.h" +#include "rlcanopentypes.h" +#include "rlinifile.h" + +#ifndef TOOL +#define TOOL +//#include "ToolBox.cpp" +#endif + +#include "objdir.h" /* Include file for EDS file manager */ + +#include "cif_user.h" /* Include file for device driver API */ +#include "rcs_user.h" /* Include file for RCS definition */ +#include "asc_user.h" /* Include file for ASCII protocols */ +#include "nvr_user.h" /* Include file for 3964R protocol */ +#include "COM_USER.H" + +//! class to manage one node of a CanOpenMaster board in a CanOpen network +class rlCanNode +{ + public: + rlCanNode (); + + /*! initializes a new node obj. node is defined by boardid, nodeid and a + telegram which contains node specific information from device's dual + ported memory */ + rlCanNode (int boardnr, int nodeid, RCS_MESSAGETELEGRAM_10& _telegramm); + + //! calls destructors of rlinifile obj and objdir + ~rlCanNode(); + + //!returns the type of a specific entry in the object directory + int objecttype(int objindex, int subindex); + + //!prints out the configuration of the node + void showConfiguration(); + + //!returns the current node ID of the node + int getNodeID(); + + //!returns the board ID the node is connected to. + int getBoardID(); + + //!returns the current number of all installed PDOs (Process Data Objects) + int getPdoCount(); + + //!returns the current number of all installed reiceive PDOs + int getReceivePdoCount(); + + //!returns the current number of all installed transmit PDOs + int getTransmitPdoCount(); + + /*! indicates if node mapping is available. When mapping is active, it is + possible to catch a specific Object within a PDO */ + bool hasMapping(); + + //! contains transmit PDOs + //QPtrVector transmit_pdoList; + + //! contains receive PDOs + //QPtrVector receive_pdoList; + + // RECEIVE_LIST = 0 + // TRANSMIT_LIST = 1 + QPtrVector pdoList[2]; + + private: + //! current node ID (1-127) + int nodeID; + + //! curent board ID (0-3) + int boardID; + + /*! iterates through all files in eds directory. opens every eds file and + returns a pointer to an ini-file object of the eds file matching the + product string in [DeviceInfo] ProductName */ + rlIniFile* getEDS(const char* _productstr); + + /*! pointer to inifile. object which handles access to the EDS file + describing the object directory of this node */ + rlIniFile* ini; + + /*! pointer to objdir which handles access to all items in the object + directory of this node */ + ObjDir* objdir; + + /*! reads out the configuration of a node from the device. + For success the device must configured by SYCon. */ + void readConfigurationMessage(RCS_MESSAGETELEGRAM_10& _message); + + //!Unique device number if available. + unsigned short usIdentNumber; + + //!Unique vendor number if available. + unsigned char usVendorIdent; + + //! specific node informations. extracted from message telegramm + QString abVendorName; + QString abDeviceName; + QString abDescription; + QString edslocation; + unsigned char pdocount; + unsigned char bMasterAddress; + unsigned char bSettings; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlcanopen.h b/libs/pvb/include/rllib/rlcanopen.h new file mode 100644 index 0000000..5bcf7f7 --- /dev/null +++ b/libs/pvb/include/rllib/rlcanopen.h @@ -0,0 +1,285 @@ +/*************************************************************************** + rlcanopen.cpp - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by Marc Br�tigam, Christian Wilmes, R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +/*! + * \section intro Introduction to rlCANopen-API + * + * The rlCANopen-Software represents a developer friendly interface for + * Hilscher CANopen Mastercard users, which ensures a comfortable + * access to CANopen nodes and also Linux and Win32 portability. + * + * Using the Server-Client-architecture a network-wide availability of + * data is feasible. + * + * + + */ + + +#ifndef NODES +#define NODES + +#define err00 "no error, command executed" +#define err03 "DESCRIPT table not found. DEVICE is not configured by SyCon" +#define err57 "sequence error. Check requested DeviceAdr of continued message" +#define err58 "no entry found for requested DeviceAdr of request message." +#define err100 "Communication ERROR!!!" + +#include "rlwthread.h" +#include "rlcannode.h" +#include +#include + + +//! main class which provides canopen API functions and manages all nodes. +/*! This class contains a canopen specific API which accesses the canopen bus + through the bus-independ Hilscher device API. It reads the configuration + which has to be written previously to the device by SyCon. Based on this + configuration data it searches node corresponding EDS files to create + object directories. These help to enshure type security and cast warnings + when users try to write incorrect data types to can nodes. + */ +class rlCanOpen +{ + public: + rlCanOpen(); + rlCanOpen(char* _inifilename); + ~rlCanOpen(); + + //! returns the number of available boards + int getBoardCount(); + + //! returns the number of currently active board + int getActiveBoard(); + + //! prints out the configuration of a specific node + bool showNodeConfiguration(int _boardnr,int _nodeid); + + //! prints out the configuration off all available nodes from all boards + bool showNodeConfiguration(); // show all nodes + + /*! using the sdo_read function you can read a certain object from the object + dictionary of a node. For this the SDO (Service Data Object) service + will be used. The enquired object will be written to the rlCanOpenTypes + class. To read out the correct value from this class use one of the + get_TYPE() {e.g. get_int() } functions. You can assert the type in the + class using rlCanOpenTypes::get_DaemonType(); + if sdo_read failures the current error can be read out using + rlCanOpenTypes::get_rlmsgerr()*/ + int sdo_read ( int _boardnr, + int _nodeid, + int _objectindex, + int _subindex, + rlCanOpenTypes &_sdo_data); + + /*! using the sdo_write function you can write to a certain object from the + object dictionary of a node. For this the SDO (Service Data Object) + Service will be used. The relevant data must be written into the + rlCanOpenTypes class before. To write the data into the rlCanOpenTypes + class use one of the datatype depending functions like + rlCanOpenTypes::set_int(int _value); + if sdo_write failures the current error can be read out using + rlCanOpenTypes::get_rlmsgerr()*/ + int sdo_write ( int _boardnr, + int _nodeid, + int _objectindex, + int _subindex, + rlCanOpenTypes &_sdo_data); + + /*! using the pdo_receive function you can receive a PDO (Process Data Object), + which is send from the specific node to the device. The enquired object + will be written to the rlCanOpenTypes class. + The mapping is only available if mapping is configurated during the node + creation of the rlcanopen constructer. Therefore a eds file (electronic + data sheet) is needed. Use the cannode::hasMapping() function to check + if mapping is available. To read out the correct value from this class + use one of the get_TYPE() {e.g. get_int() } functions you can assert the + type in the class using rlCanOpenTypes::get_DaemonType(); */ + int pdo_receive( int _boardnr, + int _nodeid, + int _pdonr, + int _mappingnr, + rlCanOpenTypes &_pdo_data); + + + /*! using the pdo_receive function you can receive a PDO (Process Data Object), + which is send from the specific node to the canOpen master card. The data + will be written to the rlCanOpenTypes class. This function doesn't use + mapping. So the whole 8Byte PDO data, will be received. To read out use + the rlCanOpenTypes::get_buffer({0-7}) function */ + int pdo_receive( int _boardnr, + int _nodeid, + int _pdonr, + rlCanOpenTypes &_pdo_data); + + + + /*! Using the pdo_transmit function you can transmit a PDO (Process Data + Object) to a specific node. The desired data must be written to the + rlCanOpenTypes class. The mapping is only available if mapping is + configurated during the node creation of the rlcanopen constructer. + Therefore an eds file (electronic data sheet) is needed. + Use the cannode::hasMapping() function to check if mapping is available */ + int pdo_transmit( int _boardnr, + int _nodeid, + int _pdonr, + int _mappingnr, + rlCanOpenTypes &_pdo_data); + + /*! Using the pdo_transmit function you can transmit a PDO (Process Data + Object) to a specific node. The desired data must be written to the + rlCanOpenTypes class. This function does not support mapping. So the + whole 8byte PDO data, will be send to write to the rlCanOpenTypes use + the rlCanOpenTypes::set_buffer({0-7}) function */ + int pdo_transmit( int _boardnr, + int _nodeid, + int _pdonr, + rlCanOpenTypes &_pdo_data); + + /*! Because the nodes of all boards are stored in one list, the listindex is + not equal to the nodeID(1-127). Use this function to get the listindex + of a desired node */ + int getNodeIndex( int _boardnr, + int _nodeid, + int & _index); + + /*! returns daemontype number of an object. The type is retrieved from the + node's objectdir. When no objectdir exists (e.g. because of a missing + EDS file) or when the requested object does not exist, this function + will return 0xFF (the corresponding value to rlCanOpenTypes::RL_NOTYPE) + */ + int getObjectType( int _boardnr, + int _nodeid, + int _objectindex, + int _subindex); + + /*! Use this function to get information about a specific node. + The nodestate, nodeerror and a nodestateFlag will be written to the + rlCanOpenTypes. Read the rlCanOpenTypes.h header to get further + information about these variables. Hilscher specific function (so no + CanOpoen services) are used to receive the information */ + int getNodeState( int _boardnr, + int _nodeid, + rlCanOpenTypes &_data); + + /*! Using this function you are able to restart a CanOpenMaster board + (device). There are 3 possibly kinds of restarting the master: + coldstart, warmstart, bootstart. + The corresponding '#defines' are declared in canopenstructs.h + Hilscher specific function (so no CanOpoen services) are used to + execute this command */ + int restartBoard( int _boardnr, int _restarttype); + + /*! Using this function you can send a NMT Command to one or all nodes (of + one board). NMT (Network Management) is a CanOpen service. Because of the + device there are constrictions for the user. + You can only execute the follow NMT commands: + START_REMOTE_NODE, + STOP_REMOTE_NODE, + ENTER_PREOPERATIONAL, + RESET_NODE, + RESET_COMMUNICATION + The corresponding '#defines' are declared in canopenstructs.h */ + int sendNMTCommand( int _boardnr, + int _nodeid, + unsigned char _cmd); + + + + bool is_twisted_type(int _canopentype); + + + private: + + /*! This function reads out the configuration of a specific node using special + Hilscher commands (CMDCODE_GET_CONFIGURATION). If the master board isn't + configurated by SyCon it is not possibly to use this function with success. + It returns false if the node is not available */ + bool getNodeConfiguration(int _nodeID); + + /*! this function iterates through the recieve/tramsmit pdo lists and returns + the ID number of the pdo that fits the given objektindex. The PdoId + identifies the send/receive PDO on the given node */ + int getPdoID(int _boardnr, int _nodeid, int _objektindex, int _direction); + + //! the currently active board + int activeboard; + + /*! read properties of inifile. EDS path, logfile location and user-specific + options are set on startup */ + void read_inifile(const char* _filename); + + //! initialize nodes and create nodelist + bool ini(); + + //! clear message struct by setting all elements to zero + void delmsg(); + + //! Read informations about installed devices + bool iniboards(); + + //! this string buffer is usually written with sprintf before sent to stdout + char err_out_buf[255]; + + //! return value for hilscher specific message functions + short sRet; + + //! Pointer to error logfile + FILE* err_fp; + + //! name of logfile stdout is redirected to + QString logFileName; + + //! hilscher specific message structur which will be sent to the master card + RCS_MESSAGETELEGRAM_10 message; + + //! this list contains all nodes from all boards + QPtrVector nodelist; + + //! the current count of CanOpenMaster cards + int boardcount; + + //! message counter + unsigned char messagenr; + + //! sets a desired CanOpenMaster active, so that it can be used + short setBoardActive(int _boardnr); + + /*! if the user changes the mapping of a node using SDO functions, + the internal mapping list should be changed */ + int refreshMappingList( int _boardnr, + int _nodeid, + int _pdoID, + int _pdoDirection); + + /*! this function checks the bus for available nodes and creates + a corresponding nodelist */ + int createNodes(); + + //! this function writes the mapping objects for each pdo of a node + int createMappingObjects( int _boardid, + int _nodeid, + int _pdoDirection); + + + + /*! this indicator is true when stdout is redirected to file. + it is set in the ini-file */ + bool enableLogging; + +}; + +#endif diff --git a/libs/pvb/include/rllib/rlcanopenclient.h b/libs/pvb/include/rllib/rlcanopenclient.h new file mode 100644 index 0000000..0f3dc71 --- /dev/null +++ b/libs/pvb/include/rllib/rlcanopenclient.h @@ -0,0 +1,174 @@ +/*************************************************************************** + rlcanopen.cpp - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by Marc Br�tigam, Christian Wilmes, R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#include +#include +#include +#include +#include "rlsocket.h" +#include "rlthread.h" +#include "rlcutil.h" +#include "rlwthread.h" + +#include "rlcanopentypes.h" + +//! Class performs API rlcanopen functions remotely through tcp sockets +/*! this class provides the client API funcions which should be + similar to the rlcanopen API. + Main difference is that underlying code does not communicate with + the canopen device itself but with a rlcanopendaemon, which should + run in backbround or on an remote computer. */ + +class rlCanOpenClient +{ +public: + + enum rl_msg { + MSG_SEND = 0, + MSG_RECEIVE = 1, + MSG_SDO_READ = 0, + MSG_SDO_WRITE = 1, + MSG_PDO_RECEIVE = 3, + MSG_CONNECT = 5, + MSG_DISCONNECT = 6, + MSG_PDO_TRANSMIT = 4, + MSG_NMT_TRANSMIT = 7, + MSG_RESTART_BOARD = 8, + MSG_GET_NODE_STATE = 9 + }; + + //! initializes the client on localhost port 5000 + rlCanOpenClient(); + //! initializes the client on given port and remove server adress + rlCanOpenClient(int _port, char* _remoteadress); + //! destructor disconnects client + ~rlCanOpenClient(); + //! opens a new connection to a running rlCanOpenDaemon + int connect(); + //! disconnects from daemon + int disconnect(); + + + /*! using the sdo_read function you can read a certain object from the + object dictionary of a node. + Function will return NULL if connection to daemon broke down. + CanOpen interface related errors are + accessable in _sdo_data.get_rlmsgerr() */ + int sdo_read( int _boardnr, + int _nodeid,int _objectindex, + int _subindex, + rlCanOpenTypes &_sdo_data); + + /*! using the sdo_write function you can write to a certain object + from the object dictionary of a node + Function will return NULL if connection to daemon broke down. + CanOpen interface related errors are + accessable in _sdo_data.get_rlmsgerr() */ + int sdo_write(int _boardnr, + int _nodeid,int _objectindex, + int _subindex, + rlCanOpenTypes &_sdo_data); + + /*! receives single mapped pdo object from daemon. + Function will return NULL if connection to daemon broke down. + CanOpen interface related errors are + accessable in _sdo_data.get_rlmsgerr() */ + int pdo_receive(int _boardnr, + int _nodeid,int _pdonr, + int _mappingnr, + rlCanOpenTypes &_pdo_data); + + /*! receives an 8 byte pdo from daemon. + Function will return NULL if connection to daemon broke down. + CanOpen interface related errors are + accessable in _sdo_data.get_rlmsgerr() */ + int pdo_receive(int _boardnr, + int _nodeid,int _pdonr, + rlCanOpenTypes &_pdo_data); + + /*! sends a single mapped pdo object to daemon. + Function will return NULL if connection to daemon broke down. + CanOpen interface related errors are + accessable in _pdo_data.get_rlmsgerr() */ + int pdo_transmit(int _boardnr, + int _nodeid,int _pdonr, + int _mappingnr, + rlCanOpenTypes &_pdo_data); + + /*! sends an 8 byte pdo to daemon. + Function will return NULL if connection to daemon broke down. + CanOpen interface related errors are + accessable in _pdo_data.get_rlmsgerr() */ + int pdo_transmit(int _boardnr, + int _nodeid, + int _pdonr, + rlCanOpenTypes &_pdo_data); + + /*! sends a NMT command to daemon. */ + int sendNMTCommand( int _boardnr, + int _nodeid, + unsigned char _cmd, + bool &returnstate); + + /*! forces daemon to restart canopen device. */ + int restartBoard(int _boardnr, int _restarttype, bool &returnstate); + + /*! receives node state data of particular node from daemon. */ + int getNodeState(int _boardnr, int _nodeid,rlCanOpenTypes &_data); + + //! setter for private port variable + void setPort(int _port); + + //! setter for private remoteadress variable + void setAdr(char* _adr); + +private: + //! variable contains process id + int pid; + + //! flag indicates connection status + bool connected; + + //! variable contains port + int port; + + //! string of remoteadress + char remoteadress[40]; + + //! pointer to socket object + rlSocket* socket; + //! timeout in ms + int client_timeout; +}; + +//##################################################################################### +// convenience class for client users +class rlCanClient : public rlCanOpenClient +{ +public: + rlCanClient(int _port, char* _remoteadress, int _boardnr); + ~rlCanClient(); + int sdo_read(int _nodeid, int _objectindex, int _subindex, rlCanOpenTypes &_sdo_data); + int sdo_write(int _nodeid,int _objectindex, int _subindex, rlCanOpenTypes &_sdo_data); + int pdo_receive(int _nodeid, int _pdonr, int _mappingnr, rlCanOpenTypes &_pdo_data); + int pdo_receive(int _nodeid, int _pdonr, rlCanOpenTypes &_pdo_data); + int pdo_transmit(int _nodeid, int _pdonr, int _mappingnr, rlCanOpenTypes &_pdo_data); + int pdo_transmit(int _nodeid, int _pdonr, rlCanOpenTypes &_pdo_data); + int sendNMTCommand(int _nodeid, unsigned char _cmd, bool &returnstate); + int restartBoard(int _restarttype, bool &returnstate); + int getNodeState(int _nodeid, rlCanOpenTypes &_data); +private: + int boardnr; +}; diff --git a/libs/pvb/include/rllib/rlcanopendaemon.h b/libs/pvb/include/rllib/rlcanopendaemon.h new file mode 100644 index 0000000..a84892e --- /dev/null +++ b/libs/pvb/include/rllib/rlcanopendaemon.h @@ -0,0 +1,100 @@ +/*************************************************************************** + rlcanopen.cpp - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by Marc Brutigam, Christian Wilmes, R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef DAEMON +#define DAEMON + +#include +#include +#include +#include "rlthread.h" +#include "rlcutil.h" +#include "rlsocket.h" +#include "rlwthread.h" +#include "rlcanopen.h" + + + enum rl_msg { + MSG_SEND = 0, + MSG_RECEIVE = 1, + MSG_SDO_READ = 0, + MSG_SDO_WRITE = 1, + MSG_PDO_RECEIVE = 3, + MSG_CONNECT = 5, + MSG_DISCONNECT = 6, + MSG_PDO_TRANSMIT = 4, + MSG_NMT_TRANSMIT = 7, + MSG_RESTART_BOARD = 8, + MSG_GET_NODE_STATE = 9 + }; + + +//! canopen tcp/ip interface for concurrent device-access of multiple clientprocesses +/*! this is a multi threaded server process, which listens on a tcp port for incomming + connections. It runs the only recommended instance of rlcanopen class for beeing the + very only process accessing the device. + Different processes who concurrently try to access the device will be queued autmaticly + by daemonprocess. These processes are inteded to communicate through rlcanopenclient. */ + +class rlCanOpenDaemon{ + public: + + /*! empty constructor initializes on port 5000. + creates a new rlCanOpen Object which + performs all access to canopen device */ + rlCanOpenDaemon(); + + /*! main constructor sets port and inifilename. + creates a new rlCanOpen Object which + performs all access to canopen device */ + rlCanOpenDaemon(int _port, char* _iniFileName=0); + + /*! destructor destroys rlcanopen object */ + ~rlCanOpenDaemon(); + + /*! returns value of current port */ + int getPort(); + + /*! daemon creates a listener thread which handels + incoming connections by himself creating + clientconnection threads for each client connecting to the daemon. */ + void start(); + + /*! pointer to rlCanOpen Object which performs all access to canopen device */ + rlCanOpen* nodes; + + /*! rlThread object which manages basic thread functionality e.g. + locking to prevent threads + from concurrently accessing the canopen device */ + rlThread daemon_thread; + + private: + int port; + +}; + +// parameter struct for passing parameters to handler thread +struct THREADTRANSFER +{ + int socketdescr; // socket descriptor identifying the new connection + rlCanOpenDaemon* daemonptr; // pointer to daemon object +}; + + + + + + +#endif diff --git a/libs/pvb/include/rllib/rlcanopenstructs.h b/libs/pvb/include/rllib/rlcanopenstructs.h new file mode 100644 index 0000000..2704b58 --- /dev/null +++ b/libs/pvb/include/rllib/rlcanopenstructs.h @@ -0,0 +1,120 @@ +/*************************************************************************** + rlcanopen.cpp - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by Marc Br�tigam, Christian Wilmes, R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +//!definition of CanOpen structs for CanOpen Deamon + +#ifndef CanOpenStructsH +#define CanOpenStructsH + + +#define DIRECTION_RECEIVE 0 +#define DIRECTION_TRANSMIT 1 + + + +#define RECEIVE_PDO_MAPPING_STARTADRESS 0x1600 +#define RECEIVE_PDO_MAPPING_MAXADRESS 0x17FF +#define TRANSMIT_PDO_MAPPING_STARTADRESS 0x1A00 +#define TRANSMIT_PDO_MAPPING_MAXADRESS 0x1BFF +#define MAX_NODES 127 +#define MAX_SDO_BUFFERSIZE 246 + + + +//! Hilscher device-communication constants +#define CAN_TASK 3 +#define USER_AT_HOST 16 +#define CMDCODE_GET_CONFIGURATION 15 +#define CMDCODE_SDO_UPDOWNLOAD 74 +#define CMDCODE_Node_Diag 66 +#define CMD_NMT_Module_Protocol 96 + +//! NMT Command specifier +#define CMD_NMT_START_REMOTE_NODE 1 +#define CMD_NMT_STOP_REMOTE_NODE 2 +#define CMD_NMT_ENTER_PREOPERATIONAL 128 +#define CMD_NMT_RESET_NODE 129 +#define CMD_NMT_RESET_COMMUNICATION 130 + +#define TASK_TFC_READ 1 +#define TASK_TFC_WRITE 2 +#define RESPONSE_CODE_GET_CONFIGURATION 15 + +#define DATA_DIRECTION_MASK 0x30 +#define DIRECTION_INPUT 0x10 +#define DIRECTION_OUTPUT 0x20 + +//! ERRCODES +#define ERRCODE_NOERROR 0 +#define ERRCODE_INVALID_NODEID -2 +#define ERRCODE_INVALID_PDOID -3 +#define ERRCODE_PDOSND_FAIL -4 +#define ERRCODE_INVALID_MAPID -5 +#define ERRCODE_INVALID_RLTYPE -6 +#define ERRCODE_PDORCV_FAIL -7 + +//! DEVRESET +#define COLDSTART 2 +#define WARMSTART 3 +#define BOOTSTART 4 + +//! mapping object which is part of the mappinglist of a PDO +struct rlCanMapping +{ + //! the mapping ID determines the mapping object within the PDO (1 to n) + unsigned short mappingId; + + //! its current type (int32, float, char, ...) + int etype; + + //! its current canoptentype (int24, int40, int48, ...) + int canopentype; + + //! its position in within the 8Byte + unsigned short position; + + //! length of mappend object in bits + unsigned short length; +} ; + + + +//! PDO object which is part of one of the two pdo lists in the node class +struct rlCanPDO +{ + //! 1 = receive PDO / 2 = send PDO [indicate by PDO No] + short bPDODirection; + + //! size of a PDO / max 8 Bytes + unsigned char bPDOSize; + + //! if only one bit is set in a PDO, this value shows its position + unsigned char bDataPosition; + + //! fixes the PDO position in the card memory + unsigned short usPDOAddress; + + //! this list contains all mapping information of a PDO + QPtrVector mappingList; + + //! the adress of object directory of the node where the mapping is placed + int mappingOvAdress; +}; + + + +#endif + diff --git a/libs/pvb/include/rllib/rlcanopentypes.h b/libs/pvb/include/rllib/rlcanopentypes.h new file mode 100644 index 0000000..e76c3a5 --- /dev/null +++ b/libs/pvb/include/rllib/rlcanopentypes.h @@ -0,0 +1,419 @@ +/*************************************************************************** + rlcanopen.cpp - description + ------------------- + begin : Tue March 03 2004 + copyright : (C) 2004 by Marc Brutigam, Christian Wilmes, R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +#include + using std::cin; + using std::cout; + +#include "rlinifile.h" +#include +#include + +struct IPCMSGSTRUCT; + +//!class to handle CANopen types +/*! Can nodes contain data objects of any type. It is necessary + to convert type secure data into type insecure rawdata to transfer it over + the canbus. Therefore this class helps to convert raw canbus data easily. + To prevent users from reading out raw data with a wrong type (e.g. performing + get_int() when a float number is stored in this class), a type number indicates + the currently stored datatype. Everytime such a type violation occurs, a warning + is written to stdout. +*/ + + +class rlCanOpenTypes { + public: + enum rl_types{ + RL_BOOL=0, + RL_UCHAR, + RL_SHORT, + RL_USHORT, + RL_INT , + RL_LONG, + RL_FLOAT, + RL_DOUBLE, + RL_LONGLONG, + RL_STRING, + RL_BUFFER, + RL_ULONG, + RL_ULONGLONG, + RL_PDO = 13, + RL_NODESTATE, + RL_NOTYPE = 0xFF + }; + + + enum canopen_types{ + + c_BOOLEAN = 0x0001, + INTEGER8_t = 0x0002, + INTEGER16_t = 0x0003, + INTEGER32_t = 0x0004, + UNSIGNED8_t = 0x0005, + UNSIGNED16_t = 0x0006, + UNSIGNED32_t = 0x0007, + REAL32_t = 0x0008, + VISIBLE_STRING = 0x0009, + OCTET_STRING_t = 0x000A, + UNICODE_STRING = 0x000B, + TIME_OF_DAY_t = 0x000C, + TIME_DIFFERENC = 0x000D, + BIT_STRING_t = 0x000E, + DOMAIN_t = 0x000F, + INTEGER24_t = 0x0010, + REAL64_t = 0x0011, + INTEGER40_t = 0x0012, + INTEGER48_t = 0x0013, + INTEGER56_t = 0x0014, + INTEGER64_t = 0x0015, + UNSIGNED24_t = 0x0016, + RESERVED1_t = 0x0017, + UNSIGNED40_t = 0x0018, + UNSIGNED48_t = 0x0019, + UNSIGNED56_t = 0x001A, + UNSIGNED64_t = 0x001B +}; + + //! Constructor initializes with RL_NOTYPE + rlCanOpenTypes(); + + //! returns number of bytes used for current type + int getLength(); + + //! sets all bytes in databuffer to zero + void clearBuffer(); + + /*! sets the type of data stored in databuffer. All getter-functions forced to + return a type different from this will produce an invalid-type-warning to + stdout + */ + void set_DaemonType(rl_types _type); + + //! alternative setter receives integer typenumber + void set_DaemonType(int _type); + + //! returns current of data stored in databuffer + int get_DaemonType(); + + /*! recieves an CANopen typenumber as defined in CiA DS-301 specification. + This type is converted to the appropiate RL-type. Therefore type-numbers + may be extracted directly from EDS file without external conversion. + */ + void set_CanOpenType(int _type); + + //! returns the current type converted to CANopen typenumber + int get_CanOpenType(); + + /*! Function for typenumber conversion. CANopen-Type differs between 27 primitive + data types while DaemonType only consists of 13 ANSI C data types an two + more daemon specific tyes: RL_PDO and RL_NOTYPE which indicates that no + type is defined for raw data placed in this classes databuffer. + */ + static int canOpenType2DeamonType(int _canopentype); + + //! Function for typenumber conversion. + static int deamonType2CanOpenType(int _deamontype); + + //! sets type to RL_INT and stores passed parameter data in databuffer + void set_int(int _value); + + /*! returns databuffer-content as integer type. When type is not RL_INT + this will produce an invalid-type-warning to stdout*/ + int get_int(); + + //! sets type to RL_FLOAT and stores passed parameter data in databuffer + void set_float(float _value); + + /*! returns databuffer-content as float type. When type is not RL_FLOAT + this will produce an invalid-type-warning to stdout*/ + float get_float(); + + //! sets type to RL_DOUBLE and stores passed parameter data in databuffer + void set_double(double _value); + + /*! returns databuffer-content as double type. When type is not RL_DOUBLE + this will produce an invalid-type-warning to stdout*/ + double get_double(); + + //! sets type to RL_SHORT and stores passed parameter data in databuffer + void set_short(short _value); + + /*! returns databuffer-content as short type. When type is not RL_SHORT + this will produce an invalid-type-warning to stdout*/ + short get_short(); + + //! sets type to RL_USHORT and stores passed parameter data in databuffer + void set_ushort(unsigned short _value); + + /*! returns databuffer-content as short type. When type is not RL_USHORT + this will produce an invalid-type-warning to stdout*/ + unsigned short get_ushort(); + + //! sets type to RL_LONGLONG and stores passed parameter data in databuffer + void set_longlong(long int _value); + + /*! returns databuffer-content as long long type. When type is not RL_LONGLONG + this will produce an invalid-type-warning to stdout*/ + long int get_longlong(); + + /*! sets type to RL_STRING. the passed string-constant is copied byte-wise + to databuffer */ + void set_string(const char* _value); + + /*! creates a new 246 bytes string filled with databuffer-content and returns a + pointer. this pointer must be stored and memory must be freed with delete, + when the string is not longer needed, to prevent programm from producing + memory leak. */ + char* get_string(); + + /*! This setter does not modify the current type. it is intended to transfer + raw data recieved from canbus into the databuffer and afterwards set the + approbiate daemontype with set_daemontype. _index must be within range of + 246 bytes databuffer size. + */ + void set_buffer(int _index, unsigned char _databyte); + + //! returns 1 byte from databuffer + unsigned char get_buffer(int _index); + + //! sets type to RL_UCHAR and stores passed parameter data in databuffer + void set_uchar(unsigned char _value); + + /*! returns databuffer-content as uchar type. When type is not RL_UCHAR + this will produce an invalid-type-warning to stdout*/ + unsigned char get_uchar(); + + //! sets type to RL_BOOL and stores passed parameter data in databuffer + void set_bool(bool _value); + + /*! returns databuffer-content as bool type. When type is not RL_BOOL + this will produce an invalid-type-warning to stdout*/ + bool get_bool(); + + //! sets type to RL_LONG and stores passed parameter data in databuffer + void set_long(long _value); + + /*! returns databuffer-content as long type. When type is not RL_LONG + this will produce an invalid-type-warning to stdout*/ + long get_long(); + + //! sets type to RL_ULONG and stores passed parameter data in databuffer + void set_ulong(unsigned long _value); + + /*! returns databuffer-content as ulong type. When type is not RL_ULONG + this will produce an invalid-type-warning to stdout*/ + unsigned long get_ulong(); + + //! sets type to RL_ULONGLONG and stores passed parameter data in databuffer + void set_ulonglong(unsigned long int _value); + unsigned long int get_ulonglong(); + + //! sets the errornumber. refer private varibale rlmsgerr for details + void set_rlmsgerr(long _errnr); + //! returns current errnumber + long get_rlmsgerr(); + + /*! sets type to RL_NODESTATE. This is function is intended to store flag-data + received from the device. */ + void set_nodestateFlags( unsigned char _bNodeNoResponse, + unsigned char _bEmcyBuffOverflow, + unsigned char _bPrmFault, + unsigned char _bGuardActive , + unsigned char _bDeactivated); + + /*! returns false when typenumber is not RL_NODESTATE. if true states are stored + in parameter variables */ + bool get_nodestateFlags( bool &_bNodeNoResponse, + bool &_bEmcyBuffOverflow, + bool &_bPrmFault, + bool &_bGuardActive, + bool &_bDeactivated); + + //! read particular nodestade with the following functions + bool get_nodestateFlag_NoResponse(); + bool get_nodestateFlag_EmcyBuffOverflow(); + bool get_nodestateFlag_PrmFault(); + bool get_nodestateFlag_GuardActive(); + bool get_nodestateFlag_Deactivated(); + + /*! sets current state of node. this is a code number the following meaning: + alias nr + DISCONNECTED 1 + CONNECTING 2 + PREPARING 3 + PREPARED 4 + OPERATIONAL 5 + PRE_OPERATIONAL 127 */ + void set_nodestate(unsigned char _nodestate); + + //! returns the nodestate. refer code numbers above + unsigned char get_nodestate(); + + /*! sets the actual node error. refer com_pie.pdf page 15 for detailed + error code description */ + void set_nodeerror(unsigned char _nodeerror); + + //! returns actual node error + unsigned char get_nodeerror(); + + //! external buffer for pdotransfer + unsigned char pdobuffer[8]; + + //! exchange bytes 0-7 from databuffer to pdobuffer + void buf2pdobuf(); + + //! exchange bytes 0-7 from pdobuffer to databuffer + void pdobuf2buf(); + + //! copies all data from right object into left object + rlCanOpenTypes& operator = (rlCanOpenTypes &cp); + + //! returns a IPCMSGSTRUCT filled with current object data + IPCMSGSTRUCT createIpcMsg(); + + //! overwrites all data with IPCMSGSTRUCT data + void getIpcMsg(IPCMSGSTRUCT _myIpcMsg); + + //! prints MsgErrStr to StdOut + void rlMsgErrOut(); + + + /*! returns a pointer to a new 22 character string containing the name of + the error in rlmsgerr. This pointer must be stored and memory must be + freed with delete, when the string is not longer needed, to prevent + programm from producing memory leak. */ + char* rlMsgErrStr(); + + /*! returns a pointer to a new 12 character string containing the name of + the type passed by _typnr. This pointer must be stored and memory must + be freed with delete, when the string is not longer needed, to prevent + programm from producing memory leak. */ + char* type2str(int _typenr); + + + bool translate_CanOpenType(int _canopentype); + int get_CanOpenTypeLength(int _canopentype); + + private: + + /*! produce an invalid-type-warning to stdout. + used by nearly all getter functions */ + void invalidTypeError(int _typenr); + + + /*! variable that stores the current datatype. only rl_types enum values + are indented to be stored here */ + int typenumber; + + /*! errnumber // alias // description + rlmsgerr = 0 // ERRCODE_NOERROR // no error + rlmsgerr > 0 // // msg.f error code. Refer com_pie.pdf page 44 for details. + rlmsgerr = -1 // // msg.a or msg.nr inconsistency + rlmsgerr = -2 // ERRCODE_INVALID_NODEID // nodeid does not exist + rlmsgerr = -3 // ERRCODE_INVALID_PDOID // pdoid does not exist + rlmsgerr = -4 // ERRCODE_PDOSND_FAIL // transmit pdo failed + rlmsgerr = -5 // ERRCODE_INVALID_MAPID // mappingid does not exist + rlmsgerr = -6 // ERRCODE_INVALID_RLTYPE // type does not fit during pdo transmit + rlmsgerr = -7 // ERRCODE_PDORCV_FAIL // pdo receive failed */ + long rlmsgerr; + + + //all different types are stored together in the same data area + union { + int t_int; // 4 Bytes 0x00 + float t_float; // 4 Bytes 0x01 + double t_double; // 8 Bytes 0x02 + short t_short; // 2 Bytes 0x03 + unsigned short t_ushort; // 2 Bytes 0x04 + long int t_longlong; // 8 Bytes 0x05 + char t_string[247]; // 246 Bytes 0x06 + unsigned char t_databytes[247]; // 246 Bytes 0x07 + unsigned char t_databyte; // 1 Byte 0x08 + bool t_bool; // 1 Byte 0x09 + long t_long; // 4 Bytes 0x0A + unsigned long t_ulong; // 4 Bytes 0x0B + unsigned long int t_ulonglong; // 8 Bytes 0x0C + // Error => 0xFF + struct + { + unsigned char bNodeNoResponse : 1; /* no response */ + unsigned char bEmcyBuffOverflow : 1; /* emcy.buffer overflow */ + unsigned char bPrmFault : 1; /* parameters faulty */ + unsigned char bGuardActive : 1; /* node guarding active */ + unsigned char bDeactivated : 1; /* not configured */ + unsigned char bNodeState; + #define DISCONNECTED 1 + #define CONNECTING 2 + #define PREPARING 3 + #define PREPARED 4 + #define OPERATIONAL 5 + #define PRE_OPERATIONAL 127 + unsigned char bActualError; + } bNodeFlagState; + }; + +}; + + + +//! the IPCMSGSTRUCT is the transfer buffer which is send trough TCP sockets +/* + MSG_SEND 0 + MSG_RECEIVE 1 + +#define MSG_SDO_READ 0 +#define MSG_SDO_WRITE 1 +#define MSG_PDO_RECEIVE 3 +#define MSG_CONNECT 5 +#define MSG_DISCONNECT 6 +#define MSG_PDO_TRANSMIT 4 +#define MSG_NMT_TRANSMIT 7 +#define MSG_RESTART_BOARD 8 +#define MSG_GET_NODE_STATE 9 +*/ + +struct IPCMSGSTRUCT +{ + long typenumber; + /* msgtype can be one of this values + MSG_SDO_READ 0 + MSG_SDO_WRITE 1 + MSG_PDO_RECEIVE 3 + MSG_CONNECT 5 + MSG_DISCONNECT 6 + MSG_PDO_TRANSMIT 4 + MSG_NMT_TRANSMIT 7 + MSG_RESTART_BOARD 8 + MSG_GET_NODE_STATE 9 */ + long msgtype; + + /* transfer type can be one of this values + MSG_SEND 0 + MSG_RECEIVE 1 */ + long transfertype; + + long processid; + long boardid; + long nodeid; + long objectindex; + long subindex; + long pdoid; + long mappingid; + long rlmsgerr; + char mtext[247]; +}; + diff --git a/libs/pvb/include/rllib/rlcommandlineinterface.h b/libs/pvb/include/rllib/rlcommandlineinterface.h new file mode 100644 index 0000000..e22b79b --- /dev/null +++ b/libs/pvb/include/rllib/rlcommandlineinterface.h @@ -0,0 +1,60 @@ +/*************************************************************************** + rlcommandlineinterface.h - description + ------------------- + begin : Sat Mar 27 2010 + copyright : (C) 2010 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_COMMANDLINE_INTERFACE_H_ +#define _RL_COMMANDLINE_INTERFACE_H_ + +#include "rldefine.h" +#include "rlsocket.h" +#include "rlserial.h" +#include "rlspawn.h" + +/*!
+Commandline interface that allows applications to communicate over pipe || socket || serial line || stdio .
+
+The parameters of start() are as follows:
+start("stdio");                    // use stdin and stdout
+start("pipe","command");           // run "command" and connect it's stdio with us (runs on unix only)
+start("host:5050");                // connect to "host" on port 5050 and communicate with the server (tip: define a server with xinted on "host" port 5050)
+start("localhost:5050","command"); // run "command" and then try to connect to "localhost" port 5050 for communication with "command"
+start("server.localhost:5050");    // act as a server on "localhost" port 5050 (can serve only 1 client. if you want to serve more clients use rlSocket)
+start(tty);                        // use serial interface for communication
+
+Return values:
+start()      returns -1 on error
+readLine()   returns the read string or NULL
+readBlock()  returns the number of read bytes or -1 on error
+printf()     returns the number of written characters or -1 on error
+writeBlock() returns the number of written bytes or -1 on error
+
*/ +class rlCommandlineInterface +{ +public: + rlCommandlineInterface(); + virtual ~rlCommandlineInterface(); + int start(const char *how, const char *command=NULL); + int start(rlSerial *tty); + const char *readLine(int timeout=0); + int readBlock(void *buf, int len, int timeout=0); + int printf(const char *format, ...); + int writeBlock(void *buf, int len); +private: + char line[rl_PRINTF_LENGTH]; + rlSocket *sock; + rlSpawn *spawn; + rlSerial *tty; +}; +#endif + diff --git a/libs/pvb/include/rllib/rlcontroller.h b/libs/pvb/include/rllib/rlcontroller.h new file mode 100644 index 0000000..085db8e --- /dev/null +++ b/libs/pvb/include/rllib/rlcontroller.h @@ -0,0 +1,163 @@ +/*************************************************************************** + rlcontroller.h - description + ------------------- + begin : Wed Jun 16 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_CONTROLLER_H_ +#define _RL_CONTROLLER_H_ + +#include "rldefine.h" +#include "rlthread.h" + +/*!
+class for closed loop control
+According to: F. Doerrscheid/W. Latzel, Grundlagen der Regelungstechnik, B.G. Teubner Stuttgart
+Page 436-437, Regelalgorithmen mit der Trapezregel
+
*/ +class rlController : public rlThread +{ +public: + enum ControllerType + { + P = 1, + I = 2, + D_T1 = 3, + PI = 4, + PD_T1 = 5, + PID_T1 = 6, + PI_SUM = 7, + PD_T1_SUM = 8, + PID_T1_SUM = 9 + }; + rlController(double (*_getMeasurement)() ,void (_writeOutput)(double output)); + ~rlController(); + void start(); + void stop(); + /*!
+  Set the reference value for the controller
+  
*/ + void setReference (double _reference); + /*!
+  Transfer function: Gr(s) = Kp
+  
*/ + void setP (double _T, double _Kp); + /*!
+                               1
+  Transfer function: Gr(s) = ------
+                             T1 * s
+  T = cycle time in seconds
+  
*/ + void setI (double _T, double _T1); + /*!
+                              TD * s
+  Transfer function: Gr(s) = ---------
+                             1 + Td*s
+  T = cycle time in seconds
+  
*/ + void setD_T1 (double _T, double _TD, double _Td); + /*!
+                                  1 + Tn*s
+  Transfer function: Gr(s) = Kp * --------
+                                   Tn*s
+  T = cycle time in seconds
+  
*/ + void setPI (double _T, double _Kp, double _Tn); + /*!
+                                  1 + TvP*s
+  Transfer function: Gr(s) = Kp * ---------
+                                  1 + Td*s
+  T = cycle time in seconds
+  
*/ + void setPD_T1 (double _T, double _Kp, double _TvP, double _Td); + /*!
+                                   1 + TnP*s   1 + TvP*s
+  Transfer function: Gr(s) = Kpp * --------- * ---------
+                                     TnP*s     1 + Td*s
+  T = cycle time in seconds
+  
*/ + void setPID_T1 (double _T, double _Kpp, double _TnP, double _TvP, double _Td); + /*!
+                                         1
+  Transfer function: Gr(s) = Kp * ( 1 + ---- )
+                                        Tn*s
+  T = cycle time in seconds
+  
*/ + void setPI_SUM (double _T, double _Kp, double _Tn); + /*!
+                                          Tv*s
+  Transfer function: Gr(s) = Kp * ( 1 + -------- )
+                                        1 + Td*s
+  T = cycle time in seconds
+  
*/ + void setPD_T1_SUM (double _T, double _Kp, double _Tv, double _Td); + /*!
+                                         1       Tv*s
+  Transfer function: Gr(s) = Kp * ( 1 + ---- + -------- )
+                                        Tn*s   1 + Td*s
+  T = cycle time in seconds
+  
*/ + void setPID_T1_SUM (double _T, double _Kp, double _Tn, double _Tv, double _Td); + /*!
+  Set limits for the controller output
+  
*/ + void setLimits(double _yk_min, double _yk_max); + /*!
+  Reset limits for the controller output
+  
*/ + void resetLimits(); + /*!
+  Don't set the controller parameters directly
+  Use the set methods, because they will also set the coefficients
+  Controller parameters are for reading only
+  
*/ + double Kp,Kpp,T,T1,Td,TD,Tn,TnP,TvP,Tv,reference; + int type; + int running; + double d0,d1,d2,dD; + double c1,c2,cD; + double yk,yk_1,yk_2; + double ek,ek_1,ek_2; + double y1k,y1k_1,ydk,ydk_1; + int dt; + // callbacks + /*!
+  You have to supply this function for getting the measurement
+  
*/ + double (*getMeasurement)(); + /*!
+  You have to supply this function for writing the output
+  
*/ + void (*writeOutput)(double output); + + /*!
+  Default sleepLocally = 1
+  But:
+  Sleeping locally might me inaccurate.
+  It might be better to have a central timer and wait for it in
+  double (*_getMeasurement)();
+  T = cycle time in seconds
+  
*/ + int sleepLocally; + /*!
+  last measurement 
+  
*/ + double measurement; + /*!
+  limits 
+  
*/ + double yk_min; + double yk_max; + int limited; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlcorba.h b/libs/pvb/include/rllib/rlcorba.h new file mode 100644 index 0000000..92aeb64 --- /dev/null +++ b/libs/pvb/include/rllib/rlcorba.h @@ -0,0 +1,110 @@ +/*************************************************************************** + rlcorba.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_CORBA_H_ +#define _RL_CORBA_H_ + +#include "rldefine.h" +#define rlMICO +//#define rlVISIBROKER +//#define rlOMNIORB + +#include +#ifdef rlMICO +#include +#endif + +template +class rlCorbaClient +{ +public: +#ifdef rlMICO + rlCorbaClient(int ac, char **av, const char *iname) + { + idlname = adr = NULL; + if(iname == NULL) return; + idlname = new char[strlen(iname)+1]; + strcpy(idlname,iname); + for(int i=0; ibind(idlname, adr); + if(CORBA::is_nil(obj)) + { + cerr << "cannot bind to " << adr << endl; + delete adr; + adr = NULL; + return; + } + client = T::_narrow(obj); + if(CORBA::is_nil(client)) + { + cerr << "Argument is not a " << idlname << " reference" << endl; + } + } + ~rlCorbaClient() + { + if(idlname != NULL) delete idlname; + if(adr != NULL) delete adr; + } +#endif + char *idlname; + char *adr; + CORBA::ORB_var orb; + CORBA::Object_var obj; + Tvar client; +}; + +template +class rlCorbaServer +{ +public: +#ifdef rlMICO + rlCorbaServer(int ac, char **av, const char *) + { + orb = CORBA::ORB_init(ac,av); + obj = orb->resolve_initial_references("RootPOA"); + poa = PortableServer::POA::_narrow(obj); + mgr = poa->the_POAManager(); + server = server_servant._this(); + CORBA::String_var str = orb->object_to_string(server); + cout << str << endl; // write reference to stdout + mgr->activate(); + } + ~rlCorbaServer() + { + } +#endif + void run() + { + orb->run(); + } + char *adr; + CORBA::ORB_var orb; + CORBA::Object_var obj; + PortableServer::POA_var poa; + PortableServer::POAManager_var mgr; + Timpl server_servant; + Tvar server; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlcutil.h b/libs/pvb/include/rllib/rlcutil.h new file mode 100644 index 0000000..314f1c5 --- /dev/null +++ b/libs/pvb/include/rllib/rlcutil.h @@ -0,0 +1,254 @@ +/*************************************************************************** + rlcutil.cpp - description + ------------------- + begin : Wed Dec 11 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/*!
+Some C functions.
+
*/ +#ifndef _RL_CUTIL_H_ +#define _RL_CUTIL_H_ + +#include +#include +#include +#include +#include "rldefine.h" + +/*!
+  like printf for debugging 
+
*/ +int rlSetDebugPrintf(int state); +int rlDebugPrintf(const char *format, ...); + +/*!
+  test if input line is available
+  #include 
+
*/ +int rlInputAvailable(); + +/*!
+  like printf in the last line of a terminal
+
*/ +int rlLastLinePrintf(const char *format, ...); + +#ifdef RLUNIX +/*!
+  call execvp(arg[0],arg) on unix
+
*/ +#ifndef SWIG +int rlexec(const char *command); +#endif +#endif + +/*!
+  encode plain text password p
+
*/ +const char *rlpass(const char *p); + +/*!
+  strncpy + terminate with '\\0'
+
*/ +char *rlstrncpy(char *dest, const char *source, int n); + +/*!
+  strncpy + terminate with '\\0'
+  terminates on '\\n' or '\\0'
+  '\\n' is not copied
+
*/ +char *rlstrlinecpy(char *dest, const char *source, int n); + +/*!
+  like vsnprintf but portable
+
*/ +#ifndef SWIG +int rlvsnprintf(char *text, int len, const char *format, va_list ap); +#endif + +/*!
+  like snprintf but portable
+
*/ +int rlsnprintf(char *text, int len, const char *format, ...); + +/*!
+  set signal handler for signal SIGTERM
+
*/ +void rlSetSigtermHandler(void (*handler)(void *arg), void *arg); + +/*!
+  context = 0 must be 0 on first call
+
*/ +const char *rlFindFile(const char *pattern, int *context); + +/**
+returns:
+~/.name               on Linux/Unix
+sys$login:name        on OpenVMS
+%USERPROFILE%\\name    on Windows
+
*/ +const char *rlGetInifile(const char *name); + +/**
+swaps bytes
+
*/ +int rlSwapShort(int val); + +/**
+Send command to a bus system
+
*/ +int rlEib1 (int command); +int rlEib2 (int command); +int rlLon1 (int command); +int rlLon2 (int command); +int rlProfibus1(int command); +int rlProfibus2(int command); +int rlCan1 (int command); +int rlCan2 (int command); + +/**
+Call internet browser
+
*/ +int rlBrowser(const char *htmlfile); + +/**
+Call system(command)
+
*/ +int rlsystem(const char *command); + +/**
+Submit a pvserver
+Example:
+rlSubmitPvserver("HOME","/temp/murx","pvs","-exit_on_bind_error -exit_after_last_client_terminates");
+
*/ +int rlSubmitPvserver(const char *env, const char *path, const char *pvs, const char *options=NULL); + +/**
+Get option from string
+return = 0 # not found
+return = 1 # found
+
*/ +int rlOption(const char *string, const char *option); + +/**
+Get option from string
+
*/ +int rlIntOption(const char *string, const char *option, int _default); + +/**
+Get option from string
+
*/ +float rlFloatOption(const char *string, const char *option, float _default); + +/**
+Get option from string
+
*/ +const char *rlTextOption(const char *string, const char *option, const char *_default); + +/**
+Copy a Textfile (no binary file)
+
*/ +int rlCopyTextfile(const char *source, const char *destination); + +/**
+convert str to upper case
+
*/ +int rlupper(char *str); + +/**
+convert str to lower case
+
*/ +int rllower(char *str); + +/**
+test if str starts with startstr
+
*/ +int rlStartsWith(const char *str, const char *startstr); + +/**
+test if str ends with endstr
+
*/ +int rlEndsWith(const char *str, const char *endstr); + +/**
+test if str matches with wild
+
*/ +int rlStrMatch(const char *str, const char *wild); + +/**
+same as stat
+
*/ +#ifndef SWIG +int rlStat(const char *filepath, struct stat *buf); +#endif + +/**
+read data from file
+return := number of bytes read | -1
+
*/ +int rlFRead(FILE *fin, void *data, int len); + +/**
+write data to file
+return := number of bytes written | -1
+
*/ +int rlFWrite(FILE *fout, void *data, int len); + +/**
+write data to file
+return := number of bytes written | -1
+
*/ +int rlWriteFile(const char *filename, void *data, int len); + +/**
+same as mkdir
+
*/ +int rlMkdir(const char *dir, int mode=0744); + +/**
+Set bit bitnumber in value
+Return value
+
*/ +int rlBitSet(int bitnumber, int *value); + +/**
+Clear bit bitnumber in value
+Return value
+
*/ +int rlBitClear(int bitnumber, int *value); + +/**
+XOR bit bitnumber in value
+Return value
+
*/ +int rlBitChange(int bitnumber, int *value); + +/**
+Test bit bitnumber in value
+Return 0 | 1
+
*/ +int rlBitTest(int bitnumber, int *value); + +/**
+Push value to front of buffer.
+Shift all other values.
+
*/ +void rlPushToDoubleBuffer(double val, double *buffer, int size); + +/**
+Push value to front of buffer.
+Shift all other values.
+
*/ +void rlPushToFloatBuffer(float val, float *buffer, int size); + + +#endif diff --git a/libs/pvb/include/rllib/rldataacquisition.h b/libs/pvb/include/rllib/rldataacquisition.h new file mode 100644 index 0000000..d16a666 --- /dev/null +++ b/libs/pvb/include/rllib/rldataacquisition.h @@ -0,0 +1,83 @@ +/*************************************************************************** + rldataacquisition.h - description + ------------------- + begin : Mon Sep 03 2007 + copyright : (C) 2007 by pvbrowser + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_DAQ_H_ +#define _RL_DAQ_H_ + +#include "rldefine.h" +#include "rlmailbox.h" +#include "rlsharedmemory.h" + +/*!
+This class is for data acquisition within pvserver according to the pvbrowser principle.
+It communicates by the means of a shared memory and a mailbox.
+Use it together with rlDataAcquisitionProvider.
+
*/ +class rlDataAcquisition +{ +public: + // shared memory header + typedef struct + { + char ident[4]; // must be "daq" + int maxItemNameLength; // maximum length of an item name + int maxNameLength; // maximum length of the item value + int numItems; // number of items in shared memory + int readErrorCount; // 0...65536 incremented by each read error + int writeErrorCount; // 0...65536 incremented by each write error + int lifeCounter; // 0...65536 incremented on each cycle + int spare[7]; // for future use + char cspare[32]; // for future use + }SHM_HEADER; + + enum DAQ_ENUM + { + DAQ_ERROR = 256*256*128 + }; + +#ifdef RLWIN32 + rlDataAcquisition(const char *mailbox="c:\\automation\\mbx\\dataacquisition.mbx", const char *shared_memory="c:\\automation\\shm\\dataacquisition.shm", long shared_memory_size=65536); +#else + rlDataAcquisition(const char *mailbox="/srv/automation/mbx/dataacquisition.mbx", const char *shared_memory="/srv/automation/shm/dataacquisition.shm", long shared_memory_size=65536); +#endif + virtual ~rlDataAcquisition(); + const char *stringValue(const char *variable); + int intValue(const char *variable); + float floatValue(const char *variable); + int writeStringValue(const char *variable, const char *value); + int writeIntValue(const char *variable, int value); + int writeFloatValue(const char *variable, float value); + /*! Incremented by the daemon on each read error */ + int readErrorCount(); + /*! Incremented by the daemon on each write error */ + int writeErrorCount(); + /*! Incremented by the daemon in each cycle */ + int lifeCounter(); + const char *firstVariable(); + const char *nextVariable(); + int shmStatus(); // 0 if shared memory is ok | DAQ_ERROR if shared memory is not ok + int shmKey(); // key of shared memory + int shmId(); // id of shared memory + +private: + SHM_HEADER *shmheader; + const char *shmvalues; + rlMailbox *mbx; + rlSharedMemory *shm; + int iCurrent; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rldataacquisitionprovider.h b/libs/pvb/include/rllib/rldataacquisitionprovider.h new file mode 100644 index 0000000..1d0572a --- /dev/null +++ b/libs/pvb/include/rllib/rldataacquisitionprovider.h @@ -0,0 +1,82 @@ +/*************************************************************************** + rldataacquisitionprovider.h - description + ------------------- + begin : Mon Sep 03 2007 + copyright : (C) 2007 by pvbrowser + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_DAQ_PROVIDER_H_ +#define _RL_DAQ_PROVIDER_H_ + +#include "rldefine.h" +#include "rlsharedmemory.h" + +/*!
+This class is usefull to implement your own data acquisition according to the pvbrowser principle.
+It is used within pvb/template/dataacquisition/client/data_acquisition_provider_template.cpp
+Starting from there you can implement your data acquisition.
+
*/ +class rlDataAcquisitionProvider +{ +public: + // shared memory header + typedef struct + { + char ident[4]; // must be "daq" + int maxItemNameLength; // maximum length of an item name + int maxNameLength; // maximum length of the item value + int numItems; // number of items in shared memory + int readErrorCount; // 0...65536 incremented by each read error + int writeErrorCount; // 0...65536 incremented by each write error + int lifeCounter; // 0...65536 incremented each cycle + int spare[7]; // for future use + char cspare[32]; // for future use + }SHM_HEADER; + + enum DAQ_PROVIDER_ENUM + { + DAQ_PROVIDER_ERROR = 256*256*128 + }; + +#ifdef RLWIN32 + rlDataAcquisitionProvider(int maxNameLength=31, const char *shared_memory="c:\\automation\\shm\\dataacquisition.shm", long shared_memory_size=65536); +#else + rlDataAcquisitionProvider(int maxNameLength=31, const char *shared_memory="/srv/automation/shm/dataacquisition.shm", long shared_memory_size=65536); +#endif + virtual ~rlDataAcquisitionProvider(); + int readItemList(const char *filename); // return DAQ_PROVIDER_ERROR | num_items + const char *firstItem(); + const char *nextItem(); + const char *stringValue(const char *variable); + int intValue(const char *variable); + float floatValue(const char *variable); + int setStringValue(const char *variable, const char *value); + int setIntValue(const char *variable, int value); + int setFloatValue(const char *variable, float value); + int readErrorCount(); + int writeErrorCount(); + int lifeCounter(); + int setReadErrorCount(int count); + int setWriteErrorCount(int count); + int setLifeCounter(int count); + int shmStatus(); // 0 if shared memory is ok | DAQ_PROVIDER_ERROR if shared memory is not ok + int setAllowAddValues(int allow, int maxItemNameLength); + +private: + SHM_HEADER *shmheader; + char *shmvalues; + int current_item, allow_add_values; + rlSharedMemory *shm; + long sharedMemorySize; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rldataaquisition.h b/libs/pvb/include/rllib/rldataaquisition.h new file mode 100644 index 0000000..cf38225 --- /dev/null +++ b/libs/pvb/include/rllib/rldataaquisition.h @@ -0,0 +1,3 @@ +#warning "Please #include \"rldataacuisition.h\" instead of \"rldataaquisition.h\"" +#warning "Please replace rlDataAquisition by rlDataAcquisition" +#error "rlDataAcquisition had been misspelled to rlDataAquisition. This was fixed. Please adjust your code." diff --git a/libs/pvb/include/rllib/rldataaquisitionprovider.h b/libs/pvb/include/rllib/rldataaquisitionprovider.h new file mode 100644 index 0000000..6c4dbab --- /dev/null +++ b/libs/pvb/include/rllib/rldataaquisitionprovider.h @@ -0,0 +1,3 @@ +#warning "Please #include \"rldataacquisitionprovider.h\" instead of \"rldataaquisitionprovider.h\"" +#warning "Please replace rlDataAquisitionProvider by rlDataAcquisitionProvider" +#error "rlDataAcquisitionProvider had been misspelled to rlDataAquisitionProvider. This was fixed. Please adjust your code." diff --git a/libs/pvb/include/rllib/rldataprovider.h b/libs/pvb/include/rllib/rldataprovider.h new file mode 100644 index 0000000..df2e77b --- /dev/null +++ b/libs/pvb/include/rllib/rldataprovider.h @@ -0,0 +1,100 @@ +/*************************************************************************** + rldataprovider.h - description + ------------------- + begin : Fri Dec 20 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_DATA_PROVIDER_H_ +#define _RL_DATA_PROVIDER_H_ + +#include "rldefine.h" +#include "rlsocket.h" +#include "rlthread.h" +#include "rlinterpreter.h" + +/*!
+This class is a container for data.
+You can get/set the data identified by id.
+The run method starts a separate thread that makes rlDataProvider available over TCP.
+
*/ +class rlDataProvider +{ + public: + rlDataProvider(int numInteger, int numFloat=0, int numString=0); + virtual ~rlDataProvider(); + int getInt (int id); + float getFloat (int id); + int getIntArray (int id, int *i, int nmax); + int getFloatArray (int id, float *f, int nmax); + const char *getString(int id); + int setInt (int id, int i); + int setFloat (int id, float f); + int setIntArray (int id, int *i, int num); + int setFloatArray (int id, float *f, int num); + int setString(int id, const char *str); + int getIntAndReset(int id); + int setIntAndWaitForReset(int id, int i); + int setInt0Semaphore(int i); + int getInt0Semaphore(); + int run(rlSocket *socket); + private: + typedef char* CHARPTR; + int *ints; + float *floats; + char **strings; + int num_integer, num_float, num_string; + rlMutex mutex; + rlSemaphore int0semaphore; +}; + +/*!
+This class is a client that can access rlDataProvider over TCP.
+
*/ +class rlDataProviderClient +{ + public: + rlDataProviderClient(); + virtual ~rlDataProviderClient(); + int getInt (rlSocket *socket, int id, int *status); + float getFloat (rlSocket *socket, int id, int *status); + int getIntArray (rlSocket *socket, int id, int *array, int nmax); + int getFloatArray (rlSocket *socket, int id, float *array, int nmax); + const char *getString (rlSocket *socket, int id, int *status); + int setInt (rlSocket *socket, int id, int i); + int setFloat (rlSocket *socket, int id, float f); + int setIntArray (rlSocket *socket, int id, int *i, int num); + int setFloatArray (rlSocket *socket, int id, float *f, int num); + int setString (rlSocket *socket, int id, const char *str); + int getIntAndReset (rlSocket *socket, int id, int *status); + int setIntAndWaitForReset(rlSocket *socket, int id, int i); + int getInt0Semaphore (rlSocket *socket, int *status); + private: + rlInterpreter interpreter; + char cret[rl_PRINTF_LENGTH]; +}; + +/*!
+This class starts a separate thread.
+The thread is accepting clients, that want access to rlDataProvider.
+
*/ +class rlDataProviderThreads +{ + public: + rlDataProviderThreads(int Port, rlDataProvider *Provider); + virtual ~rlDataProviderThreads(); + void start(); + rlDataProvider *provider; + rlThread thread; + int port; +}; + +#endif diff --git a/libs/pvb/include/rllib/rldefine.h b/libs/pvb/include/rllib/rldefine.h new file mode 100644 index 0000000..b8ec3aa --- /dev/null +++ b/libs/pvb/include/rllib/rldefine.h @@ -0,0 +1,109 @@ +/*************************************************************************** + rldefine.h - description + ------------------- + begin : Wed Dec 04 2002 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/*!
+The header that is included in every file of rllib.
+
*/ +#ifndef _RL_DEFINE_H_ +#define _RL_DEFINE_H_ + +// CPP Standard +#if __cplusplus >= 199711L +#define RLCPP98 +#endif + +#if __cplusplus >= 201103L +#define RLCPP11 +#endif + +#if __cplusplus >= 201402L +#define RLCPP14 +#endif + +#if __cplusplus >= 201703L +#define RLCPP17 +#endif + + +// define WIN +#ifdef _WIN32 +#define RLWIN32 +#include +#include +#define WTHREAD_GNUC0 ( __GNUC__ * 1000 ) + __GNUC_MINOR__ +#if WTHREAD_GNUC0 >= 4008 +#endif +#endif + +// we always use this and are very lazy +#include +#include +#include + +// define unix if not already defined +#ifdef __unix__ +#ifndef unix +#define unix +#endif +#endif +#ifdef unix +#define RLUNIX +#endif + +#if defined(__APPLE__) && defined(__MACH__) +#ifndef RLUNIX +#define RLUNIX +#endif +#endif + +#define rl_PRINTF_LENGTH 4096 +#define rl_PRINTF_LENGTH_SPREADSHEET 4096 + +#define BIT0 1 +#define BIT1 2 +#define BIT2 4 +#define BIT3 8 +#define BIT4 16 +#define BIT5 32 +#define BIT6 64 +#define BIT7 128 +#define BIT8 256*1 +#define BIT9 256*2 +#define BIT10 256*4 +#define BIT11 256*8 +#define BIT12 256*16 +#define BIT13 256*32 +#define BIT14 256*64 +#define BIT15 256*128 +#define BIT16 256*256*1 +#define BIT17 256*256*2 +#define BIT18 256*256*4 +#define BIT19 256*256*8 +#define BIT20 256*256*16 +#define BIT21 256*256*32 +#define BIT22 256*256*64 +#define BIT23 256*256*128 +#define BIT24 256*256*256*1 +#define BIT25 256*256*256*2 +#define BIT26 256*256*256*4 +#define BIT27 256*256*256*8 +#define BIT28 256*256*256*16 +#define BIT29 256*256*256*32 +#define BIT30 256*256*256*64 +#define BIT31 256*256*256*128 + +#define RLCRLF "\r\n" + +#endif diff --git a/libs/pvb/include/rllib/rldf1.h b/libs/pvb/include/rllib/rldf1.h new file mode 100644 index 0000000..cd6239c --- /dev/null +++ b/libs/pvb/include/rllib/rldf1.h @@ -0,0 +1,307 @@ +/*************************************************************************** + rldf1.cpp - description + ------------------- + +This Class implements basic functions of DF1 Full Duplex protocall as +described in 1770-6.5.16 Publication of AB. + +This Class implements: + - Data Link Layer ( Message Frames ) + - Application Layer ( Message Packets ) + - Some Basic Communication Commands for reading and writting PLC files. + It is easy to add more Communication Commands. + +Some basic knowledge about the related PLCs is required. +The class supports only serial communication through RS232 port. + +DANGER: DON'T connect to a PLC unless you are certain it is safe to do so!!! +You are ABSOLUTELY RESPONSIBLE if you affect the operation of a running PLC. + +Evangelos Arkalis +mail:arkalis.e@gmail.com +***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ + +#ifndef _RL_DF1_H_ +#define _RL_DF1_H_ + +#include "rlserial.h" +class df1Buffer; + +class rlDF1 +{ +public: + +/*!
+    Initialize class
+    src = id of local device
+    timeout = receive timeout in ms
+
*/ + rlDF1(unsigned char src=0, int timeout=1000); + virtual ~rlDF1(); + void registerSerial(rlSerial *serial); + + enum DF1ret { + retERROR_TNS = -6, + retERROR_STS = -5, + retERROR_CRC = -4, + retERROR_NAC = -3, + retERROR = -2, + retNORESPONSE = -1, + retSUCCESS = 0 + }; + + +/*!
+      Command: Set CPU mode ( See page 7-26 )
+      destination = destination ID
+      mode = CPUMODE value
+
*/ + enum CPUMODE { + PROGRAM = 0, + TEST, + RUN, + NOCHANGE + }; + int cmdSetCPUMode(unsigned char destination, unsigned char mode); +/*!
+        Command: Diagnostic Status
+        Reads a block of status information from an interface module.
+        The function returns the status information in data.
+        (see Chapter 10, Diagnostic Status Information.)
+
+        destination = destination ID
+        data = buffer for data return
+        returns the number of valid bytes in data or Error Code
+
*/ + int cmdDiagnosticStatus( unsigned char destination, unsigned char *data); +/*!
+        Command: protected typed logical read with three address fields
+        *Most Important command*. Reads data from a logical address.
+        Parameters:
+            destination = destination ID
+            nsize = size of data to be read
+            filetype = Type of file with number filenum
+                            84 hex: status
+                            85 hex: bit
+                            86 hex: timer
+                            87 hex: counter
+                            88 hex: control
+                            89 hex: integer
+                            8A hex: floating point
+                            8B hex: output logical by slot
+                            8C hex: input logical by slot
+                            8D hex: string
+                            8E hex: ASCII
+                            8F hex: BCD
+            filenum = filenumber in PLC memory
+            adr  = Elements Address (see Manual)
+            sadr = Subelements Address (see Manual)
+            data = buffer for data return
+        returns the number of valid bytes in data or Error Code
+
*/ + int cmdLogicalRead( unsigned char destination, unsigned char nsize, unsigned char filetype, unsigned char filenum, unsigned char adr, unsigned char sadr, unsigned char *buffer); +/*!
+        Command: protected typed logical write with three address fields
+        *Most Important command*. Writes data to a logical address.
+        Parameters:
+            destination = destination ID
+            nsize = size of data to write
+            filetype = Type of file with number filenum
+                            84 hex: status
+                            85 hex: bit
+                            86 hex: timer
+                            87 hex: counter
+                            88 hex: control
+                            89 hex: integer
+                            8A hex: floating point
+                            8B hex: output logical by slot
+                            8C hex: input logical by slot
+                            8D hex: string
+                            8E hex: ASCII
+                            8F hex: BCD
+            filenum = filenumber in PLC memory
+            adr  = Elements Address (see Manual)
+            sadr = Subelements Address (see Manual)
+            data = buffer of data to write
+        returns Error Code
+
*/ + int cmdLogicalWrite( unsigned char destination, unsigned char nsize, unsigned char filetype, unsigned char filenum, unsigned char adr, unsigned char sadr, unsigned char *buffer); +private: +/*!
+      Functions for Application Layer.
+      Normally private. If you want to add new Commands do it with new public functions.
+
+      sendCommand implements sending with retries and handling
+        destination = id of remote device
+        cmd = Command Code (see page 6-3)
+        sts = Status Code (see page 6-6 )
+        cdata = Pointer to Command Specific data packet ( Chapter 7 )
+        len = Length of cdata
+
+      receiveAnswer gets answer frame from remote.
+
+
*/ + int sendCommand( unsigned char destination, unsigned char cmd, unsigned char sts, unsigned char *cdata, unsigned char len); + int receiveAnswer( unsigned char &destination, unsigned char &cmd, unsigned char &sts, unsigned char *cdata, unsigned char &len); +/*!
+      Functions for Data Link Layer.
+      Internal Use ONLY.
+
*/ + enum DF1BytePos { + POS_DST =0, + POS_SRC =1, + POS_CMD =2, + POS_STS =3, + POS_TNSL =4, + POS_TNSH =5, + POS_DATA =6 + }; + enum DF1ControlChars { /// Page 2-6 of Ref Manual + SOH = 0x01, + STX = 0x02, + ETX = 0x03, + EOT = 0x04, + ENQ = 0x05, + ACK = 0x06, + DLE = 0x10, + NAC = 0x15 + }; + enum DF1Flags { + FLAG_TIMEOUT =-1, + FLAG_DATA =0, + FLAG_CONTROL =1 + }; + int writeBuffer( unsigned char *buffer, int len ); + int writeBuffer( df1Buffer& buffer ); + int getSymbol(unsigned char *c); + int get(unsigned char *c); + int sendENQ(); + int sendACK(); + int sendNAC(); + + + rlSerial *tty; + bool active; + unsigned short tns; + + int nRequests; + int nResponses; + unsigned char source; + int timeout; + +public: +/*!
+    Some statistics...
+
*/ + int requests() {return nRequests;}; + int responses() {return nResponses;}; + void clearStats() { nRequests=0; nResponses=0;}; +}; + + +#endif // _RL_DF1_H_ + +/* +// test program for rlDF1 +#include + +// Remote ID +const unsigned char id=1; + +rlSerial ser; +rlDF1 myplc; + + +int main(int argc, char *argv[]) +{ + int ret; + if ( ser.openDevice( "/dev/ttyS0", B19200, 0, 0 )!= 0 ) exit(-1); + printf("\nDevice OK"); + myplc.registerSerial( &ser ); /// Register Serial Port + + + printf("\n1.TEST CONNECTIVITY"); + ret = myplc.cmdSetCPUMode( id, rlDF1::NOCHANGE ); /// For Connectivity Test + if (ret<0) { + printf("\nDevice Error %d\n",ret); + exit(-1); + } + rlsleep(3000); + + + printf("\n2.SET PLC IN PROGRAM MODE"); + ret = myplc.cmdSetCPUMode( id, rlDF1::PROGRAM ); /// PROGRAM MODE + if (ret<0) { + printf("\nDevice Error %d\n",ret); + exit(-1); + } + rlsleep(3000); + + + printf("\n3.SET PLC IN RUN MODE"); + ret = myplc.cmdSetCPUMode( id, rlDF1::RUN ); /// RUN MODE + if (ret<0) { + printf("\nDevice Error %d\n",ret); + exit(-1); + } + rlsleep(3000); + + + printf("\n4.GET PLC STATUS BYTES (Read Manual for details)"); + unsigned char rbytes[256]; + ret = myplc.cmdDiagnosticStatus( id, rbytes ); + if (ret<0) { + printf("\nDevice Error %d\n",ret); + exit(-1); + } + for(int i=0;i \t%d \t%02X", i, rbytes[i], rbytes[i]); + printf("\n"); + rlsleep(3000); + + + printf("\n5.LOGICAL READ - Read 2 bytes from Inputs - I1:0"); + ret = myplc.cmdLogicalRead( id, 2, 0x8C, 1, 0, 0, rbytes ); /// 0x8C:Read Inputs by Slot: 2 bytes from Data File I1, starting at Address 0 [ I1:0 ] + if (ret<0) { + printf("\nDevice Error %d\n",ret); + exit(-1); + } + for(int i=0;i \t%d \t%02X", i, rbytes[i], rbytes[i]); + printf("\n"); + rlsleep(3000); + + + printf("\n6.LOGICAL WRITE - Write 2 bytes to Outputs - Q0:0 > CYCLE FROM 0.0 to 0.7, RESET 0.8-0.15\n"); + for(int i=0;i<8;i++) { + printf("SET Q0:0.%d",i); + rbytes[0]=0x01< RESET 0.0-0.15"); + rbytes[0]=0; /// Reset Outputs 0-15 + rbytes[1]=0; + ret = myplc.cmdLogicalWrite( id, 2, 0x8B, 0, 0, 0, rbytes ); /// 0x8B:Write Outputs by Slot: 2 bytes to Data File Q0, starting at Address 0 [ Q0:0 ] + if (ret<0) { + printf("\nDevice Error %d\n",ret); + exit(-1); + } + printf("\nDuring execution of this program, we had %d Requests and %d Responses to/from PLC\n", myplc.requests(), myplc.responses()); + + + ser.closeDevice(); +} +*/ diff --git a/libs/pvb/include/rllib/rleibnetip.h b/libs/pvb/include/rllib/rleibnetip.h new file mode 100644 index 0000000..dffb128 --- /dev/null +++ b/libs/pvb/include/rllib/rleibnetip.h @@ -0,0 +1,121 @@ +/*************************************************************************** + rleibnetip.h - description + ------------------- + begin : Wed Apr 04 2007 + copyright : (C) 2007 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_EIB_NET_IP_H_ +#define _RL_EIB_NET_IP_H_ + +#include "rldefine.h" +#include "rludpsocket.h" +#include "rlthread.h" +#include + +#define EIB_ON 0x81 +#define EIB_OFF 0x80 + +class rlDataAcquisitionProvider; + +/*!
+class for EIBnet/IP access
+
*/ +class rlEIBnetIP : public rlUdpSocket +{ +public: + + enum EIBnetIP + { + PORT = 3671, + SUCCESS = 0, + EIBERROR = 0x0ffffffff, + TIMEOUT = -1, + COULD_NOT_CONNECT = -2 + }; + + typedef struct + { + unsigned char headersize; + unsigned char version; + unsigned short servicetype; + unsigned short totalsize; + unsigned char data[128-6]; + }PDU; + + typedef struct + { + unsigned char mc; // 0x29 + unsigned char addi1; // 0x0 + unsigned char ctrl1; // 0xbc + unsigned char ctrl2; // 0xe0 + unsigned short saddr; // 0x1 + unsigned short daddr; // 0x100 + unsigned char apci_length; // 0x1 + unsigned char apci; // 0x0 + unsigned char val[14]; // 0x80 + }EIB_TEL; + + // this may be used by the application programmer + rlEIBnetIP(int num_signals = 1000, int debug = 0, rlDataAcquisitionProvider *provider = NULL); + virtual ~rlEIBnetIP(); + + int setServer(rlIpAdr *server); + int setClient(rlIpAdr *client); + int startReading(); + int stopReading(); + int value(const char *name); + unsigned int valueUnsigned(const char *name); + float valueFloat2(const char *name); + float valueFloat4(const char *name); + int setValue(const char *name, int val, int length=-1, int addi1=-1, int ctrl=-1, int apci=-1); + int setValueUnsigned(const char *name, unsigned int val, int length=-1, int addi1=-1, int ctrl=-1, int apci=-1); + int setValueFloat(const char *name, float val, int length=-1, int addi1=-1, int ctrl=-1, int apci=-1); + int setText(const char *name, const char *text); + int getText(const char *name, char *text, int maxlen); + int setSourceAdr(const char *adr); + int dump(FILE *fout); + int setValuesFromCSV(const char *filename); + int debug; + int watch_eib; + + // the rest is for internal use only + int connect(); + int disconnect(); + int isConnected(); +#ifndef SWIG_SESSION + int getDescription(PDU *pdu); +#endif + int recv(void *buf, int maxlen); + int storeBuffer(unsigned char *buf, int len); + int sendDisconnectRequest(); + + void *mem; + int memsize; + int running; + int channelid; + rlThread thread; + rlIpAdr *server; + int send_sequencecounter; + int tunnel_ack; + rlDataAcquisitionProvider *provider; + +private: + int printTelegram(EIB_TEL *tel); + int storeInProvider(EIB_TEL *tel); + rlIpAdr client; + rlIpAdr from; + int maxvalues; + int is_connected; + short saddr; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlevent.h b/libs/pvb/include/rllib/rlevent.h new file mode 100644 index 0000000..bb67c8a --- /dev/null +++ b/libs/pvb/include/rllib/rlevent.h @@ -0,0 +1,64 @@ +/*************************************************************************** + rlevent.h - description + ------------------- + begin : Wed Dec 18 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/*!
+These functions allow you to send event log messages over TCP/IP to the event log server
+implemented by the pvserver pcontrol (available as separate download)
+
+See also the class rlEventLogServer.
+
*/ +#ifndef _RL_EVENT_H_ +#define _RL_EVENT_H_ + +#include "rldefine.h" +#define rlMAX_EVENT 256 // maximum size of an event message + +static const char rlevent_name[][4] = { "INF", "WAR", "ERR", "CRI", "FAT", "TST" }; +enum EventTypes +{ + rlInfo = 0, + rlWarning, + rlError, + rlCritical, + rlFatal, + rlTest, + rlEVENT_SIZE +}; + +#ifdef XXXunix +#define rlEvent(typ, format, args...) { rlSetEventLocation(__FILE__,__LINE__); rlEventPrintf( typ, format, args); } +#else +#define rlEvent rlSetEventLocation(__FILE__,__LINE__);rlEventPrintf +#endif + +/*!
+initialize rlEvent
+parameters:
+-eventhost=adr
+-eventport=num
+
*/ +void rlEventInit(int ac, char **av, const char *module); + +/*!
+set the location where rlEvent is called
+
*/ +void rlSetEventLocation(const char *file, int line); + +/*!
+output the message
+
*/ +void rlEventPrintf(int event_type, const char *format, ...); + +#endif diff --git a/libs/pvb/include/rllib/rleventlogserver.h b/libs/pvb/include/rllib/rleventlogserver.h new file mode 100644 index 0000000..9ab01ed --- /dev/null +++ b/libs/pvb/include/rllib/rleventlogserver.h @@ -0,0 +1,79 @@ +/*************************************************************************** + rleventlogserver.h - description + ------------------- + begin : Wed Dec 18 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_EVENT_LOG_SERVER_H_ +#define _RL_EVENT_LOG_SERVER_H_ + +#include "rldefine.h" +#include "rlevent.h" +#include "rlthread.h" + +#define rlMAX_MESSAGES 128 + +/*!
+A class for implementing an event log server.
+You may use it with rlevent.h
+
*/ +class rlEventLogServer +{ + public: + /*!
+    the event log files will be called:
+    filename.rlEventLog
+    max_events = max number of events in one file
+    files may be purged by cron
+    
*/ + rlEventLogServer(const char *filename=NULL, int max_events=10000); + virtual ~rlEventLogServer(); + + /*!
+    num is the event number
+    num = -1 will retrieve all events
+    
*/ + const char *getEvent(char *buf, int *num); + void putEvent(const char *event); + + private: + char memory[rlMAX_MESSAGES*rlMAX_EVENT]; + rlMutex mutex; + int front; + int cnt; + char *filename; + void *fp; + int max_events, num_events; +}; + +/*!
+This class starts a separate thread, that runs a rlEventLogServer log server.
+It waits on TCP port for clients. See rlevent.h
+
*/ +class rlEventLogServerThreads +{ + public: + /*!
+    event_log_server will not be deleted by the destructor
+    
*/ + rlEventLogServerThreads(int port, rlEventLogServer *event_log_server); + virtual ~rlEventLogServerThreads(); + void start(); + int getPort(); + rlEventLogServer *event_log_server; + + private: + rlThread acceptThread; + int port; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlfifo.h b/libs/pvb/include/rllib/rlfifo.h new file mode 100644 index 0000000..d2b9ef8 --- /dev/null +++ b/libs/pvb/include/rllib/rlfifo.h @@ -0,0 +1,57 @@ +/*************************************************************************** + rlfifo.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_FIFO_H_ +#define _RL_FIFO_H_ + +#include "rldefine.h" +#include "rlthread.h" + +/*!
+class for a fifo. (first in first out)
+
*/ +class rlFifo +{ +private: + typedef struct _MessageList_ + { + char *mes; + int len; + struct _MessageList_ *next; + }MessageList; + +public: + rlFifo(int maxmessages=0); + virtual ~rlFifo(); + + enum FifoEnum { + DATA_AVAILABLE=-1, NO_DATA_AVAILABLE=-2, MESSAGE_TO_BIG=-3, FIFO_FULL=-4 + }; + + int read(void *buf, int maxlen); + int poll(); + int nmesAvailable(); + int write(const void *buf, int len); + int printf(const char *format, ...); + +private: + int maxmes; + int nmes; + MessageList *list; + WSEMAPHORE semaphore; + pthread_mutex_t mutex; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlfileload.h b/libs/pvb/include/rllib/rlfileload.h new file mode 100644 index 0000000..9ac9fb1 --- /dev/null +++ b/libs/pvb/include/rllib/rlfileload.h @@ -0,0 +1,50 @@ +/*************************************************************************** + rlfileload.h - description + ------------------- + begin : Fri Jul 28 2006 + copyright : (C) 2006 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_FILE_LOAD_H_ +#define _RL_FILE_LOAD_H_ + +#include "rldefine.h" +#include "rlstring.h" + +typedef struct _rlFileLines_ +{ + char *line; + struct _rlFileLines_ *next; +}rlFileLines; + +/*!
+This class loads a text file to memory.
+Then you can iterate to it's lines.
+
*/ +class rlFileLoad +{ + public: + rlFileLoad(); + virtual ~rlFileLoad(); + int load(const char *filename); + void unload(); + const char *firstLine(); + const char *nextLine(); + void setDebug(int state); + int text2rlstring(rlString &rlstring); + private: + int loaded; + int debug; + rlFileLines file_lines; + rlFileLines *current_line; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlhilschercif.h b/libs/pvb/include/rllib/rlhilschercif.h new file mode 100644 index 0000000..e810371 --- /dev/null +++ b/libs/pvb/include/rllib/rlhilschercif.h @@ -0,0 +1,76 @@ +/*************************************************************************** + rlhilschercif.h - description + ------------------- + begin : Tue Feb 13 2007 + copyright : (C) 2007 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_HILSCHER_CIF_H_ +#define _RL_HILSCHER_CIF_H_ + +#include "rldefine.h" +#include "rlthread.h" +#ifdef RLUNIX +#include "cif_user.h" /* Include file for device driver API */ +#else +#include "CIFUSER.h" +#endif +#include "rcs_user.h" /* Include file for RCS definition */ +#include "asc_user.h" /* Include file for ASCII protocols */ +#include "nvr_user.h" /* Include file for 3964R protocol */ + +/*!
+This class is for data access to Hilscher CIF cards
+like PROFIBUS ...
+It uses the driver provided by Hilscher and has access to it's dual ported RAM.
+
+Attention: In order to use this class on Linux as normal user you have to set
+chmod ugoa+rw /dev/cif
+
*/ +class rlHilscherCIF +{ +public: + rlHilscherCIF(); + virtual ~rlHilscherCIF(); + int debug; + + int open(); // convenience method + int close(); // convenience method + + int devGetMessage(int timeout); // use mailbox, uses tMessage + int devPutMessage(int timeout); // use mailbox, please set tMessage + int devExchangeIO(int sendOffset, int sendSize, unsigned char *sendData, + int receiveOffset, int receiveSize, unsigned char *receiveData, + int timeout); + + int devOpenDriver(); + int devInitBoard(); + int devGetInfo(int info); // info = GET_FIRMWARE_INFO | GET_IO_INFO + int devSetHostState(int mode); // mode = HOST_READY | HOST_NOT_READY + int devPutTaskParameter(); + int devReset(); + int devExitBoard(); + int devCloseDriver(); + void printFirmwareInfo(); + + unsigned short usBoardNumber; // Board number, 0-3 + unsigned short usDevState, usHostState; + unsigned char abInfo[300]; // Buffer for various information + ASC_PARAMETER aParameter; // Parameters for ASCII protocolls + IOINFO tIoInfo; // IO information structure + RCS_MESSAGETELEGRAM_10 tMessage; + + rlMutex mutex; + +private: + int isOpen; +}; +#endif diff --git a/libs/pvb/include/rllib/rlhistorylogger.h b/libs/pvb/include/rllib/rlhistorylogger.h new file mode 100644 index 0000000..f7a3743 --- /dev/null +++ b/libs/pvb/include/rllib/rlhistorylogger.h @@ -0,0 +1,55 @@ +/*************************************************************************** + rlhistorylogger.h - description + ------------------- + begin : Wed Dec 06 2006 + copyright : (C) 2006 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_HISTORY_LOGGER_H_ +#define _RL_HISTORY_LOGGER_H_ + +#include "rldefine.h" +#include "rltime.h" +#include "rlthread.h" +#include + +typedef struct _rlHistoryLogLine_ +{ + _rlHistoryLogLine_ *next; + char *line; +}rlHistoryLogLine; + +/*!
+This class logs tab separated text including time stamp in 10 csv files + actual values in memory
+This is for archiveing historical data with time stamp.
+You should separate the text in pushLine with tab.
+
*/ +class rlHistoryLogger +{ +public: + rlHistoryLogger(const char *csvName, int maxHoursPerFile, int maxLinesInMemory=100); + virtual ~rlHistoryLogger(); + int pushLine(const char *text); + const char *firstLine(); + const char *nextLine(); + rlMutex mutex; + int debug; +private: + int pushLineToMemory(const char *line); + int pushLineToFile(const char *line); + int openFile(); + rlHistoryLogLine *first_line,*current_line; + rlTime time,file_start_time,time_diff; + FILE *fout; + int max_hours_per_file, max_lines_in_memory, current_file; + char *csv_name, *csv_file_name; +}; +#endif diff --git a/libs/pvb/include/rllib/rlhistoryreader.h b/libs/pvb/include/rllib/rlhistoryreader.h new file mode 100644 index 0000000..b05dd37 --- /dev/null +++ b/libs/pvb/include/rllib/rlhistoryreader.h @@ -0,0 +1,106 @@ +/*************************************************************************** + rlhistoryreader.h - description + ------------------- + begin : Wed Dec 06 2006 + copyright : (C) 2006 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_HISTORY_READER_H_ +#define _RL_HISTORY_READER_H_ + +#include "rldefine.h" +#include "rltime.h" +#include + +typedef struct _rlHistoryReaderLine_ +{ + _rlHistoryReaderLine_ *next; + char *line; +}rlHistoryReaderLine; + +/*!
+This class reads tab separated text including time stamp from 10 csv files
+Use it together with rlHistoryLogger.
+
+Example usage within pvbrowser slot function:
+
+#include "rlhistoryreader.h"
+
+typedef struct // (todo: define your data structure here)
+{
+  rlHistoryReader hist;
+}
+DATA;
+
+...snip...
+
+static int slotButtonEvent(PARAM *p, int id, DATA *d)
+{
+  if(p == NULL || id == 0 || d == NULL) return -1;
+  if(id == buttonShowPlot)
+  {
+    rlTime tStart, tDiff, tEnd;
+    tStart.year  = 2009;
+    tStart.month = 8;
+    tStart.day   = 29;
+    tStart.hour  = 0;
+
+    tDiff.hour = 24;
+
+    tEnd = tStart + tDiff;
+
+    printf("start=%s diff=%s end=%s\n",tStart.getTimeString(), tDiff.getTimeString(), tEnd.getTimeString());
+
+    if(d->hist.read("test", &tStart, &tEnd) < 0)
+    {
+      printf("could not read test csv file\n");
+      return 0;
+    }
+    const char *line = d->hist.firstLine();
+    while(*line != '\\0')
+    {
+      printf("line=%s", line);
+      const char *values = strchr(line,'\t');
+      if(values != NULL)
+      {
+        float val1, val2;
+        sscanf(values,"\t%f\t%f", &val1, &val2);
+        printf("val1=%f val2=%f\n", val1, val2);
+        //// fill your buffer for plotting here
+      }
+      line = d->hist.nextLine();
+    }
+    //// display your xy-graphic from the filled buffer here
+  }
+  return 0;
+}
+
*/ +class rlHistoryReader +{ +public: + rlHistoryReader(); + virtual ~rlHistoryReader(); + int read(const char *csvName, rlTime *start, rlTime *end); + const char *firstLine(); + const char *nextLine(); + int clean(); + int cat(const char *csvName, FILE *fout); + int debug; +private: + int openFile(); + int pushLineToMemory(const char *line); + rlHistoryReaderLine *first_line,*current_line; + rlTime time; + FILE *fin; + int current_file; + char *csv_name, *csv_file_name; +}; +#endif diff --git a/libs/pvb/include/rllib/rlhtml.h b/libs/pvb/include/rllib/rlhtml.h new file mode 100644 index 0000000..82bb148 --- /dev/null +++ b/libs/pvb/include/rllib/rlhtml.h @@ -0,0 +1,46 @@ +/*************************************************************************** + rlhtml.h - description + ------------------- + begin : Thu Jul 30 2015 + copyright : (C) Lehrig Software Enigineering + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_HTML_H_ +#define _RL_HTML_H_ + +#include "rldefine.h" +#include "rlstring.h" + +/*!
+conveniance base class for html
+
*/ +class rlHtml +{ +public: + rlHtml(); + virtual ~rlHtml(); + + /*!
+  html can be configured with rlhtml.css
+  
*/ + const char *htmlHeader(); + const char *htmlTrailer(); + /*!
+  html representation of text file
+  
*/ + int textFile(const char *filename, rlString &text); + /*!
+  hexdump representation of text file
+  
*/ + int hexdumpFile(const char *filename, rlString &text); +}; + +#endif diff --git a/libs/pvb/include/rllib/rlhtmldir.h b/libs/pvb/include/rllib/rlhtmldir.h new file mode 100644 index 0000000..39919da --- /dev/null +++ b/libs/pvb/include/rllib/rlhtmldir.h @@ -0,0 +1,70 @@ +/*************************************************************************** + rlhtmldir.h - description + ------------------- + begin : Thu Jul 30 2015 + copyright : (C) Lehrig Software Enigineering + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_HTMLDIR_H_ +#define _RL_HTMLDIR_H_ + +#include "rlhtml.h" +#include "rlspreadsheet.h" + +/*!
+class for a file selector with html
+
*/ +class rlHtmlDir : public rlHtml +{ +public: + enum + { + list_files_and_directories = 1, + list_directories_only = 2, + list_files_only = 3 + }WHAT_TO_LIST; + + rlHtmlDir(); + virtual ~rlHtmlDir(); + + /*!
+  dir := ".." | "absolute_path" | "relative_path"
+  
*/ + int cd(const char *dir, int is_initial_dir=0); + + /*!
+  html can be configured with rlhtml.css
+  
*/ + const char *getHtml(int generate_html_header_and_trailer=1); + + /*!
+  list of filenames found
+  return: number of files found
+  
*/ + int getFilenames(rlSpreadsheetRow *row); + + rlString initialPath; // initial path + rlString currentPath; // current path + rlString pattern; // search pattern for rlfind, default * + int recursive; // 0|1 + int list_what; // enum WHAT_TO_LIST + int hide_hidden_files; // 0|1 + rlString textHome; // default Home: + rlString textPath; // default Path: + rlString textrlHtmlDirCSS; // default rlhtml.css + + rlString startHtml; // default html is empty + rlString endHtml; // default html is empty +private: + rlString html; // header + startHtml + rlfind_results + endHtml + trailer +}; + +#endif diff --git a/libs/pvb/include/rllib/rlinifile.h b/libs/pvb/include/rllib/rlinifile.h new file mode 100644 index 0000000..eea9f15 --- /dev/null +++ b/libs/pvb/include/rllib/rlinifile.h @@ -0,0 +1,126 @@ +/*************************************************************************** + rlinifile.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_INI_FILE_H_ +#define _RL_INI_FILE_H_ + +#include "rldefine.h" +#include "rlstring.h" + +/*!
+class for INI files as known from Windows.
+
*/ +class rlIniFile +{ +public: + rlIniFile(); + virtual ~rlIniFile(); + int read(const char *filename); + int write(const char *filename); + const char *filename(); + const char *text(const char *section, const char *name); + void setText(const char *section, const char *name, const char *text); + int printf(const char *section, const char *name, const char *format, ...); + void remove(const char *section); + void remove(const char *section, const char *name); + const char *firstSection(); + const char *nextSection(); + const char *firstName(const char *section); + const char *nextName(const char *section); + void setDefaultSection(const char *section); + const char *defaultSection(); + /*!
+  Use this method for translating text within your application.
+
+  Example:
+  ini->setDefaultSection("german");
+  printf("german_text=%s\n", ini->i18n("text1","This is text1") );
+  
*/ + const char *i18n(const char *tag, const char *default_text=""); + /*!
+  Use this method for translating text within your application.
+
+  Example:
+
+  #define TR(txt) d->translator.tr(txt)
+
+  typedef struct // (todo: define your data structure here)
+  {
+        rlIniFile translator;
+  }
+  DATA;
+
+  static int slotInit(PARAM *p, DATA *d)
+  {
+    if(p == NULL || d == NULL) return -1;
+    d->translator.read("text.ini");
+    d->translator.setDefaultSection("DEUTSCH");
+    printf("test1=%s\n", TR("umlaute"));
+    printf("test2=%s\n", TR("Xumlaute"));
+    d->translator.setDefaultSection("ENGLISH");
+    printf("test1=%s\n", TR("umlaute"));
+    printf("test2=%s\n", TR("Xumlaute"));
+  }
+
+  With text.ini:
+  [DEUTSCH]
+  hello=Hallo
+  world=Welt
+  umlaute=äöüß
+
+  [ENGLISH]
+  hello=Hello
+  world=World
+  umlaute=german_umlaute=äöüß
+  
*/ + const char *tr(const char *txt); +private: + typedef struct _rlSectionName_ + { + _rlSectionName_ *nextName; + char *name; + char *param; + }rlSectionName; + + typedef struct _rlSection_ + { + _rlSection_ *nextSection; + rlSectionName *firstName; + char *name; + }rlSection; + + void copyIdentifier(char *buf, const char *line); + void copyName(char *buf, const char *line); + void copyParam(char *buf, const char *line); + void deleteSectionNames(rlSection *section); + rlSection *_firstSection; + int currentSection, currentName; + rlString fname; + rlString default_section; +}; + +int rlSetTranslator(const char *language, const char *inifile=NULL); +#ifndef SWIGPYTHON +const char *rltranslate(const char *txt, char **mytext=NULL); +const char *rltranslate2(const char *section, const char *txt, char **mytext=NULL); +#define rltr(txt) rltranslate(txt) + +#ifdef pvtr +#undef pvtr +#endif +#define pvtr(txt) rltranslate2(p->lang_section,txt,&p->mytext2) +#endif + +#endif diff --git a/libs/pvb/include/rllib/rlinterpreter.h b/libs/pvb/include/rllib/rlinterpreter.h new file mode 100644 index 0000000..61c0518 --- /dev/null +++ b/libs/pvb/include/rllib/rlinterpreter.h @@ -0,0 +1,39 @@ +/*************************************************************************** + rlinterpreter.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_INTERPRETER_H_ +#define _RL_INTERPRETER_H_ + +#include "rldefine.h" + +/*!
+A class for interpreting text.
+
*/ +class rlInterpreter +{ +public: + rlInterpreter(int Maxline=rl_PRINTF_LENGTH); + virtual ~rlInterpreter(); + + char *line; + int isCommand(const char *command); + void copyStringParam(char *destination, int index); + int maxchar(); + +private: + int maxline; +}; + +#endif diff --git a/libs/pvb/include/rllib/rllib.h b/libs/pvb/include/rllib/rllib.h new file mode 100644 index 0000000..8e68745 --- /dev/null +++ b/libs/pvb/include/rllib/rllib.h @@ -0,0 +1,43 @@ +// include all headers from rllib +#ifndef _RLLIB_H +#define _RLLIB_H + +#include "rlspawn.h" +#include "rlwthread.h" +#include "rlthread.h" +#include "rlsocket.h" +#include "rltime.h" +#include "rlmailbox.h" +#include "rlfifo.h" +#include "rlsharedmemory.h" +#include "rlspreadsheet.h" +#include "rlinifile.h" +#include "rlinterpreter.h" +#include "rlpcontrol.h" +#include "rlcutil.h" +#include "rldefine.h" +#include "rlevent.h" +#include "rleventlogserver.h" +#include "rldataprovider.h" +#include "rlserial.h" +#include "rlmodbus.h" +#include "rlmodbusclient.h" +#include "rl3964r.h" +#include "rlsiemenstcp.h" +#include "rlsiemenstcpclient.h" +#include "rlcontroller.h" +#include "rlppiclient.h" +#include "rlsvganimator.h" +#include "rlsvgcat.h" +#include "rlfileload.h" +#include "rlhistorylogger.h" +#include "rlhistoryreader.h" +//#include "rlhilschercif.h" // include this separately because it will produce warnings +#include "rludpsocket.h" +#include "rleibnetip.h" +#include "rlopcxmlda.h" +#include "rldataacquisition.h" +#include "rldataacquisitionprovider.h" +#include "rlstring.h" + +#endif diff --git a/libs/pvb/include/rllib/rlmailbox.h b/libs/pvb/include/rllib/rlmailbox.h new file mode 100644 index 0000000..8f8c8c1 --- /dev/null +++ b/libs/pvb/include/rllib/rlmailbox.h @@ -0,0 +1,127 @@ +/*************************************************************************** + rlmailbox.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_MAILBOX_H_ +#define _RL_MAILBOX_H_ + +#include "rldefine.h" + +/*!
+class for a mailbox.
+
+A mailbox is for communication between processes on the same computer.
+It works like a fifo.
+Many processes can write to 1 mailbox.
+Only 1 reader is allowed.
+
*/ +class rlMailbox +{ +public: + enum MailboxEnum + { + /// return codes for write() + MAILBOX_ERROR = -1, + MAILBOX_FULL = -2, + /// wait parameter for read() + WAIT = 1, + NOWAIT = 0, + /// maximum mailbox length + MAX_MAILBOX = 256*256, + /// status: + OK = 2, + COULD_NOT_CREATE_MAILBOX = 3, + COULD_NOT_GET_KEY = 4, + COULD_NOT_GET_CHAN_ID = 5 + }; + + /*!
+  construct a named mailbox
+  
*/ + rlMailbox(const char *name); + + /*!
+  destruct the mailbox
+  
*/ + virtual ~rlMailbox(); + + /*!
+  write buf with length len to mailbox
+  return: bytes written
+          MAILBOX_ERROR
+          MAILBOX_FULL
+  
*/ + int write(const void *buf, int len); + + /*!
+  similar to printf
+  return: bytes written
+          MAILBOX_ERROR
+          MAILBOX_FULL
+  
*/ + int printf(const char *format, ...); + + /*!
+  read buf from mailbox, maxlen=Maximal length of buf
+  return: number of bytes read
+  wait = 0 no wait
+  wait = 1 wait for message
+  
*/ + int read(void *buf, int maxlen, int wait=WAIT); + + /*!
+  set the size of buffer for "const char *read(int wait)"
+  
*/ + int setReadBufferSize(int size); + + /*!
+  read buffer from mailbox
+  return: buffer | ""
+  wait = 0 no wait
+  wait = 1 wait for message
+  
*/ + const char *read(int wait=WAIT); + + /*!
+  write message to mailbox
+  return: bytes written
+          MAILBOX_ERROR
+          MAILBOX_FULL
+  
*/ + int write(const char *message); + + /*!
+  read all messages from mailbox, clear them
+  
*/ + void clear(); + + /*!
+  should be: OK
+  can be:    COULD_NOT_CREATE_MAILBOX
+             COULD_NOT_GET_CHAN_ID
+  
*/ + int status; + + /*!
+  Name of mailbox
+  
*/ + char *name; + +private: + int chanid; + int buffer_size; + char *buffer; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlmodbus.h b/libs/pvb/include/rllib/rlmodbus.h new file mode 100644 index 0000000..502011c --- /dev/null +++ b/libs/pvb/include/rllib/rlmodbus.h @@ -0,0 +1,257 @@ +/*************************************************************************** + rlmodbus.h - description + ------------------- + begin : Tue Mar 13 2003 + copyright : (C) 2003 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_MODBUS_H_ +#define _RL_MODBUS_H_ + +#include "rldefine.h" +#include "rlsocket.h" +#include "rlserial.h" + +/*!
+This class implements the modbus protocol.
+You can use serial interfaces or TCP/IP.
+Modbus RTU and ASCII are available.
+
+All Modbus requests include "slave" and "function".
+Then some bytes follow, which are specific to a given function.
+The request is then terminated by a checksum.
+
+This table shows the bytes that are specific to a given function.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionQueryResponse
01 Read Coil StatusStart adr high
Start adr low
Number of points high
Number of points low
Data Byte Count
Data1
Data2 …
8 points per byte
02 Read Input StatusStart adr high
Start adr low
Number of points high
Number of points low
Data Byte Count
Data1
Data2 …
8 points per byte
03 Read Holding RegistersStart adr high
Start adr low
Number of points high
Number of points low
Data Byte Count
Data1 high
Data1 low
Data2 high
Data2 low…
1 point needs 2 bytes
04 Read Input RegistersStart adr high
Start adr low
Number of points high
Number of points low
Data Byte Count
Data1 high
Data1 low
Data2 high
Data2 low…
1 point needs 2 bytes
05 Force Single CoilCoil adr high
Coil adr low
Force data high
Force data low
Coil adr high
Coil adr low
Force data high
Force data low
Force data ON = 0x0ff00
Force data OFF = 0
06 Preset Single RegisterRegister adr high
Register adr low
Preset data high
Preset data low
Register adr high
Register adr low
Preset data high
Preset data low

07 Read Exception Status
Coil data8 exception status coils returned
11 Fetch Comm Event Counter
Status high
Status low
Event Count high
Event Count low

12 Fetch Comm Event Log

See: PI_MODBUS_300.pdf
15 Force Multiple CoilsCoil adr high
Coil adr low
Number of coils high
Number of coils low
Force data byte count
Force data1
Force data2 ...
Coil adr high
Coil adr low
Number of coils high
Number of coils low
8 coils per byte
16 Preset Multiple RegistersStart adr high
Start adr low
Number of registers high
Number of registers low
Data byte count
Data1 high
Data1 low
Data2 high
Data2 low …
Start adr high
Start adr low
Number of registers high
Number of registers low

17 Report Slave ID
Data Byte count ~ device specificSee: PI_MODBUS_300.pdf
20 Read General Reference

See: PI_MODBUS_300.pdf
21 Write General Reference

See: PI_MODBUS_300.pdf
22 Mask Write 4X Register

See: PI_MODBUS_300.pdf
23 Read/Write 4X Registers

See: PI_MODBUS_300.pdf
24 Read FIFO Queue

See: PI_MODBUS_300.pdf
+ +*/ + +class rlModbus +{ + public: +/*!
+data exchanged by Modbus is either: 
+1byte unsigned for coils 
+2byte unsigned for registers
+
+Helper union for converting Modbus data to data types that are not standard Modbus data types
+Example:
+rlModbus::DATA data;
+data.u_short[0] = registers[0]; // store an unsigned 16 bit register in union data
+printf("print registers[0] as signed int value=%d\n", data.s_short[0]);
+
*/ + typedef union + { + unsigned char u_char[4]; // 4 * 8bit_data, unsigned + char s_char[4]; // 4 * 8bit_data, signed + unsigned short u_short[2]; // 2 * 16bit_data, signed + short s_short[2]; // 2 * 16bit_data, signed + unsigned int u_int; // 1 * 32bit_data, unsigned + int s_int; // 1 * 32bit_data, signed + float s_float; // 1 * 32bit_data, signed + }DATA; + + enum Modbus + { + MODBUS_CHECKSUM_ERROR = -2, + MODBUS_ERROR = -1, + MODBUS_SUCCESS = 0, + MODBUS_RTU = 1, + MODBUS_ASCII = 2 + }; + + enum ModbusFunctionCodes + { + ReadCoilStatus = 1, + ReadInputStatus = 2, + ReadHoldingRegisters = 3, + ReadInputRegisters = 4, + ForceSingleCoil = 5, + PresetSingleRegister = 6, + ReadExceptionStatus = 7, + FetchCommEventCtr = 11, + FetchCommEventLog = 12, + ForceMultipleCoils = 15, + PresetMultipleRegs = 16, + ReportSlaveID = 17, + ReadGeneralReference = 20, + WriteGeneralReference = 21, + MaskWrite4XRegisters = 22, + ReadWrite4XRegisters = 23, + ReadFifoQueue = 24 + }; + + rlModbus(long max_telegram_length = 1024, int mode = MODBUS_RTU, char end_delimitor = 0x0a); + virtual ~rlModbus(); + int write (int slave, int function, const unsigned char *data, int len, int *transactionID = NULL); + int request (int slave, int function, int start_adr, int num_register); + int response(int *slave, int *function, unsigned char *data, int timeout=1000); + int readRequest(int *slave, int *function, unsigned char *data, int timeout=1000, int *transactionID = NULL); + void registerSocket(rlSocket *socket); + void registerSerial(rlSerial *serial); + int data2int(const unsigned char *data); + int int2data(int val, unsigned char *data); + int intsize(); + int autoreconnectSocket; + int readCoilStatus (int slave, int start_adr, int number_of_coils, unsigned char *status, int timeout=1000); + int readInputStatus (int slave, int start_adr, int number_of_inputs, unsigned char *status, int timeout=1000); +/*!
+We assume positive values for registers: 0 <= registers < 256*256
+
*/ + int readHoldingRegisters (int slave, int start_adr, int number_of_registers, int *registers, int timeout=1000); +/*!
+We assume positive values for registers: 0 <= registers < 256*256
+
*/ + int readInputRegisters (int slave, int start_adr, int number_of_registers, int *registers, int timeout=1000); + int forceSingleCoil (int slave, int coil_adr, int value, int timeout=1000); +/*!
+We assume positive values for registers: 0 <= value < 256*256
+
*/ + int presetSingleRegister (int slave, int register_adr, int value, int timeout=1000); +/*!
+We assume positive values for registers: 0 <= registers < 256*256
+
*/ + int forceMultipleCoils (int slave, int coil_adr, int number_of_coils, unsigned char *coils, int timeout=1000); +/*!
+We assume positive values for registers: 0 <= registers < 256*256
+
*/ + int presetMultipleRegisters (int slave, int start_adr, int number_of_registers, int *registers, int timeout=1000); + + private: + int buf2int_rtu(unsigned char *buf); + void int2buf_rtu(int i, unsigned char *buf); + int buf2int_ascii(unsigned char *buf); + void int2buf_ascii(int i, unsigned char *buf); + void insertLRC(int len); + void insertCRC(int len); + int LRCerror(int len); + int CRCerror(int len); + rlSocket *s; + rlSerial *tty; + unsigned char *tel; + long maxtel; + int mode; + char delimitor; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlmodbusclient.h b/libs/pvb/include/rllib/rlmodbusclient.h new file mode 100644 index 0000000..d9540a2 --- /dev/null +++ b/libs/pvb/include/rllib/rlmodbusclient.h @@ -0,0 +1,44 @@ +/*************************************************************************** + rlmodbusclient.h - description + ------------------- + begin : Wed Jan 07 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_MODBUS_CLIENT_H_ +#define _RL_MODBUS_CLIENT_H_ + +#include "rldefine.h" +#include "rlmodbus.h" +#include "rlmailbox.h" +#include "rlsharedmemory.h" + +/*!
+This class is for data aqusition over a modbus daemon as created by pvdevelop.
+It communicates over a shared memory and a mailbox according to the pvbrowser principle.
+
*/ +class rlModbusClient : public rlMailbox, public rlSharedMemory +{ + public: + rlModbusClient(const char *mbxname, const char *shmname, int shmsize); + virtual ~rlModbusClient(); + int write(int slave, int function, const unsigned char *data, int len); + int writeSingleCoil(int slave, int adr, int value); + int writeMultipleCoils(int slave, int adr, const unsigned char *values, int num_coils); + int writePresetSingleRegister(int slave, int adr, int value); + int writePresetMultipleRegisters(int slave, int adr, const int *values, int num_values); + int readBit(int offset, int number); + int readByte(int offset, int number); + int readShort(int offset, int number); +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlopcxmlda.h b/libs/pvb/include/rllib/rlopcxmlda.h new file mode 100644 index 0000000..1f4d739 --- /dev/null +++ b/libs/pvb/include/rllib/rlopcxmlda.h @@ -0,0 +1,78 @@ +/*************************************************************************** + rlopcxmlda.h - description + ------------------- + begin : Mon Aug 27 2007 + copyright : (C) 2007 by pvbrowser + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/** +use this class together with opcxmlda_client. +opcxmlda_client will fill the shared memory with variables read over opc xml-da. +opcxmlda_client will receive outgoing writes through it's mailbox. +*/ + +#ifndef _RL_OPC_XML_DA_H_ +#define _RL_OPC_XML_DA_H_ + +#include "rldefine.h" +#include "rlmailbox.h" +#include "rlsharedmemory.h" + +/*!
+This class is for data acquisition within pvserver according to the pvbrowser principle.
+It communicates with the daemon opcxmlda_client by the means of a shared memory and a mailbox.
+
*/ +class rlOpcXmlDa +{ +public: + // shared memory header + typedef struct + { + char ident[4]; // must be "opc" + int maxItemNameLength; // maximum length of an item name + int maxNameLength; // maximum length of the item value + int numItems; // number of items in shared memory + int readErrorCount; // 0...65536 incremented by each read error + int writeErrorCount; // 0...65536 incremented by each write error + int spare[8]; // for future use + char cspare[32]; // for future use + }SHM_HEADER; + + enum OPC_XML_DA_ENUM + { + OPCXMLDA_ERROR = 256*256*128 + }; + +#ifdef RLWIN32 + rlOpcXmlDa(const char *mailbox="c:\\automation\\mbx\\opcxmlda.mbx", const char *shared_memory="c:\\automation\\shm\\opcxmlda.shm", long shared_memory_size=65536); +#else + rlOpcXmlDa(const char *mailbox="/srv/automation/mbx/opcxmlda.mbx", const char *shared_memory="/srv/automation/shm/opcxmlda.shm", long shared_memory_size=65536); +#endif + virtual ~rlOpcXmlDa(); + const char *stringValue(const char *variable); + int intValue(const char *variable); + float floatValue(const char *variable); + int writeStringValue(const char *variable, const char *value); + int writeIntValue(const char *variable, int value); + int writeFloatValue(const char *variable, float value); + int readErrorCount(); + int writeErrorCount(); + int shmStatus(); // 0 if shared memory is ok | ERROR if shared memory is not ok + +private: + SHM_HEADER *shmheader; + const char *shmvalues; + rlMailbox *mbx; + rlSharedMemory *shm; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlpcontrol.h b/libs/pvb/include/rllib/rlpcontrol.h new file mode 100644 index 0000000..b1f50e6 --- /dev/null +++ b/libs/pvb/include/rllib/rlpcontrol.h @@ -0,0 +1,141 @@ +/*************************************************************************** + rlspawn.h - description + ------------------- + begin : Wed Dec 11 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_PCONTROL_H_ +#define _RL_PCONTROL_H_ + +#include "rltime.h" + +/*!
+A class for starting/stoping/monitoring other processes.
+
*/ +class rlPcontrol +{ + public: + /*!
+    construct a process control object
+    
*/ + rlPcontrol(); + + /*!
+    deconstruct the process control object
+    
*/ + virtual ~rlPcontrol(); + + /*!
+    set the startup command and the process_name
+    
*/ + void setStartupCommand(const char *command, const char *process_name); + + /*!
+    start the process
+    
*/ + int start(); + + /*!
+    stop the process with SIGTERM
+    
*/ + int sigterm(); + + /*!
+    stop the process with SIGKILL
+    
*/ + int sigkill(); + + /*!
+    test if process is alive
+    
*/ + int isAlive(); + + /*!
+    get startup command
+    
*/ + const char *startupCommand(); + + /*!
+    get process name
+    
*/ + const char *processName(); + + /*!
+    get process time start/stop
+    
*/ + rlTime *processTime(); + + /*!
+    set process id
+    
*/ + void setPID(long pid); + + /*!
+    get process id
+    
*/ + long pid(); + + /*!
+    get next object in list
+    
*/ + rlPcontrol *getNext(); + + /*!
+    add and return a new rlPcontrol object
+    
*/ + rlPcontrol *addNew(); +#ifdef __VMS + /*!
+    set input filename or logical
+    
*/ + void setInput (const char *input); + + /*!
+    set output filename or logical
+    
*/ + void setOutput(const char *output); + + /*!
+    set error filename or logical
+    
*/ + void setError (const char *error); +#endif + + /*!
+    set priority default=8
+    
*/ + void setPriority(int priority); + + /*!
+    get priority
+    
*/ + int priority(); + + private: + int rlstrlen(const char *str); + char *startup_command, *process_name; + +#ifdef __VMS + char *m_input, *m_output, *m_error; +#endif + +#ifdef RLWIN32 + long m_dwProcessId; +#endif + + long m_pid; + rlTime process_time; + rlPcontrol *next; + int prio; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlplc.h b/libs/pvb/include/rllib/rlplc.h new file mode 100644 index 0000000..e99a611 --- /dev/null +++ b/libs/pvb/include/rllib/rlplc.h @@ -0,0 +1,95 @@ +/*************************************************************************** + rlplc.h - description + ------------------- + begin : Tue Dec 11 2008 + copyright : (C) 2008 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_PLC_H_ +#define _RL_PLC_H_ + +#include "rldefine.h" +#include "rlsharedmemory.h" + +class rlPlcState +{ + public: + rlPlcState(int numInt=100, int numFloat=100, int numDouble=0, const char *shared_memory=NULL); + virtual ~rlPlcState(); + int *i, *i_old; + float *f, *f_old; + double *d, *d_old; + void clear(); + void rememberState(); + int intChanged(int index); + int floatChanged(int index); + int doubleChanged(int index); + int intHasIncreased(int index); + int floatHasIncreased(int index); + int doubleHasIncreased(int index); + int intHasDecreased(int index); + int floatHasDecreased(int index); + int doubleHasDecreased(int index); + int deltaInt(int index); + float deltaFloat(int index); + double deltaDouble(int index); + void set(int index, int bit); + void clear(int index, int bit); + int isSet(int index, int bit); + int isClear(int index, int bit); + int hasBeenSet(int index, int bit); + int hasBeenCleared(int index, int bit); + int maxInt(); + int maxFloat(); + int maxDouble(); + int getInt(int index); + float getFloat(int index); + double getDouble(int index); + int getOldInt(int index); + float getOldFloat(int index); + double getOldDouble(int index); + rlSharedMemory *shm; + + private: + int max_int, max_float, max_double; +}; + +class rlPlcMem +{ + public: + rlPlcMem(); + virtual ~rlPlcMem(); + int i, i_old; + float f, f_old; + double d, d_old; + void rememberState(); + int intChanged(); + int floatChanged(); + int doubleChanged(); + int intHasIncreased(); + int floatHasIncreased(); + int doubleHasIncreased(); + int intHasDecreased(); + int floatHasDecreased(); + int doubleHasDecreased(); + int deltaInt(); + float deltaFloat(); + double deltaDouble(); + void set(int bit); + void clear(int bit); + int isSet(int bit); + int isClear(int bit); + int hasBeenSet(int bit); + int hasBeenCleared(int bit); +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlppiclient.h b/libs/pvb/include/rllib/rlppiclient.h new file mode 100644 index 0000000..e0e1d87 --- /dev/null +++ b/libs/pvb/include/rllib/rlppiclient.h @@ -0,0 +1,64 @@ +/*************************************************************************** + rlppiclient.h - description + ------------------- + begin : Mon Jul 12 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_PPI_CLIENT_H_ +#define _RL_PPI_CLIENT_H_ + +#include "rldefine.h" +#include "rlmailbox.h" +#include "rlsharedmemory.h" + +/*!
+This class is for data acquisition from pvserver according to the pvbrowser principle.
+The according daemon is generated by pvdevelop.
+It communicates by the means of a shared memory and a mailbox.
+
*/ +class rlPPIClient : public rlMailbox, rlSharedMemory +{ + public: + enum PPI_area + { + daveSD = 0x3, + daveInputs = 0x81, + daveOutputs = 0x82, + daveFlags = 0x83, + daveDB = 0x84, //data blocks + daveDI = 0x85, //not tested + daveLocal = 0x86, //not tested + daveV = 0x87, // don't know what it is + daveCounter = 28, //not tested + daveTimer = 29 //not tested + }; + rlPPIClient(const char *mbxname, const char *shmname, int shmsize, int have_to_swap=1); + virtual ~rlPPIClient(); + int write(int slave, int area, int dbnum, int start, int len, const unsigned char *data); + int writeFloat(int slave, int area, int dbnum, int start, int len, const float *val); + int writeDword(int slave, int area, int dbnum, int start, int len, const int *val); + int writeShort(int slave, int area, int dbnum, int start, int len, const short *val); + int writeUDword(int slave, int area, int dbnum, int start, int len, const unsigned int *val); + int writeUShort(int slave, int area, int dbnum, int start, int len, const unsigned short *val); + int read(int offset, int len); + float Float(int index); + int Dword(int index); + int Short(int index); + unsigned int UDword(int index); + unsigned int UShort(int index); + unsigned char buf[512]; // after calling read, the data is here + private: + int have_to_swap; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlreport.h b/libs/pvb/include/rllib/rlreport.h new file mode 100644 index 0000000..a6180ce --- /dev/null +++ b/libs/pvb/include/rllib/rlreport.h @@ -0,0 +1,155 @@ +/*************************************************************************** + rlreport.h - description + ------------------- + begin : Sun Jul 03 2011 + copyright : (C) 2011 pvbrowser + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_REPORT_H_ +#define _RL_REPORT_H_ + +#include +#include "rldefine.h" +#include "rlinifile.h" +#include "rlstring.h" + +/*!
+class for generating PDF files with LaTeX
+
+//### typical usage begin  #############################################
+int report(PARAM *p)
+{
+  rlReport r;
+  rlString filename;
+  filename  = p->file_prefix; // use an individual filename for each client
+  filename += ".tex";
+  r.open(filename.text());
+  r.includeHeader("\\documentclass[a4paper]{article}","\\usepackage[ngerman]{babel}"); // german article on A4 paper
+  //// here we may include our own header definitions
+
+  r.beginDocument();
+  //// --- begin here we use the methods: printf(), include(), includeCSV(), includeImage(), spawn() --------------
+  r.printf("\\section{Teil 1}\n");
+  r.printf("Hallo Welt\n");
+  r.includeImage("test.jpg","Testbild",0.8f);
+  r.includeCSV("test.csv",1,"Test CSV");
+  r.printf("\\cppbegin{main.cpp}\n");
+  r.include("main.cpp");
+  r.printf("\\end{lstlisting}\n");
+  r.printf("\\simplecodebegin{Verzeichnis Inhalt}\n");
+  r.spawn("ls -al");
+  r.printf("\\end{lstlisting}\n");
+  //// --- end here we use the methods: printf(), include(), includeCSV(), includeImage(), spawn() ----------------
+  r.endDocument();
+  r.close();
+
+  r.pdflatex(); // pdflatex -interaction=nonstopmode file.tex
+
+  filename  = p->file_prefix;
+  filename += ".pdf";
+  pvDownloadFileAs(p,filename.text(), "report.pdf");
+  pvClientCommand(p,"pdf","report.pdf"); // open report.pdf on the client using the pdf-viewer
+  return 0;
+}
+//### typical usage end  ###############################################
+
*/ +class rlReport +{ +public: + + rlReport(); + virtual ~rlReport(); + + /*!
+      open the output file for writeing
+  
*/ + int open(const char *filename); + + /*!
+      close the output file
+  
*/ + int close(); + + /*!
+      print text to the output file
+  
*/ + int printf(const char *format, ...); + + /*!
+      print "\\begin{document}"  to the output file
+  
*/ + int beginDocument(); + + /*!
+      print "\\end{document}"  to the output file
+  
*/ + int endDocument(); + + /*!
+      Include a file to the output.
+      If ini != NULL then the content of ini can be used as text modules as follows:
+      Withnin file we use something like \\$[SECTION][NAME] to address the text module we want to include.
+  
*/ + int include(const char *filename, rlIniFile *ini=NULL); + + /*!
+      Include the LaTeX header to the output file.
+      If optional_parameter == NULL then output the default parameters.
+      Examples:
+        includeHeader("\\usepackage[a4paper]{article}", "\\usepackage[ngerman]{babel}");
+        includeHeader("\\usepackage[a4paper]{book}",    "\\usepackage[english,greek]{babel}");
+      See:
+        http://en.wikibooks.org/wiki/LaTeX/Internationalization
+      Our default LaTeX header is within the fprintf() statements of rlReport::includeHeader()
+        You may printf() or include() more header definitions and then call
+        r.beginDocument();
+  
*/ + int includeHeader(const char *documentclass = "\\documentclass[a4paper]{article}", + const char *language = "\\usepackage[english]{babel}", + const char *inputenc = "\\usepackage[utf8]{inputenc}", + const char *layout = "\\setlength{\\parindent}{0pt} \\setlength{\\topmargin}{-50pt} \\setlength{\\oddsidemargin}{0pt} \\setlength{\\textwidth}{480pt} \\setlength{\\textheight}{700pt}"); + + /*!
+      print a CSV table  to the output file
+      filename := name.csv
+      use_first_row_as_title := 0 | 1
+      legend := NULL | text_describing_the_table
+  
*/ + int includeCSV(const char *filename, int use_first_row_as_title=1, const char *legend=NULL, char delimitor='\t'); + + /*!
+      Include a graphic into our document.
+      filename := name.jpg | name.png
+      legend := NULL | text_describeing_the_image
+  
*/ + int includeImage(const char *filename, const char *legend=NULL, float scale=1.0f); + + /*!
+      Run the external "command" and include what is printed by "command" to the output file.
+      This works as follows:
+        sprintf(cmd,"%s > %s.temp", command, file.text())
+        system(cmd);
+        include(file.text() + ".temp");
+  
*/ + int spawn(const char *command); + /*!
+      Run "pdflatex -interaction=nonstopmode file.tex" if command==NULL or
+      what you specify by your own command.
+  
*/ + int pdflatex(const char *command = NULL); + +private: + FILE *fout; // output file pointer + rlString file; // name of the output file +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlserial.h b/libs/pvb/include/rllib/rlserial.h new file mode 100644 index 0000000..d253439 --- /dev/null +++ b/libs/pvb/include/rllib/rlserial.h @@ -0,0 +1,135 @@ +/*************************************************************************** + rlserial.cpp - description + ------------------- + begin : Sat Dec 21 2002 + copyright : (C) 2002 by R. Lehrig + email : lehrig@t-online.de + + RMOS implementation: + Copyright : (C) 2004 Zertrox GbR + Written by : Alexander Feller + Email : feller@zertrox.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/*!
+With this class you can communicate over a serial line.
+
*/ +#ifndef _RL_SERIAL_H_ +#define _RL_SERIAL_H_ + +#include "rlthread.h" + +#ifdef RLUNIX +#include +#endif + +#ifndef B0 +// speed will be defined by termios.h, this is just for documentation +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#endif + +/*!
+With this class you can communicate over a serial line.
+
*/ +class rlSerial +{ + public: + enum Parity + { + NONE = 0, + ODD , + EVEN + }; + + rlSerial(); + virtual ~rlSerial(); + /** +
+    On OpenVMS please set the tt parameters at DCL level E.g.:
+    $ set term /perm/pasthru  -
+               /eightbit      -
+               /nottsync      -
+               /nohostsync    -
+               /noreadsync    -
+               /type          -
+               /noline        -
+               /altype        -
+               /parity=even   -
+               /speed=9600 tta1:
+
+    devicename := /dev/ttyX (unix) | COMx (Windows) | ttaX: (OpenVMS) 
+    speed      := B50 ... B4000000                                    
+    block      := 0 | 1 (bool)                                        
+    rtscts     := 0 | 1 (bool)                                        
+    bits       := 7 | 8 (unix) | 4-8 (Windows)                        
+    stopbits   := 1 | 2                                               
+    parity     := rlSerial::NONE | rlSerial::ODD | rlSerial::EVEN     
+    return == 0  success, return < 0 error
+    
+ */ + int openDevice(const char *devicename, int speed=B9600, int block=1, int rtscts=1, int bits=8, int stopbits=1, int parity=rlSerial::NONE); + int select(int timeout=500); + int readChar(); + int writeChar(unsigned char uchar); + int readBlock(unsigned char *buf, int len, int timeout=-1); + int writeBlock(const unsigned char *buf, int len); + int readLine(unsigned char *buf, int maxlen, int timeout=1000); + int closeDevice(); + //! on := 0 | 1 (bool) + void setTrace(int on); + private: +#ifdef RLUNIX + struct termios save_termios; +#endif +#ifdef __VMS + unsigned short int vms_channel; +#endif +#ifdef RLWIN32 + HANDLE hdl; +#endif +#ifdef RM3 + int device, uint, com, baudrate; +#endif + enum { RESET, RAW, CBREAK } ttystate; + int ttysavefd; + int fd,trace; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlsharedmemory.h b/libs/pvb/include/rllib/rlsharedmemory.h new file mode 100644 index 0000000..b1f0ed5 --- /dev/null +++ b/libs/pvb/include/rllib/rlsharedmemory.h @@ -0,0 +1,77 @@ +/*************************************************************************** + rlsharedmemory.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SHARED_MEMORY_H_ +#define _RL_SHARED_MEMORY_H_ + +#include "rldefine.h" +#include "rlwthread.h" + +/*!
+class for a shared memory.
+
+A shared memory is a piece of RAM that is shared between processes.
+If many processes have access to the same RAM, it is necessary to lock the shared memory.
+The read/write methods will do this and copy the data to local data.
+If you want direct access, you may use getUserAdr().
+
*/ +class rlSharedMemory +{ +public: + enum SharedMemoryEnum + { + OK = 0, + ERROR_FILE, + ERROR_SHMGET, + ERROR_SHMAT, + ERROR_SHMCTL + }; + + /*! rwmode := access rights under unix. default 0600 user=read,write */ + rlSharedMemory(const char *name, unsigned long size, int rwmode=0600); + virtual ~rlSharedMemory(); + int deleteSharedMemory(); + int write(unsigned long offset, const void *buf, int len); + int read (unsigned long offset, void *buf, int len); + int readInt(unsigned long offset, int index); + int readShort(unsigned long offset, int index); + int readByte(unsigned long offset, int index); + float readFloat(unsigned long offset, int index); + int writeInt(unsigned long offset, int index, int val); + int writeShort(unsigned long offset, int index, int val); + int writeByte(unsigned long offset, int index, unsigned char val); + int writeFloat(unsigned long offset, int index, float val); + void *getUserAdr(); + int shmKey(); + int shmId(); + unsigned long size(); + int status; + char *name; +private: + int id; + int shmkey; + char *base_adr; + char *user_adr; + unsigned long _size; + pthread_mutex_t *mutex; +#ifdef RLWIN32 + HANDLE hSharedFile; + OVERLAPPED overlapped; +#elif defined(RLUNIX) + int fdlock; +#endif +}; + +#endif diff --git a/libs/pvb/include/rllib/rlsiemenstcp.h b/libs/pvb/include/rllib/rlsiemenstcp.h new file mode 100644 index 0000000..37038fa --- /dev/null +++ b/libs/pvb/include/rllib/rlsiemenstcp.h @@ -0,0 +1,255 @@ +/*************************************************************************** + rlsiemenstcp.h - description + ------------------- + begin : Mon Mar 08 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + + S7_200 update : Wed Mar 21 2007 + copyright : (C) 2007 by Aljosa Merljak + Email : aljosa.merljak@datapan.si + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SIEMENS_TCP_H_ +#define _RL_SIEMENS_TCP_H_ + +#include "rldefine.h" +#include "rlsocket.h" + +/*!
+class for communication with Siemens PLC's via TCP
+
+(1) There is the old Fetch/Write protocol from the old S5 PLC (fetch_write=1).
+
+(2) And there is the current Siemens PLC protocol introduced with the S7 series of PLC (fetch_write=0).
+
+According to
+http://www.ietf.org/rfc/rfc0905.txt
+the client will send a connection request to the PLC after it has establisched a TCP connection().
+
+Here is a example connect_block for a Siemens S7 PLC (CBxx in hex):
+CB00= 3, ISO_HEADER_VERSION
+CB01= 0, ISO_HEADER_RESERVED
+CB02= 0, ISO_HEADER_LENGHT_HIGH
+CB03=16, ISO_HEADER_LENGHT_LOW = 22 Byte (hex 16)
+CB04=11, Length Indicator Field = 17 dec = 22 byte_total_length - 1 byte_length_indicator - 4 byte_ISO_HEADER
+CB05=E0, Connection Request Code (Bits 8-5) 1110=E, Initial Credit Allocation (Bits 4-1) Class 0
+CB06= 0, DESTINATION-REF-HIGH
+CB07= 0, DESTINATION-REF-LOW
+CB08= 0, SOURCE-REF-HIGH
+CB09= 1, SOURCE-REF-LOW
+CB10= 0, Class and Option
+CB11=C1, Identifier: Calling TSAP will follow
+CB12= 2, Parameter Length, 2 byte will follow
+CB13= 1, Remote TSAP, free to choose on client side       (1=PG,2=OP,3=Step7Basic) suggested
+CB14= 0, Remote TSAP, free to choose on client side       (upper_3_bit_is_rack / lower_5_bit_is_slot) suggested
+CB15=C2, Identifier: Called TSAP will follow
+CB16= 2, Parameter Length, 2 byte will follow
+CB17= 1, Local TSAP,  set within Step7 = 1                (1=PG,2=OP,3=Step7Basic)
+CB18= 0, Local TSAP,  set within Step7 = 0...connectionN  (upper_3_bit_is_rack / lower_5_bit_is_slot)
+CB19=C0, Identifier: Maximum TPDU size will follow
+CB20= 1, Parameter Length, 1 byte will follow 
+CB21= 9, max 512 octets 
+
+For the different PLC types the connect_block looks as follows:
+s7_200  = {3,0,0,16,0x11,0xE0,0x00,0x00,0x00,0x01,0x00,0xC1,2,'M','W',0xC2,2,'M','W',0xC0,1,9} 
+s7_300  = {3,0,0,16,0x11,0xE0,0x00,0x00,0x00,0x01,0x00,0xC1,2,  1,0  ,0xC2,2,  1,2  ,0xC0,1,9} on S7_300 slot of cpu is always 2
+s7_400  = {3,0,0,16,0x11,0xE0,0x00,0x00,0x00,0x01,0x00,0xC1,2,  1,0  ,0xC2,2,  1,3  ,0xC0,1,9} on S7_400 slot of cpu is always 3
+s7_1200 = {3,0,0,16,0x11,0xE0,0x00,0x00,0x00,0x01,0x00,0xC1,2,  1,0  ,0xC2,2,  1,0  ,0xC0,1,9} slot may be 0 || 1 and TSAP 03.01 || 10.00
+s7_logo = {3,0,0,22,0x11,0xE0,0x00,0x00,0x00,0x01,0x00,0xC1,2,  2,0  ,0xC2,2,  2,0  ,0xC0,1,9} 
+For S7_200 and S7_1200 read: (only symbolic access to DB1) 
+http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=21601611&caller=view
+
+According to the Remote TSAP Siemens makes the following statement:
+######################################################################################
+Remote TSAP (Remote Transport Service Access Point, entfernter Dienstzugangspunkt)
+The representation is the same as with the Local TSAP, 
+but the second byte has another meaning:
+- first Byte: contains a device id (allowed 02 or 03)
+02 OS (Operating Station Bedienen und Beobachten)
+03 other
+suggested: 02
+- second Byte: contains the adressing within the SIMATIC S7-CPU,
+divided in:
+Bit 7 ... 5 Rack (Subsystem) of the S7-CPU
+Bit 4 ... 0 Slot of the S7-CPU
+Hint: It is suggested to choose the same settings for Byte 1 in Remote and Local TSAP
+######################################################################################
+
+When you use our rlSiemensTCP class you can do it as follows:
+
+unsigned char cb[22];
+rlSiemensTCP *plc = new rlSiemensTCP(adr);
+plc->getDefaultConnectBlock(cb);
+cb[13] = 1; // set 1 Byte of Remote TSAP
+cb[14] = 0; // set 2 Byte of Remote TSAP
+cb[17] = 1; // set Local TSAP of the PLC to the
+cb[18] = 0; // configuration done within Step 7 
+plc->setConnectBlock(cb);
+
+Now you can read/write the PLC.
+
+The following matrix shows some combinations:
+--------------------------------------------
+             | CB13    CB14    CB17   CB18
+--------------------------------------------
+S7_200       | 'M'     'W'      'M'    'W'
+--------------------------------------------
+S7_300       |  1       0        1      2
+--------------------------------------------
+S7_400       |  1       0        1      3
+--------------------------------------------
+S7_1200      |  1       0        1      0
+--------------------------------------------
+S7_logo 0BA7 |  2       0        2      0
+--------------------------------------------
+
+CB17 = (1=PG,2=OP,3=Step7Basic)
+CB18 = (upper_3_bit_is_rack / lower_5_bit_is_slot)
+Thus the above would be:
+A TSAP within Step 7 of 10.00 results in: cb[17] = PG; cb[18] = 0; // rack=0 slot=0 
+A TSAP within Step 7 of 10.01 results in: cb[17] = PG; cb[18] = 1; // rack=0 slot=1
+A TSAP within Step 7 of 10.02 results in: cb[17] = PG; cb[18] = 2; // rack=0 slot=2
+A TSAP within Step 7 of 10.03 results in: cb[17] = PG; cb[18] = 3; // rack=0 slot=3
+
+You may use rlSiemensTCP with the individual plc_type for conveniance.
+But you can set the whole connect_block and use ANY_SIEMENS_COMPATIBLE_PLC.
+
+Please use Wireshark or tcpdump if the settings of the above matrix do not work for you.
+Send us your results.
+
+PS: Still wondering about 'M' 'W' on S7-200
+
*/ +class rlSiemensTCP : public rlSocket +{ +public: + enum ORG + { + ORG_DB = 1, + ORG_M = 2, + ORG_E = 3, + ORG_A = 4, + ORG_PEPA = 5, + ORG_Z = 6, + ORG_T = 7 + }; + enum PLC_TYPE + { + ANY_SIEMENS_COMPATIBLE_PLC = 1000, + S7_200 = 1, + S7_300 = 2, + S7_400 = 3, + S5 = 4, + RACK_SLOT = 5, + S7_1200 = 6, // patch from user slammera from our forum (8 Nov 2012) + LOGO = 7 // LOGO! 0BA7, according to jjmg_engenharia from our forum (3 Sep 2013) + }; + enum SiemensFunctionCodes + { + WriteBit = 1, + WriteByte = 2 + }; + rlSiemensTCP(const char *adr, int _plc_type=rlSiemensTCP::ANY_SIEMENS_COMPATIBLE_PLC, int _fetch_write = 1, int function = -1, int rack_slot = -1); + virtual ~rlSiemensTCP(); + /*!
+  
*/ + int getDefaultConnectBlock(unsigned char *connect_block); + int setConnectBlock(const unsigned char *connect_block); + int getConnectBlock(unsigned char *connect_block); + int write(int org, int dbnr, int start_adr, int length, const unsigned char *buf, int function=WriteByte); + int fetch(int org, int dbnr, int start_adr, int length, unsigned char *buf); +private: + void doConnect(); + int read_iso(unsigned char *buf); + int write_iso(unsigned char *buf, int len); + int getOrg(int org); + int write_bit(int& i, int org, int dbnr, int start_adr, int len, const unsigned char *buf); + int write_byte(int& i, int org, int dbnr, int start_adr, int length, const unsigned char *buf); + typedef struct + { + unsigned char version; + unsigned char reserved; + unsigned char length_high; + unsigned char length_low; + }IH; // iso header + typedef struct + { + unsigned char ident[2]; + unsigned char header_len; + unsigned char ident_op_code; + unsigned char op_code_len; + unsigned char op_code; + unsigned char ident_org_block; + unsigned char len_org_block; + unsigned char org_block; + unsigned char dbnr; + unsigned char start_adr[2]; + unsigned char len[2]; + unsigned char spare1; + unsigned char spare1_len; + }WH; // write header + typedef struct + { + unsigned char ident[2]; + unsigned char header_len; + unsigned char ident_op_code; + unsigned char op_code_len; + unsigned char op_code; + unsigned char ack_block; + unsigned char ack_block_len; + unsigned char error_block; + unsigned char spare1; + unsigned char spare1_len; + unsigned char spare2[5]; + }WA; // write ack + typedef struct + { + unsigned char ident[2]; + unsigned char header_len; + unsigned char ident_op_code; + unsigned char op_code_len; + unsigned char op_code; + unsigned char ident_org_block; + unsigned char len_org_block; + unsigned char org_block; + unsigned char dbnr; + unsigned char start_adr[2]; + unsigned char len[2]; + unsigned char spare1; + unsigned char spare1_len; + }FH; // fetch header + typedef struct + { + unsigned char ident[2]; + unsigned char header_len; + unsigned char ident_op_code; + unsigned char op_code_len; + unsigned char op_code; + unsigned char ack_block; + unsigned char ack_block_len; + unsigned char error_block; + unsigned char spare1; + unsigned char spare1_len; + unsigned char spare2[5]; + }FA; // fetch ack + WH wh; + WA wa; + FH fh; + FA fa; + IH ih; + int function, rack_slot; + int plc_type; + int fetch_write; + unsigned char pdu[2048]; + int use_cb; + unsigned char cb[22]; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlsiemenstcpclient.h b/libs/pvb/include/rllib/rlsiemenstcpclient.h new file mode 100644 index 0000000..a3e97d6 --- /dev/null +++ b/libs/pvb/include/rllib/rlsiemenstcpclient.h @@ -0,0 +1,67 @@ +/*************************************************************************** + rlsiemenstcpclient.h - description + ------------------- + begin : Mon Mar 08 2004 + copyright : (C) 2004 by R. Lehrig + email : lehrig@t-online.de + + S7_200 update : Wed Mar 21 2007 + copyright : (C) 2007 by Aljosa Merljak + Email : aljosa.merljak@datapan.si + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SIEMENS_TCP_CLIENT_H_ +#define _RL_SIEMENS_TCP_CLIENT_H_ + +#include "rldefine.h" +#include "rlsiemenstcp.h" +#include "rlmailbox.h" +#include "rlsharedmemory.h" + +/*!
+This class is for data acquisition within pvserver according to the pvbrowser principle.
+The corresponding daemon is generated by pvdevelop.
+It communicates by the means of a shared memory and a mailbox.
+
*/ +class rlSiemensTCPClient : public rlMailbox, rlSharedMemory +{ + public: + enum ORG + { + ORG_DB = 1, + ORG_M = 2, + ORG_E = 3, + ORG_A = 4, + ORG_PEPA = 5, + ORG_Z = 6, + ORG_T = 7 + }; + rlSiemensTCPClient(const char *mbxname, const char *shmname, int shmsize, int have_to_swap=1); + virtual ~rlSiemensTCPClient(); + int write(int slave, int org, int dbnum, int start, int len, const unsigned char *buf, int function); + int writeBit(int slave, int org, int dbnum, int start, int offset, int len, const unsigned char *buf); + int writeByte(int slave, int org, int dbnum, int start, int len, const unsigned char *val); + int writeFloat(int slave, int org, int dbnum, int start, int len, const float *val); + int writeDword(int slave, int org, int dbnum, int start, int len, const int *val); + int writeShort(int slave, int org, int dbnum, int start, int len, const short *val); + int writeUDword(int slave, int org, int dbnum, int start, int len, const unsigned int *val); + int writeUShort(int slave, int org, int dbnum, int start, int len, const unsigned short *val); + int read(int offset, int len); + float Float(int index); + int Dword(int index); + int Short(int index); + unsigned int UDword(int index); + unsigned int UShort(int index); + unsigned char buf[2048]; // after calling read, the data is here + private: + int have_to_swap; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlsocket.h b/libs/pvb/include/rllib/rlsocket.h new file mode 100644 index 0000000..36ba220 --- /dev/null +++ b/libs/pvb/include/rllib/rlsocket.h @@ -0,0 +1,270 @@ +/*************************************************************************** + rlsocket.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SOCKET_H_ +#define _RL_SOCKET_H_ + +#include "rldefine.h" +#include "rlstring.h" +#ifdef RLWIN32 +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include "unistd.h" +#endif + +/*!
+you have to call this function before you use any sockets
+(at least under windows)
+
*/ +#define wsa rlwsa +int rlwsa(); +int rlScoketWrite(int *socket, const void *buf, int len); + +/*!
+class for encapsulating TCP/IP socket calls
+
*/ +class rlSocket +{ +public: + + enum SocketEnum + { + SOCKET_ERR = -1, + SETSOCKOPT_ERR = -2, + LISTEN_ERR = -3, + ACCEPT_ERR = -4, + INET_ADDR_ERR = -5, + CONNECT_ERR = -6, + PORT_ERR = -7 + }; + + /*!
+      construct a new rlSocket but do not connect
+      adr  = hostname | dotted address
+      port = port number of socket
+      active = 0 wait for connections with accept()
+      active = 1 open the connection with connect()
+      active = 2 neither accept() nor connect()
+  
*/ + rlSocket(const char *adr, int port, int active); + + /*!
+      construct a new rlSocket
+      use connection on open socket
+  
*/ + rlSocket(int socket); + + + /*!
+      destruct the socket
+      attention if active = 0 the socket will still be bound to port
+  
*/ + virtual ~rlSocket(); + + /*!
+      set adr to a different adr than in the constructor
+  
*/ + void setAdr(const char *adr); + + /*!
+      set port to a different port than in the constructor
+  
*/ + void setPort(int port); + + /*!
+      get port
+  
*/ + int getPort(); + + /*!
+      set port active = 0|1
+  
*/ + void setActive(int active); + + /*!
+      read a block of data
+      len = length of data to be read
+      timeout = 0 wait indefinite
+      timeout > 0 wait at maximum for timeout milliseconds
+      return > 0 length of message read
+      return == 0 timeout
+      return < 0 error
+  
*/ + int read(void *buf, int len, int timeout=0); + + /*!
+      read a '\n' terminated string
+      len = max length of data to be read
+      timeout = 0 wait indefinite
+      timeout > 0 wait at maximum for timeout milliseconds
+      return > 0 length of message read
+      return == 0 timeout
+      return < 0 error
+  
*/ + int readStr(char *buf, int len, int timeout=0); + + /*!
+      read a http header and return Content-Length
+      return < 0 error
+  
*/ + int readHttpHeader(rlString *header, int timeout=0); + + /*!
+      write a block of data
+      return > 0 length of data written
+      return < 0 error
+  
*/ + int write(const void *buf, int len); + + /*!
+      similar to printf
+      return > 0 length of data written
+      return < 0 error
+  
*/ + int printf(const char *format, ...); + + /*!
+      connect
+      return >= 0 socket used
+      return < 0  error (see: enum SocketEnum)
+  
*/ + int connect(); + + /*!
+      disconnect
+      return = 0
+  
*/ + int disconnect(); + + /*!
+      wait for data arriving on socket
+      timeout > 0 timeout in milliseconds
+      timeout == 0 indefinite timeout
+      return = 1 DATA_AVAILABLE
+      return = 0 TIMEOUT
+  
*/ + int select(int timeout=0); + + /*!
+      return == 1 socket is connected
+      return == 0 socket is not connected
+  
*/ + int isConnected(); + + /*!
+      default: prefer IPV4
+      if(ip==6) prefer IPV6
+      else      prefer IPV4
+  
*/ + int setIPVersion(int version); + + /*!
+      return == 4 IPV4
+      return == 6 IPV6
+  
*/ + int getIPVersion(); + + /*!
+      This method is intendet for data providers implemented as ProcessViewServer
+  
*/ + int sendProcessViewBrowserButtonEvent(int id); + + /*!
+      this is the real socket used for communication
+      s >= 0  connected
+      s == -1 disconnected
+  
*/ + int s; + + /*!
+      portable version of getsockopt
+  
*/ + static int rlGetsockopt(int sockfd, int level, int optname, void *optval, int *optlen); + + /*!
+      portable version of setsockopt
+  
*/ + static int rlSetsockopt(int sockfd, int level, int optname, const void *optval, int optlen); + + /*!
+      get an option from this->s
+  
*/ + int rlGetsockopt(int level, int optname); + + /*!
+      set an option on this->s
+  
*/ + int rlSetsockopt(int level, int optname); + + /*!
+      read the response to a http get request until Content-Length is received
+      Tip: char line[256];
+  
*/ + int readHttpContentLength(int timeout); + + /*!
+      this array can be casted to (struct sockaddr *) &sockaddr[0];
+      in case of active==0 it will store sockaddr of the last client
+      (48 bytes spare)
+
+      struct sockaddr {
+        unsigned short    sa_family;    // address family, AF_xxx
+        char              sa_data[14];  // 14 bytes of protocol address
+      };
+
+      // IPv4 AF_INET sockets:
+      struct sockaddr_in {
+        short            sin_family;   // e.g. AF_INET, AF_INET6
+        unsigned short   sin_port;     // e.g. htons(3490)
+        struct in_addr   sin_addr;     // see struct in_addr, below
+        char             sin_zero[8];  // zero this if you want to
+      };
+      struct in_addr {
+        unsigned long s_addr;          // load with inet_pton()
+      };
+
+      // IPv6 AF_INET6 sockets:
+      struct sockaddr_in6 {
+        u_int16_t       sin6_family;   // address family, AF_INET6
+        u_int16_t       sin6_port;     // port number, Network Byte Order
+        u_int32_t       sin6_flowinfo; // IPv6 flow information
+        struct in6_addr sin6_addr;     // IPv6 address
+        u_int32_t       sin6_scope_id; // Scope ID
+      };
+      struct in6_addr {
+          unsigned char   s6_addr[16];   // load with inet_pton()
+      };
+  
*/ + unsigned char sockaddr[16+48]; + +private: + char adr[132]; + int port; + int active; + int os; + int first; + int prefer_ipv6; + int rl_ipversion; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlspawn.h b/libs/pvb/include/rllib/rlspawn.h new file mode 100644 index 0000000..bb2d53e --- /dev/null +++ b/libs/pvb/include/rllib/rlspawn.h @@ -0,0 +1,169 @@ +/*************************************************************************** + rlspawn.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SPAWN_H_ +#define _RL_SPAWN_H_ + +#include "rldefine.h" + +#ifndef RLUNIX +//#warning This Functionality is only available under Linux/Unix +/* +http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574%28v=vs.85%29.aspx +http://www.tenouk.com/cpluscodesnippet/pipeandchildprocess.html +http://msdn.microsoft.com/en-us/library/windows/desktop/aa365780%28v=vs.85%29.aspx + +GetFileNameFromHandle +http://msdn.microsoft.com/en-us/library/windows/desktop/aa366789%28v=vs.85%29.aspx +*/ +#endif + +/*!
+Spawn an external program.
+Redirect \ \ \ of external program to this class
+
+Now you can communicate with this external program over a pipe.
+Attention: This class is only available on unix like systems.
+
*/ +class rlSpawn +{ +public: + rlSpawn(); + virtual ~rlSpawn(); + + /*!
+  Start an operating system command.
+  The output from the command can be read with readLine()
+  You can write to the program with writeString() or write()
+  Return: 0=success -1=error
+  
*/ + int spawn(const char *command); + + /*!
+  Read a line from the spawned command.
+  When the command terminates NULL is returned.
+  
*/ + const char *readLine(); + + /*!
+  Read a char from the spawned command.
+  When the command terminates EOF is returned.
+  
*/ + int getchar(); + + /*!
+  Wait for characters.
+  return = 0 // timeout
+  return = 1 // characters available
+  
*/ + int select(int timeout=50); + + /*!
+  Write buf to \ of spawned command
+  buf must be 0 terminated
+  Return: number of bytes written
+          -1 error
+  
*/ + int writeString(const char *buf); + + /*!
+  Write buf to \ of spawned command
+  Return: number of bytes written
+          -1 error
+  
*/ + int write(const char *buf, int len); + + /*!
+  similar to printf
+  Return: number of bytes written
+          -1 error
+  
*/ + int printf(const char *format, ...); + + /*!
+  Print all outputs from spawned command to \
+  
*/ + void printAll(); + + /*!
+  Get FILE pointer fromChild
+  
*/ + FILE *getFilepointer(); + + /*!
+  Kill process on other side of pipe
+  
*/ + int sigkill(); + + /*!
+  Read JPEG buffer fromChild
+  return: length of buffer | -1 as error
+
+  Example: A thread continiously reads the mjpeg output of ffmpeg and stores it in jpegBuffer
+
+  rlThread mythread;
+  unsigned char jpegBuffer[256*256*16];
+
+  void *myThread(void *arg) // define your thread function
+  {
+    rlSpawn spawn;
+
+    restart:  
+    if(arg == NULL) return NULL;
+        
+    THREAD_PARAM  *p = (THREAD_PARAM *) arg;
+    //myThreadsData *d = (myThreadsData *) p->user;
+    spawn.spawn("ffmpeg -f video4linux2 -i /dev/v4l/by-id/usb-046d_0825_A867B3D0-video-index0 -vf \"transpose, hflip\" -r 10 -f mjpeg pipe:1");  
+    while(p->running)
+    {
+      int ret = spawn.readJpegBuffer(jpegBuffer,sizeof(jpegBuffer));
+      printf("ret=%d\n",ret);
+      if(ret < 0) goto restart;
+    }
+    return arg;
+  }
+
+  Example: The jpegBuffer can now be Send to a Image Widget on the pvbrowser client
+ 
+  extern rlThread mythread;
+  extern unsigned char jpegBuffer[];
+
+  static int slotNullEvent(PARAM *p, DATA *d)
+  {
+    if(p == NULL || d == NULL) return -1;
+    pvSendJpegFrame(p,imgWebcam,jpegBuffer);
+    return 0;
+  }
+
+  
*/ + int readJpegBuffer(unsigned char *buffer, int maxbuffer); + + int pid; + +private: +#ifdef RLWIN32 + HANDLE toChildRD; + HANDLE toChildWR; + HANDLE fromChildRD; + HANDLE fromChildWR; + HANDLE hThread; + HANDLE hProcess; +#else + void *toChild,*fromChild; +#endif + char line[4096]; // adjust this if the buffer is not big enough +}; + +#endif diff --git a/libs/pvb/include/rllib/rlspreadsheet.h b/libs/pvb/include/rllib/rlspreadsheet.h new file mode 100644 index 0000000..ca5de9d --- /dev/null +++ b/libs/pvb/include/rllib/rlspreadsheet.h @@ -0,0 +1,116 @@ +/*************************************************************************** + rlspreadsheet.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SPREADSHEET_H_ +#define _RL_SPREADSHEET_H_ + +#include "rldefine.h" + +/*!
+A cell of a spreadsheet.
+
*/ +class rlSpreadsheetCell +{ +public: + rlSpreadsheetCell(const char *text=0); + virtual ~rlSpreadsheetCell(); + const char *text(); + void setText(const char *text); + int printf(const char *format, ...); + void clear(); + void setNextCell(rlSpreadsheetCell *next); + rlSpreadsheetCell *getNextCell(); + int exists(); +private: + char *txt; + rlSpreadsheetCell *nextCell; +}; + +/*!
+A row within a spreadsheet.
+
*/ +class rlSpreadsheetRow +{ +public: + //! column = 1...N + rlSpreadsheetRow(); + virtual ~rlSpreadsheetRow(); + const char *text(int column); + void setText(int column, const char *text); + int printf(int column, const char *format, ...); + void clear(); + void setNextRow(rlSpreadsheetRow *next); + rlSpreadsheetRow *getNextRow(); + rlSpreadsheetCell *getFirstCell(); + void readRow(const unsigned char *line, char delimitor='\t'); + void writeRow(void *fp, char delimitor='\t'); + int exists(int column); +private: + rlSpreadsheetCell *firstCell; + rlSpreadsheetRow *nextRow; +}; + +/*!
+A spreadsheet Table.
+The class works with CSV files.
+
*/ +class rlSpreadsheetTable +{ +public: + //! column = 1...N, row = 1...N + rlSpreadsheetTable(char delimitor='\t'); + virtual ~rlSpreadsheetTable(); + const char *text(int column, int row); + void setText(int column, int row, const char *text); + int printf(int column, int row, const char *format, ...); + void clear(); + int read(const char *filename); + int write(const char *filename); + void setNextTable(rlSpreadsheetTable *next); + rlSpreadsheetTable *getNextTable(); + rlSpreadsheetRow *getFirstRow(); + int exists(int column, int row); + void setDelimitor(char delimitor); +private: + char delimitor; + rlSpreadsheetRow *firstRow; + rlSpreadsheetTable *nextTable; +}; + +/*!
+A series of spreadsheet tables.
+The class works with CSV files.
+
*/ +class rlSpreadsheetWorkbook +{ +public: + //! column = 1...N, row = 1...N, page = 1...N + rlSpreadsheetWorkbook(char delimitor='\t'); + virtual ~rlSpreadsheetWorkbook(); + const char *text(int column, int row, int page); + void setText(int column, int row, int page, const char *text); + int printf(int column, int row, int page, const char *format, ...); + void clear(); + int read(const char *filename); + int write(const char *filename); + int exists(int column, int row, int page); + rlSpreadsheetTable *getFirstTable(); + void setDelimitor(char delimitor); +private: + char delimitor; + rlSpreadsheetTable *firstTable; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlstate.h b/libs/pvb/include/rllib/rlstate.h new file mode 100644 index 0000000..0384300 --- /dev/null +++ b/libs/pvb/include/rllib/rlstate.h @@ -0,0 +1,274 @@ +/*************************************************************************** + rlstate.h - description + ------------------- + begin : Sat Dec 29 2012 + copyright : (C) 2012 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_STATE_H +#define _RL_STATE_H + +#include +#include +#include +#include +#include "rlthread.h" + +/*!
+This class is used to implement a statemachine.
+
+Under pvbaddon/templates/statemachine/plc you find the statemachine consisting of several threads.
+The main thread will read/write a Modbus PLC.
+The statemachine stm2 will handle a small demo statemachine.
+The statemachine stm1 will start stm2 if the user selects this function.
+
+The data will be stored in a shared memory.
+The shared memory contains a complex datastructure (typedef struct {...} USER_DEFINED_STRUCTURE;) which can be used to exchange values between several processes.
+
+The pvbrowser visualization server is located under pvbaddon/templates/statemachine/pvs
+There we use a SVG graphic (stm2.svg) showing the statemachine.
+This graphic is generated by graphviz from stm2.dot
+pvs and plc exchange data only via shared memory.
+
+Please start both (plc and pvs) in a separate terminal and then start the pvbrowser client
+
+Here is some sourcecode from the template:
+// ***************************************************************************
+//                          main.cpp  -  description
+//                             -------------------
+//  begin            : Sa. Mai 4 09:29:07 2013
+//  generated by     : pvdevelop (C) Lehrig Software Engineering
+//  email            : lehrig@t-online.de
+// ***************************************************************************
+#include "plcapp.h"
+
+SHM_DATA      *shm_data;
+rlSharedMemory shm("/srv/automation/shm/plc.shm", sizeof(SHM_DATA));
+rlSerial       tty;
+rlModbus       mb;
+rlMutex        mb_mutex;
+rlState        sm1, sm2;
+
+//// helper functions
+int printBinByte(unsigned char val)
+{
+  if(val & BIT7) printf("1");
+  else           printf("0");
+  if(val & BIT6) printf("1");
+  else           printf("0");
+  if(val & BIT5) printf("1");
+  else           printf("0");
+  if(val & BIT4) printf("1");
+  else           printf("0");
+  printf(":");
+  if(val & BIT3) printf("1");
+  else           printf("0");
+  if(val & BIT2) printf("1");
+  else           printf("0");
+  if(val & BIT1) printf("1");
+  else           printf("0");
+  if(val & BIT0) printf("1");
+  else           printf("0");
+  return 0;
+}
+
+int printBin(unsigned char *data)
+{
+  printf("BinData: ");
+  printBinByte(data[0]);
+  printf(" - ");
+  printBinByte(data[1]);
+  return 0;
+}
+
+//// Schneider PLC: first 4 bits are outputs then 6 bits input follow
+static int readIO() 
+{
+  unsigned char data[256];
+  int ret;
+  
+  MB_readInputStatus(1,0,10,data);          // read all IO values from modbus
+  shm_data->plc.in.in1 = mb.data2int(data); // store data in shared memory
+
+  if(trace)
+  {
+    printf("readIO:: ret=%d ", ret); 
+    printBin(data);
+    printf(" in1=%x\n", shm_data->plc.in.in1);
+  }  
+  return 0;
+}
+
+static int writeIO()
+{
+  unsigned char coils[8];
+  int ret;
+
+  coils[0] = shm_data->plc.out.out1 & 0x0ff;
+  MB_forceMultipleCoils(1,0,4,coils);       // write the 4 output bits to modbus
+
+  return 0;
+}
+
+int main()
+{
+  if(trace) printf("plc starting ...\n");
+  if(trace) printf("shm.status=%d\n", shm.status);
+  if(shm.status != rlSharedMemory::OK)
+  {
+    printf("ERROR: shared memory status is not ok\n");
+    return -1;
+  }
+  shm_data = (SHM_DATA *) shm.getUserAdr();
+  memset(shm_data,0,sizeof(SHM_DATA));
+  if(tty.openDevice("/dev/ttyUSB0",B9600,1,1,8,1,rlSerial::NONE) < 0)
+  {
+    printf("ERROR: openDevice(\"/dev/tty/USB0\")\n");
+  }
+  mb.registerSerial(&tty);
+
+  startStepsStm1(&sm1, 100); // start statemachine 1
+  startStepsStm2(&sm2, 100); // start statemachine 2
+  printf("going to IO loop\n");
+  while(1)
+  {
+    readIO();
+    writeIO();
+    rlsleep(10);
+  }
+  return 0;
+}
+
+// *****************************************************************************
+//                          stm2.cpp  -  description
+//                             -------------------
+//  begin            : Sa. Mai 4 09:29:07 2013
+//  generated by     : pvdevelop (C) Lehrig Software Engineering
+//  email            : lehrig@t-online.de
+//                     A simple template for implementing your own statemachine
+//                     See: pvbaddon/templates/statemachine
+// *****************************************************************************
+#include "plcapp.h"
+
+////TODO: define our states
+////      Your states are defined by static functions which get a pointer to the statemachine
+////      The pointer sm->user might be used to transfer the address of a user defined datastructure
+////      A transition from one state to the next is done by sm->gotoState(theNextState);
+////      Your statemachine runs within a separate thread and the current state is called within "cycletime" intervals
+static void stStart(rlState *sm);
+static void stProcess(rlState *sm);
+static void stFinish(rlState *sm);
+
+////TODO: implement our states
+static void stStart(rlState *sm)
+{
+  shm_data->plc.out.out1 = 1;                        // set output 1 in shared memory
+  if(sm->stepCounter > 20) 
+  {
+    shm_data->plc.out.out1 = 2;                      // reset output 1 in shared memory
+    strcpy(shm_data->plc.state.stm2_name,"Process"); // set next state name in shared memory 
+    sm->gotoState(stProcess);                        // goto the next state
+  }  
+}
+
+static void stProcess(rlState *sm)
+{
+  shm_data->plc.out.out1 = sm->stepCounter;          // set output 1 in shared memory
+  if(sm->stepCounter > 30) 
+  {
+    strcpy(shm_data->plc.state.stm2_name,"Finish");  // set next state name in shared memory
+    sm->gotoState(stFinish);                         // goto the next state
+  }  
+}
+
+static void stFinish(rlState *sm)
+{
+  shm_data->plc.out.out1 = 1;                        // set output 1 in shared memory
+  if(sm->stepCounter > 30) 
+  {
+    shm_data->plc.out.out1 = 0;                      // reset output 1 in shared memory
+    strcpy(shm_data->plc.state.stm2_name,"NULL");    // set next state name NULL
+    shm_data->plc.state.stm2_running = 0;            // reset running in shared memory 
+    sm->gotoState(NULL);                             // goto NULL state
+  }  
+}
+
+int startStepsStm2(rlState *sm, int cycletime)       // start our statemachine
+{
+  if(trace) printf("stm2 starting\n");
+  shm_data->plc.state.stm2_running = 1;              // set running in shared memory
+  strcpy(shm_data->plc.state.stm2_name,"Start");     // set next state name in shared memory
+  sm->gotoState(stStart);                            // goto nextState
+  sm->startSteps(cycletime);                         // start a thread which handles the statemachine
+  return 0;
+}
+
+// ***************************************************************************
+//                          stm1.cpp  -  description
+//                             -------------------
+//  begin            : Sa. Mai 4 09:29:07 2013
+//  generated by     : pvdevelop (C) Lehrig Software Engineering
+//  email            : lehrig@t-online.de
+// ***************************************************************************
+#include "plcapp.h"
+extern rlState sm2;
+
+////TODO: define our states
+static void stStart(rlState *sm);
+
+////TODO: implement our states
+static void stStart(rlState *sm)
+{
+  shm_data->plc.out.out2 = sm->stepCounter;
+  if(shm_data->plc.state.stm2_running == 0)
+  {
+    if(shm_data->pvs.state.button_start_stm2 == 1)
+    {
+      startStepsStm2(&sm2, 100);               // start statemachine 2 thread
+    }
+    else if(shm_data->plc.in.in1 & BIT1)
+    {
+      startStepsStm2(&sm2, 100);               // start statemachine 2 thread
+    }
+  }  
+}
+
+int startStepsStm1(rlState *sm, int cycletime) // start our statemachine
+{
+  if(trace) printf("Start stm1\n");
+  shm_data->plc.state.stm1_running = 1;        // set running within shared memory
+  sm->gotoState(stStart);                      // goto nextState
+  sm->startSteps(cycletime);                   // start a thread that will handle our statemachine
+  return 0;
+}
+
+
+*/ + +class rlState +{ + public: + rlState(); + ~rlState(); + int startSteps(int cycletime); + int runSteps(int cycletime); + void gotoState(void (*funcPtr)(rlState *sm)); + void *user; + int stepCounter; + int cycletime; + static const long MAX_STEP = 1000*1000*1000; + void (*nextStep)(rlState *sm); + void (*lastState)(rlState *sm); + rlThread thread; +}; + +#endif + diff --git a/libs/pvb/include/rllib/rlstring.h b/libs/pvb/include/rllib/rlstring.h new file mode 100644 index 0000000..5522242 --- /dev/null +++ b/libs/pvb/include/rllib/rlstring.h @@ -0,0 +1,161 @@ +/*************************************************************************** + rlstring.h - description + ------------------- + begin : Wed Jan 02 2008 + copyright : (C) Lehrig Software Enigineering + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_STRING_H_ +#define _RL_STRING_H_ + +#include +#include "rldefine.h" + +extern const char rlCRLF[]; + +/*!
+class for a simple ANSI-C like string.
+
*/ +class rlString +{ +public: + /*!
+  construct the string
+  
*/ + rlString(const char *text=""); + rlString(rlString &text); + rlString(rlString *text); + rlString(const rlString &text); + + /*!
+  destruct the string
+  
*/ + virtual ~rlString(); + + rlString& operator=(const char *s2); + rlString& operator=(rlString &s2); + + rlString& operator+(const char *s2); + rlString& operator+(rlString &s2); + + rlString& operator+=(const char *s2); + rlString& operator+=(rlString &s2); + + int operator==(const char *s2); + int operator==(rlString &s2); + int operator==(const rlString &s2); + + int operator!=(const char *s2); + int operator!=(rlString &s2); + + /*!
+  get the text
+  
*/ + char *text(); + char *text() const; + + /*!
+  set the text
+  
*/ + int setText(const char *text); + + /*!
+  printf the text
+  
*/ + int printf(const char *format, ...); + + /*!
+  copy text
+  
*/ + int strcpy(const char *text); + + /*!
+  append text
+  
*/ + int cat(const char *text); + + /*!
+  converst string to upper case
+  
*/ + int upper(); + + /*!
+  converst string to upper case
+  
*/ + int lower(); + + /*!
+  test if string starts with startstr
+  
*/ + int startsWith(const char *startstr); + + /*!
+  case insensitive string compare
+  
*/ + int strnocasecmp(const char *other); + + /*!
+  case insensitive string compare starting n characters
+  
*/ + int strnnocasecmp(const char *other, int n); + + /*!
+  strstr()
+  
*/ + char *strstr(const char *substring); + + /*!
+  strchr()
+  
*/ + char *strchr(int c); + + /*!
+  strchr()
+  
*/ + char *strrchr(int c); + + /*!
+  Remove quotas around a string.
+  This might be usefull together with CSV files.
+  
*/ + int removeQuotas(char c='"'); + + /*!
+  Remove "\n" at end of string.
+  
*/ + int removeNewline(); + + /*!
+  Read string from file.
+  
*/ + int read(const char *filename); + + /*!
+  Write string to file.
+  
*/ + int write(const char *filename); + + /*!
+  convert to platform independent filename
+  
*/ + const char *toFilename(); + + /*!
+  convert to platform independent directoryname
+  
*/ + const char *toDirname(); + +private: + char *txt; + char *tmp; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlsubset.h b/libs/pvb/include/rllib/rlsubset.h new file mode 100644 index 0000000..90afa9f --- /dev/null +++ b/libs/pvb/include/rllib/rlsubset.h @@ -0,0 +1,28 @@ +// include essential header from rlllib + +#include "rlcontroller.h" +#include "rlcutil.h" +#include "rldataacquisition.h" +#include "rldataprovider.h" +#include "rlevent.h" +#include "rlfifo.h" +#include "rlfileload.h" +#include "rlhistorylogger.h" +#include "rlhistoryreader.h" +#include "rlinifile.h" +#include "rlinterpreter.h" +#include "rlmailbox.h" +#include "rlmodbusclient.h" +#include "rlpcontrol.h" +#include "rlppiclient.h" +#include "rlserial.h" +#include "rlsharedmemory.h" +#include "rlsiemenstcpclient.h" +#include "rlsocket.h" +#include "rlspawn.h" +#include "rlspreadsheet.h" +#include "rlstring.h" +#include "rlsvganimator.h" +#include "rlthread.h" +#include "rltime.h" +#include "rludpsocket.h" diff --git a/libs/pvb/include/rllib/rlsvganimator.h b/libs/pvb/include/rllib/rlsvganimator.h new file mode 100644 index 0000000..22a40b9 --- /dev/null +++ b/libs/pvb/include/rllib/rlsvganimator.h @@ -0,0 +1,143 @@ +/*************************************************************************** + rlsvganimator.h - description + ------------------- + begin : Tue Apr 10 2006 + copyright : (C) 2006 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SVG_ANIMATOR_ +#define _RL_SVG_ANIMATOR_ +#include "rldefine.h" +#include "rlinifile.h" +#include "rlspreadsheet.h" +#include "rlstring.h" + +/*!
+This class holds the position of an SVG object.
+Use it together with rlSvgAnimator::setMatrix()
+
*/ +class rlSvgPosition +{ + public: + rlSvgPosition(); + rlSvgPosition(float sx_init, float a_init, float x0_init, float y0_init, float cx_init, float cy_init); + virtual ~rlSvgPosition(); + float sx, alpha, x0, y0, cx, cy; + struct rlPositionInit {float sx, alpha, x0, y0, w, h;} init; + void setInit(float x0_init, float y0_init, float w_init, float h_init); + void move(float x, float y); + void moveRelative(float dx, float dy); + void scale(float s); + void scaleRelative(float ds); + void rotate(float alpha, float cx, float cy); +}; + +/*!
+This class allows you to animate SVG graphics within pvbrowser.
+First the SVG is send to pvbrowser.
+Then you may modify the SVG within the pvbrowser client.
+
*/ +class rlSvgAnimator +{ + public: + rlSvgAnimator(); + virtual ~rlSvgAnimator(); + + /*! initialize the socket with pvbrowser p->s */ + int setSocket(int *socket); + /*! initialize the id with the pvbrowser object id */ + int setId(int Id); + /*! read SVG file infile and load it into the pvbrowser client. + if inifile is given inifile will be set with properties within the SVG XML file. + The id's of the SVG objects will result in section names of the inifile. */ + int read(const char *infile, rlIniFile *inifile=NULL); + /*! update the SVG graphic with: + gBeginDraw(p,id); d->svgAnimator.writeSocket(); gEndDraw(p); */ + //! The following methods are for modifying a object within a SVG graphic identified by objectname + int writeSocket(); + /*! change a property of tag = "name=" */ + + int svgPrintf(const char *objectname, const char *tag, const char *format, ...); + /*! recursively change a property of tag = "name=" */ + int svgRecursivePrintf(const char *objectname, const char *tag, const char *format, ...); + /*! search for "before" within "tag=" property and replace it with "after". You may use wildcards whin "before" */ + int svgSearchAndReplace(const char *objectname, const char *tag, const char *before, const char *after); + /*! recursively search for "before" within "tag=" property and replace it with "after". You may use wildcards within "before" */ + int svgRecursiveSearchAndReplace(const char *objectname, const char *tag, const char *before, const char *after); + /*! change the text of "objectname" */ + int svgTextPrintf(const char *objectname, const char *format, ...); + /*! remove a style option of "objectname". option must end with ':'. Example: option="stroke:" */ + int svgRemoveStyleOption(const char *objectname, const char *option); + /*! recursively remove a style option of "objectname". option must end with ':'. Example: option="stroke:" */ + int svgRecursiveRemoveStyleOption(const char *objectname, const char *option); + /*! change a style option of "objectname". option must end with ':'. Example: option="stroke:" value="#000000" */ + int svgChangeStyleOption(const char *objectname, const char *option, const char *value); + /*! recursively change a style option of "objectname". option must end with ':'. Example: option="stroke:" value="#000000" */ + int svgRecursiveChangeStyleOption(const char *objectname, const char *option, const char *value); + /*! set a style option of "objectname". option must end with ':'. Example: value="fill:#9d9d9d;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1" */ + int svgSetStyleOption(const char *objectname, const char *value); + /*! recursively set a style option of "objectname". option must end with ':'. Example: value="fill:#9d9d9d;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1" */ + int svgRecursiveSetStyleOption(const char *objectname, const char *value); + /*! hide/show object state := 0=hide 1=show */ + int show(const char *objectname, int state); // state := 0|1 + /*! set transformation matrix of object */ + int setMatrix(const char *objectname, float sx, float alpha, float x0, float y0, float cx, float cy); + /*! set transformation matrix of object */ + //! The following methods are for moveing and zooming the whole SVG identified by mainObject. default: main + int setMatrix(const char *objectname, rlSvgPosition &pos); + /*! set/get the name of the MainObject . The object name holding the whole SVG graphic. default: main */ + + int setMainObject(const char *main_object); + const char *mainObject(); + /*! set/get x0,y0 coordinates for the MainObject */ + int setXY0(float x0, float y0); + float x0(); + float y0(); + /*! set/get mouse position 0 for the MainObject */ + int setMouseXY0(float x0, float y0); + float mouseX0(); + float mouseY0(); + /*! set/get mouse position 1 for the MainObject */ + int setMouseXY1(float x1, float y1); + float mouseX1(); + float mouseY1(); + /*! set/get the scaling factor for the MainObject */ + int setScale(float scale); + float scale(); + /*! zooms the whole SVG graphic keeping it centered to the viewport */ + int zoomCenter(float newScale); + /*! zooms the whole SVG graphic so that the visible section is from x0,x0 to x1,y1 */ + int zoomRect(); + /*! sets the MainObject matrix according to scale,x0,y0 */ + int setMainObjectMatrix(); + /*! call this method when the widget is resized */ + int setWindowSize(int width, int height); + float windowWidth(); + float windowHeight(); + /*! move MainObject to position */ + int moveMainObject(float x, float y); + + int isModified; + + private: + int tcpsend(const char *buf, int len); + int fillIniFile(rlIniFile *inifile, const char *line); + int fileFillIniFile(const char *infile, rlIniFile *inifile); + int inifileState, inifileCount; + rlSpreadsheetCell inifileID; + rlSpreadsheetTable inifileTable; + int *s; + int id; + // zoomer variables follow + float svgX0, svgY0, svgWindowWidth, svgWindowHeight, svgScale, svgMouseX0, svgMouseY0, svgMouseX1, svgMouseY1; + rlString main_object_name; +}; +#endif diff --git a/libs/pvb/include/rllib/rlsvgcat.h b/libs/pvb/include/rllib/rlsvgcat.h new file mode 100644 index 0000000..3327037 --- /dev/null +++ b/libs/pvb/include/rllib/rlsvgcat.h @@ -0,0 +1,44 @@ +/*************************************************************************** + rlsvgcat.h - description + ------------------- + begin : Tue Apr 09 2006 + copyright : (C) 2006 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_SVG_CAT_ +#define _RL_SVG_CAT_ + +#include "rldefine.h" + +/*!
+This class will normalize SVG XML files so that
+- lines are left justified
+- 1 tag per line
+
*/ +class rlSvgCat +{ + public: + rlSvgCat(); + virtual ~rlSvgCat(); + int open(const char *infile, const char *outfile = 0); + int reopenSocket(const char *infile, int s); + void cat(); + void close(); + private: + int outUntil(int i, const char *tag); + int outUntilEnd(int i); + int outValue(int i); + void catline(); + void *fin, *fout; + int s; + char line[256*256]; +}; +#endif diff --git a/libs/pvb/include/rllib/rlsvgvdi.h b/libs/pvb/include/rllib/rlsvgvdi.h new file mode 100644 index 0000000..c4bdf38 --- /dev/null +++ b/libs/pvb/include/rllib/rlsvgvdi.h @@ -0,0 +1,146 @@ +/*************************************************************************** + rlsvgvdi.h - description + ------------------- + begin : Tu Mar 22 2016 + copyright : (C) 2016 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef _RL_SVGVDI_H_ +#define _RL_SVGVDI_H_ + +#include +#include "rlstring.h" +#include "rlspawn.h" +#define MAXARRAY 1024*4 // maximum array size for line(x,y,n) + +#ifndef PROCESSVIEWSERVER_H +/* font alignment */ +enum rlFontAlignment { /* */ +ALIGN_LEFT=0, /* example */ +ALIGN_CENTER, /* example */ +ALIGN_RIGHT, /* example */ +ALIGN_VERT_CENTER /* e */ +}; /* x */ + /* a */ + /* m */ + /* p */ + /* l */ + /* e */ + /* */ + +/* linestyle for lines in axis */ +enum rlLinestyle { +LINESTYLE_NONE=0, +LINESTYLE_CIRCLE, +LINESTYLE_CROSS, +LINESTYLE_RECT, +LINESTYLE_CIRCLE_NO_LINE, +LINESTYLE_CROSS_NO_LINE, +LINESTYLE_RECT_NO_LINE +}; +#endif + +/*!
+class for drawing xy-graphics and any svg graphics either on the client or on the server.
+
+SVG (Tiny) is a flexible and powerfull graphics format.
+- It can be rendered on a pvbrowser DrawWidget on the client, 
+  where the user will also be able to interact with the SVG (example: clicking on named objects within the SVG)
+- It can be rendered into another format by SVG converters on the server and/or the client
+- It can be used to implement scalable user interfaces especially when using on mobile devices
+
+rlSvgVdi brings some conveniance functions to draw xy-graphics with SVG and 
+some general SVG interface functions, that produce SVG content directly.
+
+The Output might be send to File/Socket/stdout or simply collected as a rlString with all the generated SVG.
+
+See example within pvbaddon/demos/rlsvgvdi
+
+HINT 1: Use rlSpawn and the rlsvgcat utility to read static SVG templates and insert the content generated by rlSvgVdi dynamically into the output stream.
+        You might use comment strings within the SVG for controlling the filter pipeline.
+
+HINT 2: Use this class for the purpose of generating reports in pdf
+
+HINT 3: Use SVG converters with a commandline interface to convert SVG to png, jpg, pdf ...
+        Examples: rsvg, imagemagick
+        https://wiki.gnome.org/action/show/Projects/LibRsvg
+        http://imagemagick.org/script/index.php
+
+
*/ +class rlSvgVdi +{ +public: + rlSvgVdi(); + ~rlSvgVdi(); + int setOutput(int *socket_out, int idForPvbrowser=0); + int setOutput(FILE *fout); + int setOutput(const char *outputfilename); + int setOutput(rlSpawn *pipe); + int endOutput(); + const char *svgHeader(int width=1280, int height=1024, int rbackground=255, int gbackground=255, int bbackground=255); + const char *svgTrailer(); + const char *drawEllipse(int x, int y, int rx, int ry); + const char *moveTo(int x, int y); + const char *lineTo(int x, int y); + const char *line(int x1, int y1, int x2, int y2); + const char *text(int x, int y, const char *text, int alignment=ALIGN_LEFT); + const char *textInAxis(float x, float y, const char *text, int alignment); + const char *box(int x, int y, int w, int h); + const char *boxWithText(int x, int y, int w, int h, int fontsize, const char *xlabel, const char *ylabel, const char * rylabel); + const char *rect(int x, int y, int w, int h); + const char *xAxis(float start, float delta, float end, int draw=1); + const char *yAxis(float start, float delta, float end, int draw=1); + const char *xGrid(); + const char *yGrid(); + const char *rightYAxis(float start, float delta, float end, int draw=1); + const char *drawSymbol(int x, int y, int type); + const char *line(float *x, float *y, int n, int linestayle=LINESTYLE_NONE); + const char *setColor(int r, int g, int b); + const char *setFont(const char *family, int size, int weight, int italic); + const char *setWidth(int w); + const char *setLinestyle(const char *dasharray); + const char *comment(const char *text); + const char *svg_put(const char *text); + const char *svg_printf(const char *format, ...); + const char *svg_d(int *x, int *y, int count); + const char *svg_points(int *x, int *y, int count); + int outputState; + int getFontsize(); + int getBoxX(); + int getBoxY(); + int getBoxW(); + int getBoxH(); + +private: + int *sout; + FILE *fout; + rlSpawn *pipe; + rlString filename, outputfilename; + int idForPvbrowser; + rlString svg, svg2, svg3, fontstring; + char stroke[16]; + int width; + rlString dasharray; + rlString lineoptions, textoptions; + int perhapsSend(const char *text); + int xold, yold; + float xmin,dx,xmax; + float ymin,dy,ymax; + int tx(float x); + int ty(float y); + int boxx,boxy,boxw,boxh; + int fontsize; + int sr; // symbol radius + char floatFormat[80]; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlthread.h b/libs/pvb/include/rllib/rlthread.h new file mode 100644 index 0000000..29cc930 --- /dev/null +++ b/libs/pvb/include/rllib/rlthread.h @@ -0,0 +1,167 @@ +/*************************************************************************** + rlthread.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_THREAD_H_ +#define _RL_THREAD_H_ + +#include "rldefine.h" +#include "rlwthread.h" + +class rlThread; + +/*!
+This parameter is given to the thread function.
+
*/ +typedef struct +{ + rlThread *thread; + void *user; + int running; +} +THREAD_PARAM; + +/*!
+Thread functions based on POSIX threads.
+
*/ +class rlThread +{ +public: + rlThread(int max_semphore=1000); + virtual ~rlThread(); + /*!
+  Create a new thread
+  Your thread function looks like:
+
+  void *threadFunction(void *arg)
+  {
+    THREAD_PARAM *p = (THREAD_PARAM *) arg;
+    YOUR_DATA    *d = (YOUR_DATA *) p->user;
+
+    for(int i=0; i<50; i++)
+    {
+      p->thread->lock();
+      // do something critical
+      printf("this is the thread\n");
+      p->thread->unlock();
+    }
+
+    return NULL;
+  }
+  
*/ + int create(void *(*func)(void*), void *argument); + + /*!
+  Try to lock the mutex.
+  return 0 if already locked
+  return !0 if lock sucessfull
+  
*/ + int trylock(); + + /*!
+  Lock the mutex.
+  
*/ + int lock(); + + /*!
+  Unlock the mutex.
+  
*/ + int unlock(); + + /*!
+  Wait until semaphore is signaled
+  
*/ + int waitSemaphore(); + + /*!
+  Increment the value of the semaphore
+  
*/ + int incrementSemaphore(); + + /*!
+  Wait for termination of thread and get the exit status
+  
*/ + int join(void **status); + + /*!
+  Cancel the thread
+  
*/ + int cancel(); + + /*!
+  Terminate the thread and return exit status
+  
*/ + void threadExit(void *status); + + pthread_t tid; + pthread_attr_t attr; + pthread_mutex_t mutex; + WSEMAPHORE semaphore; +private: + THREAD_PARAM arg; +}; + +/*!
+Mutex functions based on POSIX threads.
+
*/ +class rlMutex +{ +public: + //rlMutex(const pthread_mutexattr_t *attr = NULL); + rlMutex(const void *attr = NULL); + virtual ~rlMutex(); + + /*!
+  Try to lock the mutex.
+  return 0 if already locked
+  return !0 if lock sucessfull
+  
*/ + int trylock(); + + /*!
+  Lock the mutex.
+  
*/ + int lock(); + + /*!
+  Unlock the mutex.
+  
*/ + int unlock(); + + pthread_mutex_t mutex; +}; + +/*!
+Semaphore functions based on POSIX threads.
+
*/ +class rlSemaphore +{ +public: + rlSemaphore(int max_semaphore = 1000); + virtual ~rlSemaphore(); + + /*!
+  Wait until semaphore is signaled
+  
*/ + int waitSemaphore(); + + /*!
+  Increment the value of the semaphore
+  
*/ + int incrementSemaphore(); + + WSEMAPHORE semaphore; +}; + +#endif diff --git a/libs/pvb/include/rllib/rltime.h b/libs/pvb/include/rllib/rltime.h new file mode 100644 index 0000000..6e09ca3 --- /dev/null +++ b/libs/pvb/include/rllib/rltime.h @@ -0,0 +1,65 @@ + +/*************************************************************************** + rltime.h - description + ------------------- + begin : Tue Jan 02 2001 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_TIME_V1_H_ +#define _RL_TIME_V1_H_ + +#include "rldefine.h" + +/*!
+class for handling time.
+
*/ +class rlTime +{ +public: + rlTime(int Year=0, int Month=0, int Day=0, int Hour=0, int Minute=0, int Second=0, int Millisecond=0); + virtual ~rlTime(); + const char *version(); + const char *getTimeString(); + const char *getIsoTimeString(); + const char *toString(const char *format); + void getLocalTime(); + int getFileModificationTime(const char *filename); + + /*!
+  format: sscanf(time_string,"%d-%d-%d %d:%d:%d %d",&year,&month,&day, &hour,&minute,&second, &millisecond);
+  
*/ + void setTimeFromString(const char *time_string); + void setTimeFromIsoString(const char *iso_time_string); + void setLocalTime(); + double secondsSinceEpoche(); + rlTime& operator+= (rlTime &time); + rlTime& operator-= (rlTime &time); + rlTime operator+ (rlTime &time); + rlTime operator- (rlTime &time); + int operator== (rlTime &time); + int operator< (rlTime &time); + int operator<= (rlTime &time); + int operator> (rlTime &time); + int operator>= (rlTime &time); + int year; + int month; + int day; + int hour; + int minute; + int second; + int millisecond; +private: + char time_string[32]; // 2001-11-23 12:52:60 056 + char iso_time_string[32]; // 2001-11-23T12:52:60.056 +}; + +#endif diff --git a/libs/pvb/include/rllib/rludpsocket.h b/libs/pvb/include/rllib/rludpsocket.h new file mode 100644 index 0000000..9f34bc8 --- /dev/null +++ b/libs/pvb/include/rllib/rludpsocket.h @@ -0,0 +1,101 @@ +/*************************************************************************** + rludpsocket.h - description + ------------------- + begin : Tue Apr 03 2007 + copyright : (C) 2007 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_UDP_SOCKET_H_ +#define _RL_UDP_SOCKET_H_ + +#include "rldefine.h" +#include "rlsocket.h" + +#ifdef RLWIN32 +#include +#include +#include +#include +#define MSG_NOSIGNAL 0 +#else +#include +#include +#include +#include +#include +#include "unistd.h" +#endif + +/*!
+class for encapsulating ip  addresses
+
*/ +class rlIpAdr +{ +public: + rlIpAdr(); + virtual ~rlIpAdr(); + int setAdr(const char *adr, int port); + int operator== (rlIpAdr &address1); + struct sockaddr_in address; +}; + +/*!
+class for encapsulating UDP socket calls
+
*/ +class rlUdpSocket +{ +public: + rlUdpSocket(int debug = 0); + virtual ~rlUdpSocket(); + + /*!
+  setsocketopt for SOL_SOCKET level
+  
*/ + int setSockopt(int opt); + + /*!
+  setsocketopt with full control
+  
*/ + int setSockopt(int level, int optname, void *optval, int optlen); + + /*!
+  return > 0 -> socket else error
+  
*/ + int bind(int port); + + /*!
+  return == 0 -> timeout
+  
*/ + int select(int timeout); + + /*!
+  return > 0 -> number of bytes read return == 0 -> timeout else error
+  
*/ + int recvfrom(void *buf, int maxlen, rlIpAdr *source, int timeout = -1); + + /*!
+  return >= 0 -> number of bytes written else error
+  
*/ + int sendto(const void *buf, int len, rlIpAdr *dest); + + /*!
+  return >= 0 -> number of bytes written else error
+  
*/ + int printf(rlIpAdr *dest, const char *format, ...); + + int debug, readflag, writeflag; + +private: + struct sockaddr_in address; + int s; +}; + +#endif diff --git a/libs/pvb/include/rllib/rlwebcam.h b/libs/pvb/include/rllib/rlwebcam.h new file mode 100644 index 0000000..156c73b --- /dev/null +++ b/libs/pvb/include/rllib/rlwebcam.h @@ -0,0 +1,98 @@ +/*************************************************************************** + rlwebcam.h - description + ------------------- + begin : Mo Aug 24 2009 + copyright : (C) 2009 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +#ifndef _RL_WEBCAM_H_ +#define _RL_WEBCAM_H_ + +#include "rldefine.h" +#include "rlsocket.h" +#include "rlstring.h" + +/*!
+class for handling networked webcams over http:// that use motion jpeg
+
+If you do not know under which URL your webcam provides the M-JPEG video stream
+you may use tcpdump to figure it out.
+
+Example:
+
+tcpdump -X -i eth0 -t -q -s 0 "host 192.168.1.200 && port 80" | grep -A 10 GET
+
+IP myhost.46727 > 192.168.1.200.http: tcp 97
+ 0x0000:  4500 0089 edb6 4000 4006 c891 c0a8 010e  E.....@.@.......
+ 0x0010:  c0a8 01c8 b687 0050 d99f 8b7d 0003 d5b2  .......P...}....
+ 0x0020:  5018 16d0 2460 0000 4745 5420 2f63 6769  P...$`..GET./cgi
+ 0x0030:  2d62 696e 2f53 7472 6561 6d3f 5669 6465  -bin/Stream?Vide
+ 0x0040:  6f20 4175 7468 6f72 697a 6174 696f 6e3a  o.Authorization:
+ 0x0050:  2042 6173 6963 2059 5752 7461 5734 3663  .Basic.YWRtaW46c
+ 0x0060:  4746 7a63 3364 7663 6d51 3d3f 7765 6263  GFzc3dvcmQ=?webc
+ 0x0070:  616d 5057 443d 526f 6f74 436f 6f6b 6965  amPWD=RootCookie
+ 0x0080:  3030 3030 300d 0a0d 0a                   00000....
+
+Usage example for pvbrowser slot functions:
+
+#include "rlwebcam.h"
+
+typedef struct // (todo: define your data structure here)
+{
+  rlWebcam webcamBig;
+}
+DATA;
+
+static int slotInit(PARAM *p, DATA *d)
+{
+  if(p == NULL || d == NULL) return -1;
+  p->sleep = 20;
+  p->force_null_event = 0;
+  d->webcamBig.debug = 0;
+  d->webcamBig.filename.printf("%swebcam.jpg", p->file_prefix);
+  d->webcamBig.setUrl("http://192.168.1.200/cgi-bin/Stream?Video Authorization: Basic YWRtaW46cGFzc3dvcmQ=?webcamPWD=RootCookie00000");
+  return 0;
+}
+
+static int slotNullEvent(PARAM *p, DATA *d)
+{
+  if(p == NULL || d == NULL) return -1;
+  if(const char *fname = d->webcamBig.getFrame()) // OR if(const char *fname = d->webcamBig.getSnapshot()) 
+  {
+    pvDownloadFileAs(p,fname,"webcam.jpg");
+    pvSetImage(p,WebcamBig,"webcam.jpg"); // WebcamBig is a pvQImage object that accepts jpeg images
+  }
+  return 0;
+}
+
+
*/ +class rlWebcam +{ +public: + rlWebcam(); + virtual ~rlWebcam(); + int setUrl(const char *url); + int disconnect(); + const char *getSnapshot(int timeout=3000); + const char *getFrame(int timeout=3000, int requestOnly=0); + int getFrameBuffer(unsigned char *buffer, int maxbuffer, int timeout=3000); + const char *getUrl(); + const char *getHost(); + int getPort(); + const char *getPath(); + int debug; + rlString filename; + rlSocket *sock; + +private: + rlString url, temp1, temp2, temp3; +}; +#endif diff --git a/libs/pvb/include/rllib/rlwthread.h b/libs/pvb/include/rllib/rlwthread.h new file mode 100644 index 0000000..875ecda --- /dev/null +++ b/libs/pvb/include/rllib/rlwthread.h @@ -0,0 +1,130 @@ +/*************************************************************************** + wthread.h - description + ------------------- + begin : Sun Jan 02 2000 + copyright : (C) 2001 by R. Lehrig + email : lehrig@t-online.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * + * published by the Free Software Foundation * + * * + ***************************************************************************/ +/*********************************************************************************** + +Wrapper for posix threads (UNIX,VMS,windows) + +(C) R. Lehrig 2001 lehrig@t-online.de + +***********************************************************************************/ + +#ifndef _RL_WTHREAD_H_ +#define _RL_WTHREAD_H_ + +#ifndef SWIG + +#include "rldefine.h" + +#ifdef RLWIN32 +#define WTREAD_GNUC10 ( __GNUC__ * 1000 ) + __GNUC_MINOR__ +#if WTREAD_GNUC10 < 4008 +#define RLWIN32THREAD +#else +#include +#endif +#endif + +#ifdef RLWIN32THREAD + +#include +#include +#include +#include + +#ifndef _WRAPTHREAD_ +#ifndef _WTHREAD_H_ +typedef unsigned long int pthread_t; + +/* Attributes for threads */ +typedef struct __sched_param +{ + int sched_priority; +}SCHED_PARAM; + +typedef struct +{ + int __detachstate; + int __schedpolicy; + struct __sched_param __schedparam; + int __inheritsched; + int __scope; + size_t __guardsize; + int __stackaddr_set; + void *__stackaddr; + size_t __stacksize; +}pthread_attr_t; + +typedef HANDLE pthread_mutex_t; +//old typedef CRITICAL_SECTION pthread_mutex_t; +typedef long pthread_mutexattr_t; +#endif +#endif + +#else /* VMS or UNIX or new GCC on Windows*/ +#ifndef WIN_PTHREADS_H +#include +#endif +#endif /* end of MSWINDOWS */ + +#ifndef _WRAPTHREAD_ +#ifndef _WTHREAD_H_ +typedef struct +{ +#ifdef RLWIN32THREAD + int cmax; + HANDLE hSemaphore; +#else + int cmax; + int nready; + pthread_mutex_t mutex; + pthread_cond_t cond; +#endif +}WSEMAPHORE; +#endif +#endif + +/* function prototypes */ +//#ifdef __cplusplus +//extern "C" { +//#endif +int rlwthread_attr_init(pthread_attr_t *attr); +int rlwthread_create(pthread_t *tid, const pthread_attr_t *attr, + void *(*func)(void*), void *arg); +void rlwthread_close_handle(pthread_t *tid); +void rlwthread_exit(void *status); +int rlwthread_join(pthread_t tid, void **status); +int rlwthread_mutex_init(pthread_mutex_t *mptr, const pthread_mutexattr_t *attr); +int rlwthread_mutex_destroy(pthread_mutex_t *mptr); +int rlwthread_mutex_lock(pthread_mutex_t *mptr); +int rlwthread_mutex_trylock(pthread_mutex_t *mptr); +int rlwthread_mutex_unlock(pthread_mutex_t *mptr); +int rlwthread_cancel(pthread_t tid); +int rlwrapinit_semaphore(WSEMAPHORE *s, int cmax); +int rlwrapdestroy_semaphore(WSEMAPHORE *s); +int rlwrapincrement_semaphore(WSEMAPHORE *s); +int rlwrapwait_semaphore(WSEMAPHORE *s); +int rlwthread_sleep(long msec); +void rlsleep(long msec); +//#ifdef __cplusplus +//}; +//#endif + +#else +// SWIG +void rlsleep(long msec); +#endif + +#endif diff --git a/libs/pvb/include/rllib/setport.h b/libs/pvb/include/rllib/setport.h new file mode 100644 index 0000000..3fdd6b4 --- /dev/null +++ b/libs/pvb/include/rllib/setport.h @@ -0,0 +1,5 @@ +#ifdef unix +int setPort(char *name, char *baud, char parity); +#else +HANDLE WINAPI setPort(char *name, char *baud, char parity); +#endif diff --git a/libs/pvb/x64/rllib.lib b/libs/pvb/x64/rllib.lib new file mode 100644 index 0000000..ec81270 Binary files /dev/null and b/libs/pvb/x64/rllib.lib differ diff --git a/libs/pvb/x64/rlsvgcat.exe b/libs/pvb/x64/rlsvgcat.exe new file mode 100644 index 0000000..68d024f Binary files /dev/null and b/libs/pvb/x64/rlsvgcat.exe differ diff --git a/libs/pvb/x64/serverlib.lib b/libs/pvb/x64/serverlib.lib new file mode 100644 index 0000000..b54f5c7 Binary files /dev/null and b/libs/pvb/x64/serverlib.lib differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c2bf9b..c3bb643 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,23 @@ cmake_minimum_required(VERSION 3.23) +############################################################################### +### define funcitons ### + +## function: visual studio source group +macro(ADD_SOURCE_GROUP srcpath) + file(GLOB src_h ${PROJECT_SOURCE_DIR}/${srcpath}/*.h) + file(GLOB src_cpp ${PROJECT_SOURCE_DIR}/${srcpath}/*.cpp) + set(src_tmp ${src_h} ${src_cpp}) + if (${srcpath} STREQUAL "./" OR ${srcpath} STREQUAL "." OR ${srcpath} STREQUAL "") + set(groupName src) + else() + set(groupName src/${srcpath}) + endif() + source_group(${groupName} FILES ${src_tmp}) + list(APPEND SOURCE_FILE ${src_tmp}) +endmacro(ADD_SOURCE_GROUP) +############################################################################### + set(PROJECT_NAME EES) project(${PROJECT_NAME}) @@ -15,6 +33,8 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Od /Ob2") # 设置 Release 模式下链接器的调试信息 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG") +add_definitions(-DWIN32_LEAN_AND_MEAN) + # Qt_PATH 为 Qt 的安装地址 set(QT_PATH "D:/Programs/Qt5/5.15.2/msvc2019_64") set(CMAKE_PREFIX_PATH ${QT_PATH}/lib/cmake) @@ -33,10 +53,10 @@ find_package(Qt5 COMPONENTS WebEngineWidgets REQUIRED) -add_definitions(-DWIN32_LEAN_AND_MEAN) set(ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(THIRDPARTY_PATH ${ROOT_PATH}/../thirdparty) +set(PVLIBS_PATH ${ROOT_PATH}/../libs/pvb) include_directories( ${ROOT_PATH} @@ -46,24 +66,20 @@ include_directories( ${THIRDPARTY_PATH} ${THIRDPARTY_PATH}/mysql/include ${THIRDPARTY_PATH}/nlohmann_json-3.11.2 + ${PVLIBS_PATH}/include/pvserver + ${PVLIBS_PATH}/include/rllib ) -macro(ADD_SOURCE_GROUP srcpath) - file(GLOB src_h ${PROJECT_SOURCE_DIR}/${srcpath}/*.h) - file(GLOB src_cpp ${PROJECT_SOURCE_DIR}/${srcpath}/*.cpp) - set(src_tmp ${src_h} ${src_cpp}) - source_group(src/${srcpath} FILES ${src_tmp}) - list(APPEND SOURCE_FILE ${src_tmp}) -endmacro(ADD_SOURCE_GROUP) - # 设置编译源文件 -ADD_SOURCE_GROUP(./) +ADD_SOURCE_GROUP(.) ADD_SOURCE_GROUP(common) ADD_SOURCE_GROUP(app) ADD_SOURCE_GROUP(database) ADD_SOURCE_GROUP(protocol) -ADD_SOURCE_GROUP(widgets) -ADD_SOURCE_GROUP(widgets/pages) +#ADD_SOURCE_GROUP(widgets) +#ADD_SOURCE_GROUP(widgets/pages) +ADD_SOURCE_GROUP(pv) +ADD_SOURCE_GROUP(pv/pages) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../bin) add_executable(${PROJECT_NAME} ${SOURCE_FILE}) @@ -81,5 +97,7 @@ target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} ws2_32 iphlpapi ${THIRDPARTY_PATH}/mysql/lib/x64/libmysql.lib + ${PVLIBS_PATH}/x64/serverlib.lib + ${PVLIBS_PATH}/x64/rllib.lib ) diff --git a/src/app/Admin.cpp b/src/app/Admin.cpp index b9ad141..2ab2e66 100644 --- a/src/app/Admin.cpp +++ b/src/app/Admin.cpp @@ -1,5 +1,4 @@ #include "Admin.h" -#include "app/Dao.h" #include "common/Logger.h" Errcode Admin::longin(std::string username, std::string passwd) diff --git a/src/app/AppData.cpp b/src/app/AppData.cpp new file mode 100644 index 0000000..404de1f --- /dev/null +++ b/src/app/AppData.cpp @@ -0,0 +1,49 @@ +#include "AppData.h" + +#include "app/Station.h" + +std::shared_ptr AppData::getStation(int stationId) +{ + auto iter = mapStation.find(stationId); + if (iter!=mapStation.end()) + { + return iter->second; + } + return nullptr; +} + +std::shared_ptr AppData::getStationByName(std::string name) +{ + for (auto iter = mapStation.begin(); iter!=mapStation.end(); ++iter) + { + if (iter->second->name == name) + { + return iter->second; + } + } + return nullptr; +} + +void AppData::getStationNames(std::vector& vecNames) +{ + vecNames.resize(mapStation.size()); + int i = 0; + for (auto iter = mapStation.begin(); iter!=mapStation.end(); ++iter) + { + vecNames[i] = iter->second->name; + } +} + +std::shared_ptr AppData::getDevice(int stationId, int deviceId) +{ + auto station = getStation(stationId); + if (station) + { + return station->getDevice(deviceId); + } + return nullptr; +} + +void AppData::loadStatData() +{ +} \ No newline at end of file diff --git a/src/app/AppData.h b/src/app/AppData.h new file mode 100644 index 0000000..b285c76 --- /dev/null +++ b/src/app/AppData.h @@ -0,0 +1,48 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +class Station; +class Device; + +class AppData +{ +public: + std::shared_ptr getStation(int stationId); + + std::shared_ptr getStationByName(std::string name); + + void getStationNames(std::vector& vecNames); + + std::shared_ptr getDevice(int stationId, int deviceId); + + // 读取统计数据: 今日统计数据,累计统计数据 + void loadStatData(); + + +public: + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 系统 === + int64_t sysActivationTime {}; + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 数据库 === + struct { + std::string host; + int port; + std::string user; + std::string passwd; + } db; + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 场站信息 === + std::unordered_map> mapStation; + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 角色定义 === + +}; diff --git a/src/app/AppSetting.h b/src/app/AppSetting.h deleted file mode 100644 index 23ce1f1..0000000 --- a/src/app/AppSetting.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -class AppSetting -{ -public: - static AppSetting& instance() { - static AppSetting inst; - return inst; - } - - -}; \ No newline at end of file diff --git a/src/app/Application.cpp b/src/app/Application.cpp index 8f4e442..24b2a1d 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -1,13 +1,92 @@ #include "Application.h" #include "common/Utils.h" - #include "Config.h" -#include "app/Dao.h" #include "app/Device.h" +#include "database/DaoEntity.h" +#include "database/Dao.h" +#include "app/Station.h" +#include "app/Device.h" + +void InitStation() +{ + AppData& appdata = Application::instance().getAppData(); + + // 读取数据库 + std::vector result; + DAO::queryStationList(result); + for (auto& fields: result) + { + int stationId = fields.getInt(DMStation::STATION_ID); + auto station = std::make_shared(stationId); + station->name = fields.getStr(DMStation::NAME); + station->energyCapacity = fields.getDouble(DMStation::CAPACITY); + appdata.mapStation[stationId] = station; + } +} + +void InitDevice() +{ + AppData& appdata = Application::instance().getAppData(); + + vector result; + DAO::queryDeviceList(result); + for (auto& fields: result) + { + int deviceId = fields.getInt(DMDevice::DEVICE_ID); + int stationId = fields.getInt(DMDevice::STATION_ID); + auto station = appdata.getStation(stationId); + if (station) + { + auto device = Device::create(fields); + station->addDevice(deviceId, device); + } + else + { + XLOGE() << "init device error: unknown station_id:[" << stationId << "] device_id=" << deviceId; + } + } +} + +void InitStatData() +{ + AppData& appdata = Application::instance().getAppData(); + + std::string curDate = Utils::dateStr(); + vector result; + DAO::queryStatDataList(curDate, curDate, result); + for (auto& fields: result) + { + std::string dt = fields.getStr(DMStatStation::DT); + int stationId = fields.getInt(DMStatStation::STATION_ID); + auto station = appdata.getStation(stationId); + if (station) + { + station->storageIn = fields.getFloat(DMStatStation::STORAGE_ELECT_IN); + station->storageOut = fields.getFloat(DMStatStation::STORAGE_ELECT_OUT); + //station->storageNumIn = fields.getFloat(DMStatStation::STORAGE_NUM); + //station->storageNumOut = fields.getFloat(DMStatStation::STORAGE_NUM); + station->storageNumErr = fields.getFloat(DMStatStation::STORAGE_NUM_ERR); + + station->solarGen = fields.getFloat(DMStatStation::SOLAR_ELECT_GEN); + station->solarGrid = fields.getFloat(DMStatStation::SOLAR_ELECT_GRID); + station->solarNumErr = fields.getFloat(DMStatStation::SOLAR_NUM_ERR); + + station->chargeElect = fields.getFloat(DMStatStation::CHARGE_ELECT); + station->chargeNum = fields.getFloat(DMStatStation::CHARGE_NUM); + station->chargeNumErr = fields.getFloat(DMStatStation::CHARGE_NUM_ERR); + } + else + { + XLOGE() << "init staticis data error: unknown station_id:[" << stationId << "] dt=" << dt; + } + } + +} void Application::init() { + // 初始化系统配置,读取配置文件 Config::init("assets/config/app.json"); // 设置数据库配置 @@ -23,79 +102,23 @@ void Application::init() // 连接数据库,读取基础信息 - + // 初始化场站信息 + InitStation(); // 读取设备信息,连接设备 - this->initDevice(); + InitDevice(); + // 读取基础统计信息,在系统总览中需要展示 + InitStatData(); + + // 创建设备处理线程 std::thread([=]() { runThreadDevice(); }).detach(); // 创建主业务循环线程 std::thread([=]() { runThreadMain(); }).detach(); } - -static void addDeviceTest(vector& v, int device_id, int type, std::string name, std::string code, int is_open, std::string attrs = "{}") +AppData& Application::getAppData() { - DataFields fields; - fields.set("device_id", device_id); - fields.set("type", type); - fields.set("name", name); - fields.set("code", code); - fields.set("is_open", is_open); - fields.set("attrs", attrs); - v.push_back(fields); -} - -void Application::initDevice() -{ - DaoEntity dao(""); - std::string sql = "select * from device;"; - vector result; - //dao.exec(sql, result); - addDeviceTest(result, 1, 1, "变压器", "", 1); - addDeviceTest(result, 2, 2, "配电柜1", "", 1); - addDeviceTest(result, 3, 3, "电表", "", 1); - addDeviceTest(result, 4, 4, "门禁", "", 1); - addDeviceTest(result, 5, 5, "空调", "", 1); - addDeviceTest(result, 6, 6, "照明", "", 1); - addDeviceTest(result, 7, 7, "消防", "", 1); - addDeviceTest(result, 8, 8, "光照监测设备", "", 1); - addDeviceTest(result, 9, 9, "风速监测设备", "", 1); - addDeviceTest(result, 10, 10, "温湿度监测设备", "", 1); - addDeviceTest(result, 11, 11, "烟感监测设备", "", 1); - addDeviceTest(result, 12, 12, "水浸传感器", "", 1); - addDeviceTest(result, 13, 13, "视频监控", "", 1); - addDeviceTest(result, 14, 101, "逆变器", "", 1); - addDeviceTest(result, 15, 102, "汇流箱", "", 1); - addDeviceTest(result, 16, 103, "光伏板", "", 1); - addDeviceTest(result, 17, 104, "风力发电机", "", 1); - addDeviceTest(result, 18, 105, "储能变流器", "", 1); - addDeviceTest(result, 19, 106, "储能电池", "", 1); - addDeviceTest(result, 20, 107, "BMS", "", 1); - addDeviceTest(result, 21, 108, "充电桩", "", 1); - addDeviceTest(result, 22, 103, "光伏板-1000", "", 1); - addDeviceTest(result, 23, 108, "充电桩-000001", "", 1); - addDeviceTest(result, 24, 103, "光伏板-1001", "", 1); - addDeviceTest(result, 25, 103, "光伏板-1002", "", 1); - addDeviceTest(result, 26, 103, "光伏板-1003", "", 1); - addDeviceTest(result, 27, 103, "光伏板-1004", "", 1); - addDeviceTest(result, 28, 103, "光伏板-1005", "", 1); - addDeviceTest(result, 29, 103, "光伏板-1006", "", 1); - addDeviceTest(result, 30, 103, "光伏板-1007", "", 1); - addDeviceTest(result, 31, 103, "光伏板-1008", "", 1); - addDeviceTest(result, 32, 103, "光伏板-1009", "", 1); - addDeviceTest(result, 33, 103, "光伏板-1010", "", 1); - addDeviceTest(result, 34, 103, "光伏板-1011", "", 1); - addDeviceTest(result, 35, 103, "光伏板-1012", "", 1); - addDeviceTest(result, 36, 106, "储能电池-001", "", 1); - addDeviceTest(result, 37, 106, "储能电池-005", "", 1); - addDeviceTest(result, 38, 106, "储能电池-002", "", 1); - addDeviceTest(result, 39, 106, "储能电池-003", "", 1); - addDeviceTest(result, 40, 106, "储能电池-004", "", 1); - - for (auto& fields: result) - { - Device::add(fields); - } + return appdata_; } void Application::runThreadMain() @@ -110,7 +133,6 @@ void Application::runThreadMain() } - void Application::runThreadDevice() { while (!isQuit()) diff --git a/src/app/Application.h b/src/app/Application.h index 7b6d9e1..2743bc0 100644 --- a/src/app/Application.h +++ b/src/app/Application.h @@ -1,85 +1,10 @@ #pragma once #include + #include "common/Logger.h" - #include "Operator.h" - -struct AppData -{ - ///////////////////////////////////////////// - /// === 系统 === - int64_t sysActivationTime {}; - - ///////////////////////////////////////////// - /// === 数据库 === - struct { - std::string host; - int port; - std::string user; - std::string passwd; - } db; - - ///////////////////////////////////////////// - /// === 系统统计 === - // 累计发电量,单位:kWh - double electGenTatal {}; - // 累计入网电量,单位:kWh - double electInTotal {}; - // 累计收益,单位:元 - double incomeTotal {}; - // 碳减排量, 单位:吨 - double ccers {}; - - ///////////////////////////////////////////// - /// === 环境 === - // 光照度 - double illuminance {}; - // 辐照度 - double irradiance {}; - // 风速 - double windspeed {}; - // 温度 - double temperature {}; - // 湿度 - double humidity {}; - - ///////////////////////////////////////////// - /// === 日统计 === - struct { - // 发电量 - double electGen {}; - // 入网电量 - double electIn {}; - // 发电收益金额 - double incomeElect {}; - // 储能电量 - double electStorage {}; - // 储能次数 - int numStore {}; - // 放电电量 - double electDischarge {}; - // 放电次数 - int numDischarge {}; - // 用电电量 - double electLoad {}; - // 充电电量 - double electCharge {}; - // 充电次数 - int numCharge {}; - // 充电收益 - double incomeCharge {}; - - // 故障次数 - int numFault {}; - // 故障次数:光伏设备 - int numFaultSolar {}; - // 故障次数:储能设备 - int numFaultStorage {}; - // 故障次数:负荷设备 - int numFaultLoad {}; - } statDay; -}; +#include "app/AppData.h" class Application { @@ -91,8 +16,9 @@ public: } void init(); - void initDevice(); + AppData& getAppData(); + bool isQuit() { return isQuit_; } Operator& getOperator() { return op_; } @@ -100,9 +26,12 @@ public: void runThreadDevice(); -private: +public: bool isQuit_ = false; // 登录的管理员信息 Operator op_; + + // 应用数据 + AppData appdata_; }; \ No newline at end of file diff --git a/src/app/Dao.cpp b/src/app/Dao1.cpp similarity index 95% rename from src/app/Dao.cpp rename to src/app/Dao1.cpp index 3701250..e7a5a1b 100644 --- a/src/app/Dao.cpp +++ b/src/app/Dao1.cpp @@ -1,4 +1,4 @@ -#include "Dao.h" +#include "Dao1.h" #include "common/Logger.h" #include "common/Utils.h" #include "common/Snowflake.h" @@ -17,7 +17,7 @@ std::shared_ptr DAO::get(std::string tableName) Errcode DAO::login(std::shared_ptr dao, std::string account, std::string passwd, std::string& err) { - std::string t = Utils::timeNowStr(); + std::string t = Utils::timeStr(); if (!dao) { dao = std::make_shared(""); @@ -90,7 +90,7 @@ bool DAO::writeSystemLog(std::shared_ptr dao, int type, std::string u fieldsLog.set("user_id", userId); fieldsLog.set("user_account", account); fieldsLog.set("content", text); - fieldsLog.set("create_time", Utils::timeNowStr()); + fieldsLog.set("create_time", Utils::timeStr()); bool ret = dao->insertFields({fieldsLog}); return ret; } @@ -131,7 +131,7 @@ int DAO::insertUser(DataFields& fields) } fields.set("user_id", Snowflake::instance().getIdStr()); - fields.set("create_time", Utils::timeNowStr()); + fields.set("create_time", Utils::timeStr()); ret = dao->insertFields(fields); return (ret) ? 0 : 1; } diff --git a/src/app/Dao.h b/src/app/Dao1.h similarity index 100% rename from src/app/Dao.h rename to src/app/Dao1.h diff --git a/src/app/Device.cpp b/src/app/Device.cpp index 5f7ea51..642ebd6 100644 --- a/src/app/Device.cpp +++ b/src/app/Device.cpp @@ -33,7 +33,7 @@ // return iter->second; //} -int DeviceEntity::startComm() +int Device::startComm() { if (!isOpen) { @@ -64,63 +64,58 @@ int DeviceEntity::startComm() return 0; } -// ================================================================================================ -// $$Device -std::map> Device::mapDevices; - -void Device::add(DataFields& fields) +std::shared_ptr Device::create(DataFields& fields) { - auto entity = std::make_shared(); - entity->deviceId = fields.getInt("device_id"); - entity->type = fields.getInt("type"); - entity->name = fields.getStr("name"); - entity->code = fields.getStr("code"); - entity->isOpen = fields.getInt("is_open"); - entity->attrsJson = fields.getStr("attrs"); + auto device = std::make_shared(); + device->deviceId = fields.getInt("device_id"); + device->type = fields.getInt("type"); + device->name = fields.getStr("name"); + device->code = fields.getStr("code"); + device->isOpen = fields.getInt("is_open"); + device->attrsJson = fields.getStr("attrs"); // 解析属性的JSON字符串,转换成键值对 NJson jsonroot; - bool ret = NJsonParse(entity->attrsJson, jsonroot); + bool ret = NJsonParse(device->attrsJson, jsonroot); if (!ret) // 解析错误 { - XLOGE() << "device attr json parse error, device_id=" << entity->deviceId; + XLOGE() << "device attr json parse error, device_id=" << device->deviceId; } else { for (auto& [key, val] : jsonroot.items()) { std::string valType = val.type_name(); if (valType == "string") { - entity->attrs.set(key, val.get()); + device->attrs.set(key, val.get()); } else if (valType == "number") { - entity->attrs.set(key, val.get()); + device->attrs.set(key, val.get()); } - else { + else { XLOGE() << key << ": [" << valType << "]"; } } } - // 保存设备 entity 到 map - if (entity->deviceId != -1) - { - mapDevices[entity->deviceId] = entity; - } - // 启动通讯,该函数中会自动判断isOpen状态,选择是否进行通讯连接 - entity->startComm(); + device->startComm(); + return device; } -std::vector> Device::getDeviceByType(int type) -{ - std::vector> vecDevice; - for (auto iter = mapDevices.begin(); iter!=mapDevices.end(); ++iter) - { - auto device = iter->second; - if (device && (type<=0 || device->type == type)) - { - vecDevice.push_back(device); - } - } - return vecDevice; -} \ No newline at end of file + + + +// +//std::vector> Device::getDeviceByType(int type) +//{ +// std::vector> vecDevice; +// for (auto iter = mapDevices.begin(); iter!=mapDevices.end(); ++iter) +// { +// auto device = iter->second; +// if (device && (type<=0 || device->type == type)) +// { +// vecDevice.push_back(device); +// } +// } +// return vecDevice; +//} \ No newline at end of file diff --git a/src/app/Device.h b/src/app/Device.h index 325ae3a..43a90fc 100644 --- a/src/app/Device.h +++ b/src/app/Device.h @@ -9,7 +9,7 @@ class CommEntity; -class DeviceEntity +class Device { public: int deviceId = -1; @@ -38,17 +38,19 @@ public: // 启动通讯 int startComm(); + + static std::shared_ptr create(DataFields& fields); }; -class Device -{ -public: - static void add(DataFields& fields); - - static std::vector> getDeviceByType(int type); - -public: - static std::map> mapDevices; -}; +//class Device +//{ +//public: +// static void add(DataFields& fields); +// +// static std::vector> getDeviceByType(int type); +// +//public: +// static std::map> mapDevices; +//}; diff --git a/src/app/Operator.cpp b/src/app/Operator.cpp index 880a2d0..cf3fd0e 100644 --- a/src/app/Operator.cpp +++ b/src/app/Operator.cpp @@ -1,17 +1,17 @@ #include "Operator.h" -#include "DAO.h" #include "common/Logger.h" bool Operator::login(std::string account, std::string passwd, std::string& err) { - auto ecode = DAO::login(nullptr, account, passwd, err); - if (ecode == Errcode::OK) - { - XLOGD() << "用户[" + account + "]登录成功"; - } - else - { - XLOGD() << "用户[" + account + "]登录失败: " << err; - } - return (ecode == Errcode::OK); + //auto ecode; = DAO::login(nullptr, account, passwd, err); + //if (ecode == Errcode::OK) + //{ + // XLOGD() << "用户[" + account + "]登录成功"; + //} + //else + //{ + // XLOGD() << "用户[" + account + "]登录失败: " << err; + //} + //return (ecode == Errcode::OK); + return true; } \ No newline at end of file diff --git a/src/app/Station.cpp b/src/app/Station.cpp new file mode 100644 index 0000000..89675f2 --- /dev/null +++ b/src/app/Station.cpp @@ -0,0 +1,21 @@ +#include "Station.h" + + +Station::Station(int id) : id(id) +{ +} + +void Station::addDevice(int deviceId, std::shared_ptr device) +{ + mapDevice_[deviceId] = device; +} + +std::shared_ptr Station::getDevice(int deviceId) +{ + auto iter = mapDevice_.find(deviceId); + if (iter!=mapDevice_.end()) + { + return iter->second; + } + return nullptr; +} \ No newline at end of file diff --git a/src/app/Station.h b/src/app/Station.h new file mode 100644 index 0000000..1974a2e --- /dev/null +++ b/src/app/Station.h @@ -0,0 +1,74 @@ +#pragma once + +#include +#include + +class Device; + +class Station +{ +public: + Station(int id); + + void addDevice(int deviceId, std::shared_ptr device); + std::shared_ptr getDevice(int deviceId); + +public: + int id {}; + std::string name; + + // 储能容量 + double energyCapacity {}; + + /////////////////////////////////////////////////////////////////////////////////////////////// + /// === 系统统计 === + // 累计发电量,单位:kWh + double electGenTatal {}; + // 累计入网电量,单位:kWh + double electGridTotal {}; + // 累计收益,单位:元 + double incomeTotal {}; + // 碳减排量, 单位:吨 + double ccers {}; + // 累计储能充电电量 + double electStorageIn {}; + // 累计储能放电电量 + double electStorageOut {}; + + /////////////////////////////////////////////////////////////////////////////////////////////// + /// === 日统计 === + double storageIn {}; // 储能充电电量 + double storageOut {}; // 储能放电电量 + + int storageNumIn {}; // 储能充电次数 + int storageNumOut {}; // 储能放电次数 + int storageNumErr {}; // 储能故障次数 + + double solarGen {}; // 光伏发电电量 + double solarGrid {}; // 光伏入网电量 + int solarNumErr {}; // 光伏故障次数 + + double chargeElect {}; // 充电设备充电电量 + int chargeNum {}; // 充电设备充电次数 + int chargeNumErr {}; // 充电设备故障次数 + + double incomeElect {}; // 发电收益金额 + double incomeCharge {}; // 充电收益金额 + + /////////////////////////////////////////////////////////////////////////////////////////////// + /// === 环境 === + // 光照度 + double illuminance {}; + // 辐照度 + double irradiance {}; + // 风速 + double windspeed {}; + // 温度 + double temperature {}; + // 湿度 + double humidity {}; + + /////////////////////////////////////////////////////////////////////////////////////////////// + /// === 设备信息 === + std::unordered_map> mapDevice_; +}; \ No newline at end of file diff --git a/src/common/Crypto.cpp b/src/common/Crypto.cpp new file mode 100644 index 0000000..b48294c --- /dev/null +++ b/src/common/Crypto.cpp @@ -0,0 +1,151 @@ +#include "Crypto.h" + + +#define MD5_A 0x67452301 +#define MD5_B 0xefcdab89 +#define MD5_C 0x98badcfe +#define MD5_D 0x10325476 + +const char MD5_S16[] = "0123456789abcdef"; + +const unsigned int T[] = { + 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee, + 0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501, + 0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be, + 0x6b901122,0xfd987193,0xa679438e,0x49b40821, + 0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa, + 0xd62f105d,0x02441453,0xd8a1e681,0xe7d3fbc8, + 0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed, + 0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a, + 0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c, + 0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70, + 0x289b7ec6,0xeaa127fa,0xd4ef3085,0x04881d05, + 0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665, + 0xf4292244,0x432aff97,0xab9423a7,0xfc93a039, + 0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1, + 0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1, + 0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391 }; + +const unsigned int MD5_OFFSET[] = { + 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22, + 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, + 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23, + 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21 +}; + +// 填充字符串 +vector padding(string src, unsigned int& len) +{ + // 以512位,64个字节为一组 + unsigned int num = ((src.length() + 8) / 64) + 1; + vector rec(num * 16); + len = num * 16; + for (unsigned int i = 0; i < src.length(); i++) { + // 一个unsigned int对应4个字节,保存4个字符信息 + rec[i >> 2] |= (int)(src[i]) << ((i % 4) * 8); + } + // 补充1000...000 + rec[src.length() >> 2] |= (0x80 << ((src.length() % 4) * 8)); + // 填充原文长度 + rec[rec.size() - 2] = (src.length() << 3); + return rec; +} +// 整理输出 +string md5_format(unsigned int num) +{ + string res = ""; + unsigned int base = 1 << 8; + for (int i = 0; i < 4; i++) { + string tmp = ""; + unsigned int b = (num >> (i * 8)) % base & 0xff; + for (int j = 0; j < 2; j++) { + tmp = MD5_S16[b % 16] + tmp; + b /= 16; + } + res += tmp; + } + return res; +} + +// F函数 +unsigned int F(unsigned int b, unsigned int c, unsigned int d) +{ + return (b & c) | ((~b) & d); +} +// G函数 +unsigned int G(unsigned int b, unsigned int c, unsigned int d) +{ + return (b & d) | (c & (~d)); +} +// H函数 +unsigned int H(unsigned int b, unsigned int c, unsigned int d) +{ + return b ^ c ^ d; +} +// I函数 +unsigned int I(unsigned int b, unsigned int c, unsigned int d) +{ + return c ^ (b | (~d)); +} +// 移位操作函数 +unsigned int shift(unsigned int a, unsigned int n) +{ + return (a << n) | (a >> (32 - n)); +} + +// 循环压缩 +void md5_encode(unsigned int* X, int size, unsigned int& tempA, unsigned int& tempB, unsigned int& tempC, unsigned int& tempD) +{ + unsigned int a = tempA, + b = tempB, + c = tempC, + d = tempD, + rec = 0, + g, k; + for (int i = 0; i < 64; i++) { + if (i < 16) { + // F迭代 + g = F(b, c, d); + k = i; + } else if (i < 32) { + // G迭代 + g = G(b, c, d); + k = (1 + 5 * i) % 16; + } else if (i < 48) { + // H迭代 + g = H(b, c, d); + k = (5 + 3 * i) % 16; + } else { + // I迭代 + g = I(b, c, d); + k = (7 * i) % 16; + } + rec = d; + d = c; + c = b; + b = b + shift(a + g + X[k] + T[i], MD5_OFFSET[i]); + a = rec; + } + tempA += a; + tempB += b; + tempC += c; + tempD += d; +} + +string Crypto::md5(string src) +{ + unsigned int tempA = MD5_A; + unsigned int tempB = MD5_B; + unsigned int tempC = MD5_C; + unsigned int tempD = MD5_D; + unsigned int len = 0; + vector rec = padding(src, len); + for (unsigned int i = 0; i < len / 16; i++) { + unsigned int num[16]; + for (int j = 0; j < 16; j++) { + num[j] = rec[i * 16 + j]; + } + md5_encode(num, 16, tempA, tempB, tempC, tempD); + } + return md5_format(tempA) + md5_format(tempB) + md5_format(tempC) + md5_format(tempD); +} \ No newline at end of file diff --git a/src/common/Crypto.h b/src/common/Crypto.h new file mode 100644 index 0000000..c237511 --- /dev/null +++ b/src/common/Crypto.h @@ -0,0 +1,20 @@ +#ifndef _Crypto_H_ +#define _Crypto_H_ + + +#include +#include +#include +#include + +using namespace std; + + +class Crypto +{ +public: + static string md5(string src); + +}; + +#endif // ! _Crypto_H_ \ No newline at end of file diff --git a/src/common/DataFields.cpp b/src/common/DataFields.cpp index 9524f59..8f4fa82 100644 --- a/src/common/DataFields.cpp +++ b/src/common/DataFields.cpp @@ -32,10 +32,17 @@ int DataFields::getInt(string key) { return mapFields_.count(key) > 0 ? Utils::toInt(mapFields_[key]) : 0; } + float DataFields::getFloat(string key) { return mapFields_.count(key) > 0 ? Utils::toFloat(mapFields_[key]) : 0.0f; } + +double DataFields::getDouble(string key) +{ + return mapFields_.count(key) > 0 ? Utils::toDouble(mapFields_[key]) : 0.0; +} + void DataFields::remove(string key) { auto it = mapFields_.find(key); @@ -143,7 +150,7 @@ string DataFields::get_update_sql(string tbname, std::vector vec_ke return oss.str(); } -void DataFields::foreach_item(function on_foraach) +void DataFields::foreachItem(function on_foraach) { for (auto it = mapFields_.begin(); it != mapFields_.end(); it++) { @@ -176,12 +183,12 @@ bool DataFields::is_float_number(string key) return true; } -string DataFields::to_str() +string DataFields::toStr() { string s; for (auto it = mapFields_.begin(); it != mapFields_.end(); it++) { - s += ("[" + it->first + ":" + it->second + "] "); + s += ("{" + it->first + ":" + it->second + "} "); } return s; } diff --git a/src/common/DataFields.h b/src/common/DataFields.h index d48826a..7903e10 100644 --- a/src/common/DataFields.h +++ b/src/common/DataFields.h @@ -10,10 +10,10 @@ using namespace std; struct PageInfo { - int total = 0; - int page_id = 1; - int page_size = 10; - int page_max = 0; + int total {0}; + int pageIndex {0}; + int pageSize {10}; + int pageCount {0}; }; class DataFields @@ -64,7 +64,13 @@ public: * @param: [string key] 索引名称 */ float getFloat(string key); - + + /** + * 获取 double 值 + * @param: [string key] 索引名称 + */ + double getDouble(string key); + /** * 删除指定索引的值 * @param: [string key] 索引名称 @@ -116,7 +122,7 @@ public: * 遍历数据项 * @param: [function... on_foraach] 回调函数 */ - void foreach_item(function on_foraach); + void foreachItem(function on_foraach); /** * 判断是否含有数据项 @@ -133,7 +139,7 @@ public: /** * 转换成键值对的字符串格式 */ - string to_str(); + string toStr(); /** * 获取数据项的大小 diff --git a/src/common/Logger.cpp b/src/common/Logger.cpp index 4cf5a31..b856756 100644 --- a/src/common/Logger.cpp +++ b/src/common/Logger.cpp @@ -7,7 +7,7 @@ std::mutex g_mutex; -Logger::Logger(Logger::ELogType logtype, std::string filename, int line) : line_(line) +Logger::Logger(Logger::ELogType logtype, std::string filename, int lineEdit) : line_(lineEdit) { auto index = filename.find_last_of('\\'); if (index != std::string::npos) @@ -64,7 +64,7 @@ Logger::~Logger() } //std::cout << "[" << filename_ << ":" << line_ << "] [" << Utils::time_now_string_ms() << "][" << strLogType[int(log_type_)] << "] "; - std::cout << "[" << Utils::timeNowStrMS() << "][" << strLogType[int(log_type_)] << "] "; + std::cout << "[" << Utils::timeStrMS() << "][" << strLogType[int(log_type_)] << "] "; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); std::cout << "- " << text << std::endl << std::flush; g_mutex.unlock(); diff --git a/src/common/Logger.h b/src/common/Logger.h index 092088a..2eb52a6 100644 --- a/src/common/Logger.h +++ b/src/common/Logger.h @@ -19,7 +19,7 @@ public: }; public: - Logger(Logger::ELogType logType, std::string filename, int line); + Logger(Logger::ELogType logType, std::string filename, int lineEdit); ~Logger(); std::stringstream& Stream() { return oss_; } diff --git a/src/common/Utils.cpp b/src/common/Utils.cpp index f14f3d7..2522e16 100644 --- a/src/common/Utils.cpp +++ b/src/common/Utils.cpp @@ -195,34 +195,13 @@ void parse_from_string() cout << tp.time_since_epoch().count() << endl; } -int64_t Utils::timeNow() -{ - // return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); - return std::chrono::time_point_cast(std::chrono::system_clock::now()).time_since_epoch().count(); -} -int64_t Utils::timeNowMS() +int64_t Utils::time() { return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); //return std::chrono::time_point_cast(std::chrono::system_clock::now()).time_since_epoch().count(); } -int64_t Utils::timeNowDate() -{ - // 获取当前时间 - auto now = std::chrono::system_clock::now(); - time_t t = std::chrono::system_clock::to_time_t(now); - // 转换为本地时间结构体 - struct tm* tmlocal = localtime(&t); - - // 设置时分秒为0 - tmlocal->tm_hour = 0; - tmlocal->tm_min = 0; - tmlocal->tm_sec = 0; - - // 转换回time_t - return mktime(tmlocal); -} -string Utils::timeNowStr(std::string fmt /*= "%Y-%m-%dT%H:%M:%S"*/) +string Utils::timeStr(std::string fmt /*= "%Y-%m-%dT%H:%M:%S"*/) { auto t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::stringstream ss; @@ -230,7 +209,28 @@ string Utils::timeNowStr(std::string fmt /*= "%Y-%m-%dT%H:%M:%S"*/) return ss.str(); } -string Utils::timeNowStrMS(std::string fmt /*= "%Y-%m-%dT%H:%M:%S"*/) +int64_t Utils::date() +{ + // 获取当前时间戳 + std::time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + + // 转换为本地时间结构体,设置时分秒为0 + std::tm* tmlocal = localtime(&t); + tmlocal->tm_hour = 0; + tmlocal->tm_min = 0; + tmlocal->tm_sec = 0; + + auto tp = std::chrono::time_point_cast(std::chrono::system_clock::from_time_t(mktime(tmlocal))); + return tp.time_since_epoch().count(); +} + +string Utils::dateStr(std::string fmt /*= "%Y-%m-%d %H:%M:%S"*/) +{ + return Utils::timeStr(fmt).substr(0, 10); +} + + +string Utils::timeStrMS(std::string fmt /*= "%Y-%m-%dT%H:%M:%S"*/) { auto tpNow = std::chrono::system_clock::now(); auto time = std::chrono::system_clock::to_time_t(tpNow); @@ -238,109 +238,110 @@ string Utils::timeNowStrMS(std::string fmt /*= "%Y-%m-%dT%H:%M:%S"*/) std::stringstream ss; ss << std::put_time(std::localtime(&time), fmt.c_str()); - auto tms = std::chrono::duration_cast(tpNow.time_since_epoch()); - auto tseconds = std::chrono::duration_cast(tpNow.time_since_epoch()); + auto epoch = tpNow.time_since_epoch(); + auto tms = std::chrono::duration_cast(epoch); + auto tseconds = std::chrono::duration_cast(epoch); ss << "." << std::setfill('0') << std::setw(3) << (tms - tseconds).count(); return ss.str(); } - -string Utils::timeStr(int64_t ts, std::string fmt /*= "%Y-%m-%d %H:%M:%S"*/) -{ - // std::localtime : 本地时区的时间 - // std::gmtime : 格林威治时间 - time_t t(ts); - std::stringstream ss; - ss << std::put_time(std::localtime(&t), fmt.c_str()); - return ss.str(); -} - -string Utils::time_to_string(int64_t dt, std::string fmt /*= "%Y-%m-%d %H:%M:%S"*/) -{ - auto ms = std::chrono::milliseconds(dt); - auto tp = std::chrono::time_point(ms); - time_t t = std::chrono::system_clock::to_time_t(tp); - std::stringstream ss; - ss << std::put_time(std::localtime(&t), fmt.c_str()); - return ss.str(); -} - -// 2023-12-12 12:12:12 -int64_t Utils::time(string dt, int zone) -{ - if (dt.empty()) - { - return std::chrono::time_point_cast(std::chrono::system_clock::now()).time_since_epoch().count(); - } - else - { - static string FMT_D = "yyyy-MM-dd"; - static string FMT_DT = "yyyy-MM-dd HH:mm:ss"; - static string FMT_DS = "yyyy-MM-dd HH:mm:ss.SSS"; - string fmt; - if (dt.size() == FMT_D.size()) - { - fmt = "%Y-%m-%d"; - dt[4] = dt[7] = '-'; - } - else if (dt.size() == FMT_DT.size()) - { - fmt = "%Y-%m-%d %H:%M:%S"; - dt[4] = dt[7] = '-'; - dt[10] = ' '; - dt[13] = dt[16] = ':'; - } - else if (dt.size() == FMT_DT.size()) - { - } - else - { - return -1; - } - - stringstream ss(dt); - - std::tm t {}; - ss >> std::get_time(&t, fmt.c_str()); - t.tm_hour += zone; - auto tp = std::chrono::system_clock::from_time_t(std::mktime(&t)); - return std::chrono::duration_cast(tp.time_since_epoch()).count(); - //return std::chrono::duration_cast(tp.time_since_epoch()).count(); - } -} - - - -bool Utils::time_string_to_tm(string dt, std::tm& t) -{ - t.tm_year = 1900; - t.tm_mon = 1; - t.tm_mday = 1; - static string FORMAT_D = "yyyy-mm-dd"; - static string FORMAT_DT = "yyyy-mm-dd HH:MM:SS"; - string fmt; - if (dt.size() == FORMAT_D.size()) - { - fmt = "%Y-%m-%d"; - dt[4] = dt[7] = '-'; - } - else if (dt.size() >= FORMAT_DT.size()) - { - fmt = "%Y-%m-%d %H:%M:%S"; - dt[4] = dt[7] = '-'; - dt[10] = ' '; - dt[13] = dt[16] = ':'; - } - else - { - return false; - } - stringstream ss; - ss << dt; - ss >> std::get_time(&t, fmt.c_str()); - t.tm_year += 1900; - t.tm_mon += 1; - return true; -} +// +//string Utils::timeStr(int64_t ts, std::string fmt /*= "%Y-%m-%d %H:%M:%S"*/) +//{ +// // std::localtime : 本地时区的时间 +// // std::gmtime : 格林威治时间 +// time_t t(ts); +// std::stringstream ss; +// ss << std::put_time(std::localtime(&t), fmt.c_str()); +// return ss.str(); +//} +// +//string Utils::time_to_string(int64_t dt, std::string fmt /*= "%Y-%m-%d %H:%M:%S"*/) +//{ +// auto ms = std::chrono::milliseconds(dt); +// auto tp = std::chrono::time_point(ms); +// time_t t = std::chrono::system_clock::to_time_t(tp); +// std::stringstream ss; +// ss << std::put_time(std::localtime(&t), fmt.c_str()); +// return ss.str(); +//} +// +//// 2023-12-12 12:12:12 +//int64_t Utils::time(string dt, int zone) +//{ +// if (dt.empty()) +// { +// return std::chrono::time_point_cast(std::chrono::system_clock::now()).time_since_epoch().count(); +// } +// else +// { +// static string FMT_D = "yyyy-MM-dd"; +// static string FMT_DT = "yyyy-MM-dd HH:mm:ss"; +// static string FMT_DS = "yyyy-MM-dd HH:mm:ss.SSS"; +// string fmt; +// if (dt.size() == FMT_D.size()) +// { +// fmt = "%Y-%m-%d"; +// dt[4] = dt[7] = '-'; +// } +// else if (dt.size() == FMT_DT.size()) +// { +// fmt = "%Y-%m-%d %H:%M:%S"; +// dt[4] = dt[7] = '-'; +// dt[10] = ' '; +// dt[13] = dt[16] = ':'; +// } +// else if (dt.size() == FMT_DT.size()) +// { +// } +// else +// { +// return -1; +// } +// +// stringstream ss(dt); +// +// std::tm t {}; +// ss >> std::get_time(&t, fmt.c_str()); +// t.tm_hour += zone; +// auto tp = std::chrono::system_clock::from_time_t(std::mktime(&t)); +// return std::chrono::duration_cast(tp.time_since_epoch()).count(); +// //return std::chrono::duration_cast(tp.time_since_epoch()).count(); +// } +//} +// +// +// +//bool Utils::time_string_to_tm(string dt, std::tm& t) +//{ +// t.tm_year = 1900; +// t.tm_mon = 1; +// t.tm_mday = 1; +// static string FORMAT_D = "yyyy-mm-dd"; +// static string FORMAT_DT = "yyyy-mm-dd HH:MM:SS"; +// string fmt; +// if (dt.size() == FORMAT_D.size()) +// { +// fmt = "%Y-%m-%d"; +// dt[4] = dt[7] = '-'; +// } +// else if (dt.size() >= FORMAT_DT.size()) +// { +// fmt = "%Y-%m-%d %H:%M:%S"; +// dt[4] = dt[7] = '-'; +// dt[10] = ' '; +// dt[13] = dt[16] = ':'; +// } +// else +// { +// return false; +// } +// stringstream ss; +// ss << dt; +// ss >> std::get_time(&t, fmt.c_str()); +// t.tm_year += 1900; +// t.tm_mon += 1; +// return true; +//} void Utils::sleep_ms(int ms) { diff --git a/src/common/Utils.h b/src/common/Utils.h index 2a2e640..c8e1102 100644 --- a/src/common/Utils.h +++ b/src/common/Utils.h @@ -39,19 +39,22 @@ public: memcpy_s(&dest[start], len, &src, len); } - static int64_t timeNow(); - static int64_t timeNowMS(); - static int64_t timeNowDate(); - static string timeNowStr(std::string fmt = "%Y-%m-%d %H:%M:%S"); - static string timeNowStrMS(std::string fmt = "%Y-%m-%d %H:%M:%S"); - static string timeStr(int64_t ts, std::string fmt = "%Y-%m-%d %H:%M:%S"); + // 获取当前时间的时间戳(毫秒) + static int64_t time(); + // 获取当前时间的格式字符串 + static string timeStr(std::string fmt = "%Y-%m-%d %H:%M:%S"); + // 获取当前日期的时间戳(毫秒) + static int64_t date(); + // 获取当前日期的格式字符串 + static string dateStr(std::string fmt = "%Y-%m-%d %H:%M:%S"); - static int64_t time(string dt="", int zone = 0); - - static string time_to_string(int64_t dt, std::string fmt="%Y-%m-%d %H:%M:%S"); - static bool time_string_to_tm(string dt, std::tm& t); + static string timeStrMS(std::string fmt = "%Y-%m-%d %H:%M:%S"); + //static string timeStr(int64_t ts, std::string fmt = "%Y-%m-%d %H:%M:%S"); + //static int64_t time(string dt="", int zone = 0); + //static string time_to_string(int64_t dt, std::string fmt="%Y-%m-%d %H:%M:%S"); + //static bool time_string_to_tm(string dt, std::tm& t); std::string duration_str(int64_t t) { @@ -89,12 +92,12 @@ public: TimeTick() { - tickMS_ = Utils::timeNowMS(); + tickMS_ = Utils::time(); } bool elapse(int64_t ms, bool reset = true) { - auto tick_now = Utils::timeNowMS(); + auto tick_now = Utils::time(); bool res = tick_now - tickMS_ > ms; if (res && reset) { @@ -105,7 +108,7 @@ public: void reset() { - tickMS_ = Utils::timeNowMS(); + tickMS_ = Utils::time(); } }; diff --git a/src/database/Dao.cpp b/src/database/Dao.cpp new file mode 100644 index 0000000..0ef8cb0 --- /dev/null +++ b/src/database/Dao.cpp @@ -0,0 +1,172 @@ +#include "Dao.h" +#include "common/Utils.h" + +std::string DAO::sqlPageLimit(int index, int size) +{ + int startIndex = index * size; + if (startIndex < 0) { startIndex = 0; } + return " LIMIT " + std::to_string(startIndex) + "," + std::to_string(size); +} + +bool DAO::count(DaoEntity& dao, std::string tableName, std::string condition, int& count) +{ + std::string sql = "SELECT COUNT(*) count FROM " + tableName; + if (!condition.empty()) { sql += " WHERE " + condition; }; + sql += ";"; + + std::vector result; + bool ret = dao.exec(sql, result); + if (ret) + { + count = (result.size() > 0) ? result[0].getInt("count") : 0; + } + return ret; +} + +static bool QueryCount(DaoEntity& dao, std::string sqlFrom, int& count) +{ + std::vector result; + bool ret = dao.exec("SELECT COUNT(*) count " + sqlFrom, result); + if (ret) + { + count = (result.size() > 0) ? result[0].getInt("count") : 0; + } + return ret; +} + + +static bool QueryPagination(std::string sqlFrom, PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + + int count {0}; + if (!QueryCount(dao, sqlFrom, count)) + { + return false; + } + + pageInfo.total = count; + std::string sql = "SELECT * " + sqlFrom + DAO::sqlPageLimit(pageInfo.pageIndex, pageInfo.pageSize); + bool ret = dao.exec(sql, result); + if (!ret) + { + XLOGE() << "DAO database error: sql=" << sql; + } + return ret; +} + +bool DAO::queryUserList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMUser::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: queryUserList failed."; + } + return ret; +} + +bool DAO::updateUserById(DataFields& params) +{ + std::string userId = params.getStr(DMUser::USER_ID); + params.remove(DMUser::USER_ID); + DaoEntity dao(DMUser::TABLENAME); + return dao.updateFields(params, "WHERE " + DMUser::USER_ID + "='" + userId + "'"); +} + +bool DAO::queryRoleList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMRole::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: queryRoleList failed."; + } + return ret; +} + +bool DAO::queryPermissionList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMPermission::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: queryPermissionList failed."; + } + return ret; +} + +// 查询场站信息列表 +bool DAO::queryStationList(vector& result) +{ + std::string sql = "SELECT * FROM " + DMStation::TABLENAME; + return DaoEntity::execOnce(sql, result); +} + +// 分页查询场站信息列表 +bool DAO::queryStationList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMStation::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: queryStationList failed."; + } + return ret; +} + +// 查询设备信息列表 +bool DAO::queryDeviceList(vector& result) +{ + std::string sql = "SELECT * FROM " + DMDevice::TABLENAME; + return DaoEntity::execOnce(sql, result); +} + +// 分页查询设备信息列表 +bool DAO::queryDeviceList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMDevice::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: queryDeviceList failed."; + } + return ret; +} + +// 策略管理 +bool DAO::queryPolicyList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMPolicy::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: queryPolicyList failed."; + } + return ret; +} + +// 系统日志管理 +bool DAO::querySystemLogList(PageInfo& pageInfo, vector& result) +{ + DaoEntity dao(""); + std::string sqlFrom = "FROM " + DMSystemLog::TABLENAME; + bool ret = QueryPagination(sqlFrom, pageInfo, result); + if (!ret) + { + XLOGE() << "DAO database error: querySystemLogList failed."; + } + return ret; +} + +bool DAO::queryStatDataList(std::string startDate, std::string endDate, vector& result) +{ + std::string sql = "SELECT * FROM " + DMStatStation::TABLENAME + " WHERE dt BETWEEN '" + startDate + "' AND '" + endDate + "';"; + return DaoEntity::execOnce(sql, result); +} \ No newline at end of file diff --git a/src/database/Dao.h b/src/database/Dao.h new file mode 100644 index 0000000..d2226a0 --- /dev/null +++ b/src/database/Dao.h @@ -0,0 +1,54 @@ +#pragma once +#include "DaoEntity.h" +#include "DataModelDef.h" +#include "common/Logger.h" + +class DAO +{ +public: + static std::string sqlPageLimit(int index, int size); + + static bool count(DaoEntity& dao, std::string tableName, std::string condition, int& count); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 用户管理 + static bool queryUserList(PageInfo& pageInfo, vector& result); + + static bool updateUserById(DataFields& params); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 角色管理 + static bool queryRoleList(PageInfo& pageInfo, vector& result); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 权限管理 + static bool queryPermissionList(PageInfo& pageInfo, vector& result); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 场站管理 + // 查询场站信息列表 + static bool queryStationList(vector& result); + // 分页查询场站信息列表 + static bool queryStationList(PageInfo& pageInfo, vector& result); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 设备管理 + // 查询设备信息列表 + static bool queryDeviceList(vector& result); + // 分页查询设备信息列表 + static bool queryDeviceList(PageInfo& pageInfo, vector& result); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 策略管理 + // 分页查询策略信息列表 + static bool queryPolicyList(PageInfo& pageInfo, vector& result); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 系统日志管理 + // 分页查询系统日志列表 + static bool querySystemLogList(PageInfo& pageInfo, vector& result); + + /////////////////////////////////////////////////////////////////////////////////////////////// + // === 统计数据管理 + static bool queryStatDataList(std::string startDate, std::string endDate, vector& result); +}; \ No newline at end of file diff --git a/src/database/DaoEntity.cpp b/src/database/DaoEntity.cpp index 91d1155..a2aeeb5 100644 --- a/src/database/DaoEntity.cpp +++ b/src/database/DaoEntity.cpp @@ -192,20 +192,21 @@ bool DaoEntity::queryFields(string keys, const string& sql_c, PageInfo& pageinfo return true; } - pageinfo.page_max = pageinfo.total / pageinfo.page_size + (pageinfo.total % pageinfo.page_size > 0 ? 1 : 0); + pageinfo.pageCount = pageinfo.total / pageinfo.pageSize + (pageinfo.total % pageinfo.pageSize > 0 ? 1 : 0); oss.str(""); - if (pageinfo.page_id <= 0) + if (pageinfo.pageIndex <= 0) { - pageinfo.page_id = 1; + pageinfo.pageIndex = 1; } - int start = (pageinfo.page_id - 1) * pageinfo.page_size; - oss << "SELECT " << keys << " FROM `" << tableName_ << "` " << sql_c << " LIMIT " << start << "," << pageinfo.page_size << ";"; + int start = (pageinfo.pageIndex - 1) * pageinfo.pageSize; + oss << "SELECT " << keys << " FROM `" << tableName_ << "` " << sql_c << " LIMIT " << start << "," << pageinfo.pageSize << ";"; return this->db_->exec(oss.str().c_str(), result); } bool DaoEntity::updateFields(DataFields& fields, const string& sql_c) { string sql = fields.get_update_sql(tableName_, sql_c); + std::cout << sql; if (sql_c.empty()) { //Spdlogger::error("[DB] update condition is empty, not exec, sql={}", sql); diff --git a/src/database/DataModelDef.h b/src/database/DataModelDef.h new file mode 100644 index 0000000..ef7a4bf --- /dev/null +++ b/src/database/DataModelDef.h @@ -0,0 +1,138 @@ +#include +using namespace std; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// 用户 表结构字段 +namespace DMUser +{ + const string TABLENAME = "user"; // 表名称 + const string USER_ID = "user_id"; + const string ACCOUNT = "account"; + const string PASSWD = "passwd"; + const string NAME = "name"; + const string GENDER = "gender"; + const string AGE = "age"; + const string PHONE = "phone"; + const string EMAIL = "email"; + const string IS_OPEN = "is_open"; + const string LOGINTIME = "login_time"; + const string CREATETIME = "create_time"; + const string UPDATETIME = "update_time"; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// 角色 表结构字段 +namespace DMRole +{ + const string TABLENAME = "role"; + const string ROLE_ID = "role_id"; + const string NAME = "name"; + const string TYPE = "type"; + const string DESCRIBE = "describe"; + const string IS_OPEN = "is_open"; + const string CREATETIME = "create_time"; + const string UPDATETIME = "update_time"; +} + +namespace DMPermission +{ + const string TABLENAME = "permission"; + const string PERMISSION_ID = "permission_id"; + const string NAME = "name"; + const string DESCRIBE = "describe"; + const string IS_OPEN = "is_open"; + const string CREATETIME = "create_time"; + const string UPDATETIME = "update_time"; +} + +namespace DMRolePermission +{ + const string TABLENAME = "role_permission"; + const string FID_ID = "id"; + const string FID_ROLE_ID = "role_id"; + const string FID_PERMISSION_ID = "permission_id"; +} + +namespace DMStation +{ + const string TABLENAME = "station"; + const string STATION_ID = "station_id"; + const string NAME = "name"; + const string ADDRESS = "address"; + const string LONGITUDE = "lon"; + const string LATITUDE = "lat"; + const string TEL = "tel"; + const string CAPACITY = "capacity"; + const string STATUS = "status"; +} + +namespace DMDevice +{ + const string TABLENAME = "device"; + const string DEVICE_ID = "device_id"; + const string STATION_ID = "station_id"; + const string TYPE = "type"; + const string NAME = "name"; + const string CODE = "code"; + const string MODEL = "model"; + const string FACTORY = "factory"; + const string TEL = "factory_tel"; + const string ATTRS = "attrs"; + const string IS_OPEN = "is_open"; + const string STATUS = "status"; + const string CREATE_TIME = "create_time"; + const string UPDATE_TIME = "update_time"; +} + +namespace DMPolicy +{ + const string TABLENAME = "policy"; + const string POLICY_ID = "policy_id"; + const string TYPE = "type"; + const string NAME = "name"; + const string DESCRIBE = "describe"; + const string VALUE = "value"; + const string IS_OPEN = "is_open"; + const string CREATE_TIME = "create_time"; + const string UPDATE_TIME = "update_time"; +} + +namespace DMSystemLog +{ + const string TABLENAME = "system_log"; + const string LOG_ID = "log_id"; + const string TYPE = "type"; + const string USER_ID = "user_id"; + const string USER_ACCOUNT = "user_account"; + const string CONTENT = "content"; + const string STATUS = "status"; + const string CREATE_TIME = "create_time"; + const string UPDATE_TIME = "update_time"; +} + +namespace DMAlertLog +{ + const string TABLENAME = "alert_log"; + const string LOG_ID = "log_id"; + const string TYPE = "type"; + const string DEVICE_ID = "device_id"; + const string CONTENT = "content"; + const string STATUS = "status"; + const string CREATE_TIME = "create_time"; +} + +namespace DMStatStation +{ + const string TABLENAME = "stat_staion"; + const string DT = "dt"; + const string STATION_ID = "station_id"; + const string STORAGE_ELECT_IN = "storage_elect_in"; + const string STORAGE_ELECT_OUT = "storage_elect_out"; + const string STORAGE_NUM_ERR = "storage_num_err"; + const string SOLAR_ELECT_GEN = "solar_elect_gen"; + const string SOLAR_ELECT_GRID = "solar_elect_grid"; + const string SOLAR_NUM_ERR = "solar_num_err"; + const string CHARGE_ELECT = "charge_elect"; + const string CHARGE_NUM = "charge_num"; + const string CHARGE_NUM_ERR = "charge_num_err"; +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a788372..389230d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,17 +5,18 @@ #include #include -#include "widgets/MainWindow.h" #include "common/Utils.h" -#include "app/Application.h" -#include "app/Dao.h" - #include "common/Snowflake.h" -#include "protocol/TcpEntity.h" - #include "common/JsonN.h" +#include "app/Application.h" #include "app/Config.h" +#include "protocol/TcpEntity.h" + +#include "widgets/MainWindow.h" + +#include "pv/PvApp.h" +#include "pv/PvUser.h" int main(int argc, char** argv) { @@ -69,15 +70,22 @@ int main(int argc, char** argv) Application::instance().init(); // 运行QT主窗口 - QApplication qapp(argc, argv); - MainWindow mainWin; - mainWin.setWindowTitle("风光储能站控制管理系统"); - mainWin.resize(1920, 1080); - mainWin.show(); - qapp.exec(); + //QApplication qapp(argc, argv); + //MainWindow mainWin; + //mainWin.setWindowTitle("风光储能站控制管理系统"); + //mainWin.resize(1920, 1080); + //mainWin.show(); + //qapp.exec(); - //while (1) { - // std::this_thread::sleep_for(std::chrono::seconds(1)); - //} + + PARAM p; + int s; + pvInit(argc, argv, &p); + /* here you may interpret ac,av and set p->user to your data */ + while(1) + { + s = pvAccept(&p); + if(s != -1) pvCreateThread(&p,s); + } return 0; } \ No newline at end of file diff --git a/src/pv/#/PvPop.cpp b/src/pv/#/PvPop.cpp new file mode 100644 index 0000000..9263923 --- /dev/null +++ b/src/pv/#/PvPop.cpp @@ -0,0 +1,219 @@ +#include "PvPop.h" +#include "PvInstance.h" +#include "common/Logger.h" + +static const string STYLE_LAB = "color:white;font:bold 18px;border:1px solid rgba(120,120,120,0);"; + +string PvPop::POP_DEFAULT = ""; + +//PanelPop::PanelPop(PARAM* p, int parent, string title, int w, int h) +// +//{ +// +//} + +void PvPop::update(PARAM* p) +{ +} + +void PvPop::set_pop_cb(std::function cb) +{ + cb_pop_ = cb; +}; + +void PvPop::set_enabled(string title, bool b) +{ + if (!title.empty()) + { + if (map_w_.find(title) != map_w_.end()) + { + pvSetEnabled(p_, map_w_[title].pvid, b); + } + return; + } + for (auto it = map_w_.begin(); it != map_w_.end(); it++) + { + pvSetEnabled(p_, it->second.pvid, b); + } +} + +void PvPop::on_click_ok() +{ +}; + +void PvPop::set_status(string status) +{ + status_ = status; + string s = title_; + if (!status_.empty()) + { + s += (":" + status_); + } + pvSetText(p_, lab_title_, s.c_str()); +} + +string PvPop::status() +{ + return status_; +} + +void PvPop::set_err(PARAM* p, string err) +{ + err_ = err; + pvSetText(p, id_err_, err.c_str()); +} + +string PvPop::err() +{ + return err_; +} + +void PvPop::reset(PARAM* p) +{ +} + +PvPop::PvPop(PARAM* p, int parent, string title, int w /*= 900*/, int h /*= 700*/) + : PvWidget(p, parent, PvRect(0, 0, 1920, 1080)), width_(w), height_(h), title_(title) +{ + // 半透全屏背景,遮盖后面的控件,禁止操作底层控件 + PvManager::label(p, pvid_, "", PvRect(0, 0, 1920, 1080), "background-color:rgba(50,50,50,0);"); + + // 弹框的有效工作区域 + rt_pop_.set((1920 - w) * 0.5, (1080 - h) * 0.5, w, h); + // 工作区(包含顶部标题和底部按钮) + w_main_ = PvManager::widget(p, pvid_, rt_pop_); + // 工作区背景 + PvManager::label(p, w_main_, "", PvRect(0, 0, w, h), "border:1px solid #26dcac;border-radius:10;background-color:rgb(21,68,94);"); + + // 顶部标题 + lab_title_ = PvManager::label(p, w_main_, title, PvRect(1, 1, w - 2, 48), "border-radius:10;background-color:rgb(49,132,149);font:bold 20px;color:rgb(255,255,255);"); + pvSetAlignment(p, lab_title_, AlignCenter); + + // 用户工作区 + w_worksace_ = PvManager::widget(p, w_main_, PvRect(1, 48, w - 2, (h - 120))); + + // 关闭按钮 + PvManager::button_image(p, w_main_, "resource/pv.btn.close.png", "", "", PvRect(w - 40, 10, 29, 29), [=](string s) + { + this->set_status(""); + this->hide(); + }); + + static string style_btn_ok = + "QPushButton{background-color:rgb(38,220,172);font:bold 20px;color:white;border-radius:8;}" + "QPushButton:hover{border:2px solid red;}" + "QPushButton:pressed{border-width:3px 0 0 3px;border-style:inset;}" + "QPushButton:disabled{color:rgb(150,150,150);}"; + static string style_btn_cannel = + "QPushButton{background-color:rgb(200,207,216);font:bold 20px;color:black;border-radius:8;}" + "QPushButton:hover{border:2px solid red;}" + "QPushButton:pressed{border-width:3px 0 0 3px;border-style:inset;}" + "QPushButton:disabled{color:rgb(150,150,150);}"; + + int btn_ok = PvManager::button(p, w_main_, "确定", PvRect(w * 0.5 - 120 - 20, h - 60, 120, 40), style_btn_ok); + int btn_cancel = PvManager::button(p, w_main_, "取消", PvRect(w * 0.5 + 20, h - 60, 120, 40), style_btn_cannel); + PvInstance::bind_event(p, PvEvent::BUTTON_EVENT, btn_ok, [=](string e) + { + this->on_click_ok(); + if (cb_pop_) + { + cb_pop_(p, 1); + } + else + { + this->hide(); + } + }); + PvInstance::bind_event(p, PvEvent::BUTTON_EVENT, btn_cancel, [=](string e) + { + this->set_status(""); + this->hide(); + }); + + // 错误提示栏 + id_err_ = PvManager::label(p, w_main_, "", PvRect(50, h - 60 - 30, 700, 30), "background-color:rgba(50,50,50,30);color:red;font:bold 16px;"); + + // 默认不显示 + this->set_visible(false); + + w_param_ = make_shared(p, w_worksace_, PvRect(0, 0, w, h)); + w_param_->set_line_callback([=](shared_ptr line, string old_v, string v) + { + string id = line->get_id(); + data_.set(id, v); + if (cb_line_changed_) + { + cb_line_changed_(line); + } + }); +} + +void PvPop::set_data(DataFields& data) +{ + for (auto& it : data.fields()) + { + this->set_data(it.first, it.second); + } +}; + +void PvPop::set_data(string id, string v) +{ + data_.set(id, v); + if (w_param_) + { + w_param_->set_line_data(id, v); + } +} + +string PvPop::get_data(string k) +{ + return data_.get_str(k); +} + +DataFields& PvPop::get_data() +{ + return data_; +}; + +void PvPop::set_line_callback(function)> cb) +{ + cb_line_changed_ = cb; +} + +void PvPop::on_show() +{ +} + +void PvPop::on_hide() +{ + //w_param_->clear(); + this->do_cleanup(); +} + +void PvPop::do_cleanup() +{ +}; + +void PvPop::foreach_line(std::function cb) +{ + for (auto& item : data_.fields()) + { + if (cb) + { + cb(item.first, item.second); + } + } +} + +void PvPop::clear() +{ + data_.clear(); + w_param_->clear(); +} + +PvPopConfirm::PvPopConfirm(PARAM* p, int parent, string title, int w, int h) + : PvPop(p, parent, title, w, h) +{ + std::string style = "color:rgb(255,255,255);font:bold 20px;padding-left:10;"; + PvManager::label(p, w_worksace_, "是否确定操作?", PvRect(20, 30, w, 40), style); +} \ No newline at end of file diff --git a/src/pv/#/PvPop.h b/src/pv/#/PvPop.h new file mode 100644 index 0000000..71bd9f0 --- /dev/null +++ b/src/pv/#/PvPop.h @@ -0,0 +1,87 @@ +#pragma once + +#include +#include "DataFields.h" +#include "PvApp.h" + +struct PopLineInfo +{ + string title; // 控件名称标题 + string type; // 控件类型 + int pvid; // 值的控件ID + //PopLineInfo(string s, string t, int id) : title(s), type(t), pvid(id) {} +}; + +class PvPop : public PvObject +{ +public: + PvPop(PARAM* p, int parent, string title, int w = 900, int h = 700); + + void set_data(DataFields& data); + void set_data(string k, string v); + string get_data(string k); + DataFields& get_data(); + + void set_line_callback(function)> cb); + + void on_show() override; + void on_hide() override; + virtual void do_cleanup(); + + void foreach_line(std::function); + + void set_status(string status); + string status(); + + void update(PARAM* p); + + void set_pop_cb(std::function cb); + + void set_err(PARAM* p, string err); + string err(); + + void reset(PARAM* p); + + void set_enabled(string title, bool b); + virtual void on_click_ok(); + + void clear(); + +public: + static string POP_DEFAULT; + +protected: + shared_ptr w_param_; + + // 原始数据 + DataFields data_; + + function)> cb_line_changed_ = nullptr; + + int w_main_; + int w_worksace_; + int lab_title_; + int id_err_; + + int width_; + int height_; + PvRect rt_pop_; + + string title_; + string status_; + string err_; + + // 弹出窗口的行控件信息 + unordered_map map_w_; + + std::function cb_pop_ = nullptr; +}; + + +class PvPopConfirm : public PvPop +{ +public: + PvPopConfirm(PARAM* p, int parent, string title, int w = 900, int h = 700); + + int lab_text_ = PV_INVALID_ID; +}; \ No newline at end of file diff --git a/src/pv/MaskMain.cpp b/src/pv/MaskMain.cpp new file mode 100644 index 0000000..faa3185 --- /dev/null +++ b/src/pv/MaskMain.cpp @@ -0,0 +1,119 @@ +#include "MaskMain.h" +#include "pv/pages/MaskPageHome.h" +#include "pv/pages/MaskPageRunning.h" +#include "pv/pages/MaskPageForecast.h" +#include "pv/pages/MaskPageStat.h" +#include "pv/pages/MaskPageSysmgr.h" + +#include "common/DataFields.h" +#include +#include +#include +#include +std::string GetDateTimeWeekday() +{ + static std::vector wdaysStr = {"星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; + std::time_t now = std::time(nullptr); + std::tm tm = *std::localtime(&now); + std::stringstream ss; + ss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S ") << wdaysStr[tm.tm_wday]; + return ss.str(); +} + + + +int MaskMain::initUI() +{ + pvSetStyleSheet(p, PV_ID_MAIN, "color: white; font: normal 14px \"微软雅黑\";"); + ui.bkg = PvApp::pvid(p); + PvApp::image(p, 0, 0, 0, 1920, 1080, "bkg.png"); + + ui.datetime = PvApp::label(p, PV_ID_MAIN, 10, 30, 420, 30, GetDateTimeWeekday(), "font: bold 18px;"); + pvSetAlignment(p, ui.datetime, AlignCenter); + + int idStationTitle = PvApp::label(p, 0, 620, 0, 660, 90, "能源站监控与运行管理系统", "font:bold 48px \"Microsoft YaHei\"; color:white"); + pvSetAlignment(p, idStationTitle, AlignCenter); + + // 初始化子页面 + int menuActive = PV_ID_NUL; + switch (pvcode_) + { + case EPvCode::NUL: + case EPvCode::MASK_LOGIN: {} + case EPvCode::MASK_HOME: { maskPage_ = std::make_shared(p); } + break; + case EPvCode::MASK_RUNNING: { maskPage_ = std::make_shared(p); } + break; + case EPvCode::MASK_FORECAST_STORAGE: + case EPvCode::MASK_FORECAST_SOLAR: + case EPvCode::MASK_FORECAST_CHARGE: + case EPvCode::MASK_FORECAST: { maskPage_ = std::make_shared(p); } + break; + case EPvCode::MASK_STAT_STORAGE: + case EPvCode::MASK_STAT_SOLAR: + case EPvCode::MASK_STAT_CHARGE: + case EPvCode::MASK_STAT: { maskPage_ = std::make_shared(p); } + break; + case EPvCode::MASK_SYSMGR: + case EPvCode::MASK_MGR_USER: + case EPvCode::MASK_MGR_ROLE: + case EPvCode::MASK_MGR_PERMISSION: + case EPvCode::MASK_MGR_STATION: + case EPvCode::MASK_MGR_DEVICE: + case EPvCode::MASK_MGR_POLICY: + case EPvCode::MASK_MGR_SYSLOG: + case EPvCode::MASK_MGR_ALERTLOG: { maskPage_ = std::make_shared(p); } + break; + default: { maskPage_ = std::make_shared(p); } + break; + } + if (maskPage_) + { + maskPage_->initUI(pvcode_); + } + + std::vector vecMenuItems = {"系统总览", "运行监控", "预测管理", "统计分析", "系统管理"}; + { + int n = vecMenuItems.size(); + int y=980, w = 100, margin = 10, h=40; + int x0 = (1920 - (w*n + margin*(n-1))) * 0.5; + for (int i = 0; i MaskMain::createSubPage(int pvid) +{ + return nullptr; +} + +EPvCode MaskMain::onEventNull(int pvid) +{ + pvSetText(p, ui.datetime, GetDateTimeWeekday().c_str()); + return EPvCode::NUL; +} + +EPvCode MaskMain::onEventButton(int pvid) +{ + EPvCode pvcode = EPvCode::NUL; + auto iter = mapMenuInfo_.find(pvid); + if (iter != mapMenuInfo_.end()) + { + return iter->second.second; + } + else + { + if (maskPage_) + { + pvcode = maskPage_->onEventButton(pvid); + } + } + return pvcode; +} \ No newline at end of file diff --git a/src/pv/MaskMain.h b/src/pv/MaskMain.h new file mode 100644 index 0000000..f1a7df6 --- /dev/null +++ b/src/pv/MaskMain.h @@ -0,0 +1,34 @@ +#pragma once + +#include "pvapp.h" + +static const std::string STYLE_BKG = +"border-width:1 1 1 1px;" +"border-style:outset solid;" +"border-color:rgba(180,180,180,255);" +"background-color:rgba(80,80,80,80);"; + +class MaskMain : public PvMask +{ +public: + struct { + int bkg = PV_ID_NUL; + int widgetMenu = PV_ID_NUL; + int datetime = PV_ID_NUL; + } ui; + + std::map> mapMenuInfo_; + + EPvCode pvcode_; + std::shared_ptr maskPage_; + + MaskMain(PARAM* p, EPvCode pvcode) : PvMask(p), pvcode_(pvcode) {} + + int initUI(); + + std::shared_ptr createSubPage(int pvid); + + EPvCode onEventNull(int pvid) override; + EPvCode onEventButton(int pvid) override; + +}; \ No newline at end of file diff --git a/src/pv/PvApp.cpp b/src/pv/PvApp.cpp new file mode 100644 index 0000000..47cf6d9 --- /dev/null +++ b/src/pv/PvApp.cpp @@ -0,0 +1,226 @@ +#include "PvApp.h" +#include "PvUser.h" +#include "TimeUtils.h" + + +#define FONT_NAME "微软雅黑" + +void PvApp::setPvUser(PARAM* p, PvUser* pvuser) +{ + p->user = pvuser; +} + +PvUser* PvApp::getPvUser(PARAM* p) +{ + return static_cast(p->user); +} + +int PvApp::pvid(PARAM* p) +{ + auto pvuser = PvApp::getPvUser(p); + return (++pvuser->pvidIndex); +} + +void PvApp::reset(PARAM* p) +{ + // 清理event回调 + auto pvuser = PvApp::getPvUser(p); + pvuser->mapEventCallback.clear(); + pvuser->pvidIndex = 0; +} + +EPvCode PvApp::getPvCode(std::string name) +{ + static std::map mapPvCode = + { + {"系统总览", EPvCode::MASK_HOME}, + {"运行监控", EPvCode::MASK_RUNNING}, + {"预测管理", EPvCode::MASK_FORECAST}, + {"储能充放电预测", EPvCode::MASK_FORECAST_STORAGE}, + {"光伏发电预测", EPvCode::MASK_FORECAST_SOLAR}, + {"充电负荷预测", EPvCode::MASK_FORECAST_CHARGE}, + {"统计分析", EPvCode::MASK_STAT}, + {"储能设备运行分析", EPvCode::MASK_STAT_STORAGE}, + {"光伏设备运行分析", EPvCode::MASK_STAT_SOLAR}, + {"充电设备运行分析", EPvCode::MASK_STAT_CHARGE}, + {"系统管理", EPvCode::MASK_SYSMGR}, + {"用户管理", EPvCode::MASK_MGR_USER}, + {"角色管理", EPvCode::MASK_MGR_ROLE}, + {"权限管理", EPvCode::MASK_MGR_PERMISSION}, + {"场站管理", EPvCode::MASK_MGR_STATION}, + {"设备管理", EPvCode::MASK_MGR_DEVICE}, + {"策略管理", EPvCode::MASK_MGR_POLICY}, + {"系统日志", EPvCode::MASK_MGR_SYSLOG}, + {"告警日志", EPvCode::MASK_MGR_ALERTLOG}, + }; + auto iter = mapPvCode.find(name); + if (iter != mapPvCode.end()) + { + return iter->second; + } + else + { + return EPvCode::NUL; + } +} + + +void PvApp::bind(PARAM* p, PvEvent eid, int pvid, std::function cb) +{ + auto pvuser = PvApp::getPvUser(p); + if (pvuser) + { + std::string event = std::to_string((int)eid) + ":" + std::to_string((int)pvid); + pvuser->mapEventCallback[event] = cb; + } +} + +void PvApp::dispatch(PARAM* p, PvEvent eid, int pvid, std::string text) +{ + auto pvuser = PvApp::getPvUser(p); + if (pvuser) + { + std::string event = std::to_string((int)eid) + ":" + std::to_string((int)pvid); + auto iter = pvuser->mapEventCallback.find(event); + if (iter != pvuser->mapEventCallback.end()) + { + (iter->second)(text); + } + } +} + +int PvApp::widget(PARAM* p, int parent, int x, int y, int w, int h) +{ + int id = PvApp::pvid(p); + pvQWidget(p, id, parent); + pvSetGeometry(p, id, x, y, w, h); + return id; +} + +int PvApp::label(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss) +{ + int id = PvApp::pvid(p); + pvQLabel(p, id, parent); + pvSetGeometry(p, id, x, y, w, h); + pvSetFont(p, id, FONT_NAME, 14, 1, 0, 0, 0); + pvSetFontColor(p, id, 255, 255, 255); + if (!text.empty()) { pvSetText(p, id, text.c_str()); } + if (!qss.empty()) { pvSetStyleSheet(p, id, qss.c_str()); } + return id; +} +int PvApp::labelAlignCenter(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss) +{ + int id = PvApp::label(p, parent, x, y, w, h, text, qss); + pvSetAlignment(p, id, AlignCenter); + return id; +} + +int PvApp::button(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss) +{ + int id = PvApp::pvid(p); + pvQPushButton(p, id, parent); + pvSetGeometry(p, id, x, y, w, h); + pvSetFont(p, id, FONT_NAME, 14, 1, 0, 0, 0); + pvSetFontColor(p, id, 255, 255, 255); + if (!text.empty()) { pvSetText(p, id, text.c_str()); } + if (!qss.empty()) { pvSetStyleSheet(p, id, qss.c_str()); } + return id; +} + +int PvApp::image(PARAM* p, int parent, int x, int y, int w, int h, const char* filename) +{ + int id = PvApp::pvid(p); + pvQImage(p, id, parent, filename); + pvSetGeometry(p, id, x, y, w, h); + //if (!qss.empty()) { pvSetStyleSheet(p, id, qss.c_str()); } + return id; +} + +int PvApp::combox(PARAM* p, int parent, int x, int y, int w, int h, const std::vector& vecItems) +{ + int id = PvApp::pvid(p); + pvQComboBox(p, id, parent, 0, 0); + pvSetGeometry(p, id, x, y, w, h); + pvSetStyleSheet(p, id, QSS_COMBOX_14.c_str()); + for (int i=0; i +#include +#include +#include +#include + +#include "PvStyle.h" +#include "common/Logger.h" + +// 主窗口的 id 是 0,其它创建的控件都是主窗口的子控件,在创建子控件时,id 从 1 开始累加 +#define PV_ID_MAIN 0 +#define PV_ID_NUL -999 + +enum class EPvMaskID +{ + NUL = 0, + LOGIN, + HOME, + Running, + SysManage, + Statistics, +}; + +enum class EPvCode +{ + NUL = 0, + MASK_LOGIN, + MASK_HOME, + MASK_RUNNING, + MASK_FORECAST, + MASK_FORECAST_STORAGE, + MASK_FORECAST_SOLAR, + MASK_FORECAST_CHARGE, + MASK_STAT, + MASK_STAT_STORAGE, + MASK_STAT_SOLAR, + MASK_STAT_CHARGE, + MASK_SYSMGR, + MASK_MGR_USER, + MASK_MGR_ROLE, + MASK_MGR_PERMISSION, + MASK_MGR_STATION, + MASK_MGR_DEVICE, + MASK_MGR_POLICY, + MASK_MGR_SYSLOG, + MASK_MGR_ALERTLOG, +}; + +class PvObject +{ +public: + PARAM* p = NULL; + int pvid = PV_ID_NUL; + PvObject(PARAM* p) : p(p) {} + void show(bool v) { if (p && pvid != PV_ID_NUL) { v ? pvShow(p, pvid) : pvHide(p, pvid); } } + virtual EPvCode onEventNull(int pvid) { return EPvCode::NUL; } + virtual EPvCode onEventButton(int pvid) { return EPvCode::NUL; } + virtual EPvCode onEventText() { return EPvCode::NUL; } +}; + +class PvMask : public PvObject +{ +public: + PvMask(PARAM* p) : PvObject(p) {}; + + virtual int initUI(EPvCode pvcode) { return 0; }; +}; + +class PvUser; + +class PvApp +{ +public: + static void setPvUser(PARAM* p, PvUser* pvuser); + static PvUser* getPvUser(PARAM* p); + + static int pvid(PARAM* p); + static void reset(PARAM* p); + + static EPvCode getPvCode(std::string name); + + static void bind(PARAM* p, PvEvent eid, int pvid, std::function cb); + static void dispatch(PARAM* p, PvEvent eid, int pvid, std::string text); + + static int widget(PARAM* p, int parent, int x, int y, int w, int h); + + static int label(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss = ""); + + static int labelAlignCenter(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss = ""); + + static int button(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss = ""); + + static int image(PARAM* p, int parent, int x, int y, int w, int h, const char* filename); + + static int combox(PARAM* p, int parent, int x, int y, int w, int h, const std::vector& vecItems); + + static int lineEdit(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss = ""); +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// === PvRect +class PvRect +{ +public: + PvRect(); + + PvRect(int ix, int iy, int width, int height); + + PvRect& set(int ix, int iy, int width, int height); + + PvRect& set_x(int ix); + PvRect& set_y(int iy); + PvRect& set_w(int iw); + PvRect& set_h(int ih); + + PvRect& shift_x(int ix); + PvRect& shift_y(int iy); + PvRect& shift_w(int iw); + PvRect& shift_h(int ih); + +public: + int x = 0; + int y = 0; + int w = 100; + int h = 32; +}; + +struct PvColor +{ + int r; + int g; + int b; + int a; + + PvColor(int r, int g, int b, int a = 255) : r(r), g(g), b(b), a(a) {} + std::string rgb() + { + return "rgb(" + std::to_string(r) + "," + std::to_string(g) + "," + std::to_string(b) + ")"; + } + std::string rgba() + { + return "rgb(" + std::to_string(r) + "," + std::to_string(g) + "," + std::to_string(b) + "," + std::to_string(a) + ")"; + } +}; diff --git a/src/pv/PvChart.cpp b/src/pv/PvChart.cpp new file mode 100644 index 0000000..628fa3d --- /dev/null +++ b/src/pv/PvChart.cpp @@ -0,0 +1,409 @@ +#include "PvChart.h" +#include "TimeUtils.h" + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// === PvChartBar + +PvChartBar::PvChartBar(PARAM* p, int parentId, int x, int y, int w, int h) + : PvObject(p) +{ + pvid_ = PvApp::label(p, parentId, x, y, w, h, "", "border: none; border-radius: 0px; background-color: transparent; color:white; font: normal 12px;"); + + boxBar_.x = 40; + boxBar_.y = 56; + boxBar_.w = w - boxBar_.x * 2; + boxBar_.h = h - boxBar_.y - 38; + boxBar_.id = PvApp::label(p, pvid_, boxBar_.x, boxBar_.y, boxBar_.w+1, boxBar_.h+1, "", "border: none; background-color: transparent;"); + + + int hMargin = 5; + { + // 左侧X轴 + yAxisLeft_.widget = PvApp::label(p, pvid_, 0, 0, boxBar_.x, h, "", ""); + PvApp::label(p, yAxisLeft_.widget, boxBar_.x-1, boxBar_.y, 1, boxBar_.h, "", "border: 1px solid white;"); + } + { + yAxisRight_.widget = PvApp::label(p, pvid_, boxBar_.x + boxBar_.w, 0, boxBar_.x, h, "", ""); + PvApp::label(p, yAxisRight_.widget, 0, boxBar_.y, 1, boxBar_.h, "", "border: 1px solid white;"); + } + + yLabelLeft_ = PvApp::label(p, pvid_, 0, 0, boxBar_.x*2, boxBar_.y-10, "", "font: bold 14px; color: white;"); + pvSetAlignment(p, yLabelLeft_, AlignHCenter | AlignBottom); + yLabelRight_ = PvApp::label(p, pvid_, boxBar_.w, 0, boxBar_.x*2, boxBar_.y-5, "", "font: bold 14px; color: white;"); + pvSetAlignment(p, yLabelRight_, AlignHCenter | AlignBottom); + + // Y轴分成5段 + setTickX(7); + setTickY(5); +} + +void PvChartBar::setTickX(int n) +{ + vecTickX_.resize(n); + // 每一段的长度: + int len = int(float(boxBar_.w)/float(n)); + int y = boxBar_.y + boxBar_.h; + // X轴分成 n 段,共有 n 条刻度线 + for (int i = 0; i vecSeriesColor = +{ + "rgb(84, 112, 198);", "rgb(169, 223, 150);", "rgb(246, 220, 125);", "rgb(84, 112, 198);", "rgb(169, 223, 150);", "rgb(246, 220, 125);" +}; + +void PvChartBar::insertItem(std::string text) +{ + int index = vecItems_.size(); + int nItem = index+1; + + // 根据 X 轴的分段数量创建 bar + int n = vecTickX_.size(); + // 每一段的绘制区域的长度,左右保留间距 5px, 计算每一个柱体的宽度 + int wBar = (int(float(boxBar_.w)/float(n)) - margin) / nItem; + + // 如果不是第一个序列项,需要重新计算前面序列的宽度 + for (int i = 0; i> vd) +{ + int nItems = vecItems_.size(); + if (index >= nItems) + { + return; + } + + double vmax = yLeftMax; + // 计算Y轴的范围, 获取数据中的最大值 (先不考虑最小值,最小值使用0) + for (int i = 0; i vmax) { vmax = val; } + } + setRangeY(0, vmax); + + // 计算和重绘 bar + // Y轴差值 + double delta = double(yLeftMax - yLeftMin); + auto& bar = vecItems_[index].bar_; + + // 根据 X 轴的分段数量创建 bar + int n = vecTickX_.size(); + // 每一段的绘制区域的长度,左右保留间距 5px, 计算每一个柱体的宽度 + int wBar = (int(float(boxBar_.w)/float(n)) - margin) / vecItems_.size(); + + for (int pos = 0; posmark(p, 0, 10, 100); + //this->mark(p, 1, 11, 100); + + yLabelLeft = PvApp::label(p, pvid_, 10, 24, 100, 20, "", "border:none;color:white;font-size:14px;font-weight:bold;"); + pvSetAlignment(p, yLabelLeft, AlignLeft); + yLabelRight = PvApp::label(p, pvid_, rect_.w - 100 - 10, 24, 100, 20, "", "border:none;color:white;font-size:14px;font-weight:bold;"); + pvSetAlignment(p, yLabelRight, AlignRight); +} + +void PvChartCurve::setBackground(PARAM* p, int r, int g, int b) +{ + qpwSetCanvasBackground(p, plotId_, r, g, b); + std::string qss = "border: none; border-radius: 0px; background-color: " + PvColor(r, g, b).rgb() + ";"; + pvSetStyleSheet(p, pvid_, qss.c_str()); +} + +void PvChartCurve::setLabelYLeft(std::string title, float min, float max, float step) +{ + yLeftMin_ = min; + yLeftMax_ = max; + yLeftStep_ = step; + qpwSetAxisScale(p, plotId_, yLeft, min, max, step); + qpwEnableAxis(p, plotId_, yLeft); + //qpwSetAxisTitle(p, id_, yLeft, "Y轴说明"); + pvSetText(p, yLabelLeft, title.c_str()); +} + +void PvChartCurve::setLabelYRight(std::string title, float min, float max, float step) +{ + yRightMin_ = min; + yRightMax_ = max; + yRightStep_ = step; + qpwSetAxisScale(p, plotId_, yRight, min, max, step); + qpwEnableAxis(p, plotId_, yRight); + //qpwSetAxisTitle(p, id_, yRight, "Y轴说明"); + + pvSetText(p, yLabelRight, title.c_str()); +} + +void PvChartCurve::setXBottom(float min, float max, float step) +{ + qpwSetAxisScale(p, plotId_, xBottom, min, max, step); + qpwReplot(p, plotId_); +} +void PvChartCurve::setXBottomFormat(std::string fmt) +{ + // 设置时间轴 "yyyy-MM-dd hh:mm:ss" + qpwSetAxisScaleDraw(p, plotId_, xBottom, fmt.c_str()); +} + +static std::vector g_mapSeriesColor = +{ + PvColor(84, 112, 198), PvColor(169, 223, 150), PvColor(246, 220, 125), PvColor(84, 112, 198), PvColor(169, 223, 150), PvColor(246, 220, 125) +}; + +int PvChartCurve::insertItem(int pos, std::string name, int x, int y, int w) +{ + int index = vecItems_.size(); + + auto& color = g_mapSeriesColor[index]; + PvApp::label(p, pvid_, x, y + 3, 14, 14, "", "background-color:" + color.rgb() + ";border-radius:7px;"); + PvApp::label(p, pvid_, x + 16, y, w - 16, 18, name, "color:white;font:normal 12px;border:0px solid #ff0000;"); + + // 添加数据曲线 + qpwInsertCurve(p, plotId_, index, name.c_str()); + // 设置曲线颜色和类型 // NoPen,SolidLine,DashLine,DotLine,DashDotLine,DashDotDotLine,MPenStyle = 0x0f + qpwSetCurvePen(p, plotId_, index, color.r, color.g, color.b, 2, SolidLine); + //qpwSetCurveSymbol(p_, plot_id_, index, MarkerNone, col.r, col.g, col.b, WHITE, 4, 4); + + // 设置数据对应的Y轴(LEFT或RIGHT) + qpwSetCurveYAxis(p, plotId_, index, (pos == 0) ? yLeft : yRight); + + CurveItem item; + item.name = name; + item.pos = pos; + vecItems_.push_back(item); + return index; +} + +void PvChartCurve::updateItem(int index, const std::vector>& data) +{ + if (index >= vecItems_.size()) + { + return; + } + auto& item = vecItems_[index]; + + int64_t tCurrent = TimeUtils::now(); + int yMax = 0; + int size = (int)data.size(); + std::vector vx(size, 0); + std::vector vy(size, 0); + for (size_t i = 0; i < size; ++i) + { + vx[i] = data[i].first; + vy[i] = data[i].second; + if (yMax < data[i].second) { yMax = data[i].second; } + } + this->reviseYMax(item.pos, yMax); + qpwSetCurveData(p, plotId_, index, size, &vx[0], &vy[0]); + qpwReplot(p, plotId_); +} + + +int64_t PvChartCurve::set_range_x_days(int n) +{ + this->setXBottomFormat("MM/dd"); + int step = 3600 * 24; + auto t_end = TimeUtils::datetime2ts(TimeUtils::now_date() + " 08:00:00"); + auto t_start = t_end - step * (n - 1); + this->setXBottom(t_start, t_end, step); + return t_start; +} + +int64_t PvChartCurve::set_range_x_day_by_hour(int n) +{ + this->setXBottomFormat("hh:mm"); + auto t_start = TimeUtils::datetime2ts(TimeUtils::now_date() + " 00:00:00"); + auto t_end = t_start + 86400; + this->setXBottom(t_start, t_end, 86400 / n); + return t_start; +} + + +void PvChartCurve::reviseYMax(int pos, double v) +{ + bool isLeft = (pos == 0); + + int min = (isLeft ? yLeftMin_ : yRightMin_); + int max = (isLeft ? yLeftMax_ : yRightMax_); + int step = (isLeft ? yLeftStep_ : yRightStep_); + + while (v > max) + { + max += (max-min); + step *= 2; + } + qpwSetAxisScale(p, plotId_, yLeft, min, max, step); + qpwSetAxisScale(p, plotId_, yRight, min, max, step); +} + +void PvChartCurve::update_days_test(int n) +{ + int step = 3600*24/n; + auto t_start = TimeUtils::datetime2ts(TimeUtils::now_date() + " 00:00:00"); + auto t_end = t_start+3600*24; + + std::vector> vd(n); + double v = 100; + for (int index = 0; index < vecItems_.size(); ++index) + { + for (int i = 0; i < n; ++i) + { + vd[i].first = static_cast(t_start + i * step); + vd[i].second = v += 2;// (v += (Utils::random(0, 10)-5)); + }; + this->updateItem(index, vd); + } + +} + +void PvChartCurve::mark(PARAM* p, int index, float x, float y, std::string text) +{ + qpwInsertMarker(p, plotId_, 0); + qpwSetMarkerPos(p, plotId_, index, x, y); + //MarkerNone,MarkerEllipse,MarkerRect,MarkerDiamond,MarkerTriangle,MarkerDTriangle,MarkerUTriangle,MarkerLTriangle,MarkerRTriangle,MarkerCross,MarkerXCross,MarkerStyleCnt + qpwSetMarkerSymbol(p, plotId_, 0, MarkerEllipse, RED, GREEN, 10, 10); + qpwSetMarkerFont(p, plotId_, 0, "微软雅黑", 14, 1); + qpwSetMarkerLabel(p, plotId_, 0, text.c_str()); +} diff --git a/src/pv/PvChart.h b/src/pv/PvChart.h new file mode 100644 index 0000000..f09fbce --- /dev/null +++ b/src/pv/PvChart.h @@ -0,0 +1,119 @@ +#include "PvApp.h" + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// === PvChartBar +class PvChartBar : public PvObject +{ +public: + static std::shared_ptr create(PARAM* p, int parentId, int x, int y, int w, int h) + { + return std::make_shared(p, parentId, x, y, w, h); + } + + PvChartBar(PARAM* p, int parentId, int x, int y, int w, int h); + + void setTickX(int n); + void setTickY(int n); + + void insertItem(std::string text); + void updateItem(int index, std::vector> vd); + + void setRangeY(double vmin, double vmax); + void setLabelYLeft(std::string name); + void setLabelYRight(std::string name); + + int pvid_; + + struct { + int x; + int y; + int w; + int h; + int id; + } boxBar_; + + struct AxisTick { + int widget = PV_ID_NUL; + std::vector vecTick_; + }; + + AxisTick yAxisLeft_; + AxisTick yAxisRight_; + AxisTick xAxis_; + + int yLabelLeft_ = PV_ID_NUL; + int yLabelRight_ = PV_ID_NUL; + + std::vector vecTickX_; + + struct BarItem { + std::string name; + int idItem; + std::vector bar_; + }; + + std::vector vecItems_; + int itemLabelPos = 100; + + + int yLeftMin = 0; + int yLeftMax = 0; + int yMinRight = 0; + int yMaxRight = 0; + + // 绘制区域的间距、柱体的间距 + int margin = 5; +}; + +//**************************************************************************************************** +// 曲线图 +// +class PvChartCurve : public PvObject +{ +public: + PvChartCurve(PARAM* p, int parent, int x, int y, int w, int h); + + void setBackground(PARAM* p, int r, int g, int b); + + void setLabelYLeft(std::string name, float min = 0, float max = 100, float step = 20); + void setLabelYRight(std::string name, float min = 0, float max = 100, float step = 20); + + void setXBottom(float min, float max, float step); + void setXBottomFormat(std::string fmt); + + int insertItem(int pos, std::string name, int x, int y, int w); + void updateItem(int index, const std::vector>& data); + + int64_t set_range_x_days(int n); + int64_t set_range_x_day_by_hour(int n); + + void update_days_test(int n); + void mark(PARAM* p, int index, float x, float y, std::string text); + void reviseYMax(int pos, double v); + +private: + PvRect rect_; + int pvid_; + int plotId_; + int start_num_ = 0; + + int labTimeLine_; + std::vector> vecTimeAxisId_; + + struct CurveItem + { + std::string name; + int pos; + }; + std::vector vecItems_; + + int yLabelLeft = PV_ID_NUL; + int yLabelRight = PV_ID_NUL; + + int yLeftMin_ = 0; + int yLeftMax_ = 0; + int yLeftStep_ = 0; + int yRightMin_ = 0; + int yRightMax_ = 0; + int yRightStep_ = 0; +}; \ No newline at end of file diff --git a/src/pv/PvPopWidget.cpp b/src/pv/PvPopWidget.cpp new file mode 100644 index 0000000..b00d6f4 --- /dev/null +++ b/src/pv/PvPopWidget.cpp @@ -0,0 +1,113 @@ +#include "PvPopWidget.h" + +PvPopWidget::PvPopWidget(PARAM* p, int width, int height) : PvObject(p), width(width), height(height) +{ + pvid = PvApp::widget(p, PV_ID_MAIN, 0, 0, 1920, 1080); + PvApp::label(p, pvid, 0, 0, 1920, 1080, "", "background-color: rgba(30,30,30,180);"); + + int x = (1920-width) *0.5; + int y = (1080-height) *0.5; + ui.widget = PvApp::widget(p, pvid, x, y, width, height); + PvApp::label(p, ui.widget, 2, 2, width-4, height-4, "", "background-color: rgb(12,39,58); border: 1px solid rgb(31,145,156);"); + PvApp::label(p, ui.widget, 0, 0, 60, height, "", "background-color: transparent; border: 0 solid rgb(42, 149, 245); border-width: 5px 0 5px 5px;"); + PvApp::label(p, ui.widget, width-60, 0, 60, height, "", "background-color: transparent; border: 0 solid rgb(42, 149, 245); border-width: 5px 5px 5px 0;"); + + ui.title = PvApp::label(p, ui.widget, 20, 10, width-20, 30, "", "font: bold 20px;"); + PvApp::label(p, ui.widget, 20, 40, width*0.5-20, 3, "", QSS_UNDERLINE); + { + int w = 100, h = 40, offset = 50; + int x = (width- w*2 - offset) *0.5; + int y = height - h - 40; + + int btnOk = PvApp::button(p, ui.widget, x, y, w, h, "确定", QSS_BTN_CONFIRM); + PvApp::bind(p, PvEvent::BUTTON_EVENT, btnOk, [=](std::string) { + this->show(false); + if (callbackConfirm) { callbackConfirm(); } + }); + int btnCancel = PvApp::button(p, ui.widget, x+w+offset, y, w, h, "取消", QSS_BTN_CANCEL); + PvApp::bind(p, PvEvent::BUTTON_EVENT, btnCancel, [=](std::string) { + this->show(false); + }); + } +} + +void PvPopWidget::addParamLineEdit(std::string key, std::string title, int x, int y, bool editable/*= true*/) +{ + auto line = std::make_shared("lineEdit", key); + PvApp::label(p, ui.widget, x, y, lineKeyWidth, lineHeight, title, "font: bold 14px;"); + line->widget = PvApp::lineEdit(p, ui.widget, x+lineKeyWidth, y, lineValWidth, lineHeight, ""); + if (!editable) { pvSetEnabled(p, line->widget, 0); } + mapLines[key] = line; + PvApp::bind(p, PvEvent::TEXT_EVENT, line->widget, [=](std::string text) { + line->val = text; + }); +} + +void PvPopWidget::addParamCombox(std::string key, std::string title, int x, int y, std::vector items) +{ + auto line = std::make_shared("combox", key); + PvApp::label(p, ui.widget, x, y, lineKeyWidth, lineHeight, title, "font: bold 14px;"); + line->widget = PvApp::combox(p, ui.widget, x+lineKeyWidth, y, lineValWidth, lineHeight, items); + mapLines[key] = line; + PvApp::bind(p, PvEvent::TEXT_EVENT, line->widget, [=](std::string text) { + line->val = text; + }); +} + +void PvPopWidget::setParamText(std::shared_ptr line, std::string text) +{ + if (line->type == "lineEdit") + { + pvSetText(p, line->widget, text.c_str()); + } + else if (line->type == "combox") + { + int index = 0; + for (int i = 0; iitems.size(); ++i) + { + if (line->items[i] == text) { index = i; break; } + } + pvSetCurrentItem(p, line->widget, index); + } +} + +void PvPopWidget::setParamText(std::string key, std::string text) +{ + auto iter = mapLines.find(key); + if (iter != mapLines.end()) + { + this->setParamText(iter->second, text); + } +} + +void PvPopWidget::setTitle(std::string title) +{ + pvSetText(p, ui.title, title.c_str()); +} + +void PvPopWidget::setData(DataFields fields) +{ + for (auto iter = mapLines.begin(); iter != mapLines.end(); ++iter) + { + auto& line = iter->second; + this->setParamText(line, fields.getStr(line->key)); + } +} + +DataFields PvPopWidget::getData() +{ + DataFields fields; + for (auto iter = mapLines.begin(); iter!=mapLines.end(); ++iter) + { + auto& line = iter->second; + fields.set(line->key, line->val); + } + return fields; +} + +void PvPopWidget::setLineGeometry(int wKey, int wVal, int h) +{ + lineKeyWidth = wKey; + lineValWidth = wVal; + lineHeight = h; +} \ No newline at end of file diff --git a/src/pv/PvPopWidget.h b/src/pv/PvPopWidget.h new file mode 100644 index 0000000..2343389 --- /dev/null +++ b/src/pv/PvPopWidget.h @@ -0,0 +1,53 @@ +#pragma once + +#include "PvApp.h" +#include "DataFields.h" + +class PvPopWidget : public PvObject +{ +public: + struct ParamLine + { + std::string key; + std::string type; + std::string val; + int widget; + std::vector items; + ParamLine(std::string type, std::string key) : type(type), key(key) {} + }; + + PvPopWidget(PARAM* p, int width, int height); + + void addParamLineEdit(std::string key, std::string title, int x, int y, bool editable=true); + + void addParamCombox(std::string key, std::string title, int x, int y, std::vector items); + + void setParamText(std::shared_ptr line, std::string text); + void setParamText(std::string key, std::string text); + + void setCallbackConfirm(std::function callback) { callbackConfirm = callback; }; + + void setTitle(std::string title); + + void setData(DataFields fields); + DataFields getData(); + + void setLineGeometry(int wKey, int wVal, int h); + + int width {800}; + int height {600}; + + int lineKeyWidth {70}; + int lineValWidth {180}; + int lineHeight {30}; + + struct { + int widget; + int title; + } ui; + + std::map> mapLines; + DataFields data; + + std::function callbackConfirm = nullptr; +}; \ No newline at end of file diff --git a/src/pv/PvStyle.h b/src/pv/PvStyle.h new file mode 100644 index 0000000..1416663 --- /dev/null +++ b/src/pv/PvStyle.h @@ -0,0 +1,136 @@ +#pragma once +#include + +static std::string QSS_BTN_CONFIRM = +"QPushButton { background-color:rgb(28, 145, 138); border-radius:10px; border: none; color:white; font:bold 18px \"Microsoft YaHei\";}" +"QPushButton:hover { background-color:rgb(10,125,215);border:2px solid rgb(1,239,255);color:rgb(1,239,255)}" +"QPushButton:pressed { border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_BTN_CANCEL = +"QPushButton { background-color:rgb(200, 200, 200);border-radius:10px;border:0px solid rgb(10,120,215);color:white;font:bold 18px \"Microsoft YaHei\";}" +"QPushButton:hover { background-color:rgb(10,125,215);border:2px solid rgb(1,239,255);color:rgb(1,239,255)}" +"QPushButton:pressed { border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_COMBOX = +"QComboBox {border: 1px solid rgb(18, 251, 255); background-color: rgb(5, 47, 77); border-radius: 5px; color:white; font: bold 16px;}" +"QComboBox QAbstractItemView { border: 1px solid gray; background-color: rgba(8, 54, 91); border-radius: 5px;}" +"QComboBox::drop-down { border-radius: 5px; width: 30px; }" +"QComboBox:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_COMBOX_14 = +"QComboBox {border: 1px solid rgb(18, 251, 255); background-color: rgb(5, 47, 77); border-radius: 5px; color:white; font: bold 14px;}" +"QComboBox QAbstractItemView { border: 1px solid gray; background-color: rgba(8, 54, 91); border-radius: 5px;}" +"QComboBox::drop-down { border-radius: 5px; width: 30px; }" +"QComboBox:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_LINEEDIT = +"QLineEdit { background-color: rgb(12, 39, 58); border: 1px solid rgb(18, 251, 255); border-radius: 5px; color:white; font: bold 14px;}" +"QLineEdit:disabled { border: 1px solid gray; color:rgb(150,150,150);}"; + +static std::string STYLE_BTN = +"QPushButton { background-color:rgb(4, 96, 142);border-radius:10px;border:0px solid rgb(10,120,215);color:white;font:bold 18px \"Microsoft YaHei\";}" +"QPushButton:hover { background-color:rgb(10,125,215);border:2px solid rgb(1,239,255);color:rgb(1,239,255)}" +"QPushButton:pressed { border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled { color:rgb(150,150,150);}"; + +static std::string STYLE_BTN_ACTIVE = +"QPushButton { background-color:rgb(4, 96, 142);border-radius:10px;border:2px solid rgb(1,239,255);color:rgb(1,239,255);font:bold 18px \"Microsoft YaHei\";}" +"QPushButton:hover { background-color:rgb(10,125,215);border:2px solid rgb(1,239,255);color:rgb(1,239,255)}" +"QPushButton:pressed { border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_LABEL_BKG_1 = +"QLabel { background-color:rgb(5, 47, 77); border:none; border-radius:5px; }" +"QLabel:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_LABEL_BKG_2 = +"QLabel { background-color:rgb(8, 54, 91); border:none; border-radius:5px; }" +"QLabel:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_BOX = +"QLabel { background-color:rgba(200,200,200,20); border:0px solid;border-color:rgb(5,255,255);border-radius:2px;font:bold 16px;color:white; }" +"QLabel:hover {border: 1px solid rgb(1, 183, 209);}" +"QLabel:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_BOX_ACTIVE = +"QLabel { background-color:rgb(7, 72, 111); border:2px solid;border-color:rgb(1, 183, 209); border-radius:2px;font:bold 16px;color:white; }" +"QLabel:hover {border: 1px solid rgb(1, 183, 209);}" +"QLabel:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_TITLE = +"QLabel { background:transparent; color: rgb(99, 196, 216); font: bold 16px; border: none; padding-top: 0px;}" +"QLabel:disabled { color:rgb(150,150,150);}"; + +static std::string STYLE_TITLE_ICON = +"padding-top: 0px;" +"background-color: qlineargradient(x1:0, y1:1, x2:0, y2:0, stop:0 rgba(0, 71, 105, 255),stop:1 rgba(0, 71, 105, 0));" +"border-radius: 0px; color:white; font: bold 16px; border-left: 8px solid rgba(33,255,210);"; + +static std::string QSS_UNDERLINE = +"background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,stop:0 rgba(9,194,207,200),stop:1 rgba(9,194,207,0));"; + +const std::string QSS_BTN_MGR = +"QPushButton { background-color:rgb(10, 34, 63); border-radius:5px; border:1px solid rgb(33, 105, 195); color:white; font:bold 18px \"Microsoft YaHei\";}" +"QPushButton:hover { background-color:rgb(10,125,215); border:2px solid rgb(1,239,255); color:rgb(1,239,255)}" +//"QPushButton:pressed{border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:pressed { border-width:3px 0 0 3px;border-style:inset; }" +"QPushButton:disabled{color:rgb(150,150,150);}"; + +const std::string QSS_BTN_MGR_ACTIVE = +"QPushButton { background-color:rgb(33, 105, 195);border-radius:5px; border:1px solid rgb(68, 167, 252);color:white;font:bold 18px \"Microsoft YaHei\"; }" +"QPushButton:hover { background-color:rgb(10,125,215); border:2px solid rgb(1,239,255); color:rgb(1,239,255)}" +"QPushButton:pressed { border-width:3px 0 0 3px;border-style:inset; }" +"QPushButton:disabled { color:rgb(150,150,150); }"; + +//"background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 transparent, stop:%1 red, stop:1 blue);" + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// === 表格 +static const std::string QSS_TABLE = +"border: 1px solid rgb(28, 121, 122); background-color:rgb(7, 46, 74);"; + +// 表头 +static const std::string QSS_TABLE_HEAD = +"background-color: rgb(18, 93, 113); color:rgb(255, 255, 255); font:bold 16px;" +"border-width:1 1 1 1px; border-style:inset solid; border-color:rgb(120, 120, 120);"; + +// 单元格 +static const std::string QSS_TABLE_CELL = +"background-color:transparent; color:rgb(255,255,255); font:bold 15px;padding-left:1;" +"border-width:0 0 0 0px; border-style:inset solid; border-color:rgba(180,180,180,200);"; + +static const std::string QSS_TABLE_BTN_VIEW = +"QPushButton { background-color: rgb(28, 145, 138); color:white; border-radius:2px; border:none; font:bold 14px;}" +"QPushButton:hover { border: 1px solid white;}" +"QPushButton:pressed { border-width:3px 0 0 3px;border-style:inset;}" +"QPushButton:disabled { color:rgb(150,150,150);}"; + +const std::string BTN_NEW = // 78, 149, 143 +"QPushButton{background-color:rgb(38,233,233);color:white;border-radius:5px;border:2px solid rgb(10,120,215);font:bold 18px;}" +"QPushButton:hover{background-color:rgb(10,125,215);}" +"QPushButton:pressed{border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled{color:rgb(150,150,150);}"; + +const std::string BTN_EDIT = +"QPushButton{background-color:rgb(248,147,45);color:white;border-radius:5px;border:2px solid rgb(10,120,215);font:bold 15px;}" +"QPushButton:hover{background-color:rgb(10,125,215);}" +"QPushButton:pressed{border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled{color:rgb(150,150,150);}"; + +const std::string BTN_DELETE = +"QPushButton{background-color:rgb(252,83,83);color:white;border-radius:5px;border:2px solid rgb(10,120,215);font:bold 15px;}" +"QPushButton:hover{background-color:rgb(10,125,215);}" +"QPushButton:pressed{border-width:3px 0 0 3px;background-color:rgb(150,150,150);border-style:inset;}" +"QPushButton:disabled{color:rgb(150,150,150);}"; + +// 表格行的斑马色0 +static const std::string QSS_TABLE_ROW_0 = +"background-color:rgb(7, 46, 74); border-width:0 0 1 0px; border-style:inset solid; border-color:rgba(120,120,120, 100);"; +// 表格行的斑马色1 +static const std::string QSS_TABLE_ROW_1 = +"background-color:rgb(7, 46, 74); border-width:0 0 1 0px; border-style:inset solid; border-color:rgba(120,120,120, 100);"; +// 表格行的高亮显示 +static const std::string QSS_TABLE_ROW_HIGHLIGHT = +"background-color:rgba(14,45,60,200);border:1px solid rgba(255,0,0,100);"; \ No newline at end of file diff --git a/src/pv/PvTable.cpp b/src/pv/PvTable.cpp new file mode 100644 index 0000000..f42ad9b --- /dev/null +++ b/src/pv/PvTable.cpp @@ -0,0 +1,476 @@ +#include "PvTable.h" +#include "PvStyle.h" + +static const string STYLE_BKG = +"border-width:1 1 1 1px; border-style:outset solid; border-color:rgba(180,180,180,255);" +"background-color:rgba(80,80,80,0);"; + +//********************************************************************************************************************* +// PvTable +PvTable::PvTable(PARAM* p, int parent, int x, int y, int w, int row, Options& opts) + //: PvWidget(p, parent, PvRect(x, y, w, opts.item_height* row + (opts.show_header ? (opts.header_height) : 0))), + : PvObject(p), option_(opts), nRow_(row), nCol_(0) +{ + // 计算表格的显示区域 + int h = opts.row_height* row + (opts.show_header ? (opts.head_height) : 0); + rect_.set(x, y, w, h); + // 表格的主窗体(QWidget设置样式无效) + pvid_ = PvApp::widget(p, parent, x, y, w, h+1); + // 表格的背景色和边框样式 + PvApp::label(p, pvid_, 0, 0, w, h+1, "", QSS_TABLE); + + vecHead_.resize(0); + vecRows_.resize(nRow_); + vecData_.resize(nRow_); + + // 创建行高亮显示背景 + for (int row = 0; row < nRow_; row++) + { + int y = item_posy(row); + string qss = (row % 2 != 0) ? QSS_TABLE_ROW_0 : QSS_TABLE_ROW_1; + int rowBkg = PvApp::label(p, pvid_, 1, y, rect_.w-2, option_.row_height, "", qss); + pvHide(p, rowBkg); + vecRows_[row].bkg = rowBkg; + } +} + +void PvTable::addHead(string id, string text, int width, vector> mapping) +{ + vecHead_.push_back(Head(id, text, width, mapping)); + nCol_ = vecHead_.size(); + + if (width <= -1) + { + width = rect_.w-1 - posCol_; + } + int col = nCol_ - 1; + + // 创建表头的标签 + if (option_.show_header) + { + vecHead_[col].pvid = PvApp::label(p, pvid_, posCol_, 0, width, option_.head_height, text, QSS_TABLE_HEAD); + } + + // 创建列的单元格 + for (int row = 0; row < nRow_; ++row) + { + int y = item_posy(row); + int pvid = PvApp::label(p, pvid_, posCol_, y, width, option_.row_height, "", QSS_TABLE_CELL); + vecRows_[row].vecCells.push_back(pvid); + PvApp::bind(p, MOUSE_OVER_EVENT, pvid, [=](string s) { highlight(row, (s == "1")); }); + } + posCol_ += width; +} + +void PvTable::addHead(vector vec_text) +{ + int colSize = vec_text.size(); + int x = 0; + for (int i = 0; i < vec_text.size(); ++i) + { + int w = float(rect_.w-1) * float(i+1) / float(colSize); + string text = vec_text[i]; + this->addHead(text, text, w-x); + x = w; + } +} + +void PvTable::setRowVisible(int row, bool v) +{ + if (row < 0 || row >= vecRows_.size()) + { + return; + } + auto& rowItem = vecRows_[row]; + if (rowItem.visible != v) + { + rowItem.visible = v; + rowItem.visible ? pvShow(p, rowItem.bkg) : pvHide(p, rowItem.bkg); + if (!v) + { + for (int col = 0; col 0 && row <= vecRows_.size()) + { + if (v) { qss = "background-color:rgba(14,45,60,200);border:1px solid rgba(255,0,0,100);"; } + pvSetStyleSheet(p, vecRows_[row].bkg, qss.c_str()); + } +} + +void PvTable::addOperate(vector vecOpt) +{ + // 创建表头的标签 + if (option_.show_header) + { + PvApp::label(p, pvid_, posCol_, 0, rect_.w - posCol_, option_.head_height, "操作", QSS_TABLE_HEAD); + } + for (int row = 0; row < nRow_; ++row) + { + int y = item_posy(row); + int btn_opt = PvApp::label(p, pvid_, posCol_, y, rect_.w - posCol_, option_.row_height, "", QSS_TABLE_CELL); + //PvInstance::bind_event(p, MOUSE_OVER_EVENT, btn_opt, [=](string s) { highlight(row, (s == "1")); }); + vecOpt_.push_back({ btn_opt, vector() }); + auto& vec_opt_btn_ = vecOpt_.back().second; + + int x = 5, w = 60; + for (int i = 0; i < vecOpt.size(); i++) + { + auto& title = vecOpt[i]; + w = 20 + 15 * title.size() / 3; + int btn = PvApp::button(p, btn_opt, x, 4, w, 24, title, QSS_TABLE_BTN_VIEW); + PvApp::bind(p, PvEvent::BUTTON_EVENT, btn, [=](std::string) { + if (cbOperate_) { cbOperate_(row, 0, title); } + }); + vec_opt_btn_.push_back(btn); + x += (w + 5); + } + pvHide(p, btn_opt); + } +} + +void PvTable::setOperateCallback(CallbackTableOpt cb) +{ + cbOperate_ = cb; +}; + +void PvTable::set_text(PARAM* p, int row, int col, string text, string style) +{ + if (row < nRow_ && col < nCol_) + { + pvSetText(p, vecRows_[row].vecCells[col], text.c_str()); + if (!style.empty()) + { + int idx = row + 1; + if (idx % 2 != 0) + { + style = item_base_style_ + style; + } + else + { + style = item_base_style_ + style; + } + + //style = "qproperty-alignment:AlignCenter;" + style + "}"; + string s = "QLabel{" + style + "} QLabel:disabled{color:rgb(150,150,150)}"; + pvSetStyleSheet(p, vecRows_[row].vecCells[col], s.c_str()); + } + } +} + +void PvTable::setRowData(int row, DataFields& d) +{ + if (row >= nRow_) { return; } + + vecData_[row] = d; + for (int col = 0; col < vecHead_.size(); ++col) + { + auto& head = vecHead_[col]; + string text = d.getStr(head.id); + text = head.getMapping(text); + pvSetText(p, vecRows_[row].vecCells[col], text.c_str()); + } + setRowVisible(row, true); + this->setOperateVisible(row, d.size() > 0); +} + +void PvTable::setRowData(int row, std::vector vd) +{ + if (row >= nRow_) { return; } + pvShow(p, vecRows_[row].bkg); + for (int col = 0; col < vecHead_.size(); ++col) + { + if (col < vd.size()) { + auto& head = vecHead_[col]; + string text = head.getMapping(vd[col]); + pvSetText(p, vecRows_[row].vecCells[col], text.c_str()); + } + } + setRowVisible(row, true); + this->setOperateVisible(row, vd.size() > 0); +} + +DataFields& PvTable::getRowdata(int row) +{ + static DataFields tmp; + return (row >= 0 && row < vecData_.size()) ? vecData_[row] : tmp; +} + +void PvTable::set_border_visible(PARAM* p, bool v) +{ + v ? pvShow(p, border_id_) : pvHide(p, border_id_); +} + +int PvTable::item_posy(int row) +{ + return option_.show_header ? row * option_.row_height + option_.head_height : row * option_.row_height; +} + +//void PvTable::set_item_btn_callback(CallbackTableOpt cb) +//{ +// //cb_opt_ = cb; +//} + +void PvTable::add_col_button(PARAM* p, int col, string title, PvRect& rt, string style) +{ + if (col >= nCol_) + { + return; + } + for (int row = 0; row < nRow_; ++row) + { + int id = PvApp::button(p, vecRows_[row].vecCells[col], rt.x, rt.y, rt.w, rt.h, title, style); + pvHide(p, id); + vec_col_item_btn_[row].push_back(id); + //PvInstance::bind_event(p, PvEvent::BUTTON_EVENT, id, [=](string s) + //{ + // if (cb_operate_) + // { + // cb_operate_(row, col, title); + // } + //}); + } +} + +string GetTableItemButtonStyle(string title) +{ + static unordered_map map_style = + { + //{PV::OPT_NEW, PvStyle::BTN_NEW}, + //{PV::OPT_EDIT, PvStyle::BTN_EDIT}, + //{PV::OPT_DEL, PvStyle::BTN_DELETE} + }; + string style = map_style[title]; + if (style.empty()) + { + style = BTN_EDIT; + } + return style; +} + +void PvTable::add_col_button(PARAM* p, int col, vector vec_title) +{ + int x = 5; + int w = 0; + for (int i = 0; i < vec_title.size(); i++) + { + auto& title = vec_title[i]; + w = 20 + 20 * title.size() / 3; + this->add_col_button(p, col, title, PvRect(x, 3, w, 28), BTN_EDIT); + x += (w + 5); + } +} + +void PvTable::setOperateVisible(int row, bool v, int id) +{ + if (row < vecOpt_.size()) + { + auto& vec_opt_btn = vecOpt_[row].second; + int pvid = id < 0 ? vecOpt_[row].first : ((id < vec_opt_btn.size()) ? vec_opt_btn[id] : PV_ID_NUL); + v ? pvShow(p, pvid) : pvHide(p, pvid); + } +} + +int PvTable::border_id() +{ + return border_id_; +} + +int PvTable::rows() +{ + return nRow_; +} +int PvTable::colums() +{ + return nCol_; +} + +vector PvTable::data() +{ + return vecData_; +} + +PvTable::Head& PvTable::header(int col) +{ + return vecHead_[col]; +} + + + + + +static const string STYLE_NORMAL = +"QPushButton{background-color:rgba(255,255,255,30);border-radius:0px;font:bold 16px;color:white;border:1px solid #20a481;}" +"QPushButton:hover{background-color:rgba(32,164,128,255);color:white;}" +"QPushButton:pressed{border-width:3px 0 0 3px;border-style:inset;color:white;}"; + +static const string STYLE_ACTIVE = +"QPushButton{background-color:rgba(32,164,128,255);border-radius:0px;font:bold 16px;color:white;border:1px solid #20a481;}" +"QPushButton:hover{background-color:rgba(32,164,128,255);color:white;}" +"QPushButton:pressed{border-width:3px 0 0 3px;border-style:inset;color:white;}"; + + +PvPagination::PvPagination(PARAM* p, int parent, const PvRect& rt) + : PvObject(p) +{ + pvid_ = PvApp::label(p, parent, rt.x, rt.y, rt.w, rt.h, "", ""); + // 分页控件 + int x = 0; + int y = 0; + btn_prev_ = PvApp::button(p, pvid_, x, y, 30, 30, "<", STYLE_NORMAL); + for (int i = 1; i <= 7; i++) + { + int id = PvApp::button(p, pvid_, x += 32, y, 30, 30, std::to_string(i), STYLE_NORMAL); + vec_btn_page_.push_back({id, 0}); + //PvInstance::bind_event(p, PvEvent::BUTTON_EVENT, id, [=](string s) { this->on_click_page(id); }); + } + btn_next_ = PvApp::button(p, pvid_, x += 32, y, 30, 30, ">", STYLE_NORMAL); + + //PvInstance::bind_event(p, PvEvent::BUTTON_EVENT, btn_prev_, [=](string e) { this->on_click_prev(); }); + //PvInstance::bind_event(p, PvEvent::BUTTON_EVENT, btn_next_, [=](string e) { this->on_click_next(); }); + + this->set_page(0, 0); +} + +void PvPagination::set_page(int page_id, int max_page) +{ + this->active_page_button(p, page_id, page_id_); + + page_id_ = page_id; + page_count_ = max_page; + + int x = 32; + int y = 0;// table_->rect().h + 16; + for (int i = 0; i < vec_btn_page_.size(); ++i) + { + auto& btn_info = vec_btn_page_[i]; + auto btnid = btn_info.first; + int idx = i + 1; + if (idx > page_count_) + { + pvHide(p, btnid); + } + else + { + pvShow(p, btnid); + if (page_count_ > 7) + { + if (idx == 4) + { + idx = 0; + } + else if (idx > 4) + { + idx = page_count_ - (7 - idx); + } + } + btn_info.second = idx; + + string text = to_string(idx); + if (text.empty() || text == "0") + { + text = "..."; + pvSetEnabled(p, btnid, false); + } + pvMove(p, btnid, x, y); + pvSetText(p, btnid, text.c_str()); + if (page_id == idx) + { + this->active_page_button(p, page_id, page_id_); + page_id_ = page_id; + } + x += (32); + } + } + pvMove(p, btn_next_, x, y); +} + +int PvPagination::pageid() +{ + return page_id_; +}; + +void PvPagination::active_page_button(PARAM* p, int new_pageid, int old_pageid) +{ + for (int i = 0; i < vec_btn_page_.size(); i++) + { + auto& item = vec_btn_page_[i]; + if (item.second != 0) + { + if (item.second == old_pageid) + { + pvSetStyleSheet(p, item.first, STYLE_NORMAL.c_str()); + } + if (item.second == new_pageid) + { + pvSetStyleSheet(p, item.first, STYLE_ACTIVE.c_str()); + } + } + } +} + +void PvPagination::set_goto_page_callback(std::function cb) +{ + cb_goto_ = cb; +} + +void PvPagination::on_click_page(int btnid) +{ + for (int i = 0; i < vec_btn_page_.size(); ++i) + { + auto& item = vec_btn_page_[i]; + if (btnid == item.first) + { + int page_id = item.second; + if (cb_goto_) { cb_goto_(page_id); } + return; + } + } +} + +void PvPagination::on_click_prev() +{ + if (page_id_ <= 1) + { + return; + } + if (cb_goto_) + { + cb_goto_(page_id_ - 1); + } +} + +void PvPagination::on_click_next() +{ + if (page_id_ >= page_count_) + { + return; + } + if (cb_goto_) + { + cb_goto_(page_id_ + 1); + } +} + + +PvPageTable::PvPageTable(PARAM* p, int parent, int x, int y, int w, int rows, PvTable::Options& opts) +//: PvWidget(p, parent, PvRect(x, y, w, opts.item_height* rows + (opts.show_header ? (opts.header_height) : 0))) + : PvObject(p) +{ + int h = opts.row_height* rows + (opts.show_header ? (opts.head_height) : 0); + int pvid_ = PvApp::widget(p, parent, x, y, w, h); + table_ = make_shared(p, pvid_, 0, 0, w, rows, opts); +} + +shared_ptr PvPageTable::getTable() +{ + return table_; +} \ No newline at end of file diff --git a/src/pv/PvTable.h b/src/pv/PvTable.h new file mode 100644 index 0000000..61dce6f --- /dev/null +++ b/src/pv/PvTable.h @@ -0,0 +1,174 @@ +#ifndef _PvTable_H_ +#define _PvTable_H_ + +#include + +#include "PvApp.h" +#include "DataFields.h" + +using CallbackTableOpt = std::function; + +class PvTable : public PvObject +{ +public: + struct Options + { + bool show_header = true; + bool show_border = true; + int head_height = 40; + int row_height = 35; + int page_size = 10; + int width = 500; + }; + + struct Head + { + Head() {} + Head(std::string hid, std::string htext, int w, std::vector> mapping) + : id(hid), text(htext), width(w), vecMaping(mapping) {} + + std::string id; + std::string text; + int width = 80; + int pvid = PV_ID_NUL; + vector> vecMaping; + + std::string getMapping(std::string s) + { + std::string v = s; + for (auto& item : vecMaping) + { + if (v == item.first) { v = item.second; } + else if (v == item.second) { v = item.first; } + } + return v; + } + }; + + struct Row + { + bool visible = false; + int bkg {PV_ID_NUL}; + std::vector vecCells {}; + }; + +public: + PvTable(PARAM* p, int parent, int x, int y, int w, int rows, Options& option); + + void addHead(std::string id, std::string text, int width, std::vector> mapping = {}); + void addHead(std::vector vecText); + + void setRowVisible(int row, bool v); + void highlight(int row, bool v); + + void addOperate(std::vector vecOpt); + void setOperateCallback(CallbackTableOpt cb); + + void set_text(PARAM* p, int row, int col, std::string text, std::string style = ""); + + void setRowData(int row, DataFields& d); + void setRowData(int row, std::vector vd); + + DataFields& getRowdata(int row); + + void set_border_visible(PARAM* p, bool v); + + void add_col_button(PARAM* p, int col, std::string title, PvRect& rt, std::string style); + void add_col_button(PARAM* p, int col, std::vector vec_title); + void setOperateVisible(int row, bool v, int id = -1); + + int item_posy(int row); + + int border_id(); + + int rows(); + + int colums(); + + std::vector data(); + + PvTable::Head& header(int col); + +private: + int pvid_; + PvRect rect_; + + int border_id_; + + std::vector vecHead_; + std::vector vecRows_; + + std::vector vecData_; + + vector>> vecOpt_; + int nRow_; + int nCol_; + + string item_base_style_; + + Options option_; + + unordered_map> vec_col_item_btn_; + + CallbackTableOpt cbOperate_ = nullptr; + + int posCol_ = 0; +}; + + +class PvPagination : public PvObject +{ +public: + PvPagination(PARAM* p, int parent, const PvRect& rt); + + void set_page(int page_id, int max_page); + + int pageid(); + + void set_goto_page_callback(std::function cb); + +private: + void on_click_page(int btnid); + void on_click_prev(); + void on_click_next(); + + void active_page_button(PARAM* p, int new_pageid, int old_pageid); + +private: + int pvid_ = PV_ID_NUL; + + // 当前显示的页码索引, 从1开始 + int page_id_ = 1; + + // 总页数 + int page_count_ = 0; + + // 上一页按钮 + int btn_prev_ = PV_ID_NUL; + + // 下一页按钮 + int btn_next_ = PV_ID_NUL; + + // 页面跳转按钮 + int btn_gopage_ = PV_ID_NUL; + + // 页码列表(最多显示6个页码按钮,前3页和后3页) <按钮ID, 页码> + std::vector> vec_btn_page_; + + function cb_goto_ = nullptr; +}; + + +class PvPageTable :public PvObject +{ +public: + PvPageTable(PARAM* p, int parent, int x, int y, int w, int rows, PvTable::Options& opts); + + shared_ptr getTable(); + +private: + shared_ptr table_ = nullptr; + shared_ptr page_ctrl_ = nullptr; +}; + +#endif // ! _PvTable_H_ \ No newline at end of file diff --git a/src/app/AppSetting.cpp b/src/pv/PvUser.cpp similarity index 100% rename from src/app/AppSetting.cpp rename to src/pv/PvUser.cpp diff --git a/src/pv/PvUser.h b/src/pv/PvUser.h new file mode 100644 index 0000000..0bb5334 --- /dev/null +++ b/src/pv/PvUser.h @@ -0,0 +1,11 @@ +#pragma once +#include +#include +#include + +class PvUser +{ +public: + int pvidIndex = 0; + std::map> mapEventCallback; +}; \ No newline at end of file diff --git a/src/pv/pages/MaskPageForecast.cpp b/src/pv/pages/MaskPageForecast.cpp new file mode 100644 index 0000000..2eb6c2a --- /dev/null +++ b/src/pv/pages/MaskPageForecast.cpp @@ -0,0 +1,44 @@ +#include "MaskPageForecast.h" + +#include "pv/PvChart.h" + +static int CreatePanel(PARAM* p, int parentId, int x, int y, int w, int h, std::string title) +{ + int id = PvApp::label(p, parentId, x, y, w, h, "", QSS_LABEL_BKG_2); + PvApp::label(p, id, 10, 10, w, 20, title, STYLE_TITLE_ICON); + PvApp::label(p, id, 20, 30, w, 2, "", QSS_UNDERLINE); + return id; +} + +MaskPageForecast::MaskPageForecast(PARAM* p) : PvMask(p) +{ +} + +int MaskPageForecast::initUI(EPvCode pvcode) +{ + int x = 10, y = 100, w = 1900, h = 420; + int delta = 40; + { + int panel = CreatePanel(p, 0, x, y, w, h, "储能充放电预测"); + chart1_ = std::make_shared(p, panel, 0, delta, w, h-delta); + chart1_->setBackground(p, 8, 54, 91); + chart1_->setLabelYLeft("电量(kWh)", 0, 10, 2); + chart1_->insertItem(0, "充电电量", 120, 10, 80); + chart1_->insertItem(0, "放电电量", 200, 10, 80); + } + { + int panel = CreatePanel(p, 0, x, y+=(h+10), w = 945, h, "光伏发电预测"); + chart2_ = std::make_shared(p, panel, 0, delta, w, h-delta); + chart2_->setBackground(p, 8, 54, 91); + chart2_->setLabelYLeft("电量(kWh)", 0, 10, 2); + chart2_->insertItem(0, "发电电量", 120, 10, 80); + } + { + int panel = CreatePanel(p, 0, x+=(w+10), y, w, h, "充电负荷预测"); + chart3_ = std::make_shared(p, panel, 0, delta, w, h-delta); + chart3_->setBackground(p, 8, 54, 91); + chart3_->setLabelYLeft("电量(kWh)", 0, 10, 2); + chart3_->insertItem(0, "充电电量", 120, 10, 80); + } + return 0; +} \ No newline at end of file diff --git a/src/pv/pages/MaskPageForecast.h b/src/pv/pages/MaskPageForecast.h new file mode 100644 index 0000000..aefc451 --- /dev/null +++ b/src/pv/pages/MaskPageForecast.h @@ -0,0 +1,16 @@ +#pragma once + +#include "pv/PvApp.h" + +class PvChartCurve; + +class MaskPageForecast : public PvMask +{ +public: + MaskPageForecast(PARAM* p); + int initUI(EPvCode pvcode); + + std::shared_ptr chart1_; + std::shared_ptr chart2_; + std::shared_ptr chart3_; +}; \ No newline at end of file diff --git a/src/pv/pages/MaskPageHome.cpp b/src/pv/pages/MaskPageHome.cpp new file mode 100644 index 0000000..874f505 --- /dev/null +++ b/src/pv/pages/MaskPageHome.cpp @@ -0,0 +1,329 @@ +#include "MaskPageHome.h" +#include "common/Utils.h" +#include "app/Application.h" +#include "app/Station.h" + +#include "pv/PvTable.h" +#include "pv/PvChart.h" + +static int CreatePanel(PARAM* p, int parent, int x, int y, int w, int h, std::string title) +{ + int panelId = PvApp::label(p, parent, x, y, w, h, "", QSS_LABEL_BKG_1); + int titleId = PvApp::label(p, panelId, 10, 8, w, 22, title, STYLE_TITLE_ICON); + PvApp::label(p, panelId, 20, 28, w, 2, "", QSS_UNDERLINE); + return panelId; +} + +static int CreatePanel1(PARAM* p, int parent, int x, int y, int w, int h, std::string title) +{ + int panelId = PvApp::label(p, parent, x, y, w, h, "", "border: none; background-color: transparent;"); + PvApp::image(p, panelId, 0, 13, 500, 17, "bkgBox.png"); + PvApp::label(p, panelId, 20, 0, w-20, 30, title, "background-color: transparent; font: bold 18px;"); + return panelId; +} + +static int CreateCard1(PARAM* p, int parentId, int x, int y, int w, int h, std::string title, std::string val) +{ + int id = PvApp::label(p, parentId, x, y, w, h, "", QSS_LABEL_BKG_1); + int idTitle = PvApp::label(p, id, 0, h*0.5, w, h*0.5, title, "background:transparent; font: bold 28px;"); + int idVal = PvApp::label(p, id, 0, 0, w, h*0.5, val, "background:transparent; font: bold 28px; color:rgb(77,215,240);"); + pvSetAlignment(p, idTitle, AlignCenter); + pvSetAlignment(p, idVal, AlignHCenter | AlignBottom); + return id; +} + +static int CreateCard2(PARAM* p, int parent, int x, int y, int w, int h, std::string title, std::string val) +{ + int id = PvApp::label(p, parent, x, y, w, h, "", QSS_LABEL_BKG_1); + + int idTitle = PvApp::label(p, id, 0, 0, w, h*0.5, title, "background:transparent; font: bold 16px;"); + int idVal = PvApp::label(p, id, 0, h*0.5, w, h*0.5, val, "background:transparent; font: bold 16px; color:rgb(77,215,240);"); + pvSetAlignment(p, idTitle, AlignCenter); + pvSetAlignment(p, idVal, AlignCenter); + return id; +} + +static int CreateBox(PARAM* p, int parent, int x, int y, int w, int h, std::string k, std::string val="") +{ + int id = PvApp::label(p, parent, x, y, w, h, "", "border-radius:0px; background-color: rgb(7, 45, 66); border: 1px solid rgb(27, 88, 105);"); + { + int len = 10; + std::string qss = "background-color: transparent; border: 1px solid rgb(0, 218, 216);"; + PvApp::label(p, id, 0, 0, len, len, "", qss + "border-width: 2px 0 0 2px"); + PvApp::label(p, id, w-len, 0, len, len, "", qss + "border-width: 2px 2px 0 0"); + PvApp::label(p, id, w-len, h-len, len, len, "", qss + "border-width: 0 2px 2px 0"); + PvApp::label(p, id, 0, h-len, len, len, "", qss + "border-width: 0 0 2px 2px"); + } + int titleId = PvApp::label(p, id, 0, 0, w, h*0.5, k, "border:none; background-color: transparent; font: bold 14px; padding-bottom: 0px;"); + int valId = PvApp::label(p, id, 0, h*0.5, w, h*0.5, val, "border:none; background-color: transparent; font: bold 16px; color:rgb(77, 215, 240);"); + pvSetAlignment(p, titleId, AlignHCenter | AlignBottom); + pvSetAlignment(p, valId, AlignHCenter | AlignTop); + return valId; +} + +static int CreateIconBox(PARAM* p, int parent, int x, int y, std::string k, std::string val, std::string icon) +{ + //PvApp::label(p, parent, x, y, 50, 50, "", "background-color: rgb(2, 41, 60); border: 1px solid rgb(61, 254, 250);"); + //PvApp::label(p, parent, x+3, y+3, 44, 44, "", "background-color: transparent; border: 2px solid rgb(31, 91, 139);"); + PvApp::image(p, parent, x, y, 50, 50, icon.c_str()); + PvApp::label(p, parent, x+52, y, 100, 20, k, "background-color: transparent; border: none; font: bold 14px;"); + int valId = PvApp::label(p, parent, x+52, y+25, 100, 20, val, "background-color: transparent; border: none; font: bold 14px;"); + return valId; +} + +class PopStation +{ +public: + PARAM* p {}; + int widget = PV_ID_NUL; + int width = 1100; + int height = 800; + int labelTitle = PV_ID_NUL; + + PopStation(PARAM* p) : p(p) + { + int wMask = 1920, hMask = 960; + widget = PvApp::widget(p, PV_ID_MAIN, 0, 0, wMask, hMask); + PvApp::label(p, widget, 0, 0, 1920, 960, "", "background-color: rgb(1, 32, 54);"); + + // 站名称Title + labelTitle = PvApp::label(p, widget, 0, 40, wMask, 30, "", "border: none; background-color: transparent; font: bold 20px;"); + pvSetAlignment(p, labelTitle, AlignCenter); + + { + int pid = PvApp::label(p, widget, (wMask-width)*0.5, (hMask-height)*0.5, width, height, "", "background-color: rgb(2, 58, 87); border: 1px solid rgb(31, 198, 255);"); + PvApp::label(p, pid, 0, 0, 80, height, "", "background-color: transparent; border: 3px solid rgb(31, 198, 255); border-width: 3px 0 3px 3px;"); + PvApp::label(p, pid, width-80, 0, 80, height, "", "background-color: transparent; border: 3px solid rgb(31, 198, 255); border-width: 3px 3px 3px 0;"); + + int btnClose = PvApp::button(p, pid, width-40, 5, 30, 30, "✕", "background-color: white; border: none; border-radius: 15px; color: rgb(2, 59, 87); font: bold 20px;"); + PvApp::bind(p, PvEvent::BUTTON_EVENT, btnClose, [=](std::string) { + pvHide(p, widget); + }); + + int x = 20, y = 40, w = 500, h = 240; + { + int box = CreatePanel1(p, pid, x, y, w, h, "预制舱信息"); + int x0 = 50, y0 = 40, w0 = 150, h0 = 60; + CreateBox(p, box, x0 = 60, y0, w0, h0, "电池类型", "磷酸铁锂电池"); + CreateBox(p, box, w-x0-w0, y0, w0, h0, "冷却模式", "风冷"); + CreateBox(p, box, x0 = 20, y0 += (h0+5), w0, h0, "运行模式", "最优经济化"); + CreateBox(p, box, w-x0-w0, y0, w0, h0, "电池额定电压", "300 V"); + CreateBox(p, box, x0 = 60, y0 += (h0+5), w0, h0, "PCS额定功率", "100 kW"); + CreateBox(p, box, w-x0-w0, y0, w0, h0, "电池储能容量", "100 kWh"); + } + { + y += (h+10); + int box = CreatePanel1(p, pid, x, y, w, h, "运行与统计信息"); + + CreateIconBox(p, box, 40, 40, "舱内温度", "20 ℃", "icon1.png"); + CreateIconBox(p, box, 40+160, 40, "舱内湿度", "30 %", "icon2.png"); + CreateIconBox(p, box, 40+160*2, 40, "电压", "200 V", "icon3.png"); + CreateIconBox(p, box, 40, 90, "电流", "30 A", "icon4.png"); + CreateIconBox(p, box, 40+160, 90, "功率", "6 kW", "icon5.png"); + CreateIconBox(p, box, 40+160*2, 90, "功率因数", "1.0", "icon5.png"); + + int x0 = 10, y0 = 160, w0 = 90, h0 = 60; + CreateBox(p, box, x0, y0, w0, h0, "场站运行天数", "365 天"); + CreateBox(p, box, x0 += (w0+10), y0, w0, h0, "储能充电电量", "22 kWh"); + CreateBox(p, box, x0 += (w0+10), y0, w0, h0, "储能放电电量", "11 kWh"); + CreateBox(p, box, x0 += (w0+10), y0, w0, h0, "场站累计收益", "123.12 元"); + CreateBox(p, box, x0 += (w0+10), y0, w0, h0, "设备利用率", "10 %"); + } + { + y += (h+10); + int box = CreatePanel1(p, pid, x, y, w, h, "环境信息"); + + CreateIconBox(p, box, 80, 50, "光照强度", "27.1 Lux", "icon1.png"); + CreateIconBox(p, box, 80+200*1, 50, "风速", "1.2 m/s", "icon2.png"); + CreateIconBox(p, box, 80, 120, "环境温度", "35.7 ℃", "icon1.png"); + CreateIconBox(p, box, 80+200*1, 120, "环境湿度", "31.3 %", "icon2.png"); + } + + { + x = 580; y = 40; h = 240; + int box = CreatePanel1(p, pid, x, y, w, h, "储能充放电量"); + PvChartCurve chart(p, box, 0, 40, 500, 200); + chart.setBackground(p, 2, 58, 87); + chart.setLabelYLeft("电量(kWh)"); + chart.insertItem(0, "充电电量", 120, 10, 80); + chart.insertItem(0, "放电电量", 200, 10, 80); + } + { + y += (h+10); + int box = CreatePanel1(p, pid, x, y, w, h, "场站收益"); + PvChartCurve chart(p, box, 0, 40, 500, 200); + chart.setBackground(p, 2, 58, 87); + chart.setLabelYLeft("电量(元)"); + chart.insertItem(0, "收益", 120, 10, 80); + } + { + y += (h+10); + int box = CreatePanel1(p, pid, x, y, w, h, "设备利用率"); + PvChartCurve chart(p, box, 0, 40, 500, 200); + chart.setBackground(p, 2, 58, 87); + chart.setLabelYLeft("利用率(%)"); + chart.insertItem(0, "利用率", 120, 10, 80); + } + } + } + + void setTitle(std::string title) + { + pvSetText(p, labelTitle, title.c_str()); + } + void show(int v) + { + v ? pvShow(p, widget) : pvHide(p, widget); + } +}; + + +//background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,stop:1 rgba(0,255,240,200),stop:0 rgba(0,255,240,0)); +int MaskPageHome::initUI(EPvCode pvcode) +{ + int x = 10, y = 100, w = 500, h1 = 260, h2=290, h3=290; + + // 左侧区域: 上 + { + int x0 = 0, y0=40, w0=160, h0=64; + int panel = CreatePanel(p, 0, x, y, w, h1, "运行总览"); + ui.labelRunDays = CreateBox(p, panel, x0 = 50, y0, w0, h0, "运行时间"); + ui.labelStationNum = CreateBox(p, panel, w-10-w0-x0, y0, w0, h0, "能源站数量"); + ui.labelEnergyCapacity = CreateBox(p, panel, x0 = 10, y0+=(h0+10), w0, h0, "储能总容量"); + ui.labelIncome = CreateBox(p, panel, w-10-w0-x0, y0, w0, h0, "累计收益"); + ui.labelStorageIn = CreateBox(p, panel, x0 = 50, y0 += (h0+10), w0, h0, "累计储能充电量"); + ui.labelStorageOut = CreateBox(p, panel, w-10-w0-x0, y0, w0, h0, "累计储能放电量"); + } + + // 左侧区域: 中 + { + int panel = CreatePanel(p, 0, x, y+h1+10, w, h2, "储能设备"); + + int x1 = 10; + CreateCard2(p, panel, x1, 40, 235, 50, "今日充电电量", "0 kWh"); + CreateCard2(p, panel, x1+=245, 40, 235, 50, "今日放电电量", "0 kWh"); + + auto bar = PvChartBar::create(p, panel, 10, 100, w-20, h2-100); + bar->setLabelYLeft("电量(kWh)"); + bar->insertItem("日充电电量"); + bar->insertItem("日放电电量"); + bar->updateItem(0, {{"08/01", 10}, {"08/02", 20}, {"08/03", 30}, {"08/04", 40}, {"08/05", 50}, {"08/06", 60}, {"08/07", 70}}); + bar->updateItem(1, {{"08/01", 1}, {"08/02", 2}, {"08/03", 3}, {"08/04", 4}, {"08/05", 5}, {"08/06", 6}, {"08/07", 7}}); + } + + // 左侧区域: 下 + { + int panel = CreatePanel(p, 0, x, y+h1+h2+20, w, h3, "光伏设备"); + + int x1 = 10; + CreateCard2(p, panel, x1, 40, 235, 50, "今日发电电量", "0 kWh"); + CreateCard2(p, panel, x1 += 245, 40, 235, 50, "今日入网电量", "0 kWh"); + + auto bar = PvChartBar::create(p, panel, 10, 100, w-20, h3-100); + bar->setLabelYLeft("电量(kWh)"); + bar->insertItem("日发电电量"); + bar->insertItem("日入网电量"); + bar->updateItem(0, {{"08/01", 10}, {"08/02", 20}, {"08/03", 30}, {"08/04", 40}, {"08/05", 50}, {"08/06", 60}, {"08/07", 70}}); + } + + // 右侧区域:上 + { + int panel = CreatePanel(p, 0, x += (880+10+500+10), y, w = 500, h1, "运行分析"); + + } + // 右侧区域:中 + { + int panel = CreatePanel(p, 0, x, y+h1+10, w = 500, h2, "充电设备"); + + int x1 = 10; + CreateCard2(p, panel, x1, 40, 235, 50, "今日充电电量", "0 kWh"); + CreateCard2(p, panel, x1 += 245, 40, 235, 50, "今日充电次数", "0 次"); + + auto bar = PvChartBar::create(p, panel, 10, 100, w-20, h2-100); + bar->setLabelYLeft("电量(kWh)"); + bar->insertItem("日充电电量"); + bar->insertItem("日充电次数"); + bar->updateItem(0, {{"08/01", 10}, {"08/02", 20}, {"08/03", 30}, {"08/04", 40}, {"08/05", 50}, {"08/06", 60}, {"08/07", 70}}); + + } + // 右侧区域:下 + { + int panel = CreatePanel(p, 0, x, y+h1+h2+20, w = 500, h3, "告警分析"); + + int x1 = 10; + CreateCard2(p, panel, x1, 40, 153, 50, "今日储能告警", "0 次"); + CreateCard2(p, panel, x1 += 163, 40, 153, 50, "今日光伏告警", "0 次"); + CreateCard2(p, panel, x1 += 163, 40, 153, 50, "今日充电告警", "0 次"); + + auto bar = PvChartBar::create(p, panel, 10, 100, w-20, h3-100); + bar->setLabelYLeft("次数"); + bar->insertItem("日储能告警"); + bar->insertItem("日光伏告警"); + bar->insertItem("日充电告警"); + bar->updateItem(0, {{"08/01", 10}, {"08/02", 20}, {"08/03", 30}, {"08/04", 40}, {"08/05", 50}, {"08/06", 60}, {"08/07", 70}}); + } + + // 中间区域 + { + int panel = PvApp::label(p, 0, x = 10+500+10, y, w = 880, h1+h2+h3+20, "", QSS_LABEL_BKG_1); + + ////// 饼图 + //int left = PvApp::widget(p, panel, 100, 100, 100, 100); + //pvSetStyleSheet(p, left, "border: 1px solid gray; border-radius:50px;"); + + //int id = PvApp::pvid(); + //pvDownloadFile(p, "red.png"); + //pvQImage(p, id, left, ""); + //pvSetGeometry(p, id, 10, 10, 100, 100); + //pvSetImage(p, id, "red.png", 0); + ////pvSetStyleSheet(p, id, "border-radius: 50px;"); + + //int right = PvApp::label(p, panel, 200, 100, 100, 200, "", "border: 1px solid gray;"); + //std::string qss = "background: qlineargradient(x1:0, y1 : 0, x2 : 1, y2 : 1, stop : 0 red, stop:1 blue); border-radius: 50px;"; + //std::string qss1 = "width: 200px;height: 200px;background: red;transform: rotate(45deg); border-radius: 100px;"; + //PvApp::label(p, left, 0, 0, 200, 200, "", qss1); + + PvApp::image(p, panel, 0, 20, 880, 800, "map.png"); + + auto popStation = new PopStation(p); + popStation->show(0); + int btn = PvApp::button(p, panel, 10, 20, 100, 30, "场站一", STYLE_BTN); + PvApp::bind(p, PvEvent::BUTTON_EVENT, btn, [=](std::string) { + popStation->setTitle("场站一"); + pvShow(p, popStation->widget); + }); + + PvApp::image(p, panel, 500, 420, 50, 50, "mapMarker.png"); + PvApp::image(p, panel, 420, 500, 50, 50, "mapMarker.png"); + PvApp::image(p, panel, 520, 532, 50, 50, "mapMarker.png"); + PvApp::image(p, panel, 363, 380, 50, 50, "mapMarker.png"); + PvApp::image(p, panel, 545, 564, 50, 50, "mapMarker.png"); + } + + this->updateUI(); + return 0; +} + +void MaskPageHome::updateUI() +{ + auto& appdata = Application::instance().getAppData(); + + int stationNum = appdata.mapStation.size(); // 场站数量 + double energyCapacity {}; // 储能容量 + double incomeTotal {}; // 累计收益 + double electStorageIn {}; // 储能充电电量 + double electStorageOut {}; // 储能放电电量 + for (auto& item : appdata.mapStation) + { + auto& station = item.second; + energyCapacity += station->energyCapacity; + incomeTotal += station->incomeTotal; + } + + pvSetText(p, ui.labelRunDays, "100 天"); + pvSetText(p, ui.labelRunDays, (Utils::toStr(stationNum) + " 个").c_str()); + pvSetText(p, ui.labelEnergyCapacity, (Utils::toStr(energyCapacity) + " kWh").c_str()); + pvSetText(p, ui.labelIncome, (Utils::toStr(incomeTotal) + " 元").c_str()); + pvSetText(p, ui.labelStorageIn, (Utils::toStr(electStorageIn) + " kWh").c_str()); + pvSetText(p, ui.labelStorageOut, (Utils::toStr(electStorageOut) + " kWh").c_str()); +} \ No newline at end of file diff --git a/src/pv/pages/MaskPageHome.h b/src/pv/pages/MaskPageHome.h new file mode 100644 index 0000000..c8627fe --- /dev/null +++ b/src/pv/pages/MaskPageHome.h @@ -0,0 +1,37 @@ +#pragma once + +#include "pv/PvApp.h" + +class MaskPageHome : public PvMask +{ +public: + // 控件ID的数量,需要在创建控件之前确定值和数量 + int idCount = 100; + + int iconView1; + int welcomeLabel; + int helpLabel; + int buttonRestroom; + +public: + MaskPageHome(PARAM* p) : PvMask(p) + { + iconView1 = PvApp::pvid(p); + welcomeLabel = PvApp::pvid(p); + helpLabel = PvApp::pvid(p); + buttonRestroom = PvApp::pvid(p); + } + + int initUI(EPvCode pvcode); + void updateUI(); + + struct { + int labelRunDays; + int labelStationNum; + int labelEnergyCapacity; + int labelIncome; + int labelStorageIn; + int labelStorageOut; + } ui; + +}; \ No newline at end of file diff --git a/src/pv/pages/MaskPageRunning.cpp b/src/pv/pages/MaskPageRunning.cpp new file mode 100644 index 0000000..ff0f72d --- /dev/null +++ b/src/pv/pages/MaskPageRunning.cpp @@ -0,0 +1,253 @@ +#include "MaskPageRunning.h" +#include "app/Application.h" + +static std::string QSS_CARD_DEVICE = +"QLabel { background-color:rgb(8, 54, 91); border:0px solid rgb(120, 120, 120); border-radius:5px; font:bold 14px; color:white; }" +"QLabel:hover {border: 2px solid rgb(79, 129, 255); border-radius:2px;}" +"QLabel:disabled { color:rgb(150,150,150);}"; + +static std::string QSS_PARAM_K = "border:none; background-color: transparent; color: rgb(180,180,180); font: bold 13px;"; +static std::string QSS_PARAM_V = "border:none; background-color: transparent; color: white; font: bold 14px;"; + +static int CreateParamLabel(PARAM* p, int parent, int x, int y, std::string k, std::string v) +{ + PvApp::label(p, parent, x, y, 70, 30, k, QSS_PARAM_K); + return PvApp::label(p, parent, x += 70, y, 120, 30, v, QSS_PARAM_V); +} + +class BoxCard : PvObject +{ +public: + static std::shared_ptr create(PARAM* p, int parent, int x, int y) + { + return std::make_shared(p, parent, x, y); + } + + BoxCard(PARAM* p, int parent, int x, int y) : PvObject(p) + { + card_ = PvApp::label(p, parent, x, y, 400, 250, "", QSS_CARD_DEVICE); + + PvApp::label(p, card_, 10, 10, 60, 60, "", "border:none; background-color: rgb(39, 158, 145);"); + ui.code = PvApp::label(p, card_, 80, 10, 100, 20, "", "border:none; background-color: transparent;"); + ui.name = PvApp::label(p, card_, 80, 30, 100, 20, "", "border:none; background-color: transparent;"); + ui.type = PvApp::label(p, card_, 80, 50, 100, 20, "", "border:none; background-color: transparent; color: rgb(8, 161, 249);"); + + int x1 = 190; + ui.online = PvApp::labelAlignCenter(p, card_, x1, 10, 70, 30, "在线", QSS_PARAM_V); + ui.running = PvApp::labelAlignCenter(p, card_, x1 += 70, 10, 70, 30, "空闲", QSS_PARAM_V); + ui.err = PvApp::labelAlignCenter(p, card_, x1 += 70, 10, 70, 30, "正常", QSS_PARAM_V); + + PvApp::labelAlignCenter(p, card_, x1 = 190, 40, 70, 30, "在线状态", QSS_PARAM_K); + PvApp::labelAlignCenter(p, card_, x1 += 70, 40, 70, 30, "工作状态", QSS_PARAM_K); + PvApp::labelAlignCenter(p, card_, x1 += 70, 40, 70, 30, "故障状态", QSS_PARAM_K); + + + PvApp::label(p, card_, 10, 80, 80, 30, "运行分析:", QSS_PARAM_K); + PvApp::button(p, card_, 80, 83, 60, 24, "查看", "border:none; border-radius: 5px; background-color: rgb(28, 145, 138); color:white; font: bold 14px;"); + + // 默认创建 10 个参数标签: + int n = 10; + vecParamLabel_.resize(n); + for (int i = 0; i vecKeys) + { + for (int i = 0; i> vecParamLabel_; + std::map mapParam_; +}; + +MaskPageRunning::MaskPageRunning(PARAM* p) : PvMask(p) +{ +} + +int MaskPageRunning::initUI(EPvCode pvcode) +{ + PvApp::label(p, 0, 10, 100, 1900, 850, "", "background-color: rgb(5, 47, 77); border-radius: 10px;"); + PvApp::label(p, 0, 10, 150, 220, 790, "", "background-color: rgb(8, 54, 91); border-radius: 10px;"); + int workspace = PvApp::label(p, 0, 240, 150, 1670, 790, "", "background-color: rgba(8, 54, 91, 0); border-radius: 10px;"); + + std::vector vecStationNames; + Application::instance().getAppData().getStationNames(vecStationNames); + PvApp::label(p, 0, 20, 110, 80, 30, "场站切换", "color:white; font: bold 16px;"); + PvApp::combox(p, 0, 100, 110, 150, 30, vecStationNames); + if (vecStationNames.size() > 0) + { + station_ = Application::instance().getAppData().getStationByName(vecStationNames[0]); + } + + PvApp::label(p, 0, 320, 110, 80, 30, "运行模式", "color:white; font: bold 16px;"); + PvApp::combox(p, 0, 400, 110, 200, 30, {"最优经济化运行模式", "最优经济化运行模式", "自定义"}); + + PvApp::label(p, 0, 670, 110, 80, 30, "策略名称", "color:white; font: bold 16px;"); + PvApp::combox(p, 0, 750, 110, 200, 30, {"峰谷套利策略", "需求响应策略", "自发自用上网策略"}); + + int x = 20, y = 160, w = 200, h = 180; + // 储能设备 + { + ui.storage.name = "储能设备"; + int pid = ui.storage.box = PvApp::label(p, 0, x, y, w, h, "", QSS_BOX); + PvApp::label(p, pid, 10, 0, w-10, 30, ui.storage.name, QSS_TITLE); + + ui.storage.btn = PvApp::button(p, pid, 0, 0, w, h, "", "background-color: transparent;"); + ui.storage.workspace = PvApp::widget(p, workspace, 0, 0, 1670, 790); + pvHide(p, ui.storage.workspace); + + // 创建信息卡片 + { + vecCard_.resize(12); + for (int i=0; i> mapDeviceTypes = +{ + {"储能设备", {"储能预制舱", "储能电池", "储能电池", "储能电池"}}, + {"光伏设备", {"光伏板", "光伏板", "光伏板", "光伏板", "光伏板", "光伏板", "光伏板", "光伏板"}}, + {"充电设备", {"充电桩", "充电桩", "充电桩", "充电桩", "充电桩", "充电桩", "充电桩", "充电桩", "充电桩", "充电桩"}}, +}; +std::map> mapDeviceParams = +{ + {"储能预制舱", {"运行模式", "冷却方式", "实时电压", "额定电压", "实时电流", "额定电流", "实时功率", "额定功率", "功率因数", "电池容量"}}, + {"储能电池", {"实时电压", "额定电压", "实时电流", "额定电流", "实时功率", "额定功率", "功率因数", "电池容量"}}, + {"逆变器", {"实时电压", "额定电压", "实时电流", "额定电流", "实时功率", "额定功率", "功率因数"}}, + {"光伏板", {"实时电压", "额定电压", "实时电流", "额定电流", "实时功率", "额定功率", "功率因数"}}, + {"充电桩", {"实时电压", "额定电压", "实时电流", "额定电流", "实时功率", "额定功率", "功率因数"}}, +}; + +void MaskPageRunning::activeBoxPanel(BoxPanel& panel) +{ + static int activeBox = PV_ID_NUL; + static int activeWorkspace = PV_ID_NUL; + if (activeBox != PV_ID_NUL) { pvSetStyleSheet(p, activeBox, QSS_BOX.c_str()); } + if (activeBox = panel.box) { pvSetStyleSheet(p, activeBox, QSS_BOX_ACTIVE.c_str()); } + + if (activeWorkspace != PV_ID_NUL) { pvHide(p, activeWorkspace); } + if (activeWorkspace = panel.workspace) { pvShow(p, activeWorkspace); } + + + if (panel.workspace != ui.security.workspace) + { + std::vector vecDeviceInfo = mapDeviceTypes[panel.name]; + + // 读取储能设备信息 + for (int i = 0; ishow(1); + card->setCard(type, type+"-"+std::to_string(i), type+"-"+std::to_string(i)); + card->setParamkeys(mapDeviceParams[type]); + } + else + { + card->show(0); + } + } + } +} \ No newline at end of file diff --git a/src/pv/pages/MaskPageRunning.h b/src/pv/pages/MaskPageRunning.h new file mode 100644 index 0000000..b97c3b2 --- /dev/null +++ b/src/pv/pages/MaskPageRunning.h @@ -0,0 +1,35 @@ +#pragma once + +#include "pv/PvApp.h" + +class BoxCard; +class Station; + +class MaskPageRunning : public PvMask +{ +public: + struct BoxPanel { + std::string name; + int box; + int btn; + int workspace; + }; + + MaskPageRunning(PARAM* p); + int initUI(EPvCode pvcode); + + virtual EPvCode onEventButton(int pvid); + + void activeBoxPanel(BoxPanel& panel); + + + struct { + BoxPanel storage; + BoxPanel solar; + BoxPanel charge; + BoxPanel security; + } ui; + + std::vector> vecCard_; + std::shared_ptr station_ = nullptr; +}; \ No newline at end of file diff --git a/src/pv/pages/MaskPageStat.cpp b/src/pv/pages/MaskPageStat.cpp new file mode 100644 index 0000000..0c3d6a9 --- /dev/null +++ b/src/pv/pages/MaskPageStat.cpp @@ -0,0 +1,167 @@ +#include "MaskPageStat.h" +#include "pv/PvTable.h" +#include "pv/PvChart.h" + +static int CreatePanel(PARAM* p, int parentId, int x, int y, int w, int h, std::string title) +{ + int id = PvApp::label(p, parentId, x, y, w, h, "", QSS_LABEL_BKG_2); + PvApp::label(p, id, 10, 10, w, 20, title, STYLE_TITLE_ICON); + PvApp::label(p, id, 20, 30, w, 2, "", QSS_UNDERLINE); + return id; +} + +MaskPageStat::MaskPageStat(PARAM* p) : PvMask(p) +{ +} + +struct StatChartInfo +{ + std::string name; + std::vector vecAxis; + std::vector> vecItems; + StatChartInfo(std::string name, std::vector axis, std::vector> items) : name(name), vecAxis(axis), vecItems(items) {}; +}; +using VecChartDef = std::vector; +static VecChartDef chartStorageDef = +{ + StatChartInfo {"充放电分析", {"电量(kWh)"}, {{"充电电量", 0}, { "放电电量", 0 }}}, + StatChartInfo {"运行状态分析", {"时长(h)", "次数"}, {{"充电时长", 0}, {"放电时长", 0}, {"故障次数", 0}}}, + StatChartInfo {"电压/电流分析", {"电压(V)", "电流(A)"}, {{"电压", 0}, {"电流", 0}}}, + StatChartInfo {"功率分析", {"功率(kW)"}, {{"功率", 0}}} +}; +static VecChartDef chartSolarDef = +{ + StatChartInfo {"发电电量分析", {"电量(kWh)"}, {{"发电电量", 0}}}, + StatChartInfo {"运行状态分析", {"时长(h)", "次数"}, {{"发电时长", 0}, {"故障次数", 0}}}, + StatChartInfo {"电压/电流分析", {"电压(V)", "电流(A)"}, {{"电压", 0}, {"电流", 0}}}, + StatChartInfo {"功率分析", {"功率(kW)"}, {{"功率", 0}}} +}; +static VecChartDef chartChargeDef = +{ + StatChartInfo {"充电分析", {"电量(kWh)"}, {{"充电电量", 0}}}, + StatChartInfo {"运行状态分析", {"时长(h)", "次数"}, {{"充电时长", 0}, {"充电次数", 0}, {"故障次数", 0}}}, + StatChartInfo {"电压/电流分析", {"电压(V)", "电流(A)"}, {{"电压", 0}, {"电流", 0}}}, + StatChartInfo {"功率分析", {"功率(kW)"}, {{"功率", 0}}} +}; +using VecStatDef = std::vector>; +static VecStatDef statDef = { + {"储能设备运行分析", chartStorageDef}, + {"光伏设备运行分析", chartSolarDef}, + {"充电设备运行分析", chartChargeDef} +}; + +int MaskPageStat::initUI(EPvCode pvcode) +{ + PvApp::label(p, PV_ID_MAIN, 10, 100, 1900, 850, "", QSS_LABEL_BKG_1); + + if (pvcode == EPvCode::MASK_STAT) { pvcode = EPvCode::MASK_STAT_STORAGE; } + std::string curModuleName; + VecChartDef chartDef {}; + + for (int i = 0; i(p, panel, 0, delta, w, h-delta); + this->initChartBar(chart1, vecAxis, vecItems); + } + else if (i == 1) + { + chart2 = std::make_shared(p, panel, 0, delta, w, h-delta); + this->initChartBar(chart2, vecAxis, vecItems); + } + else if (i == 2) + { + chart3 = std::make_shared(p, panel, 0, delta, w, h-delta); + chart3->setBackground(p, 8, 54, 91); + this->initChartCurve(chart3, vecAxis, vecItems); + } + else if (i == 3) + { + chart4 = std::make_shared(p, panel, 0, delta, w, h-delta); + chart4->setBackground(p, 8, 54, 91); + this->initChartCurve(chart4, vecAxis, vecItems); + } + } + } + + // 初始化表格 + { + PvTable::Options option; + auto table = new PvTable(p, 0, 10, 480, 1900, 12, option); + table->addHead({"日期", "设备ID", "设备名称", "设备类型", "充电次数", "放电次数", "故障次数"}); + } + + // + { + + } + + return 0; +} + +void MaskPageStat::initChartBar(std::shared_ptr chart, std::vector& vecAxis, std::vector>& vecItems) +{ + if (!chart) { return; } + for (int pos = 0; possetLabelYLeft(text); + if (pos == 1) chart->setLabelYRight(text); + } + for (int index = 0; indexinsertItem(vecItems[index].first); + } +} + +void MaskPageStat::initChartCurve(std::shared_ptr chart, std::vector& vecAxis, std::vector>& vecItems) +{ + if (!chart) { return; } + for (int pos = 0; possetLabelYLeft(text); + if (pos == 1) chart->setLabelYRight(text); + } + for (int index = 0; indexinsertItem(vecItems[index].second, vecItems[index].first, 100+80*index, 10, 80); + } +} + +EPvCode MaskPageStat::onEventButton(int pvid) +{ + std::string title; + auto iter = mapSubpage_.find(pvid); + if (iter != mapSubpage_.end()) + { + title = iter->second; + return PvApp::getPvCode(title); + } + return EPvCode::NUL; +} \ No newline at end of file diff --git a/src/pv/pages/MaskPageStat.h b/src/pv/pages/MaskPageStat.h new file mode 100644 index 0000000..f641fe8 --- /dev/null +++ b/src/pv/pages/MaskPageStat.h @@ -0,0 +1,26 @@ +#pragma once + +#include "pv/PvApp.h" + +class PvChartBar; +class PvChartCurve; + +class MaskPageStat : public PvMask +{ +public: + MaskPageStat(PARAM* p); + + int initUI(EPvCode pvcode); + + void initChartBar(std::shared_ptr chart, std::vector& vecAxis, std::vector>& vecItems); + void initChartCurve(std::shared_ptr chart, std::vector& vecAxis, std::vector>& vecItems); + + EPvCode onEventButton(int pvid) override; + + std::map mapSubpage_; + + std::shared_ptr chart1; + std::shared_ptr chart2; + std::shared_ptr chart3; + std::shared_ptr chart4; +}; \ No newline at end of file diff --git a/src/pv/pages/MaskPageSysmgr.cpp b/src/pv/pages/MaskPageSysmgr.cpp new file mode 100644 index 0000000..f14f7f6 --- /dev/null +++ b/src/pv/pages/MaskPageSysmgr.cpp @@ -0,0 +1,355 @@ +#include "MaskPageSysmgr.h" +#include "pv/PvTable.h" +#include +#include "database/Dao.h" +#include "pv/PvPopWidget.h" + +static void createPvTable(PARAM* p) +{ + int nRow = 20, nCol = 10; + int id = PvApp::pvid(p); + pvQTable(p, id, 0, nRow, nCol); + pvSetGeometry(p, id, 10, 200, 1900, 700); + + //pvSetWhatsThis() + //pvWhatsThisPrintf() + //pvToolTip() + //pvSetGeometry() + //pvSetMinSize() + //pvSetMaxSize() + //pvMove(); + //pvResize(); + //pvHide(); + //pvShow(); + //pvSetStyleSheet() + //pvPrintfStyleSheet(); + pvSetPaletteBackgroundColor(p, id, 1, 32, 54); + pvSetPaletteForegroundColor(p, id, 0, 255, 0); + //pvSetFontColor() + //pvSetFont() + //pvSetEnabled() + //pvSetFocus() + //pvCopyToClipboard() + //pvSaveAsBmp() + + //pvTablePrintf() + //pvClear(); + //pvSetColumnWidth() + //pvSetRowHeight() + //pvSetWordWrap() + //pvSetTablePixmap() + //pvEnsureCellVisible() + pvSetEditable(p, id, 0); + pvTableSetEnabled(p, id, 1, 0, 0); + + // 设置垂直(vertical)方向表头不可 resize + for (int i = 0; i(p, 0, 10, 160, 1900, 20, option); + table->setOperateCallback([=](int row, int col, std::string text) { this->onCallbackOperate(row, col, text); }); + }; + + void setPage(int pageIndex, int pageSize, int count) {} + + void updateDataFromDB() + { + std::vector result; + PageInfo pageInfo; + this->queryTable(pageInfo, result); + for (int i = 0; irows(); ++i) + { + if (isetRowData(i, result[i]); + } + else + { + table->setRowVisible(i, false); + } + } + } + + virtual void queryTable(PageInfo& pageInfo, std::vector& result) {} + virtual void onCallbackOperate(int row, int col, std::string text) {}; + + int pageIndex {0}; + PvTable::Options option; + std::shared_ptr table; + std::shared_ptr pop; +}; + +class PageUser : public PageTable +{ +public: + PageUser(PARAM* p, EPvCode pvcode) :PageTable(p) + { + table->addHead(DMUser::USER_ID, "用户编号", 180, {}); + table->addHead(DMUser::ACCOUNT, "用户名", 180, {}); + table->addHead(DMUser::NAME, "姓名", 180, {}); + table->addHead(DMUser::GENDER, "性别", 180, {{"1", "男"}, {"0","女"}}); + table->addHead(DMUser::AGE, "年龄", 180, {}); + table->addHead(DMUser::PHONE, "手机号", 180, {}); + table->addHead(DMUser::EMAIL, "邮箱", 180, {}); + table->addHead("role_id", "角色", 180, {}); + table->addHead(DMUser::LOGINTIME, "上次登录时间", 200, {}); + table->addOperate({"编辑"}); + + pop = std::make_shared(p, 700, 500); + pop->show(0); + pop->setCallbackConfirm([=]() { + auto fields = pop->getData(); + XLOGD() << fields.toStr(); + // 保存数据: + DAO::updateUserById(fields); + }); + + int x = 50, y = 100, w=350, h=60; + pop->addParamLineEdit(DMUser::USER_ID, "用户编号", x, y, false); + pop->addParamCombox(DMRole::ROLE_ID, "角 色", x+w, y, {"系统管理员", "运营管理员", "运营人员"}); + pop->addParamLineEdit(DMUser::ACCOUNT, "用 户 名", x, y+=h); + pop->addParamLineEdit(DMUser::NAME, "姓 名", x+w, y); + pop->addParamLineEdit(DMUser::GENDER, "性 别", x, y+=h); + pop->addParamLineEdit(DMUser::AGE, "年 龄", x+w, y); + pop->addParamLineEdit(DMUser::PHONE, "手 机 号", x, y += h); + pop->addParamLineEdit(DMUser::EMAIL, "邮 箱", x+w, y); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::queryUserList(pageInfo, result); + } + void onCallbackOperate(int row, int col, std::string text) + { + if (text == "编辑") + { + pop->show(1); + pop->setTitle("编辑用户信息"); + DataFields fields = table->getRowdata(row); + pop->setData(fields); + } + }; +}; + +class PageRole : public PageTable +{ +public: + PageRole(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMRole::ROLE_ID, "角色编号", 200, {}); + table->addHead(DMRole::NAME, "角色名称", 200, {}); + table->addHead(DMRole::DESCRIBE, "角色描述", 900, {}); + table->addHead(DMRole::IS_OPEN, "是否启用", 200, {{"1", "是"}, {"0", "否"}}); + table->addOperate({"编辑", "设置权限"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::queryRoleList(pageInfo, result); + } +}; + +class PagePermission : public PageTable +{ +public: + PagePermission(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMPermission::PERMISSION_ID,"权限编号", 200, {}); + table->addHead(DMPermission::NAME, "权限名称", 200, {}); + table->addHead(DMPermission::DESCRIBE, "权限描述", 900, {}); + table->addHead(DMPermission::IS_OPEN, "是否启用", 200, {{"1", "是"}, {"0", "否"}}); + table->addOperate({"查看"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::queryPermissionList(pageInfo, result); + } +}; + +class PageStation : public PageTable +{ +public: + PageStation(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMStation::STATION_ID, "场站编号", 200, {}); + table->addHead(DMStation::NAME, "场站名称", 200, {}); + table->addHead(DMStation::ADDRESS, "地址", 200, {}); + table->addHead(DMStation::LONGITUDE, "经度", 200, {}); + table->addHead(DMStation::LATITUDE, "维度", 200, {}); + table->addHead(DMStation::TEL, "电话", 200, {}); + table->addHead(DMStation::STATUS, "状态", 200, {{"0","未启用"}, {"1", "启用"}}); + table->addOperate({"查看", "编辑"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::queryStationList(pageInfo, result); + } +}; + +class PageDevice: public PageTable +{ +public: + PageDevice(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMDevice::DEVICE_ID, "设备编号", 120, {}); + table->addHead(DMDevice::TYPE, "设备类型", 120, {}); + table->addHead(DMDevice::NAME, "设备名称", 180, {}); + table->addHead(DMDevice::CODE, "设备编码", 160, {}); + table->addHead(DMDevice::MODEL, "设备型号", 160, {}); + table->addHead(DMDevice::FACTORY, "厂家", 160, {}); + table->addHead(DMDevice::TEL, "厂家电话", 160, {}); + table->addHead(DMDevice::ATTRS, "设备参数", 460, {}); + table->addHead(DMDevice::IS_OPEN, "是否启用", 120, {{"1", "是"}, {"0", "否"}}); + table->addOperate({"查看", "编辑"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::queryDeviceList(pageInfo, result); + } +}; + +class PagePolicy : public PageTable +{ +public: + PagePolicy(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMPolicy::POLICY_ID, "策略编号", 200, {}); + table->addHead(DMPolicy::TYPE, "策略类型", 200, {}); + table->addHead(DMPolicy::NAME, "策略名称", 200, {}); + table->addHead(DMPolicy::DESCRIBE, "策略描述", 400, {}); + table->addHead(DMPolicy::VALUE, "策略参数", 400, {}); + table->addHead(DMPolicy::IS_OPEN, "是否启用", 200, {{"1", "是"}, {"0", "否"}}); + table->addOperate({"查看", "编辑"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::queryPolicyList(pageInfo, result); + } +}; + +class PageSyslog : public PageTable +{ +public: + PageSyslog(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMSystemLog::LOG_ID, "日志编号", 160, {}); + table->addHead(DMSystemLog::TYPE, "日志类型", 160, {}); + table->addHead(DMSystemLog::USER_ACCOUNT, "用户", 160, {}); + table->addHead(DMSystemLog::CONTENT, "日志详情", 800, {}); + table->addHead(DMSystemLog::STATUS, "状态", 160, {}); + table->addHead(DMSystemLog::CREATE_TIME, "记录时间", 200, {}); + table->addOperate({"查看"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + DAO::querySystemLogList(pageInfo, result); + } +}; + +class PageAlertlog : public PageTable +{ +public: + PageAlertlog(PARAM* p, EPvCode pvcode) : PageTable(p) + { + table->addHead(DMAlertLog::LOG_ID, "日志编号", 160, {}); + table->addHead(DMAlertLog::TYPE, "日志类型", 160, {}); + table->addHead(DMAlertLog::DEVICE_ID, "设备ID", 160, {}); + table->addHead(DMAlertLog::CONTENT, "日志详情", 800, {}); + table->addHead(DMAlertLog::STATUS, "状态", 160, {}); + table->addHead(DMAlertLog::CREATE_TIME, "记录时间", 200, {}); + table->addOperate({"查看"}); + } + void queryTable(PageInfo& pageInfo, std::vector& result) + { + //DAO::queryAlertLogList(pageInfo, result); + } +}; + +MaskPageSysmgr::MaskPageSysmgr(PARAM* p) : PvMask(p) +{ +} + +int MaskPageSysmgr::initUI(EPvCode pvcode) +{ + PvApp::label(p, PV_ID_MAIN, 10, 100, 1900, 850, "", QSS_LABEL_BKG_1); + + if (pvcode == EPvCode::MASK_SYSMGR) { pvcode = EPvCode::MASK_MGR_USER; } + + static std::vector vecPageNames = {"用户管理", "角色管理", "权限管理", "场站管理", "设备管理", "策略管理", "系统日志", "告警日志"}; + for (int i = 0; i(p, pvcode); } + break; + case EPvCode::MASK_MGR_ROLE: { subpage_ = std::make_shared(p, pvcode); } + break; + case EPvCode::MASK_MGR_PERMISSION: { subpage_ = std::make_shared(p, pvcode); } + break; + case EPvCode::MASK_MGR_STATION: { subpage_ = std::make_shared(p, pvcode); } + break; + case EPvCode::MASK_MGR_DEVICE: { subpage_ = std::make_shared(p, pvcode); } + break; + case EPvCode::MASK_MGR_POLICY: { subpage_ = std::make_shared(p, pvcode); } + break; + case EPvCode::MASK_MGR_SYSLOG: { subpage_ = std::make_shared(p, pvcode); } + break; + case EPvCode::MASK_MGR_ALERTLOG: { subpage_ = std::make_shared(p, pvcode); } + break; + default: + { + subpage_ = std::make_shared(p, pvcode); + } break; + } + + std::thread([=]() { + if (subpage_) { subpage_->updateDataFromDB(); } + }).detach(); + + return 0; +} + +EPvCode MaskPageSysmgr::onEventButton(int pvid) +{ + std::string title; + auto iter = mapSubpage_.find(pvid); + if (iter != mapSubpage_.end()) + { + title = iter->second; + return PvApp::getPvCode(title); + } + return EPvCode::NUL; +} \ No newline at end of file diff --git a/src/pv/pages/MaskPageSysmgr.h b/src/pv/pages/MaskPageSysmgr.h new file mode 100644 index 0000000..85a7dee --- /dev/null +++ b/src/pv/pages/MaskPageSysmgr.h @@ -0,0 +1,30 @@ +#pragma once + +#include "pv/PvApp.h" + +class PageTable; + +class MaskPageSysmgr : public PvMask +{ +public: + MaskPageSysmgr(PARAM* p); + int initUI(EPvCode pvcode); + + virtual EPvCode onEventButton(int pvid) override; + + struct { + int activePage = PV_ID_NUL; + int pageUser = PV_ID_NUL; + int pageRole = PV_ID_NUL; + int pagePermission = PV_ID_NUL; + int pageStation = PV_ID_NUL; + int pageDevice = PV_ID_NUL; + int pagePolicy = PV_ID_NUL; + int pageSyslog = PV_ID_NUL; + int pageAlertlog = PV_ID_NUL; + } ui; + + std::shared_ptr subpage_; + + std::map mapSubpage_; +}; \ No newline at end of file diff --git a/src/pv/pvmain.cpp b/src/pv/pvmain.cpp new file mode 100644 index 0000000..fd7f29f --- /dev/null +++ b/src/pv/pvmain.cpp @@ -0,0 +1,112 @@ +#include "pv/PvApp.h" +#include "pv/PvUser.h" +#include "pv/MaskMain.h" + +void pvInitResource(PARAM* p) +{ + pvDownloadFile(p, "assets/pv/bkg.png"); + pvDownloadFile(p, "assets/pv/icon1.png"); + pvDownloadFile(p, "assets/pv/icon2.png"); + pvDownloadFile(p, "assets/pv/icon3.png"); + pvDownloadFile(p, "assets/pv/icon4.png"); + pvDownloadFile(p, "assets/pv/icon5.png"); + pvDownloadFile(p, "assets/pv/bkgBox.png"); + pvDownloadFile(p, "assets/pv/map.png"); + pvDownloadFile(p, "assets/pv/mapMarker.png"); + pvDownloadFile(p, "assets/pv/downFill.png"); +} + +int onPvThreadCleanup(void* ptr) +{ + PARAM* p = (PARAM*)ptr; + return 0; +} + +int pvMain(PARAM* p) +{ + p->sleep = 100; + + // 管理客户端的连接信息 + PvUser pvuser; + PvApp::setPvUser(p, &pvuser); + + // 客户端断开时回调 + pvSetCleanup(p, onPvThreadCleanup, p); + + pvInitResource(p); + EPvCode pvcode = EPvCode::NUL; + + while (1) + { + // 重置控件的ID值 + PvApp::reset(p); + + std::shared_ptr mask; + mask = std::make_shared(p, pvcode); + + // 超过设定数量值的控件将不会显示 + pvStartDefinition(p, 1024); + if (mask) + { + mask->initUI(); + } + pvQLayoutVbox(p, 0, -1); + pvEndDefinition(p); + XLOGD() << "===>>> pvidIndex=" << PvApp::pvid(p); + + + char event[MAX_EVENT_LENGTH]; + char text[MAX_EVENT_LENGTH]; + int pvid; + pvClearMessageQueue(p); + while (1) + { + pvcode = EPvCode::NUL; + pvPollEvent(p, event); + PvEvent pvEventId = static_cast(pvParseEvent(event, &pvid, text)); + if (mask) + { + PvApp::dispatch(p, pvEventId, pvid, text); + + switch (pvEventId) + { + case NULL_EVENT: { + pvcode = mask->onEventNull(pvid); + } break; + case BUTTON_EVENT: { + pvcode = mask->onEventButton(pvid); std::cout << "EVENT: BUTTON\n"; + } break; + case TEXT_EVENT: {} break; + case SLIDER_EVENT: {} break; + case CHECKBOX_EVENT: {} break; + case RADIOBUTTON_EVENT: {} break; + case GL_IDLE_EVENT: {} break; + case GL_PAINT_EVENT: {} break; + case GL_INITIALIZE_EVENT: {} break; + case GL_RESIZE_EVENT: {} break; + case TAB_EVENT: {} break; + case TABLE_CLICKED_EVENT: {} break; + case TABLE_TEXT_EVENT: {} break; + case SELECTION_EVENT: {} break; + case CLIPBOARD_EVENT: {} break; + case BUTTON_PRESSED_EVENT: {} break; + case BUTTON_RELEASED_EVENT: {} break; + case RIGHT_MOUSE_EVENT: {} break; + case KEYBOARD_EVENT: {} break; + case PLOT_MOUSE_MOVED_EVENT: {} break; + case PLOT_MOUSE_PRESSED_EVENT: {} break; + case PLOT_MOUSE_RELEASED_EVENT: {} break; + case USER_EVENT: {} break; + case MOUSE_OVER_EVENT: {} break; + default: {} break; + } + } + + if (pvcode != EPvCode::NUL) + { + std::cout << "mask status: " << (int)pvcode << std::endl; + break; + } + } + } +} \ No newline at end of file diff --git a/src/widgets/WebHandler.cpp b/src/widgets/WebHandler.cpp index 1ceaa87..ebb9319 100644 --- a/src/widgets/WebHandler.cpp +++ b/src/widgets/WebHandler.cpp @@ -122,7 +122,7 @@ int MyWebHandler::insertUser(QVariantMap params) JSgetReqParam("phone", params, fields); JSgetReqParam("email", params, fields); JSgetReqParam("is_open", params, fields); - XLOGD() << "[cppNative] insertUser: params=" << fields.to_str(); + XLOGD() << "[cppNative] insertUser: params=" << fields.toStr(); bool ret = DAO::insertUser(fields); diff --git a/src/widgets/uihelper.cpp b/src/widgets/uihelper.cpp index 56ff645..a71ea9d 100644 --- a/src/widgets/uihelper.cpp +++ b/src/widgets/uihelper.cpp @@ -114,10 +114,10 @@ void QUI::combox(QComboBox& comb, QWidget* parent, int x, int y, int w, int h, s } } -void QUI::lineedit(QLineEdit& line, QWidget* parent, int x, int y, int w, int h) +void QUI::lineedit(QLineEdit& lineEdit, QWidget* parent, int x, int y, int w, int h) { - line.setParent(parent); - line.setGeometry(x, y, w, h); + lineEdit.setParent(parent); + lineEdit.setGeometry(x, y, w, h); } void QUI::setBackground(QWidget* w, std::string name, QColor color, std::string border) diff --git a/src/widgets/uihelper.h b/src/widgets/uihelper.h index bfcc9db..deb7e57 100644 --- a/src/widgets/uihelper.h +++ b/src/widgets/uihelper.h @@ -56,7 +56,7 @@ public: static void combox(QComboBox& comb, QWidget* parent, int x, int y, int w, int h, std::vector items, std::string v=""); - static void lineedit(QLineEdit& line, QWidget* parent, int x, int y, int w, int h); + static void lineedit(QLineEdit& lineEdit, QWidget* parent, int x, int y, int w, int h); static void setBackground(QWidget* w, std::string name, QColor color=QColor(29, 54, 102), std::string border="border-radius:5px;"); };