Exemplo n.º 1
0
	virtual Vasp *tx_work(const Argument &arg) 
	{ 
		OpParam p(thisName(),0);													
		
		if(arg.CanbeVasp()) {
			CVasp dst(arg.GetAVasp());
			Vasp *ret = do_copy(p,dst);
			ToOutVasp(1,dst);
			return ret;
		}
		else {
			post("%s - argument is not a valid vasp!",thisName());  // \todo check earlier!
			return NULL;
		}
	}
Exemplo n.º 2
0
	virtual V m_bang() 
	{ 
		if(!ref.Ok()) {
			post("%s - Invalid vasp!",thisName());
			return;
		}

		I fr = ref.ChkFrames(),o = 0;
		for(I i = 0; i < parts && (fr < 0 || fr); ++i) {
			I p = part[i];
			if(fr >= 0) { p = min(p,fr); fr -= p; }

			Vasp ret(ref); 
			ret.Frames(p);
			ret.OffsetD(o);
			ToOutVasp(0,ret);

			o += p;
		}

		if(fr) {
			Vasp ret(ref); 
			ret.Frames(fr);
			ret.OffsetD(o);
			ToOutVasp(1,ret);
		}
	}
Exemplo n.º 3
0
flext_base::FLEXT_CLASSDEF(flext_base)()
    : incnt(0),outcnt(0)
    , insigs(0),outsigs(0)
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
    ,outlets(NULL),inlets(NULL)
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
    ,indesc(NULL),outdesc(NULL)
#endif
{
    FLEXT_LOG1("%s - flext logging is on",thisName());

    methhead = NULL;
    bindhead = NULL;

    if(HasAttributes()) {
        // initialize when attribute processing is enabled
        attrhead = new ItemCont;
        attrdata = new AttrDataCont;
    }
    else {
        attrhead = NULL;
        attrdata = NULL;
    }
}
Exemplo n.º 4
0
	virtual Vasp *tx_work(const Argument &arg) 
	{ 
		OpParam p(thisName(),1);													
		p.tilt.fill  = (I)fill;
		p.tilt.mode  = (I)inter;

		Vasp *ret = do_shift(p);
		return ret;
	}
Exemplo n.º 5
0
//__________________________________________________________________________________
void    CompileListOfUserExpressions (_SimpleList& varRefs,_List& rec, bool doAll)
{
    rec.Clear();
    if (varRefs.lLength == 0) {
        return;
    }

    long i;
    _SimpleList startVars;
    _VariableContainer*  firstVar = (_VariableContainer*)LocateVar(varRefs.lData[0]);

    firstVar->ScanAndAttachVariables();

    {
        _AVLList sA (&startVars);
        if (doAll) {

            firstVar->ScanForVariables (sA,sA);
            firstVar->ScanForGVariables (sA,sA);
        }

        firstVar->ScanForDVariables (sA,sA);
        sA.ReorderList ();
    }

    if (!doAll) {
        for (i=startVars.lLength-1; i>=0; i--) {
            if (firstVar->IsModelVar(i)) {
                startVars.Delete(i);
            }
        }
    }

    for (i=0; i<startVars.lLength; i++) {
        _String thisName (LocateVar(startVars.lData[i])->GetName()->Cut
                          (LocateVar(startVars.lData[i])->GetName()->FindBackwards('.',0,-1),-1));
        rec && &thisName;
    }

    for (i=varRefs.lLength-1; i>=1; i--) {
        firstVar = (_VariableContainer*)LocateVar(varRefs.lData[i]);
        firstVar->ScanAndAttachVariables();
        firstVar->MatchParametersToList (rec,doAll);
    }

    for (i=rec.lLength-1; i>=0; i--) {
        _String* thisLine = ((_String*)rec(i));
        thisLine->Trim(1,-1);
        if (doAll)
            if (LocateVarByName(*thisLine)<0) {
                *thisLine = _String('!')&*thisLine;
            }
    }

}
Exemplo n.º 6
0
    std::string Convert(const char *txt,const char *var,int &argc,const t_atom *&argv)
    {
        FLEXT_ASSERT(txt);

        std::string ret;
        for(;;) {
            if(var)
                ret.append(txt,var-txt);
            else {
                ret.append(txt);
                break;
            }

            char typetag = var[1];
            // part of a symbol
            switch(typetag) {
                case osc::INT32_TYPE_TAG: {
                    char tmp[10];
                    int z = (argc--)?GetAInt(*argv++):0;
					sprintf(tmp,"%i",z);
                    ret += tmp;
                    break;
                }
                case osc::CHAR_TYPE_TAG: {
                    Symbol s = (argc--)?GetASymbol(*argv++):NULL;
                    ret += (s?*GetString(s):'\0');
                    break;
                }
                case osc::SYMBOL_TYPE_TAG:
                case osc::STRING_TYPE_TAG: {
                    Symbol s = (argc--)?GetASymbol(*argv++):NULL;
                    ret += (s?GetString(s):"");
                    break;
                }
                case '%':
                    ret += '%';
                    break;
                default:
                    post("%s %s - Type tag %s not handled in string",thisName(),GetString(thisTag()),typetag);
            }

            if(!typetag) break;

            // find next one
            txt = var+2;
            var = strchr(txt,'%');
        }

        return ret;
    }
