
Untitled
By: a guest on
May 22nd, 2012 | syntax:
None | size: 0.78 KB | hits: 12 | expires: Never
/* Cifre Standard Library
(c) Jeremy Tregunna, 2006, All Rights Reserved.
This program is open source software, and redistributable under the terms
and conditions of the BSD Licence. */
require("Object")
System do(
openLibc := method(
/* Set up C library */
libcName := "libc.so"
case(
(System platform == "Darwin", libcName = "libSystem.dylib")
(System platform == "FreeBSD",
"""libc.so.#io{System platformVersion asMutable clipAfterStartOfSeq(".")}""" interpolate
)
(System platform == "Linux", libcName = "libc.so.6")
)
self libc := DynLib clone open(libcName)
)
closeLibc := method(if(?libc, libc close))
syscall := method(
openLibc
argList := list("syscall", call evalArgs) flatten
r := libc performWithArgList("call", argList)
closeLibc
r
)
)