void ThousandClientDataParser::inListAllNewGame(QByteArray &data)
{
    QDataStream in(data);
    QList<GameThousand> gamesList;
    QList<Player> players;
    QString player;
    quint16 time,id;
    quint8 number;
    int size,nick_size;
    in>>size;
    for(int i=0; i<size; i++) {
        players.clear();
        in>>id;
        in>>number;
        for(quint8 j=0; j<number; j++) {
            in>>nick_size;
            in>>player;
            Player pl(player);
            players.append(pl);
        }
        in>>time;
        GameThousand game(players,number,time);
        gamesList.append(game);
    }
    emit(compliteListAllNewGame(gamesList));
}
Example #2
0
/**
 * compile one file if filename is NULL redirect do to stdin/stdout
 * @param file filename
 * @return 
 */
void compile(char *file) {
    if (file == NULL || filename_typeof(file) == 'c') {
        global_table_index = 0;
        local_table_index = NUMBER_OF_GLOBALS;
        while_table_index = 0;
        tag_table_index = 0;
        inclsp =
        iflevel =
        skiplevel =
        swstp =
        litptr =
        stkp =
        errcnt =
        ncmp =
        lastst =
        //quote[1] =
        0;
        input2 = -1;
        //quote[0] = '"';
        cmode = 1;
        glbflag = 1;
        nxtlab = 0;
        litlab = getlabel();
        defmac("end\tmemory");
        //add_global("memory", ARRAY, CCHAR, 0, EXTERN);
        //add_global("stack", ARRAY, CCHAR, 0, EXTERN);
        rglobal_table_index = global_table_index; //rglbptr = glbptr;
        //add_global("etext", ARRAY, CCHAR, 0, EXTERN);
        //add_global("edata", ARRAY, CCHAR, 0, EXTERN);
        defmac("short\tint");
        initmac();
        // compiler body
        if (file == NULL) {
            input = 0;
        } else if (!openin(file))
            return;
        if (file == NULL) {
            output = 1;
        } else if (!openout())
            return;
        header();
        code_segment_gtext();
        parse();
        close(input);
        data_segment_gdata();
        dumplits();
        dumpglbs();
        errorsummary();
        trailer();
        oflush();
        close(output);
        pl("");
        errs = errs || errfile;
    } else {
        writee("Don't understand file ");
        writee(file);
        errs = 1;
    }
}
Example #3
0
File: c80.c Project: adamsch1/scc
openin()
{
  input=0;    /* none to start with */
  while(input==0){  /* any above 1 allowed */
    kill();    /* clear line */
    if(eof)break;  /* if user said none */
    pl("Input filename? ");
    gets(line);  /* get a name */
    if(ch()==0)
      {eof=1;break;} /* none given... */
    if((input=fopen(line,"r"))==NULL)
      {input=0;  /* can't open it */
      pl("Open failure");
      }
    }
  kill();    /* erase line */
  }
