Ejemplo n.º 1
1
int main()
{
   initscr();
   keypad(stdscr, TRUE);
   noecho();
   start_color();
   init_pair(1, COLOR_GREEN,   COLOR_BLACK);
   init_pair(2, COLOR_MAGENTA, COLOR_BLACK);
   finit(9,9,0,2);
   clear();
   printw(
   "      Etherial Void   \n\n"
   "Is it that all exists only in the\n"
   "etherial landscape of the mind?\n\n"
   "The past is uncertian,\n\n"
   "The present is now the past,\n\n"
   "The future might only be thought of.\n\n"
   "Is then not our mind's eye\n"
   "the root of reality?\n\n"
   "But should that eye be blind,\n"
   "where then would rest the soul?"
   "\n\n"
   "(press any key to continue)\n");
   getch();
   clear();
   printw(
   "   I look,\n"
   "but I see nothing.");
   getch();
   clear();
   getch();
   printw(
   "   Perhaps,\n"
   "there is nothing to see.");
   getch();
   helpmsg="Use the arrow keys or WASD to move the charecter.";
   clear();
   while(loop)
   {  
      switch(z)
      {  
         case 0:
            nroom=1;
            eroom=2;
            sroom=3;
            wroom=4;
            uroom=5;
            light=2;
            wall=
            "Some sort of wall mesage should be displayed here,\n"
            "It should inform the player of the solidity of this wall,\n"
            "and it should warn that attempts to surpass this fact are admonishable.";
            
            msg(9,6,
            "   I <do> see something:\n"
            "There seem to be dimly glowing etchings on the ground which signify,\n"
            "'There is naught to the north.'");

            msg(12,9,
            "   There is <something> here:\n"
            "In the ground there are shallow grooves filled with a\n"
            "faintly luminescent material. I cannot comprehend them.");
            if(sw[0]&&sw[1]&&sw[2]&&sw[3])
            {
               map[0][9][9]='^';
               smsg(9,9,
               "This is a new stairwell.");
            }
            break;
         case 1:
            sroom=0;
            lvr(9,9,0);
            break;
         case 2:
            wroom=0;
            wall=
            "There are some large deep grooves on the wall";
            lvr(9,9,1);
            break;
         case 3:
            nroom=0;
            lvr(9,9,2);
            break;
         case 4:
            eroom=0;
            lvr(9,9,3);
            break;
         case 5:
            eroom=6;
            droom=1;
            break;
         case 6:
            wroom=5;
            break;
         default:
            endwin();
            printf("Error: 42\n");
            loop=0;
            exit(42);
      }
      unmove();
      uncover(0);
      showmap();
      input();
   }
   endwin();
   return 0;
}
Ejemplo n.º 2
0
/*
 * Returns the already visited list for the given filename. If none is found it
 * allocates a new one.
 */
static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_list_hdr_T **list_headp)
{
  ff_visited_list_hdr_T  *retptr = NULL;

  /* check if a visited list for the given filename exists */
  if (*list_headp != NULL) {
    retptr = *list_headp;
    while (retptr != NULL) {
      if (fnamecmp(filename, retptr->ffvl_filename) == 0) {
#ifdef FF_VERBOSE
        if (p_verbose >= 5) {
          verbose_enter_scroll();
          smsg((char_u *)"ff_get_visited_list: FOUND list for %s",
              filename);
          /* don't overwrite this either */
          msg_puts((char_u *)"\n");
          verbose_leave_scroll();
        }
#endif
        return retptr;
      }
      retptr = retptr->ffvl_next;
    }
  }

#ifdef FF_VERBOSE
  if (p_verbose >= 5) {
    verbose_enter_scroll();
    smsg((char_u *)"ff_get_visited_list: new list for %s", filename);
    /* don't overwrite this either */
    msg_puts((char_u *)"\n");
    verbose_leave_scroll();
  }
#endif

  /*
   * if we reach this we didn't find a list and we have to allocate new list
   */
  retptr = (ff_visited_list_hdr_T*)alloc((unsigned)sizeof(*retptr));
  if (retptr == NULL)
    return NULL;

  retptr->ffvl_visited_list = NULL;
  retptr->ffvl_filename = vim_strsave(filename);
  if (retptr->ffvl_filename == NULL) {
    vim_free(retptr);
    return NULL;
  }
  retptr->ffvl_next = *list_headp;
  *list_headp = retptr;

  return retptr;
}
Ejemplo n.º 3
0
Archivo: dic.c Proyecto: lcion/nadcn
void afisez(void){
datum key, nextkey, content;
	key = gdbm_firstkey( bz );
	while(key.dptr){
		smsg(" Cuvantul : ");
		smsg(key.dptr);
		content = gdbm_fetch(bz, key);
		smsg(" Explicatia : ");
		smsg(content.dptr);
		smsg("\n");
		nextkey = gdbm_nextkey(bz, key);
		key = nextkey;
	}
}
Ejemplo n.º 4
0
void join_channel::join_btn_clicked()
{
    QString smsg("/join ");
    if(!ui->id_lineEdit->text().isEmpty())
    {
        smsg+=ui->id_lineEdit->text();
    }
    else
    {
        if(ui->name_lineEdit->text().length()>20)
        {
            ui->tip_label->setText("频道名字不会超过20");
            return;
        }
        smsg+=ui->name_lineEdit->text();
    }

    int length=0;
    //QTextCodec*code=QTextCodec::codecForName("GBK");
    qDebug() << __LINE__ <<"sent "<<smsg;
    if((length=socket->writeDatagram(smsg.toUtf8(),smsg.toUtf8().length(),QHostAddress(server_addr),port))!=smsg.toUtf8().length())
    {
        qDebug() << __LINE__ <<"error";
        return;
    }

    ui->id_lineEdit->clear();
    ui->name_lineEdit->clear();
    this->hide();
}
Ejemplo n.º 5
0
void DlgTrocarSenha::OnBtOKClick(wxCommandEvent& event)
{
    wxString smsg("o", wxConvUTF8);
    bool bSucesso;
    if (TxNovaSenha->GetValue().Len() < 15)
    {
        smsg = _T("SENHA CURTA. Senhas muito curtas são fáceis de quebrar. Deseja continuar mesmo assim?");
        int answer = wxMessageBox(smsg , sCaptionAviso, wxYES_NO, this);
        if (answer != wxYES)
          return;
    }

    smsg = _T("ATENÇÃO. Cuidado para não perder a senha, pois não existe nenhuma maneira de recuperá-la. O acesso aos arquivos, que fazem parte da unidade de arquivos protegidos, depende exclusivamente da senha de acesso.");
    wxMessageBox(smsg , sCaptionAviso, wxOK, this);


    lblAlertaSenha->Show();
    lblAlertaSenha->Refresh();
    BtOK->Disable();
    BtSair->Disable();
    this->Refresh();
    ::wxYield();
    bSucesso = ExecMudarSenha();
    BtOK->Enable();
    BtSair->Enable();
    if (bSucesso)
          EndModal(wxID_OK);
    else
          EndModal(wxID_ABORT);
}
Ejemplo n.º 6
0
	/*! Place Fix messages on outbound message queue as a single batch.
	    \param msgs messages to send
	    \param destroy if true delete after send
	    \return count of messages written */
	size_t write_batch(const std::vector<Message *>& msgs, bool destroy)
	{
		if (msgs.empty())
			return 0;
		if (msgs.size() == 1)
			return write(msgs.front(), destroy) ? 1 : 0;
		size_t result(0);
		f8_scoped_spin_lock guard(_con_spl);
		for (std::vector<Message *>::const_iterator itr(msgs.begin()), eitr(msgs.end()), litr(eitr-1); itr != eitr; ++itr)
		{
			Message* msg = *itr;
			msg->set_end_of_batch(itr == litr);
			if (_pmodel == pm_pipeline) // pipeline mode ignores destroy flag
			{
				_msg_queue.try_push(msg);
				++result;
				continue;
			}
			if (_session.send_process(msg))
				++result;
		}
		if (destroy && _pmodel != pm_pipeline)
		{
			for (std::vector<Message *>::const_iterator itr(msgs.begin()), eitr(msgs.end()); itr != eitr; ++itr)
			{
				std::unique_ptr<Message> smsg(*itr);
			}
		}
		///@todo: need assert on result==msgs.size()
		return result;
	}
