Search found 107 matches

by csfreebird
Wed Nov 27, 2013 1:11 am
Forum: newLISP in the real world
Topic: how to make newlisp app run in background
Replies: 6
Views: 3122

Re: how to make newlisp app run in background

maybe nohup command can do this. I am trying:

Code: Select all

nohup ./test.lsp 192.168.1.57 7777 131031000043 131031000143 > /dev/null 2>&1 &
by csfreebird
Tue Nov 26, 2013 11:20 pm
Forum: newLISP in the real world
Topic: how to make newlisp app run in background
Replies: 6
Views: 3122

how to make newlisp app run in background

Hi, I ssh remote server, run my newlisp app in terminal with operator &, then I close my terminal window. but after about 2 hours, all newlisp processes are terminated. Why? I run below command in terminal: ./test.lsp 192.168.1.57 7777 131031000043 131031000143 & in test.lsp, I launch 100 processes ...
by csfreebird
Mon Nov 25, 2013 1:49 pm
Forum: newLISP in the real world
Topic: What benefits did you get from FOOP?
Replies: 9
Views: 4809

What benefits did you get from FOOP?

I just took 2 days to refactor my newlisp code, applied FOOP to my application. From what I experienced, FOOP helps me to orginize my code better than before, 1. I have a Sign class, after creating sign object, use sign object's attributes to hold status to avoid passing agruments between one functi...
by csfreebird
Mon Nov 25, 2013 6:15 am
Forum: newLISP in the real world
Topic: if we can see line number in error message
Replies: 11
Views: 5731

Re: if we can see line number in error message

Hi, Thanks for your suggestion about replacing append with string function, I will use it later. Maybe my code snippet is not a good example here, in my code, only the last two lines are using (append ... checksum-value) But I still think newLisp should offer line number when getting error because i...
by csfreebird
Mon Nov 25, 2013 3:51 am
Forum: newLISP in the real world
Topic: if we can see line number in error message
Replies: 11
Views: 5731

if we can see line number in error message

