From: Cheru on 17 Jun 2010 16:13 Hello, I discovered about Tcl just a couple of months ago and I already love it! But since I am a new developer I am not very experienced. I have some problems with a parser of a C++ source code on a Windows machine. I developed the code on my Mac and everything works just fine, but when I execute the same parser on the windows machine it does not compile. A simple working example: set fp [open $::source_file r] fconfigure $fp -translation auto set file_data [read $fp] close $fp set file_data [regsub {runThreshold = [^;]+;} $file_data "runThreshold = 0.001;"] set fp [open $::new_source_file w] fconfigure $fp -translation auto puts $fp $file_data close $fp This trick creates some problems on the linking phase of a Borland C++ compiler. If I comment out the line with the regsub the compiler does not complain. But if I define the variable runThreshold on a header file and I include it with the preprocessor it works. I suspect that there is some problem with the line endings (i.e. CR and LF) but the fconfigure did not do any good. Thanks, Cheru
From: Alexandre Ferrieux on 17 Jun 2010 20:09 On Jun 17, 10:13 pm, Cheru <cherubinetto.landolf...(a)gmail.com> wrote: > Hello, > > I discovered about Tcl just a couple of months ago and I already love > it! > But since I am a new developer I am not very experienced. > > I have some problems with a parser of a C++ source code on a Windows > machine. > I developed the code on my Mac and everything works just fine, but > when I execute the same parser on the windows machine it does not > compile. > > A simple working example: > > set fp [open $::source_file r] > fconfigure $fp -translation auto > set file_data [read $fp] > close $fp > > set file_data [regsub {runThreshold = [^;]+;} $file_data > "runThreshold = 0.001;"] > > set fp [open $::new_source_file w] > fconfigure $fp -translation auto > puts $fp $file_data > close $fp > > This trick creates some problems on the linking phase of a Borland C++ > compiler. > If I comment out the line with the regsub the compiler does not > complain. > > But if I define the variable runThreshold on a header file and I > include it with the preprocessor it works. > > I suspect that there is some problem with the line endings (i.e. CR > and LF) but the fconfigure did not do any good. > > Thanks, > Cheru You don't intend to tell us the exact link error, do you ? Also, printing out the result of the regsub is one obvious step towards understanding... -Alex
From: Cheru on 18 Jun 2010 01:29 On 18 Giu, 02:09, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> wrote: > On Jun 17, 10:13 pm, Cheru <cherubinetto.landolf...(a)gmail.com> wrote: > > > > > > > Hello, > > > I discovered about Tcl just a couple of months ago and I already love > > it! > > But since I am a new developer I am not very experienced. > > > I have some problems with a parser of a C++ source code on a Windows > > machine. > > I developed the code on my Mac and everything works just fine, but > > when I execute the same parser on the windows machine it does not > > compile. > > > A simple working example: > > > set fp [open $::source_file r] > > fconfigure $fp -translation auto > > set file_data [read $fp] > > close $fp > > > set file_data [regsub {runThreshold = [^;]+;} $file_data > > "runThreshold = 0.001;"] > > > set fp [open $::new_source_file w] > > fconfigure $fp -translation auto > > puts $fp $file_data > > close $fp > > > This trick creates some problems on the linking phase of a Borland C++ > > compiler. > > If I comment out the line with the regsub the compiler does not > > complain. > > > But if I define the variable runThreshold on a header file and I > > include it with the preprocessor it works. > > > I suspect that there is some problem with the line endings (i.e. CR > > and LF) but the fconfigure did not do any good. > > > Thanks, > > Cheru > > You don't intend to tell us the exact link error, do you ? > Also, printing out the result of the regsub is one obvious step > towards understanding... > > -Alex Unfortunately is is a really long source code and I can not post it because it is not a program of mine. But I looked for differences between the original and the parsed one look the same, except for the substitution. When I will have access to the Windows machine I will save the output of the compiler. Thanks, Cheru
|
Pages: 1 Prev: database interface supporting multiple statements Next: How to render text in image photo |