コード例 #1
0
/**
 * Method which starts assembler generation.
 */
void CodeGenerator::run(void) {

	// check if output file is open
	if(!this->output.good()) {
		compiler->error("Couldn't open output file.", RET_ERR_INTERNAL);
		return;
	}

	// generate header of assembly file
	head();
	intermediateCode->lock();

	IntermediateCode::InstructionRecord *instruction = intermediateCode->get();
	if(instruction == (IntermediateCode::InstructionRecord*) NULL) {
		compiler->error("This shouldn't happen.", RET_ERR_INTERNAL);
		return;
	}

	try {

		// processing instruction line
		do {
			if(!process(instruction))
				return;

			instruction = intermediateCode->get();
		} while (instruction != (IntermediateCode::InstructionRecord*) NULL);

	} catch(ProcessingException &ex) {
		compiler->error(ex.msg, ex.code);
		return;
	}

	// generate data section of assembly file
	data();

	// flush and close output file
	output.close();
}
コード例 #2
0
ファイル: ListBox.C プロジェクト: Stabledog/dddbash
// Dump
void ListBox::dump(std::ostream &s) const
{
    if (VSEFlags::include_list_info)
    {
	// Dump formally
	s << "[";
	if (!isEmpty())
	    s << *head() << ":" << *tail();
	s << "]";
    }
    else
    {
	// Use cuter syntax

	s << "(";

	const ListBox *list = this;
	while (list)
	{
	    if (list->isEmpty())
	    {
		if (list->isDummyBox())
		    s << ", " << *list;
		list = 0;
	    }
	    else
	    {
		if (list != this)
		    s << ", ";

		s << *(list->head());
		list = list->tail();
	    }
	}

	 s << ")";
    }
}
コード例 #3
0
static AIM_RESULT AIMGroup_GetHandles( AMHandle hGroup, AMBool bRecursive, AMBool bCnt, AMHandle **pphHandleArray, AMInt32 *piSize)
{
	const IAGroup * pGroup = (const IAGroup *)hGroup;
	AMInt32 i = 0;
	ListIter *pIter = AMNULL;
	AMAssert(0 != pGroup && AMNULL != pphHandleArray && AMNULL != piSize );

	*piSize = 0;

	if(bRecursive)
		return eAIM_RESULT_NOT_SUPPORT;

	if(bCnt)
		*piSize = pGroup->lChildCnt.size;
	else
		*piSize = pGroup->lChildGrp.size;

	if(!(*piSize))
		return eAIM_RESULT_OK;

	*pphHandleArray = (AMHandle *)AMMalloc(sizeof(AMHandle) * (*piSize));
	if(!(*pphHandleArray))
		return eAIM_RESULT_MALLOC_ERROR;

	if(bCnt)
		pIter = create(ListIter, &pGroup->lChildCnt);
	else
		pIter = create(ListIter, &pGroup->lChildGrp);

	head(ListIter, pIter);
	do 
	{
		(*pphHandleArray)[i++] = (AMHandle) retrieve(ListIter, pIter);
	} while (!next(ListIter, pIter));
	destroy(ListIter, pIter);

	return eAIM_RESULT_OK;
}
コード例 #4
0
ファイル: 148.cpp プロジェクト: ysc6688/leetcode
 ListNode* merge(ListNode* left, ListNode* right)
 {
     ListNode head(-1);
     int i,j;
     
     ListNode *p = &head;
     
     while( left && right )
     {
         if(left->val < right->val)
         {
             p->next = left;
             p = p->next;
             left = left->next;
         }
         else
         {
             p->next = right;
             p = p->next;
             right = right->next;
         }
     }
     
     while( left )
     {
         p->next = left;
         p = p->next;
         left = left->next;
     }
     
     while( right )
     {
         p->next = right;
         p = p->next;
         right = right->next;
     }
     return head.next;
 }
