newlisp/2 a newlisp for OS/2

Started by newdep, July 21, 2006, 01:10:12 PM

Previous topic - Next topic

newdep

Im currently staring to port newlisp to OS/2  ;-)



Yes that might sound odd but i have been for years a great OS/2 fan and i just

setup ecomstation and wil use OS/2 again... but not without newlisp ;-)





To start it all here is the types.c output for OS/2  as you can see there is no wchar_type

of 4 but only of 2 ...is that an issue?







type      bytes

---------------

char      1

char *    4

void *    4

short int 2

int       4

long      4

long int  4

long long 8

float     4

double    8

wchar_t   2        

jmp_buf   52







Norman.
-- (define? (Cornflakes))

newdep

#1
I have different choices of compilers.. I was thinking on doing the port with GCC-3.3.5

but i did a tryout with openwatcom ->



** wich as it seems doesnt eat any Signals

** different dirent.h  termios.h and wait.h (those are in gcc btw ;-)







wmake -f C:project2.mk -h -e

wcc386 utilsprogNLnewlisp-8.9.0newlisp.c -i=C:watcomh;C:watcomhos2 -w4 -e25 -zq -od -d2 -5r -bt=os2 -mf

utilsprogNLnewlisp-8.9.0newlisp.h(49): Error! E1055: Unable to open 'dirent.h'

utilsprogNLnewlisp-8.9.0newlisp.h(76): Error! E1055: Unable to open 'termios.h'

utilsprogNLnewlisp-8.9.0newlisp.h(77): Error! E1055: Unable to open 'sys/wait.h'

utilsprogNLnewlisp-8.9.0newlisp.c(300): Error! E1011: Symbol 'SIGALRM' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(301): Error! E1011: Symbol 'SIGVTALRM' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(302): Error! E1011: Symbol 'SIGPROF' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(303): Error! E1011: Symbol 'SIGPIPE' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(304): Error! E1011: Symbol 'SIGCHLD' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(378): Error! E1011: Symbol 'SIGPIPE' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(378): Error! E1054: Expression must be constant

utilsprogNLnewlisp-8.9.0newlisp.c(381): Error! E1011: Symbol 'SIGALRM' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(381): Error! E1054: Expression must be constant

utilsprogNLnewlisp-8.9.0newlisp.c(382): Error! E1011: Symbol 'SIGVTALRM' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(382): Error! E1054: Expression must be constant

utilsprogNLnewlisp-8.9.0newlisp.c(383): Error! E1011: Symbol 'SIGPROF' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(383): Error! E1054: Expression must be constant

utilsprogNLnewlisp-8.9.0newlisp.c(391): Error! E1011: Symbol 'SIGCHLD' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(391): Error! E1054: Expression must be constant

utilsprogNLnewlisp-8.9.0newlisp.c(392): Error! E1011: Symbol 'WNOHANG' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(658): Error! E1011: Symbol 'ostype' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(757): Error! E1011: Symbol 'ostype' has not been declared

utilsprogNLnewlisp-8.9.0newlisp.c(392): Warning! W131: No prototype found for function 'waitpid'

utilsprogNLnewlisp-8.9.0newlisp.c(3006): Warning! W131: No prototype found for function 'isnan'

utilsprogNLnewlisp-8.9.0newlisp.c(5227): Warning! W131: No prototype found for function 'execv'

Error(E42): Last command making (C:projectnewlisp.obj) returned a bad status

Error(E02): Make execution terminated

Execution complete





** Ill try again but now with GCC !!
-- (define? (Cornflakes))

newdep

#2
Oke i did some investigation on GCC and there are some uncomming parts

between POSIX and OS/2  (is not 100% posix)



So i need to rewrite the signals part and others... well there is nu hurry ;-)



Keep you informed...
-- (define? (Cornflakes))

pjot

#3
Interesting! Keep up the good spirit ;-)



The signalling stuff will probably become a problem though, but you always can leave them out your newLisp port using a macro.



Peter

newdep

#4
Oke got GCC3.3.5 to compile the types.c without errors... it was a bit of a struggle

