當前位置: 首頁>>代碼示例>>C++>>正文


C++ Atom函數代碼示例

本文整理匯總了C++中Atom函數的典型用法代碼示例。如果您正苦於以下問題:C++ Atom函數的具體用法?C++ Atom怎麽用?C++ Atom使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Atom函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: sizeof

thing_th *Primordial_Err(thing_th *messages, int shallReg) {
    err_th *this_error=calloc(1, sizeof(err_th));
    this_error->kind=error_k;
    this_error->CAR=Atom("err");
    this_error->CDR=messages;
    return shallReg ? reg_thing((thing_th *)this_error) : (thing_th *)this_error;
}
開發者ID:gregghz,項目名稱:funky,代碼行數:7,代碼來源:funky_data.c

示例2: switch

thing_th *funky_def(thing_th *args) {
    switch(th_kind(Car(args))) {
        case atom_k:
            return env_set(sym(Car(args)),
                           define_procedure(Cdr(args)));
        case cons_k:
            return define_procedure(args);
        default:
            return Err(Cons(Atom(ERRMSG_TYPES),
                            Cons(Atom(ERRMSG_BADDEF), NULL)));
    }
    if(th_kind(Car(args))==atom_k)
        return env_set(sym(Car(args)), 
                       define_procedure(Cdr(args)));
    return define_procedure(args);
}
開發者ID:gregghz,項目名稱:funky,代碼行數:16,代碼來源:funky_op.c

示例3: switch

static thing_th *dup_cell(thing_th *thing) {
    switch(th_kind(thing)) {
        case number_k:
            return Number(sym(thing));
        case string_k:
            return String(sym(thing));
        case atom_k:
            return Atom(sym(thing));
        case cons_k:
            return Cons(Car(thing), Cdr(thing));
        case error_k:
            return Err(Cdr(thing));
        case procedure_k:
            return Proc(Car(thing), Cdr(thing));
        case macro_k:
            return Mac(Car(thing), Cdr(thing));
        case gen_k:
            return Gen(Car(thing), Cdr(thing));
        case routine_k:
            return Routine(call_rt(thing));
        case method_k:
            return Method(call_rt(thing));
        case grid_k:
            return duplicate_grid(thing);
        case null_k:
            return NULL;
    }
}
開發者ID:gregghz,項目名稱:funky,代碼行數:28,代碼來源:funky_data.c

示例4: CheckConnectorUsageMain

void CheckConnectorUsageMain( CgContext *cg, Symbol *program, Stmt *fStmt)
{
  Symbol *outConn, *lSymb;
  Type *cType;
  int len, cid;
  Binding *lBind;
  
  outConn = cg->theHal->varyingOut;
  if (!outConn || !outConn->type)
    return;
  cType = outConn->type;
  cid = static_cast< TypeStruct * >( cType )->variety;
  len = cg->theHal->GetConnectorRegister(cid, 1, Atom(), NULL);
  ApplyToTopExpressions( cg, CheckConnectorUsage, fStmt, NULL, 0);
  lSymb = static_cast< TypeStruct * >( cg->theHal->varyingOut->type )->members->symbols;
  // This doesn't work!  The output value is always written by the return statement!  RSG
  while (lSymb) {
    lBind = lSymb->details.var.bind;
    if (lBind) {
      if ((lBind->properties & BIND_WRITE_REQUIRED) &&
          !(lBind->properties & BIND_WAS_WRITTEN))
      {
        SemanticWarning( cg, &program->loc, WARNING_S_CMEMBER_NOT_WRITTEN,
                        cg->GetString( lBind->name ));
      }
    }
    lSymb = lSymb->next;
  }
} // CheckConnectorUsageMain
開發者ID:casseveritt,項目名稱:sx,代碼行數:29,代碼來源:check.cpp

示例5: caml_alloc_dummy_float

