Пример #1
0
/*!
  \brief run_post_functions_with_arg() is called to run a function AFTER 
  tab loading is complete. It'll search the exported symbols of MegaTunix 
  for the function and if found execute it with the passed widget as an
  argument.
  \param functions is the CSV list of functions to run
  \param widget is the pointer to widget to be passed to the function
  */
G_MODULE_EXPORT void run_post_functions_with_arg(const gchar * functions, GtkWidget *widget)
{
	void (*post_func_w_arg)(GtkWidget *) = NULL;
	void (*post_func)(void) = NULL;
	gchar ** vector = NULL;
	guint i = 0;
	ENTER();
	vector = g_strsplit(functions,",",-1);
	for (i=0;i<g_strv_length(vector);i++)
	{
		/* If widget defined, pass to post function */
		if (widget)
		{
			if (get_symbol(vector[i],(void **)&post_func_w_arg))
				post_func_w_arg(widget);
			else
				MTXDBG(TABLOADER|CRITICAL,_("Error finding symbol \"%s\", error:\n\t%s\n"),vector[i],g_module_error());
		}
		else /* If no widget find funct with no args.. */
		{
			if (get_symbol(vector[i],(void **)&post_func))
				post_func();
			else
				MTXDBG(TABLOADER|CRITICAL,_("Error finding symbol \"%s\", error:\n\t%s\n"),vector[i],g_module_error());
		}
	}
	g_strfreev(vector);
	EXIT();
	return;
}
Пример #2
0
//------------------------------------------------------------------------------
    bool
    get_symbol( const std::string& name,
                Elf64_Addr&        value,
                Elf_Xword&         size,
                unsigned char&     bind,
                unsigned char&     type,
                Elf_Half&          section_index,
                unsigned char&     other ) const
    {
        bool ret = false;

        if ( 0 != get_hash_table_index() ) {
            Elf_Word nbucket = *(const Elf_Word*)hash_section->get_data();
            Elf_Word nchain  = *(const Elf_Word*)( hash_section->get_data() +
                                   sizeof( Elf_Word ) );
            Elf_Word val     = elf_hash( (const unsigned char*)name.c_str() );

            Elf_Word y   = *(const Elf_Word*)( hash_section->get_data() +
                               ( 2 + val % nbucket ) * sizeof( Elf_Word ) );
            std::string   str;
            get_symbol( y, str, value, size, bind, type, section_index, other );
            while ( str != name && STN_UNDEF != y && y < nchain ) {
                y = *(const Elf_Word*)( hash_section->get_data() +
                        ( 2 + nbucket + y ) * sizeof( Elf_Word ) );
                get_symbol( y, str, value, size, bind, type, section_index, other );
            }
            if (  str == name ) {
                ret = true;
            }
        }

        return ret;
    }
Пример #3
0
AstInvocation* ParsePrimary::wrap_with_invocation(AstIdentifier* node, pstr_t str)
{
    AstInvocation *newRoot = new AstInvocation();
    newRoot->strhead = node->strhead;
    newRoot->ident = node;

    AstArgument *args;
    enum SymbolType type = get_symbol(str);
    switch (type) {
        case SYMBOL_PAREN_RIGHT:
            args = new AstArgument();
            args->strhead = args->strtail = newRoot->strtail = str + 1;
            newRoot->astArgs = args;
            return newRoot;
        default:
            args = parse_argument(str);
            newRoot->astArgs = args;
            str = args->strtail;
    }

    type = get_symbol(str);
    switch (type) {
        case SYMBOL_PAREN_RIGHT:
            newRoot->strtail = str + 1;
            return newRoot;
        default:
            std::ostringstream os;
            os << "Unexpected character: " << str[0] << std::endl;
            throw std::invalid_argument(os.str());
    }
}
Пример #4
0
SYMBOL         *get_op(
    char *cp,
    char **endp)
{
    int             local;
    char           *label;
    SYMBOL         *op;

    cp = skipwhite(cp);
    if (EOL(*cp))
        return NULL;

    label = get_symbol(cp, &cp, &local);
    if (label == NULL)
        return NULL;                   /* No operation code. */

    cp = skipwhite(cp);
    if (*cp == ':') {                  /* A label definition? */
        cp++;
        if (*cp == ':')
            cp++;                      /* Skip it */
        free(label);
        label = get_symbol(cp, &cp, NULL);
        if (label == NULL)
            return NULL;
    }

    op = lookup_sym(label, &system_st);
    free(label);

    if (endp)
        *endp = cp;

    return op;
}
Пример #5
0
bool  find_symbols(expression const  e, std::function<bool(symbol)> const  selector,
                   std::unordered_set<symbol,symbol::hash>&  output)
{
    if (selector(get_symbol(e)))
        output.insert(get_symbol(e));
    for (uint64_t  i = 0ULL; i < num_parameters(e); ++i)
        find_symbols(argument(e,i),selector,output);
    return !output.empty();
}
Пример #6
0
/******************************************************************************
 *
 *	L O O K U P _ P R O C (char *name)
 *
 * Looks up a command name in the global symbol table, searching in the
 * required order for procedures of different classes.
 *
 ******************************************************************************
 */
