-
Notifications
You must be signed in to change notification settings - Fork 2
/
clorb-supp.lisp
96 lines (61 loc) · 2.16 KB
/
clorb-supp.lisp
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
;;;; clorb-supp.lisp
(in-package :clorb)
;; For lack of better place to put it:
;; Special variable: *THE-ORB*
;; holds a reference to the singelton orb object when the orb has been initialized.
(defvar *the-orb* nil)
;;; Logging
(defvar *log-output* t)
(defun mess (level fmt &rest args)
(when (>= level *log-level*)
(apply #'cl:format *log-output*
(format nil "~~&~A ~A~~%"
(make-string level :initial-element #\;)
fmt)
args)
#-clisp
(finish-output *log-output*)))
(defun stroid (stream oid colon-p at-p)
(declare (ignore colon-p at-p))
(map nil
(lambda (octet)
(if (< 31 octet 127)
(princ (code-char octet) stream)
(format stream "<~x>" octet)))
oid))
;;;; Helper functions
(defun kwote (x)
"Return an expression that quotes X."
(list 'quote x))
(defun mklist (x)
"Return the list for list designator X."
(if (consp x) x (list x)))
(defun repeated (item)
"Return a cyclic list with element item."
(let ((x (list item)))
(setf (cdr x) x)
x))
(defun feature (name)
"Return feature symbol for IDL name.
The name is upcased and interned in the features package (nick OP)."
(intern (string-upcase name) :op))
(defun key (string)
"Return keyword symbol with name string."
(check-type string string)
(intern (string-upcase string) :keyword))
(defun prefixed-name (prefix-string name-symbol)
"Return symbol with same package as name-symbol and a name that is the
name of name-symbol prefixed with prefix-string."
(intern (concatenate 'string prefix-string (symbol-name name-symbol))
(symbol-package name-symbol)))
(defun tc-constant-name (symbol)
"Return the name of the constant for the TypeCode of a type symbol."
;; FIXME: Should prehaps only be used by the code generator
(prefixed-name "_TC_" symbol))
(defun ensure-corba-package (name &key nicknames export)
(let ((package (find-package name)))
(unless package
(setq package (make-package name :nicknames nicknames :use '())))
(export (mapcar (lambda (sym-name) (intern sym-name package)) export)
package)))
;;; clorb-supp.lisp ends here