File: qa-win-dll

package info (click to toggle)
newlisp 10.7.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,292 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (51 lines) | stat: -rwxr-xr-x 984 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env newlisp

;; test newlisp DLL

(println)
(println "Testing Windows DLL calls")

(unless (find ostype '("Windows"))
	(println "not tested on " ostype)
	(exit)
)

(unless (file-info "newlisp.dll")
	(println ">>>>> No newlisp.dll found")
	(exit)
)

(error-event (fn () 
    (println ">>>>> ERROR " (first (last-error)) " " (last (last-error)))
    (exit)
))

(define (dll-eval expr)
	(unless newlispEvalStr
		(import "newlisp.dll" "newlispEvalStr"))
	(let (result (get-string (newlispEvalStr (string expr))) )
		(if (starts-with result "\nERR:")
			"ERROR in DLL call"
			(read-expr result))
	)
)


(if (and
		(println (= (dll-eval '(+ 3 4)) 7))
		(println (= (dll-eval '(sequence 1 10)) (sequence 1 10)))
		(println (= (dll-eval '(set 'x 12345)) 12345))
		(println (= (dll-eval 'x) 12345))
		(println (= (dll-eval '(foo bar)) "ERROR in DLL call")) )

	(println ">>>>> Windows DLL CALLS SUCCESSFUL")
	(println ">>>>> PROBLEM IN Windows DLL CALLS")
)

(println)

(exit)