[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gforth] Using Gforth with #! "shebang"
From: |
Bernd Paysan |
Subject: |
Re: [gforth] Using Gforth with #! "shebang" |
Date: |
Wed, 21 Nov 2012 15:54:07 +0100 |
User-agent: |
KMail/4.8.5 (Linux/3.4.11-2.16-desktop; KDE/4.8.5; x86_64; ; ) |
Am Mittwoch, 21. November 2012, 15:40:15 schrieb David Kuehling:
> According to stack overflow
>
> http://stackoverflow.com/questions/4303128/spam-urls-suck#tab-top
>
> there's no way to do multi-argument shebang. As Andrew pointed out,
> multi-line shebangs that do an intermediate invocation of /bin/sh on the
> same source file are the way to go. There are even a few languages that
> have support for multi-line shebang in that they have keywords that can
> be used to escape a few lines of header to be only parsed by the shell
> without interfering with shell invocation. I like the way it's handled
> in Common Lisp:
>
> http://rosettacode.org/wiki/Multiline_shebang#Common_Lisp
>
> I guess we could easily add the same syntax to Gforth.
Yes, but
' ( alias #( immediate
would be even easier to implement, and then your multiarg shebang is
#! /bin/sh
#(
exec gforth-fast --options
exit
)
> I'd also be happy if Gforth allwed to resize the dictionary and stacks
> at runtime :)
Since we use mmap to allocate them, this should not be that hard. The resized
stacks can be copied (i.e. allocate new stacks, copy the old stacks, move the
pointers, deallocate the old stack). Resizing the dictionary would require to
reserve a large chunk of memory via mmap+mprotect, this is doable (this will
still allow you to catch errors from allocating too much). What we can't do
is move the dictionary to a new resized region.
What you can is to create your own image with changed default stack and
dictionary sizes. Just invoke gforthmi with
gforthmi gforth-large.fi -d 256M ...
(no other parameter than the sizes), and then write your script with the one
single argument you need:
#! /usr/local/bin/gforth-fast --image=/your/path/gforth-large.fi
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/
signature.asc
Description: This is a digitally signed message part.
- [gforth] Using Gforth with #! "shebang", David Kuehling, 2012/11/20
- Re: [gforth] Using Gforth with #! "shebang", Andrew Pennebaker, 2012/11/20
- Re: [gforth] Using Gforth with #! "shebang", Anton Ertl, 2012/11/21
- Re: [gforth] Using Gforth with #! "shebang", David Kuehling, 2012/11/21
- Re: [gforth] Using Gforth with #! "shebang",
Bernd Paysan <=
- Re: [gforth] Using Gforth with #! "shebang", Anton Ertl, 2012/11/21
- Re: [gforth] Using Gforth with #! "shebang", Bernd Paysan, 2012/11/21
- Re: [gforth] Using Gforth with #! "shebang", David Kuehling, 2012/11/21
- Re: [gforth] Using Gforth with #! "shebang", Bernd Paysan, 2012/11/22
- Re: [gforth] Using Gforth with #! "shebang", Anton Ertl, 2012/11/22
- Re: [gforth] Using Gforth with #! "shebang", Bernd Paysan, 2012/11/22
- Re: [gforth] Using Gforth with #! "shebang", Bernd Paysan, 2012/11/21