コード例 #5
0
void NetworkAccessManager::onRequestFinished(QNetworkReply *reply)
{
    // http://stackoverflow.com/questions/4330274/qtwebkit-how-to-check-http-status-code
    if(reply->error() > 0) {
        qDebug() << "Response Error " << reply->error() << "\n" << reply->errorString();
        if (reply->error() == QNetworkReply::ContentReSendError) {
            if (d->DataMap.contains(reply))  {
                RequestInfo* ri = d->DataMap.value(reply);
                qWarning() << "Hit with  205! Going to re-process the request for which this error is."
                           << " The request url is " << reply->request().url().toString()
                           << " and the request op-type is " << ri->Operation << ". FYI(head=1,get=2,put=3,post=4,del=5).";

                switch (ri->Operation) {
                case HeadOperation:
                    head(reply->request()); break;
                case GetOperation:
                    get(reply->request()); break;
                case PutOperation:
                    put(reply->request(), ri->Data); break;
                case PostOperation:
                    post(reply->request(), ri->Data); break;
                case DeleteOperation:
                    deleteResource(reply->request()); break;
                default:
                    qWarning() << "Alas! Unknown operation :("; break;
                }
            }
            else {
                qWarning()  << "Hit with  205! But no cached data found in the network-manager data map associated with this request to process the request!";
            }
        }
    }
    else {
        qDebug() << "Request processed successfully# " << reply->request().url().toString();
    }

    d->removeRequestInfo(reply);
}
コード例 #6
0
void CStalkerAnimationManager::reload				(CAI_Stalker *_object)
{
	m_object					= _object;
	m_visual					= object().Visual();

	m_crouch_state_config		= object().SpecificCharacter().crouch_type();
	VERIFY						((m_crouch_state_config == 0) || (m_crouch_state_config == 1) || (m_crouch_state_config == -1));
	m_crouch_state				= m_crouch_state_config;

	if (object().already_dead())
		return;

	m_skeleton_animated			= smart_cast<CKinematicsAnimated*>(m_visual);
	VERIFY						(m_skeleton_animated);

	m_data_storage				= stalker_animation_data_storage().object(m_skeleton_animated);
	VERIFY						(m_data_storage);

	if (!object().g_Alive())
		return;

#ifdef USE_HEAD_BONE_PART_FAKE
	VERIFY						(!m_data_storage->m_head_animations.A.empty());
	u16							bone_part = m_skeleton_animated->LL_GetMotionDef(m_data_storage->m_head_animations.A.front())->bone_or_part;
	VERIFY						(bone_part != BI_NONE);
	m_script_bone_part_mask		= CStalkerAnimationPair::all_bone_parts ^ (1 << bone_part);
#endif

	assign_bone_callbacks		();

#ifdef DEBUG
	global().set_dbg_info		(*object().cName(),"Global");
	head().set_dbg_info			(*object().cName(),"Head  ");
	torso().set_dbg_info		(*object().cName(),"Torso ");
	legs().set_dbg_info			(*object().cName(),"Legs  ");
	script().set_dbg_info		(*object().cName(),"Script");
#endif
};
コード例 #7
0
ファイル: UtlSortedList.cpp プロジェクト: Jaroslav23/sipxtapi
// Return the number of occurrences of the designated object.
size_t UtlSortedList::occurrencesOf(const UtlContainable* containableToMatch) const 
{
   int count = 0;
   UtlLink* listNode;
   UtlContainable* visitNode = NULL;
   int             comparison;

   OsLock take(const_cast<OsBSem&>(mContainerLock));
   
   for (listNode = head(), comparison = 0;
        comparison <= 0 && listNode;
        listNode = listNode->next()
        )
   {
      visitNode = (UtlContainable*)listNode->data;
      if(visitNode && visitNode->compareTo(containableToMatch) == 0)
      {
         count++;
      }
   }

   return(count);
}
コード例 #8
0
ファイル: protocol_long.cpp プロジェクト: njuicsgz/cpp
int CProtocolLong::GetMsg(Message& req)
{
	int nLen=cached_len();
	char * pData=head();
	if(pData==NULL)
	{
		return 0;
	}
	if(pData!=NULL&&pData[0]!=SOH)
	{
		return -1;
	}
	unsigned long len=*((unsigned long*)(pData+1));
	len = ntohl(len);
	if(len<=cached_len())
	{
		req.Clear();
		req.AttachMessage(pData,len);
		skip(len);
		return nLen;
	}
	return 0;
}
コード例 #9
0
ファイル: check_expr_tactic.cpp プロジェクト: cpehle/lean
tactic check_expr_tactic(elaborate_fn const & elab, expr const & e,
                         std::string const & fname, pair<unsigned, unsigned> const & pos) {
    return tactic01([=](environment const & env, io_state const & ios, proof_state const & s) {
            goals const & gs = s.get_goals();
            if (empty(gs)) {
                throw_no_goal_if_enabled(s);
                return none_proof_state();
            }
            goal const & g      = head(gs);
            name_generator ngen = s.get_ngen();
            expr new_e = std::get<0>(elab(g, ios.get_options(), ngen.mk_child(), e, none_expr(), s.get_subst(), false));
            auto tc = mk_type_checker(env, ngen.mk_child());
            expr new_t = tc->infer(new_e).first;
            auto out = regular(env, ios);
            flycheck_information info(out);
            if (info.enabled()) {
                out << fname << ":" << pos.first << ":" << pos.second << ": information: ";
                out << "check result:\n";
            }
            out << new_e << " : " << new_t << endl;
            return some_proof_state(s);
        });
}
コード例 #10
0
  pair < size_t, Node* >DoublyLinkedList::set_data (Node* node,
      size_t value)
  {
#ifdef LOGGING
    cout << "v" << version << ": set_data (" << node_to_string (node) << ", "
         << value << ")" << endl;
#endif

    version_info_t new_version;
    ++version;
    new_version.size = versions.back ().size;
    Node* current_head = head ();

    Node* modified_node =
      modify_field (node, DATA, reinterpret_cast < Node* > (value), current_head);
    if (!modified_node->prev ()) {
      new_version.head = modified_node;
    }
    else {
      new_version.head = current_head;
    }
    versions.push_back (new_version);
  }
