;;; srecode/compile --- Compilation of srecode template files.
-;; Copyright (C) 2005, 2007-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: codegeneration
(defun srecode-compile-templates ()
"Compile a semantic recode template file into a mode-local variable."
(interactive)
+ (unless (semantic-active-p)
+ (error "You have to activate semantic-mode to compile SRecode templates."))
(require 'srecode/insert)
(message "Compiling template %s..."
(file-name-nondirectory (buffer-file-name)))
(buffer-file-name))))
(mode nil)
(application nil)
+ (framework nil)
(priority nil)
(project nil)
(vars nil)
)
((string= name "application")
(setq application (read firstvalue)))
+ ((string= name "framework")
+ (setq framework (read firstvalue)))
((string= name "priority")
(setq priority (read firstvalue)))
((string= name "project")
priority))
;; Save it up!
- (srecode-compile-template-table table mode priority application project vars)
+ (srecode-compile-template-table table mode priority application framework project vars)
)
)
(while (and comp (stringp (car comp)))
(setq comp (cdr comp)))
(or (not comp)
- (require 'srecode/insert)
- (srecode-template-inserter-newline-child-p (car comp))))
+ (progn (require 'srecode/insert)
+ (srecode-template-inserter-newline-child-p (car comp)))))
(defun srecode-compile-split-code (tag str STATE
&optional end-name)
;;(message "Compile: %s %S" name props)
(if (not key)
(apply 'srecode-template-inserter-variable name props)
- (let ((classes (class-children srecode-template-inserter))
+ (let ((classes (eieio-class-children srecode-template-inserter))
(new nil))
;; Loop over the various subclasses and
;; create the correct inserter.
(while (and (not new) classes)
- (setq classes (append classes (class-children (car classes))))
+ (setq classes (append classes (eieio-class-children (car classes))))
;; Do we have a match?
(when (and (not (class-abstract-p (car classes)))
(equal (oref (car classes) key) key))
(if (not new) (error "SRECODE: Unknown macro code %S" key))
new)))
-(defun srecode-compile-template-table (templates mode priority application project vars)
+(defun srecode-compile-template-table (templates mode priority application framework project vars)
"Compile a list of TEMPLATES into an semantic recode table.
The table being compiled is for MODE, or the string \"default\".
PRIORITY is a numerical value that indicates this tables location
in an ordered search.
APPLICATION is the name of the application these templates belong to.
+FRAMEWORK is the name of the framework these templates belong to.
PROJECT is a directory name which these templates scope to.
A list of defined variables VARS provides a variable table."
(let ((namehash (make-hash-table :test 'equal
:major-mode mode
:priority priority
:application application
+ :framework framework
:project project))
(tmpl (oref table templates)))
;; Loop over all the templates, and xref.
(defmethod srecode-dump ((tmp srecode-template))
"Dump the contents of the SRecode template tmp."
(princ "== Template \"")
- (princ (object-name-string tmp))
+ (princ (eieio-object-name-string tmp))
(princ "\" in context ")
(princ (oref tmp context))
(princ "\n")
(defmethod srecode-dump ((ins srecode-template-inserter) indent)
"Dump the state of the SRecode template inserter INS."
(princ "INS: \"")
- (princ (object-name-string ins))
+ (princ (eieio-object-name-string ins))
(when (oref ins :secondname)
(princ "\" : \"")
(princ (oref ins :secondname)))
(princ "\" type \"")
- (let* ((oc (symbol-name (object-class ins)))
+ (let* ((oc (symbol-name (eieio-object-class ins)))
(junk (string-match "srecode-template-inserter-" oc))
(on (if junk
(substring oc (match-end 0))