Skip to content

Commit f7faeef

Browse files
Change alloc names, add more equates
1 parent 0369593 commit f7faeef

File tree

7 files changed

+171
-106
lines changed

7 files changed

+171
-106
lines changed
0 Bytes
Binary file not shown.

CEdev/examples/library_examples/fileio/demo_3/src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/* Shared library headers - depends on which ones you wish to use */
1414
#include <lib/ce/fileioc.h>
1515

16-
/* Some common function prototypes. Maybe in the future these functions will become a library */
16+
/* Some function prototypes. Maybe in the future these functions will become a library */
1717
cplx_t Int24ToCplx(int real, int imag);
1818
cplx_t FloatToCplx(float real, float imag);
1919
cplx_t RealToCplx(real_t real, real_t imag);
@@ -40,23 +40,23 @@ void main(void) {
4040
ti_SetVar(TI_REAL_TYPE, ti_A, &my_real);
4141

4242
/* Store the equation "2+2" into the Y1 variable */
43-
my_equ = ti_AllocEqu(3);
43+
my_equ = ti_MallocEqu(3);
4444
my_equ->data[0] = '2';
4545
my_equ->data[1] = tAdd;
4646
my_equ->data[2] = '2';
4747
ti_SetVar(TI_EQU_TYPE, ti_Y1, my_equ);
4848
free(my_equ);
4949

5050
/* Store the list {1.5,2.5,3.5} to L1 */
51-
my_list = ti_AllocList(3);
51+
my_list = ti_MallocList(3);
5252
my_list->items[0] = real_1_5;
5353
my_list->items[1] = real_2_5;
5454
my_list->items[2] = real_3_5;
5555
ti_SetVar(TI_REAL_LIST_TYPE, ti_L1, my_list);
5656
free(my_list);
5757

5858
/* Store the matrix [[2.5,2.5]] to Ans */
59-
my_matrix = ti_AllocMatrix(1,2);
59+
my_matrix = ti_MallocMatrix(1,2);
6060
matrix_element(my_matrix, 0, 0) = real_2_5;
6161
matrix_element(my_matrix, 0, 1) = real_2_5;
6262
ti_SetVar(TI_MATRIX_TYPE, ti_Ans, my_matrix);

CEdev/examples/library_examples/fileio/demo_4/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void main(void) {
3434
return;
3535

3636
prime_factors((unsigned)in);
37-
list_out = ti_AllocList(total_primes);
37+
list_out = ti_MallocList(total_primes);
3838

3939
for(i=0; i<total_primes; i++) {
4040
list_out->items[i] = os_Int24ToReal(primes[i]);

CEdev/include/lib/ce/fileioc.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,42 +249,42 @@ uint8_t ti_RclVar(const uint8_t var_type, const char *var_name, void **data_stru
249249
/**
250250
* Allocates space for a real variable
251251
*/
252-
#define ti_AllocReal() ((real_t*)malloc(sizeof(real_t)))
252+
#define ti_MallocReal() ((real_t*)malloc(sizeof(real_t)))
253253

254254
/**
255255
* Allocates space for a complex variable
256256
*/
257-
#define ti_AllocCplx() ((cplx_t*)malloc(sizeof(cplx_t)))
257+
#define ti_MallocCplx() ((cplx_t*)malloc(sizeof(cplx_t)))
258258

259259
/**
260260
* Allocates space for a string variable
261261
*/
262-
string_t *ti_CustomAllocString(unsigned len, void (*malloc_routine)(size_t));
263-
#define ti_AllocString(len) ti_CustomAllocString(len, (void*)malloc)
262+
string_t *ti_AllocString(unsigned len, void (*malloc_routine)(size_t));
263+
#define ti_MallocString(len) ti_AllocString(len, (void*)malloc)
264264

265265
/**
266266
* Allocates space for a list variable
267267
*/
268-
list_t *ti_CustomAllocList(unsigned dim, void (*malloc_routine)(size_t));
269-
#define ti_AllocList(dim) ti_CustomAllocList(dim, (void*)malloc)
268+
list_t *ti_AllocList(unsigned dim, void (*malloc_routine)(size_t));
269+
#define ti_MallocList(dim) ti_AllocList(dim, (void*)malloc)
270270

271271
/**
272272
* Allocates space for a matrix variable
273273
*/
274-
matrix_t *ti_CustomAllocMatrix(uint8_t rows, uint8_t cols, void (*malloc_routine)(size_t));
275-
#define ti_AllocMatrix(rows, cols) ti_CustomAllocMatrix(rows, cols, (void*)malloc)
274+
matrix_t *ti_AllocMatrix(uint8_t rows, uint8_t cols, void (*malloc_routine)(size_t));
275+
#define ti_MallocMatrix(rows, cols) ti_AllocMatrix(rows, cols, (void*)malloc)
276276

277277
/**
278278
* Allocates space for a complex list variable
279279
*/
280-
cplx_list_t *ti_CustomAllocCplxList(unsigned dim, void (*malloc_routine)(size_t));
281-
#define ti_AllocCplxList(dim) ti_CustomAllocCplxList(dim, (void*)malloc)
280+
cplx_list_t *ti_AllocCplxList(unsigned dim, void (*malloc_routine)(size_t));
281+
#define ti_MallocCplxList(dim) ti_AllocCplxList(dim, (void*)malloc)
282282

283283
/**
284284
* Allocates space for an equation variable
285285
*/
286-
equ_t *ti_CustomAllocEqu(unsigned len, void (*malloc_routine)(size_t));
287-
#define ti_AllocEqu(len) ti_CustomAllocEqu(len, (void*)malloc)
286+
equ_t *ti_AllocEqu(unsigned len, void (*malloc_routine)(size_t));
287+
#define ti_MallocEqu(len) ti_AllocEqu(len, (void*)malloc)
288288

289289
/**
290290
* Some more definitions using Ans

CEdev/include/lib/ce/graphx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ typedef struct gfx_point {
6767
* otherwise it will not be linked correctly
6868
*/
6969
gfx_image_t *gfx_AllocSprite(uint8_t width, uint8_t height, void (*malloc_routine)(size_t));
70+
#define gfx_MallocSprite(width, height) gfx_AllocSprite(uint8_t width, uint8_t height, (void*)malloc)
7071

7172
/**
7273
* This routine should be used globally as it uses the BSS

0 commit comments

Comments
 (0)