Exemplo n.º 7
0
	virtual V m_bang() 
	{ 
		if(!ref.Ok() || !ref.Check()) {
/*
			if(!frms) 
				post("%s - No length defined!",thisName());
			else 
*/
			{
				ImmBuf ibuf(frms,zero);
				Vasp ret(frms,Vasp::Ref(ibuf));
                ToOutVasp(0,ret);
			}
		}
		else if(ref.Vectors() > 1) 
			post("%s - More than one vector in vasp!",thisName());
		else {
			VBuffer *buf = ref.Buffer(0);
			const I len = buf->Length(),chns = buf->Channels();

			// size of memory reservation (at least frms samples)
			const I rlen = frms > len?frms:len; 
			
			ImmBuf imm(rlen,false);

			BS *dst = imm.Pointer();
			const BS *src = buf->Pointer();

//			post("!copy: src: %p,%i,%i -> dst: %p,%i",src,len,chns,dst,rlen);

			register int i;
			_DE_LOOP(i,len, ( dst[i] = *src,src += chns ) )
			if(zero && rlen > len) ZeroSamples(dst+len,rlen-len);

			Vasp::Ref vr(imm);

//			post("!vr: %s,%i",vr.Ok()?vr.Symbol().Name():"***",vr.Offset());

			Vasp ret(len,vr);
			ToOutVasp(0,ret);

            delete buf;
		}
	}
