lib/wrappers/s-z - Dropped 'T' from types

This commit is contained in:
pdw
2015-05-24 22:50:19 -05:00
committed by Araq
parent b2bc5440aa
commit cbd8da93f4
15 changed files with 613 additions and 540 deletions

View File

@@ -346,7 +346,7 @@ const
HAT_LEFTDOWN* = HAT_LEFT or HAT_DOWN # SDL_events.h constants
type
TEventKind* = enum # kind of an SDL event
EventKind* = enum # kind of an SDL event
NOEVENT = 0, # Unused (do not remove)
ACTIVEEVENT = 1, # Application loses/gains visibility
KEYDOWN = 2, # Keys pressed
@@ -374,6 +374,7 @@ type
# Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use
USEREVENT = 24 # This last event is only for bounding internal arrays
# It is the number of bits in the event mask datatype -- int32
{.deprecated: [TEventKind: EventKind].}
const
NUMEVENTS* = 32
@@ -750,12 +751,12 @@ const # Enumeration of valid key mods (possibly OR'd tog
GRAB_ON* = 1 #SDL_GRAB_FULLSCREEN // Used internally
type
THandle* = int #SDL_types.h types
Handle* = int #SDL_types.h types
# Basic data types
TBool* = enum
Bool* = enum
sdlFALSE, sdlTRUE
PUInt8Array* = ptr TUInt8Array
TUInt8Array* = array[0..high(int) shr 1, byte]
PUInt8Array* = ptr UInt8Array
UInt8Array* = array[0..high(int) shr 1, byte]
PUInt16* = ptr uint16
PUInt32* = ptr uint32
PUInt64* = ptr UInt64
@@ -768,15 +769,14 @@ type
hi*: int32
lo*: int32
TGrabMode* = int32 # SDL_error.h types
Terrorcode* = enum
GrabMode* = int32 # SDL_error.h types
ErrorCode* = enum
ENOMEM, EFREAD, EFWRITE, EFSEEK, LASTERROR
Errorcode* = Terrorcode
TArg*{.final.} = object
Arg*{.final.} = object
buf*: array[0..ERR_MAX_STRLEN - 1, int8]
Perror* = ptr Terror
TError*{.final.} = object # This is a numeric value corresponding to the current error
Error*{.final.} = object # This is a numeric value corresponding to the current error
# SDL_rwops.h types
# This is the read/write operation structure -- very basic
# some helper types to handle the unions
@@ -787,51 +787,51 @@ type
# used directly as an error message format string.
key*: array[0..ERR_MAX_STRLEN - 1, int8] # These are the arguments for the error functions
argc*: int
args*: array[0..ERR_MAX_ARGS - 1, TArg]
args*: array[0..ERR_MAX_ARGS - 1, Arg]
TStdio*{.final.} = object
Stdio*{.final.} = object
autoclose*: int # FILE * is only defined in Kylix so we use a simple pointer
fp*: pointer
TMem*{.final.} = object
Mem*{.final.} = object
base*: ptr byte
here*: ptr byte
stop*: ptr byte
PRWops* = ptr TRWops # now the pointer to function types
TSeek* = proc (context: PRWops, offset: int, whence: int): int{.cdecl.}
TRead* = proc (context: PRWops, thePtr: pointer, size: int, maxnum: int): int{.
PRWops* = ptr RWops # now the pointer to function types
Seek* = proc (context: PRWops, offset: int, whence: int): int{.cdecl.}
Read* = proc (context: PRWops, thePtr: pointer, size: int, maxnum: int): int{.
cdecl.}
TWrite* = proc (context: PRWops, thePtr: pointer, size: int, num: int): int{.
Write* = proc (context: PRWops, thePtr: pointer, size: int, num: int): int{.
cdecl.}
TClose* = proc (context: PRWops): int{.cdecl.} # the variant record itself
TRWops*{.final.} = object
seek*: TSeek
read*: TRead
write*: TWrite
closeFile*: TClose # a keyword as name is not allowed
Close* = proc (context: PRWops): int{.cdecl.} # the variant record itself
RWops*{.final.} = object
seek*: Seek
read*: Read
write*: Write
closeFile*: Close # a keyword as name is not allowed
# be warned! structure alignment may arise at this point
theType*: cint
mem*: TMem
mem*: Mem
RWops* = TRWops # SDL_timer.h types
RWops* = RWops # SDL_timer.h types
# Function prototype for the timer callback function
TTimerCallback* = proc (interval: int32): int32{.cdecl.}
TNewTimerCallback* = proc (interval: int32, param: pointer): int32{.cdecl.}
TimerCallback* = proc (interval: int32): int32{.cdecl.}
NewTimerCallback* = proc (interval: int32, param: pointer): int32{.cdecl.}
PTimerID* = ptr TTimerID
TTimerID*{.final.} = object
PTimerID* = ptr TimerID
TimerID*{.final.} = object
interval*: int32
callback*: TNewTimerCallback
callback*: NewTimerCallback
param*: pointer
lastAlarm*: int32
next*: PTimerID
TAudioSpecCallback* = proc (userdata: pointer, stream: ptr byte, length: int){.
AudioSpecCallback* = proc (userdata: pointer, stream: ptr byte, length: int){.
cdecl.} # SDL_audio.h types
# The calculated values in this structure are calculated by SDL_OpenAudio()
PAudioSpec* = ptr TAudioSpec
TAudioSpec*{.final.} = object # A structure to hold a set of audio conversion filters and buffers
PAudioSpec* = ptr AudioSpec
AudioSpec*{.final.} = object # A structure to hold a set of audio conversion filters and buffers
freq*: int # DSP frequency -- samples per second
format*: uint16 # Audio data format
channels*: byte # Number of channels: 1 mono, 2 stereo
@@ -844,18 +844,18 @@ type
# 'len' is the length of that buffer in bytes.
# Once the callback returns, the buffer will no longer be valid.
# Stereo samples are stored in a LRLRLR ordering.
callback*: TAudioSpecCallback
callback*: AudioSpecCallback
userdata*: pointer
PAudioCVT* = ptr TAudioCVT
PAudioCVTFilter* = ptr TAudioCVTFilter
TAudioCVTFilter*{.final.} = object
PAudioCVT* = ptr AudioCVT
PAudioCVTFilter* = ptr AudioCVTFilter
AudioCVTFilter*{.final.} = object
cvt*: PAudioCVT
format*: uint16
PAudioCVTFilterArray* = ptr TAudioCVTFilterArray
TAudioCVTFilterArray* = array[0..9, PAudioCVTFilter]
TAudioCVT*{.final.} = object
PAudioCVTFilterArray* = ptr AudioCVTFilterArray
AudioCVTFilterArray* = array[0..9, PAudioCVTFilter]
AudioCVT*{.final.} = object
needed*: int # Set to 1 if conversion possible
srcFormat*: uint16 # Source audio format
dstFormat*: uint16 # Target audio format
@@ -865,49 +865,49 @@ type
lenCvt*: int # Length of converted audio buffer
lenMult*: int # buffer must be len*len_mult big
lenRatio*: float64 # Given len, final size is len*len_ratio
filters*: TAudioCVTFilterArray
filters*: AudioCVTFilterArray
filterIndex*: int # Current audio conversion function
TAudiostatus* = enum # SDL_cdrom.h types
AudioStatus* = enum # SDL_cdrom.h types
AUDIO_STOPPED, AUDIO_PLAYING, AUDIO_PAUSED
TCDStatus* = enum
CDStatus* = enum
CD_ERROR, CD_TRAYEMPTY, CD_STOPPED, CD_PLAYING, CD_PAUSED
PCDTrack* = ptr TCDTrack
TCDTrack*{.final.} = object # This structure is only current as of the last call to SDL_CDStatus()
PCDTrack* = ptr CDTrack
CDTrack*{.final.} = object # This structure is only current as of the last call to SDL_CDStatus()
id*: byte # Track number
theType*: byte # Data or audio track
unused*: uint16
len*: int32 # Length, in frames, of this track
offset*: int32 # Offset, in frames, from start of disk
PCD* = ptr TCD
TCD*{.final.} = object #SDL_joystick.h types
PCD* = ptr CD
CD*{.final.} = object #SDL_joystick.h types
id*: int # Private drive identifier
status*: TCDStatus # Current drive status
status*: CDStatus # Current drive status
# The rest of this structure is only valid if there's a CD in drive
numtracks*: int # Number of tracks on disk
curTrack*: int # Current track position
curTrack*: int # Current track position
curFrame*: int # Current frame offset within current track
track*: array[0..MAX_TRACKS, TCDTrack]
track*: array[0..MAX_TRACKS, CDTrack]
PTransAxis* = ptr TTransAxis
TTransAxis*{.final.} = object # The private structure used to keep track of a joystick
PTransAxis* = ptr TransAxis
TransAxis*{.final.} = object # The private structure used to keep track of a joystick
offset*: int
scale*: float32
PJoystickHwdata* = ptr TJoystickHwdata
TJoystick_hwdata*{.final.} = object # joystick ID
PJoystickHwdata* = ptr JoystickHwdata
Joystick_hwdata*{.final.} = object # joystick ID
id*: int # values used to translate device-specific coordinates into SDL-standard ranges
transaxis*: array[0..5, TTransAxis]
transaxis*: array[0..5, TransAxis]
PBallDelta* = ptr TBallDelta
TBallDelta*{.final.} = object # Current ball motion deltas
PBallDelta* = ptr BallDelta
BallDelta*{.final.} = object # Current ball motion deltas
# The SDL joystick structure
dx*: int
dy*: int
PJoystick* = ptr TJoystick
TJoystick*{.final.} = object # SDL_verion.h types
PJoystick* = ptr Joystick
Joystick*{.final.} = object # SDL_verion.h types
index*: byte # Device index
name*: cstring # Joystick name - system dependent
naxes*: int # Number of axis controls on the joystick
@@ -921,16 +921,16 @@ type
hwdata*: PJoystickHwdata # Driver dependent information
refCount*: int # Reference count for multiple opens
Pversion* = ptr Tversion
Tversion*{.final.} = object # SDL_keyboard.h types
Pversion* = ptr Version
Version*{.final.} = object # SDL_keyboard.h types
major*: byte
minor*: byte
patch*: byte
TKey* = int32
TMod* = int32
PKeySym* = ptr TKeySym
TKeySym*{.final.} = object # SDL_events.h types
Key* = int32
Mod* = int32
PKeySym* = ptr KeySym
KeySym*{.final.} = object # SDL_events.h types
#Checks the event queue for messages and optionally returns them.
# If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
# the back of the event queue.
@@ -943,69 +943,69 @@ type
# This function returns the number of events actually stored, or -1
# if there was an error. This function is thread-safe.
scancode*: byte # hardware specific scancode
sym*: TKey # SDL virtual keysym
modifier*: TMod # current key modifiers
sym*: Key # SDL virtual keysym
modifier*: Mod # current key modifiers
unicode*: uint16 # translated character
TEventAction* = enum # Application visibility event structure
EventAction* = enum # Application visibility event structure
ADDEVENT, PEEKEVENT, GETEVENT
PActiveEvent* = ptr TActiveEvent
TActiveEvent*{.final.} = object # SDL_ACTIVEEVENT
PActiveEvent* = ptr ActiveEvent
ActiveEvent*{.final.} = object # SDL_ACTIVEEVENT
# Keyboard event structure
kind*: TEventKind
kind*: EventKind
gain*: byte # Whether given states were gained or lost (1/0)
state*: byte # A mask of the focus states
PKeyboardEvent* = ptr TKeyboardEvent
TKeyboardEvent*{.final.} = object # SDL_KEYDOWN or SDL_KEYUP
PKeyboardEvent* = ptr KeyboardEvent
KeyboardEvent*{.final.} = object # SDL_KEYDOWN or SDL_KEYUP
# Mouse motion event structure
kind*: TEventKind
kind*: EventKind
which*: byte # The keyboard device index
state*: byte # SDL_PRESSED or SDL_RELEASED
keysym*: TKeySym
keysym*: KeySym
PMouseMotionEvent* = ptr TMouseMotionEvent
TMouseMotionEvent*{.final.} = object # SDL_MOUSEMOTION
PMouseMotionEvent* = ptr MouseMotionEvent
MouseMotionEvent*{.final.} = object # SDL_MOUSEMOTION
# Mouse button event structure
kind*: TEventKind
kind*: EventKind
which*: byte # The mouse device index
state*: byte # The current button state
x*, y*: uint16 # The X/Y coordinates of the mouse
xrel*: int16 # The relative motion in the X direction
yrel*: int16 # The relative motion in the Y direction
PMouseButtonEvent* = ptr TMouseButtonEvent
TMouseButtonEvent*{.final.} = object # SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
PMouseButtonEvent* = ptr MouseButtonEvent
MouseButtonEvent*{.final.} = object # SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
# Joystick axis motion event structure
kind*: TEventKind
kind*: EventKind
which*: byte # The mouse device index
button*: byte # The mouse button index
state*: byte # SDL_PRESSED or SDL_RELEASED
x*: uint16 # The X coordinates of the mouse at press time
y*: uint16 # The Y coordinates of the mouse at press time
PJoyAxisEvent* = ptr TJoyAxisEvent
TJoyAxisEvent*{.final.} = object # SDL_JOYAXISMOTION
PJoyAxisEvent* = ptr JoyAxisEvent
JoyAxisEvent*{.final.} = object # SDL_JOYAXISMOTION
# Joystick trackball motion event structure
kind*: TEventKind
kind*: EventKind
which*: byte # The joystick device index
axis*: byte # The joystick axis index
value*: int16 # The axis value (range: -32768 to 32767)
PJoyBallEvent* = ptr TJoyBallEvent
TJoyBallEvent*{.final.} = object # SDL_JOYAVBALLMOTION
PJoyBallEvent* = ptr JoyBallEvent
JoyBallEvent*{.final.} = object # SDL_JOYAVBALLMOTION
# Joystick hat position change event structure
kind*: TEventKind
kind*: EventKind
which*: byte # The joystick device index
ball*: byte # The joystick trackball index
xrel*: int16 # The relative motion in the X direction
yrel*: int16 # The relative motion in the Y direction
PJoyHatEvent* = ptr TJoyHatEvent
TJoyHatEvent*{.final.} = object # SDL_JOYHATMOTION */
PJoyHatEvent* = ptr JoyHatEvent
JoyHatEvent*{.final.} = object # SDL_JOYHATMOTION */
# Joystick button event structure
kind*: TEventKind
kind*: EventKind
which*: byte # The joystick device index */
hat*: byte # The joystick hat index */
value*: byte # The hat position value:
@@ -1014,146 +1014,171 @@ type
# 6 5 4
# Note that zero means the POV is centered.
PJoyButtonEvent* = ptr TJoyButtonEvent
TJoyButtonEvent*{.final.} = object # SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
PJoyButtonEvent* = ptr JoyButtonEvent
JoyButtonEvent*{.final.} = object # SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
# The "window resized" event
# When you get this event, you are
# responsible for setting a new video
# mode with the new width and height.
kind*: TEventKind
kind*: EventKind
which*: byte # The joystick device index
button*: byte # The joystick button index
state*: byte # SDL_PRESSED or SDL_RELEASED
PResizeEvent* = ptr TResizeEvent
TResizeEvent*{.final.} = object # SDL_VIDEORESIZE
PResizeEvent* = ptr ResizeEvent
ResizeEvent*{.final.} = object # SDL_VIDEORESIZE
# A user-defined event type
kind*: TEventKind
kind*: EventKind
w*: cint # New width
h*: cint # New height
PUserEvent* = ptr TUserEvent
TUserEvent*{.final.} = object # SDL_USEREVENT through SDL_NUMEVENTS-1
kind*: TEventKind
code*: cint # User defined event code
PUserEvent* = ptr UserEvent
UserEvent*{.final.} = object # SDL_USEREVENT through SDL_NUMEVENTS-1
kind*: EventKind
code*: cint # User defined event code
data1*: pointer # User defined data pointer
data2*: pointer # User defined data pointer
{.deprecated: [THandle: Handle, TEventAction: EventAction, TKey: Key, TArg: Arg,
TKeySym: KeySym, TKeyboardEvent: KeyboardEvent, TError: Error,
TWrite: Write, TBool: Bool, TUInt8Array: UInt8Array,
TGrabMode: GrabMode, Terrorcode: Errorcode, TStdio: Stdio,
TMem: Mem, TSeek: Seek, TRead: Read, TClose: Close,
TTimerCallback: TimerCallback, TNewTimerCallback: NewTimerCallabck,
TTimerID: TimerID, TAudioSpecCallback: AudioSpecCallback,
TAudioSpec: AudioSpec, TAudioCVTFilter: AudioCVTFilter,
TAudioCVTFilterArray: AudioCVTFilterArray, TAudioCVT: AudioCVT,
TAudioStatus: AudioStatus, TCDStatus: CDStatus, TCDTrack: CDTrack,
TCD: CD, TTransAxis: TransAxis, TJoystick_hwdata: Joystick_hwdata,
TJoystick: Joystick, TJoyAxisEvent: JoyAxisEvent, TRWops: RWops,
TJoyBallEvent: JoyBallEvent, TJoyHatEvent: JoyHatEvent,
TJoyButtonEvent: JoyButtonEvent, TBallDelta: BallDelta,
Tversion: Version, TMod: Mod, TActiveEvent: ActiveEvent,
TMouseMotionEvent: MouseMotionEvent, TMouseButtonEvent: MouseButtonEvent,
TResizeEvent: ResizeEvent, TUserEvent: UserEvent].}
when defined(Unix):
type #These are the various supported subsystems under UNIX
TSysWm* = enum
SysWm* = enum
SYSWM_X11
{.deprecated: [TSysWm: SysWm].}
when defined(WINDOWS):
type
PSysWMmsg* = ptr TSysWMmsg
TSysWMmsg*{.final.} = object
version*: Tversion
hwnd*: THandle # The window for the message
PSysWMmsg* = ptr SysWMmsg
SysWMmsg*{.final.} = object
version*: Version
hwnd*: Handle # The window for the message
msg*: int # The type of message
wParam*: int32 # WORD message parameter
lParam*: int32 # LONG message parameter
{.deprecated: [TSysWMmsg: SysWMmsg].}
elif defined(Unix):
type # The Linux custom event structure
PSysWMmsg* = ptr TSysWMmsg
TSysWMmsg*{.final.} = object
version*: Tversion
subsystem*: TSysWm
PSysWMmsg* = ptr SysWMmsg
SysWMmsg*{.final.} = object
version*: Version
subsystem*: SysWm
when false:
event*: TXEvent
{.deprecated: [TSysWMmsg: SysWMmsg].}
else:
type # The generic custom event structure
PSysWMmsg* = ptr TSysWMmsg
TSysWMmsg*{.final.} = object
version*: Tversion
PSysWMmsg* = ptr SysWMmsg
SysWMmsg*{.final.} = object
version*: Version
data*: int
{.deprecated: [TSysWMmsg: SysWMmsg].}
# The Windows custom window manager information structure
when defined(WINDOWS):
type
PSysWMinfo* = ptr TSysWMinfo
TSysWMinfo*{.final.} = object
version*: Tversion
window*: THandle # The display window
PSysWMinfo* = ptr SysWMinfo
SysWMinfo*{.final.} = object
version*: Version
window*: Handle # The display window
{.deprecated: [TSysWMinfo: SysWMinfo].}
elif defined(Unix):
type
TX11*{.final.} = object
X11*{.final.} = object
when false:
display*: PDisplay # The X11 display
window*: TWindow # The X11 display window
window*: Window # The X11 display window
# These locking functions should be called around
# any X11 functions using the display variable.
# They lock the event thread, so should not be
# called around event functions or from event filters.
lock_func*: pointer
unlock_func*: pointer # Introduced in SDL 1.0.2
fswindow*: TWindow # The X11 fullscreen window
wmwindow*: TWindow # The X11 managed input window
fswindow*: Window # The X11 fullscreen window
wmwindow*: Window # The X11 managed input window
{.deprecated: [TX11: X11].}
type
PSysWMinfo* = ptr TSysWMinfo
TSysWMinfo*{.final.} = object
version*: Tversion
subsystem*: TSysWm
X11*: TX11
PSysWMinfo* = ptr SysWMinfo
SysWMinfo*{.final.} = object
version*: Version
subsystem*: SysWm
X11*: X11
{.deprecated: [TSysWMinfo: SysWMinfo].}
else:
type # The generic custom window manager information structure
PSysWMinfo* = ptr TSysWMinfo
TSysWMinfo*{.final.} = object
version*: Tversion
PSysWMinfo* = ptr SysWMinfo
SysWMinfo*{.final.} = object
version*: Version
data*: int
{.deprecated: [TSysWMinfo: SysWMinfo].}
type
PSysWMEvent* = ptr TSysWMEvent
TSysWMEvent*{.final.} = object
kind*: TEventKind
PSysWMEvent* = ptr SysWMEvent
SysWMEvent*{.final.} = object
kind*: EventKind
msg*: PSysWMmsg
PExposeEvent* = ptr TExposeEvent
TExposeEvent*{.final.} = object
kind*: TEventKind
PExposeEvent* = ptr ExposeEvent
ExposeEvent*{.final.} = object
kind*: EventKind
PQuitEvent* = ptr TQuitEvent
TQuitEvent*{.final.} = object
kind*: TEventKind
PQuitEvent* = ptr QuitEvent
QuitEvent*{.final.} = object
kind*: EventKind
PEvent* = ptr TEvent
TEvent*{.final.} = object
kind*: TEventKind
PEvent* = ptr Event
Event*{.final.} = object
kind*: EventKind
pad: array[0..19, byte]
TEventFilter* = proc (event: PEvent): int{.cdecl.} # SDL_video.h types
EventFilter* = proc (event: PEvent): int{.cdecl.} # SDL_video.h types
# Useful data types
PPSDL_Rect* = ptr PRect
PRect* = ptr TRect
TRect*{.final.} = object
PRect* = ptr Rect
Rect*{.final.} = object
x*, y*: int16
w*, h*: uint16
Rect* = TRect
PColor* = ptr TColor
TColor*{.final.} = object
# Rect* = TRect
PColor* = ptr Color
Color*{.final.} = object
r*: byte
g*: byte
b*: byte
unused*: byte
PColorArray* = ptr TColorArray
TColorArray* = array[0..65000, TColor]
PColorArray* = ptr ColorArray
ColorArray* = array[0..65000, Color]
PPalette* = ptr TPalette
TPalette*{.final.} = object # Everything in the pixel format structure is read-only
Palette*{.final.} = object # Everything in the pixel format structure is read-only
ncolors*: int
colors*: PColorArray
PPixelFormat* = ptr TPixelFormat
TPixelFormat*{.final.} = object # The structure passed to the low level blit functions
PixelFormat*{.final.} = object # The structure passed to the low level blit functions
palette*: PPalette
bitsPerPixel*: byte
bytesPerPixel*: byte
@@ -1172,8 +1197,8 @@ type
colorkey*: int32 # RGB color key information
alpha*: byte # Alpha value information (per-surface alpha)
PBlitInfo* = ptr TBlitInfo
TBlitInfo*{.final.} = object # typedef for private surface blitting functions
PBlitInfo* = ptr BlitInfo
BlitInfo*{.final.} = object # typedef for private surface blitting functions
sPixels*: ptr byte
sWidth*: int
sHeight*: int
@@ -1187,10 +1212,10 @@ type
table*: ptr byte
dst*: PPixelFormat
PSurface* = ptr TSurface
TBlit* = proc (src: PSurface, srcrect: PRect,
PSurface* = ptr Surface
Blit* = proc (src: PSurface, srcrect: PRect,
dst: PSurface, dstrect: PRect): int{.cdecl.}
TSurface*{.final.} = object # Useful for determining the video hardware capabilities
Surface*{.final.} = object # Useful for determining the video hardware capabilities
flags*: int32 # Read-only
format*: PPixelFormat # Read-only
w*, h*: cint # Read-only
@@ -1199,7 +1224,7 @@ type
offset*: cint # Private
hwdata*: pointer #TPrivate_hwdata; Hardware-specific surface info
# clipping information:
clipRect*: TRect # Read-only
clipRect*: Rect # Read-only
unused1*: int32 # for binary compatibility
# Allow recursive locks
locked*: int32 # Private
@@ -1209,8 +1234,8 @@ type
formatVersion*: cint # Private
refcount*: cint
PVideoInfo* = ptr TVideoInfo
TVideoInfo*{.final.} = object # The YUV hardware video overlay
PVideoInfo* = ptr VideoInfo
VideoInfo*{.final.} = object # The YUV hardware video overlay
hwAvailable*: byte
blitHw*: byte
unusedBits3*: byte # Unused at this point
@@ -1219,8 +1244,8 @@ type
currentW*: int32 # Value: The current video mode width
currentH*: int32 # Value: The current video mode height
POverlay* = ptr TOverlay
TOverlay*{.final.} = object # Public enumeration for setting the OpenGL window attributes.
POverlay* = ptr Overlay
Overlay*{.final.} = object # Public enumeration for setting the OpenGL window attributes.
format*: int32 # Overlay format
w*, h*: int # Width and height of overlay
planes*: int # Number of planes in the overlay. Usually either 1 or 3
@@ -1228,61 +1253,73 @@ type
pixels*: ptr ptr byte # An array of pointers to the data of each plane. The overlay should be locked before these pointers are used.
hwOverlay*: int32 # This will be set to 1 if the overlay is hardware accelerated.
TGLAttr* = enum
GLAttr* = enum
GL_RED_SIZE, GL_GREEN_SIZE, GL_BLUE_SIZE, GL_ALPHA_SIZE, GL_BUFFER_SIZE,
GL_DOUBLEBUFFER, GL_DEPTH_SIZE, GL_STENCIL_SIZE, GL_ACCUM_RED_SIZE,
GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE, GL_STEREO,
GL_MULTISAMPLEBUFFERS, GL_MULTISAMPLESAMPLES, GL_ACCELERATED_VISUAL,
GL_SWAP_CONTROL
PCursor* = ptr TCursor
TCursor*{.final.} = object # SDL_mutex.h types
area*: TRect # The area of the mouse cursor
PCursor* = ptr Cursor
Cursor*{.final.} = object # SDL_mutex.h types
area*: Rect # The area of the mouse cursor
hotX*, hot_y*: int16 # The "tip" of the cursor
data*: ptr byte # B/W cursor data
mask*: ptr byte # B/W cursor mask
save*: array[1..2, ptr byte] # Place to save cursor area
wmCursor*: pointer # Window-manager cursor
{.deprecated: [TRect: Rect, TSurface: Surface, TEvent: Event, TColor: Color,
TEventFilter: EventFilter, TColorArray: ColorArray,
TSysWMEvent: SysWMEvent, TExposeEvent: ExposeEvent,
TQuitEvent: QuitEvent, TPalette: Palette, TPixelFormat: PixelFormat,
TBlitInfo: BlitInfo, TBlit: Blit, TVideoInfo: VideoInfo,
TOverlay: Overlay, TGLAttr: GLAttr, TCursor: Cursor].}
type
PMutex* = ptr TMutex
TMutex*{.final.} = object
Psemaphore* = ptr Tsemaphore
Tsemaphore*{.final.} = object
PSem* = ptr TSem
TSem* = Tsemaphore
PCond* = ptr TCond
TCond*{.final.} = object # SDL_thread.h types
PMutex* = ptr Mutex
Mutex*{.final.} = object
Psemaphore* = ptr Semaphore
Semaphore*{.final.} = object
PSem* = ptr Sem
Sem* = Semaphore
PCond* = ptr Cond
Cond*{.final.} = object # SDL_thread.h types
{.deprecated: [TCond: Cond, TSem: Sem, TMutex: Mutex, Tsemaphore: Semaphore].}
when defined(WINDOWS):
type
TSYS_ThreadHandle* = THandle
SYS_ThreadHandle* = Handle
{.deprecated: [TSYS_ThreadHandle: SYS_ThreadHandle].}
when defined(Unix):
type
TSYS_ThreadHandle* = pointer
SYS_ThreadHandle* = pointer
{.deprecated: [TSYS_ThreadHandle: SYS_ThreadHandle].}
type # This is the system-independent thread info structure
PThread* = ptr TThread
TThread*{.final.} = object # Helper Types
PThread* = ptr Thread
Thread*{.final.} = object # Helper Types
# Keyboard State Array ( See demos for how to use )
threadid*: int32
handle*: TSYS_ThreadHandle
handle*: SYS_ThreadHandle
status*: int
errbuf*: Terror
data*: pointer
PKeyStateArr* = ptr TKeyStateArr
TKeyStateArr* = array[0..65000, byte] # Types required so we don't need to use Windows.pas
PKeyStateArr* = ptr KeyStateArr
KeyStateArr* = array[0..65000, byte] # Types required so we don't need to use Windows.pas
PInteger* = ptr int
PByte* = ptr int8
PWord* = ptr int16
PLongWord* = ptr int32 # General arrays
PByteArray* = ptr TByteArray
TByteArray* = array[0..32767, int8]
PWordArray* = ptr TWordArray
TWordArray* = array[0..16383, int16] # Generic procedure pointer
PByteArray* = ptr ByteArray
ByteArray* = array[0..32767, int8]
PWordArray* = ptr WordArray
WordArray* = array[0..16383, int16] # Generic procedure pointer
{.deprecated: [TKeyStateArr: KeyStateArr, TByteArray: ByteArray, TThread: Thread,
TWordArray: WordArray].}
type TEventSeq = set[TEventKind]
template evconv(procName: expr, ptrName: typedesc, assertions: TEventSeq): stmt {.immediate.} =
type EventSeq = set[EventKind]
{.deprecated: [TEventSeq: EventSeq].}
template evconv(procName: expr, ptrName: typedesc, assertions: EventSeq): stmt {.immediate.} =
proc `procName`*(event: PEvent): ptrName =
assert(contains(assertions, event.kind))
result = cast[ptrName](event)
@@ -1337,7 +1374,7 @@ proc getError*(): cstring{.cdecl, importc: "SDL_GetError", dynlib: LibName.}
proc setError*(fmt: cstring){.cdecl, importc: "SDL_SetError", dynlib: LibName.}
proc clearError*(){.cdecl, importc: "SDL_ClearError", dynlib: LibName.}
when not (defined(WINDOWS)):
proc error*(Code: Terrorcode){.cdecl, importc: "SDL_Error", dynlib: LibName.}
proc error*(Code: ErrorCode){.cdecl, importc: "SDL_Error", dynlib: LibName.}
#------------------------------------------------------------------------------
# io handling
#------------------------------------------------------------------------------
@@ -1368,13 +1405,13 @@ proc getTicks*(): int32{.cdecl, importc: "SDL_GetTicks", dynlib: LibName.}
proc delay*(msec: int32){.cdecl, importc: "SDL_Delay", dynlib: LibName.}
# Add a new timer to the pool of timers already running.
# Returns a timer ID, or NULL when an error occurs.
proc addTimer*(interval: int32, callback: TNewTimerCallback, param: pointer): PTimerID{.
proc addTimer*(interval: int32, callback: NewTimerCallback, param: pointer): PTimerID{.
cdecl, importc: "SDL_AddTimer", dynlib: LibName.}
# Remove one of the multiple timers knowing its ID.
# Returns a boolean value indicating success.
proc removeTimer*(t: PTimerID): TBool{.cdecl, importc: "SDL_RemoveTimer",
proc removeTimer*(t: PTimerID): Bool{.cdecl, importc: "SDL_RemoveTimer",
dynlib: LibName.}
proc setTimer*(interval: int32, callback: TTimerCallback): int{.cdecl,
proc setTimer*(interval: int32, callback: TimerCallback): int{.cdecl,
importc: "SDL_SetTimer", dynlib: LibName.}
#------------------------------------------------------------------------------
# audio-routines
@@ -1432,7 +1469,7 @@ proc audioDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl,
proc openAudio*(desired, obtained: PAudioSpec): int{.cdecl,
importc: "SDL_OpenAudio", dynlib: LibName.}
# Get the current audio state:
proc getAudioStatus*(): TAudiostatus{.cdecl, importc: "SDL_GetAudioStatus",
proc getAudioStatus*(): Audiostatus{.cdecl, importc: "SDL_GetAudioStatus",
dynlib: LibName.}
# This function pauses and unpauses the audio callback processing.
# It should be called with a parameter of 0 after opening the audio
@@ -1518,7 +1555,7 @@ proc cdOpen*(drive: int): PCD{.cdecl, importc: "SDL_CDOpen", dynlib: LibName.}
# This function returns the current status of the given drive.
# If the drive has a CD in it, the table of contents of the CD and current
# play position of the CD will be stored in the SDL_CD structure.
proc cdStatus*(cdrom: PCD): TCDStatus{.cdecl, importc: "SDL_CDStatus",
proc cdStatus*(cdrom: PCD): CDStatus{.cdecl, importc: "SDL_CDStatus",
dynlib: LibName.}
# Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
# tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
@@ -1559,7 +1596,7 @@ proc cdEject*(cdrom: PCD): int{.cdecl, importc: "SDL_CDEject", dynlib: LibName.}
# Closes the handle for the CD-ROM drive
proc cdClose*(cdrom: PCD){.cdecl, importc: "SDL_CDClose", dynlib: LibName.}
# Given a status, returns true if there's a disk in the drive
proc cdInDrive*(status: TCDStatus): bool
proc cdInDrive*(status: CDStatus): bool
proc numJoysticks*(): int{.cdecl, importc: "SDL_NumJoysticks", dynlib: LibName.}
# Get the implementation dependent name of a joystick.
@@ -1643,7 +1680,7 @@ proc pumpEvents*(){.cdecl, importc: "SDL_PumpEvents", dynlib: LibName.}
# removed from the queue.
# This function returns the number of events actually stored, or -1
# if there was an error. This function is thread-safe.
proc peepEvents*(events: PEvent, numevents: int, action: TEventAction,
proc peepEvents*(events: PEvent, numevents: int, action: EventAction,
mask: int32): int{.cdecl, importc: "SDL_PeepEvents",
dynlib: LibName.}
# Polls for currently pending events, and returns 1 if there are any pending
@@ -1672,11 +1709,11 @@ proc pushEvent*(event: PEvent): int{.cdecl, importc: "SDL_PushEvent",
# be closed, otherwise the window will remain open if possible.
# If the quit event is generated by an interrupt signal, it will bypass the
# internal queue and be delivered to the application at the next event poll.
proc setEventFilter*(filter: TEventFilter){.cdecl,
proc setEventFilter*(filter: EventFilter){.cdecl,
importc: "SDL_SetEventFilter", dynlib: LibName.}
# Return the current event filter - can be used to "chain" filters.
# If there is no event filter set, this function returns NULL.
proc getEventFilter*(): TEventFilter{.cdecl, importc: "SDL_GetEventFilter",
proc getEventFilter*(): EventFilter{.cdecl, importc: "SDL_GetEventFilter",
dynlib: LibName.}
# This function allows you to set the state of processing certain events.
# If 'state' is set to SDL_IGNORE, that event will be automatically dropped
@@ -1691,7 +1728,7 @@ proc eventState*(theType: byte, state: int): byte{.cdecl,
#------------------------------------------------------------------------------
# This macro can be used to fill a version structure with the compile-time
# version of the SDL library.
proc version*(x: var Tversion)
proc version*(x: var Version)
# This macro turns the version numbers into a numeric value:
# (1,2,3) -> (1203)
# This assumes that there will never be more than 100 patchlevels
@@ -2230,7 +2267,7 @@ proc wmToggleFullScreen*(surface: PSurface): int{.cdecl,
# Grabbing means that the mouse is confined to the application window,
# and nearly all keyboard input is passed directly to the application,
# and not interpreted by a window manager, if any.
proc wmGrabInput*(mode: TGrabMode): TGrabMode{.cdecl,
proc wmGrabInput*(mode: TGrabMode): GrabMode{.cdecl,
importc: "SDL_WM_GrabInput", dynlib: LibName.}
#------------------------------------------------------------------------------
# mouse-routines
@@ -2305,13 +2342,13 @@ proc getKeyRepeat*(delay: PInteger, interval: PInteger){.cdecl,
proc getKeyState*(numkeys: pointer): ptr byte{.cdecl, importc: "SDL_GetKeyState",
dynlib: LibName.}
# Get the current key modifier state
proc getModState*(): TMod{.cdecl, importc: "SDL_GetModState", dynlib: LibName.}
proc getModState*(): Mod{.cdecl, importc: "SDL_GetModState", dynlib: LibName.}
# Set the current key modifier state
# This does not change the keyboard state, only the key modifier flags.
proc setModState*(modstate: TMod){.cdecl, importc: "SDL_SetModState",
proc setModState*(modstate: Mod){.cdecl, importc: "SDL_SetModState",
dynlib: LibName.}
# Get the name of an SDL virtual keysym
proc getKeyName*(key: TKey): cstring{.cdecl, importc: "SDL_GetKeyName",
proc getKeyName*(key: Key): cstring{.cdecl, importc: "SDL_GetKeyName",
dynlib: LibName.}
#------------------------------------------------------------------------------
# Active Routines
@@ -2469,7 +2506,7 @@ proc loadWAV(filename: cstring, spec: PAudioSpec, audioBuf: ptr byte,
audiolen: PUInt32): PAudioSpec =
result = loadWAV_RW(rWFromFile(filename, "rb"), 1, spec, audioBuf, audiolen)
proc cdInDrive(status: TCDStatus): bool =
proc cdInDrive(status: CDStatus): bool =
result = ord(status) > ord(CD_ERROR)
proc framesToMsf*(frames: int; m, s, f: var int) =
@@ -2483,7 +2520,7 @@ proc framesToMsf*(frames: int; m, s, f: var int) =
proc msfToFrames*(m, s, f: int): int =
result = m * 60 * CD_FPS + s * CD_FPS + f
proc version(x: var Tversion) =
proc version(x: var Version) =
x.major = MAJOR_VERSION
x.minor = MINOR_VERSION
x.patch = PATCHLEVEL

View File

@@ -37,22 +37,22 @@ const # Some rates in Hz
SMOOTHING_ON* = 1
type
PFPSmanager* = ptr TFPSmanager
TFPSmanager*{.final.} = object # ---- Structures
PFPSmanager* = ptr FPSmanager
FPSmanager*{.final.} = object # ---- Structures
framecount*: uint32
rateticks*: float32
lastticks*: uint32
rate*: uint32
PColorRGBA* = ptr TColorRGBA
TColorRGBA*{.final.} = object
PColorRGBA* = ptr ColorRGBA
ColorRGBA*{.final.} = object
r*: byte
g*: byte
b*: byte
a*: byte
PColorY* = ptr TColorY
TColorY*{.final.} = object #
PColorY* = ptr ColorY
ColorY*{.final.} = object #
#
# SDL_framerate: framerate manager
#
@@ -60,7 +60,7 @@ type
#
#
y*: byte
{.deprecated: [TFPSmanager: FPSmanager, TColorRGBA: ColorRGBA, TColorY: ColorY].}
proc initFramerate*(manager: PFPSmanager){.cdecl, importc: "SDL_initFramerate",
dynlib: gfxLibName.}

View File

@@ -148,7 +148,7 @@ const
# This macro can be used to fill a version structure with the compile-time
# version of the SDL_image library.
proc imageVersion*(x: var Tversion)
proc imageVersion*(x: var Version)
# This function gets the version of the dynamically linked SDL_image library.
# it should NOT be used to fill a version structure, instead you should
# use the SDL_IMAGE_VERSION() macro.
@@ -236,7 +236,7 @@ proc imgLoadXV_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXV_RW",
proc imgReadXPMFromArray*(xpm: cstringArray): PSurface{.cdecl,
importc: "IMG_ReadXPMFromArray", dynlib: ImageLibName.}
proc imageVersion(x: var Tversion) =
proc imageVersion(x: var Version) =
x.major = IMAGE_MAJOR_VERSION
x.minor = IMAGE_MINOR_VERSION
x.patch = IMAGE_PATCHLEVEL

View File

@@ -188,34 +188,34 @@ const
(LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
type #music_cmd.h types
PMusicCMD* = ptr TMusicCMD
TMusicCMD*{.final.} = object #wavestream.h types
PMusicCMD* = ptr MusicCMD
MusicCMD*{.final.} = object #wavestream.h types
filename*: array[0..PATH_MAX - 1, char]
cmd*: array[0..PATH_MAX - 1, char]
pid*: TSYS_ThreadHandle
PWAVStream* = ptr TWAVStream
TWAVStream*{.final.} = object #playmidi.h types
PWAVStream* = ptr WAVStream
WAVStream*{.final.} = object #playmidi.h types
wavefp*: pointer
start*: int32
stop*: int32
cvt*: TAudioCVT
PMidiEvent* = ptr TMidiEvent
TMidiEvent*{.final.} = object
PMidiEvent* = ptr MidiEvent
MidiEvent*{.final.} = object
time*: int32
channel*: byte
typ*: byte
a*: byte
b*: byte
PMidiSong* = ptr TMidiSong
TMidiSong*{.final.} = object #music_ogg.h types
PMidiSong* = ptr MidiSong
MidiSong*{.final.} = object #music_ogg.h types
samples*: int32
events*: PMidiEvent
POGG_Music* = ptr TOGG_Music
TOGG_Music*{.final.} = object # mikmod.h types
POGG_Music* = ptr OGG_Music
OGG_Music*{.final.} = object # mikmod.h types
#*
# * Error codes
# *
@@ -226,7 +226,7 @@ type #music_cmd.h types
lenAvailable*: int32
sndAvailable*: pointer
TErrorEnum* = enum
ErrorEnum* = enum
MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING,
MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE,
MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER,
@@ -246,37 +246,41 @@ type #music_cmd.h types
MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE,
MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT,
MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
PMODULE* = ptr TMODULE
TMODULE*{.final.} = object
PUNIMOD* = ptr TUNIMOD
TUNIMOD* = TMODULE #SDL_mixer.h types
PMODULE* = ptr MODULE
MODULE*{.final.} = object
PUNIMOD* = ptr UNIMOD
UNIMOD* = MODULE #SDL_mixer.h types
# The internal format for an audio chunk
PChunk* = ptr TChunk
TChunk*{.final.} = object
PChunk* = ptr Chunk
Chunk*{.final.} = object
allocated*: cint
abuf*: pointer
alen*: uint32
volume*: byte # Per-sample volume, 0-128
TFading* = enum
Fading* = enum
MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
TMusicType* = enum
MusicType* = enum
MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3
PMusic* = ptr TMusic
TMusic*{.final.} = object # The internal format for a music chunk interpreted via mikmod
mixtype*: TMusicType # other fields are not aviable
# data : TMusicUnion;
PMusic* = ptr Music
Music*{.final.} = object # The internal format for a music chunk interpreted via mikmod
mixtype*: MusicType # other fields are not aviable
# data : MusicUnion;
# fading : TMix_Fading;
# fade_volume : integer;
# fade_step : integer;
# fade_steps : integer;
# error : integer;
TMixFunction* = proc (udata, stream: pointer, length: cint): pointer{.
MixFunction* = proc (udata, stream: pointer, length: cint): pointer{.
cdecl.} # This macro can be used to fill a version structure with the compile-time
# version of the SDL_mixer library.
{.deprecated: [TMusicCMD: MusicCMD, TWAVStream: WAVStream, TMidiEvent: MidiEvent,
TMidiSong: MidiSong, TOGG_Music: OGG_Music, TErrorEnum: ErrorEnum,
TMODULE: MODULE, TUNIMOD: UNIMOD, TChunk: Chunk, TFading: Fading,
TMusicType: MusicType, TMusic: Music, TMixFunction: MixFunction].}
proc version*(x: var sdl.Tversion)
proc version*(x: var sdl.Version)
# This function gets the version of the dynamically linked SDL_mixer library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_MIXER_VERSION() macro.
@@ -314,18 +318,18 @@ proc freeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic",
dynlib: MixerLibName.}
# Find out the music format of a mixer music, or the currently playing
# music, if 'music' is NULL.
proc getMusicType*(music: PMusic): TMusicType{.cdecl,
proc getMusicType*(music: PMusic): MusicType{.cdecl,
importc: "Mix_GetMusicType", dynlib: MixerLibName.}
# Set a function that is called after all mixing is performed.
# This can be used to provide real-time visual display of the audio stream
# or add a custom mixer filter for the stream data.
#
proc setPostMix*(mixFunc: TMixFunction, arg: pointer){.cdecl,
proc setPostMix*(mixFunc: MixFunction, arg: pointer){.cdecl,
importc: "Mix_SetPostMix", dynlib: MixerLibName.}
# Add your own music player or additional mixer function.
# If 'mix_func' is NULL, the default music player is re-enabled.
#
proc hookMusic*(mixFunc: TMixFunction, arg: pointer){.cdecl,
proc hookMusic*(mixFunc: MixFunction, arg: pointer){.cdecl,
importc: "Mix_HookMusic", dynlib: MixerLibName.}
# Add your own callback when the music has finished playing.
#
@@ -337,9 +341,10 @@ proc getMusicHookData*(): pointer{.cdecl, importc: "Mix_GetMusicHookData",
#* Add your own callback when a channel has finished playing. NULL
# * to disable callback.*
type
TChannelFinished* = proc (channel: cint){.cdecl.}
ChannelFinished* = proc (channel: cint){.cdecl.}
{.deprecated: [TChannelFinished: ChannelFinished].}
proc channelFinished*(channelFinished: TChannelFinished){.cdecl,
proc channelFinished*(channelFinished: ChannelFinished){.cdecl,
importc: "Mix_ChannelFinished", dynlib: MixerLibName.}
const
CHANNEL_POST* = - 2
@@ -430,9 +435,9 @@ proc fadeOutGroup*(tag: cint, ms: cint): cint{.cdecl,
proc fadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic",
dynlib: MixerLibName.}
# Query the fading status of a channel
proc fadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic",
proc fadingMusic*(): Fading{.cdecl, importc: "Mix_FadingMusic",
dynlib: MixerLibName.}
proc fadingChannel*(which: cint): TFading{.cdecl,
proc fadingChannel*(which: cint): Fading{.cdecl,
importc: "Mix_FadingChannel", dynlib: MixerLibName.}
proc pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.}
@@ -468,7 +473,7 @@ proc getChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk",
proc closeAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.}
proc version(x: var sdl.Tversion) =
proc version(x: var sdl.Version) =
x.major = MAJOR_VERSION
x.minor = MINOR_VERSION
x.patch = PATCHLEVEL

View File

@@ -40,34 +40,34 @@ const
(LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
type #music_cmd.h types
PMusicCMD* = ptr TMusicCMD
TMusicCMD*{.final.} = object #wavestream.h types
PMusicCMD* = ptr MusicCMD
MusicCMD*{.final.} = object #wavestream.h types
filename*: array[0..PATH_MAX - 1, char]
cmd*: array[0..PATH_MAX - 1, char]
pid*: TSYS_ThreadHandle
PWAVStream* = ptr TWAVStream
TWAVStream*{.final.} = object #playmidi.h types
PWAVStream* = ptr WAVStream
WAVStream*{.final.} = object #playmidi.h types
wavefp*: pointer
start*: int32
stop*: int32
cvt*: TAudioCVT
PMidiEvent* = ptr TMidiEvent
TMidiEvent*{.final.} = object
PMidiEvent* = ptr MidiEvent
MidiEvent*{.final.} = object
time*: int32
channel*: byte
typ*: byte
a*: byte
b*: byte
PMidiSong* = ptr TMidiSong
TMidiSong*{.final.} = object #music_ogg.h types
PMidiSong* = ptr MidiSong
MidiSong*{.final.} = object #music_ogg.h types
samples*: int32
events*: PMidiEvent
POGG_Music* = ptr TOGG_Music
TOGG_Music*{.final.} = object # mikmod.h types
POGG_Music* = ptr OGG_Music
OGG_Music*{.final.} = object # mikmod.h types
#*
# * Error codes
# *
@@ -78,7 +78,7 @@ type #music_cmd.h types
lenAvailable*: cint
sndAvailable*: pointer
TErrorEnum* = enum
ErrorEnum* = enum
MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING,
MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE,
MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER,
@@ -98,31 +98,36 @@ type #music_cmd.h types
MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE,
MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT,
MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
PMODULE* = ptr TMODULE
TMODULE*{.final.} = object
PUNIMOD* = ptr TUNIMOD
TUNIMOD* = TMODULE #SDL_mixer.h types
PMODULE* = ptr MODULE
MODULE*{.final.} = object
PUNIMOD* = ptr UNIMOD
UNIMOD* = MODULE #SDL_mixer.h types
# The internal format for an audio chunk
PChunk* = ptr TChunk
TChunk*{.final.} = object
PChunk* = ptr Chunk
Chunk*{.final.} = object
allocated*: cint
abuf*: pointer
alen*: uint32
volume*: byte # Per-sample volume, 0-128
TFading* = enum
Fading* = enum
MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
TMusicType* = enum
MusicType* = enum
MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG
PMusic* = ptr TMusic
TMusic*{.final.} = object
typ*: TMusicType
PMusic* = ptr Music
Music*{.final.} = object
typ*: MusicType
TMixFunction* = proc (udata, stream: pointer, length: cint): pointer{.
MixFunction* = proc (udata, stream: pointer, length: cint): pointer{.
cdecl.} # This macro can be used to fill a version structure with the compile-time
# version of the SDL_mixer library.
{.deprecated: [TMusicCMD: MusicCMD, TWAVStream: WAVStream, TMidiEvent: MidiEvent,
TMidiSong: MidiSong, TOGG_Music: OGG_Music, TErrorEnum: ErrorEnum,
TMODULE: MODULE, TUNIMOD: UNIMOD, TChunk: Chunk, TFading: Fading,
TMusicType: MusicType, TMusic: Music, TMixFunction: MixFunction].}
proc version*(x: var sdl.Tversion)
proc version*(x: var sdl.Version)
# This function gets the version of the dynamically linked SDL_mixer library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_MIXER_VERSION() macro.
@@ -160,18 +165,18 @@ proc freeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic",
dynlib: MixerLibName.}
# Find out the music format of a mixer music, or the currently playing
# music, if 'music' is NULL.
proc getMusicType*(music: PMusic): TMusicType{.cdecl,
proc getMusicType*(music: PMusic): MusicType{.cdecl,
importc: "Mix_GetMusicType", dynlib: MixerLibName.}
# Set a function that is called after all mixing is performed.
# This can be used to provide real-time visual display of the audio stream
# or add a custom mixer filter for the stream data.
#
proc setPostMix*(mixfunc: TMixFunction, arg: pointer){.cdecl,
proc setPostMix*(mixfunc: MixFunction, arg: pointer){.cdecl,
importc: "Mix_SetPostMix", dynlib: MixerLibName.}
# Add your own music player or additional mixer function.
# If 'mix_func' is NULL, the default music player is re-enabled.
#
proc hookMusic*(mixFunc: TMixFunction, arg: pointer){.cdecl,
proc hookMusic*(mixFunc: MixFunction, arg: pointer){.cdecl,
importc: "Mix_HookMusic", dynlib: MixerLibName.}
# Add your own callback when the music has finished playing.
#
@@ -183,9 +188,10 @@ proc getMusicHookData*(): pointer{.cdecl, importc: "Mix_GetMusicHookData",
#* Add your own callback when a channel has finished playing. NULL
# * to disable callback.*
type
TChannelFinished* = proc (channel: cint){.cdecl.}
ChannelFinished* = proc (channel: cint){.cdecl.}
{.deprecated: [TChannelFinished: ChannelFinished].}
proc channelFinished*(channelFinished: TChannelFinished){.cdecl,
proc channelFinished*(channelFinished: ChannelFinished){.cdecl,
importc: "Mix_ChannelFinished", dynlib: MixerLibName.}
const
CHANNEL_POST* = - 2
@@ -286,9 +292,9 @@ proc fadeOutGroup*(tag: cint, ms: cint): cint{.cdecl,
proc fadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic",
dynlib: MixerLibName.}
# Query the fading status of a channel
proc fadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic",
proc fadingMusic*(): Fading{.cdecl, importc: "Mix_FadingMusic",
dynlib: MixerLibName.}
proc fadingChannel*(which: cint): TFading{.cdecl,
proc fadingChannel*(which: cint): Fading{.cdecl,
importc: "Mix_FadingChannel", dynlib: MixerLibName.}
# Pause/Resume a particular channel
proc pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.}
@@ -335,7 +341,7 @@ proc getChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk",
proc closeAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.}
# We'll use SDL for reporting errors
proc version(x: var Tversion) =
proc version(x: var Version) =
x.major = MAJOR_VERSION
x.minor = MINOR_VERSION
x.patch = PATCHLEVEL

View File

@@ -143,34 +143,34 @@ type # SDL_net.h types
#***********************************************************************
#* IPv4 hostname resolution API *
#***********************************************************************
PIPAddress* = ptr TIPAddress
TIPAddress*{.final.} = object #* TCP network API
PIPAddress* = ptr IPAddress
IPAddress*{.final.} = object #* TCP network API
host*: uint32 # 32-bit IPv4 host address */
port*: uint16 # 16-bit protocol port */
PTCPSocket* = ptr TTCPSocket
TTCPSocket*{.final.} = object # UDP network API
PTCPSocket* = ptr TCPSocket
TCPSocket*{.final.} = object # UDP network API
ready*: int
channel*: int
remoteAddress*: TIPAddress
localAddress*: TIPAddress
remoteAddress*: IPAddress
localAddress*: IPAddress
sflag*: int
PUDP_Channel* = ptr TUDP_Channel
TUDP_Channel*{.final.} = object
PUDP_Channel* = ptr UDP_Channel
UDP_Channel*{.final.} = object
numbound*: int
address*: array[0..MAX_UDPADDRESSES - 1, TIPAddress]
address*: array[0..MAX_UDPADDRESSES - 1, IPAddress]
PUDPSocket* = ptr TUDPSocket
TUDPSocket*{.final.} = object
PUDPSocket* = ptr UDPSocket
UDPSocket*{.final.} = object
ready*: int
channel*: int
address*: TIPAddress
binding*: array[0..MAX_UDPCHANNELS - 1, TUDP_Channel]
address*: IPAddress
binding*: array[0..MAX_UDPCHANNELS - 1, UDP_Channel]
PUDPpacket* = ptr TUDPpacket
PUDPpacket* = ptr UDPpacket
PPUDPpacket* = ptr PUDPpacket
TUDPpacket*{.final.} = object #***********************************************************************
UDPpacket*{.final.} = object #***********************************************************************
#* Hooks for checking sockets for available data *
#***********************************************************************
channel*: int #* The src/dst channel of the packet *
@@ -178,25 +178,27 @@ type # SDL_net.h types
length*: int #* The length of the packet data *
maxlen*: int #* The size of the data buffer *
status*: int #* packet status after sending *
address*: TIPAddress #* The source/dest address of an incoming/outgoing packet *
address*: IPAddress #* The source/dest address of an incoming/outgoing packet *
PSocket* = ptr TSocket
TSocket*{.final.} = object
PSocket* = ptr Socket
Socket*{.final.} = object
ready*: int
channel*: int
PSocketSet* = ptr TSocketSet
TSocketSet*{.final.} = object # Any network socket can be safely cast to this socket type *
PSocketSet* = ptr SocketSet
SocketSet*{.final.} = object # Any network socket can be safely cast to this socket type *
numsockets*: int
maxsockets*: int
sockets*: PSocket
PGenericSocket* = ptr TGenericSocket
TGenericSocket*{.final.} = object
PGenericSocket* = ptr GenericSocket
GenericSocket*{.final.} = object
ready*: int
{.deprecated: [TSocket: Socket, TSocketSet: SocketSet, TIPAddress: IpAddress,
TTCPSocket: TCPSocket, TUDP_Channel: UDP_Channel, TUDPSocket: UDPSocket,
TUDPpacket: UDPpacket, TGenericSocket: GenericSocket].}
proc version*(x: var Tversion)
proc version*(x: var Version)
#* Initialize/Cleanup the network API
# SDL must be initialized before calls to functions in this library,
# because this library uses utility functions from the SDL library.
@@ -209,14 +211,14 @@ proc quit*(){.cdecl, importc: "SDLNet_Quit", dynlib: NetLibName.}
# address will be INADDR_NONE, and the function will return -1.
# If 'host' is NULL, the resolved host will be set to INADDR_ANY.
# *
proc resolveHost*(address: var TIPAddress, host: cstring, port: uint16): int{.
proc resolveHost*(address: var IPAddress, host: cstring, port: uint16): int{.
cdecl, importc: "SDLNet_ResolveHost", dynlib: NetLibName.}
#* Resolve an ip address to a host name in canonical form.
# If the ip couldn't be resolved, this function returns NULL,
# otherwise a pointer to a static buffer containing the hostname
# is returned. Note that this function is not thread-safe.
#*
proc resolveIP*(ip: var TIPAddress): cstring{.cdecl,
proc resolveIP*(ip: var IPAddress): cstring{.cdecl,
importc: "SDLNet_ResolveIP", dynlib: NetLibName.}
#***********************************************************************
#* TCP network API *
@@ -229,7 +231,7 @@ proc resolveIP*(ip: var TIPAddress): cstring{.cdecl,
# in the correct form).
# The newly created socket is returned, or NULL if there was an error.
#*
proc tcpOpen*(ip: var TIPAddress): PTCPSocket{.cdecl,
proc tcpOpen*(ip: var IPAddress): PTCPSocket{.cdecl,
importc: "SDLNet_TCP_Open", dynlib: NetLibName.}
#* Accept an incoming connection on the given server socket.
# The newly created socket is returned, or NULL if there was an error.
@@ -295,7 +297,7 @@ proc udpOpen*(port: uint16): PUDPSocket{.cdecl, importc: "SDLNet_UDP_Open",
# address, to which all outbound packets on the channel are sent.
# This function returns the channel which was bound, or -1 on error.
#*
proc udpBind*(sock: PUDPSocket, channel: int, address: var TIPAddress): int{.
proc udpBind*(sock: PUDPSocket, channel: int, address: var IPAddress): int{.
cdecl, importc: "SDLNet_UDP_Bind", dynlib: NetLibName.}
#* Unbind all addresses from the given channel *
proc udpUnbind*(sock: PUDPSocket, channel: int){.cdecl,
@@ -405,7 +407,7 @@ proc read16*(area: pointer): uint16{.cdecl, importc: "SDLNet_Read16",
proc read32*(area: pointer): uint32{.cdecl, importc: "SDLNet_Read32",
dynlib: NetLibName.}
proc version(x: var Tversion) =
proc version(x: var Version) =
x.major = MAJOR_VERSION
x.minor = MINOR_VERSION
x.patch = PATCHLEVEL

View File

@@ -177,8 +177,9 @@ const
UNICODE_BOM_SWAPPED* = 0x0000FFFE
type
PFont* = ptr TFont
TFont = object
PFont* = ptr Font
Font = object
{.deprecated: [TFont: Font].}
# This macro can be used to fill a version structure with the compile-time
@@ -256,9 +257,9 @@ proc sizeUNICODE*(font: PFont, text: PUInt16, w: var cint, y: var cint): cint{.
# to the text color.
# This function returns the new surface, or NULL if there was an error.
#
proc renderUTF8Solid*(font: PFont, text: cstring, fg: TColor): PSurface{.
proc renderUTF8Solid*(font: PFont, text: cstring, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderUTF8_Solid", dynlib: ttfLibName.}
proc renderUNICODE_Solid*(font: PFont, text: PUInt16, fg: TColor): PSurface{.
proc renderUNICODE_Solid*(font: PFont, text: PUInt16, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderUNICODE_Solid", dynlib: ttfLibName.}
#
#Create an 8-bit palettized surface and render the given glyph at
@@ -268,21 +269,21 @@ proc renderUNICODE_Solid*(font: PFont, text: PUInt16, fg: TColor): PSurface{.
# centering in the X direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc renderGlyphSolid*(font: PFont, ch: uint16, fg: TColor): PSurface{.
proc renderGlyphSolid*(font: PFont, ch: uint16, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderGlyph_Solid", dynlib: ttfLibName.}
# Create an 8-bit palettized surface and render the given text at
# high quality with the given font and colors. The 0 pixel is background,
# while other pixels have varying degrees of the foreground color.
# This function returns the new surface, or NULL if there was an error.
#
proc renderTextShaded*(font: PFont, text: cstring, fg: TColor,
bg: TColor): PSurface{.cdecl,
proc renderTextShaded*(font: PFont, text: cstring, fg: Color,
bg: Color): PSurface{.cdecl,
importc: "TTF_RenderText_Shaded", dynlib: ttfLibName.}
proc renderUTF8Shaded*(font: PFont, text: cstring, fg: TColor,
bg: TColor): PSurface{.cdecl,
proc renderUTF8Shaded*(font: PFont, text: cstring, fg: Color,
bg: Color): PSurface{.cdecl,
importc: "TTF_RenderUTF8_Shaded", dynlib: ttfLibName.}
proc renderUNICODE_Shaded*(font: PFont, text: PUInt16, fg: TColor,
bg: TColor): PSurface{.cdecl,
proc renderUNICODE_Shaded*(font: PFont, text: PUInt16, fg: Color,
bg: Color): PSurface{.cdecl,
importc: "TTF_RenderUNICODE_Shaded", dynlib: ttfLibName.}
# Create an 8-bit palettized surface and render the given glyph at
# high quality with the given font and colors. The 0 pixel is background,
@@ -291,17 +292,17 @@ proc renderUNICODE_Shaded*(font: PFont, text: PUInt16, fg: TColor,
# direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc renderGlyphShaded*(font: PFont, ch: uint16, fg: TColor, bg: TColor): PSurface{.
proc renderGlyphShaded*(font: PFont, ch: uint16, fg: Color, bg: Color): PSurface{.
cdecl, importc: "TTF_RenderGlyph_Shaded", dynlib: ttfLibName.}
# Create a 32-bit ARGB surface and render the given text at high quality,
# using alpha blending to dither the font with the given color.
# This function returns the new surface, or NULL if there was an error.
#
proc renderTextBlended*(font: PFont, text: cstring, fg: TColor): PSurface{.
proc renderTextBlended*(font: PFont, text: cstring, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderText_Blended", dynlib: ttfLibName.}
proc renderUTF8Blended*(font: PFont, text: cstring, fg: TColor): PSurface{.
proc renderUTF8Blended*(font: PFont, text: cstring, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderUTF8_Blended", dynlib: ttfLibName.}
proc RenderUNICODE_Blended*(font: PFont, text: PUInt16, fg: TColor): PSurface{.
proc RenderUNICODE_Blended*(font: PFont, text: PUInt16, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderUNICODE_Blended", dynlib: ttfLibName.}
# Create a 32-bit ARGB surface and render the given glyph at high quality,
# using alpha blending to dither the font with the given color.
@@ -309,7 +310,7 @@ proc RenderUNICODE_Blended*(font: PFont, text: PUInt16, fg: TColor): PSurface{.
# direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc renderGlyphBlended*(font: PFont, ch: uint16, fg: TColor): PSurface{.
proc renderGlyphBlended*(font: PFont, ch: uint16, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderGlyph_Blended", dynlib: ttfLibName.}
# For compatibility with previous versions, here are the old functions
# #define TTF_RenderText(font, text, fg, bg)
@@ -327,11 +328,11 @@ proc quit*(){.cdecl, importc: "TTF_Quit", dynlib: ttfLibName.}
proc wasInit*(): cint{.cdecl, importc: "TTF_WasInit", dynlib: ttfLibName.}
proc version*(x: var sdl.Tversion) =
proc version*(x: var sdl.Version) =
x.major = MAJOR_VERSION
x.minor = MINOR_VERSION
x.patch = PATCHLEVEL
proc renderTextSolid*(font: PFont, text: cstring, fg: TColor): PSurface{.
proc renderTextSolid*(font: PFont, text: cstring, fg: Color): PSurface{.
cdecl, importc: "TTF_RenderText_Solid", dynlib: ttfLibName.}

View File

@@ -142,22 +142,23 @@ const
FILTER_INFO_PIXEL_ERROR* = 2 # Filter info from SMPEG
type
TFilterInfo*{.final.} = object
FilterInfo*{.final.} = object
yuvMbSquareError*: PUInt16
yuvPixelSquareError*: PUInt16
PFilterInfo* = ptr TFilterInfo # MPEG filter definition
PFilter* = ptr TFilter # Callback functions for the filter
TFilterCallback* = proc (dest, source: POverlay, region: PRect,
PFilterInfo* = ptr FilterInfo # MPEG filter definition
PFilter* = ptr Filter # Callback functions for the filter
FilterCallback* = proc (dest, source: POverlay, region: PRect,
filterInfo: PFilterInfo, data: pointer): pointer{.
cdecl.}
TFilterDestroy* = proc (filter: PFilter): pointer{.cdecl.} # The filter definition itself
TFilter*{.final.} = object # The null filter (default). It simply copies the source rectangle to the video overlay.
FilterDestroy* = proc (filter: PFilter): pointer{.cdecl.} # The filter definition itself
Filter*{.final.} = object # The null filter (default). It simply copies the source rectangle to the video overlay.
flags*: uint32
data*: pointer
callback*: TFilterCallback
destroy*: TFilterDestroy
callback*: FilterCallback
destroy*: FilterDestroy
{.deprecated: [TFilterInfo: FilterInfo, TFilterCallback: FilterCallback,
TFilterDestroy: FilterDestroy, TFilter: Filter].}
proc filterNull*(): PFilter{.cdecl, importc: "SMPEGfilter_null",
dynlib: SmpegLibName.}
@@ -184,7 +185,7 @@ type
Pversion* = ptr TVersion # This is the actual SMPEG object
TSMPEG* = object
PSMPEG* = ptr TSMPEG # Used to get information about the SMPEG object
TInfo* = object
Info* = object
hasAudio*: int32
hasVideo*: int32
width*: int32
@@ -198,7 +199,8 @@ type
currentTime*: float64
totalTime*: float64
PInfo* = ptr TInfo # Possible MPEG status codes
PInfo* = ptr Info # Possible MPEG status codes
{.deprecated: [TInfo: Info].}
const
STATUS_ERROR* = - 1
@@ -206,7 +208,7 @@ const
STATUS_PLAYING* = 1
type
Tstatus* = int32
Status* = int32
Pstatus* = ptr int32 # Matches the declaration of SDL_UpdateRect()
TDisplayCallback* = proc (dst: PSurface, x, y: int, w, h: int): pointer{.
cdecl.} # Create a new SMPEG object from an MPEG file.
@@ -217,6 +219,7 @@ type
# The sdl_audio parameter indicates if SMPEG should initialize the SDL audio
# subsystem. If not, you will have to use the playaudio() function below
# to extract the decoded data.
{.deprecated: [Tstatus: Status].}
proc new*(theFile: cstring, info: PInfo, audio: int): PSMPEG{.cdecl,
importc: "SMPEG_new", dynlib: SmpegLibName.}
@@ -243,7 +246,7 @@ proc enablevideo*(mpeg: PSMPEG, enable: int){.cdecl,
proc delete*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_delete",
dynlib: SmpegLibName.}
# Get the current status of an SMPEG object
proc status*(mpeg: PSMPEG): Tstatus{.cdecl, importc: "SMPEG_status",
proc status*(mpeg: PSMPEG): Status{.cdecl, importc: "SMPEG_status",
dynlib: SmpegLibName.}
# status
# Set the audio volume of an MPEG stream, in the range 0-100

View File

@@ -96,18 +96,18 @@ const
SPH_GROUPBY_ATTRPAIR* = 5
type
TSphinxBool* {.size: sizeof(cint).} = enum
SphinxBool* {.size: sizeof(cint).} = enum
SPH_FALSE = 0,
SPH_TRUE = 1
Tclient {.pure, final.} = object
PClient* = ptr TClient
Twordinfo*{.pure, final.} = object
Client {.pure, final.} = object
PClient* = ptr Client
Wordinfo*{.pure, final.} = object
word*: cstring
docs*: cint
hits*: cint
Tresult*{.pure, final.} = object
Result*{.pure, final.} = object
error*: cstring
warning*: cstring
status*: cint
@@ -122,9 +122,9 @@ type
total_found*: cint
time_msec*: cint
num_words*: cint
words*: ptr array [0..100_000, TWordinfo]
words*: ptr array [0..100_000, Wordinfo]
Texcerpt_options*{.pure, final.} = object
Excerpt_options*{.pure, final.} = object
before_match*: cstring
after_match*: cstring
chunk_separator*: cstring
@@ -135,24 +135,26 @@ type
limit_words*: cint
around*: cint
start_passage_id*: cint
exact_phrase*: TSphinxBool
single_passage*: TSphinxBool
use_boundaries*: TSphinxBool
weight_order*: TSphinxBool
query_mode*: TSphinxBool
force_all_words*: TSphinxBool
load_files*: TSphinxBool
allow_empty*: TSphinxBool
emit_zones*: TSphinxBool
exact_phrase*: SphinxBool
single_passage*: SphinxBool
use_boundaries*: SphinxBool
weight_order*: SphinxBool
query_mode*: SphinxBool
force_all_words*: SphinxBool
load_files*: SphinxBool
allow_empty*: SphinxBool
emit_zones*: SphinxBool
Tkeyword_info*{.pure, final.} = object
Keyword_info*{.pure, final.} = object
tokenized*: cstring
normalized*: cstring
num_docs*: cint
num_hits*: cint
{.deprecated: [TSphinxBool: SphinxBool,
Tclient: Client, Twordinfo: Wordinfo, Tresult: Result,
Texcerpt_options: Excerpt_options, Tkeyword_info: Keyword_info].}
proc create*(copy_args: TSphinxBool): PClient{.cdecl, importc: "sphinx_create",
proc create*(copy_args: SphinxBool): PClient{.cdecl, importc: "sphinx_create",
dynlib: sphinxDll.}
proc cleanup*(client: PClient){.cdecl, importc: "sphinx_cleanup",
dynlib: sphinxDll.}
@@ -162,87 +164,87 @@ proc error*(client: PClient): cstring{.cdecl, importc: "sphinx_error",
dynlib: sphinxDll.}
proc warning*(client: PClient): cstring{.cdecl, importc: "sphinx_warning",
dynlib: sphinxDll.}
proc set_server*(client: PClient, host: cstring, port: cint): TSphinxBool{.cdecl,
proc set_server*(client: PClient, host: cstring, port: cint): SphinxBool{.cdecl,
importc: "sphinx_set_server", dynlib: sphinxDll.}
proc set_connect_timeout*(client: PClient, seconds: float32): TSphinxBool{.cdecl,
proc set_connect_timeout*(client: PClient, seconds: float32): SphinxBool{.cdecl,
importc: "sphinx_set_connect_timeout", dynlib: sphinxDll.}
proc open*(client: PClient): TSphinxBool{.cdecl, importc: "sphinx_open",
proc open*(client: PClient): SphinxBool{.cdecl, importc: "sphinx_open",
dynlib: sphinxDll.}
proc close*(client: PClient): TSphinxBool{.cdecl, importc: "sphinx_close",
proc close*(client: PClient): SphinxBool{.cdecl, importc: "sphinx_close",
dynlib: sphinxDll.}
proc set_limits*(client: PClient, offset: cint, limit: cint,
max_matches: cint, cutoff: cint): TSphinxBool{.cdecl,
max_matches: cint, cutoff: cint): SphinxBool{.cdecl,
importc: "sphinx_set_limits", dynlib: sphinxDll.}
proc set_max_query_time*(client: PClient, max_query_time: cint): TSphinxBool{.
proc set_max_query_time*(client: PClient, max_query_time: cint): SphinxBool{.
cdecl, importc: "sphinx_set_max_query_time", dynlib: sphinxDll.}
proc set_match_mode*(client: PClient, mode: cint): TSphinxBool{.cdecl,
proc set_match_mode*(client: PClient, mode: cint): SphinxBool{.cdecl,
importc: "sphinx_set_match_mode", dynlib: sphinxDll.}
proc set_ranking_mode*(client: PClient, ranker: cint): TSphinxBool{.cdecl,
proc set_ranking_mode*(client: PClient, ranker: cint): SphinxBool{.cdecl,
importc: "sphinx_set_ranking_mode", dynlib: sphinxDll.}
proc set_sort_mode*(client: PClient, mode: cint, sortby: cstring): TSphinxBool{.
proc set_sort_mode*(client: PClient, mode: cint, sortby: cstring): SphinxBool{.
cdecl, importc: "sphinx_set_sort_mode", dynlib: sphinxDll.}
proc set_field_weights*(client: PClient, num_weights: cint,
field_names: cstringArray, field_weights: ptr cint): TSphinxBool{.
field_names: cstringArray, field_weights: ptr cint): SphinxBool{.
cdecl, importc: "sphinx_set_field_weights", dynlib: sphinxDll.}
proc set_index_weights*(client: PClient, num_weights: cint,
index_names: cstringArray, index_weights: ptr cint): TSphinxBool{.
index_names: cstringArray, index_weights: ptr cint): SphinxBool{.
cdecl, importc: "sphinx_set_index_weights", dynlib: sphinxDll.}
proc set_id_range*(client: PClient, minid: int64, maxid: int64): TSphinxBool{.
proc set_id_range*(client: PClient, minid: int64, maxid: int64): SphinxBool{.
cdecl, importc: "sphinx_set_id_range", dynlib: sphinxDll.}
proc add_filter*(client: PClient, attr: cstring, num_values: cint,
values: ptr int64, exclude: TSphinxBool): TSphinxBool{.cdecl,
values: ptr int64, exclude: SphinxBool): SphinxBool{.cdecl,
importc: "sphinx_add_filter", dynlib: sphinxDll.}
proc add_filter_range*(client: PClient, attr: cstring, umin: int64,
umax: int64, exclude: TSphinxBool): TSphinxBool{.cdecl,
umax: int64, exclude: SphinxBool): SphinxBool{.cdecl,
importc: "sphinx_add_filter_range", dynlib: sphinxDll.}
proc add_filter_float_range*(client: PClient, attr: cstring, fmin: float32,
fmax: float32, exclude: TSphinxBool): TSphinxBool{.cdecl,
fmax: float32, exclude: SphinxBool): SphinxBool{.cdecl,
importc: "sphinx_add_filter_float_range", dynlib: sphinxDll.}
proc set_geoanchor*(client: PClient, attr_latitude: cstring,
attr_longitude: cstring, latitude: float32, longitude: float32): TSphinxBool{.
attr_longitude: cstring, latitude: float32, longitude: float32): SphinxBool{.
cdecl, importc: "sphinx_set_geoanchor", dynlib: sphinxDll.}
proc set_groupby*(client: PClient, attr: cstring, groupby_func: cint,
group_sort: cstring): TSphinxBool{.cdecl,
group_sort: cstring): SphinxBool{.cdecl,
importc: "sphinx_set_groupby", dynlib: sphinxDll.}
proc set_groupby_distinct*(client: PClient, attr: cstring): TSphinxBool{.cdecl,
proc set_groupby_distinct*(client: PClient, attr: cstring): SphinxBool{.cdecl,
importc: "sphinx_set_groupby_distinct", dynlib: sphinxDll.}
proc set_retries*(client: PClient, count: cint, delay: cint): TSphinxBool{.cdecl,
proc set_retries*(client: PClient, count: cint, delay: cint): SphinxBool{.cdecl,
importc: "sphinx_set_retries", dynlib: sphinxDll.}
proc add_override*(client: PClient, attr: cstring, docids: ptr int64,
num_values: cint, values: ptr cint): TSphinxBool{.cdecl,
num_values: cint, values: ptr cint): SphinxBool{.cdecl,
importc: "sphinx_add_override", dynlib: sphinxDll.}
proc set_select*(client: PClient, select_list: cstring): TSphinxBool{.cdecl,
proc set_select*(client: PClient, select_list: cstring): SphinxBool{.cdecl,
importc: "sphinx_set_select", dynlib: sphinxDll.}
proc reset_filters*(client: PClient){.cdecl,
importc: "sphinx_reset_filters", dynlib: sphinxDll.}
proc reset_groupby*(client: PClient){.cdecl,
importc: "sphinx_reset_groupby", dynlib: sphinxDll.}
proc query*(client: PClient, query: cstring, index_list: cstring,
comment: cstring): ptr Tresult{.cdecl, importc: "sphinx_query",
comment: cstring): ptr Result{.cdecl, importc: "sphinx_query",
dynlib: sphinxDll.}
proc add_query*(client: PClient, query: cstring, index_list: cstring,
comment: cstring): cint{.cdecl, importc: "sphinx_add_query",
dynlib: sphinxDll.}
proc run_queries*(client: PClient): ptr Tresult{.cdecl,
proc run_queries*(client: PClient): ptr Result{.cdecl,
importc: "sphinx_run_queries", dynlib: sphinxDll.}
proc get_num_results*(client: PClient): cint{.cdecl,
importc: "sphinx_get_num_results", dynlib: sphinxDll.}
proc get_id*(result: ptr Tresult, match: cint): int64{.cdecl,
proc get_id*(result: ptr Result, match: cint): int64{.cdecl,
importc: "sphinx_get_id", dynlib: sphinxDll.}
proc get_weight*(result: ptr Tresult, match: cint): cint{.cdecl,
proc get_weight*(result: ptr Result, match: cint): cint{.cdecl,
importc: "sphinx_get_weight", dynlib: sphinxDll.}
proc get_int*(result: ptr Tresult, match: cint, attr: cint): int64{.cdecl,
proc get_int*(result: ptr Result, match: cint, attr: cint): int64{.cdecl,
importc: "sphinx_get_int", dynlib: sphinxDll.}
proc get_float*(result: ptr Tresult, match: cint, attr: cint): float32{.cdecl,
proc get_float*(result: ptr Result, match: cint, attr: cint): float32{.cdecl,
importc: "sphinx_get_float", dynlib: sphinxDll.}
proc get_mva*(result: ptr Tresult, match: cint, attr: cint): ptr cint{.
proc get_mva*(result: ptr Result, match: cint, attr: cint): ptr cint{.
cdecl, importc: "sphinx_get_mva", dynlib: sphinxDll.}
proc get_string*(result: ptr Tresult, match: cint, attr: cint): cstring{.cdecl,
proc get_string*(result: ptr Result, match: cint, attr: cint): cstring{.cdecl,
importc: "sphinx_get_string", dynlib: sphinxDll.}
proc init_excerpt_options*(opts: ptr Texcerpt_options){.cdecl,
proc init_excerpt_options*(opts: ptr Excerpt_options){.cdecl,
importc: "sphinx_init_excerpt_options", dynlib: sphinxDll.}
proc build_excerpts*(client: PClient, num_docs: cint, docs: cstringArray,
index: cstring, words: cstring, opts: ptr Texcerpt_options): cstringArray{.
index: cstring, words: cstring, opts: ptr Excerpt_options): cstringArray{.
cdecl, importc: "sphinx_build_excerpts", dynlib: sphinxDll.}
proc update_attributes*(client: PClient, index: cstring, num_attrs: cint,
attrs: cstringArray, num_docs: cint,
@@ -253,7 +255,7 @@ proc update_attributes_mva*(client: PClient, index: cstring, attr: cstring,
values: ptr cint): cint{.cdecl,
importc: "sphinx_update_attributes_mva", dynlib: sphinxDll.}
proc build_keywords*(client: PClient, query: cstring, index: cstring,
hits: TSphinxBool, out_num_keywords: ptr cint): ptr Tkeyword_info{.
hits: SphinxBool, out_num_keywords: ptr cint): ptr Keyword_info{.
cdecl, importc: "sphinx_build_keywords", dynlib: sphinxDll.}
proc status*(client: PClient, num_rows: ptr cint, num_cols: ptr cint): cstringArray{.
cdecl, importc: "sphinx_status", dynlib: sphinxDll.}

View File

@@ -97,33 +97,39 @@ const
SQLITE_TRANSIENT* = cast[pointer](- 1)
type
TSqlite3 {.pure, final.} = object
PSqlite3* = ptr TSqlite3
Sqlite3 {.pure, final.} = object
PSqlite3* = ptr Sqlite3
PPSqlite3* = ptr PSqlite3
TContext{.pure, final.} = object
Pcontext* = ptr TContext
Context{.pure, final.} = object
Pcontext* = ptr Context
Tstmt{.pure, final.} = object
Pstmt* = ptr Tstmt
Tvalue{.pure, final.} = object
Pvalue* = ptr Tvalue
Value{.pure, final.} = object
Pvalue* = ptr Value
PValueArg* = array[0..127, Pvalue]
Tcallback* = proc (para1: pointer, para2: int32, para3,
Callback* = proc (para1: pointer, para2: int32, para3,
para4: cstringArray): int32{.cdecl.}
Tbind_destructor_func* = proc (para1: pointer){.cdecl.}
Tcreate_function_step_func* = proc (para1: Pcontext, para2: int32,
Create_function_step_func* = proc (para1: Pcontext, para2: int32,
para3: PValueArg){.cdecl.}
Tcreate_function_func_func* = proc (para1: Pcontext, para2: int32,
Create_function_func_func* = proc (para1: Pcontext, para2: int32,
para3: PValueArg){.cdecl.}
Tcreate_function_final_func* = proc (para1: Pcontext){.cdecl.}
Tresult_func* = proc (para1: pointer){.cdecl.}
Tcreate_collation_func* = proc (para1: pointer, para2: int32, para3: pointer,
Create_function_final_func* = proc (para1: Pcontext){.cdecl.}
Result_func* = proc (para1: pointer){.cdecl.}
Create_collation_func* = proc (para1: pointer, para2: int32, para3: pointer,
para4: int32, para5: pointer): int32{.cdecl.}
Tcollation_needed_func* = proc (para1: pointer, para2: PSqlite3, eTextRep: int32,
Collation_needed_func* = proc (para1: pointer, para2: PSqlite3, eTextRep: int32,
para4: cstring){.cdecl.}
{.deprecated: [TSqlite3: Sqlite3, TContext: Context, Tvalue: Value,
Tcallback: Callback, Tcreate_function_step_func: Create_function_step_func,
Tcreate_function_func_func: Create_function_func_func,
Tcreate_function_final_func: Create_function_final_func,
Tresult_func: Result_func, Tcreate_collation_func: Create_collation_func,
Tcollation_needed_func: Collation_needed_func].}
proc close*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_close".}
proc exec*(para1: PSqlite3, sql: cstring, para3: Tcallback, para4: pointer,
proc exec*(para1: PSqlite3, sql: cstring, para3: Callback, para4: pointer,
errmsg: var cstring): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_exec".}
proc last_insert_rowid*(para1: PSqlite3): int64{.cdecl, dynlib: Lib,
@@ -261,15 +267,15 @@ proc finalize*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
proc reset*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_reset".}
proc create_function*(para1: PSqlite3, zFunctionName: cstring, nArg: int32,
eTextRep: int32, para5: pointer,
xFunc: Tcreate_function_func_func,
xStep: Tcreate_function_step_func,
xFinal: Tcreate_function_final_func): int32{.cdecl,
xFunc: Create_function_func_func,
xStep: Create_function_step_func,
xFinal: Create_function_final_func): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_create_function".}
proc create_function16*(para1: PSqlite3, zFunctionName: pointer, nArg: int32,
eTextRep: int32, para5: pointer,
xFunc: Tcreate_function_func_func,
xStep: Tcreate_function_step_func,
xFinal: Tcreate_function_final_func): int32{.cdecl,
xFunc: Create_function_func_func,
xStep: Create_function_step_func,
xFinal: Create_function_final_func): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_create_function16".}
proc aggregate_count*(para1: Pcontext): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_aggregate_count".}
@@ -305,7 +311,7 @@ proc set_auxdata*(para1: Pcontext, para2: int32, para3: pointer,
para4: proc (para1: pointer){.cdecl.}){.cdecl, dynlib: Lib,
importc: "sqlite3_set_auxdata".}
proc result_blob*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
para4: Result_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_blob".}
proc result_double*(para1: Pcontext, para2: float64){.cdecl, dynlib: Lib,
importc: "sqlite3_result_double".}
@@ -320,28 +326,28 @@ proc result_int64*(para1: Pcontext, para2: int64){.cdecl, dynlib: Lib,
proc result_null*(para1: Pcontext){.cdecl, dynlib: Lib,
importc: "sqlite3_result_null".}
proc result_text*(para1: Pcontext, para2: cstring, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
para4: Result_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text".}
proc result_text16*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
para4: Result_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16".}
proc result_text16le*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
para4: Result_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16le".}
proc result_text16be*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
para4: Result_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16be".}
proc result_value*(para1: Pcontext, para2: Pvalue){.cdecl, dynlib: Lib,
importc: "sqlite3_result_value".}
proc create_collation*(para1: PSqlite3, zName: cstring, eTextRep: int32,
para4: pointer, xCompare: Tcreate_collation_func): int32{.
para4: pointer, xCompare: Create_collation_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_create_collation".}
proc create_collation16*(para1: PSqlite3, zName: cstring, eTextRep: int32,
para4: pointer, xCompare: Tcreate_collation_func): int32{.
para4: pointer, xCompare: Create_collation_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_create_collation16".}
proc collation_needed*(para1: PSqlite3, para2: pointer, para3: Tcollation_needed_func): int32{.
proc collation_needed*(para1: PSqlite3, para2: pointer, para3: Collation_needed_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_collation_needed".}
proc collation_needed16*(para1: PSqlite3, para2: pointer, para3: Tcollation_needed_func): int32{.
proc collation_needed16*(para1: PSqlite3, para2: pointer, para3: Collation_needed_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_collation_needed16".}
proc libversion*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
#Alias for allowing better code portability (win32 is not working with external variables)

View File

@@ -8,10 +8,11 @@
#
type
TccState {.pure, final.} = object
PccState* = ptr TccState
CcState {.pure, final.} = object
PccState* = ptr CcState
TErrorFunc* = proc (opaque: pointer, msg: cstring) {.cdecl.}
ErrorFunc* = proc (opaque: pointer, msg: cstring) {.cdecl.}
{.deprecated: [TccState: CcState, TErrorFunc: ErrorFunc].}
proc openCCState*(): PccState {.importc: "tcc_new", cdecl.}
## create a new TCC compilation context
@@ -22,7 +23,7 @@ proc closeCCState*(s: PccState) {.importc: "tcc_delete", cdecl.}
proc enableDebug*(s: PccState) {.importc: "tcc_enable_debug", cdecl.}
## add debug information in the generated code
proc setErrorFunc*(s: PccState, errorOpaque: pointer, errorFun: TErrorFunc) {.
proc setErrorFunc*(s: PccState, errorOpaque: pointer, errorFun: ErrorFunc) {.
cdecl, importc: "tcc_set_error_func".}
## set error/warning display callback

View File

@@ -27,16 +27,16 @@ const
# structs and enums ourselves.
type
TRegoff* = cint
TRegex*{.pure, final.} = object
Regoff* = cint
Regex*{.pure, final.} = object
re_nsub*: int ## Number of parenthesized subexpressions.
value*: pointer ## For internal use only.
TRegmatch*{.pure, final.} = object
rm_so*: TRegoff
rm_eo*: TRegoff
Regmatch*{.pure, final.} = object
rm_so*: Regoff
rm_eo*: Regoff
TReg_errcode*{.size: 4.} = enum ## POSIX tre_regcomp() return error codes.
Reg_errcode*{.size: 4.} = enum ## POSIX tre_regcomp() return error codes.
## (In the order listed in the standard.)
REG_OK = 0, ## No error.
REG_NOMATCH, ## No match.
@@ -52,6 +52,8 @@ type
REG_ERANGE, ## Invalid use of range operator
REG_ESPACE, ## Out of memory.
REG_BADRPT ## Invalid use of repetition operators.
{.deprecated: [TRegoff: Regoff, TRegex: Regex, TRegmatch: Regmatch,
TReg_errcode: Reg_errcode].}
# POSIX tre_regcomp() flags.
@@ -88,22 +90,22 @@ const
# The POSIX.2 regexp functions
proc regcomp*(preg: var TRegex, regex: cstring, cflags: cint): cint{.cdecl,
proc regcomp*(preg: var Regex, regex: cstring, cflags: cint): cint{.cdecl,
importc: "tre_regcomp", dynlib: treDll.}
proc regexec*(preg: var TRegex, string: cstring, nmatch: int,
pmatch: ptr TRegmatch, eflags: cint): cint{.cdecl,
proc regexec*(preg: var Regex, string: cstring, nmatch: int,
pmatch: ptr Regmatch, eflags: cint): cint{.cdecl,
importc: "tre_regexec", dynlib: treDll.}
proc regerror*(errcode: cint, preg: var TRegex, errbuf: cstring,
proc regerror*(errcode: cint, preg: var Regex, errbuf: cstring,
errbuf_size: int): int{.cdecl, importc: "tre_regerror",
dynlib: treDll.}
proc regfree*(preg: var TRegex){.cdecl, importc: "tre_regfree", dynlib: treDll.}
proc regfree*(preg: var Regex){.cdecl, importc: "tre_regfree", dynlib: treDll.}
# Versions with a maximum length argument and therefore the capability to
# handle null characters in the middle of the strings (not in POSIX.2).
proc regncomp*(preg: var TRegex, regex: cstring, len: int, cflags: cint): cint{.
proc regncomp*(preg: var Regex, regex: cstring, len: int, cflags: cint): cint{.
cdecl, importc: "tre_regncomp", dynlib: treDll.}
proc regnexec*(preg: var TRegex, string: cstring, len: int, nmatch: int,
pmatch: ptr TRegmatch, eflags: cint): cint{.cdecl,
proc regnexec*(preg: var Regex, string: cstring, len: int, nmatch: int,
pmatch: ptr Regmatch, eflags: cint): cint{.cdecl,
importc: "tre_regnexec", dynlib: treDll.}
# Approximate matching parameter struct.
@@ -124,7 +126,7 @@ type
type
TRegamatch*{.pure, final.} = object
nmatch*: int ## Length of pmatch[] array.
pmatch*: ptr TRegmatch ## Submatch data.
pmatch*: ptr Regmatch ## Submatch data.
cost*: cint ## Cost of the match.
num_ins*: cint ## Number of inserts in the match.
num_del*: cint ## Number of deletes in the match.
@@ -133,10 +135,10 @@ type
# Approximate matching functions.
proc regaexec*(preg: var TRegex, string: cstring, match: ptr TRegamatch,
proc regaexec*(preg: var Regex, string: cstring, match: ptr TRegamatch,
params: TRegaparams, eflags: cint): cint{.cdecl,
importc: "tre_regaexec", dynlib: treDll.}
proc reganexec*(preg: var TRegex, string: cstring, len: int,
proc reganexec*(preg: var Regex, string: cstring, len: int,
match: ptr TRegamatch, params: TRegaparams,
eflags: cint): cint{.
cdecl, importc: "tre_reganexec", dynlib: treDll.}
@@ -155,8 +157,8 @@ type
context*: pointer
proc reguexec*(preg: var TRegex, string: ptr TStrSource, nmatch: int,
pmatch: ptr TRegmatch, eflags: cint): cint{.cdecl,
proc reguexec*(preg: var Regex, string: ptr TStrSource, nmatch: int,
pmatch: ptr Regmatch, eflags: cint): cint{.cdecl,
importc: "tre_reguexec", dynlib: treDll.}
proc runtimeVersion*(): cstring{.cdecl, importc: "tre_version", dynlib: treDll.}
@@ -177,10 +179,10 @@ const
# Returns 1 if the compiled pattern has back references, 0 if not.
proc have_backrefs*(preg: var TRegex): cint{.cdecl,
proc have_backrefs*(preg: var Regex): cint{.cdecl,
importc: "tre_have_backrefs", dynlib: treDll.}
# Returns 1 if the compiled pattern uses approximate matching features,
# 0 if not.
proc have_approx*(preg: var TRegex): cint{.cdecl, importc: "tre_have_approx",
proc have_approx*(preg: var Regex): cint{.cdecl, importc: "tre_have_approx",
dynlib: treDll.}

View File

@@ -59,12 +59,12 @@ else:
{.pragma: mydll.}
type
TZipSourceCmd* = int32
ZipSourceCmd* = int32
TZipSourceCallback* = proc (state: pointer, data: pointer, length: int,
cmd: TZipSourceCmd): int {.cdecl.}
PZipStat* = ptr TZipStat
TZipStat* = object ## the 'zip_stat' struct
ZipSourceCallback* = proc (state: pointer, data: pointer, length: int,
cmd: ZipSourceCmd): int {.cdecl.}
PZipStat* = ptr ZipStat
ZipStat* = object ## the 'zip_stat' struct
name*: cstring ## name of the file
index*: int32 ## index within archive
crc*: int32 ## crc of file data
@@ -74,14 +74,16 @@ type
compMethod*: int16 ## compression method used
encryptionMethod*: int16 ## encryption method used
TZip = object
TZipSource = object
TZipFile = object
PZip* = ptr TZip ## represents a zip archive
PZipFile* = ptr TZipFile ## represents a file within an archive
PZipSource* = ptr TZipSource ## represents a source for an archive
Zip = object
ZipSource = object
ZipFile = object
PZip* = ptr Zip ## represents a zip archive
PZipFile* = ptr ZipFile ## represents a file within an archive
PZipSource* = ptr ZipSource ## represents a source for an archive
{.deprecated: [TZipSourceCmd: ZipSourceCmd, TZipStat: ZipStat, TZip: Zip,
TZipSourceCallback: ZipSourceCallback, TZipSource: ZipSource,
TZipFile: ZipFile].}
# flags for zip_name_locate, zip_fopen, zip_stat, ...
const
@@ -229,7 +231,7 @@ proc zip_source_filep*(para1: PZip, para2: File, para3: int, para4: int): PZipSo
cdecl, mydll, importc: "zip_source_filep".}
proc zip_source_free*(para1: PZipSource) {.cdecl, mydll,
importc: "zip_source_free".}
proc zip_source_function*(para1: PZip, para2: TZipSourceCallback,
proc zip_source_function*(para1: PZip, para2: ZipSourceCallback,
para3: pointer): PZipSource {.cdecl, mydll,
importc: "zip_source_function".}
proc zip_source_zip*(para1: PZip, para2: PZip, para3: int32, para4: int32,

View File

@@ -17,11 +17,11 @@ type
ZOffT* = int32
Pbyte* = cstring
Pbytef* = cstring
TAllocfunc* = proc (p: pointer, items: Uint, size: Uint): pointer{.cdecl.}
TFreeFunc* = proc (p: pointer, address: pointer){.cdecl.}
TInternalState*{.final, pure.} = object
PInternalState* = ptr TInternalState
TZStream*{.final, pure.} = object
Allocfunc* = proc (p: pointer, items: Uint, size: Uint): pointer{.cdecl.}
FreeFunc* = proc (p: pointer, address: pointer){.cdecl.}
InternalState*{.final, pure.} = object
PInternalState* = ptr InternalState
ZStream*{.final, pure.} = object
nextIn*: Pbytef
availIn*: Uint
totalIn*: Ulong
@@ -30,16 +30,18 @@ type
totalOut*: Ulong
msg*: Pbytef
state*: PInternalState
zalloc*: TAllocfunc
zfree*: TFreeFunc
zalloc*: Allocfunc
zfree*: FreeFunc
opaque*: pointer
dataType*: int32
adler*: Ulong
reserved*: Ulong
TZStreamRec* = TZStream
PZstream* = ptr TZStream
ZStreamRec* = ZStream
PZstream* = ptr ZStream
GzFile* = pointer
{.deprecated: [TInternalState: InternalState, TAllocfunc: Allocfunc,
TFreeFunc: FreeFunc, TZStream: ZStream, TZStreamRec: ZStreamRec].}
const
Z_NO_FLUSH* = 0
@@ -70,29 +72,29 @@ const
Z_NULL* = 0
proc zlibVersion*(): cstring{.cdecl, dynlib: libz, importc: "zlibVersion".}
proc deflate*(strm: var TZStream, flush: int32): int32{.cdecl, dynlib: libz,
proc deflate*(strm: var ZStream, flush: int32): int32{.cdecl, dynlib: libz,
importc: "deflate".}
proc deflateEnd*(strm: var TZStream): int32{.cdecl, dynlib: libz,
proc deflateEnd*(strm: var ZStream): int32{.cdecl, dynlib: libz,
importc: "deflateEnd".}
proc inflate*(strm: var TZStream, flush: int32): int32{.cdecl, dynlib: libz,
proc inflate*(strm: var ZStream, flush: int32): int32{.cdecl, dynlib: libz,
importc: "inflate".}
proc inflateEnd*(strm: var TZStream): int32{.cdecl, dynlib: libz,
proc inflateEnd*(strm: var ZStream): int32{.cdecl, dynlib: libz,
importc: "inflateEnd".}
proc deflateSetDictionary*(strm: var TZStream, dictionary: Pbytef,
proc deflateSetDictionary*(strm: var ZStream, dictionary: Pbytef,
dictLength: Uint): int32{.cdecl, dynlib: libz,
importc: "deflateSetDictionary".}
proc deflateCopy*(dest, source: var TZStream): int32{.cdecl, dynlib: libz,
proc deflateCopy*(dest, source: var ZStream): int32{.cdecl, dynlib: libz,
importc: "deflateCopy".}
proc deflateReset*(strm: var TZStream): int32{.cdecl, dynlib: libz,
proc deflateReset*(strm: var ZStream): int32{.cdecl, dynlib: libz,
importc: "deflateReset".}
proc deflateParams*(strm: var TZStream, level: int32, strategy: int32): int32{.
proc deflateParams*(strm: var ZStream, level: int32, strategy: int32): int32{.
cdecl, dynlib: libz, importc: "deflateParams".}
proc inflateSetDictionary*(strm: var TZStream, dictionary: Pbytef,
proc inflateSetDictionary*(strm: var ZStream, dictionary: Pbytef,
dictLength: Uint): int32{.cdecl, dynlib: libz,
importc: "inflateSetDictionary".}
proc inflateSync*(strm: var TZStream): int32{.cdecl, dynlib: libz,
proc inflateSync*(strm: var ZStream): int32{.cdecl, dynlib: libz,
importc: "inflateSync".}
proc inflateReset*(strm: var TZStream): int32{.cdecl, dynlib: libz,
proc inflateReset*(strm: var ZStream): int32{.cdecl, dynlib: libz,
importc: "inflateReset".}
proc compress*(dest: Pbytef, destLen: Pulongf, source: Pbytef, sourceLen: Ulong): cint{.
cdecl, dynlib: libz, importc: "compress".}
@@ -137,45 +139,45 @@ proc adler32*(adler: Ulong, buf: Pbytef, length: Uint): Ulong{.cdecl,
## **Warning**: Adler-32 requires at least a few hundred bytes to get rolling.
proc crc32*(crc: Ulong, buf: Pbytef, length: Uint): Ulong{.cdecl, dynlib: libz,
importc: "crc32".}
proc deflateInitu*(strm: var TZStream, level: int32, version: cstring,
proc deflateInitu*(strm: var ZStream, level: int32, version: cstring,
streamSize: int32): int32{.cdecl, dynlib: libz,
importc: "deflateInit_".}
proc inflateInitu*(strm: var TZStream, version: cstring,
proc inflateInitu*(strm: var ZStream, version: cstring,
streamSize: int32): int32 {.
cdecl, dynlib: libz, importc: "inflateInit_".}
proc deflateInit*(strm: var TZStream, level: int32): int32
proc inflateInit*(strm: var TZStream): int32
proc deflateInit2u*(strm: var TZStream, level: int32, `method`: int32,
proc deflateInit*(strm: var ZStream, level: int32): int32
proc inflateInit*(strm: var ZStream): int32
proc deflateInit2u*(strm: var ZStream, level: int32, `method`: int32,
windowBits: int32, memLevel: int32, strategy: int32,
version: cstring, streamSize: int32): int32 {.cdecl,
dynlib: libz, importc: "deflateInit2_".}
proc inflateInit2u*(strm: var TZStream, windowBits: int32, version: cstring,
proc inflateInit2u*(strm: var ZStream, windowBits: int32, version: cstring,
streamSize: int32): int32{.cdecl, dynlib: libz,
importc: "inflateInit2_".}
proc deflateInit2*(strm: var TZStream,
proc deflateInit2*(strm: var ZStream,
level, `method`, windowBits, memLevel,
strategy: int32): int32
proc inflateInit2*(strm: var TZStream, windowBits: int32): int32
proc inflateInit2*(strm: var ZStream, windowBits: int32): int32
proc zError*(err: int32): cstring{.cdecl, dynlib: libz, importc: "zError".}
proc inflateSyncPoint*(z: PZstream): int32{.cdecl, dynlib: libz,
importc: "inflateSyncPoint".}
proc getCrcTable*(): pointer{.cdecl, dynlib: libz, importc: "get_crc_table".}
proc deflateInit(strm: var TZStream, level: int32): int32 =
result = deflateInitu(strm, level, zlibVersion(), sizeof(TZStream).cint)
proc deflateInit(strm: var ZStream, level: int32): int32 =
result = deflateInitu(strm, level, zlibVersion(), sizeof(ZStream).cint)
proc inflateInit(strm: var TZStream): int32 =
result = inflateInitu(strm, zlibVersion(), sizeof(TZStream).cint)
proc inflateInit(strm: var ZStream): int32 =
result = inflateInitu(strm, zlibVersion(), sizeof(ZStream).cint)
proc deflateInit2(strm: var TZStream,
proc deflateInit2(strm: var ZStream,
level, `method`, windowBits, memLevel,
strategy: int32): int32 =
result = deflateInit2u(strm, level, `method`, windowBits, memLevel,
strategy, zlibVersion(), sizeof(TZStream).cint)
strategy, zlibVersion(), sizeof(ZStream).cint)
proc inflateInit2(strm: var TZStream, windowBits: int32): int32 =
proc inflateInit2(strm: var ZStream, windowBits: int32): int32 =
result = inflateInit2u(strm, windowBits, zlibVersion(),
sizeof(TZStream).cint)
sizeof(ZStream).cint)
proc zlibAllocMem*(appData: pointer, items, size: int): pointer {.cdecl.} =
result = alloc(items * size)
@@ -200,7 +202,7 @@ proc uncompress*(sourceBuf: cstring, sourceLen: int): string =
## concatenated deflated values properly.
assert (not sourceBuf.isNil)
var z: TZStream
var z: ZStream
# Initialize input.
z.nextIn = sourceBuf

View File

@@ -27,7 +27,8 @@ else:
dllname = "libzzip.so"
type
TZZipError* = int32
TZZipError* = int32 # Name conflict if we drop the `T`
const
ZZIP_ERROR* = -4096'i32
ZZIP_NO_ERROR* = 0'i32 # no error, may be used if user sets it.
@@ -54,119 +55,122 @@ const
ZZIP_THREADED* = 1'i32 shl 19'i32
type
TZZipDir* {.final, pure.} = object
TZZipFile* {.final, pure.} = object
TZZipPluginIO* {.final, pure.} = object
ZZipDir* {.final, pure.} = object
ZZipFile* {.final, pure.} = object
ZZipPluginIO* {.final, pure.} = object
TZZipDirent* {.final, pure.} = object
ZZipDirent* {.final, pure.} = object
d_compr*: int32 ## compression method
d_csize*: int32 ## compressed size
st_size*: int32 ## file size / decompressed size
d_name*: cstring ## file name / strdupped name
TZZipStat* = TZZipDirent
ZZipStat* = ZZipDirent
{.deprecated: [TZZipDir: ZzipDir, TZZipFile: ZzipFile,
TZZipPluginIO: ZzipPluginIO, TZZipDirent: ZzipDirent,
TZZipStat: ZZipStat].}
proc zzip_strerror*(errcode: int32): cstring {.cdecl, dynlib: dllname,
importc: "zzip_strerror".}
proc zzip_strerror_of*(dir: ptr TZZipDir): cstring {.cdecl, dynlib: dllname,
proc zzip_strerror_of*(dir: ptr ZZipDir): cstring {.cdecl, dynlib: dllname,
importc: "zzip_strerror_of".}
proc zzip_errno*(errcode: int32): int32 {.cdecl, dynlib: dllname,
importc: "zzip_errno".}
proc zzip_geterror*(dir: ptr TZZipDir): int32 {.cdecl, dynlib: dllname,
proc zzip_geterror*(dir: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
importc: "zzip_error".}
proc zzip_seterror*(dir: ptr TZZipDir, errcode: int32) {.cdecl, dynlib: dllname,
proc zzip_seterror*(dir: ptr ZZipDir, errcode: int32) {.cdecl, dynlib: dllname,
importc: "zzip_seterror".}
proc zzip_compr_str*(compr: int32): cstring {.cdecl, dynlib: dllname,
importc: "zzip_compr_str".}
proc zzip_dirhandle*(fp: ptr TZZipFile): ptr TZZipDir {.cdecl, dynlib: dllname,
proc zzip_dirhandle*(fp: ptr ZZipFile): ptr ZZipDir {.cdecl, dynlib: dllname,
importc: "zzip_dirhandle".}
proc zzip_dirfd*(dir: ptr TZZipDir): int32 {.cdecl, dynlib: dllname,
proc zzip_dirfd*(dir: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
importc: "zzip_dirfd".}
proc zzip_dir_real*(dir: ptr TZZipDir): int32 {.cdecl, dynlib: dllname,
proc zzip_dir_real*(dir: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
importc: "zzip_dir_real".}
proc zzip_file_real*(fp: ptr TZZipFile): int32 {.cdecl, dynlib: dllname,
proc zzip_file_real*(fp: ptr ZZipFile): int32 {.cdecl, dynlib: dllname,
importc: "zzip_file_real".}
proc zzip_realdir*(dir: ptr TZZipDir): pointer {.cdecl, dynlib: dllname,
proc zzip_realdir*(dir: ptr ZZipDir): pointer {.cdecl, dynlib: dllname,
importc: "zzip_realdir".}
proc zzip_realfd*(fp: ptr TZZipFile): int32 {.cdecl, dynlib: dllname,
proc zzip_realfd*(fp: ptr ZZipFile): int32 {.cdecl, dynlib: dllname,
importc: "zzip_realfd".}
proc zzip_dir_alloc*(fileext: cstringArray): ptr TZZipDir {.cdecl,
proc zzip_dir_alloc*(fileext: cstringArray): ptr ZZipDir {.cdecl,
dynlib: dllname, importc: "zzip_dir_alloc".}
proc zzip_dir_free*(para1: ptr TZZipDir): int32 {.cdecl, dynlib: dllname,
proc zzip_dir_free*(para1: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
importc: "zzip_dir_free".}
proc zzip_dir_fdopen*(fd: int32, errcode_p: ptr TZZipError): ptr TZZipDir {.cdecl,
proc zzip_dir_fdopen*(fd: int32, errcode_p: ptr TZZipError): ptr ZZipDir {.cdecl,
dynlib: dllname, importc: "zzip_dir_fdopen".}
proc zzip_dir_open*(filename: cstring, errcode_p: ptr TZZipError): ptr TZZipDir {.
proc zzip_dir_open*(filename: cstring, errcode_p: ptr TZZipError): ptr ZZipDir {.
cdecl, dynlib: dllname, importc: "zzip_dir_open".}
proc zzip_dir_close*(dir: ptr TZZipDir) {.cdecl, dynlib: dllname,
proc zzip_dir_close*(dir: ptr ZZipDir) {.cdecl, dynlib: dllname,
importc: "zzip_dir_close".}
proc zzip_dir_read*(dir: ptr TZZipDir, dirent: ptr TZZipDirent): int32 {.cdecl,
proc zzip_dir_read*(dir: ptr ZZipDir, dirent: ptr ZZipDirent): int32 {.cdecl,
dynlib: dllname, importc: "zzip_dir_read".}
proc zzip_opendir*(filename: cstring): ptr TZZipDir {.cdecl, dynlib: dllname,
proc zzip_opendir*(filename: cstring): ptr ZZipDir {.cdecl, dynlib: dllname,
importc: "zzip_opendir".}
proc zzip_closedir*(dir: ptr TZZipDir) {.cdecl, dynlib: dllname,
proc zzip_closedir*(dir: ptr ZZipDir) {.cdecl, dynlib: dllname,
importc: "zzip_closedir".}
proc zzip_readdir*(dir: ptr TZZipDir): ptr TZZipDirent {.cdecl, dynlib: dllname,
proc zzip_readdir*(dir: ptr ZZipDir): ptr ZZipDirent {.cdecl, dynlib: dllname,
importc: "zzip_readdir".}
proc zzip_rewinddir*(dir: ptr TZZipDir) {.cdecl, dynlib: dllname,
proc zzip_rewinddir*(dir: ptr ZZipDir) {.cdecl, dynlib: dllname,
importc: "zzip_rewinddir".}
proc zzip_telldir*(dir: ptr TZZipDir): int {.cdecl, dynlib: dllname,
proc zzip_telldir*(dir: ptr ZZipDir): int {.cdecl, dynlib: dllname,
importc: "zzip_telldir".}
proc zzip_seekdir*(dir: ptr TZZipDir, offset: int) {.cdecl, dynlib: dllname,
proc zzip_seekdir*(dir: ptr ZZipDir, offset: int) {.cdecl, dynlib: dllname,
importc: "zzip_seekdir".}
proc zzip_file_open*(dir: ptr TZZipDir, name: cstring, flags: int32): ptr TZZipFile {.
proc zzip_file_open*(dir: ptr ZZipDir, name: cstring, flags: int32): ptr ZZipFile {.
cdecl, dynlib: dllname, importc: "zzip_file_open".}
proc zzip_file_close*(fp: ptr TZZipFile) {.cdecl, dynlib: dllname,
proc zzip_file_close*(fp: ptr ZZipFile) {.cdecl, dynlib: dllname,
importc: "zzip_file_close".}
proc zzip_file_read*(fp: ptr TZZipFile, buf: pointer, length: int): int {.
proc zzip_file_read*(fp: ptr ZZipFile, buf: pointer, length: int): int {.
cdecl, dynlib: dllname, importc: "zzip_file_read".}
proc zzip_open*(name: cstring, flags: int32): ptr TZZipFile {.cdecl,
proc zzip_open*(name: cstring, flags: int32): ptr ZZipFile {.cdecl,
dynlib: dllname, importc: "zzip_open".}
proc zzip_close*(fp: ptr TZZipFile) {.cdecl, dynlib: dllname,
proc zzip_close*(fp: ptr ZZipFile) {.cdecl, dynlib: dllname,
importc: "zzip_close".}
proc zzip_read*(fp: ptr TZZipFile, buf: pointer, length: int): int {.
proc zzip_read*(fp: ptr ZZipFile, buf: pointer, length: int): int {.
cdecl, dynlib: dllname, importc: "zzip_read".}
proc zzip_freopen*(name: cstring, mode: cstring, para3: ptr TZZipFile): ptr TZZipFile {.
proc zzip_freopen*(name: cstring, mode: cstring, para3: ptr ZZipFile): ptr ZZipFile {.
cdecl, dynlib: dllname, importc: "zzip_freopen".}
proc zzip_fopen*(name: cstring, mode: cstring): ptr TZZipFile {.cdecl,
proc zzip_fopen*(name: cstring, mode: cstring): ptr ZZipFile {.cdecl,
dynlib: dllname, importc: "zzip_fopen".}
proc zzip_fread*(p: pointer, size: int, nmemb: int,
file: ptr TZZipFile): int {.cdecl, dynlib: dllname,
file: ptr ZZipFile): int {.cdecl, dynlib: dllname,
importc: "zzip_fread".}
proc zzip_fclose*(fp: ptr TZZipFile) {.cdecl, dynlib: dllname,
proc zzip_fclose*(fp: ptr ZZipFile) {.cdecl, dynlib: dllname,
importc: "zzip_fclose".}
proc zzip_rewind*(fp: ptr TZZipFile): int32 {.cdecl, dynlib: dllname,
proc zzip_rewind*(fp: ptr ZZipFile): int32 {.cdecl, dynlib: dllname,
importc: "zzip_rewind".}
proc zzip_seek*(fp: ptr TZZipFile, offset: int, whence: int32): int {.
proc zzip_seek*(fp: ptr ZZipFile, offset: int, whence: int32): int {.
cdecl, dynlib: dllname, importc: "zzip_seek".}
proc zzip_tell*(fp: ptr TZZipFile): int {.cdecl, dynlib: dllname,
proc zzip_tell*(fp: ptr ZZipFile): int {.cdecl, dynlib: dllname,
importc: "zzip_tell".}
proc zzip_dir_stat*(dir: ptr TZZipDir, name: cstring, zs: ptr TZZipStat,
proc zzip_dir_stat*(dir: ptr ZZipDir, name: cstring, zs: ptr ZZipStat,
flags: int32): int32 {.cdecl, dynlib: dllname,
importc: "zzip_dir_stat".}
proc zzip_file_stat*(fp: ptr TZZipFile, zs: ptr TZZipStat): int32 {.cdecl,
proc zzip_file_stat*(fp: ptr ZZipFile, zs: ptr ZZipStat): int32 {.cdecl,
dynlib: dllname, importc: "zzip_file_stat".}
proc zzip_fstat*(fp: ptr TZZipFile, zs: ptr TZZipStat): int32 {.cdecl, dynlib: dllname,
proc zzip_fstat*(fp: ptr ZZipFile, zs: ptr ZZipStat): int32 {.cdecl, dynlib: dllname,
importc: "zzip_fstat".}
proc zzip_open_shared_io*(stream: ptr TZZipFile, name: cstring,
proc zzip_open_shared_io*(stream: ptr ZZipFile, name: cstring,
o_flags: int32, o_modes: int32, ext: cstringArray,
io: ptr TZZipPluginIO): ptr TZZipFile {.cdecl,
io: ptr ZZipPluginIO): ptr ZZipFile {.cdecl,
dynlib: dllname, importc: "zzip_open_shared_io".}
proc zzip_open_ext_io*(name: cstring, o_flags: int32, o_modes: int32,
ext: cstringArray, io: ptr TZZipPluginIO): ptr TZZipFile {.
ext: cstringArray, io: ptr ZZipPluginIO): ptr ZZipFile {.
cdecl, dynlib: dllname, importc: "zzip_open_ext_io".}
proc zzip_opendir_ext_io*(name: cstring, o_modes: int32,
ext: cstringArray, io: ptr TZZipPluginIO): ptr TZZipDir {.
ext: cstringArray, io: ptr ZZipPluginIO): ptr ZZipDir {.
cdecl, dynlib: dllname, importc: "zzip_opendir_ext_io".}
proc zzip_dir_open_ext_io*(filename: cstring, errcode_p: ptr TZZipError,
ext: cstringArray, io: ptr TZZipPluginIO): ptr TZZipDir {.
ext: cstringArray, io: ptr ZZipPluginIO): ptr ZZipDir {.
cdecl, dynlib: dllname, importc: "zzip_dir_open_ext_io".}