On Tuesday, 23 October 2012 at 19:10:29 UTC, Jacob Carlborg wrote:
On 2012-10-23 19:42, Brad Lanam wrote:
All of these don't use the same shell. Requiring to install
bash would mean you do need to install special tools. Not
really special but additional tools. But I would count Cygwin
as a special tool for Windows.
Oh, maybe were you thinking that bash is the bourne shell? It's
the
bourne-again shell, a rewrite of the bourne shell. Solaris sh is
probably the closest to the original bourne shell.
My tool runs with any bourne shell compatible shell. It works
with bash2, bash3, bash4, ksh, ksh88, ksh93, Solaris sh, Tru64 sh,
ash, dash, mksh, pdksh. HP-UX sh.
If you need to write code that runs on multiple systems and
works with
low level system calls (rpc, et.al.), my tool might be a
better choice.
Why would that make a difference.
Not all systems are alike.
static if (_c_args_setmntent == 1)
{
f = setmntent (toStringz(DI_MOUNT_FILE));
} else static if (_c_args_setmntent == 2) {
f = setmntent (toStringz(DI_MOUNT_FILE),
toStringz("r"));
}
If I understand your tool correctly, you might convert the
mount.h or
mntent.h file [but how does your program decide which one and
even if
they exist?]. But then how are you going to change your code
to handle
the above? You've got a *lot* of work to do if you want a
cross
platform tool.
I recommend SWIG+CMAKE. Or my 'mkconfig' tool.
Well then, how does your tool work?
You put directives in the "interface file" (to use the SWIG term)
to test which capabilities the system has. It creates an output
file (.sh, .c, .d). Depending on those capabilities, the code can
use #if or static if statements to provide code that works for
the system you are building on.
In the case of the C/D language interface, the directives will
extract typedefs, structures, C function declarations, macros,
#defines.