Example #1
0
int rdbi_col_getW(
	rdbi_context_def *context,
    wchar_t *column_name,
    wchar_t *type,
    int  *length,
    int  *scale,
    int  *nullable,
    int  *is_autoincrement,
    int  *position,
    int  *eof)
{
    int   status;

    debug_on("rdbi_col_getW");

    status = (*(context->dispatch.col_getW))(context->drvr, column_name, type, length, scale, nullable, is_autoincrement,
                            position, eof);

    context->rdbi_last_status = status;

    debug_area()
    {
        if (*eof)
        {
            debug0("eof=TRUE");
        }
        else
        {
            debug6("column='%ls', type='%ls', length=%d, scale=%d, nullable=%s, position=%d",
                ISNULL(column_name), ISNULL(type), *length, *scale, ISTRUE(*nullable), *position);
        }
    }
    debug_return(NULL, status);
}
Example #2
0
int rdbi_objects_actW(
	rdbi_context_def *context,
    const wchar_t *owner,
    const wchar_t *target)
{
    int     status;
    int     tran_begun = FALSE;

    debug_on("rdbi_objects_actW");

    if (context->rdbi_cnct->autocommit_on) {
        rdbi_tran_begin(context, tran_id);
        tran_begun = TRUE;
    }

    status = (*(context->dispatch.objects_actW))(context->drvr, owner, target);

    context->rdbi_last_status = status;

    /* This code is based on rdbi_col_act, which assumes that prefetches 
    * occur, making it safe to end the transaction
    * without getting fetch across commit problems.  We'll do the same.
    */

    if ( tran_begun ) {
        rdbi_tran_end(context, tran_id);
    }

    debug_return(NULL, status);
}
Example #3
0
void
imlib2_initialize () {
  imlib2_initialized= true;
  imlib2_error      = true;

  int status= debug_off ();
  imlib2_bind (imlib_load_image, IMLIB2_load_image);
  imlib2_bind (imlib_image_get_width, IMLIB2_image_get_width);
  imlib2_bind (imlib_image_get_height, IMLIB2_image_get_height);
  imlib2_bind (imlib_context_set_image, IMLIB2_context_set_image);
  imlib2_bind (imlib_render_image_part_on_drawable_at_size,
	       IMLIB2_render_image_part_on_drawable_at_size);
  imlib2_bind (imlib_free_image, IMLIB2_free_image);
  imlib2_bind (imlib_context_set_display, IMLIB2_context_set_display);
  imlib2_bind (imlib_context_set_visual, IMLIB2_context_set_visual);
  imlib2_bind (imlib_context_set_colormap, IMLIB2_context_set_colormap);
  imlib2_bind (imlib_context_set_drawable, IMLIB2_context_set_drawable);
  debug_on (status);

#ifdef LINKED_IMLIB2
  if (DEBUG_AUTO) debug_automatic << "With linked Imlib2 support\n";
#else
  if (DEBUG_AUTO) debug_automatic << "Installed Imlib2 support\n";
#endif

  imlib2_error= false;
}
Example #4
0
int rdbi_objects_deac(rdbi_context_def *context)
{
    int   status;

    debug_on("rdbi_objects_deac");

    status = (*(context->dispatch.objects_deac))(context->drvr);

    context->rdbi_last_status = status;

    debug_return(NULL, status);

}
Example #5
0
int rdbi_stores_act(
	rdbi_context_def *context)
{
    int     status;

    debug_on("rdbi_stores_act");

    status = (*(context->dispatch.stores_act))(context->drvr);

    context->rdbi_last_status = status;

    debug_return(NULL, status);

}
Example #6
0
int rdbi_stores_get(
	rdbi_context_def *context,
    char *name,
    int  *eof)
{
    int   status;

    debug_on("rdbi_stores_get");

    status = (*(context->dispatch.stores_get))(context->drvr, name, eof);

    context->rdbi_last_status = status;

    debug_return(NULL, status);
}
Example #7
0
int rdbi_usr_existsW(
	rdbi_context_def *context,
    wchar_t *user_name,
    int  *exists)
{
    int   status;

    debug_on("rdbi_usr_exists");

    status = (*(context->dispatch.usr_existsW))(context->drvr, user_name, exists);

    context->rdbi_last_status = status;

    debug_return(NULL, status);

}
Example #8
0
int rdbi_objects_getW(
	rdbi_context_def *context,
    wchar_t *name,
    wchar_t *type,
    int  *eof)
{
    int   status;

    debug_on("rdbi_objects_get");

    status = (*(context->dispatch.objects_getW))(context->drvr, name, type, eof);

    context->rdbi_last_status = status;

    debug_return(NULL, status);
}
Example #9
0
void
axel_initialize () {
  axel_initialized= true;
  axel_error      = true;

  int status= debug_off ();
  axel_bind (axel_test, AXEL_test);
  debug_on (status);

#ifdef LINKED_AXEL
  if (DEBUG_AUTO) debug_automatic << "With linked Axel support\n";
#else
  if (DEBUG_AUTO) debug_automatic << "Installed Axel support\n";
#endif

  axel_error= false;
}
Example #10
0
bool
ft_initialize () {
  if (ft_initialized) return ft_error;
  ft_initialized= true;
#ifdef LINKED_FREETYPE
  ft_init_freetype = FT_Init_FreeType;
  ft_new_face      = FT_New_Face;
  ft_select_charmap= FT_Select_Charmap;
  ft_set_char_size = FT_Set_Char_Size;
  ft_get_char_index= FT_Get_Char_Index;
  ft_load_glyph    = FT_Load_Glyph;
  ft_render_glyph  = (glyph_renderer) ((void*) FT_Render_Glyph);
  ft_get_kerning   = FT_Get_Kerning;
  if (ft_init_freetype (&ft_library)) return true;
  if (DEBUG_AUTO) debug_automatic << "With linked TrueType support\n";
#else
  int status= debug_off ();
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_Init_FreeType" ,
			 (pointer&) ft_init_freetype);
  if (ft_init_freetype == NULL) return true;
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_New_Face"      ,
			 (pointer&) ft_new_face);
  if (ft_new_face == NULL) return true;
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_Select_Charmap",
			 (pointer&) ft_select_charmap);
  if (ft_select_charmap == NULL) return true;
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_Set_Char_Size" ,
			 (pointer&) ft_set_char_size);
  if (ft_set_char_size == NULL) return true;
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_Get_Char_Index",
			 (pointer&) ft_get_char_index);
  if (ft_get_char_index == NULL) return true;
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_Load_Glyph"    ,
			 (pointer&) ft_load_glyph);
  if (ft_load_glyph == NULL) return true;
  (void) symbol_install ("/usr/lib/libfreetype.so", "FT_Render_Glyph"  ,
			 (pointer&) ft_render_glyph);
  if (ft_render_glyph == NULL) return true;
  debug_on (status);
  if (ft_init_freetype (&ft_library)) return true;
  if (DEBUG_AUTO) debug_automatic << "Installed TrueType support\n";
