Search found 9 matches

by zhanglong
Sat Jul 18, 2015 2:31 pm
Forum: newLISP in the real world
Topic: 10.6.3 date-value bug
Replies: 2
Views: 2606

Re: 10.6.3 date-value bug

Well the bug is not here, but why I can't use variable as the first parameter?

(set 'y 2015)

(date-value y 7 18)

ERR: missing argument in function date-value.
by zhanglong
Sat Jul 18, 2015 2:22 pm
Forum: newLISP in the real world
Topic: 10.6.3 date-value bug
Replies: 2
Views: 2606

10.6.3 date-value bug

The year parameter never get evalueated.

params = getIntegerExt(params, (UINT *)&year, FALSE);

change FALSE to evalFlag please.
by zhanglong
Wed Nov 26, 2014 11:36 am
Forum: So, what can you actually DO with newLISP?
Topic: How to set a local 'Contexts Hash'
Replies: 6
Views: 5191

Re: How to set a local 'Contexts Hash'

context is value, so we can use (uuid) to generate unique symbol in MAIN, then make it a context. But there's no gc, you have to delete the context yourself. (set 'a (new Tree (sym (string "_" (uuid)) MAIN))) delete the context like this (set 'name (sym (term a) MAIN)) ; find the context's name in M...
by zhanglong
Wed Nov 26, 2014 11:14 am
Forum: newLISP in the real world
Topic: How to determine type of variable/value?
Replies: 4
Views: 3042

Re: How to determine type of variable/value?

Code: Select all

(define types '("nil" "true" "int" "float" "string" "symbol" "context"
    "primitive" "import" "ffi" "quote" "expression" "lambda" "fexpr" "array"
    "dyn_symbol"))

(define (typeof v)
    (types (& 0xf ((dump v) 1))))
the types defined in newlisp.h
by zhanglong
Sat Aug 16, 2014 6:33 am
Forum: Anything else we might add?
Topic: string options for regular expression functions
Replies: 3
Views: 4385

Re: string options for regular expression functions

i < cell->aux - 1

raise error like regexError("Unknown option at", i, buffer);
by zhanglong
Sat Aug 16, 2014 6:15 am
Forum: Anything else we might add?
Topic: string options for regular expression functions
Replies: 3
Views: 4385

Re: string options for regular expression functions

Fogot regex-comp member, others look nice.

Debug should be easier if carp for other characters, maybe throw No.39 regular expression error.
by zhanglong
Fri Aug 15, 2014 3:14 pm
Forum: Anything else we might add?
Topic: string options for regular expression functions
Replies: 3
Views: 4385

string options for regular expression functions

Hello, I write a function to support string as regex-options. Example use "ip" to replce (| 0x10000 1), {u} than 2048 CELL* parseRegexOptions(CELL* params, UINT * options, int evalFlag) { CELL* cell; int i; char* buffer; if (evalFlag) cell = evaluateExpression(params); else cell = params; *options =...
by zhanglong
Thu Jul 24, 2014 12:51 am
Forum: newLISP in the real world
Topic: if default functor is an array, length always return 0
Replies: 1
Views: 1180

if default functor is an array, length always return 0

(set 'A:A (array 10))
(length A) --> 0

In order to pass big array by reference transparently, 'length' should return the array's size.
by zhanglong
Sat Mar 15, 2014 10:05 am
Forum: newLISP and the O.S.
Topic: on windows nl-filesys.c's isFile has a bug
Replies: 1
Views: 2262

on windows nl-filesys.c's isFile has a bug

stat return -1 for string like "d:". But in isFile isDirectory "d:/" is changed to "d:" before transfer to stat , we should check before temporary replace last \ or / to NUL. maybe change if (slash == '\\' || slash == '/') *(fileName + len - 1) = 0; to if ((slash == '\\' || slash == '/') && (! (len...