update windows vocabs to load without c-type strings

db4
Joe Groff 2009-09-27 18:19:53 -05:00
parent 20621bbbb6
commit 4f82861bf3
11 changed files with 106 additions and 94 deletions

2
basis/opengl/gl/windows/windows.factor Normal file → Executable file
View File

@ -1,4 +1,4 @@
USING: alien.syntax kernel windows.types ; USING: alien.c-types alien.syntax kernel windows.types ;
IN: opengl.gl.windows IN: opengl.gl.windows
LIBRARY: gl LIBRARY: gl

View File

@ -1,5 +1,5 @@
USING: alien.syntax kernel math windows.types windows.kernel32 USING: alien.c-types alien.syntax kernel math windows.types
math.bitwise classes.struct ; windows.kernel32 math.bitwise classes.struct ;
IN: windows.advapi32 IN: windows.advapi32
LIBRARY: advapi32 LIBRARY: advapi32
@ -222,15 +222,15 @@ C-ENUM:
SE_WMIGUID_OBJECT SE_WMIGUID_OBJECT
SE_REGISTRY_WOW64_32KEY ; SE_REGISTRY_WOW64_32KEY ;
TYPEDEF: TRUSTEE* PTRUSTEE
STRUCT: TRUSTEE STRUCT: TRUSTEE
{ pMultipleTrustee PTRUSTEE } { pMultipleTrustee TRUSTEE* }
{ MultipleTrusteeOperation MULTIPLE_TRUSTEE_OPERATION } { MultipleTrusteeOperation MULTIPLE_TRUSTEE_OPERATION }
{ TrusteeForm TRUSTEE_FORM } { TrusteeForm TRUSTEE_FORM }
{ TrusteeType TRUSTEE_TYPE } { TrusteeType TRUSTEE_TYPE }
{ ptstrName LPTSTR } ; { ptstrName LPTSTR } ;
TYPEDEF: TRUSTEE* PTRUSTEE
STRUCT: EXPLICIT_ACCESS STRUCT: EXPLICIT_ACCESS
{ grfAccessPermissions DWORD } { grfAccessPermissions DWORD }
{ grfAccessMode ACCESS_MODE } { grfAccessMode ACCESS_MODE }

6
basis/windows/com/com.factor Normal file → Executable file
View File