#endif
  ft_error= false;
  return false;
}
Example #11
0
int rdbi_initialize (rdbi_context_def **contextp, char* driver)
{
    DWORD nchars;
    char module[MAX_PATH];
    char* last;
    HMODULE handle;
    FARPROC procedure;
    int status;

    debug_on("rdbi_initialize");

    nchars = GetModuleFileName (NULL, module, MAX_PATH);
    if (0 == nchars)
        strcpy (module, ".\\");
    else
    {   
        // scan the string for the last occurrence of a slash
        last = strrchr (module, '\\');
        if (NULL != last)
        {
            last++; // move past the slash
            *last = '\0'; // null terminate it there
        }
    }
    strcat (module, driver);
#ifdef _WIN32
    strcat (module, ".dll");
#else
    strcat (module, ".so"); // doesn't really work here, just a placeholder
#endif
    handle = LoadLibrary (module);
    if (NULL != handle)
    {
        procedure = GetProcAddress (handle, "init");
        if (NULL != procedure)
            status = rdbi_init (contextp, (initializer*)procedure);
        else
            status = RDBI_GENERIC_ERROR;
    }
    else
        status = RDBI_GENERIC_ERROR;
    
    debug_return(NULL, status);
}
Example #12
0
void
tm_sqlite3_initialize () {
  sqlite3_initialized= true;
  sqlite3_error      = true;

  int status= debug_off ();
  sqlite3_bind (sqlite3_open, SQLITE3_open);
  sqlite3_bind (sqlite3_close, SQLITE3_close);
  sqlite3_bind (sqlite3_get_table, SQLITE3_get_table);
  sqlite3_bind (sqlite3_free_table, SQLITE3_free_table);
  debug_on (status);

#ifdef LINKED_SQLITE3
  if (DEBUG_AUTO) debug_automatic << "With linked Sqlite3 support\n";
#else
  if (DEBUG_AUTO) debug_automatic << "Installed Sqlite3 support\n";
#endif

  sqlite3_error= false;
}
Example #13
0
void sph_cache::update(int t)
{
    struct timeval start, end;
    gettimeofday(&start,NULL);
    glPushAttrib(GL_PIXEL_MODE_BIT);
    {
	int c;
	float time;
	float lastTime;
	time = lastTime = 0.0;
        for (c = 0; !loads.empty(); ++c)
        {
            sph_task task = loads.remove();
            sph_page page = pages.search(sph_page(task.f, task.i), t);
                            waits.remove(sph_page(task.f, task.i));

            if (page.valid())
            {
		if(task.valid)
		{
		    page.t = t;
		    pages.remove(page);
		    pages.insert(page, t);

		    if (debug)
			debug_on(face_level(task.i));

		    task.make_texture(page.o, files[task.f].w, files[task.f].h,
			    files[task.f].c, files[task.f].b);
		}
		else
		{
		    pages.remove(page);
		    task.dump_texture();
		    if(page.o)
		    {
			glDeleteTextures(1,&page.o);
			page.o = 0;
		    }
		}
            }
            else
	    {
                task.dump_texture();
	    }

            pbos.enq(task.u);

	    gettimeofday(&end,NULL);
            lastTime = time;
	    time = (end.tv_sec - start.tv_sec) + ((end.tv_usec - start.tv_usec)/1000000.0);
	    lastTime = time - lastTime;
	    if(time + (lastTime*2.0) > _maxTime)
	    {
#ifdef CACHE_PRINT_DEBUG
		std::cerr << "Timeout break: Textures loaded: " << c+1 << std::endl;
#endif
		break;
	    }
        }

	/*if(c)
	{
	    std::cerr << "Textures loaded: " << c << std::endl;
	}*/
    }
    glPopAttrib();
}
Example #14
0
bool
tm_cairo_initialize () {
  if (tm_cairo_initialized) return tm_cairo_error;
  tm_cairo_initialized= true;

#ifdef LINKED_CAIRO
#define CAIRO_LINK(a,b) b = a
#else
#define CAIRO_LINK(LIBFUNC,LOCALFUNC) \
  (void) symbol_install ("/usr/lib/cairo.so", #LIBFUNC , (pointer&) LOCALFUNC); \
  if (LOCALFUNC == NULL) return true; 
  
  int status= debug_off ();
#endif
  
  CAIRO_LINK(cairo_move_to, tm_cairo_move_to);
  CAIRO_LINK(cairo_show_glyphs, tm_cairo_show_glyphs);
  CAIRO_LINK(cairo_font_face_status, tm_cairo_font_face_status);
  CAIRO_LINK(cairo_set_source_surface, tm_cairo_set_source_surface);
  CAIRO_LINK(cairo_new_path, tm_cairo_new_path);
  CAIRO_LINK(cairo_stroke, tm_cairo_stroke);
  CAIRO_LINK(cairo_font_face_set_user_data, tm_cairo_font_face_set_user_data);
  CAIRO_LINK(cairo_set_antialias, tm_cairo_set_antialias);
  CAIRO_LINK(cairo_set_font_size, tm_cairo_set_font_size);
  CAIRO_LINK(cairo_fill, tm_cairo_fill);
  CAIRO_LINK(cairo_set_source_rgba, tm_cairo_set_source_rgba);
  CAIRO_LINK(cairo_status_to_string, tm_cairo_status_to_string);
  CAIRO_LINK(cairo_set_source_rgb, tm_cairo_set_source_rgb);
  CAIRO_LINK(cairo_close_path, tm_cairo_close_path);
  CAIRO_LINK(cairo_restore, tm_cairo_restore);
  CAIRO_LINK(cairo_translate, tm_cairo_translate);
  CAIRO_LINK(cairo_set_font_face, tm_cairo_set_font_face);
  CAIRO_LINK(cairo_font_face_destroy, tm_cairo_font_face_destroy);
  CAIRO_LINK(cairo_set_line_width, tm_cairo_set_line_width);
  CAIRO_LINK(cairo_image_surface_create_from_png, tm_cairo_image_surface_create_from_png);
  CAIRO_LINK(cairo_image_surface_get_width, tm_cairo_image_surface_get_width);
  CAIRO_LINK(cairo_scale, tm_cairo_scale);
  CAIRO_LINK(cairo_mask, tm_cairo_mask);
  CAIRO_LINK(cairo_set_operator, tm_cairo_set_operator);
  CAIRO_LINK(cairo_image_surface_create, tm_cairo_image_surface_create);
  CAIRO_LINK(cairo_paint, tm_cairo_paint);
  CAIRO_LINK(cairo_rectangle, tm_cairo_rectangle);
  CAIRO_LINK(cairo_set_line_cap, tm_cairo_set_line_cap);
  CAIRO_LINK(cairo_set_line_join, tm_cairo_set_line_join);
  CAIRO_LINK(cairo_surface_reference, tm_cairo_surface_reference);
  CAIRO_LINK(cairo_line_to, tm_cairo_line_to);
  CAIRO_LINK(cairo_status, tm_cairo_status);
  CAIRO_LINK(cairo_show_page, tm_cairo_show_page);
  CAIRO_LINK(cairo_reference, tm_cairo_reference);
  CAIRO_LINK(cairo_create, tm_cairo_create);
  CAIRO_LINK(cairo_surface_destroy, tm_cairo_surface_destroy);
  CAIRO_LINK(cairo_set_fill_rule, tm_cairo_set_fill_rule);
  CAIRO_LINK(cairo_destroy, tm_cairo_destroy);
  CAIRO_LINK(cairo_save, tm_cairo_save);
  CAIRO_LINK(cairo_set_source, tm_cairo_set_source);
  CAIRO_LINK(cairo_image_surface_get_height, tm_cairo_image_surface_get_height);
  CAIRO_LINK(cairo_mask_surface, tm_cairo_mask_surface);

#ifdef CAIRO_HAS_FT_FONT
  CAIRO_LINK(cairo_ft_font_face_create_for_ft_face, tm_cairo_ft_font_face_create_for_ft_face);
#endif
#ifdef CAIRO_HAS_PS_SURFACE
  CAIRO_LINK(cairo_ps_surface_create, tm_cairo_ps_surface_create);
#endif
#ifdef CAIRO_HAS_XLIB_SURFACE
  CAIRO_LINK(cairo_xlib_surface_create, tm_cairo_xlib_surface_create);
#endif  
#ifdef CAIRO_HAS_QUARTZ_SURFACE
  CAIRO_LINK(cairo_quartz_surface_create_for_cg_context, tm_cairo_quartz_surface_create_for_cg_context) ;
#endif
  
    
#undef CAIRO_LINK
#ifdef LINKED_CAIRO
  if (DEBUG_AUTO) debug_automatic << "With linked Cairo support\n";
#else
  if (DEBUG_AUTO) debug_automatic << "Installed Cairo support\n";
  debug_on (status);
#endif
  
  
  tm_cairo_error= false;
  return false;
}
Example #15
0
static void save_err_msgW( 
	odbcdr_context_def  *context, 
	SQLSMALLINT plm_handle_type,	// Handle type
	SQLHANDLE plm_handle,			// Handle name
	int ConnInd)	    			// Connection indicator
{
	RETCODE		plm_retcode = SQL_SUCCESS;
	SQLWCHAR    plm_szSqlState[ODBCDR_MAX_BUFF_SIZE];
	SQLWCHAR 	plm_szErrorMsg[ODBCDR_MAX_BUFF_SIZE];
	SDWORD		plm_pfNativeError = 0L;
	SWORD	 	plm_pcbErrorMsg = 0;
	SQLSMALLINT plm_cRecNmbr = 1;
	SDWORD  	plm_SS_MsgState = 0;
	SDWORD  	plm_SS_Severity = 0;
	SQLINTEGER	plm_Rownumber = 0;
	USHORT		plm_SS_Line;
	SQLSMALLINT	plm_cbSS_Procname, plm_cbSS_Srvname;
	SQLWCHAR   	plm_SS_Procname[555];
	SQLWCHAR   	plm_SS_Srvname[555];
    plm_szSqlState[0] = L'\0';
    plm_szErrorMsg[0] = L'\0';

	debug_on("odbcdr_xlt_status: save_err_msg");

	context->odbcdr_last_err_msgW[0] = L'\0';

  	while (plm_retcode != SQL_NO_DATA_FOUND) {
		plm_retcode = SQLGetDiagRecW(plm_handle_type, plm_handle,
					plm_cRecNmbr, plm_szSqlState, &plm_pfNativeError,
					plm_szErrorMsg, ODBCDR_MAX_BUFF_SIZE - 1, &plm_pcbErrorMsg);
 
		// Note that if the application has not yet made a
		// successful connection, the SQLGetDiagField
		// information has not yet been cached by ODBC
		// Driver Manager and these calls to SQLGetDiagField
		// will fail.
		if (plm_retcode != SQL_NO_DATA_FOUND) {
			if (ConnInd) {
				plm_retcode = SQLGetDiagFieldW(
						plm_handle_type, plm_handle, plm_cRecNmbr,
						SQL_DIAG_ROW_NUMBER, &plm_Rownumber,
						SQL_IS_INTEGER,
						NULL);
#ifdef _WIN32
				plm_retcode = SQLGetDiagFieldW(
						plm_handle_type, plm_handle, plm_cRecNmbr,
						SQL_DIAG_SS_LINE, &plm_SS_Line,
						SQL_IS_INTEGER,
						NULL);
				plm_retcode = SQLGetDiagFieldW(
						plm_handle_type, plm_handle, plm_cRecNmbr,
						SQL_DIAG_SS_MSGSTATE, &plm_SS_MsgState,
						SQL_IS_INTEGER,
						NULL);
				plm_retcode = SQLGetDiagFieldW(
						plm_handle_type, plm_handle, plm_cRecNmbr,
						SQL_DIAG_SS_SEVERITY, &plm_SS_Severity,
						SQL_IS_INTEGER,
						NULL);
				plm_retcode = SQLGetDiagFieldW(
						plm_handle_type, plm_handle, plm_cRecNmbr,
						SQL_DIAG_SS_PROCNAME, &plm_SS_Procname,
						sizeof(plm_SS_Procname),
						&plm_cbSS_Procname);
				plm_retcode = SQLGetDiagFieldW(
						plm_handle_type, plm_handle, plm_cRecNmbr,
						SQL_DIAG_SS_SRVNAME, &plm_SS_Srvname,
						sizeof(plm_SS_Srvname),
						&plm_cbSS_Srvname);
#endif
			} // if ConnInd
			// display error messages, filtering out expected "errors"
            if ((plm_pfNativeError == 5701) ||	// Change database context error code
                (plm_pfNativeError == 5703)	) {	// Change language setting error code
					break;// out of while loop, do not display error messages
			} else {
				
				// Save the message.
				wcscpy( context->odbcdr_last_err_msgW, (wchar_t*)plm_szErrorMsg );

				debug1("szSqlState = %ls",plm_szSqlState);
				debug1("pfNativeError = %d",plm_pfNativeError);
				debug1("szErrorMsg = %ls",plm_szErrorMsg);
				debug1("pcbErrorMsg = %d",plm_pcbErrorMsg);
				if (ConnInd) {
					debug1("ODBCRowNumber = %d", plm_Rownumber);
					debug1("SSrvrLine = %d", plm_Rownumber);
					debug1("SSrvrMsgState = %d",plm_SS_MsgState);
					debug1("SSrvrSeverity = %d",plm_SS_Severity);
					debug1("SSrvrProcname = %ls",plm_SS_Procname);
					debug1("SSrvrSrvname = %ls",plm_SS_Srvname);
				}
				break;
			} //else
		} //if plm_retcode
		plm_cRecNmbr++; //Increment to next diagnostic record.
	} // End while.

	debug_return_void(NULL);

}
Example #16
0
void check_current_timer_irq(void)
{
 uint8 i=next_expired_timer & 0x1f;          // get the timer #
 viatype *V=(i<9) ? &via[i] : NULL;          // get VIA # if it's a via

 seek_mouse_event();

// ALERT_LOG(0,"Entering check_current_timer_irq. cpu68k_clocks:%016llx timer that expired:%d %s",
//        cpu68k_clocks,next_expired_timer,gettimername(next_expired_timer));

 //printregs(buglog,"");

 // DEBUG_LOG(0,"Timer #%d expired.  Clocks at :%ld\n",next_expired_timer,cpu68k_clocks);
 // DEBUG_LOG(0,"vertical:%ld(%s)\n cops_event:%ld(%s)\n tenth:%ld(%s)\npc24=%08x\n",
 //           virq_start,         (virq_start      >cpu68k_clocks ? "Good":"*Lost*"),
 //           cops_event,         (cops_event      >cpu68k_clocks ? "Good":"*Lost*"),
 //           tenth_sec_cycles,   (tenth_sec_cycles>cpu68k_clocks ? "Good":"*Lost*"),pc24 );


  // null cycle timer - just allow host ui to get an event, etc.
 if (!next_expired_timer) {//STAMP("timer=0");
                            DEBUG_LOG(0,"Waaa! Could not find a timer! cpu68k_clocks:%016llx before get_next_timer_event",cpu68k_clocks);
                            get_next_timer_event();
                            DEBUG_LOG(0,"Woot! cpu68k_clocks:%016llx after get_next_timer_event.  Got %d %s as the next timer.",cpu68k_clocks,
                                 next_expired_timer,gettimername(next_expired_timer));

                            if (cpu68k_clocks < cpu68k_clocks_stop) return;

                            if (!next_expired_timer) {DEBUG_LOG(0,"Got 0, bye."); return;}
                          }

 if (next_expired_timer>=CYCLE_TIMER_SCC_B_XMT_BUF_EMPTY && next_expired_timer<=CYCLE_TIMER_SCC_A_SPECIAL)
 {
    switch(next_expired_timer)
    {
        case CYCLE_TIMER_SCC_B_XMT_BUF_EMPTY:        break;
        case CYCLE_TIMER_SCC_B_EXT_STAT_CHG:         break;
        case CYCLE_TIMER_SCC_B_RCVD_CHAR:            break;
        case CYCLE_TIMER_SCC_B_SPECIAL:              break;
        case CYCLE_TIMER_SCC_A_XMT_BUF_EMPTY:        break;
        case CYCLE_TIMER_SCC_A_EXT_STAT_CHG:         break;
        case CYCLE_TIMER_SCC_A_RCVD_CHAR:            break;
        case CYCLE_TIMER_SCC_A_SPECIAL:              break;
    }
 }



 if ((next_expired_timer & 0x7f)==CYCLE_TIMER_VERTICAL_RETRACE)         // non-via timer such as vertical irq
 {
             /* This was wrong.  We have 0=entering retrace, 1= vertical off, but still in retrace, 2=display
                it's 15 lines each for 0,1, and 364 for the rest.
                 1 video bit = 5ns or 20Mhz.  1 line is 720 bits + h_sync of 11 words.
                 1 cpu cycle=4 bits.  720 bits = 180 cpu cycles + 11 (16 bit words) + 44 cycles H_SYNC=224 cycles/line
                 364 lines=81536 cpu cycles for the main display
                 15 lines 1/2 vsync = 3360 cpu cycles.
             */

             vcount++; if (vcount>2) vcount=0;     // 0=normal display, 1=vertical retrace with signal on, 2=vertical retrace, signal off

             // exiting vertical retrace, entering start of video frame.
             DEBUG_LOG(0,"Vertical Retrace Phase:%d, VTIR is %d:",vcount,videoirq);
             switch(vcount)
             {
             case 0:       {    DEBUG_LOG(0,"vertical retrace phase 0");

                //                if ( (screenrefreshcount=(screenrefreshcount+1) & 0x01)==0 ) LisaScreenRefresh();  // entering refresh cycle, so update screen with changes
                                  
                                  next_expired_timer=0;
                                  get_next_timer_event();
                                  video_scan=cpu68k_clocks;             // keep track of where we are
                                  virq_start=cpu68k_clocks+FULL_FRAME_CYCLES;

                                  return;
                                }

             // entering vertical retrace, signal IRQ if enabled
             case 1:    {          DEBUG_LOG(0,"vertical retrace phase 1, VIDEOIRQ PHASE/ENABLED is:%d",videoirq);
                                  virq_start=cpu68k_clocks + VERT_RETRACE_ON;
                                  vertical=1;
                                  verticallatch=1;

                                  if (videoirq & 1)     // Interrupt if turned on.
                                     {//STAMP("autovector: firing video IRQ\n");
                                      DEBUG_LOG(0,"Firing IRQ1 for vertical retrace");
                                      reg68k_external_autovector(IRQ_VIDEO);  // this was wrong - should be EXTERNAL!
                                     }
                                  else DEBUG_LOG(0,"Not firing IRQ1 for vertical retrace because it's off (videoirq=%d)",videoirq);

                                  next_expired_timer=0;
                                  get_next_timer_event();     // setup next cycle
                                  return;
                                }
             // exiting vertical retrace, shut vertical retrace signal off
             case 2 :
                                { DEBUG_LOG(0,"Vertical retrace phase 2");
                                  virq_start=cpu68k_clocks+VERT_RETRACE_CYCLES;
                                  vertical=0;  // not sure if vertical=0 s/b here!

                                  next_expired_timer=0;
                                  get_next_timer_event();     // setup next cycle
                                  return;
                                }
              }
             // this should be unreachable code.
             next_expired_timer=0;
             get_next_timer_event();     // setup next cycle
             return;
 }


 // COPS mouse timer
 if ((next_expired_timer & 0x7f)==CYCLE_TIMER_COPS_MOUSE_IRQ)
 { // need to be careful with the next line as it calls reg68k_internal vector while *OUTSIDE*!!!!
   DEBUG_LOG(0," CYCLE_TIMER_COPS_MOUSE_IRQ");
   SET_COPS_NEXT_EVENT(0);
   //DEBUG_LOG(0,"COPS Timer Entered:: cpu68k_clocks:%ld, cops_event:%ld cops_mouse:%d\n",cpu68k_clocks,cops_event,cops_mouse);


   // Are COPS IRQ's enabled?  If so, either mouse timer IRQ's enabled? or was there a keystroke?
   // then, fire the IRQ.
   if (   (cops_event>0 || copsqueuelen)  ) // 20060609   was (via[1].via[IER] & VIA_IRQ_BIT_CA1)    &&
   {
       DEBUG_LOG(0,"Setting IFR because either of these happened:");
       DEBUG_LOG(0,"via[1].via[IER] & CA1 bit:%d",  (via[1].via[IER] & VIA_IRQ_BIT_CA1)  );
       DEBUG_LOG(0,"(cops_event>0 is:%016llx   || copsqueuelen is %d)",cops_event,copsqueuelen);

       via[1].via[IFR] |= VIA_IRQ_BIT_CA1;

     //  DEBUG_LOG(0,"queuing COPS [mouse timed irq:] copsqlen:%d  items, %d mouse items. mouse is:%d\n",
     //              copsqueuelen,mousequeuelen,cops_mouse);


     //20060118-disabled this as it's handled via get_pending_vector! //  reg68k_external_autovector(IRQ_COPS);

   } else DEBUG_LOG(0,"Did not queue IRQ COPS");

   //STAMP("timer=0 - setting up next cycle");get_next_timer_event();     // setup next cycle
   next_expired_timer=0;  get_next_timer_event();  return;
 }





if ((next_expired_timer & 0x7f)==CYCLE_TIMER_COPS_CLOCK_DSEC)
 { // update system clock

      // might want to find a better place for this, but since 1/10th of a second occurs relatively
      // rarely compared to the 1/60th sec vertical redraw, it's somewhat better.
      #ifdef DEBUG
      #ifdef DEBUG_ON_SCREENHASH

         if ( cmp_screen_hash(debug_hash,get_screen_hash()) > SCREENHASH_LIMIT && 0==debug_log_enabled)
            { debug_on("screenhash-met"); debug_log_enabled=1;}

      #endif
      #ifdef DEBUG_OFF_SCREENHASH
      if ( cmp_screen_hash(debug_hash_off,get_screen_hash()) > SCREENHASH_LIMIT && debug_log_enabled)
            { debug_off(); debug_log_enabled=0; ALERT_LOG(0,"Debug OFf SCREENHASH_OFF Met");}
      #endif
      #endif



   DEBUG_LOG(0,"COPS Decisecond timer entered.\n");


   // take care of some other housekeeping too
   if (floppy_ram[0]) floppy_go6504();
   if (scc_running>2) scc_control_loop();
   seek_mouse_event();
   if (scc_running) scc_control_loop();

   next_expired_timer=0;  get_next_timer_event();


   // lisa can ask COPS to disable the clock.  When this is done, don't track time until re-enabled
   if (!lisa_clock_on)                             {STAMP("lisa clock is disabled, therefore frozen"); return;}



#ifndef USE64BITTIMER
   if (lasttenth>HALF_CLK) lasttenth=CLKDIV2(lasttenth);
#endif

   if ((lasttenth+TENTH_OF_A_SECOND)>cpu68k_clocks) return;  // ensure we're not updating too often.

   //decisecond_clk_tick();             // handled by lisaem_wx.cpp OnIdle loop //20070409//
   tenth_sec_cycles =cpu68k_clocks+TENTH_OF_A_SECOND;  // schedule next 1/10th second IRQ to fire

   //ALERT_LOG(0,"1/10th tick. cpu clk:%lld\n",cpu68k_clocks);

   //printlisatime(buglog);
   return;
 }

/// Floppy FDIR events /////////////////////////////////////////////////////////////////////////////////////////////////////////
if ((next_expired_timer & 0x7f)==CYCLE_TIMER_FDIR)
 {
     DEBUG_LOG(0,"Entering CYCLE_TIMER_FDIR");

     next_expired_timer=0;  get_next_timer_event();


     if (fdir_timer==-1) return;        // prevent duplicate IRQ's.

     fdir_timer=-1;                     // clear the timer
     FloppyIRQ_time_up();

     if (!floppy_FDIR)                 //20060605 - then the thing is cleared here!
            {DEBUG_LOG(0,"floppy_FDIR is not set, so no IRQ to fire.");
             return;} // was it suppressed already? ignore it.


     if (  (floppy_irq_top && (floppy_ram[DRIVE] & 0x80)) || (floppy_irq_bottom && (floppy_ram[DRIVE]&0x08))  )
     {
         DEBUG_LOG(0,"Adding AUTOVECTOR FDIR IRQ to queue because FDIR is on");
         reg68k_external_autovector(1);
     }
     return;
 }

 if (next_expired_timer==CYCLE_TIMER_Z8530)
 {
   DEBUG_LOG(0,"[zilog8530.c:]Count Zero Interrupt");
   z8530_event=-1;
   z8530_last_irq_status_bits=128;
 }

// Handle VIA related timers from this point on
 if (!V) return;                     // if we have an erroneous timer, return;

/// Shift register events //////////////////////////////////////////////////////////////////////////////////////////////////////
 if (next_expired_timer & 0x40)     // shift register
 {
    DEBUG_LOG(0,"Handling Shift Register");
    flag_via_sr_irq(i);

    next_expired_timer=0;  get_next_timer_event();  return;
 }





 /// VIA Timer 1 and Timer 2 Events ////////////////////////////////////////////////////////////////////////////////////////////
 DEBUG_LOG(0,"Handling timer 1 or 2");
 if (next_expired_timer & 0x80)  flag_via_t2_irq(i);
 else                            flag_via_t1_irq(i);

 next_expired_timer=0;  get_next_timer_event();  return;
}
Example #17
0
static int
get_blobSqlServer(
	odbcdr_context_def		*context,
    odbcdr_cursor_def       *cursor,
    int                     position,
    int                     blobNo,
    int                     recNo,
    int                     blobValid,
    pByteArray_def          *visionBlob_O,
	pByteArray_def		    *l_visionBlob_0
    )
{
    odbcdr_connData_def	    *connData = NULL;
    int                     rdbi_status = RDBI_GENERIC_ERROR;
    PBYTE                   pData = NULL;
    BYTE                    test[1];
    pByteArray_def          wkb = NULL;
    SQLLEN                  count;
    SQLRETURN               rc;

    debug_on( "odbcdr_blob:blob_convertFromSqlServer_S" );

    // Bound arrays offset 
    int offset = blobNo * ODBCDR_MAX_ARRAY_SIZE + recNo;

    if ( blobValid )
    {
        if ( cursor->odbcdr_blobNI[offset] == SQL_NULL_DATA || cursor->odbcdr_blobNI[offset] == 0)
        {
            *visionBlob_O = NULL;
            *l_visionBlob_0 = NULL;
            debug0( "Blob is NULL." );
            rdbi_status = RDBI_SUCCESS;
            goto the_exit;
        }

        debug0( "Blob is not NULL." );

        pData = (PBYTE)&cursor->odbcdr_blob[offset * ODBCDR_UBLOB_CHUNK_SIZE];
     
        count = cursor->odbcdr_blobNI[offset];
    }
    else
    {
        // Fetch as blob. First get the size.
        rc = SQLGetData( cursor->hStmt, 
                                     position, 
                                     SQL_C_BINARY, 
                                     test, 
                                     0, 
                                     &count);

        if ( rc != SQL_SUCCESS_WITH_INFO ) {
            ODBCDR_ODBC_ERR( rc,  
                             SQL_HANDLE_STMT, cursor->hStmt,
                            "SQLGetData", "getData");
        }
        
        if ( count <= 0 ) 
        {
            *visionBlob_O = NULL;
            *l_visionBlob_0 = NULL;
            debug0( "Blob is NULL." );
            rdbi_status = RDBI_SUCCESS;
            goto the_exit;
        }

        debug0( "Blob is not NULL." );

        // Allocate the buffer
        int  allocMore = true;
        if ( cursor->odbcdr_blob_tmp == NULL )
            cursor->odbcdr_blob_tmp = (PBYTE)malloc( count );
        else if ( cursor->odbcdr_blob_tmp_size < count )
            cursor->odbcdr_blob_tmp = (PBYTE)realloc( cursor->odbcdr_blob_tmp, count );
        else
            allocMore = false;

        if ( allocMore )
            cursor->odbcdr_blob_tmp_size = (int) count;

        pData = cursor->odbcdr_blob_tmp;

        SQLLEN lenOrIndex;
        ODBCDR_ODBC_ERR( SQLGetData( cursor->hStmt, 
                                        position, 
                                        SQL_C_BINARY, 
                                        pData,
                                        count, 
                                        &lenOrIndex),
                            SQL_HANDLE_STMT, cursor->hStmt,
                            "SQLGetData", "getData");
        cursor->odbcdr_blobNI[offset] = lenOrIndex;
    }

    // Create a byte array from the array of bytes. Note 'count' is an initial size.
    if ( NULL == ( wkb = IByteArray_Create( pData, (int) count) ) )
        goto the_exit;

    *visionBlob_O = *l_visionBlob_0 = wkb;

    rdbi_status = RDBI_SUCCESS;

  the_exit:
    debug_return( NULL, rdbi_status );
}