I looked in main.txt to see the source generated for a swap with SINGLEs

by qbguy (no login)

It uses the temp variable g_tmp_float. I looked in qbx.cpp and found this:

char g_tmp_char;
unsigned char g_tmp_uchar;
short g_tmp_short;
unsigned short g_tmp_ushort;
long g_tmp_long;
unsigned long g_tmp_ulong;
int64_t g_tmp_int64;
uint64_t g_tmp_uint64;
float g_tmp_float;
double g_tmp_double;
long double g_tmp_longdouble;
qbs *g_swap_str;

Here is the code I used:
x=2
y=3
SWAP x, y
PRINT x, y

produces this:

S_0:;
S_1:;
*__SINGLE_X= 2 ;
if(qbevent){qbevent=0;
while(suspend_program||stop_program){Sleep(10);if(stop_program) end();}
if(new_error){fix_error();if (error_retry){error_retry=0;goto S_1;}}
}
S_2:;
*__SINGLE_Y= 3 ;
if(qbevent){qbevent=0;
while(suspend_program||stop_program){Sleep(10);if(stop_program) end();}
if(new_error){fix_error();if (error_retry){error_retry=0;goto S_2;}}
}
S_3:;
g_tmp_float=*__SINGLE_X;
*__SINGLE_X=*__SINGLE_Y;
*__SINGLE_Y=g_tmp_float;
if(qbevent){qbevent=0;
while(suspend_program||stop_program){Sleep(10);if(stop_program) end();}
if(new_error){fix_error();if (error_retry){error_retry=0;goto S_3;}}
}
S_4:;
tqbs=qbs_new(0,0);
qbs_set(tqbs,qbs_add(qbs_str((float)(*__SINGLE_X)),qbs_new_txt(" ")));
if (new_error) goto skip1;
if (qbg_cursor_x!=1){
if ((tqbs->len+qbg_cursor_x-1)>qbg_width_in_characters){
qbs_print(nothingstring,1);
}}
qbs_print(tqbs,0);
qbs_set(tqbs,qbs_new_txt(" "));
do{
qbs_print(tqbs,0);
}while( ( (((qbg_cursor_x-1)%14)!=0) || (qbg_cursor_x>(qbg_width_in_characters-13)) ) && (qbg_cursor_x<qbg_width_in_characters) );
qbs_free(tqbs);
tqbs=qbs_new(0,0);
qbs_set(tqbs,qbs_add(qbs_str((float)(*__SINGLE_Y)),qbs_new_txt(" ")));
if (new_error) goto skip1;
if (qbg_cursor_x!=1){
if ((tqbs->len+qbg_cursor_x-1)>qbg_width_in_characters){
qbs_print(nothingstring,1);
}}
qbs_print(tqbs,0);
qbs_free(tqbs);
qbs_print(nothingstring,1);
skip1:
qbs_cleanup(qbs_tmp_base,0);
if(qbevent){qbevent=0;
while(suspend_program||stop_program){Sleep(10);if(stop_program) end();}
if(new_error){fix_error();if (error_retry){error_retry=0;goto S_4;}}
}
print_holding_cursor=0; qbg_cursor_x=1; qbg_cursor_y=qbg_height_in_characters;
if (qbg_width_in_characters==80){
qbs_print(qbs_new_txt("Press any key to continue "),0);
}else{
qbs_print(qbs_new_txt("Press any key to continue "),0);
}
do{
SDL_Delay(0);
if (stop_program) end();
}while(qbs_cleanup(qbs_tmp_base,qbs_equal(qbs_inkey(),qbs_new_txt(""))));
close_program=1;
end();
return NULL;
}

Posted on Jun 27, 2008, 6:55 PM
from IP address 75.0.227.216

Respond to this message   

Return to Index