(no commit message)
[sfa.git] / server / jpywork / socket.java
1 import org.python.core.*;
2
3 public class socket extends java.lang.Object {
4     static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
5     static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
6     static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
7     
8     public static class _PyInner extends PyFunctionTable implements PyRunnable {
9         private static PyObject s$0;
10         private static PyObject s$1;
11         private static PyObject s$2;
12         private static PyObject s$3;
13         private static PyObject s$4;
14         private static PyObject s$5;
15         private static PyObject s$6;
16         private static PyObject s$7;
17         private static PyObject s$8;
18         private static PyObject s$9;
19         private static PyObject s$10;
20         private static PyObject s$11;
21         private static PyObject s$12;
22         private static PyObject s$13;
23         private static PyObject i$14;
24         private static PyObject i$15;
25         private static PyObject i$16;
26         private static PyObject i$17;
27         private static PyObject i$18;
28         private static PyObject i$19;
29         private static PyObject s$20;
30         private static PyObject s$21;
31         private static PyObject i$22;
32         private static PyObject s$23;
33         private static PyObject s$24;
34         private static PyObject s$25;
35         private static PyObject i$26;
36         private static PyObject s$27;
37         private static PyObject s$28;
38         private static PyObject s$29;
39         private static PyObject s$30;
40         private static PyObject s$31;
41         private static PyObject i$32;
42         private static PyObject s$33;
43         private static PyObject i$34;
44         private static PyObject s$35;
45         private static PyObject s$36;
46         private static PyFunctionTable funcTable;
47         private static PyCode c$0__gethostbyaddr;
48         private static PyCode c$1_getfqdn;
49         private static PyCode c$2_gethostname;
50         private static PyCode c$3_gethostbyname;
51         private static PyCode c$4_gethostbyaddr;
52         private static PyCode c$5_socket;
53         private static PyCode c$6_bind;
54         private static PyCode c$7_listen;
55         private static PyCode c$8_accept;
56         private static PyCode c$9_connect;
57         private static PyCode c$10__setup;
58         private static PyCode c$11_recv;
59         private static PyCode c$12_send;
60         private static PyCode c$13_getsockname;
61         private static PyCode c$14_getpeername;
62         private static PyCode c$15_setsockopt;
63         private static PyCode c$16_getsockopt;
64         private static PyCode c$17_makefile;
65         private static PyCode c$18___init__;
66         private static PyCode c$19_close;
67         private static PyCode c$20_FileWrapper;
68         private static PyCode c$21_shutdown;
69         private static PyCode c$22_close;
70         private static PyCode c$23__tcpsocket;
71         private static PyCode c$24___init__;
72         private static PyCode c$25_bind;
73         private static PyCode c$26_connect;
74         private static PyCode c$27_sendto;
75         private static PyCode c$28_send;
76         private static PyCode c$29_recvfrom;
77         private static PyCode c$30_recv;
78         private static PyCode c$31_getsockname;
79         private static PyCode c$32_getpeername;
80         private static PyCode c$33___del__;
81         private static PyCode c$34_close;
82         private static PyCode c$35__udpsocket;
83         private static PyCode c$36_test;
84         private static PyCode c$37_main;
85         private static void initConstants() {
86             s$0 = Py.newString("Preliminary socket module.\012\012XXX Restrictions:\012\012- Only INET sockets\012- No asynchronous behavior\012- No socket options\012- Can't do a very good gethostbyaddr() right...\012\012");
87             s$1 = Py.newString("AF_INET");
88             s$2 = Py.newString("SOCK_DGRAM");
89             s$3 = Py.newString("SOCK_RAW");
90             s$4 = Py.newString("SOCK_RDM");
91             s$5 = Py.newString("SOCK_SEQPACKET");
92             s$6 = Py.newString("SOCK_STREAM");
93             s$7 = Py.newString("SocketType");
94             s$8 = Py.newString("error");
95             s$9 = Py.newString("getfqdn");
96             s$10 = Py.newString("gethostbyaddr");
97             s$11 = Py.newString("gethostbyname");
98             s$12 = Py.newString("gethostname");
99             s$13 = Py.newString("socket");
100             i$14 = Py.newInteger(2);
101             i$15 = Py.newInteger(1);
102             i$16 = Py.newInteger(3);
103             i$17 = Py.newInteger(4);
104             i$18 = Py.newInteger(5);
105             i$19 = Py.newInteger(65535);
106             s$20 = Py.newString("\012    Return a fully qualified domain name for name. If name is omitted or empty\012    it is interpreted as the local host.  To find the fully qualified name,\012    the hostname returned by gethostbyaddr() is checked, then aliases for the\012    host, if available. The first name which includes a period is selected.\012    In case no fully qualified domain name is available, the hostname is retur\012    New in version 2.0.\012    ");
107             s$21 = Py.newString(".");
108             i$22 = Py.newInteger(0);
109             s$23 = Py.newString("This signifies a server socket");
110             s$24 = Py.newString("");
111             s$25 = Py.newString("setReuseAddress");
112             i$26 = Py.newInteger(50);
113             s$27 = Py.newString("This signifies a client socket");
114             s$28 = Py.newString("b");
115             s$29 = Py.newString("<socket>");
116             s$30 = Py.newString("both istream and ostream have been shut down");
117             s$31 = Py.newString("r");
118             i$32 = Py.newInteger(80);
119             s$33 = Py.newString("GET / HTTP/1.0\015\012\015\012");
120             i$34 = Py.newInteger(2000);
121             s$35 = Py.newString("__main__");
122             s$36 = Py.newString("/usr/share/jython/Lib/socket.py");
123             funcTable = new _PyInner();
124             c$0__gethostbyaddr = Py.newCode(1, new String[] {"name", "addrs", "names", "addresses", "addr"}, "/usr/share/jython/Lib/socket.py", "_gethostbyaddr", false, false, funcTable, 0, null, null, 0, 1);
125             c$1_getfqdn = Py.newCode(1, new String[] {"name", "a", "addrs", "names"}, "/usr/share/jython/Lib/socket.py", "getfqdn", false, false, funcTable, 1, null, null, 0, 1);
126             c$2_gethostname = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "gethostname", false, false, funcTable, 2, null, null, 0, 1);
127             c$3_gethostbyname = Py.newCode(1, new String[] {"name"}, "/usr/share/jython/Lib/socket.py", "gethostbyname", false, false, funcTable, 3, null, null, 0, 1);
128             c$4_gethostbyaddr = Py.newCode(1, new String[] {"name", "addrs", "names"}, "/usr/share/jython/Lib/socket.py", "gethostbyaddr", false, false, funcTable, 4, null, null, 0, 1);
129             c$5_socket = Py.newCode(3, new String[] {"family", "type", "flags"}, "/usr/share/jython/Lib/socket.py", "socket", false, false, funcTable, 5, null, null, 0, 1);
130             c$6_bind = Py.newCode(3, new String[] {"self", "addr", "port", "host"}, "/usr/share/jython/Lib/socket.py", "bind", false, false, funcTable, 6, null, null, 0, 1);
131             c$7_listen = Py.newCode(2, new String[] {"self", "backlog", "a", "port", "host"}, "/usr/share/jython/Lib/socket.py", "listen", false, false, funcTable, 7, null, null, 0, 1);
132             c$8_accept = Py.newCode(1, new String[] {"self", "port", "sock", "conn", "host"}, "/usr/share/jython/Lib/socket.py", "accept", false, false, funcTable, 8, null, null, 0, 1);
133             c$9_connect = Py.newCode(3, new String[] {"self", "addr", "port", "host"}, "/usr/share/jython/Lib/socket.py", "connect", false, false, funcTable, 9, null, null, 0, 1);
134             c$10__setup = Py.newCode(2, new String[] {"self", "sock"}, "/usr/share/jython/Lib/socket.py", "_setup", false, false, funcTable, 10, null, null, 0, 1);
135             c$11_recv = Py.newCode(2, new String[] {"self", "n", "m", "data"}, "/usr/share/jython/Lib/socket.py", "recv", false, false, funcTable, 11, null, null, 0, 1);
136             c$12_send = Py.newCode(2, new String[] {"self", "s", "n"}, "/usr/share/jython/Lib/socket.py", "send", false, false, funcTable, 12, null, null, 0, 1);
137             c$13_getsockname = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getsockname", false, false, funcTable, 13, null, null, 0, 1);
138             c$14_getpeername = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getpeername", false, false, funcTable, 14, null, null, 0, 1);
139             c$15_setsockopt = Py.newCode(4, new String[] {"self", "level", "optname", "value"}, "/usr/share/jython/Lib/socket.py", "setsockopt", false, false, funcTable, 15, null, null, 0, 1);
140             c$16_getsockopt = Py.newCode(3, new String[] {"self", "level", "optname"}, "/usr/share/jython/Lib/socket.py", "getsockopt", false, false, funcTable, 16, null, null, 0, 1);
141             c$17_makefile = Py.newCode(3, new String[] {"self", "mode", "bufsize", "file"}, "/usr/share/jython/Lib/socket.py", "makefile", false, false, funcTable, 17, null, null, 0, 1);
142             c$18___init__ = Py.newCode(3, new String[] {"self", "socket", "file"}, "/usr/share/jython/Lib/socket.py", "__init__", false, false, funcTable, 18, null, null, 0, 1);
143             c$19_close = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/socket.py", "close", false, false, funcTable, 19, null, null, 0, 1);
144             c$20_FileWrapper = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "FileWrapper", false, false, funcTable, 20, null, null, 0, 0);
145             c$21_shutdown = Py.newCode(2, new String[] {"self", "how"}, "/usr/share/jython/Lib/socket.py", "shutdown", false, false, funcTable, 21, null, null, 0, 1);
146             c$22_close = Py.newCode(1, new String[] {"self", "ostream", "sock", "istream"}, "/usr/share/jython/Lib/socket.py", "close", false, false, funcTable, 22, null, null, 0, 1);
147             c$23__tcpsocket = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "_tcpsocket", false, false, funcTable, 23, null, null, 0, 0);
148             c$24___init__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/socket.py", "__init__", false, false, funcTable, 24, null, null, 0, 1);
149             c$25_bind = Py.newCode(3, new String[] {"self", "addr", "port", "a", "host"}, "/usr/share/jython/Lib/socket.py", "bind", false, false, funcTable, 25, null, null, 0, 1);
150             c$26_connect = Py.newCode(3, new String[] {"self", "addr", "port", "host"}, "/usr/share/jython/Lib/socket.py", "connect", false, false, funcTable, 26, null, null, 0, 1);
151             c$27_sendto = Py.newCode(3, new String[] {"self", "data", "addr", "packet", "n", "port", "a", "host", "bytes"}, "/usr/share/jython/Lib/socket.py", "sendto", false, false, funcTable, 27, null, null, 0, 1);
152             c$28_send = Py.newCode(2, new String[] {"self", "data"}, "/usr/share/jython/Lib/socket.py", "send", false, false, funcTable, 28, null, null, 0, 1);
153             c$29_recvfrom = Py.newCode(2, new String[] {"self", "n", "packet", "port", "m", "host", "bytes"}, "/usr/share/jython/Lib/socket.py", "recvfrom", false, false, funcTable, 29, null, null, 0, 1);
154             c$30_recv = Py.newCode(2, new String[] {"self", "n", "m", "bytes", "packet"}, "/usr/share/jython/Lib/socket.py", "recv", false, false, funcTable, 30, null, null, 0, 1);
155             c$31_getsockname = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getsockname", false, false, funcTable, 31, null, null, 0, 1);
156             c$32_getpeername = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getpeername", false, false, funcTable, 32, null, null, 0, 1);
157             c$33___del__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/socket.py", "__del__", false, false, funcTable, 33, null, null, 0, 1);
158             c$34_close = Py.newCode(1, new String[] {"self", "sock"}, "/usr/share/jython/Lib/socket.py", "close", false, false, funcTable, 34, null, null, 0, 1);
159             c$35__udpsocket = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "_udpsocket", false, false, funcTable, 35, null, null, 0, 0);
160             c$36_test = Py.newCode(0, new String[] {"s", "data"}, "/usr/share/jython/Lib/socket.py", "test", false, false, funcTable, 36, null, null, 0, 1);
161             c$37_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "main", false, false, funcTable, 37, null, null, 0, 0);
162         }
163         
164         
165         public PyCode getMain() {
166             if (c$37_main == null) _PyInner.initConstants();
167             return c$37_main;
168         }
169         
170         public PyObject call_function(int index, PyFrame frame) {
171             switch (index){
172                 case 0:
173                 return _PyInner._gethostbyaddr$1(frame);
174                 case 1:
175                 return _PyInner.getfqdn$2(frame);
176                 case 2:
177                 return _PyInner.gethostname$3(frame);
178                 case 3:
179                 return _PyInner.gethostbyname$4(frame);
180                 case 4:
181                 return _PyInner.gethostbyaddr$5(frame);
182                 case 5:
183                 return _PyInner.socket$6(frame);
184                 case 6:
185                 return _PyInner.bind$7(frame);
186                 case 7:
187                 return _PyInner.listen$8(frame);
188                 case 8:
189                 return _PyInner.accept$9(frame);
190                 case 9:
191                 return _PyInner.connect$10(frame);
192                 case 10:
193                 return _PyInner._setup$11(frame);
194                 case 11:
195                 return _PyInner.recv$12(frame);
196                 case 12:
197                 return _PyInner.send$13(frame);
198                 case 13:
199                 return _PyInner.getsockname$14(frame);
200                 case 14:
201                 return _PyInner.getpeername$15(frame);
202                 case 15:
203                 return _PyInner.setsockopt$16(frame);
204                 case 16:
205                 return _PyInner.getsockopt$17(frame);
206                 case 17:
207                 return _PyInner.makefile$18(frame);
208                 case 18:
209                 return _PyInner.__init__$19(frame);
210                 case 19:
211                 return _PyInner.close$20(frame);
212                 case 20:
213                 return _PyInner.FileWrapper$21(frame);
214                 case 21:
215                 return _PyInner.shutdown$22(frame);
216                 case 22:
217                 return _PyInner.close$23(frame);
218                 case 23:
219                 return _PyInner._tcpsocket$24(frame);
220                 case 24:
221                 return _PyInner.__init__$25(frame);
222                 case 25:
223                 return _PyInner.bind$26(frame);
224                 case 26:
225                 return _PyInner.connect$27(frame);
226                 case 27:
227                 return _PyInner.sendto$28(frame);
228                 case 28:
229                 return _PyInner.send$29(frame);
230                 case 29:
231                 return _PyInner.recvfrom$30(frame);
232                 case 30:
233                 return _PyInner.recv$31(frame);
234                 case 31:
235                 return _PyInner.getsockname$32(frame);
236                 case 32:
237                 return _PyInner.getpeername$33(frame);
238                 case 33:
239                 return _PyInner.__del__$34(frame);
240                 case 34:
241                 return _PyInner.close$35(frame);
242                 case 35:
243                 return _PyInner._udpsocket$36(frame);
244                 case 36:
245                 return _PyInner.test$37(frame);
246                 case 37:
247                 return _PyInner.main$38(frame);
248                 default:
249                 return null;
250             }
251         }
252         
253         private static PyObject _gethostbyaddr$1(PyFrame frame) {
254             // Temporary Variables
255             int t$0$int;
256             PyObject t$0$PyObject, t$1$PyObject;
257             
258             // Code
259             frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getAllByName").__call__(frame.getglobal("gethostbyname").__call__(frame.getlocal(0))));
260             frame.setlocal(2, new PyList(new PyObject[] {}));
261             frame.setlocal(1, new PyList(new PyObject[] {}));
262             t$0$int = 0;
263             t$1$PyObject = frame.getlocal(3);
264             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
265                 frame.setlocal(4, t$0$PyObject);
266                 frame.getlocal(2).invoke("append", frame.getlocal(4).invoke("getHostName"));
267                 frame.getlocal(1).invoke("append", frame.getlocal(4).invoke("getHostAddress"));
268             }
269             return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
270         }
271         
272         private static PyObject getfqdn$2(PyFrame frame) {
273             // Temporary Variables
274             int t$0$int;
275             PyObject[] t$0$PyObject__;
276             PyObject t$0$PyObject, t$1$PyObject;
277             
278             // Code
279             /* 
280                 Return a fully qualified domain name for name. If name is omitted or empty
281                 it is interpreted as the local host.  To find the fully qualified name,
282                 the hostname returned by gethostbyaddr() is checked, then aliases for the
283                 host, if available. The first name which includes a period is selected.
284                 In case no fully qualified domain name is available, the hostname is retur
285                 New in version 2.0.
286                  */
287             if (frame.getlocal(0).__not__().__nonzero__()) {
288                 frame.setlocal(0, frame.getglobal("gethostname").__call__());
289             }
290             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("_gethostbyaddr").__call__(frame.getlocal(0)), 2);
291             frame.setlocal(3, t$0$PyObject__[0]);
292             frame.setlocal(2, t$0$PyObject__[1]);
293             t$0$int = 0;
294             t$1$PyObject = frame.getlocal(3);
295             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
296                 frame.setlocal(1, t$0$PyObject);
297                 if (frame.getlocal(1).invoke("find", s$21)._ge(i$22).__nonzero__()) {
298                     return frame.getlocal(1);
299                 }
300             }
301             return frame.getlocal(0);
302         }
303         
304         private static PyObject gethostname$3(PyFrame frame) {
305             return frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getLocalHost").__call__().invoke("getHostName");
306         }
307         
308         private static PyObject gethostbyname$4(PyFrame frame) {
309             return frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(0)).invoke("getHostAddress");
310         }
311         
312         private static PyObject gethostbyaddr$5(PyFrame frame) {
313             // Temporary Variables
314             PyObject[] t$0$PyObject__;
315             
316             // Code
317             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("_gethostbyaddr").__call__(frame.getlocal(0)), 2);
318             frame.setlocal(2, t$0$PyObject__[0]);
319             frame.setlocal(1, t$0$PyObject__[1]);
320             return new PyTuple(new PyObject[] {frame.getlocal(2).__getitem__(i$22), frame.getlocal(2), frame.getlocal(1)});
321         }
322         
323         private static PyObject socket$6(PyFrame frame) {
324             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0)._eq(frame.getglobal("AF_INET")));
325             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(1)._in(new PyTuple(new PyObject[] {frame.getglobal("SOCK_DGRAM"), frame.getglobal("SOCK_STREAM")})));
326             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(2)._eq(i$22));
327             if (frame.getlocal(1)._eq(frame.getglobal("SOCK_STREAM")).__nonzero__()) {
328                 return frame.getglobal("_tcpsocket").__call__();
329             }
330             else {
331                 return frame.getglobal("_udpsocket").__call__();
332             }
333         }
334         
335         private static PyObject bind$7(PyFrame frame) {
336             // Temporary Variables
337             PyObject[] t$0$PyObject__;
338             
339             // Code
340             if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
341                 frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
342             }
343             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
344             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("addr").__not__());
345             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
346             frame.setlocal(3, t$0$PyObject__[0]);
347             frame.setlocal(2, t$0$PyObject__[1]);
348             frame.getlocal(0).__setattr__("addr", frame.getlocal(1));
349             return Py.None;
350         }
351         
352         private static PyObject listen$8(PyFrame frame) {
353             // Temporary Variables
354             PyObject[] t$0$PyObject__;
355             
356             // Code
357             /* This signifies a server socket */
358             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
359             frame.getlocal(0).__setattr__("server", i$15);
360             if (frame.getlocal(0).__getattr__("addr").__nonzero__()) {
361                 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("addr"), 2);
362                 frame.setlocal(4, t$0$PyObject__[0]);
363                 frame.setlocal(3, t$0$PyObject__[1]);
364             }
365             else {
366                 t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {s$24, i$22}), 2);
367                 frame.setlocal(4, t$0$PyObject__[0]);
368                 frame.setlocal(3, t$0$PyObject__[1]);
369             }
370             if (frame.getlocal(4).__nonzero__()) {
371                 frame.setlocal(2, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(4)));
372                 frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("ServerSocket").__call__(frame.getlocal(3), frame.getlocal(1), frame.getlocal(2)));
373             }
374             else {
375                 frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("ServerSocket").__call__(frame.getlocal(3), frame.getlocal(1)));
376             }
377             if (frame.getglobal("hasattr").__call__(frame.getlocal(0).__getattr__("sock"), s$25).__nonzero__()) {
378                 frame.getlocal(0).__getattr__("sock").invoke("setReuseAddress", frame.getlocal(0).__getattr__("reuse_addr"));
379             }
380             return Py.None;
381         }
382         
383         private static PyObject accept$9(PyFrame frame) {
384             /* This signifies a server socket */
385             if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
386                 frame.getlocal(0).invoke("listen");
387             }
388             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("server"));
389             frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("accept"));
390             frame.setlocal(4, frame.getlocal(2).invoke("getInetAddress").invoke("getHostName"));
391             frame.setlocal(1, frame.getlocal(2).invoke("getPort"));
392             frame.setlocal(3, frame.getglobal("_tcpsocket").__call__());
393             frame.getlocal(3).invoke("_setup", frame.getlocal(2));
394             return new PyTuple(new PyObject[] {frame.getlocal(3), new PyTuple(new PyObject[] {frame.getlocal(4), frame.getlocal(1)})});
395         }
396         
397         private static PyObject connect$10(PyFrame frame) {
398             // Temporary Variables
399             PyObject[] t$0$PyObject__;
400             
401             // Code
402             /* This signifies a client socket */
403             if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
404                 frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
405             }
406             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
407             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
408             frame.setlocal(3, t$0$PyObject__[0]);
409             frame.setlocal(2, t$0$PyObject__[1]);
410             if (frame.getlocal(3)._eq(s$24).__nonzero__()) {
411                 frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getLocalHost").__call__());
412             }
413             frame.getlocal(0).invoke("_setup", frame.getglobal("java").__getattr__("net").__getattr__("Socket").__call__(frame.getlocal(3), frame.getlocal(2)));
414             return Py.None;
415         }
416         
417         private static PyObject _setup$11(PyFrame frame) {
418             frame.getlocal(0).__setattr__("sock", frame.getlocal(1));
419             if (frame.getglobal("hasattr").__call__(frame.getlocal(0).__getattr__("sock"), s$25).__nonzero__()) {
420                 frame.getlocal(0).__getattr__("sock").invoke("setReuseAddress", frame.getlocal(0).__getattr__("reuse_addr"));
421             }
422             frame.getlocal(0).__setattr__("istream", frame.getlocal(1).invoke("getInputStream"));
423             frame.getlocal(0).__setattr__("ostream", frame.getlocal(1).invoke("getOutputStream"));
424             return Py.None;
425         }
426         
427         private static PyObject recv$12(PyFrame frame) {
428             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
429             frame.setlocal(3, frame.getglobal("jarray").__getattr__("zeros").__call__(frame.getlocal(1), s$28));
430             frame.setlocal(2, frame.getlocal(0).__getattr__("istream").invoke("read", frame.getlocal(3)));
431             if (frame.getlocal(2)._le(i$22).__nonzero__()) {
432                 return s$24;
433             }
434             if (frame.getlocal(2)._lt(frame.getlocal(1)).__nonzero__()) {
435                 frame.setlocal(3, frame.getlocal(3).__getslice__(null, frame.getlocal(2), null));
436             }
437             return frame.getlocal(3).invoke("tostring");
438         }
439         
440         private static PyObject send$13(PyFrame frame) {
441             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
442             frame.setlocal(2, frame.getglobal("len").__call__(frame.getlocal(1)));
443             frame.getlocal(0).__getattr__("ostream").invoke("write", frame.getlocal(1));
444             return frame.getlocal(2);
445         }
446         
447         private static PyObject getsockname$14(PyFrame frame) {
448             // Temporary Variables
449             PyObject[] t$0$PyObject__;
450             PyObject t$0$PyObject;
451             
452             // Code
453             if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
454                 t$0$PyObject__ = org.python.core.Py.unpackSequence((t$0$PyObject = frame.getlocal(0).__getattr__("addr")).__nonzero__() ? t$0$PyObject : new PyTuple(new PyObject[] {s$24, i$22}), 2);
455                 frame.setlocal(2, t$0$PyObject__[0]);
456                 frame.setlocal(1, t$0$PyObject__[1]);
457                 frame.setlocal(2, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(2)).invoke("getHostAddress"));
458             }
459             else {
460                 if (frame.getlocal(0).__getattr__("server").__nonzero__()) {
461                     frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getInetAddress").invoke("getHostAddress"));
462                 }
463                 else {
464                     frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getLocalAddress").invoke("getHostAddress"));
465                 }
466                 frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getLocalPort"));
467             }
468             return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
469         }
470         
471         private static PyObject getpeername$15(PyFrame frame) {
472             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
473             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("server").__not__());
474             frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getInetAddress").invoke("getHostAddress"));
475             frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getPort"));
476             return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
477         }
478         
479         private static PyObject setsockopt$16(PyFrame frame) {
480             if (frame.getlocal(2)._eq(frame.getglobal("SO_REUSEADDR")).__nonzero__()) {
481                 frame.getlocal(0).__setattr__("reuse_addr", frame.getlocal(3));
482             }
483             return Py.None;
484         }
485         
486         private static PyObject getsockopt$17(PyFrame frame) {
487             if (frame.getlocal(2)._eq(frame.getglobal("SO_REUSEADDR")).__nonzero__()) {
488                 return frame.getlocal(0).__getattr__("reuse_addr");
489             }
490             return Py.None;
491         }
492         
493         private static PyObject makefile$18(PyFrame frame) {
494             frame.setlocal(3, frame.getglobal("None"));
495             if (frame.getlocal(0).__getattr__("istream").__nonzero__()) {
496                 if (frame.getlocal(0).__getattr__("ostream").__nonzero__()) {
497                     frame.setlocal(3, frame.getglobal("org").__getattr__("python").__getattr__("core").__getattr__("PyFile").__call__(new PyObject[] {frame.getlocal(0).__getattr__("istream"), frame.getlocal(0).__getattr__("ostream"), s$29, frame.getlocal(1)}));
498                 }
499                 else {
500                     frame.setlocal(3, frame.getglobal("org").__getattr__("python").__getattr__("core").__getattr__("PyFile").__call__(frame.getlocal(0).__getattr__("istream"), s$29, frame.getlocal(1)));
501                 }
502             }
503             else if (frame.getlocal(0).__getattr__("ostream").__nonzero__()) {
504                 frame.setlocal(3, frame.getglobal("org").__getattr__("python").__getattr__("core").__getattr__("PyFile").__call__(frame.getlocal(0).__getattr__("ostream"), s$29, frame.getlocal(1)));
505             }
506             else {
507                 throw Py.makeException(frame.getglobal("IOError"), s$30);
508             }
509             if (frame.getlocal(3).__nonzero__()) {
510                 return frame.getglobal("_tcpsocket").invoke("FileWrapper", frame.getlocal(0), frame.getlocal(3));
511             }
512             return Py.None;
513         }
514         
515         private static PyObject __init__$19(PyFrame frame) {
516             // Temporary Variables
517             PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
518             
519             // Code
520             frame.getlocal(0).__setattr__("socket", frame.getlocal(1));
521             frame.getlocal(0).__setattr__("sock", frame.getlocal(1).__getattr__("sock"));
522             frame.getlocal(0).__setattr__("istream", frame.getlocal(1).__getattr__("istream"));
523             frame.getlocal(0).__setattr__("ostream", frame.getlocal(1).__getattr__("ostream"));
524             frame.getlocal(0).__setattr__("file", frame.getlocal(2));
525             frame.getlocal(0).__setattr__("read", frame.getlocal(2).__getattr__("read"));
526             frame.getlocal(0).__setattr__("readline", frame.getlocal(2).__getattr__("readline"));
527             frame.getlocal(0).__setattr__("readlines", frame.getlocal(2).__getattr__("readlines"));
528             frame.getlocal(0).__setattr__("write", frame.getlocal(2).__getattr__("write"));
529             frame.getlocal(0).__setattr__("writelines", frame.getlocal(2).__getattr__("writelines"));
530             frame.getlocal(0).__setattr__("flush", frame.getlocal(2).__getattr__("flush"));
531             frame.getlocal(0).__setattr__("seek", frame.getlocal(2).__getattr__("seek"));
532             frame.getlocal(0).__setattr__("tell", frame.getlocal(2).__getattr__("tell"));
533             t$0$PyObject = i$15;
534             t$1$PyObject = frame.getlocal(0);
535             t$2$PyObject = t$1$PyObject.__getattr__("socket");
536             t$2$PyObject.__setattr__("file_count", t$2$PyObject.__getattr__("file_count").__iadd__(t$0$PyObject));
537             return Py.None;
538         }
539         
540         private static PyObject close$20(PyFrame frame) {
541             // Temporary Variables
542             PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
543             
544             // Code
545             if (frame.getlocal(0).__getattr__("file").__getattr__("closed").__nonzero__()) {
546                 return Py.None;
547             }
548             t$0$PyObject = i$15;
549             t$1$PyObject = frame.getlocal(0);
550             t$2$PyObject = t$1$PyObject.__getattr__("socket");
551             t$2$PyObject.__setattr__("file_count", t$2$PyObject.__getattr__("file_count").__isub__(t$0$PyObject));
552             frame.getlocal(0).__getattr__("file").invoke("close");
553             if (((t$0$PyObject = frame.getlocal(0).__getattr__("socket").__getattr__("file_count")._eq(i$22)).__nonzero__() ? frame.getlocal(0).__getattr__("socket").__getattr__("sock")._eq(i$22) : t$0$PyObject).__nonzero__()) {
554                 if (frame.getlocal(0).__getattr__("sock").__nonzero__()) {
555                     frame.getlocal(0).__getattr__("sock").invoke("close");
556                 }
557                 if (frame.getlocal(0).__getattr__("istream").__nonzero__()) {
558                     frame.getlocal(0).__getattr__("istream").invoke("close");
559                 }
560                 if (frame.getlocal(0).__getattr__("ostream").__nonzero__()) {
561                     frame.getlocal(0).__getattr__("ostream").invoke("close");
562                 }
563             }
564             return Py.None;
565         }
566         
567         private static PyObject FileWrapper$21(PyFrame frame) {
568             frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$18___init__));
569             frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_close));
570             return frame.getf_locals();
571         }
572         
573         private static PyObject shutdown$22(PyFrame frame) {
574             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(1)._in(new PyTuple(new PyObject[] {i$22, i$15, i$14})));
575             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
576             if (frame.getlocal(1)._in(new PyTuple(new PyObject[] {i$22, i$14})).__nonzero__()) {
577                 frame.getlocal(0).__setattr__("istream", frame.getglobal("None"));
578             }
579             if (frame.getlocal(1)._in(new PyTuple(new PyObject[] {i$15, i$14})).__nonzero__()) {
580                 frame.getlocal(0).__setattr__("ostream", frame.getglobal("None"));
581             }
582             return Py.None;
583         }
584         
585         private static PyObject close$23(PyFrame frame) {
586             frame.setlocal(2, frame.getlocal(0).__getattr__("sock"));
587             frame.setlocal(3, frame.getlocal(0).__getattr__("istream"));
588             frame.setlocal(1, frame.getlocal(0).__getattr__("ostream"));
589             frame.getlocal(0).__setattr__("sock", i$22);
590             frame.getlocal(0).__setattr__("istream", i$22);
591             frame.getlocal(0).__setattr__("ostream", i$22);
592             if (frame.getlocal(0).__getattr__("file_count")._eq(i$22).__nonzero__()) {
593                 if (frame.getlocal(3).__nonzero__()) {
594                     frame.getlocal(3).invoke("close");
595                 }
596                 if (frame.getlocal(1).__nonzero__()) {
597                     frame.getlocal(1).invoke("close");
598                 }
599                 if (frame.getlocal(2).__nonzero__()) {
600                     frame.getlocal(2).invoke("close");
601                 }
602             }
603             return Py.None;
604         }
605         
606         private static PyObject _tcpsocket$24(PyFrame frame) {
607             frame.setlocal("sock", frame.getname("None"));
608             frame.setlocal("istream", frame.getname("None"));
609             frame.setlocal("ostream", frame.getname("None"));
610             frame.setlocal("addr", frame.getname("None"));
611             frame.setlocal("server", i$22);
612             frame.setlocal("file_count", i$22);
613             frame.setlocal("reuse_addr", i$22);
614             frame.setlocal("bind", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$6_bind));
615             frame.setlocal("listen", new PyFunction(frame.f_globals, new PyObject[] {i$26}, c$7_listen));
616             frame.setlocal("accept", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_accept));
617             frame.setlocal("connect", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$9_connect));
618             frame.setlocal("_setup", new PyFunction(frame.f_globals, new PyObject[] {}, c$10__setup));
619             frame.setlocal("recv", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_recv));
620             frame.setlocal("send", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_send));
621             frame.setlocal("getsockname", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_getsockname));
622             frame.setlocal("getpeername", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_getpeername));
623             frame.setlocal("setsockopt", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_setsockopt));
624             frame.setlocal("getsockopt", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_getsockopt));
625             frame.setlocal("makefile", new PyFunction(frame.f_globals, new PyObject[] {s$31, i$15.__neg__()}, c$17_makefile));
626             frame.setlocal("FileWrapper", Py.makeClass("FileWrapper", new PyObject[] {}, c$20_FileWrapper, null));
627             frame.setlocal("shutdown", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_shutdown));
628             frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_close));
629             return frame.getf_locals();
630         }
631         
632         private static PyObject __init__$25(PyFrame frame) {
633             frame.getlocal(0).__setattr__("sock", frame.getglobal("None"));
634             frame.getlocal(0).__setattr__("addr", frame.getglobal("None"));
635             return Py.None;
636         }
637         
638         private static PyObject bind$26(PyFrame frame) {
639             // Temporary Variables
640             PyObject[] t$0$PyObject__;
641             
642             // Code
643             if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
644                 frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
645             }
646             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
647             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
648             frame.setlocal(4, t$0$PyObject__[0]);
649             frame.setlocal(2, t$0$PyObject__[1]);
650             if (frame.getlocal(4)._eq(s$24).__nonzero__()) {
651                 frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__(frame.getlocal(2)));
652             }
653             else {
654                 frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(4)));
655                 frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__(frame.getlocal(2), frame.getlocal(3)));
656             }
657             return Py.None;
658         }
659         
660         private static PyObject connect$27(PyFrame frame) {
661             // Temporary Variables
662             PyObject[] t$0$PyObject__;
663             
664             // Code
665             if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
666                 frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
667             }
668             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
669             frame.setlocal(3, t$0$PyObject__[0]);
670             frame.setlocal(2, t$0$PyObject__[1]);
671             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("addr").__not__());
672             if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
673                 frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__());
674             }
675             frame.getlocal(0).__setattr__("addr", frame.getlocal(1));
676             return Py.None;
677         }
678         
679         private static PyObject sendto$28(PyFrame frame) {
680             // Temporary Variables
681             PyObject[] t$0$PyObject__;
682             
683             // Code
684             frame.setlocal(4, frame.getglobal("len").__call__(frame.getlocal(1)));
685             if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
686                 frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__());
687             }
688             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(2), 2);
689             frame.setlocal(7, t$0$PyObject__[0]);
690             frame.setlocal(5, t$0$PyObject__[1]);
691             frame.setlocal(8, frame.getglobal("jarray").__getattr__("array").__call__(frame.getglobal("map").__call__(frame.getglobal("ord"), frame.getlocal(1)), s$28));
692             frame.setlocal(6, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(7)));
693             frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("DatagramPacket").__call__(new PyObject[] {frame.getlocal(8), frame.getlocal(4), frame.getlocal(6), frame.getlocal(5)}));
694             frame.getlocal(0).__getattr__("sock").invoke("send", frame.getlocal(3));
695             return frame.getlocal(4);
696         }
697         
698         private static PyObject send$29(PyFrame frame) {
699             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("addr"));
700             return frame.getlocal(0).invoke("sendto", frame.getlocal(0).__getattr__("addr"));
701         }
702         
703         private static PyObject recvfrom$30(PyFrame frame) {
704             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
705             frame.setlocal(6, frame.getglobal("jarray").__getattr__("zeros").__call__(frame.getlocal(1), s$28));
706             frame.setlocal(2, frame.getglobal("java").__getattr__("net").__getattr__("DatagramPacket").__call__(frame.getlocal(6), frame.getlocal(1)));
707             frame.getlocal(0).__getattr__("sock").invoke("receive", frame.getlocal(2));
708             frame.setlocal(5, frame.getlocal(2).invoke("getAddress").invoke("getHostName"));
709             frame.setlocal(3, frame.getlocal(2).invoke("getPort"));
710             frame.setlocal(4, frame.getlocal(2).invoke("getLength"));
711             if (frame.getlocal(4)._lt(frame.getlocal(1)).__nonzero__()) {
712                 frame.setlocal(6, frame.getlocal(6).__getslice__(null, frame.getlocal(4), null));
713             }
714             return new PyTuple(new PyObject[] {frame.getlocal(6).invoke("tostring"), new PyTuple(new PyObject[] {frame.getlocal(5), frame.getlocal(3)})});
715         }
716         
717         private static PyObject recv$31(PyFrame frame) {
718             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
719             frame.setlocal(3, frame.getglobal("jarray").__getattr__("zeros").__call__(frame.getlocal(1), s$28));
720             frame.setlocal(4, frame.getglobal("java").__getattr__("net").__getattr__("DatagramPacket").__call__(frame.getlocal(3), frame.getlocal(1)));
721             frame.getlocal(0).__getattr__("sock").invoke("receive", frame.getlocal(4));
722             frame.setlocal(2, frame.getlocal(4).invoke("getLength"));
723             if (frame.getlocal(2)._lt(frame.getlocal(1)).__nonzero__()) {
724                 frame.setlocal(3, frame.getlocal(3).__getslice__(null, frame.getlocal(2), null));
725             }
726             return frame.getlocal(3).invoke("tostring");
727         }
728         
729         private static PyObject getsockname$32(PyFrame frame) {
730             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
731             frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getLocalAddress").invoke("getHostName"));
732             frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getLocalPort"));
733             return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
734         }
735         
736         private static PyObject getpeername$33(PyFrame frame) {
737             if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
738             frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getInetAddress").invoke("getHostName"));
739             frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getPort"));
740             return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
741         }
742         
743         private static PyObject __del__$34(PyFrame frame) {
744             frame.getlocal(0).invoke("close");
745             return Py.None;
746         }
747         
748         private static PyObject close$35(PyFrame frame) {
749             frame.setlocal(1, frame.getlocal(0).__getattr__("sock"));
750             frame.getlocal(0).__setattr__("sock", i$22);
751             frame.getlocal(1).invoke("close");
752             return Py.None;
753         }
754         
755         private static PyObject _udpsocket$36(PyFrame frame) {
756             frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$24___init__));
757             frame.setlocal("bind", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$25_bind));
758             frame.setlocal("connect", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$26_connect));
759             frame.setlocal("sendto", new PyFunction(frame.f_globals, new PyObject[] {}, c$27_sendto));
760             frame.setlocal("send", new PyFunction(frame.f_globals, new PyObject[] {}, c$28_send));
761             frame.setlocal("recvfrom", new PyFunction(frame.f_globals, new PyObject[] {}, c$29_recvfrom));
762             frame.setlocal("recv", new PyFunction(frame.f_globals, new PyObject[] {}, c$30_recv));
763             frame.setlocal("getsockname", new PyFunction(frame.f_globals, new PyObject[] {}, c$31_getsockname));
764             frame.setlocal("getpeername", new PyFunction(frame.f_globals, new PyObject[] {}, c$32_getpeername));
765             frame.setlocal("__del__", new PyFunction(frame.f_globals, new PyObject[] {}, c$33___del__));
766             frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$34_close));
767             return frame.getf_locals();
768         }
769         
770         private static PyObject test$37(PyFrame frame) {
771             frame.setlocal(0, frame.getglobal("socket").__call__(frame.getglobal("AF_INET"), frame.getglobal("SOCK_STREAM")));
772             frame.getlocal(0).invoke("connect", new PyTuple(new PyObject[] {s$24, i$32}));
773             frame.getlocal(0).invoke("send", s$33);
774             while (i$15.__nonzero__()) {
775                 frame.setlocal(1, frame.getlocal(0).invoke("recv", i$34));
776                 Py.println(frame.getlocal(1));
777                 if (frame.getlocal(1).__not__().__nonzero__()) {
778                     break;
779                 }
780             }
781             return Py.None;
782         }
783         
784         private static PyObject main$38(PyFrame frame) {
785             frame.setglobal("__file__", s$36);
786             
787             /* Preliminary socket module.
788             
789             XXX Restrictions:
790             
791             - Only INET sockets
792             - No asynchronous behavior
793             - No socket options
794             - Can't do a very good gethostbyaddr() right...
795             
796              */
797             frame.setlocal("java", org.python.core.imp.importOne("java.net", frame));
798             frame.setlocal("org", org.python.core.imp.importOne("org.python.core", frame));
799             frame.setlocal("jarray", org.python.core.imp.importOne("jarray", frame));
800             frame.setlocal("string", org.python.core.imp.importOne("string", frame));
801             frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13}));
802             frame.setlocal("error", frame.getname("IOError"));
803             frame.setlocal("AF_INET", i$14);
804             frame.setlocal("SOCK_DGRAM", i$15);
805             frame.setlocal("SOCK_STREAM", i$14);
806             frame.setlocal("SOCK_RAW", i$16);
807             frame.setlocal("SOCK_RDM", i$17);
808             frame.setlocal("SOCK_SEQPACKET", i$18);
809             frame.setlocal("SOL_SOCKET", i$19);
810             frame.setlocal("SO_REUSEADDR", i$17);
811             frame.setlocal("_gethostbyaddr", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__gethostbyaddr));
812             frame.setlocal("getfqdn", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$1_getfqdn));
813             frame.setlocal("gethostname", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_gethostname));
814             frame.setlocal("gethostbyname", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_gethostbyname));
815             frame.setlocal("gethostbyaddr", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_gethostbyaddr));
816             frame.setlocal("socket", new PyFunction(frame.f_globals, new PyObject[] {i$22}, c$5_socket));
817             frame.setlocal("_tcpsocket", Py.makeClass("_tcpsocket", new PyObject[] {}, c$23__tcpsocket, null));
818             frame.setlocal("_udpsocket", Py.makeClass("_udpsocket", new PyObject[] {}, c$35__udpsocket, null));
819             frame.setlocal("SocketType", frame.getname("_tcpsocket"));
820             frame.setlocal("test", new PyFunction(frame.f_globals, new PyObject[] {}, c$36_test));
821             if (frame.getname("__name__")._eq(s$35).__nonzero__()) {
822                 frame.getname("test").__call__();
823             }
824             return Py.None;
825         }
826         
827     }
828     public static void moduleDictInit(PyObject dict) {
829         dict.__setitem__("__name__", new PyString("socket"));
830         Py.runCode(new _PyInner().getMain(), dict, dict);
831     }
832     
833     public static void main(String[] args) throws java.lang.Exception {
834         String[] newargs = new String[args.length+1];
835         newargs[0] = "socket";
836         System.arraycopy(args, 0, newargs, 1, args.length);
837         Py.runMain(socket._PyInner.class, newargs, socket.jpy$packages, socket.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
838     }
839     
840 }