コード例 #11
0
 ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
     ListNode head(0);
     ListNode *p = &head;
     while (l1 != NULL || l2 != NULL) {
         if (l1 == NULL) {
             p->next = l2;
             break;
         }
         if (l2 == NULL) {
             p->next = l1;
             break;
         }
         if (l1->val < l2->val) {
             p->next = l1;
             l1 = l1->next;
         } else {
             p->next = l2;
             l2 = l2->next;
         }
         p = p->next;
     }
     return head.next;
 }
コード例 #12
0
ファイル: main.c プロジェクト: RodrigoCastiel/Portalsnake
void display( int matrix[][50], int v[][2], int f[], int initial) // display dynamic things, using graphics (snake, food)
{
    int x,y,i,j; // counters
    x = 15;
    y = 15; // initial position to the matrix
    if(initial==1) {
        for(i=0; i<length; i++) {
            body(15+10*v[i][1],15+10*v[i][0]);
        }
    }
    else {
        body(15+10*v[1][1],15+10*v[1][0]);
        if((v[0][1]+v[0][0])%2==0) {
            body(15+10*v[0][1],15+10*v[0][0]);
        }
        else {
            head(15+10*v[0][1],15+10*v[0][0]);
        }
        body_erase(15+10*guardj,15+10*guardi);
        fruit(15+10*f[1],15+10*f[0]);// now display the food
    }

}
コード例 #13
0
//main function
int main(int argc,char *argv[]) {
    int test;
	int rank; //
	int size; //
	MPI_Status status;
	
	//initialize MPI
	MPI_Init(NULL,NULL);
	//get the current process's rank, to rank
	MPI_Comm_rank(MPI_COMM_WORLD,&rank);
	//get the total number of processes, to size
	MPI_Comm_size(MPI_COMM_WORLD,&size);
	
	//---------
	//exit if the number of processes is not satisfied
	if(size<2)
	{			
		printf("Need at least 2 processes!\n");
		MPI_Abort(MPI_COMM_WORLD,99);
	}
	//---------
	
	if(rank==0)
	{
		//set the head process, which is the one with id==0
		head();
	}
	else
	{
		//set the other ring processes, which are those with id!=0
		worker();
	}
	
	//finalize MPI
	MPI_Finalize();
	return EXIT_SUCCESS;
}
コード例 #14
0
ファイル: Beak.cpp プロジェクト: RobertLeyland/chirpino
byte Beak::chirp(const char *chirpStr, int16_t nFrames, SynthFrame *frames) {
    static const uint32_t hPhaseStep = pgm_read_dword_near(phaseSteps + 17);
    static const uint32_t jPhaseStep = pgm_read_dword_near(phaseSteps + 19);
    uint32_t phaseStep = jPhaseStep;
    
    // check length and return warning if incorrect
    const char *cs = chirpStr;
    byte count = CHIRP_STRING_LENGTH;
    while(*cs++ && --count) {
    }
    if(count || *cs) {
        return CHIRP_STRING_LENGTH_WARNING;
    }
    
    TheSynth.beginFrameSequence(nFrames, frames);
    
    head(hPhaseStep);
    
    // all chirps start with these two tones
    append(hPhaseStep);
    append(jPhaseStep);

    while(const char code = *chirpStr++) { // assignment, not comparison
        phaseStep = phaseStepForCharCode(code);
        if(phaseStep) {
            append(phaseStep);
        }
        else {
            return BAD_CHIRP_CODE_WARNING;
        }
    }
        
    tail(phaseStep);
    TheSynth.endFrameSequence();
    
    return TheSynth.play();
}
コード例 #15
0
ファイル: efxfixture.cpp プロジェクト: stev96/qlcplus
bool EFXFixture::isValid() const
{
    Fixture* fxi = doc()->fixture(head().fxi);

    if (fxi == NULL)
        return false;
    else if (head().head >= fxi->heads())
        return false;
    else if (m_mode == PanTilt && fxi->panMsbChannel(head().head) == QLCChannel::invalid() && // Maybe a device can pan OR tilt
             fxi->tiltMsbChannel(head().head) == QLCChannel::invalid())   // but not both. Teh sux0r.
        return false;
    else if (m_mode == Dimmer && fxi->masterIntensityChannel(head().head) == QLCChannel::invalid() )
        return false;
    else if (m_mode == RGB && fxi->rgbChannels(head().head).size () == 0)
        return false;
    else
        return true;
}
コード例 #16
0
ファイル: server.cpp プロジェクト: b-xiang/pficommon
static pfi::lang::shared_ptr<http::response> gen_resp(stringstream &ss)
{
  http::header head(ss);

  string content_type="text/html; charset=utf-8";
  int code=200;
  string reason="OK";

  if (head.has_key("content-type")){
    content_type=head["content-type"];
    head.erase("content-type");
  }
  if (head.has_key("location")){
    code=302;
    reason="Found";
  }
  if (head.has_key("status")){
    const char *p=head["status"].c_str();
    char *q=NULL;
    code=strtol(p, &q, 10);
    while(*q && isspace(*q)) q++;
    reason=q;
    head.erase("status");
  }
  
  pfi::lang::shared_ptr<http::response> resp(new http::response(code, reason));

  head["Content-Type"]=content_type;

  for (http::header::iterator p=head.begin();
       p!=head.end(); p++)
    resp->head()[p->first]=p->second;

  resp->body()<<ss.rdbuf();

  return resp;
}
コード例 #17
0
ファイル: horn_tactic.cpp プロジェクト: CHolmes3/z3
 formula_kind get_formula_kind(expr_ref& f) {
     expr_ref tmp(f);
     normalize(tmp);
     ast_mark mark;
     expr_ref_vector args(m), body(m);
     expr_ref head(m);
     expr* a = 0, *a1 = 0;
     qe::flatten_or(tmp, args);
     for (unsigned i = 0; i < args.size(); ++i) {
         a = args[i].get(); 
         check_predicate(mark, a);
         if (m.is_not(a, a1)) {
             body.push_back(a1);
         }
         else if (is_predicate(a)) {
             if (head) {
                 return IS_NONE;
             }
             head = a;
         }
         else {
             body.push_back(m.mk_not(a));
         }
     }
     if (head) {
         if (!is_implication(f)) {
             f = m.mk_and(body.size(), body.c_ptr());
             f = m.mk_implies(f, head);
         }
         return IS_RULE;
     }
     else {
         f = m.mk_and(body.size(), body.c_ptr());
         return IS_QUERY;
     }
 }
