updated iup.nim; made tests green

This commit is contained in:
Araq
2014-08-31 22:55:51 +02:00
parent d7d059a686
commit 41c7cde61f
9 changed files with 1055 additions and 1058 deletions

View File

@@ -1036,8 +1036,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
internalError(c.debug[pc], "too implement")
of opcNarrowS:
decodeB(rkInt)
let min = -(1 shl (rb-1))
let max = (1 shl (rb-1))-1
let min = -(1.BiggestInt shl (rb-1))
let max = (1.BiggestInt shl (rb-1))-1
if regs[ra].intVal < min or regs[ra].intVal > max:
stackTrace(c, tos, pc, errGenerated,
msgKindToString(errUnhandledExceptionX) % "value out of range")

View File

@@ -1,37 +1,37 @@
# Example IUP program
# IupTabs: Creates a IupTabs control.
# iupTabs: Creates a iupTabs control.
import iup
discard iup.Open(nil, nil)
discard iup.open(nil, nil)
var vbox1 = Iup.Vbox(Iup.Label("Inside Tab A"), Iup.Button("Button A", ""), nil)
var vbox2 = Iup.Vbox(Iup.Label("Inside Tab B"), Iup.Button("Button B", ""), nil)
var vbox1 = iup.vbox(iup.label("Inside Tab A"), iup.button("Button A", ""), nil)
var vbox2 = iup.vbox(iup.label("Inside Tab B"), iup.button("Button B", ""), nil)
Iup.SetAttribute(vbox1, "TABTITLE", "Tab A")
Iup.SetAttribute(vbox2, "TABTITLE", "Tab B")
iup.setAttribute(vbox1, "TABTITLE", "Tab A")
iup.setAttribute(vbox2, "TABTITLE", "Tab B")
var tabs1 = Iup.Tabs(vbox1, vbox2, nil)
var tabs1 = iup.tabs(vbox1, vbox2, nil)
vbox1 = Iup.Vbox(Iup.Label("Inside Tab C"), Iup.Button("Button C", ""), nil)
vbox2 = Iup.Vbox(Iup.Label("Inside Tab D"), Iup.Button("Button D", ""), nil)
vbox1 = iup.vbox(iup.label("Inside Tab C"), iup.button("Button C", ""), nil)
vbox2 = iup.vbox(iup.label("Inside Tab D"), iup.button("Button D", ""), nil)
Iup.SetAttribute(vbox1, "TABTITLE", "Tab C")
Iup.SetAttribute(vbox2, "TABTITLE", "Tab D")
iup.setAttribute(vbox1, "TABTITLE", "Tab C")
iup.setAttribute(vbox2, "TABTITLE", "Tab D")
var tabs2 = Iup.Tabs(vbox1, vbox2, nil)
Iup.SetAttribute(tabs2, "TABTYPE", "LEFT")
var tabs2 = iup.tabs(vbox1, vbox2, nil)
iup.setAttribute(tabs2, "TABTYPE", "LEFT")
var box = Iup.Hbox(tabs1, tabs2, nil)
Iup.SetAttribute(box, "MARGIN", "10x10")
Iup.SetAttribute(box, "GAP", "10")
var box = iup.hbox(tabs1, tabs2, nil)
iup.setAttribute(box, "MARGIN", "10x10")
iup.setAttribute(box, "GAP", "10")
var dlg = Iup.Dialog(box)
Iup.SetAttribute(dlg, "TITLE", "IupTabs")
Iup.SetAttribute(dlg, "SIZE", "200x100")
var dlg = iup.dialog(box)
iup.setAttribute(dlg, "TITLE", "iupTabs")
iup.setAttribute(dlg, "SIZE", "200x100")
discard ShowXY(dlg, IUP_CENTER, IUP_CENTER)
discard MainLoop()
Close()
discard showXY(dlg, IUP_CENTER, IUP_CENTER)
discard mainLoop()
close()

View File

@@ -9,21 +9,21 @@ var
event: TEvent
bgColor = colChocolate.int32
if init(INIT_VIDEO) != 0:
if Init(INIT_VIDEO) != 0:
quit "SDL failed to initialize!"
screen = SetVideoMode(640, 480, 16, SWSURFACE or ANYFORMAT)
if screen.isNil:
quit($sdl.getError())
quit($sdl.GetError())
greeting = IMG_load("tux.png")
if greeting.isNil:
echo "Failed to load tux.png"
else:
## convert the image to alpha and free the old one
var s = greeting.displayFormatAlpha()
var s = greeting.DisplayFormatAlpha()
swap(greeting, s)
s.freeSurface()
s.FreeSurface()
r.x = 0
r.y = 0
@@ -31,7 +31,7 @@ r.y = 0
block game_loop:
while true:
while pollEvent(addr event) > 0:
while PollEvent(addr event) > 0:
case event.kind
of QUITEV:
break game_loop
@@ -41,12 +41,12 @@ block game_loop:
else:
discard
discard fillRect(screen, nil, bgColor)
discard blitSurface(greeting, nil, screen, addr r)
discard flip(screen)
discard FillRect(screen, nil, bgColor)
discard BlitSurface(greeting, nil, screen, addr r)
discard Flip(screen)
greeting.freeSurface()
screen.freeSurface()
greeting.FreeSurface()
screen.FreeSurface()
sdl.Quit()
## fowl wuz here 10/2012

View File

