本文整理汇总了C++中GetRhsVar函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRhsVar函数的具体用法?C++ GetRhsVar怎么用?C++ GetRhsVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRhsVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_colminmax_arg
/*--------------------------------------------------------------------------*/
int get_colminmax_arg(char *fname,int pos,rhs_opts opts[], int ** colminmax )
{
int m,n,l,first_opt=FirstOpt(),kopt;
if (pos < first_opt)
{
if (VarType(pos))
{
GetRhsVar(pos,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
CheckLength(pos,m*n,2);
*colminmax=istk(l);
}
else
{
/** global value can be modified **/
int zeros[2] = { 0, 0 } ;
setDefColMinMax( zeros ) ;
*colminmax = getDefColMinMax() ;
}
}
else if ((kopt=FindOpt("colminmax",opts)))
{
GetRhsVar(kopt,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
CheckLength(kopt,m*n,2);
*colminmax=istk(l);
}
else
{
/** global value can be modified **/
int zeros[2] = { 0, 0 } ;
setDefColMinMax( zeros ) ;
*colminmax = getDefColMinMax() ;
}
return 1;
}
示例2: get_legend_arg
/*--------------------------------------------------------------------------*/
int get_legend_arg(char *fname,int pos,rhs_opts opts[], char ** legend )
{
int m,n,l,first_opt=FirstOpt(),kopt;
if (pos < first_opt)
{
if (VarType(pos)) {
GetRhsVar(pos,STRING_DATATYPE, &m, &n, &l);
*legend = cstk(l);
}
else
{
*legend = getDefLegend() ;
}
}
else if ((kopt=FindOpt("leg",opts))) {
GetRhsVar(kopt,STRING_DATATYPE, &m, &n, &l);
*legend = cstk(l);
}
else
{
*legend = getDefLegend() ;
}
return 1;
}
示例3: get_with_mesh_arg
/*--------------------------------------------------------------------------*/
int get_with_mesh_arg(char *fname,int pos,rhs_opts opts[], BOOL * withMesh)
{
int m,n,l,first_opt=FirstOpt(),kopt;
if (pos < first_opt)
{
if (VarType(pos))
{
GetRhsVar(pos,MATRIX_OF_BOOLEAN_DATATYPE, &m, &n, &l);
CheckLength(pos,m*n,1);
*withMesh = *(istk(l));
}
else
{
/** global value can be modified **/
setDefWithMesh( FALSE );
*withMesh = getDefWithMesh() ;
}
}
else if ((kopt=FindOpt("mesh",opts)))
{
GetRhsVar(kopt,MATRIX_OF_BOOLEAN_DATATYPE, &m, &n, &l);
CheckLength(kopt,m*n,1);
*withMesh = *(istk(l));
}
else
{
/** global value can be modified **/
setDefWithMesh( FALSE );
*withMesh = getDefWithMesh() ;
}
return 1;
}
示例4: sci_exec_if
int sci_exec_if(char *fname)
{
static int l1, m1, n1;
void *p_sci;
static int l2, m2, n2;
static int minrhs=2, maxrhs=2;
static int err;
debug_3 ("[sci_exec_if] ..................... \r\n");
CheckRhs(minrhs,maxrhs);
// example: pfir1
m1=1;
n1=1;
GetRhsVar(1,"p",&m1,&n1,&l1);
// example: SCI_RESET
GetRhsVar(2, "i", &m2, &n2, &l2);
p_sci = (void *) ((unsigned long int) *stk(l1));
sci_exec_ifcpp(p_sci, *(istk(l2)));
if (sci_err) {
sciprint("\n%s:\n info:%d\n",sci_err_msg,sci_info);
Scierror(999,"%s failed err=%d", fname, sci_err);
return 0;
}
debug_3 ("[sci_exec_if] +++++++++++++++++++++ \r\n");
return 0;
}
示例5: sci_xfarcs
/*--------------------------------------------------------------------------*/
int sci_xfarcs(char *fname, unsigned long fname_len)
{
int m1 = 0, n1 = 0, l1 = 0;
int m2 = 0, n2 = 0, l2 = 0;
long hdl = 0;
int i = 0;
double angle1 = 0.0;
double angle2 = 0.0;
CheckRhs(1, 2);
GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
if (m1 != 6)
{
Scierror(999, _("%s: Wrong size for input argument #%d: %s expected.\n"), fname, 1, "(6,n)");
return 0;
}
if (Rhs == 2)
{
GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &m2, &n2, &l2);
CheckVector(2, m2, n2);
if (n1 != m2 * n2)
{
Scierror(999, _("%s: Wrong size for input arguments #%d and #%d.\n"), fname, 1, 2);
return 0;
}
}
else
{
m2 = 1;
n2 = n1;
CreateVar(2, MATRIX_OF_INTEGER_DATATYPE, &m2, &n2, &l2);
for (i = 0; i < n2; ++i)
{
*istk(l2 + i) = i + 1;
}
}
getOrCreateDefaultSubwin();
for (i = 0; i < n1; ++i)
{
angle1 = DEG2RAD(*stk(l1 + (6 * i) + 4) / 64.0);
angle2 = DEG2RAD(*stk(l1 + (6 * i) + 5) / 64.0);
Objarc(&angle1, &angle2, stk(l1 + (6 * i)), stk(l1 + (6 * i) + 1),
stk(l1 + (6 * i) + 2), stk(l1 + (6 * i) + 3), istk(l2 + i), istk(l2 + i), TRUE, FALSE, &hdl);
}
/** Construct Compound and make it current object **/
setCurrentObject(ConstructCompoundSeq(n1));
LhsVar(1) = 0;
PutLhsVar();
return 0;
}
示例6: sci_ctree2
/*--------------------------------------------------------------------------*/
int sci_ctree2(char *fname, unsigned long fname_len)
{
int one = 1, ipvec = 0, nvec = 0, mvec = 0, noin = 0, moin = 0, ipoin = 0, noinr = 0, moinr = 0, ipoinr = 0;
int ndep = 0, mdep = 0, ipdep = 0, ndepuptr = 0, mdepuptr = 0, ipdepuptr = 0, ipord = 0, ipok = 0, n = 0, nord = 0;
CheckRhs(5, 5);
CheckLhs(2, 2);
GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &nvec, &mvec, &ipvec);
GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &noin, &moin, &ipoin);
GetRhsVar(3, MATRIX_OF_INTEGER_DATATYPE, &noinr, &moinr, &ipoinr);
GetRhsVar(4, MATRIX_OF_INTEGER_DATATYPE, &ndep, &mdep, &ipdep);
GetRhsVar(5, MATRIX_OF_INTEGER_DATATYPE, &ndepuptr, &mdepuptr, &ipdepuptr);
n = nvec * mvec;
CreateVar(6, MATRIX_OF_INTEGER_DATATYPE, &n, &one, &ipord);
CreateVar(7, MATRIX_OF_INTEGER_DATATYPE, &one, &one, &ipok);
ctree2(istk(ipvec), n, istk(ipdep), istk(ipdepuptr), istk(ipoin), istk(ipoinr), istk(ipord), &nord, istk(ipok));
*istk(iadr(C2F(intersci).iwhere[5]) + 1) = nord;
LhsVar(1) = 6;
LhsVar(2) = 7;
PutLhsVar();
return 0;
}
示例7: empty
int empty(void)
{
int m, n;
int k;
int m1, n1, p1;
int m2, n2, p2;
int NZMAX = 1;
int jc = 5;
int ir;
int *header;
double *value;
GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &p1);
GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &p2);
m = (int) * stk(p1);
n = (int) * stk(p2);
CreateData(3, (6 + n + 1)*sizeof(int) + sizeof(double));
header = (int *) GetData(3);
value = (double *) header;
header[0] = 7;
header[1] = m;
header[2] = n;
header[3] = 0;
header[4] = NZMAX;
header[jc] = 0;
ir = jc + n + 1;
for (k = 0; k < n; ++k)
{
header[jc + k + 1] = 0;
}
header[ir] = 0;
value[(5 + header[2] + header[4]) / 2 + 1] = 0.0;
LhsVar(1) = 3;
PutLhsVar();
return 1;
}
示例8: get_colout_arg
/*--------------------------------------------------------------------------*/
int get_colout_arg(char *fname,int pos,rhs_opts opts[], int ** colout )
{
int m,n,l,first_opt=FirstOpt(),kopt;
if (pos < first_opt)
{
if (VarType(pos))
{
GetRhsVar(pos,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
CheckLength(pos,m*n,2);
*colout = istk(l);
}
else
{
/** global value can be modified **/
int newDefCO[2] = { -1, -1 } ;
setDefColOut( newDefCO ) ;
*colout = getDefColOut() ;
}
}
else if ((kopt=FindOpt("colout",opts)))
{
GetRhsVar(kopt,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
CheckLength(kopt,m*n,2);
*colout=istk(l);
}
else
{
/** global value can be modified **/
int newDefCO[2] = { -1, -1 } ;
setDefColOut( newDefCO ) ;
*colout = getDefColOut() ;
}
return 1;
}
示例9: sci_grep
/*------------------------------------------------------------------------*/
int sci_grep(char *fname, unsigned long fname_len)
{
CheckRhs(2, 3);
CheckLhs(1, 2);
if (VarType(1) == sci_matrix)
{
int m1 = 0, n1 = 0;
char **Str = NULL;
GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &Str);
if ((m1 == 0) && (n1 == 0))
{
int l = 0;
CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l);
LhsVar(1) = Rhs + 1;
PutLhsVar();
return 0;
}
}
if (Rhs == 3)
{
if (VarType(3) == sci_strings)
{
char typ = 'd'; /*default */
int m3 = 0, n3 = 0, l3 = 0;
GetRhsVar(3, STRING_DATATYPE, &m3, &n3, &l3);
if (m3 * n3 != 0)
{
typ = cstk(l3)[0];
}
if (typ == 'r')
{
sci_grep_common(fname, TRUE);
}
else
{
Scierror(999, _("%s: Wrong value for input argument #%d: '%s' expected.\n"), fname, 3, "s");
return 0;
}
}
else
{
Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 3);
return 0;
}
}
else /* Rhs == 2 */
{
sci_grep_common(fname, FALSE);
}
return 0;
}
示例10: sci_get_if
int sci_get_if(char *fname)
{
static int l1, m1, n1;
void *p_sci;
static int l2, m2, n2;
static int lr3, lc3;
static int minrhs=2, maxrhs=2;
static int minlhs=0, maxlhs=1;
static int err;
struct sci_var s_v;
debug_3 ("[if_sci_get] ..................... \r\n");
CheckRhs(minrhs,maxrhs);
CheckLhs(minlhs,maxlhs);
// example: pfir1
m1=1;
n1=1;
GetRhsVar(1,"p",&m1,&n1,&l1);
// example: SCI_TAPS
GetRhsVar(2, "i", &m2, &n2, &l2);
p_sci = (void *) ((unsigned long int) *stk(l1));
s_v = sci_get_ifcpp(p_sci, *istk(l2));
if (sci_err) {
sciprint("\n%s:\n info:%d\n",sci_err_msg,sci_info);
Scierror(999,"%s failed err=%d", fname, sci_err);
return 0;
}
// now when m3,n3 are set - create [mxn] sci variable on stack (it=is_complex)
if (s_v.is_double)
{ CreateCVar(3,"d", &s_v.is_complex, &s_v.m, &s_v.n, &lr3, &lc3);
// alocated mem on scilab stack for [mxn] of (complex) double
s_v.p_re=stk(lr3);
s_v.p_im=stk(lc3);
}
else if (s_v.is_boolean)
{ CreateVar(3,"b", &s_v.m, &s_v.n, &lr3);
// alocated mem on scilab stack for [mxn] boolean
s_v.p_re=istk(lr3);
s_v.p_im=NULL;
}
else
{ lr3 = I_INT32;;
CreateVar(3,"I", &s_v.m, &s_v.n, &lr3);
// alocated mem on scilab stack for [mxn] of U_INT32
s_v.p_re=istk(lr3);
s_v.p_im=NULL;
}
// copy values
sci_pop_var(&s_v);
// remove data from heap
sci_delete_var(&s_v);
LhsVar(1) = 3; /* return var */
debug_3 ("[if_sci_get] +++++++++++++++++++++ \r\n");
return 0;
}
示例11: sci_relocate_handle
int sci_relocate_handle( char * fname, unsigned long fname_len )
{
int handleCol ;
int handleRow ;
int nbHandle ;
int handleStkIndex ;
int parentCol ;
int parentRow ;
int parentStkIndex ;
int outIndex ;
int i ;
unsigned long * handleArray = NULL ;
/* the function should be called with relocate_handle( handle, parent_handle ) */
CheckRhs(2,2) ;
CheckLhs(0,1) ;
GetRhsVar( 1,GRAPHICAL_HANDLE_DATATYPE, &handleRow, &handleCol, &handleStkIndex );
nbHandle = handleRow * handleCol ;
GetRhsVar( 2,GRAPHICAL_HANDLE_DATATYPE, &parentRow, &parentCol, &parentStkIndex );
if ( parentCol * parentRow != 1 )
{
Scierror(999,_("%s: Handles must be relocated under a single parent.\n"),fname);
return 0 ;
}
/* create an array of handles */
handleArray = MALLOC( nbHandle * sizeof( unsigned long ) ) ;
if ( handleArray == NULL )
{
Scierror(999,_("%s: No more memory.\n"),fname);
return 0 ;
}
for ( i = 0 ; i < nbHandle ; i++ )
{
handleArray[i] = (unsigned long) *hstk( handleStkIndex + i ) ;
}
// FIXME : loop on each handle and call MVC to enable new relationship.
// if ( sciRelocateHandles( handleArray ,
// handleRow * handleCol,
// (unsigned long) *hstk( parentStkIndex ) ) != 0 )
// {
// PutLhsVar();
// return 0 ;
// }
FREE( handleArray ) ;
CreateVar( Rhs + 1,GRAPHICAL_HANDLE_DATATYPE, &handleCol, &handleRow, &outIndex );
*hstk(outIndex) = *hstk(handleStkIndex) ;
LhsVar(1) = Rhs + 1 ;
PutLhsVar();
return 0 ;
}
示例12: sci_emptystr_two_rhs
/*--------------------------------------------------------------------------*/
static int sci_emptystr_two_rhs(char *fname)
{
/*value_param_pos_1 is the number of row ; value_param_pos_2 is the number of col*/
int Type_One = GetType(1);
int Type_Two = GetType(2);
if ((Type_One == sci_matrix) && (Type_Two == sci_matrix))
{
double value_param_pos_1 = 0;
double value_param_pos_2 = 0;
int matrixdimension = 0;
int m1 = 0, n1 = 0, l1 = 0;
int m2 = 0, n2 = 0, l2 = 0;
GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &l2);
value_param_pos_1 = *stk(l1);
value_param_pos_2 = *stk(l2);
matrixdimension = (int)(value_param_pos_1 * value_param_pos_2);
if (matrixdimension > 0)
{
int m = (int)value_param_pos_1;
int n = (int)value_param_pos_2;
CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &m, &n, NULL);
}
else
{
/* returns [] */
int l = 0;
int m = 0;
int n = 0;
CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &m, &n, &l);
}
LhsVar(1) = Rhs + 1;
PutLhsVar();
}
else
{
if (Type_One != sci_matrix)
{
Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of integers expected.\n"), fname, 1);
}
else /* Type_Two */
{
Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of integers expected.\n"), fname, 2);
}
}
return 0;
}
示例13: get_rect_arg
/*--------------------------------------------------------------------------*/
int get_rect_arg(char *fname,int pos,rhs_opts opts[], double ** rect )
{
int m,n,l,first_opt=FirstOpt(),kopt,i;
if (pos < first_opt)
{
if (VarType(pos)) {
GetRhsVar(pos,MATRIX_OF_DOUBLE_DATATYPE, &m, &n, &l);
if (m * n != 4) {
Scierror(999,"%s: Wrong size for input argument #%d: %d expected\n",fname,pos,4);
return 0;
}
*rect = stk(l);
for(i=0;i<4;i++)
if(finite((*rect)[i]) == 0){
Scierror(999,"%s: Wrong values (Nan or Inf) for input argument: %d finite values expected\n",fname,4);
return 0;
}
}
else
{
/** global value can be modified **/
double zeros[4] = { 0.0, 0.0, 0.0, 0.0 } ;
setDefRect( zeros ) ;
*rect = getDefRect() ;
}
}
else if ((kopt=FindOpt("rect",opts))) {/* named argument: rect=value */
GetRhsVar(kopt,MATRIX_OF_DOUBLE_DATATYPE, &m, &n, &l);
if (m * n != 4) {
Scierror(999,"%s: Wrong size for input argument #%d: %d expected\n",fname,kopt,4);
return 0;
}
*rect = stk(l);
for(i=0;i<4;i++)
if(finite((*rect)[i]) == 0){
Scierror(999,"%s: Wrong values (Nan or Inf) for input argument: %d finite values expected\n",fname,4);
return 0;
}
}
else
{
/** global value can be modified **/
double zeros[4] = { 0.0, 0.0, 0.0, 0.0 } ;
setDefRect( zeros ) ;
*rect = getDefRect() ;
}
return 1;
}
示例14: get_labels_arg
/**
* retrieve the labels from the command line and store them into labels
*/
int get_labels_arg(char *fname, int pos, rhs_opts opts[], char ** labels)
{
int m,n,l,first_opt=FirstOpt(),kopt;
if (pos < first_opt)
{
if (VarType(pos))
{
GetRhsVar(pos,STRING_DATATYPE, &m, &n, &l);
*labels = cstk(l);
}
else
{
/* jb silvy 03/2006 */
/* do not change the legend if one already exists */
char * pSubWinUID = getOrCreateDefaultSubwin();
if (sciGetLegendDefined(pSubWinUID))
{
*labels = NULL;
}
else
{
*labels = getDefLegend();
}
}
}
else if ((kopt=FindOpt("leg",opts)))
{
GetRhsVar(kopt,STRING_DATATYPE, &m, &n, &l);
*labels = cstk(l);
}
else
{
/* jb silvy 03/2006 */
/* do not change the legend if one already exists */
char* pSubWinUID = getOrCreateDefaultSubwin();
if (sciGetLegendDefined(pSubWinUID))
{
*labels = NULL;
}
else
{
*labels = getDefLegend();
}
}
return 1;
}
示例15: int_imread
int int_imread(char * fname)
{
int mR, nR, lR;
IplImage * pImage;
CheckRhs(1, 1);
CheckLhs(1, 1);
GetRhsVar(1, "c", &mR, &nR, &lR);
// fix default mode for compatibility with previous version of SIVP
pImage = cvLoadImage(cstk(lR), 1);
/* if load image failed */
if(pImage == NULL)
{
Scierror(999, "%s: Can not open file %s.\r\n", fname, cstk(lR));
return -1;
}
IplImg2Mat(pImage, 2);
LhsVar(1) = 2;
cvReleaseImage(&pImage);
return 0;
}