summaryrefslogtreecommitdiff
path: root/macros/FunctionAnnotation/FA_TP_MAX.sci
blob: 0b78f9e3d71fc92db7c4c6f2736ead2f33d1d0e9 (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
39
40
41
42
43
44
45
function opout = FA_TP_MAX(in1,in2)
// function opout = FA_TP_MAX(in1,in2)
// -----------------------------------------------------------------
// Type-Maximum function for Function Annotations.
// Returns the maximum between the two data types in input according
// to a predefined priority. For example z(double complex) is 
// greater that c(single complex).
//
// Input data:
// in1: string specifying the data type number 1.
// in2: string specifying the data type number 2.
//
// Output data:
// opout: string containing the computed result.
//
// Status:
// 26-Oct-2007 -- Raffaele Nutricato: Author.
// 26-Oct-2007 -- Alberto Morea: Test Ok.
//
// Copyright 2007 Raffaele Nutricato & Alberto Morea.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------

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

// ------------------------
// --- Generate Output. ---
// ------------------------
in1Pin2 = in1+in2;
opout = in1;

if (in2 == 'z')
   opout = 'z';
elseif (in1Pin2 == 'sd')
   opout = 'd';
elseif (in1Pin2 == 'sc')
   opout = 'c';
elseif (in1Pin2 == 'dc')
   opout = 'z';
end

endfunction