view python/pydc/examples/atoi.py @ 22:4ee8d6aa7721

- java binding cleanup, exposed free functions (not very oo, this entire binding) - java binding examples
author cslag
date Sat, 09 Apr 2016 18:18:34 -0500
parents bf5625bb6f05
children edbbd467f50a
line wrap: on
line source

from pydc import *
import sys
import platform

if sys.platform == "win32":
  libc = load("msvcrt")
elif sys.platform == "darwin":
  libc = load("/usr/lib/libc.dylib")
elif "bsd" in sys.platform:
  libc = load("/usr/lib/libc.so")
elif platform.architecture()[0] == "64bit":
  libc = load("/lib64/libc.so.6")
else:
  libc = load("/lib/libc.so.6")

fp_atoi = find(libc,"atoi")
fp_atof = find(libc,"atof")



def atoi(s): return call(fp_atoi,"p)i",s)
def atod(s): return call(fp_atof,"p)d",s)

print atoi( "3".join(["12","45"]) )
print atod( "3".join(["12","45"]) )