discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Source code generator, part 2


From: Stefan Urbanek
Subject: Source code generator, part 2
Date: Mon, 02 Aug 2004 20:43:01 +0200

Hi,

I have polished a bit the source code generator. Changes:

- new comments are used with syntax like /** Some ivar description | keywords 
*/, where everything after last pipe '|' character is considered as keyword 
list.
- keywords are: exposed, archived, object and readonly
- StepTalk script was added as a prototype of generator tool (sorry, no real 
tool yet)
- .h and .m templates were added, so source is generated according to them

DOWNLOAD
Source:
    http://stefan.agentfarms.net/Download/GNUstep/DevelopmentKit-20040802.tar.gz
CVS:
    cvs -z3 -d:ext:anoncvs@savannah.nongnu.org:/cvsroot/develkit co develkit

INSTALL:
    make install

USAGE:
If you have latest (from yesterday) CVS version of StepTalk:
    1. put Scripts/dkgenerate.st in one of the */Library/Scripts/Shell directory
    2. in a source directory run: stexec dkgenerate MyClass.h MyOtherClass.m
If you do not have latest StepTalk from CVS:
    1. put Scripts/dkgenerate.st in some source directory
    2. in the source directory run: stexec dkgenerate.st MyClass.h 
MyOtherClass.m

What will happen? MyClass-generated.m and MyOtherClass-generated.m will be 
created and MyClass.h and MyOtherClass.h will be modified. I know, I am going a 
bit agains myself with this, as mixing generated and user edited code in one 
file is not a good idea. However I found it reasonable solution for this time.

TODO:
- parse class comments to get class-wide defaults, like:
    archive:all - archive all ivars
    archive:custom - do not create archive methods
    scriptable - keyword for other tools for generating scripting info (or 
class descriptions)
    dealloc:custom - do not create dealloc method
    archive:nosuper - superclass does not have archiving methods (no NSCoding 
protocol), therefore do not call super on archiving
   ...
- create a cache for known type names that are class names, so one does not 
have to write 'object' keyword

REFERENCES:
Template example: 
http://stefan.agentfarms.net/Download/GNUstep/Trash/Generated-template.m
Script: http://stefan.agentfarms.net/Download/GNUstep/Trash/dkgenerate.st
Example header file: 
http://stefan.agentfarms.net/Download/GNUstep/Trash/AFModel.h

Enjoy and let me know what do you think of it. Feedback and patches are welcome.

Best regards,

Stefan Urbanek--
http://stefan.agentfarms.net

First they ignore you, then they laugh at you, then they fight you, then you 
win.
- Mahatma Gandhi






reply via email to

[Prev in Thread] Current Thread [Next in Thread]