Beispiel #1
0
int dpic_save(int value) {
    svScope scope = svGetScope();
    if (!scope) {
	printf("%%Warning: svGetScope failed\n");
	return 0;
    }

    if (svPutUserData(scope, &Dpic_Unique, (void*)(value))) {
	printf("%%Warning: svPutUserData failed\n");
	return 0;
    }
    return 1;
}
Beispiel #2
0
Vt_embed1_child* __get_modelp() {
    svScope scope = svGetScope();
    if (!scope) {
	vl_fatal(__FILE__,__LINE__,__FILE__,"svGetScope failed");
	return NULL;
    }

    void* __modelp = svGetUserData(scope, &T_Embed_Child_Unique);
    if (!__modelp) {
	// Create the model
	const char* scopenamep = svGetNameFromScope(scope);
	if (!scopenamep) vl_fatal(__FILE__,__LINE__,__FILE__,"svGetNameFromScope failed");
	__modelp = new Vt_embed1_child(scopenamep);
	if (svPutUserData(scope, &T_Embed_Child_Unique, __modelp)) {
	    vl_fatal(__FILE__,__LINE__,__FILE__,"svPutUserData failed");
	}
    }
    return (Vt_embed1_child*)(__modelp); 
}
Beispiel #3
0
int dpic_save(int value) {
    svScope scope = svGetScope();
    if (!scope) {
	printf("%%Warning: svGetScope failed\n");
	return 0;
    }

    // Use union to avoid cast to different size pointer warnings
    union valpack {
	void* ptr;
	int i;
    } vp;

    vp.i = value;
    if (svPutUserData(scope, &Dpic_Unique, vp.ptr)) {
	printf("%%Warning: svPutUserData failed\n");
	return 0;
    }
    return 1;
}