Spivoxity / obc-3

Oxford Oberon-2 compiler
38 stars 7 forks source link

XYplane is not provided under Windows #18

Closed Spivoxity closed 3 years ago

Spivoxity commented 5 years ago

I could experiment with building under Cygwin/X and running with Xming.

Probably a separate runtime "obxjx" would be needed to avoid making all Oberon binaries depend on X being installed. Either that, or solve the problem of dynamic loading.

A better proposal would be to cut out the X layer and make a direct implementation of XYplane for Windows.

rerunner commented 3 years ago

Hi Spivoxity,

XYplane works well with Windows 10 when using Cygwin/X (32 bits version). I only needed to correct two very minor issues (changing _MAXPATH to MAXPATH and commenting out one instance of a double defined function).

The Tartan test succeeds and shows the lines test, I also compiled and run the BarnsleyFern code from the rosetta code website, which also runs perfectly in Cygwin/X.

Thanks for the great work.

Spivoxity commented 3 years ago

Thanks for the info. Would you like to send me a patch?

rerunner commented 3 years ago

No problem, I will create one. I just forked your code so that I can check it in this evening.

rerunner commented 3 years ago

I pushed the patch to my fork of obc-3, the commit with the changes is here:

https://github.com/rerunner/obc-3/commit/b2f1d89b8d7e34b0d6f5eab78188d86b1dd7b0ba

Cheers.

Spivoxity commented 3 years ago

Here's a patch. It fixes two problems:

  1. _MAX_PATH is called MAX_PATH under Cygwin
  2. Ifdefs on Cygwin result in both the Unix and the Windows implementations of get_chunk (gc.c) being selected.

If Cygwin is to become a supported target, it seems desirable to sort out the ifdefs to get a planned, consistent result. On amd64, that means sorting out whether the Windows calls or Cygwin's emulation of mmap provide the best way of allocating storage addressible by 32-bit pointers.

cygwin.patch.txt

Spivoxity commented 3 years ago

It's probably best to use the Windows calls for memory allocation, and not try to rely on cygwin's emulation of mmap. So on Windows HAVE_MMAP needs to be forcibly disabled. Does the emulation support 32-bit addresses on Win64 at all?