[MLton-commit] r5286
Vesa Karvonen
vesak at mlton.org
Wed Feb 21 07:27:15 PST 2007
Extract C preprocessor defined constants from <windows.h> with cpp, awk,
and sed.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/windows/unstable/Makefile
A mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp
U mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h
U mltonlib/trunk/com/ssh/windows/unstable/detail/lib/windows.c
U mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml
U mltonlib/trunk/com/ssh/windows/unstable/lib.mlb
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/windows/unstable/Makefile
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/Makefile 2007-02-21 12:29:08 UTC (rev 5285)
+++ mltonlib/trunk/com/ssh/windows/unstable/Makefile 2007-02-21 15:27:12 UTC (rev 5286)
@@ -27,6 +27,9 @@
def-use-file := $(gen-dir)/lib.du
+constants-sml := $(gen-dir)/constants.sml
+constants-cpp := detail/constants.sml.cpp
+
##########################################################################
.PHONY : all clean help check
@@ -38,12 +41,12 @@
@echo " clean Removes generated files"
@echo " help Prints this message"
-all : $(lib-file) $(nlffi-mlb)
+all : $(lib-file) $(nlffi-mlb) $(constants-sml)
clean :
- rm -rf $(bin-dir) $(gen-dir) $(lib-file) $(def-use-file)
+ rm -rf $(bin-dir) $(gen-dir) $(lib-file)
-check : $(nlffi-mlb) $(mlb-path-map)
+check : $(nlffi-mlb) $(mlb-path-map) $(constants-sml)
mlton -stop tc \
-mlb-path-map $(mlb-path-map) \
-prefer-abs-paths true \
@@ -52,6 +55,18 @@
##########################################################################
+$(constants-sml) : $(constants-cpp) $(ffi-h-files) Makefile
+ mkdir -p $(@D)
+ cat $< | cpp -E -P \
+ | awk '/(* begin *)/, /(* end *)/' \
+ | sed -e 's#< *(\?#<#g' -e 's#)\? *>#>#g' \
+ -e 's#<(.*)#<#g' \
+ -e 's#\([0-9]\)[lL]>#\1>#g' \
+ -e 's#<0[xX]#<x#g' \
+ -e 's#<#<0w#g' \
+ -e 's#<\(.*\)>#\1#g' \
+ > $@
+
$(mlb-path-map) : Makefile
echo 'MLTON_LIB $(shell cd ../../../.. && pwd)' > $@
echo 'SML_COMPILER mlton' >> $@
Added: mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp 2007-02-21 12:29:08 UTC (rev 5285)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp 2007-02-21 15:27:12 UTC (rev 5286)
@@ -0,0 +1,27 @@
+-*- sml -*-
+
+#include <windows.h>
+
+(* begin *)
+(* Copyright (C) 2007 SSH Communications Security, Helsinki, Finland
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+structure Windows = struct
+
+#define C_CODE(_)
+
+#define WIN_CONST(name, type) val wc_##name = wt_##type <name>
+
+fun wt_DWORD x : Word32.t = x
+fun wt_WORD x : Word16.t = x
+fun wt_REGSAM x : Word32.t = x
+fun wt_HKEY x : C.voidptr =
+ C_Int.mk_voidptr let open MLton.Pointer in add (null, x) end
+
+#include "detail/ffi/windows.h"
+
+end
+(* end *)
Property changes on: mltonlib/trunk/com/ssh/windows/unstable/detail/constants.sml.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h 2007-02-21 12:29:08 UTC (rev 5285)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/ffi/windows.h 2007-02-21 15:27:12 UTC (rev 5286)
@@ -13,190 +13,194 @@
/************************************************************************/
+#ifndef C_CODE
+# define C_CODE(x) x;
+#endif
+
#ifndef WIN_TYPEDEF
-# define WIN_TYPEDEF(name, type) typedef type name
+# define WIN_TYPEDEF(name, type) C_CODE(typedef type name)
#endif
#ifndef WIN_CONST
-# define WIN_CONST(name, type) extern type win_##name
+# define WIN_CONST(name, type)
#endif
#ifndef WIN_FUNCTION
-# define WIN_FUNCTION(name, result, arity, args) extern result win_##name args
+# define WIN_FUNCTION(name, result, arity, args) C_CODE(result win_##name args)
#endif
/************************************************************************/
-WIN_TYPEDEF(LPVOID, void *);
+WIN_TYPEDEF(LPVOID, void *)
-WIN_TYPEDEF(BOOL, int);
-WIN_TYPEDEF(BYTE, unsigned char);
-WIN_TYPEDEF(WORD, unsigned short);
-WIN_TYPEDEF(DWORD, unsigned long);
-WIN_TYPEDEF(LONG, long);
-WIN_TYPEDEF(LONGLONG, long long);
+WIN_TYPEDEF(BOOL, int)
+WIN_TYPEDEF(BYTE, unsigned char)
+WIN_TYPEDEF(WORD, unsigned short)
+WIN_TYPEDEF(DWORD, unsigned long)
+WIN_TYPEDEF(LONG, long)
+WIN_TYPEDEF(LONGLONG, long long)
-WIN_TYPEDEF(LPBYTE, BYTE *);
-WIN_TYPEDEF(LPDWORD, DWORD *);
-WIN_TYPEDEF(LPLONG, LONG *);
+WIN_TYPEDEF(LPBYTE, BYTE *)
+WIN_TYPEDEF(LPDWORD, DWORD *)
+WIN_TYPEDEF(LPLONG, LONG *)
-WIN_TYPEDEF(LPCTSTR, const char *);
-WIN_TYPEDEF(LPTSTR, char *);
+WIN_TYPEDEF(LPCTSTR, const char *)
+WIN_TYPEDEF(LPTSTR, char *)
-WIN_TYPEDEF(LPSECURITY_ATTRIBUTES, void *);
-WIN_TYPEDEF(PFILETIME, void *);
+WIN_TYPEDEF(LPSECURITY_ATTRIBUTES, void *)
+WIN_TYPEDEF(PFILETIME, void *)
/************************************************************************/
-WIN_FUNCTION(GetLastError, DWORD, 0, (void));
+WIN_FUNCTION(GetLastError, DWORD, 0, (void))
-WIN_CONST(ERROR_INSUFFICIENT_BUFFER, DWORD);
-WIN_CONST(ERROR_MORE_DATA, DWORD);
-WIN_CONST(ERROR_NO_MORE_ITEMS, DWORD);
-WIN_CONST(ERROR_SUCCESS, DWORD);
+WIN_CONST(ERROR_INSUFFICIENT_BUFFER, DWORD)
+WIN_CONST(ERROR_MORE_DATA, DWORD)
+WIN_CONST(ERROR_NO_MORE_ITEMS, DWORD)
+WIN_CONST(ERROR_SUCCESS, DWORD)
/************************************************************************/
-WIN_TYPEDEF(HMODULE, void *);
+WIN_TYPEDEF(HMODULE, void *)
-WIN_FUNCTION(GetModuleFileName, DWORD, 3, (HMODULE, LPTSTR, DWORD));
+WIN_FUNCTION(GetModuleFileName, DWORD, 3, (HMODULE, LPTSTR, DWORD))
/************************************************************************/
-WIN_FUNCTION(GetShortPathName, DWORD, 3, (LPCTSTR, LPTSTR, DWORD));
+WIN_FUNCTION(GetShortPathName, DWORD, 3, (LPCTSTR, LPTSTR, DWORD))
/************************************************************************/
-WIN_TYPEDEF(HLOCAL, void *);
+WIN_TYPEDEF(HLOCAL, void *)
-WIN_FUNCTION(LocalFree, HLOCAL, 1, (HLOCAL));
+WIN_FUNCTION(LocalFree, HLOCAL, 1, (HLOCAL))
/************************************************************************/
-WIN_TYPEDEF(HKEY, void *);
+WIN_TYPEDEF(HKEY, void *)
-WIN_CONST(HKEY_CLASSES_ROOT, HKEY);
-WIN_CONST(HKEY_CURRENT_CONFIG, HKEY);
-WIN_CONST(HKEY_CURRENT_USER, HKEY);
-WIN_CONST(HKEY_DYN_DATA, HKEY);
-WIN_CONST(HKEY_LOCAL_MACHINE, HKEY);
-WIN_CONST(HKEY_PERFORMANCE_DATA, HKEY);
-WIN_CONST(HKEY_USERS, HKEY);
+WIN_CONST(HKEY_CLASSES_ROOT, HKEY)
+WIN_CONST(HKEY_CURRENT_CONFIG, HKEY)
+WIN_CONST(HKEY_CURRENT_USER, HKEY)
+WIN_CONST(HKEY_DYN_DATA, HKEY)
+WIN_CONST(HKEY_LOCAL_MACHINE, HKEY)
+WIN_CONST(HKEY_PERFORMANCE_DATA, HKEY)
+WIN_CONST(HKEY_USERS, HKEY)
-WIN_TYPEDEF(PHKEY, HKEY *);
+WIN_TYPEDEF(PHKEY, HKEY *)
-WIN_TYPEDEF(REGSAM, unsigned long);
+WIN_TYPEDEF(REGSAM, unsigned long)
-WIN_CONST(KEY_ALL_ACCESS, REGSAM);
-WIN_CONST(KEY_CREATE_LINK, REGSAM);
-WIN_CONST(KEY_CREATE_SUB_KEY, REGSAM);
-WIN_CONST(KEY_ENUMERATE_SUB_KEYS, REGSAM);
-WIN_CONST(KEY_EXECUTE, REGSAM);
-WIN_CONST(KEY_NOTIFY, REGSAM);
-WIN_CONST(KEY_QUERY_VALUE, REGSAM);
-WIN_CONST(KEY_READ, REGSAM);
-WIN_CONST(KEY_SET_VALUE, REGSAM);
-WIN_CONST(KEY_WRITE, REGSAM);
+WIN_CONST(KEY_ALL_ACCESS, REGSAM)
+WIN_CONST(KEY_CREATE_LINK, REGSAM)
+WIN_CONST(KEY_CREATE_SUB_KEY, REGSAM)
+WIN_CONST(KEY_ENUMERATE_SUB_KEYS, REGSAM)
+WIN_CONST(KEY_EXECUTE, REGSAM)
+WIN_CONST(KEY_NOTIFY, REGSAM)
+WIN_CONST(KEY_QUERY_VALUE, REGSAM)
+WIN_CONST(KEY_READ, REGSAM)
+WIN_CONST(KEY_SET_VALUE, REGSAM)
+WIN_CONST(KEY_WRITE, REGSAM)
-WIN_CONST(REG_BINARY, DWORD);
-WIN_CONST(REG_DWORD, DWORD);
-WIN_CONST(REG_DWORD_LITTLE_ENDIAN, DWORD);
-WIN_CONST(REG_DWORD_BIG_ENDIAN, DWORD);
-WIN_CONST(REG_EXPAND_SZ, DWORD);
-WIN_CONST(REG_LINK, DWORD);
-WIN_CONST(REG_MULTI_SZ, DWORD);
-WIN_CONST(REG_NONE, DWORD);
-WIN_CONST(REG_QWORD, DWORD);
-WIN_CONST(REG_QWORD_LITTLE_ENDIAN, DWORD);
-WIN_CONST(REG_SZ, DWORD);
+WIN_CONST(REG_BINARY, DWORD)
+WIN_CONST(REG_DWORD, DWORD)
+WIN_CONST(REG_DWORD_LITTLE_ENDIAN, DWORD)
+WIN_CONST(REG_DWORD_BIG_ENDIAN, DWORD)
+WIN_CONST(REG_EXPAND_SZ, DWORD)
+WIN_CONST(REG_LINK, DWORD)
+WIN_CONST(REG_MULTI_SZ, DWORD)
+WIN_CONST(REG_NONE, DWORD)
+WIN_CONST(REG_QWORD, DWORD)
+WIN_CONST(REG_QWORD_LITTLE_ENDIAN, DWORD)
+WIN_CONST(REG_SZ, DWORD)
-WIN_CONST(REG_CREATED_NEW_KEY, DWORD);
-WIN_CONST(REG_OPENED_EXISTING_KEY, DWORD);
+WIN_CONST(REG_CREATED_NEW_KEY, DWORD)
+WIN_CONST(REG_OPENED_EXISTING_KEY, DWORD)
-WIN_FUNCTION(RegCloseKey, LONG, 1, (HKEY));
+WIN_FUNCTION(RegCloseKey, LONG, 1, (HKEY))
WIN_FUNCTION(RegCreateKeyEx, LONG, 9,
(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM,
- LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD));
-WIN_FUNCTION(RegDeleteKey, LONG, 2, (HKEY, LPCTSTR));
-WIN_FUNCTION(RegDeleteValue, LONG, 2, (HKEY, LPCTSTR));
+ LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD))
+WIN_FUNCTION(RegDeleteKey, LONG, 2, (HKEY, LPCTSTR))
+WIN_FUNCTION(RegDeleteValue, LONG, 2, (HKEY, LPCTSTR))
WIN_FUNCTION(RegEnumKeyEx, LONG, 8,
(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPTSTR, LPDWORD,
- PFILETIME));
+ PFILETIME))
WIN_FUNCTION(RegEnumValue, LONG, 8,
- (HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD));
-WIN_FUNCTION(RegOpenKeyEx, LONG, 5, (HKEY, LPCTSTR, DWORD, REGSAM, PHKEY));
+ (HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD))
+WIN_FUNCTION(RegOpenKeyEx, LONG, 5, (HKEY, LPCTSTR, DWORD, REGSAM, PHKEY))
WIN_FUNCTION(RegQueryValueEx, LONG, 6,
- (HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD));
+ (HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD))
WIN_FUNCTION(RegSetValueEx, LONG, 6,
- (HKEY, LPCTSTR, DWORD, DWORD, const BYTE *, DWORD));
+ (HKEY, LPCTSTR, DWORD, DWORD, const BYTE *, DWORD))
/************************************************************************/
-WIN_CONST(EVENTLOG_ERROR_TYPE, WORD);
-WIN_CONST(EVENTLOG_AUDIT_FAILURE, WORD);
-WIN_CONST(EVENTLOG_AUDIT_SUCCESS, WORD);
-WIN_CONST(EVENTLOG_INFORMATION_TYPE, WORD);
-WIN_CONST(EVENTLOG_WARNING_TYPE, WORD);
+WIN_CONST(EVENTLOG_ERROR_TYPE, WORD)
+WIN_CONST(EVENTLOG_AUDIT_FAILURE, WORD)
+WIN_CONST(EVENTLOG_AUDIT_SUCCESS, WORD)
+WIN_CONST(EVENTLOG_INFORMATION_TYPE, WORD)
+WIN_CONST(EVENTLOG_WARNING_TYPE, WORD)
/************************************************************************/
-WIN_TYPEDEF(HANDLE, void *);
+WIN_TYPEDEF(HANDLE, void *)
-WIN_FUNCTION(CloseHandle, BOOL, 1, (HANDLE));
+WIN_FUNCTION(CloseHandle, BOOL, 1, (HANDLE))
/************************************************************************/
-WIN_CONST(WAIT_OBJECT_0, DWORD);
-WIN_CONST(WAIT_ABANDONED_0, DWORD);
-WIN_CONST(WAIT_IO_COMPLETION, DWORD);
-WIN_CONST(WAIT_TIMEOUT, DWORD);
-WIN_CONST(WAIT_FAILED, DWORD);
+WIN_CONST(WAIT_OBJECT_0, DWORD)
+WIN_CONST(WAIT_ABANDONED_0, DWORD)
+WIN_CONST(WAIT_IO_COMPLETION, DWORD)
+WIN_CONST(WAIT_TIMEOUT, DWORD)
+WIN_CONST(WAIT_FAILED, DWORD)
-WIN_CONST(INFINITE, DWORD);
+WIN_CONST(INFINITE, DWORD)
WIN_FUNCTION(WaitForMultipleObjectsEx, DWORD, 5,
- (DWORD, const HANDLE *, BOOL, DWORD, BOOL));
+ (DWORD, const HANDLE *, BOOL, DWORD, BOOL))
WIN_FUNCTION(WaitForMultipleObjects, DWORD, 4,
- (DWORD, const HANDLE *, BOOL, DWORD));
+ (DWORD, const HANDLE *, BOOL, DWORD))
/************************************************************************/
WIN_FUNCTION(CreateSemaphore, HANDLE, 4,
- (LPSECURITY_ATTRIBUTES, LONG, LONG, LPCTSTR));
-WIN_FUNCTION(ReleaseSemaphore, BOOL, 3, (HANDLE, LONG, LPLONG));
+ (LPSECURITY_ATTRIBUTES, LONG, LONG, LPCTSTR))
+WIN_FUNCTION(ReleaseSemaphore, BOOL, 3, (HANDLE, LONG, LPLONG))
/************************************************************************/
-WIN_FUNCTION(CreateMutex, HANDLE, 3, (LPSECURITY_ATTRIBUTES, BOOL, LPCTSTR));
-WIN_FUNCTION(ReleaseMutex, BOOL, 1, (HANDLE));
+WIN_FUNCTION(CreateMutex, HANDLE, 3, (LPSECURITY_ATTRIBUTES, BOOL, LPCTSTR))
+WIN_FUNCTION(ReleaseMutex, BOOL, 1, (HANDLE))
/************************************************************************/
WIN_FUNCTION(CreateWaitableTimer, HANDLE, 3,
- (LPSECURITY_ATTRIBUTES, BOOL, LPCTSTR));
-WIN_FUNCTION(CancelWaitableTimer, BOOL, 1, (HANDLE));
+ (LPSECURITY_ATTRIBUTES, BOOL, LPCTSTR))
+WIN_FUNCTION(CancelWaitableTimer, BOOL, 1, (HANDLE))
-BOOL win_SetWaitableTimer(HANDLE, LONGLONG, LONG, BOOL);
+C_CODE(BOOL win_SetWaitableTimer(HANDLE, LONGLONG, LONG, BOOL))
/************************************************************************/
-WIN_CONST(FILE_NOTIFY_CHANGE_ATTRIBUTES, DWORD);
-WIN_CONST(FILE_NOTIFY_CHANGE_DIR_NAME, DWORD);
-WIN_CONST(FILE_NOTIFY_CHANGE_FILE_NAME, DWORD);
-WIN_CONST(FILE_NOTIFY_CHANGE_LAST_WRITE, DWORD);
-WIN_CONST(FILE_NOTIFY_CHANGE_SECURITY, DWORD);
-WIN_CONST(FILE_NOTIFY_CHANGE_SIZE, DWORD);
+WIN_CONST(FILE_NOTIFY_CHANGE_ATTRIBUTES, DWORD)
+WIN_CONST(FILE_NOTIFY_CHANGE_DIR_NAME, DWORD)
+WIN_CONST(FILE_NOTIFY_CHANGE_FILE_NAME, DWORD)
+WIN_CONST(FILE_NOTIFY_CHANGE_LAST_WRITE, DWORD)
+WIN_CONST(FILE_NOTIFY_CHANGE_SECURITY, DWORD)
+WIN_CONST(FILE_NOTIFY_CHANGE_SIZE, DWORD)
-WIN_FUNCTION(FindFirstChangeNotification, HANDLE, 3, (LPCTSTR, BOOL, DWORD));
-WIN_FUNCTION(FindCloseChangeNotification, BOOL, 1, (HANDLE));
-WIN_FUNCTION(FindNextChangeNotification, BOOL, 1, (HANDLE));
+WIN_FUNCTION(FindFirstChangeNotification, HANDLE, 3, (LPCTSTR, BOOL, DWORD))
+WIN_FUNCTION(FindCloseChangeNotification, BOOL, 1, (HANDLE))
+WIN_FUNCTION(FindNextChangeNotification, BOOL, 1, (HANDLE))
/************************************************************************/
-WIN_FUNCTION(GetCurrentProcessId, DWORD, 0, (void));
+WIN_FUNCTION(GetCurrentProcessId, DWORD, 0, (void))
/************************************************************************/
-LPTSTR win_FormatErrorLocalAlloc(DWORD error);
+C_CODE(LPTSTR win_FormatErrorLocalAlloc(DWORD error))
#endif
Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/lib/windows.c
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/lib/windows.c 2007-02-21 12:29:08 UTC (rev 5285)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/lib/windows.c 2007-02-21 15:27:12 UTC (rev 5286)
@@ -23,20 +23,18 @@
extern int typedef_chk_a_##name[sizeof(typedef_fn_of_assumed_type_##name \
(typedef_val_of_actual_type_##name))]; \
extern int typedef_chk_b_##name[sizeof(typedef_fn_of_actual_type_##name \
- (typedef_val_of_assumed_type_##name))]
+ (typedef_val_of_assumed_type_##name))];
/************************************************************************/
-#define WIN_CONST(name, type) \
-typedef type type_of_##name; \
-const type_of_##name win_##name = name
+#define WIN_CONST(name, type)
/************************************************************************/
#define WIN_FUNCTION(name, result, arity, args) \
result win_##name FORMALS##arity args \
{ UNLESS(IS_VOID(result))(return) name ACTUALS##arity args; } \
-typedef result (type_of_##name) args
+typedef result (type_of_##name) args;
#define UNLESS(c) CONCAT(UNLESS, c)
#define UNLESS0(x) x
Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml 2007-02-21 12:29:08 UTC (rev 5285)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml 2007-02-21 15:27:12 UTC (rev 5286)
@@ -8,6 +8,8 @@
(* Implementation of Windows utilities. *)
structure Windows :> WINDOWS_EX = struct
+ open Windows
+
local
open Type Prettier
in
@@ -33,13 +35,9 @@
val op >>& = With.>>&
- local
- fun `x = C.Get.ulong' (x ())
- in
- val success = `G_win_ERROR_SUCCESS.obj'
- val noMoreItems = `G_win_ERROR_NO_MORE_ITEMS.obj'
- val moreData = `G_win_ERROR_MORE_DATA.obj'
- end
+ val success = wc_ERROR_SUCCESS
+ val noMoreItems = wc_ERROR_NO_MORE_ITEMS
+ val moreData = wc_ERROR_MORE_DATA
val getLastError = F_win_GetLastError.f
@@ -117,33 +115,29 @@
structure Key = struct
open BitFlags
- fun `x = SysWord.fromWord (C.Get.ulong' (x ()))
- val allAccess = `G_win_KEY_ALL_ACCESS.obj'
- val createLink = `G_win_KEY_CREATE_LINK.obj'
- val createSubKey = `G_win_KEY_CREATE_SUB_KEY.obj'
- val enumerateSubKeys = `G_win_KEY_ENUMERATE_SUB_KEYS.obj'
- val execute = `G_win_KEY_EXECUTE.obj'
- val notify = `G_win_KEY_NOTIFY.obj'
- val queryValue = `G_win_KEY_QUERY_VALUE.obj'
- val read = `G_win_KEY_READ.obj'
- val setValue = `G_win_KEY_SET_VALUE.obj'
- val write = `G_win_KEY_WRITE.obj'
+ val ` = SysWord.fromWord
+ val allAccess = `wc_KEY_ALL_ACCESS
+ val createLink = `wc_KEY_CREATE_LINK
+ val createSubKey = `wc_KEY_CREATE_SUB_KEY
+ val enumerateSubKeys = `wc_KEY_ENUMERATE_SUB_KEYS
+ val execute = `wc_KEY_EXECUTE
+ val notify = `wc_KEY_NOTIFY
+ val queryValue = `wc_KEY_QUERY_VALUE
+ val read = `wc_KEY_READ
+ val setValue = `wc_KEY_SET_VALUE
+ val write = `wc_KEY_WRITE
end
structure Reg = struct
type hkey = C.voidptr
- local
- fun `x = C.Get.voidptr' (x ())
- in
- val classesRoot = `G_win_HKEY_CLASSES_ROOT.obj'
- val currentConfig = `G_win_HKEY_CURRENT_CONFIG.obj'
- val currentUser = `G_win_HKEY_CURRENT_USER.obj'
- val dynData = `G_win_HKEY_DYN_DATA.obj'
- val localMachine = `G_win_HKEY_LOCAL_MACHINE.obj'
- val performanceData = `G_win_HKEY_PERFORMANCE_DATA.obj'
- val users = `G_win_HKEY_USERS.obj'
- end
+ val classesRoot = wc_HKEY_CLASSES_ROOT
+ val currentConfig = wc_HKEY_CURRENT_CONFIG
+ val currentUser = wc_HKEY_CURRENT_USER
+ val dynData = wc_HKEY_DYN_DATA
+ val localMachine = wc_HKEY_LOCAL_MACHINE
+ val performanceData = wc_HKEY_PERFORMANCE_DATA
+ val users = wc_HKEY_USERS
fun closeKey h =
raiseOnError (fn () => F"Reg.closeKey"[A ptr h])
@@ -163,8 +157,7 @@
F_win_RegCreateKeyEx.f'
(h, n', 0w0, null, 0w0, SysWord.toWord m, null,
C.Ptr.|&! hkResult, C.Ptr.|&! dwDisposition)
- ; (if C.Get.ulong' dwDisposition =
- C.Get.ulong' (G_win_REG_CREATED_NEW_KEY.obj' ())
+ ; (if C.Get.ulong' dwDisposition = wc_REG_CREATED_NEW_KEY
then CREATED_NEW_KEY
else OPENED_EXISTING_KEY) (C.Get.voidptr' hkResult)))
@@ -220,16 +213,12 @@
| SZ of String.t
local
- local
- fun `x = C.Get.ulong' (x ())
- in
- val binary = `G_win_REG_BINARY.obj'
- val dword = `G_win_REG_DWORD.obj'
- val expandSz = `G_win_REG_EXPAND_SZ.obj'
- val multiSz = `G_win_REG_MULTI_SZ.obj'
- val qword = `G_win_REG_QWORD.obj'
- val sz = `G_win_REG_SZ.obj'
- end
+ val binary = wc_REG_BINARY
+ val dword = wc_REG_DWORD
+ val expandSz = wc_REG_EXPAND_SZ
+ val multiSz = wc_REG_MULTI_SZ
+ val qword = wc_REG_QWORD
+ val sz = wc_REG_SZ
val toMultiSz = String.tokens (#"\000" <\ op =) o Byte.bytesToString
val toSz = hd o toMultiSz
@@ -293,13 +282,12 @@
structure EventLog = struct
structure Type = struct
open BitFlags
- val ` = SysWord.fromInt o MLRep.Short.Unsigned.toIntX o C.Get.ushort' o
- pass ()
- val auditFailure = `G_win_EVENTLOG_AUDIT_FAILURE.obj'
- val auditSuccess = `G_win_EVENTLOG_AUDIT_SUCCESS.obj'
- val error = `G_win_EVENTLOG_ERROR_TYPE.obj'
- val information = `G_win_EVENTLOG_INFORMATION_TYPE.obj'
- val warning = `G_win_EVENTLOG_WARNING_TYPE.obj'
+ val ` = SysWord.fromInt o Word16.toIntX
+ val auditFailure = `wc_EVENTLOG_AUDIT_FAILURE
+ val auditSuccess = `wc_EVENTLOG_AUDIT_SUCCESS
+ val error = `wc_EVENTLOG_ERROR_TYPE
+ val information = `wc_EVENTLOG_INFORMATION_TYPE
+ val warning = `wc_EVENTLOG_WARNING_TYPE
end
end
@@ -332,15 +320,11 @@
| OBJECT of 'a
| TIMEOUT
- local
- fun `x = C.Get.ulong' (x ())
- in
- val object = `G_win_WAIT_OBJECT_0.obj'
- val abandoned = `G_win_WAIT_ABANDONED_0.obj'
- val timeout = `G_win_WAIT_TIMEOUT.obj'
- val failed = `G_win_WAIT_FAILED.obj'
- val infinite = `G_win_INFINITE.obj'
- end
+ val object = wc_WAIT_OBJECT_0
+ val abandoned = wc_WAIT_ABANDONED_0
+ val timeout = wc_WAIT_TIMEOUT
+ val failed = wc_WAIT_FAILED
+ val infinite = wc_INFINITE
fun wait name all ws t = let
val n = Word.fromInt (length ws)
@@ -425,13 +409,13 @@
structure FileChange = struct
structure Filter = struct
open BitFlags
- fun `x = SysWord.fromWord (C.Get.ulong' (x ()))
- val attributes = `G_win_FILE_NOTIFY_CHANGE_ATTRIBUTES.obj'
- val dirName = `G_win_FILE_NOTIFY_CHANGE_DIR_NAME.obj'
- val fileName = `G_win_FILE_NOTIFY_CHANGE_FILE_NAME.obj'
- val lastWrite = `G_win_FILE_NOTIFY_CHANGE_LAST_WRITE.obj'
- val security = `G_win_FILE_NOTIFY_CHANGE_SECURITY.obj'
- val size = `G_win_FILE_NOTIFY_CHANGE_SIZE.obj'
+ val ` = SysWord.fromWord
+ val attributes = `wc_FILE_NOTIFY_CHANGE_ATTRIBUTES
+ val dirName = `wc_FILE_NOTIFY_CHANGE_DIR_NAME
+ val fileName = `wc_FILE_NOTIFY_CHANGE_FILE_NAME
+ val lastWrite = `wc_FILE_NOTIFY_CHANGE_LAST_WRITE
+ val security = `wc_FILE_NOTIFY_CHANGE_SECURITY
+ val size = `wc_FILE_NOTIFY_CHANGE_SIZE
end
type t = C.voidptr
Modified: mltonlib/trunk/com/ssh/windows/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/lib.mlb 2007-02-21 12:29:08 UTC (rev 5285)
+++ mltonlib/trunk/com/ssh/windows/unstable/lib.mlb 2007-02-21 15:27:12 UTC (rev 5286)
@@ -15,6 +15,12 @@
$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb
generated/$(TARGET_ARCH)-$(TARGET_OS)/nlffi/lib.mlb
+ local
+ $(SML_LIB)/basis/mlton.mlb
+ $(SML_LIB)/mlnlffi-lib/internals/c-int.mlb
+ in
+ generated/$(TARGET_ARCH)-$(TARGET_OS)/constants.sml
+ end
in
ann
"forceUsed"
More information about the MLton-commit
mailing list