List of Listings – Code Generation in Action

List of Listings

Chapter 3. Code generation tools

Listing 3.1. Example code for parsing SQL

Listing 3.2. Example code for parsing PostgreSQL

Listing 3.3. Example code for parsing C

Listing 3.4. Example code for parsing C++

Listing 3.5. Example code for parsing Java

Chapter 4. Building simple generators

Listing 4.1. Code munger 1, first variant: reading from a single file

Listing 4.2. Code munger 1, second variant: parsing a directory

Listing 4.3. Code munger 1, third variant: reading from standard input

Listing 4.4. Code munger 1, fourth variant: reading from a file using the language parser toolkit

Listing 4.5. Code munger 2: Looks for specific comments in a C file

Listing 4.6. Code munger 3: Converts a C file to HTML

Listing 4.7. Code munger 4: Transforms an XML file

Listing 4.8. Listing 4.8 Code munger 5: Creates C constants from a CSV file

Listing 4.9. Template for code munger 5

Listing 4.10. Code munger 6: Creates Java base classes for data storage

Listing 4.11.

Listing 4.12. Listing 4.12 Inline-code expander: Printf maker

Listing 4.13. Mixed-code generator 1: building printfs

Listing 4.14. Partial-class generator: building structure classes from a CSV file

Listing 4.15. The tier generator: building structure classes from XML

Listing 4.16.

Chapter 5. Generating user interfaces

Listing 5.1. Listuibuilder.rb

Listing 5.2. table_page

Listing 5.3. Form template code

Listing 5.4. edit_form

Chapter 6. Generating documentation

Listing 6.1. Example of Java using JavaDoc structured documentation standard

Listing 6.2. docgen.rb

Listing 6.3. table_page.html.template

Chapter 7. Generating unit tests

Listing 7.1. testgen.rb

Chapter 8. Embedding SQL with generators

Listing 8.1. psqlgen.rb

Listing 8.2. The FlexibleSQL class

Chapter 9. Handling data

Listing 9.1. csvgen.rb

Listing 9.2.

Listing 9.3. output

Chapter 11. Generating web services layers

Listing 11.1.

Listing 11.2. rpcgen.rb

Listing 11.3.

Listing 11.4.

Listing 11.5. output

Listing 11.6.

Listing 11.7. The

Listing 11.8. output

Listing 11.9.

Listing 11.10.

Chapter 12. Generating business logic

Listing 12.1.

Listing 12.2. after generation

Listing 12.3. bdgen.rb

Chapter 13. More generator ideas

Listing 13.1. lookup_function_example.c

Listing 13.2. lookup_table_example.c

Appendix C. EJBGen code and templates

Listing C.1. ejbgenRead.rb

Listing C.2. ejbgenDefs.rb

Listing C.3. ejbgen.rb

Listing C.4.

Listing C.5.

Listing C.6. Add.jsp.template

Listing C.7. jboss.xml.template

Listing C.8. tables.sql.template