mirror of
https://github.com/irmen/prog8.git
synced 2025-01-27 10:31:40 +00:00
removed fake vm functions
This commit is contained in:
parent
8eff51904e
commit
38208a7c9e
@ -101,7 +101,7 @@ fun optimizeSameAssignments(linesByFourteen: List<List<IndexedValue<String>>>):
|
||||
|
||||
// optimize sequential assignments of the isSameAs value to various targets (bytes, words, floats)
|
||||
// the float one is the one that requires 2*7=14 lines of code to check...
|
||||
// @todo a better place to do this is in the Compiler instead and transform the Ast, and never even create the inefficient asm in the first place...
|
||||
// @todo a better place to do this is in the Compiler instead and transform the Ast, or the AsmGen, and never even create the inefficient asm in the first place...
|
||||
|
||||
val removeLines = mutableListOf<Int>()
|
||||
for (pair in linesByFourteen) {
|
||||
|
@ -88,32 +88,7 @@ val BuiltinFunctions = mapOf(
|
||||
BuiltinFunctionParam("address", IterableDatatypes + DataType.UWORD),
|
||||
BuiltinFunctionParam("numwords", setOf(DataType.UWORD)),
|
||||
BuiltinFunctionParam("wordvalue", setOf(DataType.UWORD, DataType.WORD))), null),
|
||||
"strlen" to FunctionSignature(true, listOf(BuiltinFunctionParam("string", StringDatatypes)), DataType.UBYTE, ::builtinStrlen),
|
||||
|
||||
// TODO clean up these vm-specific functions
|
||||
"vm_write_memchr" to FunctionSignature(false, listOf(BuiltinFunctionParam("address", setOf(DataType.UWORD))), null),
|
||||
"vm_write_memstr" to FunctionSignature(false, listOf(BuiltinFunctionParam("address", setOf(DataType.UWORD))), null),
|
||||
"vm_write_num" to FunctionSignature(false, listOf(BuiltinFunctionParam("number", NumericDatatypes)), null),
|
||||
"vm_write_char" to FunctionSignature(false, listOf(BuiltinFunctionParam("char", setOf(DataType.UBYTE))), null),
|
||||
"vm_write_str" to FunctionSignature(false, listOf(BuiltinFunctionParam("string", StringDatatypes)), null),
|
||||
"vm_input_str" to FunctionSignature(false, listOf(BuiltinFunctionParam("intovar", StringDatatypes)), null),
|
||||
"vm_gfx_clearscr" to FunctionSignature(false, listOf(BuiltinFunctionParam("color", setOf(DataType.UBYTE))), null),
|
||||
"vm_gfx_pixel" to FunctionSignature(false, listOf(
|
||||
BuiltinFunctionParam("x", IntegerDatatypes),
|
||||
BuiltinFunctionParam("y", IntegerDatatypes),
|
||||
BuiltinFunctionParam("color", IntegerDatatypes)), null),
|
||||
"vm_gfx_line" to FunctionSignature(false, listOf(
|
||||
BuiltinFunctionParam("x1", IntegerDatatypes),
|
||||
BuiltinFunctionParam("y1", IntegerDatatypes),
|
||||
BuiltinFunctionParam("x2", IntegerDatatypes),
|
||||
BuiltinFunctionParam("y2", IntegerDatatypes),
|
||||
BuiltinFunctionParam("color", IntegerDatatypes)), null),
|
||||
"vm_gfx_text" to FunctionSignature(false, listOf(
|
||||
BuiltinFunctionParam("x", IntegerDatatypes),
|
||||
BuiltinFunctionParam("y", IntegerDatatypes),
|
||||
BuiltinFunctionParam("color", IntegerDatatypes),
|
||||
BuiltinFunctionParam("text", StringDatatypes)),
|
||||
null)
|
||||
"strlen" to FunctionSignature(true, listOf(BuiltinFunctionParam("string", StringDatatypes)), DataType.UBYTE, ::builtinStrlen)
|
||||
)
|
||||
|
||||
fun builtinMax(array: List<Number>): Number = array.maxBy { it.toDouble() }!!
|
||||
|
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# this script uses the Gradle build to compile the code,
|
||||
# and then adds the contents of several jar files into one output jar.
|
||||
|
||||
./gradlew jar
|
||||
|
||||
mkdir -p compiler_jar/extracted
|
||||
mkdir -p compiler_jar/source
|
||||
cp compiler/build/libs/compiler.jar parser/build/libs/parser.jar parser/antlr/lib/antlr-runtime-4.7.2.jar compiler_jar/source/
|
||||
|
||||
KOTLINLIBS=$(kotlinc -verbose -script 2>&1 | grep home | cut -d ' ' -f 6-)/lib
|
||||
cp ${KOTLINLIBS}/kotlin-stdlib-jdk8.jar ${KOTLINLIBS}/kotlin-stdlib.jar compiler_jar/source/
|
||||
|
||||
pushd compiler_jar/extracted
|
||||
for i in ../source/*.jar; do jar xf $i; done
|
||||
cd ..
|
||||
jar cfe ../prog8compiler.jar prog8.CompilerMainKt -C extracted .
|
||||
popd
|
||||
rm -r compiler_jar
|
||||
ls -l prog8compiler.jar
|
Loading…
x
Reference in New Issue
Block a user