/ src /
/src/clos-types.lisp
1 (in-package :smoke)
2
3 (defclass cxx::number () ())
4
5 (defclass cxx::rational (cxx::number) ())
6
7 (defclass cxx::int (cxx::rational) ())
8 (defclass cxx::short (cxx::rational) ())
9
10
11 (defclass cxx::real (cxx::number) ())
12
13 (defclass cxx::float (cxx::real) ())
14 (defclass cxx::double (cxx::real) ())
15
16
17 (defclass cxx::char () ())
18 (defclass cxx::pointer ()
19 ((next)))
20 (defclass cxx::const ()
21 ((next)))
22
23
24 (defgeneric convert (from to))
25
26 (defmethod convert (from to)
27 (values nil nil))
28
29 (defun char->int (c)
30 (char-code c))
31
32 (defmethod convert ((from character) (to cxx::int))
33 (values #'char->int 1))
34
35 (defmethod convert (from (to cxx::const))
36 (call-next-method (const from) to))
37
38 (defmethod convert ((from cxx::const) (to cxx::const))
39 (call-next-method (next from) (next to)))
40
41 (defun float->int (f)
42 (round f))
43
44 (defmethod convert ((from float) (to cxx::int))
45 (values #'float->int 1))
46
47 (defmethod convert ((from string) (to cxx::char)))
48 ;(defmethod convert ((from string) (to qstring)))