Skip to content

Commit

Permalink
Remove deprecated TA_LIB_PRO
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Nov 8, 2024
1 parent f672d7c commit 84e0ed2
Show file tree
Hide file tree
Showing 167 changed files with 642 additions and 1,481 deletions.
4 changes: 4 additions & 0 deletions README-DEVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Must be in a specific directory to run it:
$ cd ta-lib/bin
$ ./gen_code
```

## Code Flow
C IDL (interface, function signature) -> gen_code -> C Function (complicated) -> gen_code -> Java

34 changes: 17 additions & 17 deletions java/src/com/tictactec/ta/lib/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
package com.tictactec.ta.lib;

public class Core {

private int[] unstablePeriod;

private CandleSetting[] candleSettings;

private Compatibility compatibility;

/** Creates a new instance of Core */
public Core() {
unstablePeriod = new int[com.tictactec.ta.lib.FuncUnstId.All
Expand All @@ -69,7 +69,7 @@ public Core() {
candleSettings[i] = new CandleSetting(TA_CandleDefaultSettings[i]);
}
}

public RetCode SetCandleSettings(CandleSettingType settingType,
RangeType rangeType, int avgPeriod, double factor) {
if (settingType.ordinal() >= CandleSettingType.AllCandleSettings
Expand All @@ -81,7 +81,7 @@ public RetCode SetCandleSettings(CandleSettingType settingType,
candleSettings[settingType.ordinal()].factor = factor;
return RetCode.Success;
}

final private CandleSetting TA_CandleDefaultSettings[] = {
/*
* real body is long when it's longer than the average of the 10
Expand Down Expand Up @@ -146,7 +146,7 @@ public RetCode SetCandleSettings(CandleSettingType settingType,
*/
new CandleSetting(CandleSettingType.Equal,
RangeType.HighLow, 5, 0.05) };

public RetCode RestoreCandleDefaultSettings(
CandleSettingType settingType) {
int i;
Expand All @@ -163,7 +163,7 @@ public RetCode RestoreCandleDefaultSettings(
}
return RetCode.Success;
}

public RetCode SetUnstablePeriod(FuncUnstId id, int period)
{
if (id.ordinal() >= FuncUnstId.All
Expand All @@ -172,22 +172,22 @@ public RetCode SetUnstablePeriod(FuncUnstId id, int period)
unstablePeriod[id.ordinal()] = period;
return RetCode.Success;
}

public int GetUnstablePeriod(FuncUnstId id)
{
return unstablePeriod[id.ordinal()];
}

public void SetCompatibility(Compatibility compatibility)
{
this.compatibility = compatibility;
}

public Compatibility getCompatibility()
{
return compatibility;
}

/**** START GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/
public int accbandsLookback( int optInTimePeriod )
{
Expand Down Expand Up @@ -22001,15 +22001,15 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
inReal, optInTimePeriod,
outBegIdx, outNBElement, outReal );
}
RetCode TA_INT_SMA( int startIdx,
TA_INT_SMA( int startIdx,
int endIdx,
double inReal[],
double inReal[], <-- Arrays
int optInTimePeriod,
MInteger outBegIdx,
MInteger outNBElement,
double outReal[] )
double outReal[] ) : RetCode
{
double periodTotal, tempReal;
let mut periodTotal, tempReal;
int i, outIdx, trailingIdx, lookbackTotal;
lookbackTotal = (optInTimePeriod-1);
if( startIdx < lookbackTotal )
Expand Down Expand Up @@ -25272,5 +25272,5 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
}
/* Generated */
/**** END GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/

}
10 changes: 5 additions & 5 deletions java/src/com/tictactec/ta/lib/meta/TaFuncMetaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public class TaFuncMetaInfo extends TaFuncSignature
static final int TOTAL_FIX_PARAMETERS = 4;
static final int INPUT_FIX_PARAMETERS = 2;
static final int OUTPUT_FIX_PARAMETERS = 2;

public TaFuncMetaInfo(String name, Method method, Method lookbackMethod)
{
this.name = name;
this.name = name;doForEachFunctionPhase2
this.method = method;
this.lookbackMethod = lookbackMethod;
this.optionTypes = lookbackMethod.getParameterTypes();
Expand Down Expand Up @@ -190,16 +190,16 @@ public RetCode call(Core taCore, Object[] inArs, int startIndex, int endIndex, O
for(int j=0;j<outVarTypes.length;j++)
{
parameters[i++] = outArs[j];
}
}
return (RetCode) getMethod().invoke(taCore, parameters);
}

public int callLookback(Core taCore, Object ... options) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
System.out.println(getLookbackMethod());
return (Integer) getLookbackMethod().invoke(taCore, options);
}

public String toString()
{
StringBuffer sb = new StringBuffer();
Expand Down
16 changes: 4 additions & 12 deletions src/ta_common/ta_global.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
#include "ta_global.h"
#include "ta_func.h"

#ifdef TA_LIB_PRO
/* Section for code distributed with TA-Lib Pro only. */
#endif

/**** External functions declarations. ****/
/* None */

Expand Down Expand Up @@ -97,11 +93,7 @@ TA_RetCode TA_Initialize( void )
* variables of all other modules...
*/
memset( TA_Globals, 0, sizeof( TA_LibcPriv ) );
TA_Globals->magicNb = TA_LIBC_PRIV_MAGIC_NB;

#ifdef TA_LIB_PRO
/* Section for code distributed with TA-Lib Pro only. */
#endif
TA_Globals->magicNb = TA_LIBC_PRIV_MAGIC_NB;

/*** At this point, TA_Shutdown can be called to clean-up. ***/

Expand All @@ -122,9 +114,9 @@ TA_RetCode TA_Shutdown( void )
return TA_SUCCESS;
}

TA_RetCode TA_SetCandleSettings( TA_CandleSettingType settingType,
TA_RangeType rangeType,
int avgPeriod,
TA_RetCode TA_SetCandleSettings( TA_CandleSettingType settingType,
TA_RangeType rangeType,
int avgPeriod,
double factor )
{
/*printf("setcdlset:%d ",settingType);*/
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_ACCBANDS.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
24 changes: 8 additions & 16 deletions src/ta_func/ta_ACOS.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,10 @@

/* Insert TA function code here. */

#ifdef TA_LIB_PRO
/* Section for code distributed with TA-Lib Pro only. */
#else
for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
{
outReal[outIdx] = std_acos(inReal[i]);
}
#endif
for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
{
outReal[outIdx] = std_acos(inReal[i]);
}

VALUE_HANDLE_DEREF(outNBElement) = outIdx;
VALUE_HANDLE_DEREF(outBegIdx) = startIdx;
Expand All @@ -184,7 +180,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down Expand Up @@ -236,13 +231,10 @@
/* Generated */ return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */ #endif
/* Generated */ #endif
/* Generated */ #ifdef TA_LIB_PRO
/* Generated */ #else
/* Generated */ for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
/* Generated */ {
/* Generated */ outReal[outIdx] = std_acos(inReal[i]);
/* Generated */ }
/* Generated */ #endif
/* Generated */ for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
/* Generated */ {
/* Generated */ outReal[outIdx] = std_acos(inReal[i]);
/* Generated */ }
/* Generated */ VALUE_HANDLE_DEREF(outNBElement) = outIdx;
/* Generated */ VALUE_HANDLE_DEREF(outBegIdx) = startIdx;
/* Generated */ return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_AD.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
36 changes: 8 additions & 28 deletions src/ta_func/ta_ADD.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,7 @@
{
/* insert local variable here */
int outIdx;

#ifdef TA_LIB_PRO
/* Section for code distributed with TA-Lib Pro only. */
/* Begin Proprietary */
/* End Proprietary */
#else
int i;
#endif

/**** START GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
/* Generated */
Expand All @@ -178,14 +171,10 @@

/* Insert TA function code here. */

#ifdef TA_LIB_PRO
/* Section for code distributed with TA-Lib Pro only. */
#else
for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
{
outReal[outIdx] = inReal0[i]+inReal1[i];
}
#endif
for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
{
outReal[outIdx] = inReal0[i]+inReal1[i];
}

VALUE_HANDLE_DEREF(outNBElement) = outIdx;
VALUE_HANDLE_DEREF(outBegIdx) = startIdx;
Expand All @@ -196,7 +185,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down Expand Up @@ -238,12 +226,7 @@
/* Generated */ #endif
/* Generated */ {
/* Generated */ int outIdx;
/* Generated */ #ifdef TA_LIB_PRO
/* Generated */ /* Begin Proprietary */
/* Generated */ /* End Proprietary */
/* Generated */ #else
/* Generated */ int i;
/* Generated */ #endif
/* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK
/* Generated */ if( startIdx < 0 )
/* Generated */ return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
Expand All @@ -258,13 +241,10 @@
/* Generated */ return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */ #endif
/* Generated */ #endif
/* Generated */ #ifdef TA_LIB_PRO
/* Generated */ #else
/* Generated */ for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
/* Generated */ {
/* Generated */ outReal[outIdx] = inReal0[i]+inReal1[i];
/* Generated */ }
/* Generated */ #endif
/* Generated */ for( i=startIdx, outIdx=0; i <= endIdx; i++, outIdx++ )
/* Generated */ {
/* Generated */ outReal[outIdx] = inReal0[i]+inReal1[i];
/* Generated */ }
/* Generated */ VALUE_HANDLE_DEREF(outNBElement) = outIdx;
/* Generated */ VALUE_HANDLE_DEREF(outBegIdx) = startIdx;
/* Generated */ return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_ADOSC.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_ADX.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_ADXR.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_APO.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ TA_RetCode TA_PREFIX(INT_PO)( int startIdx,
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_AROON.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
1 change: 0 additions & 1 deletion src/ta_func/ta_AROONOSC.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@
/**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
/* Generated */
/* Generated */ #define USE_SINGLE_PRECISION_INPUT
/* Generated */ #undef TA_LIB_PRO
/* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
/* Generated */ #undef TA_PREFIX
/* Generated */ #define TA_PREFIX(x) TA_S_##x
Expand Down
Loading

0 comments on commit 84e0ed2

Please sign in to comment.