Re: [Quickfix-developers] Generate script broken for c++?
Brought to you by:
orenmnero
From: Asher N. <ash...@gm...> - 2014-04-22 17:29:39
|
So I went ahead and did some digging, and this appears to be a problem with Ruby. Firstly, I discovered that code generation is now handled by various GeneratorXX.rb ruby scripts. I've not seen that documented or mentioned anywhere. Secondly, the Ruby 'print' function appears to be the culprit adding brackets [ and quotation marks ". It's worth mentioning that I know zero about Ruby. I made the following changes to GeneratorCPP.rb to get things to compile: diff --git a/spec/GeneratorCPP.rb b/spec/GeneratorCPP.rb index ed9fd2f..244ba33 100644 --- a/spec/GeneratorCPP.rb +++ b/spec/GeneratorCPP.rb @@ -106,8 +106,8 @@ class GeneratorCPP @f.puts "class " + name + ": public FIX::Group" @f.puts "{" @f.puts "public:" - @f.print name + "() : FIX::Group(" + number + "," + delim + "," + "FIX::message_order(" - order.each { |field| @f.printInline field + "," } + @f.puts name + "() : FIX::Group(" + number + "," + delim + "," + "FIX::message_order(" + order.each { |field| @f.putsInline field + "," } @f.putsInline "0)) {}" end @@ -144,7 +144,7 @@ class GeneratorCPP @f.indent required.each_index { |i| field = required[i] - @f.print "const FIX::" + field + "& a" + field + @f.puts "const FIX::" + field + "& a" + field if(i != required.size-1) @f.putsInline "," else That results in the generated files containing some extraneous newlines (which puts inserts but print does not), but otherwise everything appears to work. I'm not going to do any more research on this assuming my correction works, but I wanted to let the community know what I found. Thanks, Asher On Tue, Apr 22, 2014 at 11:50 AM, Asher Newcomer <ash...@gm...> wrote: > Apologies for the typo - clearly the errors occur after I run the > generate.sh script in the spec directory, not the configure script. > > Thanks > > > ---------- Forwarded message ---------- > From: Asher Newcomer <ash...@gm...> > Date: Tue, Apr 22, 2014 at 11:16 AM > Subject: Generate script broken for c++? > To: qui...@li... > > > Hi All, > > I'm attempting to make some very simple changes to the FIX field > definitions in Quickfix, but the generate.sh script seems to be producing > invalid code. > > I have no problem compiling and using the source code directly from the > repo (bootstrap, configure, make). > > However, if I first run the configure.sh script in the spec directory, I > receive errors on a subsequent build because the xsl seems to insert 'bad' > characters into the code. This is prior to me making any changes. Diff on a > couple files as follows: > > diff --git a/quickfix/src/C++/fix42/Advertisement.h > b/quickfix/src/C++/fix42/Advertisement.h > index 71391af..eca39fd 100644 > --- a/quickfix/src/C++/fix42/Advertisement.h > +++ b/quickfix/src/C++/fix42/Advertisement.h > @@ -16,11 +16,11 @@ namespace FIX42 > static FIX::MsgType MsgType() { return FIX::MsgType("7"); } > > Advertisement( > - const FIX::AdvId& aAdvId, > - const FIX::AdvTransType& aAdvTransType, > - const FIX::Symbol& aSymbol, > - const FIX::AdvSide& aAdvSide, > - const FIX::Shares& aShares ) > + ["const FIX::AdvId& aAdvId"], > + ["const FIX::AdvTransType& aAdvTransType"], > + ["const FIX::Symbol& aSymbol"], > + ["const FIX::AdvSide& aAdvSide"], > + ["const FIX::Shares& aShares"] ) > : Message(MsgType()) > { > set(aAdvId); > diff --git a/quickfix/src/C++/fix42/Allocation.h > b/quickfix/src/C++/fix42/Allocation.h > index d5d876e..dced96d 100644 > --- a/quickfix/src/C++/fix42/Allocation.h > +++ b/quickfix/src/C++/fix42/Allocation.h > @@ -16,13 +16,13 @@ namespace FIX42 > static FIX::MsgType MsgType() { return FIX::MsgType("J"); } > > Allocation( > - const FIX::AllocID& aAllocID, > - const FIX::AllocTransType& aAllocTransType, > - const FIX::Side& aSide, > - const FIX::Symbol& aSymbol, > - const FIX::Shares& aShares, > - const FIX::AvgPx& aAvgPx, > - const FIX::TradeDate& aTradeDate ) > + ["const FIX::AllocID& aAllocID"], > + ["const FIX::AllocTransType& aAllocTransType"], > + ["const FIX::Side& aSide"], > + ["const FIX::Symbol& aSymbol"], > + ["const FIX::Shares& aShares"], > + ["const FIX::AvgPx& aAvgPx"], > + ["const FIX::TradeDate& aTradeDate"] ) > > > Any ideas why the brackets and quotations marks are being generated? Any > ideas what I can do to sort this out? > > I'd very much appreciate any insight anyone can offer, as I'm not eager to > go spelunking through the XSL. > > Regards, > > Asher > > |