Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds basic support for message variants. Variants are placed in `variant/*.cmake` files. Variants can include different sections of the message. There is rudimentary support for encoding differences. Currently the only option supported is whether the `|` and `$` syntax is considered to be syntactic sugar that needs expanding into parentheses, or genuine symbols to be communicated.
- Loading branch information
Showing
9 changed files
with
111 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"variant": "@COSMIC_VARIANT@", | ||
"use_flattener": @COSMIC_USE_FLATTENER@, | ||
"lines": @COSMIC_LINES@ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// -*- mode:java; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- | ||
|
||
package cosmicos; | ||
|
||
@:expose | ||
class Config { | ||
private var config : Dynamic; | ||
|
||
public function new(txt: String = null) { | ||
config = null; | ||
if (txt != null) { | ||
config = haxe.Json.parse(txt); | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* Option: is flattener syntax "|" and "$" supported in the message or should | ||
* these be mapped to parentheses. | ||
* | ||
*/ | ||
public function useFlattener() : Bool { | ||
if (config == null) return true; | ||
return Reflect.field(config, 'use_flattener'); | ||
} | ||
|
||
/** | ||
* | ||
* | ||
* Number of lines of message to work on - 0 means unlimited. Can be convenient | ||
* to set to a small number during development. | ||
* | ||
*/ | ||
public function lines() : Int { | ||
if (config == null) return 0; | ||
return Reflect.field(config, 'lines'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# we expect to get a variable COSMIC_DEPENDS that lists all parts | ||
include(${CMAKE_SOURCE_DIR}/src/README.cmake) | ||
|
||
# Flag controlling whether the "|" symbol for flattening messages can be | ||
# encoded (if false), or (if false) should be expanded to nested parens. | ||
set(COSMIC_USE_FLATTENER true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# we expect to get a variable COSMIC_DEPENDS that lists all parts | ||
include(${CMAKE_SOURCE_DIR}/src/README.cmake) | ||
|
||
# Flag controlling whether the "|" symbol for flattening messages can be | ||
# encoded (if true), or (if false) should be expanded to nested parens. | ||
set(COSMIC_USE_FLATTENER false) |