Example #4
0
clearbatch()
{
nl();
nl();
put("1Really clear batch [4y/N1]:2 ");
if(ny())
	{
	nl();
	pl("4Batch not cleared.");
	}
else
	{
	nl();
	pl("4Batch cleared.");
	que.files=0;
	}
}
Example #5
0
int
main (int argc, char *argv[])
{
  QCoreApplication app(argc,argv);
  subway::dubway::PluginLoader pl((app.applicationDirPath()+"/plugin.so").toLocal8Bit());
  QObject *qo = pl.instance ("A");
  QMetaObject::invokeMethod (qo, "testa");
  return app.exec();
}
Example #6
0
int main()
{
  Arr_with_hist_2   arr;

  // Insert s1, s2 and s3 incrementally:
  Segment_2 s1(Point_2(0, 3), Point_2(4, 3));
  insert(arr, s1);
  Segment_2 s2(Point_2(3, 2), Point_2(3, 5));
  insert(arr, s2);
  Segment_2 s3(Point_2(2, 3), Point_2(5, 3));
  insert(arr, s3);

  // Insert three additional segments aggregately:
  Segment_2 segs[3];
  segs[0] = Segment_2(Point_2(2, 6), Point_2(7, 1));
  segs[1] = Segment_2(Point_2(0, 0), Point_2(2, 6));
  segs[2] = Segment_2(Point_2(3, 4), Point_2(6, 4));
  insert(arr, segs, segs + 3);

  // Print out the curves and the number of edges each one induces.
  Arr_with_hist_2::Curve_iterator            cit;

  std::cout << "The arrangement contains "
            << arr.number_of_curves() << " curves:" << std::endl;
  for (cit = arr.curves_begin(); cit != arr.curves_end(); ++cit)
    std::cout << "Curve [" << *cit << "] induces "
              << arr.number_of_induced_edges(cit) << " edges." << std::endl; 

  // Print the arrangement edges, along with the list of curves that
  // induce each edge.
  Arr_with_hist_2::Edge_iterator                  eit;
  Arr_with_hist_2::Originating_curve_iterator     ocit;

  std::cout << "The arrangement is comprised of "
            << arr.number_of_edges() << " edges:" << std::endl;
  for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
    std::cout << "[" << eit->curve() << "]. Originating curves: ";
    for (ocit = arr.originating_curves_begin (eit);
         ocit != arr.originating_curves_end (eit); ++ocit)
    {
      std::cout << " [" << *ocit << "]" << std::flush;
    }
    std::cout << std::endl;
  }

  // Perform some point-location queries:
  Point_location   pl(arr);

  Point_2          p1(4, 6);
  point_location_query(pl, p1);
  Point_2          p2(6, 2);
  point_location_query(pl, p2);
  Point_2          p3(2, 4);
  point_location_query(pl, p3);

  return 0;
}
Example #7
0
void DrawPolyLine( AcGiWorldDraw* mode, const AcGePoint3d& spt, const AcGePoint3d& ept, double width )
{
    AcDbPolyline pl( 2 );
    pl.addVertexAt( 0, Point3D_To_2D( spt ) );
    pl.addVertexAt( 1, Point3D_To_2D( ept ) );
    pl.setConstantWidth( width );

    pl.worldDraw( mode );
}
Example #8
0
shared_hid_file create(const std::string& filepath, const file_access_props& aprops)
{
    hid_t file_id;
    shared_hid_proplist pl(proplist::create(proplist::_H5P_FILE_ACCESS));
    aprops.apply(pl.hid());

    H5CPP_ERR_ON_NEG(file_id = H5Fcreate(filepath.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, pl.id()));
    return shared_hid_file(hid_file(file_id));
}
Example #9
0
title(char *list)
{
char s[80];
int i,line,len,width;

line=strlen(list);

if(line%2==0)
	width=30;
else
	width=29;


len=(width-line)/2;

ansic(6);
s[0]=0;
s[0]=214;                  /* 218 */
for(i=0;i < width;i++)
	s[i+1]=196;
s[i]=183;						/* 191 */
s[i+1]=0;
pl(s);
s[0]=186;						/* 179 */
for(i=0;i < len;i++)
	s[i+1]=32;
s[i]=0;
strcat(s,"7");
strcat(s,list);
strcat(s,"6");
put(s);
for(i=0;i < len;i++)
	s[i]=32;
s[i]=186;						/* 179 */
s[i+1]=0;
pl(s);
s[0]=211;						/* 192 */
for(i=0;i < width;i++)
	s[i+1]=196;
s[i]=189;     					/* 217 */
s[i+1]=0;
pl(s);
nl();
}
bool KstPluginDialogI::editObject() {
    KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
    if (!pp) { // something is dreadfully wrong - this should never happen
        return false;
    }

    KstWriteLocker pl(pp);

    if (_tagName->text() != pp->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) {
        _tagName->setFocus();
        return false;
    }

    pp->setTagName(KstObjectTag(_tagName->text(), KstObjectTag::globalTagContext));  // FIXME: tag context always global?

    int pitem = _w->PluginCombo->currentItem();
    KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);

    pp->setRecursed(false);
    pp->inputVectors().clear();
    pp->inputScalars().clear();
    pp->inputStrings().clear();

    // Save the vectors and scalars
    if (!saveInputs(pp, pPtr)) {
        KMessageBox::sorry(this, i18n("There is an error in the inputs you entered."));
        return false;
    }

    if (pitem >= 0 && _w->PluginCombo->count() > 0) {
        pp->setPlugin(pPtr);
    }

    if (!saveOutputs(pp, pPtr)) {
        KMessageBox::sorry(this, i18n("There is an error in the outputs you entered."));
        return false;
    }

    if (!pp->isValid()) {
        KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
        return false;
    }

    pp->setRecursed(false);
    if (pp->recursion()) {
        pp->setRecursed(true);
        KMessageBox::sorry(this, i18n("There is a recursion resulting from the plugin you entered."));
        return false;
    }

    pp->setDirty();

    emit modified();

    return true;
}
Example #11
0
int main() {
  std::cout << "initial:\n";
  Plorg pl("JNU");
  pl.show();

  std::cout << "update ci:\n";
  pl.updateCI(3);
  pl.show();
  return 0;
}
Example #12
0
int MusicLib::addtoPlaylist(Song & song, char* playlist)
{
	int rtn = 0;
	Playlist pl(playlist);
	if(playlists.contains(pl)) // pulls playlist if existent
		rtn = 1; // playlist did not need to be added
	pl.addSong(song); // add song
	playlists.put(pl); // [re-]insert playlist w/ new song
	return rtn;
}
Example #13
0
// Searches for playlist and copies existing songs to result
int MusicLib::getByPlaylist(char* playlist, jnickg::adt::List<Song> & result)
{
	result.clear(true);
	int rtn = 0;
	Playlist pl(playlist);
	if(playlists.contains(pl))
		rtn = 1;
	pl.getSongs(result);
	return rtn;
}
bool BinnedMapDialogI::newObject() {
  //called upon clicking 'ok' in 'new' mode
  //return false if the specified objects can't be made, otherwise true

  QString tagName = _tagName->text();

  if (tagName != defaultTag && KstData::self()->dataTagNameNotUnique(tagName, true, this)) {
    _tagName->setFocus();
    return false;
  }

  //Need to create a new object rather than use the one in KstDataObject pluginList
  BinnedMapPtr map = kst_cast<BinnedMap>(KstDataObject::createPlugin("Binned Map"));
  Q_ASSERT(map); //should never happen...

  KstWriteLocker pl(map);

  if (tagName == defaultTag) {
    tagName = KST::suggestPluginName("binnedmap");
  }
  map->setTagName(KstObjectTag::fromString(tagName));

  // Save the vectors and scalars
  if (!editSingleObject(map) || !map->isValid()) {
    KMessageBox::sorry(this, i18n("There is an error in the values you entered."));
    return false;
  }

  map->setMap(_w->_binnedMap->text());
  map->setHitsMap(_w->_hitsMap->text());

  if (!map || !map->isValid()) {
    KMessageBox::sorry(this, i18n("There is an error in the binned map you entered."));
    return false;
  }

  //xxxx
  map->setXMin(_w->_Xmin->text().toDouble());
  map->setXMax(_w->_Xmax->text().toDouble());
  map->setYMin(_w->_Ymin->text().toDouble());
  map->setYMax(_w->_Ymax->text().toDouble());

  map->setNX(_w->_Xn->value());
  map->setNY(_w->_Yn->value());
  map->setAutoBin(_w->_realTimeAutoBin->isChecked());

  map->setDirty();
  KST::dataObjectList.lock().writeLock();
  KST::dataObjectList.append(map.data());
  KST::dataObjectList.lock().unlock();
  map = 0L; // drop the reference
  emit modified();

  return true;
}
TCGbool TCGClient::main(TCGint argc, TCGchar **argv)
{
    Init(argc, argv, NULL);

    try
    {
        BasicWindow<Playback<CPlaybackAdapter>>     win(m_play);
        TokenizerType                               tok(m_tokHeader, &m_stream);
#ifdef API_DUMP
        ApiAnalyzer                                 apiAnalyzer(g_args.analyze, TCG_DEBUG_OUTPUT_PATH, NULL, g_args);
        CPlayer                                     pl(win, *m_pLibs, tok.fileformatversion(), &apiAnalyzer, &m_stream);
#else
        CPlayer                                     pl(win, *m_pLibs, tok.fileformatversion(), &m_stream);
#endif
        Parser                                      parser(pl, tok);

        g_pPlayer = &pl;

#ifdef API_DUMP
        apiAnalyzer.SetPlayer(&pl);
#endif

        TCGLOG(TCG_INFO, TCG_CLIENT_OS, "Start cloud render playback...\n");
        parser.ParseAll();
        TCGLOG(TCG_INFO, TCG_CLIENT_OS, "\ncloud render playback is completed.\n\n");
    }
    catch (const exception& e)
    {
        std::string err = e.what();
        TCGLOG(TCG_ERROR, TCG_CLIENT_OS, "\n\nException: %s\n\n", err.c_str());
        tcgOS_TerminalUninit();
        tcgOS_Sync();
    }
    catch (...)
    {
        TCGLOG(TCG_ERROR, TCG_CLIENT_OS, "Unexpected Exception\n");
        tcgOS_TerminalUninit();
        tcgOS_Sync();
    }

    return TCG_TRUE;
}
Example #16
0
delbatfile()
{
char s[80];
int i;

nl();
nl();

if(que.files==0)
	{
	pl("4No files in batch.");
	return;
	}

while(1)
	{
	put("1Delete which file from batch [4Name/Number1][4?/List1]:2 ");
	input(s,50);
	switch(s[0])
		{
		case 0:
			return;
		case '?':
			listbatch();
			nl();
			break;
		default:
			i=atoi(s);
			if(i < 1 || i > que.files)
				{
				nl();
				pl("4Invalid file.");
				return;
				}
			else
				{
				delbfile(i);
				return;
				}
		}
	}
}
Example #17
0
void CScriptCameraPitchVolume::Touch(CActor& act, CStateManager& mgr) {
  TCastToPtr<CPlayer> pl(act);
  if (!pl)
    return;

  auto plBox = pl->GetTouchBounds();
  if (!plBox)
    return;

  x13c_24_entered = xe8_obbox.AABoxIntersectsBox(plBox.value());
}
void meshUntangler::optimizeNodePosition(const scalar tol)
{
    # ifdef DEBUGSmooth
    Info << "Untangling point " << pointI_ << endl;
    # endif

    cutRegion cr(bb_);

    forAll(tets_, tetI)
    {
        const partTet& tet = tets_[tetI];
        vector n
        (
            (points_[tet.b()] - points_[tet.a()]) ^
            (points_[tet.c()] - points_[tet.a()])
        );

        if( mag(n) < VSMALL ) continue;

        plane pl(points_[tet.a()], n);

        # ifdef DEBUGSmooth
        Info << "tet.a() " << tet.a() << endl;
        Info << "Cutting plane ref point " << pl.refPoint() << endl;
        Info << "Cutting plane normal " << pl.normal() << endl;
        # endif

        cr.planeCut(pl);
    }

    if( cr.points().size() )
    {
        point p(vector::zero);

        const DynList<point, 64>& pts = cr.points();
        forAll(pts, pI)
            p += pts[pI];

        p /= pts.size();

        # ifdef DEBUGSmooth
        Info << "Corners of the feasible region " << pts << endl;
        # endif

        for(direction i=0;i<vector::nComponents;++i)
        {
            const scalar& val = p[i];
            if( (val != val) || ((val - val) != (val - val)) )
                return;
        }

        points_[pointI_] = p;
    }
}
Example #19
0
shared_hid_file open(const std::string& filepath, bool readonly, const file_access_props& aprops)
{
    hid_t file_id;
    shared_hid_proplist pl(proplist::create(proplist::_H5P_FILE_ACCESS));
    aprops.apply(pl.hid());

    H5CPP_ERR_ON_NEG(file_id = H5Fopen(filepath.c_str(),
                                       (readonly)? H5F_ACC_RDONLY : H5F_ACC_RDWR, pl.id()));

    return shared_hid_file(hid_file(file_id));
}
Example #20
0
int mainOE(int argc, char **argv) {
	unsigned int ws[][2] = {{1000000,100},{777777,100},{640487,100},{47360,100},{10127,100},
			{9873,100},{8153,100},{7543,100},{6937,100},{5342,100},{4283,100},
				{3761,100},{2344,100},{231,100},{123,12}};
	PrimesLoader pl("P1.TXT");
    unsigned int cufOff = pl.loadPrimes(ws[0][0],1000000);				
	SearchMetaData* md = bnb_oddEven_Cost_search(ws,length(ws),pl.primeVector(),cufOff,false,true);
	md->print();
	delete md;
	return 0; 
}
Example #21
0
 Vec3f getSnapPoint(Vec3f p) {
     if (translation == POINT) snapP = Vec3f(prim_t.getPosition());
     if (translation == LINE) snapP = prim_t.getClosestPoint(local(p)).subZero(); // project on line
     if (translation == PLANE) {
         Plane pl(prim_t.getDirection(), prim_t.getPosition());
         p = local(p);
         float d = pl.distance(p); // project on plane
         snapP = p + d*pl.getNormal();
     }
     return snapP;
 }
