1 /* TA-LIB Copyright (c) 1999-2007, Mario Fortier
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or
5  * without modification, are permitted provided that the following
6  * conditions are met:
7  *
8  * - Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  *
11  * - Redistributions in binary form must reproduce the above copyright
12  *   notice, this list of conditions and the following disclaimer in
13  *   the documentation and/or other materials provided with the
14  *   distribution.
15  *
16  * - Neither name of author nor the names of its contributors
17  *   may be used to endorse or promote products derived from this
18  *   software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /* List of contributors:
35  *
36  *  Initial  Name/description
37  *  -------------------------------------------------------------------
38  *  MF       Mario Fortier
39  *
40  * Change history:
41  *
42  *  MMDDYY BY     Description
43  *  -------------------------------------------------------------------
44  *  090807 MF     Initial Version
45  */
46 
47 /**** START GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/
48 /* All code within this section is automatically
49  * generated by gen_code. Any modification will be lost
50  * next time gen_code is run.
51  */
52 /* Generated */
53 /* Generated */ #if defined( _MANAGED )
54 /* Generated */    #include "TA-Lib-Core.h"
55 /* Generated */    #define TA_INTERNAL_ERROR(Id) (RetCode::InternalError)
56 /* Generated */    namespace TicTacTec { namespace TA { namespace Library {
57 /* Generated */ #elif defined( _JAVA )
58 /* Generated */    #include "ta_defs.h"
59 /* Generated */    #include "ta_java_defs.h"
60 /* Generated */    #define TA_INTERNAL_ERROR(Id) (RetCode.InternalError)
61 /* Generated */ #else
62 /* Generated */    #include <string.h>
63 /* Generated */    #include <math.h>
64 /* Generated */    #include "ta_func.h"
65 /* Generated */ #endif
66 /* Generated */
67 /* Generated */ #ifndef TA_UTILITY_H
68 /* Generated */    #include "ta_utility.h"
69 /* Generated */ #endif
70 /* Generated */
71 /* Generated */ #ifndef TA_MEMORY_H
72 /* Generated */    #include "ta_memory.h"
73 /* Generated */ #endif
74 /* Generated */
75 /* Generated */ #define TA_PREFIX(x) TA_##x
76 /* Generated */ #define INPUT_TYPE   double
77 /* Generated */
78 /* Generated */ #if defined( _MANAGED )
FloorLookback(void)79 /* Generated */ int Core::FloorLookback( void )
80 /* Generated */
81 /* Generated */ #elif defined( _JAVA )
82 /* Generated */ public int floorLookback(  )
83 /* Generated */
84 /* Generated */ #else
85 /* Generated */ int TA_FLOOR_Lookback( void )
86 /* Generated */
87 /* Generated */ #endif
88 /**** END GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/
89 {
90    /* insert local variable here */
91 
92 /**** START GENCODE SECTION 2 - DO NOT DELETE THIS LINE ****/
93 /* Generated */ /* No parameters to validate. */
94 /**** END GENCODE SECTION 2 - DO NOT DELETE THIS LINE ****/
95 
96    /* insert lookback code here. */
97 
98    return 0;
99 }
100 
101 /**** START GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
102 /*
103  * TA_FLOOR - Vector Floor
104  *
105  * Input  = double
106  * Output = double
107  *
108  */
109 /* Generated */
110 /* Generated */ #if defined( _MANAGED ) && defined( USE_SUBARRAY )
111 /* Generated */ enum class Core::RetCode Core::Floor( int    startIdx,
112 /* Generated */                                       int    endIdx,
113 /* Generated */                                       SubArray^    inReal,
114 /* Generated */                                       [Out]int%    outBegIdx,
115 /* Generated */                                       [Out]int%    outNBElement,
116 /* Generated */                                       cli::array<double>^  outReal )
117 /* Generated */ #elif defined( _MANAGED )
118 /* Generated */ enum class Core::RetCode Core::Floor( int    startIdx,
119 /* Generated */                                       int    endIdx,
120 /* Generated */                                       cli::array<double>^ inReal,
121 /* Generated */                                       [Out]int%    outBegIdx,
122 /* Generated */                                       [Out]int%    outNBElement,
123 /* Generated */                                       cli::array<double>^  outReal )
124 /* Generated */ #elif defined( _JAVA )
125 /* Generated */ public RetCode floor( int    startIdx,
126 /* Generated */                       int    endIdx,
127 /* Generated */                       double       inReal[],
128 /* Generated */                       MInteger     outBegIdx,
129 /* Generated */                       MInteger     outNBElement,
130 /* Generated */                       double        outReal[] )
131 /* Generated */ #else
132 /* Generated */ TA_RetCode TA_FLOOR( int    startIdx,
133 /* Generated */                      int    endIdx,
134 /* Generated */                      const double inReal[],
135 /* Generated */                      int          *outBegIdx,
136 /* Generated */                      int          *outNBElement,
137 /* Generated */                      double        outReal[] )
138 /* Generated */ #endif
139 /**** END GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
140 {
141    /* insert local variable here */
142    int outIdx;
143    int i;
144 
145 /**** START GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
146 /* Generated */
147 /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK
148 /* Generated */
149 /* Generated */    /* Validate the requested output range. */
150 /* Generated */    if( startIdx < 0 )
151 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
152 /* Generated */    if( (endIdx < 0) || (endIdx < startIdx))
153 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
154 /* Generated */
155 /* Generated */    #if !defined(_JAVA)
156 /* Generated */    if( !inReal ) return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
157 /* Generated */    #endif /* !defined(_JAVA)*/
158 /* Generated */    #if !defined(_JAVA)
159 /* Generated */    if( !outReal )
160 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
161 /* Generated */
162 /* Generated */    #endif /* !defined(_JAVA) */
163 /* Generated */ #endif /* TA_FUNC_NO_RANGE_CHECK */
164 /* Generated */
165 /**** END GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
166 
167    /* Insert TA function code here. */
168 
169    /* Default return values */
170    for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
171    {
172       outReal[outIdx] = std_floor(inReal[i]);
173    }
174 
175    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
176    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
177 
178    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
179 }
180 
181 /**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
182 /* Generated */
183 /* Generated */ #define  USE_SINGLE_PRECISION_INPUT
184 /* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
185 /* Generated */    #undef   TA_PREFIX
186 /* Generated */    #define  TA_PREFIX(x) TA_S_##x
187 /* Generated */ #endif
188 /* Generated */ #undef   INPUT_TYPE
189 /* Generated */ #define  INPUT_TYPE float
190 /* Generated */ #if defined( _MANAGED )
191 /* Generated */ enum class Core::RetCode Core::Floor( int    startIdx,
192 /* Generated */                                       int    endIdx,
193 /* Generated */                                       cli::array<float>^ inReal,
194 /* Generated */                                       [Out]int%    outBegIdx,
195 /* Generated */                                       [Out]int%    outNBElement,
196 /* Generated */                                       cli::array<double>^  outReal )
197 /* Generated */ #elif defined( _JAVA )
198 /* Generated */ public RetCode floor( int    startIdx,
199 /* Generated */                       int    endIdx,
200 /* Generated */                       float        inReal[],
201 /* Generated */                       MInteger     outBegIdx,
202 /* Generated */                       MInteger     outNBElement,
203 /* Generated */                       double        outReal[] )
204 /* Generated */ #else
205 /* Generated */ TA_RetCode TA_S_FLOOR( int    startIdx,
206 /* Generated */                        int    endIdx,
207 /* Generated */                        const float  inReal[],
208 /* Generated */                        int          *outBegIdx,
209 /* Generated */                        int          *outNBElement,
210 /* Generated */                        double        outReal[] )
211 /* Generated */ #endif
212 /* Generated */ {
213 /* Generated */    int outIdx;
214 /* Generated */    int i;
215 /* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
216 /* Generated */     if( startIdx < 0 )
217 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
218 /* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
219 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
220 /* Generated */     #if !defined(_JAVA)
221 /* Generated */     if( !inReal ) return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
222 /* Generated */     #endif
223 /* Generated */     #if !defined(_JAVA)
224 /* Generated */     if( !outReal )
225 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
226 /* Generated */     #endif
227 /* Generated */  #endif
228 /* Generated */    for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
229 /* Generated */    {
230 /* Generated */       outReal[outIdx] = std_floor(inReal[i]);
231 /* Generated */    }
232 /* Generated */    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
233 /* Generated */    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
234 /* Generated */    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
235 /* Generated */ }
236 /* Generated */
237 /* Generated */ #if defined( _MANAGED )
238 /* Generated */ }}} // Close namespace TicTacTec.TA.Lib
239 /* Generated */ #endif
240 /**** END GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
241 
242