Skip to content

Commit b11a83f

Browse files
Versoin 1.2.4
1 parent 57a7c8a commit b11a83f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+6458
-1135
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/*++
2+
3+
Copyright (C) 2018 Automatic Component Toolkit Developers
4+
5+
All rights reserved.
6+
7+
This file has been generated by the Automatic Component Toolkit (ACT) version 1.2.4.
8+
9+
Abstract: This is an autogenerated plain C Header file in order to allow an easy
10+
use of Prime Numbers Interface
11+
12+
Interface version: 1.2.0
13+
14+
*/
15+
16+
#ifndef __LIBPRIMES_HEADER
17+
#define __LIBPRIMES_HEADER
18+
19+
#ifdef __LIBPRIMES_DLL
20+
#ifdef WIN32
21+
#define LIBPRIMES_DECLSPEC __declspec (dllexport)
22+
#else // WIN32
23+
#define LIBPRIMES_DECLSPEC __attribute__((visibility("default")))
24+
#endif // WIN32
25+
#else // __LIBPRIMES_DLL
26+
#define LIBPRIMES_DECLSPEC
27+
#endif // __LIBPRIMES_DLL
28+
29+
#include "libprimes_types.h"
30+
31+
extern "C" {
32+
33+
/*************************************************************************************************************************
34+
Class definition for Calculator
35+
**************************************************************************************************************************/
36+
37+
/**
38+
* Returns the current value of this Calculator
39+
*
40+
* @param[in] pCalculator - Calculator instance.
41+
* @param[out] pValue - The current value of this Calculator
42+
* @return error code or 0 (success)
43+
*/
44+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_getvalue (LibPrimes_Calculator pCalculator, unsigned long long * pValue);
45+
46+
/**
47+
* Sets the value to be factorized
48+
*
49+
* @param[in] pCalculator - Calculator instance.
50+
* @param[in] nValue - The value to be factorized
51+
* @return error code or 0 (success)
52+
*/
53+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_setvalue (LibPrimes_Calculator pCalculator, unsigned long long nValue);
54+
55+
/**
56+
* Sets the progress callback function
57+
*
58+
* @param[in] pCalculator - Calculator instance.
59+
* @param[in] pProgressCallback - The progress callback
60+
* @return error code or 0 (success)
61+
*/
62+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_setprogresscallback (LibPrimes_Calculator pCalculator, LibPrimesProgressCallback pProgressCallback);
63+
64+
/**
65+
* Performs the specific calculation of this Calculator
66+
*
67+
* @param[in] pCalculator - Calculator instance.
68+
* @return error code or 0 (success)
69+
*/
70+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_calculate (LibPrimes_Calculator pCalculator);
71+
72+
/*************************************************************************************************************************
73+
Class definition for FactorizationCalculator
74+
**************************************************************************************************************************/
75+
76+
/**
77+
* Returns the prime factors of this number (without multiplicity)
78+
*
79+
* @param[in] pFactorizationCalculator - FactorizationCalculator instance.
80+
* @param[in] nPrimeFactorsBufferSize - Number of elements in buffer
81+
* @param[out] pPrimeFactorsNeededCount - will be filled with the count of the written elements, or needed buffer size.
82+
* @param[out] pPrimeFactorsBuffer - PrimeFactor buffer of The prime factors of this number
83+
* @return error code or 0 (success)
84+
*/
85+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_factorizationcalculator_getprimefactors (LibPrimes_FactorizationCalculator pFactorizationCalculator, const unsigned int nPrimeFactorsBufferSize, unsigned int * pPrimeFactorsNeededCount, sLibPrimesPrimeFactor * pPrimeFactorsBuffer);
86+
87+
/*************************************************************************************************************************
88+
Class definition for SieveCalculator
89+
**************************************************************************************************************************/
90+
91+
/**
92+
* Returns all prime numbers lower or equal to the sieve's value
93+
*
94+
* @param[in] pSieveCalculator - SieveCalculator instance.
95+
* @param[in] nPrimesBufferSize - Number of elements in buffer
96+
* @param[out] pPrimesNeededCount - will be filled with the count of the written elements, or needed buffer size.
97+
* @param[out] pPrimesBuffer - uint64 buffer of The primes lower or equal to the sieve's value
98+
* @return error code or 0 (success)
99+
*/
100+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_sievecalculator_getprimes (LibPrimes_SieveCalculator pSieveCalculator, const unsigned int nPrimesBufferSize, unsigned int * pPrimesNeededCount, unsigned long long * pPrimesBuffer);
101+
102+
/*************************************************************************************************************************
103+
Global functions
104+
**************************************************************************************************************************/
105+
106+
/**
107+
* Creates a new FactorizationCalculator instance
108+
*
109+
* @param[out] pInstance - New FactorizationCalculator instance
110+
* @return error code or 0 (success)
111+
*/
112+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_createfactorizationcalculator (LibPrimes_FactorizationCalculator * pInstance);
113+
114+
/**
115+
* Creates a new SieveCalculator instance
116+
*
117+
* @param[out] pInstance - New SieveCalculator instance
118+
* @return error code or 0 (success)
119+
*/
120+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_createsievecalculator (LibPrimes_SieveCalculator * pInstance);
121+
122+
/**
123+
* Releases the memory of an Instance
124+
*
125+
* @param[in] pInstance - Instance Handle
126+
* @return error code or 0 (success)
127+
*/
128+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_releaseinstance (LibPrimes_BaseClass pInstance);
129+
130+
/**
131+
* retrieves the current version of the library.
132+
*
133+
* @param[out] pMajor - returns the major version of the library
134+
* @param[out] pMinor - returns the minor version of the library
135+
* @param[out] pMicro - returns the micro version of the library
136+
* @return error code or 0 (success)
137+
*/
138+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_getlibraryversion (unsigned int * pMajor, unsigned int * pMinor, unsigned int * pMicro);
139+
140+
/**
141+
* Handles Library Journaling
142+
*
143+
* @param[in] pFileName - Journal FileName
144+
* @return error code or 0 (success)
145+
*/
146+
LIBPRIMES_DECLSPEC LibPrimesResult libprimes_setjournal (const char * pFileName);
147+
148+
}
149+
150+
#endif // __LIBPRIMES_HEADER
151+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*++
2+
3+
Copyright (C) 2018 Automatic Component Toolkit Developers
4+
5+
All rights reserved.
6+
7+
This file has been generated by the Automatic Component Toolkit (ACT) version 1.2.4.
8+
9+
Abstract: This is an autogenerated plain C Header file with basic types in
10+
order to allow an easy use of Prime Numbers Interface
11+
12+
Interface version: 1.2.0
13+
14+
*/
15+
16+
#ifndef __LIBPRIMES_TYPES_HEADER
17+
#define __LIBPRIMES_TYPES_HEADER
18+
19+
/*************************************************************************************************************************
20+
General type definitions
21+
**************************************************************************************************************************/
22+
23+
typedef int LibPrimesResult;
24+
typedef void * LibPrimesHandle;
25+
26+
/*************************************************************************************************************************
27+
Version for LibPrimes
28+
**************************************************************************************************************************/
29+
30+
#define LIBPRIMES_VERSION_MAJOR 1
31+
#define LIBPRIMES_VERSION_MINOR 2
32+
#define LIBPRIMES_VERSION_MICRO 0
33+
34+
/*************************************************************************************************************************
35+
Error constants for LibPrimes
36+
**************************************************************************************************************************/
37+
38+
#define LIBPRIMES_SUCCESS 0
39+
#define LIBPRIMES_ERROR_NOTIMPLEMENTED 1
40+
#define LIBPRIMES_ERROR_INVALIDPARAM 2
41+
#define LIBPRIMES_ERROR_INVALIDCAST 3
42+
#define LIBPRIMES_ERROR_BUFFERTOOSMALL 4
43+
#define LIBPRIMES_ERROR_GENERICEXCEPTION 5
44+
#define LIBPRIMES_ERROR_COULDNOTLOADLIBRARY 6
45+
#define LIBPRIMES_ERROR_COULDNOTFINDLIBRARYEXPORT 7
46+
#define LIBPRIMES_ERROR_NORESULTAVAILABLE 8
47+
#define LIBPRIMES_ERROR_CALCULATIONABORTED 9
48+
49+
/*************************************************************************************************************************
50+
Declaration of handle classes
51+
**************************************************************************************************************************/
52+
53+
typedef LibPrimesHandle LibPrimes_BaseClass;
54+
typedef LibPrimesHandle LibPrimes_Calculator;
55+
typedef LibPrimesHandle LibPrimes_FactorizationCalculator;
56+
typedef LibPrimesHandle LibPrimes_SieveCalculator;
57+
58+
/*************************************************************************************************************************
59+
Declaration of structs
60+
**************************************************************************************************************************/
61+
62+
#pragma pack (1)
63+
64+
typedef struct {
65+
unsigned long long m_Prime;
66+
unsigned int m_Multiplicity;
67+
} sLibPrimesPrimeFactor;
68+
69+
#pragma pack ()
70+
71+
/*************************************************************************************************************************
72+
Declaration of function pointers
73+
**************************************************************************************************************************/
74+
75+
/**
76+
* LibPrimesProgressCallback - Callback to report calculation progress and query whether it should be aborted
77+
*
78+
* @param[in] fProgressPercentage - How far has the calculation progressed?
79+
* @param[out] pShouldAbort - Should the calculation be aborted?
80+
*/
81+
typedef void(*LibPrimesProgressCallback)(float, bool*);
82+
83+
#endif // __LIBPRIMES_TYPES_HEADER

0 commit comments

Comments
 (0)