示例#1
0
文件: Id.cpp 项目: cr8tr/omnidome
 Id::Id(const char* _c)
 {
   make(QString(_c));
 }
示例#2
0
Signature::Signature(IdentList &idents)
{
  make(idents);
}
示例#3
0
文件: Id.cpp 项目: cr8tr/omnidome
 Id::Id(QString const& _str)
 {
   make(_str);
 }
示例#4
0
文件: amcsshe.c 项目: epu/mps
          bogusRoots[i] = (mps_addr_t)p;
      }
    }

    r = (size_t)rnd();
    if (r & 1) {
      i = (r >> 1) % exactRootsCOUNT;
      if (exactRoots[i] != objNULL)
        die(HeaderFormatCheck(exactRoots[i]), "wrapper check");
      exactRoots[i] = make(roots_count);
      if (exactRoots[(exactRootsCOUNT-1) - i] != objNULL)
        dylan_write(exactRoots[(exactRootsCOUNT-1) - i],
                    exactRoots, exactRootsCOUNT);
    } else {
      i = (r >> 1) % ambigRootsCOUNT;
      ambigRoots[(ambigRootsCOUNT-1) - i] = make(roots_count);
      /* Create random interior pointers */
      ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1);
    }

    if (r % initTestFREQ == 0)
      *(int*)busy_init = -1; /* check that the buffer is still there */

    if (objs % 1024 == 0) {
      report(arena);
      putchar('.');
      (void)fflush(stdout);
    }

    ++objs;
  }
