* Suggestion: c library access
@ 1999-12-16 20:56 Jan Kroken
1999-12-16 22:08 ` Mike Fletcher
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kroken @ 1999-12-16 20:56 UTC (permalink / raw)
To: zsh-workers
I have a suggestion for a (far) future Zsh enhancement. What if you
could load libraries, and call functions from them on the command line?
Imagine the following script which uses a function float pow(float,float):
---BEGIN---
#!/bin/zsh
LIBM 0 $(((load-library libm)))
return_function c_pow (){
Y=$(((float-to-shell $(((exec-library-function $LIBM "pow" \
$(((shell-to-float $1))) \
$(((shell-to-float $2)))))))))
return Y
}
A=2.0 B=2.0
C=$(c_pow $A $B)
$(((free-library $LIBM)))
---END---
would this be an idea?
--
-jk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Suggestion: c library access
1999-12-16 20:56 Suggestion: c library access Jan Kroken
@ 1999-12-16 22:08 ` Mike Fletcher
0 siblings, 0 replies; 4+ messages in thread
From: Mike Fletcher @ 1999-12-16 22:08 UTC (permalink / raw)
To: Jan Kroken; +Cc: zsh-workers
>>>>> "Jan" == Jan Kroken <jankr@ifi.uio.no> writes:
Jan> I have a suggestion for a (far) future Zsh enhancement. What
Jan> if you could load libraries, and call functions from them on
Jan> the command line?
If you've got a perl XS wrapper for your library, you could
use the embedded perl module to use that from zsh.
http://www.phydeaux.org/perl/zperl-0.01.patch.gz
This was back against plain 3.1.6, so it might not work
against pws-12. Of course I'm going on vacation for a week+ in a
little while so version 0.02 probably will work with pws-12 soon. :)
--
Fletch | "If you find my answers frightening, __`'/|
fletch@phydeaux.org | Vincent, you should cease askin' \ o.O'
678 443-6239(w) | scary questions." -- Jules =(___)=
| U
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Suggestion: c library access
1999-12-17 9:08 Sven Wischnowsky
@ 1999-12-20 22:23 ` Peter Stephenson
0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1999-12-20 22:23 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky wrote:
> This reminded me: mathfunc uses drem(), but at least the Solaris 5.6 I
> have access to here doesn't seem to have that.
It's not worth testing for, let's remove it.
--- Doc/Zsh/mod_mathfunc.yo.mf Mon Dec 20 21:50:37 1999
+++ Doc/Zsh/mod_mathfunc.yo Mon Dec 20 21:50:06 1999
@@ -37,7 +37,7 @@
expresssions.
The following functions take two floating point arguments: tt(copysign),
-tt(drem), tt(fmod), tt(hypot), tt(nextafter).
+tt(fmod), tt(hypot), tt(nextafter).
The following take an integer first argument and a floating point second
argument: tt(jn), tt(yn).
--- Src/Modules/mathfunc.c.mf Mon Dec 20 21:22:36 1999
+++ Src/Modules/mathfunc.c Mon Dec 20 21:49:51 1999
@@ -45,7 +45,6 @@
MF_COPYSIGN,
MF_COS,
MF_COSH,
-MF_DREM,
MF_ERF,
MF_ERFC,
MF_EXP,
@@ -131,7 +130,6 @@
NUMMATHFUNC("copysign", math_func, 2, 2, MF_COPYSIGN),
NUMMATHFUNC("cos", math_func, 1, 1, MF_COS),
NUMMATHFUNC("cosh", math_func, 1, 1, MF_COSH),
- NUMMATHFUNC("drem", math_func, 2, 2, MF_DREM),
NUMMATHFUNC("erf", math_func, 1, 1, MF_ERF),
NUMMATHFUNC("erfc", math_func, 1, 1, MF_ERFC),
NUMMATHFUNC("exp", math_func, 1, 1, MF_EXP),
@@ -294,10 +292,6 @@
case MF_COSH:
retd = cosh(argd);
- break;
-
- case MF_DREM:
- retd = drem(argd, argd2);
break;
case MF_ERF:
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Suggestion: c library access
@ 1999-12-17 9:08 Sven Wischnowsky
1999-12-20 22:23 ` Peter Stephenson
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-12-17 9:08 UTC (permalink / raw)
To: zsh-workers
Jan Kroken wrote:
> I have a suggestion for a (far) future Zsh enhancement. What if you
> could load libraries, and call functions from them on the command line?
>
> Imagine the following script which uses a function float pow(float,float):
Well, this special case is already handled with the mathfunc
module. Otherwise... interesting idea, are you volunteering?
This reminded me: mathfunc uses drem(), but at least the Solaris 5.6 I
have access to here doesn't seem to have that.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-12-20 22:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-16 20:56 Suggestion: c library access Jan Kroken
1999-12-16 22:08 ` Mike Fletcher
1999-12-17 9:08 Sven Wischnowsky
1999-12-20 22:23 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).