1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;; Confidential and proprietary information of ITA Software, Inc. ;;;
5 ;;; Copyright (c) 2012 ITA Software, Inc. All rights reserved. ;;;
7 ;;; Original author: Scott McKay ;;;
9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11 (in-package "PROTO-IMPL")
16 (defun proto-class-name (x)
17 (remove-if-not #'alphanumericp
18 (camel-case (format nil "~A" x) :separators '(#\- #\_ #\/))))
20 (defun proto-field-name (x)
21 (remove-if-not #'alphanumericp
22 (camel-case-but-one (format nil "~A" x) :separators '(#\- #\_ #\/ #\.))))
24 (defun proto-enum-name (x &optional prefix)
25 (let* ((x (string-upcase (string x)))
26 (x (if (and prefix (starts-with x prefix)) (subseq x (length prefix)) x)))
27 (remove-if-not #'(lambda (x) (or (alphanumericp x) (eql x #\_)))
28 (format nil "~{~A~^_~}" (split-string x :separators '(#\- #\_ #\/ #\.))))))
34 (defmacro i+ (&rest fixnums)
35 `(the fixnum (+ ,@(loop for n in fixnums collect `(the fixnum ,n)))))
37 (defmacro i- (number &rest fixnums)
38 `(the fixnum (- (the fixnum ,number) ,@(loop for n in fixnums collect `(the fixnum ,n)))))
40 (defmacro i= (&rest fixnums)
41 `(= ,@(loop for n in fixnums collect `(the fixnum ,n))))
43 (defmacro i< (&rest fixnums)
44 `(< ,@(loop for n in fixnums collect `(the fixnum ,n))))
46 (defmacro i> (&rest fixnums)
47 `(> ,@(loop for n in fixnums collect `(the fixnum ,n))))
49 (defmacro iash (value count)
50 `(the fixnum (ash (the fixnum ,value) (the fixnum ,count))))
52 (defmacro ilogior (&rest fixnums)
54 `(the fixnum (logior (the fixnum ,(car fixnums))
56 `(ilogior ,@(cdr fixnums))
57 `(the fixnum ,(cadr fixnums)))))
58 `(the fixnum ,(car fixnums))))
60 (defmacro ilogand (&rest fixnums)
62 `(the fixnum (logand (the fixnum ,(car fixnums))
64 `(ilogand ,@(cdr fixnums))
65 `(the fixnum ,(cadr fixnums)))))
66 `(the fixnum ,(car fixnums))))
68 (define-modify-macro iincf (&optional (delta 1)) i+)
69 (define-modify-macro idecf (&optional (delta 1)) i-)