getting the right packages in place... here the OS/2 types.c

(which are ofcourse the same as the cmpiled watcom version ;-)





type      bytes

---------------

char      1

char *    4

void *    4

short int 2

int       4

long      4

long int  4

long long 8

float     4

double    8

wchar_t   2
-- (define? (Cornflakes))

newdep

#5
Oooo yes I have got a whole list of tricks to handle to get newlisp towards OS/2

but sofar i have all the docs i need... Ill drop inhere when im realy desperate ;-)
-- (define? (Cornflakes))

newdep

#6
The first OS/2 newlisp version is compiled ;-)

I cant say if everything is running fine yet because i have some problems

with executing arguments from the commandline..



But newlisp 8.0.2 (yes old version) is compiled ;-) ->

(Ooo yes ..dont look at the Filesize ;-)





[C:utilsprognlnewlisp-8.0.2]make os2

make -f makefile_os2

make[1]: Entering directory `C:/utils/prog/nl/newlisp-8.0.2'

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 newlisp.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-symbol.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-math.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-list.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-liststr.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-string.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-filesys.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-sock.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-import.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-xml.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-web.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-matrix.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 nl-debug.c

gcc -Wall -Wno-uninitialized -O2 -c -g -DOS2 -DOPSYS=10 pcre.c

gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matri

x.o nl-debug.o pcre.o -g -lm -o newlisp.exe

make[1]: Leaving directory `C:/utils/prog/nl/newlisp-8.0.2'



[C:utilsprognlnewlisp-8.0.2]ls -al newlisp.exe

-rwxrwx--a   808305 Jul 28 16:13 newlisp.exe



[C:utilsprognlnewlisp-8.0.2]newlisp

newLISP v8.0.2 Copyright (c) 2004 Lutz Mueller. All rights reserved.



> (sys-info)

(264 268435456 261 1 0 1024 8002 10)

> (exit)







Enjoy... ill keep you informed...



Norman.
-- (define? (Cornflakes))

newdep

#7
compiled newlisp with gcc 3.3.5 for OS/2



pipes, process , ! and semaphores will be different and

need to be manualy adjusted.. for now 8.10 runs without those..



here is the qa of 8.1.0 (2004)





testing-> !------- different on OS/2, test skipped!



testing-> !=

testing-> $

testing-> %

testing-> &

testing-> *

testing-> +

testing-> -

testing-> /

testing-> <

testing-> <<

testing-> <=

testing-> =

testing-> >

testing-> >=

testing-> >>

testing-> NaN?

testing-> ^

testing-> abs

testing-> acos

testing-> add

testing-> address

testing-> and

testing-> append

testing-> apply

testing-> args

testing-> array

testing-> array-list

testing-> array?

testing-> asin

testing-> assoc

testing-> atan

testing-> atan2

testing-> atom?

testing-> begin

testing-> beta

testing-> betai

testing-> binomial

testing-> break

testing-> case

testing-> catch

testing-> ceil

testing-> change-dir

testing-> char

testing-> chop

testing-> close

testing-> collect

testing-> command-line

testing-> cond

testing-> cons

testing-> constant

testing-> context

testing-> context?

testing-> copy-file

testing-> cos

testing-> count

testing-> cpymem

testing-> crit-chi2

testing-> crit-z

testing-> current-line

testing-> date

testing-> date-value

testing-> debug

testing-> dec

testing-> define

testing-> define-macro

testing-> delete

testing-> delete-file

testing-> device

testing-> difference

testing-> directory

testing-> directory?

testing-> div

testing-> dolist

testing-> dotimes

testing-> dotree

testing-> dump

testing-> dup

testing-> empty?

testing-> encrypt

testing-> ends-with

testing-> env

testing-> environ

testing-> error-event

testing-> error-number

testing-> error-text

testing-> eval

testing-> eval-string

testing-> exectesting exectesting read-processtesting write-process

testing-> exit

testing-> exp

testing-> explode

testing-> fft

testing-> file-info

testing-> file?

testing-> filter

testing-> find

testing-> first

testing-> flat

testing-> float

