BaCon RECORD reference pointers
Apr 27, 2020 11:17:42 GMT 1
Post by alexfish on Apr 27, 2020 11:17:42 GMT 1
Hi All
as part of another thread had problems passing accessing bacon RECORD record_type *
looks like a solution
some bits from another project May be useful to others
Peter can you have a look where
is
if I use
then bacon kicks as in defined previously
Using latest bacon from fossil :: last night
BR
Alex
also trying find out what to do here RE valgrind
as part of another thread had problems passing accessing bacon RECORD record_type *
looks like a solution
some bits from another project May be useful to others
' record_type *
RECORD WIDGET
LOCAL active TYPE int
LOCAL xpos,ypos TYPE int
LOCAL w,h TYPE int
LOCAL string TYPE STRING
END RECORD
' our reference pointer is WIDGET_type*
DECLARE BUTTON_1 TYPE WIDGET_type*
RECORD EVENT
LOCAL active TYPE int
LOCAL xpos,ypos TYPE int
END RECORD
' our reference pointer is EVENT_type*
DECLARE Event_1 TYPE EVENT_type*
SUB SETEVENT ( EVENT_type* event)
event->active=1
event->xpos=12
event->ypos=30
ENDSUB
SUB WIDGET_EVENT(EVENT_type* event,WIDGET_type* widget)
widget->xpos= event->xpos
widget->ypos= event->ypos
END SUB
SUB WIDGET_GET_POSITION (WIDGET_type* widget, int * xpos,int * ypos)
* xpos = widget->xpos
* ypos =widget->ypos
END SUB
SETEVENT((EVENT_type*)&Event_1)
WIDGET_EVENT((EVENT_type*)&Event_1, (WIDGET_type*)& BUTTON_1)
' have a problem if use xpos & ypos the bacon say defined previousy
' can see this stament in the code ?
LOCAL Wxpos,Wypos TYPE int
WIDGET_GET_POSITION((WIDGET_type*)& BUTTON_1,&Wxpos,&Wypos)
PRINT Wxpos, ":" , Wypos
Peter can you have a look where
LOCAL Wxpos,Wypos TYPE int
is
if I use
LOCAL xpos,ypos TYPE int
then bacon kicks as in defined previously
Using latest bacon from fossil :: last night
BR
Alex
also trying find out what to do here RE valgrind
==19562== HEAP SUMMARY:
==19562== in use at exit: 100 bytes in 6 blocks
==19562== total heap usage: 6 allocs, 0 frees, 100 bytes allocated
==19562==
==19562== LEAK SUMMARY:
==19562== definitely lost: 9 bytes in 1 blocks
==19562== indirectly lost: 0 bytes in 0 blocks
==19562== possibly lost: 74 bytes in 1 blocks
==19562== still reachable: 17 bytes in 4 blocks
==19562== suppressed: 0 bytes in 0 blocks
==19562== Rerun with --leak-check=full to see details of leaked memory
==19562==
==19562== For counts of detected and suppressed errors, rerun with: -v
==19562== Use --track-origins=yes to see where uninitialised values come from
==19562== ERROR SUMMARY: 6900 errors from 254 contexts (suppressed: 176 from 5)