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 - newdep

#21
Hi Lutz,



This option (net-packet) is far the best network option newlisp has..Thanks a lot for this Lutz!

I do remember we once discussed this option to manipulate packets headers (3 years ago..hehe)

because i needed it to do so.. At that time it wasnt ready yet..now it is and I have my next project

already finished. (dumped the C code application and replaced it with newlisp ;-))



Here perhpas a small addon for the manual to give the example a little more strenght,

i know you have the qa-packet too but the manual is user input number one ...



Again... please use if usefull else /dev/null ...


Quote
; The following example is an UDP example.

; The packet generated is almost the same as the function (net-send-udp "192.168.1.95" 12345 "Hello World")

; it that context that a net-send-udp does send its original source-address. But this example manipulates

; the source-address of the UDP packet.



; client side UDP packet generation with source address 192.168.1.95 and destination address 192.168.10.10

; The packets is sent from the client machine with ip address 192.168.3.100.        



(set 'udp-packet (pack (dup "b" 39) '(

    0x45 0x00 0x00 0x27 0x4b 0x8f 0x00 0x00 0x40 0x11 0x00 0x00 192 168 1 95

    192  168  10   10   0xf2 0xc8 0x30 0x39 0x00 0x13 0x00 0x00 0x48 0x65 0x6c 0x6c

    0x6f 0x20 0x57 0x6f 0x72 0x6c 0x64)))

           

(unless (net-packet udp-packet)

        (println "net-error: " (net-error))

        (println "sys-error: " (sys-error)))

       

; On the server side:

; You see that the source address is not 192.168.3.100 but 192.168.1.95    

; which is correct as the packet was originaly sent from 192.168.3.100 but  

; the UDP stack has no source ip checking therefore this works.

(net-receive-udp 12345 2048)

it will return ("Hello world" "192.168.1.95" 62123)

       

; when using net-packet as a none root user the following error will return

net-error: (1 "Cannot open socket")

sys-error: (1 "Operation not permitted")
#22
newLISP newS / newlisp Documentation 10.3.0 "divert"
March 25, 2011, 07:49:37 AM
Hi Lutz,



The "divert" option on net-listen needs an extention for the users as not all readers know what this is probably.. Btw.. nice option..



I have summerized here what, i think, needs to be added to make it more clear...but please do

borrow from it what you think adds the extra..


Quote
A "divert" socket option does not work by default on Linux or Unix systems. Also a "divert" socket

is not the same as a "raw" socket. A" divert" socket can reinject its data back into the network stack it

also stops network packets going further up the network stack. Its main use  is for data manipulation and inspection of the ip packets, done by i.e. firewalls and network 'gateways'.



"divert" only works when your system-kernel was prepaired to use this option. Some linux and unix distributions do this and some dont. If you want to use the net-listen "divert" option then you must prepair your kernel and firewall to enable "divert". Not all firewall types can do this.



A net-listen "divert" option is only useable when you have full "root" privilages.



The str-mode can only contain "divert" and does not allow another "udp"  in front of it.

This would turn the net-listen back to "udp" only and not into "divert":

(net-listen "" "udp" "divert")   ; this is wrong

(net-listen "" "divert") ; this is good


#23
newLISP newS / Kane-box
November 20, 2010, 03:15:47 PM
Well people.. Im very thrilled about the kane-box...cant help it as my roots are in networking/routers/firewalls so im following that product closely and had to post

something overhere to share my enthousiasm about it.. The new webpage is there and processing kicked in overthere it seems....

http://www.kane-box.com/kane_box/Home.html">//http://www.kane-box.com/kane_box/Home.html



I can only say "Good Luck Guys and Go for it!" , I LOVE IT!



;-)
#24
Anything else we might add? / BOT's on forum...
November 18, 2010, 03:50:40 AM
Who is running all the BOT's that login here on the forum? And where does the info go?

Just currious as they seem very bussy these bot's ;-)
#25
newLISP and the O.S. / Seeking NEWLISP 9.3.12 manual
April 27, 2010, 01:24:51 AM
Hope someone has the newlisp 9.3.12 manual around,

Im seeking it because im programming against that version and

