setFileName

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

setFileName

Koen_Be3840
Please correct me if I'm wrong:

In the VM Translator you can pass a directory or a fileName to the code writer.

This creates a streamWriter in case of dir: \dirHoldingFiles\dirHoldingFiles.asm (dir must hold Sys.vm!!, Main.vm, etc.)

This creates a streamWriter in case of file: \dirHoldingFiles\fileName.asm (file must include Sys.Init!!, Main.Function, etc.)

In both cases VMCodeWriter.setFileName() is only set once.

Koen
Reply | Threaded
Open this post in threaded view
|

Re: setFileName

cadet1620
Administrator
Koen_Be3840 wrote
Please correct me if I'm wrong:

In the VM Translator you can pass a directory or a fileName to the code writer.

This creates a streamWriter in case of dir: \dirHoldingFiles\dirHoldingFiles.asm (dir must hold Sys.vm!!, Main.vm, etc.)

This creates a streamWriter in case of file: \dirHoldingFiles\fileName.asm (file must include Sys.Init!!, Main.Function, etc.)

In both cases VMCodeWriter.setFileName() is only set once.

Koen
Only one instance of StreamWriter is created during the execution of the VM translator. It is created with the name of the output .asm file, either dir-name.asm or file-name.asm depending on the argument to the VM translator.

For every source file translated, StreamWriter.setFileName is called with the name of the source file. (The source file name is used to create unique symbol names in the .asm file.)

Here's an example from running my VM translator:
[P:/tecs/projects/09]
% hvm -v Reflect                      [Translating a directory]
Output to file Reflect\Reflect.asm    [CodeWriter constructed]
Processing directory Reflect
Processing Reflect\Array.vm           [CodeWriter.setFileName called]
Processing Reflect\Ball.vm            [CodeWriter.setFileName called]
Processing Reflect\Game.vm
Processing Reflect\Keyboard.vm
Processing Reflect\Main.vm
Processing Reflect\Math.vm
Processing Reflect\Memory.vm
Processing Reflect\Mirrors.vm
Processing Reflect\Output.vm
Processing Reflect\Random.vm
Processing Reflect\Screen.vm
Processing Reflect\String.vm
Processing Reflect\Sys.vm
Processing Reflect\Target.vm
[P:/tecs/projects/09]
% cd Reflect
[P:/tecs/projects/09/Reflect]
% hvm -v Game.vm                      [Translating a single file]
Output to file .\Game.asm             [CodeWriter constructed]
Processing Game.vm                    [CodeWriter.setFileName called]
[P:/tecs/projects/09/Reflect]

--Mark

   
Reply | Threaded
Open this post in threaded view
|

Re: setFileName

Koen_Be3840
Ok got it now

One instance of StreamWriter; in both cases.
setFileName every new File (in the directory) for unique "Static" symbols.


squashed the bugs and VM is running!!

thx Mark