Examples of XLoper


Examples of org.boris.xlloop.xloper.XLoper

            return ((XLString) x).str;
        return null;
    }

    public Double getDouble(int row, int column) {
        XLoper x = get(row, column);
        if (x instanceof XLNum)
            return ((XLNum) x).num;
        else if (x instanceof XLInt)
            return (double) ((XLInt) x).w;
        else if (x instanceof XLBool)
View Full Code Here

Examples of org.boris.xlloop.xloper.XLoper

    public XLoper execute(IFunctionContext context, String name, XLoper[] args) throws RequestException {
        try {
            LispValue inValue = makeList(args, findSize(args));
            LispValue result = jatha.eval(inValue);
            XLoper outValue = makeResult(result);
            return outValue;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RequestException(e);
        }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLoper

        int size;
        if (args == null || (size = args.length) == 0) {
            return 0;
        }
        while (size > 0) {
            XLoper v = args[--size];
            if (!(v instanceof XLMissing)) {
                return size + 1;
            }
        }
        return 0;
View Full Code Here

Examples of org.boris.xlloop.xloper.XLoper

    }

    public static Class[] createArgHints(XLoper[] args) {
        Class[] hints = new Class[args.length];
        for (int i = 0; i < hints.length; i++) {
            XLoper v = args[i];
            if (v instanceof XLArray) {
                XLArray c = (XLArray) v;
                if (c.columns > 1) {
                    hints[i] = Object[][].class;
                } else {
View Full Code Here

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

Examples of org.boris.xlloop.xloper.XLoper

    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

Examples of org.boris.xlloop.xloper.XLoper

                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

Examples of org.boris.xlloop.xloper.XLoper

        }
    }

    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

Examples of org.boris.xlloop.xloper.XLoper

                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

Examples of org.boris.xlloop.xloper.XLoper

        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
TOP
Copyright © 2018 www.massapi.com. 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.