Beispiel #1
0
// module.names
// -o output_path
// -s skip_module.names
int parseTask(std::string& content, Task* task, int left, int right) {
  int space = findSymbol(content, ' ', left, right);
  splitNames(task->moduleNames, content, left, space);

  if (space == right) return ERROR_OK; // no more data

  // parse task options
  int cursor = space + 1;
  int hyphen;
  while (cursor < right) {
    hyphen = findSymbol(content, '-', cursor, right);
    if (hyphen == right) break; // no options

    space = findSymbol(content, ' ',  hyphen + 3, right);
    switch (content[hyphen + 1]) {
      case 'o':
        task->output = content.substr(hyphen + 3, space - (hyphen + 3));
        break;
      case 's':
        splitNames(task->skipModuleNames, content, hyphen + 3, space);
        break;
      default:
        return PROJECT_UNKNOWN_TASK_OPTION_ERROR;
    }
    
    cursor = space + 1;
  }

  return ERROR_OK;
}
Beispiel #2
0
const Symbol*
Symbol::findSymbolByQualifiedName(Name name, bool restricted) const
{
    size_t p;
    const String& sname = name;

//     const Symbol* s = context()->globalScope()->findSymbol(name);

//     if (s && s->scope() == context()->globalScope())
//     {
//         return s;
//     }

    if ((p = findSeparator(sname)) != String::npos)
    {
        Mu::String first = sname.substr(0, p);
        Mu::String rest  = sname.substr(p + 1);

	if (Name name0 = context()->lookupName(first.c_str()))
	{
	    if (const Symbol* sym = findSymbol(name0))
	    {
		if (rest != "")
		{
                    Name n = context()->internName(rest.c_str());

		    for (const Symbol *s = sym->firstOverload();
			 s;
			 s = s->nextOverload())
		    {
			if (!restricted || s->_searchable)
			{
                            if (const Symbol* child =
                                s->findSymbolByQualifiedName(n, restricted))
                            {
                                return child;
                            }
			}
		    }
		}
		else
		{
		    return sym;
		}
	    }
	}
    }
    else
    {
	return findSymbol(name);
    }

    return 0;
}
Beispiel #3
0
NODE genLeaf(int op, int val, double rval, char *id)
{
	NODE t;
	struct Symbol* s;

	if (id != NULL&&!findSymbol(id))
	{
		FILE *txt;
		txt = fopen("outputParser.txt", "a");
		fprintf(txt, "\nError at line %d: Undeclared identifier: %s", line_number, id);
		fclose(txt);
		PrintSymbolTable();
		exit(1);
	}

	t = (NODE)malloc(sizeof(struct node));
	t->num_val.val = val;

	t->op = op;

	if (id != NULL)
		t->name = id;
	else
		t->name = "";

	t->s1 = NULL;
	t->s2 = NULL;
	t->s3 = NULL;
	t->children = 0;

	switch (op)
	{
	case IDE:
		t->type = findSymbol(id)->type;
		break;

	case INTCONST:
		t->type = INTEGER;
		t->num_val.val = val;
		break;

	case REALCONST:
		t->type = FLOAT;
		t->num_val.rval = rval;
		break;

	case TRUE:
	case FALSE:
		t->type = BOOLEAN;
		break;
	}
	return(t);
}
Beispiel #4
0
str
QOTshowFlowGraph(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
    str fname;
    str modnme;
    str fcnnme;
    Symbol s = NULL;

    (void) cntxt;
    if (stk != 0) {
        modnme = *getArgReference_str(stk, p, 1);
        fcnnme = *getArgReference_str(stk, p, 2);
        fname = *getArgReference_str(stk, p, 3);
    } else {
        modnme = getArgDefault(mb, p, 1);
        fcnnme = getArgDefault(mb, p, 2);
        fname = getArgDefault(mb, p, 3);
    }


    s = findSymbol(cntxt->nspace,putName(modnme, strlen(modnme)), putName(fcnnme, strlen(fcnnme)));

    if (s == NULL) {
        char buf[1024];
        snprintf(buf,1024, "%s.%s", modnme, fcnnme);
        throw(MAL, "optimizer.showFlowGraph", RUNTIME_OBJECT_UNDEFINED ":%s", buf);
    }
    showFlowGraph(s->def, stk, fname);
    return MAL_SUCCEED;
}
Beispiel #5
0
str
QOTshowPlan(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
    str modnme;
    str fcnnme;
    Symbol s = NULL;

    if (stk != 0) {
        modnme = *getArgReference_str(stk, p, 1);
        fcnnme = *getArgReference_str(stk, p, 2);
    } else {
        modnme = getArgDefault(mb, p, 1);
        fcnnme = getArgDefault(mb, p, 2);
    }

    mnstr_printf(cntxt->fdout,"#showPlan()\n");
    removeInstruction(mb, p);
    if( modnme ) {
        s = findSymbol(cntxt->nspace, putName(modnme, strlen(modnme)), putName(fcnnme, strlen(fcnnme)));

        if (s == NULL) {
            char buf[1024];
            snprintf(buf,1024, "%s.%s", modnme, fcnnme);
            throw(MAL, "optimizer.showPlan", RUNTIME_OBJECT_UNDEFINED ":%s", buf);
        }
        mb= s->def;
    }
    printFunction(cntxt->fdout, mb, 0, LIST_INPUT);
    return MAL_SUCCEED;
}
Beispiel #6
0
/*
 * Display routines
 */