@@ -8,14 +8,14 @@ import os, streams, parsecsv, strutils, math
if paramCount() < 1:
quit("Usage: statcsv filename[.csv]")
var filename = addFileExt(ParamStr(1), "csv")
var filename = addFileExt(paramStr(1), "csv")
var s = newFileStream(filename, fmRead)
if s == nil: quit("cannot open the file " & filename)
var
x: TCsvParser
x: CsvParser
header: seq[string]
res: seq[TRunningStat]
res: seq[RunningStat]
open(x, s, filename, separator=';', skipInitialSpace = true)
while readRow(x):
if processedRows(x) == 1:

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@
{.deadCodeElim: on.}
import # Data structure templates
Windows
windows
const
NCBNAMSZ* = 16 # absolute length of a net name
@@ -24,20 +24,20 @@ type # Network Control Block
TNCBPostProc* = proc (P: PNCB) {.stdcall.}
TNCB* {.final.} = object # Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
# by an array of NAME_BUFFER structures.
ncb_command*: Char # command code
ncb_retcode*: Char # return code
ncb_lsn*: Char # local session number
ncb_num*: Char # number of our network name
ncb_command*: char # command code
ncb_retcode*: char # return code
ncb_lsn*: char # local session number
ncb_num*: char # number of our network name
ncb_buffer*: cstring # address of message buffer
ncb_length*: int16 # size of message buffer
ncb_callname*: array[0..NCBNAMSZ - 1, char] # blank-padded name of remote
ncb_name*: array[0..NCBNAMSZ - 1, char] # our blank-padded netname
ncb_rto*: Char # rcv timeout/retry count
ncb_sto*: Char # send timeout/sys timeout
ncb_rto*: char # rcv timeout/retry count
ncb_sto*: char # send timeout/sys timeout
ncb_post*: TNCBPostProc # POST routine address
ncb_lana_num*: Char # lana (adapter) number
ncb_cmd_cplt*: Char # 0xff => commmand pending
ncb_reserve*: array[0..9, Char] # reserved, used by BIOS
ncb_lana_num*: char # lana (adapter) number
ncb_cmd_cplt*: char # 0xff => commmand pending
ncb_reserve*: array[0..9, char] # reserved, used by BIOS
ncb_event*: THandle # HANDLE to Win32 event which
# will be set to the signalled
# state when an ASYNCH command
@@ -45,11 +45,11 @@ type # Network Control Block
PAdapterStatus* = ptr TAdapterStatus
TAdapterStatus* {.final.} = object
adapter_address*: array[0..5, Char]
rev_major*: Char
reserved0*: Char
adapter_type*: Char
rev_minor*: Char
adapter_address*: array[0..5, char]
rev_major*: char
reserved0*: char
adapter_type*: char
rev_minor*: char
duration*: int16
frmr_recv*: int16
frmr_xmit*: int16
@@ -75,9 +75,9 @@ type # Network Control Block
PNameBuffer* = ptr TNameBuffer
TNameBuffer* {.final.} = object
name*: array[0..NCBNAMSZ - 1, Char]
name_num*: Char
name_flags*: Char
name*: array[0..NCBNAMSZ - 1, char]
name_num*: char
name_flags*: char
const # values for name_flags bits.
@@ -96,19 +96,19 @@ type # Structure returned to the NCB command NCBSSTAT is SESSION_HEADER followed
# status for all names.
PSessionHeader* = ptr TSessionHeader
TSessionHeader* {.final.} = object
sess_name*: Char
num_sess*: Char
rcv_dg_outstanding*: Char
rcv_any_outstanding*: Char
sess_name*: char
num_sess*: char
rcv_dg_outstanding*: char
rcv_any_outstanding*: char
PSessionBuffer* = ptr TSessionBuffer
TSessionBuffer* {.final.} = object
lsn*: Char
state*: Char
local_name*: array[0..NCBNAMSZ - 1, Char]
remote_name*: array[0..NCBNAMSZ - 1, Char]
rcvs_outstanding*: Char
sends_outstanding*: Char
lsn*: char
state*: char
local_name*: array[0..NCBNAMSZ - 1, char]
remote_name*: array[0..NCBNAMSZ - 1, char]
rcvs_outstanding*: char
sends_outstanding*: char
const # Values for state
@@ -125,24 +125,24 @@ type # Structure returned to the NCB command NCBENUM.
PLanaEnum* = ptr TLanaEnum
TLanaEnum* {.final.} = object # Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
# by an array of FIND_NAME_BUFFER structures.
len*: Char # Number of valid entries in lana[]
lana*: array[0..MAX_LANA, Char]
len*: char # Number of valid entries in lana[]
lana*: array[0..MAX_LANA, char]
PFindNameHeader* = ptr TFindNameHeader
TFindNameHeader* {.final.} = object
node_count*: int16
reserved*: Char
unique_group*: Char
reserved*: char
unique_group*: char
PFindNameBuffer* = ptr TFindNameBuffer
TFindNameBuffer* {.final.} = object # Structure provided with NCBACTION. The purpose of NCBACTION is to provide
# transport specific extensions to netbios.
len*: Char
access_control*: Char
frame_control*: Char
destination_addr*: array[0..5, Char]
source_addr*: array[0..5, Char]
routing_info*: array[0..17, Char]
len*: char
access_control*: char
frame_control*: char
destination_addr*: array[0..5, char]
source_addr*: array[0..5, char]
routing_info*: array[0..17, char]
PActionHeader* = ptr TActionHeader
TActionHeader* {.final.} = object
@@ -227,6 +227,6 @@ const # NCB Command codes
# main user entry point for NetBIOS 3.0
# Usage: Result = Netbios( pncb );
proc Netbios*(P: PNCB): Char{.stdcall, dynlib: "netapi32.dll",
proc Netbios*(P: PNCB): char{.stdcall, dynlib: "netapi32.dll",
importc: "Netbios".}
# implementation

View File

@@ -28,14 +28,14 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
import
Windows
windows
type
HDROP* = THandle
UINT_PTR* = ptr UINT
UINT_PTR* = ptr uint32
DWORD_PTR* = ptr DWORD
pHICON* = ptr HICON
pBool* = ptr BOOL
PHICON* = ptr HICON
PBool* = ptr bool
STARTUPINFOW* {.final.} = object # a guess. Omission should get fixed in Windows.
cb*: DWORD
lpReserved*: LPTSTR
@@ -60,27 +60,27 @@ type
TSTARTUPINFOW* = STARTUPINFOW
PSTARTUPINFOW* = ptr STARTUPINFOW #unicode
proc DragQueryFileA*(arg1: HDROP, arg2: UINT, arg3: LPSTR, arg4: UINT): UINT{.
proc DragQueryFileA*(arg1: HDROP, arg2: uint32, arg3: LPSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileA".}
proc DragQueryFileW*(arg1: HDROP, arg2: UINT, arg3: LPWSTR, arg4: UINT): UINT{.
proc DragQueryFileW*(arg1: HDROP, arg2: uint32, arg3: LPWSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileW".}
proc DragQueryFile*(arg1: HDROP, arg2: UINT, arg3: LPSTR, arg4: UINT): UINT{.
proc DragQueryFile*(arg1: HDROP, arg2: uint32, arg3: LPSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileA".}
proc DragQueryFile*(arg1: HDROP, arg2: UINT, arg3: LPWSTR, arg4: UINT): UINT{.
proc DragQueryFile*(arg1: HDROP, arg2: uint32, arg3: LPWSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileW".}
proc DragQueryPoint*(arg1: HDROP, arg2: LPPOINT): BOOL{.stdcall,
proc DragQueryPoint*(arg1: HDROP, arg2: LPPOINT): bool{.stdcall,
dynlib: "shell32.dll", importc: "DragQueryPoint".}
proc DragFinish*(arg1: HDROP){.stdcall, dynlib: "shell32.dll",
importc: "DragFinish".}
proc DragAcceptFiles*(hwnd: HWND, arg2: BOOL){.stdcall, dynlib: "shell32.dll",
proc DragAcceptFiles*(hwnd: HWND, arg2: bool){.stdcall, dynlib: "shell32.dll",
importc: "DragAcceptFiles".}
proc ShellExecuteA*(HWND: hwnd, lpOperation: LPCSTR, lpFile: LPCSTR,
proc ShellExecuteA*(hwnd: HWND, lpOperation: LPCSTR, lpFile: LPCSTR,
lpParameters: LPCSTR, lpDirectory: LPCSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteA".}
proc ShellExecuteW*(hwnd: HWND, lpOperation: LPCWSTR, lpFile: LPCWSTR,
lpParameters: LPCWSTR, lpDirectory: LPCWSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteW".}
proc ShellExecute*(HWND: hwnd, lpOperation: LPCSTR, lpFile: LPCSTR,
proc ShellExecute*(hwnd: HWND, lpOperation: LPCSTR, lpFile: LPCSTR,
lpParameters: LPCSTR, lpDirectory: LPCSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteA".}
proc ShellExecute*(hwnd: HWND, lpOperation: LPCWSTR, lpFile: LPCWSTR,
@@ -94,16 +94,16 @@ proc FindExecutable*(lpFile: LPCSTR, lpDirectory: LPCSTR, lpResult: LPSTR): HIns
stdcall, dynlib: "shell32.dll", importc: "FindExecutableA".}
proc FindExecutable*(lpFile: LPCWSTR, lpDirectory: LPCWSTR, lpResult: LPWSTR): HInst{.
stdcall, dynlib: "shell32.dll", importc: "FindExecutableW".}
proc CommandLineToArgvW*(lpCmdLine: LPCWSTR, pNumArgs: ptr int32): pLPWSTR{.
proc CommandLineToArgvW*(lpCmdLine: LPCWSTR, pNumArgs: ptr int32): PLPWSTR{.
stdcall, dynlib: "shell32.dll", importc: "CommandLineToArgvW".}
proc ShellAboutA*(HWND: hWnd, szApp: LPCSTR, szOtherStuff: LPCSTR, HICON: hIcon): int32{.
proc ShellAboutA*(hwnd: HWND, szApp: LPCSTR, szOtherStuff: LPCSTR, hIcon: HICON): int32{.
stdcall, dynlib: "shell32.dll", importc: "ShellAboutA".}
proc ShellAboutW*(HWND: hWnd, szApp: LPCWSTR, szOtherStuff: LPCWSTR,
HICON: hIcon): int32{.stdcall, dynlib: "shell32.dll",
proc ShellAboutW*(hwnd: HWND, szApp: LPCWSTR, szOtherStuff: LPCWSTR,
hIcon: HICON): int32{.stdcall, dynlib: "shell32.dll",
importc: "ShellAboutW".}
proc ShellAbout*(HWND: hWnd, szApp: LPCSTR, szOtherStuff: LPCSTR, HICON: hIcon): int32{.
proc ShellAbout*(hwnd: HWND, szApp: LPCSTR, szOtherStuff: LPCSTR, hIcon: HICON): int32{.
stdcall, dynlib: "shell32.dll", importc: "ShellAboutA".}
proc ShellAbout*(HWND: hWnd, szApp: LPCWSTR, szOtherStuff: LPCWSTR, HICON: hIcon): int32{.
proc ShellAbout*(hwnd: HWND, szApp: LPCWSTR, szOtherStuff: LPCWSTR, hIcon: HICON): int32{.
stdcall, dynlib: "shell32.dll", importc: "ShellAboutW".}
proc DuplicateIcon*(inst: HINST, icon: HICON): HIcon{.stdcall,
dynlib: "shell32.dll", importc: "DuplicateIcon".}
@@ -115,29 +115,29 @@ proc ExtractAssociatedIcon*(hInst: HINST, lpIconPath: LPSTR, lpiIcon: LPWORD): H
stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconA".}
proc ExtractAssociatedIcon*(hInst: HINST, lpIconPath: LPWSTR, lpiIcon: LPWORD): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconW".}
proc ExtractIconA*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: UINT): HICON{.
proc ExtractIconA*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconA".}
proc ExtractIconW*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: UINT): HICON{.
proc ExtractIconW*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconW".}
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: UINT): HICON{.
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconA".}
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: UINT): HICON{.
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconW".}
# if(WINVER >= 0x0400)
type # init with sizeof(DRAGINFO)
DRAGINFOA* {.final.} = object
uSize*: UINT
uSize*: uint32
pt*: POINT
fNC*: BOOL
fNC*: bool
lpFileList*: LPSTR
grfKeyState*: DWORD
TDRAGINFOA* = DRAGINFOA
LPDRAGINFOA* = ptr DRAGINFOA # init with sizeof(DRAGINFO)
DRAGINFOW* {.final.} = object
uSize*: UINT
uSize*: uint32
pt*: POINT
fNC*: BOOL
fNC*: bool
lpFileList*: LPWSTR
grfKeyState*: DWORD
@@ -184,8 +184,8 @@ type
AppBarData* {.final.} = object
cbSize*: DWORD
hWnd*: HWND
uCallbackMessage*: UINT
uEdge*: UINT
uCallbackMessage*: uint32
uEdge*: uint32
rc*: RECT
lParam*: LPARAM # message specific
@@ -197,41 +197,41 @@ proc SHAppBarMessage*(dwMessage: DWORD, pData: APPBARDATA): UINT_PTR{.stdcall,
#
# EndAppBar
#
proc DoEnvironmentSubstA*(szString: LPSTR, cchString: UINT): DWORD{.stdcall,
proc DoEnvironmentSubstA*(szString: LPSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstA".}
proc DoEnvironmentSubstW*(szString: LPWSTR, cchString: UINT): DWORD{.stdcall,
proc DoEnvironmentSubstW*(szString: LPWSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstW".}
proc DoEnvironmentSubst*(szString: LPSTR, cchString: UINT): DWORD{.stdcall,
proc DoEnvironmentSubst*(szString: LPSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstA".}
proc DoEnvironmentSubst*(szString: LPWSTR, cchString: UINT): DWORD{.stdcall,
proc DoEnvironmentSubst*(szString: LPWSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstW".}
#Macro
proc EIRESID*(x: int32): int32
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: pHICON,
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExA".}
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: pHICON,
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExW".}
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32,
phiconLarge: var HICON, phiconSmall: var HIcon,
nIcons: UINT): UINT{.stdcall, dynlib: "shell32.dll",
nIcons: uint32): uint32{.stdcall, dynlib: "shell32.dll",
importc: "ExtractIconExA".}
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32,
phiconLarge: var HICON, phiconSmall: var HIcon,
nIcons: UINT): UINT{.stdcall, dynlib: "shell32.dll",
nIcons: uint32): uint32{.stdcall, dynlib: "shell32.dll",
importc: "ExtractIconExW".}
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: pHICON,
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExA".}
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: pHICON,
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExW".}
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: var HICON,
phiconSmall: var HIcon, nIcons: UINT): UINT{.stdcall,
phiconSmall: var HIcon, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExA".}
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32,
phiconLarge: var HICON, phiconSmall: var HIcon, nIcons: UINT): UINT{.
phiconLarge: var HICON, phiconSmall: var HIcon, nIcons: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconExW".}
#
# Shell File Operations
@@ -291,11 +291,11 @@ type
type
SHFILEOPSTRUCTA* {.final.} = object
hwnd*: HWND
wFunc*: UINT
wFunc*: uint32
pFrom*: LPCSTR
pTo*: LPCSTR
fFlags*: FILEOP_FLAGS
fAnyOperationsAborted*: BOOL
fAnyOperationsAborted*: bool
hNameMappings*: LPVOID
lpszProgressTitle*: LPCSTR # only used if FOF_SIMPLEPROGRESS
@@ -303,11 +303,11 @@ type
LPSHFILEOPSTRUCTA* = ptr SHFILEOPSTRUCTA
SHFILEOPSTRUCTW* {.final.} = object
hwnd*: HWND
wFunc*: UINT
wFunc*: uint32
pFrom*: LPCWSTR
pTo*: LPCWSTR
fFlags*: FILEOP_FLAGS
fAnyOperationsAborted*: BOOL
fAnyOperationsAborted*: bool
hNameMappings*: LPVOID
lpszProgressTitle*: LPCWSTR
@@ -430,10 +430,10 @@ type
cbSize*: DWORD
fMask*: ULONG
hwnd*: HWND
lpVerb*: lpcwstr
lpFile*: lpcwstr
lpParameters*: lpcwstr
lpDirectory*: lpcwstr
lpVerb*: LPCWSTR
lpFile*: LPCWSTR
lpParameters*: LPCWSTR
lpDirectory*: LPCWSTR
nShow*: int32
hInstApp*: HINST
lpIDList*: LPVOID
@@ -456,24 +456,24 @@ else:
SHELLEXECUTEINFO* = SHELLEXECUTEINFOA
TSHELLEXECUTEINFO* = SHELLEXECUTEINFOA
LPSHELLEXECUTEINFO* = LPSHELLEXECUTEINFOA
proc ShellExecuteExA*(lpExecInfo: LPSHELLEXECUTEINFOA): Bool{.stdcall,
proc ShellExecuteExA*(lpExecInfo: LPSHELLEXECUTEINFOA): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExA".}
proc ShellExecuteExW*(lpExecInfo: LPSHELLEXECUTEINFOW): Bool{.stdcall,
proc ShellExecuteExW*(lpExecInfo: LPSHELLEXECUTEINFOW): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExW".}
proc ShellExecuteEx*(lpExecInfo: LPSHELLEXECUTEINFOA): Bool{.stdcall,
proc ShellExecuteEx*(lpExecInfo: LPSHELLEXECUTEINFOA): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExA".}
proc ShellExecuteEx*(lpExecInfo: LPSHELLEXECUTEINFOW): Bool{.stdcall,
proc ShellExecuteEx*(lpExecInfo: LPSHELLEXECUTEINFOW): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExW".}
proc WinExecErrorA*(HWND: hwnd, error: int32, lpstrFileName: LPCSTR,
proc WinExecErrorA*(hwnd: HWND, error: int32, lpstrFileName: LPCSTR,
lpstrTitle: LPCSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorA".}
proc WinExecErrorW*(HWND: hwnd, error: int32, lpstrFileName: LPCWSTR,
proc WinExecErrorW*(hwnd: HWND, error: int32, lpstrFileName: LPCWSTR,
lpstrTitle: LPCWSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorW".}
proc WinExecError*(HWND: hwnd, error: int32, lpstrFileName: LPCSTR,
proc WinExecError*(hwnd: HWND, error: int32, lpstrFileName: LPCSTR,
lpstrTitle: LPCSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorA".}
proc WinExecError*(HWND: hwnd, error: int32, lpstrFileName: LPCWSTR,
proc WinExecError*(hwnd: HWND, error: int32, lpstrFileName: LPCWSTR,
lpstrTitle: LPCWSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorW".}
type
@@ -487,7 +487,7 @@ type
hUserToken*: HANDLE
lpProcessAttributes*: LPSECURITY_ATTRIBUTES
lpThreadAttributes*: LPSECURITY_ATTRIBUTES
bInheritHandles*: BOOL
bInheritHandles*: bool
dwCreationFlags*: DWORD
lpStartupInfo*: LPSTARTUPINFOW
lpProcessInformation*: LPPROCESS_INFORMATION
@@ -495,7 +495,7 @@ type
TSHCREATEPROCESSINFOW* = SHCREATEPROCESSINFOW
PSHCREATEPROCESSINFOW* = ptr SHCREATEPROCESSINFOW
proc SHCreateProcessAsUserW*(pscpi: PSHCREATEPROCESSINFOW): Bool{.stdcall,
proc SHCreateProcessAsUserW*(pscpi: PSHCREATEPROCESSINFOW): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHCreateProcessAsUserW".}
#
# End ShellExecuteEx and family }
@@ -544,16 +544,16 @@ type
NOTIFYICONDATAA* {.final.} = object
cbSize*: DWORD
hWnd*: HWND
uID*: UINT
uFlags*: UINT
uCallbackMessage*: UINT
uID*: uint32
uFlags*: uint32
uCallbackMessage*: uint32
hIcon*: HICON
szTip*: array[0..127, CHAR]
szTip*: array[0..127, char]
dwState*: DWORD
dwStateMask*: DWORD
szInfo*: array[0..255, CHAR]
uTimeout*: UINT # also: uVersion
szInfoTitle*: array[0..63, CHAR]
szInfo*: array[0..255, char]
uTimeout*: uint32 # also: uVersion
szInfoTitle*: array[0..63, char]
dwInfoFlags*: DWORD
guidItem*: TGUID
@@ -562,16 +562,16 @@ type
NOTIFYICONDATAW* {.final.} = object
cbSize*: DWORD
hWnd*: HWND
uID*: UINT
uFlags*: UINT
uCallbackMessage*: UINT
uID*: uint32
uFlags*: uint32
uCallbackMessage*: uint32
hIcon*: HICON
szTip*: array[0..127, WCHAR]
szTip*: array[0..127, Wchar]
dwState*: DWORD
dwStateMask*: DWORD
szInfo*: array[0..255, WCHAR]
uTimeout*: UINT # also uVersion : UINT
szInfoTitle*: array[0..63, CHAR]
szInfo*: array[0..255, Wchar]
uTimeout*: uint32 # also uVersion : UINT
szInfoTitle*: array[0..63, char]
dwInfoFlags*: DWORD
guidItem*: TGUID
@@ -619,13 +619,13 @@ const
NIIF_ICON_MASK* = 0x0000000F
NIIF_NOSOUND* = 0x00000010
proc Shell_NotifyIconA*(dwMessage: Dword, lpData: PNOTIFYICONDATAA): Bool{.
proc Shell_NotifyIconA*(dwMessage: Dword, lpData: PNOTIFYICONDATAA): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconA".}
proc Shell_NotifyIconW*(dwMessage: Dword, lpData: PNOTIFYICONDATAW): Bool{.
proc Shell_NotifyIconW*(dwMessage: Dword, lpData: PNOTIFYICONDATAW): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconW".}
proc Shell_NotifyIcon*(dwMessage: Dword, lpData: PNOTIFYICONDATAA): Bool{.
proc Shell_NotifyIcon*(dwMessage: Dword, lpData: PNOTIFYICONDATAA): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconA".}
proc Shell_NotifyIcon*(dwMessage: Dword, lpData: PNOTIFYICONDATAW): Bool{.
proc Shell_NotifyIcon*(dwMessage: Dword, lpData: PNOTIFYICONDATAW): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconW".}
#
# The SHGetFileInfo API provides an easy way to get attributes
@@ -652,20 +652,20 @@ type
hIcon*: HICON # out: icon
iIcon*: int32 # out: icon index
dwAttributes*: DWORD # out: SFGAO_ flags
szDisplayName*: array[0..(MAX_PATH) - 1, CHAR] # out: display name (or path)
szTypeName*: array[0..79, CHAR] # out: type name
szDisplayName*: array[0..(MAX_PATH) - 1, char] # out: display name (or path)
szTypeName*: array[0..79, char] # out: type name
TSHFILEINFOA* = SHFILEINFOA
pSHFILEINFOA* = ptr SHFILEINFOA
PSHFILEINFOA* = ptr SHFILEINFOA
SHFILEINFOW* {.final.} = object
hIcon*: HICON # out: icon
iIcon*: int32 # out: icon index
dwAttributes*: DWORD # out: SFGAO_ flags
szDisplayName*: array[0..(MAX_PATH) - 1, WCHAR] # out: display name (or path)
szTypeName*: array[0..79, WCHAR] # out: type name
szDisplayName*: array[0..(MAX_PATH) - 1, Wchar] # out: display name (or path)
szTypeName*: array[0..79, Wchar] # out: type name
TSHFILEINFOW* = SHFILEINFOW
pSHFILEINFOW* = ptr SHFILEINFOW
PSHFILEINFOW* = ptr SHFILEINFOW
when defined(UNICODE):
type
@@ -701,67 +701,67 @@ const
# in the upper 8 bits of the iIcon
proc SHGetFileInfoA*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: pSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
psfi: PSHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfoW*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
psfi: pSHFILEINFOW, cbFileInfo, UFlags: UINT): DWORD{.
psfi: PSHFILEINFOW, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
proc SHGetFileInfo*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: pSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
psfi: PSHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfoA*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: var TSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
psfi: var TSHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfoW*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
psfi: var TSHFILEINFOW, cbFileInfo, UFlags: UINT): DWORD{.
psfi: var TSHFILEINFOW, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
proc SHGetFileInfo*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: var TSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
psfi: var TSHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfo*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
psfi: var TSHFILEINFOW, cbFileInfo, UFlags: UINT): DWORD{.
psfi: var TSHFILEINFOW, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
proc SHGetDiskFreeSpaceExA*(pszDirectoryName: LPCSTR,
pulFreeBytesAvailableToCaller: pULARGE_INTEGER,
pulTotalNumberOfBytes: pULARGE_INTEGER,
pulTotalNumberOfFreeBytes: pULARGE_INTEGER): Bool{.
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExA".}
proc SHGetDiskFreeSpaceExW*(pszDirectoryName: LPCWSTR,
pulFreeBytesAvailableToCaller: pULARGE_INTEGER,
pulTotalNumberOfBytes: pULARGE_INTEGER,
pulTotalNumberOfFreeBytes: pULARGE_INTEGER): Bool{.
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExW".}
proc SHGetDiskFreeSpaceEx*(pszDirectoryName: LPCSTR,
pulFreeBytesAvailableToCaller: pULARGE_INTEGER,
pulTotalNumberOfBytes: pULARGE_INTEGER,
pulTotalNumberOfFreeBytes: pULARGE_INTEGER): Bool{.
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExA".}
proc SHGetDiskFreeSpace*(pszDirectoryName: LPCSTR,
pulFreeBytesAvailableToCaller: pULARGE_INTEGER,
pulTotalNumberOfBytes: pULARGE_INTEGER,
pulTotalNumberOfFreeBytes: pULARGE_INTEGER): Bool{.
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExA".}
proc SHGetDiskFreeSpaceEx*(pszDirectoryName: LPCWSTR,
pulFreeBytesAvailableToCaller: pULARGE_INTEGER,
pulTotalNumberOfBytes: pULARGE_INTEGER,
pulTotalNumberOfFreeBytes: pULARGE_INTEGER): Bool{.
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExW".}
proc SHGetDiskFreeSpace*(pszDirectoryName: LPCWSTR,
pulFreeBytesAvailableToCaller: pULARGE_INTEGER,
pulTotalNumberOfBytes: pULARGE_INTEGER,
pulTotalNumberOfFreeBytes: pULARGE_INTEGER): Bool{.
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExW".}
proc SHGetNewLinkInfoA*(pszLinkTo: LPCSTR, pszDir: LPCSTR, pszName: LPSTR,
pfMustCopy: pBool, uFlags: UINT): Bool{.stdcall,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoA".}
proc SHGetNewLinkInfoW*(pszLinkTo: LPCWSTR, pszDir: LPCWSTR, pszName: LPWSTR,
pfMustCopy: pBool, uFlags: UINT): Bool{.stdcall,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoW".}
proc SHGetNewLinkInfo*(pszLinkTo: LPCSTR, pszDir: LPCSTR, pszName: LPSTR,
pfMustCopy: pBool, uFlags: UINT): Bool{.stdcall,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoA".}
proc SHGetNewLinkInfo*(pszLinkTo: LPCWSTR, pszDir: LPCWSTR, pszName: LPWSTR,
pfMustCopy: pBool, uFlags: UINT): Bool{.stdcall,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoW".}
const
SHGNLI_PIDL* = 0x00000001 # pszLinkTo is a pidl
@@ -777,17 +777,17 @@ const
PRINTACTION_DOCUMENTDEFAULTS* = 6
PRINTACTION_SERVERPROPERTIES* = 7
proc SHInvokePrinterCommandA*(HWND: hwnd, uAction: UINT, lpBuf1: LPCSTR,
lpBuf2: LPCSTR, fModal: Bool): Bool{.stdcall,
proc SHInvokePrinterCommandA*(hwnd: HWND, uAction: uint32, lpBuf1: LPCSTR,
lpBuf2: LPCSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandA".}
proc SHInvokePrinterCommandW*(HWND: hwnd, uAction: UINT, lpBuf1: LPCWSTR,
lpBuf2: LPCWSTR, fModal: Bool): Bool{.stdcall,
proc SHInvokePrinterCommandW*(hwnd: HWND, uAction: uint32, lpBuf1: LPCWSTR,
lpBuf2: LPCWSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}
proc SHInvokePrinterCommand*(HWND: hwnd, uAction: UINT, lpBuf1: LPCSTR,
lpBuf2: LPCSTR, fModal: Bool): Bool{.stdcall,
proc SHInvokePrinterCommand*(hwnd: HWND, uAction: uint32, lpBuf1: LPCSTR,
lpBuf2: LPCSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandA".}
proc SHInvokePrinterCommand*(HWND: hwnd, uAction: UINT, lpBuf1: LPCWSTR,
lpBuf2: LPCWSTR, fModal: Bool): Bool{.stdcall,
proc SHInvokePrinterCommand*(hwnd: HWND, uAction: uint32, lpBuf1: LPCWSTR,
lpBuf2: LPCWSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}
proc SHLoadNonloadedIconOverlayIdentifiers*(): HResult{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}

File diff suppressed because it is too large Load Diff

View File

@@ -250,14 +250,14 @@
# SDL_GL_MULTISAMPLESAMPLES
#
# Add DLL/Shared object functions
# function SDL_LoadObject( const sofile : PChar ) : Pointer;
# function SDL_LoadObject( const sofile : PChar ) : pointer;
#
# function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer;
# function SDL_LoadFunction( handle : pointer; const name : PChar ) : pointer;
#
# procedure SDL_UnloadObject( handle : Pointer );
# procedure SDL_UnloadObject( handle : pointer );
#
# Added function to create RWops from const memory: SDL_RWFromConstMem()
# function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops;
# function SDL_RWFromConstMem(const mem: pointer; size: Integer) : PSDL_RWops;
#
# Ported SDL_cpuinfo.h so Now you can test for Specific CPU types.
#
@@ -756,9 +756,9 @@ type
sdlFALSE, sdlTRUE
PUInt8Array* = ptr TUInt8Array
TUInt8Array* = array[0..high(int) shr 1, byte]
PUInt16* = ptr UInt16
PUInt32* = ptr UInt32
PUInt64* = ptr UInt64
PUInt16* = ptr uInt16
PUInt32* = ptr uInt32
PUInt64* = ptr uInt64
UInt64*{.final.} = object
hi*: int32
lo*: int32
@@ -790,8 +790,8 @@ type
args*: array[0..ERR_MAX_ARGS - 1, TArg]
TStdio*{.final.} = object
autoclose*: int # FILE * is only defined in Kylix so we use a simple Pointer
fp*: Pointer
autoclose*: int # FILE * is only defined in Kylix so we use a simple pointer
fp*: pointer
TMem*{.final.} = object
base*: ptr byte
@@ -800,9 +800,9 @@ type
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{.
TRead* = proc (context: PRWops, thePtr: pointer, size: int, maxnum: int): int{.
cdecl.}
TWrite* = proc (context: PRWops, thePtr: Pointer, size: int, num: int): int{.
TWrite* = proc (context: PRWops, thePtr: pointer, size: int, num: int): int{.
cdecl.}
TClose* = proc (context: PRWops): int{.cdecl.} # the variant record itself
TRWops*{.final.} = object
@@ -817,27 +817,27 @@ type
RWops* = TRWops # 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.}
TNewTimerCallback* = proc (interval: int32, param: pointer): int32{.cdecl.}
PTimerID* = ptr TTimerID
TTimerID*{.final.} = object
interval*: int32
callback*: TNewTimerCallback
param*: Pointer
param*: pointer
last_alarm*: int32
next*: PTimerID
TAudioSpecCallback* = proc (userdata: Pointer, stream: ptr byte, length: int){.
TAudioSpecCallback* = 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
freq*: int # DSP frequency -- samples per second
format*: UInt16 # Audio data format
format*: uInt16 # Audio data format
channels*: byte # Number of channels: 1 mono, 2 stereo
silence*: byte # Audio buffer silence value (calculated)
samples*: UInt16 # Audio buffer size in samples
padding*: UInt16 # Necessary for some compile environments
samples*: uInt16 # Audio buffer size in samples
padding*: uInt16 # Necessary for some compile environments
size*: int32 # Audio buffer size in bytes (calculated)
# This function is called when the audio device needs more data.
# 'stream' is a pointer to the audio data buffer
@@ -845,20 +845,20 @@ type
# Once the callback returns, the buffer will no longer be valid.
# Stereo samples are stored in a LRLRLR ordering.
callback*: TAudioSpecCallback
userdata*: Pointer
userdata*: pointer
PAudioCVT* = ptr TAudioCVT
PAudioCVTFilter* = ptr TAudioCVTFilter
TAudioCVTFilter*{.final.} = object
cvt*: PAudioCVT
format*: UInt16
format*: uint16
PAudioCVTFilterArray* = ptr TAudioCVTFilterArray
TAudioCVTFilterArray* = array[0..9, PAudioCVTFilter]
TAudioCVT*{.final.} = object
needed*: int # Set to 1 if conversion possible
src_format*: UInt16 # Source audio format
dst_format*: UInt16 # Target audio format
src_format*: uint16 # Source audio format
dst_format*: uint16 # Target audio format
rate_incr*: float64 # Rate conversion increment
buf*: ptr byte # Buffer to hold entire audio data
length*: int # Length of original audio buffer
@@ -876,7 +876,7 @@ type
TCDTrack*{.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
unused*: uint16
len*: int32 # Length, in frames, of this track
offset*: int32 # Offset, in frames, from start of disk
@@ -945,7 +945,7 @@ type
scancode*: byte # hardware specific scancode
sym*: TKey # SDL virtual keysym
modifier*: TMod # current key modifiers
unicode*: UInt16 # translated character
unicode*: uint16 # translated character
TEventAction* = enum # Application visibility event structure
ADDEVENT, PEEKEVENT, GETEVENT
@@ -971,7 +971,7 @@ type
kind*: TEventKind
which*: byte # The mouse device index
state*: byte # The current button state
x*, y*: UInt16 # The X/Y coordinates of the mouse
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
@@ -982,8 +982,8 @@ type
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
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
@@ -1036,8 +1036,8 @@ type
TUserEvent*{.final.} = object # SDL_USEREVENT through SDL_NUMEVENTS-1
kind*: TEventKind
code*: cint # User defined event code
data1*: Pointer # User defined data pointer
data2*: Pointer # User defined data pointer
data1*: pointer # User defined data pointer
data2*: pointer # User defined data pointer
when defined(Unix):
@@ -1090,8 +1090,8 @@ elif defined(Unix):
# 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
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
@@ -1135,7 +1135,7 @@ type
PRect* = ptr TRect
TRect*{.final.} = object
x*, y*: int16
w*, h*: UInt16
w*, h*: uint16
Rect* = TRect
PColor* = ptr TColor
@@ -1182,7 +1182,7 @@ type
d_width*: int
d_height*: int
d_skip*: int
aux_data*: Pointer
aux_data*: pointer
src*: PPixelFormat
table*: ptr byte
dst*: PPixelFormat
@@ -1194,17 +1194,17 @@ type
flags*: int32 # Read-only
format*: PPixelFormat # Read-only
w*, h*: cint # Read-only
pitch*: UInt16 # Read-only
pixels*: Pointer # Read-write
pitch*: uint16 # Read-only
pixels*: pointer # Read-write
offset*: cint # Private
hwdata*: Pointer #TPrivate_hwdata; Hardware-specific surface info
hwdata*: pointer #TPrivate_hwdata; Hardware-specific surface info
# clipping information:
clip_rect*: TRect # Read-only
unused1*: int32 # for binary compatibility
# Allow recursive locks
locked*: int32 # Private
# info for fast blit mapping to other surfaces
Blitmap*: Pointer # PSDL_BlitMap; // Private
Blitmap*: pointer # PSDL_BlitMap; // Private
# format version, bumped at every change to invalidate blit maps
format_version*: cint # Private
refcount*: cint
@@ -1241,7 +1241,7 @@ type
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
wm_cursor*: Pointer # Window-manager cursor
wm_cursor*: pointer # Window-manager cursor
type
@@ -1268,7 +1268,7 @@ type # This is the system-independent thread info struc
handle*: TSYS_ThreadHandle
status*: int
errbuf*: TError
data*: Pointer
data*: pointer
PKeyStateArr* = ptr TKeyStateArr
TKeyStateArr* = array[0..65000, byte] # Types required so we don't need to use Windows.pas
@@ -1326,7 +1326,7 @@ proc WasInit*(flags: int32): int32{.cdecl, importc: "SDL_WasInit",
proc Quit*(){.cdecl, importc: "SDL_Quit", dynlib: LibName.}
when defined(WINDOWS):
# This should be called from your WinMain() function, if any
proc RegisterApp*(name: cstring, style: int32, h_Inst: Pointer): int{.cdecl,
proc RegisterApp*(name: cstring, style: int32, h_Inst: pointer): int{.cdecl,
importc: "SDL_RegisterApp", dynlib: LibName.}
proc TableSize*(table: cstring): int
#------------------------------------------------------------------------------
@@ -1347,17 +1347,17 @@ proc RWFromFile*(filename, mode: cstring): PRWops{.cdecl,
importc: "SDL_RWFromFile", dynlib: LibName.}
proc FreeRW*(area: PRWops){.cdecl, importc: "SDL_FreeRW", dynlib: LibName.}
#fp is FILE *fp ???
proc RWFromFP*(fp: Pointer, autoclose: int): PRWops{.cdecl,
proc RWFromFP*(fp: pointer, autoclose: int): PRWops{.cdecl,
importc: "SDL_RWFromFP", dynlib: LibName.}
proc RWFromMem*(mem: Pointer, size: int): PRWops{.cdecl,
proc RWFromMem*(mem: pointer, size: int): PRWops{.cdecl,
importc: "SDL_RWFromMem", dynlib: LibName.}
proc RWFromConstMem*(mem: Pointer, size: int): PRWops{.cdecl,
proc RWFromConstMem*(mem: pointer, size: int): PRWops{.cdecl,
importc: "SDL_RWFromConstMem", dynlib: LibName.}
proc AllocRW*(): PRWops{.cdecl, importc: "SDL_AllocRW", dynlib: LibName.}
proc RWSeek*(context: PRWops, offset: int, whence: int): int
proc RWTell*(context: PRWops): int
proc RWRead*(context: PRWops, theptr: Pointer, size: int, n: int): int
proc RWWrite*(context: PRWops, theptr: Pointer, size: int, n: int): int
proc RWRead*(context: PRWops, theptr: pointer, size: int, n: int): int
proc RWWrite*(context: PRWops, theptr: pointer, size: int, n: int): int
proc RWClose*(context: PRWops): int
#------------------------------------------------------------------------------
# time-handling
@@ -1369,7 +1369,7 @@ 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: TNewTimerCallback, param: pointer): PTimerID{.
cdecl, importc: "SDL_AddTimer", dynlib: LibName.}
# Remove one of the multiple timers knowing its ID.
# Returns a boolean value indicating success.
@@ -1387,7 +1387,7 @@ proc AudioInit*(driver_name: cstring): int{.cdecl, importc: "SDL_AudioInit",
dynlib: LibName.}
proc AudioQuit*(){.cdecl, importc: "SDL_AudioQuit", dynlib: LibName.}
# This function fills the given character buffer with the name of the
# current audio driver, and returns a Pointer to it if the audio driver has
# current audio driver, and returns a pointer to it if the audio driver has
# been initialized. It returns NULL if no driver has been initialized.
proc AudioDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl,
importc: "SDL_AudioDriverName", dynlib: LibName.}
@@ -1470,8 +1470,8 @@ proc FreeWAV*(audio_buf: ptr byte){.cdecl, importc: "SDL_FreeWAV", dynlib: LibNa
# by SDL_ConvertAudio() to convert a buffer of audio data from one format
# to the other.
# This function returns 0, or -1 if there was an error.
proc BuildAudioCVT*(cvt: PAudioCVT, src_format: UInt16, src_channels: byte,
src_rate: int, dst_format: UInt16, dst_channels: byte,
proc BuildAudioCVT*(cvt: PAudioCVT, src_format: uint16, src_channels: byte,
src_rate: int, dst_format: uint16, dst_channels: byte,
dst_rate: int): int{.cdecl, importc: "SDL_BuildAudioCVT",
dynlib: LibName.}
# Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
@@ -1937,12 +1937,12 @@ proc AllocSurface*(flags: int32, width, height, depth: int,
proc CreateRGBSurface*(flags: int32, width, height, depth: int,
RMask, GMask, BMask, AMask: int32): PSurface{.cdecl,
importc: "SDL_CreateRGBSurface", dynlib: LibName.}
proc CreateRGBSurfaceFrom*(pixels: Pointer, width, height, depth, pitch: int,
proc CreateRGBSurfaceFrom*(pixels: pointer, width, height, depth, pitch: int,
RMask, GMask, BMask, AMask: int32): PSurface{.cdecl,
importc: "SDL_CreateRGBSurfaceFrom", dynlib: LibName.}
proc FreeSurface*(surface: PSurface){.cdecl, importc: "SDL_FreeSurface",
dynlib: LibName.}
proc MustLock*(Surface: PSurface): bool
proc MustLock*(surface: PSurface): bool
# SDL_LockSurface() sets up a surface for directly accessing the pixels.
# Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
# to and read from 'surface->pixels', using the pixel format stored in
@@ -2178,7 +2178,7 @@ proc FreeYUVOverlay*(Overlay: POverlay){.cdecl, importc: "SDL_FreeYUVOverlay",
proc GL_LoadLibrary*(filename: cstring): int{.cdecl,
importc: "SDL_GL_LoadLibrary", dynlib: LibName.}
# Get the address of a GL function (for extension functions)
proc GL_GetProcAddress*(procname: cstring): Pointer{.cdecl,
proc GL_GetProcAddress*(procname: cstring): pointer{.cdecl,
importc: "SDL_GL_GetProcAddress", dynlib: LibName.}
# Set an attribute of the OpenGL subsystem before intialization.
proc GL_SetAttribute*(attr: TGLAttr, value: int): int{.cdecl,
@@ -2255,7 +2255,7 @@ proc GetMouseState*(x: var int, y: var int): byte{.cdecl,
proc GetRelativeMouseState*(x: var int, y: var int): byte{.cdecl,
importc: "SDL_GetRelativeMouseState", dynlib: LibName.}
# Set the position of the mouse cursor (generates a mouse motion event)
proc WarpMouse*(x, y: UInt16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName.}
proc WarpMouse*(x, y: uint16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName.}
# Create a cursor using the specified data and mask (in MSB format).
# The cursor width must be a multiple of 8 bits.
#
@@ -2402,7 +2402,7 @@ proc CondWaitTimeout*(cond: Pcond, mut: Pmutex, ms: int32): int{.cdecl,
# Condition variable functions
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# Create a thread
proc CreateThread*(fn, data: Pointer): PThread{.cdecl,
proc CreateThread*(fn, data: pointer): PThread{.cdecl,
importc: "SDL_CreateThread", dynlib: LibName.}
# Get the 32-bit thread identifier for the current thread
proc ThreadID*(): int32{.cdecl, importc: "SDL_ThreadID", dynlib: LibName.}
@@ -2435,16 +2435,16 @@ proc GetWMInfo*(info: PSysWMinfo): int{.cdecl, importc: "SDL_GetWMInfo",
# * to the object handle (or NULL if there was an error).
# * The 'sofile' parameter is a system dependent name of the object file.
# *
proc LoadObject*(sofile: cstring): Pointer{.cdecl, importc: "SDL_LoadObject",
proc LoadObject*(sofile: cstring): pointer{.cdecl, importc: "SDL_LoadObject",
dynlib: LibName.}
#* Given an object handle, this function looks up the address of the
# * named function in the shared object and returns it. This address
# * is no longer valid after calling SDL_UnloadObject().
# *
proc LoadFunction*(handle: Pointer, name: cstring): Pointer{.cdecl,
proc LoadFunction*(handle: pointer, name: cstring): pointer{.cdecl,
importc: "SDL_LoadFunction", dynlib: LibName.}
#* Unload a shared object from memory *
proc UnloadObject*(handle: Pointer){.cdecl, importc: "SDL_UnloadObject",
proc UnloadObject*(handle: pointer){.cdecl, importc: "SDL_UnloadObject",
dynlib: LibName.}
#------------------------------------------------------------------------------
proc Swap32*(D: int32): int32
@@ -2455,32 +2455,32 @@ proc TurnBitOff*(value: int, bit: int8): int
# implementation
proc TABLESIZE(table: cstring): int =
Result = SizeOf(table) div SizeOf(table[0])
result = sizeOf(table) div sizeOf(table[0])
proc OutOfMemory() =
when not (defined(WINDOWS)): Error(ENOMEM)
proc RWSeek(context: PRWops, offset: int, whence: int): int =
Result = context.seek(context, offset, whence)
result = context.seek(context, offset, whence)
proc RWTell(context: PRWops): int =
Result = context.seek(context, 0, 1)
result = context.seek(context, 0, 1)
proc RWRead(context: PRWops, theptr: Pointer, size: int, n: int): int =
Result = context.read(context, theptr, size, n)
proc RWRead(context: PRWops, theptr: pointer, size: int, n: int): int =
result = context.read(context, theptr, size, n)
proc RWWrite(context: PRWops, theptr: Pointer, size: int, n: int): int =
Result = context.write(context, theptr, size, n)
proc RWWrite(context: PRWops, theptr: pointer, size: int, n: int): int =
result = context.write(context, theptr, size, n)
proc RWClose(context: PRWops): int =
Result = context.closeFile(context)
result = context.closeFile(context)
proc LoadWAV(filename: cstring, spec: PAudioSpec, audio_buf: ptr byte,
audiolen: PUInt32): PAudioSpec =
Result = LoadWAV_RW(RWFromFile(filename, "rb"), 1, spec, audio_buf, audiolen)
result = LoadWAV_RW(RWFromFile(filename, "rb"), 1, spec, audio_buf, audiolen)
proc CDInDrive(status: TCDStatus): bool =
Result = ord(status) > ord(CD_ERROR)
result = ord(status) > ord(CD_ERROR)
proc FRAMES_TO_MSF(frames: int, M: var int, S: var int, F: var int) =
var value: int
@@ -2492,7 +2492,7 @@ proc FRAMES_TO_MSF(frames: int, M: var int, S: var int, F: var int) =
M = value
proc MSF_TO_FRAMES(M: int, S: int, F: int): int =
Result = M * 60 * CD_FPS + S * CD_FPS + F
result = M * 60 * CD_FPS + S * CD_FPS + F
proc VERSION(X: var TVersion) =
X.major = MAJOR_VERSION
@@ -2500,43 +2500,43 @@ proc VERSION(X: var TVersion) =
X.patch = PATCHLEVEL
proc VERSIONNUM(X, Y, Z: int): int =
Result = X * 1000 + Y * 100 + Z
result = X * 1000 + Y * 100 + Z
proc COMPILEDVERSION(): int =
Result = VERSIONNUM(MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL)
result = VERSIONNUM(MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL)
proc VERSION_ATLEAST(X, Y, Z: int): bool =
Result = (COMPILEDVERSION() >= VERSIONNUM(X, Y, Z))
result = (COMPILEDVERSION() >= VERSIONNUM(X, Y, Z))
proc LoadBMP(filename: cstring): PSurface =
Result = LoadBMP_RW(RWFromFile(filename, "rb"), 1)
result = LoadBMP_RW(RWFromFile(filename, "rb"), 1)
proc SaveBMP(surface: PSurface, filename: cstring): int =
Result = SaveBMP_RW(surface, RWFromFile(filename, "wb"), 1)
result = SaveBMP_RW(surface, RWFromFile(filename, "wb"), 1)
proc BlitSurface(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int =
Result = UpperBlit(src, srcrect, dst, dstrect)
result = UpperBlit(src, srcrect, dst, dstrect)
proc AllocSurface(flags: int32, width, height, depth: int,
RMask, GMask, BMask, AMask: int32): PSurface =
Result = CreateRGBSurface(flags, width, height, depth, RMask, GMask, BMask,
result = CreateRGBSurface(flags, width, height, depth, RMask, GMask, BMask,
AMask)
proc MustLock(Surface: PSurface): bool =
Result = ((surface[].offset != 0) or
((surface[].flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0))
proc MustLock(surface: PSurface): bool =
result = ((surface.offset != 0) or
((surface.flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0))
proc LockMutex(mutex: Pmutex): int =
Result = mutexP(mutex)
result = mutexP(mutex)
proc UnlockMutex(mutex: Pmutex): int =
Result = mutexV(mutex)
result = mutexV(mutex)
proc BUTTON(Button: int): int =
Result = PRESSED shl (Button - 1)
result = PRESSED shl (Button - 1)
proc Swap32(D: int32): int32 =
Result = ((D shl 24) or ((D shl 8) and 0x00FF0000) or
result = ((D shl 24) or ((D shl 8) and 0x00FF0000) or
((D shr 8) and 0x0000FF00) or (D shr 24))
proc IsBitOn(value: int, bit: int8): bool =