当前位置: 首页>>代码示例>>C++>>正文


C++ RepAtom函数代码示例

本文整理汇总了C++中RepAtom函数的典型用法代码示例。如果您正苦于以下问题:C++ RepAtom函数的具体用法?C++ RepAtom怎么用?C++ RepAtom使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RepAtom函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: access_path

static Int access_path(USES_REGS1) {
  Term tname = Deref(ARG1);

  if (IsVarTerm(tname)) {
    Yap_Error(INSTANTIATION_ERROR, tname, "access");
    return false;
  } else if (!IsAtomTerm(tname)) {
    Yap_Error(TYPE_ERROR_ATOM, tname, "access");
    return false;
  } else {
          VFS_t *vfs;
          char *s =  RepAtom(AtomOfTerm(tname))->StrOfAE;
          if (!s) return false;
          if ((vfs = vfs_owner(s))) {
              vfs_stat st;
              bool rc = vfs->stat(vfs, s, &st);
              UNLOCK(GLOBAL_Stream[sno].streamlock);
              return rc;
          }
#if HAVE_STAT
    struct SYSTEM_STAT ss;
    char *file_name;

    file_name = RepAtom(AtomOfTerm(tname))->StrOfAE;
    if (SYSTEM_STAT(file_name, &ss) != 0) {
      /* ignore errors while checking a file */
      return true;
    }
    return true;
#else
    return false;
#endif
  }
}
开发者ID:vscosta,项目名称:yap-6.3,代码行数:34,代码来源:files.c

示例2: Yap_ReleaseAtom

void Yap_ReleaseAtom(Atom atom) { /* Releases an atom from the hash chain */
  register Int hash;
  register const unsigned char *p;
  AtomEntry *inChain;
  AtomEntry *ap = RepAtom(atom);
  char unsigned *name = ap->UStrOfAE;

  /* compute hash */
  p = name;
  hash = HashFunction(p) % AtomHashTableSize;
  WRITE_LOCK(HashChain[hash].AERWLock);
  if (HashChain[hash].Entry == atom) {
    NOfAtoms--;
    HashChain[hash].Entry = ap->NextOfAE;
    WRITE_UNLOCK(HashChain[hash].AERWLock);
    return;
  }
  /* else */
  inChain = RepAtom(HashChain[hash].Entry);
  while (inChain->NextOfAE != atom)
    inChain = RepAtom(inChain->NextOfAE);
  WRITE_LOCK(inChain->ARWLock);
  inChain->NextOfAE = ap->NextOfAE;
  WRITE_UNLOCK(inChain->ARWLock);
  WRITE_UNLOCK(HashChain[hash].AERWLock);
}
开发者ID:jnorthrup,项目名称:yap-6.3,代码行数:26,代码来源:adtdefs.c

示例3: exists_directory

static Int exists_directory(USES_REGS1) {
  Term tname = Deref(ARG1);
  char *file_name;

  if (IsVarTerm(tname)) {
    Yap_Error(INSTANTIATION_ERROR, tname, "exists_directory/1");
    return FALSE;
  } else if (!IsAtomTerm(tname)) {
    Yap_Error(TYPE_ERROR_ATOM, tname, "exists_directory/1");
    return FALSE;
  } else {
    VFS_t *vfs;
    char *s = Yap_VF(RepAtom(AtomOfTerm(tname))->StrOfAE);
    if (!s) return false;
    if ((vfs = vfs_owner(s))) {
bool rc = true;
      return vfs->isdir(vfs, s);

      UNLOCK(GLOBAL_Stream[sno].streamlock);
      return rc;
    }
#if HAVE_STAT
    struct SYSTEM_STAT ss;

    file_name = Yap_VF(RepAtom(AtomOfTerm(tname))->StrOfAE);
    if (SYSTEM_STAT(file_name, &ss) != 0) {
      /* ignore errors while checking a file */
      return false;
    }
    return (S_ISDIR(ss.st_mode));
#else
    return FALSE;
#endif
  }
}
开发者ID:vscosta,项目名称:yap-6.3,代码行数:35,代码来源:files.c

