/*--------------------------------------------------------------------------*/ int get_strf_arg(void* _pvCtx, char *fname, int pos, rhs_opts opts[], char ** strf) { int first_opt = FirstOpt(), kopt; if (pos < first_opt) { int* piAddr = 0; int iType = 0; char* pstData = NULL; getVarAddressFromPosition(_pvCtx, pos, &piAddr); getVarType(_pvCtx, piAddr, &iType); if (iType) { getAllocatedSingleString(_pvCtx, piAddr, &pstData); if ((int)strlen(pstData) != 3) { Scierror(999, _("%s: Wrong size for input argument #%d: String of %d characters expected.\n"), fname, pos, 3); return 0; } *strf = pstData; } else { /* def value can be changed */ reinitDefStrf(); *strf = getDefStrf(); } } else if ((kopt = FindOpt("strf", opts))) { int* piAddr = 0; char* pstData = NULL; getVarAddressFromPosition(_pvCtx, kopt, &piAddr); getAllocatedSingleString(_pvCtx, piAddr, &pstData); if ((int)strlen(pstData) != 3) { Scierror(999, _("%s: Wrong size for input argument #%d: String of %d characters expected.\n"), fname, kopt, 3); return 0; } *strf = pstData; } else { /* def value can be changed */ reinitDefStrfN(); *strf = getDefStrf(); } return 1; }
/*--------------------------------------------------------------------------*/ int get_strf_arg(char *fname,int pos,rhs_opts opts[], char ** strf ) { int m,n,l,first_opt=FirstOpt(),kopt; if (pos < first_opt) { if (VarType(pos)) { GetRhsVar(pos,STRING_DATATYPE, &m, &n, &l); if ( m * n != 3 ) { Scierror(999,_("%s: Wrong size for input argument #%d: String of %d characters expected.\n"),fname,pos, 3); return 0; } *strf = cstk(l); } else { /* def value can be changed */ reinitDefStrf() ; *strf = getDefStrf() ; } } else if ((kopt=FindOpt("strf",opts))) { GetRhsVar(kopt,STRING_DATATYPE, &m, &n, &l); if (m * n != 3) { Scierror(999,_("%s: Wrong size for input argument #%d: String of %d characters expected.\n"),fname,kopt,3); return 0; } *strf = cstk(l); } else { /* def value can be changed */ reinitDefStrfN() ; *strf = getDefStrf() ; } return 1; }