|
|
17aada5 |
/* Copyright (c) 2021 Jerry James
|
|
|
17aada5 |
*
|
|
|
17aada5 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
17aada5 |
* of this software and associated documentation files (the "Software"), to deal
|
|
|
17aada5 |
* in the Software without restriction, including without limitation the rights
|
|
|
17aada5 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
17aada5 |
* copies of the Software, and to permit persons to whom the Software is
|
|
|
17aada5 |
* furnished to do so, subject to the following conditions:
|
|
|
17aada5 |
*
|
|
|
17aada5 |
* The above copyright notice and this permission notice shall be included in
|
|
|
17aada5 |
* all copies or substantial portions of the Software.
|
|
|
17aada5 |
*
|
|
|
17aada5 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
17aada5 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
17aada5 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
17aada5 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
17aada5 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
17aada5 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
17aada5 |
* SOFTWARE.
|
|
|
17aada5 |
*/
|
|
|
17aada5 |
import java.io.FileWriter;
|
|
|
17aada5 |
import java.io.IOException;
|
|
|
17aada5 |
import scala.collection.immutable.Seq;
|
|
|
17aada5 |
|
|
|
17aada5 |
public class Generate {
|
|
|
17aada5 |
public static void main(String args[]) {
|
|
|
17aada5 |
Seq<GeneratedFile> files = codegen.genAll();
|
|
|
17aada5 |
for (int i = 0; i < files.length(); i++) {
|
|
|
17aada5 |
GeneratedFile gen = files.apply(i);
|
|
|
17aada5 |
try {
|
|
|
17aada5 |
FileWriter f = new FileWriter(args[0] + "/" + gen.name());
|
|
|
17aada5 |
f.write(gen.code());
|
|
|
17aada5 |
f.close();
|
|
|
17aada5 |
} catch (IOException e) {
|
|
|
17aada5 |
System.err.println("Failed to generate " + gen.name());
|
|
|
17aada5 |
System.err.println(e.toString());
|
|
|
17aada5 |
System.exit(1);
|
|
|
17aada5 |
}
|
|
|
17aada5 |
}
|
|
|
17aada5 |
}
|
|
|
17aada5 |
}
|