Exemplo n.º 8
0
    virtual bool CbMethodResort(int inlet,const t_symbol *sym,int argc,const t_atom *argv)
    {
		const char *dst = GetString(sym);
		if(*dst != '/')
			return false;
		
		FLEXT_ASSERT(packet);

        {
            // treat destination string
            const char *var = strchr(dst,'%');
            *packet << osc::BeginMessage(var?Convert(dst,var,argc,argv).c_str():dst);
        }

        while(argc) {
            if(IsSymbol(*argv)) {
                const char *hdr = GetString(*argv++); --argc;

                const char *var = strchr(hdr,'%');
                if(var) {
                    // variable found in string
                    char typetag = var[1];
                    if(!typetag) 
                        // % is only character
                        *packet << "%";
                    else if(hdr != var || var[2])
                        // variable not in front, or string more than 2 chars long -> substitute variables
                        *packet << Convert(hdr,var,argc,argv).c_str();
                    else {
                        // standalone
                        switch(typetag) {
                            case osc::TRUE_TYPE_TAG: *packet << true; break;
                            case osc::FALSE_TYPE_TAG: *packet << false; break;
                            case osc::NIL_TYPE_TAG: *packet << osc::Nil; break;
                            case osc::INFINITUM_TYPE_TAG: *packet << osc::Infinitum; break;
                            case osc::INT32_TYPE_TAG: {
                                osc::int32 z = (argc--)?GetAInt(*argv++):0;
                                *packet << z;
                                break;
                            }
                            case osc::FLOAT_TYPE_TAG: {
                                float z = (argc--)?GetAFloat(*argv++):0;
                                *packet << z;
                                break;
                            }
                            case osc::CHAR_TYPE_TAG: {
                                Symbol s = (argc--)?GetASymbol(*argv++):NULL;
                                *packet << (s?*GetString(s):'\0');
                                break;
                            }
                            case osc::RGBA_COLOR_TYPE_TAG: {
                                osc::uint32 r = (argc--)?(GetAInt(*argv++)&0xff):0;
                                osc::uint32 g = (argc--)?(GetAInt(*argv++)&0xff):0;
                                osc::uint32 b = (argc--)?(GetAInt(*argv++)&0xff):0;
                                osc::uint32 a = (argc--)?(GetAInt(*argv++)&0xff):0;
                                *packet << osc::RgbaColor((r<<24)+(g<<16)+(b<<8)+a);
                                break;
                            }
                            case osc::MIDI_MESSAGE_TYPE_TAG: {
                                osc::uint32 channel = (argc--)?(GetAInt(*argv++)&0xff):0;
                                osc::uint32 status = (argc--)?(GetAInt(*argv++)&0xff):0;
                                osc::uint32 data1 = (argc--)?(GetAInt(*argv++)&0xff):0;
                                osc::uint32 data2 = (argc--)?(GetAInt(*argv++)&0xff):0;
                                *packet << osc::MidiMessage((channel<<24)+(status<<16)+(data1<<8)+data2);
                                break;
                            }
                            case osc::INT64_TYPE_TAG: {
                                osc::int64 z = 0;
                                if(argc--) z += GetAInt(*argv++);
                                if(argc--) z += GetAInt(*argv++);
                                *packet << z;
                                break;
                            }
                            case osc::TIME_TAG_TYPE_TAG: {
                                double z = 0;
                                if(argc--) z += GetAFloat(*argv++);
                                if(argc--) z += GetAFloat(*argv++);
                                *packet << osc::TimeTag(GetTimetag(z));
                                break;
                            }
                            case osc::DOUBLE_TYPE_TAG: {
                                double z = 0;
                                if(argc--) z += GetAFloat(*argv++);
                                if(argc--) z += GetAFloat(*argv++);
                                *packet << z;
                                break;
                            }
                            case osc::STRING_TYPE_TAG: {
                                Symbol s = (argc--)?GetASymbol(*argv++):NULL;
                                *packet << (s?GetString(s):"");
                                break;
                            }
                            case osc::SYMBOL_TYPE_TAG: {
                                Symbol s = (argc--)?GetASymbol(*argv++):NULL;
                                *packet << osc::Symbol(s?GetString(s):"");
                                break;
                            }
                            case osc::BLOB_TYPE_TAG:
                                post("%s %s - Blob type not supported",thisName(),GetString(thisTag()));
                                break;
                            default:
                                post("%s %s - Unknown type tag %s",thisName(),GetString(thisTag()),typetag);
                        }
                    }
                }
                else
                    *packet << osc::Symbol(hdr);
            }
            else if(CanbeFloat(*argv))
                *packet << GetAFloat(*argv++),--argc;
            else {
                post("%s %s - Invalid atom type",thisName(),GetString(thisTag()));
                ++argv,--argc;
            }
        }
        *packet << osc::EndMessage;

        if(!bundle && autosend) Send(true);

        return true;
    }
Exemplo n.º 9
0
	virtual V m_help() { post("%s - Copies the triggering vasp to the argument vasp",thisName()); }
Exemplo n.º 10
0
 void CbReport(int code,const char *txt)
 {
     post("%s: %i - %s",thisName(),code,txt);
 }
Exemplo n.º 11
0
	virtual V m_help() { post("%s - Get non-zero values only for peaks",thisName()); }
