Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 22nd, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* Cifre Standard Library
  2.    (c) Jeremy Tregunna, 2006, All Rights Reserved.
  3.  
  4.    This program is open source software, and redistributable under the terms
  5.    and conditions of the BSD Licence. */
  6.  
  7. require("Object")
  8.  
  9. System do(
  10.         openLibc := method(
  11.                 /* Set up C library */
  12.                 libcName := "libc.so"
  13.                 case(
  14.                         (System platform == "Darwin", libcName = "libSystem.dylib")
  15.                         (System platform == "FreeBSD",
  16.                                 """libc.so.#io{System platformVersion asMutable clipAfterStartOfSeq(".")}""" interpolate
  17.                         )
  18.                         (System platform == "Linux", libcName = "libc.so.6")
  19.                 )
  20.                 self libc := DynLib clone open(libcName)
  21.         )
  22.         closeLibc := method(if(?libc, libc close))
  23.  
  24.         syscall := method(
  25.                 openLibc
  26.                 argList := list("syscall", call evalArgs) flatten
  27.                 r := libc performWithArgList("call", argList)
  28.                 closeLibc
  29.                 r
  30.         )
  31. )