]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/srecode/compile.el
Fix minor quoting problems in doc strings
[gnu-emacs] / lisp / cedet / srecode / compile.el
index 170b99c1fd2f7323d649370e27f3296aade56799..a8d6a5008bbda8457674781a0ac450d806754cc6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; srecode/compile --- Compilation of srecode template files.
 
-;; Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: codegeneration
@@ -34,6 +34,7 @@
 (eval-when-compile (require 'cl))
 (require 'semantic)
 (require 'eieio)
+(require 'cl-generic)
 (require 'eieio-base)
 (require 'srecode/table)
 (require 'srecode/dictionary)
@@ -87,10 +88,10 @@ for push, pop, and peek for the active template.")
 Useful if something goes wrong in SRecode, and the active template
 stack is broken."
   (interactive)
-  (if (oref srecode-template active)
+  (if (oref-default 'srecode-template active)
       (when (y-or-n-p (format "%d active templates.  Flush? "
-                             (length (oref srecode-template active))))
-       (oset-default srecode-template active nil))
+                             (length (oref-default 'srecode-template active))))
+       (oset-default 'srecode-template active nil))
     (message "No active templates to flush."))
   )
 
@@ -115,23 +116,23 @@ additional static argument data."))
 Plain text strings are not handled via this baseclass."
   :abstract t)
 
-(defmethod srecode-parse-input ((ins srecode-template-inserter)
-                               tag input STATE)
+(cl-defmethod srecode-parse-input ((_ins srecode-template-inserter)
+                                   _tag input _STATE)
   "For the template inserter INS, parse INPUT.
 Shorten input only by the amount needed.
 Return the remains of INPUT.
 STATE is the current compilation state."
   input)
 
-(defmethod srecode-match-end ((ins srecode-template-inserter) name)
+(cl-defmethod srecode-match-end ((_ins srecode-template-inserter) _name)
   "For the template inserter INS, do I end a section called NAME?"
   nil)
 
-(defmethod srecode-inserter-apply-state ((ins srecode-template-inserter) STATE)
+(cl-defmethod srecode-inserter-apply-state ((_ins srecode-template-inserter) _STATE)
   "For the template inserter INS, apply information from STATE."
   nil)
 
-(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter)
+(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter))
                                                  escape-start escape-end)
   "Insert an example using inserter INS.
 Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
@@ -158,7 +159,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
    )
   "Current state of the compile.")
 
-(defmethod srecode-compile-add-prompt ((state srecode-compile-state)
+(cl-defmethod srecode-compile-add-prompt ((state srecode-compile-state)
                                       prompttag)
   "Add PROMPTTAG to the current list of prompts."
   (with-slots (prompts) state
@@ -200,10 +201,11 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
   "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."))
+    (error "You have to activate semantic-mode to compile SRecode templates"))
   (require 'srecode/insert)
-  (message "Compiling template %s..."
-          (file-name-nondirectory (buffer-file-name)))
+  (when (called-interactively-p 'interactive)
+    (message "Compiling template %s..."
+            (file-name-nondirectory (buffer-file-name))))
   (let ((tags (semantic-fetch-tags))
        (tag nil)
        (class nil)
@@ -288,10 +290,11 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
        )
       ;; Continue
       (setq tags (cdr tags)))
-
+    
     ;; MSG - Before install since nreverse whacks our list.
-    (message "%d templates compiled for %s"
-            (length table) mode)
+    (when (called-interactively-p 'interactive)
+      (message "%d templates compiled for %s"
+              (length table) mode))
 
     ;;
     ;; APPLY TO MODE
@@ -316,12 +319,14 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
            (if (stringp project)
                (setq priority (+ 50 defaultdelta))
              (setq priority (+ 80 defaultdelta))))
-         (message "Templates %s has estimated priority of %d"
-                  (file-name-nondirectory (buffer-file-name))
-                  priority))
-      (message "Compiling templates %s priority %d... done!"
-              (file-name-nondirectory (buffer-file-name))
-              priority))
+         (when (called-interactively-p 'interactive)
+           (message "Templates %s has estimated priority of %d"
+                    (file-name-nondirectory (buffer-file-name))
+                    priority)))
+      (when (called-interactively-p 'interactive)
+       (message "Compiling templates %s priority %d... done!"
+                (file-name-nondirectory (buffer-file-name))
+                priority)))
 
     ;; Save it up!
     (srecode-compile-template-table table mode priority application framework project vars)
@@ -410,7 +415,7 @@ If END-NAME is specified, and the input string"
                                 (match-end 0)))
               (namestart (match-end 0))
               (junk (string-match regexend what namestart))
-              end tail name key)
+              end tail name)
          ;; Add string to compiled output
          (when (> (length prefix) 0)
            (setq comp (cons prefix comp)))
@@ -448,8 +453,7 @@ If END-NAME is specified, and the input string"
                          (semantic-tag-name tag)))
                  )
            ;; Add string to compiled output
-           (setq name (substring what namestart end)
-                 key nil)
+           (setq name (substring what namestart end))
            ;; Trim WHAT back.
            (setq what (substring what tail))
            ;; Get the inserter
@@ -510,15 +514,15 @@ to the inserter constructor."
   ;;(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))
+                  (equal (oref-default (car classes) key) key))
          ;; Create the new class, and apply state.
          (setq new (apply (car classes) name props))
          (srecode-inserter-apply-state new STATE)
@@ -591,10 +595,10 @@ A list of defined variables VARS provides a variable table."
 ;; Dump out information about the current srecoder compiled templates.
 ;;
 
-(defmethod srecode-dump ((tmp srecode-template))
+(cl-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")
@@ -637,15 +641,15 @@ Argument INDENT specifies the indentation level for the list."
        (princ "\n"))))
   )
 
-(defmethod srecode-dump ((ins srecode-template-inserter) indent)
+(cl-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))