Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Maurizio

#1
The following program shows a frame with only 4 columns instead of 5.

Is this a bug ?

I'm trying with the last NewLisp version and java (jdk) 1.8.0_74.



Best regards.

Maurizio.


(set-locale "C")
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))

(gs:init)

(gs:frame 'window 100 100 400 300 "my test")
(gs:set-grid-layout 'window 3 5)

(dolist (btn '("one" "two" "three" "four" "five" "six" "seven" "height" "nine" "ten"  "eleven"))
  (gs:button (sym btn) 'gs:no-action btn 75 25)
  (gs:add-to 'window (sym btn)))
   
(gs:set-visible 'window true)

(gs:listen)
#2
I'd like very very very much if newlisp were portable.

I mean :

it should not depends on any environment variable. (why newlispdir ?)

it should not have the need of a work directory (tmp directory in http mode)

or, if really needed, a subdir of the starting directory,

or, at least, a directory specified on the command line.

I'd like to have newlisp.exe and all my files in a directory (with subdirs) that i can

freely move aroud my disk, or zip and send to my friends, or copy in a stick and carry around.



Best regards.

Maurizio.
#3
newLISP Graphics & Sound / Suggestion about form layouts
September 19, 2007, 07:19:53 AM
Would be fine to have a chapter about laying out forms, better if with some example. I find the topic a little difficult.

I'd like to build forms having a similar layout :





    Please enter your information:

   first name: XXXXXXXXXXXXXXX
    last name: XXXXXXXXXXXXXXX
          age: XXX
       
          OK   CANCEL  

Please note he following:

The labels should be right aligned, while the input fields left aligned.

The two buttons OK and Cancel should have equal size.

Resizing the form should mantain the alignment of the labels/fields

and they should be orizontally centered in the form.

The space betweeen the labels and the input field should grow as the form is enlarged, but it should have a minimun size.

The form should have a fixed empty vertical space both at the top and at the bottom, and a minimun space should exist between the last row and the buttons.

The other rows should be vertically proportionally spaced.

Any suggestion ?

Regards

Maurizio
#4
I've installed newLisp Ide in c:programminewlisp

(that is, I have a directory c:programminewlispide containing

index.html, editor-frame.html, etc...



I made a desktop link to start the server as the following :

C:Programminewlispnewlisp.exe  -httpd -d 8080 -w C:Programminewlispide



I made a c:tmp directory.



If I start the server, I open a browser (IE 6.0) and then ask for:

http://127.0.0.1:8080">http://127.0.0.1:8080



the main editor page appears correctly.

from this page I can navigate using the left directory tree and I can inspect the distribuition files.



However, As I click on a button (even NEW):

the editor page does not change,

the browser shows on the status line:

Apertura pagina http://127.0.0.1:8080/content-frame.cgi">http://127.0.0.1:8080/content-frame.cgi,

it keeps running the upper right icon , but it is not really waiting.



If now I click on another file name, it is correctly displayed in the edit window.

If I manually clear the edit window and I enter a simple expression

like (println "hello") and I click on the eval button, the above behaviour

repeats exactly as described.



This happens only using IE 6.0.

Using Mozilla Firefox all works perfectly

Any suggestion ?



Regards

Maurizio
#5
newLISP in the real world / Problems with Dump ?
September 10, 2007, 02:31:45 AM
Just experimenting...

Seems that Dump interrupts dotimes evaluation



D:Temp>newlisp

newLISP v.9.2.0 on Win32, execute 'newlisp -h' for more info.



> (dotimes (x 5) (dump 'a))

(4150824 69 4145160 4145160 4177016)

>



Regards

Maurizio
#6
newLISP and the O.S. / Installation/starting directory
August 27, 2007, 01:17:27 AM
Would be fine to have a NewLisp function to get the running executable directory of newlisp.exe.



The trick to query the environment variable PROGRAMFILES to get the installation directory, as shown in newlisp-edit.lsp, does not work if I install

(for example) on another disk.



Then it would be fine to update all the gs examples to use

such a new function.



Regards

Maurizio
#7
It's the first time i'm trying to compile NewLisp (newlisp-9.1.10)

I've mingw installed in c:mingw

so I modified makefile_mingw to adjust the paths.

then I started make :

this is the error:

any suggestion ?

regards

Maurizio



D:TempNEWLIS~1.10>make mingw

make -f makefile_mingw

make[1]: Entering directory `D:/Temp/NEWLIS~1.10'

c:/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 newlisp.c

newlisp.c: In function `getToken':

newlisp.c:2887: warning: implicit declaration of function `lseek64'

c:/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-symbol.c

c:/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-math.c

nl-math.c: In function `functionFloat':

nl-math.c:396: warning: implicit declaration of function `asinh'

nl-math.c:397: warning: implicit declaration of function `acosh'

nl-math.c:398: warning: implicit declaration of function `atanh'

c:/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-list.c

c:/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-liststr.c

c:/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-string.c

nl-string.c: In function `p_search':

nl-string.c:78: `off64_t' undeclared (first use in this function)

nl-string.c:78: (Each undeclared identifier is reported only once

nl-string.c:78: for each function it appears in.)

nl-string.c:78: parse error before "filePosition"

nl-string.c:102: `filePosition' undeclared (first use in this function)

nl-string.c:102: warning: implicit declaration of function `lseek64'

nl-string.c:105: `foundPosition' undeclared (first use in this function)

make[1]: *** [nl-string.o] Error 1

make[1]: Leaving directory `D:/Temp/NEWLIS~1.10'

make: *** [mingw] Error 2
#8
newLISP Graphics & Sound / cannot start demo
July 20, 2007, 05:55:06 AM
I cannot start amy demo in newlist edit/gui server.

As I load a demo file and I click on the start button

a window appears saying :



The running NEWLISP process must first finish.



Same thing as I try to close the program.



To close it I have to kill it from task manager.



Any suggestion ?

Regards

Maurizio
#9
newLISP newS / Problems with catch-throw
March 13, 2006, 12:34:51 AM
Seems that "catch" leads to unexpected results:

in the following example the 'if' always succeed,

both with the throw statement commented or not commented.

Moreover, the doc seems misleading.



In a paragraph is written :
Quote
If an error occurs during evaluation, catch returns nil and stores the error message in symbol.

Few lines under is written :
Quote
When a throw is executed during the evaluation of expr catch will return true and the throw argument will be stored in symbol

I'm working with vers 8.8.1, on Windows 2000.



Regards

Maurizio






(define (start)
  (if (catch (do-work) 'errormsg)
    (println "error occurred " errormsg)
    (println "all goes well " errormsg)))
 
(define (do-work)
  ;; (throw "this is an error")
  (println "i'm working"))
   
   
(start)  
(exit)
#10
newLISP newS / what's wrong with this ?
March 08, 2006, 09:03:49 AM
calling sec:init i'm trying to create a new object, of type ctx,

in the object sec, but newlisp complains with the following error



symbol not in MAIN context in function new : asymbol

called from user defined function sec:init

 

this is the program :



(context 'CTX)

  (define (doit)

    (set 'x 1))

 

(context 'SECOND)

  (define (init)

    (new CTX 'asymbol))

   

(context 'MAIN)



  (new SECOND 'sec)

  (sec:init)

 

Any suggestion ?

Regards

Maurizio
#11
newLISP in the real world / About parse and scannig
February 24, 2005, 08:07:27 AM
I try to parse a text  file separating every "word"

according to a regular expression.

The code is reported below

What I see, is that even with a moderate text file (190k)

it is very slow.

I suppose this is due to the continuos string splitting after each

succesfull parse.

Any suggestion ?

Btw, should be fine to have a "scan" function, that works like

"parse", but in which you specify the " token" syntax instead of the separator one.

Regards

Maurizio.





(define (scan expr str)
  (let  ((lst '())  
         (res '()))
     (while (set 'res (regex expr str))
       (push (first res) lst -1)
       (set 'str (slice str (+ (first(rest res)) (first (rest(rest res)))))))
     lst))
     
     
(define (go)
   (let  ((expr  {[[:alpha:]]+[[:alnum:]]*|[[:digit:]]+|"(""|[^"])*"|'(''|[^'])*'|[[:graph:]]} ))
     (scan expr (read-file "myfile.txt"))))
     
[/code]
#12
I'd like to read a file in a list, having each line as a separate string.

I've tried this, but it seems to me a little clumsy.

Is it there a better way ?

Regards

Maurizio

(define (read-my-file)
  (set 'lst '())
  (set 'in-file (open "myfile.txt" "read"))
  (while (read-line in-file)
    (set 'lst (append lst (list (current-line)))))
  (close in-file)
  lst)
#13
the  following program gives an overflow error

I'm using vers 8.3.6 on win2k

Regards

Maurizio





(define (tostring argos)
  (join (map eval argos) " "))
 
(define-macro (packleft)
  (tk "pack " (tostring (args))))
 
(define (test)
  (tk "toplevel .main")
  (set 'aname  (tk "button .main.1"))
  (set 'asecond (tk "button .main.2"))
  (packleft aname asecond))
 
(test)




call stack overflow in function eval : tostring

called from user defined function tostring

called from user defined function tostring ...[/code]
#14
newLISP in the real world / Block comments
June 03, 2004, 03:31:06 AM
would be very fine to have a way to comment out several rows of code

(something like /* and */)

sometimes, while debugging,  I found the necessity to

comment out several procedures at once,

and it's very disturbing to have to comment every single line.



Regards

Maurizio
#15
Looking in the manual, in the parahraph Context as classes,

I see the following statement :



(set 'ctx (eval ctx))      ;; get context out of symbol



I really don't understand it.

Any explanation ?



Regards

Maurizio
#16
newLISP in the real world / unexpected echo
April 30, 2004, 08:10:36 AM
I'm trying a simple lisp program activated via httpd

this is the source :

(define (bold text)
  (print (string "<b>" text "</b>")))

(define (italic text)
  (print (string "<i>" text "</i>")))

(print "Content-type: text/htmlnn")
(print "<html>")
(print "<body>")

(print (string "<p> this is " (bold "bold") " and this " (italic "italic") " then normal </p>" ))

(print "</body>")
(print "</html>")

(exit)


instead of seeing :

this is bold and this is italic then normal



i see

bold italic

this is bold and this is italic then normal



there are two extra words:  bold and italic

before the desired output.



I'm using newlisp 8.01.

Any suggestion ?

Regards

Maurizio
#17
is it possible to start newlisp httpd .....

without having a command window floating around ?

I'd like to start the program using a batch file, or a menu or desktop link

and it should run httpd without showing any window,

or better, with a little icon in the tray area....



Regards



Maurizio
#18
newLISP in the real world / problem with integer
December 06, 2003, 02:43:18 PM
it seems that

  (integer "12a")

returns 12 instead of nil

it's a bug or a feature ?

(if it's a feature, how can i check for a valid integer ?)



Regards

Maurizio
#19
I'm trying to automatically generate names for tk widgets

this is a sample I've written



(define (newname parent) (string parent "." (inc 'cnt)) )

(define (opt opts) (if (string? opts) opts ""))



(define (toplevel opts)      (tk "toplevel "  (opt opts)) )

(define (frame parent opts)  (tk "frame "  (newname parent) " " (opt opts)) )



strangely, if try the following statements :



 (set 'cnt 1)

 (set 'top (toplevel ".main"))

 (set 'frame1 (frame top))

 

frame1 get the value ".main.3", instead of ".main.2"



While in this case it has no bad effects, however it's disturbing...



What happens ?



Regards



Maurizio
#20
newLISP in the real world / Debugger problems
July 28, 2003, 08:12:58 AM
I have some problem with the graphical debugger:

1) It's not immediately clear if the highlited line

is about to be executed or is already executed.

2) When debugging procedures in another context, the new context

name is always showing, making the text near illegible.

Any suggestion ?

Maurizio