node *
lookup_proc(char *name)
{
    node *res;

    if ((res = get_symbol(world, name, SYM_PROC)) != NODENIL)
	return res;
    else
	return get_symbol(world, name, SYM_HIDDEN_PROC);
}
Пример #7
0
bool symbolTableEntry::verify(int i) {
  bool flag = true;
  if (is_symbol()) {
    if (!get_symbol()->is_symbol()) {
      error("entry %#lx in symbol table isn't a symbol", get_symbol());
      flag = false;
    }
  } else {
    if (get_link()) flag = get_link()->verify(i);
  }
  return flag;
}
Пример #8
0
int main(int argc, char **argv)
{
	commit_creds = (commit_creds_fn)get_symbol("commit_creds");
	prepare_kernel_cred = (prepare_kernel_cred_fn)get_symbol("prepare_kernel_cred");
	__commit_creds = (commit_creds_fn)get_kernel_sym("commit_creds");
	__prepare_kernel_cred = (prepare_kernel_cred_fn)get_kernel_sym("prepare_kernel_cred");

	printf("[+] (get_symbol) commit_creads: %p\n", commit_creds);
	printf("[+] (get_symbol) prepare_kernel_cred: %p\n", prepare_kernel_cred);
	printf("[+] (get_kernel_sym) commit_creads: %p\n", __commit_creds);
	printf("[+] (get_kernel_sym) prepare_kernel_cred: %p\n", __prepare_kernel_cred);

	return 0;
}
Пример #9
0
/*!
  \brief loads the command post functions of an XML Command from the XML.
  \param cmd is the pointer to the Command structure
  \param node is the XML node
  */
G_MODULE_EXPORT void load_cmd_post_functions(Command *cmd, xmlNode *node)
{
	xmlNode *cur_node = NULL;
	PostFunction *pf = NULL;

	ENTER();
	if (!node->children)
	{
		MTXDBG(CRITICAL,_("XML node is empty!!\n"));
		EXIT();
		return;
	}

	cur_node = node->children;
	while (cur_node->next)
	{
		if (cur_node->type == XML_ELEMENT_NODE)
		{
			if (g_ascii_strcasecmp((gchar *)cur_node->name,"function") == 0)
			{
				pf = g_new0(PostFunction, 1);
				generic_xml_gchar_import(cur_node,&pf->name);
				if (!get_symbol(pf->name,(void **)&pf->function))
					printf(_("Unable to locate Post Function %s within MegaTunix or active plugins\n"),pf->name);
				else
				{
					pf->w_arg = FALSE;
					g_array_append_val(cmd->post_functions,pf);
				}
			}
			if (g_ascii_strcasecmp((gchar *)cur_node->name,"function_w_arg") == 0)
			{
				pf = g_new0(PostFunction, 1);
				generic_xml_gchar_import(cur_node,&pf->name);
				if (!get_symbol(pf->name,(void **)&pf->function_w_arg))
					printf(_("Unable to locate Post Function with argument %s within MegaTunix or active plugins\n"),pf->name);
				else
				{
					pf->w_arg = TRUE;
					g_array_append_val(cmd->post_functions,pf);
				}
			}
		}
		cur_node = cur_node->next;
	}
	EXIT();
	return;
}
Пример #10
0
void print_variable_ex(//objid, objidlen, variable, subtree)
    oid     *objid,
    int	    objidlen,
    struct  variable_list *variable,
    struct snmp_mib_tree    *subtree)
{
    char    buf[MAX_RETURN_BUFLEN], *cp;

