yeet json

This commit is contained in:
dankeyy 2023-03-11 17:46:27 +02:00
parent 2d004dc57b
commit f9974f1d32
No known key found for this signature in database
GPG key ID: 9EBEF7DB1A70533D
4 changed files with 4 additions and 3474 deletions

View file

@ -213,8 +213,6 @@ extern void roc__mainForHost_1_exposed_generic(struct RocBytes *ret, struct RocB
JNIEXPORT jstring JNICALL Java_HelloJNI_sayHello
(JNIEnv *env, jobject thisObj, jint num)
{
char native_string[256] = {0};
sprintf(native_string, "%d", num);
@ -224,19 +222,6 @@ JNIEXPORT jstring JNICALL Java_HelloJNI_sayHello
// Call the Roc function to populate `ret`'s bytes.
roc__mainForHost_1_exposed_generic(&ret, &arg);
/* struct json_value_s* root = json_parse((char *)ret.bytes, ret.len); */
/* if (root == NULL) { */
/* printf("Failed to parse JSON\n"); */
/* exit(1); */
/* } */
/* struct json_string_s * json_string = json_value_as_string(root); */
/* if (json_string == NULL) { */
/* printf("JSON value is not a string\n"); */
/* exit(1); */
/* } */
/* free(root); */
decref((void *)&ret, alignof(uint8_t *));
@ -266,5 +251,4 @@ JNIEXPORT jstring JNICALL Java_HelloJNI_sayHello
(*env)->DeleteLocalRef(env, byteArray);
return result;
}

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,3 @@ main = \num ->
else
str = Num.toStr num
"The number was \(str), OH YEAH!!! 🤘🤘"
# main : Str -> Str
# main = \name -> "Hello from roc \(name)!!!"

View file

@ -1,12 +1,12 @@
platform "jvm-interop"
requires {} { main : arg -> ret | arg has Decoding, ret has Encoding }
requires {} { main : arg -> ret | arg has Decoding }
exposes []
packages {}
imports [Json]
provides [mainForHost]
mainForHost : List U8 -> List U8
mainForHost : List U8 -> Str
mainForHost = \json ->
when Decode.fromBytes json Json.fromUtf8 is
Ok arg -> Encode.toBytes (main arg) Json.toUtf8
Err _ -> []
Ok arg -> main arg
Err _ -> "Decoding Error"