testing-> float?

testing-> floor

testing-> for

testing-> format

testing-> fv

testing-> gammai

testing-> gammaln

testing-> get-char

testing-> get-float

testing-> get-integer

testing-> get-string

testing-> get-url

testing-> getenv

testing-> global

testing-> if

testing-> ifft

testing-> import

testing-> inc

testing-> index

testing-> integer

testing-> integer?

testing-> intersect

testing-> invert

testing-> irr

testing-> join

testing-> lambda?

testing-> last

testing-> length

testing-> let

testing-> list

testing-> list?

testing-> load

testing-> log

testing-> lookup

testing-> lower-case

testing-> macro?

testing-> main-args

testing-> make-dir

testing-> map

testing-> match

testing-> max

testing-> member

testing-> min

testing-> mod

testing-> mul

testing-> multiply

testing-> name

testing-> net-accept

testing-> net-close

testing-> net-connect

testing-> net-error

testing-> net-listen

testing-> net-local

testing-> net-lookup

testing-> net-peek

testing-> net-peer

testing-> net-receive

testing-> net-receive-from

testing-> net-receive-udp

testing-> net-select

testing-> net-send

testing-> net-send-to

testing-> net-send-udp

testing-> net-service

testing-> net-sessions

testing-> new

testing-> normal

testing-> not

testing-> now

testing-> nper

testing-> npv

testing-> nth

testing-> nth-set

testing-> open

testing-> or

testing-> pack

testing-> parse

testing-> pipe------- different on OS/2, test skipped!



testing-> pmt

testing-> pop

testing-> post-url

testing-> pow

testing-> pretty-print

testing-> primitive?

testing-> print..........

testing-> println ->line feed



testing-> prob-chi2

testing-> prob-z

testing-> process------- different on OS/2, test skipped!



testing-> push

testing-> put-url

testing-> putenv

testing-> pv

testing-> quote

testing-> quote?

testing-> rand

testing-> random

testing-> read-buffer

testing-> read-char

testing-> read-file

testing-> read-line

testing-> ref

testing-> regex

testing-> remove-dir

testing-> rename-file

testing-> replace

testing-> replace-assoc

testing-> reset

testing-> rest

testing-> reverse

testing-> rotate

testing-> save

testing-> search

testing-> seed

testing-> seek

testing-> select

testing-> sequence

testing-> series

testing-> set

testing-> set!

testing-> set-locale

testing-> set-nth

testing-> setq

testing-> silent

testing-> sin

testing-> sleepSleeping ..

testing-> slice

testing-> sort

testing-> source

testing-> sqrt

testing-> starts-with

testing-> string

testing-> string?

testing-> sub

testing-> swap

testing-> symbol

testing-> symbol?

testing-> symbols

testing-> sys-info

testing-> tan

testing-> throw

testing-> time

testing-> time-of-day

testing-> trace

testing-> trace-highlight

testing-> transpose

testing-> trim

testing-> unique

testing-> unless

testing-> unpack

testing-> until

testing-> upper-case

testing-> while

testing-> write-buffer

testing-> write-char

testing-> write-file

testing-> write-line...



testing-> xml-error

testing-> xml-parse

testing-> xml-type-tags

testing-> |

testing-> ~



finished testing built in primitives



Testing contexts as objects, scoping rules and inheritance

local symbols ... Ok

inheritance ... Ok

do not inherit context vars ... Ok

inheriting redefined primitives ... Ok

context defs not overwriting MAIN ... Ok

accessing methods in contexts ... Ok

using contexts in vars ... Ok

mapping on context vars ... Ok

dynamic symbol in defined symbol ... Ok

set with dynamic context vars ... Ok

set! with dynamic context vars ... Ok

setq with dynamic context vars ... Ok

define with dynamic context vars ... Ok

inc with dynamic context vars ... Ok

dec with dynamic context vars ... Ok

dynamic var inside context with ref to nonexisiting ... Ok

dynamic var inside context with ref to exisiting ... Ok



Finished



newLISP v8.1.0 Copyright (c) 2004 Lutz Mueller. All rights reserved.



