un peu de clarifications

This commit is contained in:
tTh 2018-11-25 11:44:42 +01:00
parent 86515d49d5
commit d0a520ea56
3 changed files with 16 additions and 9 deletions

View File

@ -112,14 +112,14 @@ return ( &where->bbs[idx] );
}
/* --------------------------------------------------------------------- */
int print_bublist_desc(BBList *bbl, int flags)
int print_bublist_desc(BBList *bbl, int opts)
{
printf("------- bblist at %p\n", bbl);
printf("\tname \t'%s'\n", bbl->name);
printf("\tsize\t%6d\n\tfidx\t%6d\n", bbl->size, bbl->fidx);
if (flags & 0x01) {
if (opts & 0x01) {
printf("\txyz\t%f %f %f\n",
bbl->position.x, bbl->position.y, bbl->position.z);
}
@ -207,7 +207,7 @@ return 0;
* 0x0001 print diameter
* 0x0002 print graylevel
*/
int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int flags)
int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int opts)
{
int idx;
Bubulle *ar;
@ -230,8 +230,8 @@ for (idx=0; idx<bbl->fidx; idx++) {
fprintf(fp, "%12.6f %12.6f %12.6f",
ar[idx].p.x, ar[idx].p.y, ar[idx].p.z);
if (flags & 0x01) fprintf(fp, " %12.6f", ar[idx].d);
if (flags & 0x02) fprintf(fp, " %6d", ar[idx].gray);
if (opts & 0x01) fprintf(fp, " %12.6f", ar[idx].d);
if (opts & 0x02) fprintf(fp, " %6d", ar[idx].gray);
fputs("\n", fp);
}

View File

@ -20,6 +20,10 @@ typedef struct {
unsigned long reserved;
} RGBA;
/*
this is our main entity : the bubulle.
'bubulle' is a slang french word for 'friendly bubble'.
*/
typedef struct {
XYZ p; /* position */
double d; /* diameter */
@ -29,15 +33,19 @@ typedef struct {
double kvalue; /* wtf ? */
} Bubulle;
/*
this is the bubulles list descriptor.
*/
typedef struct {
char name[SZ_BUBULLE_TEXT+1];
int size; /* max number of bubulles */
int fidx; /* next free slot */
XYZ position;
XYZ position; /* global position */
unsigned long flags;
Bubulle *bbs;
Bubulle *bbs; /* ptr to a movable array */
} BBList;
BBList * alloc_bubulles(char *name, int nbre, int k);
int free_bubulles(BBList *bbl, int k);
int print_bublist_desc(BBList *bbl, int k);

3
tbb.c
View File

@ -119,10 +119,9 @@ int foo;
printf("*** Bubulles Testing -- %s %s\n\n", __DATE__, __TIME__);
bubulles_version(1);
print_sizeof();
test_alloc_free(5);
test_push_pop(2000);
test_push_pop(20000);
test_cleanfill_my_bublist(999);
foo = test_peek_poke(5000);