Questions tagged [code-generation]

Topics related to the generation of code as the output of an application, instead of directly writing code by a programmer.

3642 questions
2
votes
1 answer

How to output inside T4 template

I am trying to implement a T4 template to generate some redundant csharp code. My template gets object type passed in as following GenericTextFormatter<<#=type>> where type is typeof(objectA) etc. So I expected generated output of…
eYe
  • 1,695
  • 2
  • 29
  • 54
2
votes
2 answers

T4 texttransform passing parameters on command line possible?

I want to run the t4 TextTransForm.exe utility on my build server on the command line. I'm aware that the DTE object etc are not available on the command line. But executing a simple transform on a template which expects a parameter also suggests…
2
votes
5 answers

How to get String.Format not to parse {0}

I am writing a code generation tool that frequently will have lines like StringBuilder sp = new Stringbuilder(); sp.AppendFormat(" public {0}TextColumn()\n", className); sp.AppendLine(" {" sp.AppendLine(" Column = new…
Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
2
votes
1 answer

How can I extend the JOOQ code generator?

I'd like to make our JOOQ records more typesafe. For example, I'd like the BIGINT fields CUSTOMER.ID and ORDER.CUSTOMER_ID to be of type CustomerNo instead of just Long. I can force JOOQ's code generator generate the correct fields using a…
blubb
  • 9,510
  • 3
  • 40
  • 82
2
votes
1 answer

Jooq code generation "excludes" not working with typesafe config

I am trying to exclude two tables created by Liquibase when using TypeSafe Config. jooq { # databasechangelog = Liquibase generated tables # databasechangeloglock = Liquibase generated tables excludes = "databasechangelog,…
user1187135
2
votes
1 answer

Looking for a preprocessor to fill in static files

What I'm looking for would allow me to take something like this: index.html.template: <# include ("body.html.template") #> body.html.template: Hello World! <# include("text.txt") #> text.txt: 4 And turn it into…
Chris
  • 5,876
  • 3
  • 43
  • 69
2
votes
1 answer

Passing data from upper foreach

I have code for a T4 template that has two for each loops, and one is inside the other. I am having an issue escaping the inner for each and pass data from the parent for each. The image below demonstrates the variable data I am trying to pass from…
CodeMilian
  • 1,262
  • 2
  • 17
  • 41
2
votes
2 answers

Extending a macro in C

So I started writing a template in C using X-Macros and had the desire to use _Generic() to overload them. Problem is that would require extending a macro. I know I can't have a self-referential macro. And I believe I can't expand the definition of…
Black
  • 185
  • 9
2
votes
2 answers

How can I make IntelliJ auto-complete instantiation of List variables?

How can I teach IntelliJ to not initialize Collections with null values? (e.g. the following code will make IntelliJ mark my result variable, saying that it needs to be initialized, and that's fine) But when I use ALT+Enter on it to fix this, it…
Unknown Id
  • 460
  • 3
  • 12
2
votes
1 answer

Reading values from properties file in JOOQ Code Gen Config xml

Is it possible to read values from properties file(say a database property file) in my code generator xml configuration file? For Example, I have all my database properties stored in a separate file…
Aiden
  • 355
  • 5
  • 17
2
votes
3 answers

Generating php from delphi - has anyone done it?

See How to escape quote PHP strings generated by Delphi? I am just interested to hear if anyone has used Delphi (or possibly BCB) as a code generator for PHP ... (or thoughts about code generation from one language to another in general) Hmm, any…
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
2
votes
1 answer

Enterprise Architect code generation - compose - membervariable as array

I've this class diagram and the multiplicity 1 : 0..* The generated code from this model: public class TestKlasseB { public TestKlasseB(){ } ~TestKlasseB(){ } }//end TestKlasseB public class TestKlasseA { public…
2
votes
1 answer

Matlab Codgen eig() function - strange behaviour

First, don't be fooled by the long post, there is not a lot of code just an observation of results so there are few example matrices. This is a bit related to this question: Matlab Codegen Eig Function - Is this a Bug? I know that mex/C/C++…
micco
  • 362
  • 1
  • 16
2
votes
2 answers

Javascript code generator for C output?

I'd like to define a schema in JSON and generate C files to encode/decode streams that conform to the schema. A simplified example... The JSON object... var schema = { version: 1, objectA: { key: 0, type: "uint32_t", …
mtbkrdave
  • 2,900
  • 3
  • 23
  • 24
2
votes
3 answers

C++ code/XML generation tools

I'm not sure what exactly the right term is, kind of like ORM using XML as the data store. Are there any decent tools which will autogenerate C++ classes (including data and serialization/deserialization) based on an XML schema? Or will create…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589