[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.technology.gmt] MOFScript: Streamoutput written to wrong file

Hello

in the MOFScript user guide the behavior of the file statement is described 
as follows:
"Output statements (prints and escaped output) will be written to the latest 
declared
file in the runtime stack. A file declaration is active as long as the 
declaring rule is
active."
I declared two transfomation rules within one texttransformation their 
syntax is:

texttransformation file_test (in ecore:"ecore") {
 ecore.EPackage::main(){
  file("file2.txt")
  <% write some stuff to file 2!
  %>
   self.expandFile1()
  <% this should belong to file 2!  %>
 }
 ecore.EPackage::expandFile1(){
   file("file1.txt")
   <% write some stuff to file 1
   bla bla bla
   %>
 }
}
I would expect two files looking like this:
file1.txt:

write some stuff to file 1
bla bla bla
-----------------------
file2.txt:

write some stuff to file 2!
this should belong to file 2!

-----------------------
But when executing the texttransformation the two files look like this:
file1.txt:

write some stuff to file 1

bla bla bla
this should belong to file 2!
----------------------------------------------
file 2.txt:

write some stuff to file 2!

It seems like the outputstream for the transformation rule expandFile1() is 
not closed when the transformation rule is left by the runtime environment.
To me this behavior seems very strange. Does anyone have an explanation for 
that?

Regards
Jan