<< Scilab Code Generator Scilab Code Generator Xcos Code Generator >>

Scilab Code Generator >> Scilab Code Generator > emx_codegen

emx_codegen

Efficient, comprehensible and compact embedded single-core C/C++ code generation from Scilab code.

Syntax

emx_codegen(files)
emx_codegen(files, options)
[out,stat,err] = emx_codegen(files, options)

Arguments

files

a row vector of character strings.

options

struct of command line arguments to the code generator.

out

a column vector of character strings (standard output)

stat

an integer, the error status. stat=0 if no error occurred

err

a column vector of character strings (standard error)

Description

Sends a list of files to the code generator either local (if installed) or remote.

Sends a list of files to the code generator either local (if installed) or remote. The code-generator is based on emmtrix Code Generator (eCG).

Example

mputl(["a = (1:3)'';"
"b = (1:4);"
"c = a * b"], fullfile(TMPDIR, "matrixmul.sce"));

emx_codegen(fullfile(TMPDIR, "matrixmul.sce"), struct("outdir", TMPDIR));

mgetl(fullfile(TMPDIR, "matrixmul.c"))
int main() {
  double c_data[4][3]; 
  double chain1_data[3]; 
  static const double init1[3] = {1, 2, 3} ; 
  size_t i1, i2, i4, i5, i6; 
  double sum1; 
  
  // matrixmul.sce(5:1-10):  c = a * b
  #pragma EMX_KILLVAR c_data
  
  #pragma EMX_KILLVAR chain1_data
  
  for (i4 = 0; i4 < 3; i4++) {
    chain1_data[i4] = (int32_t )(init1[i4]); 
  } 
  for (i2 = 0; i2 < 4; i2++) {
    for (i1 = 0; i1 < 3; i1++) {
      sum1 = 0; 
      
      sum1 += chain1_data[i1] * (double )(((int32_t )(i2) + 1)); 
      
      c_data[i2][i1] = sum1; 
    } 
  } 
  
  // matrixmul.sce(5:10-11)
  puts("c = "); 
  for (i5 = 0; i5 < 3; i5++) {
    for (i6 = 0; i6 < 4; i6++) {
      printf(" %11.6g", c_data[i6][i5]); 
    } 
    puts(""); 
  } 
  
  return 0; 
}

Terms of Use

emmtrix Technologies kindly provides a free web frontend to the code generator.

Your submissions to the service may be accessible from any part of the world and any information they contain may be used by emmtrix Technologies and the public, both within and outside the country from which you posted. You understand that emmtrix Technologies does not guarantee any confidentiality with respect to any content you submit.

You are solely responsible for the support and maintenance of any content you submit through this service. All new submissions of content posted by users will be licensed under the BSD license unless otherwise noted.

For licensed code generator without these listed restrictions, feel free to contact emmtrix Technologies.

See also


Report an issue
<< Scilab Code Generator Scilab Code Generator Xcos Code Generator >>