extern "C" void __cdecl __dcrt_uninitialize_environments_nolock()
{
    _environ_table .uninitialize(uninitialize_environment_internal<char>);
    _wenviron_table.uninitialize(uninitialize_environment_internal<wchar_t>);

    free_environment(__dcrt_initial_narrow_environment);
    free_environment(__dcrt_initial_wide_environment);
}
static void __cdecl uninitialize_environment_internal(Character**& environment) throw()
{
    if (environment == get_initial_environment(Character()))
    {
        return;
    }

    free_environment(environment);
}
Beispiel #3
0
int main(int argc, char **argv)
{
    int i;
    environment *env = make_environment();
    for(i = 1; i < argc; ++i){
        FILE *fp = fopen(argv[i], "r");
        if(!fp) file_error(argv[i]);
        blazeit(fp, env);
        fclose(fp);
    }
    blazeit(stdin, env);
    free_environment(env);

    return 0;
}
Beispiel #4
0
void tora_release_instance(TORAUnknownType *ptr)
{
    switch(ptr->instance_type)
    {
        case TORAInstanceTypeEnvironment:
            free_environment((TORAEnvironment *)ptr);
            break;
        case TORAInstanceTypeExpression:
            free_expression(ptr);
            break;
        case TORAInstanceTypeToken:
            free_token((TORAToken *)ptr);
            break;
        case TORAInstanceTypeGeneric:
            tora_free(ptr);
            break;
        case TORAInstanceTypeLinkedList:
            free_linked_list((TORALinkedList *)ptr);
            break;
    }
}
Beispiel #5
0
int
main(int argc, char **argv)
{
    char **env = NULL;
    int count = 0;
    char fn[MAXPATHLEN];
    int error = 0;

    make_file(fn, sizeof(fn));

    write_file(fn, s1);
    count = read_environment(fn, &env);
    if(count != 3) {
	warnx("test 1: variable count %d != 3", count);
	error++;
    }

    write_file(fn, s2);
    count = read_environment(fn, &env);
    if(count != 1) {
	warnx("test 2: variable count %d != 1", count);
	error++;
    }

    unlink(fn);
    count = read_environment(fn, &env);
    if(count != 0) {
	warnx("test 3: variable count %d != 0", count);
	error++;
    }
    for(count = 0; env && env[count]; count++);
    if(count != 3) {
	warnx("total variable count %d != 3", count);
	error++;
    }
    free_environment(env);


    return error;
}
Beispiel #6
0
/*
 * sweep_environments: Sweeps pointervector of allocated Environments. If an 
 *                     Environment is marked, unmarks it. If an Environment is
 *                     unmarked, deletes it and sets it to NULL. Removes all
 *                     NULL entries at the end.
 * 
 * Input:
 *      None. Sweeps all allocated Environments.
 *
 * Output:
 *      None. The function modifies the Environments directly. 
 */
void sweep_environments()
{
    Environment *env;
    int i;

    // Loop through all allocated values
    for (i = 0; i < allocated_environments.size; i++)
    {
        env = (Environment *) pv_get_elem(&allocated_environments, i);
        if (env->marked == 1)
        {
            // Unmark a Value
            env->marked = 0;
        }
        else
        {
            // Delete the Value and set it to NULL
            free_environment(env);
            pv_set_elem(&allocated_environments, i, NULL);
        }
    }
    // Remove all NULL entries
    pv_compact(&allocated_environments);
}