mirror of
https://github.com/python/cpython.git
synced 2024-11-24 02:15:30 +08:00
Merged revisions 55342-55406 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55360 | guido.van.rossum | 2007-05-15 14:57:59 -0700 (Tue, 15 May 2007) | 2 lines obcheckin. ........ r55361 | guido.van.rossum | 2007-05-15 14:59:18 -0700 (Tue, 15 May 2007) | 2 lines Get rid of strop module. ........ r55367 | brett.cannon | 2007-05-15 21:06:28 -0700 (Tue, 15 May 2007) | 2 lines Remove the 'pure' module. ........ r55369 | brett.cannon | 2007-05-15 21:07:31 -0700 (Tue, 15 May 2007) | 2 lines Remove the lib-old directory (already empty). ........ r55370 | neal.norwitz | 2007-05-15 21:30:40 -0700 (Tue, 15 May 2007) | 1 line Get rid of a bunch more references to strop ........ r55374 | brett.cannon | 2007-05-15 21:39:00 -0700 (Tue, 15 May 2007) | 2 lines Complete the removal of IRIX-specific modules. ........ r55379 | brett.cannon | 2007-05-15 22:31:54 -0700 (Tue, 15 May 2007) | 2 lines Update removed IRIX modules based on what is gone from removing plat-irix6. ........ r55388 | brett.cannon | 2007-05-16 14:34:52 -0700 (Wed, 16 May 2007) | 2 lines Clean up the docstring for the compiler resource. ........ r55406 | brett.cannon | 2007-05-17 11:05:37 -0700 (Thu, 17 May 2007) | 2 lines Remove BaseException.message (deprecated in Python 2.6). ........
This commit is contained in:
parent
e35553e24c
commit
ebe3e16600
@ -47,10 +47,7 @@ PyAPI_FUNC(long) PyInt_GetMax(void);
|
||||
#define PyInt_AS_LONG(op) PyLong_AsLong(op)
|
||||
|
||||
/* These aren't really part of the Int object, but they're handy; the protos
|
||||
* are necessary for systems that need the magic of PyAPI_FUNC and that want
|
||||
* to have stropmodule as a dynamically loaded module instead of building it
|
||||
* into the main Python shared library/DLL. Guido thinks I'm weird for
|
||||
* building it this way. :-) [cjh]
|
||||
* are necessary for systems that need the magic of PyAPI_FUNC.
|
||||
*/
|
||||
PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
|
||||
PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
|
||||
|
@ -10,14 +10,12 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
} PyBaseExceptionObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *msg;
|
||||
PyObject *filename;
|
||||
PyObject *lineno;
|
||||
@ -30,7 +28,6 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *encoding;
|
||||
PyObject *object;
|
||||
PyObject *start;
|
||||
@ -42,7 +39,6 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *code;
|
||||
} PySystemExitObject;
|
||||
|
||||
@ -50,7 +46,6 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *myerrno;
|
||||
PyObject *strerror;
|
||||
PyObject *filename;
|
||||
@ -61,7 +56,6 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject *myerrno;
|
||||
PyObject *strerror;
|
||||
PyObject *filename;
|
||||
|
@ -1,61 +0,0 @@
|
||||
RATE_48000 = 48000
|
||||
RATE_44100 = 44100
|
||||
RATE_32000 = 32000
|
||||
RATE_22050 = 22050
|
||||
RATE_16000 = 16000
|
||||
RATE_11025 = 11025
|
||||
RATE_8000 = 8000
|
||||
|
||||
SAMPFMT_TWOSCOMP= 1
|
||||
SAMPFMT_FLOAT = 32
|
||||
SAMPFMT_DOUBLE = 64
|
||||
|
||||
SAMPLE_8 = 1
|
||||
SAMPLE_16 = 2
|
||||
# SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits
|
||||
SAMPLE_24 = 4
|
||||
|
||||
MONO = 1
|
||||
STEREO = 2
|
||||
QUADRO = 4 # 4CHANNEL is not a legal Python name
|
||||
|
||||
INPUT_LINE = 0
|
||||
INPUT_MIC = 1
|
||||
INPUT_DIGITAL = 2
|
||||
|
||||
MONITOR_OFF = 0
|
||||
MONITOR_ON = 1
|
||||
|
||||
ERROR_NUMBER = 0
|
||||
ERROR_TYPE = 1
|
||||
ERROR_LOCATION_LSP = 2
|
||||
ERROR_LOCATION_MSP = 3
|
||||
ERROR_LENGTH = 4
|
||||
|
||||
ERROR_INPUT_UNDERFLOW = 0
|
||||
ERROR_OUTPUT_OVERFLOW = 1
|
||||
|
||||
# These seem to be not supported anymore:
|
||||
##HOLD, RELEASE = 0, 1
|
||||
##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3
|
||||
|
||||
DEFAULT_DEVICE = 1
|
||||
|
||||
INPUT_SOURCE = 0
|
||||
LEFT_INPUT_ATTEN = 1
|
||||
RIGHT_INPUT_ATTEN = 2
|
||||
INPUT_RATE = 3
|
||||
OUTPUT_RATE = 4
|
||||
LEFT_SPEAKER_GAIN = 5
|
||||
RIGHT_SPEAKER_GAIN = 6
|
||||
INPUT_COUNT = 7
|
||||
OUTPUT_COUNT = 8
|
||||
UNUSED_COUNT = 9
|
||||
SYNC_INPUT_TO_AES = 10
|
||||
SYNC_OUTPUT_TO_AES = 11
|
||||
MONITOR_CTL = 12
|
||||
LEFT_MONITOR_ATTEN = 13
|
||||
RIGHT_MONITOR_ATTEN = 14
|
||||
|
||||
ENUM_VALUE = 0 # only certain values are valid
|
||||
RANGE_VALUE = 1 # any value in range is valid
|
@ -1,34 +0,0 @@
|
||||
ERROR = 0
|
||||
NODISC = 1
|
||||
READY = 2
|
||||
PLAYING = 3
|
||||
PAUSED = 4
|
||||
STILL = 5
|
||||
|
||||
AUDIO = 0
|
||||
PNUM = 1
|
||||
INDEX = 2
|
||||
PTIME = 3
|
||||
ATIME = 4
|
||||
CATALOG = 5
|
||||
IDENT = 6
|
||||
CONTROL = 7
|
||||
|
||||
CDDA_DATASIZE = 2352
|
||||
|
||||
##CDDA_SUBCODESIZE = (sizeof(struct subcodeQ))
|
||||
##CDDA_BLOCKSIZE = (sizeof(struct cdframe))
|
||||
##CDDA_NUMSAMPLES = (CDDA_DATASIZE/2)
|
||||
##
|
||||
##CDQ_PREEMP_MASK = 0xd
|
||||
##CDQ_COPY_MASK = 0xb
|
||||
##CDQ_DDATA_MASK = 0xd
|
||||
##CDQ_BROADCAST_MASK = 0x8
|
||||
##CDQ_PREEMPHASIS = 0x1
|
||||
##CDQ_COPY_PERMITTED = 0x2
|
||||
##CDQ_DIGITAL_DATA = 0x4
|
||||
##CDQ_BROADCAST_USE = 0x8
|
||||
##
|
||||
##CDQ_MODE1 = 0x1
|
||||
##CDQ_MODE2 = 0x2
|
||||
##CDQ_MODE3 = 0x3
|
@ -1,24 +0,0 @@
|
||||
# Backward compatible module CL.
|
||||
# All relevant symbols are now defined in the module cl.
|
||||
try:
|
||||
from cl import *
|
||||
except ImportError:
|
||||
from CL_old import *
|
||||
else:
|
||||
del CompressImage
|
||||
del DecompressImage
|
||||
del GetAlgorithmName
|
||||
del OpenCompressor
|
||||
del OpenDecompressor
|
||||
del QueryAlgorithms
|
||||
del QueryMaxHeaderSize
|
||||
del QueryScheme
|
||||
del QuerySchemeFromName
|
||||
del SetDefault
|
||||
del SetMax
|
||||
del SetMin
|
||||
try:
|
||||
del cvt_type
|
||||
except NameError:
|
||||
pass
|
||||
del error
|
@ -1,400 +0,0 @@
|
||||
NULLDEV = 0
|
||||
BUTOFFSET = 1
|
||||
VALOFFSET = 256
|
||||
PSEUDOFFSET = 512
|
||||
BUT2OFFSET = 3840
|
||||
TIMOFFSET = 515
|
||||
XKBDOFFSET = 143
|
||||
BUTCOUNT = 255
|
||||
VALCOUNT = 256
|
||||
TIMCOUNT = 4
|
||||
XKBDCOUNT = 28
|
||||
USERBUTOFFSET = 4096
|
||||
USERVALOFFSET = 12288
|
||||
USERPSEUDOFFSET = 16384
|
||||
BUT0 = 1
|
||||
BUT1 = 2
|
||||
BUT2 = 3
|
||||
BUT3 = 4
|
||||
BUT4 = 5
|
||||
BUT5 = 6
|
||||
BUT6 = 7
|
||||
BUT7 = 8
|
||||
BUT8 = 9
|
||||
BUT9 = 10
|
||||
BUT10 = 11
|
||||
BUT11 = 12
|
||||
BUT12 = 13
|
||||
BUT13 = 14
|
||||
BUT14 = 15
|
||||
BUT15 = 16
|
||||
BUT16 = 17
|
||||
BUT17 = 18
|
||||
BUT18 = 19
|
||||
BUT19 = 20
|
||||
BUT20 = 21
|
||||
BUT21 = 22
|
||||
BUT22 = 23
|
||||
BUT23 = 24
|
||||
BUT24 = 25
|
||||
BUT25 = 26
|
||||
BUT26 = 27
|
||||
BUT27 = 28
|
||||
BUT28 = 29
|
||||
BUT29 = 30
|
||||
BUT30 = 31
|
||||
BUT31 = 32
|
||||
BUT32 = 33
|
||||
BUT33 = 34
|
||||
BUT34 = 35
|
||||
BUT35 = 36
|
||||
BUT36 = 37
|
||||
BUT37 = 38
|
||||
BUT38 = 39
|
||||
BUT39 = 40
|
||||
BUT40 = 41
|
||||
BUT41 = 42
|
||||
BUT42 = 43
|
||||
BUT43 = 44
|
||||
BUT44 = 45
|
||||
BUT45 = 46
|
||||
BUT46 = 47
|
||||
BUT47 = 48
|
||||
BUT48 = 49
|
||||
BUT49 = 50
|
||||
BUT50 = 51
|
||||
BUT51 = 52
|
||||
BUT52 = 53
|
||||
BUT53 = 54
|
||||
BUT54 = 55
|
||||
BUT55 = 56
|
||||
BUT56 = 57
|
||||
BUT57 = 58
|
||||
BUT58 = 59
|
||||
BUT59 = 60
|
||||
BUT60 = 61
|
||||
BUT61 = 62
|
||||
BUT62 = 63
|
||||
BUT63 = 64
|
||||
BUT64 = 65
|
||||
BUT65 = 66
|
||||
BUT66 = 67
|
||||
BUT67 = 68
|
||||
BUT68 = 69
|
||||
BUT69 = 70
|
||||
BUT70 = 71
|
||||
BUT71 = 72
|
||||
BUT72 = 73
|
||||
BUT73 = 74
|
||||
BUT74 = 75
|
||||
BUT75 = 76
|
||||
BUT76 = 77
|
||||
BUT77 = 78
|
||||
BUT78 = 79
|
||||
BUT79 = 80
|
||||
BUT80 = 81
|
||||
BUT81 = 82
|
||||
BUT82 = 83
|
||||
MAXKBDBUT = 83
|
||||
BUT100 = 101
|
||||
BUT101 = 102
|
||||
BUT102 = 103
|
||||
BUT103 = 104
|
||||
BUT104 = 105
|
||||
BUT105 = 106
|
||||
BUT106 = 107
|
||||
BUT107 = 108
|
||||
BUT108 = 109
|
||||
BUT109 = 110
|
||||
BUT110 = 111
|
||||
BUT111 = 112
|
||||
BUT112 = 113
|
||||
BUT113 = 114
|
||||
BUT114 = 115
|
||||
BUT115 = 116
|
||||
BUT116 = 117
|
||||
BUT117 = 118
|
||||
BUT118 = 119
|
||||
BUT119 = 120
|
||||
BUT120 = 121
|
||||
BUT121 = 122
|
||||
BUT122 = 123
|
||||
BUT123 = 124
|
||||
BUT124 = 125
|
||||
BUT125 = 126
|
||||
BUT126 = 127
|
||||
BUT127 = 128
|
||||
BUT128 = 129
|
||||
BUT129 = 130
|
||||
BUT130 = 131
|
||||
BUT131 = 132
|
||||
BUT132 = 133
|
||||
BUT133 = 134
|
||||
BUT134 = 135
|
||||
BUT135 = 136
|
||||
BUT136 = 137
|
||||
BUT137 = 138
|
||||
BUT138 = 139
|
||||
BUT139 = 140
|
||||
BUT140 = 141
|
||||
BUT141 = 142
|
||||
BUT142 = 143
|
||||
BUT143 = 144
|
||||
BUT144 = 145
|
||||
BUT145 = 146
|
||||
BUT146 = 147
|
||||
BUT147 = 148
|
||||
BUT148 = 149
|
||||
BUT149 = 150
|
||||
BUT150 = 151
|
||||
BUT151 = 152
|
||||
BUT152 = 153
|
||||
BUT153 = 154
|
||||
BUT154 = 155
|
||||
BUT155 = 156
|
||||
BUT156 = 157
|
||||
BUT157 = 158
|
||||
BUT158 = 159
|
||||
BUT159 = 160
|
||||
BUT160 = 161
|
||||
BUT161 = 162
|
||||
BUT162 = 163
|
||||
BUT163 = 164
|
||||
BUT164 = 165
|
||||
BUT165 = 166
|
||||
BUT166 = 167
|
||||
BUT167 = 168
|
||||
BUT168 = 169
|
||||
BUT181 = 182
|
||||
BUT182 = 183
|
||||
BUT183 = 184
|
||||
BUT184 = 185
|
||||
BUT185 = 186
|
||||
BUT186 = 187
|
||||
BUT187 = 188
|
||||
BUT188 = 189
|
||||
BUT189 = 190
|
||||
MOUSE1 = 101
|
||||
MOUSE2 = 102
|
||||
MOUSE3 = 103
|
||||
LEFTMOUSE = 103
|
||||
MIDDLEMOUSE = 102
|
||||
RIGHTMOUSE = 101
|
||||
LPENBUT = 104
|
||||
BPAD0 = 105
|
||||
BPAD1 = 106
|
||||
BPAD2 = 107
|
||||
BPAD3 = 108
|
||||
LPENVALID = 109
|
||||
SWBASE = 111
|
||||
SW0 = 111
|
||||
SW1 = 112
|
||||
SW2 = 113
|
||||
SW3 = 114
|
||||
SW4 = 115
|
||||
SW5 = 116
|
||||
SW6 = 117
|
||||
SW7 = 118
|
||||
SW8 = 119
|
||||
SW9 = 120
|
||||
SW10 = 121
|
||||
SW11 = 122
|
||||
SW12 = 123
|
||||
SW13 = 124
|
||||
SW14 = 125
|
||||
SW15 = 126
|
||||
SW16 = 127
|
||||
SW17 = 128
|
||||
SW18 = 129
|
||||
SW19 = 130
|
||||
SW20 = 131
|
||||
SW21 = 132
|
||||
SW22 = 133
|
||||
SW23 = 134
|
||||
SW24 = 135
|
||||
SW25 = 136
|
||||
SW26 = 137
|
||||
SW27 = 138
|
||||
SW28 = 139
|
||||
SW29 = 140
|
||||
SW30 = 141
|
||||
SW31 = 142
|
||||
SBBASE = 182
|
||||
SBPICK = 182
|
||||
SBBUT1 = 183
|
||||
SBBUT2 = 184
|
||||
SBBUT3 = 185
|
||||
SBBUT4 = 186
|
||||
SBBUT5 = 187
|
||||
SBBUT6 = 188
|
||||
SBBUT7 = 189
|
||||
SBBUT8 = 190
|
||||
AKEY = 11
|
||||
BKEY = 36
|
||||
CKEY = 28
|
||||
DKEY = 18
|
||||
EKEY = 17
|
||||
FKEY = 19
|
||||
GKEY = 26
|
||||
HKEY = 27
|
||||
IKEY = 40
|
||||
JKEY = 34
|
||||
KKEY = 35
|
||||
LKEY = 42
|
||||
MKEY = 44
|
||||
NKEY = 37
|
||||
OKEY = 41
|
||||
PKEY = 48
|
||||
QKEY = 10
|
||||
RKEY = 24
|
||||
SKEY = 12
|
||||
TKEY = 25
|
||||
UKEY = 33
|
||||
VKEY = 29
|
||||
WKEY = 16
|
||||
XKEY = 21
|
||||
YKEY = 32
|
||||
ZKEY = 20
|
||||
ZEROKEY = 46
|
||||
ONEKEY = 8
|
||||
TWOKEY = 14
|
||||
THREEKEY = 15
|
||||
FOURKEY = 22
|
||||
FIVEKEY = 23
|
||||
SIXKEY = 30
|
||||
SEVENKEY = 31
|
||||
EIGHTKEY = 38
|
||||
NINEKEY = 39
|
||||
BREAKKEY = 1
|
||||
SETUPKEY = 2
|
||||
CTRLKEY = 3
|
||||
LEFTCTRLKEY = CTRLKEY
|
||||
CAPSLOCKKEY = 4
|
||||
RIGHTSHIFTKEY = 5
|
||||
LEFTSHIFTKEY = 6
|
||||
NOSCRLKEY = 13
|
||||
ESCKEY = 7
|
||||
TABKEY = 9
|
||||
RETKEY = 51
|
||||
SPACEKEY = 83
|
||||
LINEFEEDKEY = 60
|
||||
BACKSPACEKEY = 61
|
||||
DELKEY = 62
|
||||
SEMICOLONKEY = 43
|
||||
PERIODKEY = 52
|
||||
COMMAKEY = 45
|
||||
QUOTEKEY = 50
|
||||
ACCENTGRAVEKEY = 55
|
||||
MINUSKEY = 47
|
||||
VIRGULEKEY = 53
|
||||
BACKSLASHKEY = 57
|
||||
EQUALKEY = 54
|
||||
LEFTBRACKETKEY = 49
|
||||
RIGHTBRACKETKEY = 56
|
||||
LEFTARROWKEY = 73
|
||||
DOWNARROWKEY = 74
|
||||
RIGHTARROWKEY = 80
|
||||
UPARROWKEY = 81
|
||||
PAD0 = 59
|
||||
PAD1 = 58
|
||||
PAD2 = 64
|
||||
PAD3 = 65
|
||||
PAD4 = 63
|
||||
PAD5 = 69
|
||||
PAD6 = 70
|
||||
PAD7 = 67
|
||||
PAD8 = 68
|
||||
PAD9 = 75
|
||||
PADPF1 = 72
|
||||
PADPF2 = 71
|
||||
PADPF3 = 79
|
||||
PADPF4 = 78
|
||||
PADPERIOD = 66
|
||||
PADMINUS = 76
|
||||
PADCOMMA = 77
|
||||
PADENTER = 82
|
||||
LEFTALTKEY = 143
|
||||
RIGHTALTKEY = 144
|
||||
RIGHTCTRLKEY = 145
|
||||
F1KEY = 146
|
||||
F2KEY = 147
|
||||
F3KEY = 148
|
||||
F4KEY = 149
|
||||
F5KEY = 150
|
||||
F6KEY = 151
|
||||
F7KEY = 152
|
||||
F8KEY = 153
|
||||
F9KEY = 154
|
||||
F10KEY = 155
|
||||
F11KEY = 156
|
||||
F12KEY = 157
|
||||
PRINTSCREENKEY = 158
|
||||
SCROLLLOCKKEY = 159
|
||||
PAUSEKEY = 160
|
||||
INSERTKEY = 161
|
||||
HOMEKEY = 162
|
||||
PAGEUPKEY = 163
|
||||
ENDKEY = 164
|
||||
PAGEDOWNKEY = 165
|
||||
NUMLOCKKEY = 166
|
||||
PADVIRGULEKEY = 167
|
||||
PADASTERKEY = 168
|
||||
PADPLUSKEY = 169
|
||||
SGIRESERVED = 256
|
||||
DIAL0 = 257
|
||||
DIAL1 = 258
|
||||
DIAL2 = 259
|
||||
DIAL3 = 260
|
||||
DIAL4 = 261
|
||||
DIAL5 = 262
|
||||
DIAL6 = 263
|
||||
DIAL7 = 264
|
||||
DIAL8 = 265
|
||||
MOUSEX = 266
|
||||
MOUSEY = 267
|
||||
LPENX = 268
|
||||
LPENY = 269
|
||||
BPADX = 270
|
||||
BPADY = 271
|
||||
CURSORX = 272
|
||||
CURSORY = 273
|
||||
GHOSTX = 274
|
||||
GHOSTY = 275
|
||||
SBTX = 276
|
||||
SBTY = 277
|
||||
SBTZ = 278
|
||||
SBRX = 279
|
||||
SBRY = 280
|
||||
SBRZ = 281
|
||||
SBPERIOD = 282
|
||||
TIMER0 = 515
|
||||
TIMER1 = 516
|
||||
TIMER2 = 517
|
||||
TIMER3 = 518
|
||||
KEYBD = 513
|
||||
RAWKEYBD = 514
|
||||
VALMARK = 523
|
||||
REDRAW = 528
|
||||
INPUTCHANGE = 534
|
||||
QFULL = 535
|
||||
QREADERROR = 538
|
||||
WINFREEZE = 539
|
||||
WINTHAW = 540
|
||||
REDRAWICONIC = 541
|
||||
WINQUIT = 542
|
||||
DEPTHCHANGE = 543
|
||||
WINSHUT = 546
|
||||
DRAWOVERLAY = 547
|
||||
VIDEO = 548
|
||||
MENUBUTTON = RIGHTMOUSE
|
||||
WINCLOSE = 537
|
||||
KEYBDFNAMES = 544
|
||||
KEYBDFSTRINGS = 545
|
||||
MAXSGIDEVICE = 20000
|
||||
GERROR = 524
|
||||
WMSEND = 529
|
||||
WMREPLY = 530
|
||||
WMGFCLOSE = 531
|
||||
WMTXCLOSE = 532
|
||||
MODECHANGE = 533
|
||||
PIECECHANGE = 536
|
@ -1,180 +0,0 @@
|
||||
# Generated by h2py from /usr/include/errno.h
|
||||
|
||||
# Included from sys/errno.h
|
||||
|
||||
# Included from standards.h
|
||||
__KBASE = 1000
|
||||
__IRIXBASE = 1000
|
||||
__FTNBASE = 4000
|
||||
__FTNLAST = 5999
|
||||
EPERM = 1
|
||||
ENOENT = 2
|
||||
ESRCH = 3
|
||||
EINTR = 4
|
||||
EIO = 5
|
||||
ENXIO = 6
|
||||
E2BIG = 7
|
||||
ENOEXEC = 8
|
||||
EBADF = 9
|
||||
ECHILD = 10
|
||||
EAGAIN = 11
|
||||
ENOMEM = 12
|
||||
EACCES = 13
|
||||
EFAULT = 14
|
||||
ENOTBLK = 15
|
||||
EBUSY = 16
|
||||
EEXIST = 17
|
||||
EXDEV = 18
|
||||
ENODEV = 19
|
||||
ENOTDIR = 20
|
||||
EISDIR = 21
|
||||
EINVAL = 22
|
||||
ENFILE = 23
|
||||
EMFILE = 24
|
||||
ENOTTY = 25
|
||||
ETXTBSY = 26
|
||||
EFBIG = 27
|
||||
ENOSPC = 28
|
||||
ESPIPE = 29
|
||||
EROFS = 30
|
||||
EMLINK = 31
|
||||
EPIPE = 32
|
||||
EDOM = 33
|
||||
ERANGE = 34
|
||||
ENOMSG = 35
|
||||
EIDRM = 36
|
||||
ECHRNG = 37
|
||||
EL2NSYNC = 38
|
||||
EL3HLT = 39
|
||||
EL3RST = 40
|
||||
ELNRNG = 41
|
||||
EUNATCH = 42
|
||||
ENOCSI = 43
|
||||
EL2HLT = 44
|
||||
EDEADLK = 45
|
||||
ENOLCK = 46
|
||||
ECKPT = 47
|
||||
EBADE = 50
|
||||
EBADR = 51
|
||||
EXFULL = 52
|
||||
ENOANO = 53
|
||||
EBADRQC = 54
|
||||
EBADSLT = 55
|
||||
EDEADLOCK = 56
|
||||
EBFONT = 57
|
||||
ENOSTR = 60
|
||||
ENODATA = 61
|
||||
ETIME = 62
|
||||
ENOSR = 63
|
||||
ENONET = 64
|
||||
ENOPKG = 65
|
||||
EREMOTE = 66
|
||||
ENOLINK = 67
|
||||
EADV = 68
|
||||
ESRMNT = 69
|
||||
ECOMM = 70
|
||||
EPROTO = 71
|
||||
EMULTIHOP = 74
|
||||
EBADMSG = 77
|
||||
ENAMETOOLONG = 78
|
||||
EOVERFLOW = 79
|
||||
ENOTUNIQ = 80
|
||||
EBADFD = 81
|
||||
EREMCHG = 82
|
||||
ELIBACC = 83
|
||||
ELIBBAD = 84
|
||||
ELIBSCN = 85
|
||||
ELIBMAX = 86
|
||||
ELIBEXEC = 87
|
||||
EILSEQ = 88
|
||||
ENOSYS = 89
|
||||
ELOOP = 90
|
||||
ERESTART = 91
|
||||
ESTRPIPE = 92
|
||||
ENOTEMPTY = 93
|
||||
EUSERS = 94
|
||||
ENOTSOCK = 95
|
||||
EDESTADDRREQ = 96
|
||||
EMSGSIZE = 97
|
||||
EPROTOTYPE = 98
|
||||
ENOPROTOOPT = 99
|
||||
EPROTONOSUPPORT = 120
|
||||
ESOCKTNOSUPPORT = 121
|
||||
EOPNOTSUPP = 122
|
||||
EPFNOSUPPORT = 123
|
||||
EAFNOSUPPORT = 124
|
||||
EADDRINUSE = 125
|
||||
EADDRNOTAVAIL = 126
|
||||
ENETDOWN = 127
|
||||
ENETUNREACH = 128
|
||||
ENETRESET = 129
|
||||
ECONNABORTED = 130
|
||||
ECONNRESET = 131
|
||||
ENOBUFS = 132
|
||||
EISCONN = 133
|
||||
ENOTCONN = 134
|
||||
ESHUTDOWN = 143
|
||||
ETOOMANYREFS = 144
|
||||
ETIMEDOUT = 145
|
||||
ECONNREFUSED = 146
|
||||
EHOSTDOWN = 147
|
||||
EHOSTUNREACH = 148
|
||||
LASTERRNO = ENOTCONN
|
||||
EWOULDBLOCK = __KBASE+101
|
||||
EWOULDBLOCK = EAGAIN
|
||||
EALREADY = 149
|
||||
EINPROGRESS = 150
|
||||
ESTALE = 151
|
||||
EIORESID = 500
|
||||
EUCLEAN = 135
|
||||
ENOTNAM = 137
|
||||
ENAVAIL = 138
|
||||
EISNAM = 139
|
||||
EREMOTEIO = 140
|
||||
EINIT = 141
|
||||
EREMDEV = 142
|
||||
ECANCELED = 158
|
||||
ENOLIMFILE = 1001
|
||||
EPROCLIM = 1002
|
||||
EDISJOINT = 1003
|
||||
ENOLOGIN = 1004
|
||||
ELOGINLIM = 1005
|
||||
EGROUPLOOP = 1006
|
||||
ENOATTACH = 1007
|
||||
ENOTSUP = 1008
|
||||
ENOATTR = 1009
|
||||
EFSCORRUPTED = 1010
|
||||
EDIRCORRUPTED = 1010
|
||||
EWRONGFS = 1011
|
||||
EDQUOT = 1133
|
||||
ENFSREMOTE = 1135
|
||||
ECONTROLLER = 1300
|
||||
ENOTCONTROLLER = 1301
|
||||
EENQUEUED = 1302
|
||||
ENOTENQUEUED = 1303
|
||||
EJOINED = 1304
|
||||
ENOTJOINED = 1305
|
||||
ENOPROC = 1306
|
||||
EMUSTRUN = 1307
|
||||
ENOTSTOPPED = 1308
|
||||
ECLOCKCPU = 1309
|
||||
EINVALSTATE = 1310
|
||||
ENOEXIST = 1311
|
||||
EENDOFMINOR = 1312
|
||||
EBUFSIZE = 1313
|
||||
EEMPTY = 1314
|
||||
ENOINTRGROUP = 1315
|
||||
EINVALMODE = 1316
|
||||
ECANTEXTENT = 1317
|
||||
EINVALTIME = 1318
|
||||
EDESTROYED = 1319
|
||||
EBDHDL = 1400
|
||||
EDELAY = 1401
|
||||
ENOBWD = 1402
|
||||
EBADRSPEC = 1403
|
||||
EBADTSPEC = 1404
|
||||
EBADFILT = 1405
|
||||
EMIGRATED = 1500
|
||||
EMIGRATING = 1501
|
||||
ECELLDOWN = 1502
|
||||
EMEMRETRY = 1600
|
@ -1,674 +0,0 @@
|
||||
# Generated by h2py from /usr/include/sys/file.h
|
||||
|
||||
# Included from standards.h
|
||||
|
||||
# Included from sys/types.h
|
||||
|
||||
# Included from sgidefs.h
|
||||
_MIPS_ISA_MIPS1 = 1
|
||||
_MIPS_ISA_MIPS2 = 2
|
||||
_MIPS_ISA_MIPS3 = 3
|
||||
_MIPS_ISA_MIPS4 = 4
|
||||
_MIPS_SIM_ABI32 = 1
|
||||
_MIPS_SIM_NABI32 = 2
|
||||
_MIPS_SIM_ABI64 = 3
|
||||
|
||||
# Included from sys/pthread.h
|
||||
P_MYID = (-1)
|
||||
P_MYHOSTID = (-1)
|
||||
|
||||
# Included from sys/bsd_types.h
|
||||
|
||||
# Included from sys/mkdev.h
|
||||
ONBITSMAJOR = 7
|
||||
ONBITSMINOR = 8
|
||||
OMAXMAJ = 0x7f
|
||||
OMAXMIN = 0xff
|
||||
NBITSMAJOR = 14
|
||||
NBITSMINOR = 18
|
||||
MAXMAJ = 0x1ff
|
||||
MAXMIN = 0x3ffff
|
||||
OLDDEV = 0
|
||||
NEWDEV = 1
|
||||
MKDEV_VER = NEWDEV
|
||||
def IS_STRING_SPEC_DEV(x): return ((dev_t)(x)==__makedev(MKDEV_VER, 0, 0))
|
||||
|
||||
def major(dev): return __major(MKDEV_VER, dev)
|
||||
|
||||
def minor(dev): return __minor(MKDEV_VER, dev)
|
||||
|
||||
|
||||
# Included from sys/select.h
|
||||
FD_SETSIZE = 1024
|
||||
__NBBY = 8
|
||||
|
||||
# Included from string.h
|
||||
NULL = 0
|
||||
NBBY = 8
|
||||
|
||||
# Included from sys/cpumask.h
|
||||
MAXCPU = 128
|
||||
def CPUMASK_INDEX(bit): return ((bit) >> 6)
|
||||
|
||||
def CPUMASK_SHFT(bit): return ((bit) & 0x3f)
|
||||
|
||||
def CPUMASK_IS_ZERO(p): return ((p) == 0)
|
||||
|
||||
def CPUMASK_IS_NONZERO(p): return ((p) != 0)
|
||||
|
||||
|
||||
# Included from sys/nodemask.h
|
||||
def CNODEMASK_IS_ZERO(p): return ((p) == 0)
|
||||
|
||||
def CNODEMASK_IS_NONZERO(p): return ((p) != 0)
|
||||
|
||||
|
||||
# Included from sys/sema.h
|
||||
|
||||
# Included from sys/timespec.h
|
||||
|
||||
# Included from sys/param.h
|
||||
|
||||
# Included from sys/signal.h
|
||||
SIGHUP = 1
|
||||
SIGINT = 2
|
||||
SIGQUIT = 3
|
||||
SIGILL = 4
|
||||
SIGTRAP = 5
|
||||
SIGIOT = 6
|
||||
SIGABRT = 6
|
||||
SIGEMT = 7
|
||||
SIGFPE = 8
|
||||
SIGKILL = 9
|
||||
SIGBUS = 10
|
||||
SIGSEGV = 11
|
||||
SIGSYS = 12
|
||||
SIGPIPE = 13
|
||||
SIGALRM = 14
|
||||
SIGTERM = 15
|
||||
SIGUSR1 = 16
|
||||
SIGUSR2 = 17
|
||||
SIGCLD = 18
|
||||
SIGCHLD = 18
|
||||
SIGPWR = 19
|
||||
SIGWINCH = 20
|
||||
SIGURG = 21
|
||||
SIGPOLL = 22
|
||||
SIGIO = 22
|
||||
SIGSTOP = 23
|
||||
SIGTSTP = 24
|
||||
SIGCONT = 25
|
||||
SIGTTIN = 26
|
||||
SIGTTOU = 27
|
||||
SIGVTALRM = 28
|
||||
SIGPROF = 29
|
||||
SIGXCPU = 30
|
||||
SIGXFSZ = 31
|
||||
SIGK32 = 32
|
||||
SIGCKPT = 33
|
||||
SIGRESTART = 34
|
||||
SIGUME = 35
|
||||
SIGPTINTR = 47
|
||||
SIGPTRESCHED = 48
|
||||
SIGRTMIN = 49
|
||||
SIGRTMAX = 64
|
||||
__sigargs = int
|
||||
|
||||
# Included from sys/sigevent.h
|
||||
SIGEV_NONE = 128
|
||||
SIGEV_SIGNAL = 129
|
||||
SIGEV_CALLBACK = 130
|
||||
SIGEV_THREAD = 131
|
||||
|
||||
# Included from sys/siginfo.h
|
||||
SI_MAXSZ = 128
|
||||
SI_USER = 0
|
||||
SI_KILL = SI_USER
|
||||
SI_QUEUE = -1
|
||||
SI_ASYNCIO = -2
|
||||
SI_TIMER = -3
|
||||
SI_MESGQ = -4
|
||||
ILL_ILLOPC = 1
|
||||
ILL_ILLOPN = 2
|
||||
ILL_ILLADR = 3
|
||||
ILL_ILLTRP = 4
|
||||
ILL_PRVOPC = 5
|
||||
ILL_PRVREG = 6
|
||||
ILL_COPROC = 7
|
||||
ILL_BADSTK = 8
|
||||
NSIGILL = 8
|
||||
FPE_INTDIV = 1
|
||||
FPE_INTOVF = 2
|
||||
FPE_FLTDIV = 3
|
||||
FPE_FLTOVF = 4
|
||||
FPE_FLTUND = 5
|
||||
FPE_FLTRES = 6
|
||||
FPE_FLTINV = 7
|
||||
FPE_FLTSUB = 8
|
||||
NSIGFPE = 8
|
||||
SEGV_MAPERR = 1
|
||||
SEGV_ACCERR = 2
|
||||
NSIGSEGV = 2
|
||||
BUS_ADRALN = 1
|
||||
BUS_ADRERR = 2
|
||||
BUS_OBJERR = 3
|
||||
NSIGBUS = 3
|
||||
TRAP_BRKPT = 1
|
||||
TRAP_TRACE = 2
|
||||
NSIGTRAP = 2
|
||||
CLD_EXITED = 1
|
||||
CLD_KILLED = 2
|
||||
CLD_DUMPED = 3
|
||||
CLD_TRAPPED = 4
|
||||
CLD_STOPPED = 5
|
||||
CLD_CONTINUED = 6
|
||||
NSIGCLD = 6
|
||||
POLL_IN = 1
|
||||
POLL_OUT = 2
|
||||
POLL_MSG = 3
|
||||
POLL_ERR = 4
|
||||
POLL_PRI = 5
|
||||
POLL_HUP = 6
|
||||
NSIGPOLL = 6
|
||||
UME_ECCERR = 1
|
||||
NSIGUME = 1
|
||||
SIG_NOP = 0
|
||||
SIG_BLOCK = 1
|
||||
SIG_UNBLOCK = 2
|
||||
SIG_SETMASK = 3
|
||||
SIG_SETMASK32 = 256
|
||||
SA_ONSTACK = 0x00000001
|
||||
SA_RESETHAND = 0x00000002
|
||||
SA_RESTART = 0x00000004
|
||||
SA_SIGINFO = 0x00000008
|
||||
SA_NODEFER = 0x00000010
|
||||
SA_NOCLDWAIT = 0x00010000
|
||||
SA_NOCLDSTOP = 0x00020000
|
||||
_SA_BSDCALL = 0x10000000
|
||||
MINSIGSTKSZ = 512
|
||||
SIGSTKSZ = 8192
|
||||
SS_ONSTACK = 0x00000001
|
||||
SS_DISABLE = 0x00000002
|
||||
|
||||
# Included from sys/ucontext.h
|
||||
NGREG = 36
|
||||
NGREG = 37
|
||||
GETCONTEXT = 0
|
||||
SETCONTEXT = 1
|
||||
UC_SIGMASK = 001
|
||||
UC_STACK = 002
|
||||
UC_CPU = 004
|
||||
UC_MAU = 010
|
||||
UC_MCONTEXT = (UC_CPU|UC_MAU)
|
||||
UC_ALL = (UC_SIGMASK|UC_STACK|UC_MCONTEXT)
|
||||
CTX_R0 = 0
|
||||
CTX_AT = 1
|
||||
CTX_V0 = 2
|
||||
CTX_V1 = 3
|
||||
CTX_A0 = 4
|
||||
CTX_A1 = 5
|
||||
CTX_A2 = 6
|
||||
CTX_A3 = 7
|
||||
CTX_T0 = 8
|
||||
CTX_T1 = 9
|
||||
CTX_T2 = 10
|
||||
CTX_T3 = 11
|
||||
CTX_T4 = 12
|
||||
CTX_T5 = 13
|
||||
CTX_T6 = 14
|
||||
CTX_T7 = 15
|
||||
CTX_A4 = 8
|
||||
CTX_A5 = 9
|
||||
CTX_A6 = 10
|
||||
CTX_A7 = 11
|
||||
CTX_T0 = 12
|
||||
CTX_T1 = 13
|
||||
CTX_T2 = 14
|
||||
CTX_T3 = 15
|
||||
CTX_S0 = 16
|
||||
CTX_S1 = 17
|
||||
CTX_S2 = 18
|
||||
CTX_S3 = 19
|
||||
CTX_S4 = 20
|
||||
CTX_S5 = 21
|
||||
CTX_S6 = 22
|
||||
CTX_S7 = 23
|
||||
CTX_T8 = 24
|
||||
CTX_T9 = 25
|
||||
CTX_K0 = 26
|
||||
CTX_K1 = 27
|
||||
CTX_GP = 28
|
||||
CTX_SP = 29
|
||||
CTX_S8 = 30
|
||||
CTX_RA = 31
|
||||
CTX_MDLO = 32
|
||||
CTX_MDHI = 33
|
||||
CTX_CAUSE = 34
|
||||
CTX_EPC = 35
|
||||
CTX_SR = 36
|
||||
CXT_R0 = CTX_R0
|
||||
CXT_AT = CTX_AT
|
||||
CXT_V0 = CTX_V0
|
||||
CXT_V1 = CTX_V1
|
||||
CXT_A0 = CTX_A0
|
||||
CXT_A1 = CTX_A1
|
||||
CXT_A2 = CTX_A2
|
||||
CXT_A3 = CTX_A3
|
||||
CXT_T0 = CTX_T0
|
||||
CXT_T1 = CTX_T1
|
||||
CXT_T2 = CTX_T2
|
||||
CXT_T3 = CTX_T3
|
||||
CXT_T4 = CTX_T4
|
||||
CXT_T5 = CTX_T5
|
||||
CXT_T6 = CTX_T6
|
||||
CXT_T7 = CTX_T7
|
||||
CXT_S0 = CTX_S0
|
||||
CXT_S1 = CTX_S1
|
||||
CXT_S2 = CTX_S2
|
||||
CXT_S3 = CTX_S3
|
||||
CXT_S4 = CTX_S4
|
||||
CXT_S5 = CTX_S5
|
||||
CXT_S6 = CTX_S6
|
||||
CXT_S7 = CTX_S7
|
||||
CXT_T8 = CTX_T8
|
||||
CXT_T9 = CTX_T9
|
||||
CXT_K0 = CTX_K0
|
||||
CXT_K1 = CTX_K1
|
||||
CXT_GP = CTX_GP
|
||||
CXT_SP = CTX_SP
|
||||
CXT_S8 = CTX_S8
|
||||
CXT_RA = CTX_RA
|
||||
CXT_MDLO = CTX_MDLO
|
||||
CXT_MDHI = CTX_MDHI
|
||||
CXT_CAUSE = CTX_CAUSE
|
||||
CXT_EPC = CTX_EPC
|
||||
CXT_SR = CTX_SR
|
||||
CTX_FV0 = 0
|
||||
CTX_FV1 = 2
|
||||
CTX_FA0 = 12
|
||||
CTX_FA1 = 13
|
||||
CTX_FA2 = 14
|
||||
CTX_FA3 = 15
|
||||
CTX_FA4 = 16
|
||||
CTX_FA5 = 17
|
||||
CTX_FA6 = 18
|
||||
CTX_FA7 = 19
|
||||
CTX_FT0 = 4
|
||||
CTX_FT1 = 5
|
||||
CTX_FT2 = 6
|
||||
CTX_FT3 = 7
|
||||
CTX_FT4 = 8
|
||||
CTX_FT5 = 9
|
||||
CTX_FT6 = 10
|
||||
CTX_FT7 = 11
|
||||
CTX_FT8 = 20
|
||||
CTX_FT9 = 21
|
||||
CTX_FT10 = 22
|
||||
CTX_FT11 = 23
|
||||
CTX_FT12 = 1
|
||||
CTX_FT13 = 3
|
||||
CTX_FS0 = 24
|
||||
CTX_FS1 = 25
|
||||
CTX_FS2 = 26
|
||||
CTX_FS3 = 27
|
||||
CTX_FS4 = 28
|
||||
CTX_FS5 = 29
|
||||
CTX_FS6 = 30
|
||||
CTX_FS7 = 31
|
||||
CTX_FT8 = 21
|
||||
CTX_FT9 = 23
|
||||
CTX_FT10 = 25
|
||||
CTX_FT11 = 27
|
||||
CTX_FT12 = 29
|
||||
CTX_FT13 = 31
|
||||
CTX_FT14 = 1
|
||||
CTX_FT15 = 3
|
||||
CTX_FS0 = 20
|
||||
CTX_FS1 = 22
|
||||
CTX_FS2 = 24
|
||||
CTX_FS3 = 26
|
||||
CTX_FS4 = 28
|
||||
CTX_FS5 = 30
|
||||
SV_ONSTACK = 0x0001
|
||||
SV_INTERRUPT = 0x0002
|
||||
NUMBSDSIGS = (32)
|
||||
def sigmask(sig): return (1 << ((sig)-1))
|
||||
|
||||
def sigmask(sig): return (1 << ((sig)-1))
|
||||
|
||||
SIG_ERR = (-1)
|
||||
SIG_IGN = (1)
|
||||
SIG_HOLD = (2)
|
||||
SIG_DFL = (0)
|
||||
NSIG = 65
|
||||
MAXSIG = (NSIG-1)
|
||||
NUMSIGS = (NSIG-1)
|
||||
BRK_USERBP = 0
|
||||
BRK_KERNELBP = 1
|
||||
BRK_ABORT = 2
|
||||
BRK_BD_TAKEN = 3
|
||||
BRK_BD_NOTTAKEN = 4
|
||||
BRK_SSTEPBP = 5
|
||||
BRK_OVERFLOW = 6
|
||||
BRK_DIVZERO = 7
|
||||
BRK_RANGE = 8
|
||||
BRK_PSEUDO_OP_BIT = 0x80
|
||||
BRK_PSEUDO_OP_MAX = 0x3
|
||||
BRK_CACHE_SYNC = 0x80
|
||||
BRK_MULOVF = 1023
|
||||
_POSIX_VERSION = 199506
|
||||
_POSIX_VERSION = 199506
|
||||
_POSIX_VDISABLE = 0
|
||||
MAX_INPUT = 512
|
||||
MAX_CANON = 256
|
||||
UID_NOBODY = 60001
|
||||
GID_NOBODY = UID_NOBODY
|
||||
UID_NOACCESS = 60002
|
||||
MAXPID = 0x7ffffff0
|
||||
MAXUID = 0x7fffffff
|
||||
MAXLINK = 30000
|
||||
SSIZE = 1
|
||||
SINCR = 1
|
||||
KSTKSIZE = 1
|
||||
EXTKSTKSIZE = 1
|
||||
KSTKIDX = 0
|
||||
KSTEIDX = 1
|
||||
EXTKSTKSIZE = 0
|
||||
KSTKIDX = 0
|
||||
CANBSIZ = 256
|
||||
HZ = 100
|
||||
TICK = 10000000
|
||||
NOFILE = 20
|
||||
NGROUPS_UMIN = 0
|
||||
NGROUPS_UMAX = 32
|
||||
NGROUPS = 16
|
||||
PMASK = 0177
|
||||
PCATCH = 0400
|
||||
PLTWAIT = 01000
|
||||
PRECALC = 01000
|
||||
PSWP = 0
|
||||
PINOD = 10
|
||||
PSNDD = PINOD
|
||||
PRIBIO = 20
|
||||
PZERO = 25
|
||||
PMEM = 0
|
||||
NZERO = 20
|
||||
PPIPE = 26
|
||||
PVFS = 27
|
||||
PWAIT = 30
|
||||
PSLEP = 39
|
||||
PUSER = 60
|
||||
PBATCH_CRITICAL = -1
|
||||
PTIME_SHARE = -2
|
||||
PTIME_SHARE_OVER = -3
|
||||
PBATCH = -4
|
||||
PWEIGHTLESS = -5
|
||||
IO_NBPC = 4096
|
||||
IO_BPCSHIFT = 12
|
||||
MIN_NBPC = 4096
|
||||
MIN_BPCSHIFT = 12
|
||||
MIN_CPSSHIFT = 10
|
||||
BPCSHIFT = 12
|
||||
CPSSHIFT = 10
|
||||
BPCSHIFT = 14
|
||||
CPSSHIFT = 12
|
||||
CPSSHIFT = 11
|
||||
BPSSHIFT = (BPCSHIFT+CPSSHIFT)
|
||||
NULL = 0
|
||||
CMASK = 022
|
||||
NODEV = (-1)
|
||||
NOPAGE = (-1)
|
||||
NBPSCTR = 512
|
||||
SCTRSHFT = 9
|
||||
def BASEPRI(psw): return (((psw) & SR_IMASK) == SR_IMASK0)
|
||||
|
||||
def BASEPRI(psw): return (((psw) & SR_IMASK) == SR_IMASK)
|
||||
|
||||
def USERMODE(psw): return (((psw) & SR_KSU_MSK) == SR_KSU_USR)
|
||||
|
||||
MAXPATHLEN = 1024
|
||||
MAXSYMLINKS = 30
|
||||
MAXNAMELEN = 256
|
||||
PIPE_BUF = 10240
|
||||
PIPE_MAX = 10240
|
||||
NBBY = 8
|
||||
BBSHIFT = 9
|
||||
BBSIZE = (1<<BBSHIFT)
|
||||
BBMASK = (BBSIZE-1)
|
||||
def BBTOB(bbs): return ((bbs) << BBSHIFT)
|
||||
|
||||
def OFFTOBB(bytes): return (((__uint64_t)(bytes) + BBSIZE - 1) >> BBSHIFT)
|
||||
|
||||
def OFFTOBBT(bytes): return ((off_t)(bytes) >> BBSHIFT)
|
||||
|
||||
def BBTOOFF(bbs): return ((off_t)(bbs) << BBSHIFT)
|
||||
|
||||
SEEKLIMIT32 = 0x7fffffff
|
||||
MAXBSIZE = 8192
|
||||
DEV_BSIZE = BBSIZE
|
||||
DEV_BSHIFT = BBSHIFT
|
||||
def btodb(bytes): return \
|
||||
|
||||
def dbtob(db): return \
|
||||
|
||||
BLKDEV_IOSHIFT = BPCSHIFT
|
||||
BLKDEV_IOSIZE = (1<<BLKDEV_IOSHIFT)
|
||||
def BLKDEV_OFF(off): return ((off) & (BLKDEV_IOSIZE - 1))
|
||||
|
||||
def BLKDEV_LBN(off): return ((off) >> BLKDEV_IOSHIFT)
|
||||
|
||||
def BLKDEV_LTOP(bn): return ((bn) * BLKDEV_BB)
|
||||
|
||||
MAXHOSTNAMELEN = 256
|
||||
def DELAY(n): return us_delay(n)
|
||||
|
||||
def DELAYBUS(n): return us_delaybus(n)
|
||||
|
||||
TIMEPOKE_NOW = -100
|
||||
MUTEX_DEFAULT = 0x0
|
||||
METER_NAMSZ = 16
|
||||
METER_NO_SEQ = -1
|
||||
def mutex_spinlock(l): return splhi()
|
||||
|
||||
def mutex_spintrylock(l): return splhi()
|
||||
|
||||
def spinlock_initialized(l): return 1
|
||||
|
||||
SV_FIFO = 0x0
|
||||
SV_LIFO = 0x2
|
||||
SV_PRIO = 0x4
|
||||
SV_KEYED = 0x6
|
||||
SV_DEFAULT = SV_FIFO
|
||||
SEMA_NOHIST = 0x0001
|
||||
SEMA_LOCK = 0x0004
|
||||
NSCHEDCLASS = (-(PWEIGHTLESS)+1)
|
||||
MR_ACCESS = 1
|
||||
MR_UPDATE = 2
|
||||
MRLOCK_BARRIER = 0x1
|
||||
MRLOCK_BEHAVIOR = 0x2
|
||||
MRLOCK_DBLTRIPPABLE = 0x4
|
||||
MRLOCK_ALLOW_EQUAL_PRI = 0x8
|
||||
MRLOCK_DEFAULT = MRLOCK_BARRIER
|
||||
def mraccess(mrp): return mraccessf(mrp, 0)
|
||||
|
||||
def mrupdate(mrp): return mrupdatef(mrp, 0)
|
||||
|
||||
def mp_mutex_unlock(m): return mutex_unlock(m)
|
||||
|
||||
def mp_mutex_trylock(m): return mutex_trylock(m)
|
||||
|
||||
def mp_mutex_spinlock(m): return mutex_spinlock(m)
|
||||
|
||||
|
||||
# Included from sys/mon.h
|
||||
MON_LOCKED = 0x01
|
||||
MON_WAITING = 0x02
|
||||
MON_TIMEOUT = 0x04
|
||||
MON_DOSRV = 0x08
|
||||
MON_RUN = 0x10
|
||||
MR_READER_BUCKETS = 13
|
||||
def initlock(l): return spinlock_init(l,0)
|
||||
|
||||
def ownlock(x): return 1
|
||||
|
||||
def mutex_enter(m): return mutex_lock(m, PZERO)
|
||||
|
||||
def mutex_tryenter(m): return mutex_trylock(m)
|
||||
|
||||
def mutex_exit(m): return mutex_unlock(m)
|
||||
|
||||
def cv_signal(cv): return sv_signal(cv)
|
||||
|
||||
def cv_broadcast(cv): return sv_broadcast(cv)
|
||||
|
||||
def cv_destroy(cv): return sv_destroy(cv)
|
||||
|
||||
RW_READER = MR_ACCESS
|
||||
RW_WRITER = MR_UPDATE
|
||||
def rw_exit(r): return mrunlock(r)
|
||||
|
||||
def rw_tryupgrade(r): return mrtrypromote(r)
|
||||
|
||||
def rw_downgrade(r): return mrdemote(r)
|
||||
|
||||
def rw_destroy(r): return mrfree(r)
|
||||
|
||||
def RW_WRITE_HELD(r): return ismrlocked(r, MR_UPDATE)
|
||||
|
||||
def RW_READ_HELD(r): return ismrlocked(r, MR_ACCESS)
|
||||
|
||||
MS_FREE = 0
|
||||
MS_UPD = 1
|
||||
MS_ACC = 2
|
||||
MS_WAITERS = 4
|
||||
|
||||
# Included from sys/fcntl.h
|
||||
FNDELAY = 0x04
|
||||
FAPPEND = 0x08
|
||||
FSYNC = 0x10
|
||||
FDSYNC = 0x20
|
||||
FRSYNC = 0x40
|
||||
FNONBLOCK = 0x80
|
||||
FASYNC = 0x1000
|
||||
FLARGEFILE = 0x2000
|
||||
FNONBLK = FNONBLOCK
|
||||
FDIRECT = 0x8000
|
||||
FBULK = 0x10000
|
||||
FDIRENT64 = 0x8000
|
||||
FCREAT = 0x0100
|
||||
FTRUNC = 0x0200
|
||||
FEXCL = 0x0400
|
||||
FNOCTTY = 0x0800
|
||||
O_RDONLY = 0
|
||||
O_WRONLY = 1
|
||||
O_RDWR = 2
|
||||
O_NDELAY = 0x04
|
||||
O_APPEND = 0x08
|
||||
O_SYNC = 0x10
|
||||
O_DSYNC = 0x20
|
||||
O_RSYNC = 0x40
|
||||
O_NONBLOCK = 0x80
|
||||
O_LARGEFILE = 0x2000
|
||||
O_DIRECT = 0x8000
|
||||
O_BULK = 0x10000
|
||||
O_CREAT = 0x100
|
||||
O_TRUNC = 0x200
|
||||
O_EXCL = 0x400
|
||||
O_NOCTTY = 0x800
|
||||
F_DUPFD = 0
|
||||
F_GETFD = 1
|
||||
F_SETFD = 2
|
||||
F_GETFL = 3
|
||||
F_SETFL = 4
|
||||
F_SETLK = 6
|
||||
F_SETLKW = 7
|
||||
F_CHKFL = 8
|
||||
F_ALLOCSP = 10
|
||||
F_FREESP = 11
|
||||
F_SETBSDLK = 12
|
||||
F_SETBSDLKW = 13
|
||||
F_GETLK = 14
|
||||
F_CHKLK = 15
|
||||
F_CHKLKW = 16
|
||||
F_CLNLK = 17
|
||||
F_RSETLK = 20
|
||||
F_RGETLK = 21
|
||||
F_RSETLKW = 22
|
||||
F_GETOWN = 23
|
||||
F_SETOWN = 24
|
||||
F_DIOINFO = 30
|
||||
F_FSGETXATTR = 31
|
||||
F_FSSETXATTR = 32
|
||||
F_GETLK64 = 33
|
||||
F_SETLK64 = 34
|
||||
F_SETLKW64 = 35
|
||||
F_ALLOCSP64 = 36
|
||||
F_FREESP64 = 37
|
||||
F_GETBMAP = 38
|
||||
F_FSSETDM = 39
|
||||
F_RESVSP = 40
|
||||
F_UNRESVSP = 41
|
||||
F_RESVSP64 = 42
|
||||
F_UNRESVSP64 = 43
|
||||
F_GETBMAPA = 44
|
||||
F_FSGETXATTRA = 45
|
||||
F_SETBIOSIZE = 46
|
||||
F_GETBIOSIZE = 47
|
||||
F_GETOPS = 50
|
||||
F_DMAPI = 51
|
||||
F_FSYNC = 52
|
||||
F_FSYNC64 = 53
|
||||
F_GETBDSATTR = 54
|
||||
F_SETBDSATTR = 55
|
||||
F_GETBMAPX = 56
|
||||
F_SETPRIO = 57
|
||||
F_GETPRIO = 58
|
||||
F_RDLCK = 01
|
||||
F_WRLCK = 02
|
||||
F_UNLCK = 03
|
||||
O_ACCMODE = 3
|
||||
FD_CLOEXEC = 1
|
||||
FD_NODUP_FORK = 4
|
||||
BMV_IF_ATTRFORK = 0x1
|
||||
BMV_IF_NO_DMAPI_READ = 0x2
|
||||
BMV_IF_PREALLOC = 0x4
|
||||
BMV_IF_VALID = (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC)
|
||||
BMV_OF_PREALLOC = 0x1
|
||||
BMV_IF_EXTENDED = 0x40000000
|
||||
FMASK = 0x190FF
|
||||
FOPEN = 0xFFFFFFFF
|
||||
FREAD = 0x01
|
||||
FWRITE = 0x02
|
||||
FNDELAY = 0x04
|
||||
FAPPEND = 0x08
|
||||
FSYNC = 0x10
|
||||
FDSYNC = 0x20
|
||||
FRSYNC = 0x40
|
||||
FNONBLOCK = 0x80
|
||||
FASYNC = 0x1000
|
||||
FNONBLK = FNONBLOCK
|
||||
FLARGEFILE = 0x2000
|
||||
FDIRECT = 0x8000
|
||||
FBULK = 0x10000
|
||||
FCREAT = 0x0100
|
||||
FTRUNC = 0x0200
|
||||
FEXCL = 0x0400
|
||||
FNOCTTY = 0x0800
|
||||
FINVIS = 0x0100
|
||||
FSOCKET = 0x0200
|
||||
FINPROGRESS = 0x0400
|
||||
FPRIORITY = 0x0800
|
||||
FPRIO = 0x4000
|
||||
FDIRENT64 = 0x8000
|
||||
FCLOSEXEC = 0x01
|
||||
LOCK_SH = 1
|
||||
LOCK_EX = 2
|
||||
LOCK_NB = 4
|
||||
LOCK_UN = 8
|
||||
L_SET = 0
|
||||
L_INCR = 1
|
||||
L_XTND = 2
|
||||
F_OK = 0
|
||||
X_OK = 1
|
||||
W_OK = 2
|
||||
R_OK = 4
|
@ -1,289 +0,0 @@
|
||||
# Constants used by the FORMS library (module fl).
|
||||
# This corresponds to "forms.h".
|
||||
# Recommended use: import FL; ... FL.NORMAL_BOX ... etc.
|
||||
# Alternate use: from FL import *; ... NORMAL_BOX ... etc.
|
||||
|
||||
_v20 = 1
|
||||
_v21 = 1
|
||||
##import fl
|
||||
##try:
|
||||
## _v20 = (fl.get_rgbmode is not None)
|
||||
##except:
|
||||
## _v20 = 0
|
||||
##del fl
|
||||
|
||||
NULL = 0
|
||||
FALSE = 0
|
||||
TRUE = 1
|
||||
|
||||
EVENT = -1
|
||||
|
||||
LABEL_SIZE = 64
|
||||
if _v20:
|
||||
SHORTCUT_SIZE = 32
|
||||
PLACE_FREE = 0
|
||||
PLACE_SIZE = 1
|
||||
PLACE_ASPECT = 2
|
||||
PLACE_MOUSE = 3
|
||||
PLACE_CENTER = 4
|
||||
PLACE_POSITION = 5
|
||||
FL_PLACE_FULLSCREEN = 6
|
||||
FIND_INPUT = 0
|
||||
FIND_AUTOMATIC = 1
|
||||
FIND_MOUSE = 2
|
||||
BEGIN_GROUP = 10000
|
||||
END_GROUP = 20000
|
||||
ALIGN_TOP = 0
|
||||
ALIGN_BOTTOM = 1
|
||||
ALIGN_LEFT = 2
|
||||
ALIGN_RIGHT = 3
|
||||
ALIGN_CENTER = 4
|
||||
NO_BOX = 0
|
||||
UP_BOX = 1
|
||||
DOWN_BOX = 2
|
||||
FLAT_BOX = 3
|
||||
BORDER_BOX = 4
|
||||
SHADOW_BOX = 5
|
||||
FRAME_BOX = 6
|
||||
ROUNDED_BOX = 7
|
||||
RFLAT_BOX = 8
|
||||
RSHADOW_BOX = 9
|
||||
TOP_BOUND_COL = 51
|
||||
LEFT_BOUND_COL = 55
|
||||
BOT_BOUND_COL = 40
|
||||
RIGHT_BOUND_COL = 35
|
||||
COL1 = 47
|
||||
MCOL = 49
|
||||
LCOL = 0
|
||||
BOUND_WIDTH = 3.0
|
||||
DRAW = 0
|
||||
PUSH = 1
|
||||
RELEASE = 2
|
||||
ENTER = 3
|
||||
LEAVE = 4
|
||||
MOUSE = 5
|
||||
FOCUS = 6
|
||||
UNFOCUS = 7
|
||||
KEYBOARD = 8
|
||||
STEP = 9
|
||||
MOVE = 10
|
||||
FONT_NAME = 'Helvetica'
|
||||
FONT_BOLDNAME = 'Helvetica-Bold'
|
||||
FONT_ITALICNAME = 'Helvetica-Oblique'
|
||||
FONT_FIXEDNAME = 'Courier'
|
||||
FONT_ICONNAME = 'Icon'
|
||||
SMALL_FONT = 8.0
|
||||
NORMAL_FONT = 11.0
|
||||
LARGE_FONT = 20.0
|
||||
NORMAL_STYLE = 0
|
||||
BOLD_STYLE = 1
|
||||
ITALIC_STYLE = 2
|
||||
FIXED_STYLE = 3
|
||||
ENGRAVED_STYLE = 4
|
||||
ICON_STYLE = 5
|
||||
BITMAP = 3
|
||||
NORMAL_BITMAP = 0
|
||||
BITMAP_BOXTYPE = NO_BOX
|
||||
BITMAP_COL1 = 0
|
||||
BITMAP_COL2 = COL1
|
||||
BITMAP_LCOL = LCOL
|
||||
BITMAP_ALIGN = ALIGN_BOTTOM
|
||||
BITMAP_MAXSIZE = 128*128
|
||||
BITMAP_BW = BOUND_WIDTH
|
||||
BOX = 1
|
||||
BOX_BOXTYPE = UP_BOX
|
||||
BOX_COL1 = COL1
|
||||
BOX_LCOL = LCOL
|
||||
BOX_ALIGN = ALIGN_CENTER
|
||||
BOX_BW = BOUND_WIDTH
|
||||
BROWSER = 71
|
||||
NORMAL_BROWSER = 0
|
||||
SELECT_BROWSER = 1
|
||||
HOLD_BROWSER = 2
|
||||
MULTI_BROWSER = 3
|
||||
BROWSER_BOXTYPE = DOWN_BOX
|
||||
BROWSER_COL1 = COL1
|
||||
BROWSER_COL2 = 3
|
||||
BROWSER_LCOL = LCOL
|
||||
BROWSER_ALIGN = ALIGN_BOTTOM
|
||||
BROWSER_SLCOL = COL1
|
||||
BROWSER_BW = BOUND_WIDTH
|
||||
BROWSER_LINELENGTH = 128
|
||||
BROWSER_MAXLINE = 512
|
||||
BUTTON = 11
|
||||
NORMAL_BUTTON = 0
|
||||
PUSH_BUTTON = 1
|
||||
RADIO_BUTTON = 2
|
||||
HIDDEN_BUTTON = 3
|
||||
TOUCH_BUTTON = 4
|
||||
INOUT_BUTTON = 5
|
||||
RETURN_BUTTON = 6
|
||||
if _v20:
|
||||
HIDDEN_RET_BUTTON = 7
|
||||
BUTTON_BOXTYPE = UP_BOX
|
||||
BUTTON_COL1 = COL1
|
||||
BUTTON_COL2 = COL1
|
||||
BUTTON_LCOL = LCOL
|
||||
BUTTON_ALIGN = ALIGN_CENTER
|
||||
BUTTON_MCOL1 = MCOL
|
||||
BUTTON_MCOL2 = MCOL
|
||||
BUTTON_BW = BOUND_WIDTH
|
||||
if _v20:
|
||||
CHART = 4
|
||||
BAR_CHART = 0
|
||||
HORBAR_CHART = 1
|
||||
LINE_CHART = 2
|
||||
FILLED_CHART = 3
|
||||
SPIKE_CHART = 4
|
||||
PIE_CHART = 5
|
||||
SPECIALPIE_CHART = 6
|
||||
CHART_BOXTYPE = BORDER_BOX
|
||||
CHART_COL1 = COL1
|
||||
CHART_LCOL = LCOL
|
||||
CHART_ALIGN = ALIGN_BOTTOM
|
||||
CHART_BW = BOUND_WIDTH
|
||||
CHART_MAX = 128
|
||||
CHOICE = 42
|
||||
NORMAL_CHOICE = 0
|
||||
CHOICE_BOXTYPE = DOWN_BOX
|
||||
CHOICE_COL1 = COL1
|
||||
CHOICE_COL2 = LCOL
|
||||
CHOICE_LCOL = LCOL
|
||||
CHOICE_ALIGN = ALIGN_LEFT
|
||||
CHOICE_BW = BOUND_WIDTH
|
||||
CHOICE_MCOL = MCOL
|
||||
CHOICE_MAXITEMS = 128
|
||||
CHOICE_MAXSTR = 64
|
||||
CLOCK = 61
|
||||
SQUARE_CLOCK = 0
|
||||
ROUND_CLOCK = 1
|
||||
CLOCK_BOXTYPE = UP_BOX
|
||||
CLOCK_COL1 = 37
|
||||
CLOCK_COL2 = 42
|
||||
CLOCK_LCOL = LCOL
|
||||
CLOCK_ALIGN = ALIGN_BOTTOM
|
||||
CLOCK_TOPCOL = COL1
|
||||
CLOCK_BW = BOUND_WIDTH
|
||||
COUNTER = 25
|
||||
NORMAL_COUNTER = 0
|
||||
SIMPLE_COUNTER = 1
|
||||
COUNTER_BOXTYPE = UP_BOX
|
||||
COUNTER_COL1 = COL1
|
||||
COUNTER_COL2 = 4
|
||||
COUNTER_LCOL = LCOL
|
||||
COUNTER_ALIGN = ALIGN_BOTTOM
|
||||
if _v20:
|
||||
COUNTER_BW = BOUND_WIDTH
|
||||
else:
|
||||
DEFAULT = 51
|
||||
RETURN_DEFAULT = 0
|
||||
ALWAYS_DEFAULT = 1
|
||||
DIAL = 22
|
||||
NORMAL_DIAL = 0
|
||||
LINE_DIAL = 1
|
||||
DIAL_BOXTYPE = NO_BOX
|
||||
DIAL_COL1 = COL1
|
||||
DIAL_COL2 = 37
|
||||
DIAL_LCOL = LCOL
|
||||
DIAL_ALIGN = ALIGN_BOTTOM
|
||||
DIAL_TOPCOL = COL1
|
||||
DIAL_BW = BOUND_WIDTH
|
||||
FREE = 101
|
||||
NORMAL_FREE = 1
|
||||
SLEEPING_FREE = 2
|
||||
INPUT_FREE = 3
|
||||
CONTINUOUS_FREE = 4
|
||||
ALL_FREE = 5
|
||||
INPUT = 31
|
||||
NORMAL_INPUT = 0
|
||||
if _v20:
|
||||
FLOAT_INPUT = 1
|
||||
INT_INPUT = 2
|
||||
HIDDEN_INPUT = 3
|
||||
if _v21:
|
||||
MULTILINE_INPUT = 4
|
||||
SECRET_INPUT = 5
|
||||
else:
|
||||
ALWAYS_INPUT = 1
|
||||
INPUT_BOXTYPE = DOWN_BOX
|
||||
INPUT_COL1 = 13
|
||||
INPUT_COL2 = 5
|
||||
INPUT_LCOL = LCOL
|
||||
INPUT_ALIGN = ALIGN_LEFT
|
||||
INPUT_TCOL = LCOL
|
||||
INPUT_CCOL = 4
|
||||
INPUT_BW = BOUND_WIDTH
|
||||
INPUT_MAX = 128
|
||||
LIGHTBUTTON = 12
|
||||
LIGHTBUTTON_BOXTYPE = UP_BOX
|
||||
LIGHTBUTTON_COL1 = 39
|
||||
LIGHTBUTTON_COL2 = 3
|
||||
LIGHTBUTTON_LCOL = LCOL
|
||||
LIGHTBUTTON_ALIGN = ALIGN_CENTER
|
||||
LIGHTBUTTON_TOPCOL = COL1
|
||||
LIGHTBUTTON_MCOL = MCOL
|
||||
LIGHTBUTTON_BW1 = BOUND_WIDTH
|
||||
LIGHTBUTTON_BW2 = BOUND_WIDTH/2.0
|
||||
LIGHTBUTTON_MINSIZE = 12.0
|
||||
MENU = 41
|
||||
TOUCH_MENU = 0
|
||||
PUSH_MENU = 1
|
||||
MENU_BOXTYPE = BORDER_BOX
|
||||
MENU_COL1 = 55
|
||||
MENU_COL2 = 37
|
||||
MENU_LCOL = LCOL
|
||||
MENU_ALIGN = ALIGN_CENTER
|
||||
MENU_BW = BOUND_WIDTH
|
||||
MENU_MAX = 300
|
||||
POSITIONER = 23
|
||||
NORMAL_POSITIONER = 0
|
||||
POSITIONER_BOXTYPE = DOWN_BOX
|
||||
POSITIONER_COL1 = COL1
|
||||
POSITIONER_COL2 = 1
|
||||
POSITIONER_LCOL = LCOL
|
||||
POSITIONER_ALIGN = ALIGN_BOTTOM
|
||||
POSITIONER_BW = BOUND_WIDTH
|
||||
ROUNDBUTTON = 13
|
||||
ROUNDBUTTON_BOXTYPE = NO_BOX
|
||||
ROUNDBUTTON_COL1 = 7
|
||||
ROUNDBUTTON_COL2 = 3
|
||||
ROUNDBUTTON_LCOL = LCOL
|
||||
ROUNDBUTTON_ALIGN = ALIGN_CENTER
|
||||
ROUNDBUTTON_TOPCOL = COL1
|
||||
ROUNDBUTTON_MCOL = MCOL
|
||||
ROUNDBUTTON_BW = BOUND_WIDTH
|
||||
SLIDER = 21
|
||||
VALSLIDER = 24
|
||||
VERT_SLIDER = 0
|
||||
HOR_SLIDER = 1
|
||||
VERT_FILL_SLIDER = 2
|
||||
HOR_FILL_SLIDER = 3
|
||||
VERT_NICE_SLIDER = 4
|
||||
HOR_NICE_SLIDER = 5
|
||||
SLIDER_BOXTYPE = DOWN_BOX
|
||||
SLIDER_COL1 = COL1
|
||||
SLIDER_COL2 = COL1
|
||||
SLIDER_LCOL = LCOL
|
||||
SLIDER_ALIGN = ALIGN_BOTTOM
|
||||
SLIDER_BW1 = BOUND_WIDTH
|
||||
SLIDER_BW2 = BOUND_WIDTH*0.75
|
||||
SLIDER_FINE = 0.05
|
||||
SLIDER_WIDTH = 0.08
|
||||
TEXT = 2
|
||||
NORMAL_TEXT = 0
|
||||
TEXT_BOXTYPE = NO_BOX
|
||||
TEXT_COL1 = COL1
|
||||
TEXT_LCOL = LCOL
|
||||
TEXT_ALIGN = ALIGN_LEFT
|
||||
TEXT_BW = BOUND_WIDTH
|
||||
TIMER = 62
|
||||
NORMAL_TIMER = 0
|
||||
VALUE_TIMER = 1
|
||||
HIDDEN_TIMER = 2
|
||||
TIMER_BOXTYPE = DOWN_BOX
|
||||
TIMER_COL1 = COL1
|
||||
TIMER_COL2 = 1
|
||||
TIMER_LCOL = LCOL
|
||||
TIMER_ALIGN = ALIGN_CENTER
|
||||
TIMER_BW = BOUND_WIDTH
|
||||
TIMER_BLINKRATE = 0.2
|
@ -1,59 +0,0 @@
|
||||
# Symbols from <gl/get.h>
|
||||
|
||||
BCKBUFFER = 0x1
|
||||
FRNTBUFFER = 0x2
|
||||
DRAWZBUFFER = 0x4
|
||||
DMRGB = 0
|
||||
DMSINGLE = 1
|
||||
DMDOUBLE = 2
|
||||
DMRGBDOUBLE = 5
|
||||
HZ30 = 0
|
||||
HZ60 = 1
|
||||
NTSC = 2
|
||||
HDTV = 3
|
||||
VGA = 4
|
||||
IRIS3K = 5
|
||||
PR60 = 6
|
||||
PAL = 9
|
||||
HZ30_SG = 11
|
||||
A343 = 14
|
||||
STR_RECT = 15
|
||||
VOF0 = 16
|
||||
VOF1 = 17
|
||||
VOF2 = 18
|
||||
VOF3 = 19
|
||||
SGI0 = 20
|
||||
SGI1 = 21
|
||||
SGI2 = 22
|
||||
HZ72 = 23
|
||||
GL_VIDEO_REG = 0x00800000
|
||||
GLV_GENLOCK = 0x00000001
|
||||
GLV_UNBLANK = 0x00000002
|
||||
GLV_SRED = 0x00000004
|
||||
GLV_SGREEN = 0x00000008
|
||||
GLV_SBLUE = 0x00000010
|
||||
GLV_SALPHA = 0x00000020
|
||||
GLV_TTLGENLOCK = 0x00000080
|
||||
GLV_TTLSYNC = GLV_TTLGENLOCK
|
||||
GLV_GREENGENLOCK = 0x0000100
|
||||
LEFTPLANE = 0x0001
|
||||
RIGHTPLANE = 0x0002
|
||||
BOTTOMPLANE = 0x0004
|
||||
TOPPLANE = 0x0008
|
||||
NEARPLANE = 0x0010
|
||||
FARPLANE = 0x0020
|
||||
## GETDEF = __GL_GET_H__
|
||||
NOBUFFER = 0x0
|
||||
BOTHBUFFERS = 0x3
|
||||
DMINTENSITYSINGLE = 3
|
||||
DMINTENSITYDOUBLE = 4
|
||||
MONSPECIAL = 0x20
|
||||
HZ50 = 3
|
||||
MONA = 5
|
||||
MONB = 6
|
||||
MONC = 7
|
||||
MOND = 8
|
||||
MON_ALL = 12
|
||||
MON_GEN_ALL = 13
|
||||
CMAPMULTI = 0
|
||||
CMAPONE = 1
|
@ -1,393 +0,0 @@
|
||||
NULL = 0
|
||||
FALSE = 0
|
||||
TRUE = 1
|
||||
ATTRIBSTACKDEPTH = 10
|
||||
VPSTACKDEPTH = 8
|
||||
MATRIXSTACKDEPTH = 32
|
||||
NAMESTACKDEPTH = 1025
|
||||
STARTTAG = -2
|
||||
ENDTAG = -3
|
||||
BLACK = 0
|
||||
RED = 1
|
||||
GREEN = 2
|
||||
YELLOW = 3
|
||||
BLUE = 4
|
||||
MAGENTA = 5
|
||||
CYAN = 6
|
||||
WHITE = 7
|
||||
PUP_CLEAR = 0
|
||||
PUP_COLOR = 1
|
||||
PUP_BLACK = 2
|
||||
PUP_WHITE = 3
|
||||
NORMALDRAW = 0x010
|
||||
PUPDRAW = 0x020
|
||||
OVERDRAW = 0x040
|
||||
UNDERDRAW = 0x080
|
||||
CURSORDRAW = 0x100
|
||||
DUALDRAW = 0x200
|
||||
PATTERN_16 = 16
|
||||
PATTERN_32 = 32
|
||||
PATTERN_64 = 64
|
||||
PATTERN_16_SIZE = 16
|
||||
PATTERN_32_SIZE = 64
|
||||
PATTERN_64_SIZE = 256
|
||||
SRC_AUTO = 0
|
||||
SRC_FRONT = 1
|
||||
SRC_BACK = 2
|
||||
SRC_ZBUFFER = 3
|
||||
SRC_PUP = 4
|
||||
SRC_OVER = 5
|
||||
SRC_UNDER = 6
|
||||
SRC_FRAMEGRABBER = 7
|
||||
BF_ZERO = 0
|
||||
BF_ONE = 1
|
||||
BF_DC = 2
|
||||
BF_SC = 2
|
||||
BF_MDC = 3
|
||||
BF_MSC = 3
|
||||
BF_SA = 4
|
||||
BF_MSA = 5
|
||||
BF_DA = 6
|
||||
BF_MDA = 7
|
||||
BF_MIN_SA_MDA = 8
|
||||
AF_NEVER = 0
|
||||
AF_LESS = 1
|
||||
AF_EQUAL = 2
|
||||
AF_LEQUAL = 3
|
||||
AF_GREATER = 4
|
||||
AF_NOTEQUAL = 5
|
||||
AF_GEQUAL = 6
|
||||
AF_ALWAYS = 7
|
||||
ZF_NEVER = 0
|
||||
ZF_LESS = 1
|
||||
ZF_EQUAL = 2
|
||||
ZF_LEQUAL = 3
|
||||
ZF_GREATER = 4
|
||||
ZF_NOTEQUAL = 5
|
||||
ZF_GEQUAL = 6
|
||||
ZF_ALWAYS = 7
|
||||
ZSRC_DEPTH = 0
|
||||
ZSRC_COLOR = 1
|
||||
SMP_OFF = 0x0
|
||||
SMP_ON = 0x1
|
||||
SMP_SMOOTHER = 0x2
|
||||
SML_OFF = 0x0
|
||||
SML_ON = 0x1
|
||||
SML_SMOOTHER = 0x2
|
||||
SML_END_CORRECT = 0x4
|
||||
PYSM_OFF = 0
|
||||
PYSM_ON = 1
|
||||
PYSM_SHRINK = 2
|
||||
DT_OFF = 0
|
||||
DT_ON = 1
|
||||
PUP_NONE = 0
|
||||
PUP_GREY = 0x1
|
||||
PUP_BOX = 0x2
|
||||
PUP_CHECK = 0x4
|
||||
GLC_OLDPOLYGON = 0
|
||||
GLC_ZRANGEMAP = 1
|
||||
GLC_MQUEUERATE = 2
|
||||
GLC_SOFTATTACH = 3
|
||||
GLC_MANAGEBG = 4
|
||||
GLC_SLOWMAPCOLORS = 5
|
||||
GLC_INPUTCHANGEBUG = 6
|
||||
GLC_NOBORDERBUG = 7
|
||||
GLC_SET_VSYNC = 8
|
||||
GLC_GET_VSYNC = 9
|
||||
GLC_VSYNC_SLEEP = 10
|
||||
GLC_COMPATRATE = 15
|
||||
C16X1 = 0
|
||||
C16X2 = 1
|
||||
C32X1 = 2
|
||||
C32X2 = 3
|
||||
CCROSS = 4
|
||||
FLAT = 0
|
||||
GOURAUD = 1
|
||||
LO_ZERO = 0x0
|
||||
LO_AND = 0x1
|
||||
LO_ANDR = 0x2
|
||||
LO_SRC = 0x3
|
||||
LO_ANDI = 0x4
|
||||
LO_DST = 0x5
|
||||
LO_XOR = 0x6
|
||||
LO_OR = 0x7
|
||||
LO_NOR = 0x8
|
||||
LO_XNOR = 0x9
|
||||
LO_NDST = 0xa
|
||||
LO_ORR = 0xb
|
||||
LO_NSRC = 0xc
|
||||
LO_ORI = 0xd
|
||||
LO_NAND = 0xe
|
||||
LO_ONE = 0xf
|
||||
INFOCUSSCRN = -2
|
||||
ST_KEEP = 0
|
||||
ST_ZERO = 1
|
||||
ST_REPLACE = 2
|
||||
ST_INCR = 3
|
||||
ST_DECR = 4
|
||||
ST_INVERT = 5
|
||||
SF_NEVER = 0
|
||||
SF_LESS = 1
|
||||
SF_EQUAL = 2
|
||||
SF_LEQUAL = 3
|
||||
SF_GREATER = 4
|
||||
SF_NOTEQUAL = 5
|
||||
SF_GEQUAL = 6
|
||||
SF_ALWAYS = 7
|
||||
SS_OFF = 0
|
||||
SS_DEPTH = 1
|
||||
PYM_FILL = 1
|
||||
PYM_POINT = 2
|
||||
PYM_LINE = 3
|
||||
PYM_HOLLOW = 4
|
||||
PYM_LINE_FAST = 5
|
||||
FG_OFF = 0
|
||||
FG_ON = 1
|
||||
FG_DEFINE = 2
|
||||
FG_VTX_EXP = 2
|
||||
FG_VTX_LIN = 3
|
||||
FG_PIX_EXP = 4
|
||||
FG_PIX_LIN = 5
|
||||
FG_VTX_EXP2 = 6
|
||||
FG_PIX_EXP2 = 7
|
||||
PM_SHIFT = 0
|
||||
PM_EXPAND = 1
|
||||
PM_C0 = 2
|
||||
PM_C1 = 3
|
||||
PM_ADD24 = 4
|
||||
PM_SIZE = 5
|
||||
PM_OFFSET = 6
|
||||
PM_STRIDE = 7
|
||||
PM_TTOB = 8
|
||||
PM_RTOL = 9
|
||||
PM_ZDATA = 10
|
||||
PM_WARP = 11
|
||||
PM_RDX = 12
|
||||
PM_RDY = 13
|
||||
PM_CDX = 14
|
||||
PM_CDY = 15
|
||||
PM_XSTART = 16
|
||||
PM_YSTART = 17
|
||||
PM_VO1 = 1000
|
||||
NAUTO = 0
|
||||
NNORMALIZE = 1
|
||||
AC_CLEAR = 0
|
||||
AC_ACCUMULATE = 1
|
||||
AC_CLEAR_ACCUMULATE = 2
|
||||
AC_RETURN = 3
|
||||
AC_MULT = 4
|
||||
AC_ADD = 5
|
||||
CP_OFF = 0
|
||||
CP_ON = 1
|
||||
CP_DEFINE = 2
|
||||
SB_RESET = 0
|
||||
SB_TRACK = 1
|
||||
SB_HOLD = 2
|
||||
RD_FREEZE = 0x00000001
|
||||
RD_ALPHAONE = 0x00000002
|
||||
RD_IGNORE_UNDERLAY = 0x00000004
|
||||
RD_IGNORE_OVERLAY = 0x00000008
|
||||
RD_IGNORE_PUP = 0x00000010
|
||||
RD_OFFSCREEN = 0x00000020
|
||||
GD_XPMAX = 0
|
||||
GD_YPMAX = 1
|
||||
GD_XMMAX = 2
|
||||
GD_YMMAX = 3
|
||||
GD_ZMIN = 4
|
||||
GD_ZMAX = 5
|
||||
GD_BITS_NORM_SNG_RED = 6
|
||||
GD_BITS_NORM_SNG_GREEN = 7
|
||||
GD_BITS_NORM_SNG_BLUE = 8
|
||||
GD_BITS_NORM_DBL_RED = 9
|
||||
GD_BITS_NORM_DBL_GREEN = 10
|
||||
GD_BITS_NORM_DBL_BLUE = 11
|
||||
GD_BITS_NORM_SNG_CMODE = 12
|
||||
GD_BITS_NORM_DBL_CMODE = 13
|
||||
GD_BITS_NORM_SNG_MMAP = 14
|
||||
GD_BITS_NORM_DBL_MMAP = 15
|
||||
GD_BITS_NORM_ZBUFFER = 16
|
||||
GD_BITS_OVER_SNG_CMODE = 17
|
||||
GD_BITS_UNDR_SNG_CMODE = 18
|
||||
GD_BITS_PUP_SNG_CMODE = 19
|
||||
GD_BITS_NORM_SNG_ALPHA = 21
|
||||
GD_BITS_NORM_DBL_ALPHA = 22
|
||||
GD_BITS_CURSOR = 23
|
||||
GD_OVERUNDER_SHARED = 24
|
||||
GD_BLEND = 25
|
||||
GD_CIFRACT = 26
|
||||
GD_CROSSHAIR_CINDEX = 27
|
||||
GD_DITHER = 28
|
||||
GD_LINESMOOTH_CMODE = 30
|
||||
GD_LINESMOOTH_RGB = 31
|
||||
GD_LOGICOP = 33
|
||||
GD_NSCRNS = 35
|
||||
GD_NURBS_ORDER = 36
|
||||
GD_NBLINKS = 37
|
||||
GD_NVERTEX_POLY = 39
|
||||
GD_PATSIZE_64 = 40
|
||||
GD_PNTSMOOTH_CMODE = 41
|
||||
GD_PNTSMOOTH_RGB = 42
|
||||
GD_PUP_TO_OVERUNDER = 43
|
||||
GD_READSOURCE = 44
|
||||
GD_READSOURCE_ZBUFFER = 48
|
||||
GD_STEREO = 50
|
||||
GD_SUBPIXEL_LINE = 51
|
||||
GD_SUBPIXEL_PNT = 52
|
||||
GD_SUBPIXEL_POLY = 53
|
||||
GD_TRIMCURVE_ORDER = 54
|
||||
GD_WSYS = 55
|
||||
GD_ZDRAW_GEOM = 57
|
||||
GD_ZDRAW_PIXELS = 58
|
||||
GD_SCRNTYPE = 61
|
||||
GD_TEXTPORT = 62
|
||||
GD_NMMAPS = 63
|
||||
GD_FRAMEGRABBER = 64
|
||||
GD_TIMERHZ = 66
|
||||
GD_DBBOX = 67
|
||||
GD_AFUNCTION = 68
|
||||
GD_ALPHA_OVERUNDER = 69
|
||||
GD_BITS_ACBUF = 70
|
||||
GD_BITS_ACBUF_HW = 71
|
||||
GD_BITS_STENCIL = 72
|
||||
GD_CLIPPLANES = 73
|
||||
GD_FOGVERTEX = 74
|
||||
GD_LIGHTING_TWOSIDE = 76
|
||||
GD_POLYMODE = 77
|
||||
GD_POLYSMOOTH = 78
|
||||
GD_SCRBOX = 79
|
||||
GD_TEXTURE = 80
|
||||
GD_FOGPIXEL = 81
|
||||
GD_TEXTURE_PERSP = 82
|
||||
GD_MUXPIPES = 83
|
||||
GD_NOLIMIT = -2
|
||||
GD_WSYS_NONE = 0
|
||||
GD_WSYS_4S = 1
|
||||
GD_SCRNTYPE_WM = 0
|
||||
GD_SCRNTYPE_NOWM = 1
|
||||
N_PIXEL_TOLERANCE = 1
|
||||
N_CULLING = 2
|
||||
N_DISPLAY = 3
|
||||
N_ERRORCHECKING = 4
|
||||
N_SUBDIVISIONS = 5
|
||||
N_S_STEPS = 6
|
||||
N_T_STEPS = 7
|
||||
N_TILES = 8
|
||||
N_TMP1 = 9
|
||||
N_TMP2 = 10
|
||||
N_TMP3 = 11
|
||||
N_TMP4 = 12
|
||||
N_TMP5 = 13
|
||||
N_TMP6 = 14
|
||||
N_FILL = 1.0
|
||||
N_OUTLINE_POLY = 2.0
|
||||
N_OUTLINE_PATCH = 5.0
|
||||
N_ISOLINE_S = 12.0
|
||||
N_ST = 0x8
|
||||
N_STW = 0xd
|
||||
N_XYZ = 0x4c
|
||||
N_XYZW = 0x51
|
||||
N_TEX = 0x88
|
||||
N_TEXW = 0x8d
|
||||
N_RGBA = 0xd0
|
||||
N_RGBAW = 0xd5
|
||||
N_P2D = 0x8
|
||||
N_P2DR = 0xd
|
||||
N_V3D = 0x4c
|
||||
N_V3DR = 0x51
|
||||
N_T2D = 0x88
|
||||
N_T2DR = 0x8d
|
||||
N_C4D = 0xd0
|
||||
N_C4DR = 0xd5
|
||||
LMNULL = 0.0
|
||||
MSINGLE = 0
|
||||
MPROJECTION = 1
|
||||
MVIEWING = 2
|
||||
MTEXTURE = 3
|
||||
MAXLIGHTS = 8
|
||||
MAXRESTRICTIONS = 4
|
||||
DEFMATERIAL = 0
|
||||
EMISSION = 1
|
||||
AMBIENT = 2
|
||||
DIFFUSE = 3
|
||||
SPECULAR = 4
|
||||
SHININESS = 5
|
||||
COLORINDEXES = 6
|
||||
ALPHA = 7
|
||||
DEFLIGHT = 100
|
||||
LCOLOR = 101
|
||||
POSITION = 102
|
||||
SPOTDIRECTION = 103
|
||||
SPOTLIGHT = 104
|
||||
DEFLMODEL = 200
|
||||
LOCALVIEWER = 201
|
||||
ATTENUATION = 202
|
||||
ATTENUATION2 = 203
|
||||
TWOSIDE = 204
|
||||
MATERIAL = 1000
|
||||
BACKMATERIAL = 1001
|
||||
LIGHT0 = 1100
|
||||
LIGHT1 = 1101
|
||||
LIGHT2 = 1102
|
||||
LIGHT3 = 1103
|
||||
LIGHT4 = 1104
|
||||
LIGHT5 = 1105
|
||||
LIGHT6 = 1106
|
||||
LIGHT7 = 1107
|
||||
LMODEL = 1200
|
||||
LMC_COLOR = 0
|
||||
LMC_EMISSION = 1
|
||||
LMC_AMBIENT = 2
|
||||
LMC_DIFFUSE = 3
|
||||
LMC_SPECULAR = 4
|
||||
LMC_AD = 5
|
||||
LMC_NULL = 6
|
||||
TX_MINFILTER = 0x100
|
||||
TX_MAGFILTER = 0x200
|
||||
TX_WRAP = 0x300
|
||||
TX_WRAP_S = 0x310
|
||||
TX_WRAP_T = 0x320
|
||||
TX_TILE = 0x400
|
||||
TX_BORDER = 0x500
|
||||
TX_NULL = 0x000
|
||||
TX_POINT = 0x110
|
||||
TX_BILINEAR = 0x220
|
||||
TX_MIPMAP = 0x120
|
||||
TX_MIPMAP_POINT = 0x121
|
||||
TX_MIPMAP_LINEAR = 0x122
|
||||
TX_MIPMAP_BILINEAR = 0x123
|
||||
TX_MIPMAP_TRILINEAR = 0x124
|
||||
TX_REPEAT = 0x301
|
||||
TX_CLAMP = 0x302
|
||||
TX_SELECT = 0x303
|
||||
TX_TEXTURE_0 = 0
|
||||
TV_MODULATE = 0x101
|
||||
TV_BLEND = 0x102
|
||||
TV_DECAL = 0x103
|
||||
TV_COLOR = 0x200
|
||||
TV_NULL = 0x000
|
||||
TV_ENV0 = 0
|
||||
TX_S = 0
|
||||
TX_T = 1
|
||||
TG_OFF = 0
|
||||
TG_ON = 1
|
||||
TG_CONTOUR = 2
|
||||
TG_LINEAR = 3
|
||||
TG_SPHEREMAP = 4
|
||||
TG_REFRACTMAP = 5
|
||||
DGLSINK = 0
|
||||
DGLLOCAL = 1
|
||||
DGLTSOCKET = 2
|
||||
DGL4DDN = 3
|
||||
PUP_CURSOR = PUP_COLOR
|
||||
FATAL = 1
|
||||
WARNING = 2
|
||||
ASK_CONT = 3
|
||||
ASK_RESTART = 4
|
||||
XMAXSCREEN = 1279
|
||||
YMAXSCREEN = 1023
|
||||
XMAXMEDIUM = 1023
|
||||
YMAXMEDIUM = 767
|
||||
XMAX170 = 645
|
||||
YMAX170 = 484
|
||||
XMAXPAL = 779
|
||||
YMAXPAL = 574
|
@ -1,12 +0,0 @@
|
||||
NOERROR = 0
|
||||
NOCONTEXT = -1
|
||||
NODISPLAY = -2
|
||||
NOWINDOW = -3
|
||||
NOGRAPHICS = -4
|
||||
NOTTOP = -5
|
||||
NOVISUAL = -6
|
||||
BUFSIZE = -7
|
||||
BADWINDOW = -8
|
||||
ALREADYBOUND = -100
|
||||
BINDFAILED = -101
|
||||
SETFAILED = -102
|
@ -1,385 +0,0 @@
|
||||
# Generated by h2py from /usr/include/netinet/in.h
|
||||
|
||||
# Included from standards.h
|
||||
|
||||
# Included from sgidefs.h
|
||||
_MIPS_ISA_MIPS1 = 1
|
||||
_MIPS_ISA_MIPS2 = 2
|
||||
_MIPS_ISA_MIPS3 = 3
|
||||
_MIPS_ISA_MIPS4 = 4
|
||||
_MIPS_SIM_ABI32 = 1
|
||||
_MIPS_SIM_NABI32 = 2
|
||||
_MIPS_SIM_ABI64 = 3
|
||||
|
||||
# Included from sys/bsd_types.h
|
||||
|
||||
# Included from sys/mkdev.h
|
||||
ONBITSMAJOR = 7
|
||||
ONBITSMINOR = 8
|
||||
OMAXMAJ = 0x7f
|
||||
OMAXMIN = 0xff
|
||||
NBITSMAJOR = 14
|
||||
NBITSMINOR = 18
|
||||
MAXMAJ = 0x1ff
|
||||
MAXMIN = 0x3ffff
|
||||
OLDDEV = 0
|
||||
NEWDEV = 1
|
||||
MKDEV_VER = NEWDEV
|
||||
def IS_STRING_SPEC_DEV(x): return ((dev_t)(x)==__makedev(MKDEV_VER, 0, 0))
|
||||
|
||||
def major(dev): return __major(MKDEV_VER, dev)
|
||||
|
||||
def minor(dev): return __minor(MKDEV_VER, dev)
|
||||
|
||||
|
||||
# Included from sys/select.h
|
||||
FD_SETSIZE = 1024
|
||||
__NBBY = 8
|
||||
|
||||
# Included from string.h
|
||||
NULL = 0
|
||||
NBBY = 8
|
||||
|
||||
# Included from sys/endian.h
|
||||
LITTLE_ENDIAN = 1234
|
||||
BIG_ENDIAN = 4321
|
||||
PDP_ENDIAN = 3412
|
||||
_LITTLE_ENDIAN = 1234
|
||||
_BIG_ENDIAN = 4321
|
||||
_PDP_ENDIAN = 3412
|
||||
_BYTE_ORDER = _BIG_ENDIAN
|
||||
_BYTE_ORDER = _LITTLE_ENDIAN
|
||||
def ntohl(x): return (x)
|
||||
|
||||
def ntohs(x): return (x)
|
||||
|
||||
def htonl(x): return (x)
|
||||
|
||||
def htons(x): return (x)
|
||||
|
||||
def htonl(x): return ntohl(x)
|
||||
|
||||
def htons(x): return ntohs(x)
|
||||
|
||||
|
||||
# Included from sys/types.h
|
||||
|
||||
# Included from sys/pthread.h
|
||||
P_MYID = (-1)
|
||||
P_MYHOSTID = (-1)
|
||||
|
||||
# Included from sys/cpumask.h
|
||||
MAXCPU = 128
|
||||
def CPUMASK_INDEX(bit): return ((bit) >> 6)
|
||||
|
||||
def CPUMASK_SHFT(bit): return ((bit) & 0x3f)
|
||||
|
||||
def CPUMASK_IS_ZERO(p): return ((p) == 0)
|
||||
|
||||
def CPUMASK_IS_NONZERO(p): return ((p) != 0)
|
||||
|
||||
|
||||
# Included from sys/nodemask.h
|
||||
def CNODEMASK_IS_ZERO(p): return ((p) == 0)
|
||||
|
||||
def CNODEMASK_IS_NONZERO(p): return ((p) != 0)
|
||||
|
||||
IPPROTO_IP = 0
|
||||
IPPROTO_HOPOPTS = 0
|
||||
IPPROTO_ICMP = 1
|
||||
IPPROTO_IGMP = 2
|
||||
IPPROTO_GGP = 3
|
||||
IPPROTO_IPIP = 4
|
||||
IPPROTO_ENCAP = IPPROTO_IPIP
|
||||
IPPROTO_ST = 5
|
||||
IPPROTO_TCP = 6
|
||||
IPPROTO_UCL = 7
|
||||
IPPROTO_EGP = 8
|
||||
IPPROTO_IGP = 9
|
||||
IPPROTO_BBN_RCC_MON = 10
|
||||
IPPROTO_NVP_II = 11
|
||||
IPPROTO_PUP = 12
|
||||
IPPROTO_ARGUS = 13
|
||||
IPPROTO_EMCON = 14
|
||||
IPPROTO_XNET = 15
|
||||
IPPROTO_CHAOS = 16
|
||||
IPPROTO_UDP = 17
|
||||
IPPROTO_MUX = 18
|
||||
IPPROTO_DCN_MEAS = 19
|
||||
IPPROTO_HMP = 20
|
||||
IPPROTO_PRM = 21
|
||||
IPPROTO_IDP = 22
|
||||
IPPROTO_TRUNK_1 = 23
|
||||
IPPROTO_TRUNK_2 = 24
|
||||
IPPROTO_LEAF_1 = 25
|
||||
IPPROTO_LEAF_2 = 26
|
||||
IPPROTO_RDP = 27
|
||||
IPPROTO_IRTP = 28
|
||||
IPPROTO_TP = 29
|
||||
IPPROTO_NETBLT = 30
|
||||
IPPROTO_MFE_NSP = 31
|
||||
IPPROTO_MERIT_INP = 32
|
||||
IPPROTO_SEP = 33
|
||||
IPPROTO_3PC = 34
|
||||
IPPROTO_IDPR = 35
|
||||
IPPROTO_XTP = 36
|
||||
IPPROTO_DDP = 37
|
||||
IPPROTO_IDPR_CMTP = 38
|
||||
IPPROTO_TPPP = 39
|
||||
IPPROTO_IL = 40
|
||||
IPPROTO_IPV6 = 41
|
||||
IPPROTO_ROUTING = 43
|
||||
IPPROTO_FRAGMENT = 44
|
||||
IPPROTO_RSVP = 46
|
||||
IPPROTO_ESP = 50
|
||||
IPPROTO_AH = 51
|
||||
IPPROTO_ICMPV6 = 58
|
||||
IPPROTO_NONE = 59
|
||||
IPPROTO_DSTOPTS = 60
|
||||
IPPROTO_CFTP = 62
|
||||
IPPROTO_HELLO = 63
|
||||
IPPROTO_SAT_EXPAK = 64
|
||||
IPPROTO_KRYPTOLAN = 65
|
||||
IPPROTO_RVD = 66
|
||||
IPPROTO_IPPC = 67
|
||||
IPPROTO_SAT_MON = 69
|
||||
IPPROTO_VISA = 70
|
||||
IPPROTO_IPCV = 71
|
||||
IPPROTO_CPNX = 72
|
||||
IPPROTO_CPHB = 73
|
||||
IPPROTO_WSN = 74
|
||||
IPPROTO_PVP = 75
|
||||
IPPROTO_BR_SAT_MON = 76
|
||||
IPPROTO_ND = 77
|
||||
IPPROTO_WB_MON = 78
|
||||
IPPROTO_WB_EXPAK = 79
|
||||
IPPROTO_EON = 80
|
||||
IPPROTO_VMTP = 81
|
||||
IPPROTO_SECURE_VMTP = 82
|
||||
IPPROTO_VINES = 83
|
||||
IPPROTO_TTP = 84
|
||||
IPPROTO_NSFNET_IGP = 85
|
||||
IPPROTO_DGP = 86
|
||||
IPPROTO_TCF = 87
|
||||
IPPROTO_IGRP = 88
|
||||
IPPROTO_OSPF = 89
|
||||
IPPROTO_SPRITE_RPC = 90
|
||||
IPPROTO_LARP = 91
|
||||
IPPROTO_MTP = 92
|
||||
IPPROTO_AX25 = 93
|
||||
IPPROTO_SWIPE = 94
|
||||
IPPROTO_MICP = 95
|
||||
IPPROTO_AES_SP3_D = 96
|
||||
IPPROTO_ETHERIP = 97
|
||||
IPPROTO_ENCAPHDR = 98
|
||||
IPPROTO_RAW = 255
|
||||
IPPROTO_MAX = 256
|
||||
IPPROTO_STP = 257
|
||||
IPPORT_RESERVED = 1024
|
||||
IPPORT_MAXPORT = 65535
|
||||
INET_ADDRSTRLEN = 16
|
||||
INET6_ADDRSTRLEN = 46
|
||||
def IN_CLASSA(i): return (((__int32_t)(i) & 0x80000000) == 0)
|
||||
|
||||
IN_CLASSA_NET = 0xff000000
|
||||
IN_CLASSA_NSHIFT = 24
|
||||
IN_CLASSA_HOST = 0x00ffffff
|
||||
IN_CLASSA_MAX = 128
|
||||
def IN_CLASSB(i): return (((__int32_t)(i) & 0xc0000000) == 0x80000000)
|
||||
|
||||
IN_CLASSB_NET = 0xffff0000
|
||||
IN_CLASSB_NSHIFT = 16
|
||||
IN_CLASSB_HOST = 0x0000ffff
|
||||
IN_CLASSB_MAX = 65536
|
||||
def IN_CLASSC(i): return (((__int32_t)(i) & 0xe0000000) == 0xc0000000)
|
||||
|
||||
IN_CLASSC_NET = 0xffffff00
|
||||
IN_CLASSC_NSHIFT = 8
|
||||
IN_CLASSC_HOST = 0x000000ff
|
||||
def IN_CLASSD(i): return (((__int32_t)(i) & 0xf0000000) == 0xe0000000)
|
||||
|
||||
IN_CLASSD_NET = 0xf0000000
|
||||
IN_CLASSD_NSHIFT = 28
|
||||
IN_CLASSD_HOST = 0x0fffffff
|
||||
def IN_MULTICAST(i): return IN_CLASSD(i)
|
||||
|
||||
def IN_EXPERIMENTAL(i): return (((__int32_t)(i) & 0xf0000000) == 0xf0000000)
|
||||
|
||||
def IN_BADCLASS(i): return (((__int32_t)(i) & 0xf0000000) == 0xf0000000)
|
||||
|
||||
INADDR_NONE = 0xffffffff
|
||||
IN_LOOPBACKNET = 127
|
||||
IPNGVERSION = 6
|
||||
IPV6_FLOWINFO_FLOWLABEL = 0x00ffffff
|
||||
IPV6_FLOWINFO_PRIORITY = 0x0f000000
|
||||
IPV6_FLOWINFO_PRIFLOW = 0x0fffffff
|
||||
IPV6_FLOWINFO_SRFLAG = 0x10000000
|
||||
IPV6_FLOWINFO_VERSION = 0xf0000000
|
||||
IPV6_PRIORITY_UNCHARACTERIZED = 0x00000000
|
||||
IPV6_PRIORITY_FILLER = 0x01000000
|
||||
IPV6_PRIORITY_UNATTENDED = 0x02000000
|
||||
IPV6_PRIORITY_RESERVED1 = 0x03000000
|
||||
IPV6_PRIORITY_BULK = 0x04000000
|
||||
IPV6_PRIORITY_RESERVED2 = 0x05000000
|
||||
IPV6_PRIORITY_INTERACTIVE = 0x06000000
|
||||
IPV6_PRIORITY_CONTROL = 0x07000000
|
||||
IPV6_PRIORITY_8 = 0x08000000
|
||||
IPV6_PRIORITY_9 = 0x09000000
|
||||
IPV6_PRIORITY_10 = 0x0a000000
|
||||
IPV6_PRIORITY_11 = 0x0b000000
|
||||
IPV6_PRIORITY_12 = 0x0c000000
|
||||
IPV6_PRIORITY_13 = 0x0d000000
|
||||
IPV6_PRIORITY_14 = 0x0e000000
|
||||
IPV6_PRIORITY_15 = 0x0f000000
|
||||
IPV6_SRFLAG_STRICT = 0x10000000
|
||||
IPV6_SRFLAG_LOOSE = 0x00000000
|
||||
IPV6_VERSION = 0x60000000
|
||||
IPV6_FLOWINFO_FLOWLABEL = 0xffffff00
|
||||
IPV6_FLOWINFO_PRIORITY = 0x0000000f
|
||||
IPV6_FLOWINFO_PRIFLOW = 0xffffff0f
|
||||
IPV6_FLOWINFO_SRFLAG = 0x00000010
|
||||
IPV6_FLOWINFO_VERSION = 0x000000f0
|
||||
IPV6_PRIORITY_UNCHARACTERIZED = 0x00000000
|
||||
IPV6_PRIORITY_FILLER = 0x00000001
|
||||
IPV6_PRIORITY_UNATTENDED = 0x00000002
|
||||
IPV6_PRIORITY_RESERVED1 = 0x00000003
|
||||
IPV6_PRIORITY_BULK = 0x00000004
|
||||
IPV6_PRIORITY_RESERVED2 = 0x00000005
|
||||
IPV6_PRIORITY_INTERACTIVE = 0x00000006
|
||||
IPV6_PRIORITY_CONTROL = 0x00000007
|
||||
IPV6_PRIORITY_8 = 0x00000008
|
||||
IPV6_PRIORITY_9 = 0x00000009
|
||||
IPV6_PRIORITY_10 = 0x0000000a
|
||||
IPV6_PRIORITY_11 = 0x0000000b
|
||||
IPV6_PRIORITY_12 = 0x0000000c
|
||||
IPV6_PRIORITY_13 = 0x0000000d
|
||||
IPV6_PRIORITY_14 = 0x0000000e
|
||||
IPV6_PRIORITY_15 = 0x0000000f
|
||||
IPV6_SRFLAG_STRICT = 0x00000010
|
||||
IPV6_SRFLAG_LOOSE = 0x00000000
|
||||
IPV6_VERSION = 0x00000060
|
||||
def IPV6_GET_FLOWLABEL(x): return (ntohl(x) & 0x00ffffff)
|
||||
|
||||
def IPV6_GET_PRIORITY(x): return ((ntohl(x) >> 24) & 0xf)
|
||||
|
||||
def IPV6_GET_VERSION(x): return ((ntohl(x) >> 28) & 0xf)
|
||||
|
||||
def IPV6_SET_FLOWLABEL(x): return (htonl(x) & IPV6_FLOWINFO_FLOWLABEL)
|
||||
|
||||
def IPV6_SET_PRIORITY(x): return (htonl((x & 0xf) << 24))
|
||||
|
||||
def CLR_ADDR6(a): return \
|
||||
|
||||
def IS_ANYSOCKADDR(a): return \
|
||||
|
||||
def IS_ANYADDR6(a): return \
|
||||
|
||||
def IS_COMPATSOCKADDR(a): return \
|
||||
|
||||
def IS_COMPATADDR6(a): return \
|
||||
|
||||
def IS_LOOPSOCKADDR(a): return \
|
||||
|
||||
def IS_LOOPADDR6(a): return \
|
||||
|
||||
def IS_IPV4SOCKADDR(a): return \
|
||||
|
||||
def IS_IPV4ADDR6(a): return \
|
||||
|
||||
def IS_LOOPSOCKADDR(a): return \
|
||||
|
||||
def IS_LOOPADDR6(a): return \
|
||||
|
||||
def IS_IPV4SOCKADDR(a): return \
|
||||
|
||||
def IS_IPV4ADDR6(a): return \
|
||||
|
||||
def IS_LOCALADDR6(a): return ((a).s6_addr8[0] == 0xfe)
|
||||
|
||||
def IS_LINKLADDR6(a): return \
|
||||
|
||||
def IS_SITELADDR6(a): return \
|
||||
|
||||
def IS_MULTIADDR6(a): return ((a).s6_addr8[0] == 0xff)
|
||||
|
||||
def MADDR6_FLAGS(a): return ((a).s6_addr8[1] >> 4)
|
||||
|
||||
MADDR6_FLG_WK = 0
|
||||
MADDR6_FLG_TS = 1
|
||||
def MADDR6_SCOPE(a): return ((a).s6_addr8[1] & 0x0f)
|
||||
|
||||
MADDR6_SCP_NODE = 0x1
|
||||
MADDR6_SCP_LINK = 0x2
|
||||
MADDR6_SCP_SITE = 0x5
|
||||
MADDR6_SCP_ORG = 0x8
|
||||
MADDR6_SCP_GLO = 0xe
|
||||
MADDR6_ALLNODES = 1
|
||||
MADDR6_ALLROUTERS = 2
|
||||
MADDR6_ALLHOSTS = 3
|
||||
def IN6_IS_ADDR_UNSPECIFIED(p): return IS_ANYADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_LOOPBACK(p): return IS_LOOPADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_MULTICAST(p): return IS_MULTIADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_LINKLOCAL(p): return IS_LINKLADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_SITELOCAL(p): return IS_SITELADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_V4MAPPED(p): return IS_IPV4ADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_V4COMPAT(p): return IS_COMPATADDR6(*p)
|
||||
|
||||
def IN6_IS_ADDR_MC_NODELOCAL(p): return \
|
||||
|
||||
def IN6_IS_ADDR_MC_LINKLOCAL(p): return \
|
||||
|
||||
def IN6_IS_ADDR_MC_SITELOCAL(p): return \
|
||||
|
||||
def IN6_IS_ADDR_MC_ORGLOCAL(p): return \
|
||||
|
||||
def IN6_IS_ADDR_MC_GLOBAL(p): return \
|
||||
|
||||
IP_OPTIONS = 1
|
||||
IP_HDRINCL = 2
|
||||
IP_TOS = 3
|
||||
IP_TTL = 4
|
||||
IP_RECVOPTS = 5
|
||||
IP_RECVRETOPTS = 6
|
||||
IP_RECVDSTADDR = 7
|
||||
IP_RETOPTS = 8
|
||||
IP_MULTICAST_IF = 20
|
||||
IP_MULTICAST_TTL = 21
|
||||
IP_MULTICAST_LOOP = 22
|
||||
IP_ADD_MEMBERSHIP = 23
|
||||
IP_DROP_MEMBERSHIP = 24
|
||||
IP_MULTICAST_VIF = 25
|
||||
IP_RSVP_VIF_ON = 26
|
||||
IP_RSVP_VIF_OFF = 27
|
||||
IP_RSVP_ON = 28
|
||||
IP_SENDSRCADDR = 36
|
||||
IPV6_UNICAST_HOPS = IP_TTL
|
||||
IPV6_MULTICAST_IF = IP_MULTICAST_IF
|
||||
IPV6_MULTICAST_HOPS = IP_MULTICAST_TTL
|
||||
IPV6_MULTICAST_LOOP = IP_MULTICAST_LOOP
|
||||
IPV6_ADD_MEMBERSHIP = IP_ADD_MEMBERSHIP
|
||||
IPV6_DROP_MEMBERSHIP = IP_DROP_MEMBERSHIP
|
||||
IPV6_SENDIF = 40
|
||||
IPV6_NOPROBE = 42
|
||||
IPV6_RECVPKTINFO = 43
|
||||
IPV6_PKTINFO = 44
|
||||
IP_RECVTTL = 45
|
||||
IPV6_RECVHOPS = IP_RECVTTL
|
||||
IPV6_CHECKSUM = 46
|
||||
ICMP6_FILTER = 47
|
||||
IPV6_HOPLIMIT = 48
|
||||
IPV6_HOPOPTS = 49
|
||||
IPV6_DSTOPTS = 50
|
||||
IPV6_RTHDR = 51
|
||||
IPV6_PKTOPTIONS = 52
|
||||
IPV6_NEXTHOP = 53
|
||||
IP_DEFAULT_MULTICAST_TTL = 1
|
||||
IP_DEFAULT_MULTICAST_LOOP = 1
|
||||
IPV6_RTHDR_LOOSE = 0
|
||||
IPV6_RTHDR_STRICT = 1
|
||||
IPV6_RTHDR_TYPE_0 = 0
|
@ -1,233 +0,0 @@
|
||||
# These lines were mostly generated by h2py.py (see demo/scripts)
|
||||
# from <sys/ioctl.h>, <sys/termio.h> and <termios.h> on Irix 4.0.2
|
||||
# with some manual changes to cope with imperfections in h2py.py.
|
||||
# The applicability on other systems is not clear; especially non-SYSV
|
||||
# systems may have a totally different set of ioctls.
|
||||
|
||||
IOCTYPE = 0xff00
|
||||
LIOC = (ord('l')<<8)
|
||||
LIOCGETP = (LIOC|1)
|
||||
LIOCSETP = (LIOC|2)
|
||||
LIOCGETS = (LIOC|5)
|
||||
LIOCSETS = (LIOC|6)
|
||||
DIOC = (ord('d')<<8)
|
||||
DIOCGETC = (DIOC|1)
|
||||
DIOCGETB = (DIOC|2)
|
||||
DIOCSETE = (DIOC|3)
|
||||
IOCPARM_MASK = 0x7f
|
||||
IOC_VOID = 0x20000000
|
||||
IOC_OUT = 0x40000000
|
||||
IOC_IN = 0x80000000
|
||||
IOC_INOUT = (IOC_IN|IOC_OUT)
|
||||
int = 'i'
|
||||
short = 'h'
|
||||
long = 'l'
|
||||
def sizeof(t): import struct; return struct.calcsize(t)
|
||||
def _IO(x,y): return (IOC_VOID|((x)<<8)|y)
|
||||
def _IOR(x,y,t): return (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
|
||||
def _IOW(x,y,t): return (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
|
||||
# this should be _IORW, but stdio got there first
|
||||
def _IOWR(x,y,t): return (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
|
||||
FIONREAD = _IOR(ord('f'), 127, int)
|
||||
FIONBIO = _IOW(ord('f'), 126, int)
|
||||
FIOASYNC = _IOW(ord('f'), 125, int)
|
||||
FIOSETOWN = _IOW(ord('f'), 124, int)
|
||||
FIOGETOWN = _IOR(ord('f'), 123, int)
|
||||
NCC = 8
|
||||
NCC_PAD = 7
|
||||
NCC_EXT = 16
|
||||
NCCS = (NCC+NCC_PAD+NCC_EXT)
|
||||
VINTR = 0
|
||||
VQUIT = 1
|
||||
VERASE = 2
|
||||
VKILL = 3
|
||||
VEOF = 4
|
||||
VEOL = 5
|
||||
VEOL2 = 6
|
||||
VMIN = VEOF
|
||||
VTIME = VEOL
|
||||
VSWTCH = 7
|
||||
VLNEXT = (NCC+NCC_PAD+0)
|
||||
VWERASE = (NCC+NCC_PAD+1)
|
||||
VRPRNT = (NCC+NCC_PAD+2)
|
||||
VFLUSHO = (NCC+NCC_PAD+3)
|
||||
VSTOP = (NCC+NCC_PAD+4)
|
||||
VSTART = (NCC+NCC_PAD+5)
|
||||
CNUL = '\0'
|
||||
CDEL = '\377'
|
||||
CESC = '\\'
|
||||
CINTR = '\177'
|
||||
CQUIT = '\34'
|
||||
CBRK = '\377'
|
||||
def CTRL(c): return ord(c) & 0x0f
|
||||
CERASE = CTRL('H')
|
||||
CKILL = CTRL('U')
|
||||
CEOF = CTRL('d')
|
||||
CEOT = CEOF
|
||||
CSTART = CTRL('q')
|
||||
CSTOP = CTRL('s')
|
||||
CSWTCH = CTRL('z')
|
||||
CSUSP = CSWTCH
|
||||
CNSWTCH = 0
|
||||
CLNEXT = CTRL('v')
|
||||
CWERASE = CTRL('w')
|
||||
CFLUSHO = CTRL('o')
|
||||
CFLUSH = CFLUSHO
|
||||
CRPRNT = CTRL('r')
|
||||
CDSUSP = CTRL('y')
|
||||
IGNBRK = 0000001
|
||||
BRKINT = 0000002
|
||||
IGNPAR = 0000004
|
||||
PARMRK = 0000010
|
||||
INPCK = 0000020
|
||||
ISTRIP = 0000040
|
||||
INLCR = 0000100
|
||||
IGNCR = 0000200
|
||||
ICRNL = 0000400
|
||||
IUCLC = 0001000
|
||||
IXON = 0002000
|
||||
IXANY = 0004000
|
||||
IXOFF = 0010000
|
||||
IBLKMD = 0020000
|
||||
OPOST = 0000001
|
||||
OLCUC = 0000002
|
||||
ONLCR = 0000004
|
||||
OCRNL = 0000010
|
||||
ONOCR = 0000020
|
||||
ONLRET = 0000040
|
||||
OFILL = 0000100
|
||||
OFDEL = 0000200
|
||||
NLDLY = 0000400
|
||||
NL0 = 0
|
||||
NL1 = 0000400
|
||||
CRDLY = 0003000
|
||||
CR0 = 0
|
||||
CR1 = 0001000
|
||||
CR2 = 0002000
|
||||
CR3 = 0003000
|
||||
TABDLY = 0014000
|
||||
TAB0 = 0
|
||||
TAB1 = 0004000
|
||||
TAB2 = 0010000
|
||||
TAB3 = 0014000
|
||||
BSDLY = 0020000
|
||||
BS0 = 0
|
||||
BS1 = 0020000
|
||||
VTDLY = 0040000
|
||||
VT0 = 0
|
||||
VT1 = 0040000
|
||||
FFDLY = 0100000
|
||||
FF0 = 0
|
||||
FF1 = 0100000
|
||||
CBAUD = 0000017
|
||||
B0 = 0
|
||||
B50 = 0000001
|
||||
B75 = 0000002
|
||||
B110 = 0000003
|
||||
B134 = 0000004
|
||||
B150 = 0000005
|
||||
B200 = 0000006
|
||||
B300 = 0000007
|
||||
B600 = 0000010
|
||||
B1200 = 0000011
|
||||
B1800 = 0000012
|
||||
B2400 = 0000013
|
||||
B4800 = 0000014
|
||||
B9600 = 0000015
|
||||
B19200 = 0000016
|
||||
EXTA = 0000016
|
||||
B38400 = 0000017
|
||||
EXTB = 0000017
|
||||
CSIZE = 0000060
|
||||
CS5 = 0
|
||||
CS6 = 0000020
|
||||
CS7 = 0000040
|
||||
CS8 = 0000060
|
||||
CSTOPB = 0000100
|
||||
CREAD = 0000200
|
||||
PARENB = 0000400
|
||||
PARODD = 0001000
|
||||
HUPCL = 0002000
|
||||
CLOCAL = 0004000
|
||||
LOBLK = 0040000
|
||||
ISIG = 0000001
|
||||
ICANON = 0000002
|
||||
XCASE = 0000004
|
||||
ECHO = 0000010
|
||||
ECHOE = 0000020
|
||||
ECHOK = 0000040
|
||||
ECHONL = 0000100
|
||||
NOFLSH = 0000200
|
||||
IIEXTEN = 0000400
|
||||
ITOSTOP = 0001000
|
||||
SSPEED = B9600
|
||||
IOCTYPE = 0xff00
|
||||
TIOC = (ord('T')<<8)
|
||||
oTCGETA = (TIOC|1)
|
||||
oTCSETA = (TIOC|2)
|
||||
oTCSETAW = (TIOC|3)
|
||||
oTCSETAF = (TIOC|4)
|
||||
TCSBRK = (TIOC|5)
|
||||
TCXONC = (TIOC|6)
|
||||
TCFLSH = (TIOC|7)
|
||||
TCGETA = (TIOC|8)
|
||||
TCSETA = (TIOC|9)
|
||||
TCSETAW = (TIOC|10)
|
||||
TCSETAF = (TIOC|11)
|
||||
TIOCFLUSH = (TIOC|12)
|
||||
TCDSET = (TIOC|32)
|
||||
TCBLKMD = (TIOC|33)
|
||||
TIOCPKT = (TIOC|112)
|
||||
TIOCPKT_DATA = 0x00
|
||||
TIOCPKT_FLUSHREAD = 0x01
|
||||
TIOCPKT_FLUSHWRITE = 0x02
|
||||
TIOCPKT_NOSTOP = 0x10
|
||||
TIOCPKT_DOSTOP = 0x20
|
||||
TIOCNOTTY = (TIOC|113)
|
||||
TIOCSTI = (TIOC|114)
|
||||
TIOCSPGRP = _IOW(ord('t'), 118, int)
|
||||
TIOCGPGRP = _IOR(ord('t'), 119, int)
|
||||
TIOCCONS = _IOW(ord('t'), 120, int)
|
||||
struct_winsize = 'hhhh'
|
||||
TIOCGWINSZ = _IOR(ord('t'), 104, struct_winsize)
|
||||
TIOCSWINSZ = _IOW(ord('t'), 103, struct_winsize)
|
||||
TFIOC = (ord('F')<<8)
|
||||
oFIONREAD = (TFIOC|127)
|
||||
LDIOC = (ord('D')<<8)
|
||||
LDOPEN = (LDIOC|0)
|
||||
LDCLOSE = (LDIOC|1)
|
||||
LDCHG = (LDIOC|2)
|
||||
LDGETT = (LDIOC|8)
|
||||
LDSETT = (LDIOC|9)
|
||||
TERM_NONE = 0
|
||||
TERM_TEC = 1
|
||||
TERM_V61 = 2
|
||||
TERM_V10 = 3
|
||||
TERM_TEX = 4
|
||||
TERM_D40 = 5
|
||||
TERM_H45 = 6
|
||||
TERM_D42 = 7
|
||||
TM_NONE = 0000
|
||||
TM_SNL = 0001
|
||||
TM_ANL = 0002
|
||||
TM_LCF = 0004
|
||||
TM_CECHO = 0010
|
||||
TM_CINVIS = 0020
|
||||
TM_SET = 0200
|
||||
LDISC0 = 0
|
||||
LDISC1 = 1
|
||||
NTTYDISC = LDISC1
|
||||
VSUSP = VSWTCH
|
||||
TCSANOW = 0
|
||||
TCSADRAIN = 1
|
||||
TCSAFLUSH = 2
|
||||
TCIFLUSH = 0
|
||||
TCOFLUSH = 1
|
||||
TCIOFLUSH = 2
|
||||
TCOOFF = 0
|
||||
TCOON = 1
|
||||
TCIOFF = 2
|
||||
TCION = 3
|
||||
TO_STOP = LOBLK
|
||||
IEXTEN = IIEXTEN
|
||||
TOSTOP = ITOSTOP
|
@ -1,120 +0,0 @@
|
||||
NTSC_XMAX = 640
|
||||
NTSC_YMAX = 480
|
||||
PAL_XMAX = 768
|
||||
PAL_YMAX = 576
|
||||
BLANKING_BUFFER_SIZE = 2
|
||||
|
||||
MAX_SOURCES = 2
|
||||
|
||||
# mode parameter for Bind calls
|
||||
IN_OFF = 0 # No Video
|
||||
IN_OVER = 1 # Video over graphics
|
||||
IN_UNDER = 2 # Video under graphics
|
||||
IN_REPLACE = 3 # Video replaces entire win
|
||||
|
||||
# mode parameters for LoadMap calls. Specifies buffer, always 256 entries
|
||||
INPUT_COLORMAP = 0 # tuples of 8-bit RGB
|
||||
CHROMA_KEY_MAP = 1 # tuples of 8-bit RGB
|
||||
COLOR_SPACE_MAP = 2 # tuples of 8-bit RGB
|
||||
GAMMA_MAP = 3 # tuples of 24-bit red values
|
||||
|
||||
# mode parameters for UseExclusive calls
|
||||
INPUT = 0
|
||||
OUTPUT = 1
|
||||
IN_OUT = 2
|
||||
|
||||
# Format constants for the capture routines
|
||||
RGB8_FRAMES = 0 # noninterleaved 8 bit 3:2:3 RBG fields
|
||||
RGB32_FRAMES = 1 # 32-bit 8:8:8 RGB frames
|
||||
YUV411_FRAMES = 2 # interleaved, 8:2:2 YUV format
|
||||
YUV411_FRAMES_AND_BLANKING_BUFFER = 3
|
||||
|
||||
#
|
||||
# sv.SetParam is passed variable length argument lists,
|
||||
# consisting of <name, value> pairs. The following
|
||||
# constants identify argument names.
|
||||
#
|
||||
_NAME_BASE = 1000
|
||||
SOURCE = (_NAME_BASE + 0)
|
||||
SOURCE1 = 0
|
||||
SOURCE2 = 1
|
||||
SOURCE3 = 2
|
||||
COLOR = (_NAME_BASE + 1)
|
||||
DEFAULT_COLOR = 0
|
||||
USER_COLOR = 1
|
||||
MONO = 2
|
||||
OUTPUTMODE = (_NAME_BASE + 2)
|
||||
LIVE_OUTPUT = 0
|
||||
STILL24_OUT = 1
|
||||
FREEZE = (_NAME_BASE + 3)
|
||||
DITHER = (_NAME_BASE + 4)
|
||||
OUTPUT_FILTER = (_NAME_BASE + 5)
|
||||
HUE = (_NAME_BASE + 6)
|
||||
GENLOCK = (_NAME_BASE + 7)
|
||||
GENLOCK_OFF = 0
|
||||
GENLOCK_ON = 1
|
||||
GENLOCK_HOUSE = 2
|
||||
BROADCAST = (_NAME_BASE + 8)
|
||||
NTSC = 0
|
||||
PAL = 1
|
||||
VIDEO_MODE = (_NAME_BASE + 9)
|
||||
COMP = 0
|
||||
SVIDEO = 1
|
||||
INPUT_BYPASS = (_NAME_BASE + 10)
|
||||
FIELDDROP = (_NAME_BASE + 11)
|
||||
SLAVE = (_NAME_BASE + 12)
|
||||
APERTURE_FACTOR = (_NAME_BASE + 13)
|
||||
AFACTOR_0 = 0
|
||||
AFACTOR_QTR = 1
|
||||
AFACTOR_HLF = 2
|
||||
AFACTOR_ONE = 3
|
||||
CORING = (_NAME_BASE + 14)
|
||||
COR_OFF = 0
|
||||
COR_1LSB = 1
|
||||
COR_2LSB = 2
|
||||
COR_3LSB = 3
|
||||
APERTURE_BANDPASS = (_NAME_BASE + 15)
|
||||
ABAND_F0 = 0
|
||||
ABAND_F1 = 1
|
||||
ABAND_F2 = 2
|
||||
ABAND_F3 = 3
|
||||
PREFILTER = (_NAME_BASE + 16)
|
||||
CHROMA_TRAP = (_NAME_BASE + 17)
|
||||
CK_THRESHOLD = (_NAME_BASE + 18)
|
||||
PAL_SENSITIVITY = (_NAME_BASE + 19)
|
||||
GAIN_CONTROL = (_NAME_BASE + 20)
|
||||
GAIN_SLOW = 0
|
||||
GAIN_MEDIUM = 1
|
||||
GAIN_FAST = 2
|
||||
GAIN_FROZEN = 3
|
||||
AUTO_CKILL = (_NAME_BASE + 21)
|
||||
VTR_MODE = (_NAME_BASE + 22)
|
||||
VTR_INPUT = 0
|
||||
CAMERA_INPUT = 1
|
||||
LUMA_DELAY = (_NAME_BASE + 23)
|
||||
VNOISE = (_NAME_BASE + 24)
|
||||
VNOISE_NORMAL = 0
|
||||
VNOISE_SEARCH = 1
|
||||
VNOISE_AUTO = 2
|
||||
VNOISE_BYPASS = 3
|
||||
CHCV_PAL = (_NAME_BASE + 25)
|
||||
CHCV_NTSC = (_NAME_BASE + 26)
|
||||
CCIR_LEVELS = (_NAME_BASE + 27)
|
||||
STD_CHROMA = (_NAME_BASE + 28)
|
||||
DENC_VTBYPASS = (_NAME_BASE + 29)
|
||||
FAST_TIMECONSTANT = (_NAME_BASE + 30)
|
||||
GENLOCK_DELAY = (_NAME_BASE + 31)
|
||||
PHASE_SYNC = (_NAME_BASE + 32)
|
||||
VIDEO_OUTPUT = (_NAME_BASE + 33)
|
||||
CHROMA_PHASEOUT = (_NAME_BASE + 34)
|
||||
CHROMA_CENTER = (_NAME_BASE + 35)
|
||||
YUV_TO_RGB_INVERT = (_NAME_BASE + 36)
|
||||
SOURCE1_BROADCAST = (_NAME_BASE + 37)
|
||||
SOURCE1_MODE = (_NAME_BASE + 38)
|
||||
SOURCE2_BROADCAST = (_NAME_BASE + 39)
|
||||
SOURCE2_MODE = (_NAME_BASE + 40)
|
||||
SOURCE3_BROADCAST = (_NAME_BASE + 41)
|
||||
SOURCE3_MODE = (_NAME_BASE + 42)
|
||||
SIGNAL_STD = (_NAME_BASE + 43)
|
||||
NOSIGNAL = 2
|
||||
SIGNAL_COLOR = (_NAME_BASE + 44)
|
@ -1,335 +0,0 @@
|
||||
# Generated by h2py from /usr/include/sys/wait.h
|
||||
|
||||
# Included from standards.h
|
||||
def _W_INT(i): return (i)
|
||||
|
||||
WUNTRACED = 0004
|
||||
WNOHANG = 0100
|
||||
_WSTOPPED = 0177
|
||||
def WIFEXITED(stat): return ((_W_INT(stat)&0377)==0)
|
||||
|
||||
def WEXITSTATUS(stat): return ((_W_INT(stat)>>8)&0377)
|
||||
|
||||
def WTERMSIG(stat): return (_W_INT(stat)&0177)
|
||||
|
||||
def WSTOPSIG(stat): return ((_W_INT(stat)>>8)&0377)
|
||||
|
||||
WEXITED = 0001
|
||||
WTRAPPED = 0002
|
||||
WSTOPPED = 0004
|
||||
WCONTINUED = 0010
|
||||
WNOWAIT = 0200
|
||||
WOPTMASK = (WEXITED|WTRAPPED|WSTOPPED|WCONTINUED|WNOHANG|WNOWAIT)
|
||||
WSTOPFLG = 0177
|
||||
WCONTFLG = 0177777
|
||||
WCOREFLAG = 0200
|
||||
WSIGMASK = 0177
|
||||
def WWORD(stat): return (_W_INT(stat)&0177777)
|
||||
|
||||
def WIFCONTINUED(stat): return (WWORD(stat)==WCONTFLG)
|
||||
|
||||
def WCOREDUMP(stat): return (_W_INT(stat) & WCOREFLAG)
|
||||
|
||||
|
||||
# Included from sys/types.h
|
||||
|
||||
# Included from sgidefs.h
|
||||
_MIPS_ISA_MIPS1 = 1
|
||||
_MIPS_ISA_MIPS2 = 2
|
||||
_MIPS_ISA_MIPS3 = 3
|
||||
_MIPS_ISA_MIPS4 = 4
|
||||
_MIPS_SIM_ABI32 = 1
|
||||
_MIPS_SIM_NABI32 = 2
|
||||
_MIPS_SIM_ABI64 = 3
|
||||
P_MYID = (-1)
|
||||
P_MYHOSTID = (-1)
|
||||
|
||||
# Included from sys/bsd_types.h
|
||||
|
||||
# Included from sys/mkdev.h
|
||||
ONBITSMAJOR = 7
|
||||
ONBITSMINOR = 8
|
||||
OMAXMAJ = 0x7f
|
||||
OMAXMIN = 0xff
|
||||
NBITSMAJOR = 14
|
||||
NBITSMINOR = 18
|
||||
MAXMAJ = 0x1ff
|
||||
MAXMIN = 0x3ffff
|
||||
OLDDEV = 0
|
||||
NEWDEV = 1
|
||||
MKDEV_VER = NEWDEV
|
||||
def major(dev): return __major(MKDEV_VER, dev)
|
||||
|
||||
def minor(dev): return __minor(MKDEV_VER, dev)
|
||||
|
||||
|
||||
# Included from sys/select.h
|
||||
FD_SETSIZE = 1024
|
||||
__NBBY = 8
|
||||
|
||||
# Included from string.h
|
||||
NULL = 0
|
||||
NBBY = 8
|
||||
|
||||
# Included from sys/procset.h
|
||||
P_INITPID = 1
|
||||
P_INITUID = 0
|
||||
P_INITPGID = 0
|
||||
|
||||
# Included from sys/signal.h
|
||||
SIGHUP = 1
|
||||
SIGINT = 2
|
||||
SIGQUIT = 3
|
||||
SIGILL = 4
|
||||
SIGTRAP = 5
|
||||
SIGIOT = 6
|
||||
SIGABRT = 6
|
||||
SIGEMT = 7
|
||||
SIGFPE = 8
|
||||
SIGKILL = 9
|
||||
SIGBUS = 10
|
||||
SIGSEGV = 11
|
||||
SIGSYS = 12
|
||||
SIGPIPE = 13
|
||||
SIGALRM = 14
|
||||
SIGTERM = 15
|
||||
SIGUSR1 = 16
|
||||
SIGUSR2 = 17
|
||||
SIGCLD = 18
|
||||
SIGCHLD = 18
|
||||
SIGPWR = 19
|
||||
SIGWINCH = 20
|
||||
SIGURG = 21
|
||||
SIGPOLL = 22
|
||||
SIGIO = 22
|
||||
SIGSTOP = 23
|
||||
SIGTSTP = 24
|
||||
SIGCONT = 25
|
||||
SIGTTIN = 26
|
||||
SIGTTOU = 27
|
||||
SIGVTALRM = 28
|
||||
SIGPROF = 29
|
||||
SIGXCPU = 30
|
||||
SIGXFSZ = 31
|
||||
SIG32 = 32
|
||||
SIGCKPT = 33
|
||||
SIGRTMIN = 49
|
||||
SIGRTMAX = 64
|
||||
SIGPTINTR = 47
|
||||
SIGPTRESCHED = 48
|
||||
__sigargs = int
|
||||
SIGEV_NONE = 128
|
||||
SIGEV_SIGNAL = 129
|
||||
SIGEV_CALLBACK = 130
|
||||
|
||||
# Included from sys/siginfo.h
|
||||
ILL_ILLOPC = 1
|
||||
ILL_ILLOPN = 2
|
||||
ILL_ILLADR = 3
|
||||
ILL_ILLTRP = 4
|
||||
ILL_PRVOPC = 5
|
||||
ILL_PRVREG = 6
|
||||
ILL_COPROC = 7
|
||||
ILL_BADSTK = 8
|
||||
NSIGILL = 8
|
||||
FPE_INTDIV = 1
|
||||
FPE_INTOVF = 2
|
||||
FPE_FLTDIV = 3
|
||||
FPE_FLTOVF = 4
|
||||
FPE_FLTUND = 5
|
||||
FPE_FLTRES = 6
|
||||
FPE_FLTINV = 7
|
||||
FPE_FLTSUB = 8
|
||||
NSIGFPE = 8
|
||||
SEGV_MAPERR = 1
|
||||
SEGV_ACCERR = 2
|
||||
NSIGSEGV = 2
|
||||
BUS_ADRALN = 1
|
||||
BUS_ADRERR = 2
|
||||
BUS_OBJERR = 3
|
||||
NSIGBUS = 3
|
||||
TRAP_BRKPT = 1
|
||||
TRAP_TRACE = 2
|
||||
NSIGTRAP = 2
|
||||
CLD_EXITED = 1
|
||||
CLD_KILLED = 2
|
||||
CLD_DUMPED = 3
|
||||
CLD_TRAPPED = 4
|
||||
CLD_STOPPED = 5
|
||||
CLD_CONTINUED = 6
|
||||
NSIGCLD = 6
|
||||
POLL_IN = 1
|
||||
POLL_OUT = 2
|
||||
POLL_MSG = 3
|
||||
POLL_ERR = 4
|
||||
POLL_PRI = 5
|
||||
POLL_HUP = 6
|
||||
NSIGPOLL = 6
|
||||
SI_MAXSZ = 128
|
||||
SI_USER = 0
|
||||
SI_KILL = SI_USER
|
||||
SI_QUEUE = -1
|
||||
SI_ASYNCIO = -2
|
||||
SI_TIMER = -3
|
||||
SI_MESGQ = -4
|
||||
SIG_NOP = 0
|
||||
SIG_BLOCK = 1
|
||||
SIG_UNBLOCK = 2
|
||||
SIG_SETMASK = 3
|
||||
SIG_SETMASK32 = 256
|
||||
SA_ONSTACK = 0x00000001
|
||||
SA_RESETHAND = 0x00000002
|
||||
SA_RESTART = 0x00000004
|
||||
SA_SIGINFO = 0x00000008
|
||||
SA_NODEFER = 0x00000010
|
||||
SA_NOCLDWAIT = 0x00010000
|
||||
SA_NOCLDSTOP = 0x00020000
|
||||
_SA_BSDCALL = 0x10000000
|
||||
MINSIGSTKSZ = 512
|
||||
SIGSTKSZ = 8192
|
||||
SS_ONSTACK = 0x00000001
|
||||
SS_DISABLE = 0x00000002
|
||||
|
||||
# Included from sys/ucontext.h
|
||||
NGREG = 36
|
||||
NGREG = 37
|
||||
GETCONTEXT = 0
|
||||
SETCONTEXT = 1
|
||||
UC_SIGMASK = 001
|
||||
UC_STACK = 002
|
||||
UC_CPU = 004
|
||||
UC_MAU = 010
|
||||
UC_MCONTEXT = (UC_CPU|UC_MAU)
|
||||
UC_ALL = (UC_SIGMASK|UC_STACK|UC_MCONTEXT)
|
||||
CTX_R0 = 0
|
||||
CTX_AT = 1
|
||||
CTX_V0 = 2
|
||||
CTX_V1 = 3
|
||||
CTX_A0 = 4
|
||||
CTX_A1 = 5
|
||||
CTX_A2 = 6
|
||||
CTX_A3 = 7
|
||||
CTX_T0 = 8
|
||||
CTX_T1 = 9
|
||||
CTX_T2 = 10
|
||||
CTX_T3 = 11
|
||||
CTX_T4 = 12
|
||||
CTX_T5 = 13
|
||||
CTX_T6 = 14
|
||||
CTX_T7 = 15
|
||||
CTX_A4 = 8
|
||||
CTX_A5 = 9
|
||||
CTX_A6 = 10
|
||||
CTX_A7 = 11
|
||||
CTX_T0 = 12
|
||||
CTX_T1 = 13
|
||||
CTX_T2 = 14
|
||||
CTX_T3 = 15
|
||||
CTX_S0 = 16
|
||||
CTX_S1 = 17
|
||||
CTX_S2 = 18
|
||||
CTX_S3 = 19
|
||||
CTX_S4 = 20
|
||||
CTX_S5 = 21
|
||||
CTX_S6 = 22
|
||||
CTX_S7 = 23
|
||||
CTX_T8 = 24
|
||||
CTX_T9 = 25
|
||||
CTX_K0 = 26
|
||||
CTX_K1 = 27
|
||||
CTX_GP = 28
|
||||
CTX_SP = 29
|
||||
CTX_S8 = 30
|
||||
CTX_RA = 31
|
||||
CTX_MDLO = 32
|
||||
CTX_MDHI = 33
|
||||
CTX_CAUSE = 34
|
||||
CTX_EPC = 35
|
||||
CTX_SR = 36
|
||||
CXT_R0 = CTX_R0
|
||||
CXT_AT = CTX_AT
|
||||
CXT_V0 = CTX_V0
|
||||
CXT_V1 = CTX_V1
|
||||
CXT_A0 = CTX_A0
|
||||
CXT_A1 = CTX_A1
|
||||
CXT_A2 = CTX_A2
|
||||
CXT_A3 = CTX_A3
|
||||
CXT_T0 = CTX_T0
|
||||
CXT_T1 = CTX_T1
|
||||
CXT_T2 = CTX_T2
|
||||
CXT_T3 = CTX_T3
|
||||
CXT_T4 = CTX_T4
|
||||
CXT_T5 = CTX_T5
|
||||
CXT_T6 = CTX_T6
|
||||
CXT_T7 = CTX_T7
|
||||
CXT_S0 = CTX_S0
|
||||
CXT_S1 = CTX_S1
|
||||
CXT_S2 = CTX_S2
|
||||
CXT_S3 = CTX_S3
|
||||
CXT_S4 = CTX_S4
|
||||
CXT_S5 = CTX_S5
|
||||
CXT_S6 = CTX_S6
|
||||
CXT_S7 = CTX_S7
|
||||
CXT_T8 = CTX_T8
|
||||
CXT_T9 = CTX_T9
|
||||
CXT_K0 = CTX_K0
|
||||
CXT_K1 = CTX_K1
|
||||
CXT_GP = CTX_GP
|
||||
CXT_SP = CTX_SP
|
||||
CXT_S8 = CTX_S8
|
||||
CXT_RA = CTX_RA
|
||||
CXT_MDLO = CTX_MDLO
|
||||
CXT_MDHI = CTX_MDHI
|
||||
CXT_CAUSE = CTX_CAUSE
|
||||
CXT_EPC = CTX_EPC
|
||||
CXT_SR = CTX_SR
|
||||
SV_ONSTACK = 0x0001
|
||||
SV_INTERRUPT = 0x0002
|
||||
NUMBSDSIGS = (32)
|
||||
def sigmask(sig): return (1 << ((sig)-1))
|
||||
|
||||
def sigmask(sig): return (1 << ((sig)-1))
|
||||
|
||||
SIG_ERR = (-1)
|
||||
SIG_IGN = (1)
|
||||
SIG_HOLD = (2)
|
||||
SIG_DFL = (0)
|
||||
NSIG = 65
|
||||
MAXSIG = (NSIG-1)
|
||||
NUMSIGS = (NSIG-1)
|
||||
BRK_USERBP = 0
|
||||
BRK_KERNELBP = 1
|
||||
BRK_ABORT = 2
|
||||
BRK_BD_TAKEN = 3
|
||||
BRK_BD_NOTTAKEN = 4
|
||||
BRK_SSTEPBP = 5
|
||||
BRK_OVERFLOW = 6
|
||||
BRK_DIVZERO = 7
|
||||
BRK_RANGE = 8
|
||||
BRK_PSEUDO_OP_BIT = 0x80
|
||||
BRK_PSEUDO_OP_MAX = 0x3
|
||||
BRK_CACHE_SYNC = 0x80
|
||||
BRK_SWASH_FLUSH = 0x81
|
||||
BRK_SWASH_SWTCH = 0x82
|
||||
BRK_MULOVF = 1023
|
||||
|
||||
# Included from sys/resource.h
|
||||
PRIO_MIN = -20
|
||||
PRIO_MAX = 20
|
||||
PRIO_PROCESS = 0
|
||||
PRIO_PGRP = 1
|
||||
PRIO_USER = 2
|
||||
RUSAGE_SELF = 0
|
||||
RUSAGE_CHILDREN = -1
|
||||
RLIMIT_CPU = 0
|
||||
RLIMIT_FSIZE = 1
|
||||
RLIMIT_DATA = 2
|
||||
RLIMIT_STACK = 3
|
||||
RLIMIT_CORE = 4
|
||||
RLIMIT_NOFILE = 5
|
||||
RLIMIT_VMEM = 6
|
||||
RLIMIT_RSS = 7
|
||||
RLIMIT_AS = RLIMIT_VMEM
|
||||
RLIM_NLIMITS = 8
|
||||
RLIM32_INFINITY = 0x7fffffff
|
||||
RLIM_INFINITY = 0x7fffffff
|
@ -1,203 +0,0 @@
|
||||
# This file implements a class which forms an interface to the .cddb
|
||||
# directory that is maintained by SGI's cdman program.
|
||||
#
|
||||
# Usage is as follows:
|
||||
#
|
||||
# import readcd
|
||||
# r = readcd.Readcd()
|
||||
# c = Cddb(r.gettrackinfo())
|
||||
#
|
||||
# Now you can use c.artist, c.title and c.track[trackno] (where trackno
|
||||
# starts at 1). When the CD is not recognized, all values will be the empty
|
||||
# string.
|
||||
# It is also possible to set the above mentioned variables to new values.
|
||||
# You can then use c.write() to write out the changed values to the
|
||||
# .cdplayerrc file.
|
||||
|
||||
import posix, os
|
||||
|
||||
_cddbrc = '.cddb'
|
||||
_DB_ID_NTRACKS = 5
|
||||
_dbid_map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ@_=+abcdefghijklmnopqrstuvwxyz'
|
||||
def _dbid(v):
|
||||
if v >= len(_dbid_map):
|
||||
return v.zfill(2)
|
||||
else:
|
||||
return _dbid_map[v]
|
||||
|
||||
def tochash(toc):
|
||||
if type(toc) == type(''):
|
||||
tracklist = []
|
||||
for i in range(2, len(toc), 4):
|
||||
tracklist.append((None,
|
||||
(int(toc[i:i+2]),
|
||||
int(toc[i+2:i+4]))))
|
||||
else:
|
||||
tracklist = toc
|
||||
ntracks = len(tracklist)
|
||||
hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
|
||||
if ntracks <= _DB_ID_NTRACKS:
|
||||
nidtracks = ntracks
|
||||
else:
|
||||
nidtracks = _DB_ID_NTRACKS - 1
|
||||
min = 0
|
||||
sec = 0
|
||||
for track in tracklist:
|
||||
start, length = track
|
||||
min = min + length[0]
|
||||
sec = sec + length[1]
|
||||
min = min + sec / 60
|
||||
sec = sec % 60
|
||||
hash = hash + _dbid(min) + _dbid(sec)
|
||||
for i in range(nidtracks):
|
||||
start, length = tracklist[i]
|
||||
hash = hash + _dbid(length[0]) + _dbid(length[1])
|
||||
return hash
|
||||
|
||||
class Cddb:
|
||||
def __init__(self, tracklist):
|
||||
if os.environ.has_key('CDDB_PATH'):
|
||||
path = os.environ['CDDB_PATH']
|
||||
cddb_path = path.split(',')
|
||||
else:
|
||||
home = os.environ['HOME']
|
||||
cddb_path = [home + '/' + _cddbrc]
|
||||
|
||||
self._get_id(tracklist)
|
||||
|
||||
for dir in cddb_path:
|
||||
file = dir + '/' + self.id + '.rdb'
|
||||
try:
|
||||
f = open(file, 'r')
|
||||
self.file = file
|
||||
break
|
||||
except IOError:
|
||||
pass
|
||||
ntracks = int(self.id[:2], 16)
|
||||
self.artist = ''
|
||||
self.title = ''
|
||||
self.track = [None] + [''] * ntracks
|
||||
self.trackartist = [None] + [''] * ntracks
|
||||
self.notes = []
|
||||
if not hasattr(self, 'file'):
|
||||
return
|
||||
import re
|
||||
reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)')
|
||||
while 1:
|
||||
line = f.readline()
|
||||
if not line:
|
||||
break
|
||||
match = reg.match(line)
|
||||
if not match:
|
||||
print('syntax error in ' + file)
|
||||
continue
|
||||
name1, name2, value = match.group(1, 2, 3)
|
||||
if name1 == 'album':
|
||||
if name2 == 'artist':
|
||||
self.artist = value
|
||||
elif name2 == 'title':
|
||||
self.title = value
|
||||
elif name2 == 'toc':
|
||||
if not self.toc:
|
||||
self.toc = value
|
||||
if self.toc != value:
|
||||
print('toc\'s don\'t match')
|
||||
elif name2 == 'notes':
|
||||
self.notes.append(value)
|
||||
elif name1[:5] == 'track':
|
||||
try:
|
||||
trackno = int(name1[5:])
|
||||
except ValueError:
|
||||
print('syntax error in ' + file)
|
||||
continue
|
||||
if trackno > ntracks:
|
||||
print('track number %r in file %s out of range' % (trackno, file))
|
||||
continue
|
||||
if name2 == 'title':
|
||||
self.track[trackno] = value
|
||||
elif name2 == 'artist':
|
||||
self.trackartist[trackno] = value
|
||||
f.close()
|
||||
for i in range(2, len(self.track)):
|
||||
track = self.track[i]
|
||||
# if track title starts with `,', use initial part
|
||||
# of previous track's title
|
||||
if track and track[0] == ',':
|
||||
try:
|
||||
off = self.track[i - 1].index(',')
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
self.track[i] = self.track[i-1][:off] \
|
||||
+ track
|
||||
|
||||
def _get_id(self, tracklist):
|
||||
# fill in self.id and self.toc.
|
||||
# if the argument is a string ending in .rdb, the part
|
||||
# upto the suffix is taken as the id.
|
||||
if type(tracklist) == type(''):
|
||||
if tracklist[-4:] == '.rdb':
|
||||
self.id = tracklist[:-4]
|
||||
self.toc = ''
|
||||
return
|
||||
t = []
|
||||
for i in range(2, len(tracklist), 4):
|
||||
t.append((None, \
|
||||
(int(tracklist[i:i+2]), \
|
||||
int(tracklist[i+2:i+4]))))
|
||||
tracklist = t
|
||||
ntracks = len(tracklist)
|
||||
self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
|
||||
if ntracks <= _DB_ID_NTRACKS:
|
||||
nidtracks = ntracks
|
||||
else:
|
||||
nidtracks = _DB_ID_NTRACKS - 1
|
||||
min = 0
|
||||
sec = 0
|
||||
for track in tracklist:
|
||||
start, length = track
|
||||
min = min + length[0]
|
||||
sec = sec + length[1]
|
||||
min = min + sec / 60
|
||||
sec = sec % 60
|
||||
self.id = self.id + _dbid(min) + _dbid(sec)
|
||||
for i in range(nidtracks):
|
||||
start, length = tracklist[i]
|
||||
self.id = self.id + _dbid(length[0]) + _dbid(length[1])
|
||||
self.toc = ntracks.zfill(2)
|
||||
for track in tracklist:
|
||||
start, length = track
|
||||
self.toc = self.toc + length[0].zfill(2) + length[1].zfill(2)
|
||||
|
||||
def write(self):
|
||||
import posixpath
|
||||
if os.environ.has_key('CDDB_WRITE_DIR'):
|
||||
dir = os.environ['CDDB_WRITE_DIR']
|
||||
else:
|
||||
dir = os.environ['HOME'] + '/' + _cddbrc
|
||||
file = dir + '/' + self.id + '.rdb'
|
||||
if posixpath.exists(file):
|
||||
# make backup copy
|
||||
posix.rename(file, file + '~')
|
||||
f = open(file, 'w')
|
||||
f.write('album.title:\t' + self.title + '\n')
|
||||
f.write('album.artist:\t' + self.artist + '\n')
|
||||
f.write('album.toc:\t' + self.toc + '\n')
|
||||
for note in self.notes:
|
||||
f.write('album.notes:\t' + note + '\n')
|
||||
prevpref = None
|
||||
for i in range(1, len(self.track)):
|
||||
if self.trackartist[i]:
|
||||
f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i]))
|
||||
track = self.track[i]
|
||||
try:
|
||||
off = track.index(',')
|
||||
except ValueError:
|
||||
prevpref = None
|
||||
else:
|
||||
if prevpref and track[:off] == prevpref:
|
||||
track = track[off:]
|
||||
else:
|
||||
prevpref = track[:off]
|
||||
f.write('track%r.title:\t%s\n' % (i, track))
|
||||
f.close()
|
@ -1,87 +0,0 @@
|
||||
# This file implements a class which forms an interface to the .cdplayerrc
|
||||
# file that is maintained by SGI's cdplayer program.
|
||||
#
|
||||
# Usage is as follows:
|
||||
#
|
||||
# import readcd
|
||||
# r = readcd.Readcd()
|
||||
# c = Cdplayer(r.gettrackinfo())
|
||||
#
|
||||
# Now you can use c.artist, c.title and c.track[trackno] (where trackno
|
||||
# starts at 1). When the CD is not recognized, all values will be the empty
|
||||
# string.
|
||||
# It is also possible to set the above mentioned variables to new values.
|
||||
# You can then use c.write() to write out the changed values to the
|
||||
# .cdplayerrc file.
|
||||
|
||||
cdplayerrc = '.cdplayerrc'
|
||||
|
||||
class Cdplayer:
|
||||
def __init__(self, tracklist):
|
||||
self.artist = ''
|
||||
self.title = ''
|
||||
if type(tracklist) == type(''):
|
||||
t = []
|
||||
for i in range(2, len(tracklist), 4):
|
||||
t.append((None, \
|
||||
(int(tracklist[i:i+2]), \
|
||||
int(tracklist[i+2:i+4]))))
|
||||
tracklist = t
|
||||
self.track = [None] + [''] * len(tracklist)
|
||||
self.id = 'd' + repr(len(tracklist)).zfill(2)
|
||||
for track in tracklist:
|
||||
start, length = track
|
||||
self.id = self.id + repr(length[0]).zfill(2) + \
|
||||
repr(length[1]).zfill(2)
|
||||
try:
|
||||
import posix
|
||||
f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r')
|
||||
except IOError:
|
||||
return
|
||||
import re
|
||||
reg = re.compile(r'^([^:]*):\t(.*)')
|
||||
s = self.id + '.'
|
||||
l = len(s)
|
||||
while 1:
|
||||
line = f.readline()
|
||||
if line == '':
|
||||
break
|
||||
if line[:l] == s:
|
||||
line = line[l:]
|
||||
match = reg.match(line)
|
||||
if not match:
|
||||
print('syntax error in ~/' + cdplayerrc)
|
||||
continue
|
||||
name, value = match.group(1, 2)
|
||||
if name == 'title':
|
||||
self.title = value
|
||||
elif name == 'artist':
|
||||
self.artist = value
|
||||
elif name[:5] == 'track':
|
||||
trackno = int(name[6:])
|
||||
self.track[trackno] = value
|
||||
f.close()
|
||||
|
||||
def write(self):
|
||||
import posix
|
||||
filename = posix.environ['HOME'] + '/' + cdplayerrc
|
||||
try:
|
||||
old = open(filename, 'r')
|
||||
except IOError:
|
||||
old = open('/dev/null', 'r')
|
||||
new = open(filename + '.new', 'w')
|
||||
s = self.id + '.'
|
||||
l = len(s)
|
||||
while 1:
|
||||
line = old.readline()
|
||||
if line == '':
|
||||
break
|
||||
if line[:l] != s:
|
||||
new.write(line)
|
||||
new.write(self.id + '.title:\t' + self.title + '\n')
|
||||
new.write(self.id + '.artist:\t' + self.artist + '\n')
|
||||
for i in range(1, len(self.track)):
|
||||
new.write('%s.track.%r:\t%s\n' % (i, track))
|
||||
old.close()
|
||||
new.close()
|
||||
posix.rename(filename + '.new', filename)
|
@ -1,117 +0,0 @@
|
||||
.SH
|
||||
Module flp
|
||||
.LP
|
||||
The flp module loads fl-forms from fd files, as generated
|
||||
by fdesign. The module is designed to be flexible enough to allow
|
||||
almost anything to be done with the loaded form.
|
||||
.LP
|
||||
Loadform defines
|
||||
two types of functions: functions to parse fd files and functions to
|
||||
create the forms from the templates returned by the parse functions.
|
||||
There are fairly low-level create functions that create single objects,
|
||||
and convenience routines that create complete forms, including callbacks,
|
||||
etc.
|
||||
.LP
|
||||
The exception flp.error is raised whenever an error occurs while parsing a forms
|
||||
definition file or creating a form.
|
||||
.SH 2
|
||||
Parsing functions
|
||||
.LP
|
||||
There are two parsing functions, parse_form() and parse_forms(). They
|
||||
take the following form:
|
||||
.LP
|
||||
.ft C
|
||||
ftuple = parse_form(filename, formname)
|
||||
.br
|
||||
ftdict = parse_forms(filename)
|
||||
.IP
|
||||
Parse_form parses a single form, and returns a tuple (ftmp, otmplist).
|
||||
Ftmp is a template for a form, otmplist is a list of templates for
|
||||
objects. See below for a description of these templates.
|
||||
.IP
|
||||
Parse_forms parses all forms in an fd file. It returns a dictionary of
|
||||
(ftmp, otmplist) tuples, indexed by formname.
|
||||
.IP
|
||||
Filename is the name of the forms definition file to inspect. The functions
|
||||
appends '.fd' if needed, and use 'sys.path' to locate the file.
|
||||
.IP
|
||||
formname is the name of the form to load. This argument is mandatory,
|
||||
even if the file only contains one form.
|
||||
.LP
|
||||
The form template and object template are structures that contain all
|
||||
the information read from the fd file, in 'natural' form. A form
|
||||
template record contains the following fields:
|
||||
.IP
|
||||
.nf
|
||||
"Name", the name of the form;
|
||||
"Width", the width of the form;
|
||||
"Height", the height of the form; and
|
||||
"Numberofobjects", the number of objects in the form.
|
||||
.LP
|
||||
An object template contains the following fields:
|
||||
.IP
|
||||
.nf
|
||||
"Class", the class of object (eg. FL.BUTTON);
|
||||
"Type", the sub-class (eg. FL.NORMALBUTTON);
|
||||
"Box", a list with four members: [x, y, width, height];
|
||||
"Boxtype", the type of box (eg. FL.DOWNBOX);
|
||||
"Colors", a list with the two object colors;
|
||||
"Alignment", the label alignment (eg. FL.ALIGNLEFT);
|
||||
"Style", the label style (eg. FL.BOLDSTYLE);
|
||||
"Lcol", the label color;
|
||||
"Label", a string containing the label;
|
||||
"Name", a string containing the name of the object;
|
||||
"Callback", a string containing the callback routine name; and
|
||||
"Argument", a string containing the callback routine extra argument.
|
||||
.SH
|
||||
Low-level create routines.
|
||||
.LP
|
||||
The three low-level creation routines are called as follows:
|
||||
.LP
|
||||
.ft C
|
||||
form = create_form(form_template)
|
||||
.IP
|
||||
Create an fl form from a form template. Returns the form created.
|
||||
.LP
|
||||
.ft C
|
||||
obj = create_object(form, obj_template)
|
||||
.IP
|
||||
Create an object in an fl form. Return the new object.
|
||||
An error is raised if the object has a callback routine.
|
||||
.SH
|
||||
High-level create routines.
|
||||
.LP
|
||||
The 'standard' way to handle forms in python is to define a class
|
||||
that contains the form and all the objects (insofar as they are named),
|
||||
and that defines all the callback functions, and use an instance of
|
||||
this class to handle the form interaction.
|
||||
Flp contains three routines that simplify handling this paradigm:
|
||||
.LP
|
||||
.ft C
|
||||
create_full_form(instance, ftuple)
|
||||
.IP
|
||||
This routine takes an instance of your form-handling class and an
|
||||
ftuple (as returned by the parsing routines) as parameters. It inserts
|
||||
the form into the instance, defines all object names and arranges that
|
||||
the callback methods are called. All the names inserted into the
|
||||
instance are the same as the names used for the objects, etc. in the
|
||||
fd file.
|
||||
.LP
|
||||
.ft C
|
||||
merge_full_form(instance, form, ftuple)
|
||||
.IP
|
||||
This function does the same as create_full_form, only it does not create
|
||||
the form itself nor the 'background box' that fdesign automatically
|
||||
adds to each form. This is useful if your class inherits a superclass
|
||||
that already defines a skeleton form (with 'OK' and 'Cancel' buttons,
|
||||
for instance), and you want to merge the new form into that existing
|
||||
form. The 'form' parameter is the form to which the new objects are
|
||||
added.
|
||||
.LP
|
||||
If you use the paradigm sketched here but need slightly more control
|
||||
over object creation there is a routine that creates a single object
|
||||
and inserts its name (and arranges for the callback routine to be
|
||||
called):
|
||||
.LP
|
||||
.ft C
|
||||
create_object_instance(instance, form, obj_template)
|
@ -1,452 +0,0 @@
|
||||
#
|
||||
# flp - Module to load fl forms from fd files
|
||||
#
|
||||
# Jack Jansen, December 1991
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
import FL
|
||||
|
||||
SPLITLINE = '--------------------'
|
||||
FORMLINE = '=============== FORM ==============='
|
||||
ENDLINE = '=============================='
|
||||
|
||||
class error(Exception):
|
||||
pass
|
||||
|
||||
##################################################################
|
||||
# Part 1 - The parsing routines #
|
||||
##################################################################
|
||||
|
||||
#
|
||||
# Externally visible function. Load form.
|
||||
#
|
||||
def parse_form(filename, formname):
|
||||
forms = checkcache(filename)
|
||||
if forms is None:
|
||||
forms = parse_forms(filename)
|
||||
if forms.has_key(formname):
|
||||
return forms[formname]
|
||||
else:
|
||||
raise error, 'No such form in fd file'
|
||||
|
||||
#
|
||||
# Externally visible function. Load all forms.
|
||||
#
|
||||
def parse_forms(filename):
|
||||
forms = checkcache(filename)
|
||||
if forms is not None: return forms
|
||||
fp = _open_formfile(filename)
|
||||
nforms = _parse_fd_header(fp)
|
||||
forms = {}
|
||||
for i in range(nforms):
|
||||
form = _parse_fd_form(fp, None)
|
||||
forms[form[0].Name] = form
|
||||
writecache(filename, forms)
|
||||
return forms
|
||||
|
||||
#
|
||||
# Internal: see if a cached version of the file exists
|
||||
#
|
||||
MAGIC = '.fdc'
|
||||
_internal_cache = {} # Used by frozen scripts only
|
||||
def checkcache(filename):
|
||||
if _internal_cache.has_key(filename):
|
||||
altforms = _internal_cache[filename]
|
||||
return _unpack_cache(altforms)
|
||||
import marshal
|
||||
fp, filename = _open_formfile2(filename)
|
||||
fp.close()
|
||||
cachename = filename + 'c'
|
||||
try:
|
||||
fp = open(cachename, 'r')
|
||||
except IOError:
|
||||
#print 'flp: no cache file', cachename
|
||||
return None
|
||||
try:
|
||||
if fp.read(4) != MAGIC:
|
||||
print('flp: bad magic word in cache file', cachename)
|
||||
return None
|
||||
cache_mtime = rdlong(fp)
|
||||
file_mtime = getmtime(filename)
|
||||
if cache_mtime != file_mtime:
|
||||
#print 'flp: outdated cache file', cachename
|
||||
return None
|
||||
#print 'flp: valid cache file', cachename
|
||||
altforms = marshal.load(fp)
|
||||
return _unpack_cache(altforms)
|
||||
finally:
|
||||
fp.close()
|
||||
|
||||
def _unpack_cache(altforms):
|
||||
forms = {}
|
||||
for name in altforms.keys():
|
||||
altobj, altlist = altforms[name]
|
||||
obj = _newobj()
|
||||
obj.make(altobj)
|
||||
list = []
|
||||
for altobj in altlist:
|
||||
nobj = _newobj()
|
||||
nobj.make(altobj)
|
||||
list.append(nobj)
|
||||
forms[name] = obj, list
|
||||
return forms
|
||||
|
||||
def rdlong(fp):
|
||||
s = fp.read(4)
|
||||
if len(s) != 4: return None
|
||||
a, b, c, d = s[0], s[1], s[2], s[3]
|
||||
return ord(a)<<24 | ord(b)<<16 | ord(c)<<8 | ord(d)
|
||||
|
||||
def wrlong(fp, x):
|
||||
a, b, c, d = (x>>24)&0xff, (x>>16)&0xff, (x>>8)&0xff, x&0xff
|
||||
fp.write(chr(a) + chr(b) + chr(c) + chr(d))
|
||||
|
||||
def getmtime(filename):
|
||||
import os
|
||||
from stat import ST_MTIME
|
||||
try:
|
||||
return os.stat(filename)[ST_MTIME]
|
||||
except os.error:
|
||||
return None
|
||||
|
||||
#
|
||||
# Internal: write cached version of the form (parsing is too slow!)
|
||||
#
|
||||
def writecache(filename, forms):
|
||||
import marshal
|
||||
fp, filename = _open_formfile2(filename)
|
||||
fp.close()
|
||||
cachename = filename + 'c'
|
||||
try:
|
||||
fp = open(cachename, 'w')
|
||||
except IOError:
|
||||
print('flp: can\'t create cache file', cachename)
|
||||
return # Never mind
|
||||
fp.write('\0\0\0\0') # Seek back and write MAGIC when done
|
||||
wrlong(fp, getmtime(filename))
|
||||
altforms = _pack_cache(forms)
|
||||
marshal.dump(altforms, fp)
|
||||
fp.seek(0)
|
||||
fp.write(MAGIC)
|
||||
fp.close()
|
||||
#print 'flp: wrote cache file', cachename
|
||||
|
||||
#
|
||||
# External: print some statements that set up the internal cache.
|
||||
# This is for use with the "freeze" script. You should call
|
||||
# flp.freeze(filename) for all forms used by the script, and collect
|
||||
# the output on a file in a module file named "frozenforms.py". Then
|
||||
# in the main program of the script import frozenforms.
|
||||
# (Don't forget to take this out when using the unfrozen version of
|
||||
# the script!)
|
||||
#
|
||||
def freeze(filename):
|
||||
forms = parse_forms(filename)
|
||||
altforms = _pack_cache(forms)
|
||||
print('import flp')
|
||||
print('flp._internal_cache[', repr(filename), '] =', altforms)
|
||||
|
||||
#
|
||||
# Internal: create the data structure to be placed in the cache
|
||||
#
|
||||
def _pack_cache(forms):
|
||||
altforms = {}
|
||||
for name in forms.keys():
|
||||
obj, list = forms[name]
|
||||
altobj = obj.__dict__
|
||||
altlist = []
|
||||
for obj in list: altlist.append(obj.__dict__)
|
||||
altforms[name] = altobj, altlist
|
||||
return altforms
|
||||
|
||||
#
|
||||
# Internal: Locate form file (using PYTHONPATH) and open file
|
||||
#
|
||||
def _open_formfile(filename):
|
||||
return _open_formfile2(filename)[0]
|
||||
|
||||
def _open_formfile2(filename):
|
||||
if filename[-3:] != '.fd':
|
||||
filename = filename + '.fd'
|
||||
if filename[0] == '/':
|
||||
try:
|
||||
fp = open(filename,'r')
|
||||
except IOError:
|
||||
fp = None
|
||||
else:
|
||||
for pc in sys.path:
|
||||
pn = os.path.join(pc, filename)
|
||||
try:
|
||||
fp = open(pn, 'r')
|
||||
filename = pn
|
||||
break
|
||||
except IOError:
|
||||
fp = None
|
||||
if fp is None:
|
||||
raise error, 'Cannot find forms file ' + filename
|
||||
return fp, filename
|
||||
|
||||
#
|
||||
# Internal: parse the fd file header, return number of forms
|
||||
#
|
||||
def _parse_fd_header(file):
|
||||
# First read the magic header line
|
||||
datum = _parse_1_line(file)
|
||||
if datum != ('Magic', 12321):
|
||||
raise error, 'Not a forms definition file'
|
||||
# Now skip until we know number of forms
|
||||
while 1:
|
||||
datum = _parse_1_line(file)
|
||||
if type(datum) == type(()) and datum[0] == 'Numberofforms':
|
||||
break
|
||||
return datum[1]
|
||||
#
|
||||
# Internal: parse fd form, or skip if name doesn't match.
|
||||
# the special value None means 'always parse it'.
|
||||
#
|
||||
def _parse_fd_form(file, name):
|
||||
datum = _parse_1_line(file)
|
||||
if datum != FORMLINE:
|
||||
raise error, 'Missing === FORM === line'
|
||||
form = _parse_object(file)
|
||||
if form.Name == name or name is None:
|
||||
objs = []
|
||||
for j in range(form.Numberofobjects):
|
||||
obj = _parse_object(file)
|
||||
objs.append(obj)
|
||||
return (form, objs)
|
||||
else:
|
||||
for j in range(form.Numberofobjects):
|
||||
_skip_object(file)
|
||||
return None
|
||||
|
||||
#
|
||||
# Internal class: a convenient place to store object info fields
|
||||
#
|
||||
class _newobj:
|
||||
def add(self, name, value):
|
||||
self.__dict__[name] = value
|
||||
def make(self, dict):
|
||||
for name in dict.keys():
|
||||
self.add(name, dict[name])
|
||||
|
||||
#
|
||||
# Internal parsing routines.
|
||||
#
|
||||
def _parse_string(str):
|
||||
if '\\' in str:
|
||||
s = '\'' + str + '\''
|
||||
try:
|
||||
return eval(s)
|
||||
except:
|
||||
pass
|
||||
return str
|
||||
|
||||
def _parse_num(str):
|
||||
return eval(str)
|
||||
|
||||
def _parse_numlist(str):
|
||||
slist = str.split()
|
||||
nlist = []
|
||||
for i in slist:
|
||||
nlist.append(_parse_num(i))
|
||||
return nlist
|
||||
|
||||
# This dictionary maps item names to parsing routines.
|
||||
# If no routine is given '_parse_num' is default.
|
||||
_parse_func = { \
|
||||
'Name': _parse_string, \
|
||||
'Box': _parse_numlist, \
|
||||
'Colors': _parse_numlist, \
|
||||
'Label': _parse_string, \
|
||||
'Name': _parse_string, \
|
||||
'Callback': _parse_string, \
|
||||
'Argument': _parse_string }
|
||||
|
||||
# This function parses a line, and returns either
|
||||
# a string or a tuple (name,value)
|
||||
|
||||
import re
|
||||
prog = re.compile('^([^:]*): *(.*)')
|
||||
|
||||
def _parse_line(line):
|
||||
match = prog.match(line)
|
||||
if not match:
|
||||
return line
|
||||
name, value = match.group(1, 2)
|
||||
if name[0] == 'N':
|
||||
name = ''.join(name.split())
|
||||
name = name.lower()
|
||||
name = name.capitalize()
|
||||
try:
|
||||
pf = _parse_func[name]
|
||||
except KeyError:
|
||||
pf = _parse_num
|
||||
value = pf(value)
|
||||
return (name, value)
|
||||
|
||||
def _readline(file):
|
||||
line = file.readline()
|
||||
if not line:
|
||||
raise EOFError
|
||||
return line[:-1]
|
||||
|
||||
def _parse_1_line(file):
|
||||
line = _readline(file)
|
||||
while line == '':
|
||||
line = _readline(file)
|
||||
return _parse_line(line)
|
||||
|
||||
def _skip_object(file):
|
||||
line = ''
|
||||
while not line in (SPLITLINE, FORMLINE, ENDLINE):
|
||||
pos = file.tell()
|
||||
line = _readline(file)
|
||||
if line == FORMLINE:
|
||||
file.seek(pos)
|
||||
|
||||
def _parse_object(file):
|
||||
obj = _newobj()
|
||||
while 1:
|
||||
pos = file.tell()
|
||||
datum = _parse_1_line(file)
|
||||
if datum in (SPLITLINE, FORMLINE, ENDLINE):
|
||||
if datum == FORMLINE:
|
||||
file.seek(pos)
|
||||
return obj
|
||||
if type(datum) is not type(()) or len(datum) != 2:
|
||||
raise error, 'Parse error, illegal line in object: '+datum
|
||||
obj.add(datum[0], datum[1])
|
||||
|
||||
#################################################################
|
||||
# Part 2 - High-level object/form creation routines #
|
||||
#################################################################
|
||||
|
||||
#
|
||||
# External - Create a form an link to an instance variable.
|
||||
#
|
||||
def create_full_form(inst, formdata):
|
||||
fdata, odatalist = formdata
|
||||
form = create_form(fdata)
|
||||
exec('inst.'+fdata.Name+' = form\n')
|
||||
for odata in odatalist:
|
||||
create_object_instance(inst, form, odata)
|
||||
|
||||
#
|
||||
# External - Merge a form into an existing form in an instance
|
||||
# variable.
|
||||
#
|
||||
def merge_full_form(inst, form, formdata):
|
||||
fdata, odatalist = formdata
|
||||
exec('inst.'+fdata.Name+' = form\n')
|
||||
if odatalist[0].Class != FL.BOX:
|
||||
raise error, 'merge_full_form() expects FL.BOX as first obj'
|
||||
for odata in odatalist[1:]:
|
||||
create_object_instance(inst, form, odata)
|
||||
|
||||
|
||||
#################################################################
|
||||
# Part 3 - Low-level object/form creation routines #
|
||||
#################################################################
|
||||
|
||||
#
|
||||
# External Create_form - Create form from parameters
|
||||
#
|
||||
def create_form(fdata):
|
||||
import fl
|
||||
return fl.make_form(FL.NO_BOX, fdata.Width, fdata.Height)
|
||||
|
||||
#
|
||||
# External create_object - Create an object. Make sure there are
|
||||
# no callbacks. Returns the object created.
|
||||
#
|
||||
def create_object(form, odata):
|
||||
obj = _create_object(form, odata)
|
||||
if odata.Callback:
|
||||
raise error, 'Creating free object with callback'
|
||||
return obj
|
||||
#
|
||||
# External create_object_instance - Create object in an instance.
|
||||
#
|
||||
def create_object_instance(inst, form, odata):
|
||||
obj = _create_object(form, odata)
|
||||
if odata.Callback:
|
||||
cbfunc = eval('inst.'+odata.Callback)
|
||||
obj.set_call_back(cbfunc, odata.Argument)
|
||||
if odata.Name:
|
||||
exec('inst.' + odata.Name + ' = obj\n')
|
||||
#
|
||||
# Internal _create_object: Create the object and fill options
|
||||
#
|
||||
def _create_object(form, odata):
|
||||
crfunc = _select_crfunc(form, odata.Class)
|
||||
obj = crfunc(odata.Type, odata.Box[0], odata.Box[1], odata.Box[2], \
|
||||
odata.Box[3], odata.Label)
|
||||
if not odata.Class in (FL.BEGIN_GROUP, FL.END_GROUP):
|
||||
obj.boxtype = odata.Boxtype
|
||||
obj.col1 = odata.Colors[0]
|
||||
obj.col2 = odata.Colors[1]
|
||||
obj.align = odata.Alignment
|
||||
obj.lstyle = odata.Style
|
||||
obj.lsize = odata.Size
|
||||
obj.lcol = odata.Lcol
|
||||
return obj
|
||||
#
|
||||
# Internal crfunc: helper function that returns correct create function
|
||||
#
|
||||
def _select_crfunc(fm, cl):
|
||||
if cl == FL.BEGIN_GROUP: return fm.bgn_group
|
||||
elif cl == FL.END_GROUP: return fm.end_group
|
||||
elif cl == FL.BITMAP: return fm.add_bitmap
|
||||
elif cl == FL.BOX: return fm.add_box
|
||||
elif cl == FL.BROWSER: return fm.add_browser
|
||||
elif cl == FL.BUTTON: return fm.add_button
|
||||
elif cl == FL.CHART: return fm.add_chart
|
||||
elif cl == FL.CHOICE: return fm.add_choice
|
||||
elif cl == FL.CLOCK: return fm.add_clock
|
||||
elif cl == FL.COUNTER: return fm.add_counter
|
||||
elif cl == FL.DIAL: return fm.add_dial
|
||||
elif cl == FL.FREE: return fm.add_free
|
||||
elif cl == FL.INPUT: return fm.add_input
|
||||
elif cl == FL.LIGHTBUTTON: return fm.add_lightbutton
|
||||
elif cl == FL.MENU: return fm.add_menu
|
||||
elif cl == FL.POSITIONER: return fm.add_positioner
|
||||
elif cl == FL.ROUNDBUTTON: return fm.add_roundbutton
|
||||
elif cl == FL.SLIDER: return fm.add_slider
|
||||
elif cl == FL.VALSLIDER: return fm.add_valslider
|
||||
elif cl == FL.TEXT: return fm.add_text
|
||||
elif cl == FL.TIMER: return fm.add_timer
|
||||
else:
|
||||
raise error, 'Unknown object type: %r' % (cl,)
|
||||
|
||||
|
||||
def test():
|
||||
import time
|
||||
t0 = time.time()
|
||||
if len(sys.argv) == 2:
|
||||
forms = parse_forms(sys.argv[1])
|
||||
t1 = time.time()
|
||||
print('parse time:', 0.001*(t1-t0), 'sec.')
|
||||
keys = forms.keys()
|
||||
keys.sort()
|
||||
for i in keys:
|
||||
_printform(forms[i])
|
||||
elif len(sys.argv) == 3:
|
||||
form = parse_form(sys.argv[1], sys.argv[2])
|
||||
t1 = time.time()
|
||||
print('parse time:', round(t1-t0, 3), 'sec.')
|
||||
_printform(form)
|
||||
else:
|
||||
print('Usage: test fdfile [form]')
|
||||
|
||||
def _printform(form):
|
||||
f = form[0]
|
||||
objs = form[1]
|
||||
print('Form ', f.Name, ', size: ', f.Width, f.Height, ' Nobj ', f.Numberofobjects)
|
||||
for i in objs:
|
||||
print(' Obj ', i.Name, ' type ', i.Class, i.Type)
|
||||
print(' Box ', i.Box, ' btype ', i.Boxtype)
|
||||
print(' Label ', i.Label, ' size/style/col/align ', i.Size,i.Style, i.Lcol, i.Alignment)
|
||||
print(' cols ', i.Colors)
|
||||
print(' cback ', i.Callback, i.Argument)
|
@ -1,104 +0,0 @@
|
||||
Interface to CD-ROM player.
|
||||
|
||||
This module implements an interface to the built-in cd module. The
|
||||
intention is to provide a more user-friendly interface than the
|
||||
built-in module.
|
||||
|
||||
The module defines a class Readcd with several methods. The
|
||||
initialization of the class will try to open the CD player. This
|
||||
means that initialization will fail if the CD player is already in
|
||||
use. A RuntimeError will be raised by the cd module in that case.
|
||||
|
||||
The way to work with this module is as follows. The user specifies
|
||||
the parts of the CD that are to be read and he specifies callback
|
||||
functions which are to be called by the system. At some point he can
|
||||
tell the system to play. The specified parts of the CD will then be
|
||||
read and the callbacks will be called.
|
||||
|
||||
Initialization.
|
||||
===============
|
||||
|
||||
r = readcd.Readcd([cd-player [, mode]])
|
||||
|
||||
The optional arguments are the name of the CD device and the mode.
|
||||
When "mode" is not specified, it defaults to 'r' (which is the only
|
||||
possible value); when "cd-player" also isn't specified, it defaults
|
||||
to "None" which indicates the default CD player.
|
||||
|
||||
Methods.
|
||||
========
|
||||
|
||||
eject() -- Eject the CD from the player.
|
||||
|
||||
reset() -- Reset the list of data stretches to be played.
|
||||
|
||||
appendtrack(track) -- Append the specified track to the list of music
|
||||
stretches.
|
||||
|
||||
appendstretch(first, last) -- Append the stretch from "first" to "last"
|
||||
to the list of music stretches. Both "first" and "last" can be in one
|
||||
of four forms. "None": for "first", the beginning of the CD, for
|
||||
"last" the end of the CD; a single integer: a track number--playing
|
||||
starts at the beginning of the track or ends at the end of the
|
||||
specified track; a three-tuple: the absolute time from the start of
|
||||
the CD in minutes, seconds, frames; a four-tuple: track number and
|
||||
relative time within the track in minutes, seconds, frames.
|
||||
|
||||
settracks(tracklist) -- The argument is a list of integers. The list
|
||||
of stretches is set to argument list. The old list is discarded.
|
||||
|
||||
setcallback(type, func, arg) -- Set a callback function for "type".
|
||||
The function will be called as func(arg, type, data) where "arg" is
|
||||
the third argument of setcallback, "type" is the type of callback,
|
||||
"data" is type-dependent data. See the CDsetcallback(3) manual page
|
||||
for more information. The possible "type" arguments are defined in
|
||||
the CD module.
|
||||
|
||||
removecallback(type) -- Remove the callback for "type".
|
||||
|
||||
gettrackinfo([tracklist]) -- Return a list of tuples. Each tuple
|
||||
consists of start and length information of a track. The start and
|
||||
length information consist of three-tuples with minutes, seconds and
|
||||
frames. The optional tracklist argument gives a list of interesting
|
||||
track numbers. If no tracklist is specified, information about all
|
||||
tracks is returned.
|
||||
|
||||
getstatus() -- Return the status information of the CD.
|
||||
|
||||
play() -- Play the preprogrammed stretches of music from the CD. When
|
||||
nothing was programmed, the whole CD is played.
|
||||
|
||||
Specifying stretches.
|
||||
=====================
|
||||
|
||||
There are three methods available to specify a stretch of music to be
|
||||
played. The easiest way is to use "settracklist(tracklist)" with which
|
||||
a list of tracks can be specified. "settracklist(tracklist)" is
|
||||
equivalent to the sequence
|
||||
reset()
|
||||
for track in tracklist:
|
||||
appendtrack(track)
|
||||
|
||||
The next method is "appendtrack(track)" with which a whole track can be
|
||||
added to the list of music to be played. "appendtrack(track)" is
|
||||
equivalent to "appendstretch(track, track)".
|
||||
|
||||
The most complete method is "appendstretch(first, last)". Using this
|
||||
method, it is possible to specify any stretch of music.
|
||||
|
||||
When two consecutive tracks are played, it is possible to choose
|
||||
whether the pause that may be between the tracks is played as well or
|
||||
whether the pause should be skipped. When the end of a stretch is
|
||||
specified using a track number and the next stretch starts at the
|
||||
beginning of the following track and that was also specified using the
|
||||
track number (that is, both were specified as integers, not as tuples),
|
||||
the pause is played. When either value was specified using absolute
|
||||
time or track-relative time (that is, as three-tuple or as
|
||||
four-tuple), the pause will not be played.
|
||||
|
||||
Errors.
|
||||
=======
|
||||
|
||||
When an error occurs, an exception will be raised. Depending on where
|
||||
the error occurs, the exception may either be "readcd.Error" or
|
||||
"RuntimeError".
|
@ -1,244 +0,0 @@
|
||||
# Class interface to the CD module.
|
||||
|
||||
import cd, CD
|
||||
|
||||
class Error(Exception):
|
||||
pass
|
||||
class _Stop(Exception):
|
||||
pass
|
||||
|
||||
def _doatime(self, cb_type, data):
|
||||
if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end:
|
||||
## print 'done with list entry', repr(self.listindex)
|
||||
raise _Stop
|
||||
func, arg = self.callbacks[cb_type]
|
||||
if func:
|
||||
func(arg, cb_type, data)
|
||||
|
||||
def _dopnum(self, cb_type, data):
|
||||
if data > self.end:
|
||||
## print 'done with list entry', repr(self.listindex)
|
||||
raise _Stop
|
||||
func, arg = self.callbacks[cb_type]
|
||||
if func:
|
||||
func(arg, cb_type, data)
|
||||
|
||||
class Readcd:
|
||||
def __init__(self, *arg):
|
||||
if len(arg) == 0:
|
||||
self.player = cd.open()
|
||||
elif len(arg) == 1:
|
||||
self.player = cd.open(arg[0])
|
||||
elif len(arg) == 2:
|
||||
self.player = cd.open(arg[0], arg[1])
|
||||
else:
|
||||
raise Error, 'bad __init__ call'
|
||||
self.list = []
|
||||
self.callbacks = [(None, None)] * 8
|
||||
self.parser = cd.createparser()
|
||||
self.playing = 0
|
||||
self.end = 0
|
||||
self.status = None
|
||||
self.trackinfo = None
|
||||
|
||||
def eject(self):
|
||||
self.player.eject()
|
||||
self.list = []
|
||||
self.end = 0
|
||||
self.listindex = 0
|
||||
self.status = None
|
||||
self.trackinfo = None
|
||||
if self.playing:
|
||||
## print 'stop playing from eject'
|
||||
raise _Stop
|
||||
|
||||
def pmsf2msf(self, track, min, sec, frame):
|
||||
if not self.status:
|
||||
self.cachestatus()
|
||||
if track < self.status[5] or track > self.status[6]:
|
||||
raise Error, 'track number out of range'
|
||||
if not self.trackinfo:
|
||||
self.cacheinfo()
|
||||
start, total = self.trackinfo[track]
|
||||
start = ((start[0] * 60) + start[1]) * 75 + start[2]
|
||||
total = ((total[0] * 60) + total[1]) * 75 + total[2]
|
||||
block = ((min * 60) + sec) * 75 + frame
|
||||
if block > total:
|
||||
raise Error, 'out of range'
|
||||
block = start + block
|
||||
min, block = divmod(block, 75*60)
|
||||
sec, frame = divmod(block, 75)
|
||||
return min, sec, frame
|
||||
|
||||
def reset(self):
|
||||
self.list = []
|
||||
|
||||
def appendtrack(self, track):
|
||||
self.appendstretch(track, track)
|
||||
|
||||
def appendstretch(self, start, end):
|
||||
if not self.status:
|
||||
self.cachestatus()
|
||||
if not start:
|
||||
start = 1
|
||||
if not end:
|
||||
end = self.status[6]
|
||||
if type(end) == type(0):
|
||||
if end < self.status[5] or end > self.status[6]:
|
||||
raise Error, 'range error'
|
||||
else:
|
||||
l = len(end)
|
||||
if l == 4:
|
||||
prog, min, sec, frame = end
|
||||
if prog < self.status[5] or prog > self.status[6]:
|
||||
raise Error, 'range error'
|
||||
end = self.pmsf2msf(prog, min, sec, frame)
|
||||
elif l != 3:
|
||||
raise Error, 'syntax error'
|
||||
if type(start) == type(0):
|
||||
if start < self.status[5] or start > self.status[6]:
|
||||
raise Error, 'range error'
|
||||
if len(self.list) > 0:
|
||||
s, e = self.list[-1]
|
||||
if type(e) == type(0):
|
||||
if start == e+1:
|
||||
start = s
|
||||
del self.list[-1]
|
||||
else:
|
||||
l = len(start)
|
||||
if l == 4:
|
||||
prog, min, sec, frame = start
|
||||
if prog < self.status[5] or prog > self.status[6]:
|
||||
raise Error, 'range error'
|
||||
start = self.pmsf2msf(prog, min, sec, frame)
|
||||
elif l != 3:
|
||||
raise Error, 'syntax error'
|
||||
self.list.append((start, end))
|
||||
|
||||
def settracks(self, list):
|
||||
self.list = []
|
||||
for track in list:
|
||||
self.appendtrack(track)
|
||||
|
||||
def setcallback(self, cb_type, func, arg):
|
||||
if cb_type < 0 or cb_type >= 8:
|
||||
raise Error, 'type out of range'
|
||||
self.callbacks[cb_type] = (func, arg)
|
||||
if self.playing:
|
||||
start, end = self.list[self.listindex]
|
||||
if type(end) == type(0):
|
||||
if cb_type != CD.PNUM:
|
||||
self.parser.setcallback(cb_type, func, arg)
|
||||
else:
|
||||
if cb_type != CD.ATIME:
|
||||
self.parser.setcallback(cb_type, func, arg)
|
||||
|
||||
def removecallback(self, cb_type):
|
||||
if cb_type < 0 or cb_type >= 8:
|
||||
raise Error, 'type out of range'
|
||||
self.callbacks[cb_type] = (None, None)
|
||||
if self.playing:
|
||||
start, end = self.list[self.listindex]
|
||||
if type(end) == type(0):
|
||||
if cb_type != CD.PNUM:
|
||||
self.parser.removecallback(cb_type)
|
||||
else:
|
||||
if cb_type != CD.ATIME:
|
||||
self.parser.removecallback(cb_type)
|
||||
|
||||
def gettrackinfo(self, *arg):
|
||||
if not self.status:
|
||||
self.cachestatus()
|
||||
if not self.trackinfo:
|
||||
self.cacheinfo()
|
||||
if len(arg) == 0:
|
||||
return self.trackinfo[self.status[5]:self.status[6]+1]
|
||||
result = []
|
||||
for i in arg:
|
||||
if i < self.status[5] or i > self.status[6]:
|
||||
raise Error, 'range error'
|
||||
result.append(self.trackinfo[i])
|
||||
return result
|
||||
|
||||
def cacheinfo(self):
|
||||
if not self.status:
|
||||
self.cachestatus()
|
||||
self.trackinfo = []
|
||||
for i in range(self.status[5]):
|
||||
self.trackinfo.append(None)
|
||||
for i in range(self.status[5], self.status[6]+1):
|
||||
self.trackinfo.append(self.player.gettrackinfo(i))
|
||||
|
||||
def cachestatus(self):
|
||||
self.status = self.player.getstatus()
|
||||
if self.status[0] == CD.NODISC:
|
||||
self.status = None
|
||||
raise Error, 'no disc in player'
|
||||
|
||||
def getstatus(self):
|
||||
return self.player.getstatus()
|
||||
|
||||
def play(self):
|
||||
if not self.status:
|
||||
self.cachestatus()
|
||||
size = self.player.bestreadsize()
|
||||
self.listindex = 0
|
||||
self.playing = 0
|
||||
for i in range(8):
|
||||
func, arg = self.callbacks[i]
|
||||
if func:
|
||||
self.parser.setcallback(i, func, arg)
|
||||
else:
|
||||
self.parser.removecallback(i)
|
||||
if len(self.list) == 0:
|
||||
for i in range(self.status[5], self.status[6]+1):
|
||||
self.appendtrack(i)
|
||||
try:
|
||||
while 1:
|
||||
if not self.playing:
|
||||
if self.listindex >= len(self.list):
|
||||
return
|
||||
start, end = self.list[self.listindex]
|
||||
if type(start) == type(0):
|
||||
dummy = self.player.seektrack(
|
||||
start)
|
||||
else:
|
||||
min, sec, frame = start
|
||||
dummy = self.player.seek(
|
||||
min, sec, frame)
|
||||
if type(end) == type(0):
|
||||
self.parser.setcallback(
|
||||
CD.PNUM, _dopnum, self)
|
||||
self.end = end
|
||||
func, arg = \
|
||||
self.callbacks[CD.ATIME]
|
||||
if func:
|
||||
self.parser.setcallback(CD.ATIME, func, arg)
|
||||
else:
|
||||
self.parser.removecallback(CD.ATIME)
|
||||
else:
|
||||
min, sec, frame = end
|
||||
self.parser.setcallback(
|
||||
CD.ATIME, _doatime,
|
||||
self)
|
||||
self.end = (min * 60 + sec) * \
|
||||
75 + frame
|
||||
func, arg = \
|
||||
self.callbacks[CD.PNUM]
|
||||
if func:
|
||||
self.parser.setcallback(CD.PNUM, func, arg)
|
||||
else:
|
||||
self.parser.removecallback(CD.PNUM)
|
||||
self.playing = 1
|
||||
data = self.player.readda(size)
|
||||
if data == '':
|
||||
self.playing = 0
|
||||
self.listindex = self.listindex + 1
|
||||
continue
|
||||
try:
|
||||
self.parser.parseframe(data)
|
||||
except _Stop:
|
||||
self.playing = 0
|
||||
self.listindex = self.listindex + 1
|
||||
finally:
|
||||
self.playing = 0
|
@ -1,11 +0,0 @@
|
||||
#! /bin/sh
|
||||
case `uname -sr` in
|
||||
'IRIX '[456].*) ;;
|
||||
'IRIX64 '[456].*) ;;
|
||||
*) echo Probably not on an IRIX system 1>&2
|
||||
exit 1;;
|
||||
esac
|
||||
set -v
|
||||
h2py /usr/include/sys/file.h
|
||||
h2py -i '(u_long)' /usr/include/netinet/in.h
|
||||
h2py /usr/include/errno.h
|
@ -1,99 +0,0 @@
|
||||
# Convert "arbitrary" image files to rgb files (SGI's image format).
|
||||
# Input may be compressed.
|
||||
# The uncompressed file type may be PBM, PGM, PPM, GIF, TIFF, or Sun raster.
|
||||
# An exception is raised if the file is not of a recognized type.
|
||||
# Returned filename is either the input filename or a temporary filename;
|
||||
# in the latter case the caller must ensure that it is removed.
|
||||
# Other temporary files used are removed by the function.
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import pipes
|
||||
import imghdr
|
||||
|
||||
table = {}
|
||||
|
||||
t = pipes.Template()
|
||||
t.append('fromppm $IN $OUT', 'ff')
|
||||
table['ppm'] = t
|
||||
|
||||
t = pipes.Template()
|
||||
t.append('(PATH=$PATH:/ufs/guido/bin/sgi; exec pnmtoppm)', '--')
|
||||
t.append('fromppm $IN $OUT', 'ff')
|
||||
table['pnm'] = t
|
||||
table['pgm'] = t
|
||||
table['pbm'] = t
|
||||
|
||||
t = pipes.Template()
|
||||
t.append('fromgif $IN $OUT', 'ff')
|
||||
table['gif'] = t
|
||||
|
||||
t = pipes.Template()
|
||||
t.append('tifftopnm', '--')
|
||||
t.append('(PATH=$PATH:/ufs/guido/bin/sgi; exec pnmtoppm)', '--')
|
||||
t.append('fromppm $IN $OUT', 'ff')
|
||||
table['tiff'] = t
|
||||
|
||||
t = pipes.Template()
|
||||
t.append('rasttopnm', '--')
|
||||
t.append('(PATH=$PATH:/ufs/guido/bin/sgi; exec pnmtoppm)', '--')
|
||||
t.append('fromppm $IN $OUT', 'ff')
|
||||
table['rast'] = t
|
||||
|
||||
t = pipes.Template()
|
||||
t.append('djpeg', '--')
|
||||
t.append('(PATH=$PATH:/ufs/guido/bin/sgi; exec pnmtoppm)', '--')
|
||||
t.append('fromppm $IN $OUT', 'ff')
|
||||
table['jpeg'] = t
|
||||
|
||||
uncompress = pipes.Template()
|
||||
uncompress.append('uncompress', '--')
|
||||
|
||||
|
||||
class error(Exception):
|
||||
pass
|
||||
|
||||
def torgb(filename):
|
||||
temps = []
|
||||
ret = None
|
||||
try:
|
||||
ret = _torgb(filename, temps)
|
||||
finally:
|
||||
for temp in temps[:]:
|
||||
if temp != ret:
|
||||
try:
|
||||
os.unlink(temp)
|
||||
except os.error:
|
||||
pass
|
||||
temps.remove(temp)
|
||||
return ret
|
||||
|
||||
def _torgb(filename, temps):
|
||||
if filename[-2:] == '.Z':
|
||||
(fd, fname) = tempfile.mkstemp()
|
||||
os.close(fd)
|
||||
temps.append(fname)
|
||||
sts = uncompress.copy(filename, fname)
|
||||
if sts:
|
||||
raise error, filename + ': uncompress failed'
|
||||
else:
|
||||
fname = filename
|
||||
try:
|
||||
ftype = imghdr.what(fname)
|
||||
except IOError as msg:
|
||||
if type(msg) == type(()) and len(msg) == 2 and \
|
||||
type(msg[0]) == type(0) and type(msg[1]) == type(''):
|
||||
msg = msg[1]
|
||||
if type(msg) is not type(''):
|
||||
msg = repr(msg)
|
||||
raise error, filename + ': ' + msg
|
||||
if ftype == 'rgb':
|
||||
return fname
|
||||
if ftype is None or not table.has_key(ftype):
|
||||
raise error, '%s: unsupported image file type %r' % (filename, ftype)
|
||||
(fd, temp) = tempfile.mkstemp()
|
||||
os.close(fd)
|
||||
sts = table[ftype].copy(fname, temp)
|
||||
if sts:
|
||||
raise error, filename + ': conversion to rgb failed'
|
||||
return temp
|
@ -195,14 +195,3 @@ class Template(metaclass=_TemplateMetaclass):
|
||||
raise ValueError('Unrecognized named group in pattern',
|
||||
self.pattern)
|
||||
return self.pattern.sub(convert, self.template)
|
||||
|
||||
|
||||
# Try importing optional built-in module "strop" -- if it exists,
|
||||
# it redefines some string operations that are 100-1000 times faster.
|
||||
# It also defines values for whitespace, lowercase and uppercase
|
||||
# that match <ctype.h>'s definitions.
|
||||
|
||||
try:
|
||||
from strop import maketrans
|
||||
except ImportError:
|
||||
pass # Use the original versions
|
||||
|
@ -107,11 +107,8 @@ resources to test. Currently only the following are defined:
|
||||
decimal - Test the decimal module against a large suite that
|
||||
verifies compliance with standards.
|
||||
|
||||
compiler - Test the compiler package by compiling all the source
|
||||
in the standard library and test suite. This takes
|
||||
a long time. Enabling this resource also allows
|
||||
test_tokenize to verify round-trip lexing on every
|
||||
file in the test library.
|
||||
compiler - Allow test_tokenize to verify round-trip lexing on
|
||||
every file in the test library.
|
||||
|
||||
subprocess Run all tests for the subprocess module.
|
||||
|
||||
@ -987,7 +984,6 @@ _expectations = {
|
||||
test_poll
|
||||
test_pty
|
||||
test_pwd
|
||||
test_strop
|
||||
test_sqlite
|
||||
test_startfile
|
||||
test_sunaudiodev
|
||||
|
@ -11,7 +11,6 @@ except ImportError:
|
||||
|
||||
from test.test_support import (TESTFN, unlink, run_unittest,
|
||||
guard_warnings_filter)
|
||||
from test.test_pep352 import ignore_message_warning
|
||||
|
||||
# XXX This is not really enough, each *operation* should be tested!
|
||||
|
||||
@ -205,115 +204,113 @@ class ExceptionTests(unittest.TestCase):
|
||||
# test that exception attributes are happy
|
||||
|
||||
exceptionList = [
|
||||
(BaseException, (), {'message' : '', 'args' : ()}),
|
||||
(BaseException, (1, ), {'message' : 1, 'args' : (1,)}),
|
||||
(BaseException, (), {'args' : ()}),
|
||||
(BaseException, (1, ), {'args' : (1,)}),
|
||||
(BaseException, ('foo',),
|
||||
{'message' : 'foo', 'args' : ('foo',)}),
|
||||
{'args' : ('foo',)}),
|
||||
(BaseException, ('foo', 1),
|
||||
{'message' : '', 'args' : ('foo', 1)}),
|
||||
{'args' : ('foo', 1)}),
|
||||
(SystemExit, ('foo',),
|
||||
{'message' : 'foo', 'args' : ('foo',), 'code' : 'foo'}),
|
||||
{'args' : ('foo',), 'code' : 'foo'}),
|
||||
(IOError, ('foo',),
|
||||
{'message' : 'foo', 'args' : ('foo',), 'filename' : None,
|
||||
{'args' : ('foo',), 'filename' : None,
|
||||
'errno' : None, 'strerror' : None}),
|
||||
(IOError, ('foo', 'bar'),
|
||||
{'message' : '', 'args' : ('foo', 'bar'), 'filename' : None,
|
||||
{'args' : ('foo', 'bar'), 'filename' : None,
|
||||
'errno' : 'foo', 'strerror' : 'bar'}),
|
||||
(IOError, ('foo', 'bar', 'baz'),
|
||||
{'message' : '', 'args' : ('foo', 'bar'), 'filename' : 'baz',
|
||||
{'args' : ('foo', 'bar'), 'filename' : 'baz',
|
||||
'errno' : 'foo', 'strerror' : 'bar'}),
|
||||
(IOError, ('foo', 'bar', 'baz', 'quux'),
|
||||
{'message' : '', 'args' : ('foo', 'bar', 'baz', 'quux')}),
|
||||
{'args' : ('foo', 'bar', 'baz', 'quux')}),
|
||||
(EnvironmentError, ('errnoStr', 'strErrorStr', 'filenameStr'),
|
||||
{'message' : '', 'args' : ('errnoStr', 'strErrorStr'),
|
||||
{'args' : ('errnoStr', 'strErrorStr'),
|
||||
'strerror' : 'strErrorStr', 'errno' : 'errnoStr',
|
||||
'filename' : 'filenameStr'}),
|
||||
(EnvironmentError, (1, 'strErrorStr', 'filenameStr'),
|
||||
{'message' : '', 'args' : (1, 'strErrorStr'), 'errno' : 1,
|
||||
{'args' : (1, 'strErrorStr'), 'errno' : 1,
|
||||
'strerror' : 'strErrorStr', 'filename' : 'filenameStr'}),
|
||||
(SyntaxError, (), {'message' : '', 'msg' : None, 'text' : None,
|
||||
(SyntaxError, (), {'msg' : None, 'text' : None,
|
||||
'filename' : None, 'lineno' : None, 'offset' : None,
|
||||
'print_file_and_line' : None}),
|
||||
(SyntaxError, ('msgStr',),
|
||||
{'message' : 'msgStr', 'args' : ('msgStr',), 'text' : None,
|
||||
{'args' : ('msgStr',), 'text' : None,
|
||||
'print_file_and_line' : None, 'msg' : 'msgStr',
|
||||
'filename' : None, 'lineno' : None, 'offset' : None}),
|
||||
(SyntaxError, ('msgStr', ('filenameStr', 'linenoStr', 'offsetStr',
|
||||
'textStr')),
|
||||
{'message' : '', 'offset' : 'offsetStr', 'text' : 'textStr',
|
||||
{'offset' : 'offsetStr', 'text' : 'textStr',
|
||||
'args' : ('msgStr', ('filenameStr', 'linenoStr',
|
||||
'offsetStr', 'textStr')),
|
||||
'print_file_and_line' : None, 'msg' : 'msgStr',
|
||||
'filename' : 'filenameStr', 'lineno' : 'linenoStr'}),
|
||||
(SyntaxError, ('msgStr', 'filenameStr', 'linenoStr', 'offsetStr',
|
||||
'textStr', 'print_file_and_lineStr'),
|
||||
{'message' : '', 'text' : None,
|
||||
{'text' : None,
|
||||
'args' : ('msgStr', 'filenameStr', 'linenoStr', 'offsetStr',
|
||||
'textStr', 'print_file_and_lineStr'),
|
||||
'print_file_and_line' : None, 'msg' : 'msgStr',
|
||||
'filename' : None, 'lineno' : None, 'offset' : None}),
|
||||
(UnicodeError, (), {'message' : '', 'args' : (),}),
|
||||
(UnicodeError, (), {'args' : (),}),
|
||||
(UnicodeEncodeError, (str8('ascii'), 'a', 0, 1,
|
||||
str8('ordinal not in range')),
|
||||
{'message' : '', 'args' : ('ascii', 'a', 0, 1,
|
||||
{'args' : ('ascii', 'a', 0, 1,
|
||||
'ordinal not in range'),
|
||||
'encoding' : 'ascii', 'object' : 'a',
|
||||
'start' : 0, 'reason' : 'ordinal not in range'}),
|
||||
(UnicodeDecodeError, (str8('ascii'), b'\xff', 0, 1,
|
||||
str8('ordinal not in range')),
|
||||
{'message' : '', 'args' : ('ascii', b'\xff', 0, 1,
|
||||
{'args' : ('ascii', b'\xff', 0, 1,
|
||||
'ordinal not in range'),
|
||||
'encoding' : 'ascii', 'object' : b'\xff',
|
||||
'start' : 0, 'reason' : 'ordinal not in range'}),
|
||||
(UnicodeTranslateError, ("\u3042", 0, 1, str8("ouch")),
|
||||
{'message' : '', 'args' : ('\u3042', 0, 1, 'ouch'),
|
||||
{'args' : ('\u3042', 0, 1, 'ouch'),
|
||||
'object' : '\u3042', 'reason' : 'ouch',
|
||||
'start' : 0, 'end' : 1}),
|
||||
]
|
||||
try:
|
||||
exceptionList.append(
|
||||
(WindowsError, (1, 'strErrorStr', 'filenameStr'),
|
||||
{'message' : '', 'args' : (1, 'strErrorStr'),
|
||||
{'args' : (1, 'strErrorStr'),
|
||||
'strerror' : 'strErrorStr', 'winerror' : 1,
|
||||
'errno' : 22, 'filename' : 'filenameStr'})
|
||||
)
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
with guard_warnings_filter():
|
||||
ignore_message_warning()
|
||||
for exc, args, expected in exceptionList:
|
||||
try:
|
||||
e = exc(*args)
|
||||
except:
|
||||
print("\nexc=%r, args=%r" % (exc, args))
|
||||
raise
|
||||
else:
|
||||
# Verify module name
|
||||
self.assertEquals(type(e).__module__, '__builtin__')
|
||||
# Verify no ref leaks in Exc_str()
|
||||
s = str(e)
|
||||
for checkArgName in expected:
|
||||
value = getattr(e, checkArgName)
|
||||
self.assertEquals(repr(value),
|
||||
repr(expected[checkArgName]),
|
||||
'%r.%s == %r, expected %r' % (
|
||||
e, checkArgName,
|
||||
value, expected[checkArgName]))
|
||||
for exc, args, expected in exceptionList:
|
||||
try:
|
||||
e = exc(*args)
|
||||
except:
|
||||
print("\nexc=%r, args=%r" % (exc, args))
|
||||
raise
|
||||
else:
|
||||
# Verify module name
|
||||
self.assertEquals(type(e).__module__, '__builtin__')
|
||||
# Verify no ref leaks in Exc_str()
|
||||
s = str(e)
|
||||
for checkArgName in expected:
|
||||
value = getattr(e, checkArgName)
|
||||
self.assertEquals(repr(value),
|
||||
repr(expected[checkArgName]),
|
||||
'%r.%s == %r, expected %r' % (
|
||||
e, checkArgName,
|
||||
value, expected[checkArgName]))
|
||||
|
||||
# test for pickling support
|
||||
for p in pickle, cPickle:
|
||||
if p is None:
|
||||
continue # cPickle not found -- skip it
|
||||
for protocol in range(p.HIGHEST_PROTOCOL + 1):
|
||||
s = p.dumps(e, protocol)
|
||||
new = p.loads(s)
|
||||
for checkArgName in expected:
|
||||
got = repr(getattr(new, checkArgName))
|
||||
want = repr(expected[checkArgName])
|
||||
self.assertEquals(got, want,
|
||||
'pickled "%r", attribute "%s' %
|
||||
(e, checkArgName))
|
||||
# test for pickling support
|
||||
for p in pickle, cPickle:
|
||||
if p is None:
|
||||
continue # cPickle not found -- skip it
|
||||
for protocol in range(p.HIGHEST_PROTOCOL + 1):
|
||||
s = p.dumps(e, protocol)
|
||||
new = p.loads(s)
|
||||
for checkArgName in expected:
|
||||
got = repr(getattr(new, checkArgName))
|
||||
want = repr(expected[checkArgName])
|
||||
self.assertEquals(got, want,
|
||||
'pickled "%r", attribute "%s' %
|
||||
(e, checkArgName))
|
||||
|
||||
def testKeywordArgs(self):
|
||||
# test that builtin exception don't take keyword args,
|
||||
|
@ -5,12 +5,6 @@ from test.test_support import run_unittest, guard_warnings_filter
|
||||
import os
|
||||
from platform import system as platform_system
|
||||
|
||||
def ignore_message_warning():
|
||||
"""Ignore the DeprecationWarning for BaseException.message."""
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings("ignore", "BaseException.message",
|
||||
DeprecationWarning)
|
||||
|
||||
|
||||
class ExceptionClassTests(unittest.TestCase):
|
||||
|
||||
@ -21,12 +15,10 @@ class ExceptionClassTests(unittest.TestCase):
|
||||
self.failUnless(issubclass(Exception, object))
|
||||
|
||||
def verify_instance_interface(self, ins):
|
||||
with guard_warnings_filter():
|
||||
ignore_message_warning()
|
||||
for attr in ("args", "message", "__str__", "__repr__"):
|
||||
self.failUnless(hasattr(ins, attr),
|
||||
"%s missing %s attribute" %
|
||||
(ins.__class__.__name__, attr))
|
||||
for attr in ("args", "__str__", "__repr__"):
|
||||
self.failUnless(hasattr(ins, attr),
|
||||
"%s missing %s attribute" %
|
||||
(ins.__class__.__name__, attr))
|
||||
|
||||
def test_inheritance(self):
|
||||
# Make sure the inheritance hierarchy matches the documentation
|
||||
@ -89,7 +81,7 @@ class ExceptionClassTests(unittest.TestCase):
|
||||
inheritance_tree.close()
|
||||
self.failUnlessEqual(len(exc_set), 0, "%s not accounted for" % exc_set)
|
||||
|
||||
interface_tests = ("length", "args", "message", "str", "repr")
|
||||
interface_tests = ("length", "args", "str", "repr")
|
||||
|
||||
def interface_test_driver(self, results):
|
||||
for test_name, (given, expected) in zip(self.interface_tests, results):
|
||||
@ -100,57 +92,28 @@ class ExceptionClassTests(unittest.TestCase):
|
||||
# Make sure interface works properly when given a single argument
|
||||
arg = "spam"
|
||||
exc = Exception(arg)
|
||||
with guard_warnings_filter():
|
||||
ignore_message_warning()
|
||||
results = ([len(exc.args), 1], [exc.args[0], arg],
|
||||
[exc.message, arg],
|
||||
[str(exc), str(arg)],
|
||||
[repr(exc), exc.__class__.__name__ + repr(exc.args)])
|
||||
self.interface_test_driver(results)
|
||||
results = ([len(exc.args), 1], [exc.args[0], arg],
|
||||
[str(exc), str(arg)],
|
||||
[repr(exc), exc.__class__.__name__ + repr(exc.args)])
|
||||
self.interface_test_driver(results)
|
||||
|
||||
def test_interface_multi_arg(self):
|
||||
# Make sure interface correct when multiple arguments given
|
||||
arg_count = 3
|
||||
args = tuple(range(arg_count))
|
||||
exc = Exception(*args)
|
||||
with guard_warnings_filter():
|
||||
ignore_message_warning()
|
||||
results = ([len(exc.args), arg_count], [exc.args, args],
|
||||
[exc.message, ''], [str(exc), str(args)],
|
||||
[repr(exc), exc.__class__.__name__ + repr(exc.args)])
|
||||
self.interface_test_driver(results)
|
||||
results = ([len(exc.args), arg_count], [exc.args, args],
|
||||
[str(exc), str(args)],
|
||||
[repr(exc), exc.__class__.__name__ + repr(exc.args)])
|
||||
self.interface_test_driver(results)
|
||||
|
||||
def test_interface_no_arg(self):
|
||||
# Make sure that with no args that interface is correct
|
||||
exc = Exception()
|
||||
with guard_warnings_filter():
|
||||
ignore_message_warning()
|
||||
results = ([len(exc.args), 0], [exc.args, tuple()],
|
||||
[exc.message, ''],
|
||||
[str(exc), ''],
|
||||
[repr(exc), exc.__class__.__name__ + '()'])
|
||||
self.interface_test_driver(results)
|
||||
|
||||
def test_message_deprecation(self):
|
||||
# As of Python 2.6, BaseException.message is deprecated.
|
||||
with guard_warnings_filter():
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('error')
|
||||
|
||||
try:
|
||||
BaseException().message
|
||||
except DeprecationWarning:
|
||||
pass
|
||||
else:
|
||||
self.fail("BaseException.message not deprecated")
|
||||
|
||||
exc = BaseException()
|
||||
try:
|
||||
exc.message = ''
|
||||
except DeprecationWarning:
|
||||
pass
|
||||
else:
|
||||
self.fail("BaseException.message assignment not deprecated")
|
||||
results = ([len(exc.args), 0], [exc.args, tuple()],
|
||||
[str(exc), ''],
|
||||
[repr(exc), exc.__class__.__name__ + '()'])
|
||||
self.interface_test_driver(results)
|
||||
|
||||
class UsageTests(unittest.TestCase):
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
import warnings
|
||||
warnings.filterwarnings("ignore", "strop functions are obsolete;",
|
||||
DeprecationWarning,
|
||||
r'test.test_strop|unittest')
|
||||
import strop
|
||||
import unittest
|
||||
from test import test_support
|
||||
|
||||
|
||||
class StropFunctionTestCase(unittest.TestCase):
|
||||
|
||||
def test_maketrans(self):
|
||||
self.assert_(strop.maketrans("abc", "xyz") == transtable)
|
||||
self.assertRaises(ValueError, strop.maketrans, "abc", "xyzq")
|
||||
|
||||
|
||||
transtable = b'\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
|
||||
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(StropFunctionTestCase)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
@ -188,8 +188,6 @@ class PyBuildExt(build_ext):
|
||||
# math library functions, e.g. sin()
|
||||
exts.append( Extension('math', ['mathmodule.c'],
|
||||
libraries=math_libs) )
|
||||
# fast string operations implemented in C
|
||||
exts.append( Extension('strop', ['stropmodule.c']) )
|
||||
# time operations and variables
|
||||
exts.append( Extension('time', ['timemodule.c'],
|
||||
libraries=math_libs) )
|
||||
|
@ -26,6 +26,10 @@ TO DO
|
||||
Core and Builtins
|
||||
-----------------
|
||||
|
||||
- Remove BaseException.message.
|
||||
|
||||
- Remove strop module.
|
||||
|
||||
- Remove tuple parameter unpacking (PEP 3113).
|
||||
|
||||
- Remove the f_restricted attribute from frames. This naturally leads to teh
|
||||
@ -190,7 +194,9 @@ Library
|
||||
- Remove Bastion and rexec as they have been disabled since Python 2.3 (this
|
||||
also leads to the C API support for restricted execution).
|
||||
|
||||
- Remove obsolete IRIX modules: al, cd, cl, fl, fm, gl, imgfile, sgi, sv.
|
||||
- Remove obsolete IRIX modules: al/AL, cd/CD, cddb, cdplayer, cl/CL, DEVICE,
|
||||
ERRNO, FILE, fl/FL, flp, fm, GET, gl/GL, GLWS, IN, imgfile, IOCTL, jpeg,
|
||||
panel, panelparser, readcd, sgi, sv/SV, torgb, WAIT.
|
||||
|
||||
- Remove bsddb185 module; it was obsolete.
|
||||
|
||||
|
@ -133,13 +133,6 @@ zipimport zipimport.c
|
||||
# The Python symtable module depends on .h files that setup.py doesn't track
|
||||
_symtable symtablemodule.c
|
||||
|
||||
# Pure module. Cannot be linked dynamically.
|
||||
# -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE
|
||||
#WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE
|
||||
#PURE_INCLS=-I/usr/local/include
|
||||
#PURE_STUBLIBS=-L/usr/local/lib -lpurify_stubs -lquantify_stubs
|
||||
#pure puremodule.c $(WHICH_PURE_PRODUCTS) $(PURE_INCLS) $(PURE_STUBLIBS)
|
||||
|
||||
# Uncommenting the following line tells makesetup that all following
|
||||
# modules are to be built as shared libraries (see above for more
|
||||
# detail; also note that *static* reverses this effect):
|
||||
@ -170,7 +163,6 @@ _symtable symtablemodule.c
|
||||
#_random _randommodule.c # Random number generator
|
||||
#collections collectionsmodule.c # Container types
|
||||
#itertools itertoolsmodule.c # Functions creating iterators for efficient looping
|
||||
#strop stropmodule.c # String manipulations
|
||||
#atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
|
||||
|
||||
#unicodedata unicodedata.c # static Unicode character database
|
||||
|
@ -96,21 +96,18 @@ copy_grouping(char* s)
|
||||
static void
|
||||
fixup_ulcase(void)
|
||||
{
|
||||
PyObject *mods, *strop, *string, *ulo;
|
||||
PyObject *mods, *string, *ulo;
|
||||
unsigned char ul[256];
|
||||
int n, c;
|
||||
|
||||
/* find the string and strop modules */
|
||||
/* find the string module */
|
||||
mods = PyImport_GetModuleDict();
|
||||
if (!mods)
|
||||
return;
|
||||
string = PyDict_GetItemString(mods, "string");
|
||||
if (string)
|
||||
string = PyModule_GetDict(string);
|
||||
strop=PyDict_GetItemString(mods, "strop");
|
||||
if (strop)
|
||||
strop = PyModule_GetDict(strop);
|
||||
if (!string && !strop)
|
||||
if (!string)
|
||||
return;
|
||||
|
||||
/* create uppercase map string */
|
||||
@ -124,8 +121,6 @@ fixup_ulcase(void)
|
||||
return;
|
||||
if (string)
|
||||
PyDict_SetItemString(string, "uppercase", ulo);
|
||||
if (strop)
|
||||
PyDict_SetItemString(strop, "uppercase", ulo);
|
||||
Py_DECREF(ulo);
|
||||
|
||||
/* create lowercase string */
|
||||
@ -139,8 +134,6 @@ fixup_ulcase(void)
|
||||
return;
|
||||
if (string)
|
||||
PyDict_SetItemString(string, "lowercase", ulo);
|
||||
if (strop)
|
||||
PyDict_SetItemString(strop, "lowercase", ulo);
|
||||
Py_DECREF(ulo);
|
||||
|
||||
/* create letters string */
|
||||
|
@ -1,988 +0,0 @@
|
||||
/* This module exports the C API to such Pure Software Inc. (tm) (now
|
||||
* called Pure Atria Corporation) products as Purify (tm) and Quantify
|
||||
* (tm). Other packages could be added, but I didn't have those products
|
||||
* and thus lack the API documentation.
|
||||
*
|
||||
* Currently supported: Quantify 2.x, Purify 3.x
|
||||
*
|
||||
* You need to decide which products you want to incorporate into the
|
||||
* module when you compile this file. The way to do this is to edit
|
||||
* <Python>/Modules/Setup to pass the appropriate flags to the compiler.
|
||||
* -DWITH_PURIFY compiles in the Purify support, and -DWITH_QUANTIFY
|
||||
* compiles in the Quantify support. -DWITH_ALL_PURE compiles in both.
|
||||
* You can also build a Purify'd or Quantify'd interpreter by passing in
|
||||
* the LINKCC variable to make. E.g. if you want to build a Purify'd
|
||||
* interpreter and are using gcc, build Python with this command:
|
||||
*
|
||||
* make LINKCC='purify gcc'
|
||||
*
|
||||
* It would be nice (and probably easy) to provide this file as a shared
|
||||
* library, however since it doesn't appear that Pure gives us shared
|
||||
* libraries of the stubs, it doesn't really matter. For now, you have to
|
||||
* link this file in statically.
|
||||
*
|
||||
* Major bogosity. The purify.h header file exports purify_exit(), but
|
||||
* guess what? It is not defined in the libpurify_stubs.a file! I tried
|
||||
* to fake one here, hoping the Pure linker would Do The Right Thing when
|
||||
* instrumented for Purify, but it doesn't seem to, so I don't export
|
||||
* purify_exit() to the Python layer. In Python you should raise a
|
||||
* SystemExit exception anyway.
|
||||
*
|
||||
* The actual purify.h and quantify.h files which embody the APIs are
|
||||
* copyrighted by Pure Software, Inc. and are only attainable through them.
|
||||
* This module assumes you have legally installed licenses of their
|
||||
* software. Contact them on the Web via <http://www.pureatria.com/>
|
||||
*
|
||||
* Author: Barry Warsaw <bwarsaw@python.org>
|
||||
* <bwarsaw@cnri.reston.va.us>
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#if defined(WITH_PURIFY) || defined(WITH_ALL_PURE)
|
||||
# include <purify.h>
|
||||
# define HAS_PURIFY_EXIT 0 /* See note at top of file */
|
||||
# define PURE_PURIFY_VERSION 3 /* not provided by purify.h */
|
||||
#endif
|
||||
#if defined(WITH_QUANTIFY) || defined(WITH_ALL_PURE)
|
||||
# include <quantify.h>
|
||||
# define PURE_QUANTIFY_VERSION 2 /* not provided by quantify.h */
|
||||
#endif
|
||||
#if defined(PURIFY_H) || defined(QUANTIFY_H)
|
||||
# define COMMON_PURE_FUNCTIONS
|
||||
#endif /* PURIFY_H || QUANTIFY_H */
|
||||
|
||||
typedef int (*VoidArgFunc)(void);
|
||||
typedef int (*StringArgFunc)(char*);
|
||||
typedef int (*PrintfishFunc)(const char*, ...);
|
||||
typedef int (*StringIntArgFunc)(const char*, int);
|
||||
|
||||
|
||||
|
||||
static PyObject*
|
||||
call_voidarg_function(VoidArgFunc func, PyObject *self, PyObject *args)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
|
||||
status = func();
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
call_stringarg_function(StringArgFunc func, PyObject *self, PyObject *args)
|
||||
{
|
||||
int status;
|
||||
char* stringarg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s", &stringarg))
|
||||
return NULL;
|
||||
|
||||
status = func(stringarg);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
call_stringorint_function(StringArgFunc func, PyObject *self, PyObject *args)
|
||||
{
|
||||
int status;
|
||||
int intarg;
|
||||
char* stringarg;
|
||||
|
||||
/* according to the quantify.h file, the argument to
|
||||
* quantify_*_recording_system_call can be an integer or a string,
|
||||
* but the functions are prototyped as taking a single char*
|
||||
* argument. Yikes!
|
||||
*/
|
||||
if (PyArg_ParseTuple(args, "i", &intarg))
|
||||
/* func is prototyped as int(*)(char*)
|
||||
* better shut up the compiler
|
||||
*/
|
||||
status = func((char*)intarg);
|
||||
|
||||
else {
|
||||
PyErr_Clear();
|
||||
if (!PyArg_ParseTuple(args, "s", &stringarg))
|
||||
return NULL;
|
||||
else
|
||||
status = func(stringarg);
|
||||
}
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
call_printfish_function(PrintfishFunc func, PyObject *self, PyObject *args)
|
||||
{
|
||||
/* we support the printf() style vararg functions by requiring the
|
||||
* formatting be done in Python. At the C level we pass just a string
|
||||
* to the printf() style function.
|
||||
*/
|
||||
int status;
|
||||
char* argstring;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s", &argstring))
|
||||
return NULL;
|
||||
|
||||
status = func("%s", argstring);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
call_intasaddr_function(StringArgFunc func, PyObject *self, PyObject *args)
|
||||
{
|
||||
long memrep;
|
||||
int id;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "l", &memrep))
|
||||
return NULL;
|
||||
|
||||
id = func((char*)memrep);
|
||||
return Py_BuildValue("i", id);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
call_stringandint_function(StringIntArgFunc func, PyObject *self,
|
||||
PyObject *args)
|
||||
{
|
||||
long srcrep;
|
||||
int size;
|
||||
int status;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "li", &srcrep, &size))
|
||||
return NULL;
|
||||
|
||||
status = func((char*)srcrep, size);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* functions common to all products
|
||||
*
|
||||
* N.B. These printf() style functions are a bit of a kludge. Since the
|
||||
* API doesn't provide vprintf versions of them, we can't call them
|
||||
* directly. They don't support all the standard printf % modifiers
|
||||
* anyway. The way to use these is to use Python's % string operator to do
|
||||
* the formatting. By the time these functions get the thing to print,
|
||||
* it's already a string, and they just use "%s" as the format string.
|
||||
*/
|
||||
|
||||
#ifdef COMMON_PURE_FUNCTIONS
|
||||
|
||||
static PyObject*
|
||||
pure_pure_logfile_printf(PyObject* self, PyObject* args)
|
||||
{
|
||||
return call_printfish_function(pure_logfile_printf, self, args);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_pure_printf(PyObject* self, PyObject* args)
|
||||
{
|
||||
return call_printfish_function(pure_printf, self, args);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_pure_printf_with_banner(PyObject* self, PyObject* args)
|
||||
{
|
||||
return call_printfish_function(pure_printf_with_banner, self, args);
|
||||
}
|
||||
|
||||
|
||||
#endif /* COMMON_PURE_FUNCTIONS */
|
||||
|
||||
|
||||
|
||||
/* Purify functions
|
||||
*
|
||||
* N.B. There are some interfaces described in the purify.h file that are
|
||||
* not described in the manual.
|
||||
*
|
||||
* Unsigned longs purify_report_{address,number,type,result} are not
|
||||
* accessible from the Python layer since they seem mostly useful when
|
||||
* purify_stop_here() is called by the (C) debugger. The same is true of
|
||||
* the purify_stop_here_internal() function so it isn't exported either.
|
||||
* And purify_stop_here() should never be called directly.
|
||||
*
|
||||
* The header file says purify_{new,all,clear_new}_reports() are obsolete
|
||||
* so they aren't exported.
|
||||
*
|
||||
* None of the custom dynamic loader functions are exported.
|
||||
*
|
||||
* purify_unsafe_memcpy() isn't exported.
|
||||
*
|
||||
* purify_{start,size}_of_block() aren't exported.
|
||||
*
|
||||
* The manual that I have says that the prototype for the second argument
|
||||
* to purify_map_pool is:
|
||||
*
|
||||
* void (*fn)(char*)
|
||||
*
|
||||
* but the purify.h file declares it as:
|
||||
*
|
||||
* void (*fn)(char*, int, void*)
|
||||
*
|
||||
* and does not explain what the other arguments are for. I support the
|
||||
* latter but I don't know if I do it right or usefully.
|
||||
*
|
||||
* The header file says that purify_describe() returns a char* which is the
|
||||
* pointer passed to it. The manual says it returns an int, but I believe
|
||||
* that is a typo.
|
||||
*/
|
||||
#ifdef PURIFY_H
|
||||
|
||||
static PyObject*
|
||||
pure_purify_all_inuse(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_all_inuse, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_all_leaks(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_all_leaks, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_new_inuse(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_new_inuse, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_new_leaks(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_new_leaks, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_clear_inuse(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_clear_inuse, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_clear_leaks(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_clear_leaks, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_all_fds_inuse(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_all_fds_inuse, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_new_fds_inuse(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_new_fds_inuse, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_printf_with_call_chain(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_printfish_function(purify_printf_with_call_chain,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_set_pool_id(PyObject *self, PyObject *args)
|
||||
{
|
||||
long memrep;
|
||||
int id;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "li:purify_set_pool_id", &memrep, &id))
|
||||
return NULL;
|
||||
|
||||
purify_set_pool_id((char*)memrep, id);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_get_pool_id(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_get_pool_id, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_set_user_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
long memrep;
|
||||
long datarep;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ll:purify_set_user_data", &memrep, &datarep))
|
||||
return NULL;
|
||||
|
||||
purify_set_user_data((char*)memrep, (void*)datarep);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_get_user_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
/* can't use call_intasaddr_function() since purify_get_user_data()
|
||||
* returns a void*
|
||||
*/
|
||||
long memrep;
|
||||
void* data;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "l:purify_get_user_data", &memrep))
|
||||
return NULL;
|
||||
|
||||
data = purify_get_user_data((char*)memrep);
|
||||
return Py_BuildValue("l", (long)data);
|
||||
}
|
||||
|
||||
|
||||
/* this global variable is shared by both mapping functions:
|
||||
* pure_purify_map_pool() and pure_purify_map_pool_id(). Since they cache
|
||||
* this variable it should be safe in the face of recursion or cross
|
||||
* calling.
|
||||
*
|
||||
* Further note that the prototype for the callback function is wrong in
|
||||
* the Purify manual. The manual says the function takes a single char*,
|
||||
* but the header file says it takes an additional int and void*. I have
|
||||
* no idea what these are for!
|
||||
*/
|
||||
static PyObject* MapCallable = NULL;
|
||||
|
||||
static void
|
||||
map_pool_callback(char* mem, int user_size, void *user_aux_data)
|
||||
{
|
||||
long memrep = (long)mem;
|
||||
long user_aux_data_rep = (long)user_aux_data;
|
||||
PyObject* result;
|
||||
PyObject* memobj = Py_BuildValue("lil", memrep, user_size,
|
||||
user_aux_data_rep);
|
||||
|
||||
if (memobj == NULL)
|
||||
return;
|
||||
|
||||
result = PyEval_CallObject(MapCallable, memobj);
|
||||
Py_DECREF(result);
|
||||
Py_DECREF(memobj);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_map_pool(PyObject *self, PyObject *args)
|
||||
{
|
||||
/* cache global variable in case of recursion */
|
||||
PyObject* saved_callable = MapCallable;
|
||||
PyObject* arg_callable;
|
||||
int id;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "iO:purify_map_pool", &id, &arg_callable))
|
||||
return NULL;
|
||||
|
||||
if (!PyCallable_Check(arg_callable)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"Second argument must be callable");
|
||||
return NULL;
|
||||
}
|
||||
MapCallable = arg_callable;
|
||||
purify_map_pool(id, map_pool_callback);
|
||||
MapCallable = saved_callable;
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static void
|
||||
PurifyMapPoolIdCallback(int id)
|
||||
{
|
||||
PyObject* result;
|
||||
PyObject* intobj = Py_BuildValue("i", id);
|
||||
|
||||
if (intobj == NULL)
|
||||
return;
|
||||
|
||||
result = PyEval_CallObject(MapCallable, intobj);
|
||||
Py_DECREF(result);
|
||||
Py_DECREF(intobj);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_map_pool_id(PyObject *self, PyObject *args)
|
||||
{
|
||||
/* cache global variable in case of recursion */
|
||||
PyObject* saved_callable = MapCallable;
|
||||
PyObject* arg_callable;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O:purify_map_pool_id", &arg_callable))
|
||||
return NULL;
|
||||
|
||||
if (!PyCallable_Check(arg_callable)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Argument must be callable.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MapCallable = arg_callable;
|
||||
purify_map_pool_id(PurifyMapPoolIdCallback);
|
||||
MapCallable = saved_callable;
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PyObject*
|
||||
pure_purify_new_messages(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_new_messages, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_all_messages(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_all_messages, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_clear_messages(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_clear_messages, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_clear_new_messages(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_clear_new_messages, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_start_batch(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_start_batch, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_start_batch_show_first(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_start_batch_show_first,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_stop_batch(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_stop_batch, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_name_thread(PyObject *self, PyObject *args)
|
||||
{
|
||||
/* can't strictly use call_stringarg_function since
|
||||
* purify_name_thread takes a const char*, not a char*
|
||||
*/
|
||||
int status;
|
||||
char* stringarg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:purify_name_thread", &stringarg))
|
||||
return NULL;
|
||||
|
||||
status = purify_name_thread(stringarg);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_1(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_1, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_2(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_2, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_4(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_4, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_8(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_8, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_w_1(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_w_1, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_w_2(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_w_2, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_w_4(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_w_4, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_w_8(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_w_8, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_r_1(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_r_1, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_r_2(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_r_2, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_r_4(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_r_4, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_r_8(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_r_8, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_rw_1(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_rw_1, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_rw_2(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_rw_2, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_rw_4(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_rw_4, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_watch_rw_8(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_intasaddr_function(purify_watch_rw_8, self, args);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_watch_n(PyObject *self, PyObject *args)
|
||||
{
|
||||
long addrrep;
|
||||
unsigned int size;
|
||||
char* type;
|
||||
int status;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "lis:purify_watch_n", &addrrep, &size, &type))
|
||||
return NULL;
|
||||
|
||||
status = purify_watch_n((char*)addrrep, size, type);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_watch_info(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_watch_info, self, args);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_watch_remove(PyObject *self, PyObject *args)
|
||||
{
|
||||
int watchno;
|
||||
int status;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:purify_watch_remove", &watchno))
|
||||
return NULL;
|
||||
|
||||
status = purify_watch_remove(watchno);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_watch_remove_all(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_watch_remove_all, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_describe(PyObject *self, PyObject *args)
|
||||
{
|
||||
long addrrep;
|
||||
char* rtn;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "l:purify_describe", &addrrep))
|
||||
return NULL;
|
||||
|
||||
rtn = purify_describe((char*)addrrep);
|
||||
return Py_BuildValue("l", (long)rtn);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_what_colors(PyObject *self, PyObject *args)
|
||||
{
|
||||
long addrrep;
|
||||
unsigned int size;
|
||||
int status;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "li:purify_what_colors", &addrrep, &size))
|
||||
return NULL;
|
||||
|
||||
status = purify_what_colors((char*)addrrep, size);
|
||||
return Py_BuildValue("i", status);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_is_running(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(purify_is_running, self, args);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
pure_purify_assert_is_readable(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringandint_function(purify_assert_is_readable,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_purify_assert_is_writable(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringandint_function(purify_assert_is_writable,
|
||||
self, args);
|
||||
}
|
||||
|
||||
#if HAS_PURIFY_EXIT
|
||||
|
||||
/* I wish I could include this, but I can't. See the notes at the top of
|
||||
* the file.
|
||||
*/
|
||||
|
||||
static PyObject*
|
||||
pure_purify_exit(PyObject *self, PyObject *args)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:purify_exit", &status))
|
||||
return NULL;
|
||||
|
||||
/* purify_exit doesn't always act like exit(). See the manual */
|
||||
purify_exit(status);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
#endif /* HAS_PURIFY_EXIT */
|
||||
|
||||
#endif /* PURIFY_H */
|
||||
|
||||
|
||||
|
||||
/* Quantify functions
|
||||
*
|
||||
* N.B. Some of these functions are only described in the quantify.h file,
|
||||
* not in the version of the hardcopy manual that I had. If you're not
|
||||
* sure what some of these do, check the header file, it is documented
|
||||
* fairly well.
|
||||
*
|
||||
* None of the custom dynamic loader functions are exported.
|
||||
*
|
||||
*/
|
||||
#ifdef QUANTIFY_H
|
||||
|
||||
static PyObject*
|
||||
pure_quantify_is_running(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_is_running, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_help(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_help, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_print_recording_state(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_print_recording_state,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_start_recording_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_start_recording_data,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_stop_recording_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_stop_recording_data, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_is_recording_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_is_recording_data, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_start_recording_system_calls(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_start_recording_system_calls,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_stop_recording_system_calls(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_stop_recording_system_calls,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_is_recording_system_calls(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_is_recording_system_calls,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_start_recording_system_call(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringorint_function(quantify_start_recording_system_call,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_stop_recording_system_call(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringorint_function(quantify_stop_recording_system_call,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_is_recording_system_call(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringorint_function(quantify_is_recording_system_call,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_start_recording_dynamic_library_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(
|
||||
quantify_start_recording_dynamic_library_data,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_stop_recording_dynamic_library_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(
|
||||
quantify_stop_recording_dynamic_library_data,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_is_recording_dynamic_library_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(
|
||||
quantify_is_recording_dynamic_library_data,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_start_recording_register_window_traps(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(
|
||||
quantify_start_recording_register_window_traps,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_stop_recording_register_window_traps(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(
|
||||
quantify_stop_recording_register_window_traps,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_is_recording_register_window_traps(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(
|
||||
quantify_is_recording_register_window_traps,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_disable_recording_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_disable_recording_data,
|
||||
self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_clear_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_clear_data, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_save_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_voidarg_function(quantify_save_data, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_save_data_to_file(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringarg_function(quantify_save_data_to_file, self, args);
|
||||
}
|
||||
static PyObject*
|
||||
pure_quantify_add_annotation(PyObject *self, PyObject *args)
|
||||
{
|
||||
return call_stringarg_function(quantify_add_annotation, self, args);
|
||||
}
|
||||
|
||||
#endif /* QUANTIFY_H */
|
||||
|
||||
|
||||
|
||||
/* external interface
|
||||
*/
|
||||
static struct PyMethodDef
|
||||
pure_methods[] = {
|
||||
#ifdef COMMON_PURE_FUNCTIONS
|
||||
{"pure_logfile_printf", pure_pure_logfile_printf, METH_VARARGS},
|
||||
{"pure_printf", pure_pure_printf, METH_VARARGS},
|
||||
{"pure_printf_with_banner", pure_pure_printf_with_banner, METH_VARARGS},
|
||||
#endif /* COMMON_PURE_FUNCTIONS */
|
||||
#ifdef PURIFY_H
|
||||
{"purify_all_inuse", pure_purify_all_inuse, METH_VARARGS},
|
||||
{"purify_all_leaks", pure_purify_all_leaks, METH_VARARGS},
|
||||
{"purify_new_inuse", pure_purify_new_inuse, METH_VARARGS},
|
||||
{"purify_new_leaks", pure_purify_new_leaks, METH_VARARGS},
|
||||
{"purify_clear_inuse", pure_purify_clear_inuse, METH_VARARGS},
|
||||
{"purify_clear_leaks", pure_purify_clear_leaks, METH_VARARGS},
|
||||
{"purify_all_fds_inuse", pure_purify_all_fds_inuse, METH_VARARGS},
|
||||
{"purify_new_fds_inuse", pure_purify_new_fds_inuse, METH_VARARGS},
|
||||
/* see purify.h */
|
||||
{"purify_logfile_printf", pure_pure_logfile_printf, METH_VARARGS},
|
||||
{"purify_printf", pure_pure_printf, METH_VARARGS},
|
||||
{"purify_printf_with_banner", pure_pure_printf_with_banner, METH_VARARGS},
|
||||
/**/
|
||||
{"purify_printf_with_call_chain", pure_purify_printf_with_call_chain, METH_VARARGS},
|
||||
{"purify_set_pool_id", pure_purify_set_pool_id, METH_VARARGS},
|
||||
{"purify_get_pool_id", pure_purify_get_pool_id, METH_VARARGS},
|
||||
{"purify_set_user_data", pure_purify_set_user_data, METH_VARARGS},
|
||||
{"purify_get_user_data", pure_purify_get_user_data, METH_VARARGS},
|
||||
{"purify_map_pool", pure_purify_map_pool, METH_VARARGS},
|
||||
{"purify_map_pool_id", pure_purify_map_pool_id, METH_VARARGS},
|
||||
{"purify_new_messages", pure_purify_new_messages, METH_VARARGS},
|
||||
{"purify_all_messages", pure_purify_all_messages, METH_VARARGS},
|
||||
{"purify_clear_messages", pure_purify_clear_messages, METH_VARARGS},
|
||||
{"purify_clear_new_messages", pure_purify_clear_new_messages, METH_VARARGS},
|
||||
{"purify_start_batch", pure_purify_start_batch, METH_VARARGS},
|
||||
{"purify_start_batch_show_first", pure_purify_start_batch_show_first, METH_VARARGS},
|
||||
{"purify_stop_batch", pure_purify_stop_batch, METH_VARARGS},
|
||||
{"purify_name_thread", pure_purify_name_thread, METH_VARARGS},
|
||||
{"purify_watch", pure_purify_watch, METH_VARARGS},
|
||||
{"purify_watch_1", pure_purify_watch_1, METH_VARARGS},
|
||||
{"purify_watch_2", pure_purify_watch_2, METH_VARARGS},
|
||||
{"purify_watch_4", pure_purify_watch_4, METH_VARARGS},
|
||||
{"purify_watch_8", pure_purify_watch_8, METH_VARARGS},
|
||||
{"purify_watch_w_1", pure_purify_watch_w_1, METH_VARARGS},
|
||||
{"purify_watch_w_2", pure_purify_watch_w_2, METH_VARARGS},
|
||||
{"purify_watch_w_4", pure_purify_watch_w_4, METH_VARARGS},
|
||||
{"purify_watch_w_8", pure_purify_watch_w_8, METH_VARARGS},
|
||||
{"purify_watch_r_1", pure_purify_watch_r_1, METH_VARARGS},
|
||||
{"purify_watch_r_2", pure_purify_watch_r_2, METH_VARARGS},
|
||||
{"purify_watch_r_4", pure_purify_watch_r_4, METH_VARARGS},
|
||||
{"purify_watch_r_8", pure_purify_watch_r_8, METH_VARARGS},
|
||||
{"purify_watch_rw_1", pure_purify_watch_rw_1, METH_VARARGS},
|
||||
{"purify_watch_rw_2", pure_purify_watch_rw_2, METH_VARARGS},
|
||||
{"purify_watch_rw_4", pure_purify_watch_rw_4, METH_VARARGS},
|
||||
{"purify_watch_rw_8", pure_purify_watch_rw_8, METH_VARARGS},
|
||||
{"purify_watch_n", pure_purify_watch_n, METH_VARARGS},
|
||||
{"purify_watch_info", pure_purify_watch_info, METH_VARARGS},
|
||||
{"purify_watch_remove", pure_purify_watch_remove, METH_VARARGS},
|
||||
{"purify_watch_remove_all", pure_purify_watch_remove_all, METH_VARARGS},
|
||||
{"purify_describe", pure_purify_describe, METH_VARARGS},
|
||||
{"purify_what_colors", pure_purify_what_colors, METH_VARARGS},
|
||||
{"purify_is_running", pure_purify_is_running, METH_VARARGS},
|
||||
{"purify_assert_is_readable", pure_purify_assert_is_readable, METH_VARARGS},
|
||||
{"purify_assert_is_writable", pure_purify_assert_is_writable, METH_VARARGS},
|
||||
#if HAS_PURIFY_EXIT
|
||||
/* I wish I could include this, but I can't. See the notes at the
|
||||
* top of the file.
|
||||
*/
|
||||
{"purify_exit", pure_purify_exit, METH_VARARGS},
|
||||
#endif /* HAS_PURIFY_EXIT */
|
||||
#endif /* PURIFY_H */
|
||||
#ifdef QUANTIFY_H
|
||||
{"quantify_is_running", pure_quantify_is_running, METH_VARARGS},
|
||||
{"quantify_help", pure_quantify_help, METH_VARARGS},
|
||||
{"quantify_print_recording_state", pure_quantify_print_recording_state, METH_VARARGS},
|
||||
{"quantify_start_recording_data", pure_quantify_start_recording_data, METH_VARARGS},
|
||||
{"quantify_stop_recording_data", pure_quantify_stop_recording_data, METH_VARARGS},
|
||||
{"quantify_is_recording_data", pure_quantify_is_recording_data, METH_VARARGS},
|
||||
{"quantify_start_recording_system_calls",
|
||||
pure_quantify_start_recording_system_calls, METH_VARARGS},
|
||||
{"quantify_stop_recording_system_calls",
|
||||
pure_quantify_stop_recording_system_calls, METH_VARARGS},
|
||||
{"quantify_is_recording_system_calls",
|
||||
pure_quantify_is_recording_system_calls, METH_VARARGS},
|
||||
{"quantify_start_recording_system_call",
|
||||
pure_quantify_start_recording_system_call, METH_VARARGS},
|
||||
{"quantify_stop_recording_system_call",
|
||||
pure_quantify_stop_recording_system_call, METH_VARARGS},
|
||||
{"quantify_is_recording_system_call",
|
||||
pure_quantify_is_recording_system_call, METH_VARARGS},
|
||||
{"quantify_start_recording_dynamic_library_data",
|
||||
pure_quantify_start_recording_dynamic_library_data, METH_VARARGS},
|
||||
{"quantify_stop_recording_dynamic_library_data",
|
||||
pure_quantify_stop_recording_dynamic_library_data, METH_VARARGS},
|
||||
{"quantify_is_recording_dynamic_library_data",
|
||||
pure_quantify_is_recording_dynamic_library_data, METH_VARARGS},
|
||||
{"quantify_start_recording_register_window_traps",
|
||||
pure_quantify_start_recording_register_window_traps, METH_VARARGS},
|
||||
{"quantify_stop_recording_register_window_traps",
|
||||
pure_quantify_stop_recording_register_window_traps, METH_VARARGS},
|
||||
{"quantify_is_recording_register_window_traps",
|
||||
pure_quantify_is_recording_register_window_traps, METH_VARARGS},
|
||||
{"quantify_disable_recording_data",
|
||||
pure_quantify_disable_recording_data, METH_VARARGS},
|
||||
{"quantify_clear_data", pure_quantify_clear_data, METH_VARARGS},
|
||||
{"quantify_save_data", pure_quantify_save_data, METH_VARARGS},
|
||||
{"quantify_save_data_to_file", pure_quantify_save_data_to_file, METH_VARARGS},
|
||||
{"quantify_add_annotation", pure_quantify_add_annotation, METH_VARARGS},
|
||||
#endif /* QUANTIFY_H */
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ins(d, name, val)
|
||||
PyObject *d;
|
||||
char* name;
|
||||
long val;
|
||||
{
|
||||
PyObject *v = PyInt_FromLong(val);
|
||||
if (v) {
|
||||
(void)PyDict_SetItemString(d, name, v);
|
||||
Py_DECREF(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
initpure()
|
||||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
m = Py_InitModule("pure", pure_methods);
|
||||
if (m == NULL)
|
||||
return;
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
/* this is bogus because we should be able to find this information
|
||||
* out from the header files. Pure's current versions don't
|
||||
* include this information!
|
||||
*/
|
||||
#ifdef PURE_PURIFY_VERSION
|
||||
ins(d, "PURIFY_VERSION", PURE_PURIFY_VERSION);
|
||||
#else
|
||||
PyDict_SetItemString(d, "PURIFY_VERSION", Py_None);
|
||||
#endif
|
||||
|
||||
/* these aren't terribly useful because purify_exit() isn't
|
||||
* exported correctly. See the note at the top of the file.
|
||||
*/
|
||||
#ifdef PURIFY_EXIT_ERRORS
|
||||
ins(d, "PURIFY_EXIT_ERRORS", PURIFY_EXIT_ERRORS);
|
||||
#endif
|
||||
#ifdef PURIFY_EXIT_LEAKS
|
||||
ins(d, "PURIFY_EXIT_LEAKS", PURIFY_EXIT_LEAKS);
|
||||
#endif
|
||||
#ifdef PURIFY_EXIT_PLEAKS
|
||||
ins(d, "PURIFY_EXIT_PLEAKS", PURIFY_EXIT_PLEAKS);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PURE_QUANTIFY_VERSION
|
||||
ins(d, "QUANTIFY_VERSION", PURE_QUANTIFY_VERSION);
|
||||
#else
|
||||
PyDict_SetItemString(d, "QUANTIFY_VERSION", Py_None);
|
||||
#endif
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/* strop module */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
|
||||
PyDoc_STRVAR(strop_module__doc__,
|
||||
"Common string manipulations, optimized for speed.\n"
|
||||
"\n"
|
||||
"Always use \"import string\" rather than referencing\n"
|
||||
"this module directly.");
|
||||
|
||||
PyDoc_STRVAR(maketrans__doc__,
|
||||
"maketrans(frm, to) -> string\n"
|
||||
"\n"
|
||||
"Return a translation table (a string of 256 bytes long)\n"
|
||||
"suitable for use in string.translate. The strings frm and to\n"
|
||||
"must be of the same length.");
|
||||
|
||||
static PyObject *
|
||||
strop_maketrans(PyObject *self, PyObject *args)
|
||||
{
|
||||
unsigned char *c, *from=NULL, *to=NULL;
|
||||
Py_ssize_t i, fromlen=0, tolen=0;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "t#t#:maketrans", &from, &fromlen, &to, &tolen))
|
||||
return NULL;
|
||||
|
||||
if (fromlen != tolen) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"maketrans arguments must have same length");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = PyString_FromStringAndSize((char *)NULL, 256);
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result);
|
||||
for (i = 0; i < 256; i++)
|
||||
c[i]=(unsigned char)i;
|
||||
for (i = 0; i < fromlen; i++)
|
||||
c[from[i]]=to[i];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* List of functions defined in the module */
|
||||
|
||||
static PyMethodDef
|
||||
strop_methods[] = {
|
||||
{"maketrans", strop_maketrans, METH_VARARGS, maketrans__doc__},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
PyMODINIT_FUNC
|
||||
initstrop(void)
|
||||
{
|
||||
PyObject *m;
|
||||
m = Py_InitModule4("strop", strop_methods, strop_module__doc__,
|
||||
(PyObject*)NULL, PYTHON_API_VERSION);
|
||||
if (m == NULL)
|
||||
return;
|
||||
}
|
@ -27,7 +27,7 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
if (!self)
|
||||
return NULL;
|
||||
/* the dict is created on the fly in PyObject_GenericSetAttr */
|
||||
self->message = self->dict = NULL;
|
||||
self->dict = NULL;
|
||||
|
||||
self->args = PyTuple_New(0);
|
||||
if (!self->args) {
|
||||
@ -35,12 +35,6 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->message = PyString_FromString("");
|
||||
if (!self->message) {
|
||||
Py_DECREF(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
@ -54,11 +48,6 @@ BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
|
||||
self->args = args;
|
||||
Py_INCREF(self->args);
|
||||
|
||||
if (PyTuple_GET_SIZE(self->args) == 1) {
|
||||
Py_CLEAR(self->message);
|
||||
self->message = PyTuple_GET_ITEM(self->args, 0);
|
||||
Py_INCREF(self->message);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -67,7 +56,6 @@ BaseException_clear(PyBaseExceptionObject *self)
|
||||
{
|
||||
Py_CLEAR(self->dict);
|
||||
Py_CLEAR(self->args);
|
||||
Py_CLEAR(self->message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -84,7 +72,6 @@ BaseException_traverse(PyBaseExceptionObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(self->dict);
|
||||
Py_VISIT(self->args);
|
||||
Py_VISIT(self->message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -231,42 +218,10 @@ BaseException_set_args(PyBaseExceptionObject *self, PyObject *val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BaseException_get_message(PyBaseExceptionObject *self)
|
||||
{
|
||||
int ret;
|
||||
ret = PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"BaseException.message has been deprecated as "
|
||||
"of Python 2.6",
|
||||
1);
|
||||
if (ret == -1)
|
||||
return NULL;
|
||||
|
||||
Py_INCREF(self->message);
|
||||
return self->message;
|
||||
}
|
||||
|
||||
static int
|
||||
BaseException_set_message(PyBaseExceptionObject *self, PyObject *val)
|
||||
{
|
||||
int ret;
|
||||
ret = PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"BaseException.message has been deprecated as "
|
||||
"of Python 2.6",
|
||||
1);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
Py_INCREF(val);
|
||||
Py_DECREF(self->message);
|
||||
self->message = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyGetSetDef BaseException_getset[] = {
|
||||
{"__dict__", (getter)BaseException_get_dict, (setter)BaseException_set_dict},
|
||||
{"args", (getter)BaseException_get_args, (setter)BaseException_set_args},
|
||||
{"message", (getter)BaseException_get_message,
|
||||
(setter)BaseException_set_message},
|
||||
{NULL},
|
||||
};
|
||||
|
||||
@ -453,8 +408,6 @@ SystemExit_traverse(PySystemExitObject *self, visitproc visit, void *arg)
|
||||
}
|
||||
|
||||
static PyMemberDef SystemExit_members[] = {
|
||||
{"message", T_OBJECT, offsetof(PySystemExitObject, message), 0,
|
||||
PyDoc_STR("exception message")},
|
||||
{"code", T_OBJECT, offsetof(PySystemExitObject, code), 0,
|
||||
PyDoc_STR("exception code")},
|
||||
{NULL} /* Sentinel */
|
||||
@ -655,8 +608,6 @@ EnvironmentError_str(PyEnvironmentErrorObject *self)
|
||||
}
|
||||
|
||||
static PyMemberDef EnvironmentError_members[] = {
|
||||
{"message", T_OBJECT, offsetof(PyEnvironmentErrorObject, message), 0,
|
||||
PyDoc_STR("exception message")},
|
||||
{"errno", T_OBJECT, offsetof(PyEnvironmentErrorObject, myerrno), 0,
|
||||
PyDoc_STR("exception errno")},
|
||||
{"strerror", T_OBJECT, offsetof(PyEnvironmentErrorObject, strerror), 0,
|
||||
@ -888,8 +839,6 @@ WindowsError_str(PyWindowsErrorObject *self)
|
||||
}
|
||||
|
||||
static PyMemberDef WindowsError_members[] = {
|
||||
{"message", T_OBJECT, offsetof(PyWindowsErrorObject, message), 0,
|
||||
PyDoc_STR("exception message")},
|
||||
{"errno", T_OBJECT, offsetof(PyWindowsErrorObject, myerrno), 0,
|
||||
PyDoc_STR("POSIX exception code")},
|
||||
{"strerror", T_OBJECT, offsetof(PyWindowsErrorObject, strerror), 0,
|
||||
@ -1120,8 +1069,6 @@ SyntaxError_str(PySyntaxErrorObject *self)
|
||||
}
|
||||
|
||||
static PyMemberDef SyntaxError_members[] = {
|
||||
{"message", T_OBJECT, offsetof(PySyntaxErrorObject, message), 0,
|
||||
PyDoc_STR("exception message")},
|
||||
{"msg", T_OBJECT, offsetof(PySyntaxErrorObject, msg), 0,
|
||||
PyDoc_STR("exception msg")},
|
||||
{"filename", T_OBJECT, offsetof(PySyntaxErrorObject, filename), 0,
|
||||
@ -1569,8 +1516,6 @@ UnicodeError_traverse(PyUnicodeErrorObject *self, visitproc visit, void *arg)
|
||||
}
|
||||
|
||||
static PyMemberDef UnicodeError_members[] = {
|
||||
{"message", T_OBJECT, offsetof(PyUnicodeErrorObject, message), 0,
|
||||
PyDoc_STR("exception message")},
|
||||
{"encoding", T_OBJECT, offsetof(PyUnicodeErrorObject, encoding), 0,
|
||||
PyDoc_STR("exception encoding")},
|
||||
{"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0,
|
||||
|
@ -3769,8 +3769,6 @@ string_getnewargs(PyStringObject *v)
|
||||
|
||||
static PyMethodDef
|
||||
string_methods[] = {
|
||||
/* Counterparts of the obsolete stropmodule functions; except
|
||||
string.maketrans(). */
|
||||
{"join", (PyCFunction)string_join, METH_O, join__doc__},
|
||||
{"split", (PyCFunction)string_split, METH_VARARGS, split__doc__},
|
||||
{"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__},
|
||||
|
@ -619,10 +619,6 @@ SOURCE=..\..\Objects\stringobject.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Modules\stropmodule.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Python\structmember.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -27,7 +27,6 @@ extern void initsignal(void);
|
||||
extern void init_sha(void);
|
||||
extern void init_sha256(void);
|
||||
extern void init_sha512(void);
|
||||
extern void initstrop(void);
|
||||
extern void inittime(void);
|
||||
extern void initthread(void);
|
||||
extern void initcStringIO(void);
|
||||
@ -104,7 +103,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||
{"_sha", init_sha},
|
||||
{"_sha256", init_sha256},
|
||||
{"_sha512", init_sha512},
|
||||
{"strop", initstrop},
|
||||
{"time", inittime},
|
||||
#ifdef WITH_THREAD
|
||||
{"thread", initthread},
|
||||
|
@ -309,7 +309,6 @@ SRC.MODULES= $(addprefix $(TOP), \
|
||||
Modules/sha256module.c \
|
||||
Modules/sha512module.c \
|
||||
Modules/_sre.c \
|
||||
Modules/stropmodule.c \
|
||||
Modules/_struct.c \
|
||||
Modules/symtablemodule.c \
|
||||
Modules/termios.c \
|
||||
|
@ -69,7 +69,6 @@ extern void initrgbimg();
|
||||
extern void init_sha();
|
||||
extern void init_sha256();
|
||||
extern void init_sha512();
|
||||
extern void initstrop();
|
||||
extern void init_struct();
|
||||
extern void inittermios();
|
||||
extern void inittime();
|
||||
@ -134,7 +133,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||
{"_sha", init_sha},
|
||||
{"_sha256", init_sha256},
|
||||
{"_sha512", init_sha512},
|
||||
{"strop", initstrop},
|
||||
{"_struct", init_struct},
|
||||
{"termios", inittermios},
|
||||
{"time", inittime},
|
||||
|
@ -1284,9 +1284,6 @@ EXPORTS
|
||||
; From python25_s.lib(_sre)
|
||||
; "init_sre"
|
||||
|
||||
; From python25_s.lib(stropmodule)
|
||||
; "initstrop"
|
||||
|
||||
; From python25_s.lib(_struct)
|
||||
; "init_struct"
|
||||
|
||||
|
@ -31,7 +31,6 @@ extern void initrgbimg(void);
|
||||
extern void initsignal(void);
|
||||
extern void initselect(void);
|
||||
extern void init_socket(void);
|
||||
extern void initstrop(void);
|
||||
extern void initstruct(void);
|
||||
extern void inittime(void);
|
||||
extern void initthread(void);
|
||||
@ -75,7 +74,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||
{"_socket", init_socket},
|
||||
{"select", initselect},
|
||||
#endif
|
||||
{"strop", initstrop},
|
||||
{"struct", initstruct},
|
||||
{"time", inittime},
|
||||
#ifdef WITH_THREAD
|
||||
|
@ -1059,20 +1059,6 @@ stdwinmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \
|
||||
$(PY_INCLUDE)\stringobject.h $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h \
|
||||
$(PY_INCLUDE)\tupleobject.h
|
||||
|
||||
stropmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \
|
||||
$(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \
|
||||
pyconfig.h $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h \
|
||||
$(PY_INCLUDE)\floatobject.h $(PY_INCLUDE)\funcobject.h $(PY_INCLUDE)\import.h \
|
||||
$(PY_INCLUDE)\intobject.h $(PY_INCLUDE)\intrcheck.h $(PY_INCLUDE)\listobject.h \
|
||||
$(PY_INCLUDE)\longobject.h $(PY_INCLUDE)\methodobject.h \
|
||||
$(PY_INCLUDE)\modsupport.h $(PY_INCLUDE)\moduleobject.h $(PY_INCLUDE)\mymalloc.h \
|
||||
$(PY_INCLUDE)\myproto.h $(PY_INCLUDE)\object.h $(PY_INCLUDE)\objimpl.h \
|
||||
$(PY_INCLUDE)\pydebug.h $(PY_INCLUDE)\pyerrors.h $(PY_INCLUDE)\pyfpe.h \
|
||||
$(PY_INCLUDE)\pystate.h $(PY_INCLUDE)\python.h $(PY_INCLUDE)\pythonrun.h \
|
||||
$(PY_INCLUDE)\rangeobject.h $(PY_INCLUDE)\sliceobject.h \
|
||||
$(PY_INCLUDE)\stringobject.h $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h \
|
||||
$(PY_INCLUDE)\tupleobject.h
|
||||
|
||||
structmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \
|
||||
$(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \
|
||||
pyconfig.h $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h \
|
||||
|
@ -772,14 +772,6 @@ stdwinmodule.obj: abstract.h ceval.h classobject.h cobject.h \
|
||||
pystate.h python.h pythonrun.h rangeobject.h sliceobject.h \
|
||||
stringobject.h sysmodule.h traceback.h tupleobject.h
|
||||
|
||||
stropmodule.obj: abstract.h ceval.h classobject.h cobject.h complexobject.h \
|
||||
pyconfig.h dictobject.h fileobject.h floatobject.h funcobject.h \
|
||||
import.h intobject.h intrcheck.h listobject.h longobject.h \
|
||||
methodobject.h modsupport.h moduleobject.h mymalloc.h myproto.h \
|
||||
object.h objimpl.h pydebug.h pyerrors.h pyfpe.h pystate.h python.h \
|
||||
pythonrun.h rangeobject.h sliceobject.h stringobject.h sysmodule.h \
|
||||
traceback.h tupleobject.h
|
||||
|
||||
structmodule.obj: abstract.h ceval.h classobject.h cobject.h \
|
||||
complexobject.h pyconfig.h dictobject.h fileobject.h floatobject.h \
|
||||
funcobject.h import.h intobject.h intrcheck.h listobject.h \
|
||||
|
@ -742,9 +742,6 @@
|
||||
<File
|
||||
RelativePath="..\Objects\stringobject.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Modules\stropmodule.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Python\structmember.c">
|
||||
</File>
|
||||
|
@ -1545,10 +1545,6 @@
|
||||
RelativePath="..\..\Modules\signalmodule.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Modules\stropmodule.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Modules\symtablemodule.c"
|
||||
>
|
||||
|
8
README
8
README
@ -465,7 +465,7 @@ QNX: Chris Herborth (chrish@qnx.com) writes:
|
||||
crypt, curses, errno, fcntl, gdbm, grp, imageop,
|
||||
_locale, math, md5, new, operator, parser, pcre,
|
||||
posix, pwd, readline, regex, reop, rgbimg, rotor,
|
||||
select, signal, socket, soundex, strop, struct,
|
||||
select, signal, socket, soundex, struct,
|
||||
syslog, termios, time, timing, zlib, audioop, imageop, rgbimg
|
||||
|
||||
3) make SHELL=/usr/local/bin/bash
|
||||
@ -521,7 +521,7 @@ Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes:
|
||||
_codecs, _locale, _socket, _symtable, _testcapi, _weakref
|
||||
array, binascii, cmath, cPickle, crypt, cStringIO, dbm
|
||||
errno, fcntl, grp, math, md5, operator, parser, pwd
|
||||
rotor, select, struct, strop, syslog, termios,
|
||||
rotor, select, struct, syslog, termios,
|
||||
time, timing
|
||||
|
||||
4) Once the python executable and library have been built, make
|
||||
@ -860,10 +860,6 @@ will build: enable it in Setup, then if you get compilation or link
|
||||
errors, disable it -- you're either missing support or need to adjust
|
||||
the compilation and linking parameters for that module.
|
||||
|
||||
On SGI IRIX, there are modules that interface to many SGI specific
|
||||
system libraries, e.g. the GL library and the audio hardware. These
|
||||
modules will not be built by the setup.py script.
|
||||
|
||||
In addition to the file Setup, you can also edit the file Setup.local.
|
||||
(the makesetup script processes both). You may find it more
|
||||
convenient to edit Setup.local and leave Setup alone. Then, when
|
||||
|
@ -292,9 +292,6 @@ $(LIB_PYTHON): $(OBJECTS)
|
||||
@.^.Lib.signal/pyd: @.^.Modules.o.signalmodule s.linktab
|
||||
$(MAKEDLK) -d @.^.Lib.signal/pyd -s s.linktab -o @.^.Modules.o.signalmodule -e initsignal
|
||||
|
||||
@.^.Lib.strop/pyd: @.^.Modules.o.stropmodule s.linktab
|
||||
$(MAKEDLK) -d @.^.Lib.strop/pyd -s s.linktab -o @.^.Modules.o.stropmodule -e initstrop
|
||||
|
||||
@.^.Lib.struct/pyd: @.^.Modules.o.structmodule s.linktab
|
||||
$(MAKEDLK) -d @.^.Lib.struct/pyd -s s.linktab -o @.^.Modules.o.structmodule -e initstruct
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -391,8 +391,6 @@ class PyBuildExt(build_ext):
|
||||
# math library functions, e.g. sin()
|
||||
exts.append( Extension('math', ['mathmodule.c'],
|
||||
libraries=math_libs) )
|
||||
# fast string operations implemented in C
|
||||
exts.append( Extension('strop', ['stropmodule.c']) )
|
||||
# time operations and variables
|
||||
exts.append( Extension('time', ['timemodule.c'],
|
||||
libraries=math_libs) )
|
||||
|
Loading…
Reference in New Issue
Block a user