Пример #1
0
static integer cmdCount(char *cmdLine, integer deflt) {
  while (isSpaceChar((codePoint) *cmdLine))
    cmdLine++;
  if (uniStrLen(cmdLine) == 0)
    return deflt;
  else
    return parseInteger(cmdLine, uniStrLen(cmdLine));
}
Пример #2
0
bool dllMatch(struct unicode_string *str, const char *str2)
{
    size_t len = uniStrLen(str);
    char buf[len];

    uniToAscii(buf, str, len);
    
    return match(lastSlash(buf) + 1, str2);
}
Пример #3
0
static DebugWaitFor dbgShowGlobal(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  char buff[MAX_SYMB_LEN];
  integer pos = 0;
  integer ix = 0;
  integer llen = uniStrLen(line);

  enum {
    initSte, inVar
  } st = initSte;

  while (ix < llen) {
    codePoint cp = nextCodePoint(line, &ix, llen);
    switch (st) {
      case initSte:
        if (!isSpaceChar(cp)) {
          st = inVar;
          appendCodePoint(buff, &pos, NumberOf(buff), cp);
        }
        continue;
      case inVar:
        if (!isSpaceChar(cp)) {
          appendCodePoint(buff, &pos, NumberOf(buff), cp);
          continue;
        } else
          break;
    }
  }
  if (uniStrLen(buff) > 0) {
    appendCodePoint(buff, &pos, NumberOf(buff), 0);
    globalPo glb = globalVar(buff);
    if (glb != Null) {
      termPo val = getGlobal(glb);
      if (val != Null)
        outMsg(debugOutChnnl, "%s = %,*T\n", buff, displayDepth, val);
      else
        outMsg(debugOutChnnl, "%s not set\n", buff);
    }
  }

  resetDeflt("n");
  return moreDebug;
}
Пример #4
0
DebugWaitFor dbgClearBreakPoint(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  BreakPoint bp;
  retCode ret = parseBreakPoint(line, uniStrLen(line), &bp);
  if (ret == Ok)
    ret = clearBreakPoint(&bp);
  if (ret != Ok)
    outMsg(debugOutChnnl, "Could not clear spy point on %s\n%_", line);
  else
    outMsg(debugOutChnnl, "spy point cleared on %s\n%_", line);
  return moreDebug;
}
Пример #5
0
void defltCWD() {
  // set up working directory
  if (uniIsLit(CWD, "")) {
    char cbuff[MAXFILELEN];
    char *cwd = getcwd(cbuff, NumberOf(cbuff)); /* compute current starting directory */
    if (cwd == NULL)
      syserr("cant determine current directory");
    else
      uniTrim(cwd, uniStrLen(cwd), "", "/", CWD, NumberOf(CWD));
  }
}
Пример #6
0
static retCode setDebuggerPort(char *option, logical enable, void *cl) {
  debuggerPort = parseInteger(option, uniStrLen(option));
  if (debuggerPort <= 0)
    return Error;
  else{
    lineDebugging = True;   /* set up for remote symbolic insDebugging */
    interactive = True;
    showPkgFile = True;
    showColors = False;
  }
  return Ok;
}
Пример #7
0
static DebugWaitFor dbgAddBreakPoint(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  BreakPoint bp;
  retCode ret = parseBreakPoint(line, uniStrLen(line), &bp);
  if (ret == Ok)
    ret = isValidBreakPoint(&bp);
  if (ret == Ok)
    ret = addBreakPoint(&bp);
  if (ret != Ok) {
    outMsg(debugOutChnnl, "Could not set spy point on %s\n", line);
    outMsg(debugOutChnnl, "usage: +pkg/Arity or +pkg:LineNo\n%_");
  } else
    outMsg(debugOutChnnl, "%sspy point set on %s\n%_", bp.bkType == callBreak ? "call " : "line ", line);
  return moreDebug;
}
Пример #8
0
static void resetDeflt(char *cmd) {
  integer junk;
  defltLine(cmd, uniStrLen(cmd), &junk);
}
Пример #9
0
ptrI errorString(heapPo H, ptrI code) {
  if (!isvar(code)) {
    if (code == eINSUFARG)
      return allocateCString(H, "Insufficiently instantiated argument");
    else if (code == eINTNEEDD)
      return allocateCString(H, "Integer required");
    else if (code == eNUMNEEDD)
      return allocateCString(H, "Number required");
    else if (code == eVARNEEDD)
      return allocateCString(H, "Unbound variable required");
    else if (code == eSPACE)
      return allocateCString(H, "Out of heap space");
    else if (code == eUNIFY)
      return allocateCString(H, "Incomparible values in unification");
    else if (code == eDIVZERO)
      return allocateCString(H, "Division by zero");
    else if (code == eLSTNEEDD)
      return allocateCString(H, "List needed");
    else if (code == eTPLNEEDD)
      return allocateCString(H, "Tuple needed");
    else if (code == eSYMNEEDD)
      return allocateCString(H, "Symbol needed");
    else if (code == eSTRNEEDD)
      return allocateCString(H, "String required");
    else if (code == eCHRNEEDD)
      return allocateCString(H, "Character required");
    else if (code == eINVAL)
      return allocateCString(H, "invalid argument");
    else if (code == eNOPERM)
      return allocateCString(H, "permission denied");
    else if (code == eNOFILE)
      return allocateCString(H, "file not found");
    else if (code == eNOTDIR)
      return allocateCString(H, "not a directory");
    else if (code == eCFGERR)
      return allocateCString(H, "configuration problem");
    else if (code == eEOF)
      return allocateCString(H, "read past end-of-file");
    else if (code == eIOERROR)
      return allocateCString(H, "error on i/o");
    else if (code == eABORT)
      return allocateCString(H, "process aborted");
    else if (code == eNOTFND)
      return allocateCString(H, "not found");
    else if (code == eCODE)
      return allocateCString(H, "undefined program");
    else if (code == eFAIL)
      return allocateCString(H, "unexpected failure");
    else if (code == eHANDLE)
      return allocateCString(H, "not a valid handle");
    else if (code == eINVCODE)
      return allocateCString(H, "incorrect code type");
    else if (code == eASSIGN)
      return allocateCString(H, "assignment not allowed");
    else if (code == eDEAD)
      return allocateCString(H, "deadlock detected");
    else if (code == eSYSTEM)
      return allocateCString(H, "system overflow");
    else if (code == eDUPLICATE)
      return allocateCString(H, "duplicate request");
    else if (code == eNOIMPL)
      return allocateCString(H, "feature not implemented");
    else if (code == eNOTENUF)
      return allocateCString(H, "insufficient arguments given");
    else if (code == eCONNECT)
      return allocateCString(H, "cannot connect to host");
    else if (code == eINTRUPT)
      return allocateCString(H, "interrupted");
    else {
      char buf[MAX_MSG_LEN];

      strMsg(buf, NumberOf(buf), "Unknown error code: %w", &code);
      return allocateString(H, buf, uniStrLen(buf));
    }
  } else {
    char buf[MAX_MSG_LEN];

    strMsg(buf, NumberOf(buf), "Invalid error code: %w", &code);
    return allocateString(H, buf, uniStrLen(buf));
  }
}