FreeBASIC  0.91.0
hook_locate_ex.c
Go to the documentation of this file.
1 /* locate entrypoint, default to console mode */
2 
3 #include "fb.h"
4 
5 /*:::::*/
6 FBCALL int fb_LocateEx( int row, int col, int cursor, int *current_pos )
7 {
8  int tmp_current_pos = 0;
9  int res = fb_ErrorSetNum( FB_RTERROR_OK );
10  int start_y, end_y, con_width;
11 
12  fb_ConsoleGetView(&start_y, &end_y);
13  fb_GetSize( &con_width, NULL );
14 
15  if( row!=0 && (row<start_y || row>end_y) ) {
17  } else if( col!=0 && (col<1 || col>con_width) ) {
19  } else {
21 
22  FB_LOCK();
23 
24  if( __fb_ctx.hooks.locateproc ) {
25  tmp_current_pos = __fb_ctx.hooks.locateproc( row, col, cursor );
26  } else {
27  tmp_current_pos = fb_ConsoleLocate( row, col, cursor );
28  }
29 
30  if( col!=0 )
31  FB_HANDLE_SCREEN->line_length = col - 1;
32 
33  FB_UNLOCK();
34  }
35 
36  if( current_pos )
37  *current_pos = tmp_current_pos;
38 
39  return res;
40 }