This is an old revision of the document!


Joining strings in an input file

You can concatanate strings in a text file to build up complex filenames etc using the following:

macro data_directory {c:\data\storage_directory\}
macro file_stem {dataname_}
macro run_number {0000}
macro suffix {.xy}
 
macro file_dets(data_directory, file_stem, run_number, suffix) 
{
               data_directory##file_stem##run_number##suffix
}
macro file
{
               file_dets(data_directory, file_stem, run_number, suffix) 
} 
 
file

which will expand to:

c:\data\storage_directory\dataname_0000.xy

The ## concatenation sequence is a c pre-processor construct and only concatenates macro arguments hence the double step.

Similarly you can e.g. change the name of an output .xy file with macros like:

macro lor { 1000 }
 
macro File_Out_(n)
{
	voigt##n##.xy	
}
 
Out_X_Ycalc(File_Out_(lor))

Personal Tools