コード例 #1
0
ファイル: clString.cpp プロジェクト: ycaseau/CLAIRE3.3
// lookup: check if a string in a given module is represented by a symbol (returns NULL
// if no symbol is found - does NOT create a new symbol
// this method embodies the strategy for looking in upper modules (namespace inheritance)
symbol *module::lookup(char *name)
{int i = hash(name);
   while ((ClRes->sTable[i] != NULL) &&
          ((this != ClRes->sTable[i]->module_I) ||
           (equal_string(name,ClRes->sTable[i]->name) == CFALSE))) i++;
   if (i == ClAlloc->maxHash) Cerror(12,0,0);
   symbol *cur = ClRes->sTable[i];
   if (cur != NULL || this == claire.it) return cur;   // v3.2.38 - Thanks to FXJ !
   else return part_of->lookup(name); }
コード例 #2
0
ファイル: Log.cpp プロジェクト: gfphoenix/i2d
Cerror Log::dumpLevel(const char *level, const char *fmt, va_list ap)
{
    auto l = log_.get();
    auto e = Cerror(nullptr);
    if(!l)
        goto out;
    l->write("level=%s : ", level);
    e = l->vwrite(fmt, ap);
    l->write("\n");
out:
    return e;
}
コード例 #3
0
ファイル: clString.cpp プロジェクト: ycaseau/CLAIRE3.3
// create a claire symbol from an internal C string and a status, represented by
// def, which is NULL for private symbols and the definition (owner) for other symbols
// 
symbol *symbol::make(char *name, module *ns, module *def)
{int i = ns->hash(name);
   while ((ClRes->sTable[i] != NULL) &&
          ((ns != ClRes->sTable[i]->module_I) ||
           (equal_string(name,ClRes->sTable[i]->name) == CFALSE))) i++;
   if (i >= ClAlloc->maxHash) Cerror(12,0,0);
   if (ClRes->sTable[i] == NULL)
      {symbol *s = (symbol *) ClAlloc->makeAny(4);
       s->isa = Kernel._symbol;
       s->name = name;
       s->module_I = ns;
       s->definition = def;                  // def = NULL means private
       s->value = CNULL;
       ClRes->sTable[i] = s;}
   return ClRes->sTable[i];}
コード例 #4
0
ファイル: clString.cpp プロジェクト: ycaseau/CLAIRE3.3
// shrinks a string by placing the '\0' marker
char *shrink_string(char *ss, int n)
{if (n <= strlen(ss)) ss[n] = '\0';         // v3.1.10  allows identity ...
 else Cerror(11,n,_string_(ss));
 return ss;}
コード例 #5
0
ファイル: clString.cpp プロジェクト: ycaseau/CLAIRE3.3
// set the char at the i_th place in s
void nth_set_string (char *ss, int n, ClaireChar *c)
{if (n <= strlen(ss)) 
         ss[n-1] = (char) c->ascii;
 else Cerror(11,n,_string_(ss));}
コード例 #6
0
ファイル: clString.cpp プロジェクト: ycaseau/CLAIRE3.3
// get the CHAR at the i-th place in s
ClaireChar *nth_string (char *ss, int n)
{ if (n <= strlen(ss)) return char_I_integer((int) ss[n-1]);      // v3.2.44
  else Cerror(11,n,_string_(ss)); return ClRes->ascii[1];}