/*--------------------------------------------------------------------------*/ int xgetg(char * str, char * str1, int * len, int lx0, int lx1) { if (strcmp(str, "fpf") == 0) { strncpy(str1, getFPF(), 32); *len = (int) strlen(str1); } else if (strcmp(str, "auto clear") == 0) { int iAutoClear = 0; int* piAutoClear = &iAutoClear; getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_AUTO_CLEAR__, jni_bool, (void **)&piAutoClear); if (iAutoClear == 1) { strncpy(str1, "on", 2); *len = 2; } else { strncpy(str1, "off", 3); *len = 3; } } return 0; }
static int contourI(ptr_level_f func, double *x, double *y, double *z, double *zCont, int *N, int *style, int *err) { int check = 1; char *F = NULL; int n1 = 0, n2 = 0, ncont = 0, i = 0, c = 0, j = 0, k = 0, n5 = 0; int stylec = 0; n1 = N[0]; n2 = N[1]; ncont = N[2]; F = getFPF(); if ( F[0] == '\0') { ChoixFormatE1(ContNumFormat, zCont, N[2]); } InitValues(x, y, z, n1, n2); n5 = 2 * (n1) + 2 * (n2) - 3; /* Allocation */ Gcont_size = 0; /** initialize the array indices for storing contours **/ xbd_cont = MALLOC( n5 * sizeof(int) ) ; ybd_cont = MALLOC( n5 * sizeof(int) ) ; itg_cont = MALLOC( n1 * n2 * sizeof(int) ) ; if ( (xbd_cont == NULL) && n5 != 0) { check = 0; } if ( (ybd_cont == NULL) && n5 != 0) { check = 0; } if ( (itg_cont == NULL) && n1 * n2 != 0) { check = 0; } if ( check == 0) { FREE( xbd_cont ) ; FREE( ybd_cont ) ; FREE( itg_cont ) ; Scierror(999, _("%s: No more memory.\n"), "contourI"); return -1; } /* just a parametrization of the boundary points */ for ( i = 0 ; i < n2 ; i++) { ybd_cont[i] = i ; xbd_cont[i] = 0 ; } for ( i = 1 ; i < n1 ; i++) { ybd_cont[n2 + i - 1] = n2 - 1 ; xbd_cont[n2 + i - 1] = i ; } for ( i = n2 - 2; i >= 0 ; i--) { ybd_cont[2 * n2 + n1 - 3 - i] = i ; xbd_cont[2 * n2 + n1 - 3 - i] = n1 - 1 ; } for ( i = n1 - 2 ; i >= 0 ; i--) { ybd_cont[2 * n2 + 2 * n1 - 4 - i] = 0 ; xbd_cont[2 * n2 + 2 * n1 - 4 - i] = i ; } for ( c = 0 ; c < ncont ; c++) { stylec = ( style != (int *) 0) ? style[c] : c; /** itg-cont is a flag array to memorize checked parts of the grid **/ for ( i = 0 ; i < n1; i++) for ( j = 0 ; j < n2 ; j++) { itg_cont[i + n1 * j] = 0 ; } /** all the boundary segments **/ for ( k = 1 ; k < n5 ; k++) { int ib, jb; i = xbd_cont[k] ; j = ybd_cont[k]; ib = xbd_cont[k - 1] ; jb = ybd_cont[k - 1]; if (not_same_sign (phi_cont(i, j) - zCont[c] , phi_cont(ib, jb) - zCont[c])) { look(func, i, j, ib, jb, 1L, zCont[c], stylec); } } /** inside segments **/ for ( i = 1 ; i < n1 - 1; i++) for ( j = 1 ; j < n2 - 1 ; j++) if (not_same_sign ( phi_cont(i, j) - zCont[c] , phi_cont(i, j - 1) - zCont[c])) { look(func, i, j, i, j - 1, 2L, zCont[c], stylec); } } FREE( xbd_cont ) ; FREE( ybd_cont ) ; FREE( itg_cont ) ; return 0; }