@ -10,6 +10,8 @@ COM-INTERFACE: IUnknown f {00000000-0000-0000-C000-000000000046}
ULONG AddRef ( ) ULONG AddRef ( )
ULONG Release ( ) ; ULONG Release ( ) ;
TYPEDEF: void* IAdviseSink*
COM-INTERFACE: IDataObject IUnknown {0000010E-0000-0000-C000-000000000046} COM-INTERFACE: IDataObject IUnknown {0000010E-0000-0000-C000-000000000046}
HRESULT GetData ( FORMATETC* pFormatetc, STGMEDIUM* pmedium ) HRESULT GetData ( FORMATETC* pFormatetc, STGMEDIUM* pmedium )
HRESULT GetDataHere ( FORMATETC* pFormatetc, STGMEDIUM* pmedium ) HRESULT GetDataHere ( FORMATETC* pFormatetc, STGMEDIUM* pmedium )
@ -27,6 +29,10 @@ COM-INTERFACE: IDropTarget IUnknown {00000122-0000-0000-C000-000000000046}
HRESULT DragLeave ( ) HRESULT DragLeave ( )
HRESULT Drop ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect ) ; HRESULT Drop ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect ) ;
FUNCTION: HRESULT RegisterDragDrop ( HWND hWnd, IDropTarget* pDropTarget ) ;
FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd ) ;
FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ;
: com-query-interface ( interface iid -- interface' ) : com-query-interface ( interface iid -- interface' )
[ [
"void*" malloc-object &free "void*" malloc-object &free

View File

@ -1,8 +1,8 @@
USING: alien alien.c-types alien.accessors effects kernel USING: alien alien.c-types alien.accessors alien.parser
windows.ole32 parser lexer splitting grouping sequences effects kernel windows.ole32 parser lexer splitting grouping
namespaces assocs quotations generalizations accessors words sequences namespaces assocs quotations generalizations
macros alien.syntax fry arrays layouts math classes.struct accessors words macros alien.syntax fry arrays layouts math
windows.kernel32 ; classes.struct windows.kernel32 ;
IN: windows.com.syntax IN: windows.com.syntax
<PRIVATE <PRIVATE
@ -14,7 +14,7 @@ MACRO: com-invoke ( n return parameters -- )
"stdcall" alien-indirect "stdcall" alien-indirect
] ; ] ;
TUPLE: com-interface-definition name parent iid functions ; TUPLE: com-interface-definition word parent iid functions ;
C: <com-interface-definition> com-interface-definition C: <com-interface-definition> com-interface-definition
TUPLE: com-function-definition name return parameters ; TUPLE: com-function-definition name return parameters ;
@ -25,22 +25,25 @@ SYMBOL: +com-interface-definitions+
[ H{ } +com-interface-definitions+ set-global ] [ H{ } +com-interface-definitions+ set-global ]
unless unless
ERROR: no-com-interface interface ;
: find-com-interface-definition ( name -- definition ) : find-com-interface-definition ( name -- definition )
dup "f" = [ drop f ] [ [
dup +com-interface-definitions+ get-global at* dup +com-interface-definitions+ get-global at*
[ nip ] [ nip ] [ drop no-com-interface ] if
[ " COM interface hasn't been defined" prepend throw ] ] [ f ] if* ;
if
] if ;
: save-com-interface-definition ( definition -- ) : save-com-interface-definition ( definition -- )
dup name>> +com-interface-definitions+ get-global set-at ; dup word>> +com-interface-definitions+ get-global set-at ;
: (parse-com-function) ( tokens -- definition ) : (parse-com-function) ( tokens -- definition )
[ second ] [ second ]
[ first ] [ first ]
[ 3 tail [ CHAR: , swap remove ] map 2 group { "void*" "this" } prefix ] [
tri 3 tail [ CHAR: , swap remove ] map
2 group [ first2 normalize-c-arg 2array ] map
{ void* "this" } prefix
] tri
<com-function-definition> ; <com-function-definition> ;
: parse-com-functions ( -- functions ) : parse-com-functions ( -- functions )
@ -48,10 +51,11 @@ unless
[ (parse-com-function) ] map ; [ (parse-com-function) ] map ;
: (iid-word) ( definition -- word ) : (iid-word) ( definition -- word )
name>> "-iid" append create-in ; word>> name>> "-iid" append create-in ;
: (function-word) ( function interface -- word ) : (function-word) ( function interface -- word )
name>> "::" rot name>> 3append create-in ; swap [ word>> name>> "::" ] [ name>> ] bi*
3append create-in ;
: family-tree ( definition -- definitions ) : family-tree ( definition -- definitions )
dup parent>> [ family-tree ] [ { } ] if* dup parent>> [ family-tree ] [ { } ] if*
@ -79,7 +83,7 @@ unless
: define-words-for-com-interface ( definition -- ) : define-words-for-com-interface ( definition -- )
[ [ (iid-word) ] [ iid>> 1quotation ] bi (( -- iid )) define-declared ] [ [ (iid-word) ] [ iid>> 1quotation ] bi (( -- iid )) define-declared ]
[ name>> "com-interface" swap typedef ] [ word>> void* swap typedef ]
[ [
dup family-tree-functions dup family-tree-functions
[ (define-word-for-function) ] with each-index [ (define-word-for-function) ] with each-index
@ -89,8 +93,8 @@ unless
PRIVATE> PRIVATE>
SYNTAX: COM-INTERFACE: SYNTAX: COM-INTERFACE:
scan CREATE-C-TYPE
scan find-com-interface-definition scan-object find-com-interface-definition
scan string>guid scan string>guid
parse-com-functions parse-com-functions
<com-interface-definition> <com-interface-definition>

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2006 Doug Coleman. ! Copyright (C) 2005, 2006 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax alien.destructors kernel windows.types USING: alien alien.c-types alien.syntax alien.destructors
math.bitwise ; kernel windows.types math.bitwise ;
IN: windows.gdi32 IN: windows.gdi32
CONSTANT: BI_RGB 0 CONSTANT: BI_RGB 0

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2006 Doug Coleman. ! Copyright (C) 2005, 2006 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax kernel windows.types multiline USING: alien alien.c-types alien.syntax kernel windows.types
classes.struct ; multiline classes.struct ;
IN: windows.kernel32 IN: windows.kernel32
CONSTANT: MAX_PATH 260 CONSTANT: MAX_PATH 260
@ -543,7 +543,7 @@ STRUCT: DCB
TYPEDEF: DCB* PDCB TYPEDEF: DCB* PDCB
TYPEDEF: DCB* LPDCB TYPEDEF: DCB* LPDCB
STRUCT: COMM_CONFIG STRUCT: COMMCONFIG
{ dwSize DWORD } { dwSize DWORD }
{ wVersion WORD } { wVersion WORD }
{ wReserved WORD } { wReserved WORD }

View File

@ -111,10 +111,6 @@ CONSTANT: COINIT_SPEED_OVER_MEMORY 8
FUNCTION: HRESULT OleInitialize ( void* reserved ) ; FUNCTION: HRESULT OleInitialize ( void* reserved ) ;
FUNCTION: HRESULT CoInitializeEx ( void* reserved, DWORD dwCoInit ) ; FUNCTION: HRESULT CoInitializeEx ( void* reserved, DWORD dwCoInit ) ;
FUNCTION: HRESULT RegisterDragDrop ( HWND hWnd, IDropTarget* pDropTarget ) ;
FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd ) ;
FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ;
: succeeded? ( hresult -- ? ) : succeeded? ( hresult -- ? )
0 HEX: 7FFFFFFF between? ; 0 HEX: 7FFFFFFF between? ;

4
basis/windows/shell32/shell32.factor Normal file → Executable file
View File

@ -3,8 +3,8 @@
USING: alien alien.c-types alien.strings alien.syntax USING: alien alien.c-types alien.strings alien.syntax
classes.struct combinators io.encodings.utf16n io.files classes.struct combinators io.encodings.utf16n io.files
io.pathnames kernel windows.errors windows.com io.pathnames kernel windows.errors windows.com
windows.com.syntax windows.user32 windows.ole32 windows windows.com.syntax windows.types windows.user32
specialized-arrays ; windows.ole32 windows specialized-arrays ;
SPECIALIZED-ARRAY: ushort SPECIALIZED-ARRAY: ushort
IN: windows.shell32 IN: windows.shell32

View File

@ -61,6 +61,7 @@ TYPEDEF: ulong ULONG_PTR
TYPEDEF: int INT32 TYPEDEF: int INT32
TYPEDEF: uint UINT32 TYPEDEF: uint UINT32
TYPEDEF: uint DWORD32 TYPEDEF: uint DWORD32
TYPEDEF: long LONG32
TYPEDEF: ulong ULONG32 TYPEDEF: ulong ULONG32
TYPEDEF: ulonglong ULONG64 TYPEDEF: ulonglong ULONG64
TYPEDEF: long* POINTER_32 TYPEDEF: long* POINTER_32
@ -75,6 +76,8 @@ TYPEDEF: longlong LARGE_INTEGER
TYPEDEF: ulonglong ULARGE_INTEGER TYPEDEF: ulonglong ULARGE_INTEGER
TYPEDEF: LARGE_INTEGER* PLARGE_INTEGER TYPEDEF: LARGE_INTEGER* PLARGE_INTEGER
TYPEDEF: ULARGE_INTEGER* PULARGE_INTEGER TYPEDEF: ULARGE_INTEGER* PULARGE_INTEGER
TYPEDEF: size_t SIZE_T
TYPEDEF: ptrdiff_t SSIZE_T
TYPEDEF: wchar_t* LPCSTR TYPEDEF: wchar_t* LPCSTR
TYPEDEF: wchar_t* LPWSTR TYPEDEF: wchar_t* LPWSTR
@ -201,15 +204,6 @@ TYPEDEF: LONG_PTR SSIZE_T
TYPEDEF: LONGLONG USN TYPEDEF: LONGLONG USN
TYPEDEF: UINT_PTR WPARAM TYPEDEF: UINT_PTR WPARAM
TYPEDEF: RECT* LPRECT
TYPEDEF: void* PWNDCLASS
TYPEDEF: void* PWNDCLASSEX
TYPEDEF: void* LPWNDCLASS
TYPEDEF: void* LPWNDCLASSEX
TYPEDEF: void* MSGBOXPARAMSA
TYPEDEF: void* MSGBOXPARAMSW
TYPEDEF: void* LPOVERLAPPED_COMPLETION_ROUTINE
TYPEDEF: size_t socklen_t TYPEDEF: size_t socklen_t
TYPEDEF: void* WNDPROC TYPEDEF: void* WNDPROC
@ -343,6 +337,14 @@ TYPEDEF: PFD* LPPFD
TYPEDEF: HANDLE HGLRC TYPEDEF: HANDLE HGLRC
TYPEDEF: HANDLE HRGN TYPEDEF: HANDLE HRGN
TYPEDEF: void* PWNDCLASS
TYPEDEF: void* PWNDCLASSEX
TYPEDEF: void* LPWNDCLASS
TYPEDEF: void* LPWNDCLASSEX
TYPEDEF: void* MSGBOXPARAMSA
TYPEDEF: void* MSGBOXPARAMSW
TYPEDEF: void* LPOVERLAPPED_COMPLETION_ROUTINE
STRUCT: LVITEM STRUCT: LVITEM
{ mask uint } { mask uint }
{ iItem int } { iItem int }

View File

@ -1,8 +1,8 @@
! Copyright (C) 2005, 2006 Doug Coleman. ! Copyright (C) 2005, 2006 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax parser namespaces kernel math USING: alien alien.c-types alien.syntax parser namespaces
windows.types generalizations math.bitwise classes.struct kernel math windows.types generalizations math.bitwise
literals ; classes.struct literals windows.kernel32 ;
IN: windows.user32 IN: windows.user32
! HKL for ActivateKeyboardLayout ! HKL for ActivateKeyboardLayout

View File

@ -1,6 +1,7 @@
! Copyright (C) 2009 Doug Coleman. ! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.destructors classes.struct ; USING: alien.c-types alien.syntax alien.destructors classes.struct
windows.types ;
IN: windows.usp10 IN: windows.usp10
LIBRARY: usp10 LIBRARY: usp10
@ -56,6 +57,9 @@ SCRIPT_JUSTIFFY_RESERVED4 ;
STRUCT: SCRIPT_VISATTR STRUCT: SCRIPT_VISATTR
{ flags WORD } ; { flags WORD } ;
TYPEDEF: void* SCRIPT_CACHE*
TYPEDEF: void* ABC*
FUNCTION: HRESULT ScriptShape ( FUNCTION: HRESULT ScriptShape (
HDC hdc, HDC hdc,
SCRIPT_CACHE* psc, SCRIPT_CACHE* psc,