Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
spotlessmind1975 committed Dec 15, 2024
2 parents f719f51 + a2cb925 commit baaf675
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
16 changes: 15 additions & 1 deletion ugbc/src/targets/common/_infrastructure.c
Original file line number Diff line number Diff line change
Expand Up @@ -11775,10 +11775,12 @@ Variable * origin_resolution_relative_transform_x( Environment * _environment, c
if ( !((struct _Environment *)_environment)->originUsed && !((struct _Environment *)_environment)->resolutionUsed ) {

if ( _x ) {
Variable * originX = variable_retrieve( _environment, _x );
x = variable_retrieve( _environment, _x );
if ( _is_relative ) {
x = variable_add( _environment, "XGR", x->name );
}
x->origin = originX;
} else {
x = variable_retrieve( _environment, "XGR" );
}
Expand All @@ -11790,8 +11792,11 @@ Variable * origin_resolution_relative_transform_x( Environment * _environment, c
Variable * result = variable_temporary( _environment, VT_POSITION, "(x)" );

result->reflected = _x;


Variable * originX = NULL;

if ( _x ) {
originX = variable_retrieve( _environment, _x );
x = variable_retrieve_or_define( _environment, _x, VT_POSITION, 0 );
if ( _is_relative ) {
x = variable_add( _environment, "XGR", x->name );
Expand Down Expand Up @@ -11819,6 +11824,8 @@ Variable * origin_resolution_relative_transform_x( Environment * _environment, c
variable_move( _environment, x->name, result->name );
}

result->origin = originX;

return result;

}
Expand All @@ -11837,10 +11844,12 @@ Variable * origin_resolution_relative_transform_y( Environment * _environment, c
if ( !((struct _Environment *)_environment)->originUsed && !((struct _Environment *)_environment)->resolutionUsed ) {

if ( _y ) {
Variable * originY = variable_retrieve( _environment, _y );
y = variable_retrieve( _environment, _y );
if ( _is_relative ) {
y = variable_add( _environment, "YGR", y->name );
}
y->origin = originY;
} else {
y = variable_retrieve( _environment, "YGR" );
}
Expand All @@ -11853,7 +11862,10 @@ Variable * origin_resolution_relative_transform_y( Environment * _environment, c

result->reflected = _y;

Variable * originY = NULL;

if ( _y ) {
originY = variable_retrieve( _environment, _y );
y = variable_retrieve_or_define( _environment, _y, VT_POSITION, 0 );
if ( _is_relative ) {
y = variable_add( _environment, "YGR", y->name );
Expand Down Expand Up @@ -11886,6 +11898,8 @@ Variable * origin_resolution_relative_transform_y( Environment * _environment, c
variable_move( _environment, y->name, result->name );
}

result->origin = originY;

return result;

}
Expand Down
34 changes: 22 additions & 12 deletions ugbc/src/targets/common/gr.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,40 @@ void gr_locate( Environment * _environment, char * _x, char * _y ) {

if ( _x ) {
Variable * x = variable_retrieve( _environment, _x );
if ( x->reflected ) {
if ( x->origin ) {
Variable * xgr = variable_retrieve( _environment, "XGR" );
variable_move( _environment, x->name, xgr->name );
variable_move( _environment, x->origin->name, xgr->name );
} else {
Variable * xgr = variable_retrieve( _environment, "XGR" );
if ( x->initializedByConstant ) {
variable_store( _environment, xgr->name, x->value );
} else {
if ( x->reflected ) {
Variable * xgr = variable_retrieve( _environment, "XGR" );
variable_move( _environment, x->name, xgr->name );
} else {
Variable * xgr = variable_retrieve( _environment, "XGR" );
if ( x->initializedByConstant ) {
variable_store( _environment, xgr->name, x->value );
} else {
variable_move( _environment, x->name, xgr->name );
}
}
}
}

if ( _y ) {
Variable * y = variable_retrieve( _environment, _y );
if ( y->reflected ) {
if ( y->origin ) {
Variable * ygr = variable_retrieve( _environment, "YGR" );
variable_move( _environment, y->name, ygr->name );
variable_move( _environment, y->origin->name, ygr->name );
} else {
Variable * ygr = variable_retrieve( _environment, "YGR" );
if ( y->initializedByConstant ) {
variable_store( _environment, ygr->name, y->value );
} else {
if ( y->reflected ) {
Variable * ygr = variable_retrieve( _environment, "YGR" );
variable_move( _environment, y->name, ygr->name );
} else {
Variable * ygr = variable_retrieve( _environment, "YGR" );
if ( y->initializedByConstant ) {
variable_store( _environment, ygr->name, y->value );
} else {
variable_move( _environment, y->name, ygr->name );
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions ugbc/src/ugbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,12 @@ typedef struct _Variable {
*/
unsigned char * valueBuffer;

/**
* Original coordinate variable referred to this one
* when ORIGIN is in effect.
*/
struct _Variable * origin;

/**
* Reflected variable.
*/
Expand Down

0 comments on commit baaf675

Please sign in to comment.