summaryrefslogtreecommitdiff
path: root/macros/FunctionAnnotation/FA_TP_USER.sci
blob: e60a8ce839c635e8095ae537c3d30c0288d84fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function type_out = FA_TP_USER(PrecisionSpecifier,DefaultType)
// function type_out = FA_TP_USER(PrecisionSpecifier,DefaultType)
// -----------------------------------------------------------------
// Generate the output type of the output argument by using the
// output (AnnotationFnc) generated by CheckAnnotationFunction.
// double and float functions can be used to specify the type
// of the output argument. They are typically used in combination
// with zeros-like function.
//
// Input data:
// PrecisionSpecifier: it can be 'double' or 'float'.
//
// Output data:
// type_out: specifies the type of the output argument. It can be
//           's' for float precision or 'd' for double precision.
//
// Status:
// 26-Oct-2007 -- Raffaele Nutricato: Author.
// 26-Oct-2007 -- Alberto Morea: Test Ok.
// -----------------------------------------------------------------

// ------------------------------
// --- Check input arguments. ---
// ------------------------------
SCI2CNInArgCheck(argn(2),2,2);

if (mtlb_strcmp(PrecisionSpecifier,'int'))
   type_out = 'i';
elseif (mtlb_strcmp(PrecisionSpecifier,'float'))
   type_out = 's';
elseif (mtlb_strcmp(PrecisionSpecifier,'double'))
   type_out = 'd';
elseif (mtlb_strcmp(PrecisionSpecifier,'default'))
   type_out = DefaultType;
else
   error(9999, 'Unknown precision function: ""'+AnnotationFnc+'"".');
end
endfunction