Exemplo n.º 12
0
bool CmdVariable::onServer(DebuggerProxy &proxy) {
  if (m_type == KindOfVariableAsync) {
    //we only do variable inspection on continuation wait handles
    auto frame = getWaitHandleAtAsyncStackPosition(m_frame);

    if (frame != nullptr) {
      auto fp = frame->actRec();
      if (fp != nullptr) {
        m_variables = getDefinedVariables(fp);
      }
    }
  } else if (m_frame < 0) {
    m_variables = g_context->m_globalVarEnv->getDefinedVariables();
    m_global = true;
  } else {
    m_variables = g_context->getLocalDefinedVariables(m_frame);
    m_global = g_context->hasVarEnv(m_frame) == g_context->m_globalVarEnv;
    auto oThis = g_context->getThis();
    if (nullptr != oThis) {
      TypedValue tvThis;

      tvThis.m_type = KindOfObject;
      tvThis.m_data.pobj = oThis;

      Variant thisName(s_this);
      m_variables.add(thisName, tvAsVariant(&tvThis));
    }
  }

  if (m_global) {
    m_variables.remove(s_GLOBALS);
  }

  // Deprecated IDE uses this, so keep it around for now.  It expects all
  // variable values to be fully serialized across the wire.
  if (m_version == 0) {
    return proxy.sendToClient(this);
  }

  // Version 1 of this command means we want the names of all variables, but we
  // don't care about their values just yet.
  if (m_version == 1) {
    ArrayInit ret(m_variables->size(), ArrayInit::Map{});
    Variant v;
    for (ArrayIter iter(m_variables); iter; ++iter) {
      assert(iter.first().isString());
      ret.add(iter.first().toString(), v);
    }
    m_variables = ret.toArray();
    m_version = 2;
    return proxy.sendToClient(this);
  }

  // Version 2 of this command means we're trying to get the value of a single
  // variable.
  always_assert(m_version == 2);
  always_assert(!m_varName.empty());

  // Variable name might not exist.
  if (!m_variables.exists(m_varName, true /* isKey */)) {
    m_variables = Array::Create();
    return proxy.sendToClient(this);
  }

  auto const value = m_variables[m_varName];
  auto const result = m_formatMaxLen < 0
    ? DebuggerClient::FormatVariable(value)
    : DebuggerClient::FormatVariableWithLimit(value, m_formatMaxLen);
  m_variables = Array::Create(m_varName, result);

  // Remove the entry if its name or context does not match the filter.
  if (!m_filter.empty() && m_varName.find(m_filter, 0, false) < 0) {
    auto const fullvalue = DebuggerClient::FormatVariable(value);
    if (fullvalue.find(m_filter, 0, false) < 0) {
      m_variables = Array::Create();
    }
  }

  return proxy.sendToClient(this);
}
Exemplo n.º 13
0
	virtual V m_help() { post("%s - split into radio and non-radio messages",thisName()); }
Exemplo n.º 14
0
	virtual V m_help() { post("%s - Set channel index of vectors in vasp",thisName()); }
Exemplo n.º 15
0
	virtual V m_help() { post("%s - Set a vasp's frame count",thisName()); }
Exemplo n.º 16
0
	virtual V m_help() { post("%s - Resamples buffer data",thisName()); }
Exemplo n.º 17
0
	virtual V m_help() { post("%s - Return consecutive vasps with lengths given by argument list",thisName()); }
Exemplo n.º 18
0
 void _help()
 {
   post("%s - this is some useless help information.", thisName());
 }
