_str generic_process_search(_str &proc_name, int find_first)
{
_str specific_search = '^[\t ]*(SECTION[\t ]+'proc_name'[\t ]*;|FUNCTION[\t ]*'proc_name'[\t ]*\([^\)]+\)[^:]*:[^;]*;|DIAGNOSTIC[\t ]+'proc_name'[\t ]*;|PROCEDURE[\t ]*'proc_name'[\t ]*\([^\)]*\)[^;]*;)';
_str general_search = '^[\t ]*(SECTION[\t ]+[^;]+;|FUNCTION[\t ]*[^\(]+\([^\)]+\)[^:]*:[^;]*;|DIAGNOSTIC[\t ]+[^;]+;|PROCEDURE[\t ]*[^\(]+\([^\)]*\)[^;]*;)';
_str search_string = general_search;
if (find_first && proc_name :!= "") {
search_string = specific_search;
}
if ( find_first ) {
search(search_string,'UI>?');
} else {
repeat_search();
}
if ( rc ) {
return(rc);
}
_str line='';
get_line(line);
_str eatit;
if(pos('^[\t ]*SECTION',line, 1, "UI")){
parse line with eatit proc_name ';';
proc_name = tag_tree_compose_tag(proc_name,"","block",VS_TAGFLAG_static);
//message(proc_name);
}else if(pos('^[\t ]*DIAGNOSTIC',line, 1, "UI")){
parse line with eatit proc_name ';';
proc_name = tag_tree_compose_tag(proc_name,"","block",VS_TAGFLAG_static);
}else if(pos('^[\t ]*PROCEDURE',line, 1, "UI")){
_str args = "";
_str ret_type = "";
_str params[] = getParamNamesFromFunctionLine(line, false);
int i=0;
for(;i<params._length()-1; i++) {
args = args '' params[i] ', ';
}
if(params._length()>0) {
args = args '' params[params._length()-1];
}
parse line with eatit proc_name '(' eatit ')' eatit;
proc_name = tag_tree_compose_tag(proc_name,"","func",0,args, ret_type);
messageNwait("are we here2: " proc_name);
}else { //handle the function case here
_str args = "";
_str ret_type = "";
_str params[] = getParamNamesFromFunctionLine(line, false);
int i=0;
for(;i<params._length()-1; i++) {
args = args '' params[i] ', ';
}
if(params._length()>0) {
args = args '' params[params._length()-1];
}
parse line with eatit proc_name '(' eatit ')' eatit ':' ret_type;
proc_name = tag_tree_compose_tag(proc_name,"","func",0,args, ret_type);
//messageNwait(proc_name);
}
return(0);
}