[pypy-svn] r26297 - pypy/dist/pypy/rpython/rctypes/socketmodule

ale at codespeak.net ale at codespeak.net
Tue Apr 25 08:44:03 CEST 2006


Author: ale
Date: Tue Apr 25 08:44:00 2006
New Revision: 26297

Modified:
   pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py
Log:
Small change to ctypes_socket to expose constants at module level


Modified: pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py	Tue Apr 25 08:44:00 2006
@@ -113,6 +113,15 @@
                                       ('ai_canonname', c_char_p),
                                       ('ai_next', addrinfo_ptr)])
 
+CConfig.hostent = ctypes_platform.Struct('struct hostent',
+                                     [('h_name', c_char_p),
+                                      ('h_aliases', POINTER(c_char_p)),
+                                      ('h_addrtype', c_int),
+                                      ('h_length', c_int),
+                                      ('h_addr_list', POINTER(c_char_p))
+                                      ])
+
+
 
 class cConfig:
     pass
@@ -129,6 +138,8 @@
     else:
         constants[name] = default
 
+locals().update(constants)
+
 uint16_t = cConfig.uint16_t
 uint32_t = cConfig.uint32_t
 size_t = cConfig.size_t
@@ -276,3 +287,7 @@
 gethostname = socketdll.gethostname
 gethostname.argtypes = [POINTER(c_char), c_int]
 gethostname.restype = c_int
+
+gethostbyname = socketdll.gethostbyname
+gethostbyname.argtypes = [POINTER(c_char)]
+gethostbyname.restype = POINTER(cConfig.hostent)



More information about the Pypy-commit mailing list