/[cmucl]/src/tests/nlx-test.lisp
ViewVC logotype

Contents of /src/tests/nlx-test.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Mon Dec 17 19:51:39 1990 UTC (23 years, 4 months ago) by ram
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, double-double-array-base, post-merge-intl-branch, release-19b-pre1, release-19b-pre2, merged-unicode-utf16-extfmt-2009-06-11, double-double-init-sparc-2, unicode-utf16-extfmt-2009-03-27, double-double-base, snapshot-2007-09, snapshot-2007-08, snapshot-2008-08, snapshot-2008-09, ppc_gencgc_snap_2006-01-06, sse2-packed-2008-11-12, snapshot-2008-05, snapshot-2008-06, snapshot-2008-07, snapshot-2007-05, snapshot-2008-01, snapshot-2008-02, snapshot-2008-03, intl-branch-working-2010-02-19-1000, snapshot-2006-11, snapshot-2006-10, double-double-init-sparc, snapshot-2006-12, unicode-string-buffer-impl-base, sse2-base, release-20b-pre1, release-20b-pre2, unicode-string-buffer-base, sse2-packed-base, sparc-tramp-assem-2010-07-19, amd64-dd-start, snapshot-2003-10, snapshot-2004-10, release-18e-base, release-19f-pre1, snapshot-2008-12, snapshot-2008-11, intl-2-branch-base, snapshot-2004-08, snapshot-2004-09, remove_negative_zero_not_zero, snapshot-2007-01, snapshot-2007-02, snapshot-2004-05, snapshot-2004-06, snapshot-2004-07, release-19e, release-19d, GIT-CONVERSION, double-double-init-ppc, release-19c, dynamic-extent-base, unicode-utf16-sync-2008-12, LINKAGE_TABLE, release-19c-base, cross-sol-x86-merged, label-2009-03-16, release-19f-base, PRE_LINKAGE_TABLE, merge-sse2-packed, mod-arith-base, sparc_gencgc_merge, merge-with-19f, snapshot-2004-12, snapshot-2004-11, intl-branch-working-2010-02-11-1000, unicode-snapshot-2009-05, unicode-snapshot-2009-06, amd64-merge-start, ppc_gencgc_snap_2005-12-17, double-double-init-%make-sparc, unicode-utf16-sync-2008-07, release-18e-pre2, unicode-utf16-sync-2008-09, unicode-utf16-extfmts-sync-2008-12, prm-before-macosx-merge-tag, cold-pcl-base, RELEASE_20b, snapshot-2008-04, snapshot-2003-11, snapshot-2005-07, unicode-utf16-sync-label-2009-03-16, RELEASE_19f, snapshot-2007-03, release-20a-base, cross-sol-x86-base, unicode-utf16-char-support-2009-03-26, unicode-utf16-char-support-2009-03-25, release-19a-base, unicode-utf16-extfmts-pre-sync-2008-11, snapshot-2008-10, sparc_gencgc, snapshot-2007-04, snapshot-2010-12, snapshot-2010-11, unicode-utf16-sync-2008-11, snapshot-2007-07, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2007-06, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, snapshot-2003-12, release-19a-pre1, release-19a-pre3, release-19a-pre2, pre-merge-intl-branch, release-19a, UNICODE-BASE, double-double-array-checkpoint, double-double-reader-checkpoint-1, release-19d-base, release-19e-pre1, double-double-irrat-end, release-19e-pre2, snapshot-2010-05, snapshot-2010-04, snapshot-2010-07, snapshot-2010-06, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, release-19d-pre2, release-19d-pre1, snapshot-2010-08, release-18e, double-double-init-checkpoint-1, double-double-reader-base, label-2009-03-25, snapshot-2005-03, release-19b-base, cross-sol-x86-2010-12-20, double-double-init-x86, sse2-checkpoint-2008-10-01, intl-branch-2010-03-18-1300, snapshot-2005-11, double-double-sparc-checkpoint-1, snapshot-2004-04, sse2-merge-with-2008-11, sse2-merge-with-2008-10, snapshot-2005-10, RELEASE_20a, snapshot-2005-12, release-20a-pre1, snapshot-2005-01, snapshot-2009-11, snapshot-2009-12, unicode-utf16-extfmt-2009-06-11, portable-clx-import-2009-06-16, unicode-utf16-string-support, release-19c-pre1, cross-sparc-branch-base, release-19e-base, intl-branch-base, double-double-irrat-start, snapshot-2005-06, snapshot-2005-05, snapshot-2005-04, ppc_gencgc_snap_2005-05-14, snapshot-2005-02, unicode-utf16-base, portable-clx-base, snapshot-2005-09, snapshot-2005-08, lisp-executable-base, snapshot-2009-08, snapshot-2007-12, snapshot-2007-10, snapshot-2007-11, snapshot-2009-02, snapshot-2009-01, snapshot-2009-07, snapshot-2009-05, snapshot-2009-04, snapshot-2006-02, snapshot-2006-03, release-18e-pre1, snapshot-2006-01, snapshot-2006-06, snapshot-2006-07, snapshot-2006-04, snapshot-2006-05, pre-telent-clx, snapshot-2006-08, snapshot-2006-09, HEAD
Branch point for: release-19b-branch, double-double-reader-branch, double-double-array-branch, mod-arith-branch, RELEASE-19F-BRANCH, portable-clx-branch, sparc_gencgc_branch, cross-sparc-branch, RELEASE-20B-BRANCH, unicode-string-buffer-branch, sparc-tramp-assem-branch, dynamic-extent, UNICODE-BRANCH, release-19d-branch, ppc_gencgc_branch, sse2-packed-branch, lisp-executable, RELEASE-20A-BRANCH, amd64-dd-branch, double-double-branch, unicode-string-buffer-impl-branch, intl-branch, release-18e-branch, cold-pcl, unicode-utf16-branch, cross-sol-x86-branch, release-19e-branch, sse2-branch, release-19a-branch, release-19c-branch, intl-2-branch, unicode-utf16-extfmt-branch
Initial revision
1 ram 1.1 (in-package 'c)
2    
3     (eval-when (compile eval)
4     (defmacro dbg-write (string)
5     `(system:%primitive write-string ,string 0 ,(length string)))
6    
7     (defmacro receive-values (n form)
8     (collect ((vars))
9     (dotimes (i n)
10     (vars (gensym)))
11     `(multiple-value-bind ,(vars)
12     ,form
13     (dbg-write "vars =")
14     (system:%primitive print ',n)
15     ,@(mapcar #'(lambda (x)
16     `(system:%primitive print ,x))
17     (vars)))))
18    
19     (defmacro receive-any-values (form)
20     (once-only ((n-res `(multiple-value-list ,form)))
21     `(progn
22     (dbg-write "result =")
23     (system:%primitive print ,n-res)))))
24    
25    
26     (proclaim '(special *foo*))
27    
28     (defun nlx-test (n)
29     (let ((*foo* 'nlx-test))
30     (multiple-value-prog1
31     (block foo
32     (nlx-test-aux
33     #'(lambda ()
34     (dbg-write "In escape: ")
35     (system:%primitive print *foo*)
36     (return-from foo (n-values n)))))
37     (dbg-write "After unwind: ")
38     (system:%primitive print *foo*))))
39    
40     (defun nlx-test-aux (fun)
41     (let ((*foo* 'nlx-test-aux))
42     (unwind-protect
43     (funcall fun)
44     (dbg-write "Unwind: ")
45     (%primitive print *foo*)
46     (dbg-write "
47     "))))
48    
49    
50     (defun n-values (n)
51     (declare (type (integer 0 5) n))
52     (dbg-write "values =")
53     (system:%primitive print n)
54     (ecase n
55     (0 (values))
56     (1 (values 0))
57     (2 (values 0 1))
58     (3 (values 0 1 2))
59     (4 (values 0 1 2 3))
60     (5 (values 0 1 2 3 4))))
61    
62    
63     (defun list (&rest x)
64     x)
65    
66    
67     (defun lisp::%initial-function ()
68     (dbg-write "Starting...
69     ")
70     (let ((*foo* 'lisp::%initial-function))
71     (dbg-write "Before NLX-Test: ")
72     (system:%primitive print *foo*)
73     (receive-any-values (nlx-test 5))
74     (dbg-write "After NLX-Test: ")
75     (system:%primitive print *foo*))
76    
77    
78     (dbg-write "
79     done.
80     ")
81     (system:%primitive halt))

  ViewVC Help
Powered by ViewVC 1.1.5