str
MDBlifespan(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
	Lifespan span;
	str modnme;
	str fcnnme;
	Symbol s = NULL;

	(void) cntxt;
	if (stk != 0) {
		modnme = *getArgReference_str(stk, p, 1);
		fcnnme = *getArgReference_str(stk, p, 2);
	} else {
		modnme = getArgDefault(mb, p, 1);
		fcnnme = getArgDefault(mb, p, 2);
	}

	s = findSymbol(cntxt->nspace, putName(modnme), putName(fcnnme));

	if (s == NULL)
		throw(MAL, "mdb.inspect", RUNTIME_SIGNATURE_MISSING);
	span = setLifespan(s->def);
	if( span == NULL)
		throw(MAL,"mdb.inspect", MAL_MALLOC_FAIL);
	debugLifespan(cntxt, s->def, span);
	GDKfree(span);
	(void) p;
	(void) stk;
	return MAL_SUCCEED;
}
Beispiel #7
0
int parseProject(Project& project) {
  /* project.filename = getCurrentDir() + "/project.mutant"; */
  /* if (not existsPath(project.filename)) return ERROR_FAIL; */

  /* project.content = getFileContent(project.filename); */

  // find \n or right
  int left = 0;
  int right = project.content.length();
  int cursor;
  int error;

  while (left < right) {
    cursor = findSymbol(project.content, '\n', left, right);

    if (cursor - left > 0) { // skip empty line
      if (project.content[left] == '-') {
        error = parseProjectOption(project, left, cursor);
        if (error < 0) return error;
      } else {
        std::unique_ptr<Task> task(new Task());
        error = parseTask(project.content, task.get(), left, cursor);
        if (error >= 0) project.tasks.push_back(task.release());
        if (error < 0) return error;
      }
    }

    left = cursor + 1;
  }

  return ERROR_OK;
}
Beispiel #8
0
str OPTorcam(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
	Symbol t;
	str msg,mod,fcn;
	lng clk= GDKusec();
	int actions = 0;

	if( p ==NULL )
		return 0;
	removeInstruction(mb, p);
	if( p->argc == 3){
		mod= getArgDefault(mb,p,1);
		fcn= getArgDefault(mb,p,2);
	} else {
		mod= getArgDefault(mb,p,3);
		fcn= getArgDefault(mb,p,4);
	}
	t= findSymbol(cntxt->nspace, putName(mod, strlen(mod)), fcn);
	if( t == 0)
		return 0;

	msg = MACROvalidate(t->def);
	if( msg) 
		return msg;
	if( mb->errors == 0)
		actions= OPTorcamImplementation(cntxt,mb,stk,p);
    return optimizerCheck(cntxt,mb, "optimizer.orcam", actions, GDKusec() - clk, OPT_CHECK_ALL);
}
Beispiel #9
0
//==================================================================
void Parser::processSpecialLabel( const Label &label )
{
	const char *pLabelName	= label.mName.c_str();

	// is a default param value label ?
	if ( strstr( pLabelName, gpDefParamBaseLabelName ) == pLabelName )
	{
		u_int		labelAddr	= label.mAddress;

		const char *pVarName = pLabelName + strlen( gpDefParamBaseLabelName );

		size_t	idx = findSymbol( pVarName, false );
		if ( idx == DNPOS )
			return;

		// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
		// mDefaultValStartPC should be in a separate list in the shader.. without
		// being either in the symbol or symbol instance structure

		mpShader->mpShaSymsStartPCs[ idx ] = labelAddr;
	}
	else
	// is main/entry point label ?
	if ( strstr( pLabelName, gpMainLabelName ) == pLabelName )
	{
		u_int		labelAddr	= label.mAddress;

		mpShader->mStartPC = labelAddr;
	}
}
Beispiel #10
0
str
RUNsqlbind(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
	int i;
	str msg = MAL_SUCCEED;
	Symbol sqlbind = findSymbol(cntxt ->nspace, getName("sql"), getName("bind"));
	MALfcn f = NULL;

	if (sqlbind )
		f = getSignature(sqlbind)->fcn;

	if ( f )
	for (i = 0; i < mb->stop; i++) {
		p = getInstrPtr(mb, i);
		if (p->fcn == f) {
			if ((msg = reenterMAL(cntxt, mb, i, i + 1, stk)))
				break;
			/* fetch the BAT properties and turn off this instruction */
			p->token = NOOPsymbol;
		}
	}
#ifdef DEBUG_MAL_SCHEDULER
	fprintf(stderr, "scheduler.sqlbind results\n");
	fprintFunction(stderr, mb, stk, LIST_MAL_ALL);
#endif
	return msg;
}
Beispiel #11
0
void factor(){
  int l;
  int m;
  symTableEntry* symbol;
  if(currentToken == identsym){
    //First looking for a constant that matches
    symbol = findSymbol(symTable, CONST, tokenVal.string, scope);
    if(findConst(tokenVal.string, scope, &m)){
      genCode(LIT, 0, m);
    }else if(findVar(tokenVal.string, scope, &l, &m)){
      //If that fails, looking for a variable
        genCode(LOD, l, m);
    }else{
        throwError(UNDEC_ID);
    }
    readToken();
  }else if(currentToken == numbersym){
    genCode(LIT, 0, tokenVal.numeric);
    readToken();
  }else if(currentToken == lparentsym){
    readToken();
    
    expression();
    
    if(currentToken != rparentsym)
      throwError(RPAREN_MISS);
    else
      readToken();
  }
  else
    throwError(PREC_FACTOR_CANNOT_BEGIN_SYM);
  
  return;
}
uint32_t insertSymbol(string_t *name, symtab_t *symbols, bool scoped) {
	uint64_t hash = hashStr(name->val, name->len);
	value_t symName, symTab;
	symbol_t *sym;

	symName.bits = vt_string;
	symName.addr = name;

	symTab.bits = vt_object;
	symTab.oval = &symbols->entries;

	if (!symbols)
		symbols = &globalSymbols;

	if (hoistDebug)
		printf("insertSymbol('%.*s')\n", name->len, name->val);

	if ((sym = findSymbol(symTab, symName, true, hash))) {
		sym->frameIdx = ++symbols->frameIdx;
		sym->depth = symbols->depth;
		sym->scoped = scoped;
		return sym->frameIdx;
	}

	return 0;
}
Beispiel #13
0
void Eliza::preProcessResponse() {
	if(is_template(m_sResponse)) {
		findSymbol(m_sResponse);
		if(m_sKeyWord == m_sInput) {
			m_sSuffix = m_sInput;
		} else if(!m_bMemoryRecall){
			extract_suffix();
		} else {
			m_bMemoryRecall = 0;
		}
		if(m_sSuffix.length() == 0) {
			while(is_template(m_sResponse) && response_list.size() > 1) {
				response_list.erase(response_list.begin());
				m_sResponse = response_list[0];
			}
			if(is_template(m_sResponse)) {
				response_list = topicChanger;
				select_response();
			}
		}
		if(m_sSuffix.length() > 0 && m_sSymbol != "%") {
			transpose_sentence(m_sSuffix);
			correct_sentence(m_sSuffix);
			trimRight(m_sSuffix, ' ');
			m_sSuffix.insert(0, " ");
		}
		replace(m_sResponse, m_sSymbol, m_sSuffix);
	}
	if(m_sUserName != "USER") {
		replace(m_sResponse, "USER", m_sUserName);
	}
}
Beispiel #14
0
bool ELFPlugin::loadPlugin() {
	assert(!_dlHandle);

	DLObject *obj = makeDLObject();
	if (obj->open(_filename.c_str())) {
		_dlHandle = obj;
	} else {
		delete obj;
		_dlHandle = 0;
	}

	if (!_dlHandle) {
		warning("elfloader: Failed loading plugin '%s'", _filename.c_str());
		return false;
	}

	CharFunc buildDateFunc = (CharFunc)findSymbol("PLUGIN_getBuildDate");
	if (!buildDateFunc) {
		unloadPlugin();
		warning("elfloader: plugin '%s' is missing symbols", _filename.c_str());
		return false;
	}

	if (strncmp(gScummVMPluginBuildDate, buildDateFunc(), strlen(gScummVMPluginBuildDate))) {
		unloadPlugin();
		warning("elfloader: plugin '%s' has a different build date", _filename.c_str());
		return false;
	}

	bool ret = DynamicPlugin::loadPlugin();

#ifdef ELF_LOADER_CXA_ATEXIT
	if (ret) {
		// FIXME HACK: Reverse HACK of findSymbol() :P
		VoidFunc tmp;
		tmp = findSymbol("__dso_handle");
		memcpy(&_dso_handle, &tmp, sizeof(VoidFunc));
		debug(2, "elfloader: __dso_handle is %p", _dso_handle);
	}
#endif

	_dlHandle->discardSymtab();

	return ret;
}
Beispiel #15
0
linkedList_t* search(char* text)
{
	symbol_t symbol;
	symbol.text = (char*) calloc(strlen(text) + 1, sizeof(char));
	strcpy(symbol.text, text);
	symbol.type = SYMBOL_IDENTIFIER;

	return findSymbol(symbol);
}
/**
 * Find the export from a library handle.
 *
 * Note that for TLS there will be a symbol, but no section,
 * and for normal data / code there with be a section but no symbol.
 */