示例#5
0
文件: amcsshe.c 项目: epu/mps
static void *test(mps_arena_t arena, mps_pool_class_t pool_class,
                  size_t roots_count)
{
  mps_fmt_t format;
  mps_chain_t chain;
  mps_root_t exactRoot, ambigRoot, bogusRoot;
  unsigned long objs; size_t i;
  mps_word_t collections, rampSwitch;
  mps_alloc_pattern_t ramp = mps_alloc_pattern_ramp();
  int ramping;
  mps_ap_t busy_ap;
  mps_addr_t busy_init;

  die(EnsureHeaderFormat(&format, arena), "fmt_create");
  die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");

  die(mps_pool_create(&pool, arena, pool_class, format, chain),
      "pool_create(amc)");

  die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
  die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2");

  for(i = 0; i < exactRootsCOUNT; ++i)
    exactRoots[i] = objNULL;
  for(i = 0; i < ambigRootsCOUNT; ++i)
    ambigRoots[i] = rnd_addr();

  die(mps_root_create_table_masked(&exactRoot, arena,
                                   mps_rank_exact(), (mps_rm_t)0,
                                   &exactRoots[0], exactRootsCOUNT,
                                   (mps_word_t)1),
      "root_create_table(exact)");
  die(mps_root_create_table(&ambigRoot, arena,
                            mps_rank_ambig(), (mps_rm_t)0,
                            &ambigRoots[0], ambigRootsCOUNT),
      "root_create_table(ambig)");
  die(mps_root_create_table(&bogusRoot, arena,
                            mps_rank_ambig(), (mps_rm_t)0,
                            &bogusRoots[0], bogusRootsCOUNT),
      "root_create_table(bogus)");

  /* create an ap, and leave it busy */
  die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy");

  collections = 0;
  rampSwitch = rampSIZE;
  die(mps_ap_alloc_pattern_begin(ap, ramp), "pattern begin (ap)");
  die(mps_ap_alloc_pattern_begin(busy_ap, ramp), "pattern begin (busy_ap)");
  ramping = 1;
  objs = 0;
  while (collections < collectionsCOUNT) {
    mps_word_t c;
    size_t r;

    c = mps_collections(arena);

    if (collections != c) {
      collections = c;
      printf("\nCollection %"PRIuLONGEST", %lu objects.\n",
             (ulongest_t)c, objs);
      report(arena);
      for (r = 0; r < exactRootsCOUNT; ++r) {
        if (exactRoots[r] != objNULL)
          die(HeaderFormatCheck(exactRoots[r]), "wrapper check");
      }
      if (collections == rampSwitch) {
        int begin_ramp = !ramping
          || /* Every other time, switch back immediately. */ (collections & 1);

        rampSwitch += rampSIZE;
        if (ramping) {
          die(mps_ap_alloc_pattern_end(ap, ramp), "pattern end (ap)");
          die(mps_ap_alloc_pattern_end(busy_ap, ramp), "pattern end (busy_ap)");
          ramping = 0;
          /* kill half of the roots */
          for(i = 0; i < exactRootsCOUNT; i += 2) {
            if (exactRoots[i] != objNULL) {
              die(HeaderFormatCheck(exactRoots[i]), "ramp kill check");
              exactRoots[i] = objNULL;
            }
          }
        }
        if (begin_ramp) {
          die(mps_ap_alloc_pattern_begin(ap, ramp),
              "pattern rebegin (ap)");
          die(mps_ap_alloc_pattern_begin(busy_ap, ramp),
              "pattern rebegin (busy_ap)");
          ramping = 1;
        }
      }
      /*  fill bogusRoots with variations of a real pointer */
      r = rnd() % exactRootsCOUNT;
      if (exactRoots[r] != objNULL) {
        char *p = (char*)exactRoots[r];

        for(i = 0; i < bogusRootsCOUNT; ++i, ++p)
          bogusRoots[i] = (mps_addr_t)p;
      }
    }

    r = (size_t)rnd();
    if (r & 1) {
      i = (r >> 1) % exactRootsCOUNT;
      if (exactRoots[i] != objNULL)
        die(HeaderFormatCheck(exactRoots[i]), "wrapper check");
      exactRoots[i] = make(roots_count);
      if (exactRoots[(exactRootsCOUNT-1) - i] != objNULL)
        dylan_write(exactRoots[(exactRootsCOUNT-1) - i],
                    exactRoots, exactRootsCOUNT);
    } else {
示例#6
0
int main()
{
    hpx::util::mem_fn(&X::f0)(make());
    hpx::util::mem_fn(&X::g0)(make());

    hpx::util::mem_fn(&X::f1)(make(), 1);
    hpx::util::mem_fn(&X::g1)(make(), 1);

    hpx::util::mem_fn(&X::f2)(make(), 1, 2);
    hpx::util::mem_fn(&X::g2)(make(), 1, 2);

    hpx::util::mem_fn(&X::f3)(make(), 1, 2, 3);
    hpx::util::mem_fn(&X::g3)(make(), 1, 2, 3);

    hpx::util::mem_fn(&X::f4)(make(), 1, 2, 3, 4);
    hpx::util::mem_fn(&X::g4)(make(), 1, 2, 3, 4);

    hpx::util::mem_fn(&X::f5)(make(), 1, 2, 3, 4, 5);
    hpx::util::mem_fn(&X::g5)(make(), 1, 2, 3, 4, 5);

    hpx::util::mem_fn(&X::f6)(make(), 1, 2, 3, 4, 5, 6);
    hpx::util::mem_fn(&X::g6)(make(), 1, 2, 3, 4, 5, 6);

    hpx::util::mem_fn(&X::f7)(make(), 1, 2, 3, 4, 5, 6, 7);
    hpx::util::mem_fn(&X::g7)(make(), 1, 2, 3, 4, 5, 6, 7);

    hpx::util::mem_fn(&X::f8)(make(), 1, 2, 3, 4, 5, 6, 7, 8);
    hpx::util::mem_fn(&X::g8)(make(), 1, 2, 3, 4, 5, 6, 7, 8);

    HPX_TEST(hash == 2155);

    return hpx::util::report_errors();
}
    CubeExample()
      : cube_instr(make_cube.Instructions())
      , cube_indices(make_cube.Indices())
      , prog(make())
      , projection_matrix(prog, "ProjectionMatrix")
      , camera_matrix(prog, "CameraMatrix")
      , model_matrix(prog, "ModelMatrix")
      , light_pos(prog, "LightPos") {
        // bind the VAO for the cube
        gl.Bind(cube);

        gl.Bind(Buffer::Target::Array, verts);
        {
            std::vector<GLfloat> data;
            GLuint n_per_vertex = make_cube.Positions(data);
            Buffer::Data(Buffer::Target::Array, data);
            (prog | "Position").Setup<GLfloat>(n_per_vertex).Enable();
        }

        gl.Bind(Buffer::Target::Array, normals);
        {
            std::vector<GLfloat> data;
            GLuint n_per_vertex = make_cube.Normals(data);
            Buffer::Data(Buffer::Target::Array, data);
            (prog | "Normal").Setup<GLfloat>(n_per_vertex).Enable();
        }

        gl.Bind(Buffer::Target::Array, tangents);
        {
            std::vector<GLfloat> data;
            GLuint n_per_vertex = make_cube.Tangents(data);
            Buffer::Data(Buffer::Target::Array, data);
            (prog | "Tangent").Setup<GLfloat>(n_per_vertex).Enable();
        }

        gl.Bind(Buffer::Target::Array, texcoords);
        {
            std::vector<GLfloat> data;
            GLuint n_per_vertex = make_cube.TexCoordinates(data);
            Buffer::Data(Buffer::Target::Array, data);
            (prog | "TexCoord").Setup<GLfloat>(n_per_vertex).Enable();
        }

        {
            auto img = images::SphereBumpMap(512, 512, 2, 2);
            Uniform<GLsizei>(prog, "BumpTexWidth").Set(img.Width());
            Uniform<GLsizei>(prog, "BumpTexHeight").Set(img.Height());
            UniformSampler(prog, "BumpTex").Set(0);
            Texture::Active(0);

            gl.Bound(Texture::Target::_2D, bumpTex)
              .MinFilter(TextureMinFilter::LinearMipmapLinear)
              .MagFilter(TextureMagFilter::Linear)
              .WrapS(TextureWrap::Repeat)
              .WrapT(TextureWrap::Repeat)
              .Image2D(img)
              .GenerateMipmap();
        }
        //
        gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);
        gl.ClearDepth(1.0f);
        gl.Enable(Capability::DepthTest);

        gl.Enable(Capability::CullFace);
        gl.FrontFace(make_cube.FaceWinding());
    }
示例#8
0
DoubleVector DoubleVector::operator/(int num)
{
	return make(*this, '/', num);
}
示例#9
0
DoubleVector DoubleVector::operator%(DoubleVector& rightVec)
{
	return make(rightVec, '%');
}
示例#10
0
void Label::setText(const char* text) {
    free(text_);
    text_ = (char*) malloc(strlen(text) + 1);
    strcpy(text_, text);
    make();
}
示例#11
0
DoubleVector DoubleVector::operator-(DoubleVector& rightVec)
{
	shouldResize(rightVec);
	return make(rightVec, '-');
}
示例#12
0
void Label::setSize(int size) {
    size_ = size;
    make();
}
示例#13
0
void Label::setFace(const char* face) {
    free(face_);
    face_ = (char*) malloc(strlen(face) + 1);
    strcpy(face_, face);
    make();
}
示例#14
0
 sptr get_new(boost::shared_array<char> mem, size_t len){
     _mem = mem;
     return make(this, _mem.get(), len);
 }
示例#15
0
文件: http.hpp 项目: vast-io/vast
 bool parse(Iterator& f, const Iterator& l, unused_type) const {
   static auto p = make();
   return p(f, l, unused);
 }
示例#16
0
void reset() {
 ::reset();
   if (!present("magician"))
     make(MOB"2t2");
}
示例#17
0
文件: http.hpp 项目: vast-io/vast
 bool parse(Iterator& f, const Iterator& l, http::header& a) const {
   static auto p = make();
   a.name.clear();
   a.value.clear();
   return p(f, l, a.name, a.value);
 }
示例#18
0
	ShadowProg(void)
	 : Program(make())
	 , projection_matrix(self(), "ProjectionMatrix")
	 , camera_matrix(self(), "CameraMatrix")
	 , fade(self(), "Fade")
	{ }
示例#19
0
List::List()
  : Value()
{
    make(TYPES.list, this);
}
示例#20
0
void item::deserialize(JsonObject &data)
{
    init();
    clear();

    std::string idtmp="";
    std::string ammotmp="null";
    int lettmp = 0;
    std::string corptmp = "null";
    int damtmp = 0;

    if ( ! data.read( "typeid", idtmp) ) {
        debugmsg("Invalid item type: %s ", data.str().c_str() );
        idtmp = "null";
    }

    data.read( "charges", charges );
    data.read( "burnt", burnt );
    data.read( "poison", poison );
    data.read( "owned", owned );

    data.read( "bday", bday );

    data.read( "mode", mode );
    data.read( "mission_id", mission_id );
    data.read( "player_id", player_id );

    if (!data.read( "corpse", corptmp )) {
        int ctmp = -1;
        data.read( "corpse", ctmp );
        if (ctmp != -1) {
            corptmp = legacy_mon_id[ctmp];
        } else {
            corptmp = "null";
        }
    }
    if (corptmp != "null") {
        corpse = GetMType(corptmp);
    } else {
        corpse = NULL;
    }

    make(itypes[idtmp]);

    if ( ! data.read( "name", name ) ) {
        name=type->name;
    }

    data.read( "invlet", lettmp );
    invlet = char(lettmp);

    data.read( "damage", damtmp );
    damage = damtmp; // todo: check why this is done after make(), using a tmp variable
    data.read( "active", active );
    data.read( "fridge", fridge );

    data.read( "curammo", ammotmp );
    if ( ammotmp != "null" ) {
        curammo = dynamic_cast<it_ammo*>(itypes[ammotmp]);
    } else {
        curammo = NULL;
    }

    data.read("item_tags", item_tags);

    JsonObject pvars = data.get_object("item_vars");
    std::set<std::string> members = pvars.get_member_names();
    for ( std::set<std::string>::iterator pvarsit = members.begin();
            pvarsit != members.end(); ++pvarsit ) {
        if ( pvars.has_string( *pvarsit ) ) {
            item_vars[ *pvarsit ] = pvars.get_string( *pvarsit );
        }
    }

    int tmplum=0;
    if ( data.read("light",tmplum) ) {

        light=nolight;
        int tmpwidth=0;
        int tmpdir=0;

        data.read("light_width",tmpwidth);
        data.read("light_dir",tmpdir);
        light.luminance = tmplum;
        light.width = (short)tmpwidth;
        light.direction = (short)tmpdir;
    }

    data.read("contents", contents);
}