Exemplo n.º 19
0
void Soup::interpretatePDBLines(vector<string> lines, string filename)
{

  /*** determining number of objects already in soup ***/
  int oldProteinChains = proteinChains.size();
  int oldMolecules = molecules.size();
  int oldWaters = waters.size();

  vector<string> tempLines;
  vector<vector<string> > chains;

  /*** devide lines into chains ***/
  string currentType = "-";
  for(unsigned int i=0;i<lines.size();i++)
    {
      string identifier(lines[i],0,6);
      if(identifier ==currentType) //adding to current chain
	tempLines.push_back(lines[i]);
      else if(tempLines.size() != 0)
	{
	  chains.push_back(tempLines);
	  tempLines.clear();
	  currentType ="-";
	}
      if(identifier == "ATOM  " && currentType == "-")//starting atom chain
	{
	  tempLines.push_back(lines[i]);
	  currentType ="ATOM  ";
	}

      if(identifier == "HETATM" && currentType == "-") //starting hetatm chain
	{
	  tempLines.push_back(lines[i]);
	  currentType = "HETATM";
	}


    }

  /*** doing the last chain ***/
  if(tempLines.size() != 0) 
    {
      chains.push_back(tempLines);
      tempLines.clear();
    }

  /*** test chain division ***/
  /*printf("Found following chains:\n");
  for(unsigned int i=0;i<chains.size();i++)
      printf("  Chain %d: has %d elements \n", i, chains[i].size());
  */
  /*** make soup objects from chains ***/
  for(unsigned int i=0; i<chains.size(); i++)
    {
      vector<string> chain =chains[i];
      string identifier(chain[0],0,6);

      /*** ATOM  - Protein chain ***/
      if(identifier == "ATOM  ")
	{
	  //check that all ids are ATOM
	  bool allAtom = true;
	  for(unsigned int j=0; j<chain.size(); j++)
	    {
	      string identifier2(chain[j],0,6);
	      if(identifier2 != "ATOM  ")
		allAtom = false;  
	    }

	  if(allAtom)
	    {
	      //printf("All lines in chain %d have ATOM identifiers \n",i);
	      //printf(" - will be treated as protein chain\n");
	      ProteinChain X(chain);
	      proteinChains.push_back(X);
	    }
	  else
	    {
	      printf("Warning: Not all lines in chain %d have ATOM ids\n",i);
	      ProteinChain X(chain);
	      proteinChains.push_back(X);

	    }


	}
      /*** HETATM  - water, ions, other molecules ***/
      else 
	{
	  //printf("Chain %d contains HETATMs \n",i);
	  
	  string currentMolecule = "dummy";
	  vector<string> moleculeLines;
	  bool isWater = true;

	  for(unsigned int j=0; j<chain.size(); j++)
	    {
	      if(currentMolecule != string(chain[j],22,4))
		{
		  if(currentMolecule == "dummy")
		    currentMolecule = string(chain[j],22,4);
		  else
		    {
		      /*** create water molecule ***/
		      if(isWater)
			{
			  Water X(moleculeLines);
			  waters.push_back(X);
			  moleculeLines.clear();
			  currentMolecule = string(chain[j],22,4);
			}
		      /*** Create ion/other molecule ***/
		      else
			{
			  //printf("Found other molecule: %s \n",string(moleculeLines[0],17,3).c_str());
			  Molecule X(moleculeLines);
			  molecules.push_back(X);
			  moleculeLines.clear();
			  currentMolecule = string(chain[j],22,4);
			  isWater = true;
			}
		    }
		}
	      moleculeLines.push_back(chain[j]);
	      string thisName(chain[j],17,3);
	      if(thisName != "HOH")
		isWater = false;  
	      

	    } //loop over chain 


	  /*** last molecule ***/

	  if(moleculeLines.size() != 0)
	    {
	      if(isWater)
		{
		  Water X(moleculeLines);
		  waters.push_back(X);
		  moleculeLines.clear();
		}
	      else
		{
		  printf("Found other molecule: %s \n",string(chain[chain.size()-1],17,3).c_str());
		  Molecule X(moleculeLines);
		  molecules.push_back(X);
		  moleculeLines.clear();
		}
	    }	


	} // if HETATM      
    } // loop over chains  


  /*** soupObject ids ***/


  for(unsigned int i=oldProteinChains;i<proteinChains.size();i++)
    {
      char no[6];
      sprintf(no, "%d", i);
      proteinChains.at(i).id=filename + string(": Protein chain no ")+string(no);
    }
  for(unsigned int i=oldMolecules;i<molecules.size();i++)
    {
      char no[6];
      sprintf(no, "%d", i);
      molecules.at(i).id=filename + string(": Molecule no ")+string(no);
    }
  for(unsigned int i=oldWaters;i<waters.size();i++)
    {
      char no[6];
      sprintf(no, "%d", i);
      waters.at(i).id=filename + string(": Water no ")+string(no);
    }


}
Exemplo n.º 20
0
	virtual V m_help() { post("%s - Get immediate vasp vectors",thisName()); }
Exemplo n.º 21
0
	virtual V m_help() { post("%s - Set a vasp's offset(s) into the vector buffers",thisName()); }
Exemplo n.º 22
0
	virtual V m_help() { post("%s - Synchronize a number of vasps (default 2)",thisName()); }
Exemplo n.º 23
0
	virtual V m_help() { post("%s - Store and output a vasp",thisName()); }
