catblocks: linguagem visual com plugins wasm

This commit is contained in:
mguinhos committed 2026-10-20 21:12:51 +00:00
commit 95d7e3f800
35 files changed
+2294

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="digital.ovelha.catblocks"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="29" />
<application
android:label="@string/app_name"
android:hasCode="false"
android:theme="@android:style/Theme.Material.NoActionBar">
<activity
android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize">
<meta-data android:name="android.app.lib_name" android:value="catblocks" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
+39
View File
@@ -0,0 +1,39 @@
/* catblocks Android - NativeActivity sem Java.
* Usa android_native_app_glue (fornece ANativeActivity_onCreate, exigido pelo
* NativeActivity). Corre o interpretador de IR (catblocks) e registra a saida
* no logcat. Backend grafico continua stub (ver docs/ANDROID.md). */
#include <android/log.h>
#include <android_native_app_glue.h>
#include <stddef.h>
/* prototipos do nucleo catblocks compilado junto */
typedef struct cb_node cb_node;
cb_node *cb_program_sum(void);
char *cb_interp_run(cb_node *root, int nvars, char **out, size_t *outlen);
void cb_node_free_all(void *p);
static int g_ran = 0;
static void on_app_cmd(struct android_app *app, int32_t cmd) {
if (cmd == APP_CMD_INIT_WINDOW && !g_ran) {
g_ran = 1;
cb_node *root = cb_program_sum();
char *out = 0; size_t n = 0;
cb_interp_run(root, 4, &out, &n);
__android_log_print(ANDROID_LOG_INFO, "catblocks",
"saida do IR:\n%s", out ? out : "(vazio)");
cb_node_free_all(0);
}
}
void android_main(struct android_app *app) {
app->onAppCmd = on_app_cmd;
for (;;) {
int events;
struct android_poll_source *source;
while (ALooper_pollAll(-1, 0, &events, (void **)&source) >= 0) {
if (source) source->process(app, source);
if (app->destroyRequested) return;
}
}
}
+1
View File
@@ -0,0 +1 @@
<resources><string name="app_name">catblocks</string></resources>