Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Ajuda do Scilab >> API Scilab > legacy > Low level functions > CheckInputArgument

CheckInputArgument

C function which checks the number of input arguments present in the calling Scilab function.

Syntax

CheckInputArgument(void* pvCtx, int iMin, int iMax)

Arguments

pvApiCtx

Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h

iMin

the minimum number of input arguments which must be present in the calling Scilab function

iMax

the maximum number of input arguments which must be present in the calling Scilab function

Description

C function which checks the number of input arguments present in the calling Scilab function. You must include api_scilab.h to benefit from this function.

If the number of arguments is not between _iMin and _iMax, we quit the C interface (return 0;) and an error is returned in the Scilab console.

Since CheckInputArgument is doing a return 0; within the gateway function, it is important to call this function before any memory allocation in order to avoid any memory leak.

This function replaces the deprecated CheckLhs function

Examples

In this example, the C gateway function checks for a number of input arguments which must be between 2 and 3.

#include <api_scilab.h>

int sci_mycheckrhs(char * fname)
{
  CheckInputArgument(pvApiCtx, 2, 3);

  // Read input argument

  // Perform some operations

  // Return output argument

  return 0;
}

Now, some functions testing this interface:

mycheckrhs(A,B); // OK, 2 input arguments
mycheckrhs(A,B,C); // OK, 3 input arguments
mycheckrhs(A); // ERROR, 1 input argument
mycheckrhs(A,B,C,D); // ERROR, 4 input arguments

See also

  • CheckOutputArgument — C function which checks the number of output arguments present in the calling Scilab function.
Report an issue
<< Check variable dimensions (Scilab gateway) Low level functions CheckOutputArgument >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:52:44 CET 2020