Ejemplo n.º 7
0
Archivo: fs.c Proyecto: ashleyh/neovim
int os_chdir(const char *path) {
  if (p_verbose >= 5) {
    verbose_enter();
    smsg((char_u *)"chdir(%s)", path);
    verbose_leave();
  }
  return uv_chdir(path);
}
Ejemplo n.º 8
0
void SkylivePluginSkeleton::handle_something(SKMessage msg)
{
   std::cout << "Plugin Skeleton module handle something by " << msg.sender.toStdString() << std::endl;
    SKMessage smsg("plugin_skeleton");
    sendMessage(smsg);

    
}
Ejemplo n.º 9
0
inline void validate_io(ssize_t res, const char* msg) {
	if(res < 0 ) {
        boost::system::error_code ec(errno, boost::system::system_category());
		std::string smsg(msg);
		smsg.append(" ");
		smsg.append(ec.message());
		boost::throw_exception(io_exception(smsg));
	}
}
Ejemplo n.º 10
0
Archivo: dic.c Proyecto: lcion/nadcn
int exista(char *cv){
datum key, content;
	if((key.dptr = malloc(strlen(cv)+1)) == NULL){
		smsg(" Out of mem \n");
		exit(1);
	}
	strcpy(key.dptr, cv);
	key.dsize = strlen(key.dptr)+1;
	content = gdbm_fetch(bz, key);
	free(key.dptr);
	if(content.dptr != NULL){
		smsg("\nCuvantul exista !\n");
		return 1;
	}

	smsg("\nCuvantul nu exista !\n");
	return 0;
	
}
Ejemplo n.º 11
0
Archivo: dic.c Proyecto: lcion/nadcn
void inserare( char *cv, char *ex){
datum key, content;

	if(( key.dptr = malloc(strlen(cv)+1)) == NULL){
		smsg("Not enough memory\n");
		exit(1);
	}
	strcpy(key.dptr, cv);
	key.dsize = strlen(key.dptr)+1+count_cuv(key.dptr);	//sax
	if((content.dptr = malloc(strlen(ex)+1)) == NULL){
		smsg("\n Not enough memory");
		exit(1);
	}
	strcpy(content.dptr, ex);
	content.dsize = strlen(content.dptr)+1;
	gdbm_store(bz, key, content, GDBM_INSERT);
		
	free(key.dptr);
	free(content.dptr);
}
Ejemplo n.º 12
0
Archivo: dic.c Proyecto: lcion/nadcn
void sterg(void){
datum key, nextkey;
	key = gdbm_firstkey( bz );
	while(key.dptr){
		nextkey = gdbm_nextkey(bz, key);
		gdbm_delete(bz, key);		
		key = nextkey;
	}
	gdbm_reorganize(bz);
	smsg("\n Am initializat dictionarul \n");

}
Ejemplo n.º 13
0
Archivo: dic.c Proyecto: lcion/nadcn
void reply_c(int sockfd, char *sir){
t_char bl;
	sockfdex = sockfd;
	bz = gdbm_open("baza.db", 512, GDBM_WRCREAT, 0600, 0);
		if(is_command(sir, &bl)){
			switch (bl.c) {
				case 'I' : sterg();break;
				case 'i' : inserare(bl.cv, bl.ex);break;
				case 's' : stergc(bl.cv, bl.ex);break;
				case 'c' : exista(bl.cv);break;
				case 'e' : explic(bl.cv, bl.ex);break;
				case 'l' : afisez();
				case 'q' : break;
				default : smsg("\nInvalid command\n");

			}

		}
		else smsg("\nInvalid command\n");

	gdbm_close(bz);
}
Ejemplo n.º 14
0
void SeessionID::WriteFunction(std::string msg) {
	WriteLock w_lock(myLock);
	//保留2000条消息,删除最早的1000条
	if (mmap.size() > 2000) {
		mmap.erase(mmap.begin(),mmap.begin()+1000);
	}

	msgstruct_ptr smsg(new msgstruct());
	smsg->i = kki;
	smsg->msg = msg;
	mmap.push_back(smsg);
	kki = kki + 1;
}
Ejemplo n.º 15
0
Archivo: dic.c Proyecto: lcion/nadcn
void explic(const char *cv, const char *defno){
datum key, nextkey, content;
int i_defno;
	i_defno = atoi(defno);	//aici prelucrez defno
	key = gdbm_firstkey( bz );
	while(key.dptr){
		if(strcmp(cv, key.dptr) == 0){
			if(i_defno == 0){
				smsg(" Cuvantul : ");
				smsg(key.dptr);
				content = gdbm_fetch(bz, key);
				smsg(" Explicatia : ");
				smsg(content.dptr);
				smsg("\n");
				i_defno = -1;
			}
			else	i_defno--;
		}
		nextkey = gdbm_nextkey(bz, key);
		key = nextkey;
	}
}
Ejemplo n.º 16
0
// Returns TRUE if the event is posted to the SysExecutor.
// Returns FALSE if the thread *is* the SysExecutor (no message is posted, calling code should
//  handle the code directly).
bool BaseScopedCoreThread::PostToSysExec( BaseSysExecEvent_ScopedCore* msg )
{
	std::unique_ptr<BaseSysExecEvent_ScopedCore> smsg( msg );
	if( !smsg || GetSysExecutorThread().IsSelf()) return false;

	msg->SetSyncState(m_sync);
	msg->SetResumeStates(m_sync_resume, m_mtx_resume);

	GetSysExecutorThread().PostEvent( smsg.release() );
	m_sync.WaitForResult();
	m_sync.RethrowException();

	return true;
}
Ejemplo n.º 17
0
WPWEvent::WPWEvent(int type, WUserMap & users, const QString & msg, bool encrypted)
		: QCustomEvent(type)
{
	fWant = false;
	fEncrypted = encrypted;
	if (type == WPWEvent::TextEvent)
	{
		fWant = true;	// this way we'll get an error string in the private window if
		// an invalid command is used
		// everything is stuck into one string
		if (msg.startsWith("/") && !msg.startsWith("//"))
		{
			// just forward the message
			fMsg = msg;
		}
		else
		{
			QString smsg(msg);
			if (smsg.startsWith("//"))
				smsg.replace(0, 2, "/");
			if (fEncrypted)
				fMsg = "/emsg ";
			else
				fMsg = "/msg ";

			QString tusers;
			WUserIter it = users.GetIterator(HTIT_FLAG_NOREGISTER);
			while (it.HasData())
			{
				WUserRef uref;
				uref = it.GetValue();
				AddToList(tusers, uref()->GetUserID());
				it++;
			}

			fMsg += tusers;
			fMsg += " ";
			fMsg += smsg;

#ifdef _DEBUG
			WString wmsg(fMsg);
			PRINT("Sending text: %S\n", wmsg.getBuffer());
#endif
		}
	}
	else
	{
		fMsg = msg;
	}
}
Ejemplo n.º 18
0
Archivo: dic.c Proyecto: lcion/nadcn
void stergc(const char *cv, const char *defno){
datum key, nextkey;
int len_cv, i_defno;
	i_defno = atoi(defno);	//aici prelucrez defno
	len_cv = strlen(cv); 
	i_defno = i_defno + 1 + len_cv; //am obtinut key.dsize pe care-l caut

	key = gdbm_firstkey( bz );
	while(key.dptr){
		if(strcmp(key.dptr,cv) == 0 && key.dsize == i_defno){
			gdbm_delete(bz, key);
			smsg("\nAm sters un cuvant \n");	
		}	
		nextkey = gdbm_nextkey(bz, key);
		key = nextkey;
	}
	gdbm_reorganize(bz);

}
void CompressedInetStreamSocket::write(const ByteStream& msg, Stats* stats)
{
    size_t outLen = 0;
    uint32_t len = msg.length();

    if (useCompression && (len > 512))
    {
        ByteStream smsg(alg.maxCompressedSize(len));

        alg.compress((char*) msg.buf(), len, (char*) smsg.getInputPtr(), &outLen);
        smsg.advanceInputPtr(outLen);

        if (outLen < len)
            do_write(smsg, COMPRESSED_BYTESTREAM_MAGIC, stats);
        else
            InetStreamSocket::write(msg, stats);
    }
    else
        InetStreamSocket::write(msg, stats);
}
Ejemplo n.º 20
0
std::string
XArchEvalWindows::eval() const throw()
{
	char* cmsg;
	if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
							FORMAT_MESSAGE_IGNORE_INSERTS |
							FORMAT_MESSAGE_FROM_SYSTEM,
							0,
							m_error,
							MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
							(LPTSTR)&cmsg,
							0,
							NULL) == 0) {
		cmsg = NULL;
		return synergy::string::sprintf("Unknown error, code %d", m_error);
	}
	std::string smsg(cmsg);
	LocalFree(cmsg);
	return smsg;
}
Ejemplo n.º 21
0
/* Dump ARP table */
static void
dumparp(void)
{
	int i;
	struct arp_tab *ap;
	char e[128];

	arp_loadfile();
	printf("received %u badtype %u bogus addr %u reqst in %u replies %u reqst out %u\n",
	 Arp_stat.recv,Arp_stat.badtype,Arp_stat.badaddr,Arp_stat.inreq,
	 Arp_stat.replies,Arp_stat.outreq);

	printf("IP addr            Type              Time Q Addr\n");
	for(i=0;i<HASHMOD;i++){
		for(ap = Arp_tab[i];ap != (struct arp_tab *)NULL;ap = ap->next){
			printf("%-18.18s ",inet_ntoa(ap->ip_addr));
			printf("%-15s",smsg(Arptypes,NHWTYPES,ap->hardware));
			printf("%7ld ",read_timer(&ap->timer)/1000L);
			if(ap->state == ARP_PENDING)
				printf("%-2u",len_q(ap->pending));
			else
				printf("  ");
			if(ap->state == ARP_VALID){
				if(Arp_type[ap->hardware].format != NULL){
					(*Arp_type[ap->hardware].format)(e,ap->hw_addr);
				} else {
					e[0] = '\0';
				}
				printf("%s",e);
			} else {
				printf("[unknown]");
			}
			if(ap->pub)
				printf(" (published)");
			printf("\n");
		}
	}
}
Ejemplo n.º 22
0
void ExportACache::save(const char* filename, int frameNumber, char bfirst)
{	
	MStatus status;
	FXMLScene xml_f;
	xml_f.begin(filename, frameNumber, bfirst);
	for(unsigned it=0; it<m_mesh_list.length(); it++) {
		m_mesh_list[it].extendToShape();
		
		MString surface = m_mesh_list[it].partialPathName();
	
		AHelper::validateFilePath(surface);
		
		MFnDependencyNode fnode(m_mesh_list[it].node());
		MString smsg("prtMsg");
		MStatus hasMsg;
		MPlug pmsg = fnode.findPlug( smsg, 1,  &hasMsg );
		
		char bNoChange = 0;
		if(hasMsg) {
			MObject oattrib;
			AHelper::getConnectedNode(oattrib, pmsg);
			fnode.setObject(oattrib);

			bool iattr = 0;
			
			AHelper::getBoolAttributeByName(fnode, "noChange", iattr);
			if(iattr) bNoChange = 1;
		}

		xml_f.meshBegin(surface.asChar(), bNoChange);
	
		MFnMesh meshFn(m_mesh_list[it], &status );
		MItMeshPolygon faceIter(m_mesh_list[it], MObject::kNullObj, &status );
		MItMeshVertex vertIter(m_mesh_list[it], MObject::kNullObj, &status);
		MItMeshEdge edgeIter(m_mesh_list[it], MObject::kNullObj, &status);
		
		int n_tri = 0;
		float f_area = 0;
		double area;
		
		faceIter.reset();
		for( ; !faceIter.isDone(); faceIter.next() ) {
			MIntArray vexlist;
			faceIter.getVertices ( vexlist );
			n_tri += vexlist.length() - 2;
			
			faceIter.getArea( area,  MSpace::kWorld );
			f_area += (float)area;
		}
		
		xml_f.triangleInfo(n_tri, f_area);
		
		float avg_grid = sqrt(f_area/n_tri)/2;
		
		double light_intensity = 1.0;
		
		if(hasMsg) {
			MObject oattrib;
			AHelper::getConnectedNode(oattrib, pmsg);
			fnode.setObject(oattrib);

			bool iattr = 0;
			
			AHelper::getBoolAttributeByName(fnode, "noChange", iattr);
			if(iattr) xml_f.addAttribute("noChange", 1);
			
			AHelper::getBoolAttributeByName(fnode, "skipIndirect", iattr);
			if(iattr) xml_f.addAttribute("skipIndirect", 1);
			
			iattr = 0;
			AHelper::getBoolAttributeByName(fnode, "skipScatter", iattr);
			if(iattr) xml_f.addAttribute("skipScatter", 1);
			
			iattr = 0;
			AHelper::getBoolAttributeByName(fnode, "skipBackscatter", iattr);
			if(iattr) xml_f.addAttribute("skipBackscatter", 1);
			
			iattr = 0;
			AHelper::getBoolAttributeByName(fnode, "asLightsource", iattr);
			if(iattr) xml_f.addAttribute("asLightsource", 1);
			
			iattr = 0;
			AHelper::getBoolAttributeByName(fnode, "asGhost", iattr);
			if(iattr) xml_f.addAttribute("invisible", 1);
			
			iattr = 0;
			AHelper::getBoolAttributeByName(fnode, "castNoShadow", iattr);
			if(iattr) xml_f.addAttribute("noShadow", 1);
			
			double td;
			if(AHelper::getDoubleAttributeByName(fnode, "lightIntensity", td)) light_intensity = td;
			
			fnode.setObject(m_mesh_list[it].node());
		}

		xml_f.staticBegin();
		
		int n_poly = meshFn.numPolygons();
		int n_vert = meshFn.numVertices();
		int* polycount = new int[n_poly];
		
		faceIter.reset();
		for( ; !faceIter.isDone(); faceIter.next() ) polycount[ faceIter.index() ] = faceIter.polygonVertexCount();
		
		xml_f.addFaceCount(n_poly, polycount);
		delete[] polycount;
		
		int n_facevertex = meshFn.numFaceVertices();
		int* polyconnect = new int[n_facevertex];
		
		int acc = 0;
		faceIter.reset();
		for( ; !faceIter.isDone(); faceIter.next() ) 
		{
			MIntArray  vexlist;
			faceIter.getVertices ( vexlist );
			for( int i=vexlist.length()-1; i >=0; i-- ) 
			{
				polyconnect[acc] = vexlist[i];
				acc++;
			}
		}
		
		xml_f.addFaceConnection(n_facevertex, polyconnect);
		delete[] polyconnect;
		
		int* triconnect = new int[3*n_tri];
		acc = 0;
		faceIter.reset();
		for( ; !faceIter.isDone(); faceIter.next() ) 
		{
			MIntArray  vexlist;
			faceIter.getVertices ( vexlist );
			for( int i=vexlist.length()-2; i >0; i-- ) 
			{
				triconnect[acc] = vexlist[vexlist.length()-1];
				acc++;
				triconnect[acc] = vexlist[i];
				acc++;
				triconnect[acc] = vexlist[i-1];
				acc++;
			}
		}
		
		xml_f.addTriangleConnection(3*n_tri, triconnect);
		delete[] triconnect;

		if(meshFn.numUVSets() > 0)
		{
			MStringArray setNames;
			meshFn.getUVSetNames(setNames);
			for(unsigned i=0; i< setNames.length(); i++)
			{
				float* scoord = new float[n_facevertex];
				float* tcoord = new float[n_facevertex];
				
				acc = 0;
				faceIter.reset();
				MFloatArray uarray, varray;
				if(faceIter.hasUVs (setNames[i], &status))
				{
					for( ; !faceIter.isDone(); faceIter.next() ) 
					{
						faceIter.getUVs ( uarray, varray, &setNames[i] );
						for( int j=uarray.length()-1; j >=0 ; j-- ) 
						{
							scoord[acc] = uarray[j];
							tcoord[acc] = 1.0 - varray[j];
							acc++;
						}
					}
					
					
					if(setNames[i] == "map1")
					{
						xml_f.uvSetBegin(setNames[i].asChar());
						xml_f.addS("facevarying float s", meshFn.numFaceVertices(), scoord);
						xml_f.addT("facevarying float t", meshFn.numFaceVertices(), tcoord);
						xml_f.uvSetEnd();
					}
					else
					{
						xml_f.uvSetBegin(setNames[i].asChar());
						std::string paramname("facevarying float u_");
						paramname.append(setNames[i].asChar());
						xml_f.addS(paramname.c_str(), meshFn.numFaceVertices(), scoord);
						
						paramname = "facevarying float v_";
						paramname.append(setNames[i].asChar());
						xml_f.addT(paramname.c_str(), meshFn.numFaceVertices(), tcoord);
						xml_f.uvSetEnd();
					}
				}
				else MGlobal::displayWarning(MString("Skip empty uv set: ") + setNames[i]);
				
				delete[] scoord;
				delete[] tcoord;
			}
		}
		
		MStringArray colorSetNames;
		meshFn.getColorSetNames (colorSetNames);
		
		for(unsigned int i=0; i<colorSetNames.length(); i++)
		{
			MStatus hasColor;
			
			XYZ *colors = new XYZ[n_vert];
			vertIter.reset();
			MString aset = colorSetNames[i];
			MColor col;
			for( unsigned int i=0; !vertIter.isDone(); vertIter.next(), i++ ) {
					MIntArray conn_face;
					vertIter.getConnectedFaces(conn_face);
					vertIter.getColor(col, conn_face[0], &aset);
					colors[i].x = col.r*light_intensity;
					colors[i].y = col.g*light_intensity;
					colors[i].z = col.b*light_intensity;
			}
				
			xml_f.addVertexColor(aset.asChar(), n_vert, colors);
			delete[] colors;
		}
		
		//if(!bNoChange) {

			
		//}
		
		MPointArray p_vert;
		
		meshFn.getPoints ( p_vert, MSpace::kWorld );
		
		MPoint corner_l(10e6, 10e6, 10e6);
		MPoint corner_h(-10e6, -10e6, -10e6);
		
		for( unsigned int i=0; i<p_vert.length(); i++) {
			if( p_vert[i].x < corner_l.x ) corner_l.x = p_vert[i].x;
			if( p_vert[i].y < corner_l.y ) corner_l.y = p_vert[i].y;
			if( p_vert[i].z < corner_l.z ) corner_l.z = p_vert[i].z;
			if( p_vert[i].x > corner_h.x ) corner_h.x = p_vert[i].x;
			if( p_vert[i].y > corner_h.y ) corner_h.y = p_vert[i].y;
			if( p_vert[i].z > corner_h.z ) corner_h.z = p_vert[i].z;
		}
		
		
		
		XYZ *cv = new XYZ[n_vert];
		
		for( unsigned int i=0; i<p_vert.length(); i++) 
		{
			cv[i].x = p_vert[i].x;
			cv[i].y = p_vert[i].y;
			cv[i].z= p_vert[i].z;
		}
		
		//if(!bNoChange) 
		//else 
		xml_f.addStaticP(n_vert, cv);
		
		
		
		XYZ *nor = new XYZ[n_vert];
		XYZ *tang = new XYZ[n_vert];
		
		vertIter.reset();
		MVector vnor;
		
		for( unsigned int i=0; !vertIter.isDone(); vertIter.next(), i++ )
		{
			vertIter.getNormal(vnor, MSpace::kWorld);
			vnor.normalize();
			nor[i].x = vnor.x;
			nor[i].y = vnor.y;
			nor[i].z = vnor.z;
		}
		
		MString uvset("map1");
		
		vertIter.reset();
		for( unsigned int i=0; !vertIter.isDone(); vertIter.next(), i++ )
		{
			MIntArray conn_face;
			vertIter.getConnectedFaces(conn_face);
			
			MVector ctang(0,0,0);
			MVector ttang;
			for(unsigned j = 0; j<conn_face.length(); j++) 
			{
				meshFn.getFaceVertexTangent (conn_face[j], i,  ttang,  MSpace::kWorld, &uvset);
				ttang.normalize();
				ctang += ttang;
			}
			ctang.normalize();
			tang[i].x = ctang.x;
			tang[i].y = ctang.y;
			tang[i].z = ctang.z;
			
			tang[i] = nor[i].cross(tang[i]);
			tang[i].normalize();
		}

		//if(!bNoChange) 
		//else 
		xml_f.addStaticN(n_vert, nor);
		//xml_f.addTangent(n_vert, tang);
		
		
// export per-vertex thickness
		float* vgrd = new float[n_vert];
		int pidx;
		vertIter.reset();
		for( unsigned int i=0; !vertIter.isDone(); vertIter.next(), i++ ) {
			MIntArray connfaces;
			vertIter.getConnectedFaces( connfaces );
			float connarea = 0;
			for(unsigned j=0; j<connfaces.length(); j++)
			{
				faceIter.setIndex(connfaces[j], pidx);
				faceIter.getArea(area, MSpace::kWorld );
				connarea += (float)area/faceIter.polygonVertexCount();
			}
			vgrd[i] = sqrt(connarea)/2;
			if(vgrd[i] > avg_grid) vgrd[i] = avg_grid;
		}
		
		//if(!bNoChange) 
		//else 
		xml_f.addStaticGridSize(n_vert, vgrd);
		
		
		
		// 
		//else 
		xml_f.staticEnd();
		
		if(!bNoChange) {
			
			xml_f.dynamicBegin();
		
			xml_f.addP(n_vert, cv);
			xml_f.addN(n_vert, nor);
			xml_f.addGridSize(n_vert, vgrd);
			
			xml_f.dynamicEnd();
		}
		
		delete[] cv;
		delete[] tang;
		delete[] nor;
		delete[] vgrd;
		
		xml_f.addBBox(corner_l.x, corner_l.y, corner_l.z, corner_h.x, corner_h.y, corner_h.z);

		xml_f.meshEnd(bNoChange);
	}
/* disable nurbs for now

	float aspace[4][4];
	for(unsigned it=0; it<m_nurbs_list.length(); it++) {
		MVector scale = AHelper::getTransformWorldNoScale(m_nurbs_list[it].fullPathName(), aspace);
		
		MString surfacename = m_nurbs_list[it].fullPathName();
		AHelper::validateFilePath(surfacename);
		xml_f.transformBegin(surfacename.asChar(), aspace);
		xml_f.addScale(scale.x, scale.y, scale.z);
		
		m_nurbs_list[it].extendToShape();
		
		surfacename = m_nurbs_list[it].fullPathName();
		AHelper::validateFilePath(surfacename);
		
		MFnNurbsSurface fsurface(m_nurbs_list[it]);
		
		int degreeU = fsurface.degreeU();
		int degreeV = fsurface.degreeV();
		
		int formU, formV;
		
		if(fsurface.formInU() == MFnNurbsSurface::kOpen ) formU = 0;
		else if(fsurface.formInU() == MFnNurbsSurface::kClosed ) formU = 1;
		else formU = 2;

		if(fsurface.formInV() == MFnNurbsSurface::kOpen ) formV = 0;
		else if(fsurface.formInV() == MFnNurbsSurface::kClosed ) formV = 1;
		else formV = 2;
		
		xml_f.nurbssurfaceBegin(surfacename.asChar(), degreeU, degreeV, formU, formV);
		
		xml_f.staticBegin();
		
		MPointArray p_cvs;
	
		fsurface.getCVs( p_cvs, MSpace::kObject );
		
		unsigned n_cvs = p_cvs.length();
		XYZ *cv = new XYZ[n_cvs];
	
		for(unsigned i=0; i<n_cvs; i++) {
			cv[i].x = p_cvs[i].x;
			cv[i].y = p_cvs[i].y;
			cv[i].z= p_cvs[i].z;
		}
	
		xml_f.addStaticVec("cvs", n_cvs, cv);
		delete[] cv;
		
		MDoubleArray knotu, knotv;
		
		fsurface.getKnotsInU(knotu);
		fsurface.getKnotsInV(knotv);
		
		unsigned n_ku = knotu.length();
		unsigned n_kv = knotv.length();
		
		float *ku = new float[n_ku];
		for(unsigned i=0; i<n_ku; i++) ku[i] = knotu[i];
		
		float *kv = new float[n_kv];
		for(unsigned i=0; i<n_kv; i++) kv[i] = knotv[i];

		xml_f.addStaticFloat("knotu", n_ku, ku);
		xml_f.addStaticFloat("knotv", n_kv, kv);
		
		delete[] ku;
		delete[] kv;
		
		xml_f.staticEnd();
		
		xml_f.nurbssurfaceEnd();
		
		xml_f.transformEnd();
	}
*/	
	xml_f.cameraBegin("backscat_camera", m_space);
	xml_f.cameraEnd();
	
	xml_f.cameraBegin("eye_camera", m_eye);
	p_eye.extendToShape();
	MFnCamera feye(p_eye);
	xml_f.addAttribute("focal_length", (float)feye.focalLength());
	xml_f.addAttribute("horizontal_film_aperture", (float)feye.horizontalFilmAperture());
	xml_f.addAttribute("vertical_film_aperture", (float)feye.verticalFilmAperture());
	xml_f.addAttribute("near_clipping_plane", (float)feye.nearClippingPlane());
	xml_f.addAttribute("far_clipping_plane", (float)feye.farClippingPlane());
	xml_f.cameraEnd();
	
	xml_f.end(filename);
}
Ejemplo n.º 23
0
/*
 * Find a file in a search context.
 * The search context was created with vim_findfile_init() above.
 * Return a pointer to an allocated file name or NULL if nothing found.
 * To get all matching files call this function until you get NULL.
 *
 * If the passed search_context is NULL, NULL is returned.
 *
 * The search algorithm is depth first. To change this replace the
 * stack with a list (don't forget to leave partly searched directories on the
 * top of the list).
 */
