示例#1
0
文件: debug.c 项目: fmccabe/cafe
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
文件: str.cpp 项目: floomby/injector
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
文件: debug.c 项目: fmccabe/cafe
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
文件: debug.c 项目: fmccabe/cafe
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
文件: debug.c 项目: fmccabe/cafe
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
文件: debug.c 项目: fmccabe/cafe
static void resetDeflt(char *cmd) {
  integer junk;
  defltLine(cmd, uniStrLen(cmd), &junk);
}
示例#9
0
文件: error.c 项目: fmccabe/l-and-o
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));
  }
}