commands (RECORD) (WITH) unscrambled
Apr 25, 2013 16:26:43 GMT 1
Post by bigbass on Apr 25, 2013 16:26:43 GMT 1
Well this is something I had to figure out because I used
some code to convert glade xml to bacon that I didn't write
in doing so I encountered the RECORD and WITH command
which looks a bit odd at first glance
I wondered if this has another way of seeing it
so here we go with a different example
after doing this test the result is RECORD
is a great BaCon tool
another ugly thing in C to convert is
x = myVector->x
y = myVector->y
the idea is but this syntax doesnt work this way in BACON
x = myVector[0].x
y = myVector[0].y
but in BaCon we use RECORD and WITH
using this syntax myVector.x
myVector->x can be translated to
myVector.x
the value is = 1
========================
lets do y now so everything is clear
using this syntax myVector.y
myVector->y can be translated to
myVector.y
the value is = 10
lets add them together
11
some code to convert glade xml to bacon that I didn't write
in doing so I encountered the RECORD and WITH command
which looks a bit odd at first glance
I wondered if this has another way of seeing it
so here we go with a different example
after doing this test the result is RECORD
is a great BaCon tool
RECORD myVector
LOCAL x
LOCAL y
END RECORD
WITH myVector
.x = 1
.y = 10
END WITH
PRINT "another ugly thing in C to convert is"
PRINT
PRINT "x = ", "myVector->x"
PRINT "y = ", "myVector->y"
PRINT
PRINT "the idea is but this syntax doesnt work this way in BACON"
PRINT
PRINT "x = ", "myVector[0].x"
PRINT "y = ", "myVector[0].y"
PRINT
PRINT "but in BaCon we use RECORD and WITH"
PRINT "using this syntax myVector.x"
PRINT
PRINT "myVector->x " , "can be translated to"
PRINT "myVector.x "
PRINT "the value is = " ,myVector.x
PRINT "========================"
PRINT
PRINT "lets do y now so everything is clear"
PRINT "using this syntax myVector.y"
PRINT
PRINT "myVector->y ", "can be translated to"
PRINT "myVector.y "
PRINT "the value is = " ,myVector.y
PRINT
PRINT "lets add them together"
PRINT myVector.x + myVector.y
another ugly thing in C to convert is
x = myVector->x
y = myVector->y
the idea is but this syntax doesnt work this way in BACON
x = myVector[0].x
y = myVector[0].y
but in BaCon we use RECORD and WITH
using this syntax myVector.x
myVector->x can be translated to
myVector.x
the value is = 1
========================
lets do y now so everything is clear
using this syntax myVector.y
myVector->y can be translated to
myVector.y
the value is = 10
lets add them together
11