PropertyInfo MethodBind::get_argument_info(int p_argument) const { if (p_argument>=0) { String name = (p_argument<arg_names.size())?String(arg_names[p_argument]):String("arg"+itos(p_argument)); PropertyInfo pi( get_argument_type(p_argument), name ); if ((pi.type==Variant::OBJECT) && name.find(":")!=-1) { pi.hint=PROPERTY_HINT_RESOURCE_TYPE; pi.hint_string=name.get_slicec(':',1); pi.name=name.get_slicec(':',0); } return pi; } else { Variant::Type at = get_argument_type(-1); if (at==Variant::OBJECT && ret_type) return PropertyInfo( at, "ret", PROPERTY_HINT_RESOURCE_TYPE, ret_type ); else return PropertyInfo( at, "ret" ); } return PropertyInfo(); }
static int pcre_eval_header(void *_data, void *content, char *params, const char *flags){//, int parserType){ //HAY QUE PASAR UN HASHMAP EN VEZ DE UN CHAR* EN MSG. //PARAMS VA A TENER 2 PARAMETROS: // subcampo del header sobre el que se opera // expresion regular char *target_content; pcre *pcre_regex; function_arguments *arguments=parse_args(params,2); pcre_regex_data *data=(pcre_regex_data *)_data; char *header, *expr, *tmp; //printf("params: %s\n",params); if(get_argument_type(arguments,0)!=TYPE_STRING || get_argument_type(arguments,1)!=TYPE_STRING ){ wblprintf(LOG_WARNING,"PCRE REGEX PLUGIN(eval_header)","Incorrect arguments %s\n", params); return 0; } header=get_argument_content(arguments,0); expr=get_argument_content(arguments,1); if(data==NULL || hashmap_get(data->pcre_regex_cache,expr,(any_t *)&pcre_regex)==MAP_MISSING){ pcre_regex=pcregex_compile(expr); //Compile the expression if (pcre_regex==NULL) { wblprintf(LOG_WARNING,"PCRE REGEX PLUGIN(eval_header)","Incorrect regular expression %s\n", expr); return 0; } if (data!=NULL) { tmp=malloc(sizeof(char)*(strlen(expr)+1)); //Make a copy of the uncompiled regex for cache strcpy(tmp,expr); //printf("KEY INSERTADA%s\n",tmp); hashmap_put(data->pcre_regex_cache,tmp,(any_t)pcre_regex); //store the compiled regex in cache } } //Return the content to test in the raw entry generated by eml_structure_parser parser if ((target_content=getHeaderContent(content, header))==NULL){ wblprintf(LOG_WARNING, "PCRE REGEX PLUGIN (eval_header)","Unable to found raw entry on contents.\n"); return 0; } free_arguments(arguments); return pcregex_match(pcre_regex,target_content); }
int handle_coding_byte(int cursor, t_vm *vm, int op) { int i; char *coding_byte; cursor += 1; coding_byte = ft_itoa_base(vm->memory[ft_loop_memory(cursor)], 2, 0); if (ft_strlen(coding_byte) < 8) coding_byte = ft_strjoin("0", coding_byte); i = 0; while (i < 6) { if (get_argument_type(coding_byte + i) == T_REG) cursor += 1; if (get_argument_type(coding_byte + i) == T_IND) cursor += 2; if (get_argument_type(coding_byte + i) == T_DIR) cursor += get_label_size(op); i = i + 2; } return (cursor); }
static int pcre_eval(void *_data, void *content, char *params, const char *flags){//, int parserType){ //el msq es un char * ya que recibe el mail en modo raw. //Recibe un solo parametro que es el pattern char *target_content; pcre *pcre_regex; char *expr, *tmp; pcre_regex_data *data=(pcre_regex_data *)_data; function_arguments *arguments=parse_args(params,1); if(get_argument_type(arguments,0)!=TYPE_STRING){ wblprintf(LOG_WARNING,"PCRE REGEX PLUGIN(pcre_eval)","Incorrect arguments %s\n", params); return 0; } expr=get_argument_content(arguments,0); if(data==NULL || hashmap_get(data->pcre_regex_cache,expr,(any_t *)&pcre_regex)==MAP_MISSING){ pcre_regex=pcregex_compile(expr); if (pcre_regex==NULL) { wblprintf(LOG_WARNING,"PCRE REGEX PLUGIN(pcre_eval)","Incorrect regular expression %s\n", params); return 0; } if (data!=NULL){ tmp=malloc(sizeof(char)*(strlen(expr)+1)); //Make a copy of the uncompiled regex for cache //printf("KEY INSERTADA%s\n",tmp); strcpy(tmp,expr); hashmap_put(data->pcre_regex_cache,tmp,(any_t)pcre_regex); } } //Return the content to test in the raw entry generated by eml_structure_parser parser if (hashmap_get((map_t)content,"raw",(any_t *)&target_content)!=MAP_OK){ wblprintf(LOG_WARNING, "PCRE REGEX PLUGIN","Unable to found raw entry on contents"); return 0; } free_arguments(arguments); return pcregex_match(pcre_regex,target_content); }