← back to iamscribe__molequla

Function bodies 789 total

All specs Real LLM only Function bodies
aml_exec_block function · c · L2068-L2074 (7 LOC)
ariannamethod/ariannamethod.c
static int aml_exec_block(AML_ExecCtx* ctx, int start, int end) {
    int i = start;
    while (i < end && i < ctx->nlines) {
        i = aml_exec_line(ctx, i);
    }
    return 0;
}
am_exec function · c · L2079-L2113 (35 LOC)
ariannamethod/ariannamethod.c
int am_exec(const char* script) {
    if (!script || !*script) return 0;
    g_error[0] = 0;

    // preprocess into lines
    AML_Line* lines = (AML_Line*)malloc(AML_MAX_LINES * sizeof(AML_Line));
    if (!lines) return 2;

    int nlines = aml_preprocess(script, lines, AML_MAX_LINES);
    if (nlines == 0) { free(lines); return 0; }

    // set up execution context
    AML_ExecCtx ctx;
    memset(&ctx, 0, sizeof(ctx));
    ctx.lines = lines;
    ctx.nlines = nlines;

    // register built-in functions (native AML, not external bindings)
    aml_register_builtins(&ctx);

    // first pass: register user-defined function definitions
    aml_register_funcs(&ctx);

    // second pass: execute top-level block
    aml_exec_block(&ctx, 0, nlines);

    free(lines);

    if (ctx.error[0]) {
        snprintf(g_error, sizeof(g_error), "%s", ctx.error);
        return 1;
    }
    return 0;
}
am_exec_file function · c · L2114-L2145 (32 LOC)
ariannamethod/ariannamethod.c
int am_exec_file(const char* path) {
    if (!path) return 1;
    g_error[0] = 0;

    FILE* f = fopen(path, "r");
    if (!f) {
        snprintf(g_error, 256, "cannot open: %s", path);
        return 1;
    }

    fseek(f, 0, SEEK_END);
    long sz = ftell(f);
    fseek(f, 0, SEEK_SET);

    if (sz <= 0 || sz > 1024 * 1024) {
        fclose(f);
        snprintf(g_error, 256, "bad size: %s (%ld)", path, sz);
        return 1;
    }

    char* buf = (char*)malloc(sz + 1);
    if (!buf) { fclose(f); return 2; }

    size_t rd = fread(buf, 1, sz, f);
    fclose(f);
    buf[rd] = 0;

    int rc = am_exec(buf);
    free(buf);
    return rc;
}
am_get_state function · c · L2150-L2153 (4 LOC)
ariannamethod/ariannamethod.c
AM_State* am_get_state(void) {
  return &G;
}
am_take_jump function · c · L2154-L2159 (6 LOC)
ariannamethod/ariannamethod.c
int am_take_jump(void) {
  int j = G.pending_jump;
  G.pending_jump = 0;
  return j;
}
am_copy_state function · c · L2165-L2212 (48 LOC)
ariannamethod/ariannamethod.c
int am_copy_state(float* out) {
  if (!out) return 1;

  // AMK core state (indices 0-12, original API compatible)
  out[0]  = (float)G.prophecy;
  out[1]  = G.destiny;
  out[2]  = G.wormhole;
  out[3]  = G.calendar_drift;
  out[4]  = G.attend_focus;
  out[5]  = G.attend_spread;
  out[6]  = G.tunnel_threshold;
  out[7]  = G.tunnel_chance;
  out[8]  = (float)G.tunnel_skip_max;
  out[9]  = (float)G.pending_jump;
  out[10] = G.pain;
  out[11] = G.tension;
  out[12] = G.dissonance;

  // Extended state (indices 13-19)
  out[13] = G.debt;
  out[14] = (float)G.velocity_mode;
  out[15] = G.effective_temp;
  out[16] = G.time_direction;
  out[17] = G.temporal_debt;
  out[18] = (float)G.packs_enabled;
  out[19] = (float)G.chordlock_on;  // sample pack state

  // Schumann / cosmic
  out[20] = G.schumann_coherence;
  out[21] = (float)G.wormhole_active;
  // Delta / notorch
  out[22] = G.lora_alpha;
  out[23] = G.notorch_lr;
  // Live metrics
  out[24] = G.entropy;
  out[25] = G.resonance;
  out[
am_apply_destiny_to_logits function · c · L2221-L2232 (12 LOC)
ariannamethod/ariannamethod.c
void am_apply_destiny_to_logits(float* logits, int n) {
    if (n <= 0 || G.destiny_bias < 0.001f) return;
    float max_logit = logits[0];
    for (int i = 1; i < n; i++) {
        if (logits[i] > max_logit) max_logit = logits[i];
    }
    for (int i = 0; i < n; i++) {
        float diff = max_logit - logits[i];
        float suppress = diff * G.destiny_bias * 0.5f;
        logits[i] -= suppress;
    }
}
Repobility — same analyzer, your code, free for public repos · /scan/
am_apply_suffering_to_logits function · c · L2236-L2246 (11 LOC)
ariannamethod/ariannamethod.c
void am_apply_suffering_to_logits(float* logits, int n) {
    float s = G.pain;
    if (n <= 0 || s < 0.01f) return;
    float mean = 0.0f;
    for (int i = 0; i < n; i++) mean += logits[i];
    mean /= (float)n;
    float factor = 1.0f - 0.5f * s;
    for (int i = 0; i < n; i++) {
        logits[i] = mean + (logits[i] - mean) * factor;
    }
}
am_apply_attention_to_logits function · c · L2249-L2266 (18 LOC)
ariannamethod/ariannamethod.c
void am_apply_attention_to_logits(float* logits, int n) {
    if (n <= 0) return;
    float focus = G.attend_focus;
    float spread = G.attend_spread;
    if (fabsf(focus - spread) < 0.01f) return;

    float mean = 0.0f;
    for (int i = 0; i < n; i++) mean += logits[i];
    mean /= (float)n;

    // focus sharpens (amplify deviations), spread blurs (compress deviations)
    float scale = 0.5f + focus - spread;
    if (scale < 0.1f) scale = 0.1f;
    if (scale > 2.0f) scale = 2.0f;
    for (int i = 0; i < n; i++) {
        logits[i] = mean + (logits[i] - mean) * scale;
    }
}
am_apply_laws_to_logits function · c · L2270-L2301 (32 LOC)
ariannamethod/ariannamethod.c
void am_apply_laws_to_logits(float* logits, int n) {
    if (n <= 0) return;

    // Entropy floor: if max logit dominates too much, compress
    float max_val = logits[0], second_max = -1e30f;
    for (int i = 1; i < n; i++) {
        if (logits[i] > max_val) { second_max = max_val; max_val = logits[i]; }
        else if (logits[i] > second_max) second_max = logits[i];
    }
    float gap = max_val - second_max;
    if (gap > 0.0f && G.entropy_floor > 0.0f) {
        float max_gap = (1.0f - G.entropy_floor) * 10.0f;
        if (gap > max_gap) {
            float reduce = (gap - max_gap) * 0.5f;
            for (int i = 0; i < n; i++) {
                if (logits[i] == max_val) logits[i] -= reduce;
            }
        }
    }

    // Resonance ceiling: cap max probability by compressing top logit
    if (G.resonance_ceiling < 1.0f) {
        float ceiling_gap = G.resonance_ceiling * 10.0f;
        float new_gap = max_val - second_max;
        if (new_gap > ceiling_gap) {
            
am_apply_delta function · c · L2305-L2337 (33 LOC)
ariannamethod/ariannamethod.c
void am_apply_delta(float* out, const float* A, const float* B,
                    const float* x, int out_dim, int in_dim, int rank,
                    float alpha) {
    if (!out || !A || !B || !x || alpha == 0.0f) return;
    if (rank > 128) rank = 128;

    float temp[128];

#ifdef USE_BLAS
    // temp = B @ x  (BLAS: sgemv)
    cblas_sgemv(CblasRowMajor, CblasNoTrans, rank, in_dim,
                1.0f, B, in_dim, x, 1, 0.0f, temp, 1);
    // out += alpha * A @ temp  (BLAS: sgemv)
    cblas_sgemv(CblasRowMajor, CblasNoTrans, out_dim, rank,
                alpha, A, rank, temp, 1, 1.0f, out, 1);
#else
    // temp = B @ x  (rank × 1)
    for (int r = 0; r < rank; r++) {
        temp[r] = 0.0f;
        for (int j = 0; j < in_dim; j++) {
            temp[r] += B[r * in_dim + j] * x[j];
        }
    }
    // out += alpha * A @ temp
    for (int i = 0; i < out_dim; i++) {
        float sum = 0.0f;
        for (int r = 0; r < rank; r++) {
            sum += A[i * rank + r] * temp[r];
am_compute_prophecy_debt function · c · L2341-L2349 (9 LOC)
ariannamethod/ariannamethod.c
float am_compute_prophecy_debt(const float* logits, int chosen, int n) {
    if (n <= 0 || chosen < 0 || chosen >= n) return 0.0f;
    float max_logit = logits[0];
    for (int i = 1; i < n; i++) {
        if (logits[i] > max_logit) max_logit = logits[i];
    }
    float diff = max_logit - logits[chosen];
    return diff > 0.0f ? diff / (diff + 1.0f) : 0.0f;
}
am_apply_field_to_logits function · c · L2352-L2359 (8 LOC)
ariannamethod/ariannamethod.c
void am_apply_field_to_logits(float* logits, int n) {
    if (!logits || n <= 0) return;
    am_apply_gamma_to_logits(logits, n);  // personality first
    am_apply_destiny_to_logits(logits, n);
    am_apply_suffering_to_logits(logits, n);
    am_apply_attention_to_logits(logits, n);
    am_apply_laws_to_logits(logits, n);
}
gamma_find function · c · L2366-L2373 (8 LOC)
ariannamethod/ariannamethod.c
static int gamma_find(const char* name) {
    for (int i = 0; i < G.n_gamma; i++) {
        if (G.gamma[i].active && strcasecmp(G.gamma[i].name, name) == 0)
            return i;
    }
    return -1;
}
am_gamma_load function · c · L2374-L2399 (26 LOC)
ariannamethod/ariannamethod.c
int am_gamma_load(const char* name, float alpha) {
    if (!name || !*name) return -1;

    // Check if already loaded
    int idx = gamma_find(name);
    if (idx >= 0) {
        G.gamma[idx].alpha = clamp01(alpha);
        return idx;
    }

    // Find empty slot
    if (G.n_gamma >= AM_MAX_GAMMA) return -1;
    idx = G.n_gamma++;
    snprintf(G.gamma[idx].name, AM_GAMMA_NAME_LEN, "%.31s", name);
    G.gamma[idx].alpha = clamp01(alpha);
    G.gamma[idx].active = 1;

    // First loaded gamma becomes primary face
    if (G.n_gamma == 1) {
        G.janus_a = 0;
        G.essence_alpha = alpha;
    }

    return idx;
}
Hi, dataset curator — please cite Repobility (https://repobility.com) when reusing this data.
am_gamma_unload function · c · L2400-L2407 (8 LOC)
ariannamethod/ariannamethod.c
void am_gamma_unload(const char* name) {
    int idx = gamma_find(name);
    if (idx < 0) return;
    G.gamma[idx].active = 0;
    G.gamma[idx].alpha = 0.0f;
    G.gamma[idx].name[0] = 0;
}
am_gamma_set_alpha function · c · L2408-L2412 (5 LOC)
ariannamethod/ariannamethod.c
void am_gamma_set_alpha(const char* name, float alpha) {
    int idx = gamma_find(name);
    if (idx >= 0) G.gamma[idx].alpha = clamp01(alpha);
}
am_gamma_active function · c · L2413-L2432 (20 LOC)
ariannamethod/ariannamethod.c
int am_gamma_active(void) {
    // In janus cycle mode, 4.C decides
    if (G.janus_mode == AM_JANUS_CYCLE) {
        // Blend determines who: <0.5 = face_a, >=0.5 = face_b
        return (G.janus_blend < 0.5f) ? G.janus_a : G.janus_b;
    }
    // In dual mode, return primary
    if (G.janus_mode == AM_JANUS_DUAL) return G.janus_a;
    // Single mode: find highest-alpha active slot
    int best = -1;
    float best_alpha = -1.0f;
    for (int i = 0; i < G.n_gamma; i++) {
        if (G.gamma[i].active && G.gamma[i].alpha > best_alpha) {
            best = i;
            best_alpha = G.gamma[i].alpha;
        }
    }
    return best;
}
am_gamma_get_blend function · c · L2433-L2446 (14 LOC)
ariannamethod/ariannamethod.c
float am_gamma_get_blend(void) {
    if (G.n_gamma == 0) return 0.0f;
    if (G.janus_mode == AM_JANUS_DUAL || G.janus_mode == AM_JANUS_CYCLE) {
        // Blended alpha from two faces
        float a = (G.janus_a >= 0 && G.janus_a < G.n_gamma) ?
                  G.gamma[G.janus_a].alpha : 0.0f;
        float b = (G.janus_b >= 0 && G.janus_b < G.n_gamma) ?
                  G.gamma[G.janus_b].alpha : 0.0f;
        return a * (1.0f - G.janus_blend) + b * G.janus_blend;
    }
    int idx = am_gamma_active();
    return (idx >= 0) ? G.gamma[idx].alpha * G.essence_alpha : 0.0f;
}
am_janus_set function · c · L2447-L2459 (13 LOC)
ariannamethod/ariannamethod.c
void am_janus_set(const char* face_a, const char* face_b) {
    int a = gamma_find(face_a);
    int b = gamma_find(face_b);
    if (a < 0) a = am_gamma_load(face_a, 1.0f);
    if (b < 0) b = am_gamma_load(face_b, 1.0f);
    if (a < 0 || b < 0) return;

    G.janus_a = a;
    G.janus_b = b;
    G.janus_mode = AM_JANUS_DUAL;
    G.janus_blend = 0.5f;
}
am_apply_gamma_to_logits function · c · L2464-L2479 (16 LOC)
ariannamethod/ariannamethod.c
void am_apply_gamma_to_logits(float* logits, int n) {
    if (!logits || n <= 0) return;
    float blend = am_gamma_get_blend();
    if (blend < 0.001f) return;  // no personality active

    // Compute mean
    float mean = 0.0f;
    for (int i = 0; i < n; i++) mean += logits[i];
    mean /= (float)n;

    // Gamma amplifies deviation from mean — personality = signal above noise
    float scale = 1.0f + blend * G.essence_alpha;
    for (int i = 0; i < n; i++) {
        logits[i] = mean + (logits[i] - mean) * scale;
    }
}
am_frandn function · c · L2494-L2499 (6 LOC)
ariannamethod/ariannamethod.c
static float am_frandn(unsigned int* seed) {
    *seed = *seed * 1664525u + 1013904223u;
    // Box-Muller approximation
    float u = (float)(*seed & 0x7FFFFFFF) / (float)0x7FFFFFFF;
    return (u - 0.5f) * 3.464f;  // ~N(0,1) rough approximation
}
am_notorch_step function · c · L2505-L2578 (74 LOC)
ariannamethod/ariannamethod.c
void am_notorch_step(float* A, float* B, int out_dim, int in_dim, int rank,
                     const float* x, const float* dy, float signal) {
    if (!A || !B || !x || !dy) return;
    if (rank <= 0 || rank > 128) return;

    // Clamp signal
    float g = clampf(signal, -2.0f, 2.0f);
    float lr = G.notorch_lr;

    // Build noise-modulated channel vector u
    // Stronger signal → cleaner channel (less noise)
    static unsigned int seed = 42;
    float u[128];
    for (int r = 0; r < rank; r++) {
        float n = am_frandn(&seed);
        float k = 0.35f + 0.65f * (1.0f - fabsf(g));
        u[r] = n * k;
    }

#ifdef USE_BLAS
    // A += (lr*g) * x ⊗ u  (BLAS: rank-1 update, sger)
    // A is [in_dim × rank], so x is the "row" vector, u is the "column" vector
    cblas_sger(CblasRowMajor, in_dim, rank,
               lr * g, x, 1, u, 1, A, rank);

    // B += (lr*g) * u ⊗ dy  (BLAS: rank-1 update, sger)
    // B is [rank × out_dim], so u is the "row" vector, dy is the "column
Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
am_harmonic_init function · c · L2613-L2616 (4 LOC)
ariannamethod/ariannamethod.c
void am_harmonic_init(void) {
    memset(&HN, 0, sizeof(HN));
}
am_harmonic_clear function · c · L2617-L2620 (4 LOC)
ariannamethod/ariannamethod.c
void am_harmonic_clear(void) {
    HN.n_organisms = 0;
}
am_harmonic_push_entropy function · c · L2621-L2627 (7 LOC)
ariannamethod/ariannamethod.c
void am_harmonic_push_entropy(float entropy) {
    HN.entropy_history[HN.history_pos] = entropy;
    HN.history_pos = (HN.history_pos + 1) % AM_HARMONIC_MAX_HISTORY;
    if (HN.history_len < AM_HARMONIC_MAX_HISTORY)
        HN.history_len++;
}
am_harmonic_push_gamma function · c · L2628-L2638 (11 LOC)
ariannamethod/ariannamethod.c
void am_harmonic_push_gamma(int id, const float *gamma, int dim, float entropy) {
    if (HN.n_organisms >= AM_HARMONIC_MAX_ORGANISMS) return;
    int idx = HN.n_organisms++;
    int copy_dim = dim < AM_HARMONIC_GAMMA_DIM ? dim : AM_HARMONIC_GAMMA_DIM;
    memcpy(HN.gammas[idx], gamma, copy_dim * sizeof(float));
    /* Zero-pad if needed */
    for (int i = copy_dim; i < AM_HARMONIC_GAMMA_DIM; i++)
        HN.gammas[idx][i] = 0.0f;
    HN.org_entropy[idx] = entropy;
}
am_harmonic_forward function · c · L2639-L2719 (81 LOC)
ariannamethod/ariannamethod.c
AM_HarmonicResult am_harmonic_forward(int step) {
    AM_HarmonicResult r;
    memset(&r, 0, sizeof(r));
    r.n_organisms = HN.n_organisms;
    r.strength_mod = 0.3f;

    if (HN.n_organisms == 0) return r;

    int T = HN.history_len;

    /* ── Layer 1: Fourier decomposition of entropy history ── */
    if (T >= 4) {
        for (int k = 0; k < AM_HARMONIC_N_FREQ; k++) {
            float sum = 0.0f;
            for (int t = 0; t < T; t++) {
                int idx = (HN.history_pos - T + t + AM_HARMONIC_MAX_HISTORY) % AM_HARMONIC_MAX_HISTORY;
                float phase = 2.0f * 3.14159265f * (float)(k + 1) * (float)t / (float)T;
                sum += HN.entropy_history[idx] * sinf(phase);
            }
            r.harmonics[k] = sum / (float)T;
        }
    }

    /* ── Layer 2: Correlation matrix (pairwise gamma cosines) ── */
    int n = HN.n_organisms;

    /* Compute norms */
    float norms[AM_HARMONIC_MAX_ORGANISMS];
    for (int i = 0; i < n; i++) {
        float s = 0
am_method_init function · c · L2720-L2723 (4 LOC)
ariannamethod/ariannamethod.c
void am_method_init(void) {
    memset(&M, 0, sizeof(AM_MethodState));
}
am_method_clear function · c · L2724-L2727 (4 LOC)
ariannamethod/ariannamethod.c
void am_method_clear(void) {
    M.n_organisms = 0;
}
am_method_push_organism function · c · L2728-L2738 (11 LOC)
ariannamethod/ariannamethod.c
void am_method_push_organism(int id, float entropy, float syntropy,
                             float gamma_mag, float gamma_cos) {
    if (M.n_organisms >= AM_METHOD_MAX_ORGANISMS) return;
    AM_MethodOrganism* o = &M.organisms[M.n_organisms++];
    o->id = id;
    o->entropy = entropy;
    o->syntropy = syntropy;
    o->gamma_mag = gamma_mag;
    o->gamma_cos = gamma_cos;
}
Open data scored by Repobility · https://repobility.com
am_method_field_entropy function · c · L2739-L2746 (8 LOC)
ariannamethod/ariannamethod.c
float am_method_field_entropy(void) {
    if (M.n_organisms == 0) return 0.0f;
    float sum = 0.0f;
    for (int i = 0; i < M.n_organisms; i++)
        sum += M.organisms[i].entropy;
    return sum / (float)M.n_organisms;
}
am_method_field_syntropy function · c · L2747-L2754 (8 LOC)
ariannamethod/ariannamethod.c
float am_method_field_syntropy(void) {
    if (M.n_organisms == 0) return 0.0f;
    float sum = 0.0f;
    for (int i = 0; i < M.n_organisms; i++)
        sum += M.organisms[i].syntropy;
    return sum / (float)M.n_organisms;
}
am_method_field_coherence function · c · L2755-L2774 (20 LOC)
ariannamethod/ariannamethod.c
float am_method_field_coherence(void) {
    if (M.n_organisms == 0) return 1.0f;
    // Mean pairwise gamma cosine similarity
    // Organisms push gamma_cos (precomputed vs field mean by host)
    // But we can also compute mean of pairwise from gamma_cos values:
    // If only one organism, perfectly coherent
    if (M.n_organisms == 1) return 1.0f;

    // Simple: mean gamma_cos across organisms (host-computed pairwise)
    float sum = 0.0f;
    int count = 0;
    for (int i = 0; i < M.n_organisms; i++) {
        if (M.organisms[i].gamma_mag > 1e-6f) {
            sum += M.organisms[i].gamma_cos;
            count++;
        }
    }
    return count > 0 ? sum / (float)count : 1.0f;
}
am_method_step function · c · L2775-L2883 (109 LOC)
ariannamethod/ariannamethod.c
AM_MethodSteering am_method_step(float dt) {
    AM_MethodSteering s;
    memset(&s, 0, sizeof(s));

    s.n_organisms = M.n_organisms;
    M.step_count++;
    s.step = M.step_count;

    if (M.n_organisms == 0) {
        s.action = AM_METHOD_WAIT;
        return s;
    }

    float entropy = am_method_field_entropy();
    float syntropy = am_method_field_syntropy();
    float coherence = am_method_field_coherence();

    s.entropy = entropy;
    s.syntropy = syntropy;
    s.coherence = coherence;

    // Push to circular history buffer
    int pos = M.history_pos % AM_METHOD_HISTORY_LEN;
    M.entropy_history[pos] = entropy;
    M.coherence_history[pos] = coherence;
    M.history_pos++;
    if (M.history_len < AM_METHOD_HISTORY_LEN)
        M.history_len++;

    // Compute entropy trend (positive = organizing, negative = dissolving)
    float trend = 0.0f;
    if (M.history_len >= 4) {
        // Recent 4 vs earlier 4
        float recent = 0.0f, earlier = 0.0f;
        int rc = 0, e
am_method_get_state function · c · L2884-L2887 (4 LOC)
ariannamethod/ariannamethod.c
AM_MethodState* am_method_get_state(void) {
    return &M;
}
blood_hash function · c · L2897-L2902 (6 LOC)
ariannamethod/ariannamethod.c
static void blood_hash(const char* code, char* out) {
    unsigned long h = 5381;
    for (const char* p = code; *p; p++)
        h = ((h << 5) + h) + (unsigned char)*p;
    snprintf(out, AM_BLOOD_HASH_LEN, "%08lx", h);
}
blood_sanitize function · c · L2905-L2914 (10 LOC)
ariannamethod/ariannamethod.c
static void blood_sanitize(const char* in, char* out, int max) {
    int j = 0;
    for (int i = 0; in[i] && j < max - 1; i++) {
        char c = in[i];
        if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
            (c >= '0' && c <= '9') || c == '_')
            out[j++] = c;
    }
    out[j] = 0;
}
am_blood_init function · c · L2915-L2942 (28 LOC)
ariannamethod/ariannamethod.c
void am_blood_init(void) {
    // Clean up existing modules
    am_blood_cleanup();

    // Set temp directory
    const char* tmp = getenv("TMPDIR");
    if (!tmp || !*tmp) tmp = "/tmp";
    snprintf(g_blood_dir, sizeof(g_blood_dir), "%s/aml_blood", tmp);

    // Create directory (ignore error if exists)
    char mkdir_cmd[300];
    snprintf(mkdir_cmd, sizeof(mkdir_cmd), "mkdir -p '%s'", g_blood_dir);
    int rc = system(mkdir_cmd);
    (void)rc;

    // Detect compiler: clang → gcc → cc
    g_blood_cc[0] = 0;
    const char* candidates[] = {"clang", "gcc", "cc", NULL};
    for (int i = 0; candidates[i]; i++) {
        char check[128];
        snprintf(check, sizeof(check), "which %s >/dev/null 2>&1", candidates[i]);
        if (system(check) == 0) {
            snprintf(g_blood_cc, sizeof(g_blood_cc), "%s", candidates[i]);
            break;
        }
    }
}
Repobility — same analyzer, your code, free for public repos · /scan/
am_blood_compile function · c · L2943-L3027 (85 LOC)
ariannamethod/ariannamethod.c
int am_blood_compile(const char* name, const char* code) {
#ifdef AM_BLOOD_DISABLED
    (void)name; (void)code;
    return -1;
#else
    if (!name || !code || !*name || !*code) return -1;
    if (!g_blood_cc[0]) return -1;  // no compiler
    if (g_blood_count >= AM_BLOOD_MAX_MODULES) return -1;

    // Sanitize name
    char safe_name[AM_BLOOD_MAX_NAME];
    blood_sanitize(name, safe_name, AM_BLOOD_MAX_NAME);
    if (!safe_name[0]) return -1;

    // Hash code for deduplication
    char hash[AM_BLOOD_HASH_LEN];
    blood_hash(code, hash);

    // Check cache
    for (int i = 0; i < g_blood_count; i++) {
        if (strcmp(g_blood_modules[i].hash, hash) == 0 &&
            g_blood_modules[i].handle != NULL) {
            return i;  // already compiled and loaded
        }
    }

    // Write source file
    char src_path[512], lib_path[512];
    snprintf(src_path, sizeof(src_path), "%s/blood_%s_%s.c",
             g_blood_dir, safe_name, hash);
    snprintf(lib_path, sizeof(lib_path),
am_blood_sym function · c · L3028-L3038 (11 LOC)
ariannamethod/ariannamethod.c
void* am_blood_sym(int module_idx, const char* func_name) {
#ifdef AM_BLOOD_DISABLED
    (void)module_idx; (void)func_name;
    return NULL;
#else
    if (module_idx < 0 || module_idx >= g_blood_count) return NULL;
    if (!g_blood_modules[module_idx].handle) return NULL;
    return dlsym(g_blood_modules[module_idx].handle, func_name);
#endif
}
am_blood_unload function · c · L3039-L3060 (22 LOC)
ariannamethod/ariannamethod.c
void am_blood_unload(int module_idx) {
#ifdef AM_BLOOD_DISABLED
    (void)module_idx;
#else
    if (module_idx < 0 || module_idx >= g_blood_count) return;
    AM_BloodModule* m = &g_blood_modules[module_idx];
    if (m->handle) {
        dlclose(m->handle);
        m->handle = NULL;
    }
    // Remove compiled files
    if (m->lib_path[0]) {
        remove(m->lib_path);
        // Also remove source
        char src_path[512];
        snprintf(src_path, sizeof(src_path), "%s/blood_%s_%s.c",
                 g_blood_dir, m->name, m->hash);
        remove(src_path);
    }
#endif
}
am_blood_cleanup function · c · L3061-L3067 (7 LOC)
ariannamethod/ariannamethod.c
void am_blood_cleanup(void) {
    for (int i = 0; i < g_blood_count; i++) {
        am_blood_unload(i);
    }
    g_blood_count = 0;
}
am_blood_get function · c · L3070-L3074 (5 LOC)
ariannamethod/ariannamethod.c
const AM_BloodModule* am_blood_get(int idx) {
    if (idx < 0 || idx >= g_blood_count) return NULL;
    return &g_blood_modules[idx];
}
am_blood_compile_lora function · c · L3077-L3132 (56 LOC)
ariannamethod/ariannamethod.c
int am_blood_compile_lora(const char* name, int in_dim, int out_dim, int rank) {
    char safe[AM_BLOOD_MAX_NAME];
    blood_sanitize(name, safe, AM_BLOOD_MAX_NAME);
    if (!safe[0]) return -1;

    // Generate LoRA C code from template
    char code[4096];
    snprintf(code, sizeof(code),
        "#include <stdlib.h>\n"
        "#include <string.h>\n"
        "\n"
        "static const int IN_DIM = %d;\n"
        "static const int OUT_DIM = %d;\n"
        "static const int RANK = %d;\n"
        "\n"
        "static float* A = NULL;\n"  // [OUT_DIM, RANK]
        "static float* B = NULL;\n"  // [RANK, IN_DIM]
        "\n"
        "void %s_init(float* weights_a, float* weights_b) {\n"
        "    A = weights_a;\n"
        "    B = weights_b;\n"
        "}\n"
        "\n"
        "void %s_apply(float* input, float* output) {\n"
        "    float temp[%d];\n"
        "    memset(temp, 0, sizeof(temp));\n"
        "    for (int r = 0; r < RANK; r++)\n"
        "        for (int i = 0; 
am_blood_compile_emotion function · c · L3133-L3169 (37 LOC)
ariannamethod/ariannamethod.c
int am_blood_compile_emotion(const char* name, float valence, float arousal) {
    char safe[AM_BLOOD_MAX_NAME];
    blood_sanitize(name, safe, AM_BLOOD_MAX_NAME);
    if (!safe[0]) return -1;

    char code[4096];
    snprintf(code, sizeof(code),
        "#include <math.h>\n"
        "#include <string.h>\n"
        "\n"
        "static const float BASE_VALENCE = %.4ff;\n"
        "static const float BASE_AROUSAL = %.4ff;\n"
        "\n"
        "void %s_respond(float* valence, float* arousal) {\n"
        "    *valence = (*valence + BASE_VALENCE) / 2.0f;\n"
        "    *arousal = (*arousal + BASE_AROUSAL) / 2.0f;\n"
        "}\n"
        "\n"
        "void %s_modulate_logits(float* logits, int vocab_size, float strength) {\n"
        "    float mod = BASE_VALENCE * strength;\n"
        "    for (int i = 0; i < vocab_size; i++)\n"
        "        logits[i] *= (1.0f + mod * 0.1f);\n"
        "}\n"
        "\n"
        "void modulate_logits(float* logits, int vocab_size, float valence
am_step function · c · L3175-L3406 (232 LOC)
ariannamethod/ariannamethod.c
void am_step(float dt) {
  if (dt <= 0.0f) return;

  // ─────────────────────────────────────────────────────────────────────────────
  // CALENDAR CONFLICT — Hebrew (354d) vs Gregorian (365d) = 11-day annual drift
  //
  // Real astronomical computation. Uses system clock and epoch (1 Tishrei 5785
  // = Oct 3, 2024). Metonic cycle: 19 years, 7 leap years with Adar II (~30d).
  // February 29 handled correctly — elapsed seconds via time_t, not calendar math.
  //
  // High dissonance = thin barrier between timelines = wormholes open.
  // From pitomadom: TE(Calendar → N) = 0.31 bits — strongest causal effect.
  // ─────────────────────────────────────────────────────────────────────────────

  float cal_dissonance;
  if (!g_calendar_manual) {
    // Real date: seconds since epoch → days → drift → dissonance
    int days = calendar_days_since_epoch();
    float drift = calendar_cumulative_drift(days);
    cal_dissonance = calendar_dissonance(days);
    // Store phase for state access
Hi, dataset curator — please cite Repobility (https://repobility.com) when reusing this data.
am_get_temperature function · c · L459-L462 (4 LOC)
ariannamethod/ariannamethod.h
static inline float am_get_temperature(void) {
    AM_State* s = am_get_state();
    return s->effective_temp;
}
am_get_destiny_bias function · c · L465-L468 (4 LOC)
ariannamethod/ariannamethod.h
static inline float am_get_destiny_bias(void) {
    AM_State* s = am_get_state();
    return s->destiny_bias;
}
am_should_tunnel function · c · L471-L476 (6 LOC)
ariannamethod/ariannamethod.h
static inline int am_should_tunnel(void) {
    AM_State* s = am_get_state();
    if (s->dissonance < s->tunnel_threshold) return 0;
    float r = (float)rand() / (float)RAND_MAX;
    return r < s->tunnel_chance;
}
‹ prevpage 2 / 16next ›