Exemplo n.º 1
0
void BannerSubPromiseType(const EvalContext *ctx, const char *bundlename, const char *type)
{
    if (!LEGACY_OUTPUT)
    {
        return;
    }

    if (strcmp(type, "processes") == 0)
    {
        {
            Log(LOG_LEVEL_VERBOSE, "     ??? Local class context: ");

            ClassTableIterator *iter = EvalContextClassTableIteratorNewLocal(ctx);
            Class *cls = NULL;
            while ((cls = ClassTableIteratorNext(iter)))
            {
                Log(LOG_LEVEL_VERBOSE, "       %s", cls->name);
            }
            ClassTableIteratorDestroy(iter);

            Log(LOG_LEVEL_VERBOSE, "\n");
        }
    }

    Log(LOG_LEVEL_VERBOSE, "\n");
    Log(LOG_LEVEL_VERBOSE, "      = = = = = = = = = = = = = = = = = = = = = = = = = = = = ");
    Log(LOG_LEVEL_VERBOSE, "      %s in bundle %s", type, bundlename);
    Log(LOG_LEVEL_VERBOSE, "      = = = = = = = = = = = = = = = = = = = = = = = = = = = = ");
    Log(LOG_LEVEL_VERBOSE, "\n");
}
Exemplo n.º 2
0
static JsonElement *DefaultTemplateData(const EvalContext *ctx)
{
    JsonElement *hash = JsonObjectCreate(10);

    {
        ClassTableIterator *it = EvalContextClassTableIteratorNewGlobal(ctx, NULL, true, true);
        Class *cls = NULL;
        while ((cls = ClassTableIteratorNext(it)))
        {
            char *key = ClassRefToString(cls->ns, cls->name);
            JsonObjectAppendBool(hash, key, true);
            free(key);
        }
        ClassTableIteratorDestroy(it);
    }

    {
        ClassTableIterator *it = EvalContextClassTableIteratorNewLocal(ctx);
        Class *cls = NULL;
        while ((cls = ClassTableIteratorNext(it)))
        {
            char *key = ClassRefToString(cls->ns, cls->name);
            JsonObjectAppendBool(hash, key, true);
            free(key);
        }
        ClassTableIteratorDestroy(it);
    }

    {
        VariableTableIterator *it = EvalContextVariableTableIteratorNew(ctx, NULL, NULL, NULL);
        Variable *var = NULL;
        while ((var = VariableTableIteratorNext(it)))
        {
            // TODO: need to get a CallRef, this is bad
            char *scope_key = ClassRefToString(var->ref->ns, var->ref->scope);
            JsonElement *scope_obj = JsonObjectGetAsObject(hash, scope_key);
            if (!scope_obj)
            {
                scope_obj = JsonObjectCreate(50);
                JsonObjectAppendObject(hash, scope_key, scope_obj);
            }
            free(scope_key);

            char *lval_key = VarRefToString(var->ref, false);
            JsonObjectAppendElement(scope_obj, lval_key, RvalToJson(var->rval));
            free(lval_key);
        }
        VariableTableIteratorDestroy(it);
    }

    return hash;
}