    *buf = '.';	/* this is a fully qualified name */
    subtree = get_symbol(objid, objidlen, subtree, buf + 1);
    cp = buf;
    if ((strlen(buf) >= strlen((char *)RFC1066_MIB_text)) && !memcmp(buf, (char *)RFC1066_MIB_text,
	strlen((char *)RFC1066_MIB_text))){
	    cp += sizeof(RFC1066_MIB_text);
    }
    printf("Name: %s -> ", cp);
    *buf = '\0';
    if( subtree )
    {
       if (subtree->printer)
	       (SPRINT_BY_TYPE_TYPE subtree->printer)(buf, variable, subtree->enums, 0);
       else {
   	    sprint_by_type(buf, variable, subtree->enums, 0);
       }
       printf("%s\n", buf);
    }
    else
       printf("Unknown Partial...\n" );
}
Пример #11
0
int parse_factor(CALC_ELEMENT ** e)
{
	PARSE_SYMBOL s = get_symbol();
	switch (s) {
	case PARSE_NUMBER:
		*e = create_number(get_current_number());
		accept(s);
		return 0;
		break;
	case PARSE_X:
		*e = create_x();
		accept(s);
		return 0;
		break;
	case PARSE_LOG:
		return parse_log(e);
		break;
	case PARSE_LPAREN:
		return parse_paren_expr(e);
		break;
	default:
		parser_error("\'number\', \'x\', \'log\' or \'(\'");
		return -1;
	}
}
Пример #12
0
void acept_btn(uint8_t btn, uint8_t duration, uint8_t press_cnt){
	uint8_t symbol;
	symbol = get_symbol(btn, duration, press_counter);

	if(is_service_symbol(symbol)){
		make_service(symbol);
        clean_flags();
		return;
	}

	if(is_max_response()){
		if(EdConf.do_exit_on_max_resp){
			response_push(symbol);
            turn_off_cursor();
            exit_status=ExitMaxResp;
		}
        response_rm_char();
        response_push(symbol);
        clean_flags();
	}
	else{
        response_push(symbol);
        cursor_shift(RIGHT);
        clean_flags();
	}
}
Пример #13
0
int delete_braces()
{
    int i, j, k;
    char c;
    struct MyString *tmpstring;
    struct MySymbol *tmpsymbol;
    is_saved = 0;
    tmpstring = my_strings_start;
    if (N == 0)
        return 0;
    for (i = 1; i <= N; i++)
    {
        for (j = 1; j <= tmpstring->cur_size; j++)
        {
            tmpsymbol = get_symbol(i, j);
            c = tmpsymbol->symbol;
            if (c == '{')
            {
                delete_one_pair_braces(&i, &j);
                tmpstring = my_strings_start;
                for (k = 0; k < i-1; k++)
                {
                    tmpstring = tmpstring->next_string;
                }
            }
            
        }
        tmpstring = tmpstring->next_string;
    }
    return 0;
}
Пример #14
0
static void add_const(const char* name, double val)
{
  MSymbol* s = get_symbol(name);
  s->data = new_item();
  s->data->n = -1;
  s->data->val = val;
}
Пример #15
0
AstNode* ParsePrimary::parse_identifier_or_invocation(pstr_t str)
{
    AstIdentifier *ident = tokenIdentifier->parse_identifier(str);

    str = scan(ident->strtail);
    switch (ident->get_identifier_type()) {
        case AstIdentifier::FUNCTION:
            delete ident;
            return parseFunction->parse(scan(str));
        case AstIdentifier::IF:
            delete ident;
            return parseIf->parse(scan(str));
        case AstIdentifier::NAME:
            switch (get_symbol(str)) {
                case SYMBOL_PAREN_LEFT:
                    return wrap_with_invocation(ident, scan(str+1));
                    break;
                default:
                    return ident;
            }
            break;
        default:
            std::ostringstream os;
            os << "Unexpected identifier: " << ident->get_name() << std::endl;
            throw std::invalid_argument(os.str());
    }
}
Пример #16
0
AstArgument* ParsePrimary::parse_argument(pstr_t str)
{
    AstArgument *inv = new AstArgument();
    inv->strhead = str;

    AstNode *expr = parseExpression->parse(str);
    inv->children.push_back(expr);
    str = expr->strtail;

    while (true) {
        str = scan(str);
        enum SymbolType type = get_symbol(str);
        switch (type) {
            case SYMBOL_COMMA:
                str++;
                str = scan(str);
                expr = parseExpression->parse(str);
                inv->children.push_back(expr);
                str = expr->strtail;
                break;
            default:
                inv->strtail = str;
                return inv;
        }
    }
}
Пример #17
0
/* Create a new symbol instance */
object_type *create_symbol(interp_core_type *interp, char *str) {
    object_type *list=0;
    object_type *obj=0;
    char *c=0;

    obj=get_symbol(interp, str);

    /* does the symbol already exist? */
    if(obj) {
        return obj;
    }

    /* create a new buffer for the string value */
    c=alloc_string(interp, strlen(str));
    strcpy(c, str);

    obj=alloc_object(interp, SYM);
    obj->value.string_val=c;

    /* add our new symbol to the symbol list */
    list=cons(interp, obj, interp->symbols.list);

    interp->symbols.list=list;

    return obj;
}
Пример #18
0
void ExecFileParser::append_export_trampolines() {
    char jmp_opcode = 0x01;
    for (auto &psec : reader->sections)
        if (psec->get_type() == SHT_DYNSYM) {
            const auto symbols = symbol_section_accessor(*reader, psec);
            auto sym_num = symbols.get_symbols_num();

            for (unsigned int i = 0; i < sym_num; ++i) {
                string name;
                Elf64_Addr value;
                Elf_Xword size;
                unsigned char bind;
                unsigned char type;
                Elf_Half section_index;
                unsigned char other;

                // Read symbol properties
                symbols.get_symbol(i, name, value, size, bind, type, section_index, other);
                if (type != STT_FUNC || !section_index) continue;

                // Add a trampoline for this symbol
                xpsec->append_data(&jmp_opcode, 1);
                // For now, we append the indices of symbols
                // and let PatchEntry fix them up into relative offsets
                xpsec->append_data(reinterpret_cast<char*>(&i), 4);

#if OFPreadprint >= 2
                printf("xptramp %4d: 0x%08llx %6lld 0x%08llx %x %2d\n", i, value, size, (value + size),
                       static_cast<int>(type), static_cast<int>(section_index));
#endif
            }
        }
}
Пример #19
0
Cell* op_floor::eval_op(Cell* operand) const
{
  Cell* operand_ptr;

  no_of_operands(operand,1,1,true,true);

  operand_ptr = car(operand);

  if (listp(operand_ptr))
  {
    operand_ptr = eval(operand_ptr);
  }
  else if (symbolp(operand_ptr))
  {
    operand_ptr = search_symbol(get_symbol(operand_ptr),true);
  }

  if (doublep(operand_ptr))
  {
    return make_int( int(floor(get_double(operand_ptr))) );
  }
  else
  {
    if (operand_ptr != NULL)
       delete operand_ptr;
    throw runtime_error("'floor' only operates with double.");
  }
}
Пример #20
0
 SQLRETURN  SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle,
                                   SQLINTEGER Attribute, SQLPOINTER Value,
                                   SQLINTEGER StringLength) {
   if (!ptr_SQLSetStmtAttr) *(void**)(&ptr_SQLSetStmtAttr) = get_symbol("SQLSetStmtAttr");
   if (ptr_SQLSetStmtAttr) return ptr_SQLSetStmtAttr(StatementHandle, Attribute, Value, StringLength);
   else return SQL_ERROR;
 }
