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

    if (void* userp = svGetUserData(scope, &Dpic_Unique)) {
	return (int)(long long)(userp);
    } else {
	printf("%%Warning: svGetUserData failed\n");
	return 0;
    }
}
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_restore() {
    svScope scope = svGetScope();
    if (!scope) {
	printf("%%Warning: svGetScope failed\n");
	return 0;
    }

    if (void* userp = svGetUserData(scope, (void*)&Dpic_Unique)) {
	// Use union to avoid cast to different size pointer warnings
	union valpack {
	    void* ptr;
	    int i;
	} vp;
	vp.ptr = userp;
	return vp.i;
    } else {
	printf("%%Warning: svGetUserData failed\n");
	return 0;
    }
}