Move global constants into their own section since we seem to be having
trouble linking in 'extern const' variables when manually cleaving mu.cc
into separate compilation units.
This commit is contained in:
Kartik K. Agaram 2016-08-28 17:08:01 -07:00
parent c7a836797a
commit c7fde8d4e4
9 changed files with 13 additions and 11 deletions

View File

@ -105,6 +105,9 @@
//
// End Globals
// Constants
// End Constants
int main(int argc, char* argv[]) {
atexit(teardown);

View File

@ -10,8 +10,7 @@
:(before "End Types")
typedef void (*test_fn)(void);
:(before "Globals")
// move a global ahead into types that we can't generate an extern declaration for
:(before "End Constants")
const test_fn Tests[] = {
#include "test_list" // auto-generated; see makefile
};

View File

@ -383,7 +383,7 @@ using std::ofstream;
#include "termbox/termbox.h"
:(before "End Globals")
:(before "End Constants")
//: In future layers we'll use the depth field as follows:
//:
//: Errors will be depth 0.

View File

@ -412,7 +412,7 @@ string_tree* property(const reagent& r, const string& name) {
return NULL;
}
:(before "End Globals")
:(before "End Constants")
const string Ignore(","); // commas are ignored in mu except within [] strings
:(code)
void skip_whitespace_but_not_newline(istream& in) {

View File

@ -155,7 +155,7 @@ string next_word(istream& in) {
return out.str();
}
:(before "End Globals")
:(before "End Constants")
// word boundaries
const string Terminators("(){}");
:(code)

View File

@ -79,7 +79,7 @@ container foo:t [
]
+error: foo: type ingredient 't' must begin with an underscore
:(before "End Globals")
:(before "End Constants")
// We'll use large type ordinals to mean "the following type of the variable".
// For example, if we have a generic type called foo:_elem, the type
// ingredient _elem in foo's type_info will have value START_TYPE_INGREDIENTS,

View File

@ -143,10 +143,10 @@ assert(Next_predefined_global_for_scenarios < Reserved_for_tests);
// initialize a default-space.
assert(Name[tmp_recipe.at(0)][""] < Max_variables_in_scenarios);
:(before "End Globals")
// Scenario Globals.
:(before "End Constants")
// Fixed Scenario Locations.
const int SCREEN = Next_predefined_global_for_scenarios++;
// End Scenario Globals.
// End Fixed Scenario Locations.
//: give 'screen' a fixed location in scenarios
:(before "End Special Scenario Variable Names(r)")

View File

@ -33,7 +33,7 @@ scenario keyboard-in-scenario [
]
]
:(before "End Scenario Globals")
:(before "End Fixed Scenario Locations")
const int CONSOLE = Next_predefined_global_for_scenarios++;
//: give 'console' a fixed location in scenarios
:(before "End Special Scenario Variable Names(r)")

View File

@ -72,7 +72,7 @@ scenario assume-filesystem [
]
]
:(before "End Globals")
:(before "End Fixed Scenario Locations")
const int FILESYSTEM = Next_predefined_global_for_scenarios++;
//: give 'filesystem' a fixed location in scenarios
:(before "End Special Scenario Variable Names(r)")