| 
					
				 | 
			
			
				@@ -102,87 +102,87 @@ function handle_options(optionsArray) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // print available flags 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function print_usage() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    var usage = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        'Usage: amberc [-l lib1,lib2...] [-g jsGlobal1,jsGlobla2] [-m main_class] [-M main_file]', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '          [-n namespace] [-D output_dir] [-v] [-s suffix] [-S suffix] [file1 [file2 ...]] [Program]', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   amberc compiles Amber files - either separately or into a complete runnable', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   program. If no .st files are listed only a linking stage is performed.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   Files listed will be handled using the following rules:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   *.js', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Files are linked (concatenated) in listed order.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     If not found we look in $AMBER/js/', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   *.st', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Files are compiled into .js files before concatenation.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     If not found we look in $AMBER/st/.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     NOTE: Each .st file is currently considered to be a fileout of a single class', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     category of the same name as the file!', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   If no <Program> is specified each given .st file will be compiled into', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   a matching .js file. Otherwise a <Program>.js file is linked together based on', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '   the given options:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -l library1,library2', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Add listed JavaScript libraries in listed order.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Libraries are not separated by spaces or end with .js.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -L directory1,directory2', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Add listed directories to the library search path.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     The order of processing is:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     1. current directory', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     2. directories specified by -L', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     3. $AMBER', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -g jsGlobal1,jsGlobal2', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Comma separated list of JS global variable names.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     The names are added to a list containing "window", "document" and others.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -m main_class', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Add a call to the class method main_class>>main at the end of <Program>.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -M main_file', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Add <main_file> at the end of <Program.js> acting as #main.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -n amd_namespace', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Export packages with <amd_namespace> as the require.js namespace.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Default value is "amber_core".', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -v', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Produce a more verbose output.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -D', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Specifies the output directory for all generated .js files.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     The hierarchy of the input files is not maintaned.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     If this option is omitted all generated .js files are placed next to their input files', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -s suffix', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Add <suffix> to compiled .js files. File.st is then compiled into', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     File.<suffix>.js.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '  -S suffix', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Use <suffix> for all libraries accessed using -l. This makes it possible', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     to have multiple flavors of Amber and libraries in the same place.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Example invocations:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Just compile Kernel-Objects.st to Kernel-Objects.js:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '        amberc Kernel-Objects.st', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Compile Hello.st to Hello.js and create complete program called Program.js.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Additionally add a call to the class method Hello>>main:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '        amberc -m Hello Hello.st Program', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Compile Cat1.st and Cat2.st files into corresponding .js files.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     Link them with myboot.js and myKernel.js', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '     and merge everything into a complete program named Program.js:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        '        amberc -M main.js myboot.js myKernel.js Cat1.st Cat2.st Program', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    usage.forEach(function (line) { console.log(line); }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	var usage = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'Usage: amberc [-l lib1,lib2...] [-g jsGlobal1,jsGlobla2] [-m main_class] [-M main_file]', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'          [-n namespace] [-D output_dir] [-v] [-s suffix] [-S suffix] [file1 [file2 ...]] [Program]', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   amberc compiles Amber files - either separately or into a complete runnable', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   program. If no .st files are listed only a linking stage is performed.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   Files listed will be handled using the following rules:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   *.js', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Files are linked (concatenated) in listed order.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     If not found we look in $AMBER/js/', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   *.st', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Files are compiled into .js files before concatenation.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     If not found we look in $AMBER/st/.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     NOTE: Each .st file is currently considered to be a fileout of a single class', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     category of the same name as the file!', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   If no <Program> is specified each given .st file will be compiled into', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   a matching .js file. Otherwise a <Program>.js file is linked together based on', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'   the given options:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -l library1,library2', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Add listed JavaScript libraries in listed order.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Libraries are not separated by spaces or end with .js.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -L directory1,directory2', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Add listed directories to the library search path.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     The order of processing is:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     1. current directory', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     2. directories specified by -L', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     3. $AMBER', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -g jsGlobal1,jsGlobal2', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Comma separated list of JS global variable names.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     The names are added to a list containing "window", "document" and others.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -m main_class', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Add a call to the class method main_class>>main at the end of <Program>.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -M main_file', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Add <main_file> at the end of <Program.js> acting as #main.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -n amd_namespace', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Export packages with <amd_namespace> as the require.js namespace.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Default value is "amber_core".', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -v', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Produce a more verbose output.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -D', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Specifies the output directory for all generated .js files.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     The hierarchy of the input files is not maintaned.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     If this option is omitted all generated .js files are placed next to their input files', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -s suffix', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Add <suffix> to compiled .js files. File.st is then compiled into', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     File.<suffix>.js.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'  -S suffix', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Use <suffix> for all libraries accessed using -l. This makes it possible', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     to have multiple flavors of Amber and libraries in the same place.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Example invocations:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Just compile Kernel-Objects.st to Kernel-Objects.js:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'        amberc Kernel-Objects.st', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Compile Hello.st to Hello.js and create complete program called Program.js.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Additionally add a call to the class method Hello>>main:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'        amberc -m Hello Hello.st Program', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Compile Cat1.st and Cat2.st files into corresponding .js files.', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     Link them with myboot.js and myKernel.js', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'     and merge everything into a complete program named Program.js:', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		'        amberc -M main.js myboot.js myKernel.js Cat1.st Cat2.st Program', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	usage.forEach(function (line) { console.log(line); }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 |