Examples of OtpErlangTuple


Examples of com.ericsson.otp.erlang.OtpErlangTuple

            mbox.close();
        }
    }

    private void handleMessage(final OtpErlangObject msg) {
        final OtpErlangTuple tuple = (OtpErlangTuple) msg;
        final String tag = ((OtpErlangAtom) tuple.elementAt(0)).atomValue();
        if ("io_request".equals(tag)) {
            final OtpErlangPid from = (OtpErlangPid) tuple.elementAt(1);
            final OtpErlangObject replyAs = tuple.elementAt(2);
            final OtpErlangTuple request = (OtpErlangTuple) tuple.elementAt(3);
            final OtpErlangObject reply = processRequest(from, request);
            final OtpErlangTuple replyMsg = OtpErlang.mkTuple(new OtpErlangAtom(
                    "io_reply"), replyAs, reply);
            mbox.send(from, replyMsg);
        } else {
            ErlLogger.warn("IOServer: unknown message " + msg);
        }
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

    }

    public List<IStackFrame> getStackFrames(final IDebugTarget target,
            final IThread process) {
        // XXX JC copy paste
        final OtpErlangTuple tuple = getTuple();
        final OtpErlangList erlStackFrames = (OtpErlangList) tuple.elementAt(2);
        final OtpErlangTuple t2 = (OtpErlangTuple) tuple.elementAt(1);
        final OtpErlangTuple ieval = (OtpErlangTuple) t2.elementAt(0);
        OtpErlangAtom m = (OtpErlangAtom) ieval.elementAt(3);
        OtpErlangList bindings = (OtpErlangList) t2.elementAt(t2.arity() - 1);
        OtpErlangLong l = (OtpErlangLong) ieval.elementAt(1);
        final List<IStackFrame> stackFrames = new ArrayList<IStackFrame>(
                erlStackFrames.arity() + 1);
        for (final OtpErlangObject o : erlStackFrames) {
            final OtpErlangTuple t = (OtpErlangTuple) o;
            final OtpErlangTuple ml = (OtpErlangTuple) t.elementAt(1);
            final OtpErlangObject ml0 = ml.elementAt(0);
            int stackFrameNo;
            final OtpErlangLong n = (OtpErlangLong) t.elementAt(3);
            try {
                stackFrameNo = n.intValue();
            } catch (final OtpErlangRangeException e) {
                stackFrameNo = -1;
            }
            final String module = m.atomValue();
            int line;
            try {
                line = l.intValue();
            } catch (final OtpErlangRangeException e) {
                line = -1;
            }
            final IStackFrame sf = new ErlangStackFrame(module, (ErlangProcess) process,
                    target, line, null, bindings, stackFrameNo);
            stackFrames.add(sf);
            bindings = (OtpErlangList) t.elementAt(2);
            m = (OtpErlangAtom) ml0;
            l = (OtpErlangLong) ml.elementAt(1);
        }
        return stackFrames;
    }
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

    @Subscribe
    public void handleEvent(final ErlEvent event) {
        if (!event.getTopic().equals(getTopic())) {
            return;
        }
        final OtpErlangTuple t = (OtpErlangTuple) event.getEvent();
        final OtpErlangAtom module = (OtpErlangAtom) t.elementAt(0);
        final OtpErlangLong line = (OtpErlangLong) t.elementAt(1);
        final OtpErlangAtom level = (OtpErlangAtom) t.elementAt(2);
        final OtpErlangObject logEvent = t.elementAt(3);
        String ss = "";
        if (t.arity() == 5) {
            final OtpErlangTuple backtrace_0 = (OtpErlangTuple) t.elementAt(4);
            final OtpErlangBinary backtrace = (OtpErlangBinary) backtrace_0.elementAt(1);
            ss = new String(backtrace.binaryValue());
        }
        try {
            ErlLogger.getInstance().erlangLog(module.atomValue() + ".erl",
                    line.uIntValue(), level.atomValue().toUpperCase(), "%s %s",
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

    private IErlRecordDef addRecordDef(final IErlModule module,
            final OtpErlangObject pos, final OtpErlangObject val,
            final OtpErlangObject extra) {
        if (val instanceof OtpErlangTuple) {
            final OtpErlangTuple recordTuple = (OtpErlangTuple) val;
            if (recordTuple.elementAt(0) instanceof OtpErlangAtom) {
                final String s = extra instanceof OtpErlangString ? ((OtpErlangString) extra)
                        .stringValue() : null;
                final OtpErlangList fields = (OtpErlangList) recordTuple.elementAt(1);
                final ErlRecordDef r = new ErlRecordDef(module, null, s);
                setPos(r, pos);
                if (fields != null) {
                    final List<ErlRecordField> children = Lists
                            .newArrayListWithCapacity(fields.arity());
                    for (final OtpErlangObject o : fields) {
                        if (o instanceof OtpErlangTuple) {
                            final OtpErlangTuple fieldTuple = (OtpErlangTuple) o;
                            final OtpErlangAtom fieldNameAtom = (OtpErlangAtom) fieldTuple
                                    .elementAt(0);
                            final String fieldName = fieldNameAtom.atomValue();
                            final ErlRecordField field = new ErlRecordField(r, fieldName);
                            final OtpErlangTuple posTuple = (OtpErlangTuple) fieldTuple
                                    .elementAt(1);
                            if (fieldTuple.arity() > 2) {
                                final OtpErlangObject fieldExtra = fieldTuple
                                        .elementAt(2);
                                field.setExtra(Util.stringValue(fieldExtra));
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

        return result;
    }

    private IErlImport addImportAttribute(final IErlModule module,
            final OtpErlangObject pos, final OtpErlangObject val) {
        final OtpErlangTuple t = (OtpErlangTuple) val;
        if (t.elementAt(0) instanceof OtpErlangAtom
                && t.elementAt(1) instanceof OtpErlangList) {
            final OtpErlangAtom importModule = (OtpErlangAtom) t.elementAt(0);
            final OtpErlangList functionList = (OtpErlangList) t.elementAt(1);
            final ErlImport imp = new ErlImport(module, importModule.atomValue(),
                    functionList);
            setPos(imp, pos);
            return imp;
        }
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

        }
        try {
            // pos=
            // {{Line, LastLine, Offset}, PosLength} or
            // {{Line, Offset}, PosLength}
            final OtpErlangTuple tpos = (OtpErlangTuple) pos;
            final OtpErlangTuple tpos1 = (OtpErlangTuple) tpos.elementAt(0);
            final OtpErlangLong lenL = (OtpErlangLong) tpos.elementAt(1);
            final OtpErlangLong lineL = (OtpErlangLong) tpos1.elementAt(0);
            final OtpErlangLong lastLineL = (OtpErlangLong) tpos1.elementAt(1);
            final int line = lineL.intValue();
            int lastLine = lastLineL.intValue();
            int ofs;
            if (tpos1.arity() > 2) {
                ofs = ((OtpErlangLong) tpos1.elementAt(2)).intValue();
            } else {
                ofs = lastLine;
                lastLine = line;
            }
            final int len = lenL.intValue();
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

    public static OtpErlangTuple initialParse(final IOtpRpc b,
            final String scannerModuleName, final String moduleFileName,
            final String initialText, final String stateDir, final boolean useCache,
            final boolean updateRefs) {
        OtpErlangTuple res = null;
        try {
            res = (OtpErlangTuple) b.call(200000, ERLIDE_NOPARSE, "initial_parse",
                    "asssoo", scannerModuleName, moduleFileName, initialText, stateDir,
                    useCache, updateRefs);
        } catch (final RpcTimeoutException e) {
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

        return res;
    }

    public static OtpErlangTuple reparse(final IOtpRpc b, final String scannerModuleName,
            final boolean updateSearchServer) {
        OtpErlangTuple res = null;
        try {
            res = (OtpErlangTuple) b.call(20000, ERLIDE_NOPARSE, "reparse", "ao",
                    scannerModuleName, updateSearchServer);
        } catch (final RpcTimeoutException e) {
            ErlLogger.warn(e);
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

            return null;
        }
        if (!(r1 instanceof OtpErlangTuple)) {
            return null;
        }
        final OtpErlangTuple t1 = (OtpErlangTuple) r1;
        if (Util.isOk(t1)) {
            final OtpErlangObject ot = t1.elementAt(1);
            if (ot instanceof OtpErlangTuple) {
                final OtpErlangTuple tt = (OtpErlangTuple) ot;
                return new ErlToken(tt);
            }
        }
        return null;
    }
View Full Code Here

Examples of com.ericsson.otp.erlang.OtpErlangTuple

        if (!(r1 instanceof OtpErlangTuple)) {
            throw new ScannerException("Could not parse string \"" + string
                    + "\": weird return value " + r1);
        }
        final OtpErlangTuple t1 = (OtpErlangTuple) r1;

        List<ErlToken> toks = null;
        if (Util.isOk(t1)) {
            if (t1.elementAt(1) instanceof OtpErlangBinary) {
                final OtpErlangBinary b = (OtpErlangBinary) t1.elementAt(1);
                final byte[] bytes = b.binaryValue();
                toks = new ArrayList<ErlToken>(bytes.length / 10);
                for (int i = 0; i < bytes.length; i += 10) {
                    final ErlToken tk = new ErlToken(bytes, i, offset);
                    toks.add(tk);
                }
                return toks;
            }
            throw new ScannerException("unexpected token format");
        }
        throw new ScannerException("Could not parse string \"" + string + "\": "
                + t1.toString());
    }
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.