aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cedet/srecode/insert.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-06-13 18:01:42 +0200
committerLars Ingebrigtsen2019-06-14 14:24:18 +0200
commit7b837cd707753919dea0c14207c11643f7a88e87 (patch)
tree63146c38abe7b66778ebd40e8a05a4f1a7cc1152 /lisp/cedet/srecode/insert.el
parent07df91d45a950d7bef323b57dc7e46b34997143f (diff)
downloademacs-7b837cd707753919dea0c14207c11643f7a88e87.tar.gz
emacs-7b837cd707753919dea0c14207c11643f7a88e87.zip
Use CLOS-style accessors in oref/oset
* lisp/cedet/srecode/texi.el (srecode-semantic-handle-:texitag): * lisp/cedet/srecode/table.el (srecode-mode-table-new): (srecode-dump): * lisp/cedet/srecode/srt-mode.el (srecode-parse-this-macro): (semantic-analyze-possible-completions): * lisp/cedet/srecode/semantic.el (srecode-compound-toString): (srecode-semantic-apply-tag-to-dict-default): * lisp/cedet/srecode/mode.el (srecode-minor-mode-templates-menu): (srecode-edit): * lisp/cedet/srecode/insert.el (srecode-insert-method): (srecode-inserter-apply-state): (srecode-insert-ask-default): (srecode-insert-method-ask): (srecode-insert-method-field): (srecode-insert-method-helper): (srecode-parse-input): (srecode-match-end): (srecode-insert-include-lookup): (srecode-insert-method): * lisp/cedet/srecode/find.el (srecode-template-table-in-project-p): (srecode-template-get-table): (srecode-template-get-table-for-binding): (srecode-all-template-hash): * lisp/cedet/srecode/extract.el (srecode-inserter-extract): (srecode-inserter-extract): * lisp/cedet/srecode/el.el (srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/dictionary.el (initialize-instance): (srecode-dictionary-add-template-table): (srecode-compound-toString): * lisp/cedet/srecode/cpp.el (srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/compile.el (srecode-compile-template-table): (srecode-dump): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:project): * lisp/cedet/semantic/texi.el (semantic-analyze-possible-completions): * lisp/cedet/semantic/symref/list.el (semantic-symref-results-dump): (semantic-symref-list-create-macro-on-open-hit): (semantic-symref-list-rename-open-hits): (semantic-symref-list-map-open-hits): * lisp/cedet/semantic/symref/idutils.el (semantic-symref-perform-search): (semantic-symref-parse-tool-output-one-line): * lisp/cedet/semantic/symref/global.el (semantic-symref-perform-search): (semantic-symref-parse-tool-output-one-line): * lisp/cedet/semantic/symref/cscope.el (semantic-symref-perform-search): (semantic-symref-parse-tool-output-one-line): * lisp/cedet/semantic/mru-bookmark.el (semantic-mrub-ring-to-assoc-list): * lisp/cedet/semantic/grammar.el (semantic-analyze-possible-completions): * lisp/cedet/semantic/decorate/include.el (semantic-decoration-include-describe): * lisp/cedet/semantic/debug.el (semantic-debug-highlight-lexical-token): (semantic-debug-highlight-rule): * lisp/cedet/semantic/db-typecache.el (semanticdb-typecache-for-database): * lisp/cedet/semantic/complete.el (semantic-collector-calculate-completions-raw): * lisp/cedet/semantic/bovine/make.el (semantic-analyze-possible-completions): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-refs-impl): (semantic-analyze-refs-proto): * lisp/cedet/semantic/analyze/debug.el (semantic-analyzer-debug-describe-scope): * lisp/cedet/semantic/analyze.el (semantic-analyze-interesting-tag): (semantic-analyze-interesting-tag): (semantic-analyze-pulse): * lisp/cedet/ede/util.el (ede-update-version): * lisp/cedet/ede/shell.el (ede-shell-run-something): * lisp/cedet/ede/project-am.el (project-am-load-makefile): (project-rescan): (project-am-macro): (ede-buffer-mine): (project-compile-target-command): (project-am-package-info): * lisp/cedet/ede/files.el (ede--project-inode): (ede-directory-get-open-project): (ede-directory-get-toplevel-open-project): (ede-find-subproject-for-directory): (ede-toplevel-project): * lisp/cedet/ede/cpp-root.el (initialize-instance): (project-compile-project): (project-compile-target): * lisp/cedet/ede/config.el (ede-config-get-configuration): (project-debug-target): (project-run-target): (project-compile-project): (ede-preprocessor-map): (ede-java-classpath): * lisp/cedet/ede/base.el (ede-normalize-file/directory): Use CLOS-style oref/oset accessors instead of eieio-style :colon accessors. This avoids compilation warnings and is allegedly faster.
Diffstat (limited to 'lisp/cedet/srecode/insert.el')
-rw-r--r--lisp/cedet/srecode/insert.el53
1 files changed, 26 insertions, 27 deletions
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index 66bdf785c63..d23597ec479 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -471,12 +471,11 @@ If SECONDNAME is nil, return VALUE."
471 dictionary) 471 dictionary)
472 "Insert the STI inserter." 472 "Insert the STI inserter."
473 ;; Convert the name into a name/fcn pair 473 ;; Convert the name into a name/fcn pair
474 (let* ((name (oref sti :object-name)) 474 (let* ((name (oref sti object-name))
475 (fcnpart (oref sti :secondname)) 475 (fcnpart (oref sti secondname))
476 (val (srecode-dictionary-lookup-name 476 (val (srecode-dictionary-lookup-name
477 dictionary name)) 477 dictionary name))
478 (do-princ t) 478 (do-princ t))
479 )
480 ;; Alert if a macro wasn't found. 479 ;; Alert if a macro wasn't found.
481 (when (not val) 480 (when (not val)
482 (message "Warning: macro %S was not found in the dictionary." name) 481 (message "Warning: macro %S was not found in the dictionary." name)
@@ -545,12 +544,12 @@ Loop over the prompts to see if we have a match."
545 ) 544 )
546 (while prompts 545 (while prompts
547 (when (string= (semantic-tag-name (car prompts)) 546 (when (string= (semantic-tag-name (car prompts))
548 (oref ins :object-name)) 547 (oref ins object-name))
549 (oset ins :prompt 548 (oset ins prompt
550 (semantic-tag-get-attribute (car prompts) :text)) 549 (semantic-tag-get-attribute (car prompts) :text))
551 (oset ins :defaultfcn 550 (oset ins defaultfcn
552 (semantic-tag-get-attribute (car prompts) :default)) 551 (semantic-tag-get-attribute (car prompts) :default))
553 (oset ins :read-fcn 552 (oset ins read-fcn
554 (or (semantic-tag-get-attribute (car prompts) :read) 553 (or (semantic-tag-get-attribute (car prompts) :read)
555 'read-string)) 554 'read-string))
556 ) 555 )
@@ -561,7 +560,7 @@ Loop over the prompts to see if we have a match."
561 dictionary) 560 dictionary)
562 "Insert the STI inserter." 561 "Insert the STI inserter."
563 (let ((val (srecode-dictionary-lookup-name 562 (let ((val (srecode-dictionary-lookup-name
564 dictionary (oref sti :object-name)))) 563 dictionary (oref sti object-name))))
565 (if val 564 (if val
566 ;; Does some extra work. Oh well. 565 ;; Does some extra work. Oh well.
567 (cl-call-next-method) 566 (cl-call-next-method)
@@ -577,7 +576,7 @@ Loop over the prompts to see if we have a match."
577 ;; the user can use the same name again later. 576 ;; the user can use the same name again later.
578 (srecode-dictionary-set-value 577 (srecode-dictionary-set-value
579 (srecode-root-dictionary dictionary) 578 (srecode-root-dictionary dictionary)
580 (oref sti :object-name) val) 579 (oref sti object-name) val)
581 580
582 ;; Now that this value is safely stowed in the dictionary, 581 ;; Now that this value is safely stowed in the dictionary,
583 ;; we can do what regular inserters do. 582 ;; we can do what regular inserters do.
@@ -587,7 +586,7 @@ Loop over the prompts to see if we have a match."
587 dictionary) 586 dictionary)
588 "Derive the default value for an askable inserter STI. 587 "Derive the default value for an askable inserter STI.
589DICTIONARY is used to derive some values." 588DICTIONARY is used to derive some values."
590 (let ((defaultfcn (oref sti :defaultfcn))) 589 (let ((defaultfcn (oref sti defaultfcn)))
591 (cond 590 (cond
592 ((stringp defaultfcn) 591 ((stringp defaultfcn)
593 defaultfcn) 592 defaultfcn)
@@ -614,13 +613,13 @@ DICTIONARY is used to derive some values."
614Use DICTIONARY to resolve values." 613Use DICTIONARY to resolve values."
615 (let* ((prompt (oref sti prompt)) 614 (let* ((prompt (oref sti prompt))
616 (default (srecode-insert-ask-default sti dictionary)) 615 (default (srecode-insert-ask-default sti dictionary))
617 (reader (oref sti :read-fcn)) 616 (reader (oref sti read-fcn))
618 (val nil) 617 (val nil)
619 ) 618 )
620 (cond ((eq reader 'y-or-n-p) 619 (cond ((eq reader 'y-or-n-p)
621 (if (y-or-n-p (or prompt 620 (if (y-or-n-p (or prompt
622 (format "%s? " 621 (format "%s? "
623 (oref sti :object-name)))) 622 (oref sti object-name))))
624 (setq val default) 623 (setq val default)
625 (setq val ""))) 624 (setq val "")))
626 ((eq reader 'read-char) 625 ((eq reader 'read-char)
@@ -628,14 +627,14 @@ Use DICTIONARY to resolve values."
628 "%c" 627 "%c"
629 (read-char (or prompt 628 (read-char (or prompt
630 (format "Char for %s: " 629 (format "Char for %s: "
631 (oref sti :object-name)))))) 630 (oref sti object-name))))))
632 ) 631 )
633 (t 632 (t
634 (save-excursion 633 (save-excursion
635 (setq val (funcall reader 634 (setq val (funcall reader
636 (or prompt 635 (or prompt
637 (format "Specify %s: " 636 (format "Specify %s: "
638 (oref sti :object-name))) 637 (oref sti object-name)))
639 default 638 default
640 ))))) 639 )))))
641 ;; Return our derived value. 640 ;; Return our derived value.
@@ -648,7 +647,7 @@ Use DICTIONARY to resolve values."
648Use DICTIONARY to resolve values." 647Use DICTIONARY to resolve values."
649 (let* ((default (srecode-insert-ask-default sti dictionary)) 648 (let* ((default (srecode-insert-ask-default sti dictionary))
650 (compound-value 649 (compound-value
651 (srecode-field-value (oref sti :object-name) 650 (srecode-field-value (oref sti object-name)
652 :firstinserter sti 651 :firstinserter sti
653 :defaultvalue default)) 652 :defaultvalue default))
654 ) 653 )
@@ -816,12 +815,12 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
816Loops over the embedded CODE which was saved here during compilation. 815Loops over the embedded CODE which was saved here during compilation.
817The template to insert is stored in SLOT." 816The template to insert is stored in SLOT."
818 (let ((dicts (srecode-dictionary-lookup-name 817 (let ((dicts (srecode-dictionary-lookup-name
819 dictionary (oref sti :object-name)))) 818 dictionary (oref sti object-name))))
820 (when (not (listp dicts)) 819 (when (not (listp dicts))
821 (srecode-insert-report-error 820 (srecode-insert-report-error
822 dictionary 821 dictionary
823 "Cannot insert section %S from non-section variable." 822 "Cannot insert section %S from non-section variable."
824 (oref sti :object-name))) 823 (oref sti object-name)))
825 ;; If there is no section dictionary, then don't output anything 824 ;; If there is no section dictionary, then don't output anything
826 ;; from this section. 825 ;; from this section.
827 (while dicts 826 (while dicts
@@ -829,7 +828,7 @@ The template to insert is stored in SLOT."
829 (srecode-insert-report-error 828 (srecode-insert-report-error
830 dictionary 829 dictionary
831 "Cannot insert section %S from non-section variable." 830 "Cannot insert section %S from non-section variable."
832 (oref sti :object-name))) 831 (oref sti object-name)))
833 (srecode-insert-subtemplate sti (car dicts) slot) 832 (srecode-insert-subtemplate sti (car dicts) slot)
834 (setq dicts (cdr dicts))))) 833 (setq dicts (cdr dicts)))))
835 834
@@ -860,7 +859,7 @@ applied to the text between the section start and the
860Shorten input until the END token is found. 859Shorten input until the END token is found.
861Return the remains of INPUT." 860Return the remains of INPUT."
862 (let* ((out (srecode-compile-split-code tag input STATE 861 (let* ((out (srecode-compile-split-code tag input STATE
863 (oref ins :object-name)))) 862 (oref ins object-name))))
864 (oset ins template (srecode-template 863 (oset ins template (srecode-template
865 (eieio-object-name-string ins) 864 (eieio-object-name-string ins)
866 :context nil 865 :context nil
@@ -893,7 +892,7 @@ are treated specially.")
893(cl-defmethod srecode-match-end ((ins srecode-template-inserter-section-end) name) 892(cl-defmethod srecode-match-end ((ins srecode-template-inserter-section-end) name)
894 893
895 "For the template inserter INS, do I end a section called NAME?" 894 "For the template inserter INS, do I end a section called NAME?"
896 (string= name (oref ins :object-name))) 895 (string= name (oref ins object-name)))
897 896
898(defclass srecode-template-inserter-include (srecode-template-inserter-subtemplate) 897(defclass srecode-template-inserter-include (srecode-template-inserter-subtemplate)
899 ((key :initform ?> 898 ((key :initform ?>
@@ -924,13 +923,13 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
924 "For the template inserter STI, lookup the template to include. 923 "For the template inserter STI, lookup the template to include.
925Finds the template with this macro function part and stores it in 924Finds the template with this macro function part and stores it in
926this template instance." 925this template instance."
927 (let ((templatenamepart (oref sti :secondname))) 926 (let ((templatenamepart (oref sti secondname)))
928 ;; If there was no template name, throw an error. 927 ;; If there was no template name, throw an error.
929 (unless templatenamepart 928 (unless templatenamepart
930 (srecode-insert-report-error 929 (srecode-insert-report-error
931 dictionary 930 dictionary
932 "Include macro `%s' needs a template name" 931 "Include macro `%s' needs a template name"
933 (oref sti :object-name))) 932 (oref sti object-name)))
934 933
935 ;; NOTE: We used to cache the template and not look it up a second time, 934 ;; NOTE: We used to cache the template and not look it up a second time,
936 ;; but changes in the template tables can change which template is 935 ;; but changes in the template tables can change which template is
@@ -968,14 +967,14 @@ this template instance."
968 ) 967 )
969 968
970 ;; Store the found template into this object for later use. 969 ;; Store the found template into this object for later use.
971 (oset sti :includedtemplate tmpl)) 970 (oset sti includedtemplate tmpl))
972 971
973 (unless (oref sti includedtemplate) 972 (unless (oref sti includedtemplate)
974 ;; @todo - Call into a debugger to help find the template in question. 973 ;; @todo - Call into a debugger to help find the template in question.
975 (srecode-insert-report-error 974 (srecode-insert-report-error
976 dictionary 975 dictionary
977 "No template \"%s\" found for include macro `%s'" 976 "No template \"%s\" found for include macro `%s'"
978 templatenamepart (oref sti :object-name))))) 977 templatenamepart (oref sti object-name)))))
979 978
980(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include) 979(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include)
981 dictionary) 980 dictionary)
@@ -985,7 +984,7 @@ with the dictionaries found in the dictionary."
985 (srecode-insert-include-lookup sti dictionary) 984 (srecode-insert-include-lookup sti dictionary)
986 ;; Insert the template. 985 ;; Insert the template.
987 ;; Our baseclass has a simple way to do this. 986 ;; Our baseclass has a simple way to do this.
988 (if (srecode-dictionary-lookup-name dictionary (oref sti :object-name)) 987 (if (srecode-dictionary-lookup-name dictionary (oref sti object-name))
989 ;; If we have a value, then call the next method 988 ;; If we have a value, then call the next method
990 (srecode-insert-method-helper sti dictionary 'includedtemplate) 989 (srecode-insert-method-helper sti dictionary 'includedtemplate)
991 ;; If we don't have a special dictionary, then just insert with the 990 ;; If we don't have a special dictionary, then just insert with the
@@ -1053,7 +1052,7 @@ template where a ^ inserter occurs."
1053 (lambda (dict) 1052 (lambda (dict)
1054 (let ((srecode-template-inserter-point-override nil)) 1053 (let ((srecode-template-inserter-point-override nil))
1055 (if (srecode-dictionary-lookup-name 1054 (if (srecode-dictionary-lookup-name
1056 dict (oref sti :object-name)) 1055 dict (oref sti object-name))
1057 ;; Insert our sectional part with looping. 1056 ;; Insert our sectional part with looping.
1058 (srecode-insert-method-helper 1057 (srecode-insert-method-helper
1059 sti dict 'template) 1058 sti dict 'template)