LW-WIN - Some Win32-specific functions for LispWorks


 

Abstract

LW-WIN is a collection of re-usable Win32-specific functions and macros I wrote for various projects.

The code has been developed and used with LispWorks 4.4.6, 5.0.2, and 5.1 for Windows.

It comes with a BSD-style license so you can basically do with it whatever you want.

Download shortcut: http://weitz.de/files/lw-win.tar.gz.


 

Contents

  1. Download and installation
  2. Symbol index
  3. Colors
  4. Locales
  5. Mapping files
  6. Conditions
  7. Acknowledgements

 

Download and installation

LW-WIN together with this documentation can be downloaded from http://weitz.de/files/lw-win.tar.gz. The current version is 0.1.1.

LW-WIN comes with a system definition for ASDF and with one for LispWorks' Common Defsystem.
 

Colors


[Function]
get-sys-color index => color-spec


Returns a CAPI RGB color specification corresponding to the integer identifier index if the color is supported. Returns NIL otherwise.

index should be one of the constants listed below.

See the code of the MIDGETS library for an example usage of this function.


[Constants]
+color-highlight+
+color-highlighttext+
+color-inactivecaption+
+color-inactivecaptiontext+
+color-window+
+color-windowtext+


These are values that can be used for the index parameter in GET-SYS-COLOR. They correspond to the Win32 constants with the "same" (except for hyphens etc.) name, so their meaning should be fairly obvious.

 

Locales


[Function]
get-month-names => list


Returns a list of all twelve (long) month names (beginning with the name for January) as specified by the current Windows locale.


[Function]
get-weekday-names => list


Returns a list of all seven (long) weekday names (beginning with the name for Monday) as specified by the current Windows locale.


[Function]
get-first-day-of-week => integer


Returns the first day of the week as specified by the current Windows locale as an integer - 0 is Monday, 1 is Tuesday, and so on.

 

Mapping files


[Macro]
with-mapped-file (pointer pathspec &key file-offset number-of-octets) declaration* statement* => result


Executes the code in the body with number-of-octets octecs of the contents of the file denoted by the pathname designator pathspec beginning at octet position file-offset mapped into RAM. The contents are accessible beginning at the position denoted by the FLI pointer pointer.

Note that not all values for file-offset are legal. See the MSDN documentation for details.

See the CL-DONGLE library for an example usage of this macro.


 

Conditions


[Condition type]
win32-condition


Conditions of this type are signalled when errors resulting from calls into the Win32 API are caught. The conditions contain the original numerical error code as well as a human-readable string explaining the type of the error.


[Readers]
error-code win32-condition => error-code
error-message win32-condition => error-message


Readers to access the original error code and message of a WIN32-CONDITION.


[Condition type]
win32-error


A subclass of WIN32-CONDITION for errors.


[Condition type]
win32-warning


A subclass of WIN32-CONDITION for warnings.


[Function]
signal-last-error &key error-code warnp format => |


Retrieves the last error code from Windows (or uses error-code if supplied) and signals a corresponding Lisp error of type WIN-32-ERROR (or a warning of type WIN-32-WARNING if warnp is true).

Uses format (if supplied) to format the error message.

The default value for error-code, warnp, and format is NIL.


[Macro]
with-error-check () statement* => result


Executes the code in the body and returns the result of the last form as result, but first checks result. It it is the number zero (0), a null pointer, or NIL, SIGNAL-LAST-ERROR is called.

This is a convenience macro for the many cases where a Win32 function returns zero or a null pointer in case of an error.


 

Symbol index

Here are all exported symbols of LW-WIN in alphabetical order linked to their corresponding entries:
 

Acknowledgements

This documentation was prepared with DOCUMENTATION-TEMPLATE.

$Header: /usr/local/cvsrep/lw-win/doc/index.html,v 1.8 2010/08/10 17:31:03 edi Exp $

BACK TO MY HOMEPAGE