use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class ErlideXref method modules.
public static List<String> modules(final IOtpRpc backend) {
final List<String> result = new ArrayList<>();
try {
final OtpErlangObject res = backend.call(ErlideXref.ERLIDE_XREF, "modules", "");
if (Util.isOk(res)) {
final OtpErlangTuple t = (OtpErlangTuple) res;
final OtpErlangList l = (OtpErlangList) t.elementAt(1);
for (final OtpErlangObject i : l) {
if (i instanceof OtpErlangAtom) {
final OtpErlangAtom m = (OtpErlangAtom) i;
result.add(m.atomValue());
}
}
}
} catch (final RpcException e) {
ErlLogger.error(e);
}
return result;
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class ErlideIndent method fixIndentPrefs.
private List<OtpErlangTuple> fixIndentPrefs(final Map<String, String> m) {
final List<OtpErlangTuple> result = new ArrayList<>(m.size());
for (final Map.Entry<String, String> e : m.entrySet()) {
final OtpErlangAtom a = new OtpErlangAtom(e.getKey());
final String s = e.getValue();
int n;
if ("false".equals(s)) {
n = 0;
} else if ("true".equals(s)) {
n = 1;
} else {
n = Integer.parseInt(s);
}
final OtpErlangLong l = new OtpErlangLong(n);
final OtpErlangTuple t = new OtpErlangTuple(new OtpErlangObject[] { a, l });
result.add(t);
}
return result;
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class ModelInternalUtils method addUnitNamesWithPrefix.
private void addUnitNamesWithPrefix(final String prefix, final List<String> result, final Collection<IErlModule> modules, final boolean external, final boolean includes) {
for (final IErlModule module : modules) {
String moduleName = includes ? module.getName() : module.getModuleName();
if (external && includes) {
moduleName = getIncludeLibPath(module);
}
boolean nameMatches = moduleName.startsWith(prefix);
if (!nameMatches && prefix.startsWith("'")) {
nameMatches = moduleName.startsWith(prefix.substring(1));
}
if (nameMatches && (includes || !module.getName().endsWith(".hrl"))) {
if (!result.contains(moduleName)) {
final String name = new OtpErlangAtom(moduleName).toString();
result.add(name);
}
}
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class IOServer method handleMessage.
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);
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class OtpRpc method buildRpcCastMsg.
private OtpErlangObject buildRpcCastMsg(final OtpErlangObject gleader, final String module, final String fun, final OtpErlangObject[] args) {
final OtpErlangObject m = new OtpErlangAtom(module);
final OtpErlangObject f = new OtpErlangAtom(fun);
final OtpErlangObject a = new OtpErlangList(args);
final OtpErlangAtom castTag = new OtpErlangAtom("$gen_cast");
return OtpErlang.mkTuple(castTag, OtpErlang.mkTuple(new OtpErlangAtom("cast"), m, f, a, gleader));
}
Aggregations