Re: idiom for cleanup + abort

From: Joel Reymont <joelr1_at_gmail.com>
Date: Sat, 31 Jan 2009 09:01:47 +0000

On Jan 31, 2009, at 3:36 AM, Dennis Ruffer wrote:

> Otherwise, you have to discard the number of stack items
> within a DUP IF ... THEN phrase, making sure you preserve the TOS for
> the THROW.

I wrote up this for now

: LOOKUP-BLOCK-STORAGE-SERVICE ( -- svc | )
    \ IOBlockStorageServices is our child in the I/O registry
    ZSTR "IOBlockStorageServices" IOServiceMatching ( dictRef *)
    ?DUP 0= ABORT" IOServiceMatching did not return a dictionary"
    \ create an iterator over all matching IOService nubs
    kIOMasterPortDefault OVER ITERATOR IOServiceGetMatchingServices
    \ want KERN_SUCCESS here, i.e. 0 and need to release dictRef
otherwise
    IF CFRelease -1 ABORT" IOServiceGetMatchingServices failed" THEN
    ...

---
http://tinyco.de
--- Mac & iPhone
----------------------------------------------------------------------
sftalk_at_forth.com      The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users.  For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sat Jan 31 2009 - 01:02:15 PST

Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.