CAMLprim value caml_alloc_dummy_float (value size)
{
  mlsize_t wosize = Int_val(size) * Double_wosize;

  if (wosize == 0) return Atom(0);
  return caml_alloc (wosize, 0);
}
開發者ID:OpenXT,項目名稱:ocaml,代碼行數:7,代碼來源:alloc.c

示例6: sys_remove

value sys_remove(value name)
{
  int ret;
  ret = unlink(String_val(name));
  if (ret != 0) sys_error(String_val(name));
  return Atom(0);
}
開發者ID:alepharchives,項目名稱:exsml,代碼行數:7,代碼來源:sys.c

示例7: Spec

HEADER_DECLARE
Term* Spec(atom_t atom, int size){
    FRAME_ENTER;
    FRAME_LOCAL(tatom) = Atom(atom);
    FRAME_LOCAL(tsize) = Integer(size);
    FRAME_RETURN(Term*, Functor2(atom_slash, tatom, tsize));
}
開發者ID:AtnNn,項目名稱:Theremin,代碼行數:7,代碼來源:term.c

示例8: alloc_host_entry

static value alloc_host_entry(struct hostent *entry)
{
  value res;
  value name = Val_unit, aliases = Val_unit;
  value addr_list = Val_unit, adr = Val_unit;

  Begin_roots4 (name, aliases, addr_list, adr);
    name = copy_string((char *)(entry->h_name));
    /* PR#4043: protect against buggy implementations of gethostbyname()
       that return a NULL pointer in h_aliases */
    if (entry->h_aliases)
      aliases = copy_string_array((const char**)entry->h_aliases);
    else
      aliases = Atom(0);
    entry_h_length = entry->h_length;
#ifdef h_addr
    addr_list = alloc_array(alloc_one_addr, (const char**)entry->h_addr_list);
#else
    adr = alloc_one_addr(entry->h_addr);
    addr_list = alloc_small(1, 0);
    Field(addr_list, 0) = adr;
#endif
    res = alloc_small(4, 0);
    Field(res, 0) = name;
    Field(res, 1) = aliases;
    switch (entry->h_addrtype) {
    case PF_UNIX:          Field(res, 2) = Val_int(0); break;
    case PF_INET:          Field(res, 2) = Val_int(1); break;
    default: /*PF_INET6 */ Field(res, 2) = Val_int(2); break;
    }
    Field(res, 3) = addr_list;
  End_roots();
  return res;
}
開發者ID:dirkdokter,項目名稱:pprz-installer-fedora,代碼行數:34,代碼來源:gethost.c

示例9: blit_string

value blit_string(value s1, value offset1, value s2, value offset2, value len) /* ML */
{
  bcopy(&Byte(s1, Long_val(offset1)),
        &Byte(s2, Long_val(offset2)),
        Int_val(len));
  return Atom(0);
}
開發者ID:Athas,項目名稱:mosml,代碼行數:7,代碼來源:str.c

示例10: caml_alloc_dummy

CAMLprim value caml_alloc_dummy(value size)
{
  mlsize_t wosize = Int_val(size);

  if (wosize == 0) return Atom(0);
  return caml_alloc (wosize, 0);
}
開發者ID:OpenXT,項目名稱:ocaml,代碼行數:7,代碼來源:alloc.c

示例11: Column

void Parser::atom() {
    if (tokens[look].type == REGEX_) {
        atoms.push_back(Atom(REG, 0, 0, tokens[look].value, Column()));
        match(REGEX_);
    } else {
        match(LESSTHAN);
        if (tokens[look].type == TOKEN) {
            match(TOKEN);
        } else {
            column();
            cols[col[1]] = col[0];
            atoms.push_back(Atom(COLUMN, 0, 0, col[1], Column()));
        }
        match(GREATETHAN);
    }
}
開發者ID:blacider,項目名稱:compiler,代碼行數:16,代碼來源:Parser.cpp

示例12: copy_string_option_array