char_u *vim_findfile(void *search_ctx_arg)
{
  char_u      *file_path;
  char_u      *rest_of_wildcards;
  char_u      *path_end = NULL;
  ff_stack_T  *stackp;
  int len;
  int i;
  char_u      *p;
  char_u      *suf;
  ff_search_ctx_T *search_ctx;

  if (search_ctx_arg == NULL)
    return NULL;

  search_ctx = (ff_search_ctx_T *)search_ctx_arg;

  /*
   * filepath is used as buffer for various actions and as the storage to
   * return a found filename.
   */
  file_path = xmalloc(MAXPATHL);

  /* store the end of the start dir -- needed for upward search */
  if (search_ctx->ffsc_start_dir != NULL)
    path_end = &search_ctx->ffsc_start_dir[
      STRLEN(search_ctx->ffsc_start_dir)];

  /* upward search loop */
  for (;; ) {
    /* downward search loop */
    for (;; ) {
      /* check if user user wants to stop the search*/
      ui_breakcheck();
      if (got_int)
        break;

      /* get directory to work on from stack */
      stackp = ff_pop(search_ctx);
      if (stackp == NULL)
        break;

      /*
       * TODO: decide if we leave this test in
       *
       * GOOD: don't search a directory(-tree) twice.
       * BAD:  - check linked list for every new directory entered.
       *       - check for double files also done below
       *
       * Here we check if we already searched this directory.
       * We already searched a directory if:
       * 1) The directory is the same.
       * 2) We would use the same wildcard string.
       *
       * Good if you have links on same directory via several ways
       *  or you have selfreferences in directories (e.g. SuSE Linux 6.3:
       *  /etc/rc.d/init.d is linked to /etc/rc.d -> endless loop)
       *
       * This check is only needed for directories we work on for the
       * first time (hence stackp->ff_filearray == NULL)
       */
      if (stackp->ffs_filearray == NULL
          && ff_check_visited(&search_ctx->ffsc_dir_visited_list
              ->ffvl_visited_list,
              stackp->ffs_fix_path
              , stackp->ffs_wc_path
              ) == FAIL) {
#ifdef FF_VERBOSE
        if (p_verbose >= 5) {
          verbose_enter_scroll();
          smsg((char_u *)"Already Searched: %s (%s)",
              stackp->ffs_fix_path, stackp->ffs_wc_path);
          /* don't overwrite this either */
          msg_puts((char_u *)"\n");
          verbose_leave_scroll();
        }
#endif
        ff_free_stack_element(stackp);
        continue;
      }
#ifdef FF_VERBOSE
      else if (p_verbose >= 5) {
        verbose_enter_scroll();
        smsg((char_u *)"Searching: %s (%s)",
            stackp->ffs_fix_path, stackp->ffs_wc_path);
        /* don't overwrite this either */
        msg_puts((char_u *)"\n");
        verbose_leave_scroll();
      }
#endif

      /* check depth */
      if (stackp->ffs_level <= 0) {
        ff_free_stack_element(stackp);
        continue;
      }

      file_path[0] = NUL;

      /*
       * If no filearray till now expand wildcards
       * The function expand_wildcards() can handle an array of paths
       * and all possible expands are returned in one array. We use this
       * to handle the expansion of '**' into an empty string.
       */
      if (stackp->ffs_filearray == NULL) {
        char_u *dirptrs[2];

        /* we use filepath to build the path expand_wildcards() should
         * expand.
         */
        dirptrs[0] = file_path;
        dirptrs[1] = NULL;

        /* if we have a start dir copy it in */
        if (!vim_isAbsName(stackp->ffs_fix_path)
            && search_ctx->ffsc_start_dir) {
          STRCPY(file_path, search_ctx->ffsc_start_dir);
          add_pathsep(file_path);
        }

        /* append the fix part of the search path */
        STRCAT(file_path, stackp->ffs_fix_path);
        add_pathsep(file_path);

        rest_of_wildcards = stackp->ffs_wc_path;
        if (*rest_of_wildcards != NUL) {
          len = (int)STRLEN(file_path);
          if (STRNCMP(rest_of_wildcards, "**", 2) == 0) {
            /* pointer to the restrict byte
             * The restrict byte is not a character!
             */
            p = rest_of_wildcards + 2;

            if (*p > 0) {
              (*p)--;
              file_path[len++] = '*';
            }

            if (*p == 0) {
              /* remove '**<numb> from wildcards */
              STRMOVE(rest_of_wildcards, rest_of_wildcards + 3);
            } else
              rest_of_wildcards += 3;

            if (stackp->ffs_star_star_empty == 0) {
              /* if not done before, expand '**' to empty */
              stackp->ffs_star_star_empty = 1;
              dirptrs[1] = stackp->ffs_fix_path;
            }
          }

          /*
           * Here we copy until the next path separator or the end of
           * the path. If we stop at a path separator, there is
           * still something else left. This is handled below by
           * pushing every directory returned from expand_wildcards()
           * on the stack again for further search.
           */
          while (*rest_of_wildcards
                 && !vim_ispathsep(*rest_of_wildcards))
            file_path[len++] = *rest_of_wildcards++;

          file_path[len] = NUL;
          if (vim_ispathsep(*rest_of_wildcards))
            rest_of_wildcards++;
        }

        /*
         * Expand wildcards like "*" and "$VAR".
         * If the path is a URL don't try this.
         */
        if (path_with_url(dirptrs[0])) {
          stackp->ffs_filearray = (char_u **)xmalloc(sizeof(char *));
          stackp->ffs_filearray[0] = vim_strsave(dirptrs[0]);
          stackp->ffs_filearray_size = 1;
        } else
          /* Add EW_NOTWILD because the expanded path may contain
           * wildcard characters that are to be taken literally.
           * This is a bit of a hack. */
          expand_wildcards((dirptrs[1] == NULL) ? 1 : 2, dirptrs,
              &stackp->ffs_filearray_size,
              &stackp->ffs_filearray,
              EW_DIR|EW_ADDSLASH|EW_SILENT|EW_NOTWILD);

        stackp->ffs_filearray_cur = 0;
        stackp->ffs_stage = 0;
      } else
        rest_of_wildcards = &stackp->ffs_wc_path[
          STRLEN(stackp->ffs_wc_path)];

      if (stackp->ffs_stage == 0) {
        /* this is the first time we work on this directory */
        if (*rest_of_wildcards == NUL) {
          /*
           * We don't have further wildcards to expand, so we have to
           * check for the final file now.
           */
          for (i = stackp->ffs_filearray_cur;
               i < stackp->ffs_filearray_size; ++i) {
            if (!path_with_url(stackp->ffs_filearray[i])
                && !os_isdir(stackp->ffs_filearray[i]))
              continue;                 /* not a directory */

            /* prepare the filename to be checked for existence
             * below */
            STRCPY(file_path, stackp->ffs_filearray[i]);
            add_pathsep(file_path);
            STRCAT(file_path, search_ctx->ffsc_file_to_search);

            /*
             * Try without extra suffix and then with suffixes
             * from 'suffixesadd'.
             */
            len = (int)STRLEN(file_path);
            if (search_ctx->ffsc_tagfile)
              suf = (char_u *)"";
            else
              suf = curbuf->b_p_sua;
            for (;; ) {
              /* if file exists and we didn't already find it */
              if ((path_with_url(file_path)
                   || (os_file_exists(file_path)
                       && (search_ctx->ffsc_find_what
                           == FINDFILE_BOTH
                           || ((search_ctx->ffsc_find_what
                                == FINDFILE_DIR)
                               == os_isdir(file_path)))))
#ifndef FF_VERBOSE
                  && (ff_check_visited(
                          &search_ctx->ffsc_visited_list->ffvl_visited_list,
                          file_path
                          , (char_u *)""
                          ) == OK)
#endif
                  ) {
#ifdef FF_VERBOSE
                if (ff_check_visited(
                        &search_ctx->ffsc_visited_list->ffvl_visited_list,
                        file_path
                        , (char_u *)""
                        ) == FAIL) {
                  if (p_verbose >= 5) {
                    verbose_enter_scroll();
                    smsg((char_u *)"Already: %s",
                        file_path);
                    /* don't overwrite this either */
                    msg_puts((char_u *)"\n");
                    verbose_leave_scroll();
                  }
                  continue;
                }
#endif

                /* push dir to examine rest of subdirs later */
                stackp->ffs_filearray_cur = i + 1;
                ff_push(search_ctx, stackp);

                if (!path_with_url(file_path))
                  simplify_filename(file_path);
                if (os_dirname(ff_expand_buffer, MAXPATHL)
                    == OK) {
                  p = path_shorten_fname(file_path,
                      ff_expand_buffer);
                  if (p != NULL)
                    STRMOVE(file_path, p);
                }
#ifdef FF_VERBOSE
                if (p_verbose >= 5) {
                  verbose_enter_scroll();
                  smsg((char_u *)"HIT: %s", file_path);
                  /* don't overwrite this either */
                  msg_puts((char_u *)"\n");
                  verbose_leave_scroll();
                }
#endif
                return file_path;
              }

              /* Not found or found already, try next suffix. */
              if (*suf == NUL)
                break;
              copy_option_part(&suf, file_path + len,
                  MAXPATHL - len, ",");
            }
          }
        } else {
          /*
           * still wildcards left, push the directories for further
           * search
           */
          for (i = stackp->ffs_filearray_cur;
               i < stackp->ffs_filearray_size; ++i) {
            if (!os_isdir(stackp->ffs_filearray[i]))
              continue;                 /* not a directory */

            ff_push(search_ctx,
                ff_create_stack_element(
                    stackp->ffs_filearray[i],
                    rest_of_wildcards,
                    stackp->ffs_level - 1, 0));
          }
        }
        stackp->ffs_filearray_cur = 0;
        stackp->ffs_stage = 1;
      }

      /*
       * if wildcards contains '**' we have to descent till we reach the
       * leaves of the directory tree.
       */
      if (STRNCMP(stackp->ffs_wc_path, "**", 2) == 0) {
        for (i = stackp->ffs_filearray_cur;
             i < stackp->ffs_filearray_size; ++i) {
          if (fnamecmp(stackp->ffs_filearray[i],
                  stackp->ffs_fix_path) == 0)
            continue;             /* don't repush same directory */
          if (!os_isdir(stackp->ffs_filearray[i]))
            continue;               /* not a directory */
          ff_push(search_ctx,
              ff_create_stack_element(stackp->ffs_filearray[i],
                  stackp->ffs_wc_path, stackp->ffs_level - 1, 1));
        }
      }

      /* we are done with the current directory */
      ff_free_stack_element(stackp);

    }

    /* If we reached this, we didn't find anything downwards.
     * Let's check if we should do an upward search.
     */
    if (search_ctx->ffsc_start_dir
        && search_ctx->ffsc_stopdirs_v != NULL && !got_int) {
      ff_stack_T  *sptr;

      /* is the last starting directory in the stop list? */
      if (ff_path_in_stoplist(search_ctx->ffsc_start_dir,
              (int)(path_end - search_ctx->ffsc_start_dir),
              search_ctx->ffsc_stopdirs_v) == TRUE)
        break;

      /* cut of last dir */
      while (path_end > search_ctx->ffsc_start_dir
             && vim_ispathsep(*path_end))
        path_end--;
      while (path_end > search_ctx->ffsc_start_dir
             && !vim_ispathsep(path_end[-1]))
        path_end--;
      *path_end = 0;
      path_end--;

      if (*search_ctx->ffsc_start_dir == 0)
        break;

      STRCPY(file_path, search_ctx->ffsc_start_dir);
      add_pathsep(file_path);
      STRCAT(file_path, search_ctx->ffsc_fix_path);

      /* create a new stack entry */
      sptr = ff_create_stack_element(file_path,
          search_ctx->ffsc_wc_path, search_ctx->ffsc_level, 0);
      ff_push(search_ctx, sptr);
    } else
      break;
  }

  free(file_path);
  return NULL;
}
Ejemplo n.º 24
0
/* mode: ('A') append
 *       ('R') replace one or more different characters
 *       ('r') replace 1 character
 *       ('i') insert characters
 *       ('a') insert after cursor
 * a precount can be used
 *
 * for insert and append we misuse the undo buffer for the inserted
 * characters (for "." command)
 */