Exemplo n.º 24
0
ArgumentList::ArgumentList(CellMatrix cells, 
						   std::string ErrorId)
{
	CellValue empty;
	unsigned long rows = cells.RowsInStructure();
	unsigned long columns = cells.ColumnsInStructure();

	if (rows == 0)
		throw(std::string("Argument List requires non empty cell matix ")+ErrorId);

	if (!cells(0,0).IsAString())
		throw(std::string("a structure name must be specified for argument list class ")+ErrorId);
	else
	{
		StructureName = cells(0,0).StringValueLowerCase();
		cells(0,0) = empty;
	}


	{for (unsigned long i=1; i < columns; i++)
		if (!cells(0,i).IsEmpty() )
			throw("An argument list should only have the structure name on the first line: "+StructureName+ " " + ErrorId);
	}

	ErrorId +=" "+StructureName;

	{for (unsigned long i=1; i < rows; i++)
		for (unsigned long j=0; j < columns; j++)
			if (cells(i,j).IsError())
				GenerateThrow("Error Cell passed in ",i,j);}

	unsigned long row=1UL;

	while (row < rows)
	{
		unsigned long rowsDown=1;
		unsigned column = 0;

		while (column < columns)
		{
			if (cells(row,column).IsEmpty())
			{
				// check nothing else in row
				while (column< columns)
				{
					if (!cells(row,column).IsEmpty())
						GenerateThrow("data or value where unexpected.",row, column);

					++column;
				}
			}
			else // we have data
			{
				if (!cells(row,column).IsAString())
					GenerateThrow("data  where name expected.", row, column);

				std::string thisName(cells(row,column).StringValueLowerCase());

				if (thisName =="")
					GenerateThrow("empty name not permissible.", row, column);

				if (rows == row+1)
					GenerateThrow("No space where data expected below name", row, column);

				cells(row,column).clear();
// weird syntax to satisfy VC6
				CellValue* belowPtr = &cells(row+1,column);
				CellValue& cellBelow = *belowPtr;

				if (cellBelow.IsEmpty())
					GenerateThrow("Data expected below name", row, column);

				if (cellBelow.IsANumber())
				{
					add(thisName, cellBelow.NumericValue());

					column++;

					cellBelow=empty;
				}
				else
					if (cellBelow.IsBoolean())
					{
						add(thisName, cellBelow.BooleanValue());

						column++;

						cellBelow=empty; 
					}
					else // ok its a string
					{
						std::string stringVal = cellBelow.StringValueLowerCase();

						if ( (cellBelow.StringValueLowerCase() == "list") || 
							(cellBelow.StringValueLowerCase() == "matrix") ||
							(cellBelow.StringValueLowerCase() == "cells") )
						{
							bool nonNumeric = false;
							CellMatrix extracted(ExtractCells(cells,row+2,column,ErrorId,thisName,nonNumeric));


							if (cellBelow.StringValueLowerCase() == "list")
							{
								ArgumentList value(extracted,ErrorId+":"+thisName);

								addList(thisName, extracted); //note not value

							}

							if (cellBelow.StringValueLowerCase() == "cells")
							{
								add(thisName,extracted);
							}

							
							if (cellBelow.StringValueLowerCase() == "matrix")
							{
								if (nonNumeric)
									throw("Non numerical value in matrix argument :"+thisName+ " "+ErrorId);

								MJMatrix value(extracted.RowsInStructure(),extracted.ColumnsInStructure());

								for (unsigned long i=0; i < extracted.RowsInStructure(); i++)
									for (unsigned long j=0; j < extracted.ColumnsInStructure(); j++)
										ChangingElement(value,i,j) = extracted(i,j);

								add(thisName,value);

							}

							cellBelow = empty;
							rowsDown = maxi(rowsDown,extracted.RowsInStructure()+2);
							column+= extracted.ColumnsInStructure();
						}
						else // ok its an array or boring string
						{
							if (cellBelow.StringValueLowerCase() == "array" 
								||cellBelow.StringValueLowerCase() == "vector" )
							{
								cellBelow.clear();
							
								if (row+2>= rows)
									throw(ErrorId+" data expected below array "+thisName);

								unsigned long size = cells(row+2,column);
								cells(row+2,column).clear();

								if (row+2+size>=rows)
									throw(ErrorId+" more data expected below array "+thisName);


								MyArray theArray(size);

								for (unsigned long i=0; i < size; i++)
								{
									theArray[i] = cells(row+3+i,column);
									cells(row+3+i,column).clear();
								}

								add(thisName,theArray);

								rowsDown = maxi(rowsDown,size+2);
			
								column+=1;
							}
							else
							{
								std::string value = cellBelow.StringValueLowerCase();
								add(thisName,value);
								column++;

								cellBelow=empty; 
							}
						}

					}
			}		

		}	
		row+=rowsDown+1;

	}

    {for (unsigned long i=0; i < rows; i++)
        for (unsigned long j=0; j < columns; j++)
            if (!cells(i,j).IsEmpty())
            {
               GenerateThrow("extraneous data "+ErrorId,i,j);
	}}
}
Exemplo n.º 25
0
bool flext_base::InitInlets()
{
    bool ok = true;

    // incnt has number of inlets (any type)
    // insigs should be 0

    FLEXT_ASSERT(!insigs && !inlets);

    // ----------------------------------
    // create inlets
    // ----------------------------------

#if FLEXT_SYS == FLEXT_SYS_MAX      
    // copy inlet descriptions
    indesc = new char *[incnt];
    for(int i = 0; i < incnt; ++i) {
        xlet &x = inlist[i];
        indesc[i] = x.desc;
        x.desc = NULL;
    }
#endif

#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
    inlets = incnt > 1?new px_object *[incnt-1]:NULL;
#endif
    
    // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
    {
        int cnt = 0;
        if(incnt >= 1) {
            xlet &xi = inlist[0]; // points to first inlet
            if(xi.tp == xlet_sig) ++insigs;
            // else leftmost inlet is already there...
            ++cnt;

#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
            // set tooltip
// this is on a per-class basis... we cannot really use it here
//            if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc));
#endif
        }       

        for(int ix = 1; ix < incnt; ++ix,++cnt) {
            xlet &xi = inlist[ix]; // points to first inlet
            t_inlet *in = NULL;
            switch(xi.tp) {
                case xlet_float:
                case xlet_int: {
                    if(ix > 9) { 
                        // proxy inlet needed
                        (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix);  // proxy for 2nd inlet messages 
                        in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_float, (t_symbol *)sym_float);  
                    }
                    else { 
                        inlets[ix-1] = NULL;
                        static char sym[] = " ft ?";
                        sym[4] = '0'+ix;  
                        in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym)); 
                    }
                    break;
                }
                case xlet_sym: 
                    (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix);  // proxy for 2nd inlet messages 
                    in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);  
                    break;
                case xlet_list:
                    (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix);  // proxy for 2nd inlet messages 
                    in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);  
                    break;
                case xlet_any:
                    (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix);  // proxy for 2nd inlet messages 
                    in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, 0, 0);  
                    break;
                case xlet_sig:
                    inlets[ix-1] = NULL;
