aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cedet/srecode
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/srecode')
-rw-r--r--lisp/cedet/srecode/args.el24
-rw-r--r--lisp/cedet/srecode/compile.el10
-rw-r--r--lisp/cedet/srecode/cpp.el3
-rw-r--r--lisp/cedet/srecode/dictionary.el8
-rw-r--r--lisp/cedet/srecode/insert.el4
-rw-r--r--lisp/cedet/srecode/java.el21
-rw-r--r--lisp/cedet/srecode/map.el3
-rw-r--r--lisp/cedet/srecode/mode.el2
-rw-r--r--lisp/cedet/srecode/srt-mode.el6
-rw-r--r--lisp/cedet/srecode/srt.el6
-rw-r--r--lisp/cedet/srecode/table.el2
11 files changed, 68 insertions, 21 deletions
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index b91f96f611d..d6798f7523d 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -157,6 +157,30 @@ do not contain any text from preceding or following text."
157 (srecode-dictionary-show-section dict "RCS") 157 (srecode-dictionary-show-section dict "RCS")
158 ))) 158 )))
159 159
160;;; :project ARGUMENT HANDLING
161;;
162;; When the :project argument is required, fill the dictionary with
163;; information that the current project (from EDE) might know
164(defun srecode-semantic-handle-:project (dict)
165 "Add macros into the dictionary DICT based on the current ede project."
166 (let* ((bfn (buffer-file-name))
167 (dir (file-name-directory bfn)))
168 (if (ede-toplevel)
169 (let* ((projecttop (ede-toplevel-project default-directory))
170 (relfname (file-relative-name bfn projecttop))
171 (reldir (file-relative-name dir projecttop))
172 )
173 (srecode-dictionary-set-value dict "PROJECT_FILENAME" relfname)
174 (srecode-dictionary-set-value dict "PROJECT_DIRECTORY" reldir)
175 (srecode-dictionary-set-value dict "PROJECT_NAME" (ede-name (ede-toplevel)))
176 (srecode-dictionary-set-value dict "PROJECT_VERSION" (oref (ede-toplevel) :version))
177 )
178 ;; If there is no EDE project, then put in some base values.
179 (srecode-dictionary-set-value dict "PROJECT_FILENAME" bfn)
180 (srecode-dictionary-set-value dict "PROJECT_DIRECTORY" dir)
181 (srecode-dictionary-set-value dict "PROJECT_NAME" "N/A")
182 (srecode-dictionary-set-value dict "PROJECT_VERSION" "1.0"))))
183
160;;; :system ARGUMENT HANDLING 184;;; :system ARGUMENT HANDLING
161;; 185;;
162;; When a :system argument is required, fill the dictionary with 186;; When a :system argument is required, fill the dictionary with
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index 170b99c1fd2..0d68036c433 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -510,12 +510,12 @@ to the inserter constructor."
510 ;;(message "Compile: %s %S" name props) 510 ;;(message "Compile: %s %S" name props)
511 (if (not key) 511 (if (not key)
512 (apply 'srecode-template-inserter-variable name props) 512 (apply 'srecode-template-inserter-variable name props)
513 (let ((classes (class-children srecode-template-inserter)) 513 (let ((classes (eieio-class-children srecode-template-inserter))
514 (new nil)) 514 (new nil))
515 ;; Loop over the various subclasses and 515 ;; Loop over the various subclasses and
516 ;; create the correct inserter. 516 ;; create the correct inserter.
517 (while (and (not new) classes) 517 (while (and (not new) classes)
518 (setq classes (append classes (class-children (car classes)))) 518 (setq classes (append classes (eieio-class-children (car classes))))
519 ;; Do we have a match? 519 ;; Do we have a match?
520 (when (and (not (class-abstract-p (car classes))) 520 (when (and (not (class-abstract-p (car classes)))
521 (equal (oref (car classes) key) key)) 521 (equal (oref (car classes) key) key))
@@ -594,7 +594,7 @@ A list of defined variables VARS provides a variable table."
594(defmethod srecode-dump ((tmp srecode-template)) 594(defmethod srecode-dump ((tmp srecode-template))
595 "Dump the contents of the SRecode template tmp." 595 "Dump the contents of the SRecode template tmp."
596 (princ "== Template \"") 596 (princ "== Template \"")
597 (princ (object-name-string tmp)) 597 (princ (eieio-object-name-string tmp))
598 (princ "\" in context ") 598 (princ "\" in context ")
599 (princ (oref tmp context)) 599 (princ (oref tmp context))
600 (princ "\n") 600 (princ "\n")
@@ -640,12 +640,12 @@ Argument INDENT specifies the indentation level for the list."
640(defmethod srecode-dump ((ins srecode-template-inserter) indent) 640(defmethod srecode-dump ((ins srecode-template-inserter) indent)
641 "Dump the state of the SRecode template inserter INS." 641 "Dump the state of the SRecode template inserter INS."
642 (princ "INS: \"") 642 (princ "INS: \"")
643 (princ (object-name-string ins)) 643 (princ (eieio-object-name-string ins))
644 (when (oref ins :secondname) 644 (when (oref ins :secondname)
645 (princ "\" : \"") 645 (princ "\" : \"")
646 (princ (oref ins :secondname))) 646 (princ (oref ins :secondname)))
647 (princ "\" type \"") 647 (princ "\" type \"")
648 (let* ((oc (symbol-name (object-class ins))) 648 (let* ((oc (symbol-name (eieio-object-class ins)))
649 (junk (string-match "srecode-template-inserter-" oc)) 649 (junk (string-match "srecode-template-inserter-" oc))
650 (on (if junk 650 (on (if junk
651 (substring oc (match-end 0)) 651 (substring oc (match-end 0))
diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el
index 94b394a1631..fd500b6d9a3 100644
--- a/lisp/cedet/srecode/cpp.el
+++ b/lisp/cedet/srecode/cpp.el
@@ -70,8 +70,7 @@ HEADER - Shown section if in a header file."
70 (srecode-dictionary-show-section dict "NOTHEADER")) 70 (srecode-dictionary-show-section dict "NOTHEADER"))
71 71
72 ;; Strip out bad characters 72 ;; Strip out bad characters
73 (while (string-match "\\.\\| " fsym) 73 (setq fsym (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" fsym))
74 (setq fsym (replace-match "_" t t fsym)))
75 (srecode-dictionary-set-value dict "FILENAME_SYMBOL" fsym) 74 (srecode-dictionary-set-value dict "FILENAME_SYMBOL" fsym)
76 ) 75 )
77 ) 76 )
diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el
index bac05666726..bbc791f09d8 100644
--- a/lisp/cedet/srecode/dictionary.el
+++ b/lisp/cedet/srecode/dictionary.el
@@ -175,7 +175,7 @@ associated with a buffer or parent."
175 ((srecode-dictionary-child-p buffer-or-parent) 175 ((srecode-dictionary-child-p buffer-or-parent)
176 (setq parent buffer-or-parent 176 (setq parent buffer-or-parent
177 buffer (oref buffer-or-parent buffer) 177 buffer (oref buffer-or-parent buffer)
178 origin (concat (object-name buffer-or-parent) " in " 178 origin (concat (eieio-object-name buffer-or-parent) " in "
179 (if buffer (buffer-name buffer) 179 (if buffer (buffer-name buffer)
180 "no buffer"))) 180 "no buffer")))
181 (when buffer 181 (when buffer
@@ -454,12 +454,12 @@ If you subclass `srecode-dictionary-compound-value' then this
454method could return nil, but if it does that, it must insert 454method could return nil, but if it does that, it must insert
455the value itself using `princ', or by detecting if the current 455the value itself using `princ', or by detecting if the current
456standard out is a buffer, and using `insert'." 456standard out is a buffer, and using `insert'."
457 (object-name cp)) 457 (eieio-object-name cp))
458 458
459(defmethod srecode-dump ((cp srecode-dictionary-compound-value) 459(defmethod srecode-dump ((cp srecode-dictionary-compound-value)
460 &optional indent) 460 &optional indent)
461 "Display information about this compound value." 461 "Display information about this compound value."
462 (princ (object-name cp)) 462 (princ (eieio-object-name cp))
463 ) 463 )
464 464
465(defmethod srecode-compound-toString ((cp srecode-dictionary-compound-variable) 465(defmethod srecode-compound-toString ((cp srecode-dictionary-compound-variable)
@@ -654,7 +654,7 @@ STATE is the current compiler state."
654 4))) 654 4)))
655 (while entry 655 (while entry
656 (princ " --> SUBDICTIONARY ") 656 (princ " --> SUBDICTIONARY ")
657 (princ (object-name dict)) 657 (princ (eieio-object-name dict))
658 (princ "\n") 658 (princ "\n")
659 (srecode-dump (car entry) newindent) 659 (srecode-dump (car entry) newindent)
660 (setq entry (cdr entry)) 660 (setq entry (cdr entry))
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index 466efae3b9c..0d647bb56c5 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -809,7 +809,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
809 (srecode-insert-report-error 809 (srecode-insert-report-error
810 dict 810 dict
811 "Only section dictionaries allowed for `%s'" 811 "Only section dictionaries allowed for `%s'"
812 (object-name-string sti))) 812 (eieio-object-name-string sti)))
813 813
814 ;; Output the code from the sub-template. 814 ;; Output the code from the sub-template.
815 (srecode-insert-method (slot-value sti slot) dict)) 815 (srecode-insert-method (slot-value sti slot) dict))
@@ -866,7 +866,7 @@ Return the remains of INPUT."
866 (let* ((out (srecode-compile-split-code tag input STATE 866 (let* ((out (srecode-compile-split-code tag input STATE
867 (oref ins :object-name)))) 867 (oref ins :object-name))))
868 (oset ins template (srecode-template 868 (oset ins template (srecode-template
869 (object-name-string ins) 869 (eieio-object-name-string ins)
870 :context nil 870 :context nil
871 :args nil 871 :args nil
872 :code (cdr out))) 872 :code (cdr out)))
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index db4d2deee28..29a8465c45c 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -42,9 +42,24 @@ FILENAME_AS_CLASS - file converted to a Java class name."
42 ) 42 )
43 (while (string-match "\\.\\| " fpak) 43 (while (string-match "\\.\\| " fpak)
44 (setq fpak (replace-match "_" t t fpak))) 44 (setq fpak (replace-match "_" t t fpak)))
45 (if (string-match "src/" dir) 45 ;; We can extract package from:
46 (setq dir (substring dir (match-end 0))) 46 ;; 1) a java EDE project source paths,
47 (setq dir (file-name-nondirectory (directory-file-name dir)))) 47 (cond ((ede-current-project)
48 (let* ((proj (ede-current-project))
49 (pths (ede-source-paths proj 'java-mode))
50 (pth)
51 (res))
52 (while (and (not res)
53 (setq pth (expand-file-name (car pths))))
54 (when (string-match pth dir)
55 (setq res (substring dir (match-end 0))))
56 (setq pths (cdr pths)))
57 (setq dir res)))
58 ;; 2) a simple heuristic
59 ((string-match "src/" dir)
60 (setq dir (substring dir (match-end 0))))
61 ;; 3) outer directory as a fallback
62 (t (setq dir (file-name-nondirectory (directory-file-name dir)))))
48 (setq dir (directory-file-name dir)) 63 (setq dir (directory-file-name dir))
49 (while (string-match "/" dir) 64 (while (string-match "/" dir)
50 (setq dir (replace-match "." t t dir))) 65 (setq dir (replace-match "." t t dir)))
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index cbe602f3299..1dd9ba4cf47 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -363,6 +363,9 @@ Return non-nil if the map changed."
363 (let ((semantic-init-hook nil)) 363 (let ((semantic-init-hook nil))
364 (semantic-new-buffer-fcn)) 364 (semantic-new-buffer-fcn))
365 ) 365 )
366 ;; Force semantic to be enabled in this buffer.
367 (unless (semantic-active-p)
368 (semantic-new-buffer-fcn))
366 369
367 (semantic-fetch-tags) 370 (semantic-fetch-tags)
368 (let* ((mode-tag 371 (let* ((mode-tag
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el
index 8c4a53ec891..e8e1c78198e 100644
--- a/lisp/cedet/srecode/mode.el
+++ b/lisp/cedet/srecode/mode.el
@@ -225,7 +225,7 @@ MENU-DEF is the menu to bind this into."
225 (ctxtcons (assoc ctxt alltabs)) 225 (ctxtcons (assoc ctxt alltabs))
226 (bind (if (slot-boundp temp 'binding) 226 (bind (if (slot-boundp temp 'binding)
227 (oref temp binding))) 227 (oref temp binding)))
228 (name (object-name-string temp))) 228 (name (eieio-object-name-string temp)))
229 229
230 (when (not ctxtcons) 230 (when (not ctxtcons)
231 (if (string= context ctxt) 231 (if (string= context ctxt)
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index 455895c003d..2f43dc3872b 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -187,7 +187,7 @@ we can tell font lock about them.")
187 "Keymap used in srecode mode.") 187 "Keymap used in srecode mode.")
188 188
189;;;###autoload 189;;;###autoload
190(define-derived-mode srecode-template-mode fundamental-mode "SRecorder" 190(define-derived-mode srecode-template-mode fundamental-mode "SRecode"
191 "Major-mode for writing SRecode macros." 191 "Major-mode for writing SRecode macros."
192 (set (make-local-variable 'comment-start) ";;") 192 (set (make-local-variable 'comment-start) ";;")
193 (set (make-local-variable 'comment-end) "") 193 (set (make-local-variable 'comment-end) "")
@@ -232,7 +232,7 @@ we can tell font lock about them.")
232 "Provide help for working with macros in a template." 232 "Provide help for working with macros in a template."
233 (interactive) 233 (interactive)
234 (let* ((root 'srecode-template-inserter) 234 (let* ((root 'srecode-template-inserter)
235 (chl (aref (class-v root) class-children)) 235 (chl (eieio--class-children (class-v root)))
236 (ess (srecode-template-get-escape-start)) 236 (ess (srecode-template-get-escape-start))
237 (ees (srecode-template-get-escape-end)) 237 (ees (srecode-template-get-escape-end))
238 ) 238 )
@@ -248,7 +248,7 @@ we can tell font lock about them.")
248 (showexample t) 248 (showexample t)
249 ) 249 )
250 (setq chl (cdr chl)) 250 (setq chl (cdr chl))
251 (setq chl (append (aref (class-v C) class-children) chl)) 251 (setq chl (append (eieio--class-children (class-v C)) chl))
252 252
253 (catch 'skip 253 (catch 'skip
254 (when (eq C 'srecode-template-inserter-section-end) 254 (when (eq C 'srecode-template-inserter-section-end)
diff --git a/lisp/cedet/srecode/srt.el b/lisp/cedet/srecode/srt.el
index 3875246cb37..1fad31dafd6 100644
--- a/lisp/cedet/srecode/srt.el
+++ b/lisp/cedet/srecode/srt.el
@@ -69,6 +69,7 @@ DEFAULT is the default if RET is hit."
69 nil initial (or hist 'srecode-read-major-mode-history)) 69 nil initial (or hist 'srecode-read-major-mode-history))
70 ) 70 )
71 71
72;;;###autoload
72(defun srecode-semantic-handle-:srt (dict) 73(defun srecode-semantic-handle-:srt (dict)
73 "Add macros into the dictionary DICT based on the current SRT file. 74 "Add macros into the dictionary DICT based on the current SRT file.
74Adds the following: 75Adds the following:
@@ -104,4 +105,9 @@ MODE - The mode of this buffer. If not declared yet, guess."
104 105
105(provide 'srecode/srt) 106(provide 'srecode/srt)
106 107
108;; Local variables:
109;; generated-autoload-file: "loaddefs.el"
110;; generated-autoload-load-name: "srecode/srt"
111;; End:
112
107;;; srecode/srt.el ends here 113;;; srecode/srt.el ends here
diff --git a/lisp/cedet/srecode/table.el b/lisp/cedet/srecode/table.el
index 802740ba063..26163bd1e51 100644
--- a/lisp/cedet/srecode/table.el
+++ b/lisp/cedet/srecode/table.el
@@ -251,7 +251,7 @@ Use PREDICATE is the same as for the `sort' function."
251(defmethod srecode-dump ((tab srecode-template-table)) 251(defmethod srecode-dump ((tab srecode-template-table))
252 "Dump the contents of the SRecode template table TAB." 252 "Dump the contents of the SRecode template table TAB."
253 (princ "Template Table for ") 253 (princ "Template Table for ")
254 (princ (object-name-string tab)) 254 (princ (eieio-object-name-string tab))
255 (princ "\nPriority: ") 255 (princ "\nPriority: ")
256 (prin1 (oref tab :priority)) 256 (prin1 (oref tab :priority))
257 (when (oref tab :application) 257 (when (oref tab :application)