home *** CD-ROM | disk | FTP | other *** search
- ng format| z)))
- (setq atm (car z))
- (setq val (caddr z))
- (setq z (cdddr z))
- (cond ((not (numberp val))
- (%warn '|can bind only to numbers| val))
- ((or (not (symbolp atm)) (variablep atm))
- (%warn '|can bind only constant atoms| atm))
- ((and (setq old (literal-binding-of atm)) (not (equal old val)))
- (%warn '|attempt to rebind attribute| atm))
- (t (putprop atm val 'ops-bind)))
- (go top)))
-
- (defun literalize fexpr (l)
- (prog (class-name atts)
- (setq class-name (car l))
- (cond ((have-compiled-production)
- (%warn '|literalize called after p| class-name)
- (return nil))
- ((get class-name 'att-list)
- (%warn '|attempt to redefine class| class-name)
- (return nil)))
- (setq *class-list* (cons class-name *class-list*))
- (setq atts (remove-duplicates (cdr l)))
- (test-attribute-names atts)
- (mark-conflicts atts atts)
- (putprop class-name atts 'att-list)))
-
- (defun vector-attribute fexpr (l)
- (cond ((have-compiled-production)
- (%warn '|vector-attribute called after p| l))
- (t
- (test-attribute-names l)
- (mapc (function vector-attribute2) l))))
-
- (defun vector-attribute2 (att) (putprop att t 'vector-attribute))
-
- (defun is-vector-attribute (att) (get att 'vector-attribute))
-
- (defun test-attribute-names (l)
- (mapc (function test-attribute-names2) l))
-
- (defun test-attribute-names2 (atm)
- (cond ((or (not (symbolp atm)) (variablep atm))
- (%warn '|can bind only constant atoms| atm))))
-
- (defun finish-literalize nil
- (cond ((not (null *class-list*))
- (mapc (function note-user-assigns) *class-list*)
- (mapc (function assign-scalars) *class-list*)
- (mapc (function assign-vectors) *class-list*)
- (mapc (function put-ppdat) *class-list*)
- (mapc (function erase-literal-info) *class-list*)
- (setq *class-list* nil)
- (setq *buckets* nil))))
-
- (defun have-compiled-production nil (not (zerop *pcount*)))
-
- (defun put-ppdat (class)
- (prog (al att ppdat)
- (setq ppdat nil)
- (setq al (get class 'att-list))
- top (cond ((not (atom al))
- (setq att (car al))
- (setq al (cdr al))
- (setq ppdat
- (cons (cons (literal-binding-of att) att)
- ppdat))
- (go top)))
- (putprop class ppdat 'ppdat)))
-
- ; note-user-assigns and note-user-vector-assigns are needed only when
- ; literal and literalize are both used in a program. They make sure that
- ; the assignments that are made explicitly with literal do not cause problems
- ; for the literalized classes.
-
- (defun note-user-assigns (class)
- (mapc (function note-user-assigns2) (get class 'att-list)))
-
- (defun note-user-assigns2 (att)
- (prog (num conf buck clash)
- (setq num (literal-binding-of att))
- (and (null num) (return nil))
- (setq conf (get att 'conflicts))
- (setq buck (store-binding att num))
- (setq clash (find-common-atom buck conf))
- (and clash
- (%warn '|attributes in a class assigned the same number|
- (cons att clash)))
- (return nil)))
-
- (defun note-user-vector-assigns (att given needed)
- (and (> needed given)
- (%warn '|vector attribute assigned too small a value in literal| att)))
-
- (defun assign-scalars (class)
- (mapc (function assign-scalars2) (get class 'att-list)))
-
- (defun assign-scalars2 (att)
- (prog (tlist num bucket conf)
- (and (literal-binding-of att) (return nil))
- (and (is-vector-attribute att) (return nil))
- (setq tlist (buckets))
- (setq conf (get att 'conflicts))
- top (cond ((atom tlist)
- (%warn '|could not generate a binding| att)
- (store-binding