off_t edit(int mode)
{
    int ch, ch1;
    size_t len;
    off_t count = 0L;
    off_t buffer = BUFFER;
    off_t psize;
    if(!filesize && mode == 'i') {
        mode = 'A';
    }
    if(mode != 'A' && mode != 'a') {
        if(current - mem >= filesize) {
            beep();
            return 0L;
        }
    }
    if(precount < 1) {
        precount = 1;
    }
    len = strlen(rep_buf);
    if(mode == 'r' && current + precount > maxpos) {
        beep();
        rep_buf[len] = '\0';
        return 0L;
    }
    if(alloc_buf(buffer, &undo_buf) == 0L) {
        rep_buf[len] = '\0';
        return 0L;
    }
    switch(mode) {
        case 'A':
            edits = U_APPEND;
            break;
        case 'R':
            edits = U_EDIT;
            smsg("REPLACE MODE");
            break;
        case 'r':
            edits = U_EDIT;
            smsg("REPLACE 1 CHAR");
            break;
        case 'a':
        case 'i':
            edits = U_INSERT;
            smsg("INSERT MODE");
            break;
    }
    undo_start = current;
    while((ch = vgetc()) != ESC) {
        ch &= 0xff;
        rep_buf[len++] = ch;
        if(ch == '\t') {
            toggle();
            setcur();
            continue;
        }
        if(ch == KEY_BACKSPACE || ch == ASCII_DEL || ch == BVICTRL('H')) {
            if(count > 0) {
                len--;
                count--;
                if(mode == 'A' || mode == 'a' || mode == 'i') {
                    filesize--;
                    maxpos--;
                }
                current--;
                cur_back();
                setcur();
            } else {
                beep();
            }
            continue;
        }
        if(loc == HEX) {
            if(isxdigit(ch)) {
                mvaddch(y, x + 1, ' ');
                mvaddch(y, x, ch);
                do {
                    ch1 = vgetc() & 0xff;
                    if(ch1 == ESC) {
                        mvaddch(y, x, ' ');
                        current--;
                        cur_back();
                        goto escape;
                    }
                    if(!isxdigit(ch1)) {
                        beep();
                        ch1 = -1;
                    }
                } while(ch1 == -1);
                rep_buf[len++] = ch1;
                mvaddch(y, x + 1, ch1);
                sprintf(tmpbuf, "%c%c", ch, ch1);
                sscanf(tmpbuf, "%2x", &ch);
            } else {
                beep();
                len--;
                goto wrong;
            }
        } else {            /*** ASCII - Bereich ***/
            if(isprint(ch)) {
                mvaddch(y, x, ch);
            } else {
                beep();
                goto wrong;
            }
        }
        curpos = current++;
        if(mode == 'i' || mode == 'a') {
            memmove(current, curpos, maxpos - curpos);
        }
        if(mode == 'A' || mode == 'i' || mode == 'a') {
            maxpos++;
            filesize++;
            /* NEU
            undo_buf[count++] = ch;
            */
            count++;
        } else {
            undo_buf[count++] = *curpos;
        }
        if(count == buffer) {
            buffer += BUFFER;
            if(alloc_buf(buffer, &undo_buf) == 0L) {
                rep_buf[len] = '\0';
                return count;
            }
        }
        *curpos = (char)ch;
        cur_forw(0);
        statpos();
        if(mode == 'i' || mode == 'a') {
            repaint();
        } else {
            lineout();
        }
        setcur();
        if(filesize > memsize - 2L) {
            if(enlarge(100L)) {
                break;
            }
        }
        if((mode != 'A' && mode != 'a') && curpos == maxpos - 1) {
            break;
        }
        if(mode == 'r') {
            break;
        }
wrong:
        continue;
    }
    rep_buf[len++] = ESC;
    rep_buf[len] = '\0';
    if(!count) {
        goto escape;
    }
    if(precount > 1) {
        switch(mode) {
            case 'i':
            case 'a':
            case 'A':
                psize = count * (precount - 1);
                if(filesize + psize > memsize - 2L) {
                    if(enlarge(psize + 100L)) {
                        return count;
                    }
                }
                if(psize + count > buffer) {
                    if(alloc_buf(psize + count, &undo_buf) == 0L) {
                        return count;
                    }
                }
                if(mode == 'i' || mode == 'a') {
                    memmove(current + psize, current, maxpos - curpos);
                }
                /* NEU
                undo_pos = undo_buf + count - 1L;
                */
                while(--precount) {
                    /* NEU
                    memcpy(undo_pos + 1L, undo_pos - count + 1L, count);
                    undo_pos += count;
                    */
                    memcpy(curpos + 1L, curpos - count + 1L, count);
                    curpos += count;
                }
                filesize += psize;
                count += psize;
                maxpos += psize;
                undo_count += psize;
                current = curpos + 1L;
                setpage(current);
                repaint();
                break;
            case 'R':
                if(current + count * (precount - 1) > maxpos) {
                    break;
                }
                psize = count;
                while(--precount) {
                    memcpy(undo_buf + psize, curpos + 1L, count);
                    psize += count;
                    memcpy(curpos + 1L, curpos - count + 1L, count);
                    curpos += count;
                }
                count = psize;
                setpage(++curpos);
                repaint();
                break;
            case 'r':
                while(--precount) {
                    undo_buf[count++] = *(++curpos);
                    *curpos = (char)ch;
                    cur_forw(0);
                    statpos();
                    lineout();
                }
                break;
        }
    }
    cur_back();
escape:
    setcur();
    smsg("");
    return(count);
}
Ejemplo n.º 25
0
/*-#+func----------------------------------------------------------
    FUNCTION: arp_dump()
     PURPOSE: Dump arp packet
      SYNTAX: char *arp_dump(FILE *fp, MBUF *bpp, BYTE flags);
 DESCRIPTION: Dumps ARP packet 'bpp' to FILE 'fp'
     RETURNS: Nothing
     HISTORY: 940324 V0.1
--#-func----------------------------------------------------------*/
char *arp_dump(MBUF *bpp, BYTE flags)
{
    static char s[512];
    struct arp arp;
    struct arp_type *at;
    int    is_ip = 0;
    char   t[80];

    /*-----/ Dump header /-----*/
    strcpy(s,"ARP: ");

    /*-----/ Decode header to struct arp /-----*/
    if(ntoharp(&arp,bpp) == -1){
        strcat(s," bad packet\n");
        return(s);
    }

    /*-----/ Determine hardware /-----*/
    if(arp.hardware < NHWTYPES)
      at = &Arp_type[arp.hardware];
    else
      at = NULLATYPE;

    /* Print hardware type in Ascii if known, numerically if not */
    sprintf(t," %s",smsg(Arptypes,NHWTYPES,arp.hardware));
    strcat(s,t);

    /* Print hardware length only if unknown type, or if it doesn't match
     * the length in the known types table
     */
    if(at == NULLATYPE || (arp.hwalen != at->hwalen)) {
      sprintf(t," hwlen %u",arp.hwalen);
      strcat(s,t);
    }

    /* Check for most common case -- upper level protocol is IP */
    if(at != NULLATYPE && arp.protocol == at->iptype){
        strcat(s," IP");
        is_ip = 1;
    } else {
        sprintf(t," prot 0x%x prlen %u",arp.protocol,arp.pralen);
        strcat(s,t);
    }

    /*-----/ Dump ARP opcode /-----*/
    switch(arp.opcode){
    case ARP_REQUEST:
        strcat(s," REQUEST");
        break;
    case ARP_REPLY:
        strcat(s," REPLY");
        break;
    case REVARP_REQUEST:
        strcat(s," REVERSE REQUEST");
        break;
    case REVARP_REPLY:
        strcat(s," REVERSE REPLY");
        break;
    default:
        sprintf(t," op %u",arp.opcode);
        strcat(s,t);
        break;
    }
    strcat(s,"  ");

    /*-----/ Dump sender /-----*/
    if(is_ip) {
      sprintf(t,"%s->",inet_ntoa(arp.sprotaddr));
      strcat(s,t);
    }
    else
      strcat(s,"?   ");

    /*-----/ Dump target /-----*/
    if(is_ip) {
      sprintf(t,"%s",inet_ntoa(arp.tprotaddr));
      strcat(s,t);
    }
    else
      strcat(s,"?");

    /*-----/ Return pointer to generated string /-----*/
    return(s);
}
Ejemplo n.º 26
0
	void