I am not sure if newLisp can output line number or not in error message currently. But according to my experience, I always take many minutes to find the error location when my code becomes large. If newlisp does support this, it will save many time. e.g (define (check-checksum2 msg-length msg-body)...
by csfreebird
Sat Nov 23, 2013 1:48 pm
Forum: newLISP in the real world
Topic: cannot create a sub class from Tree in another context
Replies: 3
Views: 2015

cannot create a sub class from Tree in another context

My case is: 1. I have a Sign class 2. In this Sign class, need to create a Class which inherits from Tree, this Class is used for holding key and value pairs. Key is message type, value is corresponding function that is ued to handle the message, that's table-driven design to avoid many if/else stat...
by csfreebird
Tue Nov 19, 2013 3:34 pm
Forum: newLISP in the real world
Topic: question about context chapter in manual
Replies: 1
Views: 1387

question about context chapter in manual

Hi, Lutz: When reading this: When a user-defined function is evaluated, the context is switched to the parent context of the symbol it is called with. Does the symbol(red color above) mean user-defined function here? If there are context A and B, B has a user-defined function myfun in A context, I w...
by csfreebird
Tue Nov 19, 2013 3:24 pm
Forum: newLISP in the real world
Topic: typo in manual?
Replies: 5
Views: 2756

typo in manual?

A symbol is created when newLISP first sees it, when calling the load, sym, or eval-string functions. When newLISP reads a source file, symbols are created before evaluation occurs. In manual contexts chapter, I see above words. Is it a typo? when calling the load, sym ... should be 'while calling ...
by csfreebird
Mon Nov 04, 2013 9:25 am
Forum: newLISP in the real world
Topic: manual enhancement
Replies: 1
Views: 1424

manual enhancement

When reading expand chapter, there is: expand is useful when composing lambda expressions or doing variable expansion inside macros. But the example code below is nothing to do with macros. (define (raise-to power) (expand (fn (base) (pow base power)) 'power)) (define square (raise-to 2)) (define cu...
by csfreebird
Mon Oct 21, 2013 1:19 pm
Forum: newLISP in the real world
Topic: call C++ function from newlisp code
Replies: 2
Views: 1868

call C++ function from newlisp code

Is it possible to call a c++ function, I want to build a C++ so file which has some functions for accessing database, then write a newlisp app to use it. I am working on Ubuntu.
by csfreebird
Tue Jul 30, 2013 4:26 pm
Forum: So, what can you actually DO with newLISP?
Topic: Just share what newlisp does for me here
Replies: 7
Views: 9132

Just share what newlisp does for me here

1. I just write a newlisp app for replacing CMake to build my C++ app on Ubuntu using GCC. The article is written in Chinese, I have no time to translate it in English. http://blog.csdn.net/csfreebird/article/details/9635529 Newlisp is more powerful than many script languages, I never realized it co...
by csfreebird
Sat Jul 27, 2013 3:24 am
Forum: newLISP in the real world
Topic: How to implement function overwriting
Replies: 2
Views: 2106

How to implement function overwriting

I want to make one function support different argument combinations
like that in API:

Code: Select all

append

syntax: (append list-1 [list-2 ... ])
syntax: (append array-1 [array-2 ... ])
syntax: (append str-1 [str-2 ... ])
How to write my own function like that. Any document for this?
by csfreebird
Fri Jul 19, 2013 6:28 am
Forum: newLISP in the real world
Topic: @return tag doesn't work
Replies: 1
Views: 1399

Re: @return tag doesn't work

I figured out myself. Because I forgot to put @syntax on the top of my function.
It's a little bleak here.
by csfreebird
Sun Jul 14, 2013 3:53 pm
Forum: newLISP in the real world
Topic: @return tag doesn't work
Replies: 1
Views: 1399

@return tag doesn't work

I tried the newest version of newlisp, newlisp -v newLISP v.10.5.3 64-bit on Linux IPv4/6 UTF-8 libffi. Get the newlispdoc codes from http://newlisp.org/syntax.cgi?code/newlispdoc.txt But when I use @return tag in comments, I just get result below ;; @return Returns cookie if login succeeds It seems...
by csfreebird
Thu May 09, 2013 1:54 am
Forum: newLISP in the real world
Topic: Make newlisp app be a windows service?
Replies: 3
Views: 1985

Re: Make newlisp app be a windows service?

Thanks. From your idea, I got my solution. Just install one bat file as windows service, and this bat file call my newlisp script file. For example, My daemon.lsp file is: (while true (println "hello, I am daemon") (append-file "c:\\t.txt" "mm") (sleep 1000)) And my daemon.bat file has: newlisp C:\w...
by csfreebird
Wed May 08, 2013 4:35 pm
Forum: newLISP in the real world
Topic: Make newlisp app be a windows service?
Replies: 3
Views: 1985

Make newlisp app be a windows service?

I wish I could install one newlisp app as windows service. Then it could watch over my other processes, make sure they are all alive.
How to do this?
by csfreebird
Tue May 07, 2013 4:19 am
Forum: newLISP in the real world
Topic: timeout question about net-receive
Replies: 5
Views: 3068

Re: timeout question about net-receive

you are right. Thank you.
by csfreebird
Mon Apr 29, 2013 5:08 am
Forum: newLISP in the real world
Topic: timeout question about net-receive
Replies: 5
Views: 3068

Re: timeout question about net-receive

What's your point?
my codes is

Code: Select all

    (if (!= -1 q)
by csfreebird
Sun Apr 28, 2013 12:14 pm
Forum: newLISP in the real world
Topic: timeout question about net-receive
Replies: 5
Views: 3068

Re: timeout question about net-receive

I write some codes for solving this problem: ;; socket.lsp (context 'socket) ;; return the number of bytes which are ready to read ;; throw error if connection is closed (define (net-peek-ex s) (unless (net-peek s) (throw-error "connection is closed"))) ;; read specified size of data from connection...
by csfreebird
Sat Apr 20, 2013 9:47 am
Forum: newLISP in the real world
Topic: timeout question about net-receive
Replies: 5
Views: 3068

timeout question about net-receive

net-receive has not one timeout argument. When will it return if no data is sent by remote peer?
And another question, is it possible to set the timeout now?
by csfreebird
Sat Apr 20, 2013 9:00 am
Forum: newLISP in the real world
Topic: uint32_t type
Replies: 6
Views: 2470

Re: uint32_t type

My newlisp app is used for simulating 10,000 devices which connect to my TCP server.
I am doing some parallel testing recently.
We transfer 16bit or 32bit integer with big-endian order via TCP.
The network traffic means cost for our business. :)
by csfreebird
Fri Apr 19, 2013 7:51 am
Forum: newLISP in the real world
Topic: uint32_t type
Replies: 6
Views: 2470

Re: uint32_t type

it's interesting, why it doesn't change the value, but makes it look like one unsigned integer instead of signed integer?
by csfreebird
Thu Apr 18, 2013 1:48 am
Forum: newLISP in the real world
Topic: uint32_t type
Replies: 6
Views: 2470

Re: uint32_t type

I used pack with unpack for this. (define (u4 v) (first (unpack "lu" (pack "lu" v)))) Here is some examples for calling u4 function: > (define (u4 v)(first (unpack "lu" (pack "lu" v)))) (lambda (v) (first (unpack "lu" (pack "lu" v)))) > (u4 8) 8 > (u4 -12) 4294967284 > But, it's not convenient, and ...
by csfreebird
Wed Apr 17, 2013 2:06 pm
Forum: newLISP in the real world
Topic: uint32_t type
Replies: 6
Views: 2470

uint32_t type

How to define a variable which contains one uint32_t integer?
Any example?