Menu

#1 Extra definitions for an enhanced system

open
nobody
None
5
2003-10-03
2003-07-17
Mark Hurd
No

extra.lisp is my extension to Rich's base boot.lisp. I
override a couple of his definitions and extend some
others. The important features:

* Reflection

Very useful to navigate around the .NET Framework (and
other classes) without using a class browser.

* P/Invoke

Gives access to the rest of the Win32 API.

* Late binding

Gives access to ActiveX (COM) objects.

* with-dispose

Like lets with each object originally assigned being
disposed, irrespective of what happens to the variable it
is assigned to.

Plus a range of other tools and things I thought I might
use again. There's a lot of useful stuff, some stuff that
ought to be optimised and some that is too specific to
my enmvironment and VB leanings. There's also some
code designed for earlier builds of DotLisp that could be
removed.

Documentation is minimal. Leave a note in the forums
here if you can't work out how to use something.

Discussion

  • Mark Hurd

    Mark Hurd - 2003-07-17

    Extensions to the basic DotLisp

     
  • Nobody/Anonymous

    Logged In: NO

    Very nice and interesting enhancements.

    Can you give examples with Win32API and ActiveX?

    Hans-Peter

     
  • Mark Hurd

    Mark Hurd - 2003-10-03

    Logged In: YES
    user_id=820378

    Hans-Peter: There's a simple FileSystemObject COM example
    in the comments. Here's a contrived COM and Win32API
    example:

    I've uploaded my latest version of extra.lisp. Here's a quick
    list of changes:
    - lists as sets use eqv?, not eql?
    - congruent? to compare lists as sets
    - superset & subset -> superset? & subset?
    - intersection simplified
    - uniq bug fix on empty list and reworked
    - set-nth (nth setter) bug fix, off by one error
    - type refection display skips attributes by default
    - event-info to display details about one event
    - type-info displays Sealed/Abstract status (using VB.NET
    terms)
    - late-set is the setter for late-get
    - pp now prints quotes, backquotes and vectors in their
    reader macro forms
    - (between x lower-bound upper-bound) where _ means
    infinity for upper-bound and negative infinity for lower-bound.
    - @ prnf prf use .NET Framework format strings
    - (edit filename) opens filename in Notepad
    - macroexpand and macroexpand-all extend macroexpand-1
    symplisticly
    - enum-matches enumerates over regular expression match
    results (the enum corresponding to for-each-match that was
    already defined)

    There's still much only useful to me and some not generic
    enough yet, but I hope people are finding uses for it and
    ideas from it.

     
  • Mark Hurd

    Mark Hurd - 2003-10-03

    Updated file with described changes

     
  • Mark Hurd

    Mark Hurd - 2003-10-03
    • summary: Extra defintions for an enhanced system --> Extra definitions for an enhanced system
     
  • Mark Hurd

    Mark Hurd - 2003-10-03

    Logged In: YES
    user_id=820378

    Instead of the intended "contrived COM and Win32API
    example", here's a Win2API sample:

    (PInvoke-declare SendMessage :Lib "User32"
    :Args (vector-of Type.
    IntPtr. Int32. Int32. Int32.)
    :Return-Type Int32.)
    (PInvoke-declare MessageBeep :Lib "user32"
    :Args (vector-of Type.
    MessageBoxIcon.)
    :Return-Type Boolean.)
    (PInvoke-declare MessageBox :Lib "user32"
    :Args (vector-of Type.
    IntPtr. String. String. MessageBoxIcon. )
    :Return-Type DialogResult.)
    (PInvoke-declare GetShellWindow :Lib "user32"
    :Return-Type IntPtr.)

    ; Standard message box with beep, but only
    ; "above" the desktop:
    (MessageBeep MessageBoxIcon:Warning)
    (MessageBox (GetShellWindow)
    "Hello, World!\r\n\r\nScreen will blank now."
    "P/Invoke Working..."
    MessageBoxIcon:Warning)

    ; On Window 2000 and XP, when you've got
    ; a monitor that can powersave, this instantly
    ; blanks the screen.
    (set HWND_BROADCAST (IntPtr:op_Explicit -1)
    WM_SYSCOMMAND (Int32:Parse "112"
    NumberStyles:HexNumber)
    SC_MONITORPOWER (Int32:Parse "F170"
    NumberStyles:HexNumber)
    nMode 1)
    (dotimes i 1000
    (SendMessage HWND_BROADCAST WM_SYSCOMMAND
    SC_MONITORPOWER nMode))

    and another COM example:

    (set IEs (create-object "Shell.Application"))
    (set Ws (late Windows IEs))
    (dotimes i (late-get Count Ws)
    (let (W (late Item Ws i))
    (prns (late-get Name W))
    (prns (late-get LocationUrl W))
    ))

     
  • Nobody/Anonymous

    Logged In: NO

    Hello Mark,

    thanks to Southern Australia for sharing the code!

    > .. but I hope people are finding uses for it and ideas from it.

    For me it has yet happend. I hope others will also do.

    When you have other usefull stuff, please post!

    Hans-Peter
    Germany

     
  • Mark Hurd

    Mark Hurd - 2005-03-11

    Logged In: YES
    user_id=820378

    extra.lisp has been added to (and changed a bit) over the last
    18 months. See
    http://www.ozemail.com.au/~markhurd/DotLispPatch.html
    for my latest version.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.