On Fri, 10 Nov 1995, Ed Peschko wrote:
> What I was thinking about was stripping apart existing commands (implementations
> of ls, etc) and coding them as C calls (which then could be interfaced into
> perl without shell.) This is prefaced on the supposition that there *are*
> portable versions of ls/pwd/cd/etc.. out there. Which may be a mistake, in which
> case, yes, they would have to be recoded in perl.
Look at BSD or GNU. Yes, the code exists. OK, I see where you are coming
from here... I suppose you could take all of ls, pwd, etc., and wrap them
into XSUB code.
> As for the ultra-specific stuff, there should be some 'semi-automatic code
> wrangler' which rips apart the code just like the generic, and then puts
> it together as a library call (based on argc, argv) which then could be linked
> to perl.
Heck, you'd practically just need to re-link the stuff, so main() gets
called by your own wrapper function. You'd pass in argc and argv from the
perl argument stack, and set up pipes for stdout, stderr, etc. Heck, why
not make this function part of perl, and call it backticks? :-)
> Again -- as much of the manual stuff should be handled (probably by
> perl itself, including the interface to perl's internal variable types).
XSUB!
> I have no doubts that this would be real tricky -- for one, global variables
> would be tough to handle (variable conflicts), figuring out how to incorporate
> existing Makefiles with this process, dealing with #defines, non standard code
> (without argc argv), etc.. But I wouldn't say it was impossible.
Exactly the sort of thing you have to deal with when pulling in all sorts
of libraries to use in XSUB code.
> As for the reason why I think this is so important -- I know firsthand the
> reaction of several technical managers when they were looking at code that was
> *not* fully portable was put out for sale on the marketplace.
> Needless to say, it was ugly.
>
> They looked at the most nit-picky things without concentrating on the core
> functionality..
>
> *sigh*
>
> That's why I look forward to a perl compiler, and that's why I think it is worth
> the effort to make perl as compile ready as can be...
This is a separate issue from compiling. _Really_. If you want to do
anything like this, feel free to do it via the existing XS mechanism.
Since XSUB's can be statically linked into perl, that solves the
"compiling" problem. (And doesn't impact one way or another the much
harder task of actually compiling perl code.)
> Ed
--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)