Skip to content

Commit

Permalink
Enhance XS:Lisp parameter support
Browse files Browse the repository at this point in the history
  • Loading branch information
mesheets committed Jul 23, 2024
1 parent 9ac6009 commit 9604683
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions demo/xs-lisp/hello-xsLisp.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
;; hello world

(begin
(putc-native-user :char-H :char-E :char-parallel)
(putc-native-user :char-H :char-E :char-parallel :char-O)
(msleep 1000)

(putc-native-user :char-L :char-E :char-G)
(putc-native-user :char-L :char-E :char-G :char-O)
(sleep 1)

(cls)
(sleep 1)

(putc-native-user :char-F :char-L :char-I)
(putc-native-user :char-F :char-L :char-I :char-P)
(putc-native :char-dash 5)
(sleep 1)

Expand Down
12 changes: 8 additions & 4 deletions xs/lisp/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ typedef int object;
#define maxLAMBDAnreq 16

#define SUBRindex(obj) ((obj)>>INDEXPOS)
#define SUBRnreq(obj) (((obj)>>(TAGBITS+4))&3)
#define SUBRnmax(obj) (((obj)>>(TAGBITS+1))&7)
#define SUBRnreq(obj) (((obj)>>(TAGBITS+3))&7)
#define SUBRnopt(obj) (((obj)>>(TAGBITS+1))&3)
#define SUBRnmax(obj) (SUBRnreq(obj) + SUBRnopt(obj))
#define SUBRrestp(obj) ((obj)&(1<<TAGBITS))

#define GENSYM(cell) ((cell)|GVARTAG1)
Expand All @@ -107,10 +108,13 @@ typedef int object;
#define CONST2SUBR(obj) ((obj)^6)
#endif
#define CONSTindex(obj) ((obj)>>INDEXPOS)
// index: subr_index enumeration value
// nreq: # of required parameters (max of 7)
// nopt: # of optional parameters (max of 3)
#define MKCONST(index, nreq, nopt, restp) \
(((index) << INDEXPOS) \
| ((nreq) << (TAGBITS+4)) \
| ((nreq+nopt) << (TAGBITS+1)) \
| ((nreq) << (TAGBITS+3)) \
| ((nopt) << (TAGBITS+1)) \
| (restp ? (1<<TAGBITS) : 0) \
| CONSTTAG)
#define MKSPECIAL(index) (((index) << INDEXPOS) | CONSTTAG)
Expand Down

0 comments on commit 9604683

Please sign in to comment.