Update copyright notices for 2013.
[bpt/emacs.git] / lisp / cedet / srecode / compile.el
index d65cd2b..170b99c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; srecode/compile --- Compilation of srecode template files.
 
-;; Copyright (C) 2005, 2007-201 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: codegeneration
@@ -62,7 +62,7 @@
    (dictionary :initarg :dictionary
               :type (or null srecode-dictionary)
               :documentation
-              "List of section dictinaries.
+              "List of section dictionaries.
 The compiled template can contain lists of section dictionaries,
 or values that are expected to be passed down into different
 section macros.  The template section dictionaries are merged in with
@@ -199,6 +199,8 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
 (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)))
@@ -210,6 +212,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
                                       (buffer-file-name))))
        (mode nil)
        (application nil)
+       (framework nil)
        (priority nil)
        (project nil)
        (vars nil)
@@ -253,6 +256,8 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
                     )
                    ((string= name "application")
                     (setq application (read firstvalue)))
+                   ((string= name "framework")
+                    (setq framework (read firstvalue)))
                    ((string= name "priority")
                     (setq priority (read firstvalue)))
                    ((string= name "project")
@@ -319,7 +324,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
               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)
     )
 )
 
@@ -376,8 +381,8 @@ It is hard if the previous inserter is a newline object."
   (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)
@@ -522,12 +527,13 @@ to the inserter constructor."
       (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
@@ -569,6 +575,7 @@ A list of defined variables VARS provides a variable table."
                   :major-mode mode
                   :priority priority
                   :application application
+                  :framework framework
                   :project project))
           (tmpl (oref table templates)))
       ;; Loop over all the templates, and xref.