1: <?php
2: 3: 4:
5:
6:
7:
8:
9:
10: require(__QCUBED__. '/codegen/QCodeGen.class.php');
11:
12:
13: include (__QCUBED_CORE__ . '/codegen/controls/_class_paths.inc.php');
14:
15:
16:
17: function PrintInstructions() {
18: global $strCommandName;
19: print('QCubed Code Generator (Command Line Interface) - ' . QCUBED_VERSION . '
20: Copyright (c) 2001 - 2009, QuasIdea Development, LLC, QCubed Project
21: This program is free software with ABSOLUTELY NO WARRANTY; you may
22: redistribute it under the terms of The MIT License.
23:
24: Usage: ' . $strCommandName . ' CODEGEN_SETTINGS
25:
26: Where CODEGEN_SETTINGS is the absolute filepath of the codegen_settings.xml
27: file, containing the code generator settings.
28:
29: For more information, please go to http://qcu.be
30: ');
31: exit();
32: }
33:
34: $settingsFile = __CONFIGURATION__ . '/codegen_settings.xml';
35: if ($_SERVER['argc'] >= 2)
36: $settingsFile = $_SERVER['argv'][1];
37:
38: if (!is_file($settingsFile)) {
39: PrintInstructions();
40: }
41:
42:
43:
44: QCodeGen::Run($settingsFile);
45:
46:
47:
48: if ($strErrors = QCodeGen::$RootErrors) {
49: printf("The following ROOT ERRORS were reported:\r\n%s\r\n\r\n", $strErrors);
50: } else {
51: printf("CodeGen settings (as evaluted from %s):\r\n%s\r\n\r\n", $settingsFile, QCodeGen::GetSettingsXml());
52: }
53:
54: foreach (QCodeGen::$CodeGenArray as $objCodeGen) {
55: printf("%s\r\n---------------------------------------------------------------------\r\n", $objCodeGen->GetTitle());
56: printf("%s\r\n", $objCodeGen->GetReportLabel());
57: printf("%s\r\n", $objCodeGen->GenerateAll());
58: if ($strErrors = $objCodeGen->Errors)
59: printf("The following errors were reported:\r\n%s\r\n", $strErrors);
60: print("\r\n");
61: }
62:
63: foreach (QCodeGen::GenerateAggregate() as $strMessage) {
64: printf("%s\r\n\r\n", $strMessage);
65: }