updates coredsl version and makes BitValues with leading zeros
This commit is contained in:
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Automatic-Module-Name: com.minres.coredsl.json
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-Version: 2.0.1
|
||||
Bundle-Version: 2.0.2
|
||||
Bundle-SymbolicName: com.minres.coredsl.json;singleton:=true
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Require-Bundle: com.minres.coredsl;bundle-version="2.0.0",
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.coredsl</groupId>
|
||||
<artifactId>com.minres.coredsl.json.parent</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.0.2</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>com.minres.coredsl.json</artifactId>
|
||||
|
@@ -20,6 +20,7 @@ import org.json.JSONObject
|
||||
import org.json.JSONArray
|
||||
import com.minres.coredsl.coreDsl.Statement
|
||||
import org.eclipse.xtext.resource.XtextResource
|
||||
import com.minres.coredsl.util.TypedBigInteger
|
||||
|
||||
/**
|
||||
* Generates code from your model files on save.
|
||||
@@ -108,7 +109,15 @@ class CoreDslJsonGenerator extends AbstractGenerator {
|
||||
def dispatch asString(BitField i) '''«i.name»[«i.startIndex.value.intValue»:«i.endIndex.value.intValue»]'''
|
||||
|
||||
def dispatch asString(BitValue i) {
|
||||
i.value.toString(2)
|
||||
val str = i.value.toString(2)
|
||||
if(i.value instanceof TypedBigInteger) {
|
||||
val v = i.value as TypedBigInteger
|
||||
if(v.size > str.length) {
|
||||
val format_string = String.format("%%%ds", v.size)
|
||||
return String.format(format_string, str).replace(' ', '0');
|
||||
}
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user