aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cedet/srecode/insert.el
diff options
context:
space:
mode:
authorStefan Monnier2015-02-04 13:49:49 -0500
committerStefan Monnier2015-02-04 13:49:49 -0500
commit73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121 (patch)
treefc2ee663521960bf1c102bb98a72f31903e5110b /lisp/cedet/srecode/insert.el
parent102a21d68976ab9dc85304e0bc47b7562d3cf93f (diff)
downloademacs-73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121.tar.gz
emacs-73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121.zip
* lisp/cedet: Use cl-generic instead of EIEIO's defgeneric/defmethod
* lisp/cedet/**/*.el: Mechanically replace all calls to defmethod/defgeneric by calls to cl-defmethod/cl-defgeneric. * lisp/cedet/srecode/table.el: * lisp/cedet/srecode/fields.el: * lisp/cedet/srecode/dictionary.el: * lisp/cedet/srecode/compile.el: * lisp/cedet/semantic/debug.el: * lisp/cedet/semantic/db-ref.el: * lisp/cedet/ede/base.el: * lisp/cedet/ede/auto.el: * lisp/cedet/ede.el: Require `cl-generic'.
Diffstat (limited to 'lisp/cedet/srecode/insert.el')
-rw-r--r--lisp/cedet/srecode/insert.el82
1 files changed, 41 insertions, 41 deletions
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index 78ec1658859..0c13ee51e34 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -260,20 +260,20 @@ Optional argument TEMP is the template that is getting its arguments resolved."
260;; Code managing the top-level insert method and the current 260;; Code managing the top-level insert method and the current
261;; insertion stack. 261;; insertion stack.
262;; 262;;
263(defmethod srecode-push ((st srecode-template)) 263(cl-defmethod srecode-push ((st srecode-template))
264 "Push the srecoder template ST onto the active stack." 264 "Push the srecoder template ST onto the active stack."
265 (oset st active (cons st (oref st active)))) 265 (oset st active (cons st (oref st active))))
266 266
267(defmethod srecode-pop :STATIC ((st srecode-template)) 267(cl-defmethod srecode-pop ((st (subclass srecode-template)))
268 "Pop the srecoder template ST onto the active stack. 268 "Pop the srecoder template ST onto the active stack.
269ST can be a class, or an object." 269ST can be a class, or an object."
270 (oset st active (cdr (oref st active)))) 270 (oset st active (cdr (oref st active))))
271 271
272(defmethod srecode-peek :STATIC ((st srecode-template)) 272(cl-defmethod srecode-peek ((st (subclass srecode-template)))
273 "Fetch the topmost active template record. ST can be a class." 273 "Fetch the topmost active template record. ST can be a class."
274 (car (oref st active))) 274 (car (oref st active)))
275 275
276(defmethod srecode-insert-method ((st srecode-template) dictionary) 276(cl-defmethod srecode-insert-method ((st srecode-template) dictionary)
277 "Insert the srecoder template ST." 277 "Insert the srecoder template ST."
278 ;; Merge any template entries into the input dictionary. 278 ;; Merge any template entries into the input dictionary.
279 ;; This may happen twice since some templates arguments need 279 ;; This may happen twice since some templates arguments need
@@ -324,7 +324,7 @@ by themselves.")
324Specify the :indent argument to enable automatic indentation when newlines 324Specify the :indent argument to enable automatic indentation when newlines
325occur in your template.") 325occur in your template.")
326 326
327(defmethod srecode-insert-method ((sti srecode-template-inserter-newline) 327(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-newline)
328 dictionary) 328 dictionary)
329 "Insert the STI inserter." 329 "Insert the STI inserter."
330 ;; To be safe, indent the previous line since the template will 330 ;; To be safe, indent the previous line since the template will
@@ -363,9 +363,9 @@ occur in your template.")
363 ((stringp i) 363 ((stringp i)
364 (princ i)))))) 364 (princ i))))))
365 365
366(defmethod srecode-dump ((ins srecode-template-inserter-newline) indent) 366(cl-defmethod srecode-dump ((ins srecode-template-inserter-newline) indent)
367 "Dump the state of the SRecode template inserter INS." 367 "Dump the state of the SRecode template inserter INS."
368 (call-next-method) 368 (cl-call-next-method)
369 (when (oref ins hard) 369 (when (oref ins hard)
370 (princ " : hard") 370 (princ " : hard")
371 )) 371 ))
@@ -388,7 +388,7 @@ When set to 'end it will insert a CR if we are not at 'eol'.")
388 "Insert a newline before and after a template, and possibly do indenting. 388 "Insert a newline before and after a template, and possibly do indenting.
389Specify the :blank argument to enable this inserter.") 389Specify the :blank argument to enable this inserter.")
390 390
391(defmethod srecode-insert-method ((sti srecode-template-inserter-blank) 391(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-blank)
392 dictionary) 392 dictionary)
393 "Make sure there is no text before or after point." 393 "Make sure there is no text before or after point."
394 (let ((i (srecode-dictionary-lookup-name dictionary "INDENT")) 394 (let ((i (srecode-dictionary-lookup-name dictionary "INDENT"))
@@ -425,7 +425,7 @@ Specify the :blank argument to enable this inserter.")
425 ) 425 )
426 "Allow comments within template coding. This inserts nothing.") 426 "Allow comments within template coding. This inserts nothing.")
427 427
428(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-comment) 428(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-comment))
429 escape-start escape-end) 429 escape-start escape-end)
430 "Insert an example using inserter INS. 430 "Insert an example using inserter INS.
431Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." 431Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
@@ -436,7 +436,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
436 (terpri) 436 (terpri)
437 ) 437 )
438 438
439(defmethod srecode-insert-method ((sti srecode-template-inserter-comment) 439(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-comment)
440 dictionary) 440 dictionary)
441 "Don't insert anything for comment macros in STI." 441 "Don't insert anything for comment macros in STI."
442 nil) 442 nil)
@@ -453,7 +453,7 @@ If there is no entry, insert nothing.")
453(defvar srecode-inserter-variable-current-dictionary nil 453(defvar srecode-inserter-variable-current-dictionary nil
454 "The active dictionary when calling a variable filter.") 454 "The active dictionary when calling a variable filter.")
455 455
456(defmethod srecode-insert-variable-secondname-handler 456(cl-defmethod srecode-insert-variable-secondname-handler
457 ((sti srecode-template-inserter-variable) dictionary value secondname) 457 ((sti srecode-template-inserter-variable) dictionary value secondname)
458 "For VALUE handle SECONDNAME behaviors for this variable inserter. 458 "For VALUE handle SECONDNAME behaviors for this variable inserter.
459Return the result as a string. 459Return the result as a string.
@@ -471,7 +471,7 @@ If SECONDNAME is nil, return VALUE."
471 (object-print sti) secondname))) 471 (object-print sti) secondname)))
472 value)) 472 value))
473 473
474(defmethod srecode-insert-method ((sti srecode-template-inserter-variable) 474(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-variable)
475 dictionary) 475 dictionary)
476 "Insert the STI inserter." 476 "Insert the STI inserter."
477 ;; Convert the name into a name/fcn pair 477 ;; Convert the name into a name/fcn pair
@@ -541,7 +541,7 @@ If there is no entry, prompt the user for the value to use.
541The prompt text used is derived from the previous PROMPT command in the 541The prompt text used is derived from the previous PROMPT command in the
542template file.") 542template file.")
543 543
544(defmethod srecode-inserter-apply-state 544(cl-defmethod srecode-inserter-apply-state
545 ((ins srecode-template-inserter-ask) STATE) 545 ((ins srecode-template-inserter-ask) STATE)
546 "For the template inserter INS, apply information from STATE. 546 "For the template inserter INS, apply information from STATE.
547Loop over the prompts to see if we have a match." 547Loop over the prompts to see if we have a match."
@@ -561,14 +561,14 @@ Loop over the prompts to see if we have a match."
561 (setq prompts (cdr prompts))) 561 (setq prompts (cdr prompts)))
562 )) 562 ))
563 563
564(defmethod srecode-insert-method ((sti srecode-template-inserter-ask) 564(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-ask)
565 dictionary) 565 dictionary)
566 "Insert the STI inserter." 566 "Insert the STI inserter."
567 (let ((val (srecode-dictionary-lookup-name 567 (let ((val (srecode-dictionary-lookup-name
568 dictionary (oref sti :object-name)))) 568 dictionary (oref sti :object-name))))
569 (if val 569 (if val
570 ;; Does some extra work. Oh well. 570 ;; Does some extra work. Oh well.
571 (call-next-method) 571 (cl-call-next-method)
572 572
573 ;; How is our -ask value determined? 573 ;; How is our -ask value determined?
574 (if srecode-insert-with-fields-in-progress 574 (if srecode-insert-with-fields-in-progress
@@ -585,9 +585,9 @@ Loop over the prompts to see if we have a match."
585 585
586 ;; Now that this value is safely stowed in the dictionary, 586 ;; Now that this value is safely stowed in the dictionary,
587 ;; we can do what regular inserters do. 587 ;; we can do what regular inserters do.
588 (call-next-method)))) 588 (cl-call-next-method))))
589 589
590(defmethod srecode-insert-ask-default ((sti srecode-template-inserter-ask) 590(cl-defmethod srecode-insert-ask-default ((sti srecode-template-inserter-ask)
591 dictionary) 591 dictionary)
592 "Derive the default value for an askable inserter STI. 592 "Derive the default value for an askable inserter STI.
593DICTIONARY is used to derive some values." 593DICTIONARY is used to derive some values."
@@ -612,7 +612,7 @@ DICTIONARY is used to derive some values."
612 dictionary 612 dictionary
613 "Unknown default for prompt: %S" defaultfcn))))) 613 "Unknown default for prompt: %S" defaultfcn)))))
614 614
615(defmethod srecode-insert-method-ask ((sti srecode-template-inserter-ask) 615(cl-defmethod srecode-insert-method-ask ((sti srecode-template-inserter-ask)
616 dictionary) 616 dictionary)
617 "Do the \"asking\" for the template inserter STI. 617 "Do the \"asking\" for the template inserter STI.
618Use DICTIONARY to resolve values." 618Use DICTIONARY to resolve values."
@@ -646,7 +646,7 @@ Use DICTIONARY to resolve values."
646 val) 646 val)
647 ) 647 )
648 648
649(defmethod srecode-insert-method-field ((sti srecode-template-inserter-ask) 649(cl-defmethod srecode-insert-method-field ((sti srecode-template-inserter-ask)
650 dictionary) 650 dictionary)
651 "Create an editable field for the template inserter STI. 651 "Create an editable field for the template inserter STI.
652Use DICTIONARY to resolve values." 652Use DICTIONARY to resolve values."
@@ -661,9 +661,9 @@ Use DICTIONARY to resolve values."
661 ;; across multiple locations. 661 ;; across multiple locations.
662 compound-value)) 662 compound-value))
663 663
664(defmethod srecode-dump ((ins srecode-template-inserter-ask) indent) 664(cl-defmethod srecode-dump ((ins srecode-template-inserter-ask) indent)
665 "Dump the state of the SRecode template inserter INS." 665 "Dump the state of the SRecode template inserter INS."
666 (call-next-method) 666 (cl-call-next-method)
667 (princ " : \"") 667 (princ " : \"")
668 (princ (oref ins prompt)) 668 (princ (oref ins prompt))
669 (princ "\"") 669 (princ "\"")
@@ -681,7 +681,7 @@ Thus a specification of `10:left' will insert the value of A
681to 10 characters, with spaces added to the left. Use `right' for adding 681to 10 characters, with spaces added to the left. Use `right' for adding
682spaces to the right.") 682spaces to the right.")
683 683
684(defmethod srecode-insert-variable-secondname-handler 684(cl-defmethod srecode-insert-variable-secondname-handler
685 ((sti srecode-template-inserter-width) dictionary value width) 685 ((sti srecode-template-inserter-width) dictionary value width)
686 "For VALUE handle WIDTH behaviors for this variable inserter. 686 "For VALUE handle WIDTH behaviors for this variable inserter.
687Return the result as a string. 687Return the result as a string.
@@ -714,7 +714,7 @@ By default, treat as a function name."
714 (concat padchars value) 714 (concat padchars value)
715 (concat value padchars)))))) 715 (concat value padchars))))))
716 716
717(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-width) 717(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-width))
718 escape-start escape-end) 718 escape-start escape-end)
719 "Insert an example using inserter INS. 719 "Insert an example using inserter INS.
720Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." 720Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
@@ -750,7 +750,7 @@ The cursor is placed at the ^ macro after insertion.
750Some inserter macros, such as `srecode-template-inserter-include-wrap' 750Some inserter macros, such as `srecode-template-inserter-include-wrap'
751will place text at the ^ macro from the included macro.") 751will place text at the ^ macro from the included macro.")
752 752
753(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-point) 753(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-point))
754 escape-start escape-end) 754 escape-start escape-end)
755 "Insert an example using inserter INS. 755 "Insert an example using inserter INS.
756Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." 756Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
@@ -761,7 +761,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
761 (terpri) 761 (terpri)
762 ) 762 )
763 763
764(defmethod srecode-insert-method ((sti srecode-template-inserter-point) 764(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-point)
765 dictionary) 765 dictionary)
766 "Insert the STI inserter. 766 "Insert the STI inserter.
767Save point in the class allocated 'point' slot. 767Save point in the class allocated 'point' slot.
@@ -787,11 +787,11 @@ generalized marker will do something else. See
787 "Wrap a section of a template under the control of a macro." 787 "Wrap a section of a template under the control of a macro."
788 :abstract t) 788 :abstract t)
789 789
790(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-subtemplate) 790(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-subtemplate))
791 escape-start escape-end) 791 escape-start escape-end)
792 "Insert an example using inserter INS. 792 "Insert an example using inserter INS.
793Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." 793Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
794 (call-next-method) 794 (cl-call-next-method)
795 (princ " Template Text to control") 795 (princ " Template Text to control")
796 (terpri) 796 (terpri)
797 (princ " ") 797 (princ " ")
@@ -801,7 +801,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
801 (terpri) 801 (terpri)
802 ) 802 )
803 803
804(defmethod srecode-insert-subtemplate ((sti srecode-template-inserter-subtemplate) 804(cl-defmethod srecode-insert-subtemplate ((sti srecode-template-inserter-subtemplate)
805 dict slot) 805 dict slot)
806 "Insert a subtemplate for the inserter STI with dictionary DICT." 806 "Insert a subtemplate for the inserter STI with dictionary DICT."
807 ;; Make sure that only dictionaries are used. 807 ;; Make sure that only dictionaries are used.
@@ -814,7 +814,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
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))
816 816
817(defmethod srecode-insert-method-helper ((sti srecode-template-inserter-subtemplate) 817(cl-defmethod srecode-insert-method-helper ((sti srecode-template-inserter-subtemplate)
818 dictionary slot) 818 dictionary slot)
819 "Do the work for inserting the STI inserter. 819 "Do the work for inserting the STI inserter.
820Loops over the embedded CODE which was saved here during compilation. 820Loops over the embedded CODE which was saved here during compilation.
@@ -837,7 +837,7 @@ The template to insert is stored in SLOT."
837 (srecode-insert-subtemplate sti (car dicts) slot) 837 (srecode-insert-subtemplate sti (car dicts) slot)
838 (setq dicts (cdr dicts))))) 838 (setq dicts (cdr dicts)))))
839 839
840(defmethod srecode-insert-method ((sti srecode-template-inserter-subtemplate) 840(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-subtemplate)
841 dictionary) 841 dictionary)
842 "Insert the STI inserter. 842 "Insert the STI inserter.
843Calls back to `srecode-insert-method-helper' for this class." 843Calls back to `srecode-insert-method-helper' for this class."
@@ -858,7 +858,7 @@ The dictionary saved at the named dictionary entry will be
858applied to the text between the section start and the 858applied to the text between the section start and the
859`srecode-template-inserter-section-end' macro.") 859`srecode-template-inserter-section-end' macro.")
860 860
861(defmethod srecode-parse-input ((ins srecode-template-inserter-section-start) 861(cl-defmethod srecode-parse-input ((ins srecode-template-inserter-section-start)
862 tag input STATE) 862 tag input STATE)
863 "For the section inserter INS, parse INPUT. 863 "For the section inserter INS, parse INPUT.
864Shorten input until the END token is found. 864Shorten input until the END token is found.
@@ -872,9 +872,9 @@ Return the remains of INPUT."
872 :code (cdr out))) 872 :code (cdr out)))
873 (car out))) 873 (car out)))
874 874
875(defmethod srecode-dump ((ins srecode-template-inserter-section-start) indent) 875(cl-defmethod srecode-dump ((ins srecode-template-inserter-section-start) indent)
876 "Dump the state of the SRecode template inserter INS." 876 "Dump the state of the SRecode template inserter INS."
877 (call-next-method) 877 (cl-call-next-method)
878 (princ "\n") 878 (princ "\n")
879 (srecode-dump-code-list (oref (oref ins template) code) 879 (srecode-dump-code-list (oref (oref ins template) code)
880 (concat indent " ")) 880 (concat indent " "))
@@ -889,12 +889,12 @@ Return the remains of INPUT."
889 "All template segments between the section-start and section-end 889 "All template segments between the section-start and section-end
890are treated specially.") 890are treated specially.")
891 891
892(defmethod srecode-insert-method ((sti srecode-template-inserter-section-end) 892(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-section-end)
893 dictionary) 893 dictionary)
894 "Insert the STI inserter." 894 "Insert the STI inserter."
895 ) 895 )
896 896
897(defmethod srecode-match-end ((ins srecode-template-inserter-section-end) name) 897(cl-defmethod srecode-match-end ((ins srecode-template-inserter-section-end) name)
898 898
899 "For the template inserter INS, do I end a section called NAME?" 899 "For the template inserter INS, do I end a section called NAME?"
900 (string= name (oref ins :object-name))) 900 (string= name (oref ins :object-name)))
@@ -912,7 +912,7 @@ are treated specially.")
912The included template will have additional dictionary entries from the subdictionary 912The included template will have additional dictionary entries from the subdictionary
913stored specified by this macro.") 913stored specified by this macro.")
914 914
915(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-include) 915(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-include))
916 escape-start escape-end) 916 escape-start escape-end)
917 "Insert an example using inserter INS. 917 "Insert an example using inserter INS.
918Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." 918Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
@@ -923,7 +923,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
923 (terpri) 923 (terpri)
924 ) 924 )
925 925
926(defmethod srecode-insert-include-lookup ((sti srecode-template-inserter-include) 926(cl-defmethod srecode-insert-include-lookup ((sti srecode-template-inserter-include)
927 dictionary) 927 dictionary)
928 "For the template inserter STI, lookup the template to include. 928 "For the template inserter STI, lookup the template to include.
929Finds the template with this macro function part and stores it in 929Finds the template with this macro function part and stores it in
@@ -981,7 +981,7 @@ this template instance."
981 "No template \"%s\" found for include macro `%s'" 981 "No template \"%s\" found for include macro `%s'"
982 templatenamepart (oref sti :object-name))))) 982 templatenamepart (oref sti :object-name)))))
983 983
984(defmethod srecode-insert-method ((sti srecode-template-inserter-include) 984(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include)
985 dictionary) 985 dictionary)
986 "Insert the STI inserter. 986 "Insert the STI inserter.
987Finds the template with this macro function part, and inserts it 987Finds the template with this macro function part, and inserts it
@@ -1017,7 +1017,7 @@ stored specified by this macro. If the included macro includes a ^ macro,
1017then the text between this macro and the end macro will be inserted at 1017then the text between this macro and the end macro will be inserted at
1018the ^ macro.") 1018the ^ macro.")
1019 1019
1020(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-include-wrap) 1020(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-include-wrap))
1021 escape-start escape-end) 1021 escape-start escape-end)
1022 "Insert an example using inserter INS. 1022 "Insert an example using inserter INS.
1023Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." 1023Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
@@ -1035,7 +1035,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
1035 (terpri) 1035 (terpri)
1036 ) 1036 )
1037 1037
1038(defmethod srecode-insert-method ((sti srecode-template-inserter-include-wrap) 1038(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include-wrap)
1039 dictionary) 1039 dictionary)
1040 "Insert the template STI. 1040 "Insert the template STI.
1041This will first insert the include part via inheritance, then 1041This will first insert the include part via inheritance, then
@@ -1067,7 +1067,7 @@ template where a ^ inserter occurs."
1067 inserter1 dict 'template)))))))) 1067 inserter1 dict 'template))))))))
1068 ;; Do a regular insertion for an include, but with our override in 1068 ;; Do a regular insertion for an include, but with our override in
1069 ;; place. 1069 ;; place.
1070 (call-next-method))) 1070 (cl-call-next-method)))
1071 1071
1072(provide 'srecode/insert) 1072(provide 'srecode/insert)
1073 1073