mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-15 21:23:57 +00:00
yeet json
This commit is contained in:
parent
2d004dc57b
commit
f9974f1d32
4 changed files with 4 additions and 3474 deletions
|
|
@ -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
|
|
@ -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)!!!"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue