File: api-base.lisp

package info (click to toggle)
albert 0.4.10.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,556 kB
  • ctags: 2,014
  • sloc: lisp: 13,587; ansic: 7,729; xml: 843; makefile: 99; sh: 28
file content (135 lines) | stat: -rw-r--r-- 3,110 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: sds-api-apispec -*-

;;; This file is autogenerated by the SDS API Generator.

(in-package :sds-api-apispec)
(define-sds-module apispec)

(def-sds-const API "api")
(def-sds-const CONSTANT "constant")
(def-sds-const CLASS "class")
(def-sds-const VAR "var")
(def-sds-const ATTR "attr")
(def-sds-const SUBELEM "subelem")
(def-sds-const DOC "doc")
(def-sds-const INFODOC "infodoc")
(def-sds-const EXPL "expl")


(def-sds-class toplevel
   (name constants classes )
  api)

(def-sds-class constant
   (name val )
  constant)

(def-sds-class class
   (name elmname doc vars attrs subelems infodoc )
  class)

(def-sds-class var
   (name type doc )
  var)

(def-sds-class attr
   (name type var doc )
  attr)

(def-sds-class subelem
   (name type var doc )
  subelem)

(def-sds-class infodoc
   (type value info expl )
  infodoc)

(defmethod initialize-instance :after ((obj apispec-toplevel) &key)
  (add-attributes obj
     (STRING "name" name)
  )
  (add-subelements obj
     (PTRLIST "constant" constants)
     (PTRLIST "class" classes)
  )
)

(defmethod initialize-instance :after ((obj apispec-constant) &key)
  (add-attributes obj
     (STRING "name" name)
     (STRING "val" val)
  )
)

(defmethod initialize-instance :after ((obj apispec-class) &key)
  (add-attributes obj
     (STRING "name" name)
     (STRING "elmname" elmname)
  )
  (add-subelements obj
     (STRING "doc" doc)
     (PTRLIST "var" vars)
     (PTRLIST "attr" attrs)
     (PTRLIST "subelem" subelems)
     (PTRLIST "infodoc" infodoc)
  )
)

(defmethod initialize-instance :after ((obj apispec-var) &key)
  (add-attributes obj
     (STRING "name" name)
     (STRING "type" type)
     (STRING "doc" doc)
  )
)

(defmethod initialize-instance :after ((obj apispec-attr) &key)
  (add-attributes obj
     (STRING "name" name)
     (STRING "type" type)
     (STRING "var" var)
     (STRING "doc" doc)
  )
)

(defmethod initialize-instance :after ((obj apispec-subelem) &key)
  (add-attributes obj
     (STRING "name" name)
     (STRING "type" type)
     (STRING "var" var)
     (STRING "doc" doc)
  )
)

(defmethod initialize-instance :after ((obj apispec-infodoc) &key)
  (add-attributes obj
     (STRING "type" type)
     (STRING "value" value)
     (STRING "doc" info)
  )
  (add-subelements obj
     (STRING "expl" expl)
  )
)


(create-obj-constructors (toplevel api)
                         (constant constant)
                         (class class)
                         (var var)
                         (attr attr)
                         (subelem subelem)
                         (infodoc infodoc))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defclass apispec-factory (xml-factory) ()))
(defun make-apispec-factory ()  (make-instance 'apispec-factory :name "apispec factory"))

(defmethod produce-xml-object ((factory apispec-factory) classname)
  (let ((fn (get-constructor classname))
        (retval nil))
    (if fn 
        (setf retval (apply fn '())) 
      (warn "No good value from ~a, asked for: ~a" (factory.name factory) classname))
    retval
    ))