Package org.boris.xlloop.xloper

Examples of org.boris.xlloop.xloper.XLoper


        ByteArrayOutputStream out = new ByteArrayOutputStream();
        out.write(XLoper.xlTypeStr);
        out.write(10);
        out.write("hello".getBytes());
        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        XLoper x = BinaryCodec.decode(in);
        System.out.println(x);
    }
View Full Code Here


    public static void main(String[] args) throws Exception {
        URL u = new URL("http://localhost:8000/xlloop/TestServer.php");
        String n = "Sum";
        XLoper[] xlargs = createArgs();
        XLoper res = FunctionExecutor.execute(u, n, xlargs);
        System.out.println(JSONCodec.encode(res).toString(4));
    }
View Full Code Here

                a[i] = new XLOper();
                a[i].type = XLOperType.xltypeMissing;
            }
        }
        XLOper x = addin.invoke(name, a);
        XLoper r = convert(x);
        return r;
    }
View Full Code Here

        }
    }

    public static void handleRequest(IFunctionHandler handler, IRequestProtocol protocol, Socket socket, Session session) {
        try {
            XLoper nameOrVersion = protocol.receive(socket);
            XLString name = null;
            IFunctionContext context = null;
            if (nameOrVersion.type == XLoper.xlTypeInt) {
                int version = ((XLInt) nameOrVersion).w;
                if (version == 20) {
                    XLBool b = (XLBool) protocol.receive(socket);
                    if (b.bool) {
                        XLoper caller = protocol.receive(socket);
                        XLoper sheetName = protocol.receive(socket);
                        XLSRef cref = null;
                        if (caller instanceof XLSRef)
                            cref = (XLSRef) caller;
                        String namestr = null;
                        if (sheetName instanceof XLString)
                            namestr = ((XLString) sheetName).str;
                        context = new FunctionContext(handler, session, cref, namestr);
                    }
                } else {
                    protocol.send(socket, new XLString("#Unknown protocol version"));
                    socket.close();
                    return;
                }
                name = (XLString) protocol.receive(socket);
            } else {
                name = (XLString) nameOrVersion;
            }
            XLInt argCount = (XLInt) protocol.receive(socket);
            XLoper[] args = new XLoper[argCount.w];
            for (int i = 0; i < argCount.w; i++) {
                args[i] = protocol.receive(socket);
            }
            if (!session.init && name.str.equals(INITIALIZE)) {
                initializeSession(session, args);
            }

            if (session.init && context == null)
                context = new FunctionContext(handler, session, null, null);

            XLoper res = handler.execute(context, name.str, args);
            if (res == null)
                res = XLError.NULL;
            protocol.send(socket, res);
        } catch (RequestException e) {
            try {
View Full Code Here

                System.out.print(" ");
                System.out.print(caller);
            }
        }
        System.out.print(" = ");
        XLoper res = h.execute(context, name, args);
        System.out.println(res);
        return res;
    }
View Full Code Here

        Thread.sleep(1000);

        XLList a = new XLList();
        a.add(4);
        a.add(4.5);
        XLoper res = rep.execute(null, "Script.sum", a.toArray());
        System.out.println(res);
    }
View Full Code Here

            er.add(i);
            er.add(i);
            er.add(i);
            er.add(i);
            er.add(i);
            XLoper v = re.execute("Echo", er.toXLoper().array);
            System.out.println(v);
        }
        System.out.println(System.currentTimeMillis() - t0);

        re.disconnect();
View Full Code Here

TOP

Related Classes of org.boris.xlloop.xloper.XLoper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.