void CompiledIC::internal_set_ic_destination(address entry_point, bool is_icstub, void* cache, bool is_icholder) {
  assert(entry_point != NULL, "must set legal entry point");
  assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
  assert (!is_optimized() || cache == NULL, "an optimized virtual call does not have a cached metadata");
  assert (cache == NULL || cache != (Metadata*)badOopVal, "invalid metadata");

  assert(!is_icholder || is_icholder_entry(entry_point), "must be");

  // Don't use ic_destination for this test since that forwards
  // through ICBuffer instead of returning the actual current state of
  // the CompiledIC.
  if (is_icholder_entry(_ic_call->destination())) {
    // When patching for the ICStub case the cached value isn't
    // overwritten until the ICStub copied into the CompiledIC during
    // the next safepoint.  Make sure that the CompiledICHolder* is
    // marked for release at this point since it won't be identifiable
    // once the entry point is overwritten.
    InlineCacheBuffer::queue_for_release((CompiledICHolder*)_value->data());
  }

  if (TraceCompiledIC) {
    tty->print("  ");
    print_compiled_ic();
    tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
    if (!is_optimized()) {
      tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
    }
    if (is_icstub) {
      tty->print(" (icstub)");
    }
    tty->cr();
  }

  {
    MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
#ifdef ASSERT
    CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
    assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
#endif
     _ic_call->set_destination_mt_safe(entry_point);
  }

  if (is_optimized() || is_icstub) {
    // Optimized call sites don't have a cache value and ICStub call
    // sites only change the entry point.  Changing the value in that
    // case could lead to MT safety issues.
    assert(cache == NULL, "must be null");
    return;
  }

  if (cache == NULL)  cache = (void*)Universe::non_oop_word();

  _value->set_data((intptr_t)cache);
}
Example #23
0
void DrawPolyLine( AcGiWorldDraw* mode, const AcGePoint3d& pt, double angle, double length, double width )
{
    AcGeVector3d v( AcGeVector3d::kXAxis );
    v.rotateBy( angle, AcGeVector3d::kZAxis );

    AcDbPolyline pl( 2 );
    pl.addVertexAt( 0, Point3D_To_2D( pt ) );
    pl.addVertexAt( 1, Point3D_To_2D( pt + v * length ) );
    pl.setConstantWidth( width );

    pl.worldDraw( mode );
}
Example #24
0
void
PitchChooser::slotSetPitch(int p)
{
    if (m_pitch->value() != p)
        m_pitch->setValue(p);
    if (m_pitchDragLabel->getPitch() != p)
        m_pitchDragLabel->slotSetPitch(p);

    MidiPitchLabel pl(p);
    m_pitchLabel->setText(pl.getQString());
    update();
}
bool KstFilterDialogI::newObject() {
  QString tagName = _tagName->text();

  if (KstData::self()->dataTagNameNotUnique(tagName, true, this)) {
    _tagName->setFocus();
    return false;
  } else {
    int pitem = _w->PluginCombo->currentItem();

    if (pitem >= 0 && _w->PluginCombo->count() > 0) {
      KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);

      if (pPtr) {
        KstCPluginPtr plugin = new KstCPlugin;
        KstWriteLocker pl(plugin);
        plugin->setDirty();
        if (saveInputs(plugin, pPtr)) {
          if (tagName == plugin_defaultTag) {
            tagName = KST::suggestPluginName(_pluginList[pitem], KstObjectTag::fromString(_yvector));
          }

          plugin->setTagName(KstObjectTag(tagName, KstObjectTag::globalTagContext)); // FIXME: tag context always global?

          plugin->setPlugin(pPtr);

          if (saveOutputs(plugin, pPtr)) {
            if (plugin->isValid()) {
              if (!createCurve(plugin)) {
                KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
                return false;
              } else {
                KST::dataObjectList.lock().writeLock();
                KST::dataObjectList.append(plugin.data());
                KST::dataObjectList.lock().unlock();
              }
            } else {
              KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
              return false;
            }
          } else {
            KMessageBox::sorry(this, i18n("There is an error in the outputs you entered."));
            return false;
          }
        } else {
          KMessageBox::sorry(this, i18n("There is an error in the inputs you entered."));
          return false;
        }
      }
    }
    emit modified();
  }
  return true;
}
Example #26
0
void Connectome::computeMetrics()
{
    if (NW.is_empty())
        return;
    // local metrics order:
    // strength, degree, PL, eff, vul, CC, betweeness,
    // PC, Z-score, modularity, rich-club
    // nodal local metrics

    uint n = NW.n_rows;
    localMetrics.set_size(11,n);
    localMetrics.row(0) = strength(NW);                 // strength
    localMetrics.row(1) = degree(NW);                   // degree
    pl = pathLength(1/NW);
    pl(find(pl == datum::inf)).fill(0);
    localMetrics.row(2) = sum(pl,0)/n;                  // path length
    localMetrics.row(3) = localEfficiency(NW);          // efficiency
    localMetrics.row(4) = vulnerability(NW);            // vulnerability

    localMetrics.row(5) = clusteringCoeff(NW);          // CC
    localMetrics.row(6) = betweenessCentrality(1/NW,    // betweeness: Hubs
                                               edgeBetweeness);
    // Even though modularity is not a local metric, however,
    // the output have a number of elements = number of nodes
    double Q;
    urowvec Ci = modularity_louvain(NW,&Q);
    localMetrics.row(7)=participationCoefficient(NW,Ci);// participation coeff
    localMetrics.row(8) = moduleZscore(NW,Ci);          // Z score

    localMetrics.row(9) = conv_to<rowvec>::from(Ci);    // modularity
    localMetrics.row(10) = richClub(NW,-1);             // rich club

    // global metrics order:
    // Strength_mean, degree_mean, CCmean,
    // Q modularity, CPL, GE, trans, density
    // assortativity
    globalMetrics.set_size(10,1);
    globalMetrics(0) = mean(localMetrics.row(0));   // mean strength
    globalMetrics(1) = mean(localMetrics.row(1));   // mean degree
    globalMetrics(2) = mean(localMetrics.row(5));   // mean CC
    globalMetrics(3) = Q;                           // modularity
    globalMetrics(4) = accu(pl)/(n*n-n);            // CPL
    // reusing computed shortest path to compute GE
    mat invPL = 1/pl;
    invPL(find(invPL == datum::inf)).fill(0);
    globalMetrics(5) = accu(invPL)/(n*n-n);         // global eff
    globalMetrics(6) = transitivity(NW);            // transitivity
    globalMetrics(7) = density(NW);                 // density
    globalMetrics(8) = assortativity(NW);           // assortativity
    globalMetrics(9) = 0.0;

    metricsExist = true;
}
Example #27
0
FastUndoBlock FastUndoBlock::fromOldBlock(const CBlockUndo &block, Streaming::BufferPool *pool)
{
    CSizeComputer sc(0, 0);
    sc << block;
    if (pool) {
        pool->reserve(sc.size());
        block.Serialize(*pool, 0, 0);
        return FastUndoBlock(pool->commit());
    }
    Streaming::BufferPool pl(sc.size());
    block.Serialize(pl, 0, 0);
    return FastUndoBlock(pl.commit());
}
Example #28
0
File: c80.c Project: adamsch1/scc
openout()
  {
  kill();      /* erase line */
  output=0;    /* start with none */
  pl("Output filename? "); /* ask...*/
  gets(line);  /* get a filename */
  if(ch()==0)return;  /* none given... */
  if((output=fopen(line,"w"))==NULL) /* if given, open */
    {output=0;  /* can't open */
    error("Open failure!");
    }
  kill();      /* erase line */
}
Example #29
0
// 绘制箭头
void DrawArrow( AcGiWorldDraw* mode, const AcGePoint3d& insertPt, double angle, double width, double length )
{
    AcGeVector3d v( AcGeVector3d::kXAxis );
    v.rotateBy( angle, AcGeVector3d::kZAxis );

    AcDbPolyline pl( 2 );
    pl.addVertexAt( 0, Point3D_To_2D( insertPt ) );
    pl.addVertexAt( 1, Point3D_To_2D( insertPt + v * length ) );
    pl.setWidthsAt( 0, width, 0 );
    pl.setWidthsAt( 1, 0, 0 );

    pl.worldDraw( mode );
}
Example #30
0
void MeshManipulator::moveVertex(const Ray * r)
{
	Vector3F *p = &m_mesh->vertices()[m_intersect->m_componentIdx];
    
    Plane pl(r->m_dir.reversed(), m_intersect->m_hitP);

    Vector3F hit;
    float t;
	if(pl.rayIntersect(*r, hit, t, 1)) {
	    *p += hit - m_intersect->m_hitP;
	    m_intersect->m_hitP = hit;
	}
}