On 01/06/2013 02:40 AM, joakim@... wrote:
> I'm making a simple srecode application for creating java classes
> according to a template.
> It involves creating a java class, adding fields, getters/setters,
> builders, and constructors. Nothing spectacular, but I thought it would
> be a good srecode exercise.
> some questions:
> - There seems to be a srecode-getset.el file floating around, but not
> in the cedet repo. Whats up with that?
I don't know about this specific file, but many of the more superfluous
options were not included in Emacs.
But that's ok. srecode-getset is an interactive tool. Put the cursor on
a field in a class, run the command, and it creates the get/set code for
you. It is not too closely related to what you want to do.
> - My application will likely be non-interactive. Lisp will be extracted
> from a csv file, and then fed to the srecode app that will create a
> number of corresponding classes. Any thoughts?
> - For code standard reasons the getters/setters should be in one area of
> the class, and the private fields collected in another area. How do I
> achieve jumping around in the file while expanding the srecode
The way to do this is pretty simple. While parsing/reading your csv
file, create a Semantic TAG table. Instead of moving around in the
file, you could probably call 'sort' on the fields of the class you are
creating with whatever rule you want.
When you are done with the entirety of your csv file analysis, and done
post-processing your faux semantic tags, you would call
srecode-semantic-insert-tag, and your entire class will be created.
There are good examples in the CEDET integration test suite. See
cedet/tests/cedet-integ-test.el, look for cit-srecode-insert-taglist for
the utility, and in cit-cpp.el, look for the tag tables that are created.