static inline value copy_string_option_array(const char** strs, int len)
{
  if (!len) return Atom(0);
  else {
    CAMLparam0();
    CAMLlocal2(v_str, v_res);
    int i;

    v_res = caml_alloc(len, 0);

    for (i = 0; i < len; ++i) {
      const char *str = strs[i];
      if (str == NULL) Field(v_res, i) = Val_None;
      else {
        value v_opt;
        v_str = caml_copy_string(str);
        v_opt = caml_alloc_small(1, 0);
        Field(v_opt, 0) = v_str;
        Store_field(v_res, i, v_opt);
      }
    }

    CAMLreturn(v_res);
  }
}
開發者ID:Moondee,項目名稱:caut-lib,代碼行數:25,代碼來源:sqlite3_stubs.c

示例13: ml_gtk_init

CAMLprim value ml_gtk_init (value argv)
{
    CAMLparam1 (argv);
    int argc = Wosize_val(argv), i;
    CAMLlocal1 (copy);

    copy = (argc ? alloc (argc, Abstract_tag) : Atom(0));
    for (i = 0; i < argc; i++) Field(copy,i) = Field(argv,i);
    if( !gtk_init_check (&argc, (char ***)&copy) ){
      ml_raise_gtk ("ml_gtk_init: initialization failed");
    }

    argv = (argc ? alloc (argc, 0) : Atom(0));
    for (i = 0; i < argc; i++) modify(&Field(argv,i), Field(copy,i));
    CAMLreturn (argv);
}
開發者ID:CRogers,項目名稱:obc,代碼行數:16,代碼來源:ml_gtk.c

示例14: H3

Molecule H3()
{
    int nAtoms = 3;

    Eigen::Vector3d H1( 0.735000, 0.000000, -1.333333);
    Eigen::Vector3d H2(-0.735000, 0.000000, -1.333333);
    Eigen::Vector3d H3( 0.000000, 0.000000,  2.666667);

    Eigen::MatrixXd geom(3, nAtoms);
    geom.col(0) = H1.transpose();
    geom.col(1) = H2.transpose();
    geom.col(2) = H3.transpose();
    Eigen::Vector3d charges, masses;
    charges << 1.0, 1.0, 1.0;
    masses  << 1.0078250, 1.0078250, 1.0078250;

    std::vector<Atom> atoms;
    double radiusH = (1.20 * 1.20) / convertBohrToAngstrom;
    atoms.push_back( Atom("Hydrogen", "H", charges(0), masses(0), radiusH, H1, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H", charges(1), masses(1), radiusH, H2, 1.0) );
    atoms.push_back( Atom("Hydrogen", "H", charges(2), masses(2), radiusH, H3, 1.0) );

    std::vector<Sphere> spheres;
    Sphere sph2(H1, radiusH);
    Sphere sph3(H2, radiusH);
    Sphere sph4(H3, radiusH);
    spheres.push_back(sph2);
    spheres.push_back(sph3);
    spheres.push_back(sph4);

    enum pointGroup { pgC1, pgC2, pgCs, pgCi, pgD2, pgC2v, pgC2h, pgD2h };
    Symmetry pGroup;
    switch(group) {
    case(pgC1):
        pGroup = buildGroup(0, 0, 0, 0);
        break;
    case(pgC2v):
        // C2v as generated by Oyz and Oxz
        pGroup = buildGroup(2, 1, 2, 0);
        break;
    default:
        pGroup = buildGroup(0, 0, 0, 0);
        break;
    }

    return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup);
};
開發者ID:loriab,項目名稱:pcmsolver,代碼行數:47,代碼來源:TestingMolecules.hpp

示例15: sys_close

value sys_close(value fd)
{
	if (close(VAL_TO_INT(fd)) != 0) {
		sys_error(NULL);
	}

	return Atom(0);
}
開發者ID:alepharchives,項目名稱:exsml,代碼行數:8,代碼來源:sys.c


注:本文中的Atom函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。