[EROS-Arch] CapIDL, C and expeptions
Constantine Plotnikov
cap@novosoft.ru
Mon, 19 Mar 2001 23:13:25 +0600
This is a multi-part message in MIME format.
------=_NextPart_000_0261_01C0B0CA.33682700
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset="koi8-r"
Hi!
When programming for SOM (OS/2 System Object Model) I have=20
seen following pattern for handling exceptions in C.
Environment env;
init_env(&env);
...
rc =3D call_somthing(&env, obj, arg1, arg2);
if(env.hasException)
{
// handle problem
}
else
{
// use return code
}
...
I think that it is an good compromise between high level langugages and=20
C binding and it will not reserve return values. I have seen similar =
interface=20
in native binding of some programming language, but do not remeber which =
one. The variant was:
Environment env =3D init_env();
...
rc =3D call_somthing(env, obj, arg1, arg2);
if(env.hasException)
{
// handle problem
}
else
{
// use return code
}
...
free_env(env);
Considering that eros components are single threaded concurrency=20
is not an problem and first varaint could be used.
I'm also interested to see "Dynamic Invocation Interface" for =
capabilities
defiend for interfaces. This interface if it will standard will simplify
writing scripting languages for EROS.=20
Constantine
------=_NextPart_000_0261_01C0B0CA.33682700
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset="koi8-r"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When programming for SOM (OS/2 =
System Object=20
Model) I have </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>seen following pattern for handling =
exceptions in=20
C.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Environment env;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>init_env(&env);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>rc =3D call_somthing(&env, obj, =
arg1,=20
arg2);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if(env.hasException)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> // handle problem</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>else</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> // use return code</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I think that it is an good compromise =
between high=20
level langugages and </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>C binding and it will not reserve =
return values. I=20
have seen similar interface </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>in native binding of some programming =
language, but=20
do not remeber which </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>one. The variant was:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Environment env =3D </FONT><FONT =
face=3DArial=20
size=3D2>init_env();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>rc =3D call_somthing(env, obj, arg1,=20
arg2);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if(env.hasException)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> // handle problem</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>else</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> // use return code</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>free_env(env);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Considering that eros components <FONT =
face=3DArial=20
size=3D2>are single threaded concurrency </FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2>is not an =
problem and first=20
varaint could </FONT><FONT face=3DArial size=3D2>be =
used.</FONT></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm also interested to see "Dynamic =
Invocation=20
Interface" for capabilities</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>defiend for interfaces. This interface =
if it will=20
standard will simplify</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>writing scripting languages for=20
EROS. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Constantine</FONT></DIV></BODY></HTML>
------=_NextPart_000_0261_01C0B0CA.33682700--