Commits

Anonymous committed dbbaaec

Config files can now be used with -config compiler option (no preprocessing yet)

Comments (0)

Files changed (4)

Compiler/Back/cgen.sa

 
    attr c_flags:FLIST{STR};	-- Flags to pass to C compiler
    attr externals:FMAP{STR,FSET{STR}}; -- Files linked if class reachable
+	 attr configs:LIST{STR};
    attr executable:STR;		-- The executable to output, or void
 
    attr optimize:BOOL;		-- Attempt optimizations
       LAYOUT_TBL::prog:=p;
       LAYOUT_TBL::cgen:=res;
       res.threshold:=150_000;	-- Default target size of 150KB per C file
+			res.configs := #;
       return res;
 
       -- Most initialization really occurs when "init" is called.

Compiler/Configuration/cs_options.sa

 	    (#OUT+"[has classes:"+classes.str+"]").flush;
 	 end;
 	 loop parser.has:=parser.has.insert(classes.elt!,fn); end;
+	    when "-config" then
+	 fn::=next_arg;
+	 if ~is_filename(fn) then
+	    #ERR+"-config clause did not have a file name after it."
+	    " Found:"+fn+" instead. Will be ignored\n";
+	 end;
+	 cgen.configs.append(fn)
       when "-O_hoist_iter_init" then
 	 cgen.optimize:=true;
 	 prog.hoist_iter_init:=true;

Compiler/sacomp.sa

 	end;
 
       loop p.config.read(p.platforms.elt!+"/CONFIG"); end;
+			loop
+			 additional_config ::= cgen.configs.elt!;
+			 --#OUT + "-------------reading config: " + additional_config + "\n";
+			 p.config.read( additional_config );
+			end;
+
 
       p.tp_tbl:=#(p);
       p.tp_graph:=#(p);
+user_config_files branch is about enabling users to add own .config files. .config file format does not seem to be described anywhere (this should also be done).