コード例 #18
0
ファイル: t_romg.cpp プロジェクト: kuailexs/symbiandump-os1
LOCAL_C void writeRomImage()
//
// Write the ROM image.
//
	{

	test.Start(_L("Write rom file header"));
//
	TPckgBuf<TRomFileHeader> fileHeadB;
	fileHeadB.FillZ(fileHeadB.MaxLength());
	TRomFileHeader& fileHead=fileHeadB();
	Mem::Copy(&fileHead.iName[0],"EPOC468 ROM     ",KRomFileHeaderNameSize);
	Mem::Copy(&fileHead.iVersionStr[0],"0.01",4);
	Mem::Copy(&fileHead.iBuildNumStr[0],"   1",4);
	fileHead.iRomSize=TheRomHeader.iRomSize;
	fileHead.iHeaderSize=KRomFileHeaderSize;
	test(TheFile.Write(fileHeadB)==KErrNone);
//
	test.Next(_L("Write rom header"));
	TheFiller.FillZ(TheFiller.MaxLength());
	TPckgC<TRomHeader> head(TheRomHeader);
	test(TheFile.Write(head)==KErrNone);
	TheCurrentBase=UserSvr::RomHeaderAddress()+sizeof(TheRomHeader);
//
	test.Next(_L("Write directories"));
	TheLevel=(-1);
	TheRootDir->WriteDirs();
	test(TheLevel==(-1));
//
	test.Next(_L("Write files"));
	TheLevel=(-1);
	TheRootDir->WriteFiles();
	test(TheLevel==(-1));
//
	test.End();
	}