#ifdef FLEXT_COMPATIBLE
                    if(inlist[ix-1].tp != xlet_sig) {
                        post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
                        ok = false;
                    }
                    else 
#endif
                    {
                        // pd is not able to handle signals and messages into the same inlet...
                        in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);  
                        ++insigs;
                    }
                    break;
                default:
                    inlets[ix-1] = NULL;
                    error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)inlist[ix].tp);
                    ok = false;
            } 

#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
            // set tooltip
            if(in && xi.desc && *xi.desc) inlet_settip(in,gensym(xi.desc));
#endif
        }

        incnt = cnt;
    }
#elif FLEXT_SYS == FLEXT_SYS_MAX
    {
        int ix,cnt;
        // count leftmost signal inlets
        while(insigs < incnt && inlist[insigs].tp == xlet_sig) ++insigs;
        
        for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
            xlet &xi = inlist[ix];
            if(!ix) {
                if(xi.tp != xlet_any) {
                    error("%s: Leftmost inlet must be of type signal or anything",thisName());
                    ok = false;
                }
            }
            else {
                FLEXT_ASSERT(inlets);
                switch(xi.tp) {
                    case xlet_sig:
                        inlets[ix-1] = NULL;
                        error("%s: All signal inlets must be left-aligned",thisName());
                        ok = false;
                        break;
                    case xlet_float: {
						if(ix < 10) {
							inlets[ix-1] = NULL;
                            floatin(x_obj,ix);
							break;
						}
						else
							goto makeproxy;
					}
                    case xlet_int: {
						if(ix < 10) {
							inlets[ix-1] = NULL;
                            intin(x_obj,ix);
							break;
						}
						else
							goto makeproxy;
					}
					makeproxy:
                    case xlet_any: // non-leftmost
                    case xlet_sym:
                    case xlet_list:
                        inlets[ix-1] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);  
                        break;
                    default:
                        inlets[ix-1] = NULL;
                        error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)xi.tp);
                        ok = false;
                } 
            }
        }
        
        if(inlets)
            while(ix >= 0) inlets[ix--] = NULL;
	}
#else
#error
#endif

    return ok;  
}