[gambit-list] null device on windows

Mikael mikael.rcv at gmail.com
Sat Apr 13 10:41:17 EDT 2013


Hi Ralph!

Yeah Black Hole on Windows is completely relevant.

Re BH, you may be interested in checking out the nonsyntactic tower version
at https://github.com/pereckerdal/blackhole/tree/legacy as that one is most
tested and tried currently.

You find a current version of this nicely bundled on
http://dynamo.iro.umontreal.ca/wiki/index.php/Dumping_Grounds#Module_systems
under
the download link
http://dynamo.iro.umontreal.ca/wiki/images/6/64/2012-11-28-bh-non-syntactictower%2Bbundled-libs.tar.gz.

For installation please refer to the mailing list post of 2012-11-29.

Further updates are coming to Black Hole, at a currently unspecified date.

I would guess it works great on Windows either directly or with some trivla
tweak, feel free to let the list know.


Now, did this solve your problem, or do you by some reason want to proceed
with digging into the (compile-file-to-target "/dev/null" ... issue with
syntactictower BH?

Mikael

2013/4/13 Ralph Moritz <ralph.moeritz at outlook.com>

> On Unix the null device is /dev/null. On Windows NT+ the equivalent is
> NUL. We can verify this by writing the following small C++11 program:
>
> #include <cstdio>
> int main() {
>   auto f = fopen("NUL", "r");
>   if (f == nullptr) {
>     fprintf(stderr, "Cannot open file `NUL'.");
>     return 0;
>   }
>   printf("Opened file `NUL' successfully.");
> }
>
> The above program, when compiled and run on Windows, will always print
> "Opened file `NUL' successfully."
>
> This brings me to Gambit, via Black Hole. BH contains some code (in
> compile-load.scm and lib.scm) that assumes `/dev/null' exists. This is
> obviously not true on Windows where instead we have `NUL'. It's easy
> enough to modify BH accordingly but the problem remains that Gambit
> tries to normalize all paths passed to `compile-file-to-target' so we
> end up with `<absolute path to cwd>\NUL' instead of just `NUL'. This
> essentially prevents us from using the null device as input to
> `compile-file-to-target' on Windows & means the following code from BH
> will fail on Windows:
>
> (define (compile-sexp-to-c sexp
>                            fn
>                            #!key
>                            (options '()))
>   (##gc) ;; Avoid out-of-memory related crashes
>   (let ((hook (lambda (_) sexp))
>         (prev-hook #f))
>     (dynamic-wind
>         (lambda ()
>           (set! prev-hook c#expand-source)
>           (set! c#expand-source hook))
>         (lambda ()
>           (compile-file-to-target "/dev/null" ;; Change to "NUL" on Windows
>                              output: fn
>                              options: options))
>         (lambda ()
>           (set! c#expand-source prev-hook)))))
>
> I've searched through the Gambit source code & tried to make the
> necessary changes to get this working but have been unable to do so. I
> probably just don't yet have a good enough understanding of the
> code. (I tried modifying ___os_path_normalize_directory in
> lib/os_files.c)
>
> Is anyone able to help with this? I really want to run Black Hole on
> Windows!
>
> Many thanks,
> Ralph
>
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130413/f9534149/attachment.htm>


More information about the Gambit-list mailing list