help()
{
	int		c;
	int		eof;
	int		i;
	long	filepos[26];	/* seek position for each screen */
	int		screennr;		/* screen number; 'c' == 1 */
	char	fnamebuf[MAXPATHL];
#ifdef MSDOS
	char	*fnamep;
#endif

/*
 * try to open the file specified by the "helpfile" option
 */
	expand_env(p_hf, fnamebuf, MAXPATHL);
	if ((helpfd = fopen(fnamebuf, READBIN)) == NULL)
	{
#ifdef MSDOS
	/*
	 * for MSdos: try the DOS search path
     */
		strcpy(fnamebuf, "vim.hlp");
		fnamep = searchpath(fnamebuf);
		if (fnamep == NULL || (helpfd = fopen(fnamep, READBIN)) == NULL)
		{
#endif
			smsg("Sorry, help file %s not found", fnamebuf);
			return;
#ifdef MSDOS
		}
#endif
	}
	helpfilepos = 0;
	screennr = 0;
	for (i = 0; i < 26; ++i)
		filepos[i] = 0;
	State = HELP;
	for (;;)
	{
		eof = redrawhelp();
		if (!eof)
			filepos[screennr + 1] = ftell(helpfd);

		if ((c = vgetc()) == '\n' || c == '\r')
			break;

		if (c == ' ')						/* one screen forwards */
		{
			if (screennr < 25 && !eof)
				++screennr;
		}
		else if (c == 'a')					/* go to first screen */
			screennr = 0;
		else if (c == 'b')					/* go one screen backwards */
		{
			if (screennr > 0)
				--screennr;
		}
		else if (c >= 'c' && c <= 'z')		/* go to specified screen */
		{
			if (c - 'b' < screennr)			/* backwards */
				screennr = c - 'b';
			else							/* forwards */
			{
				while (screennr < c - 'b' && filepos[screennr + 1])
					++screennr;
				fseek(helpfd, filepos[screennr], 0);
				while (screennr < c - 'b')
				{
					while ((i = getc(helpfd)) != '\f' && i != -1)
						;
					if (i == -1)
						break;
					filepos[++screennr] = ftell(helpfd);
				}
			}
		}
		helpfilepos = filepos[screennr];
	}
	State = NORMAL;
	script_winsize_pp();
	fclose(helpfd);
	updateScreen(CLEAR);
}
Ejemplo n.º 27
0
int main()
{  finit( 9, 9, 0, 3);
   int n; /* having a spare int is useful. */
   time_t t;
   printw(
   "   This game is so interesting and meaningfull\n"
   "and the reasons why are explained in this message...\n"
   "...which may or may not be complete\n"
   "\n"
   "(press any 3 keys to continue)\n");
   getch();
   getch();
   getch();
   clear();

   #include "objects.h"

   while(loop)
   {  
      switch(z)
      {  
         case 0:
            uroom[0]=5;
            wroom[0]=1;
 
            wall=
            "Some sort of wall mesage should be displayed here,\n"
            "It should inform the player of the solidity of this wall,\n"
            "and it should warn that attempts to surpass this fact are admonishable.";

            event(11,11,30,"hello");
            event(11,11,31,"hello again");
            event(11,11,32,"hello a third time");

            mesage[0][0].x  =12;
            mesage[0][0].y  =12;
            mesage[0][0].ch='*';
            mesage[0][0].hit="Hello sir, this is a structure mesage";
 
            msg(8,9,
            "THIS SPOT IS IMPORTANT FOR THIS REASON");
            smsg(2,9,
               "   This spot is UBER important :)\n"
               "It clears the screen to show you something!!!! \n");
            smsg(2,9,
               "   And it can do it twice!!!\n");
            smsg(2,9,
               "\n"
               "And thrice as well!!! :)");
            if(sw[0])
            {
               smsg(9,9,
               "This is a new stairwell.");
            }
            break;
         case 1:
            wall=
            "this is a wall in room 1";
            droom[1]=2;
            eroom[1]=0;
            sroom[1]=4;
            break;
         case 2:
            wall=
            "this is a more interesting wall in room 2";
            sroom[2]=3;
            uroom[2]=1;
            break;
         case 3:
            wall=
            "in room 3, the wall is so interesting, it's unsurpassable...";
            nroom[3]=2;
            break;
         case 4:
            wall=
            "...when it's not compared to these walls in room 4\n"
            "(see room 3's walls)";
            
            smsg(6,14,
            "   this is an object of\n"
            "INSURMOUNTABLE POWER...\n"
            "It will somehow help you on your\n"
            "QUEST,\n"
            "(which has neither been defined nor\n"
            "ACCEPTED)...\n"
            "\n"
            "...once the master programmer imbues\n"
            "it with the power to do such.\n"
            "\n"
            "Until then, walk from here back to\n"
            "THE BEGINING,\n"
            "and from there to here 9 times 7.\n"
            "\n");
             
            smsg(6,14,
            "+-----------------------------------+"
            "|                                   |"
            "|                                   |"
            "|            ????                   |"
            "|          ??  ? ???                |"
            "|            ??     ??              |"
            "|             ####    ?   ####      |"
            "|          ###    ##   ? ##  ##     |"
            "|        ##     ?   #  ?     ##     |"
            "|      ##     ?   o   ?     ##      |"
            "|     ##     ?  #   ?     ##        |"
            "|     ##  ## ?   ##    ###          |"
            "|      ####   ?    ####             |"
            "|              ??     ??            |"
            "|                ??? ?  ??          |"
            "|                   ????            |"
            "|                                   |"
            "|                                   |"
            "+-----------------------------------+");

            smsg(6,14,
            "   The Master Programmer hath spoken."
            "He hath declared that the way forth  "
            "shall become clear if you retrace    "
            "your steps to your point of origin.  ");

            lvr(6,14,0);
            if(sw[0]==1)
            {
               map[0][9][9]='^';
               sw[0]==2;
            }
            nroom[4]=1;
            break;
         case 5:
            wall=
            "there is nothing extra-ordinary about these walls";
            droom[5]=0;
            nroom[5]=6;
            smsg(9,8,
            "\n\n\n   Time:\n"
            "all encompasing,\n"
            "inescapable...\n");
            
            smsg(9,1,
            "\n\n\n...incorporeal.\n\n"
            "   In Time\n" /* "Time" which refers to the clock, is a proper noun in this case*/
            "The Trinity will point forward...");

            lvr(9 , 4,1);
            lvr(13, 5,2);
            lvr(14,9 ,3);
            lvr(13,13,4);
            lvr(9 ,14,5);
            lvr(5 ,13,6);
            lvr(4 , 9,7);
            lvr(5 , 5,8);

            if(sw[1]&&sw[3]&&sw[5]&&sw[7]||sw[2]&&sw[4]&&sw[6]&&sw[8])
            {
               sw[1]=0;
               sw[2]=0;
               sw[3]=0;
               sw[4]=0;
               sw[5]=0;
               sw[6]=0;
               sw[7]=0;
               sw[8]=0;
            }
            if(sw[1]&&sw[4]&&sw[6]||sw[2]&&sw[5]&&sw[7]||sw[8]&&sw[5]&&sw[3])
            {
               map[5][0][ 8]=' ';
               map[5][0][ 9]=' ';
               map[5][0][10]=' ';
            }
            else
            {
               map[5][0][ 8]='-';
               map[5][0][ 9]='-';
               map[5][0][10]='-';
            }
            
            if(time(NULL)>t)
            {
            int a,b,c,d,e,f,g,h;
            a=sw[1]; //rotate lvrs
            b=sw[2];
            c=sw[3];
            d=sw[4];
            e=sw[5];
            f=sw[6];
            g=sw[7];
            h=sw[8];
            sw[1]=h;
            sw[2]=a;
            sw[3]=b;
            sw[4]=c;
            sw[5]=d;
            sw[6]=e;
            sw[7]=f;
            sw[8]=g;
            }
            t=time(NULL);
            break;
         case 6:
            sroom[6]=5;
            uroom[6]=7;

            map[5][0][ 8]=' ';
            map[5][0][ 9]=' ';
            map[5][0][10]=' ';

            msg( 9, 9,
            "...all will be of one substance...");

            lvr( 6, 6, 9);
            lvr(12, 6,10);
            lvr( 9, 7,11);
            lvr( 7, 9,12);
            lvr(11, 9,13);
            lvr( 9,11,14);
            lvr( 6,12,15);
            lvr(12,12,16);

            if(sw[ 9]==1)
            {
               flip(13);
               flip(14);
               sw[ 9]=2;
            }
            if(sw[10]==1)
            {
               flip(12);
               flip(14);
               sw[10]=2;
            }
            if(sw[11]==1)
            {
               flip(15);
               flip(16);
               sw[11]=2;
            }
            if(sw[12]==1)
            {
               flip(10);
               flip(16);
               sw[12]=2;
            } 
            if(sw[13]==1)
            {
               flip( 9);
               flip(15);
               sw[13]=2;
            }
            if(sw[14]==1)
            {
               flip( 9);
               flip(10);
               sw[14]=2;
            }
            if(sw[15]==1)
            {
               flip(13);
               flip(11);
               sw[15]=2;
            }
            if(sw[16]==1)
            {
               flip(11);
               flip(12);
               sw[16]=2;
            }
            lvr( 6, 6, 9);
            lvr(12, 6,10);
            lvr( 9, 7,11);
            lvr( 7, 9,12);
            lvr(11, 9,13);
            lvr( 9,11,14);
            lvr( 6,12,15);
            lvr(12,12,16);
            if(sw[9]&&sw[10]&&sw[11]&&sw[12]&&sw[13]&&sw[14]&&sw[15]&&sw[16])
              {map[6][9][9]='^';}
            
            break;
         case 7:
            uroom[7]=8;
            droom[7]=6;
            lvr( 5, 5,17);
            lvr(13, 5,18);
            lvr(13,13,19);
            lvr(5 ,13,20);
            
            for(n=17;n<20;n++)
            {
               if(sw[n]==1)
               {
                  flip(n+4);
                  flip(n+1);
                  flip(n);
               }
            }
            if(sw[20]==1)
            {
               flip(17);
               flip(24);
               flip(20);
            }
            mlvr( 5, 5,17);
            mlvr(13, 5,18);
            mlvr(13,13,19);
            mlvr(5 ,13,20);

            break;
         case 8:
            uroom[8]=9;
            droom[8]=7;

            lvr( 9, 9,30);

            lvr( 5, 5,21);
            lvr(13, 5,22);
            lvr(13,13,23);
            lvr(5 ,13,24);
            
            for(n=22;n<=24;n++)
            {
               if(sw[n]==1)
               {
                  flip(n-1);
                  flip(n+4);
                  flip(n-4);
                  flip(n);
               }
            }
            if(sw[21]==1)
            {
               flip(24);
               flip(25);
               flip(17);
               flip(21);
            }
            if(sw[30]==1)
            {
               int a,b,c,d;
               a=sw[21];
               b=sw[22];
               c=sw[23];
               d=sw[24];
               sw[21]=b;
               sw[22]=c;
               sw[23]=d;
               sw[24]=a;
               flip(30);
            }

            mlvr( 9, 9,30);
            mlvr( 5, 5,21);
            mlvr(13, 5,22);
            mlvr(13,13,23);
            mlvr(5 ,13,24);
            break;
         case 9:
            droom[9]=8;
            uroom[9]=10;
            lvr( 9, 9,29);

            lvr( 5, 5,25);
            lvr(13, 5,26);
            lvr(13,13,27);
            lvr(5 ,13,28);
            
            for(n=25;n<28;n++)
            {
               if(sw[n]==1)
               {
                  flip(n+1);
                  flip(n-4);
                  flip(n);
               }
            }
            if(sw[28]==1)
            {
               flip(25);
               flip(24);
               flip(28);
            }
            if(sw[29]==1)
            {
               int a,b,c,d;
               a=sw[25];
               b=sw[26];
               c=sw[27];
               d=sw[28];
               sw[25]=d;
               sw[26]=a;
               sw[27]=b;
               sw[28]=c;
               flip(29);
            }
            mlvr( 5, 5,25);
            mlvr(13, 5,26);
            mlvr(13,13,27);
            mlvr(5 ,13,28);

            break;
         default:
            endwin();
            printf("ERROR THE PROGGRAMMER HAS YET TO MAKE THIS LEVEL!!!\n");
            loop=0;
            return 1;
      }
      mesages();
      levers();
      BlockMessage();
      uncover(1);
      showmap();
      input();
   }

   endwin();
   return 0;
}
Ejemplo n.º 28
0
/*
 * Either execute a command by calling the shell or start a new shell
 */
    int
