Skip to content

Commit a1564b6

Browse files
committed
Mention the non-macro helper functions in some demos
1 parent 9c57d3f commit a1564b6

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

examples/fileio_factorize/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
void prime_factors(unsigned int n);
1313

1414
int primes[512];
15-
int total_primes = 0;
15+
unsigned int total_primes = 0;
1616

1717
/* Main Function */
1818
void main(void) {
@@ -34,7 +34,7 @@ void main(void) {
3434

3535
/* Create a list to store the primes */
3636
if (!total_primes) return;
37-
list_out = ti_MallocList(total_primes);
37+
list_out = ti_MallocList(total_primes); // Same as ti_AllocList(total_primes, malloc)
3838

3939
/* Write out the list of primes */
4040
for (i=0; i<total_primes; i++) {

examples/fileio_os_vars/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@ void main(void) {
3737
ti_SetVar(TI_REAL_TYPE, ti_A, &my_real);
3838

3939
/* Store the equation "2+2" into the Y1 variable */
40-
my_equ = ti_MallocEqu(3);
40+
my_equ = ti_MallocEqu(3); // Same as ti_AllocEqu(3, malloc)
4141
my_equ->data[0] = '2';
4242
my_equ->data[1] = tAdd;
4343
my_equ->data[2] = '2';
4444
ti_SetVar(TI_EQU_TYPE, ti_Y1, my_equ);
4545
free(my_equ);
4646

4747
/* Store the list {1.5,2.5,3.5} to L1 */
48-
my_list = ti_MallocList(3);
48+
my_list = ti_MallocList(3); // Same as ti_AllocList(3, malloc)
4949
my_list->items[0] = real_1_5;
5050
my_list->items[1] = real_2_5;
5151
my_list->items[2] = real_3_5;
5252
ti_SetVar(TI_REAL_LIST_TYPE, ti_L1, my_list);
5353
free(my_list);
5454

5555
/* Store the matrix [[2.5,2.5]] to Ans */
56-
my_matrix = ti_MallocMatrix(1,2);
56+
my_matrix = ti_MallocMatrix(1,2); // Same as ti_AllocMatrix(1, 2, malloc)
5757
matrix_element(my_matrix, 0, 0) = real_2_5;
5858
matrix_element(my_matrix, 0, 1) = real_2_5;
5959
ti_SetVar(TI_MATRIX_TYPE, ti_Ans, my_matrix);

examples/gfx_rletsprite/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void main(void) {
9898
gfx_TransparentSprite_NoClip(ubuntu_normal, xmin + w * 3 / 2, ymin + h * 3);
9999
gfx_ConvertToRLETSprite(ubuntu_normal, ubuntu_uninited);
100100
gfx_RLETSprite_NoClip(ubuntu_uninited, xmin + w * 5 / 2, ymin + h * 3);
101-
ubuntu_malloc = gfx_ConvertMallocRLETSprite(ubuntu_normal);
101+
ubuntu_malloc = gfx_ConvertMallocRLETSprite(ubuntu_normal); // Same as gfx_ConvertToNewRLETSprite(ubuntu_normal, malloc)
102102
gfx_RLETSprite_NoClip(ubuntu_malloc, xmin + w * 7 / 2, ymin + h * 3);
103103

104104
/* Wait for a key to be pressed */

examples/gfx_sprite_compress/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void main(void) {
2020
gfx_sprite_t *apple;
2121

2222
/* Allocate space for the decompressed sprite */
23-
apple = gfx_MallocSprite(apple_width, apple_height);
23+
apple = gfx_MallocSprite(apple_width, apple_height); // Same as: gfx_AllocSprite(apple_width, apple_height, malloc)
2424

2525
/* Decompress the sprite */
2626
dzx7_Standard(apple_compressed, apple); // or dzx7_Turbo

examples/gfx_tilemap_compress/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void main(void) {
4545

4646
/* Decompress the tiles */
4747
for (i = 0; i < sizeof(tileset_tiles)/sizeof(gfx_sprite_t*) ; i++) {
48-
tmp_ptr = gfx_MallocSprite(TILE_WIDTH, TILE_HEIGHT);
48+
tmp_ptr = gfx_MallocSprite(TILE_WIDTH, TILE_HEIGHT); // Same as gfx_AllocSprite(TILE_WIDTH, TILE_HEIGHT, malloc)
4949
dzx7_Turbo(tileset_tiles_compressed[i], tmp_ptr); // or dzx7_Standard, but in this case we have a lot of tiles
5050
tileset_tiles[i] = tmp_ptr;
5151
}
@@ -73,7 +73,7 @@ void main(void) {
7373
gfx_SetPalette(tiles_gfx_pal, sizeof_tiles_gfx_pal, 0);
7474
gfx_SetColor(gfx_white);
7575

76-
/* Draw to buffer to avoid tearing */
76+
/* Draw to buffer to avoid tearing. Note, this is the same as gfx_SetDraw(gfx_buffer) */
7777
gfx_SetDrawBuffer();
7878

7979
/* Set monospace font with width of 8 */

0 commit comments

Comments
 (0)