>
-- (define? (Cornflakes))

newdep

#8
All tests do now work for 8.1.0 release with GCC

All functionality from newlisp-8.1.0 is working!





A website will shortly be setup for the OS/2 informtion on newlisp OS/2 port.



Enjoy, Norman.
-- (define? (Cornflakes))

newdep

#9
newlisp.exe 8.2.0 for OS/2 (v4.0+) can be downloaded here ->



http://www.nodep.nl/downloads/newlisp/newlisp2.exe.gz">http://www.nodep.nl/downloads/newlisp/newlisp2.exe.gz





some extra info ->

http://newlisp.nodep.nl/newlisp2.html">http://newlisp.nodep.nl/newlisp2.html





enjoy newlisp on a real Multitasking machine -)
-- (define? (Cornflakes))

newdep

#10
changed compiler options and reduced the size from 880Kb to 220Kb..

(file is at download site , see above)







newlisp 8.3.0 port is starting, and this will be a pain ;-)
-- (define? (Cornflakes))

newdep

#11
newlisp 8.9.1 compiled on OS/2 v4+





[C:utilsprognlnewlisp-8.9.1]newlisp

newLISP v.8.9.1 on OS/2 v4+, execute 'newlisp -h' for more info.



> (sys-info)

(327 268435456 323 1 0 2048 8901 10)

>





you can find it on the above url.





remarks:



This is a cimpled version only, testing is still in progress ! ;-)

mmap is not supported on OS/2 by default (share) always returns 'nil

semaphores, process, exec, fork, !, networking and file i/o do function

though i did not test it individualy.



the qa-dot output currently delivered with newlisp is not proper for OS/2

and will fail on some parts. Though executing those parts individualy they function fine.



Enjoy, Norman.





-- (define? (Cornflakes))

newdep

#12
some working proof  on OS/2 ->





[C:utilsprognlnewlisp-8.9.1]newlisp ../sudoku.lsp

Generating sudoku solution: !1!2!3!4!5!6!7!8!9 (59883)

Generating game from sudoku solution.





  2     | 7 1   |     5

    9   |   3   |   8 4

  3 8   | 4 9   |

  ----- + ----- + -----

    7   |   2 1 |   4

  9 4 3 |       | 1

  5   1 |     6 |     3

  ----- + ----- + -----

  6 3   | 8     | 4

    5   | 1 6 3 |

  7 1   |   5   |   6









[C:utilsprognlnewlisp-8.9.1]newlisp ../pascal.lsp



This program shows Pascal's Triangle.



If the results do not fit on your screen, redirect

to a file, for example: newlisp pascal.lsp > results.txt



How many lines of the triangle must be calculated? 10



                              1

                           1     1

                        1     2     1

                     1     3     3     1

                  1     4     6     4     1

               1     5     10    10    5     1

            1     6     15    20    15    6     1

         1     7     21    35    35    21    7     1

      1     8     28    56    70    56    28    8     1

   1     9     36    84    126   126   84    36    9     1

1     10    45    120   210   252   210   120   45    10    1







> (load "http://www.nodep.nl/downloads/newlisp/latin.lsp">http://www.nodep.nl/downloads/newlisp/latin.lsp")



--- Running!



(1 4 2 3 5)

(4 1 5 2 3)

(5 2 3 4 1)

(2 3 1 5 4)

(3 5 4 1 2)



--- 12 milliseconds timed!
-- (define? (Cornflakes))

Lutz

#13
Congratulations! I have linked to your OS/2 page on:



http://newlisp.org/index.cgi?page=Downloads">http://newlisp.org/index.cgi?page=Downloads



Lutz

newdep

#14
I think im currently the only OS/2 newlisp user in the world..



But never the less here is an update on the current release...



- pipes do not close sessions properly! (investigating...)

- fork, semaphores, exec, ! and process work without the use of pipes!





Unsupported functions in OS/2 release:

(unicode) There is no support for UTF-8 compiled

(share) is assigned to always returns 'nil (OS/2 does not have mmap())





Enjoy, Norman.
-- (define? (Cornflakes))