示例4: mpe_create_state

static Int               /* mpe_create_state(+Event,+Event,+Text,+Colour) */
p_create_state()
{
  Term t_start = Deref(ARG1), t_end = Deref(ARG2),
    t_descr = Deref(ARG3), t_colour = Deref(ARG4);
  Int start_id, end_id;
  char *descr, *colour;
  int retv;

  /* The first and second args must be bount to integer event IDs. */
  if (IsVarTerm(t_start)) {
    Yap_Error(INSTANTIATION_ERROR, t_start, "mpe_create_state");
    return (FALSE);
  } else if( !IsIntegerTerm(t_start) ) {
    Yap_Error(TYPE_ERROR_INTEGER, t_start, "mpe_create_state");
    return (FALSE);
  } else {
    start_id = IntOfTerm(t_start);
  }
  if (IsVarTerm(t_end)) {
    Yap_Error(INSTANTIATION_ERROR, t_end, "mpe_create_state");
    return (FALSE);
  } else if( !IsIntegerTerm(t_end) ) {
    Yap_Error(TYPE_ERROR_INTEGER, t_end, "mpe_create_state");
    return (FALSE);
  } else {
    end_id = IntOfTerm(t_end);
  }

  /* The third and fourth args must be bound to atoms. */
  if (IsVarTerm(t_descr)) {
    Yap_Error(INSTANTIATION_ERROR, t_descr, "mpe_create_state");
    return (FALSE);
  } else if( !IsAtomTerm(t_descr) ) {
    Yap_Error(TYPE_ERROR_ATOM, t_descr, "mpe_create_state");
    return (FALSE);
  } else {
    descr = RepAtom(AtomOfTerm(t_descr))->StrOfAE;
  }
  if (IsVarTerm(t_colour)) {
    Yap_Error(INSTANTIATION_ERROR, t_colour, "mpe_create_state");
    return (FALSE);
  } else if( !IsAtomTerm(t_colour) ) {
    Yap_Error(TYPE_ERROR_ATOM, t_colour, "mpe_create_state");
    return (FALSE);
  } else {
    colour = RepAtom(AtomOfTerm(t_colour))->StrOfAE;
  }

  retv = MPE_Describe_state( (int)start_id, (int)end_id, descr, colour );

  return (retv == 0);
}
开发者ID:xicoVale,项目名称:yap-6.3,代码行数:53,代码来源:mpe.c

示例5: hidden

static int
hidden (Atom at)
{
  AtomEntry *chain;
  
  READ_LOCK(INVISIBLECHAIN.AERWLock);
  chain = RepAtom(INVISIBLECHAIN.Entry);
  while (!EndOfPAEntr (chain) && AbsAtom (chain) != at)
    chain = RepAtom(chain->NextOfAE);
  READ_UNLOCK(INVISIBLECHAIN.AERWLock);
  if (EndOfPAEntr (chain))
    return (FALSE);
  return (TRUE);
}
开发者ID:jfmc,项目名称:yap-6.3,代码行数:14,代码来源:errors.c

示例6: RestoreAtomList

static void
RestoreAtomList(Atom atm)
{
  AtomEntry      *at;

  at = RepAtom(atm);
  if (EndOfPAEntr(at))
    return;
  do {
    RestoreAtom(atm);
    atm = CleanAtomMarkedBit(at->NextOfAE);
    at = RepAtom(atm);
  } while (!EndOfPAEntr(at));
}
开发者ID:miar,项目名称:yaptab-linear,代码行数:14,代码来源:agc.c

示例7: cmp_atoms