Пример #21
0
 SQLRETURN  SQL_API SQLSetConnectAttr(SQLHDBC ConnectionHandle,
                                      SQLINTEGER Attribute, SQLPOINTER Value,
                                      SQLINTEGER StringLength) {
   if (!ptr_SQLSetConnectAttr) *(void**)(&ptr_SQLSetConnectAttr) = get_symbol("SQLSetConnectAttr");
   if (ptr_SQLSetConnectAttr) return ptr_SQLSetConnectAttr(ConnectionHandle, Attribute,Value, StringLength);
   else return SQL_ERROR;
 }
Пример #22
0
 SQLRETURN  SQL_API SQLAllocHandle(SQLSMALLINT HandleType,
                                   SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) {
   if (!ptr_SQLAllocHandle) *(void**)(&ptr_SQLAllocHandle) = get_symbol("SQLAllocHandle");
   if (ptr_SQLAllocHandle) return ptr_SQLAllocHandle(HandleType,
                                   InputHandle, OutputHandle);
   else return SQL_ERROR;
 }
Пример #23
0
void sprint_variable(//buf, objid, objidlen, variable)
    char *buf,
    oid     *objid,
    int	    objidlen,
    struct  variable_list *variable)
{
    char    tempbuf[MAX_RETURN_BUFLEN], *cp;
    struct snmp_mib_tree    *subtree = Mib;