int
OSDynLoad_FindExport(ModuleHandle handle,
                     int isData,
                     char const *name,
                     be_val<ppcaddr_t> *outAddr)
{
   auto module = handle->ptr;
   auto addr = module->findExport(name);

   *outAddr = addr;

   if (!addr) {
      gLog->debug("OSDynLoad_FindExport export {} not found", name);
      return 0xBAD10001;
   }

   // Let's first try to verify the export type based off the section it is in
   auto section = module->findAddressSection(addr);

   if (section) {
      if (isData) {
         if (section->type != kernel::loader::LoadedSectionType::Data) {
            gLog->debug("OSDynLoad_FindExport export {} expected data, found function", name);
            return 0xBAD10001;
         }
      } else {
         if (section->type != kernel::loader::LoadedSectionType::Code) {
            gLog->debug("OSDynLoad_FindExport export {} expected function, found data", name);
            return 0xBAD10001;
         }
      }

      return 0;
   }

   // Now let's try to verify it based off it's symbol
   auto symbol = module->findSymbol(addr);

   if (symbol) {
      if (symbol->type == kernel::loader::SymbolType::TLS) {
         return 0xBAD10033;
      } else if (isData && symbol->type != kernel::loader::SymbolType::Data) {
         gLog->debug("OSDynLoad_FindExport export {} expected data, found function", name);
         return 0xBAD10001;
      } else if (!isData && symbol->type != kernel::loader::SymbolType::Function) {
         gLog->debug("OSDynLoad_FindExport export {} expected function, found data", name);
         return 0xBAD10001;
      }

      return 0;
   }

   // Couldn't find a section or a symbol for the export, this should never happen...!
   decaf_abort(fmt::format("OSDynLoad_FindExport could not find symbol or section for export address 0x{:08X}", addr));
   return 0xBAD10001;
}
Beispiel #17
0
void interpret_command(ostream &out, istream &in, bool allow_bench)
{
   FrObject *cmd ;

   in >> cmd ;
   if (cmd && cmd->symbolp())
      {
      FrSymbol *cmdsym = (FrSymbol*)cmd ;
      FramepaC_bgproc() ;		// handle any asynchronous operations
      bool found = false ;
      for (CommandDef *def = commands ; def->name ; def++)
	 {
	 if (*cmdsym == def->name)
	    {
	    if (!allow_bench && strcmp(def->name,"BENCH") == 0)
	       break ;
	    found = true ;
	    def->func(out,in) ;
	    break ;
	    }
	 }
      if (!found)
	 {
	 if (cmdsym == findSymbol("BENCH") && allow_bench)
	    benchmarks_menu(out,in) ;
	 else if (cmdsym == findSymbol("?"))
	    list_commands(out,allow_bench) ;
	 else
	    {
	    out << cmd << " is an unknown command." << endl ;
	    list_commands(out,allow_bench) ;
	    }
	 }
      }
   else
      {
      out << cmd << " is not a valid command, because it is not a symbol."
	  << endl ;
      if (cmd) cmd->freeObject() ;
      FramepaC_bgproc() ;		// handle any asynchronous operations
      }
   return ;
}
Beispiel #18
0
static void pas_LabelStatement(void)
{
   char   labelName [8];                /* Label symbol table name */
   STYPE  *labelPtr;                    /* Pointer to Label Symbol */

   TRACE(lstFile,"[pas_LabelStatement]");

   /* FORM:  <integer> : */

   /* Verify that the integer is a label name */

   (void)sprintf (labelName, "%ld", tknInt);
   if (!(labelPtr = findSymbol(labelName)))
     {
       error(eUNDECLABEL);
     }
   else if(labelPtr->sKind != sLABEL)
     {
       error(eINVLABEL);
     }

   /* And also verify that the label symbol has not been previously
    * defined.
    */

   else if(!(labelPtr->sParm.l.unDefined))
     {
       error(eMULTLABEL);
     }
   else
     {
       /* Generate the label and indicate that it has been defined */

       pas_GenerateDataOperation(opLABEL, labelPtr->sParm.l.label);
       labelPtr->sParm.l.unDefined = false;

       /* We have to assume that we got here via a goto statement.
        * We don't have logic in place to track changes to the level
        * stack pointer (LSP) register, so we have no choice but to
        * invalidate that register now.
        */

       pas_InvalidateCurrentStackLevel();
     }

   /* Skip over the label integer */

   getToken();

   /* Make sure that the label is followed by a colon */

   if (token != ':') error (eCOLON);
   else getToken();
}
Beispiel #19
0
static void identifier(void)
{
  const  RTYPE *rptr;                         /* Pointer to reserved word */

  tknSubType = txNONE;                        /* Initialize */

  /* Concatenate identifier */

  do
    {
      *stringSP++ = toupper(inChar);          /* concatenate char */
      getCharacter();                         /* get next character */
    }
  while ((isalnum(inChar)) || (inChar == '_'));
  *stringSP++ = '\0';                         /* make ASCIIZ string */

  /* Check if the identifier is a reserved word */

  rptr = findReservedWord(tkn_strt);
  if (rptr)
    {
      token      = rptr->rtype;               /* get type from rsw table */
      tknSubType = rptr->subtype;             /* get subtype from rsw table */
      stringSP      = tkn_strt;               /* pop token from stack */
    } /* End if */

  /* Check if the identifier is a symbol */

  else
    {
      tknPtr = findSymbol(tkn_strt);
      if (tknPtr)
        {
          token = tknPtr->sKind;              /* get type from symbol table */
          stringSP = tkn_strt;                /* pop token from stack */

          /* The following assignments only apply to constants.  However it
           * is simpler just to make the assignments than it is to determine
           * if is appropriate to do so
           */

          if (token == tREAL_CONST)
            tknReal = tknPtr->sParm.c.val.f;
          else
            tknInt  = tknPtr->sParm.c.val.i;
        } /* End if */

      /* Otherwise, the token is an identifier */
      else
        token = tIDENT;

    } /* end else */

} /* End identifier */  
symbol_t *lookupSymbol(string_t *name, symtab_t *symbols, symtab_t *block) {
	uint64_t hash = hashStr(name->val, name->len);
	value_t symName, symTab;
	symbol_t *sym;

	symName.bits = vt_string;
	symName.addr = name;

	symTab.bits = vt_object;

	if (hoistDebug)
		printf("lookupSymbol('%.*s')\n", name->len, name->val);

	while (block) {
	  symTab.oval = &block->entries;

	  if ((sym = findSymbol(symTab, symName, false, hash))) {
		if (!sym->fixed) {
		  if (block->parent)
			sym->frameIdx += block->parent->frameIdx + block->parent->baseIdx;
		  else
			sym->frameIdx += symbols->frameIdx;

		  sym->fixed = 1;
		}
		return sym;
	  } else
	  	block = block->parent;
	}

	while (symbols) {
	  symTab.oval = &symbols->entries;

	  if ((sym = findSymbol(symTab, symName, false, hash)))
		return sym;
	  else
	  	symbols = symbols->parent;
	}

	return NULL;
}
Beispiel #21
0
str OPTsql_append(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
	str modnme;
	str fcnnme;
	str msg= MAL_SUCCEED;
	Symbol s= NULL;
	lng t,clk= GDKusec();
	int actions = 0;

	if( p )
		removeInstruction(mb, p);
	OPTDEBUGsql_append mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER sql_append\n");
	if( p && p->argc > 1 ){
		if( getArgType(mb,p,1) != TYPE_str ||
			getArgType(mb,p,2) != TYPE_str ||
			!isVarConstant(mb,getArg(p,1)) ||
			!isVarConstant(mb,getArg(p,2))
		) {
			throw(MAL, "optimizer.sql_append", ILLARG_CONSTANTS);
		}
		if( stk != 0){
			modnme= *getArgReference_str(stk,p,1);
			fcnnme= *getArgReference_str(stk,p,2);
		} else {
			modnme= getArgDefault(mb,p,1);
			fcnnme= getArgDefault(mb,p,2);
		}
		s= findSymbol(cntxt->nspace, putName(modnme,strlen(modnme)),putName(fcnnme,strlen(fcnnme)));

		if( s == NULL) {
			char buf[1024];
			snprintf(buf,1024, "%s.%s",modnme,fcnnme);
			throw(MAL, "optimizer.sql_append", RUNTIME_OBJECT_UNDEFINED ":%s", buf);
		}
		mb = s->def;
		stk= 0;
	}
	if( mb->errors ){
		/* when we have errors, we still want to see them */
		addtoMalBlkHistory(mb,"sql_append");
		return MAL_SUCCEED;
	}
	actions= OPTsql_appendImplementation(cntxt, mb,stk,p);
	msg= optimizerCheck(cntxt, mb, "optimizer.sql_append", actions, t=(GDKusec() - clk));
	OPTDEBUGsql_append {
		mnstr_printf(cntxt->fdout,"=FINISHED sql_append %d\n",actions);
		printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL );
	}
	DEBUGoptimizers
		mnstr_printf(cntxt->fdout,"#opt_reduce: " LLFMT " ms\n",t);
	QOTupdateStatistics("sql_append",actions,t);
	addtoMalBlkHistory(mb,"sql_append");
	return msg;
}
Beispiel #22
0
// Converts an integer to a signed bit string and 
// appends that to the output buffer
void processLabel(int numBits){
    accept(TC_LABEL, "Label expected.");
    if (spToken.type == TC_LABEL){
        int labelAddress = findSymbol(spToken.source);
        if (labelAddress == -1)
            putError("Undeclared label.");
        else{
            int offset = labelAddress - (spAddress + 1);
            strcat(outputBuffer, signedBinary(offset, numBits));
        }
    }
}
Beispiel #23
0
float ABLModule::getStaticReal(PSTR name)
{
    SymTableNodePtr symbol = findSymbol(name);
    if(!symbol)
        return(-999999.0);
    if(symbol->typePtr != RealTypePtr)
        return(-999999.0);
    if(symbol->defn.info.data.varType != VAR_TYPE_STATIC)
        return(-999999.0);
    StackItemPtr dataPtr = staticData + symbol->defn.info.data.offset;
    return(*((float*)dataPtr));
}
Beispiel #24
0
int32_t ABLModule::getStaticInteger(PSTR name)
{
    SymTableNodePtr symbol = findSymbol(name);
    if(!symbol)
        return(0xFFFFFFFF);
    if(symbol->typePtr != IntegerTypePtr)
        return(0xFFFFFFFF);
    if(symbol->defn.info.data.varType != VAR_TYPE_STATIC)
        return(0xFFFFFFFF);
    StackItemPtr dataPtr = staticData + symbol->defn.info.data.offset;
    return(*((int32_t*)dataPtr));
}
	int initOpenSLES() {
		int result = 0;
		void *handle;

		if ((handle = dlopen("libOpenSLES.so", RTLD_NOW)) == NULL){
			ms_warning("Fail to load libOpenSLES : %s", dlerror());
			result = -1;
		} else {
			dlerror(); // Clear previous message if present

			result += findSymbol(handle, SLW_IID_ENGINE, "SL_IID_ENGINE");
			result += findSymbol(handle, SLW_IID_ANDROIDSIMPLEBUFFERQUEUE, "SL_IID_ANDROIDSIMPLEBUFFERQUEUE");
			result += findSymbol(handle, SLW_IID_ANDROIDCONFIGURATION, "SL_IID_ANDROIDCONFIGURATION");
			result += findSymbol(handle, SLW_IID_RECORD, "SL_IID_RECORD");
			result += findSymbol(handle, SLW_IID_VOLUME, "SL_IID_VOLUME");
			result += findSymbol(handle, SLW_IID_PLAY, "SL_IID_PLAY");

			slwCreateEngine = (OpenSLESConstructor) dlsym(handle, "slCreateEngine");
			if (slwCreateEngine == NULL) {
				result += 1;
				ms_error("Couldn't find slCreateEngine symbol");
			}
		}
		return result;
	}
