3d: windows-make: WindowsAPI: We give up caring of allocation.
On the code:
1. if lines[i] is null.
*
i equals index.
And, we are going to use another buffer fixed because we can care of if we know the line after.
We put the m_thread_sleep after new allocation and would give it up that allocation.m_thread_sleep ();
--- Execution 001 ---
Mon Aug 09 17:47:41 202 i 1 lines|037d0b40| i 1 lines_2D|037d0b10|ullptr=|00000000|.7cf768|.Mon Aug 09 17:47:41 202 i 2 lines|00349600| i 2 lines_2D|0034d5f8| nullptr=|00000000|.7cf768|.Mon Aug 09 17:47:42 202 i 2 lines|037d0b88| i 2 lines_2D|037d0bd0|ullptr=|00000000|.7cf768|.Mon Aug 09 17:47:42 202 i 2 lines|037d0b88| i 2 lines_2D|037d0bd0|ullptr=|00000000|.7cf768|.Mon Aug 09 17:47:42 202 i 3 lines|00000000| i 3 lines_2D|00000000| nullptr=|00000000|.7cf768|.Mon Aug 09 17:47:42 202 i 3 lines|00000000| i 3 lines_2D|00000000|ullptr=|00000000|.7cf768|.Mon Aug 09 17:47:42 202 We can't allocate for lines memories. they are NULL after allocation loop.
--- Execution 001 ---
int m_thread_sleep () {
Sleep(250);
}
int mDisplayControls_wmpaint_display_threeD_proc ( HWND hWnd, HDC hDC, PAINTSTRUCT* ps, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
err_msg_001("mDisplayControls_wmpaint_display_threeD_proc: starts.\r\n");
static int call_once_m = 0;
int a = 0;
float x1 = 0.0f, y1 = 0.0f, z1 = 0.0f;
float x2 = 0.0f, y2 = 0.0f, z2 = 0.0f;
if ( AXEX_2D_001 == NULL ) {
err_msg_001("mDisplayControls_wmpaint_display_threeD_proc: middle: 002-01\r\n");
a = initialize_vAxex_2D_002 ();
err_msg_001("mDisplayControls_wmpaint_display_threeD_proc: middle: 002-02\r\n");
}
err_msg_001("mDisplayControls_wmpaint_display_threeD_proc: middle: 002-03-01.\r\n");
line_index = 12;
err_msg_001("lines |%p| \r\n", lines );
if ( call_once_m == 0 ) {
err_msg_001 ("malloc: lines: |%p| |%p| ends.\r\n", lines, lines_2D );
lines = (vLine**) realloc ( lines, sizeof (vLine*) * line_index );
if ( lines == NULL ) {
err_msg_001 ("lines_2D |%p| \r\n" , lines);
exit(-1);
}
lines_2D = (vLine**) realloc ( lines_2D, sizeof (vLine*) * line_index );
if ( lines_2D == NULL ) {
err_msg_001 ("lines_2D |%p| \r\n" , lines_2D);
exit(-1);
}
err_msg_001 ("malloc: lines: |%p| |%p| ends.\r\n", lines, lines_2D );
for ( int i = 0; i<line_index; i++ ) {
err_msg_001("i %d lines|%p| i %d lines_2D|%p| nullptr=|%p|\r\n", i, lines[i], i, lines_2D[i], nullptr);
if ( lines[i] != nullptr ) {
lines[i] = memorizevLine ( memorizevPoint( 0.0f, 0.0f, 0.0f ), memorizevPoint( 0.0f, 0.0f, 0.0f ) );
m_thread_sleep ();
}
if ( lines_2D[i] != nullptr ) {
lines_2D[i] = memorizevLine ( memorizevPoint( 0.0f, 0.0f, 0.0f ), memorizevPoint( 0.0f, 0.0f, 0.0f ) );
m_thread_sleep ();
}
err_msg_001("i %d lines|%p| i %d lines_2D|%p|\r\n", i, lines[i], i, lines_2D[i]);
if ( lines[i] == nullptr && lines_2D[i] == nullptr ) {
err_msg_001("We can't allocate for lines memories. they are NULL after allocation loop.\r\n" );
exit(-1);
}
err_msg_001("i %d lines|%p| i %d lines_2D|%p|\r\n", i, lines[i], i, lines_2D[i]);
}
err_msg_001 ("malloc: lines: |%p| |%p| has finished. \r\n", lines, lines_2D );
call_once_m = 1;
}
err_msg_001("mDisplayControls_wmpaint_display_threeD_proc: middle: 002-03-02.\r\n");
for ( int i = 3; i<line_index; i++ ) {
err_msg_001("m-02-01: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p| AXEX_2D_001[%d]=|%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D, (i - 1) / 3, AXEX_2D_001[ (i - 1) / 3 ] );
// right arrow is different, we don't know that reason.
x1 = AXEX_2D_001[ (i - 1) / 3 ]->center->x;
y1 = AXEX_2D_001[ (i - 1) / 3 ]->center->y;
z1 = AXEX_2D_001[ (i - 1) / 3 ]->center->z;
err_msg_001("m-02-01-01: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
x2 = x1 + AXEX_2D_001[ (i - 1) / 3 ]->right->x * 30.0f;
y2 = y1 + AXEX_2D_001[ (i - 1) / 3 ]->right->y * 30.0f;
z2 = z1 + AXEX_2D_001[ (i - 1) / 3 ]->right->z * 30.0f ;
err_msg_001("m-02-01-02: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
lines[i]->setLine ( x1, y1, z1, x2, y2, z2 ) ;
lines_2D[i]->setLine ( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f );
err_msg_001("m-02-01-03: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
i++;
err_msg_001("m-02-02: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
x1 = AXEX_2D_001[ (i - 1) / 3 ]->center->x;
y1 = AXEX_2D_001[ (i - 1) / 3 ]->center->y;
z1 = AXEX_2D_001[ (i - 1) / 3 ]->center->z;
x2 = x1 + AXEX_2D_001[ (i - 1) / 3 ]->up->x * 30.0f;
y2 = y1 + AXEX_2D_001[ (i - 1) / 3 ]->up->y * 30.0f;
z2 = z1 + AXEX_2D_001[ (i - 1) / 3 ]->up->z * 30.0f;
lines[i]->setLine ( x1, y1, z1, x2, y2, z2 ) ;
lines_2D[i]->setLine ( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f );
err_msg_001("m-02-02: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
i++;
err_msg_001("m-02-03: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
x1 = AXEX_2D_001[ (i - 1) / 3 ]->center->x;
y1 = AXEX_2D_001[ (i - 1) / 3 ]->center->y;
z1 = AXEX_2D_001[ (i - 1) / 3 ]->center->z;
x2 = x1 + AXEX_2D_001[ (i - 1) / 3 ]->depth->x * 30.0f;
y2 = y1 + AXEX_2D_001[ (i - 1) / 3 ]->depth->y * 30.0f;
z2 = z1 + AXEX_2D_001[ (i - 1) / 3 ]->depth->z * 30.0f ;
lines[i]->setLine ( x1, y1, z1, x2, y2, z2 ) ;
lines_2D[i]->setLine ( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f );
err_msg_001("m-02-03: i %d line_index = %d lines[%d]=|%p|/ lines |%p| lines2D[%d] =|%p| / lines2D |%p|\r\n", i, line_index, i, lines[i], lines, i, lines_2D[i], lines_2D );
}
printf("m-02: line_index = %d lines |%p| lines2D |%p|\r\n", line_index, lines, lines_2D );
int b = convert_model_lines( lines, lines_2D, 3, line_index );
printf("m-03: line_index = %d lines |%p| lines2D |%p|\r\n", line_index, lines, lines_2D );
// Display axes from 4 to 15
for ( int i = 3; i<line_index; i++ ) {
GamePaint_011( hDC, lines_2D[i] );
}
err_msg_001("mDisplayControls_wmpaint_display_threeD_proc: ends.\r\n");
}
// 20210321
vLine* memorizevLine( vPoint* a, vPoint* b ) {
printf("memorizevLine( vPoint* a, vPoint* b ) starts.");
printf("a , b = |%p||%p|", a, b );
a->print();
b->print();
dummy_vLine_p = new vLine ( a, b );
printf("memorized line |%p| = ", dummy_vLine_p );
dummy_vLine_p->print();
put_memories_vLine ( (vLine*)dummy_vLine_p );
return dummy_vLine_p;
}
correct: