I have a test.lsp file, when running it with -a=b -c=d
I want to save a process id file: 16754,
cat 16754, I will see
-a=b -c=d
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
(load "args.lsp")
(parse-args)
(setq process-number (int (ArgsTree "--process-number")))
(define (child-process)
(setq ppid (sys-info 6)) ; get parent pid
(setq cur-pid (sys-info 7))
(while true
(until (receive ppid msg)
(append-file (string cur-pid ".log") (string msg "n"))
(sleep 1000)
)
)
)
; parent starts child processes
(dotimes (i process-number)
(spawn 'result (child-process) true)
)
;; parent send one msg to each child process
(setf child-process-list (sync))
(println "child-process-list: " child-process-list)
(dolist (cpid child-process-list)
(println "child process: " cpid)
(send cpid "test msg")
)
;; quit in 10 seconds
(sleep 10000)
(abort)
(exit)
Quote
nil
test msg
test msg
test msg
test msg
test msg
test msg
test msg
test msg
test msg
Quotehttp://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3%BB%E7%BB%9F/hosts">http://localhost/wind_tunnel/clusters/跟踪系统/hosts
Quotehttp://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3%BB%E7%BB%9F/hosts"> http://localhost/wind_tunnel/clusters/% ... B%9F/hosts">http://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3%BB%E7%BB%9F/hosts
;; @syntax (Graph:get-node node-name)
;; @description
;; <p>If you want to get a Node out of the Graph (e.g. in order to extract
;; its properties), then use the following function to get it by name.</p>
;; @example
;; (println (:get-node my-dag "G")) ;;=> (Node "G" sad)
;; (println (:get-node my-dag "Does not exist")) ;;=> nil
(define (Graph:get-node node-name)
(and (find (list 'Node node-name '*)
(:nodes (self))
match)
$0))
(setq product-node (:get-node my-dag "result"))
(push "2014-12-12 10:10" product-node -1)
(println product-node)
(println (:get-node my-dag "result"))
bson_t * bson_new_from_json (const uint8_t* data, ssize_t len, bson_error_t *error);
(import bson-lib "bson_new_from_json" "void*" "void*" "unsigned int" "void*")
;; I also tried to use char* instead
;; (import bson-lib "bson_new_from_json" "void*" "char*" "unsigned int" "void*")
;; @syntax (mongo:bson-new-from-json json-str)
;; @return the pointer of bson_t
(define (bson-new-from-json json-str)
(bson_new_from_json json-str (length json-str) 0)
)
(load "mongo.lsp")
(set 'cmd-str "{stats:true}")
"{stats:true}"
> (mongo:bson-new-from-json cmd-str)
0
#define BCON_NEW(...)
bcon_new (NULL, __VA_ARGS__, NULL)
(set 'bson-lib "/usr/local/lib/libbson-1.0.so")
;; @Import bson_t * bcon_new (void *unused,...) BSON_GNUC_NULL_TERMINATED;
(import bson-lib "bcon_new" "void*" "void*" "char*" "char*")
;; @syntax (mongo:bcon-new arg1 arg2)
;; @return the point of bson_t
(define (bcon-new arg1 arg2)
(println arg1 "|" arg2)
(bcon_new nil arg1 arg2)
)
(set 'query-ptr (mongo:bcon-new "stats" "test"))
stats|test
ERR: missing argument
called from user defined function mongo:bcon-new
hdfs dfs -test -e /user/chenshu
echo $?
0
> (exec "hdfs dfs -test -e /user/chenshu;echo $?")
14/10/27 09:19:33 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicab
le
("0")
(define (make-sure-folder-path-end-of-slash dir-path)
(if (!= (last dir-path) "/")
(push "/" dir-path -1)
)
dir-path
)
(define (no-sub-files dir-path)
(not (directory dir-path {[^(.$)]})))
(define (delete-dir dir-path)
;; check dir-path
(unless (directory? dir-path)
(throw-error (string dir-path " folder does not exist")))
;; append slash to dir-path
(set 'dir-path (make-sure-folder-path-end-of-slash dir-path))
;; process sub files
(let (sub-files (directory dir-path {[^(.$)]}))
(if sub-files
(begin
;; iterate all sub files
(dolist (nde sub-files)
(if (directory? (append dir-path nde))
(delete-dir (append dir-path nde) file-op ext-context)
(let (file-path (append dir-path nde))
(println (string "delete file " file-path ": " (file-info file-path)))
(delete-file file-path ext-context))))
(if (no-sub-files dir-path)
(begin
(println (string "delete folder " dir-path ": " (file-info dir-path)))
(remove-dir dir-path))
)
)
(begin
(println "no sub files in " dir-path " folder, delete this folder")
(remove-dir dir-path))
)
)
)
dean@dean-Latitude-3330:~/Downloads$ mkdir -p x/x2/x3; touch x/x2/x3/z;touch x/x2/m;touch x/.sss; touch x/a.x;
dean@dean-Latitude-3330:~/Downloads$ tree x -a
x
├── a.x
├── .sss
└── x2
├── m
└── x3
└── z
2 directories, 4 files
> (delete-dir "/home/dean/Downloads/x")
delete file /home/dean/Downloads/x/a.x: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete file /home/dean/Downloads/x/x2/x3/z: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete folder /home/dean/Downloads/x/x2/x3/: (4096 16893 0 1000 1000 1409987075 1409987075 1409987075)
delete file /home/dean/Downloads/x/x2/m: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete folder /home/dean/Downloads/x/x2/: (4096 16893 0 1000 1000 1409987075 1409987075 1409987075)
delete file /home/dean/Downloads/x/.sss: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete folder /home/dean/Downloads/x/: (4096 16893 0 1000 1000 1409987075 1409987075 1409987075)
true
char **
mongoc_database_get_collection_names (mongoc_database_t *database,
bson_error_t *error);
typedef struct
{
uint32_t domain;
uint32_t code;
char message[504];
} bson_error_t;
(import library "mongoc_database_get_collection_names" "void*" "void*" "void*")
(define (get_coll_names s e)
(mongoc_database_get_collection_names s e))
(Mongo:get_coll_names s e)
ERR: value expected : nil
called from user defined function Mongo:get_coll_names
[root@hadoopMaster newlisp-10.6.0]# lsb_release -aQuote
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.9 (Final)
Release: 5.9
Codename: Final
[root@hadoopMaster newlisp-10.6.0]# uname -a
Linux hadoopMaster.com 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:29:55 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@hadoopMaster newlisp-10.6.0]# gcc --versionQuote
gcc (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cmake_minimum_required (VERSION 2.6)
include_directories(${CMAKE_SOURCE_DIR})
project(newlisp)
set(NEWLISP_SRC newlisp newlisp.c nl-symbol.c nl-math.c nl-list.c nl-liststr.c
nl-string.c nl-filesys.c nl-sock.c nl-import.c nl-xml.c nl-web.c nl-matrix.c
nl-debug.c pcre.c)
add_executable(newlisp ${NEWLISP_SRC})
#add_library(newlisp SHARED ${NEWLISP_SRC})
if(UNIX)
add_definitions("-DLINUX")
endif(UNIX)
if(WIN)
add_definitions("-DWIN_32")
endif(WIN)
if(APPLE)
add_definitions("-DMAC_OSX")
endif(APPLE)
TARGET_LINK_LIBRARIES(newlisp ffi m dl readline ncurses)
export CFLAGS=-m64
cmake .
make VERBOSE=1
[root@hadoopMaster newlisp-10.6.0]# make VERBOSE=1
/usr/bin/cmake -H/opt/newlisp-10.6.0 -B/opt/newlisp-10.6.0 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /opt/newlisp-10.6.0/CMakeFiles /opt/newlisp-10.6.0/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/opt/newlisp-10.6.0'
make -f CMakeFiles/newlisp.dir/build.make CMakeFiles/newlisp.dir/depend
make[2]: Entering directory `/opt/newlisp-10.6.0'
cd /opt/newlisp-10.6.0 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/DependInfo.cmake --color=
Dependee "/opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/DependInfo.cmake" is newer than depender "/opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/depend.internal".
Scanning dependencies of target newlisp
make[2]: Leaving directory `/opt/newlisp-10.6.0'
make -f CMakeFiles/newlisp.dir/build.make CMakeFiles/newlisp.dir/build
make[2]: Entering directory `/opt/newlisp-10.6.0'
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 1
[ 7%] Building C object CMakeFiles/newlisp.dir/newlisp.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/newlisp.c.o -c /opt/newlisp-10.6.0/newlisp.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 2
[ 14%] Building C object CMakeFiles/newlisp.dir/nl-symbol.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-symbol.c.o -c /opt/newlisp-10.6.0/nl-symbol.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 3
[ 21%] Building C object CMakeFiles/newlisp.dir/nl-math.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-math.c.o -c /opt/newlisp-10.6.0/nl-math.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 4
[ 28%] Building C object CMakeFiles/newlisp.dir/nl-list.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-list.c.o -c /opt/newlisp-10.6.0/nl-list.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 5
[ 35%] Building C object CMakeFiles/newlisp.dir/nl-liststr.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-liststr.c.o -c /opt/newlisp-10.6.0/nl-liststr.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 6
[ 42%] Building C object CMakeFiles/newlisp.dir/nl-string.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-string.c.o -c /opt/newlisp-10.6.0/nl-string.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 7
[ 50%] Building C object CMakeFiles/newlisp.dir/nl-filesys.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-filesys.c.o -c /opt/newlisp-10.6.0/nl-filesys.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 8
[ 57%] Building C object CMakeFiles/newlisp.dir/nl-sock.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-sock.c.o -c /opt/newlisp-10.6.0/nl-sock.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 9
[ 64%] Building C object CMakeFiles/newlisp.dir/nl-import.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-import.c.o -c /opt/newlisp-10.6.0/nl-import.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 10
[ 71%] Building C object CMakeFiles/newlisp.dir/nl-xml-json.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-xml-json.c.o -c /opt/newlisp-10.6.0/nl-xml-json.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 11
[ 78%] Building C object CMakeFiles/newlisp.dir/nl-web.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-web.c.o -c /opt/newlisp-10.6.0/nl-web.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 12
[ 85%] Building C object CMakeFiles/newlisp.dir/nl-matrix.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-matrix.c.o -c /opt/newlisp-10.6.0/nl-matrix.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 13
[ 92%] Building C object CMakeFiles/newlisp.dir/nl-debug.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-debug.c.o -c /opt/newlisp-10.6.0/nl-debug.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 14
[100%] Building C object CMakeFiles/newlisp.dir/pcre.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/pcre.c.o -c /opt/newlisp-10.6.0/pcre.c
Linking C executable newlisp
/usr/bin/cmake -E cmake_link_script CMakeFiles/newlisp.dir/link.txt --verbose=1
/opt/centos/devtoolset-1.1/root/usr/bin/gcc -m64 -fPIC CMakeFiles/newlisp.dir/newlisp.c.o CMakeFiles/newlisp.dir/nl-symbol.c.o CMakeFiles/newlisp.dir/nl-math.c.o CMakeFiles/newlisp.dir/nl-list.c.o CMakeFiles/newlisp.dir/nl-liststr.c.o CMakeFiles/newlisp.dir/nl-string.c.o CMakeFiles/newlisp.dir/nl-filesys.c.o CMakeFiles/newlisp.dir/nl-sock.c.o CMakeFiles/newlisp.dir/nl-import.c.o CMakeFiles/newlisp.dir/nl-xml-json.c.o CMakeFiles/newlisp.dir/nl-web.c.o CMakeFiles/newlisp.dir/nl-matrix.c.o CMakeFiles/newlisp.dir/nl-debug.c.o CMakeFiles/newlisp.dir/pcre.c.o -o newlisp -rdynamic -lffi -lm -ldl -lreadline -lncurses
[root@hadoopMaster newlisp-10.6.0]# ./newlisp
newLISP v.10.6.0 32-bit on Linux IPv4/6, options: newlisp -h
It is especially well-suited for applications in AI, simulation, natural language processing, big data, machine learning and statistics.
root@dean-Aspire-V7-481G:/usr/src/newlisp-10.6.0# make
make -f makefile_build
make[1]: Entering directory `/usr/src/newlisp-10.6.0'
gcc -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREADLINE -DSUPPORT_UTF8 -DNEWLISP64 -DLINUX -DFFI -I/usr/local/lib/libffi-3.0.13/include newlisp.c
newlisp.c: In function 'main':
newlisp.c:907:37: error: 'CPPFunction' undeclared (first use in this function)
rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
^
newlisp.c:907:37: note: each undeclared identifier is reported only once for each function it appears in
newlisp.c:907:50: error: expected expression before ')' token
rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
^
newlisp.c: At top level:
newlisp.c:990:47: error: unknown type name 'CPFunction'
char ** completion_matches(const char * text, CPFunction commands);
^
newlisp.c: In function 'newlisp_completion':
newlisp.c:995:1: warning: implicit declaration of function 'completion_matches' [-Wimplicit-function-declaration]
return(completion_matches(text, (CPFunction *)command_generator));
^
newlisp.c:995:34: error: 'CPFunction' undeclared (first use in this function)
return(completion_matches(text, (CPFunction *)command_generator));
^
newlisp.c:995:46: error: expected expression before ')' token
return(completion_matches(text, (CPFunction *)command_generator));
^
newlisp.c:996:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[1]: *** [newlisp.o] Error 1
# gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.