    *tempbuf = '.';	/* this is a fully qualified name */
    subtree = get_symbol(objid, objidlen, subtree, tempbuf + 1);
    cp = tempbuf;
    if ((strlen(buf) >= strlen((char *)RFC1066_MIB_text)) && !memcmp(buf, (char *)RFC1066_MIB_text,
	strlen((char *)RFC1066_MIB_text))){
	    cp += sizeof(RFC1066_MIB_text);
    }
    sprintf(buf, WIDE("Name: %s -> "), cp);
    buf += strlen(buf);
    if (subtree->printer)
		 (SPRINT_BY_TYPE_TYPE subtree->printer)(buf, variable, subtree->enums, 0);
    else {
	sprint_by_type(buf, variable, subtree->enums, 0);
    }
    strcat(buf, WIDE("\n"));
}
Пример #24
0
/******************************************************************************
 *
 *	G E T _ P A S S B Y R E F E R E N C E V A R (node *var)
 *
 * If a variable is a parameter then, on calling the current procedure we
 * could have passed EITHER an expression, which is evaluated and the formal's
 * value member points to that value (whose interpret member will not be
 * parameter_interpret())
 * OR
 * a variable (ie passed by reference). It is this latter case that
 * get_passbyreferencevar() handles.
 *
 * In this case the parameter's value member will point to a node whose type
 * is TYPE_SYMTAB, interpret member is parameter_interpret(),
 * symboltable_part() member points to the symbol table of the corresponding
 * actual variable and whose sub[0] member points to a node that is the
 * corresponding actual variable (ie a name_interpret() node whose value field
 * is an ICL string whose value is the identity of the passed variable).
 *
 * Note that if the actual was a parameter itself that had been passed a
 * varaiable then that parameter's actual variable parameter would have been
 * passed onto this (ie we do not have a chain formal-actuals to follow).
 *
 *
 * This routine will return something that can be assigned to or NULL.
 *
 ******************************************************************************
 */
static node *
get_passbyreferencevar(node * var)
{
    return (get_symbol(symboltable_part(var->val),
	    string_part(var->sub[0]->val),
	    SYM_VARIABLE));
}
Пример #25
0
const exprt &value_set_dereferencet::get_symbol(const exprt &expr)
{
  if(expr.id()==ID_member || expr.id()==ID_index)
    return get_symbol(expr.op0());

  return expr;
}
Пример #26
0
END_TEST


START_TEST (test_get_symbol_scope)
{
	// enter program
	ck_assert(check_enter_method("program", parser_data) != NULL);

	// enter fun1
	ck_assert(check_enter_method("fun1", parser_data) != NULL);

	// exit fun1
	ck_assert(check_exit_method(parser_data) == 0);

	// enter fun2
	ck_assert(check_enter_method("fun2", parser_data) != NULL);

	// enter fun3
	ck_assert(check_enter_method("fun3", parser_data) != NULL);

	// exit fun3
	ck_assert(check_exit_method(parser_data) == 0);

	// exit fun2
	ck_assert(check_exit_method(parser_data) == 0);

	// check that fun3 does not exist
	ck_assert(get_symbol("fun3", parser_data, 1) == NULL);
	ck_assert(get_type("fun3", parser_data).std_type == NONE);

	// exit program
	ck_assert(check_exit_method(parser_data) == 0);
}
Пример #27
0
bool GDNative::terminate() {

	if (native_handle == NULL) {
		ERR_PRINT("No valid library handle, can't terminate GDNative object");
		return false;
	}

	void *library_terminate;
	Error error = get_symbol(terminate_symbol, library_terminate);
	if (error || !library_terminate) {
		OS::get_singleton()->close_dynamic_library(native_handle);
		native_handle = NULL;
		return true;
	}

	godot_gdnative_terminate_fn library_terminate_pointer;
	library_terminate_pointer = (godot_gdnative_terminate_fn)library_terminate;

	// TODO(karroffel): remove this? Should be part of NativeScript, not
	// GDNative IMO
	godot_gdnative_terminate_options options;
	options.in_editor = Engine::get_singleton()->is_editor_hint();

	library_terminate_pointer(&options);

	// GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);

	OS::get_singleton()->close_dynamic_library(native_handle);
	native_handle = NULL;

	return true;
}
Пример #28
0
/******************************************************************************
 *
 *	P U T _ S Y M B O L (value symbval, char *name, int type, node *n)
 *
 * Stores a node under a given name, with a supplied symbol type and with a
 * value (n) in a symbol table (all given). A symboltable ICL value is passed
 * and symboltable_part() is used to get the actual symbol table involved.
 *
 * If the symbol already exists, its node value is re-used (overwritten),
 * so that existing pointers to the symbol table entry will point to the
 * new value. I don't believe anything relies on this feature currently.
 ******************************************************************************
 */
