File: test766.thp

package info (click to toggle)
theme-d 7.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,036 kB
  • sloc: lisp: 9,625; sh: 5,321; makefile: 715; ansic: 477
file content (54 lines) | stat: -rw-r--r-- 1,433 bytes parent folder | download | duplicates (2)
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
52
53
54
;; -*-theme-d-*-

;; Copyright (C) 2020 Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.

;; Expected results: translation error


(define-proper-program (tests test766)

  (import (standard-library core)
	  (standard-library console-io))


  (define-class <my-object>
    (construct ((id1 <string>)))
    (fields
     (id <string> public public id1)))
     

  (define-class <my-record>
    (construct ((name1 <string>) (address1 <string>)))
    (fields
     (name <string> public public name1)
     (address <string> public public address1)))


  (define-class <my-stack>
    (superclass <my-object>)
    (construct ((id1 <string>)) (id1) ())
    (fields
     (contents (:uniform-list <my-record>) module module null)))
     
  
  (define-class <my-counted-stack>
    (superclass <my-stack>)
    (fields
     (count <integer> module module 0)))


  (define-simple-proc my-push
      (((stack <my-counted-stack>) (element <my-record>)) <none> nonpure)
    (field-set! stack 'contents (cons element (field-ref stack 'contents)))
    (field-set! stack 'count (+ (field-ref stack 'count) 1)))
    

  (define main
    (lambda (() <integer> nonpure)
      (let ((my-stack (create <my-counted-stack>)))
	(my-push my-stack (create <my-record> "Tommi" "PL 0"))
	(my-push my-stack (create <my-record> "Jukka" "PL 1"))
	(my-push my-stack (create <my-record> "Janne" "PL 2"))
      0))))