コード例 #19
0
ファイル: test.c プロジェクト: valli22/Peter-Valli
int main(int argc, char *argv[]){
	if (argc==1) {
		fprintf(stderr, "ERROR DE ARGUMENTOS PRINCIPALES");
		return 1;
	}else{
		switch(atoi(argv[1])){
			case 1:
				head(atoi(argv[2]));
				break;
			case 2:
				tail(atoi(argv[2]));
				break;
			case 3: 
				longlines(atoi(argv[2]));
				break;
			default: 
				fprintf(stderr, "ERROR EN CASE");
				return 1;
		}
	}
	return 0;
	

}
コード例 #20
0
ファイル: UtlSList.cpp プロジェクト: ATHLSolutions/sipxecs
// Insert at the designated position.
UtlContainable* UtlSList::insertAt(size_t N, UtlContainable* obj)
{
   // :NOTE: this method is deliberately not the same as g_list_insert in that
   //        the glib routine will accept a value of N > the length of the list
   //        but this routine treats that as an error.
   UtlContainable* inserted = NULL;

   OsLock take(mContainerLock);

   LIST_SANITY_CHECK;
   size_t n;
   UtlLink* link;
   for (n = 0, link = head(); link && n < N; link = link->next(), n++)
   {
   }
   if (n == N)
   {
      UtlLink::listBefore(this, link, obj);
      inserted = obj;
   }
   LIST_SANITY_CHECK;

   return inserted;
}
コード例 #21
0
void JSGlobalObject::init(JSObject* thisValue)
{
    ASSERT(JSLock::currentThreadIsHoldingLock());

    d()->globalData = Heap::heap(this)->globalData();
    d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), thisValue);

    JSGlobalObject::globalExec()->init(0, 0, d()->globalScopeChain.node(), CallFrame::noCaller(), 0, 0, 0);

    if (JSGlobalObject*& headObject = head()) {
        d()->prev = headObject;
        d()->next = headObject->d()->next;
        headObject->d()->next->d()->prev = this;
        headObject->d()->next = this;
    } else
        headObject = d()->next = d()->prev = this;

    d()->recursion = 0;
    d()->debugger = 0;

    d()->profileGroup = 0;

    reset(prototype());
}
コード例 #22
0
int main(int argc, char* argv[])
{
        int option_n=0;
        int i,j,n;
	//default nValue= 10
	int nValue=10;
	char *char_nValue;
	FILE *fp;
	char str[buf];
	if(argc<2){
                printf("error\n");
                exit(1);
        }

        //option detect
        for(i=j=1; i<argc; i++) {
                if(argv[i][0]=='-'){
                        if(argv[i][1] == 'n'){
				if(argc<=3){
                                        printf("parameter error\n");
                                        exit(1);
                                }
                                option_n=1;
				//print the first nValue lines instead of the first 10
				char_nValue=argv[i+1];
				nValue=atoi(char_nValue);
			}
			else{
				printf("incorrect option\n");
				exit(1);
			}
                }
        }

	head(nValue,argc,argv);
}
コード例 #23
0
ファイル: UtlSortedList.cpp プロジェクト: Jaroslav23/sipxtapi
// Return the list position of the designated object.
size_t UtlSortedList::index(const UtlContainable* obj) const 
{
   size_t          index = UTL_NOT_FOUND;
   size_t          thisIndex;
   UtlLink*        listNode;
   unsigned        keyHash = obj->hash();
   
   OsLock take(const_cast<OsBSem&>(mContainerLock));
   
   for (listNode = head(), thisIndex = 0;
        listNode && index == UTL_NOT_FOUND;
        listNode = listNode->next(), thisIndex++)
   {
      if (   listNode->data                      // there is an object (for safety sake)
          && listNode->hash == keyHash           // quick test for possible equality
          && listNode->data->compareTo(obj) == 0 // real (but slower) test for equality
          )
      {
         index = thisIndex;
      }
   }
    
   return index;
}
int main(){

    long n, m, W; scanf("%ld %ld %ld", &n, &m, &W);
    std::vector<long> w(n); for(long p = 0; p < n; p++){scanf("%ld", &w[p]);}
    std::vector<long> b(n); for(long p = 0; p < n; p++){scanf("%ld", &b[p]);}
    std::vector<std::vector<long> > g(n);
    for(long p = 0; p < m; p++){
        long x, y; scanf("%ld %ld", &x, &y);
        --x; --y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    std::vector<long> head(n, -1);
    for(long p = 0; p < n; p++){dfs(p, g, head, p);}

    std::vector<long> sw(n, 0); std::vector<long> sb(n, 0);
    std::vector<std::vector<long> > sv(n);
    for(long p = 0; p < n; p++){sw[head[p]] += w[p]; sb[head[p]] += b[p]; sv[head[p]].push_back(p);}

    std::vector<long> f(W + 1, 0);
    for(long p = 0; p < n; p++){
        if(head[p] != p){continue;}
        for(long ww = W; ww >= 0; ww--){
            if(sw[p] <= ww){f[ww] = std::max(f[ww], f[ww - sw[p]] + sb[p]);}
            for(long t = 0; t < sv[p].size(); t++){
                long u = sv[p][t];
                if(w[u] <= ww){f[ww] = std::max(f[ww], f[ww - w[u]] + b[u]);}
            }
        }
    }

    printf("%ld\n", f[W]);

    return 0;
}
コード例 #25
0
 void TestModel::notifyOnNotAssignedTrait()
 {
   std::auto_ptr<Head> head(new Head()) ;
   head->change(10) ;
 }
コード例 #26
0
ファイル: gl_sarray.cpp プロジェクト: nkhuyu/SFrame
gl_sframe gl_sarray::unpack(const std::string& column_name_prefix, 
                           const std::vector<flex_type_enum>& _column_types,
                           const flexible_type& na_value, 
                           const std::vector<flexible_type>& _limit) const {
  auto column_types = _column_types;
  auto limit = _limit;
  if (dtype() != flex_type_enum::DICT && dtype() != flex_type_enum::LIST &&
      dtype() != flex_type_enum::VECTOR) {
    throw std::string("Only SArray of dict/list/array type supports unpack");
  }
  if (limit.size() > 0) {
    std::set<flex_type_enum> limit_types;
    for (const flexible_type& l : limit) limit_types.insert(l.get_type());
    if (limit_types.size() != 1) {
      throw std::string("\'limit\' contains values that are different types");
    } 
    if (dtype() != flex_type_enum::DICT && 
        *(limit_types.begin()) != flex_type_enum::INTEGER) {
      throw std::string("\'limit\' must contain integer values.");
    }
    if (std::set<flexible_type>(limit.begin(), limit.end()).size() != limit.size()) {
      throw std::string("\'limit\' contains duplicate values.");
    }
  }

  if (column_types.size() > 0) {
    if (limit.size() > 0) {
      if (limit.size() != column_types.size()) {
        throw std::string("limit and column_types do not have the same length");
      }
    } else if (dtype() == flex_type_enum::DICT) {
      throw std::string("if 'column_types' is given, 'limit' has to be provided to unpack dict type.");
    } else {
      limit.reserve(column_types.size());
      for (size_t i = 0;i < column_types.size(); ++i) limit.push_back(i);
    }
  } else {
    auto head_rows = head(100).dropna();
    std::vector<size_t> lengths(head_rows.size());
    for (size_t i = 0;i < head_rows.size(); ++i) lengths[i] = head_rows[i].size();
    if (lengths.size() == 0 || *std::max_element(lengths.begin(), lengths.end()) == 0) {
      throw std::string("Cannot infer number of items from the SArray, "
                        "SArray may be empty. please explicitly provide column types");
    }
    if (dtype() != flex_type_enum::DICT) {
      size_t length = *std::max_element(lengths.begin(), lengths.end());
      if (limit.size() == 0) {
        limit.resize(length);
        for (size_t i = 0;i < length; ++i) limit[i] = i;
      } else {
        length = limit.size();  
      }

      if (dtype() == flex_type_enum::VECTOR) {
        column_types.resize(length, flex_type_enum::FLOAT);
      } else {
        column_types.clear();
        for(const auto& i : limit) {
          std::vector<flexible_type> f;
          for (size_t j = 0;j < head_rows.size(); ++j) {
            auto x = head_rows[j];
            if (x != flex_type_enum::UNDEFINED && x.size() > i) {
              f.push_back(x.array_at(i));
            }
          }
          column_types.push_back(infer_type_of_list(f));
        }
      }

    }
  }
  if (dtype() == flex_type_enum::DICT && column_types.size() == 0) {
    return get_proxy()->unpack_dict(column_name_prefix,
                                 limit,
                                 na_value);
  } else {
    return get_proxy()->unpack(column_name_prefix,
                            limit,
                            column_types,
                            na_value);
  } 
}
コード例 #27
0
IC	void CStalkerAnimationManager::play_head				()
{
	head().animation		(assign_head_animation());
	head().play				(m_skeleton_animated,head_play_callback,&object(),false);
}
コード例 #28
0
    int main() {

        double a[2], b[1];
        head(a,b);
        return 0;
    }
コード例 #29
0
ファイル: clist.cpp プロジェクト: AaronNGray/self
int32 CList::length() {
  int32 l = 0;
  for (CListElem* e = head(); e; e = e->next()) l++;
  return l;
}
コード例 #30
0
ファイル: clist.cpp プロジェクト: AaronNGray/self
bool CList::identityIncludes(CListEntry* d) {
  for (CListElem* e = head(); e; e = e->_next) {
    if (e->data() == d) return true;
  }
  return false;
}