value
put_symbol(value symbval, char *name, int type, node * n)
{
    node *found;
    symtab *symb;

    symb = symboltable_part(symbval);
    if ((found = get_symbol(symb, name, type)) != NODENIL) {
	destroy(found);
	symb->next->value = n;		/* get_symbol has reordered table */
	return (n->val);
    } else {
	symtab *sym;

	sym = new_symtab(name, type, n);
	if (sym == SYMBNIL)
	    return (exception("SYSERR  memory exhausted in put_symbol"));
	else {
	    sym->next = symb->next;
	    sym->prev = symb;
	    symb->next->prev = sym;
	    symb->next = sym;
	    return (n->val);
	}
    }
}
Пример #29
0
void process_msg(char *msg)
{
	int i = 0;
	int j = 0;
	int delay = 0;
	char tmp = '\0';
	char sy = '\0';
	char *symbol = NULL;
	for(i = 0; i < strlen(msg); i++)
	{
		tmp = msg[i];
		symbol = get_symbol(tmp);
		if (tmp == ' ')
		{
			delay = 6 * UNIT_DELAY;
		}
		else
		{
			printf("%c = ", tmp);
			fflush(stdout);
			for(j = 0; j < strlen(symbol); j++)
			{
				sy = symbol[j];
				printf("%c", sy);
				fflush(stdout);
				process_symbol(sy);
				usleep(short_delay);
			}
			delay = 2 * UNIT_DELAY;
		}
		usleep(delay);
		printf("\n");
	}
}
Пример #30
0
/*
int Xml_Parser::find_front(wchar_t* src,wchar_t *pat,int len){
	int i,j,plen;
	plen=lstrlen(pat);
	i=0;
	while(i<len){
		if(src[i]=='\0'){
			break;
		}
		j=0;
		while(1){
			if(src[i+j]!=pat[j]){
				break;
			}
			j++;
			if(j==plen){
				return i;
			}
		}
		i++;
	}
	return string::npos;
}

int Xml_Parser::find_back(wchar_t* src,wchar_t *pat,int len){
	int res=find_front(src,pat,len);
	return (res==string::npos)?(string::npos):(res+lstrlen(pat));
}

int Xml_Parser::find_multi(wchar_t* src,wchar_t* pats,int len,wchar_t* res){
	int i,j,plen;
	plen=lstrlen(pats);
	
	for(i=0;i<len;i++){
		for(j=0;j<plen;j++){
			if(src[i]==pats[j]){
				*res=pats[j];
				return i;
			}
		}
	}
	*res=string::npos;
	return string::npos;
}
*/
int Xml_Parser::reference(current* current,int len,wstring* res){
	wstring ref;
	wchar_t* er,*src;
	int i,num;
	bool hex=false;

	if(current->str[current->n_curnt]!='&'){
		return false;
	}
	current->inclement();
	get_symbol(current,len,TEXT(";"),&ref);
	if(ref[0]=='#'){
		i=1;
		if(ref[1]=='x'){
			i++;
			hex=true;
		}
		num=wcstol(ref.c_str()+i,&er,hex?16:10);
		res->append(1,(wchar_t)num);
		return true;
	}else{
		for(i=0;i<entity.size();i++){
			if(entity[i].key==(current->str+current->n_curnt)){
				res->append(entity[i].data);
				return true;
			}
		}
	}
	//ERROR!
	return false;
}