MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manual de Serviço Página 44

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 282
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 43
2
Working with the Target Language
2-24
Extending the former example to a loop that rolls:
%language "C"
%assign ablock = BLOCK { Name "Hi" }
%roll Idx = [ 1:20, 21, 22, 23:25, 26:46], lcv = 10, ablock
Block[%< lcv == "" ? Idx : lcv>] *= 3.0;
%endroll
This TLC code produces the output:
{
int i;
for (i = 1; i < 21; i++)
{
Block[i] *= 3.0;
}
Block[21] *= 3.0;
Block[22] *= 3.0;
Block[23] *= 3.0;
Block[24] *= 3.0;
Block[25] *= 3.0;
for (i = 26; i < 47; i++)
{
Block[i] *= 3.0;
}
}
Object-Oriented Facility for Generating Target Code
The Target Language Compiler provides a simple object-oriented facility. The
language directives are:
%language string
%generatefile
%implements
This facility was designed specifically for customizing the code for Simulink
blocks, but can be used for other purposes as well.
The
%language directive specifies the target language being generated. It is
required as a consistency check to ensure that the correct implementation files
are found for the language being generated. The
%language directive must
Vista de página 43
1 2 ... 39 40 41 42 43 44 45 46 47 48 49 ... 281 282

Comentários a estes Manuais

Sem comentários