Next: , Previous: Base project methods, Up: Extending EDE

8.5 Sourcecode objects

EDE projects track source file / target associates via source code objects. The definitions for this is in ede-source.el. A source code object contains methods that know how to identify a file as being of that class, (i.e., a C file ends with .c). Some targets can handle many different types of sources which must all be compiled together. For example, a mixed C and C++ program would have instantiations of both sourcecode types.

When a target needs to know if it will accept a source file, it references its list of source code objects. These objects then make that decision.

Source code objects are stored in the target objects as a list of symbols, where the symbol's value is the object. This enables the project save file mechanism to work.

Here is an example for an instantiation of an Emacs Lisp source code object:

     (defvar ede-source-emacs
       (ede-sourcecode "ede-emacs-source"
                       :name "Emacs Lisp"
                       :sourcepattern "\\.el$"
                       :garbagepattern '("*.elc"))
       "Emacs Lisp source code definition.")

If you want to recycle parts of an existing sourcecode object, you can clone the original, and then just tweak the parts that are different. For example:

     (defvar ede-source-emacs-autoload
       (clone ede-source-emacs "ede-source-emacs-autoload"
              :name "Emacs Lisp Autoload"
              :sourcepattern "-loaddefs\\.el")
       "Emacs Lisp autoload source code.")

In this case, the garbage pattern is the same.

See Sourcecode.