static int
cmp_atoms(Atom a1, Atom a2)
{
  if (IsWideAtom(a1)) {
    if (IsWideAtom(a2)) {
      return wcscmp((wchar_t *)RepAtom(a1)->StrOfAE,(wchar_t *)RepAtom(a2)->StrOfAE);
    } else {
      /* The standard does not seem to have nothing on this */
      unsigned char *s1 = (unsigned char *)RepAtom(a1)->StrOfAE;
      wchar_t *s2 = (wchar_t *)RepAtom(a2)->StrOfAE;

      while (*s1 == *s2) {
	if (!*s1) return 0;
      }
      return *s1-*s2;
    }
  } else if (IsWideAtom(a2)) {
    /* The standard does not seem to have nothing on this */
    wchar_t *s1 = (wchar_t *)RepAtom(a1)->StrOfAE;
    unsigned char *s2 = (unsigned char *)RepAtom(a2)->StrOfAE;

    while (*s1 == *s2) {
      if (!*s1) return 0;
    }
    return *s1-*s2;
  } else {
    return strcmp(RepAtom(a1)->StrOfAE,RepAtom(a2)->StrOfAE);
  }
}
开发者ID:tpaiva91,项目名称:Disserta-o,代码行数:29,代码来源:cmppreds.c

示例8: SearchInInvisible

inline static Atom SearchInInvisible(const unsigned char *atom) {
  AtomEntry *chain;

  READ_LOCK(INVISIBLECHAIN.AERWLock);
  chain = RepAtom(INVISIBLECHAIN.Entry);
  while (!EndOfPAEntr(chain) && strcmp((char *)chain->StrOfAE, (char *)atom)) {
    chain = RepAtom(chain->NextOfAE);
  }
  READ_UNLOCK(INVISIBLECHAIN.AERWLock);
  if (EndOfPAEntr(chain))
    return (NIL);
  else
    return (AbsAtom(chain));
}
开发者ID:jnorthrup,项目名称:yap-6.3,代码行数:14,代码来源:adtdefs.c

示例9: prompt1

static Int prompt1(USES_REGS1) { /* prompt1(Atom)                 */
  Term t = Deref(ARG1);
  Atom a;
  if (IsVarTerm(t) || !IsAtomTerm(t))
    return (FALSE);
  LOCAL_AtPrompt = a = AtomOfTerm(t);
  if (strlen((char *)RepAtom(a)->StrOfAE) > MAX_PROMPT) {
    Yap_Error(SYSTEM_ERROR_INTERNAL, t, "prompt %s is too long",
              RepAtom(a)->StrOfAE);
    return (FALSE);
  }
  strncpy(LOCAL_Prompt, (char *)RepAtom(a)->StrOfAE, MAX_PROMPT);
  return (TRUE);
}
开发者ID:logicmoo,项目名称:yap-6.3,代码行数:14,代码来源:console.c

示例10: clean_atom_list

static void
clean_atom_list(AtomHashEntry *HashPtr)
{
  Atom atm = HashPtr->Entry;
  Atom *patm = &(HashPtr->Entry);
  while (atm != NIL) {
    AtomEntry *at =  RepAtom(atm);
    if (AtomResetMark(at) ||
	at->PropsOfAE != NIL ||
	(AGCHook != NULL && !AGCHook(atm))) {
      patm = &(at->NextOfAE);
      atm = at->NextOfAE;
    } else {
      NOfAtoms--;
      if (IsWideAtom(atm)) {
#ifdef DEBUG_RESTORE3
	fprintf(stderr, "Purged %p:%S\n", at, at->WStrOfAE);
#endif
	agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE);
      } else {
#ifdef DEBUG_RESTORE3
	fprintf(stderr, "Purged %p:%s patm=%p %p\n", at, at->StrOfAE, patm, at->NextOfAE);
#endif
	agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE);
      }
      *patm = atm = at->NextOfAE;
      Yap_FreeCodeSpace((char *)at);
    }
  }
}
开发者ID:miar,项目名称:yaptab-linear,代码行数:30,代码来源:agc.c

示例11: mark_global_cell