mch_call_shell(
    char_u *cmd,
    int options)	    /* SHELL_, see vim.h */
{
    int		x;
    int		tmode = cur_tmode;

    out_flush();


#ifdef MCH_WRITE_DUMP
    if (fdDump)
    {
	fprintf(fdDump, "mch_call_shell(\"%s\", %d)\n", cmd, options);
	fflush(fdDump);
    }
#endif

    /*
     * Catch all deadly signals while running the external command, because a
     * CTRL-C, Ctrl-Break or illegal instruction  might otherwise kill us.
     */
    signal(SIGINT, SIG_IGN);
    signal(SIGILL, SIG_IGN);
    signal(SIGFPE, SIG_IGN);
    signal(SIGSEGV, SIG_IGN);
    signal(SIGTERM, SIG_IGN);
    signal(SIGABRT, SIG_IGN);

    if (options & SHELL_COOKED)
	settmode(TMODE_COOK);	/* set to normal mode */

    if (cmd == NULL)
    {
	x = mch_system(p_sh, options);
    }
    else
    {
	/* we use "command" or "cmd" to start the shell; slow but easy */
	char_u *newcmd;

	newcmd = lalloc(
		STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10, TRUE);
	if (newcmd != NULL)
	{
	    if (STRNICMP(cmd, "start ", 6) == 0)
	    {
		sprintf((char *)newcmd, "%s\0", cmd+6);
		if (WinExec((LPCSTR)newcmd, SW_SHOWNORMAL) > 31)
		    x = 0;
		else
		    x = -1;
	    }
	    else
	    {
		sprintf((char *)newcmd, "%s%s %s %s",
			"",
			p_sh,
			p_shcf,
			cmd);
		x = mch_system((char *)newcmd, options);
	    }
	    vim_free(newcmd);
	}
    }

    if (tmode == TMODE_RAW)
	settmode(TMODE_RAW);	/* set to raw mode */

    if (x && !(options & SHELL_SILENT) && !emsg_silent)
    {
	smsg(_("shell returned %d"), x);
	msg_putchar('\n');
    }
#ifdef FEAT_TITLE
    resettitle();
#endif

    signal(SIGINT, SIG_DFL);
    signal(SIGILL, SIG_DFL);
    signal(SIGFPE, SIG_DFL);
    signal(SIGSEGV, SIG_DFL);
    signal(SIGTERM, SIG_DFL);
    signal(SIGABRT, SIG_DFL);


    return x;
}
Ejemplo n.º 29
0
/* Process an incoming ICMP packet */
void
icmp_input(
struct iface *iface,    /* Incoming interface (ignored) */
struct ip *ip,          /* Pointer to decoded IP header structure */
struct mbuf **bpp,      /* Pointer to ICMP message */
int rxbroadcast,
int32 said
){
	struct icmplink *ipp;
	struct icmp icmp;       /* ICMP header */
	struct ip oip;          /* Offending datagram header */
	uint type;              /* Type of ICMP message */
	uint length;

	icmpInMsgs++;
	if(rxbroadcast){
		/* Broadcast ICMP packets are to be IGNORED !! */
		icmpInErrors++;
		free_p(bpp);
		return;
	}
	length = ip->length - IPLEN - ip->optlen;
	if(cksum(NULL,*bpp,length) != 0){
		/* Bad ICMP checksum; discard */
		icmpInErrors++;
		free_p(bpp);
		return;
	}
	ntohicmp(&icmp,bpp);

	/* Process the message. Some messages are passed up to the protocol
	 * module for handling, others are handled here.
	 */
	type = icmp.type;

	switch(type){
	case ICMP_TIME_EXCEED:  /* Time-to-live Exceeded */
	case ICMP_DEST_UNREACH: /* Destination Unreachable */
	case ICMP_QUENCH:       /* Source Quench */
	case ICMP_IPSP:         /* Bad security packet */
		switch(type){
		case ICMP_TIME_EXCEED:  /* Time-to-live Exceeded */
			icmpInTimeExcds++;
			break;
		case ICMP_DEST_UNREACH: /* Destination Unreachable */
			icmpInDestUnreachs++;
			break;
		case ICMP_QUENCH:       /* Source Quench */
			icmpInSrcQuenchs++;
			break;
		}
		ntohip(&oip,bpp);       /* Extract offending IP header */
		if(Icmp_trace){
			printf("ICMP from %s:",inet_ntoa(ip->source));
			printf(" dest %s %s",inet_ntoa(oip.dest),
			 smsg(Icmptypes,ICMP_TYPES,type));
			switch(type){
			case ICMP_TIME_EXCEED:
				printf(" %s\n",
				 smsg(Exceed,NEXCEED,icmp.code));
				break;
			case ICMP_DEST_UNREACH:
				printf(" %s\n",
				 smsg(Unreach,NUNREACH,icmp.code));
				break;
			case ICMP_IPSP:
				printf(" %s\n",smsg(Said_icmp,NIPSP,icmp.code));
				break;
			default:
				printf(" %u\n",icmp.code);
				break;
			}
		}
		for(ipp = Icmplink;ipp->funct != NULL;ipp++)
			if(ipp->proto == oip.protocol)
				break;
		if(ipp->funct != NULL){
			(*ipp->funct)(ip->source,oip.source,oip.dest,icmp.type,
			 icmp.code,bpp);
		}
		break;
	case ICMP_ECHO:         /* Echo Request */
		/* Change type to ECHO_REPLY, recompute checksum,
		 * and return datagram.
		 */
		icmpInEchos++;
		icmp.type = ICMP_ECHO_REPLY;
		htonicmp(&icmp,bpp);
		icmpOutEchoReps++;
		{
		int32 tmp = ip->source;
		ip->source = ip->dest;
		ip->dest = tmp;
		ip->ttl = (char) ipDefaultTTL;
		htonip(ip,bpp,IP_CS_NEW);
		icmpOutMsgs++;
		net_route(NULL,bpp);
		}
		return;
	case ICMP_REDIRECT:     /* Redirect */
		icmpInRedirects++;
		ntohip(&oip,bpp);       /* Extract offending IP header */
		if(Icmp_trace){
			printf("ICMP from %s:",inet_ntoa(ip->source));
			printf(" dest %s %s",inet_ntoa(oip.dest),
			 smsg(Icmptypes,ICMP_TYPES,type));
			printf(" new gateway %s\n",inet_ntoa(icmp.args.address));
		}
		break;
	case ICMP_PARAM_PROB:   /* Parameter Problem */
		icmpInParmProbs++;
		break;
	case ICMP_ECHO_REPLY:   /* Echo Reply */
		icmpInEchoReps++;
		echo_proc(ip->source,ip->dest,&icmp,bpp);
		break;
	case ICMP_TIMESTAMP:    /* Timestamp */
		icmpInTimestamps++;
		{
		int32 tmp;
		uint8 buf[12];
		struct timeval tv;
		if(pullup(bpp,buf,sizeof(buf)) != sizeof(buf)){
			free_p(bpp);
			return;
		}
		gettimeofday(&tv,0);
		tmp = (tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000;
		put32(&buf[4],tmp);     /* Receive Timestamp */
		put32(&buf[8],tmp);     /* Transmit Timestamp */
		pushdown(bpp,buf,sizeof(buf));
		icmp.type = ICMP_TIME_REPLY;
		htonicmp(&icmp,bpp);
		icmpOutTimestampReps++;
		tmp = ip->source;
		ip->source = ip->dest;
		ip->dest = tmp;
		ip->ttl = (char) ipDefaultTTL;
		htonip(ip,bpp,IP_CS_NEW);
		icmpOutMsgs++;
		net_route(NULL,bpp);
		return;
		}
	case ICMP_TIME_REPLY:   /* Timestamp Reply */
		icmpInTimestampReps++;
		break;
	case ICMP_INFO_RQST:    /* Information Request */
		break;
	case ICMP_INFO_REPLY:   /* Information Reply */
		break;
	}
	free_p(bpp);
}
Ejemplo n.º 30
0
void ChatManager::onReceive( const std::string& channel, const std::string& sender, const CEGUI::String& msg )
{
    std::string smsg( reinterpret_cast< const char* >( msg.c_str() ) );
    if ( !_serverMode )
        notifyAppWindow( channel + " [" + sender + "] " + smsg );
}