there where so many things changed after that release I need

to align them..



Hope someone has a pdf around ;-)



Thanks...



Norman
#26
newLISP and the O.S. / qa-float crash
September 22, 2009, 03:17:55 AM
Hi Lutz,



on OS/2..10.1.5, Im getting a crash in return from this code inside qa-float ->


(set 'result '())
(set 'u 1.0)
;(while (> u 0.0) (set 'u (mul u 0.5)) (push u result))
 (while (> u 0.0) (set 'u (mul u 0.5)) (println u))


Not sure if it should or not crash, I dont have any other OS at the moment to compare it with..


..
..
..
1.822780505e-304
9.113902524e-305
4.556951262e-305
2.278475631e-305
1.139237816e-305
5.696189078e-306
2.848094539e-306
1.424047269e-306
7.120236347e-307
3.560118174e-307
1.780059087e-307
8.900295434e-308
4.450147717e-308
2.225073859e-308

Killed by SIGFPE
pid=0x0097 ppid=0x0040 tid=0x0001 slot=0x006e pri=0x0200 mc=0x0001
E:PROGNLNEWLISP-10.1.5NEWLISP.EXE
NEWLISP 0:00011eb9
cs:eip=005b:00021eb9      ss:esp=0053:0017faf0      ebp=0017fb28
 ds=0053      es=0053      fs=150b      gs=0000     efl=00002297
eax=005503a0 ebx=005503a0 ecx=00550a40 edx=3fe00000 edi=0017fb08 esi=00000003
Process dumping was disabled, use DUMPPROC / PROCDUMP to enable it.

#27
Anything else we might add? / --- newLISP JOBS ---
September 14, 2009, 01:21:22 PM
I found...





http://washingtondc.craigslist.org/doc/cpg/1371739351.html">//http://washingtondc.craigslist.org/doc/cpg/1371739351.html


Need freelance LISP/Python programmer (NW DC)
Date: 2009-09-12, 9:53PM EDT
Reply to: gigs-mevrw-1371739351@craigslist.org [Errors when replying to ads?]

If you don't live in the Washington, DC area, please do not apply.

Need a college srudent or freelance programmer who already knows Common LISP and Python and is willing to learn at least one of the following languages:

NEWLISP
http://www.newlisp.org/

LIOGO
http://liogo.sourceforge.net/

Terrapin Logo Version 3
http://www.terrapinlogo.com/Version_3_Features.php

Location: NW DC
it's NOT ok to contact this poster with services or other commercial interests
Compensation: Pay per project.


PostingID: 1371739351
#28
#!/usr/bin/newlisp
#
# simple commandline Google finance
#
# usage:
# $gf.lsp goog
# (Google Inc.) NASDAQ:GOOG [$471.37 0.00% 0.00 149.22B]
#
# enjoy..nodep 2009 v0.1
#

(set 'data (get-url (string {http://www.google.com/finance?q=} (main-args -1)) ))

(when (find {var _ticker = '(.*)';} data 1)
 (setq T $1)                ;; ticker symbol
  (setq M (first (parse T))) ;; market
   (setq S (last (parse T)))) ;; symbol

(when (find {var _companyName = '(.*)';} data 1)  (setq N $1)) ;; company name
(when (find {var _companyId = (.*);} data 1)      (setq I $1)) ;; company id

(when (find (string "id:" I ",values:\[" """ S """ "," """ "(.*)" """ M """ "," """ I """ "," """ S """ ) data 1)
 (map (lambda(x) (replace x $1 " ")) '(""" ","))
  (setq X (parse $1)))

(println (string  "(" N ") " T " [ $" (X -6) "   " (X -3) "%  " (X -5)  "  " (X -2) (X -1) " ]"))

(exit)



http://www.nodep.nl/downloads/newlisp/gf.lsp">//http://www.nodep.nl/downloads/newlisp/gf.lsp





Enjoy..
#29
Im poisend at the moment by Functional programming and an overload on parentheses.

I urged myself to build a small parser that removes the very first parentheses

from newlisp in the hope to create/execute visability into the code.

That results indeed in clearer code and is executable but also a disabled language.



When long enough removing parentheses from lisp you will endup killing lisp.

...parenthese per parenthese...  



The question is -> "Is a lisp with only functional parentheses possible?"



- "What is a functional parenthese?"

- "Can a lisp exist with only functional parentheses?"

- "Will a lisp be more practical/attractive in use this way?"



Having less parentheses doesnt say you cant have another grouping mechanism.



And, having anonymous functions in the language doesnt make it a lisp!





PS: If i only could move these questions through a functional programming language and see the result..
#30
newLISP Graphics & Sound / HTML 5 Canvas?
August 06, 2009, 04:36:21 AM
Wondering what to do with HTML 5 Canvas?

->

http://9elements.com/io/projects/html5/canvas/">//http://9elements.com/io/projects/html5/canvas/
#31

(define-macro (this:this) (push (context) (args)))

>(this forum topic should explain itself)                              

(this forum topic should explain itself)

#32
newLISP in the real world / rexeg-comp ?BUG?
July 28, 2009, 10:13:40 AM
Using regex-comp under windows.

(didnt test it under unix)





Btw I think the manual should provide a better exmaple of the use regex-

comp.. I got it from Python that I know how this works..





This works ->


> (find-all {d+} "1 2 3 4 numbers upto 5 6 7 8 in it." )
("1" "2" "3" "4" "5" "6" "7" "8")






This doesnt ->


(setq p1 (regex-comp {d+} ))
"ERCP1000000000000040000000000000000d000000(000300000000000000000000000000P0005,06B000500"

> (find-all p1 "1 2 3 4 numbers upto 5 6 7 8 in it." 0x10000 )
()




And replace does work directly with regex-comp..


> (replace p1 "1 2 3 4 numbers upto 5 6 7 8 in it." "+" 0x10000 )
"+ + + + numbers upto + + + + in it."




Recapturing... or only replace does work or my example doesnt work..

Anyway.. It took me far too much time to get a simple find-all working with a regex-comp..got actualy irritated by it because I needed something

quickly.. Spending 1 hour on this isnt realy quick.. anyway.. Is it a bug?
#33
Below the dashboard part for disks, Easy use of the canvas module.


#!/usr/bin/newlisp
# part of system dashboard v0.1 by nodep (c) 2009

;; -------------------------------------------------------------------
;; Disk PIE Usage from OS
;; -------------------------------------------------------------------
;; get data from 'df' and create a data-list can differ per OS.
;; output is here in GIGABYTES -h, no swap space included.
;; -------------------------------------------------------------------
(setq disks (exec {df -lhP}))
(setq disks-usage (pop disks))
(setq disks (map (fn(x) (clean empty? (parse x " "))) disks))
;; -------------------------------------------------------------------

(load "canvas.lsp")

(html "<h3>DashBoard</h3>")

;; overall canvas size
(setq canvas-width  800)
(setq canvas-height 400)
(cv:canvas "dashboard" canvas-width canvas-height)

;; display global date indicator
(cv:font "normal 18px sans-serif")
(cv:goto 10 (- canvas-height 18) )
(cv:angle 90)
(cv:text (string "System Status:  " (date)))
(cv:angle 0)

;; create a pie with usage for the disk
;; x, y position the canvas
(define (pie-disk x y disk)

    (setq radius  50)
    (setq grad   360)

    (cv:goto x y)
    (cv:fill-color 1 1 0.9)
    (cv:rectangle 160 200 true)
    (cv:fill-color 0 0 1)
    (cv:font "normal 8px sans-serif")
    (cv:angle 90)
    (cv:goto (+ x 10) (+ y 180))
    (cv:text (string "Disk name: " (disk  0)) )
    (cv:goto (+ x 10) (+ y 170))
    (cv:text (string "Disk mount:" (disk -1)) )
    (cv:goto (+ x 10) (+ y 160))
    (cv:text (string "Disk Size: " (disk  1)) )
    (cv:goto (+ x 10) (+ y 150))
    (cv:text (string "Disk Used: " (disk  2)) )
    (cv:goto (+ x 10) (+ y 140))
    (cv:text (string "Disk Free: " (disk  3)) )

    ;; return value or 0 when nil returned from int
    (setq disk-used (or (int (0 -1 (disk 2))) 0))
    (setq disk-size (int (0 -1 (disk 1))) )
    (setq pie-used  (div grad (div disk-size disk-used)))

    (cv:angle 0)
    (cv:goto (+ x 80) (+ y 80))
    (cv:fill-color 0 0.5 0)
    (cv:pie radius grad true)
    (cv:fill-color 0.9 0 0)
    (cv:pie radius pie-used true)
)

;; -------------------------------------------------------------------
;; PIE
;; -------------------------------------------------------------------
(setq pie-disk-width  160)
(setq pie-disk-height 200)

;; draw pie-disks horizontal
(dolist (d disks)
  (pie-disk (+ (* $idx pie-disk-width) (+ (* $idx 10) 10)) (- canvas-height pie-disk-height 50) (disks $idx) ))

;(cv:render "dashboard.html")
(cv:render)
(exit)






The result can be saved from youre browser directly

and could look like this ->



http://www.nodep.nl/downloads/newlisp/dashboard.png">
#34
the file newlisp.chl I created once for the context editor was remaining

on my laptop ;-) I forgot all about it..Not sure If I already posted it on the forum befor..





(conText editor is dies days OpenSource at googleCode I noticed..)





//////////////////////////////////////////////////////////////////////////////


Language:               newLisp
Description:            newlisp ConTEXT Highlighter  by newdep
Filter:                 Highlighter files (*.lsp)|*.lsp
HelpFile:
CaseSensitive:          0
LineComment:            ;
BlockCommentBeg:        [text]
BlockCommentEnd:        [/text]
IdentifierBegChars:     a..z A..Z _%@.
IdentifierChars:        a..z A..Z _ 0..9
NumConstBegChars:       0..9 $
NumConstChars:          0..9 #abcdefABCDEF
EscapeChar:              

KeyWords1:    MAIN NaN? abs acos acosh add address amb and append append-file
              apply args array array-list array? asin asinh assoc atan atan2
              atanh atom? base64-dec base64-enc bayes-query bayes-train begin
              beta betai bind binomial callback case catch ceil change-dir char
              chop clean close command-line cond cons constant context context?
              copy-file cos cosh count cpymem crc32 crit-chi2 crit-z current-line
              curry date date-value debug dec def-new default define define-macro
              delete delete-file delete-url det device difference directory directory?
              div do-until do-while doargs dolist dostring dotimes dotree dump dup empty?
              encrypt ends-with env erf error-event error-number error-text eval
              eval-string exec exists exit exp expand explode factor fft file-info
              file? filter find find-all first flat float float? floor flt for for-all
              format fv gammai gammaln gcd get-char get-float get-int get-long get-string
              get-url global global? if ifft import inc index int integer integer?
              intersect invert irr join lambda? last legal? length let letex letn
              list list? load local log lookup lower-case macro? main-args make-dir
              map mat match max member min mod mul multiply name net-accept net-close
              net-connect net-error net-eval net-listen net-local net-lookup net-peek
              net-peer net-receive net-receive-from net-receive-udp net-select net-send
              net-send-to net-send-udp net-service net-sessions new nil nil? normal not
              now nper npv nth nth-set null? number? open or ostype pack parse pipe pmt
              pop post-url pow pretty-print primitive? print println prob-chi2 prob-z
              process protected? push put-url pv quote quote? rand random randomize
              read-buffer read-char read-file read-key read-line real-path ref ref-all
              regex remove-dir rename-file replace replace-assoc reset rest reverse
              rotate round save search seed seek select semaphore sequence series set
              set-locale set-nth setq sgn share signal silent sin sinh sleep slice sort
              source sqrt starts-with string string? sub swap sym symbol? symbols sys-error
              sys-info tan tanh throw throw-error time time-of-day timer title-case trace
              trace-highlight transpose trim true true? unify unique unless unpack until
              upper-case uuid when while write-buffer write-char write-file write-line
              xml-error xml-parse xml-type-tags zero?


KeyWords2:    gs:add-list-item gs:add-separator gs:add-to  gs:append-text gs:button
              gs:canvas gs:check-box gs:check-event gs:clear-list gs:clear-text gs:copy-text
              gs:cut-text gs:color-dialog gs:color-tag gs:combo-box gs:confirm-dialog
              gs:delete-tag gs:destroy-shell gs:dialog gs:disable gs:dispose gs:dispose-splash
              gs:draw-arc gs:draw-circle gs:draw-ellipse gs:draw-image gs:draw-line gs:draw-path
              gs:draw-polygon gs:draw-rect gs:draw-round-rect gs:draw-text gs:enable  gs:eva-shell
              gs:export gs:fill-arc  gs:fill-circle gs:fill-ellipse gs:fill-polygon gs:fill-rect
              gs:fill-round-rect gs:find-text gs:frame gs:get-bounds gs:get-fonts gs:get-font-metrics
              gs:get-screen gs:get-selected-text gs:get-text gs:get-text-position gs:get-version
              gs:goto-text gs:hide-tag gs:image-button gs:image-label gs:init gs:insert-list-item
              gs:insert-tab gs:insert-text gs:key-event gs:label gs:layout gs:load-text gs:listen
              gs:list-box gs:message-dialog gs:menu gs:menu-popup gs:menu-bar gs:menu-item gs:menu-item-check
              gs:mouse-clicked gs:mouse-dragged gs:mouse-event gs:mouse-moved gs:mouse-pressed
              gs:mouse-released gs:mouse-wheel gs:move-tag gs:no-action gs:open-file-dialog gs:panel
              gs:paste-text gs:play-sound gs:progress-bar gs:radio-button gs:redo-text gs:remove-from
              gs:remove-list-item gs:remove-tab gs:request-focus gs:reorder-tags gs:rotate-tag
              gs:run-shell gs:save-file-dialog gs:save-text gs:scale-tag gs:select-list-item
              gs:select-text gs:scroll-pane gs:set-accelerator gs:set-anti-aliasing gs:set-background
              gs:set-bevel-border gs:set-border-layout gs:set-canvas gs:set-caret-color gs:set-color
              gs:set-cursor gs:set-editable gs:set-flow-layout gs:set-font gs:set-foreground gs:set-grid-layout
              gs:set-icon gs:set-look-and-feel gs:set-paint gs:set-pressed-icon gs:set-resizable gs:set-rotation
              gs:set-scale gs:set-selected gs:set-selection-color gs:set-size gs:set-stroke gs:set-syntax
              gs:set-syntax-colors gs:set-tab-size gs:set-text gs:set-titled-border gs:set-tool-tip    
              gs:set-trace gs:set-translation gs:set-value gs:set-visible gs:shear-tag gs:show-popup
              gs:show-tag gs:slider gs:split-pane gs:tabbed-pane gs:text-area gs:text-field
              gs:text-pane gs:toggle-button gs:tool-bar gs:translate-tag gs:undo-text gs:update gs:window
              gs:window-closed



KeyWords3:   ! != $ $0 $1 $10 $11 $12 $13 $14 $15 $2 $3 $4 $5 $6 $7 $8 $9
             $args $idx $main-args % & * + - / < << <= = > >= >> ? @ ^ | ~


KeyWords4: [cmd] [/cmd]


//                      I assume Underline and Strike-out are mutually exclusive

StringBegChar:          " | {
StringEndChar:          " | }
MultilineStrings:       0
UsePreprocessor:        0
CurrLineHighlighted:    0


SpaceCol:               clWhite clBlack
Keyword1Col:            clWhite clBlack
Keyword2Col:            $00C000C0 clBlack
Keyword3Col:            $00C0C000 clBlack
IdentifierCol:          $00C0C0FF clBlack
CommentCol:             $00D0D0D0 clBlack
NumberCol:              clYellow clBlack
StringCol:              clLime clBlack
SymbolCol:              clAqua clBlack
PreprocessorCol:        clOlive clBlack
SelectionCol:           clWhite clNavy
CurrentLineCol:         clYellow $00202020

OverrideTxtFgColor:     0
BlockAutoindent:        0

BlockBegStr:            (
BlockEndStr:            )
Keyword4Col:            clWhite clBlack
Keyword5Col:            $00FFFFC0 clBlack
MatchedBracesCol:       clFuchsia clBlack

#35
newLISP Graphics & Sound / again GTK
July 23, 2009, 06:41:16 AM
An adjusted example that shows how easy it is to program in newlisp

directly with GTK2+.. The import part can be put inside a module so that

only leaves the real coding..which is actualy pretty small...just to mention it.. ;-)




#!/usr/bin/newlisp
# Example of direct gtk2+ programming in newlisp

# predefine libraries for platform
(set 'GTK     "libgtk-x11-2.0.so")
(set 'GDK     "libgdk-x11-2.0.so")
(set 'GOBJECT "libgobject-2.0.so.0")

# get functions from library's
(import GOBJECT "g_signal_connect_data")
(import GDK "gdk_color_parse")

(dolist (L '(
 "gtk_init"
 "gtk_main"
 "gtk_exit"
 "gtk_table_new"
 "gtk_progress_bar_new"
 "gtk_table_attach_defaults"
 "gtk_events_pending"
 "gtk_main_iteration"
 "gtk_progress_bar_set_fraction"
 "gtk_container_add"
 "gtk_widget_show_all"
 "gtk_widget_set_size_request"
 "gtk_widget_modify_fg"
 "gtk_widget_modify_bg"
 "gtk_window_new"
 "gtk_window_set_position"
 "gtk_window_set_resizable"
 "gtk_window_set_title"
 "gtk_window_set_decorated"

 )) (import GTK L))

# callback to exit program
(define (_exit_) (gtk_exit 0) (exit))

# create a window
(gtk_init 0 0)
(set 'WIN (gtk_window_new 0))
(gtk_window_set_title WIN "different time")
(gtk_widget_set_size_request WIN 200 32)
(gtk_window_set_resizable WIN 0)
(gtk_window_set_position  WIN 2)
(gtk_window_set_decorated WIN 1)
(g_signal_connect_data WIN "delete-event" (callback 0 '_exit_) 0 0 0)

# progress bars
(setq tbl (gtk_table_new 100 100 1 ))
(gtk_container_add WIN tbl)
(setq pb1 (gtk_progress_bar_new))
(gtk_table_attach_defaults tbl pb1 1 100  1 10)
(setq pb2 (gtk_progress_bar_new ))
(gtk_table_attach_defaults tbl pb2 1 100 11 20)
(setq pb3  (gtk_progress_bar_new))
(gtk_table_attach_defaults tbl pb3 1 100 21 30)

# colors (gtk2+)
(gdk_color_parse "#000000"  black)
(gtk_widget_modify_bg pb1 0 black)
(gtk_widget_modify_bg pb2 0 black)
(gtk_widget_modify_bg pb3 0 black)
(gtk_widget_modify_bg WIN 0 black)


(gtk_widget_show_all WIN)

(setq event 0)
(while (= (integer event) 0)

    (while (= (integer (gtk_events_pending)) 1) (gtk_main_iteration))
    (sleep 50)
        (gtk_progress_bar_set_fraction pb3 (div (float (date (date-value) 0 "%H")) 24))
        (gtk_progress_bar_set_fraction pb2 (div (float (date (date-value) 0 "%M")) 60))
        (gtk_progress_bar_set_fraction pb1 (div (float (date (date-value) 0 "%S")) 60)) ))

(_exit_)
#36
Anything else we might add? / Google gadgets
July 19, 2009, 09:10:50 AM
Seems Google has added Google Desktop-Gadgets for Linux too.. I thought

those only worked for Windows.. Mac is supported too..



Now the gadgets for Linux are Gtk based Lets see if that frame work

speeds up GTK development with newlisp instead of doing it directly

from the Gtk library... who know..





http://desktop.google.com/en/linux/download.html">//http://desktop.google.com/en/linux/download.html
#37
Being a newlisp fan and bought my first Gadget phone Nokia 3120 Classic,

and because I only make phone calls with a phone, but those phones

dont exists anymore dies days..., I bought this one..(just for the 3G) and Its time to put a desent  screensaver and Background on that phone ;-)



The flash below is 240x320, So if your lucky it fits your phone..

It does fits nice perfectly..Just upload it to your phone and put it

as background or screensaver..





http://www.nodep.nl/downloads/newlisp/newlisp-240x320.swf">//http://www.nodep.nl/downloads/newlisp/newlisp-240x320.swf



and



http://www.nodep.nl/downloads/newlisp/newlisp2-240x320.swf">//http://www.nodep.nl/downloads/newlisp/newlisp2-240x320.swf





which looks someting like this (battery low on my Digital camera..Blur image ahead! ;-)



http://www.nodep.nl/downloads/newlisp/nokia-newlisp.jpg">



Enjoy...
#38
newLISP in the real world / (swap odd or not)?
July 13, 2009, 01:57:41 PM
Hi Lutz,



Running this from the command line returns without a trace of a problem..

so that looks ok...(but is it?)


$> newlisp -e "(swap (copy '(a b)))"
(a b)
$>


But running that from inside the newlisp intepreter is a different story ->


newLISP v.10.0.5 on Linux IPv4, execute 'newlisp -h' for more info.

> (swap (copy '(a b)))
(a b)

Killed
$>


I wonder where the issue is..?



Norman.
#39
Who sees the error?



I can't see (wrong glasses i guess)

why this isnt working any more.. It was build in the

pre-history pre version 10.0.0 ages of newlisp and I cant get it

working on the 10.1.0 ..Any help very welcome! ;-)



The error im getting is:


newLISP-GS v.1.29 on Linux
 double buffering supported.
 listening on 47011
 accepted connection from 0.0.0.0
 connecting to 0.0.0.0:47012
 retrying to connect

ERR: illegal parameter type in function string : $idx
called from user defined function gs:button




#!/usr/bin/newlisp
;; -----------------------------------------------------
;; - LaZu - v2.0
;;
;; Fix the game by rotating the colored squares.
;; (Horizontal and vertical numbers may only occeur once)
;;
;; Enjoy! game and idea by nodep 2006 (c) -
;; -----------------------------------------------------

(if (= ostype "Win32")
 (load (string (env "PROGRAMFILES") "/newlisp/guiserver.lsp"))
 (load "/usr/share/newlisp/guiserver.lsp"))

;; -----------------------------------------------------
;; Generate game
;; -----------------------------------------------------
(seed (nth 6 (now)) )
(push (randomize (sequence 1 9)) b)
(while (< (length b) 9) (push (rotate (b -1)) b -1))
(dotimes (x 3) (setq b (randomize b true)))
(dotimes (x 9) (dolist (y b) (push (y x) c)))
(setq c (explode c 9))
(dotimes (x 3) (setq c (randomize c true)))
(set 'c (flat c))
(set 'solution c)
;; -----------------------------------------------------

(set 'clickers '(B10 B13 B16 B37 B40 B43 B64 B67 B70))
(dotimes (T 81) (push (sym (append "B" (string T))) buttons -1))
(define (update-buttons) (dolist (x c) (gs:set-text (buttons $idx) (string x))))
(define (roler p q, r) (dotimes (r p) (set 'c (eval (coaster q)))))

;; -----------------------------------------------------

(set 'coaster '(
(and (swap  0  1 c) (swap  1  2 c) (swap  2 11 c) (swap 11 20 c) (swap 20 19 c) (swap 19 18 c) (swap 18  9 c))
(and (swap  3  4 c) (swap  4  5 c) (swap  5 14 c) (swap 14 23 c) (swap 23 22 c) (swap 22 21 c) (swap 21 12 c))
(and (swap  6  7 c) (swap  7  8 c) (swap  8 17 c) (swap 17 26 c) (swap 26 25 c) (swap 25 24 c) (swap 24 15 c))
(and (swap 27 28 c) (swap 28 29 c) (swap 29 38 c) (swap 38 47 c) (swap 47 46 c) (swap 46 45 c) (swap 45 36 c))
(and (swap 30 31 c) (swap 31 32 c) (swap 32 41 c) (swap 41 50 c) (swap 50 49 c) (swap 49 48 c) (swap 48 39 c))
(and (swap 33 34 c) (swap 34 35 c) (swap 35 44 c) (swap 44 53 c) (swap 53 52 c) (swap 52 51 c) (swap 51 42 c))
(and (swap 54 55 c) (swap 55 56 c) (swap 56 65 c) (swap 65 74 c) (swap 74 73 c) (swap 73 72 c) (swap 72 63 c))
(and (swap 57 58 c) (swap 58 59 c) (swap 59 68 c) (swap 68 77 c) (swap 77 76 c) (swap 76 75 c) (swap 75 66 c))
(and (swap 60 61 c) (swap 61 62 c) (swap 62 71 c) (swap 71 80 c) (swap 80 79 c) (swap 79 78 c) (swap 78 69 c))))


;; -----------------------------------------------------
;; Rotate only x squares random 1-8 times left
;; Make R higher will make game even more difficult
;; -----------------------------------------------------
(dotimes (R 3)
 (roler ((randomize (sequence 1 8)) 0) ((randomize (sequence 0 8)) 0)))

;; -----------------------------------------------------
;; GUI
;; -----------------------------------------------------
(gs:init)
;(gs:set-look-and-feel "com.sun.java.swing.plaf.motif.MotifLookAndFeel")
;(gs:set-look-and-feel "com.sun.java.swing.plaf.gtk.GTKLookAndFeel")
;(gs:set-look-and-feel "com.sun.java.swing.plaf.windows.WindowsLookAndFeel")
;(gs:set-look-and-feel "javax.swing.plaf.mac.MacLookAndFeel")
(gs:set-look-and-feel "javax.swing.plaf.metal.MetalLookAndFeel")

(gs:frame 'F1 0 0 420 470 "LaZu")
(gs:set-resizable 'F1 nil)
(gs:set-grid-layout 'F1 1 1 1 1 )

(gs:panel 'BP)
(dolist (b buttons)
 (gs:button b B-handler (string (c $idx)) 50 50)
 (gs:set-size b 50 50)
 (gs:set-foreground b 0 0 0 )
 (gs:set-background b 0.9 1 0.7)
 (gs:set-font b "Sans Serif" 18 "bold")
 (if (find b clickers)
  (and (gs:set-foreground b 1 0 0 )
   (gs:set-background b 0.9 1 0.4)))
 (gs:add-to 'BP b))

(gs:label 'L1 "horizontal and vertical the numbers 1-9 can only appear once" "center")
(gs:label 'L2 "click the highlighted buttons to rotate left" "center")
(gs:set-foreground 'L1 0.2 0.4 0.8 0.8 )
(gs:set-foreground 'L2 0.2 0.4 0.8 0.8 )

(gs:add-to 'BP 'L1 'L2)

(gs:add-to 'F1 'BP)
(gs:set-visible 'F1 true)


;; -----------------------------------------------------  
;; Go!
;; -----------------------------------------------------  
(define (B-handler id text)
 (cond
  ((= "MAIN:B10" id) (roler 1 0))
  ((= "MAIN:B13" id) (roler 1 1))
  ((= "MAIN:B16" id) (roler 1 2))
  ((= "MAIN:B37" id) (roler 1 3))
  ((= "MAIN:B40" id) (roler 1 4))
  ((= "MAIN:B43" id) (roler 1 5))
  ((= "MAIN:B64" id) (roler 1 6))
  ((= "MAIN:B67" id) (roler 1 7))
  ((= "MAIN:B70" id) (roler 1 8)))
  (update-buttons)
   (if (= solution c)
    (and (dolist (x clickers)
     (gs:set-text x ( "WELLDONE!" $idx )))
     (dolist (x buttons) (gs:disable x)))))

(gs:listen)
#40
newLISP Graphics & Sound / GuiServer
July 13, 2009, 08:06:09 AM
Hi Lutz,



Is it easy to add IPC (named-Pipes) to the GS?



Im seeking for a faster transport between java and Newlisp on

local machines...





And Btw.. I see you did SWT javascript imports in the HTML5 widgets..

Is it possible to build a GS in Javascript that way..That would make

GS even more flexible.. I dont know about speed here though..



Norman.