Beispiel #26
0
static void pas_GotoStatement(void)
{
   char   labelname [8];                /* Label symbol table name */
   STYPE  *label_ptr;                   /* Pointer to Label Symbol */

   TRACE(lstFile,"[pas_GotoStatement]");

   /* FORM:  GOTO <integer> */

   /* Get the token after the goto reserved word. It should be an <integer> */

   getToken();
   if (token != tINT_CONST)
     {
       /* Token following the goto is not an integer */

       error(eINVLABEL);
     }
   else
     {
       /* The integer label must be non-negative */

       if (tknInt < 0)
         {
           error(eINVLABEL);
         }
       else
         {
           /* Find and verify the symbol associated with the label */

           (void)sprintf (labelname, "%ld", tknInt);
           if (!(label_ptr = findSymbol(labelname)))
             {
               error(eUNDECLABEL);
             }
           else if (label_ptr->sKind != sLABEL)
             {
               error(eINVLABEL);
             }
           else
             {
               /* Generate the branch to the label */

               pas_GenerateDataOperation(opJMP, label_ptr->sParm.l.label);
             }
         }

       /* Get the token after the <integer> value */

       getToken();
     }
}
Beispiel #27
0
int32_t ABLModule::setStaticReal(PSTR name, float value)
{
    SymTableNodePtr symbol = findSymbol(name);
    if(!symbol)
        return(1);
    if(symbol->typePtr != RealTypePtr)
        return(2);
    if(symbol->defn.info.data.varType != VAR_TYPE_STATIC)
        return(3);
    StackItemPtr dataPtr = staticData + symbol->defn.info.data.offset;
    *((float*)dataPtr) = value;
    return(0);
}
static int loadGtkSymbols( void * library, FN_TABLE * table) {
	int i = 0;
	void * fn;
	for (i = 0; table[i].fnName != NULL; i++) {
		fn = findSymbol(library, table[i].fnName);
		if (fn != 0) {
			*(table[i].fnPtr) = fn;
		} else {
			if (table[i].required) return -1;
		}
	}
	return 0;
}
Beispiel #29
0
str
FCTshutdown(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
	str mod = *getArgReference_str(stk, pci, 1);
	str fcn = *getArgReference_str(stk, pci, 2);
	Symbol s;
	(void) mb;

	s = findSymbol(cntxt->nspace, putName(mod), putName(fcn));
	if (s == NULL)
		throw(MAL, "factories.shutdown", RUNTIME_OBJECT_MISSING);
	shutdownFactory(cntxt,s->def);
	return MAL_SUCCEED;
}
int main (){

	node *list;

		list = createList(list);

		node *SymbolTeste;
		insertSymbol(list, "TESTE");

		SymbolTeste = findSymbol(list, "TESTE");

		destroyList(list);

}