diff --git a/init.el b/init.el new file mode 100644 index 0000000..c417f8f --- /dev/null +++ b/init.el @@ -0,0 +1,74 @@ +;;; Archivo de configuraciĆ³n de emacs para jdee, git-emacs y ecb +;;; +;;; 2009-2011 juanger +;;; +;;; + +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/git-emacs")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/jdee/lisp")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/cedet-1.0pre7/common")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/elib")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/cedet-1.0pre7/semantic")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/cedet-1.0pre7/speedbar")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/cedet-1.0pre7/eieio")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/cedet-1.0pre7/ede")) +(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/ecb-2.40")) + +(load-file (expand-file-name "~/.emacs.d/site/cedet-1.0pre7/common/cedet.el")) + +(require 'git-emacs) +(require 'jde) +(require 'ecb) + +(defvar mvn-command-history nil + "Maven command history variable") + +(defun mvn(&optional args) + "Runs maven in the current project. Starting at the directory where the file being visited resides, a search is + made for pom.xml recsurively. A maven command is made from the first directory where the pom.xml file is found is then displayed + in the minibuffer. The command can be edited as needed and then executed. Errors are navigate to as in any other compile mode" + (interactive) + (let ((fn (buffer-file-name))) + (let ((dir (file-name-directory fn))) + (while (and (not (file-exists-p (concat dir "/pom.xml"))) + (not (equal dir (file-truename (concat dir "/.."))))) + (setf dir (file-truename (concat dir "/..")))) + (if (not (file-exists-p (concat dir "/pom.xml"))) + (message "No pom.xml found") + (compile (read-from-minibuffer "Command: " + (concat "mvn -f " dir "/pom.xml") nil nil 'mvn-command-history)))))) + +(defun run-mvn() + (interactive) + (progn + (mvn) + (bsh-exit) + (jde-load-all-project-files))) + +;;;;;;;;; +;;;;; +;;;;; Custom variables +;;;;; +;;;;;;;;; +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(before-save-hook (quote (delete-trailing-whitespace))) + '(ecb-auto-activate t) + '(ecb-options-version "2.40") + '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2)) + '(ecb-tip-of-the-day nil) + '(indent-tabs-mode nil) + '(paren-match-face (quote paren-face-match-light)) + '(paren-sexp-mode t) + '(show-paren-mode t) + '(transient-mark-mode t)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/site/cedet-1.0pre7/INSTALL b/site/cedet-1.0pre7/INSTALL new file mode 100644 index 0000000..3f2fe0d --- /dev/null +++ b/site/cedet-1.0pre7/INSTALL @@ -0,0 +1,202 @@ +CEDET: Collection of Emacs Development Enviromnent Tools + +CEDET is a top-level project containing several individual package for Emacs, +includeing: + + EIEIO - CLOS layer for Emacs Lisp + Semantic - Parser Infrastructure for Emacs + Speedbar - Everything browser + EDE - File manager/ Makefile generator + SRecode - Templte manager/ code generator + COGRE - Connected Graph Editor + +REQUIREMENTS: + + The full CEDET suite requires Emacs 22.1 or newer. + CEDET works well with either Emacs 21.3 or XEmacs 21.3. + Older versions of either will also work with fewer CEDET + features being available. + + If you use a binary install of Emacs, you may need the .el + files for Emacs available for some aspects of the build. + + CEDET is always developed on a recent CVS build of Emacs, and often + takes advantage of such new features. + +INSTALL: + +You can install all these packagees at once with the CEDET build and +install scripts: + +1) Copy source files somewhere. + +2) Byte compile + + There are several ways to get CEDET compiled: + + a) make + + b) make EMACS= + + You might also have trouble with makeinfo. If you need to upgrade + makeinfo, you can do this: + + c) make MAKEINFO=/usr/local/bin/makeinfo + + Note: For speedbar, and older versions of Emacs, you may also need + to byte-compile the version of INFO and RMAIL that come with + your version of emacs. + + d) make MAKEINFO=echo + + To skip making the doc. + + + e) cedet-build.el + + If you do not have "make", are on Windows, or otherwise cannot use + the Makefiles, you can build CEDET from within Emacs. See the + commentary in cedet-build.el + + +2.1) Build Issues + + If running MAKE fails due to other issues such as bad loaddef + files, custom-autoload, incomprehensible run time errors during a byte + compilation, try these steps, then go back to step 2. + + a) make clean-autoloads + b) make clean-all + +2.2) Make Issues + + If the version of Make you are using doesn't work with the CEDET + Makefiles, (such as the version on AIX) you will need to download and + install GNU Make to use with these Makefiles. Alternately, + see cedet-build.el + +3) Install load hooks into your .emacs file. For more detail on + any topic, see the info file common/cedet.info for more details on + installaiton. + +----------- +;; Load CEDET. +;; See cedet/common/cedet.info for configuration details. +(load-file "~/cedet-VERSION/common/cedet.el") + + +;; Enable EDE (Project Management) features +(global-ede-mode 1) + +;; Enable EDE for a pre-existing C++ project +;; (ede-cpp-root-project "NAME" :file "~/myproject/Makefile") + + +;; Enabling Semantic (code-parsing, smart completion) features +;; Select one of the following: + +;; * This enables the database and idle reparse engines +(semantic-load-enable-minimum-features) + +;; * This enables some tools useful for coding, such as summary mode +;; imenu support, and the semantic navigator +(semantic-load-enable-code-helpers) + +;; * This enables even more coding tools such as intellisense mode +;; decoration mode, and stickyfunc mode (plus regular code helpers) +;; (semantic-load-enable-gaudy-code-helpers) + +;; * This enables the use of Exuberent ctags if you have it installed. +;; If you use C++ templates or boost, you should NOT enable it. +;; (semantic-load-enable-all-exuberent-ctags-support) +;; Or, use one of these two types of support. +;; Add support for new languges only via ctags. +;; (semantic-load-enable-primary-exuberent-ctags-support) +;; Add support for using ctags as a backup parser. +;; (semantic-load-enable-secondary-exuberent-ctags-support) + +;; Enable SRecode (Template management) minor-mode. +;; (global-srecode-minor-mode 1) + +----------- + + Some items in the contrib directory may need additional study or + installation. Read contrib/INSTALL for specifics on those extra + packages. + +3.1) CODE COMPLETION + + If you are installing CEDET to get code completion, see the info + manual in common/cedet.info for more specifically about code + completion. + +3.2) INSTALL INFO + + Installing the info files can be done with: + + make install-info + + or, if you need to specify: + + make PREFIX=/prefix/to/install/to install-info + +4) CONFIGURE: + + You can configure how the individual packages loaded in the above + example by adding settings in the comment section. Please read + individual info manuals for each package for details on configuring + them. See the texinfo manuals for details on more specific + configurations. + + To dive right into configuring CEDET for a particular purpose, many + common purposes are enumerated in the CEDET installation info file. + + C-u C-h i common/cedet.info + + +5) BUGS/COMMENTS + + To send bug reports, or participate in discussions on these + packages, choose a mailing list: + + For Semantic use the mailing list cedet-semantic@sourceforge.net + via the URL: + + http://lists.sourceforge.net/lists/listinfo/cedet-semantic + + For EIEIO use the mailing list cedet-eieio@sourceforge.net + via the URL: + + http://lists.sourceforge.net/lists/listinfo/cedet-eieio + + For general discussions on development of these tools, and get learn + when minor updates are added to CVS, use the mailing list + cedet-devel@sourceforge.net via the URL: + + http://lists.sourceforge.net/lists/listinfo/cedet-devel + +OTHER REQUIREMENTS: + + You may also need to download some of the following files for more + obscure features. + + To use the JavaScript parser: + javascript-mode.el : http://www.emacswiki.org/cgi-bin/wiki/JavaScriptMode + + To use Exuberent CTags to parse files: + http://ctags.sourceforge.net/ + + To use GNU Global integration: + http://www.gnu.org/software/global + + To use ID Utils integration: + http://www.gnu.org/software/idutils/ + + To use CScope integration: + http://cscope.sourceforge.net/ + + To use COGRE with Graphviz Dot integration: + http://www.graphviz.org/ + + And a major mode for dot (not required): + http://users.skynet.be/ppareit/projects/graphviz-dot-mode/graphviz-dot-mode.html \ No newline at end of file diff --git a/site/cedet-1.0pre7/Makefile b/site/cedet-1.0pre7/Makefile new file mode 100644 index 0000000..65ac315 --- /dev/null +++ b/site/cedet-1.0pre7/Makefile @@ -0,0 +1,188 @@ +## Makefile --- Definition file for building CEDET +## +## Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 by David Ponce +## +## Author: David Ponce +## Maintainer: CEDET developers +## Created: 12 Sep 2003 +## X-RCS: $Id: Makefile,v 1.25 2009/08/08 21:48:32 zappo Exp $ +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License as +## published by the Free Software Foundation; either version 2, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with GNU Emacs; see the file COPYING. If not, write to the +## Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +## Boston, MA 02110-1301, USA. + +######## You can customize this part of the Makefile ######## + +## The directory where CEDET is installed +CEDET_HOME="$(CURDIR)" + +## The CEDET's packages installed +CEDET_ELISP_PACKAGES=\ +common \ +speedbar \ +eieio \ +semantic \ +srecode \ +ede \ +cogre \ +contrib + +CEDET_PACKAGES=\ +$(CEDET_ELISP_PACKAGES) \ +tests + +## Path to your Emacs +EMACS=emacs +EMACSFLAGS=-batch --no-site-file + +## Your shell (On Windows/Cygwin I recommend to use bash) +#SHELL=bash + +## Path to your find and rm commands +FIND=find +#RM = rm -f + +## INSTALL PATHS +PREFIX=/usr/local + +INFO_DIR=$(PREFIX)/share/info + +INSTALL_INFO=ginstall-info + +############### Internal part of the Makefile ############### +CEDET_VERSION=$(shell grep "defconst cedet-version" common/cedet.el | cut -d " " -f 3) + +CEDET_FILES=Makefile INSTALL cedet-build.el cedet-update-version.el PRERELEASE_CHECKLIST USING_CEDET_FROM_CVS +DIST_ROOT=cedet-$(CEDET_VERSION) +DIST_DIR=$(CEDET_HOME)/$(DIST_ROOT) +DIST_FILE=$(DIST_DIR).tar.gz + +__BUILD_AUTOLOADS=$(patsubst %,%-autoloads,$(CEDET_ELISP_PACKAGES)) +__CLEAN_AUTOLOADS=$(patsubst %,clean-%,$(__BUILD_AUTOLOADS)) +__DOMAKE=$(MAKE) $(MFLAGS) EMACS="$(EMACS)" EMACSFLAGS="$(EMACSFLAGS)" SHELL="$(SHELL)" + +## Build +## + +all: clean-autoloads packages + +bootstrap: clean-all packages + +packages: $(CEDET_PACKAGES) + +.PHONY: $(CEDET_PACKAGES) +$(CEDET_PACKAGES): + cd $(CEDET_HOME)/$@ && $(__DOMAKE) + +.PHONY: ebuild +ebuild: + $(EMACS) -q -batch --no-site-file -l cedet-build.el -f cedet-build + +## Update +## + +autoloads: $(__BUILD_AUTOLOADS) + +.PHONY: $(__BUILD_AUTOLOADS) +$(__BUILD_AUTOLOADS): + cd $(CEDET_HOME)/$(firstword $(subst -, ,$@)) && \ + $(__DOMAKE) autoloads + +recompile: autoloads + cd $(CEDET_HOME) && \ + "$(EMACS)" $(EMACSFLAGS) -l common/cedet.el \ + -f batch-byte-recompile-directory $(CEDET_PACKAGES) + +## Cleanup +## + +clean-autoloads: $(__CLEAN_AUTOLOADS) + +.PHONY: $(__CLEAN_AUTOLOADS) +$(__CLEAN_AUTOLOADS): + $(FIND) $(CEDET_HOME)/$(word 2,$(subst -, ,$@)) -type f \ + -name "*-loaddefs.el" \ + -print -exec $(RM) {} \; + +.PHONY: clean-grammars +clean-grammars: + $(FIND) $(CEDET_HOME) -type f -name "*-[bw]y.el" \ + ! -name "semantic-grammar-wy.el" \ + -print -exec $(RM) {} \; + +.PHONY: clean-info +clean-info: + $(FIND) $(CEDET_HOME) -type f -name "*.info*" \ + -print -exec $(RM) {} \; + +.PHONY: clean-elc +clean-elc: + $(FIND) $(CEDET_HOME) -type f -name "*.elc" \ + -print -exec $(RM) {} \; + +.PHONY: clean +clean: + $(FIND) $(CEDET_HOME) -type f \( -name "*-script" -o -name "*~" \) \ + -print -exec $(RM) {} \; + +clean-all: clean clean-elc clean-info clean-grammars clean-autoloads + +### UNIT TEST Harness +## Run the master CEDET unit-test suite. +.PHONY: utest itest +utest: + $(EMACS) $(EMACSFLAGS) -l "common/cedet.el" -f cedet-utest-batch + +itest: + cd tests; ./cit-test.sh Make + cd tests; ./cit-test.sh Automake + cd tests; ./cit-test.sh GNUStep + +### Install info files +## Thanks Stefano Sabatini for the info install patch. +INFO_FILES=$(shell $(FIND) $(CEDET_HOME) -type f -name '*.info') + +.PHONY: install-info +install-info: + for file in $(INFO_FILES); do \ + cp $$file $(INFO_DIR); \ + $(INSTALL_INFO) $$file $(INFO_DIR)/dir ;\ + done + +## Uninstall info files +INSTALLED_INFO_FILES=$(shell find . -name *.info | sed -e 's|.*/\(.*\.info$$\)|$(INFO_DIR)/\1|') + +.PHONY: uninstall-info +uninstall-info: + for file in $(INSTALLED_INFO_FILES); do \ + $(INSTALL_INFO) --delete $$file $(INFO_DIR)/dir ;\ + rm -f $$file;\ + done + + +## Build a distribution file. +dist: # $(CEDET_PACKAGES) + rm -rf $(DIST_DIR) + mkdir $(DIST_DIR) + cp $(CEDET_FILES) $(DIST_DIR) + for package in ${CEDET_PACKAGES}; do \ + make -C $$package $(MFLAGS) DISTDIR=$(DIST_DIR)/$$package dist; \ + done; + tar -cvzf $(DIST_FILE) $(DIST_ROOT) + rm -rf $(DIST_DIR) + +testvar: + @echo "$(TESTVAR)=$($(TESTVAR))" + +# Makefile ends here diff --git a/site/cedet-1.0pre7/PRERELEASE_CHECKLIST b/site/cedet-1.0pre7/PRERELEASE_CHECKLIST new file mode 100644 index 0000000..b082466 --- /dev/null +++ b/site/cedet-1.0pre7/PRERELEASE_CHECKLIST @@ -0,0 +1,276 @@ +Prerelease Checklist: +-------------------- + + This is a list of things to do/try before posting a release to make sure + the release will work as well as can be expected: + +Before a dist is made: +--------------------- + +Update all version numbers + + * M-x load-file RET ~/cedet/cedet-update-version.el + * M-x cuv-update + - Answer all questions, updating verion numbers as needed. + +Add a CVS tag + + * Create a new copy of CVS TRUNK + - mkdir + - cvs -d @cedet.cvs.sourceforge.net:/cvsroot/cedet co cedet + - mv cedet cedet- # (such as cedet-1p0beta3) + - cd cedet-branchname + - touch `find . -name Makefile` + - make dist + - ./testdist.sh # Test out that basic stuff is working before tagging. + - cvs tag -b + + * update new sandbox to branch + - cvs update -r + + * Apply patches to above while resolving other issues. + + * Build the new area: + - touch `find . -name Makefile` + - make EMACS=semacs + +Update Changelogs + + * Use a fresh emacs + - emacs -q + - M-x load-file RET common/cedet.el RET + * Update the Log from CVS + - M-x load-file RET cedet-update-changelog.el RET + - M-x cuc-update-all-changelogs RET + +Build a DIST file + + * touch `find . -name Makefile` + * make + * make dist + +After a dist is made: +-------------------- + +CEDET Unit tests + * From a CVS area: + * make utest + +CEDET integration test + * From a CVS area: + * make itest + +CEDET Full distribution testing + * From a CVS area: + * make dist + * ./testdist.sh EMACS + - where EMACS is the version of emacs you want to test with + +CEDET & Common area + + * Uncompress/Untar release archive. + * Compile with Makefile: + make + make EMACS=xemacs + * Build on multiple platforms + - Linux + - Windows + - Other + + * Check version numbers of different tools. + + - Verify output of: + M-x cedet-version RET + - Check the declared version numbers. + - Make sure that if changes were made to those modules, the version + is updated. + + * Start in a clean Emacs: + - Start emacs this way: + + emacs -q + -or- + xemacs -q + + M-x load-file RET cedet/common/cedet.el RET + M-x semantic-load-enable-minimum-features RET + + * All individual CEDET unit test + + M-x cedet-utest RET + - Note: Runs all automated unit tests. These tests are repeated below. + - Note: This runs a couple more tests than the MAKE command above. + + * Test ezimage + + M-x ezimage-image-association-dump RET + - Verify some common images for Emacs and XEmacs. + M-x ezimage-image-dump RET + - Verify the default registered images for Emacs and XEmacs. + + NOTE: These are in cedet-utest, but pictures need verification. + + * Test pulse + M-x pulse-test RET + - Verify pulse does what messages say. + - Try in Emacs 22, and older Emacs, or XEmacs. (different behaviors) + + NOTE: This is in cedet-utest. Needs additional x-platform care. + +EIEIO + + * M-x eieio-browse RET + + This will list the currently loaded class hierarcies. After using + the test harness, and loading semantic, this should be a long list. + + * Running tests for semantic/semanticdb, and EDE both test + other basic EIEIO features. + +Semantic + + * Make sure the semanticdb inversion check against persistent file loading + is updated if the file-format has changed. + + * In a clean Emacs + + Visit files for different modes. Include: + All files in cedet/semantic/tests. + .html file of your choice. + .texi files from the doc directory. + A lisp file, such as semantic.el. + C# file + .js javascript file + Makefile + + Start with: + M-x toggle-debug-on-error RET - Enable debugging within the + parser and incremental parser. (Usually hidden.) + + For each supported mode: + M-x bovinate RET - verify tags are accurate. + M-x speedbar RET - Open the file and verify tags. + - Check the TAGS menu for tags in that file. + + M-x global-semantic-highlight-edits-mode RET + - Edit a file. See the highlight of newly inserted text. + - Customize `semantic-edits-verbose-flag' to be non-nil. + - Wait for the idle scheduler, it should clean up the edits. + - observe messages from incremental parser. Do they relate + to the edits? + - M-x bovinate RET - verify your changes are reflected. + + Visit the menu Senator->Modes + - Enable that mode (if not already enabled) and verify the + advertised behavior. + + - Test aspects of the Senator navigation menu. + + M-x semantic-analyze-current-context RET + - Do this in different contexts in your language + files. Verify that reasonable results are returned + such as identification of assignments, function arguments, etc. + + - Optionally, use `semantic-speedbar-analysis' instead of + 'semantic-analyze-current-context'. + + - At a location with incomplete syntax (a list of arguments + with no close paren for instance: repeat previous step. + + M-x semanticdb-find-test-translate-path RET + - Verify the list matches the include files. + You may need to check the value of + `semanticdb-find-default-throttle' to determine what should, or + should not be on the list. + + - With cursor on different types of declarations: + M-x semantic-test-all-format-tag-functions RET + - Verify all formats work. + + - Use your favorite semantic-enabled tool. + + * Try semantic-regtest.el (from CVS). + +Speedbar + + * In a clean Emacs + + M-x speedbar RET + + - browse through directories, expand tags in some files. + - Special support files to try: + - texinfo files (speedbar.texi) + - html files + - rmail files (RMAIL) + + M-x Info-speedbar-browser RET + + - browse through the manuals + +EDE + + * In a clean Emacs + + - Examine files in the ede directory, such as: + ede.el + ede.texi + NEWS + + - For files in these project, verify the Project menu + - Try builds for these files + - Try some other menu items + +COGRE + + * In a clean Emacs + + M-x cogre RET mygraph RET + + Create a block diagram. + + * In a clean Emacs + + from cogre.el, put cursor on `cogre-graph-element' + + M-x cogre-uml-quick-class RET RET + + - Verify the grpah. (on parent, some direct children.) + - Move some blocks around (M-f, M-b, M-n, M-p) + +SRecode + + * Verify menu working in SRT, C++, and Emacs Lisp. + * Make sure srecode-mode is on. + + * Try inserting file:empty in some modes, and then a function + to make sure prompts work. + + * Check the maps: + M-x srecode-get-maps RET + + Note: In cedet-utest, but make sure the output contains the known + templates. + +GENERAL + + * Run `checkdoc' against various source files to make sure + doc strings are conforming. + +DEPENDANT TOOLS +--------------- + + * Test this new release against dependent tools, including: + - JDEE + - ECB + +After patches are applied: +------------------------- + +After patches are applied to the release branch, merge them back into +TRUNK. + + In a sandbox with TRUNK/HEAD active. + * cvs update -j filename + + - This merges changes from the branch into the trunk. + - Use emacs to check these branch merges in. \ No newline at end of file diff --git a/site/cedet-1.0pre7/USING_CEDET_FROM_CVS b/site/cedet-1.0pre7/USING_CEDET_FROM_CVS new file mode 100644 index 0000000..bc94473 --- /dev/null +++ b/site/cedet-1.0pre7/USING_CEDET_FROM_CVS @@ -0,0 +1,77 @@ +Using CEDET from CVS: +==================== + +If you have loaded CEDET from CVS, you will find that the basic +installation is almost the same as for the regular distribution. + +All EDE Project files for CEDET are checked into CVS along with the +corresponding Makefiles. Since "Project.ede" comes after "Makefile" +alphabetically, your CVS checkout command will always leave timestamps +that indicates that the Makefiles are out of date. + +Thus, the first compilation step is: + +----- +touch `find . -name Makefile` +----- + +To compile and install the rest of the released versions of CEDET, +please read the INSTALL file. + + + + +Web Site: +======== + +The CEDET CVS repository contains the full source to the CEDET web +page which is usually found on: + +http://cedet.sf.net + + + +Unreleased Software: +=================== + +The CEDET CVS repository sometimes contains new software that has not +been integrated into the CEDET distribution and build system. This +section describes any such tools. + +cedet/srecode +------------- + +The SRecode tools stands for "Semantic Recoder". +SRecode is a template library manager for auto-generating code for any +language. Complex code generation is managed through Semantic +compatible tags. + +SRecode has a reasonable manual that will assist you in understanding +what it is for. To try it out, add this to your .emacs file: + +------- +(add-to-list 'load-path (expand-file-name "~/cedet/srecode")) +(require 'srecode-load) +-------- + + + +Obsolete Software: +================= + +The CEDET CVS repository contains some software that has been +obsoleted with time as newer tools come online. + +You can still use some of these tools if you want, but the bit-rot +will eventually get you. + +cedet/quickpeek +--------------- + +Quick Peek was an attempt to get eldoc like behavior using only etags +files. It worked pretty well, but it required a clever parser to +provide smart output. Eventually I started writing Semantic so I +could have a parser to do this work. It was later obsoleted by an +eldoc interface, and then the `semantic-idle-scheduler-mode'. + + diff --git a/site/cedet-1.0pre7/cedet-build.el b/site/cedet-1.0pre7/cedet-build.el new file mode 100644 index 0000000..6de9f67 --- /dev/null +++ b/site/cedet-1.0pre7/cedet-build.el @@ -0,0 +1,231 @@ +;;; cedet-build.el --- Build CEDET within Emacs. + +;; Copyright (C) 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-build.el,v 1.12 2009/12/28 14:16:12 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Build all the CEDET parts interactively through EDE. +;; +;; NOTE: This does not support XEmacs, which cannot use +;; `batch-update-autoloads' in interactive mode. +;; +;;; USAGE: +;; +;; Step 1: Compile CEDET in a fresh Emacs: +;; +;; emacs -Q -l cedet-build.el -f cedet-build +;; +;; or, if -Q isn't supported +;; +;; emacs -q --no-site-file -l cedet-build.el -f cedet-build +;; +;; or, if you have minimal make available, this is in the Makefile +;; +;; make ebuild +;; +;; or +;; +;; Eval this buffer and then start compilation: +;; +;; M-x eval-buffer +;; M-x cedet-build-in-default-emacs +;; +;; or +;; +;; if this is an incremental build, you can do: +;; +;; M-x eval-buffer +;; M-x cedet-build-in-this-emacs +;; +;; If EIEIO needs recompile, it will switch to compiling in +;; a subprocess with `cedet-build-in-default-emacs'. +;; +;; Step 2: Check Output. +;; +;; If Compilation of grammars exceeds Emacs' stack size, exit Emacs, +;; and re-run the compilation steps above. Once most of CEDET is +;; compiled, this problem goes away. + + +;;; Code: + +(defvar cedet-build-location + (let ((dir (file-name-directory + (or load-file-name (buffer-file-name))))) + ;; (add-to-list 'load-path dir) + dir) + "Root of the CEDET tree.") + +(defun cedet-build-in-default-emacs() + "Build CEDET in a new Emacs instance started with -Q." + (interactive) + (let ((default-directory cedet-build-location)) + (call-process (expand-file-name invocation-name invocation-directory) + nil 0 nil + "-Q" "-l" "cedet-build.el" "-f" "cedet-build") + (message "Started new Emacs instance to build CEDET ..."))) + +(defun cedet-build-in-this-emacs () + "Build CEDET in this version of Emacs. +This only works if EIEIO does not need to be compiled." + (interactive) + (let ((src "eieio/eieio.el") (dst "eieio/eieio.elc")) + (if (file-newer-than-file-p src dst) + (when (y-or-n-p "EIEIO needs to be recompiled. Use subprocess? ") + (cedet-build-in-default-emacs)) + (cedet-build t)))) + +(defun cedet-build-msg (fmt &rest args) + "Show a build message." + (if noninteractive + (princ (apply 'format fmt args) t) + (switch-to-buffer "*CEDET BYTECOMPILE*" t) + (goto-char (point-max)) + (insert (apply 'format fmt args)) + (sit-for 0))) + +(defun cedet-build (&optional override-check) + "Build CEDET via EDE. +OVERRIDE-CHECK to override cedet short-cicuit." + (setq inhibit-splash-screen t) + + ;; Make sure CEDET is not loaded + (if (and (not override-check) (featurep 'cedet)) + (error "To use cedet-build, start Emacs with -q")) + + ;; Setup a logging buffer + (switch-to-buffer "*CEDET BYTECOMPILE*") + (delete-other-windows) + (erase-buffer) + (cedet-build-msg "CEDET BYTE COMPILATION STATUS:\n\n") + (cedet-build-msg "Step 1: Byte compile EIEIO...") + + ;; Get EIEIO built first. + (save-excursion + (load-file "common/inversion.el") + (load-file "common/cedet-compat.el") + (load-file "eieio/eieio-comp.el") + (let ((src "eieio/eieio.el") (dst "eieio/eieio.elc")) + (if (file-newer-than-file-p src dst) + (progn + (when (featurep 'eieio) + (error "You should not recompile EIEIO after it has been loaded")) + (byte-compile-file src) + (cedet-build-msg "done\n")) + (cedet-build-msg "not needed\n"))) + ) + + (load-file "common/cedet-autogen.el") + + ;; Get EDE autoloads built... + (cedet-build-msg "Step 2: EDE Autloads...") + (save-excursion + (let ((default-directory (expand-file-name "ede"))) + (cedet-update-autoloads "ede-loaddefs.el" "."))) + (cedet-build-msg "done.\n") + + ;; Get Semantic autoloads built... + (cedet-build-msg "Step 3: Semantic Autloads...") + (save-excursion + (let ((default-directory (expand-file-name "semantic"))) + (cedet-update-autoloads "semantic-loaddefs.el" "." "bovine" "wisent"))) + (cedet-build-msg "done.\n") + + ;; Get SRecode autoloads built... + (cedet-build-msg "Step 4: SRecode Autloads...") + (save-excursion + (let ((default-directory (expand-file-name "srecode"))) + (cedet-update-autoloads "srecode-loaddefs.el" "."))) + (cedet-build-msg "done.\n") + + ;; Fire up CEDET and EDE + (cedet-build-msg "Step 5: Load common/cedet.el ...") + (save-excursion + (load-file (expand-file-name "common/cedet.el" cedet-build-location))) + + (cedet-build-msg "done\nStep 6: Turning on EDE ...") + (save-excursion + (global-ede-mode 1) + (require 'semantic-ede-grammar) + (require 'wisent)) + (cedet-build-msg "done.\n\n") + + ;; Load in the Makefile + (let ((buf (get-buffer-create "CEDET MAKE")) + (pkgs nil) + (subdirs nil) + ) + (cedet-build-msg "Step 7: Scan Makefile for targets...") + (save-excursion + (set-buffer buf) + (insert-file-contents "Makefile" nil) + (goto-char (point-min)) + (re-search-forward "CEDET_ELISP_PACKAGES\\s-*=\\s-*\\\\\n") + (while (looking-at "\\(\\w+\\)\\s-*\\\\?\n") + (setq subdirs (cons (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + subdirs)) + (end-of-line) + (forward-char 1)) + (setq subdirs (nreverse subdirs)) + ) + (cedet-build-msg "%S\n\n" subdirs) + + (cedet-build-msg "Build Emacs Lisp Targets:\n-------------------\n") + (dolist (d subdirs) + ;; For each directory, get the project, and then targets + ;; and run a build on them. + (cedet-build-msg "Building project %s\n" d) + + (let ((Tproj (ede-current-project (file-name-as-directory + (expand-file-name + d cedet-build-location)))) + ) + (dolist (proj (cons Tproj (oref Tproj subproj))) + (cedet-build-msg " Project: %s\n" (object-name-string proj)) + (dolist (targ (oref proj targets)) + (when (and (or (ede-proj-target-elisp-p targ) + (ede-proj-target-elisp-autoloads-p targ) + (semantic-ede-proj-target-grammar-p targ)) + (condition-case nil + (oref targ :partofall) + (error nil))) + + (let ((ns (object-name-string targ))) + (cedet-build-msg " Target %s...%s" ns + (make-string (- 20 (length ns)) ? ))) + + ;; If it is an autoload or elisp target, then + ;; do that work here. + (let ((ans (save-excursion + (project-compile-target targ)))) + (if (and (consp ans) + (numberp (car ans))) + (cedet-build-msg "%d compiled, %d up to date.\n" + (car ans) (cdr ans)) + (cedet-build-msg "done.\n")) + )) + )))) + (cedet-build-msg "\n\nDone.\n"))) + + +(provide 'cedet-build) +;;; cedet-build.el ends here diff --git a/site/cedet-1.0pre7/cedet-update-version.el b/site/cedet-1.0pre7/cedet-update-version.el new file mode 100644 index 0000000..751048f --- /dev/null +++ b/site/cedet-1.0pre7/cedet-update-version.el @@ -0,0 +1,96 @@ +;;; cedet-update-version --- Update version numberes in all cedet packages. + +;;; Copyright (C) 2005, 2006 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-update-version.el,v 1.4 2006/02/08 04:17:01 zappo Exp $ + +;; This file is not part of GNU Emacs. + +;; Semantic is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Maintaining all these version numbers is a real pain. +;; Try to make it a little bit easier on me. +;; +;; M-x cuv-update RET + +;;; History: +;; + +;;; Code: +(if (not (featurep 'cedet)) + (error "You need to have cedet loaded to manage the update versions")) + +(defun cuv-load-package-file (package) + "Get the file name for PACKAGE." + (setq package (symbol-name package)) + (find-library package)) + +(defun cuv-update-package-version (package) + "Update the version number for the package PACKAGE." + (cuv-load-package-file package) + ;; Find the version tag. + (let ((tag (car + (semantic-find-tags-by-name + (concat (symbol-name package) "-version") + (current-buffer))))) + (goto-char (semantic-tag-start tag)) + (semantic-momentary-highlight-tag tag)) + ;; EDE will manage version numbers in files, and also + ;; manage updating the Project files. + (call-interactively 'ede-update-version) + ;; Update Makefiles. + (when (y-or-n-p "Update Makefiles from Projects? ") + (ede-proj-regenerate))) + +(defun cuv-update-all-cedet-packages () + "Update all package version numbers one by one." + (cuv-load-package-file 'cedet) + (let ((p cedet-packages) + (cep (current-buffer)) + (tag (car + (semantic-find-tags-by-name "cedet-packages" + (current-buffer))))) + (while p + (cuv-update-package-version (car (car p))) + (when (not (eq (car (car p)) 'cedet)) + ;; Update the constant in cedet.el also! + (let* ((eo (ede-toplevel)) + (v (oref eo :version))) + (switch-to-buffer cep) + (goto-char (semantic-tag-start tag)) + (re-search-forward (concat "(" (symbol-name (car (car p))) " +\"") + (semantic-tag-end tag)) + (forward-char -1) + (when (y-or-n-p "Update this location also? ") + (kill-sexp 1) + (insert (format "%S" v)) + (sit-for 2)) + )) + (setq p (cdr p))))) + +(defun cuv-update () + "Interactively update all CEDET features before a release." + (interactive) + (cuv-update-all-cedet-packages) + (message "Revision Number Updates Complete.") + ) + +(provide 'cedet-update-version) + +;;; cedet-update-version.el ends here diff --git a/site/cedet-1.0pre7/cogre/ChangeLog b/site/cedet-1.0pre7/cogre/ChangeLog new file mode 100644 index 0000000..4649c92 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/ChangeLog @@ -0,0 +1,1201 @@ +2009-10-01 Eric M. Ludlam + + * Makefile (EMACSPRELOAD): New + (utests,COGRE,utests): Add preload vars. + + * Project.ede (init,Mode,COGRE,utests): + Use the ede-emacs-preload-compiler. + +2009-06-24 Eric M. Ludlam + + * tests/Makefile, templates/Makefile (VERSION): Update to 1.0pre7 + +2009-05-30 Eric M. Ludlam + + * Makefile (VERSION): Update version to match CEDET. + + * Project.ede ("COGRE"): Update version to match CEDET. + + * cogre-mode.el (cogre-mode): Add then change-major-mode-hook below. + (cogre-switch-to-save-text): New fcn. + + * cogre.el (cogre-version): Update to 1.0pre7. + (cogre-augment-element-menu): Remove the rename menu. + (cogre-write-save-text): New method. + +2009-05-29 Eric M. Ludlam + + * cogre-mode.el (cogre-set-scoped-node-package): + Fix prompt to specify package name. + + * cogre.el (cogre-node::cogre-augment-element-menu): New. + +2009-05-08 Eric M. Ludlam + + * cogre-mode.el (cogre-tool-bar-map): Optional, if APIs available. + (cogre-mode): Don't setup toolbar if there isn't one. + +2009-04-23 Eric M. Ludlam + + * cogre-semantic.el (cogre-srecode): New require. + (cogre-export-semantic): New API fcn. + (cogre-base-graph::cogre-export-semantic-method): New method. + (cogre-export-code): New command. + + * cogre-uml.el (cogre-class::cogre-uml-stoken->uml): + Use `with-mode-local-symbol'. + (cogre-class::cogre-node-slots): Fix byte-comp warning. + (cogre-nodes-linkedto,cogre-nodes-all-in-list): New. + (cogre-uml-sort-for-lineage): New API fcn. + +2009-04-19 Eric M. Ludlam + + * cogre-mode.el (cogre-convert-buffer-contents-on-init): + If the cogre save file doesn't work, say so, and put it into + fundamental mode so it can be fixed. + + * cogre-semantic.el (cogre-peer-semantic-class::cogre-peer-update-from-source): + Fix call to cogre-refresh-tag. + + * cogre-semantic.el (cogre-refresh-tag): New, from below. + (cogre-peer-semantic-class::cogre-peer-update-from-source): + Use above fcn to refresh a tag. + (cogre-uml-quick-class): Fix use of calculated scope. + +2009-04-11 Eric M. Ludlam + + * cogre-mode.el (cogre-node-base-menu): Renamed from "mode-base". + Remove yank. Changed to a variable/easymenu declaration combo. + (cogre-link-base-menu): New variable/easymenu combo. + (cogre-change-forms-menu): Use cogre-augment-element-menu fcn instead + of slot value. + (cogre-convert-buffer-contents-on-init): Fix rename of + cogre-base-graph class name. + (cogre-set-element-name): Set init to same as default in query. + (cogre-set-scoped-node-package): New fcn. + (cogre-down-mouse-3): Query for modifications to the node menu. + If so, merge and show the modified menu. + + * cogre-uml.el (cogre-augment-element-menu): + Add menu entry for changing the package name. + + * cogre.el (cogre-graph-element): Remove menu entry. + (cogre-graph-element::cogre-augment-element-menu): Add menu + augmentation method. + + * cogre-utest.el (cogre-utest-quick-class): + Force tags update in test file. + + * cogre-uml.el (require): Add cogre-semantic + (cogre-uml-stoken->uml): Allow cogre-semantic to not be loaded. + + * cogre-semantic.el (cogre-uml-quick-class): + Make sure search results always pass through + to the next as non-nil. + Signal an error if class-tok isn't found. + + * tests/Makefile: Makefile for tests directory. + + * Makefile (utests_LISP): Renamed from tests_LISP + (all): Add utests (was tests), add Tests. + (utests): Renamed from tests. + (Tests): New subproject. + (tags, dist): Call down to new subproject. + + * Project.ede ("utests"): Renamed from just "tests" + + * tests/Project.ede: Test project. + + * cogre-utest.el (cogre-utest-quick-class): New. + + * cogre-semantic.el (cogre-peer-project-semantic): New class + (cogre-peer-semantic::cogre-peer-source-file): New method. + (cogre-peer-semantic-class::cogre-peer-update-from-source): + Add new code to refresh the stored tag from sources. + (cogre-uml-quick-class): Don't let layout cause an error. + + * cogre-convert.el (cogre-base-graph::cogre-export-dot-method): + New method class name. + + * cogre-mode.el (cogre-mode-map): Add "U" binding. + (cogre-mode-menu): Use better active fcn for yank. + Add "Update" submenu. + Lengthen menu names of things to export to. + (cogre-mode-create-popup-menu): Move "Node" to top. + Add Yank menu item. + (cogre-mode-new-link-popup-menu): Add update item. + (cogre-mode-update-popup-menu): Add node updates item. + Add Delete back in. + Use better active fcn for yank. + (cogre-insert-class-list): New method class name. + (cogre-killring-active, cogre-node-with-peer): New. + (cogre-update-node-from-source, cogre-update-graph-from-source): New. + (cogre-set-element-name): Update peer from element at end. + (cogre-move-node): If off-buffer to top or left, reset to 0, not 1. + + * cogre-uml.el (cogre-package): :subgraph type is cogre-base-graph now. + (cogre-class::cogre-uml-stoken->uml): Format strings with + the major-mode active from which the tags came, when possible. + + * cogre.el (cogre-base-graph): Renamed from `cogre-graph' + (cogre-element-peer::cogre-peer-source-file): New + (cogre-base-graph::initialize-instance): Method class name change. + Fix :detail slot :custom attribute. + Add :major-mode slot. + (cogre-graph-element): Doc fix. + (cogre): Create cogre-base-graph class. + (cogre-base-graph::initialize-instance) + (cogre-base-graph::eieio-done-customizing) + (cogre-base-graph::cogre-unique-name) + (cogre-base-graph::cogre-render-buffer) + (cogre-base-graph::cogre-save): Method class name change. + + * cogre-ascii.el (cogre-export-ascii): + Set cogre-graph var to be the graph we are exporting. + + * tests/testclasses.hh: A set of classes to test COGRE on. + + * cogre-uml.el (cogre-class::cogre-uml-stoken->uml): + If there is a peer, use it to + try and find the originating buffer so that the formatting will work + more accurately. + +2009-04-10 Eric M. Ludlam + + * cogre-mode.el (cogre-mode-menu, cogre-mode-create-popup-menu): + Add calls to below. + (cogre-customize-graph): New. + + * cogre-uml.el (cogre-class::cogre-uml-stoken->uml): + Visit originating file to format + the tag. + (cogre-class::cogre-node-slots): Support detail. + Lower details strip out duplicate information from the class. + + * cogre.el (cogre-graph): Add a detail slot. + (cogre-graph::eieio-done-customizing): New. + + * uml-create.el: Obsolete + +2009-04-09 Eric M. Ludlam + + * cogre-semantic.el (cogre-uml-quick-class): + Use `semanticdb-find-tags-subclasses-of-type' for searching for + children instead of obsoleted old function. + Rearranged other bits. + + * cogre-semantic.el (cogre-uml-quick-class): + Narrow down the list of classes more carefully. + + * cogre-uml.el (cogre-class): + Remove 'class' slot. It is no longer used. + + * cogre-semantic.el (cogre-class-history, cogre-read-class-name): + Copied from + uml-create.el + (cogre-uml-quick-class): New implementation of old function in + uml-create.el. + Some bits were kept from the previous version, but rebuilt using new + peer based class nodes. + + * cogre-convert.el (cogre-export-dot-png, cogre-export-dot-postscript-print): + Ask if the current layout should be used. If not, let dot run + and calculate a new layout. + + * cogre-mode.el (cogre-copy-element, cogre-yank-element): + Prevent name number advancement from EIEIO `clone' method. + + * Makefile (COGRE_LISP): Remove uml-create.el, add cogre-semantic.el + + * Project.ede (COGRE): Remove uml-create.el, add cogre-semantic.el + + * cogre-semantic.el: Support for Semantic Tag based node peers. + + * cogre-mode.el (cogre-mode-map): Remove `cogre-edit-label'. + Add C-k,C-w,M-w,C-y kill/yank node commands. + (cogre-mode-menu, cogre-mode-update-popup-menu): + Replace 'delete' with kill/copy/yank submenu. + (cogre-kill-element, cogre-copy-element, cogre-yank-element): + New. + + * cogre-utest.el (cogre-uml-utest): Deleted. + + * cogre-convert.el (cogre-graph::cogre-export-dot-method): + Add autoload cookie. + + * cogre.el (cogre-element-peer): New class + (cogre-element-peer::cogre-peer-update-from-source) + (cogre-element-peer::cogre-peer-update-from-element): New base methods. + (cogre-graph) + (cogre-graph-element): Add peers. + +2009-04-07 Eric M. Ludlam + + * cogre-periodic.el: (cogre-periodic-node-name-list) + (cogre-periodic): Add a notes node. + + * Makefile (dot_LISP): Add cogre-dot-mode. + + * Project.ede ("dot"): Add cogre-dot-mode.el + + * cogre-layout.el (cogre-layout): + Use cogre-dot-mode, not graphviz-dot-mode. + + * cogre-convert.el (cogre-export-dot): + Use cogre-dot-mode, and don't try to + get graphviz-dot-mode working here. + (cogre-graph::cogre-export-dot-method): Set the current buffer + to the buffer the graph belongs to. + (cogre-export-dot-utest): Don't error out on a missing mode anymore. + + * wisent-dot.el (Commentary): Discuss cogre-dot-mode substitute. + (cogre-dot-mode-hook): Support this mode also. + + * cogre-dot-mode.el: A mini mode for graphviz dot files. + If graphviz-dot-mode is available, use that, otherwise supply just + enough to get Semantic parsing the files. + + * cogre.el (cogre-graph): Do not specify an initarg for buffer slot. + (cogre-graph::initialize-instance): Set buffer to the current buffer. + (cogre): Switch to the new graph buffer before creating the + graph object. + +2009-04-06 Eric M. Ludlam + + * cogre-convert.el (cogre-class::cogre-export-dot-label): + Use below to fill in methods + and attributes in the node. + (cogre-class::cogre-export-dot-methodlist) + (cogre-class::cogre-export-dot-fieldlist): New + + * wisent-dot.el (Commentary): Remove patch + (wisent-dot-setup-parser): Adopt patch parts into + semantic-lex-syntax-modifications instead. + + * wisent-dot.wy (start attribute-block): Renamed + (graphgeneric, attribute-block, opt-link-attributes,opt-link-attributes): + Use above new name. + (attribute-block): New name, was name-description. + + * cogre-srecode.el (cogre-srecode-load-tables): New fcn. + + * cogre-convert.el (require): ps-print. + (cogre-export-dot): Load and test graphviz in a special way since + it does not have a 'provide statement. + Force load of srecode tables. + (cogre-export-dot-png): Save window excursion when creating the dot + file. + Add autoload cookie. + (cogre-export-dot-postscript-print): Add autoload cookie. + + * wisent-dot.el (graphviz-dot-mode::semantic-tag-components): + Use define-mode-local-override instead of old version. + + * cogre.el (cogre-find-node-by-name): New + (cogre-graph::cogre-unique-name): Use above instead of inline. + + * cogre-layout.el (cogre-layout): Add autoload cookie + + * cogre-mode.el (cogre-mode-menu): Add menu for PS Print, and layout. + + * Makefile (COGRE_LISP): Add cogre-layout.el + + * Project.ede (COGRE): Add cogre-layout.el + + * cogre-convert.el: (cogre-export-dot-png) + (cogre-export-dot-postscript-print) + (cogre-dot-node-position-scale): Doc updates. + + * cogre.texi (Top): Add below. + (Export): New chapter. + + * cogre-convert.el (cogre-export-dot-postscript-print): New. + (cogre-dot-node-position-scale): New custom variable. + (cogre-node::cogre-export-dot-pos): Use above to scale in X/Y + at different amounts. + + * wisent-dot.wy (graph-contents): Add below. + (graphgeneric): New + (name): Use identity for symbol return. + + * cogre-srecode.el (graphviz-dot-mode::srecode-calculate-context): + New override method. + + * cogre-layout.el: Use dot as a layout engine for COGRE. + +2009-04-05 Eric M. Ludlam + + * cogre-uml.el (cogre-inherit): + Change horizontal preference ratio to .1. + + * cogre-srecode.el (graphviz-dot-mode::srecode-semantic-apply-tag-to-dict): + Attributes are not tags, not a plist. + + * cogre-convert.el (cedet-graphviz): New require. + (cogre-export-max-y): New variable. + (cogre-export-dot): Setup cogre-export-max-y. + (cogre-export-dot-png): Expand output filename.. Add -n argument. + (cogre-tag-put-dot-attribute): Convert to update a list of tags. + (cogre-node::cogre-export-dot-method): Add a position attribute. + Create all attribs as tags, not plist. + (cogre-export-dot-pos): New fcn. + (cogre-link::cogre-export-dot-method): Attrs are not tags. + (cogre-export-dot-utest): Links in dot are backwards, so deal. + + * cogre-mode.el (cogre-mode-menu): + Move ASCII and DOT into an export menu, and add .png. + + * cogre-convert.el (cogre-export-dot-png): New. + + * wisent-dot.wy (SHAPE,LABEL,COLOR,STYLE,LEN,FONTNAME,FONTSIZE,WIDTH,HEIGHT,SPLINES,OVERLAP): + Deleted keywords. + (graph-contents): Remove label and style entries. + (label,style): Delete + (named-node): Use name instead of symbol. + (node-description): Remove SHAPE,LABEL,FONTNAME,FONTSIZE entries. + Use name instead of symbol. + (name): New. + +2009-04-04 Eric M. Ludlam + + * Makefile (LOADPATH): Add srecode. + (COGRE_LISP): Add cogre-srecode.el cogre-convert.el + (icons_MISC): Add cogre-nodes.el + (templates): New + (dist): Add templates to dist. + + * Project.ede (COGRE): Add cogre-srecode.el cogre-convert.el + (icons): Add cogre-node.xpm + + * cogre-convert.el (cogre-export-dot): + Require graphviz mode w/ a version number. + (require): Require cogre-periodic for tests. + (cogre-export-dot-utest): Skip test if graphviz mode isn't available. + + * cogre-srecode.el (cogre-srecode-setup): + Don't require graphviz so stringently. + require 'srecode-dictionary. + (eval-after-load ...): + Don't require graphviz-dot-mode. Key off srecode-map instead. + + * cogre-uml.el (cogre-scoped-node): Add package-delimiter slot. + (cogre-node-title): Use above making the title. + (cogre-uml-enable-unicode): Change package-delimiter strings + to unicode equivalents. + + * cogre-periodic.el (cogre-periodic-node-name-list, cogre-periodic-link-connectivity-list): + New. + + * cogre-convert.el: + Conversion utilities for transforming graph data into other kinds of + data structures. + + * cogre-srecode.el: + SRecode support for COGRE related graphs and DOT tags. + + * templates/Makefile: + Makefile file for srecode templates related to cogre. + + * templates/Project.ede: + Project file for srecode templates related to cogre. + + * templates/cogre-default.srt: Default COGRE graph exporting templates. + + * templates/srecode-dot.srt: Base DOT templates for srecode. + +2009-03-31 Eric M. Ludlam + + * cogre-mode.el (cogre-mode-map): Override mouse-drag events. + + * cogre-mode.el (cogre-down-mouse-1): + If click misses all elements, then + pan the buffer in the window instead. + + * picture-hack.el (picture-mouse-set-point): + Fix to handle current window hscroll. + + * cogre-mode.el (cogre-mode-create-popup-menu): Remove links from menu. + (cogre-mode-create-popup-menu): Add note node. + (cogre-tool-bar-map): Add note node. + + * cogre-ascii.el (cogre-package::cogre-node-rebuild-ascii): + Delete unused line. + (cogre-note::cogre-node-rebuild-ascii): New. + + * cogre-uml.el (cogre-note): New node type. + (cogre-note::cogre-node-rebuild-default): New method. + + * cogre-note.xpm: Icon for note nodes + +2009-03-30 Eric M. Ludlam + + * uml-create.el (cogre-semantic-uml-graph): Add autoload cookie. + +2009-03-29 Eric M. Ludlam + + * cogre.el (cogre-graph-element::eieio-done-customizing): + Erase and redraw when done customizing. + + * cogre-uml.el (cogre-scoped-node): Default package is "" + (cogre-scoped-node::cogre-node-title): Check for "", not nil for + package name. + + * cogre-periodic.el (cogre-periodic): + Add package names to one class, and one instance. + + * cogre-uml.el (cogre-scoped-node): New baseclass + (cogre-scoped-node::cogre-node-title): New method. + (cogre-class, cogre-instance): Inherit from above. + (cogre-instance::cogre-node-widest-string): Deleted. + (cogre-instance::cogre-node-title): Call next method, then + modify the output. + + * cogre.el (cogre-node::cogre-node-rebuild-default): + Don't reverse the title list. + (cogre-node::cogre-node-widest-string): Track a name list, not just + the name. + + * cogre.el (cogre-last-event-element-type): Fix for keyboard use case. + + * cogre.texi (Getting Started): Add notes about file extensions. + Fix doc for cogre command. + (Creating Nodes and Links): Add notes about mouse usage. + (Moving Nodes): Add notes on use of mouse, and need to refresh the + graph sometimes. + + * cogre.el (cogre-entered): Remove old implementation. + + * cogre-mode.el (cogre-save-hook): + When graph has no filename, but buffer does, + set the file into the graph. + Throw error if the file slot is unbound. + + * cogre.el (cogre): Change doc string. + (cogre-graph::cogre-render-buffer): Clear modification flag after + drawing iff the modification flag wasn't set to start with. + (cogre-save-graph-as, cogre-save-graph): Deleted. + (cogre-load-graph): Deleted. + (cogre-save): Return t. + + * cogre-mode.el (cogre-mode-map): Remove save from keymap. + (cogre-mode-menu): remove save from keymap. + (cogre-popup-map): New keymap. + (cogre-mode-create-popup-menu) + (cogre-mode-new-link-popup-menu) + (cogre-mode-update-popup-menu): Remove from main keymap, add to sub-map. + (cogre-mode): Add write-contents-function + Call cogre-convert-buffer-contents-on-init on new buffers. + Move rendering to the end. + (auto-mode-alist): Add .cgr files. + (cogre-convert-buffer-contents-on-init): New + (cogre-save-hook): New + +2009-03-28 Eric M. Ludlam + + * cogre-mode.el (cogre-goto-element): New, bits fron next-node. + (cogre-next-node): Call above + (cogre-render-node-after-erase): New, copied from move. + (cogre-set-element-name): Call above, and position. + (cogre-move-node): Call above. + + * cogre.el (cogre-arrow): Shring left/right arrow head. + (cogre-link::cogre-render): Erase less from the arrow heads. + + * cogre-periodic.el (cogre-periodic-utest): New test. + + * Makefile (COGRE_LISP): Add cogre-ascii.el + + * Project.ede (COGRE): Add cogre-ascii. + + * cogre-mode.el (cogre-mode-menu): Add export-as-ascii + (cogre-mode): Force font-lock to be disabled. + (cogre-new-node): Accept FIELDS argument to modify created + object. + + * cogre-periodic.el (cogre-periodic): + One of the classes now has sttributes and methods. + (cogre-periodic-make-node-at): Accept FIELDS argument. + + * cogre-uml.el (cogre-package::cogre-node-rebuild-default): + Renamed from + cogre-node-rebuild. + (cogre-class::cogre-uml-stoken->uml): Accept semantic tags or + old style slot elements. + + * cogre.el (cogre-node-rebuild-method): New variable. + (cogre-map-elements): Accept a graph argument. + (cogre-graph::cogre-render-buffer): Pass the graph into map-elements + (cogre-node::cogre-node-rebuild): New. Call below. + May call rebuild method if set. + (cogre-node::cogre-node-rebuild-default): Was a bove. + (cogre-graph::cogre-save): Pass graph into map elements. + + * cogre-ascii.el: Ascii export of a cogre graph. + + * picture-hack.el (cogre-picture-insert-rectangle): Fix paren bug. + + * cogre-mode.el (cogre-mode): Disable insertion of TABS. + + * cogre.el (cogre-node::cogre-render, cogre-link::cogre-render): + Convert picture-insert-rectangle to cogre-insert-rectangle. + + * picture-hack.el (cogre-picture-insert-rectangle): Fix typo + + * picture-hack.el (cogre-picture-insert-rectangle): + Renamed from picture-insert-rectangle. + Removed insertp arg. + Replaced old delete-rectangle w/ a delete that happens just before the + insert on a per-line basis. + +2009-03-27 Eric M. Ludlam + + * cogre-mode.el (cogre-mode): Disable undo in cogre buffers. + + * cogre-hasa.xpm: Fill in the diamond. + + * cogre-class.xpm (cogre_class_xpm): Try to improve text. + + * Makefile (COGRE_LISP): Add cogre-periodic + (icons_MISC): Add node, instance, arrow, and link icons. + + * Project.ede (COGRE): Add cogre-periodic + (icons): Add node, instance, arrow, and link icons. + + * cogre-link.xpm: Simple linke icon. + + * cogre-periodic.el (cogre-periodic): Use new utils below. + Add an arrow link. + (cogre-periodic-make-*-at): New. + + * cogre-mode.el (cogre-mode-menu): Move refresh. + (cogre-mode-new-link-popup-menu): New. + (cogre-mode-create-popup-menu): Add instance, node, link, and arrow. + (cogre-tool-bar-map): Add node, instance, link, and arrow. + (cogre-new-node, cogre-new-link): Just render the new element. + (cogre-set-element-name): Just render the new node. + (cogre-move-node): Validate input coordinates. + Render just this node, and attached links. + (cogre-move-node-*): Remove redrawing of the whole buffer. + (cogre-down-mouse-1): Don't rerender the whole buffer for + each mouse step. Do a full refresh only at the end. + (cogre-down-mouse-2-link-selector, cogre-select-a-link): New. + (cogre-down-mouse-2): Popup a menu after drag to select + a link style to use. + + * cogre.el (cogre-arrow): Add a new arrow type. + + * cogre-uml.el (cogre-package::cogre-node-slots): Deleted + (cogre-package::cogre-node-rebuild): New method. + (cogre-inherit): Fix right-arrow. + (cogre-instance): New + (cogre-instance::cogre-node-widest-string) + (cogre-instance::cogre-node-title): New methods. + (cogre-uml-enable-unicode): Add an arrow. + + * cogre-arrow.xpm: Arrow icon. + + * cogre-instance.xpm: Instance node icon. + + * cogre-node.xpm: Node icon. + + * cogre-periodic.el: A graph that shows all the current elements. + + * cogre-uml.el (cogre-package): Add some blank lines above/below name. + (cogre-package::cogre-node-slots): No slots. + (cogre-package::cogre-node-rebuild): New method. + + * cogre.el (cogre-string-merge-faces): New fcn derived from below. + (cogre-string-with-face): Delete face merge code, call above instead. + +2009-03-24 Eric M. Ludlam + + * Makefile (icons_MISC): New + (all): Add icons + (icons): New + (dist): Dist the icons. + + * Project.ede: Add icons target. + + * cogre-utest.el (cogre-utest): Fix spelling of aggregate. + +2009-03-23 Eric M. Ludlam + + * cogre-mode.el (cogre-mode-map): Define map within definition. + Add mouse events. + (cogre-mode-create-popup-menu, cogre-mode-update-popup-menu): + New menus. + (cogre-move-node): Allow a node to be moved by argument. + (cogre-node-position): Add noerror argument. + (cogre-down-mouse-1): New function for dragging nodes + (cogre-down-mouse-2): New function for creating a link. + (cogre-down-mouse-3): New function for dynamic popup menus. + + * cogre.el (cogre-last-event-element-type): New + (cogre-default-node): Use above + (cogre-default-link): Use above + +2009-03-22 Eric M. Ludlam + + * cogre-mode.el (cogre-tool-bar-map): New. + (cogre-mode): Setup toolbar. + (cogre-new-node): Remove stray code. + + * cogre-class.xpm, cogre-hasa.xpm, cogre-isa.xpm, cogre-package.xpm: + Icons for COGRE toolbar. + + * cogre.el (cogre-default-node, cogre-default-link): + Support selecting a node + based on a key symbol. (ie, toolbar.) + + * cogre-uml.el (cogre-aggregate, cogre-uml-enable-unicode): + Fix typo in aggregate name. + +2009-03-19 Eric M. Ludlam + + * Makefile, Project.ede, cogre.el (cogre-version): Update Version + +2009-03-12 Eric M. Ludlam + + * .cvsignore: No info or jpg + +2009-03-05 Alex Ott + + * .cvsignore: + add ignore files to not show auxiliary scripts, not included into CVS + +2009-02-24 Eric M. Ludlam + + * Makefile (EMACSFLAGS): New variable. + (init,dot,Mode,hacks,COGRE,tests): Use above. + +2009-01-29 Eric M. Ludlam + + * Project.ede ("COGRE"): Updated version to 0.7 + + * Makefile (VERSION): Updated to 0.7 + + * cogre.el (cogre-version): Updated to version 0.7. + +2009-01-28 Eric M. Ludlam + + * cogre-utest.el (cogre-utest-link-at): + Change to use 'push-mark' instead of + 'push-mark-command'. + +2009-01-24 Eric M. Ludlam + + * cogre-uml.el (cogre-uml-enable-unicode): + Update doc to describe the code pages. + +2009-01-20 Eric M. Ludlam + + * INSTALL: Add dicussion on unicode drawing chars. + + * cogre-uml.el (cogre-uml-enable-unicode): Support unicode UML symbols. + + * picture-hack.el (picture-rectangle-ctr, picture-rectangle-cbl, picture-rectangle-cbr): + Added in from picture mode. + (picture-draw-rectilinear-line): Use correct corners. + + * cogre-utest.el (cogre-utest): Use new cedet logging fcns. + Fixup to work in batch mode. + (cogre-utest-make-node-at): Render the graph. + (cogre-utest-link-at): Pass nomsg to push-mark. + + * cogre-mode.el (cogre-node-position): New fcn. + (cogre-move-node-left, cogre-move-node-right, cogre-move-node-up): + (cogre-move-node-down): Use cogre-node-position. + + * cogre.el (cogre-noninteractive): New fcn. + (cogre-graph-element::cogre-entered): No message in non-interactive mode. + (cogre-node::cogre-erase, cogre-node::cogre-render): + Convert mapcar to mapc. + + * picture-hack.el (picture-insert-rectangle): + Don't use insert-rectangle, but do it + directly inline. + +2009-01-10 Eric M. Ludlam + + * picture-hack.el (picture-rectangle-ctl): XEmacs compat hack. + (picture-draw-rectilinear-line): + + * cogre-utest.el (cogre-uml-utest): Force tag loading. + +2009-01-05 Eric M. Ludlam + + * cogre-utest.el (cogre-uml-utest): New test. + + * cogre-uml.el (cogre-inherit): Reduce the horizontal preference. + + * Makefile (tests_LISP): New var + (all): Add tests + (dist): Add tests + (tests): New target + + * Project.ede ("tests"): New target. + + * cogre-utest.el (picture-hack, cogre-mode): New requires + + * cogre-utest.el: Basic unit tests for cogre. + + * cogre-mode.el (cogre-mode): + Disable transient mark mode in cogre buffers. + (cogre-new-node): Return the node + (cogre-new-link): Return the link + +2008-07-03 Eric M. Ludlam + + * cogre-uml.el (cogre-package, cogre-class, cogre-inherit, cogre-aggrigate): + Add autoload cookies. + + * cogre.el (cogre-load): Move require after eieio. + (cogre-graph, cogre-graph-element, cogre-node, cogre-link): + Add autoload cookies. + +2008-05-11 Eric M. Ludlam + + * cogre.texi (top): + Update main header of COGRE, and all node entries to new format. + (Creating Nodes and Links) + (Moving Nodes, Customizing Nodes): Wrote. + +2008-04-14 Eric M. Ludlam + + * Makefile (VERSION): Updated to 0.6. + + * Project.ede (COGRE): Update version. + + * cogre.el (cogre-version): Update to 0.6. + +2008-03-11 Eric M. Ludlam + + * Makefile (LOADPATH): Added EDE + + * Project.ede ("COGRE"): Renamed from bogus thing. + +2007-04-15 Eric M. Ludlam + + * uml-create.el (cogre-graph::cogre-save): Deleted from this file. + (cogre-semantic-uml-graph::cogre-save): Allow saving. + (cogre-semantic-class::initialize-instance): Copy the tag found. + + * uml-create.el (cogre-graph::cogre-save): + Add comment about why we can't save. + + * cogre.el (cogre-load-graph): Stop using a temporary graph. + +2007-03-18 Eric M. Ludlam + + * Makefile (LOADPATH): Stripped down version + (wy): Spelling fix. + (autoloads, init, dot, Mode, hacks, COGRE, dist): + Various changes from EDE patches. + +2007-02-19 Eric M. Ludlam + + * uml-create.el (semanticdb-find): Add require + (cogre-semantic-class::initialize-instance) + (cogre-read-class-name) + (cogre-uml-quick-class) + (cogre-uml-create): Convert to new semanticdb search. + + * cogre-mode.el (cogre-mode): Add semantic-match-any-mode feature. + + * cogre.el (cogre-load, picture-hack): Add requires for byte-comp. + (cogre): Add to tools group. + +2007-02-03 Eric M. Ludlam + + * uml-create.el (cogre-semantic-class::cogre-uml-stoken->uml): + Disable images in semantic formatted strings. + +2005-09-30 Eric M. Ludlam + + * wisent-dot.wy, wisent-dot.el, uml-create.el, picture-hack.el, cogre-uml.el, cogre-mode.el, cogre-load.el, cogre.el: + Update all GPL headers with script from savannah.gnu.org. + +2005-02-03 Eric M. Ludlam + + * Project.ede ("COGRE"): Update version number. + + * Makefile (VERSION, Makefile): Updated from project file. + + * cogre.el (cogre-version): Update version number. + +2004-09-28 Eric M. Ludlam + + * uml-create.el (semantic-grammar-batch-build-packages): + Use new semantic :type. + +2004-05-25 David Ponce + + * Makefile: Re-generated to start Emacs with --no-site-file. + +2004-04-06 Eric M. Ludlam + + * Makefile (dist): Distribute the autoload file + +2004-03-28 David Ponce + + * Makefile: Rebuild. + + * Project.ede (wisent): Rename target to "wy". + (COGRE): Remove semantic-el dependency. Add dependency on + inversion and speedbar. + + * cogre-uml.el (cogre-class): Doc fix. + +2004-03-25 David Ponce + + * wisent-dot.el (semantic-wisent): Require instead of wisent-bovine. + +2004-02-29 Eric M. Ludlam + + * INSTALL: Revamped. We are a part of a CEDET install now. + +2004-02-02 David Ponce + + * wisent-dot.el (semantic-tag-components): + New override for `graphviz-dot-mode'. + +2004-01-23 David Ponce + + * wisent-dot.wy: Some code cleanup. + (, , , ): Declare as type. + (, ): Use type defaults. + (epilogue): Define `wisent-dot-lexer' here. + + * wisent-dot.el (wisent-dot-lexer): Remove. Defined in grammar. + +2004-01-15 Eric M. Ludlam + + * wisent-dot.el (semantic-lex-dot-blocks): Deleted. + (wisent-dot-lexer): Remove old style analyzers. Replace with + auto-generated ones. + + * wisent-dot.wy (punctuation, block): + Use new %type command to build lexers. + +2003-10-02 Eric M. Ludlam + + * Project.ede: Now a meta-subproject. + + * Makefile (dist): Remove local creation of tar file. + +2003-09-24 Eric M. Ludlam + + * Project.ede, Makefile, cogre.el: Update version to 0.4beta1. + +2003-09-18 David Ponce + + * Makefile: Re-generated. + + * Project.ede (init): New target. + +2003-09-17 David Ponce + + * cogre-load.el: New file. + + * Makefile: Re-generated. + + * Project.ede (autoloads): Change cogre-defs.el by cogre-loaddefs.el. + +2003-09-16 David Ponce + + * Makefile: Re-generated. + + * Project.ede (target COGRE): + Remove non existing file cogre-lay.el from target. + +2003-09-14 David Ponce + + * wisent-dot.el (wisent-dot-setup-parser): Fix use of obsolete names. + +2003-09-10 David Ponce + + * Makefile: Re-generated. + +2003-09-07 Eric M. Ludlam + + * Makefile: Makefile. + + * Project.ede ("wisent"): New + ("autoloads"): New + ("dot"): New + ("mode"): New. + + * uml-create.el: + (initialize-instance, cogre-token->uml-function, cogre-uml-stoken->uml) + (cogre-uml-browse-token-highlight-hook-fn, cogre-uml-source-marker) + (cogre-read-class-name, cogre-uml-quick-class): New semantic API + + * cogre-mode.el: Coped elements from cogre.el + + * cogre.el (cogre-box-face, cogre-box-first-face, cogre-box-last-face): + Removed + (cogre-graph-element): made abstract + (cogre-node): made abstract + (cogre-link): made abstract + (cogre-mode-map, cogre-substitute, cogre-insert-class-list) + (cogre-insert-forms-menu, cogre-change-forms-menu): Removed + (cogre): autoload cookie. + (cogre-mode, & many others): Removed + (cogre-default-node, cogre-default-link): Use 4th arg to + eieio-read-subclass. + (cogre-load-graph): autoload + + * wisent-dot.wy: Removed obsolete code. + + * wisent-dot.el (wisent-dot-automaton, other autogen): Deleted + (wisent-dot-setup-parser): Removed autogen parts, copied in parts + that used to be in the .wy file. + +2003-07-23 Eric M. Ludlam + + * wisent-dot.wy (languagemode): Set to graphviz-dot-mode + +2003-03-26 Eric M. Ludlam + + * test.dot: Sample dot file for dot parser. + + * wisent-dot.el: + (wisent-dot-automaton, wisent-dot-keywords, wisent-dot-tokens) + (wisent-dot-setup-parser): Updated from grammar. + + * wisent-dot.wy (FONTNAME, FONTSIZE): New tokens. + (DILINK, LINK): Now of punctuation type. + (number): New token class. + (graph-contents): Added graph-attributes + (graph-attributes): New + (links): Optional semicolon and attribute vector. + + * wisent-dot.el: + Lexer, Grammar and support for parsing graphviz dot files. + + * wisent-dot.wy: Grammar file for graphviz dot files + +2003-02-25 Eric M. Ludlam + + * uml-create.el (initialize-instance): + Use new function that calculates externally + defined children of a type. + (cogre-uml-quick-class): typo + +2001-12-05 Eric M. Ludlam + + * Project.ede: Version. + New layout code. + + * uml-create.el (cogre-save): New method. + (initialize-instance): Enable classes and structures. + Add default name for unfound classes in semantic. + (cogre-uml-stoken->uml): Get buffer from objectified class. + (cogre-uml-quick-class): Get the superclass instead of just the parent. + + * picture-hack.el (picture-insert): Fix for older versions of Emacs. + + * cogre-uml.el (cogre-class): Add :custom specifiers to some slots. + + * cogre.el (cogre-graph): Added extension. + (cogre-node): Remove initargs from fields not to be saved. + (cogre-link): Enable STRINGS as node entries for intermediate save state. + (cogre-loading-from-file): New variable. + (cogre-mode-map): Supress the keymap. Add save command. + (cogre-mode-menu): Added Save and Save As entries. + (cogre-map-elements, cogre-map-graph-elements): New fcn + (initialize-instance): Do not initialize when loading from a file. + (cogre-render-buffer): Use new map-lements command. + (cogre-element-pre-serialize, cogre-element-post-serialize): New methods. + (cogre-save-graph-as, cogre-save-graph, cogre-load-graph): New commands. + +2001-08-17 Eric M. Ludlam + + * uml-create.el (cogre-uml-browse-token-hook): New hook. + (cogre-uml-browse-token-highlight-hook-fn): New function for above. + (cogre-uml-source-marker): Use hook instead of always highlighting a token. + + * uml-create.el (cogre-token->uml-function): New variable. + (cogre-uml-stoken->uml): Use above to generate text. + (cogre-uml-source-marker): Momentary highlight tokens. + + * picture-hack.el (picture-insert): + Fix move-to-column typo from previous checkin. + + * cogre.el: Update version. + (eieio-base): require + (cogre-custom-originating-graph-buffer): New local variable. + (cogre-activate): Track the originating buffer before customizing. + (eieio-done-customizing::cogre-graph-element): Set buffer to the + graph before forcing a re-render. + +2001-08-14 Eric M. Ludlam + + * picture-hack.el: + Use `move-to-column' instead of `move-to-column-force' for backward + compatibility. + +2001-08-08 Eric M. Ludlam + + * Project.ede: Project file for cogre. + + * cogre.texi: Outline of a cogre manual + + * picture-hack.el (picture-insert-rectangle): + Added Emacs 21 compatibility comment. + (clear-rectangle): New compatibility function. + + * cogre.el: Support latest EIEIO changes. + (cogre-new-node): Pass prefix arg to `cogre-default-node'. + (cogre-new-link): Pass prefix arg to `cogre-default-link'. + (cogre-layout): Remove these methods. + +2001-07-20 Eric M. Ludlam + + * cogre-uml.el: Added comment about ASCII UML. + +2001-07-12 Eric M. Ludlam + + * cogre.el: Use :class instead of class for allocation of slots. + +2001-06-12 Eric M. Ludlam + + * INSTALL: Installation instructions for COGRE. + +2001-06-06 Eric M. Ludlam + + * picture-hack.el (Colin Marquardt): + Added XEmacs compatibility functions. + +2001-06-05 Eric M. Ludlam + + * uml-create.el (cogre-uml-stoken->uml): + Call abbreviate token from the originating buffer. + +2001-05-21 Eric M. Ludlam + + * cogre.el (cogre-string-with-face): + Fixed bug in last fix that colorized everything. + + * uml-create.el: do not use window-list, it is Emacs 21 only. + + * cogre.el: + Stopped using `plist-member' which appears to be Emacs 21 only. + +2001-05-19 Eric M. Ludlam + + * uml-create.el (cogre-semantic-uml-graph): New class. + (cogre-insert-clas-slist:cogre-semantic-uml-graph): New method. + (cogre-uml-source-marker:cogre-semantic-class): New method + (cogre-uml-source-display): Split into cogre-uml-source-marker for + getting the position to jump to. + (cogre-activate:cogre-semantic-class): New method. + (cogre-uml-quick-class): Make sure all tokens are in buffers. + Create the graph from cogre-semantic-uml-graph. + + * cogre.el (cogre-node): Fixed documentation. + (cogre-substitute): Doc fix. + (cogre-mode-map): Added RETURN binding to edit/view. + (cogre-insert-class-list:cogre-graph): New method + (cogre-insert-forms-menu): Call graph method for things to insert. + (cogre): accept an argument for the class of the graph to create. + (cogre-activate-element): New function. + (cogre-activate:cogre-graph-element): New method. + +2001-05-18 Eric M. Ludlam + + * uml-create.el: Code from `cogre-uml.el' specific to semantic. + New code handles graph/source interactions. + + * cogre-uml.el: Moved out semnatic specific UML into `uml-create.el' + (cogre-uml-stoken->uml): New function. + (cogre-node-slots): Use above. + + * cogre.el (*-face): Under/Over lines match default foreground color. + (cogre-link): Types are now the explicit class name (return of eieio feature). + (cogre-move-node): Inhibit motion hooks. + (cogre-render-buffer): Inhibit motion hooks. + (cogre-entered, cogre-left: cogre-graph-element): New methods. + (cogre-node-rebuild): Use underlining when possible instead of overlining. + (cogre-string-with-face): Propagate properties on passed in strings. + Conglomerate new face with old faces. + +2001-05-09 Eric M. Ludlam + + * cogre.el: Converted to use the new eieio-named base class. + Added "Delete" to the menu. + + * cogre-uml.el: Converted to use the new eieio-named base class. + +2001-05-07 Eric M. Ludlam + + * cogre-uml.el (cogre-class): Set the alignment to left. + (cogre-node-slots): Use the new uml-abbreviate method. + (cogre-read-class-name): Fix bugs w/ current class under cursor. + (cogre-uml-quick-class): Added recentering code. + + * cogre.el (cogre-horizontal-margins, cogre-vertical-margins): + New variables + (cogre-graph-element): Added `menu' field. + (cogre-node): Added `alignment' field. + Added menu to minor mode keymap. + (cogre-insert-forms-menu, cogre-change-forms-menu): New fcn. + (cogre-new-node,cogre-new-link): Only rerender if interactive. + (cogre-move-node): Pulled out guts into a method. + (cogre-move, cogre-move-detla): New Node mehtods. + (cogre-rebuild:cogre-node): Added alignment when rebuilding the rect. + (cogre-string-with-face): Handle an alignment argument. + (cogre-current-element): Make the passed in point optional. + +2001-05-02 Eric M. Ludlam + + * cogre-uml.el: Messed with some link icons. + Added a class slot to the class node. + Added cogre-uml-quick-class, and got most of it working. + +2001-04-25 Eric M. Ludlam + + * cogre-uml.el: Added new default names to nodes. + Initialize a CLASS node by asking for a class, derived from semantic, + from which the the details are created. + Fixed typo for ratio. + Fixed `cogre-read-class-name'. + + * cogre.el: + Added a layout direction to links so they can choose a preferred layout. + Moved cogre-substitute so it wouldn't throw an error. + Always truncate lines in a graph. + Fixed bug when choosing the face of the last slot in a box. + Updated widest-string method to also take slots into account. + Fixed anchor calculation for endpoint down links. + Added mock functions for the layout engine. + +2001-04-24 Eric M. Ludlam + + * cogre-uml.el: *** empty log message *** + +2001-04-23 Eric M. Ludlam + + * cogre.el: + Allow links to contain a start/end which is a child of cogre-node. + Added support for start/end glyps on lines. + Added new fns to handle default node/link insertion. Thus, you will + always insert the same type of node as done previously unless you + explicitly call something to set the defualt node, or use c-u prefix. + +2001-04-18 Eric M. Ludlam + + * cogre.el: Moved many bits to picture-hack.el where appropriate. + Added a preference-ratio and a stop-position to links. + Added a DELETE command to delete items. + Added more *-at-point-interactive functions. + Support links when TABing between items. + Added utils for calculating distances and anchors between nodes. + Fixed up link render to be simpler with the new utils. + + * picture-hack.el: Hacks to override and augment picture.el + +2001-04-14 Eric M. Ludlam + + * cogre.el: *** empty log message *** + diff --git a/site/cedet-1.0pre7/cogre/INSTALL b/site/cedet-1.0pre7/cogre/INSTALL new file mode 100644 index 0000000..96960b9 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/INSTALL @@ -0,0 +1,12 @@ +How to install COGRE + +1) Byte compile COGRE (optional, but recommended) + + Follow the INSTALL file in the top level of this distribution. + +2) Configure + + You can attempt to enable the use of unicode drawing symbols + in COGRE graphs with the following command in your .emacs file. + + (cogre-uml-enable-unicode) \ No newline at end of file diff --git a/site/cedet-1.0pre7/cogre/Makefile b/site/cedet-1.0pre7/cogre/Makefile new file mode 100644 index 0000000..60f1327 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/Makefile @@ -0,0 +1,167 @@ +# Automatically Generated Makefile by EDE. +# For use with: make +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +top= +ede_FILES=Project.ede Makefile + +wy_SEMANTIC_GRAMMAR=wisent-dot.wy +LOADPATH= ../common/ +COGRE_LISP=cogre.el cogre-uml.el cogre-periodic.el cogre-ascii.el cogre-srecode.el cogre-convert.el cogre-layout.el cogre-semantic.el +EMACSFLAGS=-batch --no-site-file +EMACS=emacs +LOADPATH= ../ede/ ../common/ ../semantic/ ../eieio/\ + ../semantic/wisent/ ../srecode/ ../speedbar/ ../semantic/bovine/ +wy_SEMANTIC_GRAMMAR_EL=wisent-dot-wy.el +LOADDEFS=cogre-loaddefs.el +LOADDIRS=. +init_LISP=cogre-load.el +ELISPPRELOAD= cedet-compat +dot_LISP=wisent-dot.el cogre-dot-mode.el +Mode_LISP=cogre-mode.el +info_TEXINFOS=cogre.texi +MAKEINFO=makeinfo +misc_MISC=INSTALL ChangeLog +hacks_LISP=picture-hack.el +utests_LISP=cogre-utest.el +icons_MISC=cogre-class.xpm cogre-hasa.xpm cogre-isa.xpm cogre-package.xpm cogre-node.xpm cogre-instance.xpm cogre-arrow.xpm cogre-link.xpm cogre-note.xpm +VERSION=1.0pre7 +DISTDIR=$(top)COGRE-$(VERSION) + + + +all: wy autoloads init dot Mode cogre.info misc hacks COGRE utests icons Tests templates + +.PHONY: wy +wy: $(wy_SEMANTIC_GRAMMAR) + @echo "(add-to-list 'load-path nil)" > grammar-make-script + @for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> grammar-make-script; \ + done; + @echo "(require 'semantic-load)" >> grammar-make-script + @echo "(require 'semantic-grammar)" >> grammar-make-script + "$(EMACS)" -batch --no-site-file -l grammar-make-script -f semantic-grammar-batch-build-packages $^ + +.PHONY: autoloads +autoloads: + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(require 'cedet-autogen)" >> $@-compile-script + "$(EMACS)" -batch --no-site-file -l $@-compile-script -f cedet-batch-update-autoloads $(LOADDEFS) $(LOADDIRS) + +.PHONY: init +init: $(init_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: dot +dot: $(dot_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: Mode +Mode: $(Mode_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +cogre.info: $(info_TEXINFOS) + $(MAKEINFO) $< + +misc: + @ + +.PHONY: hacks +hacks: $(hacks_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: COGRE +COGRE: $(COGRE_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: utests +utests: $(utests_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +icons: + @ + +.PHONY:Tests +Tests: + $(MAKE) -C tests + +.PHONY:templates +templates: + $(MAKE) -C templates + +tags: + $(MAKE) -C tests/ $(MFLAGS) $@ + $(MAKE) -C templates/ $(MFLAGS) $@ + + +clean: + rm -f *.elc *.html *.info* + +.PHONY: dist + +dist: $(wy_SEMANTIC_GRAMMAR_EL) autoloads cogre.info + mkdir $(DISTDIR) + cp $(wy_SEMANTIC_GRAMMAR) $(wy_SEMANTIC_GRAMMAR_EL) cogre-loaddefs.el $(init_LISP) $(dot_LISP) $(Mode_LISP) $(info_TEXINFOS) cogre.info* $(misc_MISC) $(hacks_LISP) $(COGRE_LISP) $(utests_LISP) $(icons_MISC) $(ede_FILES) $(DISTDIR) + $(MAKE) -C tests $(MFLAGS) DISTDIR=$(DISTDIR)/tests dist + $(MAKE) -C templates $(MFLAGS) DISTDIR=$(DISTDIR)/templates dist + +Makefile: Project.ede + @echo Makefile is out of date! It needs to be regenerated by EDE. + @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. + @false + + + +# End of Makefile diff --git a/site/cedet-1.0pre7/cogre/Project.ede b/site/cedet-1.0pre7/cogre/Project.ede new file mode 100644 index 0000000..8d1b6ce --- /dev/null +++ b/site/cedet-1.0pre7/cogre/Project.ede @@ -0,0 +1,78 @@ +;; Object COGRE +;; EDE project file. +(ede-proj-project "COGRE" + :name "COGRE" + :version "1.0pre7" + :file "Project.ede" + :targets (list + (semantic-ede-proj-target-grammar "wy" + :name "wy" + :path "" + :source '("wisent-dot.wy") + ) + (ede-proj-target-elisp-autoloads "autoloads" + :name "autoloads" + :path "" + :autoload-file "cogre-loaddefs.el" + ) + (ede-proj-target-elisp "init" + :name "init" + :path "" + :source '("cogre-load.el") + :compiler 'ede-emacs-preload-compiler + :pre-load-packages '("cedet-compat") + ) + (ede-proj-target-elisp "dot" + :name "dot" + :path "" + :source '("wisent-dot.el" "cogre-dot-mode.el") + :compiler 'ede-emacs-preload-compiler + :aux-packages '("wisent" "mode-local") + ) + (ede-proj-target-elisp "Mode" + :name "Mode" + :path "" + :source '("cogre-mode.el") + :compiler 'ede-emacs-preload-compiler + ) + (ede-proj-target-makefile-info "info" + :name "info" + :path "" + :source '("cogre.texi") + ) + (ede-proj-target-makefile-miscelaneous "misc" + :name "misc" + :path "" + :source '("INSTALL" "ChangeLog") + ) + (ede-proj-target-elisp "hacks" + :name "hacks" + :path "" + :source '("picture-hack.el") + ) + (ede-proj-target-elisp "COGRE" + :name "COGRE" + :path "" + :source '("cogre.el" "cogre-uml.el" "cogre-periodic.el" "cogre-ascii.el" "cogre-srecode.el" "cogre-convert.el" "cogre-layout.el" "cogre-semantic.el") + :versionsource '("cogre.el") + :compiler 'ede-emacs-preload-compiler + :aux-packages '("eieio" "semantic" "semantic-el" "inversion" "speedbar" "srecode") + ) + (ede-proj-target-elisp "utests" + :name "utests" + :path "" + :source '("cogre-utest.el") + :compiler 'ede-emacs-preload-compiler + ) + (ede-proj-target-makefile-miscelaneous "icons" + :name "icons" + :path "" + :source '("cogre-class.xpm" "cogre-hasa.xpm" "cogre-isa.xpm" "cogre-package.xpm" "cogre-node.xpm" "cogre-instance.xpm" "cogre-arrow.xpm" "cogre-link.xpm" "cogre-note.xpm") + ) + ) + :web-site-url "http://cedet.sourceforge.net/cogre.shtml" + :web-site-directory "/r@scp:shell.sourceforge.net:cedet/htdocs" + :web-site-file "cogre.shtml" + :ftp-upload-site "/ftp@upload.sourceforge.net:/incoming" + :metasubproject 't + ) diff --git a/site/cedet-1.0pre7/cogre/cogre-arrow.xpm b/site/cedet-1.0pre7/cogre/cogre-arrow.xpm new file mode 100644 index 0000000..8f96a88 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-arrow.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_arrow_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" .. ", +" ..... ", +" . . . ", +" . . .. ", +" .. . .. ", +" . . . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-ascii.el b/site/cedet-1.0pre7/cogre/cogre-ascii.el new file mode 100644 index 0000000..819bdb1 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-ascii.el @@ -0,0 +1,171 @@ +;;; cogre-ascii.el --- Export a cogre diagram to ASCII. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-ascii.el,v 1.3 2009/04/11 06:09:43 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Export a cogre diagram into all ASCII art. + +;;; Code: + +;;;###autoload +(defun cogre-export-ascii () + "Export the current diagram into an ASCII buffer." + (interactive) + (when (not (eieio-object-p cogre-graph)) (error "No graph to export")) + + (let* ((g cogre-graph) + (name (oref g name)) + ) + + (switch-to-buffer (get-buffer-create (concat "*ASCII Graph " name "*"))) + (erase-buffer) + (kill-all-local-variables) + + ;; Reset the drawing routines. + (let ((cogre-node-rebuild-method 'cogre-node-rebuild-ascii) + ;; Need this for rendering. + (cogre-graph g) + ) + + ;; Force the redraw + (cogre-render-buffer g t)) + )) + +(defun cogre-horizontal-box-line (width) + "Return a string that can be the top or bottom of a box with a line. +The line will be WIDTH chars long." + (concat "+" + (make-string (- width 2) picture-rectangle-h) + "+")) + +(defun cogre-string-with-edges (str width align) + "Return a string based on STR that is WIDTH chars wide. +The string will be justified based on ALIGN. +The string will have a box chars, such as | on either side." + (when (> (length str) (- width 2)) + ;; If the string is too short, trim it. + (setq str (substring 0 (- width 2)))) + (when (< (length str) (- width 2)) + ;; String is too short + (let ((buff (make-string (- width 2 (length str)) ? ))) + (cond ((eq align 'right) + (setq str (concat buff str))) + (t + (setq str (concat str buff))))) ) + (concat (make-string 1 picture-rectangle-v) + str + (make-string 1 picture-rectangle-v))) + +(defmethod cogre-node-rebuild-ascii ((node cogre-node)) + "Create a new value for `:rectangle' in NODE. +The `:rectangle' slot is inserted with rectangle commands. +A Rectangle is basically a list of equal length strings. +Those strings must have the proper face values on them. +Always make the width 2 greater than the widest string." + (let* ((width (+ (cogre-node-widest-string node) 2)) + (top-lines (oref node blank-lines-top)) + (bottom-lines (oref node blank-lines-bottom)) + (title (cogre-node-title node)) + (slots (cogre-node-slots node)) + (align (oref node alignment)) + (first t) + (rect nil)) + + (setq rect (cons (cogre-horizontal-box-line width) + rect)) + + (while (> top-lines 0) + (setq rect (cons (cogre-string-with-edges "" width align) + rect) + top-lines (1- top-lines))) + + (setq title (nreverse title)) + (while title + (setq rect (cons (cogre-string-with-edges (car title) width align) + rect) + title (cdr title))) + (while slots + (let ((sl (car slots))) + (setq rect (cons (cogre-horizontal-box-line width) + rect)) + + (while sl + (setq rect (cons (cogre-string-with-edges (car sl) width align) + rect) + sl (cdr sl)))) + (setq slots (cdr slots))) + + (while (> bottom-lines 0) + (setq rect (cons (cogre-string-with-edges "" width align) + rect) + bottom-lines (1- bottom-lines))) + + ;; Bottom of the box. + (setq rect (cons (cogre-horizontal-box-line width) + rect)) + + ;; Set the string into our graph node. + (oset node rectangle (nreverse rect)))) + + +(defmethod cogre-node-rebuild-ascii ((node cogre-package)) + "Create the text rectangle for the COGRE package. +Calls the base method, and takes the return argument and +tweaks the faces." + (let* ((rect (call-next-method)) + (first (car rect)) + ) + ;; Tweak the first and second string if it is long enough. + (when (> (length first) 7) + (let* ((backlen (- (length first) 4)) + (newfirst (concat (cogre-horizontal-box-line 5) + (make-string (- backlen 1) ? ))) + (newsecond (concat (make-string 1 picture-rectangle-v) + (make-string 3 ? ) + (cogre-horizontal-box-line backlen)))) + (setcar rect newfirst) + (setcar (cdr rect) newsecond) + )) + ;; Return it. + rect)) + +(defmethod cogre-node-rebuild-ascii ((node cogre-note)) + "Create the text rectangle for the COGRE package. +Calls the base method, and takes the return argument and +tweaks the faces." + (let* ((rect (call-next-method)) + (first (car rect)) + (second (car (cdr rect)))) + ;; Tweak the first and second string iff it is long enough. + (aset first 0 ? ) + (aset first 1 ?,) + (aset first 2 ?+) + (setcar rect first) + (aset second 0 ?+) + (aset second 1 ?-) + (aset second 2 ?+) + (setcar (cdr rect) second) + ;; Return it. + rect)) + +(provide 'cogre-ascii) +;;; cogre-ascii.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-class.xpm b/site/cedet-1.0pre7/cogre/cogre-class.xpm new file mode 100644 index 0000000..4d055ec --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-class.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_class_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ...................... ", +" . . ", +" . .. . ", +" . . . . . . ", +" ... . . . .. .. . ", +" .. . .. . . . ", +" ... . . . .. .. . ", +" . . . . ... ... . . . ", +" . .. . . . . ", +" . . ", +" . . ", +" ...................... ", +" . . ", +" . . ", +" . . ", +" . . ", +" ...................... ", +" . . ", +" . . ", +" . . ", +" . . ", +" ...................... ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-convert.el b/site/cedet-1.0pre7/cogre/cogre-convert.el new file mode 100644 index 0000000..515aaca --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-convert.el @@ -0,0 +1,387 @@ +;;; cogre-convert.el --- Conversion for cogre charts into other formats +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-convert.el,v 1.12 2009/04/11 06:18:11 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Conversions for COGRE charts. +;; +;; A cogre chart is a collection of nodes and lines. Some charts, +;; such as UML class diagrams, actually represent other kinds of structure. +;; +;; The COGRE-CONVERT utilities is a framework for transforming a graph +;; into some other LISP structure. Some conversions, such as to ASCII +;; override drawing code. Conversions transform the data instead. +;; +;; @TODO - re-write below as things are implemented +;; Ideas for conversions: +;; graph -> semantic tags +;; graph -> dot tags +;; graph -> xml for dia, or other case tool +;; +;; Ideas for reverse conversion? +;; semantic tags -> graph +;; xml fir dia -> graph +;; parsed dot file -> graph +;; +;; +;; Implementation strategy +;; My thoughts on getting to the above. +;; 1) Write a straight-up converter to dot. +;; 2) Guess what an abstract converter looks like based on dot +;; 3) Promote the generic API, and write semantic-tag converter. + +(require 'cogre-srecode) +(require 'cedet-graphviz) +(eval-when-compile (require 'ps-print)) +;;; Code: +(defvar cogre-export-max-y nil + "Max y value in the current chart.") + +;;;###autoload +(defun cogre-export-dot () + "Export the current COGRE graph to DOT notation. +DOT is a part of GraphViz." + (interactive) + (when (not (eieio-object-p cogre-graph)) (error "No graph to export")) + + (let* ((g cogre-graph) + (name (oref g name)) + (fname (concat name ".dot")) + (ede-auto-add-method 'never) + ) + ;; Load in the file + (switch-to-buffer (find-file fname)) + (erase-buffer) + + ;; Get a parsing mode running here. + (cogre-dot-mode) + + ;; Convert G into this buffer. + (let* ((graphtag (cogre-export-dot-method g)) + (members (semantic-tag-get-attribute graphtag :members)) + (cogre-srecode-current-graph g) + ) + ;; Load our tables. + (cogre-srecode-load-tables) + + ;; Start it out. + (srecode-insert "file:cogre") + + ;; Insert all the tags. + (srecode-semantic-insert-tag graphtag) + + (dolist (M members) + (srecode-semantic-insert-tag M)) + + (save-buffer) + (message "Converted graph into %d dot nodes." + (length (semantic-tag-get-attribute graphtag :members))) + ))) + +;;;###autoload +(defun cogre-export-dot-png () + "Export the current COGRE graph to DOT, then convert that to PNG. +The png file is then displayed in an Emacs buffer. +DOT is a part of GraphVis." + (interactive) + ;; Make sure things are installed ok. + (cedet-graphviz-dot-version-check) + ;; Run dot to create the file. The graph was already + ;; verified. + (let* ((def (file-name-nondirectory (concat (oref cogre-graph :name) + ".png"))) + (fname (read-file-name "Write to: " + default-directory nil nil def)) + (keeplayout (y-or-n-p "Keep current Layout? ")) + ) + ;; Convert to dot + (save-window-excursion + (cogre-export-dot) + ;; Convert from dot to png + (if keeplayout + (cedet-graphviz-translate-file (current-buffer) + (expand-file-name fname) + "png" + "-n") + (cedet-graphviz-translate-file (current-buffer) + (expand-file-name fname) + "png"))) + + (let ((ede-auto-add-method 'never)) + (find-file fname)) + )) + +;;;###autoload +(defun cogre-export-dot-postscript-print () + "Print the current graph. +This is done by exporting the current COGRE graph to DOT, then +convert that to Postscript before printing. +DOT is a part of GraphVis." + (interactive) + ;; Make sure things are installed ok. + (cedet-graphviz-dot-version-check) + ;; Run dot to create the file. The graph was already + ;; verified. + (let ((keeplayout (y-or-n-p "Keep current Layout? "))) + + ;; Convert to dot + (cogre-export-dot) + + ;; Convert from dot to postscript + (save-excursion + (set-buffer + (if keeplayout + (cedet-graphviz-translate-file (current-buffer) + nil + "ps" + "-n") + (cedet-graphviz-translate-file (current-buffer) + nil + "ps"))) + + (require 'ps-print) + (let ((ps-spool-buffer (current-buffer))) + (ps-do-despool nil)) + ))) + +;;;###autoload +(defmethod cogre-export-dot-method ((g cogre-base-graph)) + "Convert G into DOT syntax of semantic tags." + (save-excursion + (set-buffer (oref g buffer)) + (let ((cogre-export-max-y (count-lines (point-min) (point-max)))) + (semantic-tag (oref g :name) + 'digraph + :members + (cogre-map-elements 'cogre-export-dot-method g) + ) + ))) + +(defun cogre-tag-put-dot-attribute (tag attribute value) + "Get the attributes in TAG, and set ATTRIBUTE to VALUE. +This works similarly to `semantic-tag-put-attribute'." + (let* ((lst (semantic-tag-get-attribute tag :attributes)) + (atag (semantic-find-first-tag-by-name attribute lst))) + (cond + ;; If there is one, just change the value. + (atag + (semantic-tag-put-attribute atag :value value)) + ;; No list at all. Make one. + ((null lst) + (semantic-tag-put-attribute + tag :attributes + (list (semantic-tag attribute 'attribute :value value)))) + ;; Add to the existing list. + (t + (add-to-list 'lst + (semantic-tag attribute 'attribute :value value) + t))) + tag)) + +;;; NODES +(defmethod cogre-export-dot-method ((node cogre-node)) + "Convert NODE into DOT syntax of semantic tags." + (semantic-tag + (oref node :object-name) + 'node + :attributes + (list + (semantic-tag "shape" 'attribute :value (cogre-export-dot-shape node)) + (semantic-tag "label" 'attribute :value (cogre-export-dot-label node)) + ;; Position in points. + (semantic-tag "pos" 'attriute :value (cogre-export-dot-pos node)) + ) + ) + ) + +(defcustom cogre-dot-node-position-scale (cons 6 12) + "The scale to use when converting between COGRE and DOT position values. +This is of the format ( XSCALE . YSCALE ). +DOT uses points, where as COGRE uses characters." + :group 'cogre + :type 'cons) + +(defmethod cogre-export-dot-pos ((node cogre-node)) + "Return a DOT compatible position." + (let* ((pos (oref node position)) + (scalex (car cogre-dot-node-position-scale)) + (scaley (cdr cogre-dot-node-position-scale))) + (format "%d,%d" (* scalex (aref pos 0)) + ;; Dot does stuff upside-down, so we need to invert Y + (* scaley (- cogre-export-max-y (aref pos 1)))))) + +(defmethod cogre-export-dot-shape ((node cogre-node)) + "Convert NODE into DOT syntax of semantic tags." + "box") + +(defmethod cogre-export-dot-shape ((node cogre-class)) + "Convert NODE into DOT syntax of semantic tags." + "record") + +(defmethod cogre-export-dot-shape ((node cogre-package)) + "Convert NODE into DOT syntax of semantic tags." + "tab") + +(defmethod cogre-export-dot-shape ((node cogre-note)) + "Convert NODE into DOT syntax of semantic tags." + "note") + +(defmethod cogre-export-dot-label ((node cogre-node)) + "Convert NODE into DOT syntax of semantic tags." + (mapconcat 'identity (cogre-node-title node) "\\n")) + +(defmethod cogre-export-dot-label ((node cogre-scoped-node)) + "Convert NODE into DOT syntax of semantic tags." + (let ((name (oref node :object-name)) + (pack (oref node :package-name))) + (if (<= (length pack) 0) + name + (setq pack (concat "\\<\\<" pack "\\>\\>")) + (concat pack "\\n" name)))) + +(defmethod cogre-export-dot-label ((node cogre-class)) + "Convert NODE into DOT syntax of semantic tags." + (concat "{" (call-next-method) "|" + (cogre-export-dot-fieldslist node) "|" + (cogre-export-dot-methodlist node) "}")) + +(defmethod cogre-export-dot-methodlist ((node cogre-class)) + "Get a list of methods on NODE. Return as \n separated list." + (mapconcat (lambda (s) (cogre-uml-stoken->uml node s)) (oref node methods) "\\n")) + +(defmethod cogre-export-dot-fieldslist ((node cogre-class)) + "Get a list of fields on NODE. Return as \n separated list." + (mapconcat (lambda (s) (cogre-uml-stoken->uml node s)) (oref node attributes) "\\n")) + +(defmethod cogre-export-dot-label ((node cogre-instance)) + "Convert NODE into DOT syntax of semantic tags." + (let ((title (call-next-method))) + (if (string-match "\\\\n" title) + (replace-match "n:" t t title) + (concat ":" title)))) + +;;; LINKS +(defmethod cogre-export-dot-method ((link cogre-link)) + "Convert LINK into DOT syntax of semantic tags." + (let ((start (oref link start)) + (end (oref link end))) + (semantic-tag (oref end :object-name) + 'link + :to (oref start :object-name) + :attributes + ( list + (semantic-tag "arrowhead" 'attribute :value "none") + (semantic-tag "arrowtail" 'attribute :value "none") + ) + ))) + +(defmethod cogre-export-dot-method ((link cogre-inherit)) + "Convert LINK into DOT syntax of semantic tags." + (let ((tag (call-next-method)) + (end (oref link end))) + (cogre-tag-put-dot-attribute tag "arrowtail" "empty") + (cogre-tag-put-dot-attribute tag "arrowsize" "2") + ;(cogre-tag-put-dot-attribute tag :sametail (oref end :object-name)) + tag)) + +(defmethod cogre-export-dot-method ((link cogre-aggregate)) + "Convert LINK into DOT syntax of semantic tags." + (let ((tag (call-next-method))) + (cogre-tag-put-dot-attribute tag "arrowhead" "diamond") + tag)) + +(defmethod cogre-export-dot-method ((link cogre-arrow)) + "Convert LINK into DOT syntax of semantic tags." + (let ((tag (call-next-method))) + (cogre-tag-put-dot-attribute tag "arrowhead" "open") + tag)) + +;;; TESTS +;; +(eval-when-compile (require 'cogre-periodic)) + +;;;###autoload +(defun cogre-export-utest () + "Run all the COGRE structured export/convert test." + (interactive) + (cogre-export-dot-utest) + ;;(cogre-export-typed-lang-utest) + ) + +(defun cogre-export-dot-utest () + "Run the COGRE structured dot output converter test. +Basic DOT doesn't require much, so we'll use the periodic +table as an example." + (interactive) + + ;; Step one, create the graph. + (if (get-buffer "*Graph Periodic*") + (switch-to-buffer "*Graph Periodic*") + (cogre-periodic)) + ;; Step 2, convert. + (message "Converting graph %s to DOT structure." (oref cogre-graph name)) + (let* ((graphtag (cogre-export-dot-method cogre-graph)) + (members (semantic-tag-get-attribute graphtag :members)) + ) + + (when (not graphtag) + (error "Conversions failed to make anything")) + + (when (not (string= (semantic-tag-name graphtag) "Periodic")) + (error "Converted graph has wrong name: %S" (semantic-tag-name graphtag))) + (when (not (semantic-tag-of-class-p graphtag 'digraph)) + (error "Converted graph is not a digraph")) + + (let ((N cogre-periodic-node-name-list) + (L cogre-periodic-link-connectivity-list) + ) + (while members + + (let* ((M (car members)) + (n (semantic-tag-name M))) + + (cond ((semantic-tag-of-class-p M 'node) + (if (string= n (car (car N))) + (setq N (cdr N)) + (error "Unexpected node %S in conversion" n)) + ) + ((semantic-tag-of-class-p M 'link) + ;; Links go backward from COGRE to dot. + (if (string= (semantic-tag-get-attribute M :to) + (car (car L))) + (setq L (cdr L)) + (message "Expected link %S to %S" + (car (car L)) (car (cdr (car L)))) + (error "Unexpected link from %S to %S in conversion" + n (semantic-tag-get-attribute M :to))) + ) + (t + (error "Unknown dot tag %S" M))) + + ) + (setq members (cdr members))) + ) + + (message "Graph Conversion to DOT success."))) + +(provide 'cogre-convert) +;;; cogre-convert.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-dot-mode.el b/site/cedet-1.0pre7/cogre/cogre-dot-mode.el new file mode 100644 index 0000000..f43f3ba --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-dot-mode.el @@ -0,0 +1,114 @@ +;;; cogre-dot-mode.el --- Mini-mode for Graphviz DOT files. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-dot-mode.el,v 1.1 2009/04/07 00:34:01 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; A mini-mode for Graphviz DOT files. +;; +;; If graphviz-dot-mode.el by Pieter Pareit is available, use that, +;; otherwise supply the minimum features needed to parse dot files. + +(require 'mode-local) +;;; Code: + +;;; Syntax table +(defcustom cogre-dot-mode-hook nil + "Hook called when cogre-dot mode starts. +This hook is not called if graphviz-dot-mode is used +instead." + :group 'cogre + :type 'hook) + +(defvar cogre-dot-mode-syntax-table + (let ((st (make-syntax-table))) + (modify-syntax-entry ?/ ". 124b" st) + (modify-syntax-entry ?* ". 23" st) + (modify-syntax-entry ?\n "> b" st) + (modify-syntax-entry ?= "." st) + (modify-syntax-entry ?_ "_" st) + (modify-syntax-entry ?- "_" st) + (modify-syntax-entry ?> "." st) + (modify-syntax-entry ?< "." st) + (modify-syntax-entry ?[ "(" st) + (modify-syntax-entry ?] ")" st) + (modify-syntax-entry ?\" "\"" st) + (setq graphviz-dot-mode-syntax-table st) + ) + "Syntax table for `cogre-dot-mode'.") + +(defvar cogre-dot-font-lock-keywords + `(("\\(:?di\\|sub\\)?graph \\(\\sw+\\)" + (2 font-lock-function-name-face)) + ) + "Font lock keywords for the cogre dot mini-mode.") + +;;;###autoload +(defun cogre-dot-mode () + "Major mode for the dot language. +This is a mini-mode that will first attempt to load and install +`graphviz-dot-mode' in this buffer. If that fails, it installs +the syntax table, and runs a hook needed to get Semantic working +as a parsing engine." + (interactive) + + ;; Force graphviz mode to be loaded. If it fails, then continue + ;; to install the cogre version. + (condition-case nil + (progn + ;; Uncomment this to force cogre-dot-mode to go active. + ;;(error "TEST MINI MODE") + + ;; graphviz-dot-mode doesn't have a provide statement + (when (not (fboundp 'graphviz-dot-mode)) + (load-library "graphviz-dot-mode")) + (inversion-test 'graphviz-dot-mode "0.3.2") + (graphviz-dot-mode)) + (error + ;; We found an error. Do the setup needed to produce + ;; a mini-mode here. + + (kill-all-local-variables) + (setq major-mode 'cogre-dot-mode) + (setq mode-name "C-dot") + (set-syntax-table cogre-dot-mode-syntax-table) + (set (make-local-variable 'comment-start) "//") + (set (make-local-variable 'comment-start-skip) "/\\*+ *\\|//+ *") + (set (make-local-variable 'font-lock-defaults) + '(cogre-dot-font-lock-keywords)) + (run-hooks 'cogre-dot-mode-hook) + ))) +;; +;; This major-mode change doesn't conflict with graphviz, since +;; this major mode will start the graphviz one if it can be found. +;; + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.dot\\'" . cogre-dot-mode)) + +;; +;; This isn't really true, but if we use the mini-mode, +;; this allows SRecode to find the graphviz templates. +;; +(set-mode-local-parent 'cogre-dot-mode 'graphviz-dot-mode) + +(provide 'cogre-dot-mode) +;;; cogre-dot-mode.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-hasa.xpm b/site/cedet-1.0pre7/cogre/cogre-hasa.xpm new file mode 100644 index 0000000..ebb5f2e --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-hasa.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_hasa_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" . ", +" ... ", +" ..... ", +" ....... ", +" ......... ", +" ........ ", +" ...... ", +" .... ", +" .. ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-instance.xpm b/site/cedet-1.0pre7/cogre/cogre-instance.xpm new file mode 100644 index 0000000..167bd27 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-instance.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_instance_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ...................... ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . ", +" . . . ", +" . . . . ", +" . .. . . .. ...... . ", +" . .. . .... . . . ", +" . . . . ... . . ", +" . .. . . . .. . . ", +" . .. . . . ... . . ", +" . . ", +" . ................ . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" ...................... ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-isa.xpm b/site/cedet-1.0pre7/cogre/cogre-isa.xpm new file mode 100644 index 0000000..d6c21d1 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-isa.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * inherit_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" .. ", +" .. .. ", +" . . ", +" . .. ", +" .. .. ", +" . . ", +" . .. ", +" ............... ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-layout.el b/site/cedet-1.0pre7/cogre/cogre-layout.el new file mode 100644 index 0000000..e678137 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-layout.el @@ -0,0 +1,113 @@ +;;; cogre-layout.el --- Execute a layout engine on a cogre graph. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-layout.el,v 1.3 2009/04/07 00:36:44 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Reposition nodes in a graph using a layout engine. +;; +;; Calls out to graphviz for node position information. + +(require 'cogre-convert) + +;;; Code: +;;;###autoload +(defun cogre-layout () + "Layout the current graph. +This function depends on graphviz `dot' program." + (interactive) + (let ((tags nil) + (elts nil) + (maxy nil) + (scalex (car cogre-dot-node-position-scale)) + (scaley (cdr cogre-dot-node-position-scale)) + ) + (save-window-excursion + (save-excursion + ;; Convert to DOT. + (cogre-export-dot) + ;; Pump it through DOT, extract the output. + (set-buffer + (cedet-graphviz-dot-call (list (buffer-file-name)))) + ;; Put the output into dot-mode + (cogre-dot-mode) + ;; For some reason, the above mode change doesn't trigger + ;; the semantic new buffer function. Do it here. + (semantic-new-buffer-fcn) + ;; Fetch teh tags. + (setq tags (semantic-fetch-tags)) + ;; Now that we have the tags, switch back to our original + ;; graph, and try to apply the positional information. + )) + ;; Get stuff in the graph. + (setq elts (semantic-tag-get-attribute (car tags) :members)) + + ;; Get the graph max size so we can invert Y + (let* ((graphgeneric (semantic-find-first-tag-by-name "GRAPH" elts)) + (graphsize (semantic-find-first-tag-by-name + "bb" (semantic-tag-get-attribute graphgeneric + :attributes))) + (size (semantic-tag-get-attribute graphsize :value)) + (ss (split-string size "," t))) + (setq maxy (string-to-number (nth 3 ss)))) + + ;; Loop over the tags. + (dolist (E elts) + (when (semantic-tag-of-class-p E 'node) + (let* ((name (semantic-tag-name E)) + (pos (semantic-find-first-tag-by-name + "pos" (semantic-tag-get-attribute E :attributes))) + (ss (split-string (semantic-tag-get-attribute pos :value) + "," t)) + (X (string-to-number (car ss))) + (Y (string-to-number (car (cdr ss)))) + (height (semantic-tag-get-attribute + (semantic-find-first-tag-by-name + "height" (semantic-tag-get-attribute E :attributes)) + :value)) + (width (semantic-tag-get-attribute + (semantic-find-first-tag-by-name + "width" (semantic-tag-get-attribute E :attributes)) + :value)) + ;; dot reports width/height as inches, and the position + ;; as points, which is 72 points/inch. + (HH (* (/ (string-to-number height) 2) 72)) + (HW (* (/ (string-to-number width) 2) 72)) + ;; The node we want to modify + (cogrenode (cogre-find-node-by-name name)) + ) + ;; For this node at this position, move the COGRE graph node. + (if cogrenode + (progn + (message "Found new pos %d,%d for matching node %s" + X Y name) + (oset cogrenode :position + (vector (max 0 (floor (/ (- X HH) scalex))) + (max 0 (floor (/ (- maxy Y HH) scaley)))))) + ;; No match? + (message "Could not find node for element %S" E) + )))) + ;; Refresh the graph. + (cogre-refresh) + )) + +(provide 'cogre-layout) +;;; cogre-layout.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-link.xpm b/site/cedet-1.0pre7/cogre/cogre-link.xpm new file mode 100644 index 0000000..3cd1e4e --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-link.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_link_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" ..... ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" ", +" ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-load.el b/site/cedet-1.0pre7/cogre/cogre-load.el new file mode 100644 index 0000000..8f05357 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-load.el @@ -0,0 +1,36 @@ +;;; cogre-load.el --- Autoload definitions for COGRE + +;;; Copyright (C) 2003 David Ponce + +;; Author: David Ponce +;; X-RCS: $Id: cogre-load.el,v 1.2 2005/09/30 20:06:52 zappo Exp $ + +;; COGRE is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Initialize COGRE for all supported conditions. + +;;; Code: +;; + +;;; COGRE autoloads +;; +(load "cogre-loaddefs" nil t) + +(provide 'cogre-load) + +;;; cogre-load.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-loaddefs.el b/site/cedet-1.0pre7/cogre/cogre-loaddefs.el new file mode 100644 index 0000000..62f22c7 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-loaddefs.el @@ -0,0 +1,282 @@ +;;; cogre-loaddefs.el --- Auto-generated CEDET autoloads +;; +;;; Code: + + +;;;### (autoloads (cogre) "cogre" "cogre.el" (18977 14170)) +;;; Generated autoloads from cogre.el + +(eieio-defclass-autoload 'cogre-base-graph '(eieio-persistent) "cogre" "A Connected Graph.\na connected graph contains a series of nodes and links which are\nrendered in a buffer, or serialized to disk.") + +(eieio-defclass-autoload 'cogre-graph-element '(eieio-named) "cogre" "A Graph Element.\nGraph elements are anything that is drawn into a `cogre-base-graph'.\nGraph elements have a method for marking themselves dirty.") + +(eieio-defclass-autoload 'cogre-node '(cogre-graph-element) "cogre" "Connected Graph node.\nNodes are regions with a fill color, and some amount of text representing\na status, or values.") + +(eieio-defclass-autoload 'cogre-link '(cogre-graph-element) "cogre" "Connected Graph link.\nLinks are lines drawn between two nodes, or possibly loose in space\nas an intermediate step. Some links have text describing what they\ndo, and most links have special markers on one end or another, such as\narrows or circles.") + +(eieio-defclass-autoload 'cogre-arrow '(cogre-link) "cogre" "This type of link is a simple arrow.") + +(autoload 'cogre "cogre" "\ +Create a new graph not associated with a buffer. +The new graph will be given NAME. See `cogre-mode' for details. +Optional argument GRAPH-CLASS indicates the type of graph to create. + +\(fn NAME &optional GRAPH-CLASS)" t nil) + +;;;*** + +;;;### (autoloads (cogre-export-ascii) "cogre-ascii" "cogre-ascii.el" +;;;;;; (18912 13351)) +;;; Generated autoloads from cogre-ascii.el + +(autoload 'cogre-export-ascii "cogre-ascii" "\ +Export the current diagram into an ASCII buffer. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cogre-export-utest cogre-export-dot-method cogre-export-dot-postscript-print +;;;;;; cogre-export-dot-png cogre-export-dot) "cogre-convert" "cogre-convert.el" +;;;;;; (18912 13859)) +;;; Generated autoloads from cogre-convert.el + +(autoload 'cogre-export-dot "cogre-convert" "\ +Export the current COGRE graph to DOT notation. +DOT is a part of GraphViz. + +\(fn)" t nil) + +(autoload 'cogre-export-dot-png "cogre-convert" "\ +Export the current COGRE graph to DOT, then convert that to PNG. +The png file is then displayed in an Emacs buffer. +DOT is a part of GraphVis. + +\(fn)" t nil) + +(autoload 'cogre-export-dot-postscript-print "cogre-convert" "\ +Print the current graph. +This is done by exporting the current COGRE graph to DOT, then +convert that to Postscript before printing. +DOT is a part of GraphVis. + +\(fn)" t nil) + +(autoload 'cogre-export-dot-method "cogre-convert" "\ +Convert G into DOT syntax of semantic tags. + +\(fn (G cogre-base-graph))" nil nil) + +(autoload 'cogre-export-utest "cogre-convert" "\ +Run all the COGRE structured export/convert test. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cogre-dot-mode) "cogre-dot-mode" "cogre-dot-mode.el" +;;;;;; (18906 40825)) +;;; Generated autoloads from cogre-dot-mode.el + +(autoload 'cogre-dot-mode "cogre-dot-mode" "\ +Major mode for the dot language. +This is a mini-mode that will first attempt to load and install +`graphviz-dot-mode' in this buffer. If that fails, it installs +the syntax table, and runs a hook needed to get Semantic working +as a parsing engine. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.dot\\'" . cogre-dot-mode)) + +;;;*** + +;;;### (autoloads (cogre-layout) "cogre-layout" "cogre-layout.el" +;;;;;; (18906 40988)) +;;; Generated autoloads from cogre-layout.el + +(autoload 'cogre-layout "cogre-layout" "\ +Layout the current graph. +This function depends on graphviz `dot' program. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cogre-mode) "cogre-mode" "cogre-mode.el" (18977 +;;;;;; 14210)) +;;; Generated autoloads from cogre-mode.el + +(autoload 'cogre-mode "cogre-mode" "\ +Connected Graph Editor Mode. +\\{cogre-mode-map} + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist (cons "\\.cgr\\'" 'cogre-mode)) + +;;;*** + +;;;### (autoloads (cogre-periodic-utest cogre-periodic) "cogre-periodic" +;;;;;; "cogre-periodic.el" (18906 45093)) +;;; Generated autoloads from cogre-periodic.el + +(autoload 'cogre-periodic "cogre-periodic" "\ +Create a periodic table of COGRE objects. + +\(fn)" t nil) + +(autoload 'cogre-periodic-utest "cogre-periodic" "\ +Run the cogre periodic table for unit testing. +Also test various output mechanisms from the periodic table. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cogre-uml-quick-class cogre-export-code cogre-semantic-tag-to-node) +;;;;;; "cogre-semantic" "cogre-semantic.el" (18927 57417)) +;;; Generated autoloads from cogre-semantic.el + +(autoload 'cogre-semantic-tag-to-node "cogre-semantic" "\ +Convert the Semantic tag TAG into a COGRE node. +Only handles data types nodes. +To convert function/variables into methods or attributes in +an existing COGRE node, see @TODO - do that. + +\(fn TAG)" nil nil) + +(autoload 'cogre-export-code "cogre-semantic" "\ +Export the current graph into source-code in FILE. +Uses `cogre-export-semantic' to convert into Semantic tags. +Uses `cogre-srecode-setup' to setup SRecode for code generation. + +\(fn FILE)" t nil) + +(autoload 'cogre-uml-quick-class "cogre-semantic" "\ +Create a new UML diagram based on CLASS showing only immediate lineage. +The parent to CLASS, CLASS, and all of CLASSes children will be shown. + +\(fn CLASS)" t nil) + +;;;*** + +;;;### (autoloads (srecode-semantic-handle-:dot srecode-semantic-handle-:cogre +;;;;;; cogre-srecode-setup) "cogre-srecode" "cogre-srecode.el" (18905 +;;;;;; 26818)) +;;; Generated autoloads from cogre-srecode.el + +(autoload 'cogre-srecode-setup "cogre-srecode" "\ +Update various paths to get SRecode to identify COGRE macros. + +\(fn)" nil nil) + +(autoload 'srecode-semantic-handle-:cogre "cogre-srecode" "\ +Add macros to dictionary DICT based on COGRE data. + +\(fn DICT)" nil nil) + +(eval-after-load "srecode-map" (cogre-srecode-setup)) + +(autoload 'srecode-semantic-handle-:dot "cogre-srecode" "\ +Add macros to dictionary DICT based on the current DOT buffer. + +\(fn DICT)" nil nil) + +;;;*** + +;;;### (autoloads (cogre-uml-sort-for-lineage cogre-uml-enable-unicode) +;;;;;; "cogre-uml" "cogre-uml.el" (18927 57347)) +;;; Generated autoloads from cogre-uml.el + +(eieio-defclass-autoload 'cogre-package '(cogre-node) "cogre-uml" "A Package node.\nPackages represent other class diagrams, and list the major nodes\nwithin them. They can be linked by dependency links.") + +(eieio-defclass-autoload 'cogre-note '(cogre-node) "cogre-uml" "An note node.\nNotes are used to add annotations inside a graph.\nNotes are generally linked to some node, and are supposed to look\nlike a little pieces of paper.") + +(eieio-defclass-autoload 'cogre-scoped-node '(cogre-node) "cogre-uml" "A UML node that has a package specifier within which it is scoped.") + +(eieio-defclass-autoload 'cogre-class '(cogre-scoped-node) "cogre-uml" "A Class node.\nClass nodes represent a class, and can list the attributes and methods\nwithin them. Classes can have attribute links, and class hierarchy links.") + +(eieio-defclass-autoload 'cogre-instance '(cogre-scoped-node) "cogre-uml" "An instance node.\nInstances are used in instance diagrams.\nInstances are linked together with plain links.") + +(eieio-defclass-autoload 'cogre-inherit '(cogre-link) "cogre-uml" "This type of link indicates that the two nodes reference infer inheritance.\nThe `start' node is the child, and the `end' node is the parent.\nThis is supposed to infer that START inherits from END.") + +(eieio-defclass-autoload 'cogre-aggregate '(cogre-link) "cogre-uml" "This type of link indicates aggregation.\nThe `start' node is the owner of the aggregation, the `end' node is\nthe item being aggregated.\nThis is supposed to infer that START contains END.") + +(autoload 'cogre-uml-enable-unicode "cogre-uml" "\ +Enable use of UNICODE symbols to create COGRE graphs. +Inheritance uses math triangle on page 25a0. +Aggregation uses math square on edge 25a0. +Line-drawing uses line-drawing codes on page 2500. +See http://unicode.org/charts/symbols.html. + +The unicode symbols can be differing widths. This will make the +cogre chart a little screwy somteims. Your mileage may vary. + +\(fn)" t nil) + +(autoload 'cogre-uml-sort-for-lineage "cogre-uml" "\ +Sort the current graph G for determining inheritance lineage. +Return it as a list of lists. Each entry is of the form: + ( NODE PARENT1 PARENT2 ... PARENTN) + +\(fn G)" t nil) + +;;;*** + +;;;### (autoloads (cogre-utest-quick-class cogre-utest) "cogre-utest" +;;;;;; "cogre-utest.el" (18912 16027)) +;;; Generated autoloads from cogre-utest.el + +(autoload 'cogre-utest "cogre-utest" "\ +Unit test Various aspects of COGRE. + +\(fn)" t nil) + +(autoload 'cogre-utest-quick-class "cogre-utest" "\ +Test the quick-class function. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cogre-picture-insert-rectangle) "picture-hack" +;;;;;; "picture-hack.el" (18897 57890)) +;;; Generated autoloads from picture-hack.el + +(autoload 'cogre-picture-insert-rectangle "picture-hack" "\ +Overlay RECTANGLE with upper left corner at point. +Leaves the region surrounding the rectangle. + +\(fn RECTANGLE)" nil nil) + +;;;*** + +;;;### (autoloads (wisent-dot-setup-parser) "wisent-dot" "wisent-dot.el" +;;;;;; (18906 40873)) +;;; Generated autoloads from wisent-dot.el + +(autoload 'wisent-dot-setup-parser "wisent-dot" "\ +Setup buffer for parse. + +\(fn)" nil nil) + +(add-hook 'graphviz-dot-mode-hook 'wisent-dot-setup-parser) + +(add-hook 'cogre-dot-mode-hook 'wisent-dot-setup-parser) + +;;;*** + +;;;### (autoloads nil nil ("cogre-load.el" "wisent-dot-wy.el") (19335 +;;;;;; 11025 916782)) + +;;;*** + +(provide 'cogre-loaddefs) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; cogre-loaddefs.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-mode.el b/site/cedet-1.0pre7/cogre/cogre-mode.el new file mode 100644 index 0000000..02bdc77 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-mode.el @@ -0,0 +1,874 @@ +;;; cogre-mode.el --- Graph editing mode + +;;; Copyright (C) 2001, 2002, 2003, 2007, 2009 Eric M. Ludlam + +;; This file is not part of GNU Emacs. + +;; This is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; COGRE mode is based on a generic editor that can render arbitrary +;; graphs as specified by the COGRE core classes. +;; This depends on EIEIO for graph management. COGRE mode depends on +;; `picture-mode' for drawing. +;; +;; Because COGRE graphs are meant to be edited in some fashion, COGRE +;; graphs depend on the custom widget library to provide text +;; controls, or toggle buttons for editing state in a graph. + +(require 'picture-hack) +(require 'eieio) +(require 'eieio-opt) +(require 'eieio-base) +(require 'cogre) + +;;; Code: +(defface cogre-box-face '((((class color) (background dark)) + (:background "gray30" :foreground "white")) + (((class color) (background light)) + (:background "gray" :foreground "black"))) + "Face used for rectangles of boxes displaying data." + :group 'cogre) + +(defface cogre-box-first-face '((((class color) (background dark)) + (:background "gray30" :foreground "white" :overline "white")) + (((class color) (background light)) + (:background "gray" :foreground "black" :overline "black"))) + "Face used for the first data item in rectangles of boxes displaying data. +This has the `overline' property set to display borders between sections +within a box." + :group 'cogre) + +(defface cogre-box-last-face '((((class color) (background dark)) + (:background "gray30" :foreground "white" :underline "white")) + (((class color) (background light)) + (:background "gray" :foreground "black" :underline "black"))) + "Face used for the first data item in rectangles of boxes displaying data. +This has the `overline' property set to display borders between sections +within a box." + :group 'cogre) + +(defun cogre-substitute (km oldfun newfun) + "Substitue in KM, a key binding in ghe `cogre-mode-map'. +Argument OLDFUN is removed NEWFUN is substituted in." + (substitute-key-definition oldfun newfun km global-map)) + +(defvar cogre-mode-map + (let ((km (make-keymap))) + (suppress-keymap km) + ;; Structure Information + (define-key km "\C-m" 'cogre-activate-element) + ;; Structure changes + (define-key km "R" 'cogre-refresh) + (define-key km "N" 'cogre-new-node) + (define-key km "L" 'cogre-new-link) + (define-key km "D" 'cogre-delete) + (define-key km "U" 'cogre-update-node-from-source) + ;; Changing and Setting Defaults + (define-key km "\C-c\C-n" 'cogre-default-node) + (define-key km "\C-c\C-l" 'cogre-default-link) + ;; Kill/Yank operations + (define-key km "\C-k" 'cogre-kill-element) + (define-key km "\C-w" 'cogre-kill-element) + (define-key km "\M-w" 'cogre-copy-element) + (define-key km "\C-y" 'cogre-yank-element) + ;; Modifications + (define-key km "n" 'cogre-set-element-name) + ;; Move nodes around + (define-key km [(meta left)] 'cogre-move-node-left) + (define-key km [(meta right)] 'cogre-move-node-right) + (define-key km [(meta down)] 'cogre-move-node-down) + (define-key km [(meta up)] 'cogre-move-node-up) + (define-key km "\M-b" 'cogre-move-node-left) + (define-key km "\M-f" 'cogre-move-node-right) + (define-key km "\M-n" 'cogre-move-node-down) + (define-key km "\M-p" 'cogre-move-node-up) + ;; Cursor Movement + (define-key km "\C-i" 'cogre-next-node) + (define-key km "\M-\C-i" 'cogre-prev-node) + (cogre-substitute km 'forward-char 'picture-forward-column) + (cogre-substitute km 'backward-char 'picture-backward-column) + (cogre-substitute km 'next-line 'picture-move-down) + (cogre-substitute km 'previous-line 'picture-move-up) + ;; Mouse Manipulations + (define-key km [down-mouse-1] 'cogre-down-mouse-1) + (define-key km [drag-mouse-1] 'ignore) + (define-key km [down-mouse-2] 'cogre-down-mouse-2) + (define-key km [drag-mouse-2] 'ignore) + (define-key km [down-mouse-3] 'cogre-down-mouse-3) + (define-key km [drag-mouse-3] 'ignore) + km) + "Keymap used for COGRE mode.") + +(easy-menu-define + cogre-mode-menu cogre-mode-map "Connected Graph Menu" + '("Graph" + ["Refresh" cogre-refresh t ] + ["Layout (dot)" cogre-layout t ] + ("Insert" :filter cogre-insert-forms-menu) + ("Navigate" + ["Next Element" cogre-next-node t ] + ["Prev Element" cogre-prev-node t ] + ["Move Node Up" cogre-move-node-up (cogre-node-child-p (cogre-current-element)) ] + ["Move Node Down" cogre-move-node-down (cogre-node-child-p (cogre-current-element)) ] + ["Move Node Left" cogre-move-node-left (cogre-node-child-p (cogre-current-element)) ] + ["Move Node right" cogre-move-node-right (cogre-node-child-p (cogre-current-element)) ] + ) + ("Change" :filter cogre-change-forms-menu) + "--" + ( "Edit..." + [ "Kill Node" cogre-kill-element (cogre-current-element) ] + [ "Copy Node" cogre-copy-element (cogre-current-element) ] + [ "Yank Node or Tag" cogre-yank-element (cogre-killring-active) ] + [ "Delete" cogre-delete (cogre-current-element) ]) + ( "Update..." + [ "Update Graph from Peers" cogre-update-graph-from-source t ] + [ "Update Element from Peer" cogre-update-node-from-source (cogre-node-with-peer) ]) + [ "Customize Graph" cogre-customize-graph t] + [ "PS Print" cogre-export-dot-postscript-print t ] + ("Export to..." + [ "ASCII Art" cogre-export-ascii t ] + [ "Graphviz DOT" cogre-export-dot t ] + [ ".png Image" cogre-export-dot-png t ] + ) + )) + +(defvar cogre-popup-map (make-sparse-keymap) + "Map for popup menus.") + +(easy-menu-define + cogre-mode-create-popup-menu cogre-popup-map "Connected Graph Insert Menu" + '("Insert" + [ "Node" cogre-new-node t] + "---" + [ "Class" cogre-new-node t] + [ "Package" cogre-new-node t] + [ "Instance" cogre-new-node t] + [ "Note" cogre-new-node t] + "---" + [ "Yank Node or Tag" cogre-yank-element (not (ring-empty-p senator-tag-ring)) ] + [ "Customize Graph" cogre-customize-graph t] + )) + +(easy-menu-define + cogre-mode-new-link-popup-menu cogre-popup-map "New Link Menu" + '("New Link Type" + [ "Link" cogre-select-a-link t] + [ "Update Link from Peer" cogre-update-node-from-source (cogre-node-with-peer) ] + "---" + [ "Arrow" cogre-select-a-link t] + [ "Inherit" cogre-select-a-link t] + [ "Aggregate" cogre-select-a-link t] + )) + +(defvar cogre-node-base-menu + '("Update Node" + [ "Rename" cogre-set-element-name t ] + [ "View/Edit" cogre-activate-element t ] + [ "Update Node from Peer" cogre-update-node-from-source (cogre-node-with-peer) ] + "---" + [ "Kill Node" cogre-kill-element (cogre-current-element) ] + [ "Copy Node" cogre-copy-element (cogre-current-element) ] + [ "Delete" cogre-delete (cogre-current-element) ] + ) + "List of basic items for a Menu on a Node.") + +(easy-menu-define + cogre-node-update-popup-menu cogre-popup-map "Connected Graph Update Menu" + cogre-node-base-menu) + +(defvar cogre-link-base-menu + '("Update Link" + [ "View/Edit" cogre-activate-element t ] + [ "Update Node from Peer" cogre-update-node-from-source (cogre-node-with-peer) ] + "---" + [ "Delete" cogre-delete (cogre-current-element) ] + ) + "List of basic items for a Menu on a Link.") + +(easy-menu-define + cogre-link-update-popup-menu cogre-popup-map "Connected Graph Update Menu" + cogre-link-base-menu) + +(defvar cogre-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + (when (fboundp 'tool-bar-add-item) + (tool-bar-add-item "cogre-node" 'cogre-new-node 'node) + (tool-bar-add-item "cogre-class" 'cogre-new-node 'class) + (tool-bar-add-item "cogre-package" 'cogre-new-node 'package) + (tool-bar-add-item "cogre-instance" 'cogre-new-node 'instance) + (tool-bar-add-item "cogre-note" 'cogre-new-node 'note) + (tool-bar-add-item "cogre-link" 'cogre-new-link 'link) + (tool-bar-add-item "cogre-arrow" 'cogre-new-link 'arrow) + (tool-bar-add-item "cogre-isa" 'cogre-new-link 'inherit) + (tool-bar-add-item "cogre-hasa" 'cogre-new-link 'aggregate) + ) + tool-bar-map) + "The tool-bar used for COGRE mode.") + + +(defmethod cogre-insert-class-list ((graph cogre-base-graph)) + "Return a list of classes GRAPH will accept." + (eieio-build-class-alist 'cogre-graph-element)) + +(defun cogre-insert-forms-menu (menu-def) + "Create a menu for cogre INSERT item. +Argument MENU-DEF is the easy-menu definition." + (easy-menu-filter-return + (easy-menu-create-menu + "Insert Forms" + (let ((obj (cogre-current-element)) + (elements (cogre-insert-class-list cogre-graph)) + (newmenu nil)) + (while elements + ;; Added (car elements) to the menu. + (setq newmenu (cons + (vector (car (car elements)) + `(progn + (cogre-new-node + (point) + (intern ,(car (car elements)))) + (cogre-render-buffer cogre-graph) + ) + t) + newmenu)) + (setq elements (cdr elements))) + (append (list [ "New Link" cogre-new-link t ] + [ "New Node" cogre-new-node t ] + ) + (nreverse newmenu)) + )))) + +(defun cogre-change-forms-menu (menu-def) + "Create a menu for cogre CHANGE item. +Argument MENU-DEF is the easy-menu definition." + (easy-menu-filter-return + (easy-menu-create-menu + "Change Forms" + (let* ((obj (cogre-current-element)) + (newmenu (cogre-augment-element-menu obj nil))) + (append '( [ "Name" cogre-set-element-name (cogre-current-element) ] + [ "View/Edit" cogre-activate-element (cogre-current-element) ] + ) + (nreverse newmenu)) + )))) + +;;; Major Mode +;; +;;;###autoload +(defun cogre-mode () + "Connected Graph Editor Mode. +\\{cogre-mode-map}" + (interactive) + (setq major-mode 'cogre-mode + mode-name "Cogre") + (use-local-map cogre-mode-map) + (when cogre-tool-bar-map + (set (make-local-variable 'tool-bar-map) cogre-tool-bar-map)) + (setq truncate-lines t) + (setq indent-tabs-mode nil) + (buffer-disable-undo) + (set (make-local-variable 'transient-mark-mode) nil) + (setq write-contents-functions 'cogre-save-hook) + ;; Convert contents from save file. + (cogre-convert-buffer-contents-on-init) + ;; Tail setup. + (run-hooks 'cogre-mode-hook) + ;; Misc issues + (set (make-local-variable 'font-lock-global-modes) nil) + (font-lock-mode -1) + ;; Force the redraw AFTER disabling font lock + (cogre-render-buffer cogre-graph t) + ;; If someone changes the major mode, be sure to convert everything + ;; back into plain-text save file. + (add-hook 'change-major-mode-hook 'cogre-switch-to-save-text t t) + ) +(put 'cogre-mode 'semantic-match-any-mode t) + +;;;###autoload +(add-to-list 'auto-mode-alist (cons "\\.cgr\\'" 'cogre-mode)) + +(defun cogre-convert-buffer-contents-on-init () + "Convert the buffer contents into a graph. +If it is already drawing a graph, then don't convert." + (when (not (eieio-object-p cogre-graph)) + ;; Convert the contents + (if (and (buffer-file-name) (file-exists-p (buffer-file-name))) + (let ((cogre-loading-from-file t)) + ;; Convert this file into a graph. + (condition-case nil + (setq cogre-graph (eieio-persistent-read (buffer-file-name))) + (error (fundamental-mode) + (error "Not a COGRE graph file"))) + (oset cogre-graph file (buffer-file-name)) + (cogre-map-elements 'cogre-element-post-serialize) + ) + ;; Else, just initialize into a graph. + (let ((name (file-name-sans-extension (buffer-file-name)))) + (setq cogre-graph (cogre-base-graph name :name name)) + (oset cogre-graph file (buffer-file-name))) + ) + (set-buffer-modified-p nil) )) + +(defun cogre-save-hook () + "Hook called when writing out a cogre buffer to disk." + (when (and (buffer-file-name (current-buffer)) + (not (slot-boundp cogre-graph 'file))) + (oset cogre-graph file (buffer-file-name (current-buffer)))) + (when (not (slot-boundp cogre-graph 'file)) + (error "Cannot save graph. File not set in graph object. (programmer error?)")) + (cogre-save cogre-graph) + (set-buffer-modified-p nil) + (clear-visited-file-modtime) + t) + +(defun cogre-switch-to-save-text () + "Convert the current graph to the text we save." + (if (not cogre-graph) + (message "No graph to conver to text when switching modes") + + ;; Setup the objects to have a file name. + (when (and (buffer-file-name (current-buffer)) + (not (slot-boundp cogre-graph 'file))) + (oset cogre-graph file (buffer-file-name (current-buffer)))) + ;; Clear out all the graph text + (erase-buffer) + ;; Write the text into this buffer. + (let ((standard-output (current-buffer))) + (cogre-write-save-text cogre-graph) + ) + (goto-char (point-min)) + )) + +;;; Customzize the graph +;; +(defun cogre-customize-graph () + "Customize the current graph." + (interactive) + (let ((b (current-buffer))) + (require 'eieio-custom) + (customize-object cogre-graph) + (setq cogre-custom-originating-graph-buffer b))) + +;;; Menu Helper +;; +(defun cogre-killring-active () + "Return non-nil if there is a tag in the kill ring." + (not (ring-empty-p senator-tag-ring))) + +(defun cogre-node-with-peer () + "Return no-nil if there is a node with a peer under the cursor." + (let* ((node (cogre-current-element (point)))) + (and node (oref node peer)))) + +;;; Interactive utility functions +;; +(defun cogre-node-at-point-interactive (&optional pos) + "Return the node under POS. +Throw an error if there is no node." + (let ((e (cogre-current-element (or pos (point))))) + (if (or (not e) (not (obj-of-class-p e cogre-node))) + (error "No graph node under point") + e))) + +(defun cogre-link-at-point-interactive (&optional pos) + "Return the node under POS. +Throw an error if there is no node." + (let ((e (cogre-current-element (or pos (point))))) + (if (or (not e) (not (obj-of-class-p e cogre-link))) + (error "No graph node under point") + e))) + +(defun cogre-element-at-point-interactive (&optional pos) + "Return the node under POS. +Throw an error if there is no node." + (let ((e (cogre-current-element (or pos (point))))) + (if (not e) + (error "No graph node under point") + e))) + +;;; Edit/View elements +;; +(defun cogre-activate-element (element) + "View/Edit the ELEMENT. +The default ELEMENT is the one found under the cursor." + (interactive (list (cogre-current-element))) + (if element + (cogre-activate element) + (error "The cursor is not on an object"))) + +;;; Insert/Delete +;; +(defun cogre-new-node (point nodetype &rest fields) + "Insert a new node at the current point. +Argument POINT is a position to insert this node to. +NODETYPE is the eieio class name for the node to insert. +Optional FIELDS are additional constructor fields to pass +in to the created node." + (interactive (list (point) (cogre-default-node nil current-prefix-arg))) + (save-excursion + (goto-char point) + (let* ((x (current-column)) + (y (cogre-current-line)) + (n (apply 'make-instance nodetype (oref nodetype name-default) + :position (vector x y) + fields))) + (when (interactive-p) + (cogre-render n) + ) + ;; Return the node. + n))) + +(defun cogre-new-link (mark point &optional linktype) + "Insert a new link from the node at MARK to POINT of LINKTYPE. +MARK is the node within which the current mark is set. +POINT is the node the cursor is in. +LINKTYPE is the eieio class name for the link to insert." + (interactive (list (cogre-node-at-point-interactive (mark)) + (cogre-node-at-point-interactive (point)) + (cogre-default-link nil current-prefix-arg))) + (if (not linktype) (setq linktype cogre-link)) + (let ((l (make-instance linktype "Link" :start mark :end point))) + + (when (interactive-p) + (cogre-render l)) + l)) + +(defvar cogre-delete-dont-ask nil + "Track if we should ask about deleting an object from the graph.") + +(defun cogre-delete (element) + "Delete the graph ELEMENT under the cursor." + (interactive (list (cogre-element-at-point-interactive (point)))) + (if (or cogre-delete-dont-ask + (y-or-n-p (format "Really delete %s? " (object-name element)))) + (let ((cogre-delete-dont-ask t)) + (if (obj-of-class-p element cogre-node) + (let ((el (oref cogre-graph elements)) + (test nil)) + (while el + (setq test (car el) + el (cdr el)) + (if (and (obj-of-class-p test cogre-link) + (or (eq element (oref test start)) + (eq element (oref test end)))) + (cogre-delete test))))) + (cogre-erase element) + (cogre-delete-element cogre-graph element)) + )) + +;;; Kill/Yank +;; +(defun cogre-kill-element (element) + "Kill the ELEMENT under point. +Uses `cogre-copy-element' to push it into the kill ring." + (interactive (list (cogre-element-at-point-interactive (point)))) + ;; Copy the element first. + (cogre-copy-element element) + ;; Now delete the node. + (cogre-delete element) + ) + +(defun cogre-copy-element (element) + "Copy the ELEMENT under point. +Clones the object in question and places the clone in semantic-tag-format +into `senator-tag-ring'." + (interactive (list (cogre-element-at-point-interactive (point)))) + (let* ((cogre-export-max-y (count-lines (point-min) (point-max))) + (tag (cogre-export-dot-method element)) + ) + ;; While cloning the old element, disable the graph. + (semantic--tag-put-property + tag :cogre (clone element (oref element :object-name))) + + (ring-insert senator-tag-ring tag) + )) + +(defun cogre-yank-element () + "Yank an element into the current graph. +Uses `senator-tag-ring'. Will yank semantic tags from code buffers +and translate into COGRE nodes." + (interactive) + (or (ring-empty-p senator-tag-ring) + (let* ((tag (ring-ref senator-tag-ring 0)) + (elt (semantic--tag-get-property tag :cogre)) + (x (current-column)) + (y (cogre-current-line)) + ) + (if elt + ;; If this was previously a cogre node, then clone it + ;; and move it and insert. + (progn + (setq elt (clone elt (oref elt :object-name) + :position (vector x y))) + ;; We need to make the name unique, and add to the + ;; graph, as clone won't call initialize. + (let ((n (oref elt object-name))) + ;; make sure our name is unique. + (oset elt object-name (cogre-unique-name cogre-graph n))) + (cogre-add-element cogre-graph elt) + ) + ;; It is some misc Semantic Tag. Convert into a node. + (setq elt (cogre-semantic-tag-to-node tag)) + (when elt + (oset elt :position (vector x y))) + ) + (cogre-refresh)))) + +;;; Navigation +;; +(defun cogre-goto-element (elt) + "Move the cursor onto the element ELT." + (if (obj-of-class-p elt cogre-node) + ;; We have a node + (let ((p (oref elt position))) + (picture-goto-coordinate (aref p 0) (aref p 1))) + ;; Else, we have a link + (with-slots (stop-position) elt + (apply 'picture-goto-coordinate stop-position) + ))) + +(defun cogre-next-node (&optional arg) + "Move forward ARG nodes in the hierarchy. +If ARG is unspecified, assume 1." + (interactive "p") + (let ((n (cogre-current-element (point))) + (e (oref cogre-graph elements)) + (next nil)) + (if (not n) + ;; Not on the node? Tab around. + (setq next (car e)) + (let* ((l (length e)) + (i (- l (length (member n e)))) + (ni (+ i arg))) + (if (< ni 0) (setq ni (+ l ni)) + (if (>= ni l) (setq ni (- ni l)))) + (setq next (nth ni e)))) + (cogre-goto-element next))) + +(defun cogre-prev-node (&optional arg) + "Move backward ARG nodes in the hierarchy. +If ARG is unspecified, assume 1." + (interactive "p") + (cogre-next-node (- arg))) + +;;; Node Modification +;; +(defun cogre-render-node-after-erase (node) + "Redraw the node NODE after it was erased. +It will redraw the links too." + (let ((links (cogre-node-links node))) + (cogre-render node) + (mapc 'cogre-render links))) + +(defun cogre-set-element-name (node name) + "Set the name of the current NODE to NAME." + (interactive (let ((e (cogre-node-at-point-interactive))) + (let ((name (oref e object-name))) + (list e (read-string "New Name: " name))))) + (cogre-erase node) + (oset node object-name (cogre-unique-name cogre-graph name)) + (when (interactive-p) + (cogre-render-node-after-erase node) + (cogre-goto-element node) + ;; If the user changes the name, update the peer. + (let ((peer (oref node peer))) + (when peer (cogre-peer-update-from-element peer node))) + ) + ) + +(defun cogre-set-scoped-node-package (node package) + "Set the package name of the current NODE to PACKAGE." + (interactive (let ((e (cogre-node-at-point-interactive))) + (let ((name (oref e package-name))) + (list e (read-string "New Package Name: " name))))) + (cogre-erase node) + (oset node package-name package) + (when (interactive-p) + (cogre-render-node-after-erase node) + (cogre-goto-element node) + ;; If the user changes the name, update the peer. + (let ((peer (oref node peer))) + (when peer (cogre-peer-update-from-element peer node))) + ) + ) + +(defun cogre-update-node-from-source (node) + "Update the current NODE from its source. +The source is defined by the peer belonging to NODE." + (interactive (list (cogre-node-at-point-interactive))) + (let ((peer (oref node peer))) + (if (not peer) + (message "No peer to update from.") + (cogre-erase node) + (cogre-peer-update-from-source peer node) + (cogre-render-node-after-erase node) + (cogre-goto-element node) + ))) + +(defun cogre-update-graph-from-source () + "Update the current graph from its sources." + (interactive) + ;; Do the update. + (cogre-update-graph-from-peers cogre-graph) + ;; Now refresh the graph. + (cogre-refresh)) + +;;; Node Movement +;; +(defun cogre-move-node (x y &optional node) + "Set a node to postion X, Y. +If NODE is not provided, then calculate from current position." + (interactive "nX: \nnY: ") + (let ((inhibit-point-motion-hooks t) + (e (or node (cogre-current-element (point))))) + (cogre-erase e) + (if (<= x 0) (setq x 0)) + (if (<= y 0) (setq y 0)) + (cogre-move e x y) + (let ((pos (oref e position))) + (picture-goto-coordinate (aref pos 0) (aref pos 1))) + ;; Do the service of redrawing the modified pieces. + (cogre-render-node-after-erase e) + (picture-goto-coordinate x y))) + +(defun cogre-node-position (&optional noerror) + "Get the position of the node at point. +Optional NOERROR means don't throw an error if there was no node." + (let ((e (cogre-current-element (point))) + ) + (if e (oref e position) + (if noerror + nil + (error "No node at point %d" (point)))))) + +(defun cogre-move-node-left (arg) + "Move NODE left by ARG columns." + (interactive "p") + (let* ((p (cogre-node-position))) + (cogre-move-node (- (aref p 0) arg) (aref p 1)) + )) + +(defun cogre-move-node-right (arg) + "Move NODE right by ARG columns." + (interactive "p") + (let* ((p (cogre-node-position))) + (cogre-move-node (+ (aref p 0) arg) (aref p 1)) + )) + +(defun cogre-move-node-up (arg) + "Move NODE up by ARG columns." + (interactive "p") + (let* ((p (cogre-node-position))) + (cogre-move-node (aref p 0) (- (aref p 1) arg)) + )) + +(defun cogre-move-node-down (arg) + "Move NODE down by ARG columns." + (interactive "p") + (let* ((p (cogre-node-position))) + (cogre-move-node (aref p 0) (+ (aref p 1) arg)) + )) + +;;; Mouse Handlers +;; +;; Cogre is mostly keyboard driven. The mouse will make dragging +;; existing things around easier. + +(defun cogre-down-mouse-1 (event) + "Handle a mouse-down-1 EVENT in `cogre' mode. +Clicking and dragging on a node will move the node." + (interactive "@e") + (let* ((echo-keystrokes 10000) ; don't show pressed keys. + (start-pos (posn-col-row (event-end event))) + (x1 (car start-pos)) + (y1 (cdr start-pos)) + ) + + ;; Make sure the text character exists for this point. + (picture-mouse-set-point event) + + ;; Did we click on a node? + (let* ((node (cogre-current-element (point))) + (auto-hscroll-mode nil)) + + (cond + ((not node) + ;; We didn't click on anything. Drag the whole graph + ;; around. + (track-mouse + + (while (progn + (setq event (read-event)) + (mouse-movement-p event)) + + (let* ((next-pos (posn-col-row (event-end event))) + (x2 (car next-pos)) + (y2 (cdr next-pos)) + (dx (- x2 x1)) + (dy (- y2 y1)) + ) + + (condition-case nil + (scroll-down dy) + (error nil)) + (condition-case nil + (scroll-right dx) + (error nil)) + + (setq x1 x2 + y1 y2 + start-pos next-pos) + ))) + nil) + ((cogre-node-child-p node) + ;; We have a node. Drag it. + (track-mouse + + (while (progn + (setq event (read-event)) + (mouse-movement-p event)) + + (let* ((next-pos (posn-col-row (event-end event))) + (x2 (car next-pos)) + (y2 (cdr next-pos)) + (dx (- x2 x1)) + (dy (- y2 y1)) + (p (oref node position)) + ) + + ;; We have a node. Start dragging. + (cogre-move-node (+ (aref p 0) dx) (+ (aref p 1) dy) node) + + (setq x1 x2 + y1 y2 + start-pos next-pos) + ))) + ;; Always redraw when we are done. + (cogre-render-buffer cogre-graph t) + ) + ((cogre-link-child-p node) + ;; Implement something good here someday. + nil) + (t + nil) + + )))) + +(defvar cogre-down-mouse-2-link-selector nil + "The link type to use when using mouse 2. +Set by menu operations.") + +(defun cogre-select-a-link () + "Select a link type from a popup menu." + (interactive) + (setq cogre-down-mouse-2-link-selector + (cogre-default-link))) + +(defun cogre-down-mouse-2 (event) + "Handle a mouse-down-2 EVENT in `cogre' mode. +Clicking and dragging on a node will move the node." + (interactive "@e") + (let* ((echo-keystrokes 10000) ; don't show pressed keys. + (start-pos (posn-col-row (event-end event))) + (x1 (car start-pos)) + (y1 (cdr start-pos)) + ) + + ;; Make sure the text character exists for this point. + (picture-mouse-set-point event) + + ;; Did we click on a node? + (let* ((node (cogre-current-element (point)))) + + (if (and node (cogre-node-child-p node)) + (progn + (message "Drag POINT to node to create a link.") + ;; Create a link by dragging from this node to another. + (track-mouse + + (while (progn + (setq event (read-event)) + (mouse-movement-p event)) + + ;; We need some way to indicate the drag. + (picture-mouse-set-point event) + + (message "Drag POINT to node to create a link.") + )) + (let ((endnode (cogre-current-element (point))) + (cogre-down-mouse-2-link-selector nil)) + (if endnode + (progn + (popup-menu cogre-mode-new-link-popup-menu) + (make-instance (or cogre-down-mouse-2-link-selector + 'cogre-link) + :start node :end endnode) + (cogre-render-buffer cogre-graph) + ) + ;; else, a bug + (message "You must drop the link onto another node.")) + )) + (message "Click on a node and drag to create a link.") + ;; Eat the next event + (read-event) + ;; Repeat the message + (message "Click on a node and drag to create a link.") + )))) + +(defun cogre-down-mouse-3 (event) + "Handle a popup menu EVENT in `cogre' mode. +Pops up a context menu of various activities to perform." + (interactive "@e") + (let* ((startwin (selected-window)) + ;; This line has an issue in XEmacs. + (win (semantic-event-window event)) + ) + (select-window win t) + (save-excursion + (picture-mouse-set-point event) + (sit-for 0) + (let ((node (cogre-current-element (point)))) + (cond + ((cogre-node-child-p node) + (let ((extramenu (cogre-augment-element-menu node nil))) + (if (not extramenu) + (popup-menu cogre-node-update-popup-menu) + ;; Merge menus, and pop up the new one. + (let ((newmenu nil)) + (dolist (M (cdr cogre-node-base-menu)) + (push M newmenu) + (when (and (stringp M) (string= M "---")) + ;; Add new entries here. + (dolist (NM extramenu) + (push NM newmenu)) + (push "---" newmenu) + )) + ;; No convert the fabricated menu into a temporary popup. + (popup-menu + (easy-menu-create-menu (car cogre-node-base-menu) (nreverse newmenu))) + )))) + ((cogre-link-child-p node) + (popup-menu cogre-link-update-popup-menu)) + (t + (popup-menu cogre-mode-create-popup-menu))) + )) + (select-window startwin))) + +(provide 'cogre-mode) + +;;; cogre-mode.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-node.xpm b/site/cedet-1.0pre7/cogre/cogre-node.xpm new file mode 100644 index 0000000..c6a000b --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-node.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_node_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ...................... ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . ", +" . . . . . ", +" . .. . .. ... . . ", +" . .. . . . . . . . . ", +" . . .. . . . . ... . ", +" . . . . . . . . . ", +" . . . .. ... .. . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" ...................... ", +" "}; diff --git a/site/cedet-1.0pre7/cogre/cogre-note.xpm b/site/cedet-1.0pre7/cogre/cogre-note.xpm new file mode 100644 index 0000000..6043db7 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-note.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * cogre_note_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ..................", +" .. .", +" . . .", +" . . .", +" . . .", +" . . .", +". . .", +"....... .", +". .", +". .", +". . . .", +". .. . . .", +". ... . .. ... .. .", +". . . . . . . . . .", +". . .. . . . .... .", +". . .. . . . . .", +". . . .. . ... .", +". .", +". .", +". .", +". .", +". .", +". .", +"........................"}; diff --git a/site/cedet-1.0pre7/cogre/cogre-package.xpm b/site/cedet-1.0pre7/cogre/cogre-package.xpm new file mode 100644 index 0000000..97df9a7 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-package.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * package_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ......... ", +". .. ", +". .. ", +". . ", +". .............", +". .", +". .", +". ..... . .", +". . . . .", +". . . . . .... .", +". ..... . . . . .", +". . .. . . .", +". . . . . . .", +". . . . . .. .", +". . . . . .", +". .. .", +". .", +". .", +". .", +". .", +". .", +". .", +"........................"}; diff --git a/site/cedet-1.0pre7/cogre/cogre-periodic.el b/site/cedet-1.0pre7/cogre/cogre-periodic.el new file mode 100644 index 0000000..a362952 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-periodic.el @@ -0,0 +1,136 @@ +;;; cogre-periodic.el --- Periodic table of COGRE nodes +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-periodic.el,v 1.7 2009/04/07 01:45:09 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Periodic table of COGRE nodes. +;; +;; @TODO - Each time a new node or link is created, add it to the +;; periodic table. + +;;; Code: +(require 'cogre-utest) +(require 'cogre-uml) + +(defvar cogre-periodic-node-name-list + '( ( "cogre-node" cogre-node ) + ( "cogre-node (2)" cogre-node ) + ( "cogre-package" cogre-package ) + ( "cogre-class" cogre-class ) + ( "cogre-class (2)" cogre-class ) + ( "cogre-instance" cogre-instance ) + ( "cogre-instance (2)" cogre-instance ) + ( "Notes about COGRE" cogre-note ) + ) + "List of node names and classes in the graph. +Used for testing purposes in conversion routines.") + +(defvar cogre-periodic-link-connectivity-list + '( + ( "cogre-node" "cogre-node2" cogre-link ) + ( "cogre-package" "cogre-class" 'cogre-aggregate ) + ( "cogre-class (2)" "cogre-class" cogre-inherit ) + ( "cogre-instance" "cogre-instance (2)" cogre-arrow) + ) + "List of link connectivity from the periodic table graph. +Used for testing purpses in conversion routines.") + +;;;###autoload +(defun cogre-periodic () + "Create a periodic table of COGRE objects." + (interactive) + ;; Setup the graph. + (switch-to-buffer (get-buffer-create "*Graph Periodic*")) + (erase-buffer) + (kill-all-local-variables) + (cogre "Periodic") + ;; Put out the base items. + (let ((n1 (cogre-periodic-make-node-at 2 1 'cogre-node "cogre-node")) + (n2 (cogre-periodic-make-node-at 40 1 'cogre-node "cogre-node (2)"))) + (cogre-periodic-link-at n1 n2 'cogre-link)) + ;; Put out some UML class diagram elements items. + (let ((p1 (cogre-periodic-make-node-at 2 7 'cogre-package "cogre-package")) + (c1 (cogre-periodic-make-node-at + 25 7 'cogre-class "cogre-class" + :package-name "package")) + (c2 (cogre-periodic-make-node-at + 23 18 'cogre-class "cogre-class (2)" + :attributes + (list + (semantic-tag-new-variable "fAttr" "int") + (semantic-tag-new-variable "fNice" "int") + ) + :methods + (list + (semantic-tag-new-function "getAttr" "int" nil) + (semantic-tag-new-function "setAttr" "void" + (list (semantic-tag-new-variable + "attr" "int")))) + ))) + (cogre-periodic-link-at p1 c1 'cogre-aggregate) + (cogre-periodic-link-at c2 c1 'cogre-inherit)) + ;; Instance Diagram + (let ((i1 (cogre-periodic-make-node-at 45 7 'cogre-instance "cogre-instance")) + (i2 (cogre-periodic-make-node-at + 45 28 'cogre-instance "cogre-instance (2)" + :package-name "mypack")) + ) + (cogre-periodic-link-at i1 i2 'cogre-arrow)) + + ;; Notes? + (cogre-periodic-make-node-at 4 27 'cogre-note "Notes about COGRE") + + (cogre-render-buffer cogre-graph) + ) + +(defun cogre-periodic-make-node-at (x y type name &rest + fields) + "Create a node at X,Y with TYPE and NAME. +Optional FIELDS are fields to pass into the constructor." + (picture-goto-coordinate x y) + (let ((node (apply 'cogre-new-node (point) type fields))) + (cogre-set-element-name node name) + node)) + +(defun cogre-periodic-link-at (node1 node2 type) + "Create a link between NODE1 and NODE2. +Link is created with the specified TYPE." + (make-instance type :start node1 :end node2) + ) + +;;; TESTS +;; +;;;###autoload +(defun cogre-periodic-utest () + "Run the cogre periodic table for unit testing. +Also test various output mechanisms from the periodic table." + (interactive) + ;; Create the table. + (cogre-periodic) + (sit-for 0) + ;; ASCII output + (cogre-export-ascii) + (sit-for 0) + ) + +(provide 'cogre-periodic) +;;; cogre-periodic.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-semantic.el b/site/cedet-1.0pre7/cogre/cogre-semantic.el new file mode 100644 index 0000000..469623b --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-semantic.el @@ -0,0 +1,373 @@ +;;; cogre-semantic.el --- Convert Semantic TAGS to COGRE nodes. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-semantic.el,v 1.9 2009/04/23 03:28:09 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Define a set of Semantic COGRE element peers based on Semantic objects. +;; +;; Convert tags into COGRE nodes, or update existing COGRE nodes +;; with data from TAGS. +;; +;; Used for cut/paste, or updating graphs linked to code from changes +;; made in the code. +;; +;; To convert nodes into tags, see `cogre-convert.el'. + +(require 'semantic) +(require 'cogre-srecode) +(require 'cogre) + +;;; Code: + +;;; GRAPH PEERS +;; +;; The graph peer for Semantic will contain information needed for +;; code generation, such as files and what-not. +(defclass cogre-peer-project-semantic (cogre-element-peer) + ( + ) + "Peer for graph objects intended for use with Semantic element peers.") + +;;; TAG PEERS +;; +;; The peers can represent a Semantic tag, and keep it up to date. + +(defclass cogre-peer-semantic (cogre-element-peer) + ((tag :initarg :tag + :initform nil + :type (or null semantic-tag) + :documentation + "The Semantic Tag managed by this peer.") + ) + "A peer containing a Semantic class.") + +(defmethod cogre-peer-source-file ((peer cogre-peer-semantic)) + "Does this peer have a source file?" + (with-slots (tag) peer + (semantic-tag-file-name tag))) + +(defclass cogre-peer-semantic-class (cogre-peer-semantic) + ( + ) + "A peer containing a Semantic class.") + +(defun cogre-refresh-tag (tag) + "Refresh TAG from sources. +Goes to the original location of TAG, and tries to re-find that tag." + (save-excursion + (semantic-go-to-tag tag) + ;; Force a refresh if needed. + (semantic-fetch-tags) + ;; Make sure we find the original. + (let ((newtag (semantic-current-tag)) + (replace nil)) + ;; Are they basically the same? + (if (semantic-tag-similar-p tag newtag) + (setq replace t) + ;; Maybe we missed because the code moved around? + (let ((tagsearch (semantic-deep-find-tags-by-name (semantic-tag-name tag)))) + (setq tagsearch + (semantic--find-tags-by-function + (lambda (T) (semantic-tag-similar-p T tag)) + tagsearch)) + (setq newtag (car tagsearch))) + (when (and newtag (semantic-tag-similar-p tag newtag)) + (setq replace t))) + ;; Make a copy of this new tag, and return it. + (when newtag + (semantic-tag-copy newtag nil t))))) + +(defmethod cogre-peer-update-from-source ((peer cogre-peer-semantic-class) node) + "Update the PEER object, and NODE from environment." + (let* ((tag (oref peer tag)) + (newtag (cogre-refresh-tag tag)) + ) + + (when newtag + (oset peer :tag (semantic-tag-copy newtag nil t)) + (setq tag (oref peer :tag))) + + ;; Update node based one what we learned. + (let ((slots (semantic-tag-type-members tag)) + (extmeth (semantic-tag-external-member-children tag t)) + attrib method) + ;; Bin them up + (while slots + (cond + ;; A plain string, a simple language, just do attributes. + ((stringp (car slots)) + (setq attrib (cons (list (car slots) 'variable nil) + attrib)) + ) + ;; Variable decl is an attribute + ((eq (semantic-tag-class (car slots)) 'variable) + (setq attrib (cons (semantic-tag-copy (car slots) nil t) attrib))) + ;; A function decle is a method. + ((eq (semantic-tag-class (car slots)) 'function) + (setq method (cons (semantic-tag-copy (car slots) nil t) method))) + ) + (setq slots (cdr slots))) + + ;; Add in all those extra methods + (when (semanticdb-find-results-p extmeth) + (setq extmeth (semanticdb-strip-find-results extmeth t))) + (while extmeth + (when (eq (semantic-tag-class (car extmeth)) 'function) + (setq method (cons (semantic-tag-copy (car extmeth) nil t) method))) + (setq extmeth (cdr extmeth))) + + ;; Put them into the class. + (oset node object-name (semantic-tag-name tag)) + (oset node attributes (nreverse attrib)) + (oset node methods (nreverse method)) + ;; Tada! + ))) + +(defmethod cogre-peer-update-from-element ((peer cogre-peer-semantic-class) element) + "Update the PEER object, from the ELEMENT data, changing the environment." + (message "Cannot update source from graph yet.") + nil) + +;;; NEW NODE FROM SOURCE +;; +;; Handle conversion from a Semantic Tag (source) to a new node. +;; +;;;###autoload +(defun cogre-semantic-tag-to-node (tag) + "Convert the Semantic tag TAG into a COGRE node. +Only handles data types nodes. +To convert function/variables into methods or attributes in +an existing COGRE node, see @TODO - do that." + (cond + ((and tag (semantic-tag-of-class-p tag 'type) + (or (string= (semantic-tag-type tag) "class") + (string= (semantic-tag-type tag) "struct"))) + ;; A type from a typed language, make the peer and the class, + ;; then perform the update. + (let* ((peer (cogre-peer-semantic-class + (semantic-tag-name tag) + :tag (semantic-tag-copy tag nil t))) + (node (cogre-class (semantic-tag-name tag) + :peer peer))) + (cogre-peer-update-from-source peer node) + node)) + + ((semantic-tag-of-class-p tag 'node) + ;; A node from a dot file. + (error "COGRE can't import dot files yet") + ) + (t + (error "COGRE can only convert language datatypes into class nodes")))) + +;;; SEMANTIC TAG GENERATOR +;; +;; Convert a graph into a set of Semantic Tags. Different utilties +;; will be needed to convert these tags into source code. +(defun cogre-export-semantic (&optional m-mode) + "Export the current COGRE graph to a set of Semantic Tags. +This command will just display the generated tags. +Use different utilities to convert these tags to into code. +Optional argument M-MODE specifies the mode to have active +while creating the tags." + (interactive) + (when (not (eieio-object-p cogre-graph)) (error "No graph to export")) + + (let* ((g cogre-graph) + (tags nil) + ) + + (setq tags + (if m-mode + (with-mode-local-symbol m-mode + (cogre-export-semantic-method g)) + ;; Else, no mode, use whatever... + (cogre-export-semantic-method g))) + + (if (interactive-p) + ;; Dump the output. + (data-debug-show-stuff tags "CogreSemanticTagExport") + tags))) + +(defmethod cogre-export-semantic-method ((g cogre-base-graph)) + "Convert G into Semantic Tag for a typed language." + (save-excursion + (set-buffer (oref g buffer)) + ;; Sort the graph into a nested a tree. + (let ((tree (cogre-uml-sort-for-lineage g)) + (out nil)) + ;; Each entry in TREE is: + ;; ( CLASS SUPER1 SUPER2 ... ) + (dolist (E tree) + (let* ((node (car E)) + (name (oref node :object-name)) + (parents (mapcar (lambda (P) + (oref P :object-name)) + (cdr E))) + (attrib (oref node attributes)) + (method (oref node methods)) + ) + (let ((tag (semantic-tag-new-type + name "class" + (append method attrib) + (list parents)))) + (push tag out)) + )) + (nreverse out)))) + +;;; CODE GENERATOR +;; +;; Generate code from a graph. Convert into Semantic tags, then +;; output into a source file. +;; +;;;###autoload +(defun cogre-export-code (file) + "Export the current graph into source-code in FILE. +Uses `cogre-export-semantic' to convert into Semantic tags. +Uses `cogre-srecode-setup' to setup SRecode for code generation." + (interactive "FOutput File: ") + (let* ((newfilebuff (find-file-noselect file)) + (mode (save-excursion (set-buffer newfilebuff) + major-mode)) + (tags (cogre-export-semantic mode)) + ) + ;; Load our tables. + (cogre-srecode-load-tables) + (srecode-load-tables-for-mode mode) + + ;; Switch to this new buffer. + (switch-to-buffer newfilebuff) + + (when (= (point-min) (point-max)) + ;; Start it out. + (srecode-insert "file:empty")) + + ;; Insert all the tags. + (dolist (T tags) + (let ((me (srecode-semantic-insert-tag T))) + (goto-char me)) + ) + + )) + +;;; USER-UTILITY +;; +;; Previous version of cogre-uml-quick-class used a different class +;; hierarchy. This implementation uses the new peer back-end to various +;; nodes to build up the tree. +;; +;; Also, use new Semantic analyzer features to identify the +;; classes we want to build. + +(defvar cogre-class-history nil + "History for inputting class names.") + +(defun cogre-read-class-name () + "Read in a class name to be used by a cogre node." + (let ((finddefaultlist (semantic-find-tag-by-overlay)) + class prompt stream + ) + ;; Assume the top most item is the all encompassing class. + (if finddefaultlist + (setq class (car finddefaultlist))) + ;; Make sure our class is really a class + (if (not (and + class + (eq (semantic-tag-class class) 'type) + (string= (semantic-tag-type class) "class"))) + (setq class nil) + (setq class (semantic-tag-name class))) + ;; Create a prompt + (setq prompt (if class (concat "Class (default " class "): ") "Class: ")) + ;; Get the stream used for completion. + (let ((types (semanticdb-strip-find-results + (semanticdb-brute-find-tags-by-class 'type) + ;; Don't find-file-match. Just need names. + ))) + (setq stream (semantic-find-tags-by-type "class" types))) + ;; Do the query + (completing-read prompt stream + nil nil nil 'cogre-class-history + class) + )) + +;;;###autoload +(defun cogre-uml-quick-class (class) + "Create a new UML diagram based on CLASS showing only immediate lineage. +The parent to CLASS, CLASS, and all of CLASSes children will be shown." + (interactive (list (cogre-read-class-name))) + + (message "Building UML diagram for %S" class) + + (let* ((brute (semanticdb-brute-deep-find-tags-by-name class (current-buffer))) + (byclass (when brute (semanticdb-find-tags-by-class 'type brute))) + (stripped (when byclass (semanticdb-strip-find-results byclass t))) + (classes (when stripped (semantic-find-tags-by-type "class" stripped))) + (class-tok (car classes)) + (parent (semantic-tag-type-superclasses class-tok)) + (ptags nil) + + (children + (semanticdb-strip-find-results + (semanticdb-find-tags-subclasses-of-type + (semantic-tag-name class-tok) (current-buffer)))) + ) + + (unless class-tok + (error "Could not find class %S" class)) + + (save-excursion + ;; Go to our token, and then look up the parents. + (semantic-go-to-tag class-tok) + (let ((scope (semantic-calculate-scope))) + (dolist (P parent) + (push (semantic-analyze-find-tag P 'type scope) + ptags)) + )) + + ;; Create a graph. + (cogre (semantic-tag-name class-tok)) + + ;; Create this class + (let ((CT (cogre-semantic-tag-to-node class-tok))) + + ;; Create all the parent nodes in the graph, then connect + ;; them to C. + (dolist (P ptags) + (when P + (let ((pn (cogre-semantic-tag-to-node P))) + (make-instance 'cogre-inherit :start CT :end pn)))) + + ;; Create all the children nodes, and align them. + (dolist (C children) + (let ((cn (cogre-semantic-tag-to-node C))) + (make-instance 'cogre-inherit :start cn :end CT)))) + + ;; Run the layout engine. + (condition-case nil + (cogre-layout) + (error + (message "Layout engine failed. You need to install Graphviz.") + )) + )) + +(provide 'cogre-semantic) +;;; cogre-semantic.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-srecode.el b/site/cedet-1.0pre7/cogre/cogre-srecode.el new file mode 100644 index 0000000..071f114 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-srecode.el @@ -0,0 +1,153 @@ +;;; cogre-srecode.el --- SRecode macros for COGRE. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-srecode.el,v 1.5 2009/04/06 02:28:18 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Basic SRecode support for COGRE related activities. + +(require 'srecode) +(require 'srecode-dictionary) + +;;; Code: +;;;###autoload +(defun cogre-srecode-setup () + "Update various paths to get SRecode to identify COGRE macros." + + (let* ((lib (locate-library "cogre.el" t)) + (ededir (file-name-directory lib)) + (tmpdir (file-name-as-directory + (expand-file-name "templates" ededir)))) + (when (not tmpdir) + (error "Unable to location COGRE Templates directory")) + + ;; Rig up the map. + (require 'srecode-map) + (add-to-list 'srecode-map-load-path tmpdir) + (srecode-map-update-map t) + + )) + +(defun cogre-srecode-load-tables () + "Load tables COGRE needs for SREcode." + ;; We don't call this unless we need it. Load in the templates. + (srecode-load-tables-for-mode 'graphviz-dot-mode) + ) + +(defvar cogre-srecode-current-graph nil + "The current COGRE graph to add to SRecode.") + +;;;###autoload +(defun srecode-semantic-handle-:cogre (dict) + "Add macros to dictionary DICT based on COGRE data." + (let ((G (if (eieio-object-p cogre-graph) + cogre-graph + cogre-srecode-current-graph))) + (when (not G) (error "Cannot resolve :cogre template argument. No current graph")) + + (srecode-dictionary-set-value dict "GRAPHNAME" (oref G name)) + + ;; @todo - set buffer to graph. Convert to ascii. + + (srecode-dictionary-set-value dict "GRAPH" "") + )) + +;;;###autoload +(eval-after-load "srecode-map" (cogre-srecode-setup)) + +;;;###autoload +(defun srecode-semantic-handle-:dot (dict) + "Add macros to dictionary DICT based on the current DOT buffer." + ;; @todo - Is there anything?? + + ) + +(defun cogre-srecode-add-attr (label value dict) + "Add LABEL with VALUE to DICT." + (let ((subdict (srecode-dictionary-add-section-dictionary dict "ATTRIBUTES"))) + (srecode-dictionary-set-value subdict "LABEL" label) + (srecode-dictionary-set-value subdict "VALUE" value))) + +(define-mode-local-override srecode-calculate-context + graphviz-dot-mode () + "Calculate a context for SRecode. +This fcn is very sparing of fetching tags." + (if (= (point-min) (point-max)) + (list "file" "empty") + + (let ((ct (semantic-find-tag-by-overlay)) + ) + + (when (not ct) + (semantic-fetch-tags) + (setq ct (semantic-find-tag-by-overlay))) + + (cond ((not ct) + (list "declaration" "graph") + ) + ((semantic-tag-of-class-p (car ct) 'digraph) + (list "declaration" "node") + ) + ((semantic-tag-of-class-p (car (cdr ct)) 'node) + (list "attribute") + )) + ) + )) + +(define-mode-local-override srecode-semantic-apply-tag-to-dict + graphviz-dot-mode (tagobj dict) + "Insert features of TAGOBJ into dictionary DICT." + ;; Semantic Graphviz tags are not like other tags. + + ;; Store the sst into the dictionary. + (srecode-dictionary-set-value dict "TAG" tagobj) + + ;; Pull out the tag for the individual pieces. + (let ((tag (oref tagobj :prime))) + + (srecode-dictionary-set-value dict "NAME" (semantic-tag-name tag)) + + (cond + ((semantic-tag-of-class-p tag 'node) + (let ((A (semantic-tag-get-attribute tag :attributes))) + (while A + (cogre-srecode-add-attr (semantic-tag-name (car A)) + (semantic-tag-get-attribute (car A) :value) + dict) + (setq A (cdr A)))) + ) + ((semantic-tag-of-class-p tag 'link) + (srecode-dictionary-set-value + dict "TAIL" (semantic-tag-get-attribute tag :to)) + ;(cogre-srecode-add-attr "arrowhead" (semantic-tag-get-attribute tag :arrowhead) dict) + ;(cogre-srecode-add-attr "arrowtail" (semantic-tag-get-attribute tag :arrowtail) dict) + (let ((A (semantic-tag-get-attribute tag :attributes))) + (while A + (cogre-srecode-add-attr (semantic-tag-name (car A)) + (semantic-tag-get-attribute (car A) :value) + dict) + (setq A (cdr A)))) + ) + ) + )) + +(provide 'cogre-srecode) +;;; cogre-srecode.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-uml.el b/site/cedet-1.0pre7/cogre/cogre-uml.el new file mode 100644 index 0000000..e932d90 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-uml.el @@ -0,0 +1,439 @@ +;;; cogre-uml.el --- UML support for COGRE + +;;; Copyright (C) 2001, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; Keywords: oop, uml +;; X-RCS: $Id: cogre-uml.el,v 1.30 2009/04/23 03:26:59 zappo Exp $ + +;; This file is not part of GNU Emacs. + +;; This is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Provides UML support for COGRE. +;; +;; See http://c2.com/cgi/wiki?UmlAsciiArt for more examples of using +;; ASCII to draw UML diagrams. + +(require 'cogre) +(eval-when-compile (require 'cogre-semantic)) + +;;; Code: +;;;###autoload +(defclass cogre-package (cogre-node) + ((name-default :initform "Package") + (blank-lines-top :initform 1) + (blank-lines-bottom :initform 1) + (alignment :initform left) + (subgraph :initarg :subgraph + :initform nil + :type (or null cogre-base-graph) + :documentation + "A graph which represents the classes within this package. +The subgraph should be scanned to extract all the elements drawn into +the package node.") + ) + "A Package node. +Packages represent other class diagrams, and list the major nodes +within them. They can be linked by dependency links.") + +(defmethod cogre-node-rebuild-default ((node cogre-package)) + "Create the text rectangle for the COGRE package. +Calls the base method, and takes the return argument and +tweaks the faces." + (let* ((rect (call-next-method)) + (first (car rect)) + (second (car (cdr rect)))) + ;; Tweak the first and second string iff it is long enough. + (when (> (length first) 7) + (remove-text-properties 5 (length first) '(face) first) + (setcar rect first) + (cogre-string-merge-faces 5 (length second) + 'cogre-box-first-face + second) + (setcar (cdr rect) second) + ) + ;; Return it. + rect)) + +;;;###autoload +(defclass cogre-note (cogre-node) + ((name-default :initform "Note...") + (blank-lines-top :initform 1) + (blank-lines-bottom :initform 1) + (alignment :initform left) + ) + "An note node. +Notes are used to add annotations inside a graph. +Notes are generally linked to some node, and are supposed to look +like a little pieces of paper.") + +(defmethod cogre-node-rebuild-default ((node cogre-note)) + "Create the text rectangle for the COGRE package. +Calls the base method, and takes the return argument and +tweaks the faces." + (let* ((rect (call-next-method)) + (first (car rect))) + (remove-text-properties 0 1 '(face) first) + (aset first 0 ?/) + (setcar rect first) + ;; Return it. + rect)) + +;;;###autoload +(defclass cogre-scoped-node (cogre-node) + ((package-name :initform "" + :initarg :package-name + :type string + :custom string + :documentation + "The package name of this node. +Package names are displayed in italic at the top of the node above the name +in UML, usuall like this: + +---------------+ + | <> | + | NameOfNode | + | ... |") + (package-delimiters :allocation :class + :initform ( "<<" . ">>" ) + :documentation + "Decoration delimiters for left/right side of package name. +It is a list of the form ( \"LEFTDELIM\" . \"RIGHTDELIM\").") + ) + "A UML node that has a package specifier within which it is scoped." + :abstract t) + +(defmethod cogre-node-title ((node cogre-scoped-node)) + "Return the title of a scoped node. +If there is no package name, it is (\"name\"). If there +is a package, it is ( \"\" \"name\")." + (if (not (string= (oref node package-name) "")) + (let* ((p (oref node package-name)) + (delim (oref node package-delimiters)) + (s (concat (car delim) p (cdr delim)))) + (cogre-string-merge-faces 1 (+ (length p) 1) 'italic s) + (list s (oref node object-name))) + (list (oref node object-name)))) + +(defmethod cogre-augment-element-menu ((node cogre-scoped-node) menu) + "For NODE, augment the current element MENU. +Return the modified element." + (append (call-next-method node menu) + '( [ "Repackage" cogre-set-scoped-node-package t ] + ))) + +;;;###autoload +(defclass cogre-class (cogre-scoped-node) + ((name-default :initform "Class") + (blank-lines-top :initform 0) + (blank-lines-bottom :initform 0) + (alignment :initform left) + (attributes :initarg :attributes + :initform nil + :type list + :custom sexp + :documentation + "A list of attributes belonging to this Class representation. +Each attribute must in the form of a semantic token. ei. + (\"object-name\" variable \"type\" ... ) +See `semantic-fetch-tags' for details on possible token forms. +These items do not need to be REAL semantic tokens, however. +Only the format is needed to get the name/typing information.") + (methods :initarg :methods + :initform nil + :type list + :custom sexp + :documentation + "A list of methods belonging to this Class representation. +See `attribute' slot for details on the form of each token in this list.") + ) + "A Class node. +Class nodes represent a class, and can list the attributes and methods +within them. Classes can have attribute links, and class hierarchy links.") + +(defmethod cogre-uml-stoken->uml ((class cogre-class) stoken &optional text) + "For CLASS convert a Semantic style token STOKEN into a uml definition. +It also adds properties that enable editing, and interaction with +this node. Optional argument TEXT is a preformatted string." + (if (semantic-tag-p stoken) + (let ((peer (oref class peer)) + (mm (oref cogre-graph major-mode))) + (save-excursion + ;; Visit that tag's home so we get the correct mechanism for + ;; converting to a prototype. + (if (semantic-tag-file-name stoken) + (progn + (semantic-go-to-tag stoken) + (setq mm major-mode)) + (when (and peer (cogre-peer-source-file peer)) + (set-buffer (semantic-find-file-noselect + (cogre-peer-source-file peer))) + (setq mm major-mode) + ))) + ;; disable images during the format. Images will mess up + ;; the fancy formatting. + (with-mode-local-symbol mm + (let ((semantic-format-use-images-flag nil) + (parent (and (class-p 'cogre-peer-semantic) + (cogre-peer-semantic-child-p peer) + (oref peer :tag)))) + (semantic-format-tag-uml-concise-prototype stoken parent t)))) + (error "Unknown element cogre-class node attribute or method."))) + +(defmethod cogre-node-slots ((class cogre-class)) + "Return a list of each section, including title, attributes, and methods. +Argument CLASS is the class whose slots are referenced." + (let ((detail (if (eieio-object-p cogre-graph) + (oref cogre-graph :detail) + 0))) + (cond + ((= detail 0) + ;; Show everything. + (list + (mapcar (lambda (s) (cogre-uml-stoken->uml class s)) (oref class methods)) + (mapcar (lambda (s) (cogre-uml-stoken->uml class s)) (oref class attributes)) + )) + ((= detail 3) + ;; Show nothing. + (list nil nil)) + ((memq detail '(1 2)) + ;; Strip out redundant entries from the method and attribute lists. + (let ((name (oref class :object-name)) + (attr (oref class attributes)) + (meth (oref class methods))) + ;; Heuristic 1 - Strip out anything with the same name as the + ;; class itself. + (setq meth (semantic--find-tags-by-function + (lambda (T) (not (string= (semantic-tag-name T) name))) + meth)) + ;; Heuristic 2 - For each attribute, strip out any method that + ;; is either a "get" or a "set" of that attribute. + ;; + ;; But only for "more detail" cases. In even less detail cases + ;; these methods need to stay when we strip out all the private + ;; data. + (when (= detail 1) + (let ((case-fold-search t)) + (dolist (A attr) + (let* ((tn (semantic-tag-name A)) + (c1 (substring tn 0 1)) + (str (substring tn 1)) + (reg (concat "[gs]et\\(" + (if (string= c1 "f") str tn) + "\\)"))) + (setq meth (semantic--find-tags-by-function + (lambda (T) (not (string-match reg (semantic-tag-name T)))) + meth)))))) + ;; Heuristic 3 - Strip out anything private or protected! + ;; But only if less detail is desired. +; (when (= detail 2) +; ;; @TODO +; nil +; ) + ;; Heuristic 4 - Get clever. + + (list + (mapcar (lambda (s) (cogre-uml-stoken->uml class s)) meth) + (mapcar (lambda (s) (cogre-uml-stoken->uml class s)) attr) + ) + ))))) + +;;;###autoload +(defclass cogre-instance (cogre-scoped-node) + ((name-default :initform "Instance") + (blank-lines-top :initform 1) + (blank-lines-bottom :initform 1) + (alignment :initform left) + ) + "An instance node. +Instances are used in instance diagrams. +Instances are linked together with plain links.") + +(defmethod cogre-node-title ((node cogre-instance)) + "Return a list of strings representing the title of the NODE. +For example: ( \"Title\" ) or ( \"\" \"Title\" )" + (let* ((prev (call-next-method)) + (name (concat ":" (oref node object-name)))) + (cogre-string-merge-faces 0 (length name) 'underline name) + (if (= (length prev) 1) + ;; It's just us. + (list name) + ;; Else, we probably have a package name. + (setcar (cdr prev) name) + prev))) + +;;; Links +;; +;;;###autoload +(defclass cogre-inherit (cogre-link) + ((end-glyph :initform [ (" ^ " "/_\\") + ("_|_" "\\ /" " V ") + (" /|" "< |" " \\|") + ("|\\ " "| >" "|/ ") ]) + (horizontal-preference-ratio :initform .1) + ) + "This type of link indicates that the two nodes reference infer inheritance. +The `start' node is the child, and the `end' node is the parent. +This is supposed to infer that START inherits from END.") + +;;;###autoload +(defclass cogre-aggregate (cogre-link) + ((start-glyph :initform [ ("/\\ " "\\/" ) + ("/\\ " "\\/" ) + ("<>") ("<>") ]) + (horizontal-preference-ratio :initform 1) + ) + "This type of link indicates aggregation. +The `start' node is the owner of the aggregation, the `end' node is +the item being aggregated. +This is supposed to infer that START contains END.") + +;;; UNICODE SUPPORT +;; + +;;;###autoload +(defun cogre-uml-enable-unicode () + "Enable use of UNICODE symbols to create COGRE graphs. +Inheritance uses math triangle on page 25a0. +Aggregation uses math square on edge 25a0. +Line-drawing uses line-drawing codes on page 2500. +See http://unicode.org/charts/symbols.html. + +The unicode symbols can be differing widths. This will make the +cogre chart a little screwy somteims. Your mileage may vary." + (interactive) + (oset-default cogre-inherit end-glyph + [ ("\u25b3") ("\u25bd") ("\u25c1") ("\u25b7") ]) + (oset-default cogre-aggregate start-glyph + [ ("\u2b25") ("\u2b25") ("\u25c6") ("\u25c6") ] ) + ;; Nice idea, but too small. Oh well. Maybe someone else + ;; can design something better. + (oset-default cogre-arrow end-glyph + [ ("\u2191") ("\u2193") ("\u2190") ("\u2192") ] ) + + ;; Set the special single-char << and >> thingies. + (let ((delim '( "\u226a" . "\u226b" ))) + (oset-default cogre-scoped-node package-delimiters delim) + ;; Note: I should use some sort of eieio looping to do this change. + (oset-default cogre-class package-delimiters delim) + (oset-default cogre-instance package-delimiters delim)) + + ;; "\u25c7" - open box like "\u25c6" + (setq picture-rectangle-v ?\u2502) + (setq picture-rectangle-h ?\u2500) + (setq picture-rectangle-ctl ?\u250C) + (setq picture-rectangle-ctr ?\u2510) + (setq picture-rectangle-cbl ?\u2514) + (setq picture-rectangle-cbr ?\u2518) + ) + +;;; SORTED TREE +;; +;; UML diagrams have an order to them. Producing a sorted tree is the +;; first step in producing code. +(defun cogre-nodes-linkedto (node links &optional slot) + "Return a list of nodes from linked to from NODE based on LINKS. +Optional SLOT is the slot to check in each LINK to see if it matches a node. +If SLOT is not supplied, then SLOT is :start." + (when (not slot) (setq slot :start)) + (let ((out nil) + (checkslot (or slot :start)) + (getslot (cond ((eq slot :start) + :end) + (t :start)))) + (dolist (L links) + (when (eq (eieio-oref L checkslot) node) + (push (eieio-oref L getslot) out)) + ) + out)) + +(defun cogre-nodes-all-in-list (checknodes refnodes) + "Are all nodes in CHECKNODES in the reference list of REFNODES." + (let ((ans t)) + (while (and checknodes ans) + (when (not (memq (car checknodes) refnodes)) + (setq ans nil)) + (setq checknodes nil)) + ans)) + +;;;###autoload +(defun cogre-uml-sort-for-lineage (g) + "Sort the current graph G for determining inheritance lineage. +Return it as a list of lists. Each entry is of the form: + ( NODE PARENT1 PARENT2 ... PARENTN)" + (interactive (list cogre-graph)) ;; Just hack it. + ;; For a typed language, we have several jobs to do before + ;; going to convert the individual nodes. + ;; + ;; 0) Collect all the classes and inheritance links. + ;; 1) Find all top-level nodes w/ no inherited parents. + ;; 2) For each of these nodes, generate the tag, then + ;; generate each node that is a subclass. + ;; 3) Generate for each sub-sub-class, and repeat. + (let ((nodes nil) (links nil) + (toplevelnodes nil) + (dumped nil) + (out nil) + count) + ;; 0 - Sort the elements. + (cogre-map-graph-elements + g (lambda (elt) (cond ((cogre-class-child-p elt) + (push elt nodes)) + ((cogre-inherit-child-p elt) + (push elt links)) + ))) + ;; 1 - Find toplevel nodes. + (mapc (lambda (node) + (when (not (object-assoc node :start links)) + (push node toplevelnodes))) + nodes) + ;; 2 - Go over each toplevel node, and generate + (dolist (TL toplevelnodes) + (push TL dumped) + (push (list TL) out) + (setq nodes (delq TL nodes)) + ) + ;; 3 - Loop over the remaining nodes until there are none left, + ;; and all have been dumped. + (setq count (length nodes)) + (while nodes + (mapc (lambda (node) + (let ((parents (cogre-nodes-linkedto node links))) + ;; If all parents have already been dumped, then we can + ;; dump NODE. + (when (cogre-nodes-all-in-list parents dumped) + (push node dumped) + (push (cons node parents) out) + (setq nodes (delq node nodes))) + )) + nodes) + (when (= count (length nodes)) + (error "Possible graph inheritance recursion")) + (setq count (length nodes)) + ) + ;; DONE + (setq out (nreverse out)) + ;; 4) Dump if in interactive mode. + (when (interactive-p) + ;; Dump the output. + (data-debug-show-stuff out "SortedInheritanceNodes")) + out)) + +(provide 'cogre-uml) + +;;; cogre-uml.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre-utest.el b/site/cedet-1.0pre7/cogre/cogre-utest.el new file mode 100644 index 0000000..4c72a22 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre-utest.el @@ -0,0 +1,142 @@ +;;; cogre-utest.el --- Tests for COGRE + +;; Copyright (C) 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cogre-utest.el,v 1.10 2009/04/11 06:54:19 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Unit tests for COGRE. +;; +;; These are effectively no-crash and UI tests. I have not output tests. + +(require 'cedet-utests) +(eval-when-compile + (require 'picture-hack)) +(require 'cogre) +(require 'cogre-mode) + +;;; Code: + +;;;###autoload +(defun cogre-utest () + "Unit test Various aspects of COGRE." + (interactive) + + ;(cedet-utest-log-start "cogre: graph UI tests") + (cedet-utest-log-setup "COGRE") + + ;; MAKE A GRAPH + (cogre "TEST GRAPH") + + (when (not (string= "*Graph TEST GRAPH*" (buffer-name))) + (error "Failed to create graph")) + + (cedet-utest-log " * Create graph ... pass") + + ;; MAKE SEVERAL NODES + (cogre-utest-make-node-at 2 2 'cogre-class "Obj 1") + (cogre-utest-make-node-at 12 12 'cogre-class "Obj 2") + + (cogre-render-buffer cogre-graph) + + (cedet-utest-log " * Create Nodes ... pass") + + ;; Create a link. + (cogre-utest-link-at 2 2 12 12 'cogre-aggregate) + + (cogre-render-buffer cogre-graph) + + (cedet-utest-log " * Create links ... pass") + + ;; Move Test + (picture-goto-coordinate 12 12) + + (let ((six '(1 2 3 4 5 6))) + (dolist (I six) + (cogre-move-node-right 1) + (cogre-render-buffer cogre-graph) + (sit-for 0) + ) + (dolist (I six) + (cogre-move-node-up 1) + (cogre-render-buffer cogre-graph) + (sit-for 0) + ) + ) + + (cedet-utest-log " * Node Movement ... pass") + + (cedet-utest-log-shutdown + "COGRE" + nil) + ) + +(defun cogre-utest-make-node-at (x y type name) + "Create a node at X,Y with TYPE and NAME." + (picture-goto-coordinate x y) + (let ((cogre-default-node type)) + (call-interactively 'cogre-new-node) + (cogre-render-buffer cogre-graph) + (cogre-set-element-name (cogre-node-at-point-interactive (point)) name) + ) + ) + +(defun cogre-utest-link-at (x1 y1 x2 y2 type) + "Create a link between nodes located at X1/Y1 and X2/Y2. +Link is created with the specified TYPE." + (picture-goto-coordinate x1 y1) + (push-mark (point) t) + (let ((cogre-default-link type)) + (picture-goto-coordinate x2 y2) + + (call-interactively 'cogre-new-link) + )) + +;;; Test graphs derived from source +;; +;;;###autoload +(defun cogre-utest-quick-class () + "Test the quick-class function." + (interactive) + (let* ((lib (locate-library "cogre")) + (testfile + (expand-file-name "tests/testclasses.hh" + (file-name-directory lib)))) + (save-excursion + (set-buffer (find-file-noselect testfile)) + (semantic-fetch-tags) + (cogre-uml-quick-class "Subclass") + ;; Make sure we are in a graph. + (unless (cogre-base-graph-p cogre-graph) + (error "Test cogre-uml-quick-class did not createa graph")) + ;; Test the elements of the graph. + (let ((expectednodes '("Subclass" + "MyBaseclass" + "SpecificClass" + "OtherClass" + "AltClass"))) + (dolist (C expectednodes) + (unless (cogre-find-node-by-name C) + (error "Could not find expected node %S" C))) + )))) + + +(provide 'cogre-utest) +;;; cogre-utest.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre.el b/site/cedet-1.0pre7/cogre/cogre.el new file mode 100644 index 0000000..03eb67a --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre.el @@ -0,0 +1,1119 @@ +;;; cogre.el --- COnnected GRaph Editor for Emacs + +;;; Copyright (C) 2001, 2002, 2003, 2005, 2007, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; Keywords: graph, oop, extensions, outlines +;; X-RCS: $Id: cogre.el,v 1.45 2009/05/30 13:40:42 zappo Exp $ + +(defvar cogre-version "1.0pre7" + "Current version of Cogre.") + +;; This file is not part of GNU Emacs. + +;; This is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Many types of code can be displayed as a series of connected +;; graphs, such as UML class or sequence diagrams. COGRE attempts to +;; allow Emacs to display such graphs with data generated from +;; source code. +;; + +(require 'eieio) +(require 'eieio-opt) +(require 'eieio-base) +(require 'cogre-load) +(require 'semantic) +(eval-when-compile + (require 'picture-hack)) + +;;; Code: + +;;; Display Faces +(defgroup cogre nil + "COnnected GRaph Editor." + :group 'tools) + +(defcustom cogre-horizontal-margins 10 + "*Horizontal margins between nodes when they are being layed out." + :group 'cogre + :type 'number) + +(defcustom cogre-vertical-margins 7 + "*Horizontal margins between nodes when they are being layed out." + :group 'cogre + :type 'number) + +;; Export Variables +(defvar cogre-node-rebuild-method nil + "A method used when exporting a graph to some other format.") + +;; Compatibility +(defun cogre-noninteractive () + "Return non-nil if running non-interactively." + (if (featurep 'xemacs) + (noninteractive) + noninteractive)) + +;;; PEER Classes +;; +;; Each cogre element, and the graph is an abstract representation of +;; something. The peer would then be an object that handles a +;; concrete represenatation of something else. +;; +;; For example, a `note' node might be linked to a comment in some +;; code. Updating the node should update the file or updating the +;; file should update the node. +;; +;; As the different types of nodes might be linked to different kinds +;; of things, an abstract handler for peers is needed so COGRE can do +;; many kinds of jobs. + +(defclass cogre-element-peer () + ( + ) + "COGRE Elements, such as nodes an links all have a peer. +While graph elements can have a nil peer, if there is one, it +must be a subclass of this class. + +The peer provides services to the graph that allows that graph +to be linked to other items in the system defined by the peers. +Subclasses should define slots to store their data." + :abstract t) + +(defmethod cogre-peer-update-from-source ((peer cogre-element-peer) element) + "Update the PEER object, and ELEMENT from environment." + nil) + +(defmethod cogre-peer-update-from-element ((peer cogre-element-peer) element) + "Update the PEER object, from the ELEMENT data, changing the environment." + nil) + +(defmethod cogre-peer-source-file ((peer cogre-element-peer)) + "Does this peer have a source file?" + nil) + +;;; GRAPH Classes +;; +;;;###autoload +(defclass cogre-base-graph (eieio-persistent) + ((extension :initform ".cgr") ;; Override the default + (name :initarg :name + :initform "NewGraph" + :type string + :custom string + :documentation + "The name of this graph. +The save file name is based on this name.") + (buffer :initform nil + :type (or null buffer) + :documentation + "When this graph is active, this is the buffer the graph is +displayed in.") + (peer :initarg :peer + :initform nil + :type (or null cogre-element-peer) + :documentation + "The peer for this graph.") + (major-mode :initarg :major-mode + :initform fundamental-mode + :type symbol + :custom (choice (const emacs-lisp-mode) + (const c++-mode) + (const c-mode) + (const java-mode) + ;; Any other useful modes? + (symbol) + ) + :documentation + "Mode used for any mode-specific function calls. +Used when calling some mode-local functions.") + (detail :initarg :detail + :initform 0 + :type number + :custom (choice (const :tag "Max Detail" 0 ) + (const :tag "Less Detail" 1 ) + (const :tag "Not Much Detail" 2 ) + (const :tag "No Detail" 3 )) + :documentation + "A flag for items being rendered on how much detail to show. +A 0 means to show everything. +A 1 means to show a little bit less. +A 2 means to show less than that. +A 3 means just the package and name.") + (elements :initarg :elements + :initform nil + :type list + :documentation + "The list of elements in this graph.") + ) + "A Connected Graph. +a connected graph contains a series of nodes and links which are +rendered in a buffer, or serialized to disk.") + +(defmethod initialize-instance ((G cogre-base-graph) fields) + "Initialize ELT's name before the main FIELDS are initialized." + (call-next-method) + (oset G buffer (current-buffer)) + ) + +;;;###autoload +(defclass cogre-graph-element (eieio-named) + ((dirty :initform t + :documentation + "Non-nil if this graph element is dirty. +Elements are made dirty when they are erased from the screen. +Elements must be erased before any graphical fields are changed.") + (name-default :initform "Name" + :type string + :custom string + :allocation :class + :documentation + "The object-name of this node. +Node object-names must be unique within the current graph so that save +references in links can be restored.") + (peer :initarg :peer + :initform nil + :type (or null cogre-element-peer) + :documentation + "The peer for this graph.") + ) + "A Graph Element. +Graph elements are anything that is drawn into a `cogre-base-graph'. +Graph elements have a method for marking themselves dirty." + :abstract t) + +;;;###autoload +(defclass cogre-node (cogre-graph-element) + ((position :initarg :position + :initform [ 0 0 ] + :type vector + :custom (vector integer integer) + :documentation + "The X,Y [COL ROW] position as a vector for this node. +The Width/Height if this node is determined by RECTANGLE, which is +a list of strings representing the body of the node." + ) + (blank-lines-top :allocation :class + :initform 1 + :documentation + "Number of blank lines above the object-name.") + (blank-lines-bottom :allocation :class + :initform 1 + :documentation + "Number of blank lines below the last line of text.") + (alignment :initform nil + :type symbol + :allocation :class + :documentation + "Alignment of text when displayed in the box.") + (rectangle :initform nil + :type list + :documentation + "A List of strings representing an Emacs rectangle. +This rectangle is used for inserting and moving the block of +characters that represent this node in a buffer. +The rectangle is NOT SAVED. +Other fields in the node are used to build a new RECTANGLE of strings +at load time.") + ) + "Connected Graph node. +Nodes are regions with a fill color, and some amount of text representing +a status, or values." + ) + +;;;###autoload +(defclass cogre-link (cogre-graph-element) + ((start :initarg :start + :initform nil + :type (or null string cogre-node) + :documentation "The starting node. +As a string, the object-name of the node we start on. +As an object, the node we start on.") + (end :initarg :end + :initform nil + :type (or null string cogre-node) + :documentation "The ending node. +As a string, the object-name of the node we end on. +As an object, the node we end on.") + (start-glyph :initform [ nil nil nil nil ] + :allocation :class + :type vector + :documentation "The starting glyph. +A Glyph can be NULL, meaning nothing, or a vector. +A Vector must be 4 elements long. This represents glyphs on +the [ TOP BOTTOM LEFT RIGHT ] of the attached node. +Each element of the vector must be a list representing a rectangle.") + (end-glyph :initform [ nil nil nil nil ] + :allocation :class + :type vector + :documentation "The ending glyph. +See slot `start-glyph'") + (horizontal-preference-ratio + :initform .5 + :allocation :class + :documentation + "When choosing a link's direction, a weight applied to horizontal. +Since characters are not square, this ratio attempts to handle the visible +space the link spans, not the number of characters in the coordinate +system being used. +Also, some links may want to be vertical or horizontal as often as +possible, thus values of 0 or 10 are also fine to advance a +preference." ) + (stop-position :initform nil + :documentation + "After drawing this link, store a place for a tab stop.") + (layout-direction + :initform 'any + :documentation + "When using the layout engine, the preferred direction this link points. +This can have a value of 'up, 'down, 'left, 'right, 'horizontal, +'vertical, or 'any.") + ) + "Connected Graph link. +Links are lines drawn between two nodes, or possibly loose in space +as an intermediate step. Some links have text describing what they +do, and most links have special markers on one end or another, such as +arrows or circles.") + +;;; Links +;; +;;;###autoload +(defclass cogre-arrow (cogre-link) + ((end-glyph :initform [ (" ^ " "/|\\") + ("\\|/" " V ") + ("<") + (">") ]) + ) + "This type of link is a simple arrow.") + +;;; Connecte Graph variables +;; +(defvar cogre-loading-from-file nil + "Flag indicating that we are loading a graph from a file.") + +(defcustom cogre-mode-hooks nil + "Hooks run in `cogre-mode'." + :group 'cogre + :type 'hook) + +(defvar cogre-graph nil + "The current connected graph.") +(make-variable-buffer-local 'cogre-graph) + +;;; Buffer initialization +;; +;;;###autoload +(defun cogre (name &optional graph-class) + "Create a new graph not associated with a buffer. +The new graph will be given NAME. See `cogre-mode' for details. +Optional argument GRAPH-CLASS indicates the type of graph to create." + (interactive "sGraph Name: ") + (switch-to-buffer (get-buffer-create (concat "*Graph " name "*"))) + (let ((newgraph (if graph-class + (funcall graph-class name :name name) + (cogre-base-graph name :name name)))) + (setq cogre-graph newgraph) + ;;(toggle-read-only 1) + (require 'cogre-mode) + (cogre-mode) + )) + +;;; Default management +;; +;; Defaults provide a way of quickly creating a bunch of the same type +;; of node/link, or whatever. By using these functions in `interactive' +;; commands, a set of defaults can be specified which are used +;; continuously. +(defun cogre-last-event-element-type (class) + "Return a symbol representing the last event or command. +Return nil if that event is not related to some cogre element +that is a subclass of CLASS." + (let* ((event last-command-event) + (ksym (if (symbolp event) + (downcase (symbol-name event)) + "unknown")) + (name (concat "cogre-" ksym)) + (sym (intern-soft name))) + (if (and sym (child-of-class-p sym class)) + ;; The input key defines the type of node to use this time. + sym + ;; No match + nil))) + +(defvar cogre-node-history nil + "The history for reading in node class names.") + +(defvar cogre-default-node nil + "The last node type queried. +Used as the default node type when a user wants a node, and no request +to change it has been made.") + +(defun cogre-default-node (&optional node prefix) + "Return the default node type. +If run interactively, query for a new node to make the default. +If called non-interactivly there is no default, query for one. +If NODE is supplied, use that. +If there is a PREFIX argument, then force a query for one." + (interactive (list + + ;; Check the last key. Fake keys from toolbar/menu-bar can + ;; force our hand for some node types. + (or (cogre-last-event-element-type cogre-node) + ;; ELSE, read it in. + (eieio-read-subclass "Node Type: " + cogre-node + 'cogre-node-history + t)) + ;; The prefix + current-prefix-arg)) + + (when (and (not (interactive-p)) (not node) (symbolp last-command-event)) + ;; Check the last key. Fake keys from toolbar/menu-bar can + ;; force our hand for some node types. + (let ((sym (cogre-last-event-element-type cogre-node))) + ;; The input key defines the type of node to use this time. + (when sym (setq node sym)))) + + ;; Save whatever is being set. + (if node (setq cogre-default-node node)) + ;; If we are not interactive, then check the prefix. + (if (or prefix (not cogre-default-node)) + (setq cogre-default-node (eieio-read-subclass "Node Type: " + cogre-node + 'cogre-node-history + t))) + ;; Return the cached node. + cogre-default-node + ) + +(defvar cogre-link-history nil + "The history for reading in link class names.") + +(defvar cogre-default-link nil + "The last link type queried. +Used as the default link type when a user wants a link, and no request +to change it has been made.") + +(defun cogre-default-link (&optional link prefix) + "Return the default link type. +If run interactively, query for a new link to make the default. +If called non-interactivly there is no default, query for one. +If LINK is supplied, use that. +If there is a PREFIX argument, then force a query for one." + (interactive (list + ;; Check the last key. Fake keys from toolbar/menu-bar can + ;; force our hand for some link types. + (or (cogre-last-event-element-type cogre-link) + ;; Else, read it in. + (eieio-read-subclass "Link Type: " + cogre-link + 'cogre-link-history + t)) + current-prefix-arg)) + + (when (and (not (interactive-p)) (not link) (symbolp last-command-event)) + ;; Check the last key. Fake keys from toolbar/menu-bar can + ;; force our hand for some link types. + (let ((sym (cogre-last-event-element-type cogre-link))) + (when sym (setq link sym)))) + + ;; Save whatever is being set. + (if link (setq cogre-default-link link)) + ;; If we are not interactive, then check the prefix. + (if (or prefix (not cogre-default-link)) + (setq cogre-default-link (eieio-read-subclass "Link Type: " + cogre-link + 'cogre-link-history + t))) + ;; Return the cached link. + cogre-default-link + ) + +;;; Commands for Graph Mode +;; +(defun cogre-refresh () + "Refresh the current display completely." + (interactive) + (cogre-render-buffer cogre-graph t)) + +;;; Utilities +;; +(defun cogre-map-elements (function &optional graph) + "Map FUNCTION onto all GRAPH elements. +If GRAPH is not supplied, use the current graph." + (cogre-map-graph-elements (or graph cogre-graph) function)) + +(defun cogre-map-graph-elements (graph function) + "For elements of GRAPH, call FUNCTION. +Function must take one argument, which is the element. +This function can also be a method. +Returns a list of return values from each call of function." + (mapcar function (oref graph elements))) + +;;; Peer handling +;; +(defun cogre-update-graph-from-peers (graph) + "Update GRAPH, and all elements from any source peers." + ;; First, update the graph... + (let ((peer (oref graph peer))) + (when peer (cogre-peer-update-from-source peer graph))) + ;; Now update all the elements. + (cogre-map-graph-elements + graph (lambda (E) + (let ((peer (oref E peer))) + (when peer (cogre-peer-update-from-source peer E))))) + ) + +;;; State Management +;; +(defvar cogre-custom-originating-graph-buffer nil + "The graph from which a custom buffer originated.") +(make-variable-buffer-local 'cogre-custom-originating-graph-buffer) + +(defmethod cogre-activate ((element cogre-graph-element)) + "Activate ELEMENT. +This could be as simple as displaying the current state, +customizing the object, or performing some complex task." + (let ((b (current-buffer))) + (require 'eieio-custom) + (customize-object element) + (setq cogre-custom-originating-graph-buffer b)) + ) + +(defmethod eieio-done-customizing ((element cogre-graph-element)) + "Finish customizing a graph element." + (cogre-set-dirty element t) + (save-excursion + (set-buffer cogre-custom-originating-graph-buffer) + (cogre-render-buffer cogre-graph t)) + ) + +(defmethod eieio-done-customizing ((g cogre-base-graph)) + "Finish customizing a graph element." + (save-excursion + (set-buffer cogre-custom-originating-graph-buffer) + (cogre-render-buffer g t)) + ) + +(defmethod cogre-augment-element-menu ((node cogre-graph-element) menu) + "For NODE, augment the current element MENU. +Return the modified element." + nil) + +(defmethod cogre-augment-element-menu ((node cogre-node) menu) + "For NODE, augment the current element MENU. +Return the modified element." nil) + +(defmethod cogre-add-element ((graph cogre-base-graph) elt) + "Add to GRAPH a new element ELT." + (object-add-to-list graph 'elements elt t)) + +(defmethod cogre-delete-element ((graph cogre-base-graph) elt) + "Delete from GRAPH the element ELT." + (object-remove-from-list graph 'elements elt)) + +(defun cogre-find-node-by-name (name &optional graph) + "Find a cogre node by NAME in GRAPH. +If GRAPH is nil, use the current graph." + (object-assoc name :object-name (oref (or graph cogre-graph) elements))) + +(defmethod cogre-unique-name ((graph cogre-base-graph) name) + "Within GRAPH, make NAME unique." + (let ((newname name) + (obj (cogre-find-node-by-name name graph)) + (inc 1)) + (while obj + (setq newname (concat name (int-to-string inc))) + (setq inc (1+ inc)) + (setq obj (cogre-find-node-by-name newname graph))) + newname)) + +(defmethod cogre-set-dirty ((element cogre-graph-element) dirty-state) + "Set the dirty state for ELEMENT to DIRTY-STATE." + (oset element dirty dirty-state)) + +(defmethod cogre-set-dirty ((node cogre-node) dirty-state) + "Set the dirty state for NODE to DIRTY-STATE." + (if dirty-state (oset node rectangle nil)) + (call-next-method)) + +(defmethod initialize-instance ((elt cogre-graph-element) fields) + "Initialize ELT's name before the main FIELDS are initialized." + (unless cogre-loading-from-file + (let ((n (oref elt name-default))) + (object-set-name-string elt n))) + (call-next-method)) + +(defmethod initialize-instance :AFTER ((elt cogre-graph-element) fields) + "When creating a new element, add it to the current graph. +Argument ELT is the element being created. +Argument FIELDS are ignored." + (unless cogre-loading-from-file + (let ((n (oref elt object-name))) + ;; make sure our name is unique. + (oset elt object-name (cogre-unique-name cogre-graph n))) + (cogre-add-element cogre-graph elt))) + +;;; Buffer Rendering +;; +(defmethod cogre-render-buffer ((graph cogre-base-graph) &optional erase) + "Render the current graph GRAPH. +If optional argument ERASE is non-nil, then erase the buffer, +and render everything. If ERASE is nil, then only redraw items +with dirty flags set." + (let ((inhibit-read-only t) + (inhibit-modification-hooks t) + (inhibit-point-motion-hooks t) + (x (current-column)) + (y (1- (picture-current-line))) + (oldmod (buffer-modified-p (current-buffer))) + ) + (save-excursion + (if erase + (progn + (erase-buffer) + (cogre-map-elements (lambda (e) (cogre-set-dirty e t)) graph))) + (cogre-map-elements 'cogre-render graph)) + (unless oldmod (set-buffer-modified-p nil)) + (picture-goto-coordinate x y))) + +(defmethod cogre-render ((element cogre-graph-element)) + "Render ELEMENT. +By default, an ELEMENT has nothing to see, but assume we +are called from `call-next-method', so reset our dirty flag." + (cogre-set-dirty element nil)) + +(defmethod cogre-erase ((element cogre-graph-element)) + "Erase ELEMENT. +By default, an ELEMENT has nothing to erase, but assume we +are called from `call-next-method', so set our dirty flag." + (cogre-set-dirty element t)) + +(defmethod cogre-element-pre-serialize ((elt cogre-graph-element)) + "Prepare the current node to be serialized. +Remove all pointers to objects (such as links), and replace +with something reversable." + ) + +(defmethod cogre-element-post-serialize ((elt cogre-graph-element)) + "Restore object pointers after being loaded from disk. +Also called after a graph was saved to restore all objects. +Reverses `cogre-graph-pre-serialize'." + ) + +(defmethod cogre-entered ((element cogre-graph-element) start end) + "Method called when the cursor enters ELEMENT. +START and END cover the region with the property." + nil) + +(defmethod cogre-left ((element cogre-graph-element) start end) + "Method called when the cursor exits ELEMENT. +START and END cover the region with the property." + nil) + +;;; Nodes +(defmethod cogre-erase ((node cogre-node)) + "Erase NODE from the screen." + (let ((position (oref node position)) + (rectangle (cogre-node-rectangle node)) + (links (cogre-node-links node))) + (cogre-erase-rectangle (aref position 0) (aref position 1) + (length (car rectangle)) + (length rectangle)) + (mapc 'cogre-erase links)) + (call-next-method)) + +(defmethod cogre-node-links ((node cogre-node)) + "Return a list of links which reference NODE." + (with-slots (elements) cogre-graph + (let ((links nil)) + (mapc (lambda (n) (if (and (obj-of-class-p n cogre-link) + (or (eq (oref n start) node) + (eq (oref n end) node))) + (setq links (cons n links)))) + elements) + links))) + +(defmethod cogre-node-rectangle ((node cogre-node)) + "Fetch the rectangle representation for NODE." + (or (oref node rectangle) + (cogre-node-rebuild node))) + +(defmethod cogre-render ((node cogre-node)) + "Render NODE in the current graph." + (cogre-node-rectangle node) + (with-slots (position rectangle) node + (picture-goto-coordinate (aref position 0) (aref position 1)) + (cogre-picture-insert-rectangle rectangle) + ) + (call-next-method)) + +(defmethod cogre-node-rebuild ((node cogre-node)) + "Create a new value for `:rectangle' in NODE. +The `:rectangle' slot is inserted with rectangle commands. +A Rectangle is basically a list of equal length strings. +Those strings must have the proper face values on them. +Always make the width 2 greater than the widest string. + +This function calls `cogre-node-rebuild-default', unless the +current output device has been changed with by +setting``cogre-node-rebuild-method'." + (if cogre-node-rebuild-method + (funcall cogre-node-rebuild-method node) + (cogre-node-rebuild-default node))) + +(defmethod cogre-node-rebuild-default ((node cogre-node)) + "Create a new value for `:rectangle' in NODE. +The `:rectangle' slot is inserted with rectangle commands. +A Rectangle is basically a list of equal length strings. +Those strings must have the proper face values on them. +Always make the width 2 greater than the widest string." + (let* ((width (+ (cogre-node-widest-string node) 2)) + (top-lines (oref node blank-lines-top)) + (bottom-lines (oref node blank-lines-bottom)) + (title (cogre-node-title node)) + (slots (cogre-node-slots node)) + (align (oref node alignment)) + (first t) + (rect nil)) + (while (> top-lines 0) + (setq rect (cons (cogre-string-with-face + "" + (if first + (progn (setq first nil) + 'cogre-box-first-face) + 'cogre-box-face) + node width align) + rect) + top-lines (1- top-lines))) + (while title + (let ((face (cond ((and first (null (cdr title))) + (setq first nil) + '(cogre-box-first-face cogre-box-last-face)) + (first + (setq first nil) + 'cogre-box-first-face) + ((and (null (cdr title)) + (not (and (null slots) + (/= bottom-lines 0)))) + 'cogre-box-last-face) + (t 'cogre-box-face)))) + (setq rect (cons (cogre-string-with-face + (car title) face + node width align) + rect) + title (cdr title)))) + (while slots + (let ((sl (car slots))) + ;; If a subnode has nil here, make sure we put in a blank + ;; line placeholder. + (if (not sl) (setq sl (list ""))) + (while sl + (let ((face (cond ((and (= bottom-lines 0) + (null (cdr sl))) + 'cogre-box-last-face) + (t 'cogre-box-face)))) + (setq rect (cons (cogre-string-with-face + (car sl) face + node width align) + rect) + sl (cdr sl))))) + (setq slots (cdr slots))) + (while (> bottom-lines 0) + (setq rect (cons (cogre-string-with-face + "" + (if (= bottom-lines 1) + 'cogre-box-last-face + 'cogre-box-face) + node width align) + rect) + bottom-lines (1- bottom-lines))) + (oset node rectangle (nreverse rect)))) + +(defmethod cogre-move-delta ((node cogre-node) dx dy) + "Move NODE's position by DX, DY." + (let ((p (oref node position))) + (cogre-move node (+ (aref p 0) dx) (+ (aref p 1) dy)))) + +(defmethod cogre-move ((node cogre-node) x y) + "Move NODE to position X, Y." + (if (> 0 x) (setq x 0)) + (if (> 0 y) (setq y 0)) + (oset node position (vector x y)) + ) + +(defmethod cogre-node-title ((node cogre-node)) + "Return a list of strings representing the title of the NODE. +For example: ( \"Title\" ) or ( \"\" \"Title\" )" + (list (oref node object-name))) + +(defmethod cogre-node-slots ((node cogre-node)) + "For NODE, return a list of slot lists. +Slots are individual lines of text appearing in the body of a node. +Each list will be prefixed with a line before it." + nil) + +(defmethod cogre-node-widest-string ((node cogre-node)) + "Return the widest string in NODE." + (let ((names (cogre-node-title node)) + (slots (cogre-node-slots node)) + (str nil) + (ws 0)) + (while names + (setq str (car names)) + (when (> (length str) ws) + (setq ws (length str))) + (setq names (cdr names))) + (while slots + (setq str (car slots)) + (while str + (if (> (length (car str)) ws) + (setq ws (length (car str)))) + (setq str (cdr str))) + (setq slots (cdr slots))) + ws)) + + +(defun cogre-node-horizontal-distance (node1 node2) + "Calculate the horizontal distance between NODE1 and NODE2. +This number is positive or negative, depending on the direction +of distance." + ;; Make sure their rectangle's are up to date. + (cogre-node-rebuild node1) + (cogre-node-rebuild node2) + ;; Get all the details + (let* ((p1 (oref node1 position)) ;position vector + (p2 (oref node2 position)) + (x1 (aref p1 0)) ;X,Y for NODE1 + (x2 (aref p2 0)) ;X,Y for NODE2 + ) + (if (< x1 x2) + ;; positive distance. + (- x2 x1 (length (car (cogre-node-rectangle node1)))) + (- x1 x2 (length (car (cogre-node-rectangle node2)))) + ))) + +(defun cogre-node-vertical-distance (node1 node2) + "Calculate the vertical distance between NODE1 and NODE2. +This number is positive or negative, depending on the direction +of distance." + ;; Make sure their rectangle's are up to date. + (cogre-node-rebuild node1) + (cogre-node-rebuild node2) + ;; Get all the details + (let* ((p1 (oref node1 position)) ;position vector + (p2 (oref node2 position)) + (y1 (aref p1 1)) ;X,Y for NODE1 + (y2 (aref p2 1)) ;X,Y for NODE2 + ) + (if (< y1 y2) + ;; positive distance. + (- y2 y1 (length (cogre-node-rectangle node1))) + (- y1 y2 (length (cogre-node-rectangle node2))) + ))) + +(defun cogre-choose-horizontal-link-anchors (node1 node2) + "Choose horizontal link anchor points between NODE1 and NODE2. +The data returned is (X1 Y1 X2 Y2)." + (let* ((p1 (oref node1 position)) ;position vector + (p2 (oref node2 position)) + (x1 (aref p1 0)) ;X,Y for START + (y1 (aref p1 1)) + (x2 (aref p2 0)) ;X,Y for END + (y2 (aref p2 1)) + (r1 (cogre-node-rectangle node1)) ;rectangle text + (r2 (cogre-node-rectangle node2)) + (h1 (length r1)) ;Height + (h2 (length r2)) + (w1 (length (car r1))) ;Width + (w2 (length (car r2))) + ) + (if (< x1 x2) + (list (+ x1 w1) (+ y1 (/ h1 2)) (1- x2) (+ y2 (/ h2 2))) + (list (1- x1) (+ y1 (/ h1 2)) (+ x2 w2) (+ y2 (/ h2 2)))) + )) + +(defun cogre-choose-vertical-link-anchors (node1 node2) + "Choose vertical link anchor points between NODE1 and NODE2. +The data returned is (X1 Y1 X2 Y2)." + (let* ((p1 (oref node1 position)) ;position vector + (p2 (oref node2 position)) + (x1 (aref p1 0)) ;X,Y for START + (y1 (aref p1 1)) + (x2 (aref p2 0)) ;X,Y for END + (y2 (aref p2 1)) + (r1 (cogre-node-rectangle node1)) ;rectangle text + (r2 (cogre-node-rectangle node2)) + (h1 (length r1)) ;Height + (h2 (length r2)) + (w1 (length (car r1))) ;Width + (w2 (length (car r2))) + ) + (if (< y1 y2) + (list (+ x1 (/ w1 2)) (+ y1 h1) (+ x2 (/ w2 2)) (1- y2)) + (list (+ x1 (/ w1 2)) (1- y1) (+ x2 (/ w2 2)) (+ y2 h2))) + )) + +;;; Links +;; +(defmethod cogre-element-pre-serialize ((link cogre-link)) + "Prepare the current node to be serialized. +Remove all pointers to objects (such as links), and replace +with something reversable." + (call-next-method) + ;; Remove the node objects from ourselves, and remove ourselves + ;; from the nodes we point to. + (with-slots (start end) link + (setf start (oref start :object-name)) + (setf end (oref end :object-name)) + ) + ) + +(defmethod cogre-element-post-serialize ((link cogre-link)) + "Restore object pointers in LINK after being loaded from disk. +Also called after a graph was saved to restore all objects. +Reverses `cogre-graph-pre-serialize'." + (call-next-method) + ;; Convert the textual names back to object references from the + ;; current graphs element list. + (with-slots (start end) link + (setf start + (object-assoc start :object-name (oref cogre-graph elements))) + (setf end + (object-assoc end :object-name (oref cogre-graph elements))) + ) + ) + +(defvar cogre-erase-mode nil + "Non nil means we are in erase mode while rendering this link.") + +(defmethod cogre-erase ((link cogre-link)) + "Erase LINK from the screen." + (let ((picture-rectangle-ctl ? ) + (picture-rectangle-ctr ? ) + (picture-rectangle-cbl ? ) + (picture-rectangle-cbr ? ) + (picture-rectangle-v ? ) + (picture-rectangle-h ? )) + ;; Links use picture line drawing teqnique to wander about. + ;; By setting the picture line characters to spaces, we can + ;; erase the line with the render command. + (let ((cogre-erase-mode t)) + (cogre-render link)) + (call-next-method))) + +(defmethod cogre-render ((link cogre-link)) + "Render LINK in the current graph." + (with-slots (start end start-glyph end-glyph) link + (let* ((hd (cogre-node-horizontal-distance start end)) + (vd (cogre-node-vertical-distance start end)) + linkcoords + dir + ) + ;; Calculate starting points in relation to our attached nodes. + (if (> (* hd (oref link horizontal-preference-ratio)) vd) + ;; In this case, the X delta is larger than the Y delta, + ;; so the line is going mostly left/right. + (setq linkcoords (cogre-choose-horizontal-link-anchors start end) + dir 'horizontal) + (setq linkcoords (cogre-choose-vertical-link-anchors start end) + dir 'vertical)) + (oset link stop-position (list (car linkcoords) (car (cdr linkcoords)))) + ;; Now draw a rectiliniar line + (apply 'picture-draw-rectilinear-line + (append linkcoords (list dir 'face nil 'element link))) + ;; Handle start/end glyps. + (if (and (not start-glyph) (not end-glyph)) + ;; We need to do nothing if we have no glyphs. + nil + (let* (startrect endrect x1 y1 x2 y2) + ;; Calculate the modificates needed to the end points for + ;; creating the textual glyph. + (setq x1 (nth 0 linkcoords) + y1 (nth 1 linkcoords) + x2 (nth 2 linkcoords) + y2 (nth 3 linkcoords)) + (if (eq dir 'horizontal) + (progn + (if (< x1 x2) + (setq startrect (aref start-glyph 2) + endrect (aref end-glyph 3) + x2 (- x2 -1 (length (car endrect)))) + (setq startrect (aref start-glyph 3) + endrect (aref end-glyph 2) + x1 (- x1 -1 (length (car startrect))))) + (setq y1 (- y1 (/ (length startrect) 2)) + y2 (- y2 (/ (length endrect) 2)))) + (if (< y1 y2) + (setq startrect (aref start-glyph 0) + endrect (aref end-glyph 1) + y2 (- y2 -1 (length endrect))) + (setq startrect (aref start-glyph 1) + endrect (aref end-glyph 0) + y1 (- y1 -1 (length startrect)))) + (setq x1 (- x1 (/ (length (car startrect)) 2)) + x2 (- x2 (/ (length (car endrect)) 2)))) + ;; Ok, splat the glyph + (if cogre-erase-mode + (progn + (when startrect + (cogre-erase-rectangle x1 y1 + (length (car startrect)) + (1- (length startrect)))) + (when endrect + (cogre-erase-rectangle x2 y2 + (length (car endrect)) + (1- (length endrect)))) + ) + (picture-goto-coordinate x1 y1) + (cogre-picture-insert-rectangle startrect) + (picture-goto-coordinate x2 y2) + (cogre-picture-insert-rectangle endrect) + ) + )))) + (call-next-method)) + +;;; Files +;; +;; Save and restore graphs to disk + +(defmethod cogre-save ((graph cogre-base-graph)) + "Save the current graph." + (cogre-map-elements 'cogre-element-pre-serialize graph) + (unwind-protect + (eieio-persistent-save graph) + (cogre-map-elements 'cogre-element-post-serialize graph)) + t) + +(defmethod cogre-write-save-text ((graph cogre-base-graph)) + "Write GRAPH to standard-output as save text." + (cogre-map-elements 'cogre-element-pre-serialize graph) + (unwind-protect + (object-write graph (oref cogre-graph file-header-line)) + (cogre-map-elements 'cogre-element-post-serialize graph)) + t) + +;;; Low Level Rendering and status +;; +(defun cogre-string-merge-faces (start end face string) + "Merge in new face with pre-existing faces on the string. +START and END are positions to apply FACE in STRING." + (alter-text-property start end 'face + (lambda (current-face) + (let ((cf + (cond ((facep current-face) + (list current-face)) + ((listp current-face) + current-face) + (t nil))) + (nf + (cond ((facep face) + (list face)) + ((listp face) + face) + (t nil)))) + (append cf nf))) + string)) + +(defun cogre-string-with-face (string face element &optional length align) + "Using text STRING, apply FACE to that text. +The string in question belongs to the graph ELEMENT. +If optional argument LENGTH is supplied, pad STRING on the left and +right so that it is centered. If optional argument ALIGN is non-nil, +the align the string either 'left or 'right. +Return the new string." + (if length + (let* ((preprops (copy-sequence (text-properties-at 0 string))) + (ws (- length (length string))) + (sws (cond ((not align) + (make-string (/ ws 2) ? )) + ((eq align 'right) + (make-string (1- ws) ? )) + ((eq align 'left) + " ") + (t "") + )) + (ews (cond ((not align) + (make-string (+ (/ ws 2) (% ws 2)) ? )) + ((eq align 'left) + (make-string (1- ws) ? )) + ((eq align 'right) + " ") + (t "") + )) + ) + (let ((pm (plist-get preprops 'face))) + (when pm + ;; We don't want to modify the face on this based + ;; on the first character. + (setq preprops (delq 'face preprops)) + (setq preprops (delq pm preprops)))) + (setq string (concat sws string ews)) + (add-text-properties 0 (length string) preprops string) + )) + ;; Add our faces on. Preserve previously applied faces. + (when face + (cogre-string-merge-faces 0 (length string) face string) + ) + ;; Add on other properties. + (add-text-properties 0 (length string) + (list 'rear-nonsticky t + 'detachable t ;; xemacs + 'element element + ;; 'local-map + ;; 'modification-hooks + 'point-entered + (lambda (s e) + (let ((inhibit-point-motion-hooks t)) + (when (cogre-current-element) + (cogre-entered (cogre-current-element) s e)))) + 'point-left + (lambda (s e) + (let* ((inhibit-point-motion-hooks t) + (el + (save-excursion + (goto-char s) + (cogre-current-element)))) + (when el (cogre-left el s e))))) + string) + string) + +(defun cogre-erase-rectangle (x y width height) + "Clear out the rectangle at X Y, with dimensions WIDTH HEIGHT." + (picture-goto-coordinate x y) + (clear-rectangle (point) + (save-excursion + (picture-goto-coordinate (+ x width) + (+ y height)) + (point)) + t)) + +(defun cogre-current-element (&optional point) + "Return the element under POINT." + (get-text-property (or point (point)) 'element)) + +(defun cogre-current-line () + "Get the current line." + (cond ((eq (point-min) (point)) + 0) + (t (1- (count-lines (point-min) (point)))))) + +(provide 'cogre) + +;;; cogre.el ends here diff --git a/site/cedet-1.0pre7/cogre/cogre.info b/site/cedet-1.0pre7/cogre/cogre.info new file mode 100644 index 0000000..eea78cd --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre.info @@ -0,0 +1,263 @@ +This is cogre.info, produced by makeinfo version 4.9 from cogre.texi. + +START-INFO-DIR-ENTRY +* cogre: (cogre). Graphs & UML for Emacs +END-INFO-DIR-ENTRY + + +File: cogre.info, Node: Top, Next: Getting Started, Up: (dir) + +COGRE: COnnected GRaph Editor +***************************** + +COGRE is a package that enables Emacs to display connected graph +diagrams in a text buffer. The main goal is to provide UML class +diagrams, but any kind of graph can be supported through object +inheritance via EIEIO *Note (eieio)Top::. + + Warning: Very little in this manual has been written. + +* Menu: + +* Getting Started:: Graphs, Nodes, and Links +* Class Diagrams:: Creating Class diagrams +* Export:: Exporting your graph to different formats. +* Semantic Support:: Emacs can make diagrams for you +* Index:: + + +File: cogre.info, Node: Getting Started, Next: Class Diagrams, Prev: Top, Up: Top + +1 Getting Started +***************** + +There are three basic parts to any COGRE interface. + + 1. Graph The graph consists of a buffer, and all child elements in + that graph. The graph is treated as any other Emacs buffer. When + that buffer is selected, Graph editing commands are available. + + 2. Node A Node consists of a square region of screen space, and + usually a name. Nodes can be anything, but common examples are + Classes, Packages, or other "object like" things. + + 3. Link A Link is a line that connects two nodes. A link may not + exist without a node at both ends. When a node is deleted, all + links connected to it in some way are also deleted. + + The first step to using COGRE is to create a new graph. Once you +have a graph, you can create nodes and links. + + You can create a new graph with the `cogre' command, or open a new +file that ends with the `.cgr' extension. + + Use normal keybindings such as `C-x C-s' to save your graph into a +file. Use a `.cgr' extension so Emacs can correctly parse the file +into a graph again later. + + -- Function: cogre name &optional graph-class + Create a new graph not associated with a buffer. The new graph + will be given NAME. See "cogre-mode" for details. Optional + argument GRAPH-CLASS indicates the type of graph to create. + +* Menu: + +* Creating Nodes and Links :: Create new nodes and links +* Moving Nodes :: Move nodes around +* Customizing Nodes :: Customize details about a node + + +File: cogre.info, Node: Creating Nodes and Links, Next: Moving Nodes, Up: Getting Started + +1.1 Creating Nodes and Links +============================ + +The easiest way to create a node is with the insert popup menu. Right +click anywhere in the graph where there is no pre-existing node or +link, and a menu will appear allowing you to select the node style you +want. + + Nodes are created with the command `cogre-new-node', which is also +bound to `N' in the graph. + + -- Command: cogre-new-node point nodetype + Insert a new node at the current point. Argument POINT is a + position to insert this node to. NODETYPE is the eieio class name + for the node to insert. + + The easiest way to create a link is with a `mouse-2' drag operation. +Click the middle mouse button on a node, and drag the cursor to a +second node. A popup menu will appear where the link type can be +selected. The new link will be created connecting the two nodes. + + New links can also be created with the command `cogre-new-link' +which is bound to `L'. + + -- Command: cogre-new-link mark point &optional linktype + Insert a new link from the node at MARK to POINT of LINKTYPE. + MARK is the node within which the current mark is set. POINT is + the node the cursor is in. LINKTYPE is the EIEIO class name for + the link to insert. + + To configure the default type of node to insert via the keyboard, +such as a UML class node, use `cogre-default-node'. Likewise, use +`cogre-default-link'. These are bound to `C-c C-n', and `C-c C-l' +respectively. + + -- Command: cogre-default-node &optional node prefix + Return the default node type. If run interactively, query for a + new node to make the default. If called non-interactivly there is + no default, query for one. If NODE is supplied, use that. If + there is a PREFIX argument, then force a query for one. + + -- Command: cogre-default-link &optional link prefix + Return the default link type. If run interactively, query for a + new link to make the default. If called non-interactivly there is + no default, query for one. If LINK is supplied, use that. If + there is a PREFIX argument, then force a query for one. + + +File: cogre.info, Node: Moving Nodes, Next: Customizing Nodes, Prev: Creating Nodes and Links, Up: Getting Started + +1.2 Moving Nodes +================ + +Moving nodes around is also how to move links around. As a node moves, +the links will re-route. Movement is done with the mouse, or with meta +key bindings. + + To use the mouse, click with the left mouse button (`mouse-1') and +drag the node to a new location. + +`M-b' +`meta left' + Move a node left one character + +`M-f' +`meta right' + Move a node right one character + +`M-n' +`meta down' + Move a node down one character + +`M-p' +`meta up' + Move a node up one character + +`TAB' + Move point to the next node + +`M-TAB' + Move point to the previous node + + Sometimes the movement via keyboard of nodes will cause other nodes +to get their graphic to be partially erased. Minimal steps are taken to +refresh the graph to keep things fast in large drawings. To fix the +problem, use the `R' keybinding to redraw the entire graph from scratch. + + +File: cogre.info, Node: Customizing Nodes, Prev: Moving Nodes, Up: Getting Started + +1.3 Customizing Nodes +===================== + +Nodes and links are EIEIO objects, and can be customized. Press `RET' +on a node or link to customize the slots of that object. + + +File: cogre.info, Node: Class Diagrams, Next: Export, Prev: Getting Started, Up: Top + +2 Class Diagrams +**************** + +Add text here + + +File: cogre.info, Node: Export, Next: Semantic Support, Prev: Class Diagrams, Up: Top + +3 Export +******** + +COGRE can export your graph into different formats. The simplest +format is into an all ASCII diagram: + + -- Function: cogre-export-ascii + Export the current diagram into an ASCII buffer. + + Other formats are supported through the configuration of Graphviz +tools. You will need to install and configure Graphviz to use these +features. The CEDET variables controlling how dot and neato are called +are: + + -- Function: cedet-graphviz-dot-command + Command name for the Graphviz DOT executable. + + -- Function: cedet-graphviz-neato-command + Command name for the Graphviz NEATO executable. + + Also, when converting to and from DOT formatted files, a scaling +factor needs to be applied as the DOT coordinates (in points) are +converted into character sized units for COGRE. + + -- Function: cogre-dot-node-position-scale + The scale to use when converting between COGRE and DOT position + values. This is of the format ( XSCALE . YSCALE ). DOT uses + points, where as COGRE uses characters. + + Here are some handy exporting commands. + + -- Function: cogre-export-dot + Export the current COGRE graph to DOT notation. DOT is a part of + GraphViz. + + -- Function: cogre-export-dot-png + Export the current COGRE graph to DOT, then convert that to PNG. + The png file is then displayed in an Emacs buffer. DOT is a part + of GraphVis. + + -- Function: cogre-export-dot-postscript-print + Print the current graph. This is done by exporting the current + COGRE graph to DOT, then convert that to Postscript before + printing. DOT is a part of GraphVis. + + +File: cogre.info, Node: Semantic Support, Next: Index, Prev: Export, Up: Top + +4 Semantic Support +****************** + +Add text here + + +File: cogre.info, Node: Index, Prev: Semantic Support, Up: Top + +5 Index +******* + + + +Tag Table: +Node: Top159 +Node: Getting Started832 +Ref: cogre2048 +Node: Creating Nodes and Links2431 +Ref: cogre-new-node2943 +Ref: cogre-new-link3531 +Ref: cogre-default-node4036 +Ref: cogre-default-link4362 +Node: Moving Nodes4634 +Node: Customizing Nodes5645 +Node: Class Diagrams5908 +Node: Export6050 +Ref: cogre-export-ascii6299 +Ref: cedet-graphviz-dot-command6611 +Ref: cedet-graphviz-neato-command6706 +Ref: cogre-dot-node-position-scale6987 +Ref: cogre-export-dot7244 +Ref: cogre-export-dot-png7366 +Ref: cogre-export-dot-postscript-print7574 +Node: Semantic Support7751 +Node: Index7889 + +End Tag Table diff --git a/site/cedet-1.0pre7/cogre/cogre.texi b/site/cedet-1.0pre7/cogre/cogre.texi new file mode 100644 index 0000000..94faeca --- /dev/null +++ b/site/cedet-1.0pre7/cogre/cogre.texi @@ -0,0 +1,269 @@ +\input texinfo @c -*-texinfo-*- +@c +@c $Id: cogre.texi,v 1.4 2009/04/06 02:02:12 zappo Exp $ +@c +@setfilename cogre.info +@set TITLE COGRE: COnnected GRaph Editor +@set AUTHOR Eric M. Ludlam +@settitle @value{TITLE} + +@ifinfo +@format +START-INFO-DIR-ENTRY +* cogre: (cogre). Graphs & UML for Emacs +END-INFO-DIR-ENTRY +@end format +@end ifinfo + +@titlepage +@sp 10 +@center @titlefont{cogre} +@vskip 0pt plus 1 fill +Copyright @copyright{} 2001, 2008, 2009 Eric M. Ludlam +@end titlepage + +@macro COGRE{} +@i{COGRE} +@end macro + +@macro EIEIO{} +@i{EIEIO} +@end macro + +@node Top +@top @value{TITLE} + +@COGRE{} is a package that enables Emacs to display connected graph +diagrams in a text buffer. The main goal is to provide UML class +diagrams, but any kind of graph can be supported through object +inheritance via @EIEIO{} @xref{(eieio)Top}. + +Warning: Very little in this manual has been written. + +@menu +* Getting Started:: Graphs, Nodes, and Links +* Class Diagrams:: Creating Class diagrams +* Export:: Exporting your graph to different formats. +* Semantic Support:: Emacs can make diagrams for you +* Index:: +@end menu + +@node Getting Started +@comment node-name, next, previous, up +@chapter Getting Started + +There are three basic parts to any @COGRE{} interface. + +@enumerate +@item Graph +The graph consists of a buffer, and all child elements in that graph. +The graph is treated as any other Emacs buffer. When that buffer is +selected, Graph editing commands are available. +@item Node +A Node consists of a square region of screen space, and usually a +name. Nodes can be anything, but common examples are Classes, +Packages, or other ``object like'' things. +@item Link +A Link is a line that connects two nodes. A link may not exist +without a node at both ends. When a node is deleted, all links +connected to it in some way are also deleted. +@end enumerate + +The first step to using @COGRE{} is to create a new graph. Once you +have a graph, you can create nodes and links. + +You can create a new graph with the @code{cogre} command, or open a +new file that ends with the @file{.cgr} extension. + +Use normal keybindings such as @kbd{C-x C-s} to save your graph into a +file. Use a @file{.cgr} extension so Emacs can correctly parse the +file into a graph again later. + +@defun cogre name &optional graph-class +@anchor{cogre} +Create a new graph not associated with a buffer. +The new graph will be given @var{NAME}. See @dfn{cogre-mode} for details. +Optional argument @var{GRAPH-CLASS} indicates the type of graph to create. +@end defun + +@menu +* Creating Nodes and Links :: Create new nodes and links +* Moving Nodes :: Move nodes around +* Customizing Nodes :: Customize details about a node +@end menu + +@node Creating Nodes and Links +@section Creating Nodes and Links + +The easiest way to create a node is with the insert popup menu. Right +click anywhere in the graph where there is no pre-existing node or +link, and a menu will appear allowing you to select the node style you +want. + +Nodes are created with the command @code{cogre-new-node}, which is +also bound to @kbd{N} in the graph. + +@deffn Command cogre-new-node point nodetype +@anchor{cogre-new-node} +Insert a new node at the current point. +Argument @var{point} is a position to insert this node to. +@var{nodetype} is the eieio class name for the node to insert. +@end deffn + +The easiest way to create a link is with a @kbd{mouse-2} drag +operation. Click the middle mouse button on a node, and drag the +cursor to a second node. A popup menu will appear where the link type +can be selected. The new link will be created connecting the two +nodes. + +New links can also be created with the command @code{cogre-new-link} +which is bound to @kbd{L}. + +@deffn Command cogre-new-link mark point &optional linktype +@anchor{cogre-new-link} +Insert a new link from the node at @var{mark} to @var{point} of @var{linktype}. +@var{mark} is the node within which the current mark is set. +@var{point} is the node the cursor is in. +@var{linktype} is the @EIEIO{} class name for the link to insert. +@end deffn + +To configure the default type of node to insert via the keyboard, such +as a UML class node, use @code{cogre-default-node}. Likewise, use +@code{cogre-default-link}. These are bound to @kbd{C-c C-n}, and +@kbd{C-c C-l} respectively. + +@deffn Command cogre-default-node &optional node prefix +@anchor{cogre-default-node} +Return the default node type. +If run interactively, query for a new node to make the default. +If called non-interactivly there is no default, query for one. +If @var{node} is supplied, use that. +If there is a @var{prefix} argument, then force a query for one. +@end deffn + +@deffn Command cogre-default-link &optional link prefix +@anchor{cogre-default-link} +Return the default link type. +If run interactively, query for a new link to make the default. +If called non-interactivly there is no default, query for one. +If @var{link} is supplied, use that. +If there is a @var{prefix} argument, then force a query for one. +@end deffn + +@node Moving Nodes +@section Moving Nodes + +Moving nodes around is also how to move links around. As a node +moves, the links will re-route. Movement is done with the mouse, or +with meta key bindings. + +To use the mouse, click with the left mouse button (@kbd{mouse-1}) and +drag the node to a new location. + +@table @kbd +@item M-b +@itemx meta left +Move a node left one character +@item M-f +@itemx meta right +Move a node right one character +@item M-n +@itemx meta down +Move a node down one character +@item M-p +@itemx meta up +Move a node up one character +@item TAB +Move point to the next node +@item M-TAB +Move point to the previous node +@end table + +Sometimes the movement via keyboard of nodes will cause other nodes to +get their graphic to be partially erased. Minimal steps are taken to +refresh the graph to keep things fast in large drawings. To fix the +problem, use the @kbd{R} keybinding to redraw the entire graph from +scratch. + +@node Customizing Nodes +@section Customizing Nodes + +Nodes and links are @EIEIO{} objects, and can be customized. Press +@kbd{RET} on a node or link to customize the slots of that object. + +@node Class Diagrams +@chapter Class Diagrams + +Add text here + +@node Export +@chapter Export + +COGRE can export your graph into different formats. The simplest +format is into an all ASCII diagram: + +@defun cogre-export-ascii +@anchor{cogre-export-ascii} +Export the current diagram into an @var{ASCII} buffer. +@end defun + +Other formats are supported through the configuration of Graphviz +tools. You will need to install and configure Graphviz to use these +features. The CEDET variables controlling how dot and neato are +called are: + +@defun cedet-graphviz-dot-command +@anchor{cedet-graphviz-dot-command} +Command name for the Graphviz @var{DOT} executable. +@end defun + +@defun cedet-graphviz-neato-command +@anchor{cedet-graphviz-neato-command} +Command name for the Graphviz @var{NEATO} executable. +@end defun + +Also, when converting to and from DOT formatted files, a scaling +factor needs to be applied as the DOT coordinates (in points) are +converted into character sized units for COGRE. + +@defun cogre-dot-node-position-scale +@anchor{cogre-dot-node-position-scale} +The scale to use when converting between @var{COGRE} and @var{DOT} position values. +This is of the format ( @var{XSCALE} . @var{YSCALE} ). +@var{DOT} uses points, where as @var{COGRE} uses characters. +@end defun + +Here are some handy exporting commands. + +@defun cogre-export-dot +@anchor{cogre-export-dot} +Export the current @var{COGRE} graph to @var{DOT} notation. +@var{DOT} is a part of GraphViz. +@end defun + +@defun cogre-export-dot-png +@anchor{cogre-export-dot-png} +Export the current @var{COGRE} graph to @var{DOT}, then convert that to @var{PNG}. +The png file is then displayed in an Emacs buffer. +@var{DOT} is a part of GraphVis. +@end defun + +@defun cogre-export-dot-postscript-print +@anchor{cogre-export-dot-postscript-print} +Print the current graph. +This is done by exporting the current @var{COGRE} graph to @var{DOT}, then +convert that to Postscript before printing. +@var{DOT} is a part of GraphVis. +@end defun + +@node Semantic Support +@chapter Semantic Support + +Add text here + +@node Index +@chapter Index + +@contents + +@bye diff --git a/site/cedet-1.0pre7/cogre/picture-hack.el b/site/cedet-1.0pre7/cogre/picture-hack.el new file mode 100644 index 0000000..f014cfa --- /dev/null +++ b/site/cedet-1.0pre7/cogre/picture-hack.el @@ -0,0 +1,335 @@ +;;; picture-hack.el --- Updates to picture mode + +;;; Copyright (C) 2001, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; Keywords: picture +;; X-RCS: $Id: picture-hack.el,v 1.14 2009/03/31 09:28:02 zappo Exp $ + +;; Semantic is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Picture-hack is a series of modifications to functions in picture.el +;; and rect.el. +;; It also contains new functions which should live in picture.el +;; +;; These are hacks needed by COGRE. Long term, I would like to see +;; these features merged back into picture mode. + +(require 'picture) +(require 'rect) + +;;; Code: + +;;; XEmacs is missing some stuff +;; +(unless (fboundp 'picture-current-line) + ;; copied from Emacs 20.6: + (defun picture-current-line () + "Return the vertical position of point. Top line is 1." + (+ (count-lines (point-min) (point)) + (if (= (current-column) 0) 1 0)))) + +(unless (fboundp 'picture-update-desired-column) + ;; copied from Emacs 20.6: + ;; If the value of picture-desired-column is far from the current + ;; column, or if the arg ADJUST-TO-CURRENT is non-nil, set it to the + ;; current column. Return the current column. + (defun picture-update-desired-column (adjust-to-current) + (let ((current-column (current-column))) + (if (or adjust-to-current + (< picture-desired-column (1- current-column)) + (> picture-desired-column (1+ current-column))) + (setq picture-desired-column current-column)) + current-column))) + +(unless (fboundp 'char-width) + (defun char-width (CH) + "XEmacs doesn't have this, always return 1." + 1)) + +(unless (boundp 'picture-rectangle-v) + (defcustom picture-rectangle-v ?| + "*Character `picture-draw-rectangle' uses for vertical lines." + :type 'character + :group 'picture)) + +(unless (boundp 'picture-rectangle-h) + (defcustom picture-rectangle-h ?- + "*Character `picture-draw-rectangle' uses for horizontal lines." + :type 'character + :group 'picture)) + +(unless (boundp 'picture-rectangle-ctl) + (defcustom picture-rectangle-ctl ?+ + "*Character `picture-draw-rectangle' uses for top left corners." + :type 'character + :group 'picture)) + +(unless (boundp 'picture-rectangle-ctr) + (defcustom picture-rectangle-ctr ?+ + "*Character `picture-draw-rectangle' uses for top right corners." + :type 'character + :group 'picture) + ) + +(unless (boundp 'picture-rectangle-cbr) + (defcustom picture-rectangle-cbr ?+ + "*Character `picture-draw-rectangle' uses for bottom right corners." + :type 'character + :group 'picture) + ) + +(unless (boundp 'picture-rectangle-cbl) + (defcustom picture-rectangle-cbl ?+ + "*Character `picture-draw-rectangle' uses for bottom left corners." + :type 'character + :group 'picture) + ) + +;;;###autoload +(defun cogre-picture-insert-rectangle (rectangle) + "Overlay RECTANGLE with upper left corner at point. +Leaves the region surrounding the rectangle." + (let ((indent-tabs-mode nil)) + + ;; The below is pulled from 'insert-rectangle, and removes the + ;; setting of the mark. + (let ((lines rectangle) + (insertcolumn (current-column)) + (first t)) + (while lines + (or first + (progn + (forward-line 1) + (or (bolp) (insert ?\n)) + (move-to-column insertcolumn t))) + (setq first nil) + + ;; Clear the old text. + (if (> (- (point-at-eol) (point)) (length (car lines))) + (delete-char (length (car lines))) + (delete-char (- (point-at-eol) (point)))) + + (insert (car lines)) + (setq lines (cdr lines)))) )) + +;;; Changes to exsiting functions +;; +(if (condition-case nil + (and (clear-rectangle 0 0 t) + nil) + (error t)) + + ;; In emacs 20, FILL is not an argument to clear rectangle as it is + ;; in emacs 21. Add it here. Fortunatly, `operate-on-rectangle' does + ;; take a fill argument. + (defun clear-rectangle (start end &optional fill) + "Blank out rectangle with corners at point and mark. +The text previously in the region is overwritten by the blanks. +When called from a program, requires two args which specify the corners." + (interactive "r") + (operate-on-rectangle 'clear-rectangle-line start end t)) +) + +;; This is a modified version which takes text properties +(defun picture-insert (ch arg &rest textproperties) + "Insert character CH, and move in the current picture motion direction. +Repeat ARG times. +Apply TEXTPROPERTIES to the character inserted." + (let* ((width (char-width ch)) + ;; We must be sure that the succeeding insertion won't delete + ;; the just inserted character. + (picture-horizontal-step + (if (and (= picture-vertical-step 0) + (> width 1) + (< (abs picture-horizontal-step) 2)) + (* picture-horizontal-step 2) + picture-horizontal-step))) + (while (> arg 0) + (setq arg (1- arg)) + ;; The following is in Emacs 21, but it hoses over earlier Emacsen + ;; which do not have `picture-desired-column' + ;; + ;; (if (/= picture-desired-column (current-column)) + ;; (move-to-column picture-desired-column t)) + (let ((col (+ (current-column) width))) + (or (eolp) + (let ((pos (point))) + (move-to-column col t) + (delete-region pos (point))))) + (insert ch) + (forward-char -1) + (if textproperties + (add-text-properties (point) (1+ (point)) + (append + ;; These two are special defaults + ;; useful for pictures. + '(rear-nonsticky t detachable t) + textproperties)) + ) + (picture-move)))) + +(defun picture-mouse-set-point (event) + "Move point to the position clicked on, making whitespace if necessary. +Location is determined from EVENT. +Different from the default in that it handles hscrolling." + (interactive "e") + (let* ((pos (posn-col-row (event-start event))) + (hs (window-hscroll)) + (x (+ (car pos) hs)) + (y (cdr pos)) + (current-row (count-lines (window-start) (line-beginning-position)))) + (unless (equal x (current-column)) + (picture-forward-column (- x (current-column)))) + (unless (equal y current-row) + (picture-move-down (- y current-row))))) + +;;; New functions +;; +(defun picture-goto-coordinate (x y) + "Goto coordinate X, Y." + (goto-char (point-min)) + (picture-newline y) + (move-to-column x t) + ) + +(defun picture-set-motion (vert horiz) + "Set VERTICAL and HORIZONTAL increments for movement in Picture mode. +The mode line is updated to reflect the current direction." + (setq picture-vertical-step vert + picture-horizontal-step horiz) + (if (eq major-mode 'picture-mode) + (progn + (setq mode-name + (format "Picture:%s" + (nth (+ 2 (% horiz 3) (* 5 (1+ (% vert 2)))) + '(wnw nw up ne ene Left left none right Right + wsw sw down se ese)))) + (force-mode-line-update) + (message "")))) + +(defun picture-draw-rectilinear-line (x1 y1 x2 y2 &optional direction + &rest textproperties) + "Draw a line from X1, Y1 to X2, Y2. +If optional argument DIRECTION is specified as 'verticle, or 'horizontal, +then the line is drawn with the major direction in that orientation. +If DIRECTION is not specified, the greatest distance between X or Y +coordinates is used to choose. +Arguments TEXTPROPERTIES are applied to the characters inserted. +The line is drawn in a rectilinear fashion." + ;; A rectilinear line for us (short term) is a line travelling + ;; in the direction of greatest distance, with a jog in the middle. + (let (xdir ydir halfway htwiddle + ) + ;; Travelling + (if (> x1 x2) + (setq xdir -1) + (setq xdir 1)) + (if (> y1 y2) + (setq ydir -1) + (setq ydir 1)) + ;; Get there + (picture-goto-coordinate x1 y1) + (picture-update-desired-column t) + ;; Determine primary direction + (if (or (and direction (eq direction 'horizontal)) + (and (not direction) (> (abs (- x1 x2)) (abs (- y1 y2))))) + ;; This means that X is primary direction + (progn + (setq halfway (/ (abs (- x1 x2)) 2) + htwiddle (% (abs (- x1 x2)) 2)) + (picture-set-motion 0 xdir) + (apply 'picture-insert picture-rectangle-h (+ halfway htwiddle) + textproperties) + (if (/= y1 y2) + (progn + (picture-set-motion ydir 0) + (apply 'picture-insert + (if (< x1 x2) + (if (< y1 y2) + picture-rectangle-ctr + picture-rectangle-cbr) + (if (< y1 y2) + picture-rectangle-ctl + picture-rectangle-cbl)) + 1 textproperties) + (apply 'picture-insert picture-rectangle-v (1- (abs (- y1 y2))) + textproperties) + (picture-set-motion 0 xdir) + (apply 'picture-insert + (if (< x1 x2) + (if (< y1 y2) + picture-rectangle-cbl + picture-rectangle-ctl) + (if (< y1 y2) + picture-rectangle-cbr + picture-rectangle-ctr)) + 1 textproperties) + ;;(setq halfway (1- halfway)) + ) + (apply 'picture-insert picture-rectangle-h 1 + textproperties) + ) + (apply 'picture-insert picture-rectangle-h halfway + textproperties) + ) + ;; This means that Y is the primary direction + (setq halfway (/ (abs (- y1 y2)) 2) + htwiddle (% (abs (- y1 y2)) 2)) + (picture-set-motion ydir 0) + (apply 'picture-insert picture-rectangle-v (+ halfway htwiddle) + textproperties) + (if (/= x1 x2) + (progn + (picture-set-motion 0 xdir) + (apply 'picture-insert + (if (< y1 y2) + (if (< x1 x2) + picture-rectangle-cbl + picture-rectangle-cbr + ) + (if (< x1 x2) + picture-rectangle-ctl + picture-rectangle-ctr + )) + 1 textproperties) + (apply 'picture-insert picture-rectangle-h (1- (abs (- x1 x2))) + textproperties) + (picture-set-motion ydir 0) + (apply 'picture-insert + (if (< y1 y2) + (if (< x1 x2) + picture-rectangle-ctr + picture-rectangle-ctl) + (if (< x1 x2) + picture-rectangle-cbr + picture-rectangle-cbl)) + 1 textproperties) + ;(setq halfway (1- halfway)) + ) + (apply 'picture-insert picture-rectangle-v 1 + textproperties) + ) + (apply 'picture-insert picture-rectangle-v halfway + textproperties) + ) + )) + +(provide 'picture-hack) + +;;; picture-hack.el ends here diff --git a/site/cedet-1.0pre7/cogre/templates/Makefile b/site/cedet-1.0pre7/cogre/templates/Makefile new file mode 100644 index 0000000..d57223f --- /dev/null +++ b/site/cedet-1.0pre7/cogre/templates/Makefile @@ -0,0 +1,38 @@ +# Automatically Generated Makefile by EDE. +# For use with: make +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +top=../ +ede_FILES=Project.ede Makefile + +templates_MISC=srecode-dot.srt cogre-default.srt +VERSION=1.0pre7 +DISTDIR=$(top)COGRE-$(VERSION)/templates + + + +all: templates + +templates: + @ + +tags: + +.PHONY: dist + +dist: + mkdir $(DISTDIR) + cp $(templates_MISC) $(ede_FILES) $(DISTDIR) + +Makefile: Project.ede + @echo Makefile is out of date! It needs to be regenerated by EDE. + @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. + @false + + + +# End of Makefile diff --git a/site/cedet-1.0pre7/cogre/templates/Project.ede b/site/cedet-1.0pre7/cogre/templates/Project.ede new file mode 100644 index 0000000..290ef17 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/templates/Project.ede @@ -0,0 +1,13 @@ +;; Object templates +;; EDE project file. +(ede-proj-project "templates" + :name "templates" + :file "Project.ede" + :targets (list + (ede-proj-target-makefile-miscelaneous "templates" + :name "templates" + :path "" + :source '("srecode-dot.srt" "cogre-default.srt") + ) + ) + ) diff --git a/site/cedet-1.0pre7/cogre/templates/cogre-default.srt b/site/cedet-1.0pre7/cogre/templates/cogre-default.srt new file mode 100644 index 0000000..c196054 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/templates/cogre-default.srt @@ -0,0 +1,43 @@ +;; cogre-default.srt --- Default templates for basic COGRE. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +set mode "default" +set escape_start "{{" +set escape_end "}}" + +context file + +;; @TODO - Need to test this + + +template cogre-graph-comment :cogre +---- +{{comment_start}} {{GRAPHNAME}} -- {{^}} +{{comment_prefix}} +{{GRAPH:srecode-comment-prefix}} +{{comment_prefix}} +{{comment_end}} +---- + + + + +;; end \ No newline at end of file diff --git a/site/cedet-1.0pre7/cogre/templates/srecode-dot.srt b/site/cedet-1.0pre7/cogre/templates/srecode-dot.srt new file mode 100644 index 0000000..eef92a8 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/templates/srecode-dot.srt @@ -0,0 +1,77 @@ +;; srecode-dot.srt --- +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +set mode "graphviz-dot-mode" +set escape_start "{{" +set escape_end "}}" + +set comment_start "/**" +set comment_end " */" +set comment_prefix " *" + +context file + +template empty :time :user :file :dot +---- +{{>:filecomment}} +digraph structs { + {{^}} +} +---- + +template cogre :time :dot :cogre +---- +{{comment_start}} +{{comment_prefix}} Graph {{GRAPHNAME}} Generated by Emacs/SRecode on {{TIME}}. +{{comment_end}} +---- + +context declaration + +template digraph-tag :blank +"Insert a digraph structure." +---- +digraph structs { + node [shape=record]; + {{^}} +} +---- + +template generic-node :blank :tag +"Basic node declaration for generic attributes." +---- + node [shape={{SHAPE}}]; +---- + +template node :blank :tag +"Basic node tag to convert from a Semantic parse." +---- + "{{NAME}}" [ {{#ATTRIBUTES}} {{LABEL}}="{{VALUE}}"{{/ATTRIBUTES}} ]; +---- + +template link :blank :tag +"Basic link tag to convert from a Semantic parse." +---- + "{{NAME}}" -> "{{TAIL}}" [ {{#ATTRIBUTES}} {{LABEL}}="{{VALUE}}"{{/ATTRIBUTES}} ]; +---- + + +;; end \ No newline at end of file diff --git a/site/cedet-1.0pre7/cogre/tests/Makefile b/site/cedet-1.0pre7/cogre/tests/Makefile new file mode 100644 index 0000000..10a86d0 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/tests/Makefile @@ -0,0 +1,38 @@ +# Automatically Generated Makefile by EDE. +# For use with: make +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +top=../ +ede_FILES=Project.ede Makefile + +TestFiles_MISC=testclasses.hh +VERSION=1.0pre7 +DISTDIR=$(top)COGRE-$(VERSION)/tests + + + +all: TestFiles + +TestFiles: + @ + +tags: + +.PHONY: dist + +dist: + mkdir $(DISTDIR) + cp $(TestFiles_MISC) $(ede_FILES) $(DISTDIR) + +Makefile: Project.ede + @echo Makefile is out of date! It needs to be regenerated by EDE. + @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. + @false + + + +# End of Makefile diff --git a/site/cedet-1.0pre7/cogre/tests/Project.ede b/site/cedet-1.0pre7/cogre/tests/Project.ede new file mode 100644 index 0000000..f40b1fc --- /dev/null +++ b/site/cedet-1.0pre7/cogre/tests/Project.ede @@ -0,0 +1,13 @@ +;; Object Tests +;; EDE project file. +(ede-proj-project "Tests" + :name "Tests" + :file "Project.ede" + :targets (list + (ede-proj-target-makefile-miscelaneous "TestFiles" + :name "TestFiles" + :path "" + :source '("testclasses.hh") + ) + ) + ) diff --git a/site/cedet-1.0pre7/cogre/tests/testclasses.hh b/site/cedet-1.0pre7/cogre/tests/testclasses.hh new file mode 100644 index 0000000..059925a --- /dev/null +++ b/site/cedet-1.0pre7/cogre/tests/testclasses.hh @@ -0,0 +1,117 @@ +/** testclasses.hh --- A test file full of classes to make diagrams from. + */ + +class MyBaseclass +{ + +public: + MyBaseclass() + { } + ~MyBaseclass() + { } + + /** + * fMyPrivateData Accessors + * @{ + */ + int getMyPrivateData() const { + return fMyPrivateData; + } + void setMyPrivateData(int MyPrivateData) { + fMyPrivateData = MyPrivateData; + } + /** + * @} + */ + +private: + int fMyPrivateData; + char fMyChar; +}; + +class Subclass : public MyBaseclass +{ + +public: + Subclass() + { } + ~Subclass() + { } + + /** + * scData Accessors + * @{ + */ + int getcData() const { + return scData; + } + void setcData(int cData) { + scData = cData; + } + /** + * @} + */ + +private: + int scData; +}; + +class SpecificClass : public Subclass +{ + +public: + SpecificClass() + { } + ~SpecificClass() + { } + + int addSubData(Subclass *sd) { + SubData.push(sd); + } + +private: + int SData; + vector *SubData; + +}; + +class OtherClass : public Subclass +{ + +public: + OtherClass() + { } + ~OtherClass() + { } + /** + * fOdata Accessors + * @{ + */ + int getOdata() const { + return fOdata; + } + void setOdata(int Odata) { + fOdata = Odata; + } + /** + * @} + */ + +private: + int fOdata; + +}; + +class AltClass : public Subclass +{ + +public: + AltClass() + { } + AltClass() + { } +private: + int fAdata; +}; + +// End diff --git a/site/cedet-1.0pre7/cogre/wisent-dot-wy.el b/site/cedet-1.0pre7/cogre/wisent-dot-wy.el new file mode 100644 index 0000000..03138c7 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/wisent-dot-wy.el @@ -0,0 +1,281 @@ +;;; wisent-dot-wy.el --- Generated parser support file + +;; Copyright (C) 2003, 2004, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; Created: 2009-08-30 09:50:57-0400 +;; Keywords: syntax +;; X-RCS: $Id$ + +;; This file is not part of GNU Emacs. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. +;; +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; PLEASE DO NOT MANUALLY EDIT THIS FILE! It is automatically +;; generated from the grammar file wisent-dot.wy. + +;;; Code: + +;;; Prologue +;; + +;;; Declarations +;; +(defconst wisent-dot-wy--keyword-table + (semantic-lex-make-keyword-table + '(("digraph" . DIGRAPH) + ("graph" . GRAPH) + ("subgraph" . SUBGRAPH) + ("node" . NODE)) + '(("node" summary "node [...];") + ("subgraph" summary "subgraph { ... }") + ("graph" summary "graph { ... }") + ("digraph" summary "digraph { ... }"))) + "Table of language keywords.") + +(defconst wisent-dot-wy--token-table + (semantic-lex-make-type-table + '(("number" + (number)) + ("string" + (string)) + ("symbol" + (symbol)) + ("close-paren" + (RPAREN . ")") + (RBRACKET . "]") + (RBRACE . "}")) + ("open-paren" + (LPAREN . "(") + (LBRACKET . "[") + (LBRACE . "{")) + ("block" + (PAREN_BLOCK . "(LPAREN RPAREN)") + (BRACE_BLOCK . "(LBRACE RBRACE)") + (BRACKET_BLOCK . "(LBRACKET RBRACKET)")) + ("punctuation" + (COMMA . ",") + (SEMI . ";") + (EQUAL . "=") + (LINK . "--") + (DILINK . "->"))) + '(("number" :declared t) + ("string" :declared t) + ("symbol" :declared t) + ("block" :declared t) + ("punctuation" syntax "\\s.+") + ("punctuation" :declared t) + ("keyword" :declared t))) + "Table of lexical tokens.") + +(defconst wisent-dot-wy--parse-table + (progn + (eval-when-compile + (require 'wisent-comp)) + (wisent-compile-grammar + '((DIGRAPH GRAPH SUBGRAPH NODE DILINK LINK EQUAL SEMI COMMA BRACKET_BLOCK BRACE_BLOCK PAREN_BLOCK LBRACE RBRACE LBRACKET RBRACKET LPAREN RPAREN symbol string number) + nil + (dot_file + ((digraph)) + ((graph))) + (digraph + ((DIGRAPH symbol BRACE_BLOCK) + (wisent-raw-tag + (semantic-tag $2 'digraph :members + (semantic-parse-region + (car $region3) + (cdr $region3) + 'graph-contents 1))))) + (graph + ((GRAPH symbol BRACE_BLOCK) + (wisent-raw-tag + (semantic-tag $2 'graph :members + (semantic-parse-region + (car $region3) + (cdr $region3) + 'graph-contents 1))))) + (graph-contents + ((LBRACE) + nil) + ((RBRACE) + nil) + ((graph-attributes)) + ((subgraph)) + ((node)) + ((graphgeneric)) + ((named-node)) + ((links))) + (subgraph + ((SUBGRAPH symbol BRACE_BLOCK) + (wisent-raw-tag + (semantic-tag $2 'graph :members + (semantic-parse-region + (car $region3) + (cdr $region3) + 'graph-contents 1))))) + (graphgeneric + ((GRAPH BRACKET_BLOCK SEMI) + (wisent-raw-tag + (semantic-tag "GRAPH" 'generic-graph :attributes + (semantic-parse-region + (car $region2) + (cdr $region2) + 'attribute-block 1))))) + (node + ((NODE BRACKET_BLOCK SEMI) + (wisent-raw-tag + (semantic-tag "NODE" 'generic-node :attributes + (semantic-parse-region + (car $region2) + (cdr $region2) + 'attribute-block 1))))) + (graph-attributes + ((GRAPH BRACKET_BLOCK SEMI) + (wisent-raw-tag + (semantic-tag "GRAPH" 'graph-attributes :attributes + (semantic-parse-region + (car $region2) + (cdr $region2) + 'attribute-block 1))))) + (named-node + ((name BRACKET_BLOCK SEMI) + (wisent-raw-tag + (semantic-tag $1 'node :attributes + (semantic-parse-region + (car $region2) + (cdr $region2) + 'attribute-block 1))))) + (links + ((name DILINK name opt-link-attributes opt-semi) + (wisent-raw-tag + (semantic-tag $1 'link :to $3 :attributes $4))) + ((name LINK name opt-link-attributes opt-semi) + (wisent-raw-tag + (semantic-tag $1 'link :to $3 :attributes $4)))) + (name + ((symbol) + (identity $1)) + ((string) + (read $1))) + (attribute-block + ((LBRACKET) + nil) + ((RBRACKET) + nil) + ((COMMA) + nil) + ((symbol EQUAL name) + (wisent-raw-tag + (semantic-tag $1 'attribute :value $3)))) + (opt-semi + ((SEMI) + nil) + (nil)) + (opt-link-attributes + ((BRACKET_BLOCK) + (semantic-parse-region + (car $region1) + (cdr $region1) + 'attribute-block 1)) + (nil))) + '(dot_file graph-contents attribute-block))) + "Parser table.") + +(defun wisent-dot-wy--install-parser () + "Setup the Semantic Parser." + (semantic-install-function-overrides + '((parse-stream . wisent-parse-stream))) + (setq semantic-parser-name "LALR" + semantic--parse-table wisent-dot-wy--parse-table + semantic-debug-parser-source "wisent-dot.wy" + semantic-flex-keywords-obarray wisent-dot-wy--keyword-table + semantic-lex-types-obarray wisent-dot-wy--token-table) + ;; Collect unmatched syntax lexical tokens + (semantic-make-local-hook 'wisent-discarding-token-functions) + (add-hook 'wisent-discarding-token-functions + 'wisent-collect-unmatched-syntax nil t)) + + +;;; Analyzers +;; +(require 'semantic-lex) + +(define-lex-keyword-type-analyzer wisent-dot-wy---keyword-analyzer + "keyword analyzer for tokens." + "\\(\\sw\\|\\s_\\)+") + +(define-lex-block-type-analyzer wisent-dot-wy---block-analyzer + "block analyzer for tokens." + "\\s(\\|\\s)" + '((("[" LBRACKET BRACKET_BLOCK) + ("{" LBRACE BRACE_BLOCK) + ("(" LPAREN PAREN_BLOCK)) + ("]" RBRACKET) + ("}" RBRACE) + (")" RPAREN)) + ) + +(define-lex-regex-type-analyzer wisent-dot-wy---regexp-analyzer + "regexp analyzer for tokens." + "\\(\\sw\\|\\s_\\)+" + nil + 'symbol) + +(define-lex-sexp-type-analyzer wisent-dot-wy---sexp-analyzer + "sexp analyzer for tokens." + "\\s\"" + 'string) + +(define-lex-regex-type-analyzer wisent-dot-wy---regexp-analyzer + "regexp analyzer for tokens." + semantic-lex-number-expression + nil + 'number) + +(define-lex-string-type-analyzer wisent-dot-wy---string-analyzer + "string analyzer for tokens." + "\\s.+" + '((COMMA . ",") + (SEMI . ";") + (EQUAL . "=") + (LINK . "--") + (DILINK . "->")) + 'punctuation) + + +;;; Epilogue +;; +(define-lex wisent-dot-lexer + "Lexical analyzer that handles DOT buffers. +It ignores whitespace, newlines and comments." + semantic-lex-ignore-whitespace + semantic-lex-ignore-newline + semantic-lex-ignore-comments + wisent-dot-wy---keyword-analyzer + wisent-dot-wy---regexp-analyzer + wisent-dot-wy---block-analyzer + ;; ?? semantic-lex-close-paren + wisent-dot-wy---regexp-analyzer + wisent-dot-wy---sexp-analyzer + wisent-dot-wy---string-analyzer + semantic-lex-default-action + ) + +(provide 'wisent-dot-wy) + +;;; wisent-dot-wy.el ends here diff --git a/site/cedet-1.0pre7/cogre/wisent-dot.el b/site/cedet-1.0pre7/cogre/wisent-dot.el new file mode 100644 index 0000000..6f807bc --- /dev/null +++ b/site/cedet-1.0pre7/cogre/wisent-dot.el @@ -0,0 +1,97 @@ +;;; wisent-dot.el --- GraphViz DOT parser + +;; Copyright (C) 2003, 2004, 2009 Eric M. Ludlam + +;; Author: Eric Ludlam +;; Keywords: syntax +;; X-RCS: $Id: wisent-dot.el,v 1.12 2009/04/07 00:34:49 zappo Exp $ + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Parser for GraphViz DOT language. +;; The language is declaritive and the whole thing is parsed. +;; The result could be used as a data structure representing a graph. + +;; This depends on A dot mode +;; +;; It will work with either cogre-dot-mode, or if available, the much +;; nicer graphviz-dot-mode by +;; Pieter E.J. Pareit +;; http://users.skynet.be/ppareit/graphviz-dot-mode.el +;; + + +;;; Code: +(require 'semantic-wisent) +(require 'semantic) +(require 'wisent-dot-wy) + +(define-mode-local-override semantic-tag-components + graphviz-dot-mode (tag) + "Return the children of tag TAG." + (cond + ((memq (semantic-tag-class tag) + '(generic-node graph-attributes node link)) + (semantic-tag-get-attribute tag :attributes) + ) + ((memq (semantic-tag-class tag) + '(digraph graph)) + (semantic-tag-get-attribute tag :members) + ))) + +;;;###autoload +(defun wisent-dot-setup-parser () + "Setup buffer for parse." + (wisent-dot-wy--install-parser) + + (setq + ;; Lexical Analysis + semantic-lex-analyzer 'wisent-dot-lexer + semantic-lex-syntax-modifications + '( + (?- ".") + (?= ".") + (?, ".") + (?> ".") + (?< ".") + ) + ;; Parsing + ;; Environment + semantic-imenu-summary-function 'semantic-format-tag-name + imenu-create-index-function 'semantic-create-imenu-index + semantic-command-separation-character ";" + ;; Speedbar + semantic-symbol->name-assoc-list + '((graph . "Graph") + (digraph . "Directed Graph") + (node . "Node") + ) + ;; Navigation + senator-step-at-tag-classes '(graph digraph) + )) + +;;;###autoload +(add-hook 'graphviz-dot-mode-hook 'wisent-dot-setup-parser) +;;;###autoload +(add-hook 'cogre-dot-mode-hook 'wisent-dot-setup-parser) + +(provide 'wisent-dot) + +;;; wisent-dot.el ends here diff --git a/site/cedet-1.0pre7/cogre/wisent-dot.wy b/site/cedet-1.0pre7/cogre/wisent-dot.wy new file mode 100644 index 0000000..aa7fcd7 --- /dev/null +++ b/site/cedet-1.0pre7/cogre/wisent-dot.wy @@ -0,0 +1,194 @@ +;;; wisent-dot.wy --- GraphViz DOT file parser + +;; Copyright (C) 2003, 2004, 2009 Eric M. Ludlam + +;; Author: Eric Ludlam +;; Keywords: syntax +;; X-RCS: $Id: wisent-dot.wy,v 1.10 2009/04/06 02:56:32 zappo Exp $ + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Parser for GraphViz DOT language. +;; The language is declaritive and the whole thing is parsed. +;; The result could be used as a data structure representing a graph. + +%languagemode graphviz-dot-mode + +%start dot_file +;; Needed for EXPANDFULL +%start graph-contents +%start attribute-block + +;;; KEYWORDS +%type +%keyword DIGRAPH "digraph" +%put DIGRAPH summary "digraph { ... }" +%keyword GRAPH "graph" +%put GRAPH summary "graph { ... }" +%keyword SUBGRAPH "subgraph" +%put SUBGRAPH summary "subgraph { ... }" +%keyword NODE "node" +%put NODE summary "node [...];" + +;;; Punctuation Types +%type syntax "\\s.+" +%token DILINK "->" +%put DILINK summary " -> ; Directed link" +%token LINK "--" +%put LINK summary " -- ; Link" +%token EQUAL "=" +%token SEMI ";" +%token COMMA "," + +;;; BLOCK types +%type +%token BRACKET_BLOCK "(LBRACKET RBRACKET)" +%token BRACE_BLOCK "(LBRACE RBRACE)" +%token PAREN_BLOCK "(LPAREN RPAREN)" +%token LBRACE "{" +%token RBRACE "}" +%token LBRACKET "[" +%token RBRACKET "]" +%token LPAREN "(" +%token RPAREN ")" + + +;;; Bland default types +%type +%token symbol + +%type +%token string + +%type +%token number + +%% + +dot_file + : digraph + | graph + ; + +digraph + : DIGRAPH symbol BRACE_BLOCK + (TAG $2 'digraph :members (EXPANDFULL $3 graph-contents)) + ; + +graph + : GRAPH symbol BRACE_BLOCK + (TAG $2 'graph :members (EXPANDFULL $3 graph-contents)) + ; + +graph-contents + : LBRACE + () + | RBRACE + () + | graph-attributes + | subgraph + | node + | graphgeneric + | named-node + | links + ; + +subgraph + : SUBGRAPH symbol BRACE_BLOCK + (TAG $2 'graph :members (EXPANDFULL $3 graph-contents)) + ; + +graphgeneric + : GRAPH BRACKET_BLOCK SEMI + (TAG "GRAPH" 'generic-graph :attributes (EXPANDFULL $2 attribute-block)) + ; + +node + : NODE BRACKET_BLOCK SEMI + (TAG "NODE" 'generic-node :attributes (EXPANDFULL $2 attribute-block)) + ; + +graph-attributes + : GRAPH BRACKET_BLOCK SEMI + (TAG "GRAPH" 'graph-attributes :attributes (EXPANDFULL $2 attribute-block)) + ; + +named-node + : name BRACKET_BLOCK SEMI + (TAG $1 'node :attributes (EXPANDFULL $2 attribute-block)) + ; + +links + : name DILINK name opt-link-attributes opt-semi + (TAG $1 'link :to $3 :attributes $4) + | name LINK name opt-link-attributes opt-semi + (TAG $1 'link :to $3 :attributes $4) + ; + +name + : symbol + ( identity $1 ) + | string + ( read $1 ) ;; This un-strings it. + ; + +attribute-block + : LBRACKET + () + | RBRACKET + () + | COMMA + () + ;; This is a catch-all in case we miss some keyword. + | symbol EQUAL name + (TAG $1 'attribute :value $3) + ; + +opt-semi + : SEMI + () + | ;; Empty + ; + +opt-link-attributes + : BRACKET_BLOCK + (EXPANDFULL $1 attribute-block) + | ;; Empty + ; + +%% + +(define-lex wisent-dot-lexer + "Lexical analyzer that handles DOT buffers. +It ignores whitespace, newlines and comments." + semantic-lex-ignore-whitespace + semantic-lex-ignore-newline + semantic-lex-ignore-comments + wisent-dot-wy---keyword-analyzer + wisent-dot-wy---regexp-analyzer + wisent-dot-wy---block-analyzer + ;; ?? semantic-lex-close-paren + wisent-dot-wy---regexp-analyzer + wisent-dot-wy---sexp-analyzer + wisent-dot-wy---string-analyzer + semantic-lex-default-action + ) + +;;; wisent-dot.wy ends here diff --git a/site/cedet-1.0pre7/common/ChangeLog b/site/cedet-1.0pre7/common/ChangeLog new file mode 100644 index 0000000..3bb0306 --- /dev/null +++ b/site/cedet-1.0pre7/common/ChangeLog @@ -0,0 +1,1382 @@ +2010-02-19 Eric M. Ludlam + + * cedet-compat.el (find-coding-systems-region): + XEmacs variant which was attributed to Aidan. + +2010-02-17 Eric M. Ludlam + + * cedet-compat.el (find-coding-systems-region): + New, contrib from Marcus Harnisch + +2010-02-16 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): Add srecode-utest-project + +2009-12-26 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): Add wisent-calc-utest. + +2009-10-16 Eric M. Ludlam + + * cedet.texi (C++ Features): Minor tweak. + +2009-10-13 Eric M. Ludlam + + * inversion.el (inversion-decoders): + Allow for stray . in alpha/beta variants. + +2009-09-29 Eric M. Ludlam + + * cedet-compat.el (boolean-p): + Moved here from eieio. Wrapped in test for booleanp. + +2009-09-12 Eric M. Ludlam + + * cedet.el (Commentary): Fix old style install doc w/ updated doc. + + * data-debug.el (eieio,semantic-tag): Remove these requires. + (data-debug-insert-ring-button): Do not be specific about the ring contents. + (data-debug-thing-alist): Remove eieio and semantic specific entries. + (data-debug-add-specialized-thing): New function. + + * cedet-edebug.el (edebug,debug): New requires during compile. + + * cedet-compat.el (with-no-warnings): Add compatibility fcn. + + * cedet-files.el: Patch from Chong Yidong: Remove trailing whitespace. + + * cedet-edebug.el: + Patch from Chong Yidong: Remove trailing whitespace. + (cedet-edebug-prin1-to-string): Add with-no-warnings. + + * data-debug.el: Patch from Chong Yidong: Remove trailing whitespace. + (ring, eieio, semantic-tag): New requires. + +2009-09-11 Eric M. Ludlam + + * inversion.el: Patch from Chong Yidong: Remove trailing whitespace. + (inversion-version, inversion-incompatible-version): Moved. + + * mode-local.el: Patch from Chong Yidong: Remove trailing whitespace. + (get-mode-local-parent): Moved earlier in the file. + + * pulse.el: Patch from Chong Yidong: Remove trailing whitespace. + +2009-08-30 Eric M. Ludlam + + * cedet.el (cedet-packages): Update srecode version. + + * cedet.el (cedet-packages): Update cogre version. + + * Makefile (common_LISP): Remove sformat.el + + * Project.ede (common): Remove sformat. + +2009-08-29 Eric M. Ludlam + + * sformat.el: Remove obsolete package. + +2009-07-18 Eric M. Ludlam + + * sformat.el: Add note about CEDET 1.0. + +2009-07-17 Eric M. Ludlam + + * mode-local.el: Suggestion from David Engster: + (activate-mode-local-bindings): For set-auto-mode test. + Have specialized emacs and xemacs queries. + +2009-07-12 Eric M. Ludlam + + * cedet.texi (semantic-lex-c-nested-namespace-ignore-second): New doc. + +2009-07-11 Eric M. Ludlam + + * mode-local.el (activate-mode-local-bindings): + Do not do the activation if we are + called while loading in a lisp file. See Hack comment. + +2009-07-09 Eric M. Ludlam + + * mode-local.el: From David Engster: + (mode-local-map-mode-buffers): Fix bug in predicate to + mode-local-map-file-buffers to return the found value. + +2009-07-05 Eric M. Ludlam + + * mode-local.el (find-file-hooks): Revert to previous setting. + + * mode-local.el (mode-local-equivalent-mode-p): New + (mode-local-map-mode-buffers): Use above as predicate. + (mode-local-post-major-mode-change): Specify *not* local post-command-hook. + (mode-local-on-major-mode-change): Have find-file-hooks also use + mode-local-on-major-mode-change. + + * mode-local.el (set-mode-local-parent): Patch from David Engster: + Fix order of arguments to `mode-local-map-mode-buffers'. + (mode-local-setup-edebug-specs): Fix spec for setq-mode-local. + +2009-06-24 Eric M. Ludlam + + * mode-local.el (mode-local-describe-bindings-1): + Use `help-buffer' instead of + "*Help*" for identifying the buffer to display help in. + +2009-05-30 Eric M. Ludlam + + * cedet-global.el (cedet-gnu-global-version-check): + Protect against GLOBAL not being installed. + + * cedet-cscope.el (cedet-cscope-version-check): + Protect against cscope not being installed. + + * cedet-idutils.el: (cedet-idutils-support-for-directory) + (cedet-idutils-version-check): Protect against ID Utils not being installed. + +2009-04-19 Eric M. Ludlam + + * data-debug.el (Commentary): Fix example. + + * data-debug.el (Commentary): Add some help. + (data-debug-show-stuff): New utility. + (data-debug-edebug-expr, data-debug-eval-expression): Use above. + + * mode-local.el (with-mode-local-symbol): + New macro. Same as below, but mode is not + automatically quoted. + (with-mode-local): Calls above, but quotes in the first argument. + +2009-04-11 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): Add cogre-utest-quick-class + +2009-04-09 Eric M. Ludlam + + * cedet-graphviz.el (cedet-graphviz-translate-file): + Check for a -n flag, and then swap + between dot and neato. + + * cedet-utests.el (cedet-utest-test-alist): + Remove UML test as obsolete. + +2009-04-06 Eric M. Ludlam + + * cedet-graphviz.el (cedet-graphviz-dot-version-check): Fix regexp. + + * cedet-graphviz.el (cedet-graphviz-min-version): + Reset to 2.8, it seems to work. + (cedet-graphviz-dot-version-check): Handle older version number output. + + * cedet-graphviz.el (cedet-graphviz-neato-command): Doc fix. + + * cedet-graphviz.el (cedet-graphviz-translate-file): + If fileout is not specified, then + don't specify an output file. + +2009-04-05 Eric M. Ludlam + + * Makefile (common_LISP): Add cedet-graphviz.el. + + * Project.ede (common): Add cedet-graphviz.el. + + * cedet-graphviz.el: CEDET support for calling into graphviz. + +2009-04-04 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): + Add conversion/export tests. + +2009-04-02 Eric M. Ludlam + + * pulse.el (pulse-momentary-highlight-overlay): + Store items onto a list. + (pulse-momentary-unhighlight): Remove overlays from a list. + +2009-03-28 Eric M. Ludlam + + * data-debug.el (data-debug-mode): Disable undo. + + * cedet-utests.el (cedet-utest-test-alist): Add cogre periodic test. + +2009-03-27 Eric M. Ludlam + + * cedet.el (toplevel): If cedet is already loaded, throw an error. + +2009-03-23 Eric M. Ludlam + + * data-debug.el (data-debug-insert-lambda-expression): Fix font used. + (data-debug-insert-nil): New + (data-debug-thing-alist): Add nil. + + * data-debug.el (data-debug-mode): Disable font-lock more vigorously. + +2009-03-22 Eric M. Ludlam + + * data-debug.el: + (data-debug-insert-stuff-vector, data-debug-insert-stuff-vector-from-point) + (data-debug-insert-stuff-vector-button): New + (data-debug-thing-alist): Add above for vectors. + +2009-03-19 Eric M. Ludlam + + * cedet.el (cedet-version): Update version. + (cedet-packages): Update other tool revision numbers. + + * Makefile, Project.ede, icons/Makefile (VERSION): Update version + +2009-03-17 Eric M. Ludlam + + * data-debug.el: + (data-debug-insert-widget-properties,data-debug-insert-widget-from-point) + (data-debug-insert-widget): New fcns. + (data-debug-insert-lambda-expression): Doc fix. + (data-debug-thing-alist): Add widget + +2009-03-14 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-batch): Disable srecode-map-save-file. + + * cedet-utests.el (cedet-utest-batch): + Disable semanticdb file caches during + batch unit tests. + + * cedet-utests.el: Patch from David Engster + (cedet-utest-show-log-end): More robust way of getting the output log + window. + +2009-03-12 Eric M. Ludlam + + * Makefile (dist): Add missing -C to subdir invocation. + +2009-03-06 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): Remove sleep test. + + * cedet-utests.el (cedet-utest): Fix event cleanup if statement. + Fix doc. + + * working.el (working-wait-for-keypress): + Fix event cleanup if statement. + + * cedet-utests.el (cedet-running-master-tests): New variable. + (cedet-utest): Set above. + Try to clear left over input events. + (cedet-utest-log-setup): Don't erase buffer if in the middle of the + master unit tests list. + +2009-03-05 Alex Ott + + * .cvsignore: + add ignore files to not show auxiliary scripts, not included into CVS + +2009-03-05 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): Add gcc testing. + +2009-02-27 Eric M. Ludlam + + * cedet.texi (top): Add CScope menu + (C++ Features, GNU Global, ID Utils, Maintenance): Convert CEDET to @cedet{} + (CScope): New node. + + * Makefile (common_LISP): Add cedet-cscope.el + + * Project.ede (common): Add cedet-cscope.el + + * cedet-cscope.el: CScope support. + +2009-02-24 Eric M. Ludlam + + * cedet.texi (top): Add ID Utils to menu. + (ID Utils): New Node + + * icons/Makefile (VERSION): Changed. + + * Makefile (common_LISP): Add cedet-idutils.el + (EMACSFLAGS): New variable. + (init, setup, common,tests): Use EMACSFLAGS. + + * Project.ede (common): Add cedet-idutils.el + +2009-02-23 Eric M. Ludlam + + * cedet-idutils.el: Basic support for idutils in CEDET. + +2009-02-21 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): + Replace the lex-spp test with a single + fcn new in that lib. + +2009-02-19 Eric M. Ludlam + + * inversion.el: Patch from Marcus Harnisch + (inversion-decoders): Add something compatible w/ XEmacs. + +2009-02-14 Eric M. Ludlam + + * cedet.texi (top): Add below. + (Maintenance): New. + +2009-02-11 Eric M. Ludlam + + * data-debug.el (dd-propertize): + New alias or implementation depending on platform. + (data-debug-insert-hash-table, data-debug-insert-hash-table-button) + (data-debug-insert-symbol-from-point, data-debug-insert-symbol-button) + (data-debug-insert-string, data-debug-insert-number): + Use dd-propertize, not propertize. + + * cedet-utests.el (cedet-utest-test-alist): Comments update. + Add srecode-field-utest. + +2009-02-10 Eric M. Ludlam + + * pulse.el (pulse-available-p): New + (pulse-flag): Use above. Doc new behavior. + (pulse-test, pulse-momentary-highlight-overlay): + Check also pulse-available-p in case user set the flag to t + but the current terminal/frame doesn't support it. + +2009-02-04 Eric M. Ludlam + + * cedet-files.el (replace-regexp-in-string): New compatability fcn. + Moved from semanticdb-file.el + + * cedet-files.el (cedet-directory-name-to-file-name): + Add optional "testmode" argument. + (cedet-file-name-to-directory-name): New + (cedet-files-utest-list, cedet-files-utest): New tests. + +2009-01-29 Eric M. Ludlam + + * Project.ede (common): Updated to 1.0pre6. + + * Makefile (VERSION): Updated to 1.0pre6. + + * cedet.el (cedet-version): Updated to new prerelease + (cedet-packages): Updated versions. + +2009-01-24 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): Fix typo. + + * icons/Project.ede ("common/icons"): Fix name. + + * cedet.texi (GNU Global): Spelling fixes. + Be more specific bout how Global is used. + +2009-01-24 Jan Moringen + + * data-debug.el (data-debug-insert-buffer-props): + get local variables from the stored + buffer instead of the current buffer + +2009-01-20 Eric M. Ludlam + + * data-debug.el: (data-debug-insert-overlay-from-point) + (data-debug-insert-overlay-list-from-point) + (data-debug-expand-or-contract-mouse): + Eliminate unused variable bindings. + (data-debug-insert-string): Convert CRs into \n so text fits on one line. + + * pulse.el (pulse-test): Accept no-error argument. + When t, don't throw error if pulse-flag is nil. + + * cedet-utests.el (cedet-utest-test-alist): + Make interactive features optional. + (cedet-utest): Change use of logging fcns to specify a name. + Capture timing information. + (cedet-utest-noninteractive, cogre-utest-batch): New. + (cedet-utest-log-setup): Accept title arg. + (cedet-utest-show-log-shutdown): New + (cedet-utest-show-log-shutdown-msg): New + (cedet-utest-elapsed-time): New. + (cedet-utest-log-timer): New var. + (cedet-utest-add-log-item-start) + (cedet-utest-add-log-item-done) + (cedet-utest-log): Change formatting in noninteractive mode. + +2009-01-19 Jan Moringen + + * data-debug.el (data-debug-insert-symbol-from-point): + Expand symbol button + (data-debug-insert-symbol-button): Insert expandable button for symbol + (data-debug-insert-string): simplified + (data-debug-insert-number): simplified + (data-debug-insert-symbol): replaced by + `data-debug-insert-symbol-button' + (data-debug-thing-alist): insert buttons for symbols; improved some + comments + + * data-debug.el (data-debug-insert-hash-table): + Insert contents of hash-table + (data-debug-insert-hash-table-from-point): Expand hash-table button + (data-debug-insert-hash-table-button): Insert hash-table button + (data-debug-thing-alist): added cell for hash-table + +2009-01-14 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-log-start): + Protect against frame/window swapping. + + * cedet.texi (GNU Global): Added URL To gnu global + + * cedet.texi (top): Add below + (GNU Global): New. + + * cedet-global.el (cedet-gnu-global-version-check): + Add arg to not throw an error. + If we use that flag, return nil, no error. + + * cedet.texi: (Overview, Semantic, Installation/Basic Configuration) + (JDEE Target, C++ Features): Misc spelling fixes. + +2009-01-10 Eric M. Ludlam + + * working.el (working-wait-for-keypress): + Support Emacsen that don't have `read-event'. + + * cedet-compat.el (inversion): new require + (cedet-split-string-1): New compat fcn. + (cedet-split-string): Alias for working 3 arg split-string. + + * pulse.el (pulse-test): Add autoload cookie + + * sformat.el (Sformat): Fix unused var bytcomp warning. + + * inversion.el (inversion-locate-package-files-and-split): + (inversion-check-version): Fix unused var bytcomp warning. + (inversion-upgrade-package): Convert mapcar to mapc. + + * data-debug.el: (data-debug-insert-buffer-from-point) + (data-debug-insert-buffer-list-from-point) + (data-debug-insert-process-from-point) + (data-debug-insert-ring-items-from-point) + (data-debug-insert-stuff-list-from-point) + (data-debug-expand-or-contract-mouse) + (data-debug-edebug-expr): Fix unused var bytcomp warning. + (data-debug-eval-expression): + New command copied from eval-expression. + + * cedet-utests.el (cedet-utest-test-alist): Add cogre tests. + +2009-01-09 Eric M. Ludlam + + * mode-local.el (mode-local-use-bindings-p): New fcn. + +2008-12-17 Eric M. Ludlam + + * cedet-global.el (cedet-gnu-global-expand-filename): New command/fcn. + +2008-12-16 Eric M. Ludlam + + * cedet-global.el (cedet-gnu-global-show-root): New command. + (cedet-gnu-global-version-check): If interactive, show useful message. + +2008-12-15 Eric M. Ludlam + + * working.el: (working-wait-for-keypress) + (working-verify-sleep): Setup so tests work in the CEDET utest suite. + + * pulse.el (pulse-toggle-integration-advice): + Remove some dead code. Fix how the mode is toggled. + + * pulse.el (pulse-test): + Make asking questions optional for the cedet test suite. + +2008-12-10 Eric M. Ludlam + + * data-debug.el (data-debug-insert-buffer-*): New buffer support. + (data-debug-thing-alist): Use eieio-object-p, not object-p. + Don't use semantic-* fcns. + Add buffer support. + +2008-12-09 Eric M. Ludlam + + * cedet-global.el (cedet-gnu-global-search): Add more options and doc. + (cedet-gnu-global-scan-hits): New fcn. + +2008-12-04 Eric M. Ludlam + + * cedet-global.el (semantic-symref-tool-global::semantic-symref-perform-search): + Fix copy-paste error passing in searchtext to global-call. + (cedet-gnu-global-root): New fcn. + + * Makefile (common_LISP): Add cedet-global.el + + * Project.ede (common): Add cedet-global.el + + * cedet-global.el: GNU Global general interface for tools. + +2008-12-01 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-log-start): + Reset logging if the buffer has no window. + +2008-10-19 Eric M. Ludlam + + * cedet.texi (COGRE): Discuss being incomplete. + (Installation/Basic Configuration): Add url to exuberent ctags. + +2008-10-16 Eric M. Ludlam + + * inversion.el (inversion-decoders): Added decoder for a single number. + +2008-10-10 Eric M. Ludlam + + * cedet-utests.el (cedet-utest-test-alist): + Add eieio tests custom and chart. + Add semantic lex/spp test. + Add srecode getset test. + (cedet-utest-last-log-item): New + (cedet-utest-show-log-end): New + (cedet-utest-post-command-hook): New fcn + (cedet-utest-log-setup): Reset the last log item. + (cedet-utest-add-log-item-start): Skip logging the same thing twice. + Move to end of buffer. + (cedet-utest-add-log-item-done): Reset the last log item. + (cedet-utest-log-start, cedet-utest-log): New for external tests. + +2008-10-05 Eric M. Ludlam + + * cedet-utests.el: One place to run all the unit tests. + +2008-10-02 Eric M. Ludlam + + * Makefile (tests_LISP): New + (tests): New + (add,dist): Add tests. + + * Project.ede (tests): New target. + +2008-09-20 Eric M. Ludlam + + * data-debug.el (data-debug-thing-alist): Support new db/tag combo. + +2008-09-17 Eric M. Ludlam + + * data-debug.el (data-debug-insert-lambda-expression): New + (data-debug-thing-alist): Add lambda + +2008-09-05 Eric M. Ludlam + + * working.el: + (working-bar-percent-display, working-percent-bar-display) + (working-bubble-percent-display): Simplify. + (working-verify-parenthesis-a,b): Setup to show 'done' part for 1 sec. + +2008-09-04 Eric M. Ludlam + + * working.el: (working-bar-percent-display) + (working-percent-bar-display) + (working-bubble-percent-display): Suggestion from David Engster. + Fix case where 'done' message causes a 2 line message. + +2008-09-02 Eric M. Ludlam + + * cedet.el (Main setup code): Simplified status messages. + + * inversion.el (inversion-add-to-load-path): Removed status messages. + +2008-08-26 Eric M. Ludlam + + * cedet.el (code): Call info-initialize, but in a condition case. + +2008-08-20 Eric M. Ludlam + + * mode-local.el (mode-local-setup-edebug-specs): + Support new name for define-overload. + +2008-07-03 Eric M. Ludlam + + * cedet-autogen.el (make-autoload): + Convert defclass autoload cookies into + special eieio autoload forms. + + * cedet.el (cedet-packages): Re-sort. Put eieio first, and ede later. + (default-directory): Force eieio to load. + +2008-06-19 Eric M. Ludlam + + * cedet.el (cedet-packages): Update eieio version. + + * data-debug.el (data-debug-mode): Remove font-lock. + +2008-06-10 Eric M. Ludlam + + * cedet-autogen.el (make-autoload): + Add define-overloadable-function support. + +2008-05-31 Eric M. Ludlam + + * data-debug.el (data-debug-insert-process-props): + Display more parts of a process. + (data-debug-insert-process-button): The process status in the tag-line. + +2008-05-18 Eric M. Ludlam + + * data-debug.el (featurep): Add overlay-p. + (data-debug-insert-overlay-props): Do not use safe-length on a string. + (data-debug-insert-process-props, data-debug-insert-process-from-point) + (data-debug-insert-process-button): New process support + (data-debug-thing-alist): Use new overlay-p alias. Add process. + +2008-05-17 Eric M. Ludlam + + * data-debug.el (data-debug-insert-overlay-props): Use safe-length. + (data-debug-insert-stuff-list): Use cdr-safe. + (data-debug-insert-stuff-list-button): Use safe-length + (data-debug-insert-number): New + (data-debug-thing-alist): Support numbers. + + * mode-local.el (mode-local-font-lock-keywords): + Add `define-overloadable-function'. + +2008-05-11 Eric M. Ludlam + + * cedet.texi (top, Bug Reporting): Remove bug reporting section. + +2008-05-10 Eric M. Ludlam + + * cedet.texi (top): Add bug reporting seciont + (Bug Reporting): New section + (Code Completion): Add todo comment. + + * mode-local.el (define-overloadable-function): New name + (define-overload): Old name, now an alias. + +2008-05-04 Eric M. Ludlam + + * Makefile (VERSION): Updated. + + * Project.ede ("common"): Update version. + + * cedet.el (cedet-version): Update to pre5. + (cedet-packages): Update table of expected values. + +2008-04-20 Eric M. Ludlam + + * cedet.texi (C++ Features): + Discuss semantic-c-obey-conditional-section-parsing-flag. + +2008-04-14 Eric M. Ludlam + + * data-debug.el (data-debug-insert-thing): Autoload cookie. + +2008-04-13 Eric M. Ludlam + + * cedet.texi (C++ Features): + Update w/ new preprocessor symbol info, and details on + using custom. + +2008-04-01 Eric M. Ludlam + + * data-debug.el (overlay-properties): Compile time fix. + (data-debug-expand-or-contract-mouse): + Move point to correct window before expand. + +2008-03-27 Eric M. Ludlam + + * cedet-edebug.el (edebug-setup-hook, debugger-mode-hook): + Use data-debug-edebug-expr + bound to A instead of previous fcn. + + * Makefile (common_LISP): Add data-debug.el + + * Project.ede ("common"): Add data-debug.el + + * data-debug.el: Data Debugger, copied initially from semantic-adebug. + +2008-03-22 Eric M. Ludlam + + * cedet.texi (C++ Features): + Add detail on include path etc when referring to ede-cpp-root. + +2008-03-20 Eric M. Ludlam + + * cedet.texi (C++ Features): fix typo for semantic macro. + +2008-03-14 Eric M. Ludlam + + * cedet-load.el (cedet-compat): Added require. + +2008-03-11 Eric M. Ludlam + + * cedet.texi (Installation/Basic Configuration): cedet-build.el + (C++ Features): turn on EDE for cpp-root type. + +2008-02-28 Eric M. Ludlam + + * pulse.el (pulse-overlay-get): Fix XEmacs alias. + +2008-02-26 Eric M. Ludlam + + * cedet.texi (ECB Target): Fix italic on ECB. + (Code Completion): Link to new debugging section. + More on guady code helpers. + +2008-02-19 Eric M. Ludlam + + * cedet.texi (top): Added C++ features node + (Code Completion): Removed a block of code. Moved to ... + (C++ Features): New section. Added bits from Code Completion, plus + more about include paths and preprocessor symbol maps. + +2008-02-14 Eric M. Ludlam + + * cedet-files.el (cedet-directory-name-to-file-name): + Use `file-truename' on input file. + +2008-02-10 Eric M. Ludlam + + * cedet.texi (all): + Convert EDE, EIEIO, and other package names to use macros. + Add @url to all the URLs. + (Project Management): Rewrite this section to exclude some misc + semantic stuff, and add in some srecode stuff. + +2008-02-08 Eric M. Ludlam + + * cedet.el (default-directory): Add docdir to let. + +2008-01-29 Eric M. Ludlam + + * cedet.el (cedet-packages): Add srecode. + + * cedet.texi (top): Add Code Generation node. + (Overview): Add discussion on srecode. + (SRecode): New section + (Code Generation): New section + +2008-01-25 Eric M. Ludlam + + * mode-local.el (mode-local-read-function): + User minibuffer prompt for mode-localable functions. + +2008-01-11 Eric M. Ludlam + + * cedet.texi (EIEIO): Quick fix + (Code Completion): Reword a few things. + +2008-01-09 Eric M. Ludlam + + * pulse.el (pulse-toggle-integration-advice): + Show message if the advice is on or off. + +2007-08-14 Eric M. Ludlam + + * cedet.texi: + (Semantic, Speedbar, JDEE Target, ECB Target, Project Management) + (Code Completion): Fix inforef entries so they end in . + + * cedet.el (cedet-emacs-min-version): New const + (cedet-xemacs-min-version): New const + (default-directory): Make sure the Emacs that is running supports our + minimum version. + + * inversion.el (inversion-decoders): + Added 4 number decoder (see emacs-version) + Added patch level decoder (see XEmacs variable emacs-version) + (inversion-<): Support new decoders + (inversion-require): Return the package that was required. + (inversion-require-emacs): New function. + (inversion-unit-test): Test new version decoders. + + * pulse.el: o(pulse-toggle-integration-advice): + (goto-lin, echange-point-and-mark, find-tag, tags-search) + (tags-loop-continue, pop-tag-mark): Only pulse if interactive. + + * cedet.el (cedet-packages): Add DOCDIR column + (code : setting up paths): Add docdir entries into the Info path. + + * pulse.el (pulse-enable-integration-advice): Added more doc. + + * pulse.el (Compatibility): Added pulse-overlay-live-p, and -get + (pulse): Don't reset the pulse face. + (pulse-test): Don't test for non-pulsing Emacs. + Added test for momentary-highlight-overlay-function. + (pulse-momentary-highlight-overlay): New function. + (pulse-momentary-highlight-region): Use above. + Don't use `pulse-momentary-overaly' variable. + (pulse-momentary-unhighlight): Test new properties on the overlay. + Clear then, and reset things as best we can. + +2007-08-12 Eric M. Ludlam + + * Makefile (common_LISP): Added pulse.el + + * Project.ede: Add pulse.el. + + * cedet.texi: Added pulse.el + + * pulse.el: Pulse decoration utility. + +2007-06-07 Eric M. Ludlam + + * Makefile (Doc_TEXINFOS): New + (all): Add cedet.info + (cedet.info): New target + (clean): Add info. + + * Project.ede ("Doc"): New target. + + * cedet.texi: First draft. + +2007-06-06 Eric M. Ludlam + + * Project.ede ("common"): regress to prerelease 4 + + * Makefile (VERSION): Regress to prerelease 4 + + * cedet.el (cedet-version): Regress back to prerelease 4 + (cedet-packages): Regress some packages back to prerelease 4 + +2007-05-20 Eric M. Ludlam + + * Makefile (common_LISP): Added cedet-files.el. + + * Project.ede ("common"): Add cedet-files.el. + + * cedet-files.el (cedet-dir-sep-char): Replace semanticdb-dir-sep-char. + (cedet-directory-name-to-file-name): New. + Copied from semanticdb-file.el, semanticdb-file-name-directory. + + * cedet-compat.el (subst-char-in-string): + Compat fcn if it doesn't exist. + +2007-05-10 Eric M. Ludlam + + * cedet-edebug.el (edebug-setup-hook, debugger-mode-hook): + Add "A" binding into adebug + for displaying the values of some variables. + +2007-02-19 Eric M. Ludlam + + * working.el: (working-mode-line-update) + (working-run-with-timer, working-cancel-timer): Fix byte-comp issues. + + * inversion.el (inversion-decode-version): Use string-to-number. + (inversion-find-version): Add autoload cookie. + + * cedet.el (cedet-version): Move. Try to fix byte-comp warnings. + +2006-02-09 Eric M. Ludlam + + * inversion.el (inversion-find-version): + Don't load in the whole file while + scanning for revision numbers. + (inversion-add-to-load-path): After adding a load path, make + sure the new file has the correct revision number. + +2006-02-08 David Ponce + + * inversion.el (inversion-add-to-load-path): + Don't signal an error when shadowing + an outdated package. + +2006-02-08 Eric M. Ludlam + + * icons/Makefile (VERSION): Updated + + * Project.ede (:version): updated (removed) + + * Makefile (VERSION): updated + + * cedet.el (cedet-version): Updated + (cedet-packages): Revised all version numbers. + (cedet-version): Improved output table for use w/ PRERELEASE CHECKIST. + + * inversion.el (inversion-version): Update version number + (inversion-add-to-load-path): Throw error if revision mismatch. + +2006-01-30 David Ponce + + * mode-local.el (define-mode-local-override): + Set the `definition-name' of the + symbol generated for the mode local function, so find-func (since + Emacs 22) can locate it. + +2005-12-07 Eric M. Ludlam + + * ezimage.el: Doc Fixes. + +2005-10-13 David Ponce + + * cedet.el (cedet-packages): Update speedbar version requirement. + +2005-09-30 Eric M. Ludlam + + * cedet.el, working.el, pprint.el, mode-local.el, inversion.el, fame.el, ezimage.el, cedet-load.el, cedet-compat.el, cedet-autogen.el: + Update all GPL headers with script from savannah.gnu.org. + + * inversion.el (inversion-decoders): + Make more robust to some spacing issues. + (inversion-decode-version): Allow for empty alpha/beta values. (Assume 1) + (inversion-unit-test): Apply some whitespace issues to prove robustness. + +2005-09-29 Eric M. Ludlam + + * mode-local.el (find-func): New require. + +2005-09-01 Eric M. Ludlam + + * inversion.el (inversion-check-version): doc fix + +2005-06-30 Eric M. Ludlam + + * Project.ede (:version): Updated. + + * icons/Makefile, Makefile (VERSION): Updated. + + * cedet.el (cedet-version): Updated + (cedet-packages): Updated + + * cedet.el (cedet-version): New command. + +2005-05-06 Eric M. Ludlam + + * icons/Makefile (VERSION): Updated version. + + * Project.ede ("common"): Updated version. + + * Makefile (VERSION): Updated + (autoloads,init,setup,common): Quotes around EMACS. + + * cedet.el (cedet-version): Update revision + (cedet-packages): Update revisions of dependent packages. + +2005-04-20 Eric M. Ludlam + + * inversion.el (inversion-version): Updated + (inversion-unit-test): Added tests for new "prerelease" decoder. + +2005-04-19 David Ponce + + * inversion.el (inversion-decoders): + Rename from inversion-decoder-ring. Define + as constant. Fix prerelease regexp and doc string. + (inversion-decode-version) + (inversion-release-to-number): Update. + +2005-04-19 Eric M. Ludlam + + * inversion.el (speedbar-incompatible-version): + Support pre-release notation. + + * icons/Makefile, Makefile (VERSION): Updated. + + * Project.ede ("common"): Update Version number + + * cedet.el: Update Version Numbers. + +2005-03-24 David Ponce + + * mode-local.el (activate-mode-local-bindings): + Fix call to `local-variable-p' for + XEmacs compatibility. + +2005-02-22 Eric M. Ludlam + + * mode-local.el (find-function-regexp): + Modify it so that `find-function' can find + overloaded symbols. + +2005-02-03 Eric M. Ludlam + + * icons/Makefile (VERSION): Updated version number + + * cedet.el (cedet-version): Update version number. + + * Makefile (VERSION): Update version number + + * Project.ede ("common"): Update versin number. + +2005-01-10 David Ponce + + * mode-local.el (activate-mode-local-bindings): + Return previous bindings of + buffer-local variables overridden by mode-local bindings. + (with-mode-local): Restore buffer-local bindings overridden by + mode-local bindings. + +2004-12-13 David Ponce + + * working.el (working-noninteractive): Fixed definition. + +2004-11-29 David Ponce + + * fame.el: (fame-valid-level-values) + (fame-display-choice): Accept 'temp-nolog and 'nolog. + (fame-level-widget, fame-channel-widget): Format change. + (fame-temp-message-internal): New function. + (fame-temp-message): Use it. + (fame-temp-message-nolog): New function. + (fame-send-functions-alist): New internal constant. + (fame-send): Use it. + (define-fame-channel): Accept a doc string. Fix generated doc + string. + +2004-11-25 David Ponce + + * Makefile: Re-generate. + + * Project.ede ("common"): Add fame.el to source. + + * working.el (fame): Require. + (working-noninteractive): New function. + (working-message-echo): Use it and `fame-message-nolog'. + (working-message-emacs, working-message-xemacs): Remove. + (working-current-message): Alias of `fame-current-message'. + (working-temp-message): Alias of `fame-temp-message'. + (working-temp-message-timer, working-temp-message-delay) + (working-temp-restore-message): Remove. + + * fame.el: New library. + +2004-09-08 David Ponce + + * working.el (working-temp-restore-message): + Fix error when saved message text + contains percent characters. + +2004-07-30 Eric M. Ludlam + + * mode-local.el: Updated Commentary. + + * cedet.el: Update required version of semantic. + +2004-07-21 Eric M. Ludlam + + * icons/Makefile (VERSION): update to beta3 + (Makefile): Regenerated + + * Makefile (VERSION): Update to beta3 + + * Project.ede ("common"): Update version number. + + * cedet.el (cedet-version): Updated to beta3 + +2004-07-20 Eric M. Ludlam + + * Makefile (misc_AUX): New + (dist): Add misc_AUX + + * Project.ede ("misc"): New target. + +2004-06-29 David Ponce + + * working.el: New feature to display messages temporarily. + + (working-temp-message-delay, working-temp-message-timer) + (working-temp-message-saved): New variables. + (working-temp-restore-message) + (working-temp-message): New functions. + +2004-06-24 David Ponce + + * mode-local.el (mode-local-define-derived-mode-needed-p): + New function. + (define-derived-mode): Advice if the above returns non-nil. + + (mode-local--init-mode): New variable. + (mode-local-initialized-p): New function. + (mode-local-post-major-mode-change): Use it. + (activate-mode-local-bindings): Register the major mode for which + bindings have been activated in current buffer. + (deactivate-mode-local-bindings): Unregister it. + + * cedet.el: + Run every package setup after the `load-path' has been changed. + +2004-05-12 David Ponce + + * mode-local.el (cl): Require at compile time. + (define-derived-mode): Advise to workaround a bug in XEmacs + implementation, which don't set the `derived-mode-parent' + property. + +2004-04-29 David Ponce + + * icons/Makefile, Makefile: Rebuild. + + * Project.ede ("common"): Add mode-local.el to source. + +2004-04-28 David Ponce + + * mode-local.el: New file. + +2004-04-08 David Ponce + + * pprint.el (pprint-nil): Remove. + (pprint-nil-as-list): New function. + (pprint-lambda, pprint-defun): Use it. + (pprint-let): Likewise. Improve pretty-printing of let bindings. + (pprint-function): Fix error message. + +2004-04-06 Eric M. Ludlam + + * Makefile (dist): Distribute the autoload file + +2004-03-28 David Ponce + + * cedet.el (let): Revert previous change. + +2004-03-28 Eric M. Ludlam + + * cedet.el (cedet-packages): Added cedet-contrib + (inline code): Allow both package-load and package to be loaded. + +2004-03-11 Eric M. Ludlam + + * cedet-autogen.el (cedet-batch-update-autoloads): + When an error occurs, display both the + error message, and the more friendly usage message. + +2004-02-12 Eric M. Ludlam + + * cedet.el (cedet-version): Updated. + + * icons/Makefile (VERSION): updated. + + * Makefile (common_LISP): Added cedet-edebug. + (VERSION): Updated. + (all lisp compilation rules): updated EDE. + + * Project.ede (version): Update to beta 2. + + * Project.ede (common): Added cedet-edebug.el. + + * cedet-edebug.el (eieio,semantic-tag): Removed these dependencies. + (cedet-edebug-prin1-extensions): Removed contents. + (cedet-edebug-rebuild-prin1): Change name of generated function. + (cedet-edebug-prin1-to-string): New fcn. + (cedet-edebug-add-print-override): New utility function. + (edebug-setup-hook): Add autoload cookie. + +2003-12-29 Eric M. Ludlam + + * working.el: Zajcev Evgeny: + (senator-try-expand-semantic): Better check for minibuffer in a window. + +2003-12-11 Eric M. Ludlam + + * cedet-edebug.el: Extensions to edebug for projects in CEDET. + +2003-11-20 Eric M. Ludlam + + * cedet-autogen.el, ezimage.el: Merged with cedet-1p0beta1 branch. + +2003-10-22 Eric M. Ludlam + + * icons/Makefile: EDE Makefile for icons. + + * icons/Project.ede: EDE Project file for icons. + +2003-10-02 Eric M. Ludlam + + * Project.ede: Now a meta-subproject. + + * Makefile (dist): Remove local creation of tar file. + (icons): New target + (all): add icons. + +2003-10-01 David Ponce + + * Makefile: Re-generate. + + * Project.ede (common): Add cedet-compat.el to target sources. + + * cedet-compat.el: New file. + +2003-09-24 David Ponce + + * cedet.el (cedet-packages): Update minimum version requirements. + + * Makefile: Re-generate. + + * Project.ede (common): + Add sformat.el and working.el to target sources. + + * sformat.el, working.el: New file, moved from semantic. + +2003-09-23 David Ponce + + * inversion.el (inversion-add-to-load-path): + INSTALLDIR actually specifies where + PACKAGE is installed. + + * cedet.el (cedet-version): Change to 1.0beta1. + (cedet-packages): Add "cedet". + + Handle package installed in a directory with a different name. + + * Makefile, Project.ede, cedet-load.el: New file. + +2003-09-17 David Ponce + + * cedet.el (cedet-packages): + No more need an explicit setup file to load. + Automatically require the PACKAGE-load feature. + +2003-09-08 David Ponce + + * cedet.el (cl): Require at compile time. + (cedet-packages): Update versions. Add autoloads setup. + (main let): Don't setq default-directory. Use dolist. load the + setup library, don't require it. Don't stop if failed to load a setup + library. Print an error message and continue. + +2003-09-06 Eric M. Ludlam + + * inversion.el (inversion-version): Update current version. + + * inversion.el (inversion-require, inversion-upgrade-package): + add autoload cookie. + + * cedet-autogen.el (cedet-update-autoloads): Autoload cookie. + +2003-09-05 David Ponce + + * cedet-autogen.el (cedet-update-autoloads): + Also accept an explicit list of + directories to scan for autoloads. + +2003-09-03 David Ponce + + * cedet-autogen.el: New file. + +2003-08-06 David Ponce + + * ezimage.el (defezimage): + Fix typo in definition that uses `make-glyph'. + +2003-07-23 Eric M. Ludlam + + * inversion.el (inversion-version): set to 1.0 + +2003-07-18 Eric M. Ludlam + + * ezimage.el (ezimage-insert-image-button-maybe): + Use when instead of if. + (ezimage-insert-over-text): Only do logic if images enabled. + (ezimage-image-over-string): New fcn. + + * icons/bitsbang.xpm, icons/key.xpm, icons/lock.xpm, icons/unlock.xpm: + *** empty log message *** + +2003-07-17 Eric M. Ludlam + + * icons/bits.xpm, icons/box-minus.xpm, icons/box-plus.xpm, icons/box.xpm, icons/checkmark.xpm, icons/dir-minus.xpm, icons/dir-plus.xpm, icons/dir.xpm, icons/doc-minus.xpm, icons/doc-plus.xpm, icons/doc.xpm, icons/info.xpm, icons/key.xpm, icons/label.xpm, icons/lock.xpm, icons/mail.xpm, icons/page-minus.xpm, icons/page-plus.xpm, icons/page.xpm, icons/tag-gt.xpm, icons/tag-minus.xpm, icons/tag-plus.xpm, icons/tag-type.xpm, icons/tag-v.xpm, icons/tag.xpm, icons/unlock.xpm: + *** empty log message *** + + * ezimage.el: Image display code; extracted from speedbar. + +2003-03-04 Eric M. Ludlam + + * inversion.el (inversion-package-version): Fixed output messages. + +2003-03-03 Eric M. Ludlam + + * inversion.el (inversion-require): Make file argument optional. + +2003-03-02 Eric M. Ludlam + + * inversion.el (inversion-test): Fix typo. + + * inversion.el (inversion-reverse-test): New function. + + * inversion.el (inversion-unit-test): + New fcn built from previously inline code. + +2003-02-17 David Ponce + + * pprint.el (pprint-defvar): Fixed. + (pprint-to-string): Escape left parenthesis at beginning of line + in strings. + +2003-01-28 David Ponce + + * cedet.el: New file. + + * inversion.el (inversion-add-to-load-path): + Don't change the `load-path' if the + package directory don't exist. + +2002-12-19 David Ponce + + * inversion.el (inversion-find-version): + Use `locate-library' to avoid compatibility + problems. + +2002-12-13 David Ponce + + * inversion.el (inversion-version): Changed to 1.0beta4. + (inversion-decoder-ring): Doc fix. + (inversion-recode): Implemented. + (inversion-check-version): New function. + (inversion-test): Use it. + (inversion-add-to-load-path): New function. + +2002-12-11 David Ponce + + * inversion.el: (inversion-incompatible-version) + (inversion-test): Doc fix. + (inversion-find-data): New constant. + (inversion-find-version): New function. + (inversion-upgrade-package 'semantic): Commented out. + +2002-09-05 Eric M. Ludlam + + * inversion.el: Updated tesets. + (inversion-incompatible-version): Changed for testing + (inversion-<): Logic updates + (inversion-test): More tests + (inversion-require): Added DIRECTORY where new versions to be found. + (inversion-locate-package-files, inversion-locate-package-files-and-split) + (inversion-download-package-ask, inversion-upgrade-package): New functions. + +2002-09-03 Eric M. Ludlam + + * inversion.el: Update tests. + + * inversion.el (inversion-test): Indentation issues. + + * inversion.el (inversion-test): fixed typo. + + * inversion.el: Added history. + Checkdoc fixes. + + * inversion.el: Changed version number. + +2002-08-21 Eric M. Ludlam + + * inversion.el: Version checking functionality. + +2002-03-11 David Ponce + + * pprint.el (pprint-cond): New function. + (pprint-with): New function. + (pprint-setup-standard-printers): Use them to pretty print `cond' and + `with-...' forms. Added pretty printing of `dotimes' and + `unwind-protect'. + + * pprint.el (pprint-min-width): Moved before used. + (pprint-close-list): Ditto. Deleted code commented out. + +2002-03-10 David Ponce + + * pprint.el (pprint-sexp-try): Renamed from `pprint-sexp-width'. + (pprint-list): Use it. Handle whole list. + (pprint-close-list): Commented out code that break line. + (pprint-sexp): Simplified. + + * pprint.el (pprint-no-break-p): + Check that MOTIONS stay on the same line. + (pprint-close-list): Check for a newline instead of counting lines. + (pprint-min-width): Replaced `defconst' by `defvar'. + (pprint-to-string): Locally bind `inhibit-modification-hooks' to + non-nil. + + * pprint.el: A flexible Elisp pretty-printer. Initial revision. + diff --git a/site/cedet-1.0pre7/common/Makefile b/site/cedet-1.0pre7/common/Makefile new file mode 100644 index 0000000..589562b --- /dev/null +++ b/site/cedet-1.0pre7/common/Makefile @@ -0,0 +1,105 @@ +# Automatically Generated Makefile by EDE. +# For use with: make +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +top= +ede_FILES=Project.ede Makefile + +Doc_TEXINFOS=cedet.texi +MAKEINFO=makeinfo +misc_AUX=ChangeLog +EMACS=emacs +LOADPATH= ./ +LOADDEFS=cedet-loaddefs.el +LOADDIRS=. +init_LISP=cedet-load.el +EMACS=emacs +EMACSFLAGS=-batch --no-site-file +setup_LISP=cedet.el +common_LISP=cedet-autogen.el cedet-compat.el ezimage.el inversion.el pprint.el fame.el working.el cedet-edebug.el mode-local.el cedet-files.el pulse.el data-debug.el cedet-global.el cedet-idutils.el cedet-cscope.el cedet-graphviz.el +tests_LISP=cedet-utests.el +VERSION=1.0pre7 +DISTDIR=$(top)common-$(VERSION) + + + +all: cedet.info autoloads init setup common tests icons + +cedet.info: $(Doc_TEXINFOS) + $(MAKEINFO) $< + +.PHONY: autoloads +autoloads: + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(require 'cedet-autogen)" >> $@-compile-script + "$(EMACS)" -batch --no-site-file -l $@-compile-script -f cedet-batch-update-autoloads $(LOADDEFS) $(LOADDIRS) + +.PHONY: init +init: $(init_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: setup +setup: $(setup_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: common +common: $(common_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: tests +tests: $(tests_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY:icons +icons: + $(MAKE) -C icons + +tags: + $(MAKE) -C icons/ $(MFLAGS) $@ + + +clean: + rm -f *.elc *.html *.info* + +.PHONY: dist + +dist: cedet.info autoloads + mkdir $(DISTDIR) + cp $(Doc_TEXINFOS) cedet.info* $(misc_AUX) cedet-loaddefs.el $(init_LISP) $(setup_LISP) $(common_LISP) $(tests_LISP) $(ede_FILES) $(DISTDIR) + $(MAKE) -C icons $(MFLAGS) DISTDIR=$(DISTDIR)/icons dist + +Makefile: Project.ede + @echo Makefile is out of date! It needs to be regenerated by EDE. + @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. + @false + + + +# End of Makefile diff --git a/site/cedet-1.0pre7/common/Project.ede b/site/cedet-1.0pre7/common/Project.ede new file mode 100644 index 0000000..dbc66ab --- /dev/null +++ b/site/cedet-1.0pre7/common/Project.ede @@ -0,0 +1,50 @@ +;; Object common +;; EDE project file. +(ede-proj-project "common" + :name "common" + :version "1.0pre7" + :file "Project.ede" + :targets (list + (ede-proj-target-makefile-info "Doc" + :name "Doc" + :path "" + :source '("cedet.texi") + ) + (ede-proj-target-aux "misc" + :name "misc" + :path "" + :source '("ChangeLog") + ) + (ede-proj-target-elisp-autoloads "autoloads" + :name "autoloads" + :path "" + :autoload-file "cedet-loaddefs.el" + ) + (ede-proj-target-elisp "init" + :name "init" + :path "" + :source '("cedet-load.el") + ) + (ede-proj-target-elisp "setup" + :name "setup" + :path "" + :source '("cedet.el") + :versionsource '("cedet.el") + ) + (ede-proj-target-elisp "common" + :name "common" + :path "" + :source '("cedet-autogen.el" "cedet-compat.el" "ezimage.el" "inversion.el" "pprint.el" "fame.el" "working.el" "cedet-edebug.el" "mode-local.el" "cedet-files.el" "pulse.el" "data-debug.el" "cedet-global.el" "cedet-idutils.el" "cedet-cscope.el" "cedet-graphviz.el") + ) + (ede-proj-target-elisp "tests" + :name "tests" + :path "" + :source '("cedet-utests.el") + ) + ) + :web-site-url "http://cedet.sourceforge.net/" + :web-site-directory "/r@scp:shell.sourceforge.net:cedet/htdocs" + :ftp-upload-site "/ftp@upload.sourceforge.net:/incoming" + :configuration-variables 'nil + :metasubproject 't + ) diff --git a/site/cedet-1.0pre7/common/cedet-autogen.el b/site/cedet-1.0pre7/common/cedet-autogen.el new file mode 100644 index 0000000..79a7536 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-autogen.el @@ -0,0 +1,229 @@ +;;; cedet-autogen.el --- Generate autoloads for CEDET libraries + +;; Copyright (C) 2003, 2004, 2008 David Ponce + +;; Author: David Ponce +;; Created: 22 Aug 2003 +;; Keywords: maint +;; X-CVS: $Id: cedet-autogen.el,v 1.8 2008/07/03 02:06:19 zappo Exp $ + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Automatically generate autoloads for CEDET libraries. +;; + +;;; History: +;; + +;;; Code: +;; + +(require 'autoload) +(eval-when-compile (require 'cl)) + +;;; Compatibility +(defun cedet-autogen-noninteractive () + "Return non-nil if running non-interactively." + (if (featurep 'xemacs) + (noninteractive) + noninteractive)) + +(if (fboundp 'keywordp) + (defalias 'cedet-autogen-keywordp 'keywordp) + (defun cedet-autogen-keywordp (object) + "Return t if OBJECT is a keyword. +This means that it is a symbol with a print name beginning with `:' +interned in the initial obarray." + (and (symbolp object) + (char-equal ?: (aref 0 (symbol-name object))))) + ) + +(when (cedet-autogen-noninteractive) + ;; If the user is doing this non-interactively, we need to set up + ;; these conveniences. + (add-to-list 'load-path nil) + (setq find-file-hooks nil + find-file-suppress-same-file-warnings t) + ) + +(defadvice make-autoload (before cedet-make-autoload activate) + "Extend `make-autoload' with support for particular CEDET forms. +When a such form, like defclass, defmethod, etc., is recognized, it is +replaced with side effect by an equivalent known form before calling +the true `make-autoload' function." + (if (consp (ad-get-arg 0)) + (let* ((form (ad-get-arg 0)) + (file (ad-get-arg 1)) + (car (car-safe form)) + name args doc + ) + (cond + ((or (eq car 'define-overload) + (eq car 'define-overloadable-function)) + (setcar form 'defun) + ) + ((eq car 'defmethod) + (setq name (nth 1 form) + args (nthcdr 2 form)) + (if (cedet-autogen-keywordp (car args)) + (setq args (cdr args))) + (setq doc (nth 1 args) + args (car args)) + (setcar form 'defun) + (setcdr form (list name args (if (stringp doc) doc))) + ) + ((eq car 'defclass) + (setq name (nth 1 form) + args (nth 2 form) + doc (nth 4 form)) + ;; @todo - use eieio-defclass-autoload instead. + ;(setcar form 'defun) + ;(setcdr form (list name args (if (stringp doc) doc))) + (setcar form 'eieio-defclass-autoload) + (setcdr form (list (list 'quote name) (list 'quote args) file doc)) + )) + ))) + +(defconst cedet-autogen-header + "Auto-generated CEDET autoloads" + "Header of the auto-generated autoloads file.") + +(defconst cedet-autogen-tagfile ".cedet-lisp" + "Dummy file that indicates to scan this directory for autoloads.") + +(defun cedet-autogen-kill-xemacs-autoloads-feature () + "Remove Xemacs autoloads feature from this buffer." + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "(\\(featurep\\|provide\\) '\\sw+-autoloads" nil t) + (condition-case nil + (while t (up-list -1)) + (error nil)) + (kill-region (point) (save-excursion (forward-list) (point))) + ))) + +(defun cedet-autogen-update-header () + "Update header of the auto-generated autoloads file. +Run as `write-contents-hooks'." + (when (string-equal generated-autoload-file (buffer-file-name)) + (let ((tag (format ";;; %s ---" (file-name-nondirectory + (buffer-file-name))))) + (message "Updating header...") + (goto-char (point-min)) + (cond + ;; Replace existing header line + ((re-search-forward (concat "^" (regexp-quote tag)) nil t) + (beginning-of-line) + (kill-line 1) + ) + ;; Insert header before first ^L encountered (XEmacs) + ((re-search-forward "^ " nil t) + (beginning-of-line) + )) + (insert tag " " cedet-autogen-header) + (newline) + (when (featurep 'xemacs) + (cedet-autogen-kill-xemacs-autoloads-feature)) + (message "Updating header...done") + nil ;; Say not already written. + ))) + +(defun cedet-autogen-subdirs (root-dir) + "Return autoload candidate sub directories of ROOT-DIR. +That is, those where a `cedet-autogen-tagfile' file is found. +Return a list of directory names, relative to ROOT-DIR." + (let (dirs) + (dolist (dir (directory-files default-directory)) + (and (file-directory-p dir) (not (string-match dir "\\`..?\\'")) + (let* ((default-directory (expand-file-name dir)) + (subdirs (cedet-autogen-subdirs root-dir))) + (when (file-exists-p cedet-autogen-tagfile) + (push (file-relative-name default-directory root-dir) + subdirs)) + (setq dirs (nconc dirs subdirs))))) + dirs)) + +(defun cedet-autogen-ensure-default-file (file) + "Make sure that the autoload file FILE exists and if not create it." + ;; If file don't exist, and is not automatically created... + (unless (or (file-exists-p file) + (fboundp 'autoload-ensure-default-file)) + ;; Create a file buffer. + (find-file file) + ;; Use Unix EOLs, so that the file is portable to all platforms. + (setq buffer-file-coding-system 'raw-text-unix) + (unless (featurep 'xemacs) + ;; Insert a GNU Emacs loaddefs skeleton. + (insert ";;; " (file-name-nondirectory file) + " --- automatically extracted autoloads\n" + ";;\n" + ";;; Code:\n\n" + " \n;; Local" " Variables:\n" + ";; version-control: never\n" + ";; no-byte-compile: t\n" + ";; no-update-autoloads: t\n" + ";; End:\n" + ";;; " (file-name-nondirectory file) + " ends here\n")) + ;; Insert the header so that the buffer is not empty. + (cedet-autogen-update-header)) + file) + +;;;###autoload +(defun cedet-update-autoloads (loaddefs &optional directory &rest directories) + "Update autoloads in file LOADDEFS from sources. +Optional argument DIRECTORY, specifies the directory to scan for +autoloads. It defaults to the current directory. +DIRECTORIES is a list of extra directory to scan. Those directory +names are relative to DIRECTORY. If DIRECTORIES is nil try to scan +sub directories of DIRECTORY where a `cedet-autogen-tagfile' file +exists." + (interactive "FLoaddefs file: \nDDirectory: ") + (let* ((generated-autoload-file (expand-file-name loaddefs)) + (default-directory + (file-name-as-directory + (expand-file-name (or directory default-directory)))) + (extra-dirs (or directories + (cedet-autogen-subdirs default-directory))) + (write-contents-hooks '(cedet-autogen-update-header)) + (command-line-args-left (cons default-directory extra-dirs)) + ) + (cedet-autogen-ensure-default-file generated-autoload-file) + (batch-update-autoloads))) + +(defun cedet-batch-update-autoloads () + "Update autoloads in batch mode. +Usage: emacs -batch -f cedet-batch-update-autoloads LOADDEFS [DIRECTORY] +See the command `cedet-update-autoloads' for the meaning of the +LOADDEFS and DIRECTORY arguments." + (unless (cedet-autogen-noninteractive) + (error "\ +`cedet-batch-update-autoloads' is to be used only with -batch")) + (condition-case err + (apply 'cedet-update-autoloads command-line-args-left) + (error + (error "%S\n\ +Usage: emacs -batch -f cedet-batch-update-autoloads LOADDEFS [DIRECTORY]" + err)) + )) + +(provide 'cedet-autogen) + +;;; cedet-autogen.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-compat.el b/site/cedet-1.0pre7/common/cedet-compat.el new file mode 100644 index 0000000..dce5a95 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-compat.el @@ -0,0 +1,200 @@ +;;; cedet-compat.el --- Compatibility across (X)Emacs versions + +;; Copyright (C) 2009, 2010 Eric M. Ludlam +;; Copyright (C) 2004, 2008, 2010 David Ponce + +;; Author: David Ponce +;; Maintainer: David Ponce +;; Keywords: compatibility +;; X-RCS: $Id: cedet-compat.el,v 1.8 2010/02/19 22:43:21 zappo Exp $ + +;; This file is not part of Emacs + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; This library provides functions to allow running CEDET packages on +;; a variety of [X]Emacs versions. + +(require 'inversion) +;;; Code: + +(when (not (fboundp 'compare-strings)) + +;; XEmacs does not have the `compare-strings' function. Here is an +;; implementation in Emacs Lisp, derived from the C implementation +;; found in src/fns.c, in GNU Emacs 21.3.1 sources. +;;;###autoload +(defun compare-strings (str1 start1 end1 str2 start2 end2 &optional ignore-case) + "Compare the contents of two strings. +In string STR1, skip the first START1 characters and stop at END1. +In string STR2, skip the first START2 characters and stop at END2. +END1 and END2 default to the full lengths of the respective strings. + +Case is significant in this comparison if IGNORE-CASE is nil. + +The value is t if the strings (or specified portions) match. +If string STR1 is less, the value is a negative number N; + - 1 - N is the number of characters that match at the beginning. +If string STR1 is greater, the value is a positive number N; + N - 1 is the number of characters that match at the beginning." + (or start1 (setq start1 0)) + (or start2 (setq start2 0)) + (setq end1 (if end1 + (min end1 (length str1)) + (length str1))) + (setq end2 (if end2 + (min end2 (length str2)) + (length str2))) + (let ((i1 start1) + (i2 start2) + result c1 c2) + (while (and (not result) (< i1 end1) (< i2 end2)) + (setq c1 (aref str1 i1) + c2 (aref str2 i2) + i1 (1+ i1) + i2 (1+ i2)) + (if ignore-case + (setq c1 (upcase c1) + c2 (upcase c2))) + (setq result (cond ((< c1 c2) (- i1)) + ((> c1 c2) i1)))) + (or result + (cond ((< i1 end1) (1+ (- i1 start1))) + ((< i2 end2) (1- (- start1 i1))) + (t))) + )) + +) + +(if (not (fboundp 'booleanp)) + +;; XEmacs does not have booleanp, which is used as a :type specifier for +;; some slots of some classes in EIEIO. Define it here. +;;;###autoload +(defun boolean-p (bool) + "Return non-nil if BOOL is nil or t." + (or (null bool) (eq bool t))) + +) + +;; subst-char-in-string is not found on the XEmacs <= 21.4. Provide +;; here for compatibility. +(if (not (fboundp 'subst-char-in-string)) + +;;;###autoload +(defun subst-char-in-string (fromchar tochar string &optional inplace) + ;; From Emacs 21.3/lisp/subr.el + "Replace FROMCHAR with TOCHAR in STRING each time it occurs. +Unless optional argument INPLACE is non-nil, return a new string." + (let ((i (length string)) + (newstr (if inplace string (copy-sequence string)))) + (while (> i 0) + (setq i (1- i)) + (if (eq (aref newstr i) fromchar) + (aset newstr i tochar))) + newstr)) + +) + +(defun cedet-split-string-1 (string &optional separators omit-nulls) + "Like `split-string' in Emacs 22 and later. +STRING and SEPARATORS as with traditional `split-string' implementations. +Third argument OMIT-NULLS omits any strings that are zero length. + +Copied verbatim from Emacs 23 CVS version subr.el." + (let ((keep-nulls (not (if separators omit-nulls t))) + (rexp (or separators split-string-default-separators)) + (start 0) + notfirst + (list nil)) + (while (and (string-match rexp string + (if (and notfirst + (= start (match-beginning 0)) + (< start (length string))) + (1+ start) start)) + (< start (length string))) + (setq notfirst t) + (if (or keep-nulls (< start (match-beginning 0))) + (setq list + (cons (substring string start (match-beginning 0)) + list))) + (setq start (match-end 0))) + (if (or keep-nulls (< start (length string))) + (setq list + (cons (substring string start) + list))) + (nreverse list))) + +(when (not (fboundp 'find-coding-systems-region)) +;; XEmacs does not currently have `find-coding-systems-region'. Here +;; is an emulation, which seems sufficient for CEDET's purposes. + (defun find-coding-systems-region (begin end) + "Mimic Emacs' find-coding-system-region for XEmacs. +Return a coding system between BEGIN and END." + (if (stringp begin) + (if (equal (charsets-in-string begin) '(ascii)) + '(undecided) + (delete-if-not + #'(lambda (coding-system) + ;; Assume strings are always short enough that the + ;; condition-case is not worth it. + (query-coding-string begin coding-system t)) + + (remove-duplicates + (append + (get-language-info current-language-environment 'coding-system) + (mapcar #'coding-system-name (coding-system-list))) + :test #'eq :from-end t))) + (if (equal (charsets-in-region begin end) '(ascii)) + '(undecided) + (delete-if-not + #'(lambda (coding-system) + (condition-case nil + (query-coding-region begin end coding-system nil t t) + (text-conversion-error))) + (remove-duplicates + (append + (get-language-info current-language-environment 'coding-system) + (mapcar #'coding-system-name (coding-system-list))) + :test #'eq :from-end t))))) + ) + + +;;;###autoload +(if (or (featurep 'xemacs) (inversion-test 'emacs "22.0")) + ;; For XEmacs, or older Emacs, we need a new split string. + (defalias 'cedet-split-string 'cedet-split-string-1) + ;; For newer emacs, then the cedet-split-string is the same + ;; as the built-in one. + (defalias 'cedet-split-string 'split-string)) + + +;;;###autoload +(when (not (fboundp 'with-no-warnings)) + (put 'with-no-warnings 'lisp-indent-function 0) + (defun with-no-warnings (&rest body) + "Copied from `with-no-warnings' in Emacs 23. +Like `progn', but prevents compiler warnings in the body. +Note: Doesn't work if this version is being loaded." + ;; The implementation for the interpreter is basically trivial. + (car (last body)))) + + +(provide 'cedet-compat) + +;;; cedet-compat.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-cscope.el b/site/cedet-1.0pre7/common/cedet-cscope.el new file mode 100644 index 0000000..0efd2fb --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-cscope.el @@ -0,0 +1,160 @@ +;;; cedet-cscope.el --- CScope support for CEDET +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-cscope.el,v 1.2 2009/05/30 13:38:28 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Support using CScope for symbol lookups. + +(require 'inversion) + +(defvar cedet-cscope-min-version "16.0" + "Minimum version of GNU global required.") + +;;;###autoload +(defcustom cedet-cscope-command "cscope" + "Command name for the CScope executable." + :type 'string + :group 'cedet) + +;;; Code: +;;;###autoload +(defun cedet-cscope-search (searchtext texttype type scope) + "Perform a search with CScope, return the created buffer. +SEARCHTEXT is text to find. +TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, +'tagregexp, or 'tagcompletions. +TYPE is the type of search, meaning that SEARCHTEXT is compared to +filename, tagname (tags table), references (uses of a tag) , or +symbol (uses of something not in the tag table.) +SCOPE is the scope of the search, such as 'project or 'subdirs." + ;; CScope is an interactive program. It uses number flags + ;; in order to perform command line searches. Useful for this + ;; tool are: + ;; + ;; -0 = Find C symbol + ;; -1 = Find global definition + ;; -3 = Find references + ;; -6 = Find egrep pattern + ;; -7 = Find file + (let ((idx (cond ((eq type 'file) + "-7") + ;; Non files are symbols and such + ((eq texttype 'tagname) + "-1") + ((eq texttype 'tagregexp) + "-0") + ((eq texttype 'tagcompletions) + (setq searchtext (concat "^" searchtext ".*")) + "-1") + ((eq texttype 'regexp) + "-5") + (t + "-3") + ) + ) + ) + (cedet-cscope-call (list "-d" "-L" idx searchtext)))) + +(defun cedet-cscope-call (flags) + "Call CScope with the list of FLAGS." + (let ((b (get-buffer-create "*CEDET CScope*")) + (cd default-directory) + ) + (save-excursion + (set-buffer b) + (setq default-directory cd) + (erase-buffer)) + (apply 'call-process cedet-cscope-command + nil b nil + flags) + b)) + + +;;;###autoload +(defun cedet-cscope-expand-filename (filename) + "Expand the FILENAME with CScope. +Return a fully qualified filename." + (interactive "sFile: ") + (let* ((ans1 (save-excursion + (set-buffer (cedet-cscope-call (list "-d" "-L" "-7" filename))) + (goto-char (point-min)) + (if (looking-at "[^ \n]*cscope: ") + (error "CScope not available") + (split-string (buffer-string) "\n" t)))) + (ans2 (mapcar (lambda (hit) + (expand-file-name (car (split-string hit " ")))) + ans1))) + (when (interactive-p) + (if ans2 + (if (= (length ans2) 1) + (message "%s" (car ans2)) + (message "%s + %d others" (car ans2) + (length (cdr ans2)))) + (error "No file found"))) + ans2)) + +(defun cedet-cscope-support-for-directory (&optional dir) + "Return non-nil if CScope has a support file for DIR. +If DIR is not supplied, use the current default directory. +This works by running cscope on a bogus symbol, and looking for +the error code." + (save-excursion + (let ((default-directory (or dir default-directory))) + (set-buffer (cedet-cscope-call (list "-d" "-L" "-7" "moose"))) + (goto-char (point-min)) + (if (looking-at "[^ \n]*cscope: ") + nil + t)))) + +;;;###autoload +(defun cedet-cscope-version-check (&optional noerror) + "Check the version of the installed CScope command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil." + (interactive) + (let ((b (condition-case nil + (cedet-cscope-call (list "-V")) + (error nil))) + (rev nil)) + (if (not b) + (progn + (when (interactive-p) + (message "CScope not found.")) + nil) + (save-excursion + (set-buffer b) + (goto-char (point-min)) + (re-search-forward "cscope: version \\([0-9.]+\\)" nil t) + (setq rev (match-string 1)) + (if (inversion-check-version rev nil cedet-cscope-min-version) + (if noerror + nil + (error "Version of CScope is %s. Need at least %s" + rev cedet-cscope-min-version)) + ;; Else, return TRUE, as in good enough. + (when (interactive-p) + (message "CScope %s - Good enough for CEDET." rev)) + t))))) + +(provide 'cedet-cscope) +;;; cedet-cscope.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-edebug.el b/site/cedet-1.0pre7/common/cedet-edebug.el new file mode 100644 index 0000000..a6b8ad9 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-edebug.el @@ -0,0 +1,133 @@ +;;; cedet-edebug.el --- Special EDEBUG augmentation code + +;;; +;; Copyright (C) 2003, 2004, 2007, 2008, 2009 Eric M. Ludlam +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, you can either send email to this +;; program's author (see below) or write to: +;; +;; The Free Software Foundation, Inc. +;; 675 Mass Ave. +;; Cambridge, MA 02139, USA. +;; +;; Please send bug reports, etc. to zappo@gnu.org + +;;; Commentary: +;; +;; Some aspects of EDEBUG are not extensible. It is possible to extend +;; edebug through other means, such as alias or advice, but those don't stack +;; very well when there are multiple tools trying to do the same sort of thing. +;; +;; This package provides a way to extend some aspects of edebug, such as value +;; printing. + +(eval-when-compile + (require 'edebug) + (require 'debug) + ) + +;;; Code: +(defvar cedet-edebug-prin1-extensions nil + "An alist of of code that can extend PRIN1 for edebug. +Each entry has the value: (CONDITION . PRIN1COMMAND).") + +(defun cedet-edebug-prin1-recurse (object) + "Recurse into OBJECT for prin1 on `cedet-edebug-prin1-to-string'." + (concat "(" (mapconcat 'cedet-edebug-prin1-to-string object " ") ")")) + +(defun cedet-edebug-rebuild-prin1 () + "Rebuild the function `cedet-edebug-prin1-to-string'. +Use the values of `cedet-edebug-prin1-extensions' as the means of +constructing the function." + (interactive) + (let ((c cedet-edebug-prin1-extensions) + (code nil)) + (while c + (setq code (append (list (list (car (car c)) + (cdr (car c)))) + code)) + (setq c (cdr c))) + (fset 'cedet-edebug-prin1-to-string-inner + `(lambda (object &optional noescape) + "Display eieio OBJECT in fancy format. Overrides the edebug default. +Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate." + (cond + ,@(nreverse code) + (t (prin1-to-string object noescape))))) + )) + +(defun cedet-edebug-prin1-to-string (object &optional noescape) + "CEDET version of `edebug-prin1-to-string' that adds specialty +print methods for very large complex objects." + (if (not (fboundp 'cedet-edebug-prin1-to-string-inner)) + ;; Recreate the official fcn now. + (cedet-edebug-rebuild-prin1)) + + ;; Call the auto-generated version. + ;; This is not going to be available at compile time. + (with-no-warnings + (cedet-edebug-prin1-to-string-inner object noescape))) + + +(defun cedet-edebug-add-print-override (testfcn printfcn) + "Add a new EDEBUG print override. +TESTFCN is a routine that returns nil if the first argument +passed to it is not to use PRINTFCN. +PRINTFCN accepts an object identified by TESTFCN and +returns a string. +New tests are always added to the END of the list of tests. +See `cedet-edebug-prin1-extensions' for the official list." + (condition-case nil + (add-to-list 'cedet-edebug-prin1-extensions + (cons testfcn printfcn) + t) + (error ;; That failed, it must be an older version of Emacs + ;; withouth the append argument for `add-to-list' + ;; Doesn't handle the don't add twice case, but that's a + ;; development thing and developers probably use new emacsen. + (setq cedet-edebug-prin1-extensions + (append cedet-edebug-prin1-extensions + (list (cons testfcn printfcn)))))) + ;; whack the old implementation to force a rebuild. + (fmakunbound 'cedet-edebug-prin1-to-string-inner)) + +;;; NOTE TO SELF. Make this system used as an extension +;;; and then autoload the below. +;;;###autoload +(add-hook 'edebug-setup-hook + (lambda () + (require 'cedet-edebug) + ;; I suspect this isn't the best way to do this, but when + ;; cust-print was used on my system all my objects + ;; appeared as "#1 =" which was not useful. This allows + ;; edebug to print my objects in the nice way they were + ;; meant to with `object-print' and `class-name' + (defalias 'edebug-prin1-to-string 'cedet-edebug-prin1-to-string) + ;; Add a fancy binding into EDEBUG's keymap for ADEBUG. + (define-key edebug-mode-map "A" 'data-debug-edebug-expr) + )) + +;;; DEBUG MODE TOO +;; This seems like as good a place as any to stick this hack. +;;;###autoload +(add-hook 'debugger-mode-hook + (lambda () + (require 'cedet-edebug) + ;; Add a fancy binding into the debug mode map for ADEBUG. + (define-key debugger-mode-map "A" 'data-debug-edebug-expr) + )) + +(provide 'cedet-edebug) + +;;; cedet-edebug.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-files.el b/site/cedet-1.0pre7/common/cedet-files.el new file mode 100644 index 0000000..139457a --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-files.el @@ -0,0 +1,211 @@ +;;; cedet-files.el --- Common routines dealing with file names. + +;; Copyright (C) 2007, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-files.el,v 1.5 2009/09/12 00:01:50 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Various useful routines for dealing with file names in the tools +;; which are a part of CEDET. + +;;; Code: +(defvar cedet-dir-sep-char (if (boundp 'directory-sep-char) + (symbol-value 'directory-sep-char) + ?/) + "Character used for directory separation. +Obsoleted in some versions of Emacs. Needed in others.") + + +(defun cedet-directory-name-to-file-name (referencedir &optional testmode) + "Convert the REFERENCEDIR (a full path name) into a filename. +Converts directory seperation characters into ! characters. +Optional argument TESTMODE is used by tests to avoid conversion +to the file's truename, and dodging platform tricks." + (let ((file referencedir) + dir-sep-string) + ;; Expand to full file name + (when (not testmode) + (setq file (file-truename file))) + ;; If FILE is a directory, then force it to end in /. + (when (file-directory-p file) + (setq file (file-name-as-directory file))) + ;; Handle Windows Special cases + (when (or (memq system-type '(windows-nt ms-dos)) testmode) + ;; Replace any invalid file-name characters (for the + ;; case of backing up remote files). + (when (not testmode) + (setq file (expand-file-name (convert-standard-filename file)))) + (setq dir-sep-string (char-to-string cedet-dir-sep-char)) + ;; Normalize DOSish file names: convert all slashes to + ;; directory-sep-char, downcase the drive letter, if any, + ;; and replace the leading "x:" with "/drive_x". + (if (eq (aref file 1) ?:) + (setq file (concat dir-sep-string + "drive_" + (char-to-string (downcase (aref file 0))) + (if (eq (aref file 2) cedet-dir-sep-char) + "" + dir-sep-string) + (substring file 2))))) + ;; Make the name unique by substituting directory + ;; separators. It may not really be worth bothering about + ;; doubling `!'s in the original name... + (setq file (subst-char-in-string + cedet-dir-sep-char ?! + (replace-regexp-in-string "!" "!!" file))) + file)) + +(defun cedet-file-name-to-directory-name (referencefile &optional testmode) + "Reverse the process of `cedet-directory-name-to-file-name'. +Convert REFERENCEFILE to a directory name replacing ! with /. +Optional TESTMODE is used in tests to avoid doing some platform +specific conversions during tests." + (let ((file referencefile)) + ;; Replace the ! with / + (setq file (subst-char-in-string ?! ?/ file)) + ;; Occurances of // meant there was once a single !. + (setq file (replace-regexp-in-string "//" "!" file)) + + ;; Handle Windows special cases + (when (or (memq system-type '(windows-nt ms-dos)) testmode) + + ;; Handle drive letters from DOSish file names. + (when (string-match "^/drive_\\([a-z]\\)/" file) + (let ((driveletter (match-string 1 file)) + ) + (setq file (concat driveletter ":" + (substring file (match-end 1)))))) + + ;; Handle the \\file\name nomenclature on some windows boxes. + (when (string-match "^!" file) + (setq file (concat "//" (substring file 1)))) + ) + + file)) + +;;; Tests +;; +(defvar cedet-files-utest-list + '( + ( "/home/me/src/myproj/src/foo.c" . "!home!me!src!myproj!src!foo.c" ) + ( "c:/work/myproj/foo.el" . "!drive_c!work!myproj!foo.el" ) + ( "//windows/proj/foo.java" . "!!windows!proj!foo.java" ) + ( "/home/me/proj!bang/foo.c" . "!home!me!proj!!bang!foo.c" ) + ) + "List of different file names to test. +Each entry is a cons cell of ( FNAME . CONVERTED ) +where FNAME is some file name, and CONVERTED is what it should be +converted into.") + +;;;###autoload +(defun cedet-files-utest () + "Test out some file name conversions." + (interactive) + + (let ((idx 0)) + (dolist (FT cedet-files-utest-list) + + (setq idx (+ idx 1)) + + (let ((dir->file (cedet-directory-name-to-file-name (car FT) t)) + (file->dir (cedet-file-name-to-directory-name (cdr FT) t)) + ) + + (unless (string= (cdr FT) dir->file) + (error "Failed: %d. Found: %S Wanted: %S" + idx dir->file (cdr FT)) + ) + + (unless (string= file->dir (car FT)) + (error "Failed: %d. Found: %S Wanted: %S" + idx file->dir (car FT)) + ) + + )))) + + +;;; Compatibility +;; +;; replace-regexp-in-string is in subr.el in Emacs 21. Provide +;; here for compatibility. + +(when (not (fboundp 'replace-regexp-in-string)) + +(defun replace-regexp-in-string (regexp rep string &optional + fixedcase literal subexp start) + "Replace all matches for REGEXP with REP in STRING. + +Return a new string containing the replacements. + +Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the +arguments with the same names of function `replace-match'. If START +is non-nil, start replacements at that index in STRING. + +REP is either a string used as the NEWTEXT arg of `replace-match' or a +function. If it is a function it is applied to each match to generate +the replacement passed to `replace-match'; the match-data at this +point are such that match 0 is the function's argument. + +To replace only the first match (if any), make REGEXP match up to \\' +and replace a sub-expression, e.g. + (replace-regexp-in-string \"\\(foo\\).*\\'\" \"bar\" \" foo foo\" nil nil 1) + => \" bar foo\"" + + ;; To avoid excessive consing from multiple matches in long strings, + ;; don't just call `replace-match' continually. Walk down the + ;; string looking for matches of REGEXP and building up a (reversed) + ;; list MATCHES. This comprises segments of STRING which weren't + ;; matched interspersed with replacements for segments that were. + ;; [For a `large' number of replacements it's more efficient to + ;; operate in a temporary buffer; we can't tell from the function's + ;; args whether to choose the buffer-based implementation, though it + ;; might be reasonable to do so for long enough STRING.] + (let ((l (length string)) + (start (or start 0)) + matches str mb me) + (save-match-data + (while (and (< start l) (string-match regexp string start)) + (setq mb (match-beginning 0) + me (match-end 0)) + ;; If we matched the empty string, make sure we advance by one char + (when (= me mb) (setq me (min l (1+ mb)))) + ;; Generate a replacement for the matched substring. + ;; Operate only on the substring to minimize string consing. + ;; Set up match data for the substring for replacement; + ;; presumably this is likely to be faster than munging the + ;; match data directly in Lisp. + (string-match regexp (setq str (substring string mb me))) + (setq matches + (cons (replace-match (if (stringp rep) + rep + (funcall rep (match-string 0 str))) + fixedcase literal str subexp) + (cons (substring string start mb) ; unmatched prefix + matches))) + (setq start me)) + ;; Reconstruct a string from the pieces. + (setq matches (cons (substring string start l) matches)) ; leftover + (apply #'concat (nreverse matches))))) + +) + +(provide 'cedet-files) + +;;; cedet-files.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-global.el b/site/cedet-1.0pre7/common/cedet-global.el new file mode 100644 index 0000000..12954d6 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-global.el @@ -0,0 +1,170 @@ +;;; cedet-global.el --- GNU Global support for CEDET. + +;; Copyright (C) 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-global.el,v 1.7 2009/05/30 13:39:15 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Basic support for calling GNU Global, and testing version numbers. + +(require 'inversion) + +(defvar cedet-global-min-version "5.0" + "Minimum version of GNU global required.") + +;;;###autoload +(defcustom cedet-global-command "global" + "Command name for the GNU Global executable." + :type 'string + :group 'cedet) + +;;; Code: +;;;###autoload +(defun cedet-gnu-global-search (searchtext texttype type scope) + "Perform a search with GNU Global, return the created buffer. +SEARCHTEXT is text to find. +TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, +'tagregexp, or 'tagcompletions. +TYPE is the type of search, meaning that SEARCHTEXT is compared to +filename, tagname (tags table), references (uses of a tag) , or +symbol (uses of something not in the tag table.) +SCOPE is the scope of the search, such as 'project or 'subdirs." + (let ((flgs (cond ((eq type 'file) + "-a") + (t "-xa"))) + (scopeflgs (cond + ((eq scope 'project) + "" + ) + ((eq scope 'target) + "l"))) + (stflag (cond ((or (eq texttype 'tagname) + (eq texttype 'tagregexp)) + "") + ((eq texttype 'tagcompletions) + "c") + ((eq texttype 'regexp) + "g") + (t "r"))) + ) + (cedet-gnu-global-call (list (concat flgs scopeflgs stflag) + searchtext)))) + +(defun cedet-gnu-global-call (flags) + "Call GNU Global with the list of FLAGS." + (let ((b (get-buffer-create "*CEDET Global*")) + (cd default-directory) + ) + (save-excursion + (set-buffer b) + (setq default-directory cd) + (erase-buffer)) + (apply 'call-process cedet-global-command + nil b nil + flags) + b)) + +;;;###autoload +(defun cedet-gnu-global-expand-filename (filename) + "Expand the FILENAME with GNU Global. +Return a fully qualified filename." + (interactive "sFile: ") + (let ((ans (save-excursion + (set-buffer (cedet-gnu-global-call (list "-Pa" filename))) + (goto-char (point-min)) + (if (looking-at "global: ") + (error "GNU Global not available") + (split-string (buffer-string) "\n" t))))) + (when (interactive-p) + (if ans + (if (= (length ans) 1) + (message "%s" (car ans)) + (message "%s + %d others" (car ans) + (length (cdr ans)))) + (error "No file found"))) + ans)) + +;;;###autoload +(defun cedet-gnu-global-show-root () + "Show the root of a GNU Global area under the current buffer." + (interactive) + (message "%s" (cedet-gnu-global-root))) + +;;;###autoload +(defun cedet-gnu-global-root (&optional dir) + "Return the root of any GNU Global scanned project. +If a default starting DIR is not specified, the current buffer's +`default-directory' is used." + (let ((default-directory (or dir default-directory)) + ) + (save-excursion + (set-buffer (cedet-gnu-global-call (list "-pq"))) + (goto-char (point-min)) + (when (not (eobp)) + (file-name-as-directory + (buffer-substring (point) (point-at-eol))))))) + +;;;###autoload +(defun cedet-gnu-global-version-check (&optional noerror) + "Check the version of the installed GNU Global command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil." + (interactive) + (let ((b (condition-case nil + (cedet-gnu-global-call (list "--version")) + (error nil))) + (rev nil)) + (if (not b) + (progn + (when (interactive-p) + (message "GNU Global not found.")) + nil) + (save-excursion + (set-buffer b) + (goto-char (point-min)) + (re-search-forward "GNU GLOBAL \\([0-9.]+\\)" nil t) + (setq rev (match-string 1)) + (if (inversion-check-version rev nil cedet-global-min-version) + (if noerror + nil + (error "Version of GNU Global is %s. Need at least %s" + rev cedet-global-min-version)) + ;; Else, return TRUE, as in good enough. + (when (interactive-p) + (message "GNU Global %s - Good enough for CEDET." rev)) + t))))) + +(defun cedet-gnu-global-scan-hits (buffer) + "Scan all the hits from the GNU Global output BUFFER." + (let ((hits nil) + (r1 "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) ")) + (save-excursion + (set-buffer buffer) + (goto-char (point-min)) + (while (re-search-forward r1 nil t) + (setq hits (cons (cons (string-to-number (match-string 2)) + (match-string 3)) + hits))) + ;; Return the results + (nreverse hits)))) + +(provide 'cedet-global) +;;; cedet-global.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-graphviz.el b/site/cedet-1.0pre7/common/cedet-graphviz.el new file mode 100644 index 0000000..80d8b79 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-graphviz.el @@ -0,0 +1,117 @@ +;;; cedet-graphviz.el --- Support for running graphviz programs for CEDET. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-graphviz.el,v 1.6 2009/04/09 02:10:06 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; COGRE uses graphviz to export to some kinds of image formats. +;; +;; This file supports running various graphviz programs, such as dot. + +;;; Code: + +(require 'inversion) + +(defvar cedet-graphviz-min-version "2.8" + "Minimum version of Graphviz DOT program required.") + +;;;###autoload +(defcustom cedet-graphviz-dot-command "dot" + "Command name for the Graphviz DOT executable." + :type 'string + :group 'cedet) + +;;;###autoload +(defcustom cedet-graphviz-neato-command "neato" + "Command name for the Graphviz NEATO executable." + :type 'string + :group 'cedet) + +(defun cedet-graphviz-dot-call (flags) + "Call Graphviz DOT with the list of FLAGS." + (let ((b (get-buffer-create "*CEDET graphviz dot*")) + (cd default-directory) + ) + (save-excursion + (set-buffer b) + (setq default-directory cd) + (erase-buffer)) + (apply 'call-process cedet-graphviz-dot-command + nil b nil flags) + b)) + +(defun cedet-graphviz-neato-call (flags) + "Call Graphviz DOT with the list of FLAGS." + (let ((b (get-buffer-create "*CEDET graphviz neato*")) + (cd default-directory) + ) + (save-excursion + (set-buffer b) + (setq default-directory cd) + (erase-buffer)) + (apply 'call-process cedet-graphviz-neato-command + nil b nil flags) + b)) + +(defun cedet-graphviz-translate-file (bufferin fileout &optional outputformat &rest flags) + "Translate BUFFERIN to FILEOUT with OUTPUTFORMAT. +If FILEOUT is nil, then the output of neato is the translation. +The OUTPUTFORMAT is one of the dot names for an output, such as png. +The -T is appended in this function. If OUTPUTFORMAT is not supplied, then +ps is assumed. +The rest of the argument FLAGS are more flags to pass to dot." + (let* ((T (or outputformat "ps")) + (infile (buffer-file-name bufferin)) + (allflags (append flags + (list (concat "-T" T)) + (if fileout (list (concat "-o" fileout))) + (list infile)) + )) + (if (member "-n" flags) + (cedet-graphviz-neato-call allflags) + (cedet-graphviz-dot-call allflags)))) + +;;;###autoload +(defun cedet-graphviz-dot-version-check (&optional noerror) + "Check the version of the installed Graphviz dot command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil." + (interactive) + (let ((b (cedet-graphviz-dot-call (list "-V"))) + (rev nil)) + (save-excursion + (set-buffer b) + (goto-char (point-min)) + (re-search-forward "dot \\(?:- graphviz \\)?version \\([0-9.]+\\)" nil t) + (setq rev (match-string 1)) + (if (inversion-check-version rev nil cedet-graphviz-min-version) + (if noerror + nil + (error "Version of Graphviz 'dot' is %s. Need at least %s" + rev cedet-graphviz-min-version)) + ;; Else, return TRUE, as in good enough. + (when (interactive-p) + (message "Graphviz Version %s - Good enough for CEDET." rev)) + t)))) + +(provide 'cedet-graphviz) +;;; cedet-graphviz.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-idutils.el b/site/cedet-1.0pre7/common/cedet-idutils.el new file mode 100644 index 0000000..2196fb7 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-idutils.el @@ -0,0 +1,182 @@ +;;; cedet-idutils.el --- ID Utils support for CEDET. +;; +;; Copyright (C) 2009 Eric M. Ludlam +;; +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-idutils.el,v 1.2 2009/05/30 13:33:45 zappo Exp $ +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Basic support calling ID Utils functions, and checking version +;; numbers. + +(require 'inversion) + +(defvar cedet-idutils-min-version "4.0" + "Minimum version of ID Utils required.") + +;;;###autoload +(defcustom cedet-idutils-file-command "fnid" + "Command name for the ID Utils executable for searching file names." + :type 'string + :group 'cedet) + +;;;###autoload +(defcustom cedet-idutils-token-command "lid" + "Command name for the ID Utils executable for searching for tokens." + :type 'string + :group 'cedet) + +;;; Code: +(defun cedet-idutils-search (searchtext texttype type scope) + "Perform a search with IDUtils, return the created buffer. +SEARCHTEXT is text to find. +TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, +'tagregexp, or 'tagcompletions. +TYPE is the type of search, meaning that SEARCHTEXT is compared to +filename, tagname (tags table), references (uses of a tag) , or +symbol (uses of something not in the tag table.) +SCOPE is the scope of the search, such as 'project or 'subdirs. +Note: Scope is not yet supported." + (if (eq type 'file) + ;; Calls for file stuff is very simple. + (cedet-idutils-fnid-call (list searchtext)) + ;; Calls for text searches is more complex. + (let* ((resultflg (if (eq texttype 'tagcompletions) + (list "--key=token") + (list "--result=grep"))) + (scopeflgs nil) ; (cond ((eq scope 'project) "" ) ((eq scope 'target) "l"))) + (stflag (cond ((or (eq texttype 'tagname) + (eq texttype 'tagregexp)) + (list "-r" "-w")) + ((eq texttype 'tagcompletions) + ;; Add regex to search text for beginning of char. + (setq searchtext (concat "^" searchtext)) + (list "-r" "-s" )) + ((eq texttype 'regexp) + (list "-r")) + ;; t means 'symbol + (t (list "-l" "-w")))) + ) + (cedet-idutils-lid-call (append resultflg scopeflgs stflag (list searchtext)))) + )) + +(defun cedet-idutils-fnid-call (flags) + "Call ID Utils fnid with the list of FLAGS. +Return the created buffer with with program output." + (let ((b (get-buffer-create "*CEDET fnid*")) + (cd default-directory) + ) + (save-excursion + (set-buffer b) + (setq default-directory cd) + (erase-buffer)) + (apply 'call-process cedet-idutils-file-command + nil b nil + flags) + b)) + +(defun cedet-idutils-lid-call (flags) + "Call ID Utils lid with the list of FLAGS. +Return the created buffer with with program output." + (let ((b (get-buffer-create "*CEDET lid*")) + (cd default-directory) + ) + (save-excursion + (set-buffer b) + (setq default-directory cd) + (erase-buffer)) + (apply 'call-process cedet-idutils-token-command + nil b nil + flags) + b)) + +;;; UTIL CALLS +;; +;;;###autoload +(defun cedet-idutils-expand-filename (filename) + "Expand the FILENAME with IDUtils. +Return a filename relative to the default directory." + (interactive "sFile: ") + (let ((ans (save-excursion + (set-buffer (cedet-idutils-fnid-call (list filename))) + (goto-char (point-min)) + (if (looking-at "[^ \n]*fnid: ") + (error "ID Utils not available") + (split-string (buffer-string) "\n" t))))) + (setq ans (mapcar 'expand-file-name ans)) + (when (interactive-p) + (if ans + (if (= (length ans) 1) + (message "%s" (car ans)) + (message "%s + %d others" (car ans) + (length (cdr ans)))) + (error "No file found"))) + ans)) + +(defun cedet-idutils-support-for-directory (&optional dir) + "Return non-nil if IDUtils has a support file for DIR. +If DIR is not supplied, use the current default directory. +This works by running lid on a bogus symbol, and looking for +the error code." + (save-excursion + (let ((default-directory (or dir default-directory))) + (condition-case nil + (progn + (set-buffer (cedet-idutils-fnid-call '("moose"))) + (goto-char (point-min)) + (if (looking-at "[^ \n]*fnid: ") + nil + t)) + (error nil))))) + +;;;###autoload +(defun cedet-idutils-version-check (&optional noerror) + "Check the version of the installed ID Utils command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil." + (interactive) + (let ((b (condition-case nil + (cedet-idutils-fnid-call (list "--version")) + (error nil))) + (rev nil)) + (if (not b) + (progn + (when (interactive-p) + (message "ID Utils not found.")) + nil) + (save-excursion + (set-buffer b) + (goto-char (point-min)) + (re-search-forward "fnid - \\([0-9.]+\\)" nil t) + (setq rev (match-string 1)) + (if (inversion-check-version rev nil cedet-idutils-min-version) + (if noerror + nil + (error "Version of ID Utis is %s. Need at least %s" + rev cedet-idutils-min-version)) + ;; Else, return TRUE, as in good enough. + (when (interactive-p) + (message "ID Utils %s - Good enough for CEDET." rev)) + t))))) + + +(provide 'cedet-idutils) +;;; cedet-idutils.el ends here + diff --git a/site/cedet-1.0pre7/common/cedet-load.el b/site/cedet-1.0pre7/common/cedet-load.el new file mode 100644 index 0000000..22d4cbb --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-load.el @@ -0,0 +1,38 @@ +;;; cedet-load.el --- Load definitions for CEDET's common libraries + +;;; Copyright (C) 2008 Eric M. Ludlam +;;; Copyright (C) 2003 David Ponce + +;; Author: David Ponce +;; X-RCS: $Id: cedet-load.el,v 1.3 2008/03/14 22:38:15 zappo Exp $ + +;; CEDET is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Initialize CEDET's common libraries for all supported conditions. + +;;; Code: +;; + +;;; Common autoloads +;; +(load "cedet-loaddefs" nil t) +(require 'cedet-compat) + +(provide 'cedet-load) + +;;; cedet-load.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-loaddefs.el b/site/cedet-1.0pre7/common/cedet-loaddefs.el new file mode 100644 index 0000000..afd31e1 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-loaddefs.el @@ -0,0 +1,484 @@ +;;; cedet-loaddefs.el --- Auto-generated CEDET autoloads +;; +;;; Code: + + +;;;### (autoloads (cedet-update-autoloads) "cedet-autogen" "cedet-autogen.el" +;;;;;; (18540 13339)) +;;; Generated autoloads from cedet-autogen.el + +(autoload 'cedet-update-autoloads "cedet-autogen" "\ +Update autoloads in file LOADDEFS from sources. +Optional argument DIRECTORY, specifies the directory to scan for +autoloads. It defaults to the current directory. +DIRECTORIES is a list of extra directory to scan. Those directory +names are relative to DIRECTORY. If DIRECTORIES is nil try to scan +sub directories of DIRECTORY where a `cedet-autogen-tagfile' file +exists. + +\(fn LOADDEFS &optional DIRECTORY &rest DIRECTORIES)" t nil) + +;;;*** + +;;;### (autoloads nil "cedet-compat" "cedet-compat.el" (19328 21693)) +;;; Generated autoloads from cedet-compat.el + +(if (or (featurep 'xemacs) (inversion-test 'emacs "22.0")) (defalias 'cedet-split-string 'cedet-split-string-1) (defalias 'cedet-split-string 'split-string)) + +(when (not (fboundp 'with-no-warnings)) (put 'with-no-warnings 'lisp-indent-function 0) (defun with-no-warnings (&rest body) "Copied from `with-no-warnings' in Emacs 23.\nLike `progn', but prevents compiler warnings in the body.\nNote: Doesn't work if this version is being loaded." (car (last body)))) + +;;;*** + +;;;### (autoloads (cedet-cscope-version-check cedet-cscope-expand-filename +;;;;;; cedet-cscope-search cedet-cscope-command) "cedet-cscope" +;;;;;; "cedet-cscope.el" (18977 14036)) +;;; Generated autoloads from cedet-cscope.el + +(defvar cedet-cscope-command "cscope" "\ +Command name for the CScope executable.") + +(custom-autoload 'cedet-cscope-command "cedet-cscope" t) + +(autoload 'cedet-cscope-search "cedet-cscope" "\ +Perform a search with CScope, return the created buffer. +SEARCHTEXT is text to find. +TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, +'tagregexp, or 'tagcompletions. +TYPE is the type of search, meaning that SEARCHTEXT is compared to +filename, tagname (tags table), references (uses of a tag) , or +symbol (uses of something not in the tag table.) +SCOPE is the scope of the search, such as 'project or 'subdirs. + +\(fn SEARCHTEXT TEXTTYPE TYPE SCOPE)" nil nil) + +(autoload 'cedet-cscope-expand-filename "cedet-cscope" "\ +Expand the FILENAME with CScope. +Return a fully qualified filename. + +\(fn FILENAME)" t nil) + +(autoload 'cedet-cscope-version-check "cedet-cscope" "\ +Check the version of the installed CScope command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil. + +\(fn &optional NOERROR)" t nil) + +;;;*** + +;;;### (autoloads nil "cedet-edebug" "cedet-edebug.el" (19122 48399)) +;;; Generated autoloads from cedet-edebug.el + +(add-hook 'edebug-setup-hook (lambda nil (require 'cedet-edebug) (defalias 'edebug-prin1-to-string 'cedet-edebug-prin1-to-string) (define-key edebug-mode-map "A" 'data-debug-edebug-expr))) + +(add-hook 'debugger-mode-hook (lambda nil (require 'cedet-edebug) (define-key debugger-mode-map "A" 'data-debug-edebug-expr))) + +;;;*** + +;;;### (autoloads (cedet-files-utest) "cedet-files" "cedet-files.el" +;;;;;; (19122 48399)) +;;; Generated autoloads from cedet-files.el + +(autoload 'cedet-files-utest "cedet-files" "\ +Test out some file name conversions. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cedet-gnu-global-version-check cedet-gnu-global-root +;;;;;; cedet-gnu-global-show-root cedet-gnu-global-expand-filename +;;;;;; cedet-gnu-global-search cedet-global-command) "cedet-global" +;;;;;; "cedet-global.el" (18977 14083)) +;;; Generated autoloads from cedet-global.el + +(defvar cedet-global-command "global" "\ +Command name for the GNU Global executable.") + +(custom-autoload 'cedet-global-command "cedet-global" t) + +(autoload 'cedet-gnu-global-search "cedet-global" "\ +Perform a search with GNU Global, return the created buffer. +SEARCHTEXT is text to find. +TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, +'tagregexp, or 'tagcompletions. +TYPE is the type of search, meaning that SEARCHTEXT is compared to +filename, tagname (tags table), references (uses of a tag) , or +symbol (uses of something not in the tag table.) +SCOPE is the scope of the search, such as 'project or 'subdirs. + +\(fn SEARCHTEXT TEXTTYPE TYPE SCOPE)" nil nil) + +(autoload 'cedet-gnu-global-expand-filename "cedet-global" "\ +Expand the FILENAME with GNU Global. +Return a fully qualified filename. + +\(fn FILENAME)" t nil) + +(autoload 'cedet-gnu-global-show-root "cedet-global" "\ +Show the root of a GNU Global area under the current buffer. + +\(fn)" t nil) + +(autoload 'cedet-gnu-global-root "cedet-global" "\ +Return the root of any GNU Global scanned project. +If a default starting DIR is not specified, the current buffer's +`default-directory' is used. + +\(fn &optional DIR)" nil nil) + +(autoload 'cedet-gnu-global-version-check "cedet-global" "\ +Check the version of the installed GNU Global command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil. + +\(fn &optional NOERROR)" t nil) + +;;;*** + +;;;### (autoloads (cedet-graphviz-dot-version-check cedet-graphviz-neato-command +;;;;;; cedet-graphviz-dot-command) "cedet-graphviz" "cedet-graphviz.el" +;;;;;; (18909 22782)) +;;; Generated autoloads from cedet-graphviz.el + +(defvar cedet-graphviz-dot-command "dot" "\ +Command name for the Graphviz DOT executable.") + +(custom-autoload 'cedet-graphviz-dot-command "cedet-graphviz" t) + +(defvar cedet-graphviz-neato-command "neato" "\ +Command name for the Graphviz NEATO executable.") + +(custom-autoload 'cedet-graphviz-neato-command "cedet-graphviz" t) + +(autoload 'cedet-graphviz-dot-version-check "cedet-graphviz" "\ +Check the version of the installed Graphviz dot command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil. + +\(fn &optional NOERROR)" t nil) + +;;;*** + +;;;### (autoloads (cedet-idutils-version-check cedet-idutils-expand-filename +;;;;;; cedet-idutils-token-command cedet-idutils-file-command) "cedet-idutils" +;;;;;; "cedet-idutils.el" (18977 13753)) +;;; Generated autoloads from cedet-idutils.el + +(defvar cedet-idutils-file-command "fnid" "\ +Command name for the ID Utils executable for searching file names.") + +(custom-autoload 'cedet-idutils-file-command "cedet-idutils" t) + +(defvar cedet-idutils-token-command "lid" "\ +Command name for the ID Utils executable for searching for tokens.") + +(custom-autoload 'cedet-idutils-token-command "cedet-idutils" t) + +(autoload 'cedet-idutils-expand-filename "cedet-idutils" "\ +Expand the FILENAME with IDUtils. +Return a filename relative to the default directory. + +\(fn FILENAME)" t nil) + +(autoload 'cedet-idutils-version-check "cedet-idutils" "\ +Check the version of the installed ID Utils command. +If optional programatic argument NOERROR is non-nil, then +instead of throwing an error if Global isn't available, then +return nil. + +\(fn &optional NOERROR)" t nil) + +;;;*** + +;;;### (autoloads (cedet-utest-batch cedet-utest) "cedet-utests" +;;;;;; "cedet-utests.el" (19326 59186)) +;;; Generated autoloads from cedet-utests.el + +(autoload 'cedet-utest "cedet-utests" "\ +Run the CEDET unittests. +EXIT-ON-ERROR causes the test suite to exit on an error, instead +of just logging the error. + +\(fn &optional EXIT-ON-ERROR)" t nil) + +(autoload 'cedet-utest-batch "cedet-utests" "\ +Run the CEDET unit test in BATCH mode. + +\(fn)" nil nil) + +;;;*** + +;;;### (autoloads (data-debug-eval-expression data-debug-edebug-expr +;;;;;; data-debug-show-stuff data-debug-new-buffer data-debug-mode +;;;;;; data-debug-insert-thing data-debug-insert-stuff-vector data-debug-insert-stuff-list +;;;;;; data-debug-insert-widget-properties data-debug-insert-hash-table +;;;;;; data-debug-insert-property-list) "data-debug" "data-debug.el" +;;;;;; (19122 48399)) +;;; Generated autoloads from data-debug.el + +(autoload 'data-debug-insert-property-list "data-debug" "\ +Insert the property list PROPLIST. +Each line starts with PREFIX. +The attributes belong to the tag PARENT. + +\(fn PROPLIST PREFIX &optional PARENT)" nil nil) + +(autoload 'data-debug-insert-hash-table "data-debug" "\ +Insert the contents of HASH-TABLE inserting PREFIX before each element. + +\(fn HASH-TABLE PREFIX)" nil nil) + +(autoload 'data-debug-insert-widget-properties "data-debug" "\ +Insert the contents of WIDGET inserting PREFIX before each element. + +\(fn WIDGET PREFIX)" nil nil) + +(autoload 'data-debug-insert-stuff-list "data-debug" "\ +Insert all the parts of STUFFLIST. +PREFIX specifies what to insert at the start of each line. + +\(fn STUFFLIST PREFIX)" nil nil) + +(autoload 'data-debug-insert-stuff-vector "data-debug" "\ +Insert all the parts of STUFFVECTOR. +PREFIX specifies what to insert at the start of each line. + +\(fn STUFFVECTOR PREFIX)" nil nil) + +(autoload 'data-debug-insert-thing "data-debug" "\ +Insert THING with PREFIX. +PREBUTTONTEXT is some text to insert between prefix and the thing +that is not included in the indentation calculation of any children. +If PARENT is non-nil, it is somehow related as a parent to thing. + +\(fn THING PREFIX PREBUTTONTEXT &optional PARENT)" nil nil) + +(autoload 'data-debug-mode "data-debug" "\ +Major-mode for the Analyzer debugger. + +\\{data-debug-map} + +\(fn)" t nil) + +(autoload 'data-debug-new-buffer "data-debug" "\ +Create a new ddebug buffer with NAME. + +\(fn NAME)" nil nil) + +(autoload 'data-debug-show-stuff "data-debug" "\ +Data debug STUFF in a buffer named *NAME DDebug*. + +\(fn STUFF NAME)" nil nil) + +(autoload 'data-debug-edebug-expr "data-debug" "\ +Dump out the contets of some expression EXPR in edebug with ddebug. + +\(fn EXPR)" t nil) + +(autoload 'data-debug-eval-expression "data-debug" "\ +Evaluate EXPR and display the value. +If the result is something simple, show it in the echo area. +If the result is a list or vector, then use the data debugger to display it. + +\(fn EXPR)" t nil) + +;;;*** + +;;;### (autoloads (define-fame-channel) "fame" "fame.el" (17213 39681)) +;;; Generated autoloads from fame.el + +(autoload 'define-fame-channel "fame" "\ +Define the new message channel CHANNEL. +CHANNEL must be a non-nil symbol. +The optional argument DEFAULT specifies the default value of message +levels for this channel. By default it is the value of +`fame-default-level-values'. +DOCSTRING is an optional channel documentation. + +This defines the option `CHANNEL-fame-levels' to customize the current +value of message levels. And the functions `CHANNEL-send-debug', +`CHANNEL-send-info', `CHANNEL-send-warning', and `CHANNEL-send-error', +that respectively send debug, informational, warning, and error +messages to CHANNEL. + +\(fn CHANNEL &optional DEFAULT DOCSTRING)" nil (quote macro)) + +;;;*** + +;;;### (autoloads (inversion-upgrade-package inversion-add-to-load-path +;;;;;; inversion-find-version inversion-require-emacs inversion-require) +;;;;;; "inversion" "inversion.el" (19326 59186)) +;;; Generated autoloads from inversion.el + +(autoload 'inversion-require "inversion" "\ +Declare that you need PACKAGE with at least VERSION. +PACKAGE might be found in FILE. (See `require'.) +Throws an error if VERSION is incompatible with what is installed. +Optional argument DIRECTORY is a location where new versions of +this tool can be located. If there is a versioning problem and +DIRECTORY is provided, inversion will offer to download the file. +Optional argument RESERVED is saved for later use. + +\(fn PACKAGE VERSION &optional FILE DIRECTORY &rest RESERVED)" nil nil) + +(autoload 'inversion-require-emacs "inversion" "\ +Declare that you need either EMACS-VER, or XEMACS-VER. +Only checks one based on which kind of Emacs is being run. + +\(fn EMACS-VER XEMACS-VER)" nil nil) + +(autoload 'inversion-find-version "inversion" "\ +Search for the version and incompatible version of PACKAGE. +Does not load PACKAGE nor requires that it has been previously loaded. +Search in the directories in `load-path' for a PACKAGE.el library. +Visit the file found and search for the declarations of variables or +constants `PACKAGE-version' and `PACKAGE-incompatible-version'. The +value of these variables must be a version string. + +Return a pair (VERSION-STRING . INCOMPATIBLE-VERSION-STRING) where +INCOMPATIBLE-VERSION-STRING can be nil. +Return nil when VERSION-STRING was not found. + +\(fn PACKAGE)" nil nil) + +(autoload 'inversion-add-to-load-path "inversion" "\ +Add the PACKAGE path to `load-path' if necessary. +MINIMUM is the minimum version requirement of PACKAGE. +Optional argument INSTALLDIR is the base directory where PACKAGE is +installed. It defaults to `default-directory'/PACKAGE. +SUBDIRS are sub-directories to add to `load-path', following the main +INSTALLDIR path. + +\(fn PACKAGE MINIMUM &optional INSTALLDIR &rest SUBDIRS)" nil nil) + +(autoload 'inversion-upgrade-package "inversion" "\ +Try to upgrade PACKAGE in DIRECTORY is available. + +\(fn PACKAGE &optional DIRECTORY)" t nil) + +;;;*** + +;;;### (autoloads (mode-local-read-function) "mode-local" "mode-local.el" +;;;;;; (19122 48399)) +;;; Generated autoloads from mode-local.el + +(autoload 'mode-local-read-function "mode-local" "\ +Interactively read in the name of a mode-local function. +PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'. + +\(fn PROMPT &optional INITIAL HIST DEFAULT)" nil nil) + +;;;*** + +;;;### (autoloads (pprint-function pprint pprint-to-string) "pprint" +;;;;;; "pprint.el" (17213 39693)) +;;; Generated autoloads from pprint.el + +(autoload 'pprint-to-string "pprint" "\ +Return a string containing the pretty-printed representation of OBJECT. +OBJECT can be any Lisp object. Quoting characters are used as needed +to make output that `read' can handle, whenever this is possible. The +pretty printer try as much as possible to limit the length of lines to +given WIDTH. WIDTH value defaults to `fill-column'. + +\(fn OBJECT &optional WIDTH)" nil nil) + +(autoload 'pprint "pprint" "\ +Output the pretty-printed representation of OBJECT, any Lisp object. +Quoting characters are printed as needed to make output that `read' +can handle, whenever this is possible. Output stream is STREAM, or +value of `standard-output' (which see). The pretty printer try as +much as possible to limit the length of lines to given WIDTH. WIDTH +value defaults to `fill-column'. + +\(fn OBJECT &optional STREAM WIDTH)" nil nil) + +(autoload 'pprint-function "pprint" "\ +See a pretty-printed representation of FUNCTION-NAME. + +\(fn FUNCTION-NAME)" t nil) + +;;;*** + +;;;### (autoloads (pulse-line-hook-function pulse-toggle-integration-advice +;;;;;; pulse-momentary-highlight-region pulse-momentary-highlight-one-line +;;;;;; pulse-momentary-highlight-overlay pulse-test pulse) "pulse" +;;;;;; "pulse.el" (19122 48399)) +;;; Generated autoloads from pulse.el + +(autoload 'pulse "pulse" "\ +Pulse the colors on our highlight face. +If optional FACE is provide, reset the face to FACE color, +instead of `pulse-highlight-start-face'. +Be sure to call `pulse-reset-face' after calling pulse. + +\(fn &optional FACE)" nil nil) + +(autoload 'pulse-test "pulse" "\ +Test the lightening function for pulsing a line. +When optional NO-ERROR Don't throw an error if we can't run tests. + +\(fn &optional NO-ERROR)" t nil) + +(autoload 'pulse-momentary-highlight-overlay "pulse" "\ +Pulse the overlay O, unhighlighting before next command. +Optional argument FACE specifies the fact to do the highlighting. + +\(fn O &optional FACE)" nil nil) + +(autoload 'pulse-momentary-highlight-one-line "pulse" "\ +Highlight the line around POINT, unhighlighting before next command. +Optional argument FACE specifies the face to do the highlighting. + +\(fn POINT &optional FACE)" nil nil) + +(autoload 'pulse-momentary-highlight-region "pulse" "\ +Highlight between START and END, unhighlighting before next command. +Optional argument FACE specifies the fact to do the highlighting. + +\(fn START END &optional FACE)" nil nil) + +(autoload 'pulse-toggle-integration-advice "pulse" "\ +Toggle activation of advised functions that will now pulse. +Wint no ARG, toggle the pulse advice. +With a negative ARG, disable pulse advice. +With a positive ARG, enable pulse advice. +Currently advised functions include: + `goto-line' + `exchange-point-and-mark' + `find-tag' + `tags-search' + `tags-loop-continue' + `pop-tag-mark' + `imenu-default-goto-function' +Pulsing via `pulse-line-hook-function' has also been added to +the following hook: + `next-error-hook' + +\(fn ARG)" t nil) + +(autoload 'pulse-line-hook-function "pulse" "\ +Function used in hooks to pulse the current line. +Only pulses the line if `pulse-command-advice-flag' is non-nil. + +\(fn)" nil nil) + +;;;*** + +;;;### (autoloads nil nil ("cedet-load.el" "cedet.el" "ezimage.el" +;;;;;; "working.el") (19335 11024 146216)) + +;;;*** + +(provide 'cedet-loaddefs) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; cedet-loaddefs.el ends here diff --git a/site/cedet-1.0pre7/common/cedet-utests.el b/site/cedet-1.0pre7/common/cedet-utests.el new file mode 100644 index 0000000..2797fcb --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet-utests.el @@ -0,0 +1,394 @@ +;;; cedet-utests.el --- Run all unit tests in the CEDET suite. + +;; Copyright (C) 2008, 2009, 2010 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: cedet-utests.el,v 1.22 2010/02/16 02:08:14 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Remembering to run all the unit tests available in CEDET one at a +;; time is a bit time consuming. This links all the tests together +;; into one command. + +(require 'cedet) +;;; Code: +(defvar cedet-utest-test-alist + '( + ;; + ;; COMMON + ;; + + ;; Test inversion + ("inversion" . inversion-unit-test) + + ;; EZ Image dumping. + ("ezimage associations" . ezimage-image-association-dump) + ("ezimage images" . ezimage-image-dump) + + ;; Workging interactive tests. + ("working: wait-for-keypress" . + (lambda () + (if (cedet-utest-noninteractive) + (message " ** Skipping test in noninteractive mode.") + (working-wait-for-keypress)))) + ;("working: sleep" . working-verify-sleep) + + ;; Pulse + ("pulse interactive test" . (lambda () (pulse-test t))) + + ;; Files + ("cedet file conversion" . cedet-files-utest) + + ;; + ;; EIEIO + ;; + ("eieio" . (lambda () (let ((lib (locate-library "eieio-tests.el" + t))) + (load-file lib)))) + ("eieio: browser" . eieio-browse) + ("eieio: custom" . (lambda () + (require 'eieio-custom) + (customize-variable 'eieio-widget-test))) + ("eieio: chart" . (lambda () + (if (cedet-utest-noninteractive) + (message " ** Skipping test in noninteractive mode.") + (chart-test-it-all)))) + ;; + ;; EDE + ;; + + ;; @todo - Currently handled in the integration tests. Need + ;; some simpler unit tests here. + + ;; + ;; SEMANTIC + ;; + ("semantic: lex spp table write" . semantic-lex-spp-write-utest) + ("semantic: multi-lang parsing" . semantic-utest-main) + ("semantic: C preprocessor" . semantic-utest-c) + ("semantic: analyzer tests" . semantic-ia-utest) + ("semanticdb: data cache" . semantic-test-data-cache) + ("semantic: throw-on-input" . + (lambda () + (if (cedet-utest-noninteractive) + (message " ** Skipping test in noninteractive mode.") + (semantic-test-throw-on-input)))) + + ("semantic: gcc: output parse test" . semantic-gcc-test-output-parser) + ("wisent calculator" . wisent-calc-utest) + ;; + ;; SRECODE + ;; + ("srecode: fields" . srecode-field-utest) + ("srecode: templates" . srecode-utest-template-output) + ("srecode: project" . srecode-utest-project) + ("srecode: show maps" . srecode-get-maps) + ("srecode: getset" . srecode-utest-getset-output) + + ;; + ;; COGRE + ;; + ("cogre: graph" . cogre-utest) + ("cogre: periodic & ascii" . cogre-periodic-utest) + ("cogre: conversion/export tests" . cogre-export-utest) + ("cogre: uml-quick-class" . cogre-utest-quick-class) + ) + "Alist of all the tests in CEDET we should run.") + +(defvar cedet-running-master-tests nil + "Non-nil when CEDET-utest is running all the tests.") + +;;;###autoload +(defun cedet-utest (&optional exit-on-error) + "Run the CEDET unittests. +EXIT-ON-ERROR causes the test suite to exit on an error, instead +of just logging the error." + (interactive) + (if (or (not (featurep 'semanticdb-mode)) + (not (semanticdb-minor-mode-p))) + (error "CEDET Tests require: M-x semantic-load-enable-minimum-features")) + (cedet-utest-log-setup "ALL TESTS") + (let ((tl cedet-utest-test-alist) + (notes nil) + (err nil) + (start (current-time)) + (end nil) + (cedet-running-master-tests t) + ) + (dolist (T tl) + (cedet-utest-add-log-item-start (car T)) + (setq notes nil err nil) + (condition-case Cerr + (progn + (funcall (cdr T)) + ) + (error + (setq err (format "ERROR: %S" Cerr)) + ;;(message "Error caught: %s" Cerr) + )) + + ;; Cleanup stray input and events that are in the way. + ;; Not doing this causes sit-for to not refresh the screen. + ;; Doing this causes the user to need to press keys more frequently. + (when (and (interactive-p) (input-pending-p)) + (if (fboundp 'read-event) + (read-event) + (read-char))) + + (cedet-utest-add-log-item-done notes err) + (when (and exit-on-error err) + (message "to debug this test point, execute:") + (message "%S" (cdr T)) + (message "\n ** Exiting Test Suite. ** \n") + (throw 'cedet-utest-exit-on-error t) + ) + ) + (setq end (current-time)) + (cedet-utest-log-shutdown-msg "ALL TESTS" start end) + nil)) + +(defun cedet-utest-noninteractive () + "Return non-nil if running non-interactively." + (if (featurep 'xemacs) + (noninteractive) + noninteractive)) + +;;;###autoload +(defun cedet-utest-batch () + "Run the CEDET unit test in BATCH mode." + (unless (cedet-utest-noninteractive) + (error "`cedet-utest-batch' is to be used only with -batch")) + (condition-case err + (when (catch 'cedet-utest-exit-on-error + ;; Get basic semantic features up. + (semantic-load-enable-minimum-features) + ;; Disables all caches related to semantic DB so all + ;; tests run as if we have bootstrapped CEDET for the + ;; first time. + (setq-default semanticdb-new-database-class 'semanticdb-project-database) + (message "Disabling existing Semantic Database Caches.") + + ;; Disabling the srecoder map, we won't load a pre-existing one + ;; and will be forced to bootstrap a new one. + (setq srecode-map-save-file nil) + + ;; Run the tests + (cedet-utest t) + ) + (kill-emacs 1)) + (error + (error "Error in unit test harness:\n %S" err)) + ) + ) + +;;; Logging utility. +;; +(defvar cedet-utest-frame nil + "Frame used during cedet unit test logging.") +(defvar cedet-utest-buffer nil + "Frame used during cedet unit test logging.") +(defvar cedet-utest-frame-parameters + '((name . "CEDET-UTEST") + (width . 80) + (height . 25) + (minibuffer . t)) + "Frame parameters used for the cedet utest log frame.") + +(defvar cedet-utest-last-log-item nil + "Remember the last item we were logging for.") + +(defvar cedet-utest-log-timer nil + "During a test, track the start time.") + +(defun cedet-utest-log-setup (&optional title) + "Setup a frame and buffer for unit testing. +Optional argument TITLE is the title of this testing session." + (setq cedet-utest-log-timer (current-time)) + (if (cedet-utest-noninteractive) + (message "\n>> Setting up %s tests to run @ %s\n" + (or title "") + (current-time-string)) + + ;; Interactive mode needs a frame and buffer. + (when (or (not cedet-utest-frame) (not (frame-live-p cedet-utest-frame))) + (setq cedet-utest-frame (make-frame cedet-utest-frame-parameters))) + (when (or (not cedet-utest-buffer) (not (buffer-live-p cedet-utest-buffer))) + (setq cedet-utest-buffer (get-buffer-create "*CEDET utest log*"))) + (save-excursion + (set-buffer cedet-utest-buffer) + (setq cedet-utest-last-log-item nil) + (when (not cedet-running-master-tests) + (erase-buffer)) + (insert "\n\nSetting up " + (or title "") + " tests to run @ " (current-time-string) "\n\n")) + (let ((oframe (selected-frame))) + (unwind-protect + (progn + (select-frame cedet-utest-frame) + (switch-to-buffer cedet-utest-buffer t)) + (select-frame oframe))) + )) + +(defun cedet-utest-elapsed-time (start end) + "Copied from elp.el. Was elp-elapsed-time. +Argument START and END bound the time being calculated." + (+ (* (- (car end) (car start)) 65536.0) + (- (car (cdr end)) (car (cdr start))) + (/ (- (car (cdr (cdr end))) (car (cdr (cdr start)))) 1000000.0))) + +(defun cedet-utest-log-shutdown (title &optional errorcondition) + "Shut-down a larger test suite. +TITLE is the section that is done. +ERRORCONDITION is some error that may have occured durinig testing." + (let ((endtime (current-time)) + ) + (cedet-utest-log-shutdown-msg title cedet-utest-log-timer endtime) + (setq cedet-utest-log-timer nil) + )) + +(defun cedet-utest-log-shutdown-msg (title startime endtime) + "Show a shutdown message with TITLE, STARTIME, and ENDTIME." + (if (cedet-utest-noninteractive) + (progn + (message "\n>> Test Suite %s ended at @ %s" + title + (format-time-string "%c" endtime)) + (message " Elapsed Time %.2f Seconds\n" + (cedet-utest-elapsed-time startime endtime))) + + (save-excursion + (set-buffer cedet-utest-buffer) + (goto-char (point-max)) + (insert "\n>> Test Suite " title " ended at @ " + (format-time-string "%c" endtime) "\n" + " Elapsed Time " + (number-to-string + (cedet-utest-elapsed-time startime endtime)) + " Seconds\n * ")) + )) + +(defun cedet-utest-show-log-end () + "Show the end of the current unit test log." + (unless (cedet-utest-noninteractive) + (let* ((cb (current-buffer)) + (cf (selected-frame)) + (bw (or (get-buffer-window cedet-utest-buffer t) + (get-buffer-window (switch-to-buffer cedet-utest-buffer) t))) + (lf (window-frame bw)) + ) + (select-frame lf) + (select-window bw) + (goto-char (point-max)) + (select-frame cf) + (set-buffer cb) + ))) + +(defun cedet-utest-post-command-hook () + "Hook run after the current log command was run." + (if (cedet-utest-noninteractive) + (message "") + (save-excursion + (set-buffer cedet-utest-buffer) + (goto-char (point-max)) + (insert "\n\n"))) + (setq cedet-utest-last-log-item nil) + (remove-hook 'post-command-hook 'cedet-utest-post-command-hook) + ) + +(defun cedet-utest-add-log-item-start (item) + "Add ITEM into the log as being started." + (unless (equal item cedet-utest-last-log-item) + (setq cedet-utest-last-log-item item) + ;; This next line makes sure we clear out status during logging. + (add-hook 'post-command-hook 'cedet-utest-post-command-hook) + + (if (cedet-utest-noninteractive) + (message " - Running %s ..." item) + (save-excursion + (set-buffer cedet-utest-buffer) + (goto-char (point-max)) + (when (not (bolp)) (insert "\n")) + (insert "Running " item " ... ") + (sit-for 0) + )) + (cedet-utest-show-log-end) + )) + +(defun cedet-utest-add-log-item-done (&optional notes err precr) + "Add into the log that the last item is done. +Apply NOTES to the doneness of the log. +Apply ERR if there was an error in previous item. +Optional argument PRECR indicates to prefix the done msg w/ a newline." + (if (cedet-utest-noninteractive) + ;; Non-interactive-mode - show a message. + (if notes + (message " * %s {%s}" (or err "done") notes) + (message " * %s" (or err "done"))) + ;; Interactive-mode - insert into the buffer. + (save-excursion + (set-buffer cedet-utest-buffer) + (goto-char (point-max)) + (when precr (insert "\n")) + (if err + (insert err) + (insert "done") + (when notes (insert " (" notes ")"))) + (insert "\n") + (setq cedet-utest-last-log-item nil) + (sit-for 0) + ))) + +;;; INDIVIDUAL TEST API +;; +;; Use these APIs to start and log information. +;; +;; The other fcns will be used to log across all the tests at once. +(defun cedet-utest-log-start (testname) + "Setup the log for the test TESTNAME." + ;; Make sure we have a log buffer. + (save-window-excursion + (when (or (not cedet-utest-buffer) + (not (buffer-live-p cedet-utest-buffer)) + (not (get-buffer-window cedet-utest-buffer t)) + ) + (cedet-utest-log-setup)) + ;; Add our startup message. + (cedet-utest-add-log-item-start testname) + )) + +(defun cedet-utest-log(format &rest args) + "Log the text string FORMAT. +The rest of the ARGS are used to fill in FORMAT with `format'." + (if (cedet-utest-noninteractive) + (apply 'message format args) + (save-excursion + (set-buffer cedet-utest-buffer) + (goto-char (point-max)) + (when (not (bolp)) (insert "\n")) + (insert (apply 'format format args)) + (insert "\n") + (sit-for 0) + )) + (cedet-utest-show-log-end) + ) + + +(provide 'cedet-utests) +;;; cedet-utests.el ends here diff --git a/site/cedet-1.0pre7/common/cedet.el b/site/cedet-1.0pre7/common/cedet.el new file mode 100644 index 0000000..c738479 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet.el @@ -0,0 +1,226 @@ +;;; cedet.el --- Setup CEDET environment + +;; Copyright (C) 2007, 2008, 2009 by Eric M. Ludlam +;; Copyright (C) 2002, 2003, 2004, 2005, 2006 by David Ponce + +;; Author: David Ponce +;; Maintainer: CEDET developers +;; Created: 09 Dec 2002 +;; Keywords: syntax +;; X-RCS: $Id: cedet.el,v 1.36 2009/09/12 12:04:55 zappo Exp $ + +;; This file is not part of Emacs + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; This library automatically setups your [X]Emacs to use CEDET tools. +;; +;; First download the latest CEDET distribution, provided in a +;; cedet-.tar.gz tarball, from the project page at: +;; . +;; +;; Unpack the tarball in a directory of your choice. It will install +;; the following directory tree: +;; +;; cedet +;; | +;; +- common +;; | +;; +- cogre +;; | +;; +- ede +;; | +;; +- eieio +;; | +;; +- semantic +;; | +;; +- speedbar +;; | +;; +- srecode +;; | +;; \- contrib +;; +;; Then, add the following into your ~/.emacs startup file: +;; +;; (load-file "/cedet/common/cedet.el") +;; +;; Once loaded, you can enable additional feature. For example, +;; this will enable some basic and advance features: +;; +;; (load-file "/cedet/common/cedet.el") +;; (global-ede-mode t) +;; (semantic-load-enable-code-helpers) +;; (global-srecode-minor-mode 1) +;; +;; See the INSTALL file for more. + +;; +;; That's it! +;; + +;;; Code: +(when (featurep 'cedet) + (error "CEDET Version %s already loaded." cedet-version)) + +(eval-when-compile + (require 'cl) + ) + +(defconst cedet-version "1.0pre7" + "Current version of CEDET.") + +(defconst cedet-emacs-min-version "21.1" + "Minimum version of GNU Emacs supported by CEDET.") +(defconst cedet-xemacs-min-version "21.4" + "Minimum version of XEmacs supported by CEDET.") + +(defconst cedet-packages + `( + ;;PACKAGE MIN-VERSION INSTALLDIR DOCDIR + (cedet ,cedet-version "common" "common" ) + (eieio "1.2" nil "eieio" ) + (semantic "2.0pre7" nil "semantic/doc" ) + (srecode "1.0pre7" nil "srecode" ) + (ede "1.0pre7" nil "ede" ) + (speedbar "1.0.3" nil "speedbar" ) + (cogre "1.0pre7" nil "cogre" ) + (cedet-contrib "1.0pre7" "contrib" nil ) + ) + "Table of CEDET packages to install.") + +;; This file must be in "/cedet/common"! +(let ((default-directory + (file-name-directory + (or load-file-name (buffer-file-name))))) + + ;; Add "/cedet/common" to `load-path'. + (add-to-list 'load-path default-directory) + ;;(message "%S added to `load-path'" default-directory) + ;; Require the inversion library. + (require 'inversion) + + ;; Require specific Emacs versions + (inversion-require-emacs cedet-emacs-min-version + cedet-xemacs-min-version) + + ;; Go up to the parent "/cedet" directory. + (let ((default-directory (expand-file-name "..")) + package min-version installdir docdir) + + ;; Add the CEDET packages subdirectories to the `load-path' if + ;; necessary. + (dolist (package-spec cedet-packages) + (setq package (nth 0 package-spec) + min-version (nth 1 package-spec) + installdir (nth 2 package-spec) + docdir (nth 3 package-spec) + ) + ;; Add package to load path + (when installdir + (setq installdir (expand-file-name installdir))) + (inversion-add-to-load-path package min-version installdir) + ;; Add doc to Info path + (when docdir + (let ((fulldocpath (expand-file-name docdir default-directory))) + ;; Set up one of the info paths depending on if info is + ;; loaded yet. + (if (featurep 'info) + (progn + (condition-case nil ; Not all emacs versions have this. + (info-initialize) + (error nil)) + (add-to-list 'Info-directory-list fulldocpath)) + (add-to-list 'Info-default-directory-list fulldocpath)) + ))) + + ;; Force EIEIO to load so that the autoloads work. + (require 'eieio) + + ;; Then run every package setup. + (message "Setting up CEDET packages...") + (dolist (package-spec cedet-packages) + (setq package (nth 0 package-spec)) + (condition-case err + (progn + (require (intern (format "%s-load" package))) + ) + (error + (message "%s" (error-message-string err))))) + (message "Setting up CEDET packages...done") + )) + +(eval-when-compile + (require 'inversion)) + +(defun cedet-version () + "Display all active versions of CEDET and Dependant packages. + +The PACKAGE column is the name of a given package from CEDET. + +REQUESTED VERSION is the version requested by the CEDET load script. +See `cedet-packages' for details. + +FILE VERSION is the version number found in the source file +for the specificed PACKAGE. + +LOADED VERSION is the version of PACKAGE current loaded in Emacs +memory and (presumably) running in this Emacs instance. Value is X +if the package has not been loaded." + (interactive) + (with-output-to-temp-buffer "*CEDET*" + (princ "CEDET Version:\t") (princ cedet-version) + (princ "\n \t\t\tRequested\tFile\t\tLoaded") + (princ "\n Package\t\tVersion\t\tVersion\t\tVersion") + (princ "\n ----------------------------------------------------------") + (let ((p cedet-packages)) + (while p + (let ((sym (symbol-name (car (car p))))) + (princ "\n ") + (princ sym) + (princ ":\t") + (if (< (length sym) 5) + (princ "\t")) + (if (< (length sym) 13) + (princ "\t")) + (let ((reqver (nth 1 (car p))) + (filever (car (inversion-find-version sym))) + (loadver (when (featurep (car (car p))) + (symbol-value (intern-soft (concat sym "-version")))))) + (princ reqver) + (if (< (length reqver) 8) (princ "\t")) + (princ "\t") + (if (string= filever reqver) + ;; I tried the words "check" and "match", but that + ;; just looked lame. + (princ "ok\t") + (princ filever) + (if (< (length filever) 8) (princ "\t"))) + (princ "\t") + (if loadver + (if (string= loadver reqver) + (princ "ok") + (princ loadver)) + (princ "Not Loaded")) + )) + (setq p (cdr p)))) + (princ "\n\n\nC-h f cedet-version RET\n for details on output format.") + )) + +(provide 'cedet) + +;;; cedet.el ends here diff --git a/site/cedet-1.0pre7/common/cedet.info b/site/cedet-1.0pre7/common/cedet.info new file mode 100644 index 0000000..39eef80 --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet.info @@ -0,0 +1,1298 @@ +This is cedet.info, produced by makeinfo version 4.9 from cedet.texi. + + This manual documents CEDET, a collection of other tools. + + Copyright (C) 2007, 2008, 2009 Eric M. Ludlam + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.1 or any later version published by the Free Software + Foundation; with the Invariant Sections being list their titles, + with the Front-Cover Texts being list, and with the Back-Cover + Texts being list. A copy of the license is included in the + section entitled "GNU Free Documentation License". + +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* CEDET: (cedet). Collection of Emacs Development Environment Tools +END-INFO-DIR-ENTRY + + This file documents CEDET. _Collection of Emacs Development +Environment Tools_ + + Copyright (C) 2007 Eric M. Ludlam + + +File: cedet.info, Node: Top, Next: Overview, Up: (dir) + +CEDET Manual +************ + +CEDET is a Collection of Emacs Development Environment Tools including +core libraries such as EIEIO, and semantic, and user interface tools +such as Speedbar, EDE, and COGRE. + + While these tools are independent, and all have their own manuals, +they are also all co-dependent within CEDET, and are dependent on the +CEDET common libraries such as inversion and ezimage. + + This manual describes how to configure the tools as a whole to +accomplish some tasks. + + To send bug reports, or participate in discussions about CEDET, use +the mailing list cedet-devel.net via the URL: +`http://lists.sourceforge.net/lists/listinfo/cedet-devel' + +* Menu: + +* Overview:: +* Installation/Basic Configuration:: +* JDEE Target:: +* ECB Target:: +* Project Management:: +* Code Completion:: +* Code Generation:: +* C++ Features:: +* GNU Global:: +* ID Utils:: +* CScope:: +* Maintenance:: Maintaining your CEDET Data files +* GNU Free Documentation License:: +* Index:: + + +File: cedet.info, Node: Overview, Next: Installation/Basic Configuration, Prev: Top, Up: Top + +1 Overview +********** + +The CEDET collection is made up of several tools. Each tool has it's +own manual with details for that tool. + + At the core of the CEDET suite is EIEIO, which is an Implementation +of Emacs Interpreted Objects. This provides a CLOS like interface to +writing object-oriented code in Emacs. EIEIO forms the base of most of +the other tools, with the notable exception of Speedbar. + + Several other tools form the next layer of CEDET functionality. For +project management, EDE provides a simple way to create projects. You +can create an EDE centric project, which uses either Makefiles, or +AutoMakefiles, or it can wrap an automake based program you've already +developed. You can also create simple EDE wrappers on top of any style +of project. EDE provides a backgrop for any other CEDET tool that +needs to know the filesystem scope of a code base, where include +directories might be. + + semantic provides another mid-level layer. semantic provides a set +of tools for developing parsers for different languages, and an API for +searching and manipulating tags generated from your source code. +semantic also provides a wide range of core tag centric utilities such +as enhanced tag decoration, code analysis, and the coveted "Smart +Completion" feature. + + Another mid-level tool is SRecode or the Semantic Recoder. SRecode +is a template management system designed with the goal of providing a +way to build code-generating applications that are easily modified or +extended by users. At it's core is a template authoring and insertion +system. A minor mode provides a simple way to insert templates from +the various template libraries. + + Speedbar is a user interface tool that provides a narrow view into +your filesystem and tags. Speedbar is also an API for designing other +tools and is used for displaying EDE project information, Semantic +smart completion options, Email, Info, and even GDB stack information. + + Lastly, COGRE is a COnnected GRaph Editor. The core is an object +design and library for drawing, saving, and restoring simple connected +graphs. Built on this is a UML based tool which interfaces with +Semantic Tag information to draw simple UML diagrams of your code. As +of this writing COGRE is quite simple. Longer term plans include using +COGRE as a way of manipulating source code indirectly. + + All these tools depend on a suite of simple library functions, such +as inversion, ezimage, pretty printing, and mode-local variables. + +* Menu: + +* EIEIO:: Object system for Emacs. +* Semantic:: Parser generator and tag management tool. +* SRecode:: Semantic Recoder Template manager +* Speedbar:: File and tag explorer, plus more. +* EDE:: Project Management tool. +* COGRE:: Diagram editor for object design. +* Other Library Functions:: + + +File: cedet.info, Node: EIEIO, Next: Semantic, Up: Overview + +1.1 EIEIO +========= + +EIEIO contains the core object library for CEDET. You can define +classes, and methods for those classes using CLOS style syntax. +Objects can be customized using the Emacs customization tool, which +allows easy creation of dialog box style UIs. A series of bases +classes allows the creation of Emacs centric tools, wrapping up the +details of persistence, instance tracking, or instance inheritance. + + EIEIO also includes several stray tools, such as `tree.el' for +drawing tree diagrams, `chart.el' for drawing charts, `linemark.el' for +managing visible bookmarks programatically, and `lmcompile.el', which +is a linemark tool that puts out bookmarks for compiler error hits. + + Lastly, EIEIO has baseclasses for writing Speedbar interfaces. Take +an existing object hierarchy and inherit from these baseclasses to be +browsable in Speedbar. + + For more details on EIEIO, read the *note EIEIO Reference Manul: +(eieio)top. + + +File: cedet.info, Node: Semantic, Next: SRecode, Prev: EIEIO, Up: Overview + +1.2 Semantic +============ + +semantic is a parser generator, lexical analyzer, parser development +environment, parser, tag generation and management system. Build on +this is a persistent tag management system database and search utility. +Code analysis and completion generation is also provided. semantic +includes tools such as speedbar interfaces to tags, context analysis, +and completion options, Popup smart completion, tag decoration, and +support for a wide range of Emacs tools such as Imenu, wich-func, +hippie-expand, isearch, and cut/copy/paste. + + For high level overviews, configuration advice, etc, please read +*note Semantic Manual: (semantic)Top. + + If you are an application developer and need to know the functions +and concepts, *note the Application Development Manual: +(semantic-appdev)Top. + + To support a new language, *note the Language Support Developer's +Guide: (semantic-langdev)Top. + + To use the grammar writing environment, and write in the rule based +language, *note the Grammar Framework Manual: (grammar-fw)Top. + + For details on the original semantic LL parser, *note the Bovine +Parser Manual: (bovine)Top. + + For details on the Bison-like LALR parser, *note the Wisent Parser +Manual: (wisent)Top. + + +File: cedet.info, Node: SRecode, Next: Speedbar, Prev: Semantic, Up: Overview + +1.3 SRecode +=========== + +SRecode is a Template manager for writing code from Semantic templates. +It includes a specialized template authoring language and environment, +template loader and interpreter. A minor mode for inserting mode +specific templates, and some sample applications that also uses +templates to write code. + + For more details on SRecode, read the *note SRecode Manual: +(srecode)top; + + +File: cedet.info, Node: Speedbar, Next: EDE, Prev: SRecode, Up: Overview + +1.4 Speedbar +============ + +Speedbar is an abbreviated everything browser. If you can +conceptualize browsable information into 20 columns, then Speedbar can +display it for you. + + Speedbar comes with several interfaces, with the primary one being +for files and tags. It can also display buffer lists, RMAIL boxes, and +Info nodes. Combined with CEDET, it also provides project tracking, +smart completion lists, Class browsing, Connected graph browsing. + + You can use speedbar to write your own browsers. Some external tools +include ERC (Irc client), xslt-process, MH-E (mail reader), and ECB, a +code browser which embeds Speebar. + + Speedbar has been a part of Emacs for quite a while. The CEDET +version of speedbar (as of this writing, Jul 08) is nearly identical to +the version in Emacs 22. + + For more details, read the *note Speedbar Manual: (speedbar)top. + + +File: cedet.info, Node: EDE, Next: COGRE, Prev: Speedbar, Up: Overview + +1.5 EDE +======= + +EDE is the Emacs Development Environment, which means that it manages +projects, and can build Makefiles, track distribution and web sites +associated with your GNU project. + + EDE has several types of projects it can manage with varying degrees +of development support. An EDE centric project will generate Makefiles +or Automake files, and provides menus and keybindings for compiling any +target, debugging programs by providing the arguments to your debugger, +and will make sure you don't forget to include some file in your +targets. It will help you build distribution files, and post them to +the web (such as with Source Forge). EDE will track revision numbers +and make sure they are updated in multiple places. + + Projects that are merely wrapped with EDE can support a small subset +of the above. All project provide an API to other programs that need +to know the scope of a project, such as which files belong together, +where include directories might be, how to find documentation, and +details of that nature. You can even create project-local variables, +which are Emacs variables with specific values within the scope of an +EDE controlled project. + + Read more about it in the *note EDE reference manual: (ede)top. + + +File: cedet.info, Node: COGRE, Next: Other Library Functions, Prev: EDE, Up: Overview + +1.6 COGRE +========= + +COGRE is a COnnected GRaph Editor. You can use it to create simple +connected graphs and diagrams. You can also create more complex UML +class diagrams in it, or even bind UML diagrams directly to source +code, navigating your source via the UML diagram. + + While COGRE does have a lot of functionality, it still needs more +work. Consider improving COGRE. + + Read more a bout it in *note the COGRE manual: (cogre)top. + + +File: cedet.info, Node: Other Library Functions, Prev: COGRE, Up: Overview + +1.7 Other CEDET Library functions +================================= + +CEDET provides several other useful libraries in the `common/' +directory. These libraries supply most of their documentation through +the Commentary section of the Emacs Lisp file. + + Some of the libraries are: + + `' cedet-edebug.el Collection of extensions to support custom CEDET + datatypes. + + `' ezimage.el Support for covering text in an Emacs buffer with an + image. This is based on text patterns, and is portable across + most versions of Emacs and XEmacs. + + Using ezimage allows you to write a text based UI, and then + enhance it with images afterwards, allowing your UI to work well + in a text frame, in addition to looking pretty spiff in a + graphical frame. + + `' pulse.el Simple way to briefly highlight a region or line. For + Emacs 22, it will pulse the line, with the color drifting from one + shade to another. For older versions Emacs, it will just + highlight the line briefly. + + `' fame.el Support for `message' channels, allowing a program to + provide a wide range of messages, and allowing a user to configure + which set they want to see. + + `' inversion.el Revision management system. Allows you to use + `require' syntax for a specific version of some tool. If the tool + is not compatible with your desired version, a signal is thrown. + + `' mode-local.el Specify functions that have different behaviors + based on major-mode, or variables with different local values + based on major mode. Setting a value to a specific mode causes + the value to change for all buffers of that mode. + + mode-local is also aware of mode inheritance, such that C++ mode + inherits some C configurations. You can also run code, or access + variables from other modes by with a temorary scoped setting. + + mode local is used extensively throughout the semantic package. + + `' pprint.el A pretty printer for Emacs Lisp code. Use it to dump + out large complex datastructures. + + `' sformat.el A Super Format function. Define lists of associations + between letters and values, and then create format strings with % + tokens for any letter. + + sformat is used in the semantic document package to construct + complex documentation strings. + + `' working.el Display a working message, or a "percentage done" + style bar in the mini-buffer. Tasks that take a long time can use + working to provide user feedback explaining a delay. + + +File: cedet.info, Node: Installation/Basic Configuration, Next: JDEE Target, Prev: Overview, Up: Top + +2 Installation and Basic Configuration +************************************** + +A compilation centric version of the CEDET installation is in the +INSTALL file in the top level CEDET directory. + + 1. Compile CEDET + + make + + or + + make EMACS= MAKEINFO= + + If you do not have `make' installed on your system, or if you + cannot get the `Makefile's to work, then you can use the all Emacs + solution in `cedet-build.el' which is found in the toplevel CEDET + + Read the Commentary section of `cedet-build.el' for details on + using this method. + + 2. Install .emacs hooks + + Load CEDET in your `.emacs' file. You do not need to install all + of cedet into any magic Emacs controlled directories, or modify + your loadpath. The CEDET bootstrap file will automatically update + your load path, and load all the autoload files. The cedet + configuration will load a minimum set of files in. + + ;; Load CEDET + (load-file "~/cedet-VERSION/common/cedet.el") + + 3. Configuration + + You will likely need to configure CEDET to your application. Visit + the other chapters in this manual for samples to get some ideas on + possible configuration scenarios. + + 4. Contribute to CEDET + + For general discussions on development of these tools, use the + mailing list cedet-devel@sourceforge.net via the URL: + + `http://lists.sourceforge.net/lists/listinfo/cedet-devel' + + For semantic development use the mailing list cedet-semantic.net + via the URL: + + `http://lists.sourceforge.net/lists/listinfo/cedet-semantic' + + For EIEIO use the mailing list cedet-eieio@sourceforge.net via the + URL: + + `http://lists.sourceforge.net/lists/listinfo/cedet-eieio' + + 5. Install Additional Tools + + You may also need to download some of the following files for more + obscure features. + + To use the JavaScript parser: javascript-mode.el : + `http://www.emacswiki.org/cgi-bin/wiki/JavaScriptMode' + + To use Exuberent ctags to emable Semantic support in more major + modes, or as an extra database backend parser, install ctags: + `http://ctags.sourceforge.net/' + + To use the UML chart generation from `M-x semantic-dot' graphviz + dot programs, including `dotty' `http://www.graphviz.org/' + + To use the graphviz dot parser: `graphviz-dot-mode.el' see the + commentary in cogre/wisent-dot.el + + + +File: cedet.info, Node: JDEE Target, Next: ECB Target, Prev: Installation/Basic Configuration, Up: Top + +3 JDEE Target +************* + +JDEE, or the Java Development Environment, depends on CEDET for both +EIEIO, the object system, and Semantic, for parsing and providing +tagging information. + + In addition to the basic CEDET configuration, you will likely want to +add the following Semantic configuration to your `.emacs' file. + + (semantic-load-enable-minimum-features) + + This provides basic idle-time parsing of files, and persistence to +support the semantic APIs. + + If you would like to use more of the Semantic tools for your coding +in Java, you may want to enable this instead: + + (semantic-load-enable-code-helpers) + + or the fancier + + (semantic-load-enable-guady-code-helpers) + + See the *note Semantic Configuration: (semantic)Canned Configuration. +section of the semantic manual for more details about these features. + + +File: cedet.info, Node: ECB Target, Next: Project Management, Prev: JDEE Target, Up: Top + +4 ECB Target +************ + +ECB, or the Emacs Code Browser depends on CEDET for the semantic +parsing engine, and several other features. ECB can display a window +that shows semantic tag information. + + ECB can also be used with JDEE. + + In addition to the basic CEDET configuration, you will likely want to +add the following Semantic configuration to your `.emacs' file. + + (semantic-load-enable-code-helpers) + + or the fancier + + (semantic-load-enable-guady-code-helpers) + + See the *note Semantic Configuration: (semantic)Canned Configuration. +section of the semantic manual for more details about these features. + + +File: cedet.info, Node: Project Management, Next: Code Completion, Prev: ECB Target, Up: Top + +5 Project Management +******************** + +If you are looking for CEDET to help you manage a project full of +sourcecode, then you will be using EDE and semantic. + + To enable EDE add this to your `.emacs' file after CEDET is loaded: + + (global-ede-mode 1) + + You can use EDE to define your projects. If you are starting a new +project, put a file from your new project into a buffer, and type: + + M-x ede-new RET + + Now select either "Make" or "Automake", which determines the +underlying build technology to use for compilation. + + Use the menu to add targets. You can then use either Speedbar or +dired to populate your targets with files. + + For more details, see the *note EDE reference manual: (ede)Top. + + In addition to EDE and basic CEDET configuration, you will likely +want to add the following semantic configuration to your `.emacs' file. + + (semantic-load-enable-code-helpers) + + See the *note Semantic Configuration: (semantic)Canned Configuration. +section of the semantic manual for more details about these features. + + You may also want to enable the SRecode template insertion mode. + + (srecode-minor-mode 1) + + Both semantic and SRecode take advantage of EDE's knowledge of a +projects structure. + + +File: cedet.info, Node: Code Completion, Next: Code Generation, Prev: Project Management, Up: Top + +6 Code Completion +***************** + +Code Completion, or perhaps "Intellisense" is a difficult problem to +get working in Emacs. To use the CEDET suite to do it, you will need +to start by augmenting the basic CEDET install in your `.emacs' file +with: + + (semantic-load-enable-code-helpers) + + Basic code helpers enable idle parsing and summary mode. To get +idle-completions mode, and some more decorative features, use: + + (semantic-load-enable-guady-code-helpers) + + TODO - add other handy bindings here. + + For more on configuration *note Semantic Configuration: +(semantic)Canned Configuration. section of the semantic manual for +more details about these features. + + The basic idea is that Semantic will need to parse your source code +and build lookup tables. The tables are then searched to provide the +completion you might be looking for. + + To improve the things Semantic can find and complete with, you then +need to configure a few more things. This is done mainly by providing +details on where Semantic can find the source code where your tag +definitions are. + + For more, *note Semantic search configuration: +(semantic-user)Semanticdb Search Configuration. + + Once you've optimized semantic's ability to find your sources, there +are several code completion options. For more, *note semantic +analyzer: (semantic-user)Analyzer. + + If code completion doesn't work on your code right away, please read +the section on *note Smart Completion Debugging: (semantic-user)Smart +Completion Debugging. + + +File: cedet.info, Node: Code Generation, Next: C++ Features, Prev: Code Completion, Up: Top + +7 Code Generation +***************** + +Code Generation, or the ability to automatically write code from some +set of static data is done through the SRecode library. SRecode is a +template manager that uses the semantic infrastructure to support +common concepts across multiple languages. + + To effectively create a code-generation library, you need to +configure semantic. Read *note Semantic Configuration: +(semantic)Canned Configuration. for more. + + Secondly, you will need to configure SRecode. Read *note SRecode +Manual: (srecode)Quick Start; + + Once installed, you can jump right in to writing your Lisp and *note +Template Writing: (screcode)Template Writing. + + +File: cedet.info, Node: C++ Features, Next: GNU Global, Prev: Code Generation, Up: Top + +8 C++ Features +************** + +If you are using CEDET with C or C++, then there are a few C/C++ +specific options you may need to update. + +8.1 C Pre-processor +=================== + +C and C++ use pre-processor directives, and the semantic parser has +some basic support for a pre-processor. As such, you may need to set +up some macros. You can do that in two ways. + + The first option is to create your own symbol map in Emacs Lisp. You +can customize the preprocessor symbol map. + + -- Variable: semantic-lex-c-preprocessor-symbol-map + Table of C Preprocessor keywords used by the Semantic C lexer. + Each entry is a cons cell like this: ( "KEYWORD" . "REPLACEMENT" + ) Where KEYWORD is the macro that gets replaced in the lexical + phase, and REPLACEMENT is a string that is inserted in it's place. + Empty string implies that the lexical analyzer will discard + KEYWORD when it is encountered. + + Alternately, it can be of the form: ( "KEYWORD" ( LEXSYM1 "str" + 1 1 ) ... ( LEXSYMN "str" 1 1 ) ) where LEXSYM is a symbol that + would normally be produced by the lexical analyzer, such as + `symbol' or "string". The string in the second position is the + text that makes up the replacement. This is the way to have + multiple lexical symbols in a replacement. Using the first way to + specify text like "foo::bar" would not work, because : is a + separate lexical symbol. + + A quick way to see what you would need to insert is to place a + definition such as: + + #define MYSYM foo::bar + + into a C file, and do this: `M-x' semantic-lex-spp-describe + + The output table will describe the symbols needed. + + Alternately, you can use an existing C header file, or write your own +custom C header file, and use the macros in that to initialize the +preprocessor list. + + -- Variable: semantic-lex-c-preprocessor-symbol-file + List of C/C++ files that contain preprocessor macros for the C + lexer. Each entry is a filename and each file is parsed, and + those macros are included in every C/C++ file parsed by semantic. + You can use this variable instead of + `semantic-lex-c-preprocessor-symbol-map' to store your global + macros in a more natural way. + + Some such symbols for `stdio.h' as found on Linux are defined in +`semantic-lex-c-preprocessor-symbol-map-builtin'. + + Lastly, you could just opt to ignore conditional parsing. + + -- Option: semantic-c-obey-conditional-section-parsing-flag + Non-`nil' means to interpret preprocessor #if sections. This + implies that some blocks of code will not be parsed based on the + values of the conditions in the #if blocks. + + -- Function: semantic-lex-c-nested-namespace-ignore-second + Should _GLIBCXX_BEGIN_NESTED_NAMESPACE ignore the second namespace? + It is really there, but if a majority of uses is to squeeze out + the second namespace in use, then it should not be included. + + If you are having problems with smart completion and STL templates, + it may that this is set incorrectly. After changing the value of + this flag, you will need to delete any semanticdb cache files that + may have been incorrectly parsed. + +8.2 System Include path +======================= + +If you want the code-completion to work with C++ system header file, +you will need to update `semantic-dependency-system-include-path' for +C++ mode. + + M-x customize-variable RET semantic-c-dependency-system-include-path RET + + Customizing this variable will allow you to setup your system +include path and will update all files when you use custom to do it. + +8.3 EDE Setup +============= + +For large C or C++ programs, it is important to setup EDE for it. +While EDE can be used to create makefiles and such using Automake, EDE +also provides a way to merely describe a project so that tools like +semantic can find your sources. + + If your project already uses Automake, or if your project is Emacs or +the Linux Kernel, there are pre-existing EDE project types that will +automatically detect these projects. + + If EDE does not automatically detect your type of project, you may +want to use the very simple `ede-cpp-root-project' type. To use it, +add this to your `.emacs' file, or other configuration: + + (global-ede-mode 1) ;; Enable EDE + (ede-cpp-root-project "SOMENAME" :file "/dir/to/some/file") + + where SOMENAME is a name for this project, and the file is a file +name that exists at the root of your project directory. There are many +more options for the optimization of finding your header files. For +more on this option, including include path setting, and providing +macro to the C pre-processor, see *note ede-cpp-root: (ede)the +ede-cpp-root chapter. + + +File: cedet.info, Node: GNU Global, Next: ID Utils, Prev: C++ Features, Up: Top + +9 GNU Global +************ + +Several tools in CEDET can support the use of GNU Global. If you use +GNU Global in your project, you should enable the use of it to enhance +or speed up various tools in CEDET. + + You can download GNU Global from `http://www.gnu.org/software/global' + + To make sure your GNU Global installation is good, use the command + + M-x cedet-gnu-global-version-check RET + + You can wrap any CEDET / GNU Global configurations in your `.emacs' +file like this: + + (setq cedet-global-command "global") ; Change to path of global as needed + (when (cedet-gnu-global-version-check t) ; Is it ok? + ;; Configurations for GNU Global and CEDET + ) + +9.1 EDE and GNU Global +====================== + +The EDE project system can use GNU Global to accelerate finding files +within a project. The EDE command to `ede-find-file' bound to `C-c . +f' is one direct application. semantic also makes heavy use of of the +feature to find header files. + + To enable it, configure the variable `ede-locate-setup-options'. +Something like this can work in your `.emacs' file. + + (setq ede-locate-setup-options + '(ede-locate-global + ede-locate-base)) + +9.2 semantic Database +===================== + +semantic can use GNU Global as a back end for database searches. To +enable it, use: + + (semanticdb-enable-gnu-global-databases 'c++-mode) + + where the first argument is a `major-mode' in which to use it. + + GNU Global will then be used for project-wide searches as a backup +when pre-existing semantic database searches may not have parsed all +your files. + +9.3 semantic +============ + +The semantic symref tool can use GNU Global to local symbol references. +This tool will automatically detect GNU Global and use it. You can +search for references via the commands: + +`semantic-symref' + Find references to the tag under the cursor. + +`semantic-symref-symbol' + Find references to an arbitrary symbol. + + +File: cedet.info, Node: ID Utils, Next: CScope, Prev: GNU Global, Up: Top + +10 ID Utils +*********** + +Several tools in CEDET can support the use of ID Utils. If you use ID +Utils in your project, you should enable the use of it to enhance or +speed up various tools in CEDET. + + You can download ID Utils from `http://www.gnu.org/software/idutils/' + + To make sure your ID Utils installation is good, use the command + + M-x cedet-idutils-version-check RET + + You can wrap any CEDET / ID Utils configurations in your `.emacs' +file like this: + + (when (cedet-idutils-version-check t) ; Is it ok? + ;; Configurations for ID Utils and CEDET. + ) + +10.1 EDE and ID Utils +===================== + +The EDE project system can use ID Utils to accelerate finding files +within a project. The EDE command to `ede-find-file' bound to `C-c . +f' is one direct application. semantic also makes heavy use of of the +feature to find header files. + + To enable it, configure the variable `ede-locate-setup-options'. +Something like this can work in your `.emacs' file. + + (setq ede-locate-setup-options + '(ede-locate-idutils + ede-locate-base)) + +10.2 semantic +============= + +The semantic symref tool can use ID Utils to local symbol references. +This tool will automatically detect ID Utils and use it. You can +search for references via the commands: + +`semantic-symref' + Find references to the tag under the cursor. + +`semantic-symref-symbol' + Find references to an arbitrary symbol. + + +File: cedet.info, Node: CScope, Next: Maintenance, Prev: ID Utils, Up: Top + +11 CScope +********* + +Several tools in CEDET can support the use of CScope. If you use +CScope in your project, you can enable the use of it to enhance or +speed up various tools in CEDET. + + You can download CScope from `http://cscope.sourceforge.net/' + + To make sure your CScope installation is good, use the command + + M-x cedet-cscope-version-check RET + + You can wrap any CEDET / CScope configurations in your `.emacs' file +like this: + + (when (cedet-cscope-version-check t) ; Is it ok? + ;; Configurations for CScope and CEDET. + ) + +11.1 Detecting CScope +===================== + +CScope is detected by the presense of a `cscope.out' file at the ROOT +of your current project, as specified by EDE. CScope the program +supports multiple `cscope.out' files spread out through your project, +but this is not detecte by CEDET. It will also use a `cscope.out' in +the same directory as your sources if you do not use EDE + + If you use CScope and need this feature, please consider fixing it. +Contact the cedet-devel mailing list. + +11.2 EDE and CScope +=================== + +The EDE project system can use CScope to accelerate finding files +within a project. The EDE command to `ede-find-file' bound to `C-c . +f' is one direct application. semantic also makes heavy use of of the +feature to find header files for C and C++. + + To enable it, configure the variable `ede-locate-setup-options'. +Something like this can work in your `.emacs' file. + + (setq ede-locate-setup-options + '(ede-locate-cscope + ede-locate-base)) + +11.3 semantic Database +====================== + +@TODO + + semantic can could use CScope as a back end for database searches, +but this has not been implemented yet. + +11.4 semantic +============= + +The semantic symref tool can use CScope to local symbol references. +This tool will automatically detect CScope and use it. You can search +for references via the commands: + +`semantic-symref' + Find references to the tag under the cursor. + +`semantic-symref-symbol' + Find references to an arbitrary symbol. + + +File: cedet.info, Node: Maintenance, Next: GNU Free Documentation License, Prev: CScope, Up: Top + +12 Maintenance +************** + +Most of the CEDET tools do their best to maintain their data files and +caches. It is useful, however, to periodically run: + + M-x semanticdb-cleanup-cache-files RET + + to delete old database cache files that may no longer be associated +with directories on your system. + + +File: cedet.info, Node: GNU Free Documentation License, Next: Index, Prev: Maintenance, Up: Top + +Appendix A GNU Free Documentation License +***************************************** + + Version 1.1, March 2000 + + Copyright (C) 2000 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + written document "free" in the sense of freedom: to assure everyone + the effective freedom to copy and redistribute it, with or without + modifying it, either commercially or noncommercially. Secondarily, + this License preserves for the author and publisher a way to get + credit for their work, while not being considered responsible for + modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work that contains a + notice placed by the copyright holder saying it can be distributed + under the terms of this License. The "Document", below, refers to + any such manual or work. Any member of the public is a licensee, + and is addressed as "you". + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter + section of the Document that deals exclusively with the + relationship of the publishers or authors of the Document to the + Document's overall subject (or to related matters) and contains + nothing that could fall directly within that overall subject. + (For example, if the Document is in part a textbook of + mathematics, a Secondary Section may not explain any mathematics.) + The relationship could be a matter of historical connection with + the subject or with related matters, or of legal, commercial, + philosophical, ethical or political position regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, whose contents can be viewed and edited directly + and straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup has been designed + to thwart or discourage subsequent modification by readers is not + Transparent. A copy that is not "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML designed for human modification. + Opaque formats include PostScript, PDF, proprietary formats that + can be read and edited only by proprietary word processors, SGML + or XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML produced by some word + processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies of the Document numbering more than + 100, and the Document's license notice requires Cover Texts, you + must enclose the copies in covers that carry, clearly and legibly, + all these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a publicly-accessible + computer-network location containing a complete Transparent copy + of the Document, free of added material, which the general + network-using public has access to download anonymously at no + charge using public-standard network protocols. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that version + gives permission. + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in the + Modified Version, together with at least five of the principal + authors of the Document (all of its principal authors, if it + has less than five). + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + D. Preserve all the copyright notices of the Document. + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified Version + under the terms of this License, in the form shown in the + Addendum below. + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + H. Include an unaltered copy of this License. + I. Preserve the section entitled "History", and its title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. + If there is no section entitled "History" in the Document, + create one stating the title, year, authors, and publisher of + the Document as given on its Title Page, then add an item + describing the Modified Version as stated in the previous + sentence. + J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + "History" section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + K. In any section entitled "Acknowledgements" or "Dedications", + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein. + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. + M. Delete any section entitled "Endorsements". Such a section + may not be included in the Modified Version. + N. Do not retitle any existing section as "Endorsements" or to + conflict in title with any Invariant Section. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties-for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition + of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections entitled + "History" in the various original documents, forming one section + entitled "History"; likewise combine any sections entitled + "Acknowledgements", and any sections entitled "Dedications". You + must delete all sections entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, does not as a whole count as a + Modified Version of the Document, provided no compilation + copyright is claimed for the compilation. Such a compilation is + called an "aggregate", and this License does not apply to the + other self-contained works thus compiled with the Document, on + account of their being thus compiled, if they are not themselves + derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one + quarter of the entire aggregate, the Document's Cover Texts may be + placed on covers that surround only the Document within the + aggregate. Otherwise they must appear on covers around the whole + aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License provided that you also include the + original English version of this License. In case of a + disagreement between the translation and the original English + version of this License, the original English version will prevail. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document is + void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, + from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + http://www.gnu.org/copyleft/. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +If you have no Invariant Sections, write "with no Invariant +Sections" instead of saying which ones are invariant. If you have no +Front-Cover Texts, write "no Front-Cover Texts" instead of "Front-Cover +Texts being LIST"; likewise for Back-Cover Texts. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: cedet.info, Node: Index, Prev: GNU Free Documentation License, Up: Top + +Index +***** + +[index] +* Menu: + + +Tag Table: +Node: Top901 +Node: Overview1930 +Node: EIEIO4839 +Node: Semantic5850 +Node: SRecode7166 +Node: Speedbar7653 +Node: EDE8603 +Node: COGRE9927 +Node: Other Library Functions10462 +Node: Installation/Basic Configuration13058 +Node: JDEE Target15613 +Node: ECB Target16562 +Node: Project Management17285 +Node: Code Completion18620 +Node: Code Generation20244 +Node: C++ Features21013 +Ref: semantic-lex-c-preprocessor-symbol-map21641 +Ref: semantic-lex-c-preprocessor-symbol-file22994 +Ref: semantic-c-obey-conditional-section-parsing-flag23587 +Ref: semantic-lex-c-nested-namespace-ignore-second23834 +Node: GNU Global25823 +Node: ID Utils27859 +Node: CScope29381 +Node: Maintenance31533 +Node: GNU Free Documentation License31943 +Node: Index51678 + +End Tag Table diff --git a/site/cedet-1.0pre7/common/cedet.texi b/site/cedet-1.0pre7/common/cedet.texi new file mode 100644 index 0000000..95daddf --- /dev/null +++ b/site/cedet-1.0pre7/common/cedet.texi @@ -0,0 +1,1001 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename cedet.info +@set TITLE CEDET Manual +@set AUTHOR Eric M. Ludlam +@settitle @value{TITLE} + +@c ************************************************************************* +@c @ Header +@c ************************************************************************* +@macro cedet{} +@i{CEDET} +@end macro + +@copying +This manual documents @cedet{}, a collection of other tools. + +Copyright @copyright{} 2007, 2008, 2009 Eric M. Ludlam + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being list their titles, with the Front-Cover Texts +being list, and with the Back-Cover Texts being list. A copy of the +license is included in the section entitled ``GNU Free Documentation +License''. +@end quotation +@end copying + +@ifinfo +@dircategory Emacs +@direntry +* CEDET: (cedet). Collection of Emacs Development Environment Tools +@end direntry +@end ifinfo + +@iftex +@finalout +@end iftex + +@ifinfo +This file documents @cedet{}. +@emph{Collection of Emacs Development Environment Tools} + +Copyright @copyright{} 2007 @value{AUTHOR} +@end ifinfo + +@titlepage +@sp 10 +@title @value{TITLE} +@author by @value{AUTHOR} +@vskip 0pt plus 1 fill +Copyright @copyright{} 2007 @value{AUTHOR} +@page +@vskip 0pt plus 1 fill +@insertcopying +@end titlepage +@page + +@macro semantic{} +@i{semantic} +@end macro + +@macro srecode{} +@i{SRecode} +@end macro + +@macro eieio{} +@i{EIEIO} +@end macro + +@macro ede{} +@i{EDE} +@end macro + +@macro cogre{} +@i{COGRE} +@end macro + +@macro speedbar{} +@i{Speedbar} +@end macro + + +@c ************************************************************************* +@c @ Document +@c ************************************************************************* +@contents + +@node top +@top @value{TITLE} + +@cedet{} is a @i{Collection of Emacs Development Environment Tools} +including core libraries such as @eieio{}, and @semantic{}, and user +interface tools such as @speedbar{}, @ede{}, and @cogre{}. + +While these tools are independent, and all have their own manuals, +they are also all co-dependent within @cedet{}, and are dependent on +the @cedet{} common libraries such as @i{inversion} and @i{ezimage}. + +This manual describes how to configure the tools as a whole to +accomplish some tasks. + +To send bug reports, or participate in discussions about @cedet{}, +use the mailing list cedet-devel.net via the URL: +@url{http://lists.sourceforge.net/lists/listinfo/cedet-devel} + +@menu +* Overview:: +* Installation/Basic Configuration:: +* JDEE Target:: +* ECB Target:: +* Project Management:: +* Code Completion:: +* Code Generation:: +* C++ Features:: +* GNU Global:: +* ID Utils:: +* CScope:: +* Maintenance:: Maintaining your @cedet{} Data files +* GNU Free Documentation License:: +* Index:: +@end menu + +@node Overview +@chapter Overview + +The @cedet{} collection is made up of several tools. Each tool has +it's own manual with details for that tool. + +At the core of the @cedet{} suite is @eieio{}, which is an +@i{Implementation of Emacs Interpreted Objects}. This provides a CLOS +like interface to writing object-oriented code in Emacs. @eieio{} +forms the base of most of the other tools, with the notable exception +of @speedbar{}. + +Several other tools form the next layer of @cedet{} functionality. +For project management, @ede{} provides a simple way to create +projects. You can create an @ede{} centric project, which uses +either Makefiles, or AutoMakefiles, or it can wrap an automake based +program you've already developed. You can also create simple @ede{} +wrappers on top of any style of project. @ede{} provides a backgrop +for any other @cedet{} tool that needs to know the filesystem scope of +a code base, where include directories might be. + +@semantic{} provides another mid-level layer. @semantic{} provides a +set of tools for developing parsers for different languages, and an +API for searching and manipulating tags generated from your source +code. @semantic{} also provides a wide range of core tag centric +utilities such as enhanced tag decoration, code analysis, and the +coveted ``Smart Completion'' feature. + +Another mid-level tool is @srecode{} or the @i{Semantic Recoder}. +@srecode{} is a template management system designed with the goal of +providing a way to build code-generating applications that are easily +modified or extended by users. At it's core is a template authoring +and insertion system. A minor mode provides a simple way to insert +templates from the various template libraries. + +@speedbar{} is a user interface tool that provides a narrow view into +your filesystem and tags. Speedbar is also an API for designing other +tools and is used for displaying @ede{} project information, Semantic +smart completion options, Email, Info, and even GDB stack information. + +Lastly, @cogre{} is a @i{COnnected GRaph Editor}. The core is an +object design and library for drawing, saving, and restoring simple +connected graphs. Built on this is a UML based tool which interfaces +with Semantic Tag information to draw simple UML diagrams of your +code. As of this writing @cogre{} is quite simple. Longer term +plans include using @cogre{} as a way of manipulating source code +indirectly. + +All these tools depend on a suite of simple library functions, such as +@i{inversion}, @i{ezimage}, @i{pretty printing}, and @i{mode-local} +variables. + +@menu +* EIEIO:: Object system for Emacs. +* Semantic:: Parser generator and tag management tool. +* SRecode:: Semantic Recoder Template manager +* Speedbar:: File and tag explorer, plus more. +* EDE:: Project Management tool. +* COGRE:: Diagram editor for object design. +* Other Library Functions:: +@end menu + +@node EIEIO +@section @eieio{} + +@eieio{} contains the core object library for @cedet{}. You can +define classes, and methods for those classes using @i{CLOS} style +syntax. Objects can be customized using the Emacs customization tool, +which allows easy creation of dialog box style UIs. A series of bases +classes allows the creation of Emacs centric tools, wrapping up the +details of persistence, instance tracking, or instance inheritance. + +@eieio{} also includes several stray tools, such as @file{tree.el} +for drawing tree diagrams, @file{chart.el} for drawing charts, +@file{linemark.el} for managing visible bookmarks programatically, and +@file{lmcompile.el}, which is a linemark tool that puts out bookmarks +for compiler error hits. + +Lastly, @eieio{} has baseclasses for writing @speedbar{} interfaces. +Take an existing object hierarchy and inherit from these baseclasses +to be browsable in Speedbar. + +For more details on @eieio{}, read the +@inforef{top, EIEIO Reference Manul, eieio}. + + +@node Semantic +@section Semantic + +@semantic{} is a parser generator, lexical analyzer, parser +development environment, parser, tag generation and management system. +Build on this is a persistent tag management system database and +search utility. Code analysis and completion generation is also +provided. @semantic{} includes tools such as speedbar interfaces to +tags, context analysis, and completion options, Popup smart +completion, tag decoration, and support for a wide range of Emacs +tools such as Imenu, wich-func, hippie-expand, isearch, and +cut/copy/paste. + +For high level overviews, configuration advice, etc, please read +@inforef{Top, Semantic Manual, semantic}. + +If you are an application developer and need to know the functions and +concepts, +@inforef{Top, the Application Development Manual, semantic-appdev}. + +To support a new language, +@inforef{Top, the Language Support Developer's Guide, semantic-langdev}. + +To use the grammar writing environment, and write in the rule based +language, +@inforef{Top, the Grammar Framework Manual, grammar-fw}. + +For details on the original @semantic{} @acronym{LL} parser, +@inforef{Top, the Bovine Parser Manual, bovine}. + +For details on the Bison-like @acronym{LALR} parser, +@inforef{Top, the Wisent Parser Manual, wisent}. + + +@node SRecode +@section @srecode{} + +@srecode{} is a Template manager for writing code from Semantic +templates. It includes a specialized template authoring language and +environment, template loader and interpreter. A minor mode for +inserting mode specific templates, and some sample applications that +also uses templates to write code. + +For more details on @srecode{}, read the +@inforef{top, SRecode Manual, srecode}; + +@node Speedbar +@section Speedbar + +@speedbar{} is an abbreviated everything browser. If you can +conceptualize browsable information into 20 columns, then Speedbar can +display it for you. + +Speedbar comes with several interfaces, with the primary one being for +files and tags. It can also display buffer lists, RMAIL boxes, and +Info nodes. Combined with @cedet{}, it also provides project tracking, +smart completion lists, Class browsing, Connected graph browsing. + +You can use speedbar to write your own browsers. Some external tools +include ERC (Irc client), xslt-process, MH-E (mail reader), and ECB, a +code browser which embeds Speebar. + +@speedbar{} has been a part of Emacs for quite a while. The @cedet{} +version of speedbar (as of this writing, Jul 08) is nearly identical +to the version in Emacs 22. + +For more details, read the +@inforef{top, Speedbar Manual, speedbar}. + +@node EDE +@section @ede{} + +@ede{} is the @i{Emacs Development Environment}, which means that it +manages projects, and can build Makefiles, track distribution and web +sites associated with your GNU project. + +@ede{} has several types of projects it can manage with varying +degrees of development support. An @ede{} centric project will generate +Makefiles or Automake files, and provides menus and keybindings for +compiling any target, debugging programs by providing the arguments to +your debugger, and will make sure you don't forget to include some +file in your targets. It will help you build distribution files, and +post them to the web (such as with Source Forge). @ede{} will track +revision numbers and make sure they are updated in multiple places. + +Projects that are merely wrapped with @ede{} can support a small +subset of the above. All project provide an API to other programs +that need to know the scope of a project, such as which files belong +together, where include directories might be, how to find +documentation, and details of that nature. You can even create +project-local variables, which are Emacs variables with specific +values within the scope of an @ede{} controlled project. + +Read more about it in the +@inforef{top, EDE reference manual, ede}. + +@node COGRE +@section COGRE + +@cogre{} is a @i{COnnected GRaph Editor}. You can use it to create +simple connected graphs and diagrams. You can also create more +complex UML class diagrams in it, or even bind UML diagrams directly +to source code, navigating your source via the UML diagram. + +While @cogre{} does have a lot of functionality, it still needs more +work. Consider improving @cogre{}. + +Read more a bout it in +@inforef{top, the COGRE manual, cogre}. + +@node Other Library Functions +@section Other @cedet{} Library functions + +@cedet{} provides several other useful libraries in the +@file{common/} directory. These libraries supply most of their +documentation through the Commentary section of the Emacs Lisp file. + +Some of the libraries are: + +@itemize @file +@item cedet-edebug.el +Collection of extensions to support custom @cedet{} datatypes. +@item ezimage.el +Support for covering text in an Emacs buffer with an image. This is +based on text patterns, and is portable across most versions of Emacs +and XEmacs. + +Using ezimage allows you to write a text based UI, and then enhance it +with images afterwards, allowing your UI to work well in a text +frame, in addition to looking pretty spiff in a graphical frame. +@item pulse.el +Simple way to briefly highlight a region or line. For Emacs 22, it +will pulse the line, with the color drifting from one shade to +another. For older versions Emacs, it will just highlight the line +briefly. +@item fame.el +Support for @code{message} channels, allowing a program to provide a +wide range of messages, and allowing a user to configure which set +they want to see. +@item inversion.el +Revision management system. Allows you to use @code{require} syntax +for a specific version of some tool. If the tool is not compatible +with your desired version, a signal is thrown. +@item mode-local.el +Specify functions that have different behaviors based on major-mode, +or variables with different local values based on major mode. Setting +a value to a specific mode causes the value to change for all buffers +of that mode. + +mode-local is also aware of mode inheritance, such that C++ mode +inherits some C configurations. You can also run code, or access +variables from other modes by with a temorary scoped setting. + +mode local is used extensively throughout the @semantic{} package. +@item pprint.el +A pretty printer for Emacs Lisp code. Use it to dump out large +complex datastructures. +@item sformat.el +A Super Format function. Define lists of associations between letters +and values, and then create format strings with % tokens for any +letter. + +sformat is used in the semantic document package to construct complex +documentation strings. +@item working.el +Display a working message, or a ``percentage done'' style bar in the +mini-buffer. Tasks that take a long time can use working to provide +user feedback explaining a delay. +@end itemize + +@node Installation/Basic Configuration +@chapter Installation and Basic Configuration + +A compilation centric version of the @cedet{} installation is in the +INSTALL file in the top level @cedet{} directory. + +@enumerate +@item Compile @cedet{} + +@example +make +@end example + +or + +@example +make EMACS= MAKEINFO= +@end example + +If you do not have @code{make} installed on your system, or if you +cannot get the @file{Makefile}s to work, then you can use the all +Emacs solution in @file{cedet-build.el} which is found in the +toplevel @cedet directory. + +Read the Commentary section of @file{cedet-build.el} for details on +using this method. + +@item Install .emacs hooks + +Load @cedet{} in your @file{.emacs} file. You do not need to install +all of cedet into any magic Emacs controlled directories, or modify +your loadpath. The @cedet{} bootstrap file will automatically update +your load path, and load all the autoload files. The cedet +configuration will load a minimum set of files in. + +@example +;; Load CEDET +(load-file "~/cedet-VERSION/common/cedet.el") +@end example + +@item Configuration + +You will likely need to configure @cedet{} to your application. Visit +the other chapters in this manual for samples to get some ideas on +possible configuration scenarios. + +@item Contribute to @cedet{} + +For general discussions on development of these tools, use the mailing +list cedet-devel@@sourceforge.net via the URL: + +@url{http://lists.sourceforge.net/lists/listinfo/cedet-devel} + +For @semantic{} development use the mailing list cedet-semantic.net via +the URL: + +@url{http://lists.sourceforge.net/lists/listinfo/cedet-semantic} + +For @eieio{} use the mailing list cedet-eieio@@sourceforge.net via the +URL: + +@url{http://lists.sourceforge.net/lists/listinfo/cedet-eieio} + +@item Install Additional Tools + +You may also need to download some of the following files for more +obscure features. + +To use the JavaScript parser: +javascript-mode.el : @url{http://www.emacswiki.org/cgi-bin/wiki/JavaScriptMode} + +To use Exuberent ctags to emable Semantic support in more major modes, +or as an extra database backend parser, install ctags: +@url{http://ctags.sourceforge.net/} + +To use the UML chart generation from @code{M-x semantic-dot} +graphviz dot programs, including @file{dotty} +@url{http://www.graphviz.org/} + +To use the graphviz dot parser: @file{graphviz-dot-mode.el} see the +commentary in cogre/wisent-dot.el + +@end enumerate + +@node JDEE Target +@chapter @i{JDEE} Target + +@i{JDEE}, or the @i{Java Development Environment}, depends on @cedet{} +for both @eieio{}, the object system, and Semantic, for parsing and +providing tagging information. + +In addition to the basic @cedet{} configuration, you will likely want to +add the following Semantic configuration to your @file{.emacs} file. + +@example +(semantic-load-enable-minimum-features) +@end example + +This provides basic idle-time parsing of files, and persistence to +support the semantic APIs. + +If you would like to use more of the Semantic tools for your coding in +Java, you may want to enable this instead: + +@example +(semantic-load-enable-code-helpers) +@end example + +or the fancier + +@example +(semantic-load-enable-guady-code-helpers) +@end example + +See the +@inforef{Canned Configuration, Semantic Configuration, semantic}. +section of the semantic manual for more details about these features. + +@node ECB Target +@chapter ECB Target + +@i{ECB}, or the @i{Emacs Code Browser} depends on @cedet{} for the @semantic{} +parsing engine, and several other features. @i{ECB} can display a +window that shows semantic tag information. + +@i{ECB} can also be used with @i{JDEE}. + +In addition to the basic @cedet{} configuration, you will likely want to +add the following Semantic configuration to your @file{.emacs} file. + +@example +(semantic-load-enable-code-helpers) +@end example + +or the fancier + +@example +(semantic-load-enable-guady-code-helpers) +@end example + +See the +@inforef{Canned Configuration, Semantic Configuration, semantic}. +section of the semantic manual for more details about these features. + +@node Project Management +@chapter Project Management + +If you are looking for @cedet{} to help you manage a project full of +sourcecode, then you will be using @ede{} and @semantic{}. + +To enable @ede{} add this to your @file{.emacs} file after @cedet{} +is loaded: + +@example +(global-ede-mode 1) +@end example + +You can use @ede{} to define +your projects. If you are starting a new project, put a file from +your new project into a buffer, and type: + +@example +M-x ede-new RET +@end example + +Now select either ``Make'' or ``Automake'', which determines the +underlying build technology to use for compilation. + +Use the menu to add targets. You can then use either Speedbar or +dired to populate your targets with files. + +For more details, see the +@inforef{Top, EDE reference manual, ede}. + + +In addition to @ede{} and basic @cedet{} configuration, you will likely +want to add the following @semantic{} configuration to your +@file{.emacs} file. + +@example +(semantic-load-enable-code-helpers) +@end example + +See the +@inforef{Canned Configuration, Semantic Configuration, semantic}. +section of the semantic manual for more details about these features. + +You may also want to enable the @srecode{} template insertion mode. + +@example +(srecode-minor-mode 1) +@end example + +Both @semantic{} and @srecode{} take advantage of @ede{}'s knowledge of a +projects structure. + +@node Code Completion +@chapter Code Completion + +Code Completion, or perhaps ``Intellisense'' is a difficult problem to +get working in Emacs. To use the @cedet{} suite to do it, you will +need to start by augmenting the basic @cedet{} install in your +@file{.emacs} file with: + +@example +(semantic-load-enable-code-helpers) +@end example + +Basic code helpers enable idle parsing and summary mode. To get +idle-completions mode, and some more decorative features, use: + +@example +(semantic-load-enable-guady-code-helpers) +@end example + +TODO - add other handy bindings here. + +For more on configuration +@inforef{Canned Configuration, Semantic Configuration, semantic}. +section of the semantic manual for more details about these features. + +The basic idea is that Semantic will need to parse your source code and +build lookup tables. The tables are then searched to provide the +completion you might be looking for. + +To improve the things Semantic can find and complete with, you then +need to configure a few more things. This is done mainly by providing +details on where Semantic can find the source code where your tag +definitions are. + +For more, +@inforef{Semanticdb Search Configuration, Semantic search configuration, semantic-user}. + +Once you've optimized @semantic{}'s ability to find your sources, +there are several code completion options. For more, +@inforef{Analyzer, semantic analyzer, semantic-user}. + +If code completion doesn't work on your code right away, please read +the section on @inforef{Smart Completion Debugging, Smart Completion Debugging, semantic-user}. + +@node Code Generation +@chapter Code Generation + +Code Generation, or the ability to automatically write code from some +set of static data is done through the @srecode{} library. +@srecode{} is a template manager that uses the @semantic{} +infrastructure to support common concepts across multiple languages. + +To effectively create a code-generation library, you need to configure +@semantic{}. +Read @inforef{Canned Configuration, Semantic Configuration, semantic}. +for more. +@refill + +Secondly, you will need to configure @srecode{}. Read +@inforef{Quick Start, SRecode Manual, srecode}; +@refill + +Once installed, you can jump right in to writing your Lisp and +@inforef{Template Writing, Template Writing, screcode}. + + +@node C++ Features +@chapter C++ Features + +If you are using @cedet{} with C or C++, then there are a few C/C++ specific +options you may need to update. + +@section C Pre-processor + +C and C++ use pre-processor directives, and the @semantic{} parser has +some basic support for a pre-processor. As such, you may need to set +up some macros. You can do that in two ways. + +The first option is to create your own symbol map in Emacs Lisp. You +can customize the preprocessor symbol map. + +@defvar semantic-lex-c-preprocessor-symbol-map +@anchor{semantic-lex-c-preprocessor-symbol-map} +Table of @var{c} Preprocessor keywords used by the Semantic @var{c} lexer. +Each entry is a cons cell like this: + ( ``@var{keyword}`` . ''REPLACEMENT'' ) +Where @var{keyword} is the macro that gets replaced in the lexical phase, +and @var{replacement} is a string that is inserted in it's place. Empty string +implies that the lexical analyzer will discard @var{keyword} when it is encountered. + +Alternately, it can be of the form: + ( ``@var{keyword}`` ( @var{lexsym1} ``str'' @var{1} @var{1} ) @dots{} ( @var{lexsymn} ''str'' @var{1} @var{1} ) ) +where @var{lexsym} is a symbol that would normally be produced by the +lexical analyzer, such as @code{symbol} or @dfn{string}. The string in the +second position is the text that makes up the replacement. This is +the way to have multiple lexical symbols in a replacement. Using the +first way to specify text like ``foo::bar'' would not work, because : +is a separate lexical symbol. + +A quick way to see what you would need to insert is to place a +definition such as: + +#define @var{mysym} foo::bar + +into a @var{c} file, and do this: + @kbd{M-x} semantic-lex-spp-describe + +The output table will describe the symbols needed. +@end defvar + +Alternately, you can use an existing C header file, or write your own +custom C header file, and use the macros in that to initialize the +preprocessor list. + +@defvar semantic-lex-c-preprocessor-symbol-file +@anchor{semantic-lex-c-preprocessor-symbol-file} +List of @var{c}/@var{c}++ files that contain preprocessor macros for the @var{c} lexer. +Each entry is a filename and each file is parsed, and those macros +are included in every @var{c}/@var{c}++ file parsed by semantic. +You can use this variable instead of @code{semantic-lex-c-preprocessor-symbol-map} +to store your global macros in a more natural way. +@end defvar + +Some such symbols for @file{stdio.h} as found on Linux are defined in +@code{semantic-lex-c-preprocessor-symbol-map-builtin}. + +Lastly, you could just opt to ignore conditional parsing. + +@deffn Option semantic-c-obey-conditional-section-parsing-flag +@anchor{semantic-c-obey-conditional-section-parsing-flag} +Non-@code{nil} means to interpret preprocessor #if sections. +This implies that some blocks of code will not be parsed based on the +values of the conditions in the #if blocks. +@end deffn + + +@defun semantic-lex-c-nested-namespace-ignore-second +@anchor{semantic-lex-c-nested-namespace-ignore-second} +Should _@var{GLIBCXX_BEGIN_NESTED_NAMESPACE} ignore the second namespace? +It is really there, but if a majority of uses is to squeeze out +the second namespace in use, then it should not be included. + +If you are having problems with smart completion and @var{STL} templates, +it may that this is set incorrectly. After changing the value +of this flag, you will need to delete any semanticdb cache files +that may have been incorrectly parsed. +@end defun + +@section System Include path + +If you want the code-completion to work with C++ system header file, +you will need to update @code{semantic-dependency-system-include-path} for +C++ mode. + +@example +M-x customize-variable RET semantic-c-dependency-system-include-path RET +@end example + + +Customizing this variable will allow you to setup your system include path +and will update all files when you use custom to do it. + +@section EDE Setup + +For large C or C++ programs, it is important to setup @ede{} for it. +While @ede{} can be used to create makefiles and such using Automake, +@ede{} also provides a way to merely describe a project so that tools +like @semantic{} can find your sources. + +If your project already uses Automake, or if your project is Emacs or +the Linux Kernel, there are pre-existing EDE project types that will +automatically detect these projects. + +If EDE does not automatically detect your type of project, you may +want to use the very simple @code{ede-cpp-root-project} type. To use +it, add this to your @file{.emacs} file, or other configuration: + +@example +(global-ede-mode 1) ;; Enable EDE +(ede-cpp-root-project "SOMENAME" :file "/dir/to/some/file") +@end example + +where SOMENAME is a name for this project, and the file is a file name +that exists at the root of your project directory. There are many +more options for the optimization of finding your header files. +For more on this option, including include path setting, and providing +macro to the C pre-processor, see +@inforef{the ede-cpp-root chapter, ede-cpp-root, ede}. + + +@node GNU Global +@chapter GNU Global + +Several tools in @cedet{} can support the use of GNU Global. If you use +GNU Global in your project, you should enable the use of it to enhance +or speed up various tools in @cedet{}. + +You can download GNU Global from @url{http://www.gnu.org/software/global} + +To make sure your GNU Global installation is good, use the command + +@example +M-x cedet-gnu-global-version-check RET +@end example + +You can wrap any @cedet{} / GNU Global configurations in your +@file{.emacs} file like this: + +@example +(setq cedet-global-command "global") ; Change to path of global as needed +(when (cedet-gnu-global-version-check t) ; Is it ok? + ;; Configurations for GNU Global and CEDET + ) +@end example + +@section @ede{} and GNU Global + +The @ede{} project system can use GNU Global to accelerate finding +files within a project. The EDE command to @code{ede-find-file} +bound to @kbd{C-c . f} is one direct application. @semantic{} also +makes heavy use of of the feature to find header files. + +To enable it, configure the variable @code{ede-locate-setup-options}. +Something like this can work in your @file{.emacs} file. + +@example +(setq ede-locate-setup-options + '(ede-locate-global + ede-locate-base)) +@end example + +@section @semantic{} Database + +@semantic{} can use GNU Global as a back end for database searches. +To enable it, use: + +@example +(semanticdb-enable-gnu-global-databases 'c++-mode) +@end example + +where the first argument is a @code{major-mode} in which to use it. + +GNU Global will then be used for project-wide searches as a backup +when pre-existing @semantic{} database searches may not have parsed +all your files. + +@section @semantic Symref + +The semantic symref tool can use GNU Global to local symbol +references. This tool will automatically detect GNU Global and use +it. You can search for references via the commands: + +@table @code +@item semantic-symref +Find references to the tag under the cursor. +@item semantic-symref-symbol +Find references to an arbitrary symbol. +@end table + +@node ID Utils +@chapter ID Utils + +Several tools in @cedet{} can support the use of ID Utils. If you use +ID Utils in your project, you should enable the use of it to enhance +or speed up various tools in @cedet{}. + +You can download ID Utils from @url{http://www.gnu.org/software/idutils/} + +To make sure your ID Utils installation is good, use the command + +@example +M-x cedet-idutils-version-check RET +@end example + +You can wrap any @cedet{} / ID Utils configurations in your +@file{.emacs} file like this: + +@example +(when (cedet-idutils-version-check t) ; Is it ok? + ;; Configurations for ID Utils and @cedet{}. + ) +@end example + +@section @ede{} and ID Utils + +The @ede{} project system can use ID Utils to accelerate finding +files within a project. The EDE command to @code{ede-find-file} +bound to @kbd{C-c . f} is one direct application. @semantic{} also +makes heavy use of of the feature to find header files. + +To enable it, configure the variable @code{ede-locate-setup-options}. +Something like this can work in your @file{.emacs} file. + +@example +(setq ede-locate-setup-options + '(ede-locate-idutils + ede-locate-base)) +@end example + +@section @semantic Symref + +The semantic symref tool can use ID Utils to local symbol +references. This tool will automatically detect ID Utils and use +it. You can search for references via the commands: + +@table @code +@item semantic-symref +Find references to the tag under the cursor. +@item semantic-symref-symbol +Find references to an arbitrary symbol. +@end table + +@node CScope +@chapter CScope + +Several tools in @cedet{} can support the use of CScope. If you use +CScope in your project, you can enable the use of it to enhance +or speed up various tools in @cedet{}. + +You can download CScope from @url{http://cscope.sourceforge.net/} + +To make sure your CScope installation is good, use the command + +@example +M-x cedet-cscope-version-check RET +@end example + +You can wrap any @cedet{} / CScope configurations in your +@file{.emacs} file like this: + +@example +(when (cedet-cscope-version-check t) ; Is it ok? + ;; Configurations for CScope and CEDET. + ) +@end example + +@section Detecting CScope + +CScope is detected by the presense of a @file{cscope.out} file at the +ROOT of your current project, as specified by @ede{}. CScope the program +supports multiple @file{cscope.out} files spread out through your +project, but this is not detecte by @cedet{}. It will also use a +@file{cscope.out} in the same directory as your sources if you do not +use @ede{} + +If you use CScope and need this feature, please consider fixing it. +Contact the cedet-devel mailing list. + +@section @ede{} and CScope + +The @ede{} project system can use CScope to accelerate finding +files within a project. The EDE command to @code{ede-find-file} +bound to @kbd{C-c . f} is one direct application. @semantic{} also +makes heavy use of of the feature to find header files for C and C++. + +To enable it, configure the variable @code{ede-locate-setup-options}. +Something like this can work in your @file{.emacs} file. + +@example +(setq ede-locate-setup-options + '(ede-locate-cscope + ede-locate-base)) +@end example + +@section @semantic{} Database + +@@TODO + +@semantic{} can could use CScope as a back end for database searches, +but this has not been implemented yet. + +@ignore +@example +(semanticdb-enable-cscope-databases 'c++-mode) +@end example + +where the first argument is a @code{major-mode} in which to use it. + +CScope will then be used for project-wide searches as a backup when +pre-existing @semantic{} database searches may not have parsed all +your files. +@end ignore + +@section @semantic Symref + +The semantic symref tool can use CScope to local symbol references. +This tool will automatically detect CScope and use it. You can search +for references via the commands: + +@table @code +@item semantic-symref +Find references to the tag under the cursor. +@item semantic-symref-symbol +Find references to an arbitrary symbol. +@end table + +@node Maintenance +@chapter Maintenance + +Most of the @cedet{} tools do their best to maintain their data files and +caches. It is useful, however, to periodically run: + +@example +M-x semanticdb-cleanup-cache-files RET +@end example + +to delete old database cache files that may no longer be associated +with directories on your system. + +@node GNU Free Documentation License +@appendix GNU Free Documentation License + +@include ../semantic/doc/fdl.texi + +@node Index +@unnumbered Index +@printindex cp + +@iftex +@contents +@summarycontents +@end iftex + +@bye diff --git a/site/cedet-1.0pre7/common/data-debug.el b/site/cedet-1.0pre7/common/data-debug.el new file mode 100644 index 0000000..a70cc03 --- /dev/null +++ b/site/cedet-1.0pre7/common/data-debug.el @@ -0,0 +1,1092 @@ +;;; data-debug.el --- Datastructure Debugger + +;; Copyright (C) 2007, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: data-debug.el,v 1.25 2009/09/12 02:31:14 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Provide a simple way to investigate particularly large and complex +;; data structures. +;; +;; The best way to get started is to bind M-: to 'data-debug-eval-expression. +;; +;; (global-set-key "\M-:" 'data-debug-eval-expression) +;; +;; If you write functions with complex output that need debugging, you +;; can make them interactive with data-debug-show-stuff. For example: +;; +;; (defun my-complex-output-fcn () +;; "Calculate something complicated at point, and return it." +;; (interactive) ;; function not normally interactive +;; (let ((stuff (do-stuff))) +;; (when (interactive-p) +;; (data-debug-show-stuff stuff "myStuff")) +;; stuff)) + +(require 'font-lock) +(require 'ring) + +;;; Code: + +;;; Compatibility +;; +(if (featurep 'xemacs) + (eval-and-compile + (defalias 'data-debug-overlay-properties 'extent-properties) + (defalias 'data-debug-overlay-p 'extentp) + (if (not (fboundp 'propertize)) + (defun dd-propertize (string &rest properties) + "Mimic 'propertize' in from Emacs 23." + (add-text-properties 0 (length string) properties string) + string + ) + (defalias 'dd-propertize 'propertize)) + ) + ;; Regular Emacs + (eval-and-compile + (defalias 'data-debug-overlay-properties 'overlay-properties) + (defalias 'data-debug-overlay-p 'overlayp) + (defalias 'dd-propertize 'propertize) + ) + ) + +;;; GENERIC STUFF +;; +;;;###autoload +(defun data-debug-insert-property-list (proplist prefix &optional parent) + "Insert the property list PROPLIST. +Each line starts with PREFIX. +The attributes belong to the tag PARENT." + (while proplist + (let ((pretext (concat (symbol-name (car proplist)) " : "))) + (data-debug-insert-thing (car (cdr proplist)) + prefix + pretext + parent)) + (setq proplist (cdr (cdr proplist))))) + +;;; overlays +;; +(defun data-debug-insert-overlay-props (overlay prefix) + "Insert all the parts of OVERLAY. +PREFIX specifies what to insert at the start of each line." + (let ((attrprefix (concat (make-string (length prefix) ? ) "# ")) + (proplist (data-debug-overlay-properties overlay))) + (data-debug-insert-property-list + proplist attrprefix) + ) + ) + +(defun data-debug-insert-overlay-from-point (point) + "Insert the overlay found at the overlay button at POINT." + (let ((overlay (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-overlay-props overlay + (concat (make-string indent ? ) + "| ")) + (goto-char start) + )) + +(defun data-debug-insert-overlay-button (overlay prefix prebuttontext) + "Insert a button representing OVERLAY. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the overlay button." + (let ((start (point)) + (end nil) + (str (format "%s" overlay)) + (tip nil)) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) + (put-text-property start end 'ddebug overlay) + (put-text-property start end 'ddebug-indent(length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-overlay-from-point) + (insert "\n") + ) + ) + +;;; overlay list +;; +(defun data-debug-insert-overlay-list (overlaylist prefix) + "Insert all the parts of OVERLAYLIST. +PREFIX specifies what to insert at the start of each line." + (while overlaylist + (data-debug-insert-overlay-button (car overlaylist) + prefix + "") + (setq overlaylist (cdr overlaylist)))) + +(defun data-debug-insert-overlay-list-from-point (point) + "Insert the overlay found at the overlay list button at POINT." + (let ((overlaylist (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-overlay-list overlaylist + (concat (make-string indent ? ) + "* ")) + (goto-char start) + )) + +(defun data-debug-insert-overlay-list-button (overlaylist + prefix + prebuttontext) + "Insert a button representing OVERLAYLIST. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the overlay list button." + (let ((start (point)) + (end nil) + (str (format "#" (length overlaylist))) + (tip nil)) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) + (put-text-property start end 'ddebug overlaylist) + (put-text-property start end 'ddebug-indent(length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-overlay-list-from-point) + (insert "\n") + ) + ) + +;;; buffers +;; +(defun data-debug-insert-buffer-props (buffer prefix) + "Insert all the parts of BUFFER. +PREFIX specifies what to insert at the start of each line." + (let ((attrprefix (concat (make-string (length prefix) ? ) "# ")) + (proplist + (list :filename (buffer-file-name buffer) + :live (buffer-live-p buffer) + :modified (buffer-modified-p buffer) + :size (buffer-size buffer) + :process (get-buffer-process buffer) + :localvars (buffer-local-variables buffer) + ))) + (data-debug-insert-property-list + proplist attrprefix) + ) + ) + +(defun data-debug-insert-buffer-from-point (point) + "Insert the buffer found at the buffer button at POINT." + (let ((buffer (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-buffer-props buffer + (concat (make-string indent ? ) + "| ")) + (goto-char start) + )) + +(defun data-debug-insert-buffer-button (buffer prefix prebuttontext) + "Insert a button representing BUFFER. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the buffer button." + (let ((start (point)) + (end nil) + (str (format "%S" buffer)) + (tip nil)) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) + (put-text-property start end 'ddebug buffer) + (put-text-property start end 'ddebug-indent(length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-buffer-from-point) + (insert "\n") + ) + ) + +;;; buffer list +;; +(defun data-debug-insert-buffer-list (bufferlist prefix) + "Insert all the parts of BUFFERLIST. +PREFIX specifies what to insert at the start of each line." + (while bufferlist + (data-debug-insert-buffer-button (car bufferlist) + prefix + "") + (setq bufferlist (cdr bufferlist)))) + +(defun data-debug-insert-buffer-list-from-point (point) + "Insert the buffer found at the buffer list button at POINT." + (let ((bufferlist (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-buffer-list bufferlist + (concat (make-string indent ? ) + "* ")) + (goto-char start) + )) + +(defun data-debug-insert-buffer-list-button (bufferlist + prefix + prebuttontext) + "Insert a button representing BUFFERLIST. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the buffer list button." + (let ((start (point)) + (end nil) + (str (format "#" (length bufferlist))) + (tip nil)) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) + (put-text-property start end 'ddebug bufferlist) + (put-text-property start end 'ddebug-indent(length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-buffer-list-from-point) + (insert "\n") + ) + ) + +;;; processes +;; +(defun data-debug-insert-process-props (process prefix) + "Insert all the parts of PROCESS. +PREFIX specifies what to insert at the start of each line." + (let ((attrprefix (concat (make-string (length prefix) ? ) "# ")) + (id (process-id process)) + (tty (process-tty-name process)) + (pcontact (process-contact process t)) + (proplist (process-plist process))) + (data-debug-insert-property-list + (append + (if id (list 'id id)) + (if tty (list 'tty tty)) + (if pcontact pcontact) + proplist) + attrprefix) + ) + ) + +(defun data-debug-insert-process-from-point (point) + "Insert the process found at the process button at POINT." + (let ((process (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-process-props process + (concat (make-string indent ? ) + "| ")) + (goto-char start) + )) + +(defun data-debug-insert-process-button (process prefix prebuttontext) + "Insert a button representing PROCESS. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the process button." + (let ((start (point)) + (end nil) + (str (format "%S : %s" process (process-status process))) + (tip nil)) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) + (put-text-property start end 'ddebug process) + (put-text-property start end 'ddebug-indent(length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-process-from-point) + (insert "\n") + ) + ) + +;;; Rings +;; +;; A ring (like kill-ring, or whatever.) +(defun data-debug-insert-ring-contents (ring prefix) + "Insert all the parts of RING. +PREFIX specifies what to insert at the start of each line." + (let ((len (ring-length ring)) + (idx 0) + ) + (while (< idx len) + (data-debug-insert-thing (ring-ref ring idx) prefix "") + (setq idx (1+ idx)) + ))) + +(defun data-debug-insert-ring-items-from-point (point) + "Insert the ring found at the ring button at POINT." + (let ((ring (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-ring-contents ring + (concat (make-string indent ? ) + "} ")) + (goto-char start) + )) + +(defun data-debug-insert-ring-button (ring + prefix + prebuttontext) + "Insert a button representing RING. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the stuff list button." + (let* ((start (point)) + (end nil) + (str (format "#" + (ring-length ring) + (ring-size ring))) + (ringthing + (if (= (ring-length ring) 0) nil (ring-ref ring 0))) + (tip (format "Ring max-size %d, length %d." + (ring-size ring) + (ring-length ring))) + ) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-type-face) + (put-text-property start end 'ddebug ring) + (put-text-property start end 'ddebug-indent(length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-ring-items-from-point) + (insert "\n") + ) + ) + + +;;; Hash-table +;; + +;;;###autoload +(defun data-debug-insert-hash-table (hash-table prefix) + "Insert the contents of HASH-TABLE inserting PREFIX before each element." + (maphash + (lambda (key value) + (data-debug-insert-thing + key prefix + (dd-propertize "key " 'face font-lock-comment-face)) + (data-debug-insert-thing + value prefix + (dd-propertize "val " 'face font-lock-comment-face))) + hash-table)) + +(defun data-debug-insert-hash-table-from-point (point) + "Insert the contents of the hash-table button at POINT." + (let ((hash-table (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-hash-table + hash-table + (concat (make-string indent ? ) "> ")) + (goto-char start)) + ) + +(defun data-debug-insert-hash-table-button (hash-table prefix prebuttontext) + "Insert HASH-TABLE as expandable button with recursive prefix PREFIX and PREBUTTONTEXT in front of the button text." + (let ((string (dd-propertize (format "%s" hash-table) + 'face 'font-lock-keyword-face))) + (insert (dd-propertize + (concat prefix prebuttontext string) + 'ddebug hash-table + 'ddebug-indent (length prefix) + 'ddebug-prefix prefix + 'help-echo + (format "Hash-table\nTest: %s\nWeakness: %s\nElements: %d (of %d)" + (hash-table-test hash-table) + (if (hash-table-weakness hash-table) "yes" "no") + (hash-table-count hash-table) + (hash-table-size hash-table)) + 'ddebug-function + 'data-debug-insert-hash-table-from-point) + "\n")) + ) + +;;; Widget +;; +;; Widgets have a long list of properties +;;;###autoload +(defun data-debug-insert-widget-properties (widget prefix) + "Insert the contents of WIDGET inserting PREFIX before each element." + (let ((type (car widget)) + (rest (cdr widget))) + (while rest + (data-debug-insert-thing (car (cdr rest)) + prefix + (concat + (dd-propertize (format "%s" (car rest)) + 'face font-lock-comment-face) + " : ")) + (setq rest (cdr (cdr rest)))) + )) + +(defun data-debug-insert-widget-from-point (point) + "Insert the contents of the widget button at POINT." + (let ((widget (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-widget-properties + widget (concat (make-string indent ? ) "# ")) + (goto-char start)) + ) + +(defun data-debug-insert-widget (widget prefix prebuttontext) + "Insert one WIDGET. +A Symbol is a simple thing, but this provides some face and prefix rules. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing." + (let ((string (dd-propertize (format "#" (car widget)) + 'face 'font-lock-keyword-face))) + (insert (dd-propertize + (concat prefix prebuttontext string) + 'ddebug widget + 'ddebug-indent (length prefix) + 'ddebug-prefix prefix + 'help-echo + (format "Widget\nType: %s\n# Properties: %d" + (car widget) + (/ (1- (length widget)) 2)) + 'ddebug-function + 'data-debug-insert-widget-from-point) + "\n"))) + +;;; list of stuff +;; +;; just a list. random stuff inside. +;;;###autoload +(defun data-debug-insert-stuff-list (stufflist prefix) + "Insert all the parts of STUFFLIST. +PREFIX specifies what to insert at the start of each line." + (while stufflist + (data-debug-insert-thing + ;; Some lists may put a value in the CDR + (if (listp stufflist) (car stufflist) stufflist) + prefix + "") + (setq stufflist + (if (listp stufflist) + (cdr-safe stufflist) + nil)))) + +(defun data-debug-insert-stuff-list-from-point (point) + "Insert the stuff found at the stuff list button at POINT." + (let ((stufflist (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-stuff-list stufflist + (concat (make-string indent ? ) + "> ")) + (goto-char start) + )) + +(defun data-debug-insert-stuff-list-button (stufflist + prefix + prebuttontext) + "Insert a button representing STUFFLIST. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the stuff list button." + (let ((start (point)) + (end nil) + (str + (condition-case nil + (format "#" (safe-length stufflist)) + (error "#"))) + (tip (if (or (listp (car stufflist)) + (vectorp (car stufflist))) + "" + (format "%s" stufflist)))) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-variable-name-face) + (put-text-property start end 'ddebug stufflist) + (put-text-property start end 'ddebug-indent (length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-stuff-list-from-point) + (insert "\n") + ) + ) + +;;; vector of stuff +;; +;; just a vector. random stuff inside. +;;;###autoload +(defun data-debug-insert-stuff-vector (stuffvector prefix) + "Insert all the parts of STUFFVECTOR. +PREFIX specifies what to insert at the start of each line." + (let ((idx 0)) + (while (< idx (length stuffvector)) + (data-debug-insert-thing + ;; Some vectors may put a value in the CDR + (aref stuffvector idx) + prefix + "") + (setq idx (1+ idx))))) + +(defun data-debug-insert-stuff-vector-from-point (point) + "Insert the stuff found at the stuff vector button at POINT." + (let ((stuffvector (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start + ) + (end-of-line) + (setq start (point)) + (forward-char 1) + (data-debug-insert-stuff-vector stuffvector + (concat (make-string indent ? ) + "[ ")) + (goto-char start) + )) + +(defun data-debug-insert-stuff-vector-button (stuffvector + prefix + prebuttontext) + "Insert a button representing STUFFVECTOR. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the stuff vector button." + (let* ((start (point)) + (end nil) + (str (format "#" (length stuffvector))) + (tip str)) + (insert prefix prebuttontext str) + (setq end (point)) + (put-text-property (- end (length str)) end 'face 'font-lock-variable-name-face) + (put-text-property start end 'ddebug stuffvector) + (put-text-property start end 'ddebug-indent (length prefix)) + (put-text-property start end 'ddebug-prefix prefix) + (put-text-property start end 'help-echo tip) + (put-text-property start end 'ddebug-function + 'data-debug-insert-stuff-vector-from-point) + (insert "\n") + ) + ) + +;;; Symbol +;; + +(defun data-debug-insert-symbol-from-point (point) + "Insert attached properties and possibly the value of symbol at POINT." + (let ((symbol (get-text-property point 'ddebug)) + (indent (get-text-property point 'ddebug-indent)) + start) + (end-of-line) + (setq start (point)) + (forward-char 1) + (when (and (not (fboundp symbol)) (boundp symbol)) + (data-debug-insert-thing + (symbol-value symbol) + (concat (make-string indent ? ) "> ") + (concat + (dd-propertize "value" + 'face 'font-lock-comment-face) + " "))) + (data-debug-insert-property-list + (symbol-plist symbol) + (concat (make-string indent ? ) "> ")) + (goto-char start)) + ) + +(defun data-debug-insert-symbol-button (symbol prefix prebuttontext) + "Insert a button representing SYMBOL. + PREFIX is the text that preceeds the button. + PREBUTTONTEXT is some text between prefix and the symbol button." + (let ((string + (cond ((fboundp symbol) + (dd-propertize (concat "#'" (symbol-name symbol)) + 'face 'font-lock-function-name-face)) + ((boundp symbol) + (dd-propertize (concat "'" (symbol-name symbol)) + 'face 'font-lock-variable-name-face)) + (t (format "'%s" symbol))))) + (insert (dd-propertize + (concat prefix prebuttontext string) + 'ddebug symbol + 'ddebug-indent (length prefix) + 'ddebug-prefix prefix + 'help-echo "" + 'ddebug-function + 'data-debug-insert-symbol-from-point) + "\n")) + ) + +;;; String +(defun data-debug-insert-string (thing prefix prebuttontext) + "Insert one symbol THING. +A Symbol is a simple thing, but this provides some face and prefix rules. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing." + (let ((newstr thing)) + (while (string-match "\n" newstr) + (setq newstr (replace-match "\\n" t t newstr))) + (while (string-match "\t" newstr) + (setq newstr (replace-match "\\t" t t newstr))) + (insert prefix prebuttontext + (dd-propertize (format "\"%s\"" newstr) + 'face font-lock-string-face) + "\n" ))) + +;;; Number +(defun data-debug-insert-number (thing prefix prebuttontext) + "Insert one symbol THING. +A Symbol is a simple thing, but this provides some face and prefix rules. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing." + (insert prefix prebuttontext + (dd-propertize (format "%S" thing) + 'face font-lock-string-face) + "\n")) + +;;; Lambda Expression +(defun data-debug-insert-lambda-expression (thing prefix prebuttontext) + "Insert one lambda expression THING. +A Symbol is a simple thing, but this provides some face and prefix rules. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing." + (let ((txt (prin1-to-string thing))) + (data-debug-insert-simple-thing + txt prefix prebuttontext 'font-lock-keyword-face)) + ) + +;;; nil thing +(defun data-debug-insert-nil (thing prefix prebuttontext) + "Insert one simple THING with a face. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing. +FACE is the face to use." + (insert prefix prebuttontext) + (insert ": ") + (let ((start (point)) + (end nil)) + (insert "nil") + (setq end (point)) + (insert "\n" ) + (put-text-property start end 'face 'font-lock-variable-name-face) + )) + +;;; simple thing +(defun data-debug-insert-simple-thing (thing prefix prebuttontext face) + "Insert one simple THING with a face. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing. +FACE is the face to use." + (insert prefix prebuttontext) + (let ((start (point)) + (end nil)) + (insert (format "%s" thing)) + (setq end (point)) + (insert "\n" ) + (put-text-property start end 'face face) + )) + +;;; custom thing +(defun data-debug-insert-custom (thingstring prefix prebuttontext face) + "Insert one simple THINGSTRING with a face. +Use for simple items that need a custom insert. +PREFIX is the text that preceeds the button. +PREBUTTONTEXT is some text between prefix and the thing. +FACE is the face to use." + (insert prefix prebuttontext) + (let ((start (point)) + (end nil)) + (insert thingstring) + (setq end (point)) + (insert "\n" ) + (put-text-property start end 'face face) + )) + + +(defvar data-debug-thing-alist + '( + ;; nil + (null . data-debug-insert-nil) + + ;; Overlay + (data-debug-overlay-p . data-debug-insert-overlay-button) + + ;; Overlay list + ((lambda (thing) (and (consp thing) (data-debug-overlay-p (car thing)))) . + data-debug-insert-overlay-list-button) + + ;; Buffer + (bufferp . data-debug-insert-buffer-button) + + ;; Buffer list + ((lambda (thing) (and (consp thing) (bufferp (car thing)))) . + data-debug-insert-buffer-list-button) + + ;; Process + (processp . data-debug-insert-process-button) + + ;; String + (stringp . data-debug-insert-string) + + ;; Number + (numberp . data-debug-insert-number) + + ;; Symbol + (symbolp . data-debug-insert-symbol-button) + + ;; Ring + (ring-p . data-debug-insert-ring-button) + + ;; Lambda Expression + ((lambda (thing) (and (consp thing) (eq (car thing) 'lambda))) . + data-debug-insert-lambda-expression) + + ;; Hash-table + (hash-table-p . data-debug-insert-hash-table-button) + + ;; Widgets + (widgetp . data-debug-insert-widget) + + ;; List of stuff + (listp . data-debug-insert-stuff-list-button) + + ;; Vector of stuff + (vectorp . data-debug-insert-stuff-vector-button) + ) + "Alist of methods used to insert things into an Ddebug buffer.") + +;; An augmentation function for the thing alist. +(defun data-debug-add-specialized-thing (predicate fcn) + "Add a new specialized thing to display with data-debug. +PREDICATE is a function that returns t if a thing is this new type. +FCN is a function that will display stuff in the data debug buffer." + (let ((entry (cons predicate fcn)) + ;; Specialized entries show up AFTER nil, + ;; but before listp, vectorp, symbolp, and + ;; other general things. Splice it into + ;; the beginning. + (first (nthcdr 0 data-debug-thing-alist)) + (second (nthcdr 1 data-debug-thing-alist)) + ) + (when (not (member entry data-debug-thing-alist)) + (setcdr first (cons entry second))))) + +;; uber insert method +;;;###autoload +(defun data-debug-insert-thing (thing prefix prebuttontext &optional parent) + "Insert THING with PREFIX. +PREBUTTONTEXT is some text to insert between prefix and the thing +that is not included in the indentation calculation of any children. +If PARENT is non-nil, it is somehow related as a parent to thing." + (when (catch 'done + (dolist (test data-debug-thing-alist) + (when (funcall (car test) thing) + (condition-case nil + (funcall (cdr test) thing prefix prebuttontext parent) + (error + (funcall (cdr test) thing prefix prebuttontext))) + (throw 'done nil)) + ) + nil) + (data-debug-insert-simple-thing (format "%S" thing) + prefix + prebuttontext + 'bold))) + +;;; MAJOR MODE +;; +;; The Ddebug major mode provides an interactive space to explore +;; complicated data structures. +;; +(defgroup data-debug nil + "data-debug group." + :group 'langauges) + +(defvar data-debug-mode-syntax-table + (let ((table (make-syntax-table (standard-syntax-table)))) + (modify-syntax-entry ?\; ". 12" table) ;; SEMI, Comment start ;; + (modify-syntax-entry ?\n ">" table) ;; Comment end + (modify-syntax-entry ?\" "\"" table) ;; String + (modify-syntax-entry ?\- "_" table) ;; Symbol + (modify-syntax-entry ?\\ "\\" table) ;; Quote + (modify-syntax-entry ?\` "'" table) ;; Prefix ` (backquote) + (modify-syntax-entry ?\' "'" table) ;; Prefix ' (quote) + (modify-syntax-entry ?\, "'" table) ;; Prefix , (comma) + + table) + "Syntax table used in data-debug macro buffers.") + +(defvar data-debug-map + (let ((km (make-sparse-keymap))) + (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse) + (define-key km " " 'data-debug-expand-or-contract) + (define-key km "\C-m" 'data-debug-expand-or-contract) + (define-key km "n" 'data-debug-next) + (define-key km "p" 'data-debug-prev) + (define-key km "N" 'data-debug-next-expando) + (define-key km "P" 'data-debug-prev-expando) + km) + "Keymap used in data-debug.") + +(defcustom data-debug-mode-hook nil + "*Hook run when data-debug starts." + :group 'data-debug + :type 'hook) + +;;;###autoload +(defun data-debug-mode () + "Major-mode for the Analyzer debugger. + +\\{data-debug-map}" + (interactive) + (kill-all-local-variables) + (setq major-mode 'data-debug-mode + mode-name "DATA-DEBUG" + comment-start ";;" + comment-end "") + (set (make-local-variable 'comment-start-skip) + "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") + (set-syntax-table data-debug-mode-syntax-table) + (use-local-map data-debug-map) + (run-hooks 'data-debug-hook) + (buffer-disable-undo) + (set (make-local-variable 'font-lock-global-modes) nil) + (font-lock-mode -1) + ) + +;;;###autoload +(defun data-debug-new-buffer (name) + "Create a new ddebug buffer with NAME." + (let ((b (get-buffer-create name))) + (pop-to-buffer b) + (set-buffer b) + (erase-buffer) + (data-debug-mode) + b)) + +;;; Ddebug mode commands +;; +(defun data-debug-next () + "Go to the next line in the Ddebug buffer." + (interactive) + (forward-line 1) + (beginning-of-line) + (skip-chars-forward " *-><[]" (point-at-eol))) + +(defun data-debug-prev () + "Go to the next line in the Ddebug buffer." + (interactive) + (forward-line -1) + (beginning-of-line) + (skip-chars-forward " *-><[]" (point-at-eol))) + +(defun data-debug-next-expando () + "Go to the next line in the Ddebug buffer. +Contract the current line (if open) and expand the line +we move to." + (interactive) + (data-debug-contract-current-line) + (data-debug-next) + (data-debug-expand-current-line) + ) + +(defun data-debug-prev-expando () + "Go to the previous line in the Ddebug buffer. +Contract the current line (if open) and expand the line +we move to." + (interactive) + (data-debug-contract-current-line) + (data-debug-prev) + (data-debug-expand-current-line) + ) + +(defun data-debug-current-line-expanded-p () + "Return non-nil if the current line is expanded." + (let ((ti (current-indentation)) + (ni (condition-case nil + (save-excursion + (end-of-line) + (forward-char 1) + (current-indentation)) + (error 0)))) + (> ni ti))) + +(defun data-debug-line-expandable-p () + "Return non-nil if the current line is expandable. +Lines that are not expandable are assumed to not be contractable." + (not (get-text-property (point) 'ddebug-noexpand))) + +(defun data-debug-expand-current-line () + "Expand the current line (if possible). +Do nothing if already expanded." + (when (or (not (data-debug-line-expandable-p)) + (not (data-debug-current-line-expanded-p))) + ;; If the next line is the same or less indentation, expand. + (let ((fcn (get-text-property (point) 'ddebug-function))) + (when fcn + (funcall fcn (point)) + (beginning-of-line) + )))) + +(defun data-debug-contract-current-line () + "Contract the current line (if possible). +Do nothing if already expanded." + (when (and (data-debug-current-line-expanded-p) + ;; Don't contract if the current line is not expandable. + (get-text-property (point) 'ddebug-function)) + (let ((ti (current-indentation)) + ) + ;; If next indentation is larger, collapse. + (end-of-line) + (forward-char 1) + (let ((start (point)) + (end nil)) + (condition-case nil + (progn + ;; Keep checking indentation + (while (or (> (current-indentation) ti) + (looking-at "^\\s-*$")) + (end-of-line) + (forward-char 1)) + (setq end (point)) + ) + (error (setq end (point-max)))) + (delete-region start end) + (forward-char -1) + (beginning-of-line))))) + +(defun data-debug-expand-or-contract () + "Expand or contract anything at the current point." + (interactive) + (if (and (data-debug-line-expandable-p) + (data-debug-current-line-expanded-p)) + (data-debug-contract-current-line) + (data-debug-expand-current-line)) + (skip-chars-forward " *-><[]" (point-at-eol))) + +(defun data-debug-expand-or-contract-mouse (event) + "Expand or contract anything at event EVENT." + (interactive "e") + (let* ((win (car (car (cdr event)))) + ) + (select-window win t) + (save-excursion + ;(goto-char (window-start win)) + (mouse-set-point event) + (data-debug-expand-or-contract)) + )) + +;;; GENERIC STRUCTURE DUMP +;; +;;;###autoload +(defun data-debug-show-stuff (stuff name) + "Data debug STUFF in a buffer named *NAME DDebug*." + (data-debug-new-buffer (concat "*" name " DDebug*")) + (data-debug-insert-thing stuff "?" "") + (goto-char (point-min)) + (when (data-debug-line-expandable-p) + (data-debug-expand-current-line))) + +;;; DEBUG COMMANDS +;; +;; Various commands for displaying complex data structures. + +;;;###autoload +(defun data-debug-edebug-expr (expr) + "Dump out the contets of some expression EXPR in edebug with ddebug." + (interactive + (list (let ((minibuffer-completing-symbol t)) + (read-from-minibuffer "Eval: " + nil read-expression-map t + 'read-expression-history)) + )) + (let ((v (eval expr))) + (if (not v) + (message "Expression %s is nil." expr) + (data-debug-show-stuff v "expression")))) + +;;;###autoload +(defun data-debug-eval-expression (expr) + "Evaluate EXPR and display the value. +If the result is something simple, show it in the echo area. +If the result is a list or vector, then use the data debugger to display it." + (interactive + (list (let ((minibuffer-completing-symbol t)) + (read-from-minibuffer "Eval: " + nil read-expression-map t + 'read-expression-history)) + )) + + (if (null eval-expression-debug-on-error) + (setq values (cons (eval expr) values)) + (let ((old-value (make-symbol "t")) new-value) + ;; Bind debug-on-error to something unique so that we can + ;; detect when evaled code changes it. + (let ((debug-on-error old-value)) + (setq values (cons (eval expr) values)) + (setq new-value debug-on-error)) + ;; If evaled code has changed the value of debug-on-error, + ;; propagate that change to the global binding. + (unless (eq old-value new-value) + (setq debug-on-error new-value)))) + + (if (or (consp (car values)) (vectorp (car values))) + (let ((v (car values))) + (data-debug-show-stuff v "Expression")) + ;; Old style + (prog1 + (prin1 (car values) t) + (let ((str (eval-expression-print-format (car values)))) + (if str (princ str t)))))) + + +(provide 'data-debug) + +;;; data-debug.el ends here diff --git a/site/cedet-1.0pre7/common/ezimage.el b/site/cedet-1.0pre7/common/ezimage.el new file mode 100644 index 0000000..a858d9b --- /dev/null +++ b/site/cedet-1.0pre7/common/ezimage.el @@ -0,0 +1,367 @@ +;;; ezimage --- Generalized Image management + +;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation + +;; Author: Eric M. Ludlam +;; Keywords: file, tags, tools +;; X-RCS: $Id: ezimage.el,v 1.6 2005/12/07 16:51:22 zappo Exp $ + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; A few routines for placing an image over text that will work for any +;; Emacs implementation without error. When images are not supported, then +;; they are just not displayed. +;; +;; The idea is that gui buffers (trees, buttons, etc) will have text +;; representations of the GUI elements. These routines will replace the text +;; with an image when images are available. +;; +;; This file requires the `image' package if it is available. + +(condition-case nil + (require 'image) + (error nil)) + +;;; Code: +(defcustom ezimage-use-images + (and (or (fboundp 'defimage) ; emacs 21 + (fboundp 'make-image-specifier)) ; xemacs + (if (fboundp 'display-graphic-p) ; emacs 21 + (display-graphic-p) + window-system) ; old emacs & xemacs + (or (not (fboundp 'image-type-available-p)) ; xemacs? + (image-type-available-p 'xpm))) ; emacs 21 + "*Non-nil if ezimage should display icons." + :group 'ezimage + :version "21.1" + :type 'boolean) + +;;; Create our own version of defimage +(eval-and-compile + +(if (fboundp 'defimage) + + (progn + +(defmacro defezimage (variable imagespec docstring) + "Define VARIABLE as an image if `defimage' is not available. +IMAGESPEC is the image data, and DOCSTRING is documentation for the image." + `(progn + (defimage ,variable ,imagespec ,docstring) + (put (quote ,variable) 'ezimage t))) + +; (defalias 'defezimage 'defimage) + +;; This hack is for the ezimage install which has an icons direcory for +;; the default icons to be used. +(add-to-list 'load-path + (concat (file-name-directory + (locate-library "ezimage.el")) + "icons")) + + ) + (if (not (fboundp 'make-glyph)) + +(defmacro defezimage (variable imagespec docstring) + "Don't bother loading up an image... +Argument VARIABLE is the variable to define. +Argument IMAGESPEC is the list defining the image to create. +Argument DOCSTRING is the documentation for VARIABLE." + `(defvar ,variable nil ,docstring)) + +;; ELSE +(defun ezimage-find-image-on-load-path (image) + "Find the image file IMAGE on the load path." + (let ((l (cons + ;; In XEmacs, try the data directory first (for an + ;; install in XEmacs proper.) Search the load + ;; path next (for user installs) + (locate-data-directory "ezimage") + load-path)) + (r nil)) + (while (and l (not r)) + (if (file-exists-p (concat (car l) "/" image)) + (setq r (concat (car l) "/" image)) + (if (file-exists-p (concat (car l) "/icons/" image)) + (setq r (concat (car l) "/icons/" image)) + )) + (setq l (cdr l))) + r)) + +(defun ezimage-convert-emacs21-imagespec-to-xemacs (spec) + "Convert the Emacs21 image SPEC into an XEmacs image spec. +The Emacs 21 spec is what I first learned, and is easy to convert." + (let* ((sl (car spec)) + (itype (nth 1 sl)) + (ifile (nth 3 sl))) + (vector itype ':file (ezimage-find-image-on-load-path ifile)))) + +(defmacro defezimage (variable imagespec docstring) + "Define VARIABLE as an image if `defimage' is not available. +IMAGESPEC is the image data, and DOCSTRING is documentation for the image." + `(progn + (defvar ,variable + ;; The Emacs21 version of defimage looks just like the XEmacs image + ;; specifier, except that it needs a :type keyword. If we line + ;; stuff up right, we can use this cheat to support XEmacs specifiers. + (condition-case nil + (make-glyph + (make-image-specifier + (ezimage-convert-emacs21-imagespec-to-xemacs (quote ,imagespec))) + 'buffer) + (error nil)) + ,docstring) + (put ',variable 'ezimage t))) + +))) + +(defezimage ezimage-directory + ((:type xpm :file "dir.xpm" :ascent center)) + "Image used for empty directories.") + +(defezimage ezimage-directory-plus + ((:type xpm :file "dir-plus.xpm" :ascent center)) + "Image used for closed directories with stuff in them.") + +(defezimage ezimage-directory-minus + ((:type xpm :file "dir-minus.xpm" :ascent center)) + "Image used for open directories with stuff in them.") + +(defezimage ezimage-page-plus + ((:type xpm :file "page-plus.xpm" :ascent center)) + "Image used for closed files with stuff in them.") + +(defezimage ezimage-page-minus + ((:type xpm :file "page-minus.xpm" :ascent center)) + "Image used for open files with stuff in them.") + +(defezimage ezimage-page + ((:type xpm :file "page.xpm" :ascent center)) + "Image used for files with nothing interesting in it.") + +(defezimage ezimage-tag + ((:type xpm :file "tag.xpm" :ascent center)) + "Image used for tags.") + +(defezimage ezimage-tag-plus + ((:type xpm :file "tag-plus.xpm" :ascent center)) + "Image used for closed tag groups.") + +(defezimage ezimage-tag-minus + ((:type xpm :file "tag-minus.xpm" :ascent center)) + "Image used for open tags.") + +(defezimage ezimage-tag-gt + ((:type xpm :file "tag-gt.xpm" :ascent center)) + "Image used for closed tags (with twist arrow).") + +(defezimage ezimage-tag-v + ((:type xpm :file "tag-v.xpm" :ascent center)) + "Image used for open tags (with twist arrow).") + +(defezimage ezimage-tag-type + ((:type xpm :file "tag-type.xpm" :ascent center)) + "Image used for tags that represent a data type.") + +(defezimage ezimage-box-plus + ((:type xpm :file "box-plus.xpm" :ascent center)) + "Image of a closed box.") + +(defezimage ezimage-box-minus + ((:type xpm :file "box-minus.xpm" :ascent center)) + "Image of an open box.") + +(defezimage ezimage-mail + ((:type xpm :file "mail.xpm" :ascent center)) + "Image if an envelope.") + +(defezimage ezimage-checkout + ((:type xpm :file "checkmark.xpm" :ascent center)) + "Image representing a checkmark. For files checked out of a VC.") + +(defezimage ezimage-object + ((:type xpm :file "bits.xpm" :ascent center)) + "Image representing bits (an object file.)") + +(defezimage ezimage-object-out-of-date + ((:type xpm :file "bitsbang.xpm" :ascent center)) + "Image representing bits with a ! in it. (an out of data object file.)") + +(defezimage ezimage-label + ((:type xpm :file "label.xpm" :ascent center)) + "Image used for label prefix.") + +(defezimage ezimage-lock + ((:type xpm :file "lock.xpm" :ascent center)) + "Image of a lock. Used for Read Only, or private.") + +(defezimage ezimage-unlock + ((:type xpm :file "unlock.xpm" :ascent center)) + "Image of an unlocked lock.") + +(defezimage ezimage-key + ((:type xpm :file "key.xpm" :ascent center)) + "Image of a key.") + +(defezimage ezimage-document-tag + ((:type xpm :file "doc.xpm" :ascent center)) + "Image used to indicate documentation available.") + +(defezimage ezimage-document-plus + ((:type xpm :file "doc-plus.xpm" :ascent center)) + "Image used to indicate closed documentation.") + +(defezimage ezimage-document-minus + ((:type xpm :file "doc-minus.xpm" :ascent center)) + "Image used to indicate open documentation.") + +(defezimage ezimage-info-tag + ((:type xpm :file "info.xpm" :ascent center)) + "Image used to indicate more information available.") + +(defvar ezimage-expand-image-button-alist + '( + ;; here are some standard representations + ("<+>" . ezimage-directory-plus) + ("<->" . ezimage-directory-minus) + ("< >" . ezimage-directory) + ("[+]" . ezimage-page-plus) + ("[-]" . ezimage-page-minus) + ("[?]" . ezimage-page) + ("[ ]" . ezimage-page) + ("{+}" . ezimage-box-plus) + ("{-}" . ezimage-box-minus) + ;; Some vaguely representitive entries + ("*" . ezimage-checkout) + ("#" . ezimage-object) + ("!" . ezimage-object-out-of-date) + ("%" . ezimage-lock) + ) + "List of text and image associations.") + +(defun ezimage-insert-image-button-maybe (start length &optional string) + "Insert an image button based on text starting at START for LENGTH chars. +If buttontext is unknown, just insert that text. +If we have an image associated with it, use that image. +Optional argument STRING is a string upon which to add text properties." + (when ezimage-use-images + (let* ((bt (buffer-substring start (+ length start))) + (a (assoc bt ezimage-expand-image-button-alist))) + ;; Regular images (created with `insert-image' are intangible + ;; which (I suppose) make them more compatible with XEmacs 21. + ;; Unfortunatly, there is a giant pile o code dependent on the + ;; underlying text. This means if we leave it tangible, then I + ;; don't have to change said giant piles o code. + (if (and a (symbol-value (cdr a))) + (ezimage-insert-over-text (symbol-value (cdr a)) + start + (+ start (length bt)))))) + string) + +(defun ezimage-image-over-string (string &optional alist) + "Insert over the text in STRING an image found in ALIST. +Return STRING with properties applied." + (if ezimage-use-images + (let ((a (assoc string alist))) + (if (and a (symbol-value (cdr a))) + (ezimage-insert-over-text (symbol-value (cdr a)) + 0 (length string) + string) + string)) + string)) + +(defun ezimage-insert-over-text (image start end &optional string) + "Place IMAGE over the text between START and END. +Assumes the image is part of a gui and can be clicked on. +Optional argument STRING is a string upon which to add text properties." + (when ezimage-use-images + (if (featurep 'xemacs) + (add-text-properties start end + (list 'end-glyph image + 'rear-nonsticky (list 'display) + 'invisible t + 'detachable t) + string) + (add-text-properties start end + (list 'display image + 'rear-nonsticky (list 'display)) + string))) + string) + +(defun ezimage-image-association-dump () + "Dump out the current state of the Ezimage image alist. +See `ezimage-expand-image-button-alist' for details." + (interactive) + (with-output-to-temp-buffer "*Ezimage Images*" + (save-excursion + (set-buffer "*Ezimage Images*") + (goto-char (point-max)) + (insert "Ezimage image cache.\n\n") + (let ((start (point)) (end nil)) + (insert "Image\tText\tImage Name") + (setq end (point)) + (insert "\n") + (put-text-property start end 'face 'underline)) + (let ((ia ezimage-expand-image-button-alist)) + (while ia + (let ((start (point))) + (insert (car (car ia))) + (insert "\t") + (ezimage-insert-image-button-maybe start + (length (car (car ia)))) + (insert (car (car ia)) "\t" (format "%s" (cdr (car ia))) "\n")) + (setq ia (cdr ia))))))) + +(defun ezimage-image-dump () + "Dump out the current state of the Ezimage image alist. +See `ezimage-expand-image-button-alist' for details." + (interactive) + (with-output-to-temp-buffer "*Ezimage Images*" + (save-excursion + (set-buffer "*Ezimage Images*") + (goto-char (point-max)) + (insert "Ezimage image cache.\n\n") + (let ((start (point)) (end nil)) + (insert "Image\tImage Name") + (setq end (point)) + (insert "\n") + (put-text-property start end 'face 'underline)) + (let ((ia (ezimage-all-images))) + (while ia + (let ((start (point))) + (insert "cm") + (ezimage-insert-over-text (symbol-value (car ia)) start (point)) + (insert "\t" (format "%s" (car ia)) "\n")) + (setq ia (cdr ia))))))) + +(defun ezimage-all-images () + "Return a list of all variables containing ez images." + (let ((ans nil)) + (mapatoms (lambda (sym) + (if (get sym 'ezimage) (setq ans (cons sym ans)))) + ) + (setq ans (sort ans (lambda (a b) + (string< (symbol-name a) (symbol-name b))))) + ans) + ) + +(provide 'ezimage) + +;;; sb-image.el ends here diff --git a/site/cedet-1.0pre7/common/fame.el b/site/cedet-1.0pre7/common/fame.el new file mode 100644 index 0000000..66efb4a --- /dev/null +++ b/site/cedet-1.0pre7/common/fame.el @@ -0,0 +1,421 @@ +;;; fame.el --- Framework for Applications' MEssages +;; +;; Copyright (C) 2004 David Ponce +;; +;; Author: David Ponce +;; Maintainer: David Ponce +;; Created: 28 Oct 2004 +;; Keywords: status +;; X-RCS: $Id: fame.el,v 1.3 2005/09/30 20:07:29 zappo Exp $ +;; +;; This file is not part of GNU Emacs. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. +;; +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; This library provides a convenient framework for applications to +;; send messages distinguished by their level of importance, allowing +;; to customize how they will be actually rendered. +;; +;; The principle is to define a `channel' where to send messages at +;; particular levels, depending on their importance. A channel is +;; identified by a non-nil symbol. For example this library could +;; send its messages to the `fame' channel. Four levels of importance +;; are recognized, for debug, informational, warning and error +;; messages. +;; +;; Messages at any particular level can be either discarded, +;; temporarily displayed, recorded in the message log buffer without +;; showing them in the echo area, or shown the usual way like through +;; the `message' function. Messages shown in the echo area can be +;; recorded or not in the message log buffer. +;; +;; The `define-fame-channel' macro permits to easily define a new +;; channel, that is an option to customize how to display the message +;; levels for this channel, and the level specific functions to use to +;; send messages to this channel. +;; +;; Here is a small example: +;; +;; (require 'fame) +;; ... +;; (define-fame-channel feature) +;; ... +;; (feature-send-debug "Some useful debug message") +;; ... +;; (condition-case err +;; ... +;; (error +;; (feature-send-error "%s" (error-message-string err)))) +;; ... +;; (feature-send-info "Some useful informational message") +;; ... +;; (provide 'feature) + +;;; History: +;; + +;;; Code: + +;;; Constants and options +;; +(defconst fame-valid-levels + '(:error :warning :info :debug) + "Valid message levels.") + +(defconst fame-valid-level-values + '(t nolog temp temp-nolog log none) + "Valid message level values.") + +(defconst fame-default-level-values + '(:debug log :info temp :warning t :error t) + "Default display value of message levels.") + +(define-widget 'fame-display-choice 'radio-button-choice + "Widget to choose the display value of a level." + :format "%v\n" + :entry-format " %v%b" + :args '((const :format "%v" :value t) + (const :format "%v" :value nolog) + (const :format "%v" :value temp) + (const :format "%v" :value temp-nolog) + (const :format "%v" :value log) + (const :format "%v" :value none))) + +(define-widget 'fame-level-widget 'const + "Widget to display a level symbol." + :format " %t") + +(define-widget 'fame-channel-widget 'list + "Widget to customize the messages levels of a channel." + :tag "Display value of message levels" + :format "%{%t%}:\n%v\n" + :args '((fame-level-widget :tag ":debug " :value :debug) + (fame-display-choice) + (fame-level-widget :tag ":info " :value :info) + (fame-display-choice) + (fame-level-widget :tag ":warning" :value :warning) + (fame-display-choice) + (fame-level-widget :tag ":error " :value :error) + (fame-display-choice))) + +(defgroup fame nil + "Framework for Applications' MEssages." + :prefix "fame" + :group 'lisp) + +(defcustom fame-temp-message-delay 1 + "*Lifetime of a temporary message, in seconds." + :group 'fame + :type 'number) + +;;; Core message functions +;; +(eval-and-compile + +;;;; Read the message currently displayed in the echo area. + (defalias 'fame-current-message + (if (fboundp 'current-message) + 'current-message + 'ignore)) + +;;;; Show a message in the echo area without logging it. + (if (fboundp 'lmessage) + ;; XEmacs + (defun fame-message-nolog (&rest args) + "Display but don't log a message on the echo area. +ARGS are like those of the function `message'." + (and args (apply 'lmessage 'no-log args))) + ;; Emacs + (defun fame-message-nolog (&rest args) + "Display but don't log a message on the echo area. +ARGS will be passed to the function `message'." + (and args + (let ((message-log-max nil)) ;; No logging + (apply 'message args)))) + ) + +;;;; Log a message without showing it in the echo area. + (if (fboundp 'log-message) + ;; XEmacs + (defun fame-log-message (&rest args) + "Log but don't display a message. +ARGS are like those of the function `message'." + (and args (log-message 'message (apply 'format args)))) + ;; Emacs + (defun fame-log-message (&rest args) + "Log but don't display a message. +ARGS will be passed to the function `message'." + (and args + (let ((executing-kbd-macro t)) ;; Inhibit display! + (apply 'message args)))) + ) + ;; If the above definition fails, here is a portable implementation + ;; of a `log-message' function. + '(defun fame-log-message (&rest args) + "Log but don't display a message. +ARGS are like those of the function `message'." + (when args + (let ((text (apply 'format args))) + (with-current-buffer + (get-buffer-create (if (featurep 'xemacs) + " *Message-Log*" + "*Messages*")) + (goto-char (point-max)) + (or (bobp) (bolp) (insert "\n")) + (forward-line -1) + (if (search-forward text nil t) + (if (looking-at " \\[\\([0-9]+\\) times\\]") + (replace-match + (number-to-string + (1+ (string-to-number (match-string 1)))) + nil nil nil 1) + (end-of-line) + (insert " [2 times]")) + (forward-line 1) + (insert text)))))) + +;;;; Log and temporarily show a message in the echo area. + (condition-case nil + (require 'timer) + (error nil)) + ;; We need timers to display messages temporarily. + (if (not (fboundp 'run-with-timer)) + + (defun fame-temp-message-internal (fun &rest args) + "Display a message temporarily through the function FUN. +ARGS are like those of the function `message'." + ;; Without timers just call FUN. + (and args (apply fun args))) + + (defvar fame-temp-message-timer nil) + (defvar fame-temp-message-saved nil) + + (defun fame-temp-restore-message () + "Restore a message previously displayed in the echo area." + (when (timerp fame-temp-message-timer) + (cancel-timer fame-temp-message-timer) + (setq fame-temp-message-timer nil)) + (when fame-temp-message-saved + (prog1 (fame-message-nolog "%s" fame-temp-message-saved) + (setq fame-temp-message-saved nil)))) + + (defun fame-temp-message-internal (fun &rest args) + "Display a message temporarily through the function FUN. +ARGS are like those of the function `message'." + (when args + (condition-case nil + (progn + (fame-temp-restore-message) + (setq fame-temp-message-saved (fame-current-message)) + (prog1 (apply fun args) + (setq fame-temp-message-timer + (run-with-timer fame-temp-message-delay nil + 'fame-temp-restore-message)))) + (error + (fame-temp-restore-message))))) + ) + ) + +(defsubst fame-temp-message (&rest args) + "Display a message temporarily and log it. +ARGS are like those of the function `message'. +The original message is restored to the echo area after +`fame-temp-message-delay' seconds." + (apply 'fame-temp-message-internal 'message args)) + +(defsubst fame-temp-message-nolog (&rest args) + "Display a message temporarily without logging it. +ARGS are like those of the function `message'. +The original message is restored to the echo area after +`fame-temp-message-delay' seconds." + (apply 'fame-temp-message-internal 'fame-message-nolog args)) + +;;; Handling of message levels +;; +(defun fame-check-level (level) + "Check that LEVEL is a valid message level. +If valid, return LEVEL. Signal an error otherwise." + (if (memq level fame-valid-levels) + level + (signal 'wrong-type-argument + (list fame-valid-levels level)))) + +(defun fame-check-level-value (value) + "Check that VALUE is a valid message level value. +If valid, return VALUE. Signal an error otherwise." + (if (memq value fame-valid-level-values) + value + (signal 'wrong-type-argument + (list fame-valid-level-values value)))) + +(defun fame-check-channel (channel) + "Check that CHANNEL is a non-nil symbol. +If valid, return CHANNEL. Signal an error otherwise." + (if (and channel (symbolp channel)) + channel + (signal 'wrong-type-argument + (list 'symbolp channel)))) + +(defun fame-check-channel-levels (levels) + "Check that LEVELS is a valid specification of channel levels. +If valid, return a normalized form of the specification. +Signal an error otherwise." + (let (spec) + (dolist (level fame-valid-levels) + (push (fame-check-level-value + ;; A nil level value means to use the default value. + (or (plist-get levels level) + (plist-get fame-default-level-values level))) spec) + (push level spec)) + spec)) + +(defsubst fame-channel-symbol (channel) + "Return the symbol whose value is CHANNEL's levels." + (intern (format "%s-fame-levels" (fame-check-channel channel)))) + +(defun fame-channel-levels (channel) + "Return the message levels display values of CHANNEL. +If CHANNEL doesn't exist return the default value in constant +`fame-default-level-values'." + (let ((symbol (fame-channel-symbol channel))) + (if (boundp symbol) + (symbol-value symbol) + fame-default-level-values))) + +(defsubst fame-level-display (channel level) + "For CHANNEL, return the display value of LEVEL. +See also the option `fame-channels'." + (plist-get (fame-channel-levels channel) + (fame-check-level level))) + +;;; Sending messages to channels +;; +(defconst fame-send-functions-alist + '((none . nil) + (log . fame-log-message) + (temp . fame-temp-message) + (temp-nolog . fame-temp-message-nolog) + (nolog . fame-message-nolog) + (t . message) + )) + +(defun fame-send (channel level &rest args) + "Send a message to CHANNEL at level LEVEL. +ARGS are like those of the function `message'. +The message will be displayed according to what is specified for +CHANNEL in the `fame-channels' option." + (let ((sender (cdr (assq (fame-level-display channel level) + fame-send-functions-alist)))) + (and sender (apply sender args)))) + +(defsubst fame-send-debug (channel &rest args) + "Send a debug message to CHANNEL. +CHANNEL must be a non-nil symbol. +ARGS will be passed to the function `fame-send'." + (apply 'fame-send channel :debug args)) + +(defsubst fame-send-info (channel &rest args) + "Send an informational message to CHANNEL. +CHANNEL must be a non-nil symbol. +ARGS will be passed to the function `fame-send'." + (apply 'fame-send channel :info args)) + +(defsubst fame-send-warning (channel &rest args) + "Send a warning message to CHANNEL. +CHANNEL must be a non-nil symbol. +ARGS will be passed to the function `fame-send'." + (apply 'fame-send channel :warning args)) + +(defsubst fame-send-error (channel &rest args) + "Send an error message to CHANNEL. +CHANNEL must be a non-nil symbol. +ARGS will be passed to the function `fame-send'." + (apply 'fame-send channel :error args)) + +;;; Defining new channels +;; +;;;###autoload +(defmacro define-fame-channel (channel &optional default docstring) + "Define the new message channel CHANNEL. +CHANNEL must be a non-nil symbol. +The optional argument DEFAULT specifies the default value of message +levels for this channel. By default it is the value of +`fame-default-level-values'. +DOCSTRING is an optional channel documentation. + +This defines the option `CHANNEL-fame-levels' to customize the current +value of message levels. And the functions `CHANNEL-send-debug', +`CHANNEL-send-info', `CHANNEL-send-warning', and `CHANNEL-send-error', +that respectively send debug, informational, warning, and error +messages to CHANNEL." + (let ((c-opt (fame-channel-symbol channel))) + `(eval-when-compile + (defcustom ,c-opt ',(fame-check-channel-levels default) + ,(format "*Display value of message levels in the %s channel. +%s +This is a plist where a message level is a property whose value +defines how messages at this level will be displayed. + +The possible levels are :debug, :info, :warning, and :error. +Level values can be: + - t to show and log messages the standard way. + - nolog to show messages without logging them. + - temp to show messages temporarily and log them. + - temp-nolog to show messages temporarily without logging them. + - log to log but not show messages. + - none to discard messages. + +The default behavior is specified in `fame-default-level-values'." + channel + (if docstring (format "%s\n" docstring) "")) + :group 'fame + :type 'fame-channel-widget) + (defsubst ,(intern (format "%s-send-debug" channel)) + (&rest args) + ,(format "Send a debug message to the `%s' channel. +ARGS will be passed to the function `fame-send'. +To customize how such messages will be displayed, see the option +`%s'." channel c-opt) + (apply 'fame-send ',channel :debug args)) + (defsubst ,(intern (format "%s-send-info" channel)) + (&rest args) + ,(format "Send an informational message to the `%s' channel. +ARGS will be passed to the function `fame-send'. +To customize how such messages will be displayed, see the option +`%s'." channel c-opt) + (apply 'fame-send ',channel :info args)) + (defsubst ,(intern (format "%s-send-warn" channel)) + (&rest args) + ,(format "Send a warning message to the `%s' channel. +ARGS will be passed to the function `fame-send'. +To customize how such messages will be displayed, see the option +`%s'." channel c-opt) + (apply 'fame-send ',channel :warning args)) + (defsubst ,(intern (format "%s-send-error" channel)) + (&rest args) + ,(format "Send an error message to the `%s' channel. +ARGS will be passed to the function `fame-send'. +To customize how such messages will be displayed, see the option +`%s'." channel c-opt) + (apply 'fame-send ',channel :error args)) + ;; Return the CHANNEL symbol + ',c-opt))) + +(provide 'fame) + +;;; fame.el ends here diff --git a/site/cedet-1.0pre7/common/icons/Makefile b/site/cedet-1.0pre7/common/icons/Makefile new file mode 100644 index 0000000..a12acff --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/Makefile @@ -0,0 +1,38 @@ +# Automatically Generated Makefile by EDE. +# For use with: make +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +top=../ +ede_FILES=Project.ede Makefile + +icons_MISC=bitsbang.xpm bits.xpm box-minus.xpm box-plus.xpm box.xpm checkmark.xpm dir-minus.xpm dir-plus.xpm dir.xpm doc-minus.xpm doc-plus.xpm doc.xpm info.xpm key.xpm label.xpm lock.xpm mail.xpm page-minus.xpm page-plus.xpm page.xpm tag-gt.xpm tag-minus.xpm tag-plus.xpm tag-type.xpm tag-v.xpm tag.xpm unlock.xpm +VERSION=1.0pre7 +DISTDIR=$(top)common-$(VERSION)/icons + + + +all: icons + +icons: + @ + +tags: + +.PHONY: dist + +dist: + mkdir $(DISTDIR) + cp $(icons_MISC) $(ede_FILES) $(DISTDIR) + +Makefile: Project.ede + @echo Makefile is out of date! It needs to be regenerated by EDE. + @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. + @false + + + +# End of Makefile diff --git a/site/cedet-1.0pre7/common/icons/Project.ede b/site/cedet-1.0pre7/common/icons/Project.ede new file mode 100644 index 0000000..43da3d7 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/Project.ede @@ -0,0 +1,13 @@ +;; Object ede-proj-project +;; EDE project file. +(ede-proj-project "common/icons" + :name "icons" + :file "Project.ede" + :targets (list + (ede-proj-target-makefile-miscelaneous "icons" + :name "icons" + :path "" + :source '("bitsbang.xpm" "bits.xpm" "box-minus.xpm" "box-plus.xpm" "box.xpm" "checkmark.xpm" "dir-minus.xpm" "dir-plus.xpm" "dir.xpm" "doc-minus.xpm" "doc-plus.xpm" "doc.xpm" "info.xpm" "key.xpm" "label.xpm" "lock.xpm" "mail.xpm" "page-minus.xpm" "page-plus.xpm" "page.xpm" "tag-gt.xpm" "tag-minus.xpm" "tag-plus.xpm" "tag-type.xpm" "tag-v.xpm" "tag.xpm" "unlock.xpm") + ) + ) + ) diff --git a/site/cedet-1.0pre7/common/icons/bits.xpm b/site/cedet-1.0pre7/common/icons/bits.xpm new file mode 100644 index 0000000..b291fcf --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/bits.xpm @@ -0,0 +1,20 @@ +/* XPM */ +static char * sb_obj_xpm[] = { +"15 15 2 1", +" c None", +". c #000CFF", +" .. . .. . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +" .. . .. . ", +" ", +". .. . .. ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +". .. . .. ", +" ", +" .. . .. . ", +". . . . . . ", +". . . . . . "}; diff --git a/site/cedet-1.0pre7/common/icons/bitsbang.xpm b/site/cedet-1.0pre7/common/icons/bitsbang.xpm new file mode 100644 index 0000000..cd49e83 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/bitsbang.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * sb_objod_xpm[] = { +"15 15 3 1", +" c None", +". c #000CFF", +"+ c #FFFA00", +" .. . .. . ", +". .++ . . . ", +". .++ . . . ", +". . ++. . . ", +" .. ++ .. . ", +" ++ ", +". ..++. .. ", +". . .++ . . ", +". . .++ . . ", +". . .++ . . ", +". .. . .. ", +" ++ ", +" .. . ++. . ", +". . . . . . ", +". . . . . . "}; diff --git a/site/cedet-1.0pre7/common/icons/box-minus.xpm b/site/cedet-1.0pre7/common/icons/box-minus.xpm new file mode 100644 index 0000000..a24583c --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/box-minus.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_box_minus_xpm[] = { +"20 15 4 1", +" c None", +". c #000000", +"+ c #828282", +"@ c #D19200", +"...+ +..+ ", +".@@.+ +.@.+", +"+.@@.+ +.@@@.", +"+.@@@.+++++++++.@@..", +" +..@............@.+", +" +.@..@@@@@@@@@@@..+", +" +.@@..............+", +" +.@@.@@@@@@@@@@@@.+", +" +.@@.@@@@@@@@@@@@.+", +" +.@@.@@@......@@@.+", +" +.@@.@@@......@@@.+", +" +.@.@@@@@@@@@@@@.+", +" +..@@@@@@@@@@@@.+", +" +..............+", +" ++++++++++++++ "}; diff --git a/site/cedet-1.0pre7/common/icons/box-plus.xpm b/site/cedet-1.0pre7/common/icons/box-plus.xpm new file mode 100644 index 0000000..5f70fef --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/box-plus.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_box_plus_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #D19200", +" ", +" .............. ", +" .++++++++++++++. ", +" .++@@@@@@+@@@@@+. ", +" .+@+@@@@@@+@@@@@+. ", +" .+@@++++++++++++++.", +" .+@@+@@@@@@@@@@@@+.", +" .+@@+@@@@@++@@@@@+.", +" .+@@+@@@@@++@@@@@+.", +" .+@@+@@@++++++@@@+.", +" .+@@+@@@++++++@@@+.", +" .+@+@@@@@++@@@@@+.", +" .++@@@@@++@@@@@+.", +" .++++++++++++++.", +" .............. "}; diff --git a/site/cedet-1.0pre7/common/icons/box.xpm b/site/cedet-1.0pre7/common/icons/box.xpm new file mode 100644 index 0000000..f569715 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/box.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_box_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ............... ", +" .++++++++++++++. ", +" .++@@@@@@+@@@@@+. ", +" .+@+@@@@@@+@@@@@+. ", +" .+@@++++++++++++++.", +" .+@@+@@@@@@@@@@@@+.", +" .+@@+@@@@@@@@@@@@+.", +" .+@@+@@@@@@@@@@@@+.", +" .+@@+@@@@@@@@@@@@+.", +" .+@@+@@@@@@@@@@@@+.", +" .+@+@@@@@@@@@@@@+.", +". .++@@@@@@@@@@@@+.", +" .++++++++++++++.", +" .............. "}; diff --git a/site/cedet-1.0pre7/common/icons/checkmark.xpm b/site/cedet-1.0pre7/common/icons/checkmark.xpm new file mode 100644 index 0000000..ad4078b --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/checkmark.xpm @@ -0,0 +1,20 @@ +/* XPM */ +static char * sb_chk_xpm[] = { +"15 15 2 1", +" c None", +". c #FF0000", +" ", +" . . .. ", +" . . . ", +" . . . . ", +" . .. . ", +" .. ", +" .. ", +" ... .. ", +" ... .. ", +" .... .. ", +" ... .. ", +" .... ", +" ... ", +" . ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/dir-minus.xpm b/site/cedet-1.0pre7/common/icons/dir-minus.xpm new file mode 100644 index 0000000..2edd33e --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/dir-minus.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_dir_minus_xpm[] = { +"20 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #DBDB00", +"# c #FFF993", +" ....... ", +".+++++++. ", +".+@@@@@@+......... ", +".+@@@@@@@++++++++. ", +".+@@@@@@@@@@@@@@+...", +".+@@++++++++++++++++", +".+@@+##############+", +".+@+##############+.", +".+@+####++++++####+.", +".+@+####++++++####+.", +".+@+##############+.", +".++##############+..", +".++##############+. ", +".+++++++++++++++++. ", +" ................. "}; diff --git a/site/cedet-1.0pre7/common/icons/dir-plus.xpm b/site/cedet-1.0pre7/common/icons/dir-plus.xpm new file mode 100644 index 0000000..93154af --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/dir-plus.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_dir_plus_xpm[] = { +"20 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #DBDB00", +"# c #FFF993", +" ....... ", +".+++++++. ", +".+@@@@@@+.......... ", +".+@@@@@@@++++++++++.", +".+@@@@@@@@@@@@@@@@+.", +".+#######++#####@@+.", +".+#######++######@+.", +".+#####++++++####@+.", +".+#####++++++####@+.", +".+#######++######@+.", +".+#######++######@+.", +".+###############@+.", +".+###############@+.", +".++++++++++++++++++.", +" .................. "}; diff --git a/site/cedet-1.0pre7/common/icons/dir.xpm b/site/cedet-1.0pre7/common/icons/dir.xpm new file mode 100644 index 0000000..de1d3fd --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/dir.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_dir_xpm[] = { +"20 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #DBDB00", +"# c #FFF993", +" ....... ", +".+++++++. ", +".+@@@@@@+.......... ", +".+@@@@@@@++++++++++.", +".+@@@@@@@@@@@@@@@@+.", +".+##############@@+.", +".+###############@+.", +".+###############@+.", +".+###############@+.", +".+###############@+.", +".+###############@+.", +".+###############@+.", +".+###############@+.", +".++++++++++++++++++.", +" .................. "}; diff --git a/site/cedet-1.0pre7/common/icons/doc-minus.xpm b/site/cedet-1.0pre7/common/icons/doc-minus.xpm new file mode 100644 index 0000000..2480e4b --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/doc-minus.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_doc_minus_xpm[] = { +"15 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #5A818B", +"# c #FFFFFF", +" ....... ", +" .+++++++. ", +" .+@@@@@@+. ", +" .+@@@@@@+#. ", +" .+@@@@@@+#+.", +" .+@####@+##+.", +" .+@@@@@@@+#+. ", +" .+@@@@@@+##+. ", +".++++@@@@+#+. ", +".+###++++##+. ", +".+########+. ", +".++#######+. ", +" ..++++##+. ", +" ....+++. ", +" ... "}; diff --git a/site/cedet-1.0pre7/common/icons/doc-plus.xpm b/site/cedet-1.0pre7/common/icons/doc-plus.xpm new file mode 100644 index 0000000..eb7ebe1 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/doc-plus.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_doc_plus_xpm[] = { +"15 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #5A818B", +"# c #FFFFFF", +" ....... ", +" .+++++++. ", +" .+@@@@@@+. ", +" .+@@#@@@+#. ", +" .+@@#@@@+#+.", +" .+@#####+##+.", +" .+@@@@#@@+#+. ", +" .+@@@@#@+##+. ", +".++++@@@@+#+. ", +".+###++++##+. ", +".+########+. ", +".++#######+. ", +" ..++++##+. ", +" ....+++. ", +" ... "}; diff --git a/site/cedet-1.0pre7/common/icons/doc.xpm b/site/cedet-1.0pre7/common/icons/doc.xpm new file mode 100644 index 0000000..3ed8eee --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/doc.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_doc_xpm[] = { +"15 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #5A818B", +"# c #FFFFFF", +" ....... ", +" .+++++++. ", +" .+@@@@@@+. ", +" .+@@@@@@+#. ", +" .+@@@@@@+#+.", +" .+@@@@@@+##+.", +" .+@@@@@@@+#+. ", +" .+@@@@@@+##+. ", +".++++@@@@+#+. ", +".+###++++##+. ", +".+########+. ", +".+########+. ", +".++++++##+. ", +" ......+++. ", +" ... "}; diff --git a/site/cedet-1.0pre7/common/icons/info.xpm b/site/cedet-1.0pre7/common/icons/info.xpm new file mode 100644 index 0000000..0027252 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/info.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_info_xpm[] = { +"10 15 4 1", +" c None", +". c #BEBEBE", +"+ c #0000FF", +"@ c #FFFFFF", +" .. ", +" ..+++. ", +" .+++@++. ", +" .+++++++ ", +" .+++++++ ", +".++@@@++++", +".++++@++++", +".++++@++++", +".++++@++++", +" .+++@++++", +" .+++@+++ ", +" .+@@@@@+ ", +" .+++++++ ", +" .+++++ ", +" ++ "}; diff --git a/site/cedet-1.0pre7/common/icons/key.xpm b/site/cedet-1.0pre7/common/icons/key.xpm new file mode 100644 index 0000000..4b9c7b8 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/key.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * key_xpm[] = { +"16 16 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ........ ", +" ..++++++.. ", +" .+@@@@@@+. ", +" .+@@++@@+. ", +" .+@@@@@@+. ", +" .+@@@@@@+. ", +" .+@@@@@@+. ", +" .+@@@@+. ", +" .+@@+. ", +" .+@@@+. ", +" .+@@+. ", +" .+@@+. ", +" .+@@@+. ", +" .+@@+. ", +" .++. ", +" .. "}; diff --git a/site/cedet-1.0pre7/common/icons/label.xpm b/site/cedet-1.0pre7/common/icons/label.xpm new file mode 100644 index 0000000..715cc2c --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/label.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_label_xpm[] = { +"10 16 3 1", +" c None", +". c gray", +"+ c blue", +" .....", +" ..+++++", +" .+++++++", +" .++++++++", +" .++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++", +".+++++++++"}; diff --git a/site/cedet-1.0pre7/common/icons/lock.xpm b/site/cedet-1.0pre7/common/icons/lock.xpm new file mode 100644 index 0000000..f51ee97 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/lock.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * lock_xpm[] = { +"16 16 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ........ ", +" ..++++++.. ", +" .++....++. ", +" .+......+. ", +" ..+......+.. ", +" ..++++++++++..", +" .++@@@@@@@@++.", +" .+@@@@@@@@@@+.", +" .+@@@@@@@@@@+.", +" .+@@@++++@@@+.", +" .+@@@@++@@@@+.", +" .+@@@@@@@@@@+.", +" .+@@@@++@@@@+.", +" .+@@@@@@@@@@+.", +" .++++++++++++.", +" .............."}; diff --git a/site/cedet-1.0pre7/common/icons/mail.xpm b/site/cedet-1.0pre7/common/icons/mail.xpm new file mode 100644 index 0000000..5716eeb --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/mail.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_mail_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFFFFF", +"................... ", +".++++++++++++++++++.", +".++@@@@@@@@@@@@@@++.", +".+@++@@@@@@@@@@++@+.", +".+@@@++@@@@@@++@@@+.", +".+@@@@@++@@++@@@@@+.", +".+@@@@@@@++@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@+@@@@@@+@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@+@@@@@@@@@@+@@+.", +".+@@@@@@@@@@@@@@@@+.", +".++@@@@@@@@@@@@@@++.", +".++++++++++++++++++.", +" .................. "}; diff --git a/site/cedet-1.0pre7/common/icons/page-minus.xpm b/site/cedet-1.0pre7/common/icons/page-minus.xpm new file mode 100644 index 0000000..2e54243 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/page-minus.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_pg_minus_xpm[] = { +"20 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFFFFF", +"# c #ADADAD", +" ............ ", +" .++++++++++++.", +" .++@@@@@@@@@@+.", +" .+#+@@@@@@@@@@+.", +" .+##+@@@@@@@@@@+.", +" .+###+@@@@@@@@@@+.", +" .+####+@@@@@@@@@@+.", +".+++++++@++++++@@@+.", +".+@@@@@@@++++++@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".++++++++++++++++++.", +" .................. "}; diff --git a/site/cedet-1.0pre7/common/icons/page-plus.xpm b/site/cedet-1.0pre7/common/icons/page-plus.xpm new file mode 100644 index 0000000..aa5d38f --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/page-plus.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_pg_plus_xpm[] = { +"20 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFFFFF", +"# c #ADADAD", +" ............ ", +" .++++++++++++.", +" .++@@@@@@@@@@+.", +" .+#+@@@@@@@@@@+.", +" .+##+@@@@@@@@@@+.", +" .+###+@@@++@@@@@+.", +" .+####+@@@++@@@@@+.", +".+++++++@++++++@@@+.", +".+@@@@@@@++++++@@@+.", +".+@@@@@@@@@++@@@@@+.", +".+@@@@@@@@@++@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".++++++++++++++++++.", +" .................. "}; diff --git a/site/cedet-1.0pre7/common/icons/page.xpm b/site/cedet-1.0pre7/common/icons/page.xpm new file mode 100644 index 0000000..75c6a6e --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/page.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * sb_pg_xpm[] = { +"20 15 5 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFFFFF", +"# c #ADADAD", +" ............ ", +" .++++++++++++.", +" .++@@@@@@@@@@+.", +" .+#+@@@@@@@@@@+.", +" .+##+@@@@@@@@@@+.", +" .+###+@@@@@@@@@@+.", +" .+####+@@@@@@@@@@+.", +".+++++++@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".++++++++++++++++++.", +" .................. "}; diff --git a/site/cedet-1.0pre7/common/icons/tag-gt.xpm b/site/cedet-1.0pre7/common/icons/tag-gt.xpm new file mode 100644 index 0000000..49b8b72 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/tag-gt.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_tag_gt_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ", +" ............... ", +" .+++++++++++++++.", +" .+@@@@@++@@@@@@@+.", +" .+@@@@@@+++@@@@@@+.", +".+@@@@@@@++++@@@@@+.", +".+@++@@@@+++++@@@@+.", +".+@++@@@@+++++.@@@+.", +".+@@@@@@@++++.@@@@+.", +" .+@@@@@@+++.@@@@@+.", +" .+@@@@@++.@@@@@@+.", +". .++++++.++++++++.", +" ............... ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/tag-minus.xpm b/site/cedet-1.0pre7/common/icons/tag-minus.xpm new file mode 100644 index 0000000..f006c4e --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/tag-minus.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_tag__xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ", +" ............... ", +" .+++++++++++++++.", +" .+@@@@@@@@@@@@@@+.", +" .+@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@++@@++++++@@@@@+.", +".+@++@@++++++@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +" .+@@@@@@@@@@@@@@@+.", +" .+@@@@@@@@@@@@@@+.", +". .+++++++++++++++.", +" ............... ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/tag-plus.xpm b/site/cedet-1.0pre7/common/icons/tag-plus.xpm new file mode 100644 index 0000000..cf32fef --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/tag-plus.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_tag+_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ", +" ............... ", +" .+++++++++++++++.", +" .+@@@@@@@@@@@@@@+.", +" .+@@@@@@++@@@@@@@+.", +".+@@@@@@@++@@@@@@@+.", +".+@++@@++++++@@@@@+.", +".+@++@@++++++@@@@@+.", +".+@@@@@@@++@@@@@@@+.", +" .+@@@@@@++@@@@@@@+.", +" .+@@@@@@@@@@@@@@+.", +". .+++++++++++++++.", +" ............... ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/tag-type.xpm b/site/cedet-1.0pre7/common/icons/tag-type.xpm new file mode 100644 index 0000000..6588698 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/tag-type.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_tag_type_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ", +" ............... ", +" .+++++++++++++++.", +" .+@@@@@@@@@@@@@@+.", +" .+@@@@@@++++++@@@+.", +".+@@@@@@@++++++@@@+.", +".+@++@@@@@@++@@@@@+.", +".+@++@@@@@@++@@@@@+.", +".+@@@@@@@@@++@@@@@+.", +" .+@@@@@@@@++@@@@@+.", +" .+@@@@@@@@@@@@@@+.", +". .+++++++++++++++.", +" ............... ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/tag-v.xpm b/site/cedet-1.0pre7/common/icons/tag-v.xpm new file mode 100644 index 0000000..7431e4c --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/tag-v.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_tag_v_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ", +" ............... ", +" .+++++++++++++++.", +" .+@@@@@@@@@@@@@@+.", +" .+@@@++++++++++.@+.", +".+@@@@@++++++++.@@+.", +".+@++@@@++++++.@@@+.", +".+@++@@@@++++.@@@@+.", +".+@@@@@@@@++.@@@@@+.", +" .+@@@@@@@@.@@@@@@+.", +" .+@@@@@@@@@@@@@@+.", +". .+++++++++++++++.", +" ............... ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/tag.xpm b/site/cedet-1.0pre7/common/icons/tag.xpm new file mode 100644 index 0000000..4c6f1c5 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/tag.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * sb_tag_xpm[] = { +"20 15 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ", +" ", +" ............... ", +" .+++++++++++++++.", +" .+@@@@@@@@@@@@@@+.", +" .+@@@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +".+@++@@@@@@@@@@@@@+.", +".+@++@@@@@@@@@@@@@+.", +".+@@@@@@@@@@@@@@@@+.", +" .+@@@@@@@@@@@@@@@+.", +" .+@@@@@@@@@@@@@@+.", +". .+++++++++++++++.", +" ............... ", +" "}; diff --git a/site/cedet-1.0pre7/common/icons/unlock.xpm b/site/cedet-1.0pre7/common/icons/unlock.xpm new file mode 100644 index 0000000..5841163 --- /dev/null +++ b/site/cedet-1.0pre7/common/icons/unlock.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * unlock_xpm[] = { +"16 16 4 1", +" c None", +". c #828282", +"+ c #000000", +"@ c #FFF993", +" ....... ", +"..+++++.. ", +".++...++. ", +".+.....+. ", +".+.....+........", +"....++++++++++..", +" .++@@@@@@@@++.", +" .+@@@@@@@@@@+.", +" .+@@@@@@@@@@+.", +" .+@@@++++@@@+.", +" .+@@@@++@@@@+.", +" .+@@@@@@@@@@+.", +" .+@@@@++@@@@+.", +" .+@@@@@@@@@@+.", +" .++++++++++++.", +" .............."}; diff --git a/site/cedet-1.0pre7/common/inversion.el b/site/cedet-1.0pre7/common/inversion.el new file mode 100644 index 0000000..6d67748 --- /dev/null +++ b/site/cedet-1.0pre7/common/inversion.el @@ -0,0 +1,604 @@ +;;; inversion.el --- When you need something in version XX.XX + +;;; Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: inversion.el,v 1.37 2009/10/13 03:22:14 zappo Exp $ + +;; InVersion is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Keeping track of rapidly developing software is a tough thing to +;; do, especially if you want to have co-dependent packages which all +;; move at different rates. +;; +;; This library provides a framework for specifying version numbers +;; and (as side effect) have a flexible way of getting a desired feature set. +;; +;; If you would like to use this package to satisfy dependency replace this: +;; +;; (require 'spiffy) +;; +;; with this: +;; +;; (require 'inversion) +;; (inversion-require 'spiffy "1.0") +;; +;; If you feel the need to not throw errors, you can do this instead: +;; +;; (let ((err (inversion-test 'spiffy "1.0"))) +;; (if err (your-stuff-here))) +;; +;; If you new package (2.0) needs to make sure a load file from your +;; package is compatible, use this test: +;; +;; (if (not (inversion-reverse-test 'spiffy version-from-file)) +;; ;; Everything ok +;; (do stuff) +;; ;; Out of date +;; (import-old-code)) +;; +;; If you would like to make inversion optional, do this: +;; +;; (or (require 'inversion nil t) +;; (defun inversion-test (p v) +;; (string= v (symbol-value +;; (intern-soft (concat (symbol-string p) "-version")))))) +;; +;; Or modify to specify `inversion-require' instead. +;; +;; TODO: +;; Offer to download newer versions of a package. + +;;; History: +;; +;; Sept 3, 2002: First general publication. + +;;; Code: + +(defvar inversion-version "1.3" + "Current version of InVersion.") +(defvar inversion-incompatible-version "0.1alpha1" + "An earlier release which is incompatible with this release.") + +(defconst inversion-decoders + '( + (alpha "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?alpha\\([0-9]+\\)?$" 3) + (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?beta\\([0-9]+\\)?$" 3) + (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*(beta\\([0-9]+\\)?)" 3) + (prerelease "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?pre\\([0-9]+\\)?$" 3) + (full "^\\([0-9]+\\)\\.\\([0-9]+\\)$" 2) + (fullsingle "^\\([0-9]+\\)$" 1) + (patch "^\\([0-9]+\\)\\.\\([0-9]+\\) (patch \\([0-9]+\\))" 3) + (point "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" 3) + (build "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\).\\([0-9]+\\)$" 4) + ) + "List of decoders for version strings. +Each decoder is of the form: + + ( RELEASE-TYPE REGEXP MAX ) + +RELEASE-TYPE is a symbol specifying something like `beta' or `alpha'. +REGEXP is the regular expression to match a version string. +MAX is the maximum number of match-numbers in the release number. +Decoders must be ordered to decode least stable versions before the +more stable ones.") + +;;; Version Checking +;; +(defun inversion-decode-version (version-string) + "Decode VERSION-STRING into an encoded list. +Return value is of the form: + (RELEASE MAJOR MINOR ...) +where RELEASE is a symbol such as `full', or `beta'." + (let ((decoders inversion-decoders) + (result nil)) + (while (and decoders (not result)) + (if (string-match (nth 1 (car decoders)) version-string) + (let ((ver nil) + (num-left (nth 2 (car decoders))) + (count 1)) + (while (<= count num-left) + (setq ver (cons + (if (match-beginning count) + (string-to-number + (substring version-string + (match-beginning count) + (match-end count))) + 1) + ver) + count (1+ count))) + (setq result (cons (caar decoders) (nreverse ver)))) + (setq decoders (cdr decoders)))) + result)) + +(defun inversion-package-version (package) + "Return the decoded version for PACKAGE." + (let ((ver (symbol-value + (intern-soft + (concat (symbol-name package) + "-version")))) + (code nil)) + (unless ver + (error "Package %S does not define %S-version" package package)) + ;; Decode the code + (setq code (inversion-decode-version ver)) + (unless code + (error "%S-version value cannot be decoded" package)) + code)) + +(defun inversion-package-incompatibility-version (package) + "Return the decoded incompatibility version for PACKAGE. +The incompatibility version is specified by the programmer of +a package when a package is not backward compatible. It is +not an indication of new features or bug fixes." + (let ((ver (symbol-value + (intern-soft + (concat (symbol-name package) + "-incompatible-version"))))) + (if (not ver) + nil + ;; Decode the code + (inversion-decode-version ver)))) + +(defun inversion-recode (code) + "Convert CODE into a string." + (let ((r (nth 0 code)) ; release-type + (n (nth 1 code)) ; main number + (i (nth 2 code)) ; first increment + (p (nth 3 code))) ; second increment + (cond + ((eq r 'full) + (setq r "" p "")) + ((eq r 'point) + (setq r "."))) + (format "%s.%s%s%s" n i r p))) + +(defun inversion-release-to-number (release-symbol) + "Convert RELEASE-SYMBOL into a number." + (let* ((ra (assoc release-symbol inversion-decoders)) + (rn (- (length inversion-decoders) + (length (member ra inversion-decoders))))) + rn)) + +(defun inversion-= (ver1 ver2) + "Return non-nil if VER1 is equal to VER2." + (equal ver1 ver2)) + +(defun inversion-< (ver1 ver2) + "Return non-nil if VER1 is less than VER2." + (let ((v1-0 (inversion-release-to-number (nth 0 ver1))) + (v1-1 (nth 1 ver1)) + (v1-2 (nth 2 ver1)) + (v1-3 (nth 3 ver1)) + (v1-4 (nth 4 ver1)) + ;; v2 + (v2-0 (inversion-release-to-number (nth 0 ver2))) + (v2-1 (nth 1 ver2)) + (v2-2 (nth 2 ver2)) + (v2-3 (nth 3 ver2)) + (v2-4 (nth 4 ver2)) + ) + (or (and (= v1-0 v2-0) + (= v1-1 v2-1) + (= v1-2 v2-2) + (= v1-3 v2-3) + v1-4 v2-4 ; all or nothin if elt - is = + (< v1-4 v2-4)) + (and (= v1-0 v2-0) + (= v1-1 v2-1) + (= v1-2 v2-2) + v1-3 v2-3 ; all or nothin if elt - is = + (< v1-3 v2-3)) + (and (= v1-1 v2-1) + (< v1-2 v2-2)) + (and (< v1-1 v2-1)) + (and (< v1-0 v2-0) + (= v1-1 v2-1) + (= v1-2 v2-2) + ) + ))) + +(defun inversion-check-version (version incompatible-version + minimum &rest reserved) + "Check that a given version meets the minimum requirement. +VERSION, INCOMPATIBLE-VERSION and MINIMUM are of similar format to +return entries of `inversion-decode-version', or a classic version +string. INCOMPATIBLE-VERSION can be nil. +RESERVED arguments are kept for a later use. +Return: +- nil if everything is ok +- 'outdated if VERSION is less than MINIMUM. +- 'incompatible if VERSION is not backward compatible with MINIMUM. +- t if the check failed." + (let ((code (if (stringp version) + (inversion-decode-version version) + version)) + (req (if (stringp minimum) + (inversion-decode-version minimum) + minimum)) + ) + ;; Perform a test. + (cond + ((inversion-= code req) + ;; Same version.. Yay! + nil) + ((inversion-< code req) + ;; Version is too old! + 'outdated) + ((inversion-< req code) + ;; Newer is installed. What to do? + (let ((incompatible + (if (stringp incompatible-version) + (inversion-decode-version incompatible-version) + incompatible-version))) + (cond + ((not incompatible) nil) + ((or (inversion-= req incompatible) + (inversion-< req incompatible)) + ;; The requested version is = or < than what the package + ;; maintainer says is incompatible. + 'incompatible) + ;; Things are ok. + (t nil)))) + ;; Check failed + (t t)))) + +(defun inversion-test (package minimum &rest reserved) + "Test that PACKAGE meets the MINIMUM version requirement. +PACKAGE is a symbol, similar to what is passed to `require'. +MINIMUM is of similar format to return entries of +`inversion-decode-version', or a classic version string. +RESERVED arguments are kept for a later user. +This depends on the symbols `PACKAGE-version' and optionally +`PACKAGE-incompatible-version' being defined in PACKAGE. +Return nil if everything is ok. Return an error string otherwise." + (let ((check (inversion-check-version + (inversion-package-version package) + (inversion-package-incompatibility-version package) + minimum reserved))) + (cond + ((null check) + ;; Same version.. Yay! + nil) + ((eq check 'outdated) + ;; Version is too old! + (format "You need to upgrade package %s to %s" package minimum)) + ((eq check 'incompatible) + ;; Newer is installed but the requested version is = or < than + ;; what the package maintainer says is incompatible, then throw + ;; that error. + (format "Package %s version is not backward compatible with %s" + package minimum)) + ;; Check failed + (t "Inversion version check failed.")))) + +(defun inversion-reverse-test (package oldversion &rest reserved) + "Test that PACKAGE at OLDVERSION is still compatible. +If something like a save file is loaded at OLDVERSION, this +test will identify if OLDVERSION is compatible with the current version +of PACKAGE. +PACKAGE is a symbol, similar to what is passed to `require'. +OLDVERSION is of similar format to return entries of +`inversion-decode-version', or a classic version string. +RESERVED arguments are kept for a later user. +This depends on the symbols `PACKAGE-version' and optionally +`PACKAGE-incompatible-version' being defined in PACKAGE. +Return nil if everything is ok. Return an error string otherwise." + (let ((check (inversion-check-version + (inversion-package-version package) + (inversion-package-incompatibility-version package) + oldversion reserved))) + (cond + ((null check) + ;; Same version.. Yay! + nil) + ((eq check 'outdated) + ;; Version is too old! + (format "Package %s version %s is not compatible with current version" + package oldversion)) + ((eq check 'incompatible) + ;; Newer is installed but the requested version is = or < than + ;; what the package maintainer says is incompatible, then throw + ;; that error. + (format "Package %s version is not backward compatible with %s" + package oldversion)) + ;; Check failed + (t "Inversion version check failed.")))) + +;;;###autoload +(defun inversion-require (package version &optional file directory + &rest reserved) + "Declare that you need PACKAGE with at least VERSION. +PACKAGE might be found in FILE. (See `require'.) +Throws an error if VERSION is incompatible with what is installed. +Optional argument DIRECTORY is a location where new versions of +this tool can be located. If there is a versioning problem and +DIRECTORY is provided, inversion will offer to download the file. +Optional argument RESERVED is saved for later use." + (require package file) + (let ((err (inversion-test package version))) + (when err + (if directory + (inversion-download-package-ask err package directory version) + (error err))) + ;; Return the package symbol that was required. + package)) + +;;;###autoload +(defun inversion-require-emacs (emacs-ver xemacs-ver) + "Declare that you need either EMACS-VER, or XEMACS-VER. +Only checks one based on which kind of Emacs is being run." + (let ((err (inversion-test 'emacs + (if (featurep 'xemacs) + xemacs-ver + emacs-ver)))) + (if err (error err) + ;; Something nice... + t))) + +(defconst inversion-find-data + '("(def\\(var\\|const\\)\\s-+%s-%s\\s-+\"\\([^\"]+\\)" 2) + "Regexp template and match data index of a version string.") + +;;;###autoload +(defun inversion-find-version (package) + "Search for the version and incompatible version of PACKAGE. +Does not load PACKAGE nor requires that it has been previously loaded. +Search in the directories in `load-path' for a PACKAGE.el library. +Visit the file found and search for the declarations of variables or +constants `PACKAGE-version' and `PACKAGE-incompatible-version'. The +value of these variables must be a version string. + +Return a pair (VERSION-STRING . INCOMPATIBLE-VERSION-STRING) where +INCOMPATIBLE-VERSION-STRING can be nil. +Return nil when VERSION-STRING was not found." + (let* ((file (locate-library (format "%s.el" package) t)) + (tag (car inversion-find-data)) + (idx (nth 1 inversion-find-data)) + version) + (when file + (with-temp-buffer + ;; The 3000 is a bit arbitrary, but should cut down on + ;; fileio as version info usually is at the very top + ;; of a file. AFter a long commentary could be bad. + (insert-file-contents-literally file nil 0 3000) + (goto-char (point-min)) + (when (re-search-forward (format tag package 'version) nil t) + (setq version (list (match-string idx))) + (goto-char (point-min)) + (when (re-search-forward + (format tag package 'incompatible-version) nil t) + (setcdr version (match-string idx)))))) + version)) + +;;;###autoload +(defun inversion-add-to-load-path (package minimum + &optional installdir + &rest subdirs) + "Add the PACKAGE path to `load-path' if necessary. +MINIMUM is the minimum version requirement of PACKAGE. +Optional argument INSTALLDIR is the base directory where PACKAGE is +installed. It defaults to `default-directory'/PACKAGE. +SUBDIRS are sub-directories to add to `load-path', following the main +INSTALLDIR path." + (let ((ver (inversion-find-version package))) + ;; If PACKAGE not found or a bad version already in `load-path', + ;; prepend the new PACKAGE path, so it will be loaded first. + (when (or (not ver) + (and + (inversion-check-version (car ver) (cdr ver) minimum) + (message "Outdated %s %s shadowed to meet minimum version %s" + package (car ver) minimum) + t)) + (let* ((default-directory + (or installdir + (expand-file-name (format "./%s" package)))) + subdir) + (when (file-directory-p default-directory) + ;; Add SUBDIRS + (while subdirs + (setq subdir (expand-file-name (car subdirs)) + subdirs (cdr subdirs)) + (when (file-directory-p subdir) + ;;(message "%S added to `load-path'" subdir) + (add-to-list 'load-path subdir))) + ;; Add the main path + ;;(message "%S added to `load-path'" default-directory) + (add-to-list 'load-path default-directory)) + ;; We get to this point iff we do not accept or there is no + ;; system file. Lets check the version of what we just + ;; installed... just to be safe. + (let ((newver (inversion-find-version package))) + (if (not newver) + (error "Failed to find version for newly installed %s" + package)) + (if (inversion-check-version (car newver) (cdr newver) minimum) + (error "Outdated %s %s just installed" package (car newver))) + ))))) + +;;; Inversion tests +;; +(defun inversion-unit-test () + "Test inversion to make sure it can identify different version strings." + (interactive) + (let ((c1 (inversion-package-version 'inversion)) + (c1i (inversion-package-incompatibility-version 'inversion)) + (c2 (inversion-decode-version "1.3alpha2")) + (c3 (inversion-decode-version "1.3beta4")) + (c4 (inversion-decode-version "1.3 beta5")) + (c5 (inversion-decode-version "1.3.4")) + (c6 (inversion-decode-version "2.3alpha")) + (c7 (inversion-decode-version "1.3")) + (c8 (inversion-decode-version "1.3pre1")) + (c9 (inversion-decode-version "2.4 (patch 2)")) + (c10 (inversion-decode-version "2.4 (patch 3)")) + (c11 (inversion-decode-version "2.4.2.1")) + (c12 (inversion-decode-version "2.4.2.2")) + ) + (if (not (and + (inversion-= c1 c1) + (inversion-< c1i c1) + (inversion-< c2 c3) + (inversion-< c3 c4) + (inversion-< c4 c5) + (inversion-< c5 c6) + (inversion-< c2 c4) + (inversion-< c2 c5) + (inversion-< c2 c6) + (inversion-< c3 c5) + (inversion-< c3 c6) + (inversion-< c7 c6) + (inversion-< c4 c7) + (inversion-< c2 c7) + (inversion-< c8 c6) + (inversion-< c8 c7) + (inversion-< c4 c8) + (inversion-< c2 c8) + (inversion-< c9 c10) + (inversion-< c10 c11) + (inversion-< c11 c12) + ;; Negatives + (not (inversion-< c3 c2)) + (not (inversion-< c4 c3)) + (not (inversion-< c5 c4)) + (not (inversion-< c6 c5)) + (not (inversion-< c7 c2)) + (not (inversion-< c7 c8)) + (not (inversion-< c12 c11)) + ;; Test the tester on inversion + (not (inversion-test 'inversion inversion-version)) + ;; Test that we throw an error + (inversion-test 'inversion "0.0.0") + (inversion-test 'inversion "1000.0") + )) + (error "Inversion tests failed") + (message "Inversion tests passed.")))) + +;;; URL and downloading code +;; +(defun inversion-locate-package-files (package directory &optional version) + "Get a list of distributions of PACKAGE from DIRECTORY. +DIRECTORY can be an ange-ftp compatible filename, such as: + \"/ftp@ftp1.sourceforge.net/pub/sourceforge/PACKAGE\" +If it is a URL, wget will be used for download. +Optional argument VERSION will restrict the list of available versions +to the file matching VERSION exactly, or nil." +;;DIRECTORY should also allow a URL: +;; \"http://ftp1.sourceforge.net/PACKAGE\" +;; but then I can get file listings easily. + (if (symbolp package) (setq package (symbol-name package))) + (directory-files directory t + (if version + (concat "^" package "-" version "\\>") + package))) + +(defvar inversion-package-common-tails '( ".tar.gz" + ".tar" + ".zip" + ".gz" + ) + "Common distribution mechanisms for Emacs Lisp packages.") + +(defun inversion-locate-package-files-and-split (package directory &optional version) + "Use `inversion-locate-package-files' to get a list of PACKAGE files. +DIRECTORY is the location where distributions of PACKAGE are. +VERSION is an optional argument specifying a version to restrict to. +The return list is an alist with the version string in the CAR, +and the full path name in the CDR." + (if (symbolp package) (setq package (symbol-name package))) + (let ((f (inversion-locate-package-files package directory version)) + (out nil)) + (while f + (let* ((file (car f)) + (dist (file-name-nondirectory file)) + (tails inversion-package-common-tails) + (verstring nil)) + (while (and tails (not verstring)) + (when (string-match (concat (car tails) "$") dist) + (setq verstring + (substring dist (1+ (length package)) (match-beginning 0)))) + (setq tails (cdr tails))) + (if (not verstring) + (error "Cannot decode version for %s" dist)) + (setq out + (cons + (cons verstring file) + out)) + (setq f (cdr f)))) + out)) + +(defun inversion-download-package-ask (err package directory version) + "Due to ERR, offer to download PACKAGE from DIRECTORY. +The package should have VERSION available for download." + (if (symbolp package) (setq package (symbol-name package))) + (let ((files (inversion-locate-package-files-and-split + package directory version))) + (if (not files) + (error err) + (if (not (y-or-n-p (concat err ": Download update? "))) + (error err) + (let ((dest (read-directory-name (format "Download %s to: " + package) + t))) + (if (> (length files) 1) + (setq files + (list + "foo" ;; ignored + (read-file-name "Version to download: " + directory + files + t + (concat + (file-name-as-directory directory) + package) + nil)))) + + (copy-file (cdr (car files)) dest)))))) + +;;;###autoload +(defun inversion-upgrade-package (package &optional directory) + "Try to upgrade PACKAGE in DIRECTORY is available." + (interactive "sPackage to upgrade: ") + (if (stringp package) (setq package (intern package))) + (if (not directory) + ;; Hope that the package maintainer specified. + (setq directory (symbol-value (or (intern-soft + (concat (symbol-name package) + "-url")) + (intern-soft + (concat (symbol-name package) + "-directory")))))) + (let ((files (inversion-locate-package-files-and-split + package directory)) + (cver (inversion-package-version package)) + (newer nil)) + (mapc (lambda (f) + (if (inversion-< cver (inversion-decode-version (car f))) + (setq newer (cons f newer)))) + files) + newer + )) + +;; (inversion-upgrade-package +;; 'semantic +;; "/ftp@ftp1.sourceforge.net:/pub/sourceforge/cedet") + +;; "/ftp@ftp1.sourceforge.net:/pub/sourceforge/cedet" +(provide 'inversion) + +;;; inversion.el ends here diff --git a/site/cedet-1.0pre7/common/mode-local.el b/site/cedet-1.0pre7/common/mode-local.el new file mode 100644 index 0000000..e613c90 --- /dev/null +++ b/site/cedet-1.0pre7/common/mode-local.el @@ -0,0 +1,895 @@ +;;; mode-local.el --- Support for mode local facilities +;; +;; Copyright (C) 2007, 2008, 2009 Eric M. Ludlam +;; Copyright (C) 2004, 2005 David Ponce +;; +;; Author: David Ponce +;; Maintainer: David Ponce +;; Created: 27 Apr 2004 +;; Keywords: syntax +;; X-RCS: $Id: mode-local.el,v 1.24 2009/09/11 23:44:53 zappo Exp $ +;; +;; This file is not part of GNU Emacs. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. +;; +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Each major mode will want to support a specific set of behaviors. +;; Usually generic behaviors that need just a little bit of local +;; specifics. +;; +;; This library permits the setting of override functions for tasks of +;; that nature, and also provides reasonable defaults. +;; +;; There are buffer local variables, and frame local variables. +;; This library give the illusion of mode specific variables. +;; +;; You should use a mode-local variable or override to allow extension +;; only if you expect a mode author to provide that extension. If a +;; user might wish to customize a give variable or function then +;; the existing customization mechanism should be used. + +;; To Do: +;; Allow customization of a variable for a specific mode? +;; +;; Add mecro for defining the '-default' functionality. + +;;; History: +;; + +;;; Code: +(eval-when-compile (require 'cl)) + +;;; Compatibility +;; +(defun mode-local-define-derived-mode-needed-p () + "Return non-nil if mode local has to fix `define-derived-mode'. +That is, if `define-derived-mode' does not set `derived-mode-parent'." + (let ((body (cdr (macroexpand '(define-derived-mode c p "")))) + (bad t)) + (while (and body bad) + (if (equal (car body) '(put 'c 'derived-mode-parent 'p)) + (setq bad nil) + (setq body (cdr body)))) + bad)) + +(when (mode-local-define-derived-mode-needed-p) + ;; Workaround a bug in some (XEmacs) versions of + ;; `define-derived-mode' that don't set the `derived-mode-parent' + ;; property, and break mode-local. + (defadvice define-derived-mode + (after mode-local-define-derived-mode activate) + "Fix missing `derived-mode-parent' property on child." + (unless (eq 'fundamental-mode (ad-get-arg 1)) + (let ((form (cdr ad-return-value))) + (setq ad-return-value nil) + (while form + (and (eq 'defun (car-safe (car form))) + (eq (ad-get-arg 0) (car (cdr-safe (car form)))) + (push `(or (get ',(ad-get-arg 0) 'derived-mode-parent) + (put ',(ad-get-arg 0) 'derived-mode-parent + ',(ad-get-arg 1))) + ad-return-value)) + (push (car form) ad-return-value) + (setq form (cdr form))) + (setq ad-return-value `(progn ,@(nreverse ad-return-value))) + ))) + ) + +;;; Misc utilities +;; +(defun mode-local-map-file-buffers (function &optional predicate buffers) + "Run FUNCTION on every file buffer found. +FUNCTION does not have arguments; when it is entered `current-buffer' +is the currently selected file buffer. +If optional argument PREDICATE is non nil, only select file buffers +for which the function PREDICATE return non-nil. +If optional argument BUFFERS is non-nil, it is a list of buffers to +walk through. It defaults to `buffer-list'." + (dolist (b (or buffers (buffer-list))) + (and (buffer-live-p b) (buffer-file-name b) + (with-current-buffer b + (when (or (not predicate) (funcall predicate)) + (funcall function)))))) + +(defsubst get-mode-local-parent (mode) + "Return the mode parent of the major mode MODE. +Return nil if MODE has no parent." + (or (get mode 'mode-local-parent) + (get mode 'derived-mode-parent))) + +(defun mode-local-equivalent-mode-p (mode) + "Is the major-mode in the current buffer equivalent to a mode in MODES." + (let ((modes nil)) + (while mode + (setq modes (cons mode modes) + mode (get-mode-local-parent mode))) + modes)) + +(defun mode-local-map-mode-buffers (function modes) + "Run FUNCTION on every file buffer with major mode in MODES. +MODES can be a symbol or a list of symbols. +FUNCTION does not have arguments." + (or (listp modes) (setq modes (list modes))) + (mode-local-map-file-buffers + function #'(lambda () + (let ((mm (mode-local-equivalent-mode-p major-mode)) + (ans nil)) + (while (and (not ans) mm) + (setq ans (memq (car mm) modes) + mm (cdr mm)) ) + ans)))) + +;;; Hook machinery +;; +(defvar mode-local-init-hook nil + "Hook run after a new file buffer is created. +The current buffer is the newly created file buffer.") + +(defvar mode-local-changed-mode-buffers nil + "List of buffers whose `major-mode' has changed recently.") + +(defvar mode-local--init-mode nil) + +(defsubst mode-local-initialized-p () + "Return non-nil if mode local is initialized in current buffer. +That is, if the current `major-mode' is equal to the major mode for +which mode local bindings have been activated." + (eq mode-local--init-mode major-mode)) + +(defun mode-local-post-major-mode-change () + "`post-command-hook' run when there is a `major-mode' change. +This makes sure mode local init type stuff can occur." + (remove-hook 'post-command-hook 'mode-local-post-major-mode-change nil) + (let ((buffers mode-local-changed-mode-buffers)) + (setq mode-local-changed-mode-buffers nil) + (mode-local-map-file-buffers + #'(lambda () + ;; Make sure variables are set up for this mode. + (activate-mode-local-bindings) + (run-hooks 'mode-local-init-hook)) + #'(lambda () + (not (mode-local-initialized-p))) + buffers))) + +(defun mode-local-on-major-mode-change () + "Function called in `change-major-mode-hook'." + (add-to-list 'mode-local-changed-mode-buffers (current-buffer)) + (add-hook 'post-command-hook 'mode-local-post-major-mode-change t nil)) + +(add-hook 'find-file-hooks 'mode-local-post-major-mode-change) +(add-hook 'change-major-mode-hook 'mode-local-on-major-mode-change) + +;;; Mode lineage +;; +(defsubst set-mode-local-parent (mode parent) + "Set parent of major mode MODE to PARENT mode. +To work properly, this function should be called after PARENT mode +local variables have been defined." + (put mode 'mode-local-parent parent) + ;; Refresh mode bindings to get mode local variables inherited from + ;; PARENT. To work properly, the following should be called after + ;; PARENT mode local variables have been defined. + (mode-local-map-mode-buffers #'activate-mode-local-bindings mode)) + +(defmacro define-child-mode (mode parent &optional docstring) + "Make major mode MODE inherits behavior from PARENT mode. +DOCSTRING is optional and not used. +To work properly, this should be put after PARENT mode local variables +definition." + `(set-mode-local-parent ',mode ',parent)) + +(defun mode-local-use-bindings-p (this-mode desired-mode) + "Return non-nil if THIS-MODE can use bindings of DESIRED-MODE." + (let ((ans nil)) + (while (and (not ans) this-mode) + (setq ans (eq this-mode desired-mode)) + (setq this-mode (get-mode-local-parent this-mode))) + ans)) + + +;;; Core bindings API +;; +(defvar mode-local-symbol-table nil + "Buffer local mode bindings. +These symbols provide a hook for a `major-mode' to specify specific +behaviors. Use the function `mode-local-bind' to define new bindings.") +(make-variable-buffer-local 'mode-local-symbol-table) + +(defvar mode-local-active-mode nil + "Major mode in which bindings are active.") + +(defsubst new-mode-local-bindings () + "Return a new empty mode bindings symbol table." + (make-vector 13 0)) + +(defun mode-local-bind (bindings &optional plist mode) + "Define BINDINGS in the specified environment. +BINDINGS is a list of (VARIABLE . VALUE). +Optional argument PLIST is a property list each VARIABLE symbol will +be set to. The following properties have special meaning: + +- `constant-flag' if non-nil, prevent to rebind variables. +- `mode-variable-flag' if non-nil, define mode variables. +- `override-flag' if non-nil, define override functions. + +The `override-flag' and `mode-variable-flag' properties are mutually +exclusive. + +If optional argument MODE is non-nil, it must be a major mode symbol. +BINDINGS will be defined globally for this major mode. If MODE is +nil, BINDINGS will be defined locally in the current buffer, in +variable `mode-local-symbol-table'. The later should be done in MODE +hook." + ;; Check plist consistency + (and (plist-get plist 'mode-variable-flag) + (plist-get plist 'override-flag) + (error "Bindings can't be both overrides and mode variables")) + (let (table variable varname value binding) + (if mode + (progn + ;; Install in given MODE symbol table. Create a new one if + ;; needed. + (setq table (or (get mode 'mode-local-symbol-table) + (new-mode-local-bindings))) + (put mode 'mode-local-symbol-table table)) + ;; Fail if trying to bind mode variables in local context! + (if (plist-get plist 'mode-variable-flag) + (error "Mode required to bind mode variables")) + ;; Install in buffer local symbol table. Create a new one if + ;; needed. + (setq table (or mode-local-symbol-table + (setq mode-local-symbol-table + (new-mode-local-bindings))))) + (while bindings + (setq binding (car bindings) + bindings (cdr bindings) + varname (symbol-name (car binding)) + value (cdr binding)) + (if (setq variable (intern-soft varname table)) + ;; Binding already exists + ;; Check rebind consistency + (cond + ((equal (symbol-value variable) value) + ;; Just ignore rebind with the same value. + ) + ((get variable 'constant-flag) + (error "Can't change the value of constant `%s'" + variable)) + ((and (get variable 'mode-variable-flag) + (plist-get plist 'override-flag)) + (error "Can't rebind override `%s' as a mode variable" + variable)) + ((and (get variable 'override-flag) + (plist-get plist 'mode-variable-flag)) + (error "Can't rebind mode variable `%s' as an override" + variable)) + (t + ;; Merge plist and assign new value + (setplist variable (append plist (symbol-plist variable))) + (set variable value))) + ;; New binding + (setq variable (intern varname table)) + ;; Set new plist and assign initial value + (setplist variable plist) + (set variable value))) + ;; Return the symbol table used + table)) + +(defsubst mode-local-symbol (symbol &optional mode) + "Return the mode local symbol bound with SYMBOL's name. +Return nil if the mode local symbol doesn't exist. +If optional argument MODE is nil, lookup first into locally bound +symbols, then in those bound in current `major-mode' and its parents. +If MODE is non-nil, lookup into symbols bound in that major mode and +its parents." + (let ((name (symbol-name symbol)) bind) + (or mode + (setq mode mode-local-active-mode) + (setq mode major-mode + bind (and mode-local-symbol-table + (intern-soft name mode-local-symbol-table)))) + (while (and mode (not bind)) + (or (and (get mode 'mode-local-symbol-table) + (setq bind (intern-soft + name (get mode 'mode-local-symbol-table)))) + (setq mode (get-mode-local-parent mode)))) + bind)) + +(defsubst mode-local-symbol-value (symbol &optional mode property) + "Return the value of the mode local symbol bound with SYMBOL's name. +If optional argument MODE is non-nil, restrict lookup to that mode and +its parents (see the function `mode-local-symbol' for more details). +If optional argument PROPERTY is non-nil the mode local symbol must +have that property set. Return nil if the symbol doesn't exist, or +doesn't have PROPERTY set." + (and (setq symbol (mode-local-symbol symbol mode)) + (or (not property) (get symbol property)) + (symbol-value symbol))) + +;;; Mode local variables +;; +(defun activate-mode-local-bindings (&optional mode) + "Activate variables defined locally in MODE and its parents. +That is, copy mode local bindings into corresponding buffer local +variables. +If MODE is not specified it defaults to current `major-mode'. +Return the alist of buffer-local variables that have been changed. +Elements are (SYMBOL . PREVIOUS-VALUE), describing one variable." + ;; Hack - + ;; do not do this if we are inside set-auto-mode as we may be in + ;; an initialization race condition. + (if (or (and (featurep 'emacs) (boundp 'keep-mode-if-same)) + (and (featurep 'xemacs) (boundp 'just-from-file-name))) + ;; We are inside set-auto-mode, as this is an argument that is + ;; vaguely unique. + + ;; This will make sure that when everything is over, this will get + ;; called and we won't be under set-auto-mode anymore. + (mode-local-on-major-mode-change) + + ;; Do the normal thing. + (let (modes table old-locals) + (unless mode + (set (make-local-variable 'mode-local--init-mode) major-mode) + (setq mode major-mode)) + ;; Get MODE's parents & MODE in the right order. + (while mode + (setq modes (cons mode modes) + mode (get-mode-local-parent mode))) + ;; Activate mode bindings following parent modes order. + (dolist (mode modes) + (when (setq table (get mode 'mode-local-symbol-table)) + (mapatoms + #'(lambda (var) + (when (get var 'mode-variable-flag) + (let ((v (intern (symbol-name var)))) + ;; Save the current buffer-local value of the + ;; mode-local variable. + (and (local-variable-p v (current-buffer)) + (push (cons v (symbol-value v)) old-locals)) + (set (make-local-variable v) (symbol-value var))))) + table))) + old-locals))) + +(defun deactivate-mode-local-bindings (&optional mode) + "Deactivate variables defined locally in MODE and its parents. +That is, kill buffer local variables set from the corresponding mode +local bindings. +If MODE is not specified it defaults to current `major-mode'." + (unless mode + (kill-local-variable 'mode-local--init-mode) + (setq mode major-mode)) + (let (table) + (while mode + (when (setq table (get mode 'mode-local-symbol-table)) + (mapatoms + #'(lambda (var) + (when (get var 'mode-variable-flag) + (kill-local-variable (intern (symbol-name var))))) + table)) + (setq mode (get-mode-local-parent mode))))) + +(defmacro with-mode-local-symbol (mode &rest body) + "With the local bindings of MODE symbol, evaluate BODY. +The current mode bindings are saved, BODY is evaluated, and the saved +bindings are restored, even in case of an abnormal exit. +Value is what BODY returns. +This is like `with-mode-local', except that MODE's value is used. +To use the symbol MODE (quoted), use `with-mode-local'." + (let ((old-mode (make-symbol "mode")) + (old-locals (make-symbol "old-locals")) + (new-mode (make-symbol "new-mode")) + (local (make-symbol "local"))) + `(let ((,old-mode mode-local-active-mode) + (,old-locals nil) + (,new-mode ,mode) + ) + (unwind-protect + (progn + (deactivate-mode-local-bindings ,old-mode) + (setq mode-local-active-mode ,new-mode) + ;; Save the previous value of buffer-local variables + ;; changed by `activate-mode-local-bindings'. + (setq ,old-locals (activate-mode-local-bindings ,new-mode)) + ,@body) + (deactivate-mode-local-bindings ,new-mode) + ;; Restore the previous value of buffer-local variables. + (dolist (,local ,old-locals) + (set (car ,local) (cdr ,local))) + ;; Restore the mode local variables. + (setq mode-local-active-mode ,old-mode) + (activate-mode-local-bindings ,old-mode))))) +(put 'with-mode-local-symbol 'lisp-indent-function 1) + +(defmacro with-mode-local (mode &rest body) + "With the local bindings of MODE, evaluate BODY. +The current mode bindings are saved, BODY is evaluated, and the saved +bindings are restored, even in case of an abnormal exit. +Value is what BODY returns. +This lis like `with-mode-local-symbol', except that MODE is quoted +and is note evaluated." + `(with-mode-local-symbol ',mode ,@body)) +(put 'with-mode-local 'lisp-indent-function 1) + + +(defsubst mode-local-value (mode sym) + "Return the value of the MODE local variable SYM." + (or mode (error "Missing major mode symbol")) + (mode-local-symbol-value sym mode 'mode-variable-flag)) + +(defmacro setq-mode-local (mode &rest args) + "Assign new values to variables local in MODE. +MODE must be a major mode symbol. +ARGS is a list (SYM VAL SYM VAL ...). +The symbols SYM are variables; they are literal (not evaluated). +The values VAL are expressions; they are evaluated. +Set each SYM to the value of its VAL, locally in buffers already in +MODE, or in buffers switched to that mode. +Return the value of the last VAL." + (when args + (let (i ll bl sl tmp sym val) + (setq i 0) + (while args + (setq tmp (make-symbol (format "tmp%d" i)) + i (1+ i) + sym (car args) + val (cadr args) + ll (cons (list tmp val) ll) + bl (cons `(cons ',sym ,tmp) bl) + sl (cons `(set (make-local-variable ',sym) ,tmp) sl) + args (cddr args))) + `(let* ,(nreverse ll) + ;; Save mode bindings + (mode-local-bind (list ,@bl) '(mode-variable-flag t) ',mode) + ;; Assign to local variables in all existing buffers in MODE + (mode-local-map-mode-buffers #'(lambda () ,@sl) ',mode) + ;; Return the last value + ,tmp) + ))) + +(defmacro defvar-mode-local (mode sym val &optional docstring) + "Define MODE local variable SYM with value VAL. +DOCSTRING is optional." + `(progn + (setq-mode-local ,mode ,sym ,val) + (put (mode-local-symbol ',sym ',mode) + 'variable-documentation ,docstring) + ',sym)) +(put 'defvar-mode-local 'lisp-indent-function 'defun) + +(defmacro defconst-mode-local (mode sym val &optional docstring) + "Define MODE local constant SYM with value VAL. +DOCSTRING is optional." + (let ((tmp (make-symbol "tmp"))) + `(let (,tmp) + (setq-mode-local ,mode ,sym ,val) + (setq ,tmp (mode-local-symbol ',sym ',mode)) + (put ,tmp 'constant-flag t) + (put ,tmp 'variable-documentation ,docstring) + ',sym))) +(put 'defconst-mode-local 'lisp-indent-function 'defun) + +;;; Function overloading +;; +(defun make-obsolete-overload (old new) + "Mark OLD overload as obsoleted by NEW overload." + (put old 'overload-obsoleted-by new) + (put old 'mode-local-overload t) + (put new 'overload-obsolete old)) + +(defsubst overload-obsoleted-by (overload) + "Get the overload symbol obsoleted by OVERLOAD. +Return the obsolete symbol or nil if not found." + (get overload 'overload-obsolete)) + +(defsubst overload-that-obsolete (overload) + "Return the overload symbol that obsoletes OVERLOAD. +Return the symbol found or nil if OVERLOAD is not obsolete." + (get overload 'overload-obsoleted-by)) + +(defsubst fetch-overload (overload) + "Return the current OVERLOAD function, or nil if not found. +First, lookup for OVERLOAD into locally bound mode local symbols, then +in those bound in current `major-mode' and its parents." + (or (mode-local-symbol-value overload nil 'override-flag) + ;; If an obsolete overload symbol exists, try it. + (and (overload-obsoleted-by overload) + (mode-local-symbol-value + (overload-obsoleted-by overload) nil 'override-flag)))) + +(defun mode-local--override (name args body) + "Return the form that handles overloading of function NAME. +ARGS are the arguments to the function. +BODY is code that would be run when there is no override defined. The +default is to call the function `NAME-default' with the appropriate +arguments. +See also the function `define-overload'." + (let* ((default (intern (format "%s-default" name))) + (overargs (delq '&rest (delq '&optional (copy-sequence args)))) + (override (make-symbol "override"))) + `(let ((,override (fetch-overload ',name))) + (if ,override + (funcall ,override ,@overargs) + ,@(or body `((,default ,@overargs))))) + )) + +(defun mode-local--expand-overrides (name args body) + "Expand override forms that overload function NAME. +ARGS are the arguments to the function NAME. +BODY is code where override forms are searched for expansion. +Return result of expansion, or BODY if no expansion occurred. +See also the function `define-overload'." + (let ((forms body) + (ditto t) + form xbody) + (while forms + (setq form (car forms)) + (cond + ((atom form)) + ((eq (car form) :override) + (setq form (mode-local--override name args (cdr form)))) + ((eq (car form) :override-with-args) + (setq form (mode-local--override name (cadr form) (cddr form)))) + ((setq form (mode-local--expand-overrides name args form)))) + (setq ditto (and ditto (eq (car forms) form)) + xbody (cons form xbody) + forms (cdr forms))) + (if ditto body (nreverse xbody)))) + +(defun mode-local--overload-body (name args body) + "Return the code that implements overloading of function NAME. +ARGS are the arguments to the function NAME. +BODY specifies the overload code. +See also the function `define-overload'." + (let ((result (mode-local--expand-overrides name args body))) + (if (eq body result) + (list (mode-local--override name args body)) + result))) + +(defmacro define-overloadable-function (name args docstring &rest body) + "Define a new function, as with `defun' which can be overloaded. +NAME is the name of the function to create. +ARGS are the arguments to the function. +DOCSTRING is a documentation string to describe the function. The +docstring will automatically had details about its overload symbol +appended to the end. +BODY is code that would be run when there is no override defined. The +default is to call the function `NAME-default' with the appropriate +arguments. + +BODY can also include an override form that specifies which part of +BODY is specifically overridden. This permits to specify common code +run for both default and overridden implementations. +An override form is one of: + + 1. (:override [OVERBODY]) + 2. (:override-with-args OVERARGS [OVERBODY]) + +OVERBODY is the code that would be run when there is no override +defined. The default is to call the function `NAME-default' with the +appropriate arguments deduced from ARGS. +OVERARGS is a list of arguments passed to the override and +`NAME-default' function, in place of those deduced from ARGS." + `(eval-and-compile + (defun ,name ,args + ,docstring + ,@(mode-local--overload-body name args body)) + (put ',name 'mode-local-overload t))) +(put :override-with-args 'lisp-indent-function 1) + +(defalias 'define-overload 'define-overloadable-function) + +(defsubst function-overload-p (symbol) + "Return non-nil if SYMBOL is a function which can be overloaded." + (and symbol (symbolp symbol) (get symbol 'mode-local-overload))) + +(defmacro define-mode-local-override + (name mode args docstring &rest body) + "Define a mode specific override of the function overload NAME. +Has meaning only if NAME has been created with `define-overload'. +MODE is the major mode this override is being defined for. +ARGS are the function arguments, which should match those of the same +named function created with `define-overload'. +DOCSTRING is the documentation string. +BODY is the implementation of this function." + (let ((newname (intern (format "%s-%s" name mode)))) + `(progn + (eval-and-compile + (defun ,newname ,args + ,(format "%s\n\nOverride %s in `%s' buffers." + docstring name mode) + ;; The body for this implementation + ,@body) + ;; For find-func to locate the definition of NEWNAME. + (put ',newname 'definition-name ',name)) + (mode-local-bind '((,name . ,newname)) + '(override-flag t) + ',mode)) + )) + +;;; Read/Query Support +;; +;;;###autoload +(defun mode-local-read-function (prompt &optional initial hist default) + "Interactively read in the name of a mode-local function. +PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'." + (completing-read prompt obarray 'function-overload-p t initial hist default)) + +;;; Help support +;; +(defun overload-docstring-extension (overload) + "Return the doc string that augments the description of OVERLOAD." + (let ((doc "\n\This function can be overloaded\ + (see `define-mode-local-override' for details).") + (sym (overload-obsoleted-by overload))) + (when sym + (setq doc (format "%s\nIt makes the overload `%s' obsolete." + doc sym))) + (setq sym (overload-that-obsolete overload)) + (when sym + (setq doc (format "%s\nThis overload is obsoletes;\nUse `%s' instead." + doc sym))) + doc)) + +(defun mode-local-augment-function-help (symbol) + "Augment the *Help* buffer for SYMBOL. +SYMBOL is a function that can be overridden." + (with-current-buffer "*Help*" + (pop-to-buffer (current-buffer)) + (unwind-protect + (progn + (toggle-read-only -1) + (goto-char (point-min)) + (unless (re-search-forward "^$" nil t) + (goto-char (point-max)) + (beginning-of-line) + (forward-line -1)) + (insert (overload-docstring-extension symbol) "\n") + ;; NOTE TO SELF: + ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE + ) + (toggle-read-only 1)))) + +;; Help for Overload functions. Need to advise help. +(defadvice describe-function (around mode-local-help activate) + "Display the full documentation of FUNCTION (a symbol). +Returns the documentation as a string, also." + (prog1 + ad-do-it + (if (function-overload-p (ad-get-arg 0)) + (mode-local-augment-function-help (ad-get-arg 0))))) + +;; Help for mode-local bindings. +(defun mode-local-print-binding (symbol) + "Print the SYMBOL binding." + (let ((value (symbol-value symbol))) + (princ (format "\n `%s' value is\n " symbol)) + (if (and value (symbolp value)) + (princ (format "`%s'" value)) + (let ((pt (point))) + (pp value) + (save-excursion + (goto-char pt) + (indent-sexp)))) + (or (bolp) (princ "\n")))) + +(defun mode-local-print-bindings (table) + "Print bindings in TABLE." + (let (us ;; List of unpecified symbols + mc ;; List of mode local constants + mv ;; List of mode local variables + ov ;; List of overloaded functions + fo ;; List of final overloaded functions + ) + ;; Order symbols by type + (mapatoms + #'(lambda (s) + (add-to-list (cond + ((get s 'mode-variable-flag) + (if (get s 'constant-flag) 'mc 'mv)) + ((get s 'override-flag) + (if (get s 'constant-flag) 'fo 'ov)) + ('us)) + s)) + table) + ;; Print symbols by type + (when us + (princ "\n !! Unpecified symbols\n") + (mapc 'mode-local-print-binding us)) + (when mc + (princ "\n ** Mode local constants\n") + (mapc 'mode-local-print-binding mc)) + (when mv + (princ "\n ** Mode local variables\n") + (mapc 'mode-local-print-binding mv)) + (when fo + (princ "\n ** Final overloaded functions\n") + (mapc 'mode-local-print-binding fo)) + (when ov + (princ "\n ** Overloaded functions\n") + (mapc 'mode-local-print-binding ov)) + )) + +(defun mode-local-describe-bindings-2 (buffer-or-mode) + "Display mode local bindings active in BUFFER-OR-MODE." + (let (table mode) + (princ "Mode local bindings active in ") + (cond + ((bufferp buffer-or-mode) + (with-current-buffer buffer-or-mode + (setq table mode-local-symbol-table + mode major-mode)) + (princ (format "%S\n" buffer-or-mode)) + ) + ((symbolp buffer-or-mode) + (setq mode buffer-or-mode) + (princ (format "`%s'\n" buffer-or-mode)) + ) + ((signal 'wrong-type-argument + (list 'buffer-or-mode buffer-or-mode)))) + (when table + (princ "\n- Buffer local\n") + (mode-local-print-bindings table)) + (while mode + (setq table (get mode 'mode-local-symbol-table)) + (when table + (princ (format "\n- From `%s'\n" mode)) + (mode-local-print-bindings table)) + (setq mode (get-mode-local-parent mode))))) + +(defun mode-local-describe-bindings-1 (buffer-or-mode &optional interactive-p) + "Display mode local bindings active in BUFFER-OR-MODE. +Optional argument INTERACTIVE-P is non-nil if the calling command was +invoked interactively." + (if (fboundp 'with-displaying-help-buffer) + ;; XEmacs + (with-displaying-help-buffer + #'(lambda () + (with-current-buffer standard-output + (mode-local-describe-bindings-2 buffer-or-mode) + (when (fboundp 'frob-help-extents) + (goto-char (point-min)) + (frob-help-extents standard-output))))) + ;; GNU Emacs + (when (fboundp 'help-setup-xref) + (help-setup-xref + (list 'mode-local-describe-bindings-1 buffer-or-mode) + interactive-p)) + (with-output-to-temp-buffer (help-buffer) ; "*Help*" + (with-current-buffer standard-output + (mode-local-describe-bindings-2 buffer-or-mode))))) + +(defun describe-mode-local-bindings (buffer) + "Display mode local bindings active in BUFFER." + (interactive "b") + (when (setq buffer (get-buffer buffer)) + (mode-local-describe-bindings-1 buffer (interactive-p)))) + +(defun describe-mode-local-bindings-in-mode (mode) + "Display mode local bindings active in MODE hierarchy." + (interactive + (list (completing-read + "Mode: " obarray + #'(lambda (s) (get s 'mode-local-symbol-table)) + t (symbol-name major-mode)))) + (when (setq mode (intern-soft mode)) + (mode-local-describe-bindings-1 mode (interactive-p)))) + +;;; Font-lock support +;; +(defconst mode-local-font-lock-keywords + (eval-when-compile + (let* ( + ;; Variable declarations + (kv (regexp-opt + '( + "defconst-mode-local" + "defvar-mode-local" + ) t)) + ;; Function declarations + (kf (regexp-opt + '( + "define-mode-local-override" + "define-child-mode" + "define-overload" + "define-overloadable-function" + ;;"make-obsolete-overload" + "with-mode-local" + ) t)) + ;; Regexp depths + (kv-depth (regexp-opt-depth kv)) + (kf-depth (regexp-opt-depth kf)) + ) + `((,(concat + ;; Declarative things + "(\\(" kv "\\|" kf "\\)" + ;; Whitespaces & names + "\\>[ \t]*\\(\\sw+\\)?[ \t]*\\(\\sw+\\)?" + ) + (1 font-lock-keyword-face) + (,(+ 1 kv-depth kf-depth 1) + (cond ((match-beginning 2) + font-lock-type-face) + ((match-beginning ,(+ 1 kv-depth 1)) + font-lock-function-name-face) + ) + nil t) + (,(+ 1 kv-depth kf-depth 1 1) + (cond ((match-beginning 2) + font-lock-variable-name-face) + ) + nil t))) + )) + "Highlighted keywords.") + + +;;; find-func support (Emacs 21.4, or perhaps 22.1) +;; +(condition-case nil + ;; Try to get find-func so we can modify it. + (require 'find-func) + (error nil)) + +(when (boundp 'find-function-regexp) + (unless (string-match "ine-overload" find-function-regexp) + (if (string-match "(def\\\\(" find-function-regexp) + (let ((end (match-end 0)) + ) + (setq find-function-regexp + (concat (substring find-function-regexp 0 end) + "ine-overload\\|ine-mode-local-override\\|" + "ine-child-mode\\|" + (substring find-function-regexp end))))) + ) + ;; The regexp for variables is a little more kind. + ) + +;; TODO: Add XEmacs support +(when (fboundp 'font-lock-add-keywords) + (font-lock-add-keywords 'emacs-lisp-mode + mode-local-font-lock-keywords)) + +;;; edebug support +;; +(defun mode-local-setup-edebug-specs () + "Define edebug specification for mode local macros." + (def-edebug-spec setq-mode-local + (symbolp &rest symbolp form) + ) + (def-edebug-spec defvar-mode-local + (&define symbolp name def-form [ &optional stringp ] ) + ) + (def-edebug-spec defconst-mode-local + defvar-mode-local + ) + (def-edebug-spec define-overload + (&define name lambda-list stringp def-body) + ) + (def-edebug-spec define-overloadable-function + (&define name lambda-list stringp def-body) + ) + (def-edebug-spec define-mode-local-override + (&define name symbolp lambda-list stringp def-body) + ) + ) + +(add-hook 'edebug-setup-hook 'mode-local-setup-edebug-specs) + +(provide 'mode-local) + +;;; mode-local.el ends here diff --git a/site/cedet-1.0pre7/common/pprint.el b/site/cedet-1.0pre7/common/pprint.el new file mode 100644 index 0000000..860d27f --- /dev/null +++ b/site/cedet-1.0pre7/common/pprint.el @@ -0,0 +1,468 @@ +;;; pprint.el --- A flexible Elisp pretty-printer + +;; Copyright (C) 2002, 2003, 2004 David Ponce + +;; Author: David Ponce +;; Maintainer: David Ponce +;; Created: 06 Mar 2002 +;; Keywords: lisp +;; X-RCS: $Id: pprint.el,v 1.8 2005/09/30 20:07:41 zappo Exp $ + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; pprint library provides a simple and flexible pretty-printer for +;; Elisp code. +;; +;; The core function `pprint-to-string' uses `prin1' to write into a +;; temporary buffer a "flat" representation of a given expression. +;; Then it walks over that linear form and inserts line breaks and +;; indentations to produce a pretty-printed representation of the +;; expression. +;; +;; The implementation uses a lot of inline functions to improve +;; performance. And, when byte-compiled, pprint is reasonably fast. +;; +;; pprint can handle specific expressions using adapted "printers". A +;; "printer" is a function that will be called to process a form that +;; match a regular expression. A number of "standard printers" are +;; predefined to pretty print common Elisp statements like `defun', +;; `defvar', `lambda', `let', `progn', `cond', `if', etc.. +;; +;; More "printers" should be provided in future versions ;-) +;; + +;;; History: +;; + +;;; Code: + +;;;; +;;;; Printers management +;;;; + +(defvar pprint-standard-printers nil + "The standard printers.") + +(defvar pprint-printers nil + "The current printers. +This is an alist which maps printers (functions) to +matchers (regexps).") + +(defsubst pprint-clear-printers () + "Clear the current defined printers." + (setq pprint-printers nil)) + +(defun pprint-push-printer (printer matcher) + "Push a new PRINTER on top of defined printers. +MATCHER is a regexp matching expressions passed to PRINTER." + (add-to-list 'pprint-printers (cons printer matcher))) +(put 'pprint-push-printer 'lisp-indent-function 1) + +(defmacro pprint-with-printers (table &rest body) + "Set up a copy of the TABLE of printers and evaluate BODY. +The current table of printers is saved, BODY is evaluated, and the +saved table is restored, even in case of an abnormal exit. Value is +what BODY returns." + (let ((old-table (make-symbol "old-table"))) + `(let ((,old-table pprint-printers)) + (unwind-protect + (progn + (setq pprint-printers (copy-sequence ,table)) + ,@body) + (setq pprint-printers ,old-table))))) +(put 'pprint-with-printers 'lisp-indent-function 1) + +;;;; +;;;; Core functions +;;;; + +(defvar pprint-min-width 20 + "Minimum width required to prettify an expression. +If current width is greater than this value, the pretty printer does +nothing.") + +(defvar pprint-width) +(defvar pprint-no-break) + +(defmacro pprint-no-break-p (&rest motions) + "Return non-nil if executing MOTIONS don't break line." + `(save-excursion + (let ((p (point))) + ,@motions + (and (<= (current-column) pprint-width) + (= (progn (beginning-of-line) (point)) + (progn (goto-char p) (beginning-of-line) (point))))))) + +(defsubst pprint-maybe-newline-and-indent () + "Insert a newline, then indent. +Does nothing if point is before a close parenthesis character or +already at the beginning of a line." + (or (looking-at "\\s)") + (save-excursion (skip-syntax-backward "-") (bolp)) + (newline-and-indent))) + +(defsubst pprint-search-printer (table) + "Search in TABLE for a printer to process expression at point. +Return the first one that match expression at point or nil if not +found." + (while (and table (not (looking-at (cdar table)))) + (setq table (cdr table))) + (caar table)) + +(defsubst pprint-dispatch-printer () + "Dispatch a printer to print current expression. +Return non-nil if a printer was found." + (let ((printer (pprint-search-printer pprint-printers))) + (when printer + (funcall printer) + t))) + +(defsubst pprint-sexp-try (room) + "Try to pretty print current expression. +Return nil if the width needed to pretty print current expression goes +beyond specified ROOM." + (save-restriction + (narrow-to-region (point) (progn (forward-sexp) (point))) + (let* ((old-sexp (buffer-string)) + (pprint-width room) + (nobreak t)) + (goto-char (point-min)) + (pprint-sexp) + (goto-char (point-min)) + (end-of-line) + (while (and (setq nobreak (<= (current-column) room)) + (not (eobp))) + (end-of-line 2)) + (delete-region (point-min) (point-max)) + (insert old-sexp) + nobreak))) + +(defsubst pprint-close-list () + "Built-in printer to process close parenthesis characters." + (up-list 1)) + +(defsubst pprint-nil-as-list () + "If next s-expression is the nil symbol print it as (). +Return non-nil if nil has been found and printed." + (skip-syntax-forward "-'") + (when (looking-at "\\") + (delete-region (point) (save-excursion (forward-sexp) (point))) + (insert "()") + t)) + +(defsubst pprint-list () + "Built-in list printer." + (down-list 1) + (pprint-sexp t) ;; never break after an open paren + (let* ((room (- pprint-width (current-column))) + (nobreak (>= room pprint-min-width))) + (save-excursion + (while (and nobreak (not (looking-at "\\s)"))) + (setq nobreak (pprint-sexp-try room)))) + (or nobreak (pprint-maybe-newline-and-indent)) + (while (not (looking-at "\\s)")) + (pprint-sexp nobreak) + (setq nobreak nil))) + (pprint-close-list)) + +(defsubst pprint-sequence () + "Built-in printer of a sequence of expressions. +Insert a line break before each expression." + (while (not (looking-at "\\s)")) + (pprint-maybe-newline-and-indent) + (pprint-sexp))) + +(defun pprint-sexp (&optional pprint-no-break) + "Pretty print S-expression at point. +If optional argument PPRINT-NO-BREAK is non-nil the pretty-printed +representation will not start on a new line." + (if (or (> pprint-min-width pprint-width) + (pprint-no-break-p (forward-sexp))) + (forward-sexp) + (or pprint-no-break (pprint-maybe-newline-and-indent)) + (let ((old-mark (copy-marker (mark-marker)))) + (set-marker + (mark-marker) (save-excursion (forward-sexp) (point))) + (while (< (point) (marker-position (mark-marker))) + (skip-syntax-forward "-'") + (cond + ((pprint-no-break-p (forward-sexp)) + (forward-sexp)) + ((pprint-dispatch-printer)) + ((looking-at "\\s(") + (pprint-list)) + ((looking-at "\\s)") + (pprint-close-list)) + (t + (forward-sexp))) + ) + (set-marker (mark-marker) (marker-position old-mark)) + (set-marker old-mark nil)))) + +;;;; +;;;; Standard printers +;;;; + +(defun pprint-lambda () + "Standard printer for `lambda' like forms." + (down-list 1) + (forward-sexp) + ;; Print empty args as () instead of nil + (or (pprint-nil-as-list) + (pprint-sexp t)) + (pprint-sequence) + (pprint-close-list)) + +(defun pprint-defun () + "Standard printer for `defun' like forms." + (pprint-maybe-newline-and-indent) + (down-list 1) + (forward-sexp) + (forward-sexp) + ;; Print empty args as () instead of nil + (or (pprint-nil-as-list) + (pprint-sexp t)) + (pprint-sequence) + (pprint-close-list)) + +(defun pprint-defvar () + "Standard printer for `defvar' like forms." + (pprint-maybe-newline-and-indent) + (down-list 1) + (forward-sexp) + (unless (looking-at "\\s)") + (pprint-sexp) + (unless (looking-at "\\s)") + (pprint-sexp) + (pprint-sequence))) + (pprint-close-list)) + +(defun pprint-let () + "Standard printer for `let' like forms." + (down-list 1) + (forward-sexp) + (skip-syntax-forward "-'") + (if (looking-at "\\s(") + (progn + (down-list 1) + (skip-syntax-forward "-'") + (unless (looking-at "\\s)") + (pprint-sexp t) + (pprint-sequence)) + (pprint-close-list)) + ;; Print empty let binding as () instead of nil + (or (pprint-nil-as-list) + (pprint-sexp t))) + (pprint-maybe-newline-and-indent) + (pprint-sequence) + (pprint-close-list)) + +(defun pprint-if () + "Standard printer for `if' like forms." + (down-list 1) + (forward-sexp) + (pprint-sexp t) + (pprint-maybe-newline-and-indent) + (pprint-sexp) + (pprint-sequence) + (pprint-close-list)) + +(defun pprint-while () + "Standard printer for `while' like forms." + (down-list 1) + (forward-sexp) + (pprint-sexp t) + (pprint-sequence) + (pprint-close-list)) + +(defun pprint-progn () + "Standard printer for `progn' like forms." + (down-list 1) + (forward-sexp) + (pprint-sequence) + (pprint-close-list)) + +(defun pprint-setq () + "Standard printer for `setq' like forms." + (down-list 1) + (forward-sexp) + (forward-sexp) ;; 1rst VAR + (pprint-sexp t) ;; 1rst VAL + (while (not (looking-at "\\s)")) + (pprint-maybe-newline-and-indent) + (forward-sexp) ;; VAR + (pprint-sexp t)) ;; VAL + (pprint-close-list)) + +(defun pprint-cond () + "Standard printer for `cond' like forms." + (down-list 1) + (forward-sexp) + (while (not (looking-at "\\s)")) + (pprint-maybe-newline-and-indent) + (down-list 1) + (pprint-sexp t) + (pprint-sequence) + (pprint-close-list)) + (pprint-close-list)) + +(defun pprint-with () + "Standard printer for `with-' like forms." + (let* ((withfun (intern-soft (match-string 1))) + (nobreak (or (get withfun 'lisp-indent-function) 0))) + (down-list 1) + (forward-sexp) + (while (> nobreak 0) + (pprint-sexp t) + (setq nobreak (1- nobreak))) + (pprint-sequence) + (pprint-close-list))) + +(defun pprint-setup-standard-printers () + "Setup standard printers." + (pprint-clear-printers) + ;; Printers are searched in sequence from last to first pushed one. + ;; So it could be important to push the most generic printers first! + (pprint-push-printer 'pprint-with + (format "(%s\\>" "\\(with[-]\\(\\sw\\|\\s_\\)+\\)" + )) + (pprint-push-printer 'pprint-defun + (format "(%s\\>" + (regexp-opt + '( + "defun" "defmacro" "defsubst" + ) t))) + (pprint-push-printer 'pprint-lambda + (format "(%s\\>" + (regexp-opt + '( + "lambda" + ) t))) + (pprint-push-printer 'pprint-defvar + (format "(%s\\>" + (regexp-opt + '( + "defvar" "defconst" + ) t))) + (pprint-push-printer 'pprint-let + (format "(%s\\>" + (regexp-opt + '( + "let" "let*" + ) t))) + (pprint-push-printer 'pprint-if + (format "(%s\\>" + (regexp-opt + '( + "if" + ) t))) + (pprint-push-printer 'pprint-while + (format "(%s\\>" + (regexp-opt + '( + "while" "when" "unless" + "condition-case" "catch" + "dotimes" + ) t))) + (pprint-push-printer 'pprint-cond + (format "(%s\\>" + (regexp-opt + '( + "cond" + ) t))) + (pprint-push-printer 'pprint-progn + (format "(%s\\>" + (regexp-opt + '( + "prog1" "progn" + "save-excursion" "save-restriction" + "unwind-protect" + ) t))) + (pprint-push-printer 'pprint-setq + (format "(%s\\>" + (regexp-opt + '( + "setq" + ) t))) + (setq pprint-standard-printers pprint-printers)) + +(pprint-setup-standard-printers) + +;;;; +;;;; User's functions & commands +;;;; + +;;;###autoload +(defun pprint-to-string (object &optional width) + "Return a string containing the pretty-printed representation of OBJECT. +OBJECT can be any Lisp object. Quoting characters are used as needed +to make output that `read' can handle, whenever this is possible. The +pretty printer try as much as possible to limit the length of lines to +given WIDTH. WIDTH value defaults to `fill-column'." + (with-temp-buffer + (lisp-mode-variables nil) + (set-syntax-table emacs-lisp-mode-syntax-table) + (let ((print-escape-newlines nil) + (print-quoted t)) + (prin1 object (current-buffer))) + (goto-char (point-min)) + ;; Escape "(" at beginning of line. Can only occur in strings. + (when (looking-at "\\s(") + (down-list 1) + (while (re-search-forward "^\\s(" nil t) + (goto-char (match-beginning 0)) + (insert "\\"))) + (goto-char (point-min)) + (let* ((pprint-width (or width fill-column)) + (zmacs-regions nil) ;; XEmacs + (inhibit-modification-hooks t)) ;; Emacs + (pprint-sexp)) + (buffer-string))) + +;;;###autoload +(defun pprint (object &optional stream width) + "Output the pretty-printed representation of OBJECT, any Lisp object. +Quoting characters are printed as needed to make output that `read' +can handle, whenever this is possible. Output stream is STREAM, or +value of `standard-output' (which see). The pretty printer try as +much as possible to limit the length of lines to given WIDTH. WIDTH +value defaults to `fill-column'." + (princ (pprint-to-string object width) + (or stream standard-output))) + +;;;###autoload +(defun pprint-function (function-name) + "See a pretty-printed representation of FUNCTION-NAME." + (interactive "aPretty print function: ") + (let ((code (symbol-function function-name))) + (if (byte-code-function-p code) + (error "Can't pretty-print a byte compiled function")) + (with-current-buffer + (get-buffer-create (format "*pprint-function %s*" + function-name)) + (erase-buffer) + (emacs-lisp-mode) + (pprint code (current-buffer)) + (goto-char (point-min)) + (pop-to-buffer (current-buffer))))) + +(provide 'pprint) + +;;; pprint.el ends here diff --git a/site/cedet-1.0pre7/common/pulse.el b/site/cedet-1.0pre7/common/pulse.el new file mode 100644 index 0000000..dd37524 --- /dev/null +++ b/site/cedet-1.0pre7/common/pulse.el @@ -0,0 +1,409 @@ +;;; pulse.el --- Pulsing Overlays + +;; Copyright (C) 2007, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; X-RCS: $Id: pulse.el,v 1.13 2009/09/11 23:44:25 zappo Exp $ + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Manage temporary pulsing of faces and overlays. +;; +;; This is a temporal decoration technique where something is to be +;; highlighted briefly. This adds a gentle pulsing style to the text +;; decorated this way. +;; +;; Useful user functions: +;; +;; `pulse-enable-integration-advice' - Turn on advice to make various +;; Emacs commands pulse, such as `goto-line', or `find-tag'. +;; +;; The following are useful entry points: +;; +;; `pulse' - Cause `pulse-highlight-face' to shift toward background color. +;; Assumes you are using a version of Emacs that supports pulsing. +;; +;; +;; `pulse-momentary-highlight-one-line' - Pulse a single line at POINT. +;; `pulse-momentary-highlight-region' - Pulse a region. +;; `pulse-momentary-highlight-overlay' - Pulse an overlay +;; These three functions will just blink the specified area if +;; the version of Emacs you are using doesn't support pulsing. +;; +;; `pulse-line-hook-function' - A simple function that can be used in a +;; hook that will pulse whatever line the cursor is on. +;; +;;; History: +;; +;; The original pulse code was written for semantic tag highlighting. +;; It has been extracted, and adapted for general purpose pulsing. +;; +;; Pulse is a part of CEDET. http://cedet.sf.net + + +(defun pulse-available-p () + "Return non-nil if pulsing is available on the current frame." + (condition-case nil + (let ((v (color-values (face-background 'default)))) + (numberp (car-safe v))) + (error nil))) + +(defcustom pulse-flag (pulse-available-p) + "*Non-nil means to pulse the overlay face for momentary highlighting. +Pulsing involves a bright highlight that slowly shifts to the background +color. Non-nil just means to highlight with an unchanging color for a short +time. + +If `pulse-flag' is non-nil, but `pulse-available-p' is nil, then +this flag is ignored." + :group 'pulse + :type 'boolean) + +(defface pulse-highlight-start-face + '((((class color) (background dark)) + (:background "#AAAA33")) + (((class color) (background light)) + (:background "#FFFFAA"))) + "*Face used at beginning of a highight." + :group 'pulse) + +(defface pulse-highlight-face + '((((class color) (background dark)) + (:background "#AAAA33")) + (((class color) (background light)) + (:background "#FFFFAA"))) + "*Face used during a pulse for display. *DO NOT CUSTOMIZE* +Face used for temporary highlighting of tags for effect." + :group 'pulse) + +;;; Compatibility +;; +(if (featurep 'xemacs) + (progn + (defalias 'pulse-overlay-live-p + (lambda (o) + (and (extent-live-p o) + (not (extent-detached-p o)) + (bufferp (extent-buffer o))))) + (defalias 'pulse-overlay-put 'set-extent-property) + (defalias 'pulse-overlay-get 'extent-property) + (defalias 'pulse-overlay-delete 'delete-extent) + (defalias 'pulse-make-overlay 'make-extent) + ) + ;; Regular Emacs + (defalias 'pulse-overlay-live-p 'overlay-buffer) + (defalias 'pulse-overlay-put 'overlay-put) + (defalias 'pulse-overlay-get 'overlay-get) + (defalias 'pulse-overlay-delete 'delete-overlay) + (defalias 'pulse-make-overlay 'make-overlay) + ) + +;;; Code: +;; +(defun pulse-int-to-hex (int &optional nb-digits) + "Convert integer argument INT to a #XXXXXXXXXXXX format hex string. +Each X in the output string is a hexadecimal digit. +NB-DIGITS is the number of hex digits. If INT is too large to be +represented with NB-DIGITS, then the result is truncated from the +left. So, for example, INT=256 and NB-DIGITS=2 returns \"00\", since +the hex equivalent of 256 decimal is 100, which is more than 2 digits. + +This function was blindly copied from hexrgb.el by Drew Adams. +http://www.emacswiki.org/cgi-bin/wiki/hexrgb.el" + (setq nb-digits (or nb-digits 4)) + (substring (format (concat "%0" (int-to-string nb-digits) "X") int) (- nb-digits))) + +(defun pulse-color-values-to-hex (values) + "Convert list of rgb color VALUES to a hex string, #XXXXXXXXXXXX. +Each X in the string is a hexadecimal digit. +Input VALUES is as for the output of `x-color-values'. + +This function was blindly copied from hexrgb.el by Drew Adams. +http://www.emacswiki.org/cgi-bin/wiki/hexrgb.el" + (concat "#" + (pulse-int-to-hex (nth 0 values) 4) ; red + (pulse-int-to-hex (nth 1 values) 4) ; green + (pulse-int-to-hex (nth 2 values) 4))) ; blue + +(defcustom pulse-iterations 10 + "Number of iterations in a pulse operation." + :group 'pulse + :type 'number) +(defcustom pulse-delay .03 + "Delay between face lightening iterations, as used by `sit-for'." + :group 'pulse + :type 'number) + +(defun pulse-lighten-highlight () + "Lighten the face by 1/`pulse-iterations' toward the background color. +Return t if there is more drift to do, nil if completed." + (if (>= (get 'pulse-highlight-face :iteration) pulse-iterations) + nil + (let* ((frame (color-values (face-background 'default))) + (start (color-values (face-background + (get 'pulse-highlight-face + :startface)))) + (frac (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations) + (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations) + (/ (- (nth 2 frame) (nth 2 start)) pulse-iterations))) + (it (get 'pulse-highlight-face :iteration)) + ) + (set-face-background 'pulse-highlight-face + (pulse-color-values-to-hex + (list + (+ (nth 0 start) (* (nth 0 frac) it)) + (+ (nth 1 start) (* (nth 1 frac) it)) + (+ (nth 2 start) (* (nth 2 frac) it))))) + (put 'pulse-highlight-face :iteration (1+ it)) + (if (>= (1+ it) pulse-iterations) + nil + t)))) + +(defun pulse-reset-face (&optional face) + "Reset the pulse highlighting FACE." + (set-face-background 'pulse-highlight-face + (if face + (face-background face) + (face-background 'pulse-highlight-start-face) + )) + (put 'pulse-highlight-face :startface (or face + 'pulse-highlight-start-face)) + (put 'pulse-highlight-face :iteration 0)) + +;;;###autoload +(defun pulse (&optional face) + "Pulse the colors on our highlight face. +If optional FACE is provide, reset the face to FACE color, +instead of `pulse-highlight-start-face'. +Be sure to call `pulse-reset-face' after calling pulse." + (unwind-protect + (progn + (pulse-reset-face face) + (while (and (pulse-lighten-highlight) + (sit-for pulse-delay)) + nil)) + )) + +;;;###autoload +(defun pulse-test (&optional no-error) + "Test the lightening function for pulsing a line. +When optional NO-ERROR Don't throw an error if we can't run tests." + (interactive) + (if (or (not pulse-flag) (not (pulse-available-p))) + (if no-error + nil + (error (concat "Pulse test only works on versions of Emacs" + " that support pulsing"))) + ;; Run the tests + (when (interactive-p) + (message " Pulse one line.") + (read-char)) + (pulse-momentary-highlight-one-line (point)) + (when (interactive-p) + (message " Pulse a region.") + (read-char)) + (pulse-momentary-highlight-region (point) + (save-excursion + (condition-case nil + (forward-char 30) + (error nil)) + (point))) + (when (interactive-p) + (message " Pulse line a specific color.") + (read-char)) + (pulse-momentary-highlight-one-line (point) 'modeline) + (when (interactive-p) + (message " Pulse a pre-existing overlay.") + (read-char)) + (let* ((start (point-at-bol)) + (end (save-excursion + (end-of-line) + (when (not (eobp)) + (forward-char 1)) + (point))) + (o (pulse-make-overlay start end)) + ) + (pulse-momentary-highlight-overlay o) + (if (pulse-overlay-live-p o) + (pulse-overlay-delete o) + (error "Non-temporary overlay was deleted!")) + ) + (when (interactive-p) + (message "Done!")))) + + +;;; Convenience Functions +;; +(defvar pulse-momentary-overlay nil + "The current pulsing overlay.") + +;;;###autoload +(defun pulse-momentary-highlight-overlay (o &optional face) + "Pulse the overlay O, unhighlighting before next command. +Optional argument FACE specifies the fact to do the highlighting." + (pulse-overlay-put o 'original-face (pulse-overlay-get o 'face)) + (add-to-list 'pulse-momentary-overlay o) + (if (or (not pulse-flag) (not (pulse-available-p))) + ;; Provide a face... clear on next command + (progn + (pulse-overlay-put o 'face (or face 'pulse-highlight-start-face)) + (add-hook 'pre-command-hook + 'pulse-momentary-unhighlight) + ) + ;; pulse it. + (unwind-protect + (progn + (pulse-overlay-put o 'face 'pulse-highlight-face) + ;; The pulse function puts FACE onto 'pulse-highlight-face. + ;; Thus above we put our face on the overlay, but pulse + ;; with a reference face needed for the color. + (pulse face)) + (pulse-momentary-unhighlight)) + ) + ) + +(defun pulse-momentary-unhighlight () + "Unhighlight a line recently highlighted." + ;; If someone passes in an overlay, then pulse-momentary-overlay + ;; will still be nil, and won't need modifying. + (when pulse-momentary-overlay + ;; clear the starting face + (mapc + (lambda (ol) + (pulse-overlay-put ol 'face (pulse-overlay-get ol 'original-face)) + (pulse-overlay-put ol 'original-face nil) + ;; Clear the overlay if it needs deleting. + (when (pulse-overlay-get ol 'pulse-delete) (pulse-overlay-delete ol))) + pulse-momentary-overlay) + + ;; Clear the variable. + (setq pulse-momentary-overlay nil)) + + ;; Reset the pulsing face. + (pulse-reset-face) + + ;; Remove this hook. + (remove-hook 'pre-command-hook 'pulse-momentary-unhighlight) + ) + +;;;###autoload +(defun pulse-momentary-highlight-one-line (point &optional face) + "Highlight the line around POINT, unhighlighting before next command. +Optional argument FACE specifies the face to do the highlighting." + (let ((start (point-at-bol)) + (end (save-excursion + (end-of-line) + (when (not (eobp)) + (forward-char 1)) + (point)))) + (pulse-momentary-highlight-region start end face) + )) + +;;;###autoload +(defun pulse-momentary-highlight-region (start end &optional face) + "Highlight between START and END, unhighlighting before next command. +Optional argument FACE specifies the fact to do the highlighting." + (let ((o (pulse-make-overlay start end))) + ;; Mark it for deletion + (pulse-overlay-put o 'pulse-delete t) + (pulse-momentary-highlight-overlay o face))) + +;;; Random integration with other tools +;; +(defvar pulse-command-advice-flag nil + "Non-nil means pulse advice is active. +To active pulse advice, use `pulse-enable-integration-advice'.") + +;;;###autoload +(defun pulse-toggle-integration-advice (arg) + "Toggle activation of advised functions that will now pulse. +Wint no ARG, toggle the pulse advice. +With a negative ARG, disable pulse advice. +With a positive ARG, enable pulse advice. +Currently advised functions include: + `goto-line' + `exchange-point-and-mark' + `find-tag' + `tags-search' + `tags-loop-continue' + `pop-tag-mark' + `imenu-default-goto-function' +Pulsing via `pulse-line-hook-function' has also been added to +the following hook: + `next-error-hook'" + (interactive "P") + (if (null arg) + (setq pulse-command-advice-flag (not pulse-command-advice-flag)) + (if (< (prefix-numeric-value arg) 0) + (setq pulse-command-advice-flag nil) + (setq pulse-command-advice-flag t) + ) + ) + (if pulse-command-advice-flag + (message "Pulse advice enabled") + (message "Pulse advice disabled")) + ) + +(defadvice goto-line (after pulse-advice activate) + "Cause the line that is `goto'd to pulse when the cursor gets there." + (when (and pulse-command-advice-flag (interactive-p)) + (pulse-momentary-highlight-one-line (point)))) + +(defadvice exchange-point-and-mark (after pulse-advice activate) + "Cause the line that is `goto'd to pulse when the cursor gets there." + (when (and pulse-command-advice-flag (interactive-p) + (> (abs (- (point) (mark))) 400)) + (pulse-momentary-highlight-one-line (point)))) + +(defadvice find-tag (after pulse-advice activate) + "After going to a tag, pulse the line the cursor lands on." + (when (and pulse-command-advice-flag (interactive-p)) + (pulse-momentary-highlight-one-line (point)))) + +(defadvice tags-search (after pulse-advice activate) + "After going to a hit, pulse the line the cursor lands on." + (when (and pulse-command-advice-flag (interactive-p)) + (pulse-momentary-highlight-one-line (point)))) + +(defadvice tags-loop-continue (after pulse-advice activate) + "After going to a hit, pulse the line the cursor lands on." + (when (and pulse-command-advice-flag (interactive-p)) + (pulse-momentary-highlight-one-line (point)))) + +(defadvice pop-tag-mark (after pulse-advice activate) + "After going to a hit, pulse the line the cursor lands on." + (when (and pulse-command-advice-flag (interactive-p)) + (pulse-momentary-highlight-one-line (point)))) + +(defadvice imenu-default-goto-function (after pulse-advice activate) + "After going to a tag, pulse the line the cursor lands on." + (when pulse-command-advice-flag + (pulse-momentary-highlight-one-line (point)))) + +;;;###autoload +(defun pulse-line-hook-function () + "Function used in hooks to pulse the current line. +Only pulses the line if `pulse-command-advice-flag' is non-nil." + (when pulse-command-advice-flag + (pulse-momentary-highlight-one-line (point)))) + +(add-hook 'next-error-hook 'pulse-line-hook-function) + +(provide 'pulse) + +;;; pulse.el ends here diff --git a/site/cedet-1.0pre7/common/working.el b/site/cedet-1.0pre7/common/working.el new file mode 100644 index 0000000..2eaecbd --- /dev/null +++ b/site/cedet-1.0pre7/common/working.el @@ -0,0 +1,639 @@ +;;; working --- Display a "working" message in the minibuffer. + +;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, +;; 2004, 2007, 2008, 2009 Eric M. Ludlam + +;; Author: Eric M. Ludlam +;; Version: 1.5 +;; Keywords: status + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Working lets Emacs Lisp programmers easily display working messages. +;; These messages typically come in the form of a percentile, or generic +;; doodles if a maximum is unknown. +;; +;; The working entry points are quite simple. If you have a loop that needs +;; to display a status as it goes along, it would look like this: +;; +;; (working-status-forms "Doing stuff" "done" +;; (while condition +;; (working-status (calc-percentile)) +;; (my-work)) +;; (working-status t)) +;; +;; If you cannot calculate a percentile, use the function +;; `working-dynamic-status' instead, and pass in what you know. For +;; both status printing functions, the first argument is optional, +;; and you may pass in additional arguments as `format' elements +;; to the first argument of `working-status-forms'. +;; +;; See the examples at the end of the buffer. + +;;; Backwards Compatibility: +;; +;; If you want to use working in your program, but don't want to force people +;; to install working, use could add this at the beginning of your program for +;; compatibility. +;; +;; (eval-and-compile +;; (condition-case nil +;; (require 'working) +;; (error +;; (progn +;; (defmacro working-status-forms (message donestr &rest forms) +;; "Contain a block of code during which a working status is shown." +;; (list 'let (list (list 'msg message) (list 'dstr donestr) +;; '(ref1 0)) +;; (cons 'progn forms))) +;; +;; (defun working-status (&optional percent &rest args) +;; "Called within the macro `working-status-forms', show the status." +;; (message "%s%s" (apply 'format msg args) +;; (if (eq percent t) (concat "... " dstr) +;; (format "... %3d%%" +;; (or percent +;; (floor (* 100.0 (/ (float (point)) +;; (point-max))))))))) +;; +;; (defun working-dynamic-status (&optional number &rest args) +;; "Called within the macro `working-status-forms', show the status." +;; (message "%s%s" (apply 'format msg args) +;; (format "... %c" (aref [ ?- ?/ ?| ?\\ ] (% ref1 4)))) +;; (setq ref1 (1+ ref1))) +;; +;; (put 'working-status-forms 'lisp-indent-function 2))))) +;; +;; Depending on what features you use, it is, of course, easy to +;; reduce the total size of the above by omitting those features you +;; do not use. + +;;; History: +;; +;; 1.0 First Version +;; +;; 1.1 Working messages are no longer logged. +;; Added a generic animation display funciton: +;; Convert celeron to animator +;; Added a bounce display +;; Made working robust under a multi-frame environment (speedbar) +;; +;; 1.2 Fix up documentation. +;; Updated dotgrowth function for exceptionally large numbers of dots. +;; Added the percentage bubble displays. +;; +;; 1.3 Added `working-status-timeout' and `working-status-call-process'. +;; Added test fns `working-wait-for-keypress' and `working-verify-sleep'. +;; +;; 1.4 ??? +;; +;; 1.5 Use features from the fame library. +;; + +(require 'custom) +(require 'fame) + +;;; Code: +(defgroup working nil + "Working messages display." + :prefix "working" + :group 'lisp + ) + +;;; User configurable variables +;; +(defcustom working-status-percentage-type 'working-bar-percent-display + "*Function used to display the percent status. +Functions provided in `working' are: + `working-percent-display' + `working-bar-display' + `working-bar-percent-display' + `working-percent-bar-display' + `working-bubble-display' + `working-bubble-precent-display' + `working-celeron-percent-display'" + :group 'working + :type '(choice (const working-percent-display) + (const working-bar-display) + (const working-bar-percent-display) + (const working-percent-bar-display) + (const working-bubble-display) + (const working-bubble-percent-display) + (const working-celeron-percent-display) + (const nil))) + +(defcustom working-status-dynamic-type 'working-celeron-display + "*Function used to display an animation indicating progress being made. +Dynamic working types occur when the program does not know how long +it will take ahead of time. Functions provided in `working' are: + `working-number-display' + `working-text-display' + `working-spinner-display' + `working-dotgrowth-display' + `working-celeron-display' + `working-bounce-display'" + :group 'working + :type '(choice (const working-number-display) + (const working-text-display) + (const working-spinner-display) + (const working-dotgrowth-display) + (const working-celeron-display) + (const working-bounce-display) + (const nil))) + +(defcustom working-percentage-step 2 + "*Percentage display step. +A number representing how large a step must be taken when working a +percentage display. A number such as `2' means `2%'." + :group 'working' + :type 'number) + +;;; Mode line hacks +;; +;; When the user doesn't want messages in the minibuffer, hack the mode +;; line of the current buffer. +(if (featurep 'xemacs) + (eval-and-compile (defalias 'working-mode-line-update 'redraw-modeline)) + (eval-and-compile (defalias 'working-mode-line-update 'force-mode-line-update))) + +(defvar working-mode-line-message nil + "Message used by working when showing status in the mode line.") + +(if (boundp 'global-mode-string) + (progn + ;; If this variable exists, use it to push the working message into + ;; an interesting part of the mode line. + (if (null global-mode-string) + (setq global-mode-string (list ""))) + (setq global-mode-string + (append global-mode-string '(working-mode-line-message)))) + ;; Else, use minor mode trickery to get a reliable way of doing the + ;; same thing across many versions of Emacs. + (setq minor-mode-alist (cons + '(working-mode-line-message working-mode-line-message) + minor-mode-alist)) + ) + +(defvar working-use-echo-area-p t + "*Non-nil use the echo area to display working messages.") + +;;; Variables used in stages +;; +(defvar working-message nil + "Message stored when in a status loop.") +(defvar working-donestring nil + "Done string stored when in a status loop.") +(defvar working-ref1 nil + "A reference number used in a status loop.") +(defvar working-last-percent 0 + "A reference number used in a status loop.") + +;;; Programmer functions +;; +(eval-when-compile + (cond + ((fboundp 'noninteractive) + ;; Silence the XEmacs byte compiler + (defvar noninteractive)) + ((boundp 'noninteractive) + ;; Silence the Emacs byte compiler + (defun noninteractive nil)) + )) + +(defsubst working-noninteractive () + "Return non-nil if running without interactive terminal." + (if (boundp 'noninteractive) + noninteractive + (noninteractive))) + +(defun working-message-echo (&rest args) + "Print but don't log a one-line message at the bottom of the screen. +See the function `message' for details on ARGS." + (or (working-noninteractive) + (apply 'fame-message-nolog args))) + +(defalias 'working-current-message 'fame-current-message) +(defalias 'working-temp-message 'fame-temp-message) + +(defun working-message (&rest args) + "Display a message using `working-message-echo' or in mode line. +See the function `message' for details on ARGS." + (if working-use-echo-area-p + (apply 'working-message-echo args) + (when (not working-mode-line-message) + ;; If we start out nil, put stuff in to show we are up to + (setq working-mode-line-message "Working...") + (working-mode-line-update) + (sit-for 0) + ))) + +;;; Compatibility +(cond ((fboundp 'run-with-timer) + (eval-and-compile (defalias 'working-run-with-timer 'run-with-timer)) + (eval-and-compile (defalias 'working-cancel-timer 'cancel-timer)) + ) + ;;Add compatibility here + (t + ;; This gets the message out but has no timers. + (defun working-run-with-timer (&rest foo) + (working-message working-message)) + (defun working-cancel-timer (&rest foo) + (working-message "%s%s" + working-message + working-donestring))) + ) + +(defmacro working-status-forms (message donestr &rest forms) + "Contain a block of code during which a working status is shown. +MESSAGE is the message string to use and DONESTR is the completed text +to use when the functions `working-status' is called from FORMS." + (let ((current-message (make-symbol "working-current-message"))) + `(let ((,current-message (working-current-message)) + (working-message ,message) + (working-donestring ,donestr) + (working-ref1 0) + (working-last-percent 0)) + (unwind-protect + (progn ,@forms) + (setq working-mode-line-message nil) + (if working-use-echo-area-p + (message ,current-message) + (working-mode-line-update) + (sit-for 0)))) + )) +(put 'working-status-forms 'lisp-indent-function 2) + +(defmacro working-status-timeout (timeout message donestr &rest forms) + "Contain a block of code during which working status is shown. +The code may call `sit-for' or `accept-process-output', so a timer +is needed to update the message. +TIMEOUT is the length of time to wait between message updates. +MESSAGE is the message string to use and DONESTR is the completed text +to use when the functions `working-status' is called from FORMS." + (let ((current-message (make-symbol "working-current-message"))) + `(let* ((,current-message (working-current-message)) + (working-message ,message) + (working-donestring ,donestr) + (working-ref1 0) + (time ,timeout) + (working-timer + (working-run-with-timer time time 'working-dynamic-status))) + (unwind-protect + (progn ,@forms) + (working-cancel-timer working-timer) + (working-dynamic-status t) + (setq working-mode-line-message nil) + (if working-use-echo-area-p + (message ,current-message) + (working-mode-line-update) + (sit-for 0)))) + )) +(put 'working-status-timeout 'lisp-indent-function 3) + +(defun working-status-call-process + (timeout message donestr program &optional infile buffer display &rest args) + "Display working messages while running a process. +TIMEOUT is how fast to display the messages. +MESSAGE is the message to show, and DONESTR is the string to add when done. +CALLPROCESSARGS are the same style of args as passed to `call-process'. +The are: PROGRAM, INFILE, BUFFER, DISPLAY, and ARGS. +Since it actually calls `start-process', not all features will work." + (working-status-timeout timeout message donestr + (let ((proc (apply 'start-process "working" + (if (listp buffer) (car buffer) buffer) + program args))) + (set-process-sentinel proc 'list) + (while (eq (process-status proc) 'run) + (accept-process-output proc) + ;; accept-process-output caused my solaris Emacs 20.3 to crash. + ;; If this is unreliable for you, use the below which will work + ;; in that situation. + ;; (if (not (sit-for timeout)) (read-event)) + )))) + +(defun working-status (&optional percent &rest args) + "Called within the macro `working-status-forms', show the status. +If PERCENT is nil, then calculate PERCENT from the value of `point' in +the current buffer. If it is a number or float, use it as the raw +percentile. +Additional ARGS are passed to fill on % elements of MESSAGE from the +macro `working-status-forms'." + (when (and working-message working-status-percentage-type) + (let ((p (or percent + (floor (* 100.0 (/ (float (point)) (point-max))))))) + (if (or (eq p t) + (> (- p working-last-percent) working-percentage-step)) + (let* ((m1 (apply 'format working-message args)) + (m2 (funcall working-status-percentage-type (length m1) p))) + (working-message "%s%s" m1 m2) + (setq working-last-percent p)))))) + +(defun working-dynamic-status (&optional number &rest args) + "Called within the macro `working-status-forms', show the status. +If NUMBER is nil, then increment a local NUMBER from 0 with each call. +If it is a number or float, use it as the raw percentile. +Additional ARGS are passed to fill on % elements of MESSAGE from the +macro `working-status-forms'." + (when (and working-message working-status-dynamic-type) + (let* ((n (or number working-ref1)) + (m1 (apply 'format working-message args)) + (m2 (funcall working-status-dynamic-type (length m1) n))) + (working-message "%s%s" m1 m2) + (setq working-ref1 (1+ working-ref1))))) + +;;; Utilities +;; +(defun working-message-frame-width () + "Return the width of the frame the working message will be in." + (let* ((mbw (cond ((fboundp 'frame-parameter) + (frame-parameter (selected-frame) 'minibuffer)) + ((fboundp 'frame-property) + (frame-property (selected-frame) 'minibuffer)))) + (fr (if (windowp mbw) + (window-frame mbw) + default-minibuffer-frame))) + (frame-width fr))) + +;;; Percentage display types. +;; +(defun working-percent-display (length percent) + "Return the percentage of the buffer that is done in a string. +LENGTH is the amount of display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (cond ((eq percent t) (concat "... " working-donestring)) + ;; All the % signs because it then gets passed to message. + (t (format "... %3d%%" percent)))) + +(defun working-bar-display (length percent) + "Return a string with a bar-graph showing percent. +LENGTH is the amount of display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (let ((bs (- (working-message-frame-width) length 5))) + (cond ((eq percent t) + (concat ": [" (make-string bs ?#) "] " working-donestring)) + ((< bs 0) "") + (t (let ((bsl (floor (* (/ percent 100.0) bs)))) + (concat ": [" + (make-string bsl ?#) + (make-string (- bs bsl) ?.) + "]")))))) + +(defun working-bar-percent-display (length percent) + "Return a string with a bar-graph and percentile showing percentage. +LENGTH is the amount of display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (let* ((ps (if (eq percent t) + (concat "... " working-donestring) + (working-percent-display length percent))) + (psl (+ 2 length (length ps)))) + (cond ((eq percent t) + (concat (working-bar-display psl 100) " " ps)) + (t + (setq working-ref1 (length ps)) + (concat (working-bar-display psl percent) " " ps))))) + +(defun working-percent-bar-display (length percent) + "Return a string with a percentile and bar-graph showing percentage. +LENGTH is the amount of display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (let* ((ps (if (eq percent t) + (concat "... " working-donestring) + (working-percent-display length percent))) + (psl (+ 1 length (length ps)))) + (cond ((eq percent t) + (concat ps " " (working-bar-display psl 100))) + (t + (setq working-ref1 (length ps)) + (concat ps " " (working-bar-display psl percent)))))) + +(defun working-bubble-display (length percent) + "Return a string with a bubble graph indicating the precent completed. +LENGTH is the amount of the display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (if (eq percent t) + (concat " [@@@@@@@@@@@@@@@@@@@@] " working-donestring) + (let ((bs " [") + (bubbles [ ?. ?- ?o ?O ?@ ])) + (if (> percent 5) + (setq bs (concat bs (make-string (/ (floor percent) 5) ?@)))) + (setq bs (concat bs + (char-to-string (aref bubbles (% (floor percent) 5))))) + (if (< (/ (floor percent) 5) 20) + (setq bs (concat bs (make-string (- 19 (/ (floor percent) 5)) ? )))) + (concat bs "]")))) + +(defun working-bubble-percent-display (length percent) + "Return a string with a percentile and bubble graph showing percentage. +LENGTH is the amount of display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (let* ((ps (if (eq percent t) + (concat " ... " working-donestring) + (working-percent-display length percent))) + (psl (+ 1 length (length ps)))) + (cond ((eq percent t) + (concat (working-bubble-display psl t))) + (t + (setq working-ref1 (length ps)) + (concat (working-bubble-display psl percent) ps))))) + +(defun working-celeron-percent-display (length percent) + "Return a string with a celeron and string showing percent. +LENGTH is the amount of display that has been used. PERCENT +is t to display the done string, or the percentage to display." + (prog1 + (cond ((eq percent t) (working-celeron-display length t)) + ;; All the % signs because it then gets passed to message. + (t (format "%s %3d%%" + (working-celeron-display length 0) + percent))) + (setq working-ref1 (1+ working-ref1)))) + +;;; Dynamic display types. +;; +(defun working-number-display (length number) + "Return a string displaying the number of things that happened. +LENGTH is the amount of display that has been used. NUMBER +is t to display the done string, or the number to display." + (cond ((eq number t) (concat "... " working-donestring)) + ;; All the % signs because it then gets passed to message. + (t (format "... %d" number)))) + +(defun working-text-display (length text) + "Return a string displaying the name of things that happened. +LENGTH is the amount of display that has been used. TEXT +is t to display the done string, or the text to display." + (if (eq text t) + (concat "... " working-donestring) + (format "... %s" text))) + +(defun working-spinner-display (length number) + "Return a string displaying a spinner based on a number. +LENGTH is the amount of display that has been used. NUMBER +is t to display the done string, or the number to display." + (cond ((eq number t) (concat "... " working-donestring)) + ;; All the % signs because it then gets passed to message. + (t (format "... %c" (aref [ ?- ?/ ?| ?\\ ] (% working-ref1 4)))))) + +(defun working-dotgrowth-display (length number) + "Return a string displaying growing dots due to activity. +LENGTH is the amount of display that has been used. NUMBER +is t to display the done string, or the number to display. +This display happens to ignore NUMBER." + (let* ((width (- (working-message-frame-width) 4 length)) + (num-wrap (/ working-ref1 width)) + (num-. (% working-ref1 width)) + (dots [ ?. ?, ?o ?* ?O ?@ ?# ])) + (concat " (" (make-string num-. (aref dots (% num-wrap (length dots)))) ")" + (if (eq number t) (concat " " working-donestring) "")))) + +(defun working-frame-animation-display (length number frames) + "Manage a simple frame-based animation for working functions. +LENGTH is the number of characters left. NUMBER is a passed in +number (which happens to be ignored.). While coders pass t into +NUMBER, functions using this should convert NUMBER into a vector +describing how to render the done message. +Argument FRAMES are the frames used in the animation." + (cond ((vectorp number) + (let ((zone (- (length (aref frames 0)) (length (aref number 0)) + (length (aref number 1))))) + (if (< (length working-donestring) zone) + (concat " " (aref number 0) + (make-string + (ceiling (/ (- (float zone) + (length working-donestring)) 2)) ? ) + working-donestring + (make-string + (floor (/ (- (float zone) + (length working-donestring)) 2)) ? ) + (aref number 1)) + (concat " " (aref frames (% working-ref1 (length frames))) + " " working-donestring)))) + (t (concat " " (aref frames (% working-ref1 (length frames))))))) + +(defvar working-celeron-strings + [ "[O ]" "[oO ]" "[-oO ]" "[ -oO ]" "[ -oO ]" "[ -oO]" + "[ -O]" "[ O]" "[ Oo]" "[ Oo-]" "[ Oo- ]" "[ Oo- ]" + "[Oo- ]" "[O- ]"] + "Strings representing a silly celeron.") + +(defun working-celeron-display (length number) + "Return a string displaying a celeron as things happen. +LENGTH is the amount of display that has been used. NUMBER +is t to display the done string, or the number to display." + (cond ((eq number t) + (working-frame-animation-display length [ "[" "]" ] + working-celeron-strings)) + ;; All the % signs because it then gets passed to message. + (t (working-frame-animation-display length number + working-celeron-strings)))) + +(defvar working-bounce-strings + [ + "[_ ]" + "[ - ]" + "[ ~ ]" + "[ - ]" + "[ _ ]" + "[ - ]" + "[ ~ ]" + "[ - ]" + "[ _ ]" + "[ -]" + + ] + "Strings for the bounce animation.") + +(defun working-bounce-display (length number) + "Return a string displaying a celeron as things happen. +LENGTH is the amount of display that has been used. NUMBER +is t to display the done string, or the number to display." + (cond ((eq number t) + (working-frame-animation-display length [ "[" "]" ] + working-bounce-strings)) + ;; All the % signs because it then gets passed to message. + (t (working-frame-animation-display length number + working-bounce-strings)))) + +;;; Some edebug hooks +;; +(add-hook + 'edebug-setup-hook + (lambda () + (def-edebug-spec working-status-forms (form form def-body)) + (def-edebug-spec working-status-timeout (form form form def-body)))) + +;;; Example function using `working' +;; +(defun working-verify-parenthesis-a () + "Verify all the parenthesis in an elisp program buffer." + (interactive) + (working-status-forms "Scanning" "done" + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + ;; Use default buffer position. + (working-status) + (forward-sexp 1) + (sleep-for 0.05) + ) + (working-status t)) + (sit-for 1))) + +(defun working-verify-parenthesis-b () + "Verify all the parenthesis in an elisp program buffer." + (interactive) + (working-status-forms "Scanning" "done" + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + ;; Use default buffer position. + (working-dynamic-status nil) + (forward-sexp 1) + (sleep-for 0.05) + ) + (working-dynamic-status t)) + (sit-for 0))) + +(defun working-wait-for-keypress () + "Display funny graphics while waiting for a keypress." + (interactive) + (working-status-timeout .1 "Working Test: Press a key" "done" + (while (sit-for 10))) + (when (input-pending-p) + (if (fboundp 'read-event) + (read-event) + (read-char))) + ) + +(defun working-verify-sleep () + "Display funny graphics while waiting for sleep to sleep." + (interactive) + (working-status-call-process .1 "Zzzzz" "Snort" "sleep" nil nil nil "2")) + +(defun working-verify-mode-line () + "Display graphics in the mode-line for timeout." + (interactive) + (let ((working-use-echo-area-p nil)) + (message "Pres a Key") + (working-status-timeout .1 "" "" + (while (sit-for 10))) + )) + +(provide 'working) + +;;; working.el ends here diff --git a/site/cedet-1.0pre7/contrib/ChangeLog b/site/cedet-1.0pre7/contrib/ChangeLog new file mode 100644 index 0000000..fe953b7 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/ChangeLog @@ -0,0 +1,520 @@ +2010-02-08 Eric M. Ludlam + + * eassist.el: Patch from Kiwon Um + (eassist-switch-h-cpp): If destination file is in a different frame, + then switch frames. + +2010-01-30 Eric M. Ludlam + + * eassist.el: Patch from Kiwon Um: + (eassist-switch-h-cpp): If switching to a file that is already in a + window, just switch to that window. + +2010-01-09 Marco (Bj) Bardelli + + * ede-gnustep.el: + * ede-step-target:makefile attribute unitialized, to set it during + (ede-step-project::project-rescan). + * inserted commented subsitution for `makefile-macro-file-list', but + don't work. Let it commented and still using + `makefile-macro-file-list'. + * Try to use `ede-object-project' variable, but don't work. Still + to use absolute :path in targets to get parent project. + +2009-10-17 Eric M. Ludlam + + * Makefile (LOADPATH): Fix generation issue. + +2009-10-16 Eric M. Ludlam + + * Makefile (ELISPPRELOAD): New + (init,lisp): Use above. + + * Project.ede (init,lisp): Use preload compiler, and preloads. + +2009-10-08 Marco (Bj) Bardelli + + * ede-gnustep.el: Added several function for parsing using + `semantic--find-tag-by-function'. + Removed :makefile from `ede-step-project'. + +2009-09-22 Marco (Bj) Bardelli + + * ede-gnustep.el: A lot of restyling. + Return to use only one class. + Introduce a :project-mode for scanner or writer. + Provide 3 variants autoload, via :load-type or :initializers. + heavily changed: project-rescan and loading funcs. + +2009-08-09 Eric M. Ludlam + + * ede-gnustep.el (ede-step-project): + Remove stray . in project-mode which broke compilation. + + * semantic-tag-folding.el (cl): Change how it is required. + + * Makefile (lisp_LISP): ectag scala support. + + * Project.ede ("lisp"): ectag scala support. + +2009-08-05 Marco (Bj) Bardelli + + * ede-gnustep.el: * Begin a restyling. + A new approch for scanning GNUmakefile to write ProjStep.ede or + scanning ProjStep.ede to write GNUmakefile, based on :project-mode + attribute of project. + * TODO FIX many Bugs. + +2009-07-27 Eric M. Ludlam + + * semantic-ectag-scala.el: Scala support contributed by Raymond Racine + +2009-03-19 Eric M. Ludlam + + * Makefile, Project.ede, cedet-contrib.el (cedet-contrib-version): + Update version. + +2009-03-05 Alex Ott + + * .cvsignore: + add ignore files to not show auxiliary scripts, not included into CVS + +2009-02-24 Eric M. Ludlam + + * Makefile (EMACSFLAGS): New variable + (init,setup,lisp): Use above. + +2009-01-29 Eric M. Ludlam + + * Project.ede (contrib): Updated to 1.0pre6. + + * Makefile (VERSION): Updated to 1.0pre6. + + * cedet-contrib.el (cedet-contrib-version): Updated to 1.0pre6. + +2009-01-24 Eric M. Ludlam + + * wisent-php.el (wisent-php-default-setup): + Remove traces of old 'document' tool. + +2009-01-05 Eric M. Ludlam + + * ede-gnustep.el (ede-step-project): Fix doc + +2008-12-11 Eric M. Ludlam + + * ede-gnustep.el (ede-step-load): Save the directory on load. + +2008-10-21 Marco (Bj) Bardelli + + * ede-gnustep.el: Added header files support. + +2008-09-04 Eric M. Ludlam + + * Makefile (wy_SEMANTIC_GRAMMAR, wy_SEMANTIC_GRAMMAR_EL, lisp_LISP): + Remove + javascript support. + + * Project.ede ("wy", "lisp"): Remove javascript support. + + * semanticdb-javascript.el: Move to semantic. + + * wisent-javascript-jv.wy, wisent-javascript.el: + Moving to semantic/wisent directory. + +2008-09-03 Eric M. Ludlam + + * semantic-matlab.el: Moving to a different project. + +2008-08-28 Marco (Bj) Bardelli + + * ede-gnustep.el: + removed (require 'ede-pmake) from `ede-proj-setup-buidenvironment' + +2008-08-07 Eric M. Ludlam + + * Makefile (lisp_LISP): Add ede-gnustep.el + + * Project.ede ("lisp"): Add ede-gnustep.el + + * ede-gnustep.el (require ede): + Unquote. Move require of ede-proj here. + +2008-08-04 Marco (Bj) Bardelli + + * ede-gnustep.el: Initial import. + create a basic GNUmakefile to work with GNUstep-Make. + +2008-07-03 Eric M. Ludlam + + * wisent-php.el (copyright): Fix FSF name. + +2008-06-28 Eric M. Ludlam + + * wisent-php.wy: + Replaced all occurances of php-tag to just php in comments. + (wisent-php-lexer): Renamed. + +2008-06-26 Eric M. Ludlam + + * Makefile (wy_SEMANTIC_GRAMMAR): Add wisent-php.wy + (wy_SEMANTIC_GRAMMAR_EL): Add wisent-php-wy.el + (lisp_LISP): Add wisent-php.el + + * Project.ede ("wy"): Add wisent-php.wy + ("lisp"): Add wisent-php.el + + * wisent-php.el, wisent-php.wy: PHP parser support. + +2008-05-19 Eric M. Ludlam + + * semantic-matlab.el: Replace contents with notify. + +2008-05-16 Eric M. Ludlam + + * semantic-matlab.el (semantic-matlab-match-function-re): + Update to handle a non-bracketed + output variable. + +2008-05-14 Eric M. Ludlam + + * semantic-matlab.el (semantic-matlab-match-function-re): Fix. + (semantic-matlab-function-tags): Wrap error prone fcns in condition-case + Add omit-nulls arg to split-string. + (semantic-matlab-parse-region): Make sure the parse functions + doesn't throw an error. + +2008-04-14 Eric M. Ludlam + + * Makefile (LOADPATH): Added ede to load path. + (VERSION): Udated to 1.0pre5 + + * Project.ede ("Contrib"): Updated to 1.0pre5 + + * cedet-contrib.el (cedet-contrib-version): Updated to 1.0pre5 + +2008-02-23 Anton V. Belyaev + + * eassist.el: + + EAssist: set line to current function initially + +2008-02-21 Eric M. Ludlam + + * semantic-matlab.el (semantic-matlab-match-function-re): + Fix expression to handle space + between fcn name and optional arg list. + +2007-08-31 Eric M. Ludlam + + * wisent-ruby.el (semantic-lex-ruby-hashes): Fix space finding regexps. + (semantic-lex-ruby-assigned-vars): New var to fix byte-compiler + (wisent-ruby-expand-tags): Fix quote-in of . + +2007-08-29 Anton V. Belyaev + + * eassist.el: Header-body switch improvement + + * INSTALL, eassist.el: Some fixes in EAssist documentation + +2007-08-26 Dan Debertin + + * Makefile: Added wisent-ruby.el/wy. + + * Project.ede: Added wisent-ruby.el/wy + + * wisent-ruby.wy, wisent-ruby.el: Initial import. + +2007-08-09 Eric M. Ludlam + + * Makefile (lisp_LISP): Added eassist. + + * Project.ede ("Contrib"): Add eassist. + + * eassist.el: Fixed spelling in commentary. + (eassist-buffer, eassist-names-column, eassist-methods, eassist-actual-methods) + (eassist-search-string, eassist-overlays): Added to silence warnings. + + * eassist.el: + EAssist, as emailed to me by Anton Belyaev on June 23, 2007. + + * INSTALL: Add eassist install instructions. + +2007-06-06 Eric M. Ludlam + + * Makefile (VERSION): Regress version to prerelease 4. + + * Project.ede ("Contrib"): Regress version to prerelease 4. + + * cedet-contrib.el (cedet-contrib-version): + Regress back to prerelease 4 + +2007-03-18 Eric M. Ludlam + + * Makefile (LOADPATH): Stripped out dups + (wy_SEMANTIC_GRAMMAR_EL, dist): Spelling fix + +2007-02-18 Eric M. Ludlam + + * Makefile (lisp_LISP): Add semanticdb-javascript.el + + * Project.ede ("lisp"): Add semanticdb-javascript.el + + * wisent-csharp.el (semantic-format): Fix byte-comp warnings + +2007-02-03 Eric M. Ludlam + + * semanticdb-javascript.el: Added better commentary. + + * semantidb-javascript.el: File name typo. + + * semanticdb-javascript.el, semantidb-javascript.el: + Semanticdb Javascript support. + +2006-07-29 Eric M. Ludlam + + * wisent-csharp.el (wisent-csharp-lex-ignore-region,wisent-csharp-lex-ignore-endregion): + Analyze begin/end region + (wisent-csharp-lexer): Use new lexers + +2006-02-08 Eric M. Ludlam + + * Project.ede (:version): updated (removed means 1.0) + + * Makefile (VERSION): updated + + * cedet-contrib.el (cedet-contrib-version): Updated + +2005-09-30 Eric M. Ludlam + + * wisent-javascript-jv.wy, wisent-javascript.el, wisent-csharp.wy, wisent-csharp.el, semantic-tag-folding.el, semantic-matlab.el, cedet-contrib-load.el, cedet-contrib.el: + Update all GPL headers with script from savannah.gnu.org. + +2005-06-30 Eric M. Ludlam + + * cedet-contrib.el (cedet-contrib-version): Updated. + + * Project.ede (:version): Updated. + + * Makefile (VERSION): Updated. + + * semantic-tag-folding.el: + toplevel: Ran checkdoc, cleaned out errant white space. + (semantic-tag-folding-get-fold-state): Doc fix. + +2005-05-11 Suraj Acharya + + * semantic-tag-folding.el (semantic-tag-folding-mode-setup): + set line-move-ignore-invisible to t + in xemacs so that the cursor does not go into hidden text. This is the + default in Gnu Emacs. + (semantic-tag-folding-get-fold-state) + (semantic-tag-folding-set-fold-state) + (semantic-tag-folding-get-attribute-overlay, + (semantic-tag-folding-get-folding-attribute): new functions to get and + set the fold state along with some helper functions. The fold state + now goes into an overlay at the start of the tag so that full reparse + does not lose the fold state. + (semantic-tag-folding-create-folding-overlays) + (semantic-tag-folding-set-overlay-visibility): use the new fold state + get/set functions instead of having the code inline. Also some better + comments. + +2005-05-08 Suraj Acharya + + * semantic-tag-folding.el: + (semantic-tag-folding-create-folding-overlays,semantic-tag-folding-get-overlay) + (semantic-tag-folding-highlight-overlay): use the compatability layer + in semantic-fw instead of calling the Gnu Emacs overlay-* functions. + (semantic-tag-folding-mode-setup,semantic-tag-folding-highlight-default): + removed errors when these functions are run under Xemacs. + (semantic-tag-folding-highlight-default): check if we reach the + beginning of the buffer while moving backwards over comments to + determine the extent of comment blocks. Gnu Emacs doesn't require this + check because (forward-comment -1) returns nil when point is at the + beginning of the buffer. + +2005-05-06 Eric M. Ludlam + + * Project.ede ("Contrib"): Updated version number. + + * Makefile (VERSION): Update version + (autoloads, init, setup, lisp): Quotes around EMACS. + + * INSTALL: Remove matlab, it doesn't work yet. + + * cedet-contrib.el (cedet-contrib-version): Update version. + +2005-05-05 Suraj Acharya + + * semantic-tag-folding.el (global-semantic-tag-folding-mode): + throw an error if + define-fringe-bitmap is not present + (semantic-tag-folding-mode-setup): throw different errors for the + cases when the current buffer is not parsable by semantic and when + define-fringe-bitmap is not present. + + * semantic-tag-folding.el (semantic-tag-folding-set-fringe-image-style): + XEmacs doesn't + recognize #B..... as a binary number, so I changed it to #b.... which + both Gnu Emacs and XEmacs can read. + +2005-04-29 Suraj Acharya + + * semantic-tag-folding.el: + Use functionp instead of symbolp to distinguish between the cases + where semantic-tag-folding-function is a t or nil rather than a function + name. The values t and nil are used in semantic-tag-fold-all and + semantic-tag-show-all respectively. + Minor edit in function semantic-tag-folding-fold-or-show-tags to put + the when and lexical-let on separate lines. + + * semantic-tag-folding.el: + The default value of semantic-tag-folding-allow-folding-of says that + everything is to be considered for folding and but nothing is folded + by default. + Allow `block tags to folded. + Fixed a fold state determining bug in + semantic-tag-folding-create-folding-overlays where + semantic-tag-folding-allow-folding-of was mostly ignored. + Wrap a (when (semantic-tag-buffer tag) ...) around the body of + semantic-tag-folding-highlight-default. This was throwing an error + when the revert-file command was run. + Removed the compilation warning in function + semantic-tag-folding-set-fringe-image-style by not refering directly + to variable semantic-tag-folding-fringe-image-style. + +2005-04-24 Eric M. Ludlam + + * Makefile (lisp_LISP): Removed semantic-matlab.el + + * Project.ede: Removed semantic-matlab.el - it is too buggy. + +2005-04-22 Eric M. Ludlam + + * cedet-contrib.el (cedet-contrib-version): Update Version. + +2005-04-19 Eric M. Ludlam + + * Makefile (lisp_LISP): Added semantic-tag-folding.el + (VERSION): Updated. + + * Project.ede ("Contrib"): Update Name and version number. + + * INSTALL: + Provides specific install instructions for all files in contrib. + +2005-04-18 Eric M. Ludlam + + * semantic-matlab.el (semantic-matlab-match-function-re): Simplified + (semantic-matlab-function-tags): Tidy up to use above. + + * semantic-tag-folding.el (semantic-tag-folding-fringe-image-style): + Moved (again). + (semantic-tag-folding-allow-folding-of) + (semantic-tag-folding-set-fringe-image-style) + (semantic-tag-folding-function-default) + (semantic-tag-folding-p-default) + (semantic-tag-folding-highlight-default) + (semantic-tag-folding-create-folding-overlays): Reindented some lines. + + * semantic-tag-folding.el (global-semantic-tag-folding-mode): + Add autoload cookie. + + * semantic-tag-folding.el (global-semantic-tag-folding-mode): + Swapped location of var/fcn. + (semantic-tag-folding-decoration-mode-hook-enabled): Moved + (semantic-decoration-mode-hook): Moved + (semantic-tag-folding-fringe-image-style): Moved + + * Project.ede: Added semantic-tag-folding.el + + * semantic-tag-folding.el: New minor mode by Suraj Acharya. + +2005-02-03 Eric M. Ludlam + + * cedet-contrib.el (cedet-contrib-version): Updated version number + + * Makefile (VERSION): Updated version number + + * Project.ede (Contrib): Update version number. + +2005-01-16 Eric M. Ludlam + + * semantic-matlab.el (matlab): Make matlab.el optional. + + * Makefile: Updated from project file (v 1.7) + + * Project.ede: Added semantic-matlab.el, and javascript support. + + * wisent-javascript-jv.wy: + Javascript parsing. Large portions translated by Joakim Verona. + + * wisent-javascript.el: + Support parsing of Javascript with wisent-javascript-jv.wy + + * semantic-matlab.el: + Simple parser for handling MATLAB M code files with new nested functions. + +2004-07-20 Eric M. Ludlam + + * Makefile (misc_AUX): New + (dist): Add misc_AUX + + * Project.ede ("misc"): New target. + +2004-05-25 David Ponce + + * Makefile: Re-generated to start Emacs with --no-site-file. + +2004-04-06 Eric M. Ludlam + + * Makefile (dist): Distribute the autoload file + +2004-03-30 David Ponce + + * Makefile: Rebuild. + + * Project.ede ("Contrib"): Set :metasubproject to true. + +2004-03-28 David Ponce + + * Makefile: Rebuild. + + * Project.ede (ede-proj-project): Add :version. + (init, setup): New targets. + (lisp): Move cedet-contrib.el to setup target. Add dependency on + inversion and speedbar. + (Wisent_Languages): Rename target to "wy". + + * wisent-csharp.el (wisent-csharp-default-setup): Add autoload cookie. + + * cedet-contrib.el (cedet-contrib-version): New variable. + (load): Move into cedet-contrib-load.el. + + * cedet-contrib-load.el: New file. + +2004-03-28 Eric M. Ludlam + + * cedet-contrib.el: Bootstrapping for the contrib directory. + + * Makefile: Regenerated from project file. + + * Project.ede: Add needed bits to make this compile. + +2004-03-25 David Ponce + + * wisent-csharp.el (semantic-wisent): Require instead of wisent-bovine. + +2003-12-21 Eric M. Ludlam + + * Makefile: Contrib directory Makefile + + * Project.ede: Removed space from a target name. + + * Project.ede: Project for contributed files. + + * wisent-csharp.el: CSharp Wisent support code. + + * wisent-csharp.wy: CSharp Wisent definition. + diff --git a/site/cedet-1.0pre7/contrib/Makefile b/site/cedet-1.0pre7/contrib/Makefile new file mode 100644 index 0000000..322069e --- /dev/null +++ b/site/cedet-1.0pre7/contrib/Makefile @@ -0,0 +1,103 @@ +# Automatically Generated Makefile by EDE. +# For use with: make +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +top= +ede_FILES=Project.ede Makefile + +misc_AUX=ChangeLog +wy_SEMANTIC_GRAMMAR=wisent-csharp.wy wisent-ruby.wy wisent-php.wy +EMACSFLAGS=-batch --no-site-file +EMACS=emacs +LOADPATH= ../common/ ../ede/ ../semantic/ ../eieio/\ + ../semantic/bovine/ ../speedbar/ ../semantic/wisent/ +LOADDEFS=contrib-loaddefs.el +LOADDIRS=. +init_LISP=cedet-contrib-load.el +ELISPPRELOAD= cedet-compat +setup_LISP=cedet-contrib.el +wy_SEMANTIC_GRAMMAR_EL=wisent-csharp-wy.el wisent-ruby-wy.el wisent-php-wy.el +lisp_LISP=wisent-csharp.el semantic-tag-folding.el eassist.el wisent-ruby.el wisent-php.el ede-gnustep.el semantic-ectag-scala.el +VERSION=1.0pre7 +DISTDIR=$(top)Contrib-$(VERSION) + + + +all: autoloads init setup wy lisp + +.PHONY: autoloads +autoloads: + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(require 'cedet-autogen)" >> $@-compile-script + "$(EMACS)" -batch --no-site-file -l $@-compile-script -f cedet-batch-update-autoloads $(LOADDEFS) $(LOADDIRS) + +.PHONY: init +init: $(init_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: setup +setup: $(setup_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +.PHONY: wy +wy: $(wy_SEMANTIC_GRAMMAR) + @echo "(add-to-list 'load-path nil)" > grammar-make-script + @for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> grammar-make-script; \ + done; + @echo "(require 'semantic-load)" >> grammar-make-script + @echo "(require 'semantic-grammar)" >> grammar-make-script + "$(EMACS)" -batch --no-site-file -l grammar-make-script -f semantic-grammar-batch-build-packages $^ + +.PHONY: lisp +lisp: $(lisp_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + for loadpath in . ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done; + for preload in ${ELISPPRELOAD}; do \ + echo "(load \"$$preload\")" >> $@-compile-script; \ + done; + @echo "(setq debug-on-error t)" >> $@-compile-script + "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ + +tags: + + +clean: + rm -f *.elc + +.PHONY: dist + +dist: autoloads $(wy_SEMANTIC_GRAMMAR_EL) + mkdir $(DISTDIR) + cp $(misc_AUX) contrib-loaddefs.el $(init_LISP) $(setup_LISP) $(wy_SEMANTIC_GRAMMAR) $(wy_SEMANTIC_GRAMMAR_EL) $(lisp_LISP) $(ede_FILES) $(DISTDIR) + +Makefile: Project.ede + @echo Makefile is out of date! It needs to be regenerated by EDE. + @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. + @false + + + +# End of Makefile diff --git a/site/cedet-1.0pre7/contrib/Project.ede b/site/cedet-1.0pre7/contrib/Project.ede new file mode 100644 index 0000000..d37d3df --- /dev/null +++ b/site/cedet-1.0pre7/contrib/Project.ede @@ -0,0 +1,45 @@ +;; Object Contrib +;; EDE project file. +(ede-proj-project "Contrib" + :name "Contrib" + :version "1.0pre7" + :file "Project.ede" + :targets (list + (ede-proj-target-aux "misc" + :name "misc" + :path "" + :source '("ChangeLog") + ) + (ede-proj-target-elisp-autoloads "autoloads" + :name "autoloads" + :path "" + :autoload-file "contrib-loaddefs.el" + ) + (ede-proj-target-elisp "init" + :name "init" + :path "" + :source '("cedet-contrib-load.el") + :compiler 'ede-emacs-preload-compiler + :pre-load-packages '("cedet-compat") + ) + (ede-proj-target-elisp "setup" + :name "setup" + :path "" + :source '("cedet-contrib.el") + :versionsource '("cedet-contrib.el") + ) + (semantic-ede-proj-target-grammar "wy" + :name "wy" + :path "" + :source '("wisent-csharp.wy" "wisent-ruby.wy" "wisent-php.wy") + ) + (ede-proj-target-elisp "lisp" + :name "lisp" + :path "" + :source '("wisent-csharp.el" "semantic-tag-folding.el" "eassist.el" "wisent-ruby.el" "wisent-php.el" "ede-gnustep.el" "semantic-ectag-scala.el") + :compiler 'ede-emacs-preload-compiler + :aux-packages '("semantic-grammar" "wisent" "inversion" "speedbar" "semantic-el") + ) + ) + :metasubproject 't + ) diff --git a/site/cedet-1.0pre7/contrib/cedet-contrib-load.el b/site/cedet-1.0pre7/contrib/cedet-contrib-load.el new file mode 100644 index 0000000..473957d --- /dev/null +++ b/site/cedet-1.0pre7/contrib/cedet-contrib-load.el @@ -0,0 +1,37 @@ +;;; cedet-contrib-load.el --- Autoload definitions for cedet contrib + +;;; Copyright (C) 2004 Eric Ludlam + +;; Author: Eric Ludlam +;; X-RCS: $Id: cedet-contrib-load.el,v 1.2 2005/09/30 20:15:51 zappo Exp $ + +;; CEDET is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Initialize CEDET's contributed libraries for all supported +;; conditions. + +;;; Code: +;; + +;;; Contrib autoloads +;; +(load "contrib-loaddefs" nil t) + +(provide 'cedet-contrib-load) + +;;; cedet-contrib-load.el ends here diff --git a/site/cedet-1.0pre7/contrib/cedet-contrib.el b/site/cedet-1.0pre7/contrib/cedet-contrib.el new file mode 100644 index 0000000..2ce9ca0 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/cedet-contrib.el @@ -0,0 +1,35 @@ +;;; cedet-contrib.el --- Setup CEDET's contrib environment + +;;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Eric Ludlam + +;; Author: Eric Ludlam +;; X-RCS: $Id: cedet-contrib.el,v 1.12 2009/03/19 00:42:59 zappo Exp $ + +(defvar cedet-contrib-version "1.0pre7" + "Current version of contributed libraries.") + +;; CEDET is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; Setup environment of CEDET's contributed libraries. + +;;; Code: +;; + +(provide 'cedet-contrib) + +;;; cedet-contrib.el ends here diff --git a/site/cedet-1.0pre7/contrib/contrib-loaddefs.el b/site/cedet-1.0pre7/contrib/contrib-loaddefs.el new file mode 100644 index 0000000..46bb211 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/contrib-loaddefs.el @@ -0,0 +1,116 @@ +;;; contrib-loaddefs.el --- Auto-generated CEDET autoloads +;; +;;; Code: + + +;;;### (autoloads (eassist-list-methods eassist-switch-h-cpp) "eassist" +;;;;;; "eassist.el" (19326 59186)) +;;; Generated autoloads from eassist.el + +(defvar eassist-header-switches '(("h" "cpp" "cc" "c") ("hpp" "cpp" "cc") ("cpp" "h" "hpp") ("c" "h") ("C" "H") ("H" "C" "CPP" "CC") ("cc" "h" "hpp")) "\ +This variable defines possible switches for `eassist-switch-h-cpp' function. +Its format is list of (from . (to1 to2 to3...)) elements. From and toN are +strings which are extentions of the files.") + +(autoload 'eassist-switch-h-cpp "eassist" "\ +Switch header and body file according to `eassist-header-switches' var. +The current buffer's file name extention is searched in +`eassist-header-switches' variable to find out extention for file's counterpart, +for example *.hpp <--> *.cpp. + +\(fn)" t nil) + +(autoload 'eassist-list-methods "eassist" "\ +Show method/function list of current buffer in a newly created buffer. +This function is recommended to be bound to some convinient hotkey. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "ede-gnustep" "ede-gnustep.el" (19326 59186)) +;;; Generated autoloads from ede-gnustep.el + +(add-to-list 'ede-project-class-files (ede-project-autoload "edegnustep" :name "GNUstep-Make" :file 'ede-gnustep :proj-file "ProjStep.ede" :load-type 'ede-step-load :class-sym 'ede-step-project) t) + +(add-to-list 'ede-project-class-files (ede-project-autoload "gnustep-root" :name "GNUstep-make Top Most" :file 'ede-gnustep :proj-file "RootProjStep.ede" :initializers '(:project-mode scanner) :load-type 'ede-gnustep-load :class-sym 'ede-step-project) t) + +(add-to-list 'ede-project-class-files (ede-project-autoload "gnustep" :name "GNUstep-Make in scanner mode" :file 'ede-gnustep :proj-file "ProjStep.ede" :initializers '(:project-mode scanner) :load-type 'ede-gnustep-load :class-sym 'ede-step-project) t) + +(add-to-list 'auto-mode-alist '("\\(Root\\)?ProjStep\\.ede" . emacs-lisp-mode)) + +;;;*** + +;;;### (autoloads (semantic-tag-folding-mode global-semantic-tag-folding-mode +;;;;;; global-semantic-tag-folding-mode) "semantic-tag-folding" +;;;;;; "semantic-tag-folding.el" (19070 8986)) +;;; Generated autoloads from semantic-tag-folding.el + +(defvar global-semantic-tag-folding-mode nil "\ +*If non-nil enable global use of variable `semantic-tag-folding-mode'. +With this mode enabled, a new folding decoration mode is added. +Clicking on a + or - in the fringe will fold that tag.") + +(custom-autoload 'global-semantic-tag-folding-mode "semantic-tag-folding" nil) + +(autoload 'global-semantic-tag-folding-mode "semantic-tag-folding" "\ +Toggle global use of option `semantic-tag-folding-mode'. +If ARG is positive, enable, if it is negative, disable. +If ARG is nil, then toggle. + +\(fn &optional ARG)" t nil) + +(autoload 'semantic-tag-folding-mode "semantic-tag-folding" "\ +Minor mode mark semantic tags for folding. +This mode will display +/- icons in the fringe. Clicking on them +will fold the current tag. +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the +minor mode is enabled. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads (wisent-csharp-default-setup) "wisent-csharp" "wisent-csharp.el" +;;;;;; (17880 37474)) +;;; Generated autoloads from wisent-csharp.el + +(autoload 'wisent-csharp-default-setup "wisent-csharp" "\ +Not documented + +\(fn)" nil nil) + +(add-hook 'csharp-mode-hook #'wisent-csharp-default-setup) + +;;;*** + +;;;### (autoloads (wisent-php-default-setup) "wisent-php" "wisent-php.el" +;;;;;; (18810 37948)) +;;; Generated autoloads from wisent-php.el + +(autoload 'wisent-php-default-setup "wisent-php" "\ +Hook run to setup Semantic in `php-mode'. +Use the alternate LALR(1) parser. + +\(fn)" nil nil) + +(add-hook 'php-mode-hook #'wisent-php-default-setup) + +;;;*** + +;;;### (autoloads nil nil ("cedet-contrib-load.el" "cedet-contrib.el" +;;;;;; "semantic-ectag-scala.el" "wisent-csharp-wy.el" "wisent-php-wy.el" +;;;;;; "wisent-ruby-wy.el" "wisent-ruby.el") (19335 11026 97488)) + +;;;*** + +(provide 'contrib-loaddefs) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; contrib-loaddefs.el ends here diff --git a/site/cedet-1.0pre7/contrib/eassist.el b/site/cedet-1.0pre7/contrib/eassist.el new file mode 100644 index 0000000..6132f77 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/eassist.el @@ -0,0 +1,388 @@ +;;; eassist.el --- EmacsAssist, C/C++/Java/Python/ELisp method/function navigator. + +;; Copyright (C) 2006, 2007, 2010 Anton V. Belyaev +;; Author: Anton V. Belyaev + +;; This file is *NOT* part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of +;; the License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be +;; useful, but WITHOUT ANY WARRANTY; without even the implied +;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +;; PURPOSE. See the GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public +;; License along with this program; if not, write to the Free +;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +;; MA 02111-1307 USA + +;; Version: 0.9 +;; CEDET CVS Version: $Id: eassist.el,v 1.7 2010/02/08 23:29:59 zappo Exp $ + +;; Compatibility: Emacs 22 or 23, CEDET 1.0pre4 + +;;; Commentary: + +;; Contains some useful functions features for C/C++ developers similar to +;; those from VisualAssist. Remember that convenient M-o, M-g and M-m? + +;; 1) Method navigation. +;; When eassist-list-methods called when c/c++ body file buffer is active +;; a new buffer is shown, containing list of methods and functions in the +;; format: return type, class, method name. You can select the method +;; moving to its line and press ENTER to jump to the method. You also can +;; type a string in the buffer and method list will be reduced to those +;; which contain the string as a substring. Nice highlight is implemented. +;; This function is recommended to be bound to M-m in c-mode. + +;; 2) Header <-> Body file switch. +;; You can easily switch between body (c, cpp, cc...) and its corresponding +;; header file (h, hpp...) using eassist-switch-h-cpp. The counterpart file +;; is first searched in opened buffers and if there is no match the file is +;; searched in the same directory. You can adjust body to header correspondence +;; customizing eassist-header-switches variable. +;; This function is recommended to be bound to M-o in c-mode. + +;; EmacsAssist uses Semantic (http://cedet.sourceforge.net/semantic.shtml) +;; EmacsAssist is a part of CEDET project (current CVS version of CEDET contains +;; EmacsAssist) +;; EmacsAssist works with current (22) and development (23) versions of Emacs and +;; does not work with version 21. +;; EmacsAssist works with CEDET 1.0pre4 and subsequent CVS versions of CEDET. + +;; EmacsAssist has a page at Emacs Wiki, where you can always find the latest +;; version: http://www.emacswiki.org/cgi-bin/wiki/EAssist + +;; Usage: + +;; 1) Install CEDET package for Emacs (if you don't have CEDET already). +;; 2) Add convenient keymaps for fast EmacsAssist calls in c-mode and (or) python-mode +;; and for lisp: +;; +;; (defun my-c-mode-common-hook () +;; (define-key c-mode-base-map (kbd "M-o") 'eassist-switch-h-cpp) +;; (define-key c-mode-base-map (kbd "M-m") 'eassist-list-methods)) +;; (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) +;; +;; (defun my-python-mode-hook () +;; (define-key python-mode-map (kbd "M-m") 'eassist-list-methods)) +;; (add-hook 'python-mode-hook 'my-python-mode-hook) +;; +;; (define-key lisp-mode-shared-map (kbd "M-m") 'eassist-list-methods) +;; +;; 3) Open any C++ file with class definition, press M-m. Try to type +;; any method name. +;; 4) Open any .cpp file. Press M-o. If there is .h or .hpp file in the +;; same folder, it will be opened. + +;;; Changelog: + +;; 27 mar 2006 -- v0.1 Initial version created. +;; 29 mar 2006 -- v0.2 Code is more readable now. +;; Thanks to Thien-Thi Nguyen for code review! +;; 17 apr 2006 -- v0.3 Added Java and Python support. Coloring based on faces. +;; Multiple string matching. +;; 12 sep 2006 -- v0.4 Fixed ELisp code handling. Reduced string matching to function name only. +;; 23 feb 2007 -- v0.5 Added (require 'semantic) to fix possible issues. +;; Thanks to Damien Deville for the patch. +;; 13 mar 2007 -- v0.6 Added documentation to functions. +;; Thanks to Eric Ludlam for CHECKDOC tool suggestion. +;; 23 jun 2007 -- v0.7 EAssist is now a part of CEDET project. +;; Added autoload cookies for some vars and funs. +;; 29 aug 2007 -- v0.8 "M-o" function now tries first to use already opened buffers +;; and if there are no counterparts, tries to search them in the +;; current directory. +;; Thanks to Alekseenko Dimitry for great feature suggestion. +;; 23 feb 2008 -- v0.9 "M-m" buffer comes up with current function highlighted. +;; Thanks to Christoph Conrad for great suggestions and patches. + +;;; Code: + +(require 'semantic) + +;; ================================== My STRING utils ======================== +(defun eassist-string-without-last (string n) + "This function truncates from the STRING last N characters." + (substring string 0 (max 0(- (length string) n)))) + +(defun eassist-string-ends-with (string end) + "Check whether STRING ends with END substring." + (string= end (substring string (- (length end))))) +;; ================================== My STRING utils end ==================== + +;; ================================== CPP-H switch =========================== +;;;###autoload +(defvar eassist-header-switches '(("h" . ("cpp" "cc" "c")) + ("hpp" . ("cpp" "cc")) + ("cpp" . ("h" "hpp")) + ("c" . ("h")) + ("C" . ("H")) + ("H" . ("C" "CPP" "CC")) + ("cc" . ("h" "hpp"))) + "This variable defines possible switches for `eassist-switch-h-cpp' function. +Its format is list of (from . (to1 to2 to3...)) elements. From and toN are +strings which are extentions of the files.") + +;;;###autoload +(defun eassist-switch-h-cpp () + "Switch header and body file according to `eassist-header-switches' var. +The current buffer's file name extention is searched in +`eassist-header-switches' variable to find out extention for file's counterpart, +for example *.hpp <--> *.cpp." + (interactive) + (let* ((ext (file-name-extension (buffer-file-name))) + (base-name (eassist-string-without-last (buffer-name) (length ext))) + (base-path (eassist-string-without-last (buffer-file-name) (length ext))) + (count-ext (cdr (find-if (lambda (i) (string= (car i) ext)) eassist-header-switches)))) + (cond + (count-ext + (unless + (or + (loop for b in (mapcar (lambda (i) (concat base-name i)) count-ext) + when (bufferp (get-buffer b)) return + (if (get-buffer-window b) + (switch-to-buffer-other-window b) + (if (get-buffer-window b t) + (switch-to-buffer-other-frame b) + (switch-to-buffer b)))) + (loop for c in (mapcar (lambda (count-ext) (concat base-path count-ext)) count-ext) + when (file-exists-p c) return (find-file c))) + (message "There is no corresponding pair (header or body) file."))) + (t + (message "It is not a header or body file! See eassist-header-switches variable."))))) +;; ================================== CPP-H switch end ========================= + +;; ================================== Method navigator ========================= +(defvar eassist-current-tag nil + "Current Semantic tag in source buffer.") +(defvar eassist-buffer nil + "Buffer used to selecting tags in EAssist.") +(defvar eassist-names-column nil + "Column used when selecting tags in EAssist.") +(defvar eassist-methods nil + "Collection of methods used when searching for current selection.") +(defvar eassist-actual-methods nil + "Collection of actual methods used when searching for current selection.") +(defvar eassist-search-string nil + "The current search string during a search.") +(defvar eassist-overlays nil + "List of active overlays.") + +(defun eassist-function-tags () + "Return all function tags from the current buffer using Semantic API. +The function first gets all toplevel function tags from the current buffer. +Then it searches for all toplevel type tags and gets all function tags that +are children to toplevel type tags. Secondlevel function (member) tags are +annotated (without side effect) with :parent attribute to have the same +structure as toplevel function tags." + (nconc + ;; for C++/C + (semantic-find-tags-by-class 'function (semantic-something-to-tag-table eassist-buffer)) + ;; for Java and Python: getting classes and then methods for each class. + ;; Adding parent property for each method, beacause semantic does not provide parents for + ;; methods which are inside body of the class. This is true for Java class methods, + ;; for C++ header definitions and for Python class methods. + (mapcan + (lambda (type) + (mapcar + (lambda (tag) (semantic-tag-put-attribute-no-side-effect tag :parent (semantic-tag-name type))) + (semantic-find-tags-by-class 'function (semantic-tag-type-members type)))) + (semantic-find-tags-by-class 'type (semantic-something-to-tag-table eassist-buffer))))) + +(defun eassist-car-if-list (thing) + "Return car of THING if it is a list or THING itself, if not." + (cond ((listp thing) (car thing)) + (t thing))) + +(defun eassist-function-string-triplet (f) + "Return a list of three strings, representing type, parent and name of tag F." + (list + (eassist-car-if-list (semantic-tag-type f)) + (semantic-tag-function-parent f) + (semantic-tag-name f))) + +(defun eassist-format-triplets (f) + "Return a list of formatted (whitespaces, faces, delimeters) methods/function. +F - list of triplets of tag type, parent and name." + (let ((return-width (reduce 'max (mapcar 'length (mapcar 'car f)) :initial-value 0)) + (class-width (reduce 'max (mapcar 'length (mapcar 'cadr f)) :initial-value 0)) + (name-width (reduce 'max (mapcar 'length (mapcar 'caddr f)) :initial-value 0))) + (setq eassist-names-column (+ return-width class-width 4)) + (mapcar + (lambda (tri) + (let ((retrn (car tri)) + (class (cadr tri)) + (name (caddr tri))) + (setq retrn (if retrn (propertize retrn 'face 'font-lock-type-face) "")) + (if class + (setq class (propertize class 'face 'font-lock-type-face))) + (setq name (propertize name 'face 'font-lock-function-name-face)) + (cond + (class (format (format "%%%ds %%%ds :: %%s\n" return-width class-width) retrn class name)) + (t (format (format "%%%ds %%%ds %%s\n" return-width class-width) retrn "" name))))) + f))) + +;;;###autoload +(defun eassist-list-methods () + "Show method/function list of current buffer in a newly created buffer. +This function is recommended to be bound to some convinient hotkey." + (interactive) + (setq eassist-buffer (current-buffer)) + (setq eassist-current-tag (semantic-current-tag)) + (switch-to-buffer (get-buffer-create (concat (buffer-name (current-buffer)) " method list")) t) + (eassist-mode)) + +(defun eassist-jump-to-method () + "Jump to a method/function, corresponding the current line in method buffer. +When called standing on a line of method/function list, it closes the list +buffer and sets the point to a method/function, corresponding the line." + (interactive) + (let ((method-record (nth (1- (line-number-at-pos)) eassist-actual-methods))) + (cond + (method-record + (kill-buffer (current-buffer)) + (switch-to-buffer eassist-buffer t) + (goto-char (eassist-method-position method-record)) + (recenter)) + (t (message "The line does not contain method description!"))))) + +(defun eassist-matches-all (string substrings) + "Return non-nil if STRING contain each of SUBSTRINGS as a substring." + (reduce (lambda (prev part) (and prev (string-match part string))) substrings :initial-value t)) + +(defun eassist-search-string-updated () + "Update method/function list according to search string." + (message eassist-search-string) + (setq eassist-actual-methods + (remove-if-not + (lambda (elt) (eassist-matches-all (eassist-method-name elt) (split-string eassist-search-string))) + eassist-methods)) + (erase-buffer) + (dolist (i eassist-overlays) + (delete-overlay i)) + (setq eassist-overlays nil) + (loop for i in (mapcar 'eassist-method-full-line eassist-actual-methods) + with pos = 1 + with strings = (split-string eassist-search-string) + do + (insert i) + (dolist (j strings) + (let ((p (string-match j i eassist-names-column))) + (when p + (push (make-overlay (+ pos p) (+ pos p (length j))) eassist-overlays) + (overlay-put (car eassist-overlays) 'face '(background-color . "yellow"))))) + (setq pos (+ pos (length i)))) + (goto-line (/ (count-lines (point-min) (point-max)) 2))) + +(defun eassist-key-pressed (key) + "Called when KEY is pressed." + (setq eassist-search-string (concat eassist-search-string (char-to-string key))) + (eassist-search-string-updated)) + +(defun eassist-backspace-pressed () + "Called when Backspace is pressed." + (interactive) + (setq eassist-search-string (eassist-string-without-last eassist-search-string 1)) + (eassist-search-string-updated)) + +(defun eassist-make-key-function (key) + "Return a function for KEY." + `(lambda () (interactive) (eassist-key-pressed ,key))) + +(defun eassist-key-itself (map key) + "Maps in the MAP KEY to its function." + (define-key map (char-to-string key) (eassist-make-key-function key))) + +(defun eassist-escape () + "Kill method list buffer." + (interactive) + (kill-buffer (current-buffer)) + (switch-to-buffer eassist-buffer)) + +(defvar eassist-mode-map + (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (do ((k (string-to-char "a") (+ 1 k))) ((> k (string-to-char "z"))) + (define-key + map + (read-kbd-macro (char-to-string k)) + (eassist-make-key-function k))) + (do ((k (string-to-char "A") (+ 1 k))) ((> k (string-to-char "Z"))) + (define-key + map + (read-kbd-macro (char-to-string k)) + (eassist-make-key-function k))) + (do ((k (string-to-char "0") (+ 1 k))) ((> k (string-to-char "9"))) + (define-key + map + (read-kbd-macro (char-to-string k)) + (eassist-make-key-function k))) + (dolist (k (string-to-list "=><&!")) + (define-key + map + (read-kbd-macro (char-to-string k)) + (eassist-make-key-function k))) + + (eassist-key-itself map (string-to-char " ")) + (eassist-key-itself map (string-to-char "_")) + + (define-key map (kbd "") 'eassist-jump-to-method) + (define-key map (kbd "") 'eassist-backspace-pressed) + (define-key map (kbd "") 'eassist-escape) + map) + "Keymap for `eassist-mode'.") + +(defstruct eassist-method + (full-line) + (name) + (position) + (tag)) + +(defun eassist-mode-init () + "Initialize method/function list mode." + (make-local-variable 'eassist-search-string) ;; current method search string + (make-local-variable 'eassist-methods) ;; list of eassist-method structures + (make-local-variable 'eassist-actual-methods) ;; subset of eassist-methods that contain eassist-search string in the name string + (make-local-variable 'eassist-names-column) ;; this is the column where method name fields starts + (make-local-variable 'eassist-overlays) ;; overlays used to highligh search string matches in method names + (setq eassist-overlays nil) + (setq eassist-search-string "") + + (setq eassist-methods + (let* ((method-tags (eassist-function-tags)) + (method-triplets (mapcar 'eassist-function-string-triplet method-tags))) + (mapcar* '(lambda (full-line name position tag) + (make-eassist-method :full-line full-line :name name :position position :tag tag)) + (eassist-format-triplets method-triplets) + (mapcar 'caddr method-triplets) + (mapcar 'semantic-tag-start method-tags) + method-tags))) + (eassist-search-string-updated) + + ;; Set current line corresponding to the current function/method if any + (let ((line (position-if + (lambda (item) (eq eassist-current-tag (eassist-method-tag item))) + eassist-methods))) + (when line + (goto-line (1+ line)))) + + ;;(setq b1 (current-buffer)) + ;;(setq ov1 (make-overlay 1 30 b1)) + ;;(overlay-put ov1 'face '(background-color . "yellow")) + (hl-line-mode)) + +(define-derived-mode eassist-mode nil "Eassist methods" + "EmacsAssist method selection mode. + \\{eassist-mode-map} + Turning on Text mode runs the normal hook `eassist-mode-hook'." + (eassist-mode-init)) + +;; ================================== Method navigator end ====================== + +(provide 'eassist) + +;;; eassist.el ends here diff --git a/site/cedet-1.0pre7/contrib/ede-gnustep.el b/site/cedet-1.0pre7/contrib/ede-gnustep.el new file mode 100644 index 0000000..f7e80fe --- /dev/null +++ b/site/cedet-1.0pre7/contrib/ede-gnustep.el @@ -0,0 +1,1298 @@ +;;; ede-gnustep.el --- EDE GNUstep Project file driver + +;;; Copyright (C) 2008,2009 Marco Bardelli + +;; Author: Marco (Bj) Bardelli +;; Keywords: project, make, gnustep, gnustep-make +;; RCS: $Id: ede-gnustep.el,v 1.11 2010/01/09 23:05:05 safanaj Exp $ + +;; This software is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; GNUstep-Make is a system (a set of makefiles) to compile various object. +;; To write a functional GNUmakefile, we haven't to write any rule, +;; but only set some variables. + +;; #A tipical GNUmakefile to work with GNUstep-Make: + +;; ifeq ($(GNUSTEP_MAKEFILES),) +;; GNUSTEP_MAKEFILES := $(shell gnustep-config \ +;; --variable=GNUSTEP_MAKEFILES 2> /dev/null) +;; endif +;; INSTALLATION_DOMAIN = LOCAL +;; include $(GNUSTEP_MAKEFILES)/common.make +;; TOOL_NAME = xxx +;; APP_NAME = aaa +;; LIBRARY_NAME = lll + +;; xxx_C_FILES = xxx.c +;; aaa_OBJC_FILES = aaa.m +;; lll_C_FILES = lll.c +;; lll_OBJC_FILES = lll.m + +;; ... + +;; -include GNUmakefile.preamble +;; include $(GNUSTEP_MAKEFILES)/tool.make +;; include $(GNUSTEP_MAKEFILES)/application.make +;; include $(GNUSTEP_MAKEFILES)/library.make +;; -include GNUmakefile.postamble + +;; # end of Makefile +;; in this example we define three targets (xxx,aaa,lll) of several types. +;; various variables and rules should be added in preamble and postamble +;; respectively, for convention. +;; +;; I focused on the method `ede-proj-makefile-create' to write a working +;; GNUmakefile. + +;; Provide a class `ede-step-project' child of ede-project, it has a +;; :project-mode attribute for 'scanner or 'writer mode. +;; difference is in direction of generation +;; scanner: parse *makefile* to write *project file* +;; writer : parse *project file* to write *makefile* + +;; To show what's TODO +;; M-x occur XXX\|todo\|TODO\|fix\|FIX + + +(eval-and-compile + (require 'ede) + (require 'ede-proj) + (require 'makefile-edit) + ;; to easy parsing of GNUmakefiles + (require 'semantic) + (require 'semantic-find) + (require 'semantic-tag-file) + ) + +(unless (fboundp 'string-file-contents) + (defun string-file-contents (file) + "Get the plain contents of FILE." + (with-temp-buffer + (insert-file-contents file) + (buffer-substring-no-properties (point-min)(point-max)))) + ) + + + +;;; Class Definitions: +;; Source + +(defvar ede-source-gnustep-objc + (ede-sourcecode "ede-gnustep-source-objc" + :name "GNUsetp ObjC" + :sourcepattern "\\.m$" + :auxsourcepattern "\\.h$" + :garbagepattern '("*.o" "obj/*")) + "Objective-C source code definition (for using with GNUstep-make).") + +(defvar ede-source-header-gnustep-objc + (ede-sourcecode "ede-gnustep-source-header-objc" + :name "GNUsetp Header ObjC" + :sourcepattern "\\.h$" +;; :auxsourcepattern "\\.h$" + :garbagepattern nil) + "Objective-C source code definition (for using with GNUstep-make).") + +(defvar ede-source-gnustep-c + (ede-sourcecode "ede-gnustep-source-c" + :name "GNUsetp C" + :sourcepattern "\\.c$" + :auxsourcepattern "\\.h$" + :garbagepattern '("*.o" "obj/*")) + "C source code definition (for using with GNUstep-make).") + +(defvar ede-source-header-gnustep-c + (ede-sourcecode "ede-gnustep-source-header-c" + :name "GNUsetp Header C" + :sourcepattern "\\.h$" +;; :auxsourcepattern "\\.h$" + :garbagepattern nil) + "C source code definition (for using with GNUstep-make).") + +;; XXX @todo sources for C++ and Objective-C++ + +(defvar ede-source-gnustep-texi + (ede-sourcecode "ede-gnustep-source-texi" + :name "GNUsetp Texinfo" + :sourcepattern "\\.texi$" +; :auxsourcepattern "\\.h$" + :garbagepattern '("*.pdf" "*.info" "*.html")) + "Texinfo source definition (for using with GNUstep-make).") + + +;; Target +;(defclass ede-step-target (ede-proj-target) ;; may be don't need +(defclass ede-step-target (ede-target) + ((makefile :initarg :makefile ;;:initform "GNUmakefile" + :type string + :custom string + :label "Parent Makefile" + :group make + :documentation "File name of generated Makefile.") + (type :initarg :type + :initform ctool + :type symbol + :custom (choice (const ctool)(const tool) + (const library)(const clibrary) + (const application)(const documentation) + (const framework)(const bundle) + (const subproject)) + :label "Target Type" + :group make + :documentation "Type of GNUstep-Make target.") + (include-dirs :initarg :include-dirs + :initform nil + :type list + :custom (choice (const :tag "None" nil) + (repeat + (string :tag "Include dirs cpp flags"))) + :label "Include Dirs -I flags" + :group make + :documentation "Include directories like cpp flags -I. +Include some dir via the -I preprocessor flag, for this target.") + (auxsource :initarg :auxsource + :initform nil + :type list + :custom (repeat (string :tag "File")) + :label "Auxiliary Source Files" + :group (default source) + :documentation "Auxilliary source files included in this target. +Each of these is considered equivalent to a source file, but it is not +distributed, and each should have a corresponding rule to build it.") + (dirty :initform nil + :type boolean + :documentation "Non-nil when generated files needs updating.") + ) +"Abstract class for ede-step targets.") + +(defclass ede-step-target-ctool (ede-step-target) + ((sourcetype :initform (ede-source-gnustep-c + ede-source-header-gnustep-c)) + (type :initform 'ctool) + (cflags :initarg :cflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Compiler Flags"))) + (ldflags :initarg :ldflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Linker Flags")))) + "Class for CTool targets.") + +(defclass ede-step-target-tool (ede-step-target) + ((sourcetype :initform (ede-source-gnustep-objc + ede-source-gnustep-c + ede-source-header-gnustep-c + ede-source-header-gnustep-objc)) + (type :initform 'tool) + (cflags :initarg :cflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Compiler Flags"))) + (ldflags :initarg :ldflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Linker Flags")))) + "Class for Tool targets.") + +;; FIX XXX : _LIBS_DEPEND +(defclass ede-step-target-clibrary (ede-step-target) + ((sourcetype :initform (ede-source-gnustep-c + ede-source-header-gnustep-c)) + (type :initform 'clibrary) +;;; (header-install-dir :initarg :header-install-dir +;;; :initform "" +;;; :type string +;;; :group make +;;; :custom string +;;; :label "Header Installation Directory") + (cflags :initarg :cflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Compiler Flags"))) + (ldflags :initarg :ldflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Linker Flags")))) + "Class for CLib targets.") + +(defclass ede-step-target-library (ede-step-target) + ((sourcetype :initform (ede-source-gnustep-objc + ede-source-gnustep-c + ede-source-header-gnustep-objc + ede-source-header-gnustep-c)) + (type :initform 'library) +;;; (header-install-dir :initarg :header-install-dir +;;; :initform "" +;;; :type string +;;; :group make +;;; :custom string +;;; :label "Header Installation Directory") + (cflags :initarg :cflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Compiler Flags"))) + (ldflags :initarg :ldflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Linker Flags")))) + "Class for Lib targets.") + +(defclass ede-step-target-application (ede-step-target) + ((sourcetype :initform (ede-source-gnustep-objc + ede-source-gnustep-c + ede-source-header-gnustep-objc + ede-source-header-gnustep-c)) + (type :initform 'application) + (cflags :initarg :cflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Compiler Flags"))) + (ldflags :initarg :ldflags + :initform nil + :type list + :group make + :custom (repeat (string :tag "Linker Flags")))) + "Class for App targets.") + +(defclass ede-step-target-documentation (ede-step-target) + ((sourcetype :initform (ede-source-gnustep-texi)) + (type :initform 'documentation)) + "Class for Doc targets.") + +;; ;; (defclass ede-step-target-subproject (ede-step-target) +;; ;; () +;; ;; "Class for Subproject targets.") +;; (defclass ede-step-target-aggregate (ede-target) +;; () ;; this allow the parent to track subprojects in targets. +;; "Dummy class for aggregate target, really a subprojet.") +;; (defmethod project-rescan ((this ede-step-target-aggregate) &optional unused) +;; "A dummy method. Do nothing." nil) + +;;; XXX FIX: add files.make for inclusion (aka tool.make) +(defvar ede-step-target-alist + '(("ctool" ede-step-target-ctool "CTOOL_NAME") + ("objc" ede-step-target-tool "OBJC_PROGRAM_NAME") + ("tool" ede-step-target-tool "TOOL_NAME") + ("test-tool" ede-step-target-tool "TEST_TOOL_NAME") + ("app" ede-step-target-application "APP_NAME") + ("test-app" ede-step-target-application "TEST_APP_NAME") + ("doc" ede-step-target-documentation "DOCUMENT_NAME") + ("clib" ede-step-target-clibrary "CLIBRARY_NAME") + ("lib" ede-step-target-library "LIBRARY_NAME") + ("framework" ede-step-target-library "FRAMEWORK_NAME") + ("subproject" ede-step-project "SUBPROJECTS") + ) + "Alist of names to class target-types available by GNUstep-Make.") + +(defun ede-step-register-target (name class &optional macro) + "Register a new target class with NAME and class symbol CLASS. +This enables the creation of your target type." + (let ((a (assoc name ede-step-target-alist))) + (if a + (setcdr a (list class macro)) + (setq ede-step-target-alist + (cons (cons name class) ede-step-target-alist))))) + +;(defcustom ede-gnustep-project-mode-default 'scanner) + +(defclass ede-step-project (ede-project) +;(defclass ede-step-project (ede-proj-project) ;; to mix several project types, but don't solve ... + ((project-mode :initarg :project-mode :initform writer + :type symbol + :custom (choice (const :tag "Scanner Mode" scanner) + (const :tag "Writer Mode" writer)) + :group (settings) + :documentation "In scanner mode, `ede-proj-makefile-create' +is useless, the project-rescan methods change their behavoir to scan +GNUmakefiles, and possibly a ProjStep.ede could be created. In writer mode, +the behavoir is the same that in any ede-proj-project, scan ProjStep.ede to +write Makefiles") + + (init-variables + :initarg :init-variables + :initform nil + :type list + :custom (repeat (cons (string :tag "Name X") + (string :tag "Value"))) + :group (make settings) + :documentation "Variables to set in this Makefile, at top of file.") + + (additional-variables + :initarg :additional-variables + :initform nil + :type (or null list) + :custom (repeat + (cons (choice (const :tag "None" nil) + (string :tag "GNU Makefile preamble")) + (repeat (cons (string :tag "Name") + (string :tag "Value"))))) + :label "Additional variables" + :group make + :documentation + "Arbitrary variables needed from this project. +It is safe to leave this blank.") + (additional-rules + :initarg :additional-rules + :initform nil + :type (or null list) + :custom (repeat + (cons (choice (const :tag "None" nil) + (string :tag "GNU Makefile postamble")) + (repeat (object :objecttype ede-makefile-rule)))) + :label "Additional Rules" + :group make + :documentation + "Arbitrary rules and dependencies needed to make this target. +It is safe to leave this blank.") + + (menu :initform + ( + [ "Regenerate Makefiles" ede-proj-regenerate t ] + [ "Upload Distribution" ede-upload-distribution t ] + ) + ) + + (installation-domain :initarg :installation-domain + :initform user + :type symbol + :custom (choice (const user) + (const local) + ;(const network) + (const system)) + :group (default make settings) + :documentation "Installation domain specification. +The variable GNUSTEP_INSTALLATION_DOMAIN is set at this value.") + (preamble :initarg :preamble + :initform '("GNUmakefile.preamble") + :type (or null list) + :custom (repeat (string :tag "Makefile")) + :group make + :documentation "The auxilliary makefile for additional variables. +Included just before the specific target files.") + (included-makefiles :initarg :included-makefiles + :type (or null list) + :custom (repeat (string :tag "Makefile")) + :group make + :documentation "The auxilliary makefile for targets rules. +Included common and specific target files.") + (postamble :initarg :postamble + :initform '("GNUmakefile.postamble") + :type (or null list) + :custom (repeat (string :tag "Makefile")) + :group make + :documentation "The auxilliary makefile for additional rules. +Included just after the specific target files.") + + (metasubproject + :initarg :metasubproject + :initform nil + :type boolean + :custom boolean + :group (default settings) + :documentation + "Non-nil if this is a metasubproject. +Usually, a subproject is determined by a parent project. If multiple top level +projects are grouped into a large project not maintained by EDE, then you need +to set this to non-nil. The only effect is that the `dist' rule will then avoid +making a tar file.") + ) + "The EDE-STEP project definition class.") + +;;; Code: +(defun ede-gnustep-load (proj &optional rootproj) + "Load project from the topmost GNUmakefile in PROJ directory." + (let* ((mf (ede-gnustep-get-valid-makefile + (expand-file-name proj rootproj))) + (dir (directory-file-name + (or (file-name-directory (or mf "")) ""))) + pkgname pkgversion proj-obj prj-file) + + ;; check for the file project root. + ;; this allow to touch a RootProjStep.ede and `M-x ede' + ;; to load a root gnustep package. + (if (file-exists-p (expand-file-name "RootProjStep.ede" dir)) + (setq prj-file "RootProjStep.ede") + (setq prj-file "ProjStep.ede")) + (and mf + ;; To FIX, maybe VCS_MODULE ??? + (setq pkgname + (or + (with-temp-buffer + (insert-file-contents mf) + (goto-char (point-min)) + (car (makefile-macro-file-list "PACKAGE_NAME")) + ;; (ede-gnustep-semantic-value-for-tag + ;; (car (semantic-find-tags-by-name + ;; "PACKAGE_NAME" + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))) + ) + (file-name-nondirectory + (directory-file-name dir)))) + (setq pkgversion + (or + (with-temp-buffer + (insert-file-contents mf) + (goto-char (point-min)) + (or + (car (makefile-macro-file-list "PACKAGE_VERSION")) + ;; (ede-gnustep-semantic-value-for-tag + ;; (car (semantic-find-tags-by-name + ;; "PACKAGE_VERSION" + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))) + (car (makefile-macro-file-list "VERSION")))) + ;; (ede-gnustep-semantic-value-for-tag + ;; (car (semantic-find-tags-by-name + ;; "VERSION" + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))))) + "1.0")) + + ;; use dirinode to check for existence + (unless (setq proj-obj + (object-assoc (ede--inode-for-dir dir) + 'dirinode ede-projects)) + (setq proj-obj + (ede-step-project pkgname :name pkgname + :version pkgversion + :project-mode 'scanner + :directory (file-name-as-directory dir) + :file (expand-file-name prj-file dir) +; :makefile (file-name-nondirectory mf) + ;; bind :targets + :targets nil)) + (oset proj-obj :project-mode 'scanner))) + (when (ede-step-project-p proj-obj) + (project-rescan proj-obj) + (ede-step-save proj-obj)) + proj-obj)) + +;(defalias 'ede-proj-load 'ede-step-load) +(defun ede-step-load (project &optional rootproj) + "Load a project file from PROJECT directory. +If optional ROOTPROJ is provided then ROOTPROJ is the root project +for the tree being read in. If ROOTPROJ is nil, then assume that +the PROJECT being read in is the root project." + (save-excursion + (let ((ret nil) + (prj-file (car (directory-files project nil "\\(Root\\)?ProjStep.ede" nil))) + (subdirs (directory-files project nil "[^.].*" nil))) + (set-buffer (get-buffer-create " *tmp proj read*")) + (unwind-protect + (progn + (insert-file-contents (expand-file-name prj-file project) + nil nil nil t) + (goto-char (point-min)) + (setq ret (read (current-buffer))) + (if (not (eq (car ret) 'ede-step-project)) + (error "Corrupt project file")) + (setq ret (eval ret)) + (oset ret file (concat project "ProjStep.ede")) + (oset ret directory project) + (oset ret rootproject rootproj) + ) + (kill-buffer " *tmp proj read*")) + (while subdirs + (let ((sd (file-name-as-directory + (expand-file-name (car subdirs) project)))) + (if (and (file-directory-p sd) + (ede-directory-project-p sd)) + (oset ret subproj + (cons (ede-step-load sd (or rootproj ret)) + (oref ret subproj)))) + (setq subdirs (cdr subdirs)))) + (if (eq 'scanner (oref ret :project-mode)) (project-rescan ret)) + ret))) + +(defun ede-step-save (&optional project) + "Write out object PROJECT into its file." + (save-excursion + (if (not project) (setq project (ede-current-project))) + (let ((b (set-buffer (get-buffer-create " *tmp proj write*"))) + (cfn (oref project file))) + (unwind-protect + (save-excursion + (erase-buffer) + (let ((standard-output (current-buffer))) + (oset project file (file-name-nondirectory cfn)) + (object-write project ";; EDE project file.")) + (write-file cfn nil) + ) + ;; Restore the :file on exit. + (oset project file cfn) + (kill-buffer b))))) + +(defmethod ede-commit-local-variables ((proj ede-step-project)) + "Commit change to local variables in PROJ." + (ede-step-save proj)) + +(defmethod eieio-done-customizing ((proj ede-step-project)) + "Call this when a user finishes customizing this object. +Argument PROJ is the project to save." + (call-next-method) + (ede-step-save proj)) + +(defmethod eieio-done-customizing ((target ede-step-target)) + "Call this when a user finishes customizing this object. +Argument TARGET is the project we are completing customization on." + (call-next-method) + (ede-step-save (ede-current-project))) + +(defmethod ede-commit-project ((proj ede-step-project)) + "Commit any change to PROJ to its file." + (ede-step-save proj)) + +(defmethod ede-buffer-mine ((this ede-step-project) buffer) + "Return t if object THIS lays claim to the file in BUFFER." + (let ((f (ede-convert-path this (buffer-file-name buffer)))) + (or (string= (file-name-nondirectory (oref this file)) f) + (string= (ede-proj-dist-makefile this) f) + (string-match "GNUmakefile\\(\\.in\\|\\.preamble\\|\\.postamble\\)?" f) + (string-match "Makefile\\(\\.\\(preamble\\|postamble\\)\\)?" f) + ))) + +(defmethod ede-buffer-mine ((this ede-step-target) buffer) + "Return t if object THIS lays claim to the file in BUFFER." + (or (call-next-method) + (ede-target-buffer-in-sourcelist this buffer (oref this auxsource)))) + + +;;; Makefile Creation +;; XXX @TODO to use better gnustep-make, using standard variables an standard rule {before,internal,after}-*:: +(defmethod ede-proj-makefile-create ((this ede-step-project) mfilename) + "Create a GNUmakefile for all Makefile targets in THIS. +MFILENAME is the makefile to generate." + (when (eq 'writer (oref this :project-mode)) + (let ((mt nil) tmp + (isdist (string= mfilename (ede-proj-dist-makefile this))) + (depth 0) + ) + ;; ;; Find out how deep this project is. + ;; (let ((tmp this)) + ;; (while (setq tmp (ede-parent-project tmp)) + ;; (setq depth (1+ depth)))) + ;; ;; Collect the targets that belong in a makefile. + ;; (mapcar + ;; (lambda (obj) + ;; (if (and (obj-of-class-p obj 'ede-step-target) + ;; (string= (oref obj makefile) mfilename)) + ;; (setq mt (cons obj mt)))) + ;; (oref this targets)) + ;; ;; Fix the order so things compile in the right direction. + ;; (setq mt (nreverse mt)) + ;; Add in the header part of the Makefile* + (save-excursion + (set-buffer (find-file-noselect mfilename)) + (goto-char (point-min)) + (if (and + (not (eobp)) + (not (looking-at "# Automatically Generated \\w+ by EDE."))) + (if (not (y-or-n-p (format "Really replace %s?" mfilename))) + (error "Not replacing Makefile.")) + (message "Replace EDE Makefile")) + (erase-buffer) + ;; Insert a giant pile of stuff that is common between + ;; one of our Makefiles, and a Makefile.in + (insert + "# Automatically Generated " (file-name-nondirectory mfilename) + " by EDE.\n" + "# For use with: gnustep-make" + "\n#\n" + "# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST.\n" + "# EDE is the Emacs Development Environment.\n" + "# http://cedet.sourceforge.net/ede.shtml\n" + "# \n") + (insert "\nede_FILES=" (file-name-nondirectory (oref this file)) " " + (file-name-nondirectory (ede-proj-dist-makefile this)) "\n") + (insert "\n\n") + ;; Standard prologe in a GNUmakefile + (insert ;; init-variables of project + "ifeq ($(GNUSTEP_MAKEFILES),)\n" + " GNUSTEP_MAKEFILES := $(shell gnustep-config" + "--variable=GNUSTEP_MAKEFILES 2>/dev/null)\n" + "endif\n\n" + "include $(GNUSTEP_MAKEFILES)/common.make\n\n# Stuff\n") + + ;; FIX XXX package,vcs repository ... variables + ;; ... + ;; Just this project's targets variables + (ede-map-targets this + (lambda (tx) + (cond ((or (eq (oref tx type) 'ctool)(eq (oref tx type) 'tool)) + (ede-pmake-insert-variable-shared "TOOL_NAME" + (insert (ede-name tx)))) + ((eq (oref tx type) 'library) + (ede-pmake-insert-variable-shared "LIBRARY_NAME" + (insert (ede-name tx)))) + ((eq (oref tx type) 'application) + (ede-pmake-insert-variable-shared "APP_NAME" + (insert (ede-name tx)))) + ((eq (oref tx type) 'subproject) + (ede-pmake-insert-variable-shared "SUBPROJECTS" + (insert (ede-name tx))))))) + + ;; Just this target's variables, sources and flags + (insert "\n\n") + (ede-map-targets this + (lambda (tx) + (progn + (let ((file (oref tx source))) + (while file + (cond ((or + (ede-want-file-source-p ede-source-header-gnustep-c (car file)) + (ede-want-file-source-p ede-source-header-gnustep-objc (car file))) + (ede-pmake-insert-variable-shared + (concat (oref tx name) "_HEADER_FILES") + (insert (car file)))) + ((ede-want-file-source-p ede-source-gnustep-c (car file)) + (ede-pmake-insert-variable-shared + (concat (oref tx name) "_C_FILES") + (insert (car file)))) + ((ede-want-file-source-p ede-source-gnustep-objc (car file)) + (ede-pmake-insert-variable-shared + (concat (oref tx name) "_OBJC_FILES") + (insert (car file))))) + (setq file (cdr file)))) + ;; Just target's CFLAGS, LDFLAGS and INCLUDE_DIRS + (let ((cflags (oref tx cflags)) + (ldflags (oref tx ldflags)) + (incldirs (oref tx include-dirs)) + (single t)) + (while (and (sequencep cflags) cflags) + (if single + (or (setq single nil) + (insert + (concat (oref tx name) "_CFLAGS = " (car cflags) "\n"))) + (insert + (concat (oref tx name) "_CFLAGS += " (car cflags) "\n"))) + (setq cflags (cdr cflags))) + (setq single t) + (while (and (sequencep ldflags) ldflags) + (if single + (or (setq single nil) + (insert + (concat (oref tx name) "_LDFLAGS = " (car ldflags) "\n"))) + (insert + (concat (oref tx name) "_LDFLAGS += " (car ldflags) "\n"))) + (setq ldflags (cdr ldflags))) + (setq single t) + (while (and (sequencep incldirs) incldirs) + (if single + (or (setq single nil) + (insert + (concat (oref tx name) + "_INCLUDE_DIRS = " (car ldflags) "\n"))) + (insert + (concat (oref tx name) + "_INCLUDE_DIRS += " (car ldflags) "\n"))) + (setq incldirs (cdr incldirs)))) + (insert "\n") +;;;XXXX +;;; (if (or +;;; (eq (oref tx type) 'clibrary) +;;; (eq (oref tx type) 'library)) +;;; (if (oref tx header-install-dir) +;;; (insert +;;; (concat +;;; (oref tx name) +;;; "_HEADER_INSTALLATION_DIR = " +;;; (oref tx header-install-dir))))) + ))) ;; end of `ede-targets' + + ;; Yet Other project's variables + ;; Just Additional Variables ... + (insert "\n") + ;; XXX @TODO put additional variables in the preamble if specified. + (let ((addvars (oref this additional-variables)) vars mkf) + (while addvars + (if (car addvars) ;; useless ?? + (setq mkf (caar addvars) + vars (cdar addvars))) + (while vars + (if mkf + (save-excursion + (set-buffer (find-file-noselect mkf)) +; (ede-pmake-insert-variable-shared (caar vars)(cdar vars)) + (insert (caar vars) " += " (cdar vars) "\n") + (save-buffer)) +; (ede-pmake-insert-variable-shared (caar vars)(cdar vars))) + (insert (caar vars) " += " (cdar vars) "\n")) + (setq vars (cdr vars))) + (setq addvars (cdr addvars)))) + + ;; Include Preambles + (insert "\n\n") + (let ((preambles (oref this preamble))) + (while preambles + (insert "-include " (car preambles) "\n") + (setq preambles (cdr preambles)))) + ;; Include target type specific Makefile + (insert "\n") + (let (types) + (ede-map-targets this (lambda (x) (add-to-list 'types (oref x type)))) + (while types + (if (eq (car types) 'subproject) + (insert "include $(GNUSTEP_MAKEFILES)/aggregate.make\n") + (insert "include $(GNUSTEP_MAKEFILES)/" (symbol-name (car types)) ".make\n")) + (setq types (cdr types)))) + ;; Include Postambles + (insert "\n") + (let ((postambles (oref this postamble))) + (while postambles + (insert "-include " (car postambles) "\n") + (setq postambles (cdr postambles)))) + + ;; Just Additional Rules ... + ;; XXX @TODO put additional rules in the postamble if specified. + + ;; END + (save-buffer) + (goto-char (point-min)))))) + +;;; EDE command functions +;; +(defvar ede-step-target-history nil + "History when querying for a target type.") + +(defmethod project-new-target ((this ede-step-project) + &optional name type autoadd) + "Create a new target in THIS based on the current buffer." + (if (eq (oref this :project-mode) 'scanner) + (warn "This ProjStep is in Scanner Mode, are u sure what are u doing?")) + (let* ((name (or name (read-string "Name: " ""))) + (type (or type + (completing-read "Type: " ede-step-target-alist + nil t nil '(ede-step-target-history . 1)))) + (ot nil) + (src (if (and (buffer-file-name) + (if (and autoadd (stringp autoadd)) + (string= autoadd "y") + (y-or-n-p (format "Add %s to %s? " (buffer-name) name)))) + (buffer-file-name)))) + (setq ot (funcall (nth 1 (assoc type ede-step-target-alist)) name :name name + :path (ede-convert-path this default-directory) + :makefile "GNUmakefile" + :source (if src + (list (file-name-nondirectory src)) + nil))) + ;; If we added it, set the local buffer's object. + (if src (progn + (setq ede-object ot) + (ede-apply-object-keymap))) + ;; Add it to the project object + ;;(oset this targets (cons ot (oref this targets))) + ;; New form: Add to the end using fancy eieio function. + ;; @todone - Some targets probably want to be in the front. + ;; How to do that? + ;; @ans - See elisp autoloads for answer + (object-add-to-list this 'targets ot t) + ;; And save + (ede-step-save this))) + +(defmethod project-new-target-custom ((this ede-step-project)) + "Create a new target in THIS for custom." + (if (eq (oref this :project-mode) 'scanner) + (warn "This ProjStep is in Scanner Mode, are u sure what are u doing?")) + (let* ((name (read-string "Name: " "")) + (type (completing-read "Type: " ede-step-target-alist + nil t nil '(ede-step-target-history . 1)))) + (funcall (nth 1 (assoc type ede-step-target-alist)) name :name name + :path (ede-convert-path this default-directory) + :source nil))) + +(defmethod project-delete-target ((this ede-step-target)) + "Delete the current target THIS from it's parent project." + (if (eq (oref (ede-current-project (oref this :path)) :project-mode) 'scanner) + (warn "This ProjStep is in Scanner Mode, are u sure what are u doing?")) + (let ((p (ede-current-project)) + (ts (oref this source))) + ;; Loop across all sources. If it exists in a buffer, + ;; clear it's object. + (while ts + (let* ((default-directory (oref this path)) + (b (get-file-buffer (car ts)))) + (if b + (save-excursion + (set-buffer b) + (if (eq ede-object this) + (progn + (setq ede-object nil) + (ede-apply-object-keymap)))))) + (setq ts (cdr ts))) + ;; Remove THIS from it's parent. + ;; The two vectors should be pointer equivalent. + (oset p targets (delq this (oref p targets))) + (ede-step-save (ede-current-project)))) + +(defmethod project-add-file ((this ede-step-target) file) + "Add to target THIS the current buffer represented as FILE." + (if (eq (oref (ede-current-project (oref this :path)) :project-mode) 'scanner) + (warn "This ProjStep is in Scanner Mode, are u sure what are u doing?")) + (let ((file (ede-convert-path this file)) + (src (ede-target-sourcecode this)) + (aux nil)) + (while (and src (not (ede-want-file-p (car src) file))) + (setq src (cdr src))) + (when src + (setq src (car src)) + (cond ((ede-want-file-source-p this file) + (object-add-to-list this 'source file t)) + ((ede-want-file-auxiliary-p this file) + (object-add-to-list this 'auxsource file t)) + (t (error "`project-add-file(ede-target)' source mismatch error"))) + (ede-step-save)))) + +(defmethod project-remove-file ((target ede-step-target) file) + "For TARGET, remove FILE. +FILE must be massaged by `ede-convert-path'." + (if (eq (oref (ede-current-project (oref this :path)) :project-mode) 'scanner) + (warn "This ProjStep is in Scanner Mode, are u sure what are u doing?")) + ;; Speedy delete should be safe. + (object-remove-from-list target 'source (ede-convert-path target file)) + (object-remove-from-list target 'auxsource (ede-convert-path target file)) + (ede-step-save)) + +(defmethod project-update-version ((this ede-step-project)) + "The :version of project THIS has changed." + (ede-step-save)) + +(defmethod project-make-dist ((this ede-step-project)) + "Build a distribution for the project based on THIS target." + ;; I'm a lazy bum, so I'll make a makefile for doing this sort + ;; of thing, and rely only on that small section of code. + (let ((pm (ede-proj-dist-makefile this)) + (df (project-dist-files this))) + (if (and (file-exists-p (car df)) + (not (y-or-n-p "Dist file already exists. Rebuild? "))) + (error "Try `ede-update-version' before making a distribution")) + (ede-proj-setup-buildenvironment this) + (if (string= pm "Makefile.am") (setq pm "Makefile")) + (compile (concat "make -f " pm " dist")) + )) + +(defmethod project-dist-files ((this ede-step-project)) + "Return a list of files that constitutes a distribution of THIS project." + (list + ;; Note to self, keep this first for the above fn to check against. + (concat (oref this name) "-" (oref this version) ".tar.gz") + )) + +(defmethod project-compile-project ((proj ede-step-project) &optional command) + "Compile the entire current project PROJ. +Argument COMMAND is the command to use when compiling." + (let ((pm (ede-proj-dist-makefile proj)) + (default-directory (file-name-directory (oref proj file)))) + (ede-proj-setup-buildenvironment proj) +; (if (string= pm "Makefile.am") (setq pm "Makefile")) + (compile (concat "make -f " pm " all")))) + +;;; Target type specific compilations/debug +;; +(defmethod project-compile-target ((obj ede-step-target) &optional command) + "Compile the current target OBJ. +Argument COMMAND is the command to use for compiling the target." + (ede-proj-setup-buildenvironment (ede-current-project)) + (compile (concat "make -f " (oref obj makefile) " " + (ede-proj-makefile-target-name obj)))) + +(defmethod project-debug-target ((obj ede-step-target)) + "Run the current project target OBJ in a debugger." + (error "Debug-target not supported by %s" (object-name obj))) + +(defmethod ede-proj-makefile-target-name ((this ede-step-target)) + "Return the name of the main target for THIS target." + (ede-name this)) + +;;; Compiler and source code generators +;; +(defmethod ede-want-file-auxiliary-p ((this ede-target) file) + "Return non-nil if THIS target wants FILE." + ;; By default, all targets reference the source object, and let it decide. + (let ((src (ede-target-sourcecode this))) + (while (and src (not (ede-want-file-auxiliary-p (car src) file))) + (setq src (cdr src))) + src)) + + +;;; Target type specific autogenerating gobbldegook. +;; I would implement the ede-proj interface. +(eval-when-compile + (require 'ede-pmake "ede-pmake.el") + (require 'ede-pconf "ede-pconf.el")) + +(defmethod ede-proj-dist-makefile ((this ede-step-project)) + "Return the name of the Makefile with the DIST target in it for THIS." + (or (ede-gnustep-get-topmost-makefile (oref this directory)) + (concat (file-name-directory (oref this file)) "GNUmakefile"))) + +;; This Func is implemented elsewhere, probably in ede.el +;; (defun ede-proj-regenerate () +;; "Regenerate Makefiles for and edeproject project." +;; (interactive) +;; (and (eq 'writer (oref (ede-current-project) :project-mode)) +;; (ede-proj-setup-buildenvironment (ede-current-project) t))) + +(defmethod ede-proj-makefile-create-maybe ((this ede-step-project) mfilename) + "Create a Makefile for all Makefile targets in THIS if needed. +MFILENAME is the makefile to generate." + ;; For now, pass through until dirty is implemented. + (require 'ede-pmake) + (if (or (not (file-exists-p mfilename)) + (file-newer-than-file-p (oref this file) mfilename)) + (ede-proj-makefile-create this mfilename))) + +(defmethod ede-proj-setup-buildenvironment ((this ede-step-project) + &optional force) + "Setup the build environment for project THIS. +Handles the Makefile, or a Makefile.am configure.in combination. +Optional argument FORCE will force items to be regenerated." + (if (not force) + (ede-proj-makefile-create-maybe this (ede-proj-dist-makefile this)) +; (require 'ede-pmake) + (ede-proj-makefile-create this (ede-proj-dist-makefile this))) + ;; Rebuild all subprojects + (ede-map-subprojects + this (lambda (sproj) (ede-proj-setup-buildenvironment sproj force))) + ) + + +;;; Lower level overloads +;; +;; utils using semantic for parsing. +(defsubst ede-gnustep-semantic-tags-named () + (semantic--find-tags-by-function + '(lambda (tag)(string-match "_NAME$" (car tag))) + (semantic-find-tags-by-class 'variable (current-buffer)))) + +(defsubst ede-gnustep-semantic-tags-subprojects () + (semantic--find-tags-by-function + '(lambda (tag)(string-match "^SUBPROJECTS$" (car tag))) + (semantic-find-tags-by-class 'variable (current-buffer)))) + +(defsubst ede-gnustep-semantic-tags-included-files () + (semantic-find-tags-by-class 'include (current-buffer))) + +(defsubst ede-gnustep-semantic-tags-all-variables () + (semantic-find-tags-by-class 'variable (current-buffer))) + +(defsubst ede-gnustep-semantic-value-for-tag (tag) + (cadr (caddr tag))) + +(defun ede-gnustep-semantic-tag-for-value (name) + (let ((tags (semantic-fetch-tags))(found nil)) + (while (and tags (not found)) + (and (member name (ede-gnustep-semantic-value-for-tag (car tags))) + (setq found (car tags))) + (setq tags (cdr tags))) + found)) + +;; maybe require some makefile utils +(defmethod project-rescan ((this ede-step-project)) + "Rescan the EDE proj project THIS." + (cond ((eq 'writer (oref this :project-mode)) + (ede-with-projectfile this + (goto-char (point-min)) + (let ((l (read (current-buffer))) + (fields (object-slots this)) + (targets (oref this targets))) + (setq l (cdr (cdr l))) ;; objtype and name skip + (while fields ; reset to defaults those that dont appear. + (if (and (not (assoc (car fields) l)) + (not (eq (car fields) 'file))) + (let ((eieio-skip-typecheck t)) + ;; This is a hazardous thing, for some elements + ;; might not be bound. Skip typechecking and duplicate + ;; unbound slots along the way. + (eieio-oset this (car fields) + (eieio-oref-default this (car fields))))) + (setq fields (cdr fields))) + (while l + (let ((field (car l)) (val (car (cdr l)))) + (cond ((eq field targets) + (let ((targets (oref this targets)) + (newtarg nil)) + (setq val (cdr val)) ;; skip the `list' + (while val + (let ((o (object-assoc (car (cdr (car val))) ; name + 'name targets))) + (if o + (project-rescan o (car val)) + (setq o (eval (car val)))) + (setq newtarg (cons o newtarg))) + (setq val (cdr val))) + (oset this targets newtarg))) + (t + (eieio-oset this field val)))) + (setq l (cdr (cdr l))))))) ;; field/value + + ;; Scanner-mode + ((eq 'scanner (oref this :project-mode)) + (let ((mf (ede-gnustep-get-valid-makefile (oref this :directory))) + (otargets (oref this targets)) + (osubproj (oref this subproj)) + (pn (oref this :name)) (ntargets nil) (nsubproj nil)) + (when mf +; (oset this :makefile (file-name-nondirectory mf)) + (with-temp-buffer + (insert-file-contents mf) + (goto-char (point-min)) + (let (;; XXX : Why these don't work ??? + (named (ede-gnustep-semantic-tags-named)) + (subprojs (ede-gnustep-semantic-tags-subprojects)) + (included (ede-gnustep-semantic-tags-included-files)) + (allvariables (ede-gnustep-semantic-tags-all-variables)) + inst-domain) + (oset this included-makefiles included) + (setq inst-domain + (ede-gnustep-semantic-value-for-tag + (assoc "GNUSTEP_INSTALLATION_DOMAIN" allvariables))) + (cond ((string= "USER" inst-domain)(oset this installation-domain 'user)) + ((string= "SYSTEM" inst-domain)(oset this installation-domain 'system)) + ((string= "NETWORK" inst-domain)(oset this installation-domain 'network)) + (t (oset this installation-domain 'local))) + (mapc + ;; Map all the different types + (lambda (typecar) + (let ((macro (nth 2 typecar)) + (class (nth 1 typecar)) + ) + (let ((tmp nil)(targets + (makefile-macro-file-list macro) + ;; (ede-gnustep-semantic-value-for-tag + ;; (car (semantic-find-tags-by-name + ;; macro + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))) + )) + (setq targets (remove-duplicates targets :test 'equal)) + (while targets + (setq tmp (object-assoc (car targets) 'name otargets)) + (when (not tmp) + (if (eq class 'ede-step-project) + ;; I found a sub project. + (let ((spdir + (file-name-as-directory + (expand-file-name (car targets)(oref this :directory)))) mf) + (when (and + (file-directory-p spdir) + (ede-gnustep-get-valid-makefile spdir)) + ;; For each project id found, see if we need to recycle, + ;; and if we do not, then make a new one. Check the deep + ;; rescan value for behavior patterns. + (setq tmp (object-assoc spdir 'directory osubproj)) + (unless tmp + (setq tmp + (condition-case nil + ;; In case of problem, ignore it. + (ede-step-project + (car targets) :name (car targets) + :project-mode 'scanner + :directory spdir + :file (expand-file-name "ProjStep.ede" spdir) + :targets nil) + (error nil))) + ;; new subproject + (and (ede-step-project-child-p tmp) + (setq nsubproj (cons tmp nsubproj)))) + (when tmp + ;; force to be a subproject and in scanner mode + ;;(oset tmp rootproj (or (oref this rootproj) this)) + (oset tmp :project-mode 'scanner) + ;; rescan subproj after, in tail + ;; (if ede-deep-rescan (project-rescan tmp)) + ))) + + ;; I found a non-subproject target. + (setq tmp (apply class (car targets) :name (car targets) + ;; XXX check for possible relative path + ;; in names, like Library/SubLibTarget + ;;:path "" + ;; FIX: we need an absolute path + ;; because ede-object-progect var don't work, + ;; we can't use it in `project-rescan'(target) + :path (file-name-directory mf) + :makefile (file-name-nondirectory mf) + nil)) + ;; force :makefile, i don't know why !!! + (oset tmp :makefile (file-name-nondirectory mf)) + (setq ntargets (cons tmp ntargets)) + )) + ;; If we have tmp, then rescan it only if deep mode. + (if (and ede-deep-rescan (ede-step-target-child-p tmp)) + (project-rescan tmp)) + (setq targets (cdr targets)))))) + ede-step-target-alist) + ) ;; close temp buffer, we don't need makefile-macro-file-list + (oset this :targets (append ntargets otargets)) + (oset this subproj (append nsubproj osubproj)) + (ede-step-save this) + (if ede-deep-rescan + (dolist (SP (oref this subproj)) + (project-rescan SP))) + )))))) + +(defmethod project-rescan ((this ede-step-target) &optional readstream) + "Rescan target THIS from the read list READSTREAM." + ;; use the root project to distinguish between scanner/writer mode. + ;; FIX is better something like `ede-target-parent' ??? non force topmost. + (let ((this-step-root-project + (ede-current-project + (file-name-directory + (or (ede-gnustep-get-topmost-makefile (oref this :path)) (oref this :makefile) ""))))) + ;;(when (ede-step-project-child-p ede-object-project) + (when (ede-step-project-child-p this-step-root-project) + (cond ((eq 'writer (oref this-step-root-project :project-mode)) + (progn + (setq readstream (cdr (cdr readstream))) ;; constructor/name + (while readstream + (let ((tag (car readstream)) + (val (car (cdr readstream)))) + (eieio-oset this tag val)) + (setq readstream (cdr (cdr readstream)))))) + ;;((eq 'scanner (oref ede-object-project :project-mode)) + ((eq 'scanner (oref this-step-root-project :project-mode)) + ;;(let ((mf (ede-gnustep-get-valid-makefile (oref ede-object-project :directory))) + (let ((mf ;;(ede-gnustep-get-valid-makefile (oref this-step-root-project :directory))) + (oref this :makefile)) + (allsource nil)) + (with-temp-buffer + (insert-file-contents mf) + (goto-char (point-min)) + ;; FIX add all available _MACROS_FOR_TARGETS by gnustep-make, + ;; or find a way to do it. + (let ((c-src + (makefile-macro-file-list (concat (oref this :name) "_C_FILES")) + ;; (ede-gnustep-semantic-value-for-tag ;;was makefile-macro-file-list + ;; (car (semantic-find-tags-by-name + ;; (concat (oref this :name) "_C_FILES") + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))) + ) + (objc-src + (makefile-macro-file-list (concat (oref this :name) "_OBJC_FILES")) + ;; (ede-gnustep-semantic-value-for-tag ;;was makefile-macro-file-list + ;; (car (semantic-find-tags-by-name + ;; (concat (oref this :name) "_OBJC_FILES") + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))) + ) + (h-src + (makefile-macro-file-list (concat (oref this :name) "_HEADER_FILES")) + ;; (ede-gnustep-semantic-value-for-tag ;;was makefile-macro-file-list + ;; (car (semantic-find-tags-by-name + ;; (concat (oref this :name) "_HEADER_FILES") + ;; (semantic-find-tags-by-class + ;; 'variable (current-buffer))))) + ) + ) + (if c-src (setq allsource (append c-src allsource))) + (if objc-src (setq allsource (append objc-src allsource))) + (if h-src (setq allsource (append h-src allsource))))) + (oset this :source allsource))))) + )) + +;; XXX regexp to validate a makefile may be customizable list. &&'d, OR'd ??? +;; if we use a list of regexp, thier have to match "every or any" element ??? +(defun ede-gnustep-get-valid-makefile (dir) + "Return the absolute path of a valid GNUmakefile in DIR. +Check match of a line for validity." + (let ((rexp-ok "^include \\$(GNUSTEP_MAKEFILES)/common\\.make") + (mfs (directory-files dir t "^\\(GNU\\)?[mM]akefile.*")) (found nil)) + (while (and (not found) mfs) + (if (string-match rexp-ok (string-file-contents (car mfs))) + (setq found (car mfs))) + (setq mfs (cdr mfs))) + found)) + +(defun ede-gnustep-get-topmost-makefile (&optional dir) + "Find the top most valid (for gnustep) GNUmakefile." + (let* ((newdir (expand-file-name (or dir default-directory))) + (valid (ede-gnustep-get-valid-makefile newdir)) + (found nil) olddir) + (while (and (not found) (not (equal olddir newdir))) + (setq olddir newdir) ;; to prevent loop at / + ;; check for RootProjStep.ede file presence, + ;; for a valid ede-step-project root, would be the topmost. + (if (file-readable-p (expand-file-name "RootProjStep.ede" newdir)) + (setq found valid)) + (unless (or found (ede-gnustep-get-valid-makefile + (file-name-directory + (directory-file-name newdir)))) + (setq found valid)) + ;; up to .. + (setq newdir (file-name-directory (directory-file-name newdir))) + (setq valid (ede-gnustep-get-valid-makefile newdir))) + found)) + + +;;;###autoload +;; @todo - below is not compatible w/ Emacs 20! +(add-to-list 'ede-project-class-files + (ede-project-autoload "edegnustep" + :name "GNUstep-Make" :file 'ede-gnustep + :proj-file "ProjStep.ede" + :load-type 'ede-step-load + :class-sym 'ede-step-project) + t) + +;;;###autoload +;; ;; @todo - below is not compatible w/ Emacs 20! ede-project-class-files +(add-to-list 'ede-project-class-files + (ede-project-autoload "gnustep-root" + :name "GNUstep-make Top Most" :file 'ede-gnustep + :proj-file "RootProjStep.ede" + :initializers '(:project-mode scanner) + :load-type 'ede-gnustep-load + :class-sym 'ede-step-project) + t) + +;;;###autoload +;; @todo - below is not compatible w/ Emacs 20! +(add-to-list 'ede-project-class-files + (ede-project-autoload "gnustep" + :name "GNUstep-Make in scanner mode" :file 'ede-gnustep + :proj-file "ProjStep.ede" + :initializers '(:project-mode scanner) + :load-type 'ede-gnustep-load + :class-sym 'ede-step-project) + t) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\(Root\\)?ProjStep\\.ede" . emacs-lisp-mode)) + +;; (assoc "gnustep" (object-assoc-list 'name ede-project-class-files)) + + +(provide 'ede-gnustep) + +;;; ede-proj.el ends here + + + diff --git a/site/cedet-1.0pre7/contrib/semantic-ectag-scala.el b/site/cedet-1.0pre7/contrib/semantic-ectag-scala.el new file mode 100644 index 0000000..15d8e39 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/semantic-ectag-scala.el @@ -0,0 +1,82 @@ +;;; semantic-ectag-scala.el --- Scala support for ctags +;; +;; Copyright (C) 2009 Raymond Paul Racine +; +;;This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; The file contains Exuberent CTags support for the Scala language. + +;;; Code: + +;;; Scala Mode +;; + +(defvar-mode-local scala-mode semantic-ectag-lang "scala" + "Language name for Exuberent CTags.") + +(defvar-mode-local scala-mode semantic-ectag-lang-kind + "cotmnafVvTip" + "Kinds of Exuberent CTags available.") + +;; FIXME - Need to skip commented code. +;; i.e., --regex-Scala=/^[^\*\/]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/ +(defvar-mode-local scala-mode semantic-ectag-lang-extra-flags + '("--langdef=scala" + "--langmap=scala:.scala" + "--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\\1/c,class/" + "--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\\1/o,class/" + "--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\\1/c,class/" + "--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\\1/o,class/" + "--regex-scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\\1/t,class/" + "--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\\1/m,class/" + "--regex-Scala=/^[ \t]*case[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\\1/n,class/" + "--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\\1/a,class/" + "--regex-Scala=/^[ \t]*def[ \t]*([a-zA-Z0-9_]+)[ \t]*.*[:=]/\\1/f,function/" + "--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\\1/V,value/" + "--regex-Scala=/[ \t]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\\1/v,variable/" + "--regex-Scala=/^[ \t]*type[ \t]*([a-zA-Z0-9_]+)[ \t]*[\[<>=]/\\1/T,classs/" + "--regex-Scala=/^[ \t]*import[ \t]*([a-zA-Z0-9_{}., \t=>]+$)/\\1/i,include/" + "--regex-Scala=/^[ \t]*package[ \t]*([a-zA-Z0-9_.]+$)/\\1/p,package/") + "Regex for Scala symbols from syntax.") + +(defvar-mode-local scala-mode semantic-symbol->name-assoc-list + '((type . "Types") + (variable . "Variables") + (value . "Values") + (function . "Functions") + (include . "Dependencies") + (package . "Providers")) + "List of tag classes and describing strings.") + +;; CEDET has lots of ways of getting you to various levels of semantic parsing support. +;; The following incantation works. +(defun semantic-scala-cedet-support () + "Enable CEDET for Scala based upon exuberant ctags support as the primary parser." + (interactive) + (semantic-load-enable-code-helpers) + (global-srecode-minor-mode 1) + (semantic-load-enable-primary-exuberent-ctags-support) + (add-hook 'scala-mode-hook 'semantic-ectag-simple-setup)) + +(semantic-scala-cedet-support) + +;;(add-hook 'scala-mode-hook 'semantic-scala-cedet-support) + +(provide 'semantic-ectag-scala) + +;;; semantic-ectag-scala.el ends here diff --git a/site/cedet-1.0pre7/contrib/semantic-tag-folding.el b/site/cedet-1.0pre7/contrib/semantic-tag-folding.el new file mode 100644 index 0000000..4cfbcf0 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/semantic-tag-folding.el @@ -0,0 +1,760 @@ +;;; semantic-tag-folding.el --- semantic decoration style to enable folding of semantic tags +;; Time-stamp: <2005-04-28 17:03:44 sacharya> + +;;; Copyright (C) 2005, 2009 Suraj Acharya + +;; Author: Suraj Acharya + +;; This file is not part of GNU Emacs. + +;; semantic-tag-folding.el is free software; you can redistribute it +;; and/or modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2, or +;; (at your option) any later version.: + +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;;; +;;; Defines a `semantic-decoration-mode' style which allows semantic +;;; tags to be expanded or collapsed in the style of folding mode and +;;; hideshow mode. In addition to regular semantic tag, comments +;;; preceeding tags can also be folded, and consecutive 'include tags +;;; are folded as a single unit. A semantic minor mode +;;; `semantic-tag-folding-mode' is also created. So M-x +;;; semantic-tag-folding-mode can be used to turn this mode on and +;;; off, it will also turn on `semantic-deocration-mode' if required. +;;; +;;; To use feature, add this file to your load path and put the +;;; following line in your .emacs: (require 'semantic-tag-folding) +;;; +;;; Customize `semantic-tag-folding-allow-folding-of' to choose which +;;; tags you want to be able to fold. You can also choose which tags +;;; types are folded by default when semantic-decoration-mode is +;;; enabled. +;;; +;;; M-x semantic-tag-folding-mode to enable tag folding in a buffer, +;;; M-x global-semantic-tag-folding-mode turns on folding in all +;;; semantic enabled buffers. +;;; +;; Features: +;; 1. Indicators in the fringe to show which tags which can be +;; expanded or hidden, clicking on the fringe symbols toggles the +;; associated block's state +;; 2. `semantic-tag-folding-allow-folding-of' lets you customize which +;; tags can be folded, and which of those tags are folded by +;; default when this mode is first activated. +;; 3. semantic-tag-folding-mode which toggles this mode, without +;; having to turn on semantic-decoration-mode +;; 4. hs-mode style commands to fold and show all tags, all child tags +;; or only the current tag. +;; +;; TODO: +;; * semantic-tag-folding-tag and semantic-tag-folding-comment attributes should be ignored +;; when calling fold-all or show-all (or the yet to be implemented show-children functions) +;; * make tooltips behave well (turn them off when the region is +;; expanded, consistent location, no truncation, update tooltips when +;; the text changes) +;; * make the ellipsis clickable +;; * investigate occasional windows cvs Emacs crashes + + + +(require 'semantic-decorate-mode) +(eval-when-compile (require 'cl)) + +;;; Code: + +;; xemacs compatibility +;; http://www.opensource.apple.com/darwinsource/10.3/emacs-56/emacs/lisp/progmodes/hideshow.el +(when (or (not (fboundp 'add-to-invisibility-spec)) + (not (fboundp 'remove-from-invisibility-spec))) + ;; `buffer-invisibility-spec' mutators snarfed from Emacs 20.3 lisp/subr.el + (defun add-to-invisibility-spec (arg) + (cond + ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t)) + (setq buffer-invisibility-spec (list arg))) + (t + (setq buffer-invisibility-spec + (cons arg buffer-invisibility-spec))))) + (defun remove-from-invisibility-spec (arg) + (when buffer-invisibility-spec + (setq buffer-invisibility-spec + (delete arg buffer-invisibility-spec))))) + +;; http://list-archive.xemacs.org/xemacs-patches/200206/msg00144.html +;; `propertize' is a builtin in GNU Emacs 21. +(when (not (fboundp 'propertize)) + (defun propertize (string &rest properties) + "Return a copy of STRING with text properties added. +First argument is the string to copy. +Remaining arguments form a sequence of PROPERTY VALUE pairs for text +properties to add to the result." + (let ((str (copy-sequence string))) + (add-text-properties 0 (length str) + properties + str) + str))) + +;;;###autoload +(defcustom global-semantic-tag-folding-mode nil + "*If non-nil enable global use of variable `semantic-tag-folding-mode'. +With this mode enabled, a new folding decoration mode is added. +Clicking on a + or - in the fringe will fold that tag." + :group 'semantic + :group 'semantic-modes + :type 'boolean + :require 'semantic-util-modes + :initialize 'custom-initialize-default + :set (lambda (sym val) + (global-semantic-tag-folding-mode (if val 1 -1)))) + +;;;###autoload +(defun global-semantic-tag-folding-mode (&optional arg) + "Toggle global use of option `semantic-tag-folding-mode'. +If ARG is positive, enable, if it is negative, disable. +If ARG is nil, then toggle." + (interactive "P") + (setq global-semantic-tag-folding-mode + (semantic-toggle-minor-mode-globally + 'semantic-tag-folding-mode arg))) + +(defcustom semantic-tag-folding-mode-hook nil + "*Hook run at the end of function `semantic-tag-folding-mode'." + :group 'semantic + :type 'hook) + +(defvar semantic-tag-folding-mode-map + (let ((km (make-sparse-keymap))) + (define-key km [left-fringe mouse-1] 'semantic-tag-folding-click) + km) + "Keymap for folding minor mode.") + +(defvar semantic-tag-folding-mode nil + "Non-nil if folding minor mode is enabled. +Use the command `semantic-tag-folding-mode' to change this variable.") + +(make-variable-buffer-local 'semantic-tag-folding-mode) + +(defvar semantic-tag-folding-decoration-mode-hook-enabled t + "Used to disable `semantic-tag-folding-decoration-mode-hook'. +This is done when semantic-tag-folding mode turns on semantic-decoration mode.") + + +(defvar semantic-tag-folding-saved-decoration-styles nil +"The saved value of `semantic-decoration-styles'.") +(make-variable-buffer-local 'semantic-tag-folding-saved-decoration-styles) + +(defvar semantic-tag-folding-decoration-style + '(("semantic-tag-folding" . t)) + "Only turn on semantic-tag-folding decorations. +A value for variable `semantic-decoration-styles'.") + +(defun semantic-tag-folding-mode-setup () + "Setup option `semantic-tag-folding-mode'. +The minor mode can be turned on only if semantic feature is available +and the current buffer was set up for parsing. In addition, +`semantic-tag-folding-mode' is only available when fringe images are available +in Emacs 20.4." + (if semantic-tag-folding-mode + (if (not (and (featurep 'semantic) (semantic-active-p) + )) + (progn + ;; Disable minor mode if semantic stuff not available + (setq semantic-tag-folding-mode nil) + (error "Buffer %s cannot be folded by semantic" + (buffer-name))) + ;; Enable decoration mode + (add-to-invisibility-spec '(semantic-tag-fold . t)) + (if (featurep 'xemacs) + (set (make-local-variable 'line-move-ignore-invisible) t)) + (setq semantic-tag-folding-saved-decoration-styles semantic-decoration-styles) + (if semantic-decoration-mode + ;; if decoration mode is already on, ensure that semantic-tag-folding is enabled + (let ((style (assoc "semantic-tag-folding" semantic-decoration-styles))) + (when (not (cdr style)) + (setcdr style t) + (semantic-decoration-mode-setup))) + ;; else, turn on decoration mode with only semantic-tag-folding on + (setq semantic-tag-folding-saved-decoration-styles semantic-decoration-styles) + (setq semantic-decoration-styles semantic-tag-folding-decoration-style) + (let ((semantic-tag-folding-decoration-mode-hook-enabled nil)) + (semantic-decoration-mode 1)))) + ;; Remove hooks + ;; Disable the decoration. + (when semantic-decoration-mode + (if (eq semantic-decoration-styles semantic-tag-folding-decoration-style) + ;; if no calls were made to + (progn (semantic-decoration-mode -1) + (setq semantic-decoration-styles semantic-tag-folding-saved-decoration-styles)) + ;; else + (setq semantic-decoration-styles semantic-tag-folding-saved-decoration-styles) + (semantic-decoration-mode 1)))) + semantic-tag-folding-mode) + +(add-hook 'semantic-decoration-mode-hook 'semantic-tag-folding-decoration-mode-hook) + +(defun semantic-tag-folding-decoration-mode-hook () + "Hook function used to manage folding icons in decoration-mode." + (when semantic-tag-folding-decoration-mode-hook-enabled + (cond + ((and semantic-decoration-mode semantic-tag-folding-mode) + ;; when turning on decoration-mode with tag folding already on, + ;; use the saved value of `semantic-decoration-styles' and ensure + ;; that tag folding decorations are turned on + (setq semantic-decoration-styles semantic-tag-folding-saved-decoration-styles) + (let ((style (assoc "semantic-tag-folding" semantic-decoration-styles))) + (when (not (cdr style)) + (setcdr style t) + (semantic-decoration-mode-setup) + ))) + ((and semantic-decoration-mode (not semantic-tag-folding-mode)) + ;; when turning on decorations with out tag folding, ensure that + ;; tag-folding decorations are not enabled + (let ((style (assoc "semantic-tag-folding" semantic-decoration-styles))) + (when (cdr style) + (setcdr style nil) + (semantic-decoration-mode-setup) + ))) + ((and (not semantic-decoration-mode) semantic-tag-folding-mode) + ;; if turning off decoration mode with semantic tag folding on, + ;; turn off semantic tag foldng mode + (if (eq semantic-decoration-styles semantic-tag-folding-decoration-style) + ;; M-x tag-folding -> M-x decoration , turn on all the deocration mode styles + (semantic-decoration-mode 1) + ;; M-x tag-folding -> M-x decoration M-x decoration, only keep + ;; the semantic-tag-folding-decoration-style active + (semantic-tag-folding-mode 1)))))) + +;;;###autoload +(defun semantic-tag-folding-mode (&optional arg) + "Minor mode mark semantic tags for folding. +This mode will display +/- icons in the fringe. Clicking on them +will fold the current tag. +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the +minor mode is enabled." + (interactive + (list (or current-prefix-arg + (if semantic-tag-folding-mode 0 1)))) + (setq semantic-tag-folding-mode + (if arg + (> + (prefix-numeric-value arg) + 0) + (not semantic-tag-folding-mode))) + (semantic-tag-folding-mode-setup) + (run-hooks 'semantic-tag-folding-mode-hook) + (if (interactive-p) + (message "folding minor mode %sabled" + (if semantic-tag-folding-mode "en" "dis"))) + semantic-tag-folding-mode) + +(semantic-add-minor-mode 'semantic-tag-folding-mode "" semantic-tag-folding-mode-map) + + +(define-semantic-decoration-style semantic-tag-folding "Enables folding of tags.") + +;; this needs to go after defining the decoration style, until +;; define-semantic-decoration-style uses setq-default instead of +;; add-to-list when setting the value of semantic-decoration-styles +(make-variable-buffer-local 'semantic-decoration-styles) + + +(defcustom semantic-tag-folding-allow-folding-of + '((type . nil) (function . nil) (variable . nil) (include . nil) + (comment . nil) (package . nil)) + "A set of semantic classes. Tags of these classes will be allowed to be folded and unfolded by this mode." + :group 'semantic + :type ;; '(alist :key-type symbol :value-type boolean :options (type function variable include package code)) + '(set (cons :format "%v" (const :tag "Types" type) + (choice :tag "Fold by default" + (const :tag "Outer type(s) as well as inner types" all) + (const :tag "Only inner types" inner) + (const :tag "Neither" ))) + (cons :format "%v" + (const :tag "Function/method declarations" function) + (boolean :tag "Fold by default")) + (cons :format "%v" + (const :tag "Varible declarations" variable) + (boolean :tag "Fold by default")) + (cons :format "%v" + (const :tag "Blocks of consecutive include/import statements" include) + (boolean :tag "Fold by default")) + (cons :format "%v" + (const :tag "Comment blocks preceeding tags" comment) + (boolean :tag "Fold by default")) + (cons :format "%v" + (const :tag "Package declarations" package) + (boolean :tag "Fold by default")) + (cons :format "%v" + (const :tag "Code regions" code) + (boolean :tag "Fold by default")) + (cons :format "%v" + (const :tag "Code regions" block) + (boolean :tag "Fold by default")) + (repeat :tag "Other Semantic classes" + (cons :format "%v" (symbol :tag "Semantic class" code) + (boolean :tag "Fold by default"))) + )) +(make-variable-buffer-local 'semantic-tag-folding-allow-folding-of) + +(defcustom semantic-tag-folding-tag-higlight-time 1 + "The time in seconds for which a fringe highlight appears. +This higlight shows extent of the tag body when a tag is +expanded. Set this to nil for no extent indication." + :group 'semantic :type 'number) + +(defcustom semantic-tag-folding-highlight-tags-shown-by-reveal-mode nil + "If non-nil the extent tags unfolded by reveal mode is not highlighted." + :group 'semantic + :type 'boolean) + +(defcustom semantic-tag-folding-show-tooltips nil + "Display tooltips for folded tag bodies.. +If set to t, the body of a hidden tag is shown as a tooltip + when the mouse hovers over the first line of the tag. This is + not very pretty because the tooltip sometimes appears above the + cursor and not below where the tag body is, and the tootltip + text is truncated at some limit so large tag bodies are often + cut short." + :group 'semantic :type 'boolean) + +(defvar semantic-tag-folding-function 'semantic-tag-folding-function-default + "Default folding of tags. +Function which determines whether a tag should be folded by +default when `semantic-tag-folding' is activated." ) + +(defun semantic-tag-folding-set-fringe-image-style (&optional symbol value) + "Set the bitmaps for this folding \"fringe style\". +This function is called when customizing +`semantic-tag-folding-fringe-image-style'. SYMBOL is +`semantic-tag-folding-fringe-image-style' and VALUE is the fringe +style selected. +Five bitmaps are needed for each style: +* semantic-tag-folding-folded - the image in the fringe which +indicates that there is a folded tag on this line +* semantic-tag-folding-unfolded - this image indicates that the +tag starting on this line can be folded +* semantic-tag-folding-highlight-{top,middle,bottom} - when +`semantic-tag-folding-tag-higlight-time' is non-nil these three +bitmaps are used to indicate the extent of a tag when it is +unfolded." + (if symbol (set-default symbol value)) + (cond + ((not (functionp 'define-fringe-bitmap)) nil) + ((eq value 'plusminus) + + (define-fringe-bitmap 'semantic-tag-folding-folded + ;; a plus sign + [#b00011000 + #b00011000 + #b00011000 + #b11111111 + #b11111111 + #b00011000 + #b00011000 + #b00011000]) + + (define-fringe-bitmap 'semantic-tag-folding-unfolded + ;; a minus sign + [#b11111111 + #b11111111]) + + (define-fringe-bitmap 'semantic-tag-folding-highlight-top + ;; a minus sign + [#b11111111 + #b11111111]) + + (define-fringe-bitmap 'semantic-tag-folding-highlight-middle + ;; a vertical bar + [#b00011000] nil nil '(center t)) + + (define-fringe-bitmap 'semantic-tag-folding-highlight-bottom + ;; a minus sign + [#b11111111 + #b11111111])) + + ((eq value 'triangles) + + (define-fringe-bitmap 'semantic-tag-folding-unfolded + ;; a triangle pointing downwards + [#b11111110 + #b01000100 + #b00101000 + #b00010000]) + + (define-fringe-bitmap 'semantic-tag-folding-folded + ;; a filled triangle pointing to the right + [#b100000 + #b110000 + #b111000 + #b111100 + #b111100 + #b111000 + #b110000 + #b100000]) + + (define-fringe-bitmap 'semantic-tag-folding-highlight-top + ;; a triangle pointing downwards + [#b11111110 + #b01000100 + #b00101000 + #b00010000]) + + (define-fringe-bitmap 'semantic-tag-folding-highlight-middle + ;; a vertical bar + [#b00010000] nil nil '(center t)) + + (define-fringe-bitmap 'semantic-tag-folding-highlight-bottom + ;; a triangle pointing upwards + [#b00010000 + #b00101000 + #b01000100 + #b11111110]) + ) + )) + +(defcustom semantic-tag-folding-fringe-image-style 'triangles + "Fringe image style. +This variable determines the bitmaps drawn in the fringe to + indicate folded or unfolded (expanded) tags." + :group 'semantic + :type '(choice (const triangles) + (const plusminus)) + :set 'semantic-tag-folding-set-fringe-image-style) + +(defun semantic-tag-folding-allow-folding-of (class) + "Is folding of tags of semantic class CLASS allowed?" + (or + (assq class semantic-tag-folding-allow-folding-of) + (assq class (car (last semantic-tag-folding-allow-folding-of))) + )) + +(defun semantic-tag-folding-hidden-by-default (class) +"Are tags of semantic class CLASS to be hidden by default?" + (cdr (semantic-tag-folding-allow-folding-of class))) + +(defun semantic-tag-folding-function-default (tag comment) + "The default `semantic-tag-folding-function'. +Returns non-nil if the body of TAG is to be hidden when the mode +is started. COMMENT is non-nil to indicate that the comment above +TAG is what is being hidden, not the body of TAG." + (if comment + (semantic-tag-folding-hidden-by-default 'comment) + (let* ((c (semantic-tag-class tag)) + (default (semantic-tag-folding-hidden-by-default c))) + ;; `default' is the value to be returned, unless TAG is a type + ;; and only inner types are to be hidden + (if (and default (eq c 'type) (eq default 'inner)) + ;; the outermost type has no parent + (semantic-find-tag-parent-by-overlay tag) + default)))) + +(defun semantic-tag-folding-p-default (tag) + "Return non-nil if TAG is to be considered for folding. +TAG has to have valid start and end locations in the +buffer. Customize variable `semantic-tag-folding-allow-folding-of' to +influence the output of this function." + (let ((c (semantic-tag-class tag))) + (and + (semantic-tag-with-position-p tag) + (or (semantic-tag-folding-allow-folding-of 'comment) + (semantic-tag-folding-allow-folding-of c)) + ;; we only want the first include from a block of includes + (or (not (eq c 'include)) + (not (semantic-find-tag-by-overlay-prev (semantic-tag-start tag))) + (not (eq (semantic-tag-class + (semantic-find-tag-by-overlay-prev (semantic-tag-start tag))) 'include))) + ))) + +(defun semantic-tag-folding-highlight-default (tag) + "Create decoration overlays for TAG. +Also put a marker in the fringe for each thing that can be +collapsed." + (when (semantic-tag-buffer tag) + (with-current-buffer (semantic-tag-buffer tag) + (let ((point (point)) + (tag-start (semantic-tag-start tag)) + (tag-end (semantic-tag-end tag))) + ;; fold the comment preceding this tag + (if (semantic-tag-folding-allow-folding-of 'comment) + (let ((start (progn + (goto-char tag-start) + (when (forward-comment -1) + (do ((ret (point-at-eol) (point-at-eol))) + ( ;; until we see an empty line, or there are + ;; no more comments, or we reach the + ;; beginning of the buffer + (or (re-search-backward "\n\n" (- (point) 2) t) + (not (forward-comment -1)) + (bobp)) + ;; return + ret))))) + (end (progn + (goto-char tag-start) + (- (point-at-bol) 1)))) + (semantic-tag-folding-create-folding-overlays tag start end point t))) + ;; Fold the body of this tag. + ;; If folding comments is enabled all tags are passed into this + ;; function, so we need to check if folding is enabled for this + ;; tag type + (if (or (not (semantic-tag-folding-allow-folding-of 'comment)) (semantic-tag-folding-allow-folding-of (semantic-tag-class tag))) + (let ((start (progn + (goto-char tag-start) + (point-at-eol))) + (end (if (eq (semantic-tag-class tag) 'include) + (progn + (let ((tag-cursor tag) (last-tag-cursor tag)) + (while (eq (semantic-tag-class tag-cursor) 'include) + (setq last-tag-cursor tag-cursor) + (setq tag-cursor (semantic-find-tag-by-overlay-next (semantic-tag-end tag-cursor)))) + (semantic-tag-end last-tag-cursor))) + tag-end))) + (semantic-tag-folding-create-folding-overlays tag start end point nil))) + (goto-char point))))) + + +(defun semantic-tag-folding-get-attribute-overlay (tag create-if-null) + "Get the overlay used to store the fold state for TAG. +Create the overlay if CREATE-IF-NULL is non-nil." + (let* ((pos (semantic-tag-start tag)) + (ov (car (remove-if-not + (lambda (ov) + (semantic-overlay-get ov 'semantic-tag-folding-attributes)) + (semantic-overlays-at pos))))) + (when (and create-if-null (null ov)) + (setq ov (semantic-make-overlay (- pos 1) (+ 1 pos))) + (semantic-overlay-put ov 'semantic-tag-folding-attributes t)) + ov)) + +(defun semantic-tag-folding-get-folding-attribute (comment) + "Return the symbol used to store the fold state. +The symbol returned is for a tag (COMMENT is nil) or the comment +preceeding a tag (COMMENT is non-nil)" + (if comment + 'semantic-tag-folding-comment + 'semantic-tag-folding-tag)) + +(defun semantic-tag-folding-get-fold-state (tag comment) + "Return the fold state for TAG. +If COMMENT is non-nil return the fold state for the comment preceeding TAG." + (let* ((attr (semantic-tag-folding-get-folding-attribute comment)) + (ov (semantic-tag-folding-get-attribute-overlay tag nil))) + (and ov (semantic-overlay-get ov attr)))) + +(defun semantic-tag-folding-set-fold-state (tag comment state) + "Set the fold state for TAG to STATE. +If COMMENT is non-nil set the fold state for the comment preceeding TAG." + (let* ((attr (semantic-tag-folding-get-folding-attribute comment)) + (ov (semantic-tag-folding-get-attribute-overlay tag t))) + (semantic-overlay-put ov attr state))) + + +(defun semantic-tag-folding-create-folding-overlays (tag start end point comment) +"Create an overlay for `semantic-tag-overlay'. +Create an overlay associated TAG. START and END are buffer +positions, usually inside TAG, but can be outside for comment and +include block overlays. POINT is the saved location of point, +this is used to unfold any TAGS around point by default. COMMENT +is non-nil if the fold region is a comment." + (let ((fold (if (functionp semantic-tag-folding-function) + (apply semantic-tag-folding-function (list tag comment)) + semantic-tag-folding-function))) + (when (and start end (< start end) (> (count-lines start end) 1)) + (let* ((ov (semantic-decorate-tag tag start end)) + (start2 (if comment + (save-excursion + (goto-char start) + (backward-char) + (point-at-bol)) + (semantic-tag-start tag))) + (ov2 (semantic-decorate-tag tag start2 (+ start2 1))) + (marker-string "+")) + (semantic-overlay-put ov 'semantic-tag-folding t) + (semantic-overlay-put ov 'isearch-open-invisible + 'semantic-tag-folding-show-block) + + ;; check for fold state attributes + (if (functionp semantic-tag-folding-function) + (let ((state (semantic-tag-folding-get-fold-state tag comment))) + (if state + (setq fold (eq state 'fold))))) + + ;; don't fold this region if point is inside it + (if (and (> end point) (< start point)) + (setq fold nil)) + + (if (not fold) + ;; just display the unfolded bitmap in the fringe + (setq marker-string (propertize + marker-string 'display + '((left-fringe semantic-tag-folding-unfolded) + "-"))) + ;; fold the body and display a + in the fringe + (semantic-overlay-put ov 'invisible 'semantic-tag-fold) + (setq marker-string (propertize + marker-string + 'display + '((left-fringe semantic-tag-folding-folded) + "+" )))) + + ;; store the marker string and tag as a property of the + ;; overlay so we use it to change the displayed fold state + ;; later (in semantic-tag-folding-set-overlay-visibility) + (semantic-overlay-put ov 'semantic-tag-folding-marker-string marker-string) + (semantic-overlay-put ov 'semantic-tag-folding-tag tag) + (semantic-overlay-put ov 'semantic-tag-folding-comment-overlay comment) + + (semantic-overlay-put ov2 'before-string marker-string) + + ;; store fold state as a function of the tag (unless the default state is being set) + (unless (functionp semantic-tag-folding-function) + (semantic-tag-folding-set-fold-state tag comment fold)) + + ;; tooltips + (when semantic-tag-folding-show-tooltips + (semantic-overlay-put ov2 'mouse-face 'highlight) + (semantic-overlay-put ov2 'help-echo (buffer-substring (+ 1 start) end))))))) + +(defun semantic-tag-folding-fold-block () + "Fold the smallest enclosing tag at point." + (interactive) + (semantic-tag-folding-set-overlay-visibility + (semantic-tag-folding-get-overlay) t)) + +(defun semantic-tag-folding-show-block (&optional ov) + "Unfold overlay OV, or the smallest enclosing tag at point." + (interactive) + (semantic-tag-folding-set-overlay-visibility + (or ov (semantic-tag-folding-get-overlay)) nil)) + +(defun semantic-tag-folding-show-all () + "Unfold all the tags in this buffer." + (interactive) + (semantic-tag-folding-fold-or-show-tags + (semantic-fetch-available-tags) nil)) + +(defun semantic-tag-folding-fold-all () + "Fold all the tags in this buffer." + (interactive) + (semantic-tag-folding-fold-or-show-tags + (semantic-fetch-available-tags) t)) + +(defun semantic-tag-folding-show-children () + "Unfold all the tags in this buffer." + (interactive) + (semantic-tag-folding-fold-or-show-tags + (cons (semantic-current-tag) + (semantic-tag-components (semantic-current-tag))) + nil)) + +(defun semantic-tag-folding-fold-children () + "Unfold all the tags in this buffer." + (interactive) + (semantic-tag-folding-fold-or-show-tags + (cons (semantic-current-tag) + (semantic-tag-components (semantic-current-tag))) + t)) + +(defun semantic-tag-folding-fold-or-show-tags (tags fold) +"Change the fold state of TAGS to FOLD." + (lexical-let ((fold fold)) + (when semantic-decoration-mode + (semantic-decorate-clear-decorations tags) + (let ((semantic-tag-folding-function fold)) + (semantic-decorate-add-decorations tags))))) + +(defun semantic-tag-folding-get-overlay () + "Return the innermost semantic-tag-folding-folding overlay at point." + (labels ((semantic-overlay-size (ov) + (- (semantic-overlay-end ov) (semantic-overlay-start ov)))) + (car + (sort + (remove-if-not (lambda (ov) (semantic-overlay-get ov 'semantic-tag-folding)) + (semantic-overlays-at (point-at-eol))) + (lambda (x y) + (< (semantic-overlay-size x) (semantic-overlay-size y))))))) + +(defun semantic-tag-folding-set-overlay-visibility (ov fold &optional called-by-reveal-mode) + "Change the visibility of overlay OV. +If FOLD is non-nil OV is hidden. Also changes the fringe bitmap +to indcate the new state. CALLED-BY-REVEAL-MODE is t when this +overlay is folded or expanded by reveal mode." + (when (and (semantic-overlay-p ov) + ;; if reveal mode is hiding an overlay, it should've been folded by reveal mode + (or (not called-by-reveal-mode) (not fold) (semantic-overlay-get ov 'semantic-tag-reveal-mode))) + (semantic-overlay-put ov 'invisible (if fold 'semantic-tag-fold)) + (let ((tag (semantic-overlay-get ov 'semantic-tag-folding-tag))) + + (when tag + (semantic-tag-folding-set-fold-state tag (semantic-overlay-get ov 'semantic-tag-folding-comment-overlay) (if fold 'fold 'show)) + (if fold + (put-text-property 0 1 'display '((left-fringe semantic-tag-folding-folded) "+") + (semantic-overlay-get ov 'semantic-tag-folding-marker-string)) + ;; show + (put-text-property 0 1 'display '((left-fringe semantic-tag-folding-unfolded) "-") + (semantic-overlay-get ov 'semantic-tag-folding-marker-string)) + (semantic-overlay-put ov 'semantic-tag-reveal-mode called-by-reveal-mode) + (semantic-tag-folding-highlight-overlay ov)))))) + +;; set the function to be called when regions are revealed and hidden by reveal-mode. +(put 'semantic-tag-fold 'reveal-toggle-invisible 'semantic-tag-folding-set-overlay-visibility-for-reveal-mode) + +(defun semantic-tag-folding-set-overlay-visibility-for-reveal-mode (ov fold) +"Fold/unfold function called from reveal mode. +OV is the overlay whose state must change, FOLD is non-nil to fold the overlay." + (let ((semantic-tag-folding-tag-higlight-time + (if semantic-tag-folding-highlight-tags-shown-by-reveal-mode + semantic-tag-folding-tag-higlight-time + nil))) + (semantic-tag-folding-set-overlay-visibility ov fold t))) + +(defun semantic-tag-folding-highlight-overlay (ov) + "Temporarily draw attention to the overlay OV. +This is done by drawing a vertical bar in the fringe for the +lines that OV extends over for +`semantic-tag-folding-tag-higlight-time' seconds." + (when semantic-tag-folding-tag-higlight-time + (let ((overlays nil)) + (labels ((make-fringe (fringe string) + (setq overlays (cons (semantic-make-overlay (point-at-bol) (+ 1(point-at-bol))) overlays) ) + (semantic-overlay-put (car overlays) 'before-string + (propertize string 'display `(left-fringe ,fringe))))) + (save-excursion + (goto-char (semantic-overlay-start ov)) + (make-fringe 'semantic-tag-folding-highlight-top "+") + (forward-line) + (while (< (point-at-eol) (semantic-overlay-end ov)) + (make-fringe 'semantic-tag-folding-highlight-middle "|") + (forward-line)) + (make-fringe 'semantic-tag-folding-highlight-bottom "+")) + (sit-for semantic-tag-folding-tag-higlight-time) + (mapc 'semantic-overlay-delete overlays))))) + +(defun semantic-tag-folding-click (event) + "Handle fringe click EVENT by folding/unfolding blocks." + (interactive "e") + (when (event-start event) + (let* ((start (event-start event)) + (point (posn-point start)) + (window (posn-window start))) + (select-window window) + (goto-char point) + (let ((bitmaps (fringe-bitmaps-at-pos point))) + (if (member 'semantic-tag-folding-folded bitmaps) + (semantic-tag-folding-set-overlay-visibility (semantic-tag-folding-get-overlay) nil)) + (if (member 'semantic-tag-folding-unfolded bitmaps) + (semantic-tag-folding-set-overlay-visibility (semantic-tag-folding-get-overlay) t)))))) + +(provide 'semantic-tag-folding) +;;; semantic-tag-folding.el ends here \ No newline at end of file diff --git a/site/cedet-1.0pre7/contrib/wisent-csharp-wy.el b/site/cedet-1.0pre7/contrib/wisent-csharp-wy.el new file mode 100644 index 0000000..57b9449 Binary files /dev/null and b/site/cedet-1.0pre7/contrib/wisent-csharp-wy.el differ diff --git a/site/cedet-1.0pre7/contrib/wisent-csharp.el b/site/cedet-1.0pre7/contrib/wisent-csharp.el new file mode 100644 index 0000000..b46f654 --- /dev/null +++ b/site/cedet-1.0pre7/contrib/wisent-csharp.el @@ -0,0 +1,374 @@ +;;; wisent-csharp.el --- LALR grammar for C# +;; +;; Copyright (C) 2003, 2007 David Shilvock +;; Some Changes Copyright (C) 2006 Eric M. Ludlam + +;; Time-stamp: <2003-12-08 19:11:48 dave> +;; +;; Author: David Shilvock +;; Maintainer: David Shilvock +;; Created: November 2003 +;; Keywords: syntax +;; +;; This file is not part of GNU Emacs. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. +;; +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; This file contains the csharp parser created from the grammar +;; specified in wisent-csharp.wy file. It also has some support code. +;; A bunch of this is ripped from wisent-java-tags.el (David Ponce) +;; +;;; Code: + +(require 'semantic-wisent) +(require 'semantic-format) +(require 'semantic-ctxt) +(require 'wisent-csharp-wy) + + +;;;---------------------------------------------------------------------- +;;; * Lexer/Parser Support Code +;;;---------------------------------------------------------------------- + +(defconst wysent-csharp-number-re + (eval-when-compile + (concat "\\(" + "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][fFdD]\\>" + "\\|" + "\\<[0-9]+[.]" + "\\|" + "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<0[xX][0-9a-fA-F]+[lL]?\\>" + "\\|" + "\\<[0-9]+[lLfFdD]?\\>" + "\\)" + )) + "Lexer regexp to match Java number terminals. +Following is the specification of Java number literals. + +DECIMAL_LITERAL: + [1-9][0-9]* + ; +HEX_LITERAL: + 0[xX][0-9a-fA-F]+ + ; +OCTAL_LITERAL: + 0[0-7]* + ; +INTEGER_LITERAL: + [lL]? + | [lL]? + | [lL]? + ; +EXPONENT: + [eE][+-]?[09]+ + ; +FLOATING_POINT_LITERAL: + [0-9]+[.][0-9]*?[fFdD]? + | [.][0-9]+?[fFdD]? + | [0-9]+[fFdD]? + | [0-9]+?[fFdD] + ;") + +(defconst wisent-csharp-string-re "@?['\"]" + "Regexp matching beginning of a csharp string.") + +(defun wisent-csharp-expand-tag (tag) + "Expand TAG into a list of equivalent tags, or nil. +Expand multiple variable declarations in the same statement, that is +tags of class `variable' whose name is equal to a list of elements of +the form (NAME DEFAULT START . END). NAME is a variable name. DEFAULT is the +variable default value. START and END are the bounds in the declaration, +related to this variable NAME." + (let (elts elt clone def start end xpand) + (when (and (eq 'variable (semantic-tag-class tag)) + (consp (setq elts (semantic-tag-name tag)))) + ;; There are multiple names in the same variable declaration. + (while elts + ;; For each name element, clone the initial tag and give it + ;; the name of the element. + (setq elt (car elts) + elts (cdr elts) + clone (semantic-tag-clone tag (car elt)) + def (if elt (nth 1 elt) nil) + start (if elts (car (nth 2 elt)) (semantic-tag-start tag)) + end (if xpand (cdr (nth 2 elt)) (semantic-tag-end tag)) + xpand (cons clone xpand)) + ;; Set the bounds of the cloned tag with those of the name + ;; element. + (semantic-tag-set-bounds clone start end) + ;; i don't think this is doing the right thing + (if def + (semantic-tag-put-attribute clone :default-value def)) + ) + xpand))) + +;;;---------------------------------------------------------------------- +;;; * Semantic Support Code +;;;---------------------------------------------------------------------- + +;; types - special formatting for ref/out parameters +(define-mode-overload-implementation semantic-format-tag-type + csharp-mode (tag color) + "" + (let ((text (semantic-format-tag-type-default tag color)) + (mods (semantic-tag-get-attribute tag 'typemodifiers))) + (concat text (or (and (member "ref" mods) "&") + (and (member "out" mods) "*"))))) + +;; special formatting for certain csharp tags +(define-mode-overload-implementation semantic-format-tag-uml-prototype + csharp-mode (tag &optional parent color) + "" + (let ((property-p (semantic-tag-get-attribute tag 'property)) + (accessors (semantic-tag-get-attribute tag 'accessors))) + (cond + ;; properties: protection propname {get,set}: type + ((and property-p accessors) + (let ((name (semantic-format-tag-name tag parent color)) + (type (semantic--format-tag-uml-type tag color)) + (prot (semantic-format-tag-uml-protection tag parent color)) + (accesstext nil) + (text nil)) + (setq accesstext + (concat " {" + (mapconcat + #'(lambda (tag) + (semantic--format-colorize-text + (semantic-tag-name tag) 'function)) + accessors ",") + "}")) + (setq text (concat prot name accesstext type)) + (if color + (setq text (semantic--format-uml-post-colorize text tag parent))) + text)) + ;; rest - default format + (t + (semantic-format-tag-uml-prototype-default tag parent color))))) + +;; symbols modifiers that equate to abstract +(define-mode-overload-implementation semantic-tag-abstract + csharp-mode (tag &optional parent) + "Return non nil if TAG is abstract." + (let ((mods (semantic-tag-modifiers tag)) + (abs nil)) + (while (and (not abs) mods) + (if (stringp (car mods)) + (setq abs (or (string= (car mods) "abstract") + (string= (car mods) "virtual") + (string= (car mods) "override")))) + (setq mods (cdr mods))) + abs)) + +(defvar wisent-csharp-internal-is-protected-p t + "Says whether to show tags with internal protection as protected. +If non-nil any tags marked internal will be displayed as if they were +protected.") + +;; map tag protection string to symbol +(define-mode-overload-implementation semantic-tag-protection + csharp-mode (tag &optional parent) + "" + (let ((mods (semantic-tag-modifiers tag)) + (prot nil)) + (while (and (not prot) mods) + (if (stringp (car mods)) + (let ((s (car mods))) + (setq prot + ;; A few silly defaults to get things started. + (cond ((string= s "public") + 'public) + ((string= s "private") + 'private) + ((string= s "protected") + 'protected) + ((string= s "internal") + (if wisent-csharp-internal-is-protected-p + 'protected 'internal)))))) + (setq mods (cdr mods))) + prot)) + + +;; override semantic-format-uml-protection-to-string to return "%" for 'internal + +;; add to semantic-format-tag-protection-image-alist for 'internal + + +;; Local context +(define-mode-overload-implementation semantic-get-local-variables + csharp-mode () + "Get local values from a specific context. +Parse the current context for `local_variable_declaration' nonterminals to +collect tags, such as local variables or prototypes. +This function overrides `get-local-variables'." + (let ((vars nil) + ;; We want nothing to do with funny syntaxing while doing this. + (semantic-unmatched-syntax-hook nil) + (origp (point)) + start end) + (save-excursion + (while (not (semantic-up-context (point) 'function)) + (save-excursion + (forward-char 1) + (setq start (point) + end (min (progn (semantic-end-of-context) (point)) origp)) + (setq vars + (append (semantic-parse-region + start end + ;;'field_declaration + 'local_variable_declaration + 0 t) + vars)))) + vars))) + + +;;;---------------------------------------------------------------------- +;;; * Lexer +;;;---------------------------------------------------------------------- + +(define-lex-regex-analyzer wisent-csharp-lex-ignore-region + "Ignore # type macros for C sharp." + "^\\s-*#region\\>" + (goto-char (match-end 0)) + (forward-word 1) + (setq semantic-lex-end-point (point)) + nil) + +(define-lex-regex-analyzer wisent-csharp-lex-ignore-endregion + "Ignore # type macros for C sharp." + "^\\s-*#endregion\\>" + (setq semantic-lex-end-point (match-end 0)) + nil) + +(define-lex-analyzer wisent-csharp-lex-string + "Detect and create a string token for csharp strings." + (looking-at wisent-csharp-string-re) + (semantic-lex-push-token + (semantic-lex-token + 'STRING_LITERAL (point) + (save-excursion + (semantic-lex-unterminated-syntax-protection 'STRING_LITERAL + ;; skip over "@" character if any + (goto-char (1- (match-end 0))) + (forward-sexp 1) + (point)))))) + +(define-lex-simple-regex-analyzer wisent-csharp-lex-number + "Detect and create number tokens." + semantic-lex-number-expression 'NUMBER_LITERAL) + +(define-lex-regex-analyzer wisent-csharp-lex-symbol + "Detect and create identifier or keyword tokens." + "\\(\\sw\\|\\s_\\)+" + (semantic-lex-push-token + (semantic-lex-token + (or (semantic-lex-keyword-p (match-string 0)) + 'IDENTIFIER) + (match-beginning 0) + (match-end 0)))) + +(define-lex-block-analyzer wisent-csharp-lex-blocks + "Detect and create a open, close or block token." + (PAREN_BLOCK ("(" LPAREN) (")" RPAREN)) + (BRACE_BLOCK ("{" LBRACE) ("}" RBRACE)) + (BRACK_BLOCK ("[" LBRACK) ("]" RBRACK)) + ) + +(define-lex wisent-csharp-lexer + "Lexical analyzer for csharp code. +It ignores whitespaces, newlines and comments." + semantic-lex-ignore-whitespace + semantic-lex-ignore-newline + semantic-lex-ignore-comments + wisent-csharp-lex-ignore-region + wisent-csharp-lex-ignore-endregion + wisent-csharp-lex-number + wisent-csharp-lex-string + wisent-csharp-lex-symbol + semantic-lex-punctuation-type + wisent-csharp-lex-blocks + semantic-lex-default-action) + + +;;;---------------------------------------------------------------------- +;;; * Parser +;;;---------------------------------------------------------------------- + +;;;###autoload +(defun wisent-csharp-default-setup () + (wisent-csharp-wy--install-parser) + (setq + ;; Lexical analysis + semantic-lex-number-expression wysent-csharp-number-re + semantic-lex-analyzer #'wisent-csharp-lexer + ;; Parsing + semantic-tag-expand-function 'wisent-csharp-expand-tag + ;; Environment + semantic-type-relation-separator-character '(".") + semantic-command-separation-character ";" + ;; Imenu setup + semantic-imenu-summary-function 'semantic-format-tag-uml-prototype + imenu-create-index-function 'semantic-create-imenu-index + ;; speedbar and imenu bucket names + ;; .. in type parts + semantic-symbol->name-assoc-list-for-type-parts + '((type . "Types") + (variable . "Variables") + (function . "Methods")) + ;; .. everywhere + semantic-symbol->name-assoc-list + (append semantic-symbol->name-assoc-list-for-type-parts + '((include . "Using"))) + ;; navigation inside 'type children + senator-step-at-tag-classes '(function variable) + )) + +;;;###autoload +(add-hook 'csharp-mode-hook #'wisent-csharp-default-setup) + + +;;;---------------------------------------------------------------------- +;;; * Test +;;;---------------------------------------------------------------------- + +(defun wisent-csharp-lex-buffer (&optional arg) + "Run `wisent-csharp-lexer' on current buffer." + (interactive "P") + (semantic-lex-init) + (setq semantic-lex-analyzer 'wisent-csharp-lexer) + (let ((token-stream + (semantic-lex (point-min) (point-max) + (if arg (prefix-numeric-value arg))))) + (with-current-buffer + (get-buffer-create "*wisent-csharp-lexer*") + (erase-buffer) + (pp token-stream (current-buffer)) + (goto-char (point-min)) + (pop-to-buffer (current-buffer))))) + + +(provide 'wisent-csharp) + +;;; wisent-csharp.el ends here diff --git a/site/cedet-1.0pre7/contrib/wisent-csharp.wy b/site/cedet-1.0pre7/contrib/wisent-csharp.wy new file mode 100644 index 0000000..c9c8bfc --- /dev/null +++ b/site/cedet-1.0pre7/contrib/wisent-csharp.wy @@ -0,0 +1,1257 @@ +;;; wisent-csharp.wy -- LALR grammar for C# +;; +;; Copyright (C) 2003 David Shilvock +;; Time-stamp: <2003-12-08 19:11:48 dave> +;; +;; Author: David Shilvock +;; Maintainer: David Shilvock +;; Created: November 2003 +;; Keywords: syntax +;; +;; This file is not part of GNU Emacs. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. +;; +;; This software is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; This is a LALR parser for the C# language. It tries to follow the C# +;; language definition as closely as possible, but in some cases allows syntax +;; that the compiler would reject. +;; A bunch of this is ripped from wisent-java-tags.wy (David Ponce) + +;;----------- +;; * Settings +;;----------- + +;;%package wisent-csharp-wy + +%languagemode csharp-mode + +;; The default start symbol +%start compilation_unit +;; Alternate entry points - for partial re-parse +%start using_directive +%start namespace_declaration +%start class_declaration +%start const_declaration +%start field_declaration +%start constructor_declaration +%start method_declaration +%start property_declaration +%start indexer_declaration +%start event_declaration +%start fixed_parameter +%start interface_declaration +%start delegate_declaration +;; - Needed by EXPANDFULL clauses +%start namespace_member_declaration +%start class_member_declaration +%start struct_member_declaration +%start interface_member_declaration +%start accessor_declaration +%start event_accessor_declaration +%start formal_parameters +%start indexer_parameters +%start enum_members +;; - Need for semantic-get-local-variables +%start local_variable_declaration +%start local_foreach_declaration + +;;------------------------ +;; * Parenthesis terminals +;;------------------------ +%token LPAREN "(" +%token RPAREN ")" +%token LBRACE "{" +%token RBRACE "}" +%token LBRACK "[" +%token RBRACK "]" + +;;------------------ +;; * Block terminals +;;------------------ +%token PAREN_BLOCK "^(" +%token BRACE_BLOCK "^{" +%token BRACK_BLOCK "^\\[" + +;;--------------------- +;; * Operator terminals +;;--------------------- +%token NOT "!" +%token NOTEQ "!=" +%token MOD "%" +%token MODEQ "%=" +%token AND "&" +%token ANDAND "&&" +%token ANDEQ "&=" +%token MULT "*" +%token MULTEQ "*=" +%token PLUS "+" +%token PLUSPLUS "++" +%token PLUSEQ "+=" +%token COMMA "," +%token MINUS "-" +%token MINUSMINUS "--" +%token MINUSEQ "-=" +%token DOT "." +%token DIV "/" +%token DIVEQ "/=" +%token COLON ":" +%token SEMICOLON ";" +%token DEREF "->" +%token LT "<" +%token LSHIFT "<<" +%token LSHIFTEQ "<<=" +%token LTEQ "<=" +%token EQ "=" +%token EQEQ "==" +%token GT ">" +%token GTEQ ">=" +%token RSHIFT ">>" +%token RSHIFTEQ ">>=" +%token QUESTION "?" +%token XOR "^" +%token XOREQ "^=" +%token OR "|" +%token OREQ "|=" +%token OROR "||" +%token COMP "~" + +;;-------------------- +;; * Literal terminals +;;-------------------- +%token NULL_LITERAL "null" +%token BOOLEAN_LITERAL "false" +%token BOOLEAN_LITERAL "true" +%token IDENTIFIER +%token STRING_LITERAL +%token NUMBER_LITERAL + +;;-------------------- +;; * Keyword terminals +;;-------------------- +%token ABSTRACT "abstract" +%put ABSTRACT summary +"Class|Method declaration modifier: abstract {class|} ..." + +%token ADD "add" +%put ADD summary +"" + +%token AS "as" +%put AS summary +"" + +%token BASE "base" +%put BASE summary +"" + +%token BOOL "bool" +%put BOOL summary +"Primitive logical quantity type (true or false)" + +%token BREAK "break" +%put BREAK summary +"break [