Re: Pre-Scheme static allocation
Michael Sperber <[email protected]> Wed, 28 Oct 2015 09:03:12 +0100
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Thomas Hintz <[email protected]> writes: > On Sat, Oct 24, 2015, at 04:44 AM, Michael Sperber wrote: >> >> Thomas Hintz <[email protected]> writes: >> >> > Greetings, >> > >> > Is it possible for Pre-Scheme to generate static array allocations? I'm >> > looking for something like: >> > >> > char hello[] = "Hello, world."; >> >> You mean: >> >> (define hello "Hello, world.") >> >> ? (Probably not, but I'm not really sure what you mean.) > > That does not seem to do what I want to do. > > Maybe I'm missing something with the type inference system or the API. > Here is an example of what I would like to do: > > (unsigned-byte-ref "hello world") So you want the other direction. I believe there isn't a operation in PreScheme currently that does this. But it should be easy to add a procedure string->char-pointer if you just follow the example of `char-pointer->string`. But what you're trying to do still seems odd to me - maybe you can provide a little bit more background on why you're trying to do this? (I.e. why not just `(string-ref "hello-world" 0)`.) -- Regards, Mike