static CELL *
mark_global_cell(CELL *pt)
{   
  CELL reg = *pt;

  if (IsVarTerm(reg)) {
    /* skip bitmaps */
    switch(reg) {
    case (CELL)FunctorDouble:
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
      return pt + 4;
#else
      return pt + 3;
#endif
    case (CELL)FunctorBigInt:
      {
	Int sz = 3 +
	  (sizeof(MP_INT)+
	   (((MP_INT *)(pt+2))->_mp_alloc*sizeof(mp_limb_t)))/sizeof(CELL);
	return pt + sz;
      }
    case (CELL)FunctorLongInt:
      return pt + 3;
      break;
    }
  } else if (IsAtomTerm(reg)) {
    MarkAtomEntry(RepAtom(AtomOfTerm(reg)));
    return pt+1;
  }
  return pt+1;
}
开发者ID:miar,项目名称:yaptab-linear,代码行数:31,代码来源:agc.c

示例12: mark_local

static void
mark_local(void)
{
  CELL   *pt;

  /* Adjusting the local */
  pt = LCL0;
  /* moving the trail is simple */
  while (pt > ASP) {
    CELL reg = *--pt;

    if (!IsVarTerm(reg)) {
      if (IsAtomTerm(reg)
#ifdef TABLING
	  /* assume we cannot have atoms on first page,
	     so this must be an arity
	  */
	  && reg > Yap_page_size
#endif
	  ) {
	MarkAtomEntry(RepAtom(AtomOfTerm(reg)));
      }
    }
  }
}
开发者ID:miar,项目名称:yaptab-linear,代码行数:25,代码来源:agc.c

示例13: AtomTermAdjust

static inline Term
AtomTermAdjust(Term t)
{
  AtomEntry *ae = RepAtom(AtomOfTerm(t));
  MarkAtomEntry(ae);
  return(t);  
}
开发者ID:miar,项目名称:yaptab-linear,代码行数:7,代码来源:agc.c

示例14: sizeof

char *Yap_guessFileName(int f, int sno, char *nameb, size_t max) {
#if __linux__
  char path[256];
  if (snprintf(path, 255, "/proc/self/fd/%d", f) && readlink(path, nameb, max))
    return nameb;
#elif __APPLE__
  if (fcntl(f, F_GETPATH, nameb) != -1) {
    return nameb;
  }
#elif __WIN32_
  FILE_NAME_INFO *fni = (FILE_NAME_INFO *)malloc(sizeof(FILE_NAME_INFO) +
                                                 sizeof(WCHAR) * MAXPATHLEN);
  HANDLE handle = (HANDLE)_get_osfhandle(f);
  if (GetFileInformationByHandleEx(handle, FileNameInfo, &fni, max)) {
    int i;
    char *ptr = nameb;
    for (i = 0; i < fni->FileNameLength; i++)
      *ptr = _PL__utf8_put_char(ptr, fni->FileName[i]);
    *ptr = '\0';
    return nameb;
  }
#endif
  if (!StreamName(sno)) {
    return NULL;
  }
  return RepAtom(AtomOfTerm(StreamName(sno)))->StrOfAE;
}
开发者ID:jnorthrup,项目名称:yap-6.3,代码行数:27,代码来源:streams.c

示例15: LookupAtom

static void
LookupAtom(Atom at)
{
  CACHE_REGS
  const unsigned char *p = RepAtom(at)->UStrOfAE;
  CELL hash = HashFunction(p) % LOCAL_ExportAtomHashTableSize;
  export_atom_hash_entry_t *a;

  a = LOCAL_ExportAtomHashChain+hash;
  while (a->val) {
    if (a->val == at) {
      return;
    }
    a++;
    if (a == LOCAL_ExportAtomHashChain+LOCAL_ExportAtomHashTableSize)
      a = LOCAL_ExportAtomHashChain;

  }
  a->val = at;
  LOCAL_ExportAtomHashTableNum++;
  if (LOCAL_ExportAtomHashTableNum >
      LOCAL_ExportAtomHashTableSize/2
      ) {
    GrowAtomTable();
    if (!LOCAL_ExportAtomHashChain) {
      return;
    }
  }
}
开发者ID:gokhansolak,项目名称:yap-6.3,代码行数:29,代码来源:qlyw.c


注:本文中的RepAtom函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。