From 7e8248e13e06ea6e6c6b6f0f32500a9eee7a159d Mon Sep 17 00:00:00 2001 From: Greg Eisenhauer Date: Mon, 27 May 2024 20:57:44 -0400 Subject: [PATCH] EVPath 2024-05-27 (45471c87) (#4181) Code extracted from: https://github.com/GTkorvo/EVPath.git at commit 45471c87f14c735bb4a3f92477f3a04b0a06b18a (master). --- thirdparty/EVPath/EVPath/gen_interface.pl | 692 +++++++++++----------- 1 file changed, 354 insertions(+), 338 deletions(-) diff --git a/thirdparty/EVPath/EVPath/gen_interface.pl b/thirdparty/EVPath/EVPath/gen_interface.pl index f76852ba75..d79335ea5d 100755 --- a/thirdparty/EVPath/EVPath/gen_interface.pl +++ b/thirdparty/EVPath/EVPath/gen_interface.pl @@ -10,26 +10,26 @@ sub gen_type print REVP " int condition_var;\n"; @args = split( ", ", $arg_str,2); foreach $arg (split (", ", $args[1])) { - $_ = $arg; - if (/^\s*(.*\W+)(\w+)$\s*/) { - $argtype = $1; - $argname = $2; - $argtype =~ s/\s+$//; - $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $iotype = $argtype; - $sizetype = $argtype; - switch:for ($argtype) { - /attr_list/ && do {$iotype = "string"; $argtype="char*"; last;}; - /char*/ && do {$iotype = "string"; $argtype="char*"; last;}; - /EVstone$/ && do {$iotype = "integer"; $argtype="EVstone"; last;}; - /EVstone\*/ && do {print REVP " int ${argname}_len;\n"; + $_ = $arg; + if (/^\s*(.*\W+)(\w+)$\s*/) { + $argtype = $1; + $argname = $2; + $argtype =~ s/\s+$//; + $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $iotype = $argtype; + $sizetype = $argtype; + switch:for ($argtype) { + /attr_list/ && do {$iotype = "string"; $argtype="char*"; last;}; + /char*/ && do {$iotype = "string"; $argtype="char*"; last;}; + /EVstone$/ && do {$iotype = "integer"; $argtype="EVstone"; last;}; + /EVstone\*/ && do {print REVP " int ${argname}_len;\n"; $iotype = "integer[${argname}_len]"; $argtype="int *"; last;}; - /EVSimpleHandlerFunc$/ && do {$iotype = "string"; $argtype="char*"; last;}; - /FMStructDescList/ && do {$iotype = "string"; $argtype="char*"; last;}; - } - } - print REVP " $argtype $argname;\n"; + /EVSimpleHandlerFunc$/ && do {$iotype = "string"; $argtype="char*"; last;}; + /FMStructDescList/ && do {$iotype = "string"; $argtype="char*"; last;}; + } + } + print REVP " $argtype $argname;\n"; } print REVP "} ${subr}_request;\n"; $ret_type = $return_type{$subr}; @@ -52,27 +52,27 @@ sub gen_field_list print REVP " {\"condition_var\", \"integer\", sizeof(int), FMOffset(${subr}_request*, condition_var)},\n"; @args = split( ", ", $arg_str,2); foreach $arg (split (", ", $args[1])) { - $_ = $arg; - if (/^\s*(.*\W+)(\w+)$\s*/) { - $argtype = $1; - $argname = $2; - $argtype =~ s/\s+$//; - $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $iotype = $argtype; - $sizetype = $argtype; - switch:for ($argtype) { - /attr_list/ && do {$iotype = "string"; $argtype="char*"; last;}; - /char*/ && do {$iotype = "string"; $argtype="char*"; last;}; - /void*/ && do {$iotype = "char[${argname}_len"; $argtype="void*"; last;}; - /int/ && do {$iotype = "integer"; $argtype="int"; last;}; - /EVstone/ && do {$iotype = "integer"; $argtype="EVstone"; last;}; - /EVaction/ && do {$iotype = "integer"; $argtype="EVaction"; last;}; - /EVSimpleHandlerFunc/ && do {$iotype = "string"; $argtype="EVSimpleHandlerFunc"; last;}; - /FMStructDescList/ && do {$iotype = "string"; $argtype="EVSimpleHandlerFunc"; last;}; - } - } - print REVP " {\"$argname\", \"$iotype\", sizeof($sizetype), FMOffset(${subr}_request*,$argname)},\n"; + $_ = $arg; + if (/^\s*(.*\W+)(\w+)$\s*/) { + $argtype = $1; + $argname = $2; + $argtype =~ s/\s+$//; + $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $iotype = $argtype; + $sizetype = $argtype; + switch:for ($argtype) { + /attr_list/ && do {$iotype = "string"; $argtype="char*"; last;}; + /char*/ && do {$iotype = "string"; $argtype="char*"; last;}; + /void*/ && do {$iotype = "char[${argname}_len"; $argtype="void*"; last;}; + /int/ && do {$iotype = "integer"; $argtype="int"; last;}; + /EVstone/ && do {$iotype = "integer"; $argtype="EVstone"; last;}; + /EVaction/ && do {$iotype = "integer"; $argtype="EVaction"; last;}; + /EVSimpleHandlerFunc/ && do {$iotype = "string"; $argtype="EVSimpleHandlerFunc"; last;}; + /FMStructDescList/ && do {$iotype = "string"; $argtype="EVSimpleHandlerFunc"; last;}; + } + } + print REVP " {\"$argname\", \"$iotype\", sizeof($sizetype), FMOffset(${subr}_request*,$argname)},\n"; } print REVP " {NULL, NULL, 0, 0}\n};\n"; print REVP "\nFMStructDescRec ${subr}_req_formats[] = {\n"; @@ -87,17 +87,17 @@ sub gen_stub { print REVP "\nextern $return_type{$subr}\n"; print REVPHI "\nextern $return_type{$subr}\n"; if ($#args > 0) { - print REVP "INT_R$subr(CMConnection conn, $args[1])\n"; - print REVPHI "INT_R$subr(CMConnection conn, $args[1]);\n"; + print REVP "INT_R$subr(CMConnection conn, $args[1])\n"; + print REVPHI "INT_R$subr(CMConnection conn, $args[1]);\n"; } else { - print REVP "INT_R$subr(CMConnection conn)\n"; - print REVPHI "INT_R$subr(CMConnection conn);\n"; + print REVP "INT_R$subr(CMConnection conn)\n"; + print REVPHI "INT_R$subr(CMConnection conn);\n"; } print REVP "{\n"; $_ = $return_type{$subr}; if (/^\s*void\s*$/) { - $return_type{$subr} = "void"; + $return_type{$subr} = "void"; } $retsubtype = $return_type{$subr}; switch: for ($ret_type) { @@ -115,33 +115,33 @@ sub gen_stub { print REVP " f = INT_CMlookup_format(conn->cm, ${subr}_req_formats);\n"; $free_list = ""; foreach $arg (split (", ", $args[1])) { - $_ = $arg; - if (/^\s*(.*\W+)(\w+)$\s*/) { - $argtype = $1; - $argname = $2; - $argtype =~ s/\s+$//; - $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $argright = $argname; - switch:for ($argtype) { - /attr_list/ && do {$argright = "attr_list_to_string($argname)"; $free_list .= " free(request.$argname);\n"; last;}; - /FMStructDescList/ && do {$argright = "get_format_name(conn->cm, $argname)"; last;}; - } - } - print REVP " request.$argname = $argright;\n"; + $_ = $arg; + if (/^\s*(.*\W+)(\w+)$\s*/) { + $argtype = $1; + $argname = $2; + $argtype =~ s/\s+$//; + $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $argright = $argname; + switch:for ($argtype) { + /attr_list/ && do {$argright = "attr_list_to_string($argname)"; $free_list .= " free(request.$argname);\n"; last;}; + /FMStructDescList/ && do {$argright = "get_format_name(conn->cm, $argname)"; last;}; + } + } + print REVP " request.$argname = $argright;\n"; } print REVP " request.condition_var = cond;\n"; print REVP " if (f == NULL) {\n"; print REVP " f = INT_CMregister_format(conn->cm, ${subr}_req_formats);\n"; print REVP " }\n"; if ($return_type{$subr} eq "void") { - print REVP " INT_CMCondition_set_client_data(conn->cm, cond, NULL);\n"; + print REVP " INT_CMCondition_set_client_data(conn->cm, cond, NULL);\n"; } else { - print REVP " INT_CMCondition_set_client_data(conn->cm, cond, &response);\n"; + print REVP " INT_CMCondition_set_client_data(conn->cm, cond, &response);\n"; } print REVP " INT_CMwrite(conn, f, &request);\n"; if ("$free_list" ne "") { - print REVP "$free_list"; + print REVP "$free_list"; } print REVP " INT_CMCondition_wait(conn->cm, cond);\n"; switch:for ($return_type{$subr}) { @@ -173,7 +173,7 @@ sub gen_wrapper { print REVP "{\n"; $_ = $return_type{$subr}; if (/^\s*void\s*$/) { - $return_type{$subr} = "void"; + $return_type{$subr} = "void"; } $retsubtype = $return_type{$subr}; switch: for ($ret_type) { @@ -190,21 +190,21 @@ sub gen_wrapper { print REVP " ret = INT_R${subr}(conn"; } foreach $arg (split (", ", $args[1])) { - $_ = $arg; - if (/^\s*(.*\W+)(\w+)$\s*/) { - $argtype = $1; - $argname = $2; - $argtype =~ s/\s+$//; - $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $argright = "$argname"; - switch:for ($argtype) { - /attr_list/ && do {$argright = "$argname"; last;}; - /EVSimpleHandlerFunc/ && do {$argright = "$argname"; last;}; - /FMStructDescList/ && do {$argright = "$argname"; last;}; - } - } - print REVP ", $argright"; + $_ = $arg; + if (/^\s*(.*\W+)(\w+)$\s*/) { + $argtype = $1; + $argname = $2; + $argtype =~ s/\s+$//; + $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $argright = "$argname"; + switch:for ($argtype) { + /attr_list/ && do {$argright = "$argname"; last;}; + /EVSimpleHandlerFunc/ && do {$argright = "$argname"; last;}; + /FMStructDescList/ && do {$argright = "$argname"; last;}; + } + } + print REVP ", $argright"; } print REVP ");\n"; print REVP " CManager_unlock(conn->cm);\n"; @@ -229,7 +229,7 @@ sub gen_handler { print REVP "{\n"; $_ = $return_type{$subr}; if (/^\s*void\s*$/) { - $return_type{$subr} = "void"; + $return_type{$subr} = "void"; } $retsubtype = $return_type{$subr}; switch: for ($ret_type) { @@ -248,43 +248,43 @@ sub gen_handler { print REVP " f = INT_CMregister_format(conn->cm, EV_${retsubtype}_response_formats);\n"; print REVP " }\n"; foreach $arg (split (", ", $args[1])) { - $_ = $arg; - if (/^\s*(.*\W+)(\w+)$\s*/) { - $argtype = $1; - $argname = $2; - $argtype =~ s/\s+$//; - $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $argright = $argname; - switch:for ($argtype) { - /attr_list/ && do {print REVP " attr_list $argname = attr_list_from_string(request->$argname);\n"; last;}; - /EVSimpleHandlerFunc/ && do {print REVP " EVSimpleHandlerFunc $argname = REVPlookup_handler(request->$argname);\n"; last;}; - /FMStructDescList/ && do {print REVP " FMStructDescList $argname = REVPlookup_format_structs(conn->cm, request->$argname);\n"; last;}; - } - } + $_ = $arg; + if (/^\s*(.*\W+)(\w+)$\s*/) { + $argtype = $1; + $argname = $2; + $argtype =~ s/\s+$//; + $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $argright = $argname; + switch:for ($argtype) { + /attr_list/ && do {print REVP " attr_list $argname = attr_list_from_string(request->$argname);\n"; last;}; + /EVSimpleHandlerFunc/ && do {print REVP " EVSimpleHandlerFunc $argname = REVPlookup_handler(request->$argname);\n"; last;}; + /FMStructDescList/ && do {print REVP " FMStructDescList $argname = REVPlookup_format_structs(conn->cm, request->$argname);\n"; last;}; + } + } } if ($return_type{$subr} eq "void") { - print REVP " $subr(cm"; + print REVP " $subr(cm"; } else { - print REVP " ret = $subr(cm"; + print REVP " ret = $subr(cm"; } $after = ""; foreach $arg (split (", ", $args[1])) { - $_ = $arg; - if (/^\s*(.*\W+)(\w+)$\s*/) { - $argtype = $1; - $argname = $2; - $argtype =~ s/\s+$//; - $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $argright = "request->$argname"; - switch:for ($argtype) { - /attr_list/ && do {$argright = "$argname"; $after .= "free_attr_list($argname);\n"; last;}; - /EVSimpleHandlerFunc/ && do {$argright = "$argname"; last;}; - /FMStructDescList/ && do {$argright = "$argname"; last;}; - } - } - print REVP ", $argright"; + $_ = $arg; + if (/^\s*(.*\W+)(\w+)$\s*/) { + $argtype = $1; + $argname = $2; + $argtype =~ s/\s+$//; + $argtype =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $argtype =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $argright = "request->$argname"; + switch:for ($argtype) { + /attr_list/ && do {$argright = "$argname"; $after .= "free_attr_list($argname);\n"; last;}; + /EVSimpleHandlerFunc/ && do {$argright = "$argname"; last;}; + /FMStructDescList/ && do {$argright = "$argname"; last;}; + } + } + print REVP ", $argright"; } if ($has_client_data == 1) {print REVP ", NULL";} print REVP ");\n"; @@ -311,7 +311,7 @@ sub strip_client_data { @args = split( ", ", $arguments{$subr}); $_ = pop(@args); if (!/.*client_data\W*$/) { - push(@args, $_); + push(@args, $_); } $arg_str = join(", ", @args); } @@ -321,10 +321,10 @@ sub mod_EVhandler { local(@args); @args = split( ", ", $arg_str); for( my $i=0; $i < scalar(@args); $i++) { - $_ = $args[$i]; - if (/\W*EVSimpleHandlerFunc.*$/) { - $args[$i] = "char *handler"; - } + $_ = $args[$i]; + if (/\W*EVSimpleHandlerFunc.*$/) { + $args[$i] = "char *handler"; + } } $arg_str = join(", ", @args); return $arg_str; @@ -332,23 +332,39 @@ sub mod_EVhandler { { local ($/, *INPUT); - + + $cat = "cat"; + if ($^O eq "MSWin32") { + $cat = "powershell.exe Get-Content"; + } $cat_args = ""; $has_ev_dfg = 0; $cm_only = 0; + $index = 0; foreach my $a(@ARGV) { - if ($a =~ "-CM_ONLY") { - $cm_only = 1; - next; - } - $a=~s/ /\\ /g; - $cat_args .= "$a "; - if ($a =~ /ev_dfg/) { - $has_evdfg = 1; - } + if ($a =~ "-CM_ONLY") { + $cm_only = 1; + next; + } + $a=~s/ /\\ /g; + + if ($^O eq "MSWin32") { + $sep = ","; + } else { + $sep = " "; + } + if ($index == 0) + { + $sep = ""; + } + $cat_args .= "$sep$a"; + if ($a =~ /ev_dfg/) { + $has_evdfg = 1; + } + $index++; } - unless (open(INPUT, "cat $cat_args |")) { - die "sudden flaming death, no file: $cat_args\n"; + unless (open(INPUT, "$cat $cat_args |")) { + die "sudden flaming death, no file: $cat_args\n"; } $_ = ; @@ -361,76 +377,76 @@ sub mod_EVhandler { LINE: for (@f) { if (/NOLOCK/) { - $nolock = 1; + $nolock = 1; } if (/REMOTE/) { - $remote = 1; + $remote = 1; } if (/^extern/) { - next LINE if (/\"C\"/); - $decl = ""; - if ($nolock == 1) {$decl = "NOLOCK";} - if ($remote == 1) {$decl = "REMOTE";} - $nolock = 0; - $remote = 0; - $pending = 1; + next LINE if (/\"C\"/); + $decl = ""; + if ($nolock == 1) {$decl = "NOLOCK";} + if ($remote == 1) {$decl = "REMOTE";} + $nolock = 0; + $remote = 0; + $pending = 1; } if (($pending) && /;/) { - $decl = $decl . " " . $_; - push (@DECLS, $decl); - $pending = 0; + $decl = $decl . " " . $_; + push (@DECLS, $decl); + $pending = 0; } if ($pending) { - $decl = $decl . " " . $_; + $decl = $decl . " " . $_; } } for (@DECLS) { $nolock = 0; $remote = 0; if (/NOLOCK/) { - s/NOLOCK//g; - $nolock = 1; + s/NOLOCK//g; + $nolock = 1; } if (/REMOTE/) { - s/REMOTE//g; - $remote = 1; + s/REMOTE//g; + $remote = 1; } if (/extern\W+(\w+\W+)(\w+)\W*\((.*)\)/) { - $return = $1; - $name = $2; - $_ = $3; - s/\)//g; - s/\s+/ /g; - $return =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $return =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $return =~ s/\s*$//; #remove unnecessary white space - $return =~ s/^\s*//; #remove unnecessary white space - $return_type{$name} = $return; - $args = $_; - $arguments{$name} = "$args"; + $return = $1; + $name = $2; + $_ = $3; + s/\)//g; + s/\s+/ /g; + $return =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $return =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $return =~ s/\s*$//; #remove unnecessary white space + $return =~ s/^\s*//; #remove unnecessary white space + $return_type{$name} = $return; + $args = $_; + $arguments{$name} = "$args"; } else { if (/extern\W+(\w+\W+\w+\W+)(\w+).*\((.*)\)/) { - $return = $1; - $name = $2; - $_ = $3; - s/\)//g; - s/\s+/ /g; - $return =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space - $return =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space - $return =~ s/\s*$//; #remove unnecessary white space - $return =~ s/^\s*//; #remove unnecessary white space - $return_type{$name} = $return; - $args = $_; - $arguments{$name} = "$args"; + $return = $1; + $name = $2; + $_ = $3; + s/\)//g; + s/\s+/ /g; + $return =~ s/(?!\w)\s+(?=\W)//; #remove unnecessary white space + $return =~ s/(?!\W)\s+(?=\w)//; #remove unnecessary white space + $return =~ s/\s*$//; #remove unnecessary white space + $return =~ s/^\s*//; #remove unnecessary white space + $return_type{$name} = $return; + $args = $_; + $arguments{$name} = "$args"; } else { - print "Failed to match function2 on $_\n" + print "Failed to match function2 on $_\n" } } if ($nolock == 1) { - $nolocking{$name} = 1; + $nolocking{$name} = 1; } if ($remote == 1) { - $remote_enabled{$name} = 1; + $remote_enabled{$name} = 1; } } @@ -459,121 +475,121 @@ sub mod_EVhandler { print INT "#include \"ev_dfg_internal.h\"\n"; } print INT<cm"; - } - if (/EVmaster\W/) { - $cmanager = $name. "->cm"; - } - if (/EVdfg_stone\W/) { - $evdfg_stone = $name; - } - } - - $_ = $return_type{$subr}; - if (/^\s*void\s*$/) { - $return_type{$subr} = "void"; - } - if ($return_type{$subr} ne "void") { - print INT "\t$return_type{$subr} ret;\n"; - } - if (!defined($nolocking{$subr})) { - if (defined($cmanager)) { - print INT "\tCManager_lock($cmanager);\n"; - } else { - if (defined($cmconnection)) { - print INT "\tCManager cm = $cmconnection->cm;\n"; - } elsif (defined($evsource)) { - print INT "\tCManager cm = $evsource->cm;\n"; - } elsif (defined($cmtaskhandle)) { - print INT "\tCManager cm = $cmtaskhandle->cm;\n"; - } elsif (defined($cmformat)) { - print INT "\tCManager cm = $cmformat->cm;\n"; - } elsif (defined($evdfg)) { - print INT "\tCManager cm = $evdfg->master->cm;\n"; - } elsif (defined($evdfg_stone)) { - print INT "\tCManager cm = $evdfg_stone->dfg->master->cm;\n"; - } else { -# print INT "\tCManager cm = duh;\n"; - } - print INT "\tCManager_lock(cm);\n"; - } - } - if ($return_type{$subr} eq "void") { - print INT "\t"; - } else { - print INT "\tret = "; - } - - print INT "INT_$subr("; - $first = 1; - foreach $arg (split ( ",", $arguments{$subr})) { - if ($first != 1) { - print INT ", "; - } else { - $first = 0; - } - $_ = $arg; - if (/\W+(\w+)\W*$/) { - print INT "$1"; - } - } - print INT ");\n"; - if ((!defined($nolocking{$subr})) && ($subr ne "CManager_close")) { - if (defined($cmanager)) { - print INT "\tCManager_unlock($cmanager);\n"; - } else { - print INT "\tCManager_unlock(cm);\n"; - } - } - print INT "\treturn ret;\n" unless ($return_type{$subr} eq "void"); - print INT "}\n"; + if ($cm_only && (($subr =~ /^EV/) || ($subr =~ /^create/))) { + next; + } + print INT "\nextern $return_type{$subr}\n"; + print INT "$subr ( $arguments{$subr} )\n"; + print INT "{\n"; + undef $cmanager; + undef $cmconnection; + undef $evsource; + undef $cmtaskhandle; + undef $cmformat; + undef $evdfg; + undef $evdfg_stone; + foreach $arg (split ( ",", $arguments{$subr})) { + $_ = $arg; + if (/\W+(\w+)\W*$/) { + $name = $1; + } + if (/CManager/) { + $cmanager = $name; + } + if (/CMConnection/) { + $cmconnection = $name; + } + if (/EVsource/) { + $evsource = $name; + } + if (/CMTaskHandle/) { + $cmtaskhandle = $name; + } + if (/CMFormat\W/) { + $cmformat = $name; + } + if (/EVdfg\W/) { + $evdfg = $name; + } + if (/EVclient\W/) { + $cmanager = $name. "->cm"; + } + if (/EVmaster\W/) { + $cmanager = $name. "->cm"; + } + if (/EVdfg_stone\W/) { + $evdfg_stone = $name; + } + } + + $_ = $return_type{$subr}; + if (/^\s*void\s*$/) { + $return_type{$subr} = "void"; + } + if ($return_type{$subr} ne "void") { + print INT "\t$return_type{$subr} ret;\n"; + } + if (!defined($nolocking{$subr})) { + if (defined($cmanager)) { + print INT "\tCManager_lock($cmanager);\n"; + } else { + if (defined($cmconnection)) { + print INT "\tCManager cm = $cmconnection->cm;\n"; + } elsif (defined($evsource)) { + print INT "\tCManager cm = $evsource->cm;\n"; + } elsif (defined($cmtaskhandle)) { + print INT "\tCManager cm = $cmtaskhandle->cm;\n"; + } elsif (defined($cmformat)) { + print INT "\tCManager cm = $cmformat->cm;\n"; + } elsif (defined($evdfg)) { + print INT "\tCManager cm = $evdfg->master->cm;\n"; + } elsif (defined($evdfg_stone)) { + print INT "\tCManager cm = $evdfg_stone->dfg->master->cm;\n"; + } else { +# print INT "\tCManager cm = duh;\n"; + } + print INT "\tCManager_lock(cm);\n"; + } + } + if ($return_type{$subr} eq "void") { + print INT "\t"; + } else { + print INT "\tret = "; + } + + print INT "INT_$subr("; + $first = 1; + foreach $arg (split ( ",", $arguments{$subr})) { + if ($first != 1) { + print INT ", "; + } else { + $first = 0; + } + $_ = $arg; + if (/\W+(\w+)\W*$/) { + print INT "$1"; + } + } + print INT ");\n"; + if ((!defined($nolocking{$subr})) && ($subr ne "CManager_close")) { + if (defined($cmanager)) { + print INT "\tCManager_unlock($cmanager);\n"; + } else { + print INT "\tCManager_unlock(cm);\n"; + } + } + print INT "\treturn ret;\n" unless ($return_type{$subr} eq "void"); + print INT "}\n"; } print "done\n"; print INT<evp->fmc, (char*)id); free(id); @@ -825,27 +841,27 @@ sub mod_EVhandler { EOF foreach $subr (sort (keys %return_type)) { - defined($remote_enabled{$subr}) || next; - - print REVPH "\nextern $return_type{$subr}\n"; - $no_client_data = strip_client_data($arguments{$subr}); - $no_handler = mod_EVhandler($no_client_data); - $_ = $arguments{$subr}; - $has_client_data = 0; - if (/.*client_data\W*$/) { - $has_client_data = 1; - } - @args = split( ", ", $no_handler, 2); - if ($#args > 0) { - print REVPH "R$subr(CMConnection conn, $args[1]);\n"; - } else { - print REVPH "R$subr(CMConnection conn);\n"; - } - gen_type(${subr}, $no_handler); - gen_field_list(${subr}, $no_handler); - gen_stub(${subr}, $no_handler); - gen_wrapper(${subr}, $no_handler, $has_client_data); - gen_handler(${subr}, $no_client_data, $has_client_data); + defined($remote_enabled{$subr}) || next; + + print REVPH "\nextern $return_type{$subr}\n"; + $no_client_data = strip_client_data($arguments{$subr}); + $no_handler = mod_EVhandler($no_client_data); + $_ = $arguments{$subr}; + $has_client_data = 0; + if (/.*client_data\W*$/) { + $has_client_data = 1; + } + @args = split( ", ", $no_handler, 2); + if ($#args > 0) { + print REVPH "R$subr(CMConnection conn, $args[1]);\n"; + } else { + print REVPH "R$subr(CMConnection conn);\n"; + } + gen_type(${subr}, $no_handler); + gen_field_list(${subr}, $no_handler); + gen_stub(${subr}, $no_handler); + gen_wrapper(${subr}, $no_handler, $has_client_data); + gen_handler(${subr}, $no_client_data, $has_client_data); } print REVP<condition_var); if (NULL != response_ptr) { - *response_ptr = data; + *response_ptr = data; } CMCondition_signal(cm, response->condition_var); } @@ -866,7 +882,7 @@ sub mod_EVhandler { EV_void_response *response = (EV_void_response*) data; void **response_ptr = CMCondition_get_client_data(cm, response->condition_var); if (NULL != response_ptr) { - memcpy(response_ptr, data, sizeof(EV_int_response)); + memcpy(response_ptr, data, sizeof(EV_int_response)); } CMCondition_signal(cm, response->condition_var); } @@ -877,8 +893,8 @@ sub mod_EVhandler { EV_string_response *response = (EV_string_response*) data; EV_string_response *stub_ptr = CMCondition_get_client_data(cm, response->condition_var); if (NULL != stub_ptr) { - memcpy(stub_ptr, data, sizeof(EV_string_response)); - stub_ptr->ret = strdup(response->ret); + memcpy(stub_ptr, data, sizeof(EV_string_response)); + stub_ptr->ret = strdup(response->ret); } CMCondition_signal(cm, response->condition_var); } @@ -889,8 +905,8 @@ sub mod_EVhandler { EV_EVevent_list_response *response = (EV_EVevent_list_response*) data; EV_EVevent_list_response *stub_ptr = CMCondition_get_client_data(cm, response->condition_var); if (NULL != stub_ptr) { - memcpy(stub_ptr, data, sizeof(EV_EVevent_list_response)); - stub_ptr->ret = copy_EVevent_list(response->ret); + memcpy(stub_ptr, data, sizeof(EV_EVevent_list_response)); + stub_ptr->ret = copy_EVevent_list(response->ret); } CMCondition_signal(cm, response->condition_var); } @@ -915,7 +931,7 @@ sub mod_EVhandler { EOF print REVPH<