Beispiel #1
0
void
_gtk_widget_free_cached_sizes (GtkWidget *widget)
{
  SizeRequestCache   *cache;

  cache = _gtk_widget_peek_request_cache (widget);

  clear_cache (cache, GTK_SIZE_GROUP_HORIZONTAL);
  clear_cache (cache, GTK_SIZE_GROUP_VERTICAL);
}
Beispiel #2
0
/* This function checks if 'request_needed' flag is present
 * and resets the cache state if a request is needed for
 * a given orientation.
 */
static SizeRequestCache *
init_cache (GtkWidget        *widget)
{
  SizeRequestCache *cache;

  cache = _gtk_widget_peek_request_cache (widget);

  if (_gtk_widget_get_width_request_needed (widget))
    clear_cache (cache, GTK_SIZE_GROUP_HORIZONTAL);
  
  if (_gtk_widget_get_height_request_needed (widget))
    clear_cache (cache, GTK_SIZE_GROUP_VERTICAL);

  return cache;
}
Beispiel #3
0
int display_err_msg(int err, char *msg)
{
    struct simple_frame frame;

    memset(&frame, 0, sizeof(frame));

    frame.item_num = 2;
    frame.items[0].pos.row = 1;
    frame.items[0].pos.col = 1;
    strcpy(frame.items[0].title, msg);

    frame.items[1].pos.row = 4;
    frame.items[1].pos.col = 1;
    sprintf(frame.items[1].title, "错误代码:%d", err);
    
    /* for debug */
    printf("err_num:%d", err);
    show_simple_frame(&frame);
    sleep(1);

    clear_cache();
    get_keycode();

    return SUCCESS;
}
Beispiel #4
0
static void
gssdp_resource_browser_dispose (GObject *object)
{
        GSSDPResourceBrowser *resource_browser;
        GSSDPResourceBrowserPrivate *priv;

        resource_browser = GSSDP_RESOURCE_BROWSER (object);
        priv = gssdp_resource_browser_get_instance_private (resource_browser);

        if (priv->client) {
                if (g_signal_handler_is_connected
                        (priv->client,
                         priv->message_received_id)) {
                        g_signal_handler_disconnect
                                (priv->client,
                                 priv->message_received_id);
                }

                stop_discovery (resource_browser);

                g_object_unref (priv->client);
                priv->client = NULL;
        }

        clear_cache (resource_browser);

        G_OBJECT_CLASS (gssdp_resource_browser_parent_class)->dispose (object);
}
Beispiel #5
0
/*
 * ui_get_keycode - get ui keycode 
 *  @key : receive buffer 
 *  @return : status 
 */
int ui_get_keycode(int *key)
{
    int keycode, ime_state;

    ime_state = get_ime_status();
    set_ime_status(INPUT_LOW_CASE);

    clear_cache();
    while (1) {
        keycode = get_keycode();
        if (!(keycode >= '1' && keycode <= '6') && keycode != BACK && keycode != 'z')
            continue;
        else 
            break;
    }

    if (keycode == BACK)
        *key = BACK;
    else if (keycode == 'z')
        *key = HANG;
    else 
        *key = keycode - '0';

    set_ime_status(ime_state);

    return SUCCESS; 
}
Beispiel #6
0
IMP imp_implementationWithBlock(void *block)
{
	struct Block_layout *b = block;
	void *start;
	void *end;

	if ((b->flags & BLOCK_USE_SRET) == BLOCK_USE_SRET)
	{
		start = &__objc_block_trampoline_sret;
		end = &__objc_block_trampoline_end_sret;
	}
	else
	{
		start = &__objc_block_trampoline;
		end = &__objc_block_trampoline_end;
	}

	size_t trampolineSize = end - start;
	// If we don't have a trampoline intrinsic for this architecture, return a
	// null IMP.
	if (0 >= trampolineSize) { return 0; }

	struct wx_buffer buf = alloc_buffer(trampolineSize + 2*sizeof(void*));
	void **out = buf.w;
	out[0] = (void*)b->invoke;
	out[1] = Block_copy(b);
	memcpy(&out[2], start, trampolineSize);
	out = buf.x;
	char *newIMP = (char*)&out[2];
	clear_cache(newIMP, newIMP+trampolineSize);
	return (IMP)newIMP;
}
Beispiel #7
0
/**
 * Merges the given config over the existing costs.
 * @param[in] new_values  The new values.
 * @param[in] overwrite   If true, the new values overwrite the old.
 *                        If false, the new values are added to the old.
 * @param[in] cascade     Cache clearing will be cascaded into this terrain_info.
 */
void movetype::terrain_info::data::merge(const config & new_values, bool overwrite,
                                         const terrain_info * cascade)
{
	if ( overwrite )
		// We do not support child tags here, so do not copy any that might
		// be in the input. (If in the future we need to support child tags,
		// change "merge_attributes" to "merge_with".)
		cfg_.merge_attributes(new_values);
	else {
		for (const config::attribute & a : new_values.attribute_range()) {
			config::attribute_value & dest = cfg_[a.first];
			int old = dest.to_int(params_.max_value);

			// The new value is the absolute value of the old plus the
			// provided value, capped between minimum and maximum, then
			// given the sign of the old value.
			// (Think defenses for why we might have negative values.)
			int value = abs(old) + a.second.to_int(0);
			value = std::max(params_.min_value, std::min(value, params_.max_value));
			if ( old < 0 )
				value = -value;

			dest = value;
		}
	}

	// The new data has invalidated the cache.
	clear_cache(cascade);
}
Beispiel #8
0
void
TimeLog::load()
{
    if (!m_is_loaded)
    {
        clear_cache();
        if (file_exists_at(m_filepath))
        {
            ifstream infile(m_filepath.c_str());
            enable_exceptions(infile);
            string line;
            size_t line_number = 1;
            while (infile.peek() != EOF)
            {
                getline(infile, line);
                load_entry(line, line_number);
                ++line_number;
            }
            if (!m_entries.empty() && (m_entries.back().time_point > now()))
            {
                throw runtime_error
                (   "The final entry in the time log is future-dated. "
                    "Future dated entries are not supported."
                );
            }
        }
        m_is_loaded = true;
    }
    return;
}
int sub_00000588(void)
{
	int intr;
	void (*ptr)(u32) = (void*)g_func_1200;

	(*ptr)(0);
	open_iso();
	intr = sceKernelCpuSuspendIntr();

	/* sceUmdManGetUmdDiscInfo patch */
	_sw(0xE0000800, g_sceNp9660_driver_text_addr + g_offs->Data1);
	_sw(0x00000009, g_sceNp9660_driver_text_addr + g_offs->Data2);
	_sw(g_total_blocks, g_sceNp9660_driver_text_addr + g_offs->Data3);
	_sw(g_total_blocks, g_sceNp9660_driver_text_addr + g_offs->Data4);
	_sw(0x00000000, g_sceNp9660_driver_text_addr + g_offs->Data5);

	sceKernelCpuResumeIntr(intr);

	if(g_data_1204 == 0) {
		g_data_1204 = 1;
		sceKernelDelayThread(800000);
	}

	clear_cache();
	sceKernelSetQTGP3(g_umddata);

	return 0;
}
Beispiel #10
0
void DataFile::close_all()
{
    size_t left = clear_cache();
    if (left > 0)
       throw GenericException(__FILE__, __LINE__,
                              "%zu data files are still ref'ed in close_all",
                              left);
}
Beispiel #11
0
/* $begin time_p_cold */
double time_P_cold() 
{
    P(); /* Warm up instruction cache */ 
    clear_cache(); /* Clear data cache */ 
    start_counter(); 
    P(); 
    return get_counter(); 
}
Beispiel #12
0
void
intel_batchbuffer_free(struct intel_context *intel)
{
   drm_intel_bo_unreference(intel->batch.last_bo);
   drm_intel_bo_unreference(intel->batch.bo);
   drm_intel_bo_unreference(intel->batch.workaround_bo);
   clear_cache(intel);
}
Beispiel #13
0
int display_warn(char *msg)
{
    display_info(msg);

    clear_cache();
    get_keycode();

    return SUCCESS;
}
Beispiel #14
0
/*--------------------------------------------------------------------
 * src_viewer::~src_viewer
 *
 */
src_viewer::~src_viewer() {
  // Note: stree is in the stree_cache, so it will be deleted by
  // clear_cache() method.

  delete infobar;

  clear_cache();
  delete stree_cache;
}
Beispiel #15
0
static int load_shared_library(int id, void **base, unsigned long current_build_date) {
    FILE* fp = NULL;
    info("Trying to load library ID %d", id);
    if (id < 0 || id > 0xfe) error_goto_error("Attempted to load library with invalid ID");
    if (id > MAX_SHARED_LIB_ID) error_goto_error("Library ID too high");

    char filename[128];
    sprintf(filename,"%s/lib%d.so.tns",LIB_SEARCH_DIR,id);
    fp = fopen(filename, "rb");
    if (!fp) {
        error_user_goto_error("Could not open shared library %s", filename);
    }

    /* get build date */
    struct flat_hdr header;
    if (read_header(fp,&header) != 0) error_goto_error("Could not read library header");

    /* check cache */
    if (lib_cache[id-1].base != NULL && /* check if library is already loaded */
        lib_cache[id-1].build_date == header.build_date && /* check cached library is same version as file */
        lib_cache[id-1].build_date <= current_build_date /* check build dates */
        ) {
            info("Linking library from cache");
            *base = lib_cache[id-1].base;
            goto success;
    }

    if (header.build_date > current_build_date) error_user_goto_error("Library ID %d build date is newer than current executable. Refusing to load.", id);

    int (*entry_point)(int,char*[]);
    size_t dummy;

    /* load into memory - nts: potential circular dependancy problem */
    if (bflt_fload(fp, base, &dummy, &entry_point) != 0) error_goto_error("Could not load library");

    /* initialize the library */
    clear_cache();
    if (entry_point(0,NULL) != 0) info("Warning: Library (ID:%d) init routine returned nonzero",id);

    /* add to lib_cache */

    /* if there's a stale library loaded, replace it */
    if (lib_cache[id-1].base) free(lib_cache[id-1].base);

    lib_cache[id-1].base = *base;
    lib_cache[id-1].build_date = header.build_date;

    /* successfully loaded library */
    success:
    info("Library ID %d loaded successfully", id);
    fclose(fp);
    return 0;
    error:
    *base = NULL;
    if (fp) fclose(fp);
    return -1;
}
Beispiel #16
0
int get_chn_str(int row, int col, char *name)
{
    int ret, len = 0;
    char chn[2];

    set_ime_status(INPUT_PINYIN);

    clear_cache();
    while (1) {
        show_str(row, col, name);
        len = strlen(name);

        chn[0] = chn[1] = '\0';

        ret = ui_pinyin(chn);
        switch (ret) {
            case ENTER:
                /*
                   if (len != 0)
                   return SUCCESS;
                   */
                /* we don't check string is null or not, 
                 * let up-layer do that 
                 */
                return SUCCESS;
                break;

            case -EUI_BACK:
                if (len > 0) {
                    if ((uchar)name[len - 1] < 127) {
                        name[len - 1] = '\0';
                    } else {
                        name[len - 1] = '\0';
                        name[len - 2] = '\0';
                    }
                } else 
                    return -EUI_BACK;
                break;

            case -EUI_ESC:
                return -EUI_ESC;
                break;

            case SUCCESS:
                if ((uchar)chn[0] > 127) {
                    name[len] = chn[0];
                    name[len + 1] = chn[1];
                } else {
                    name[len] = chn[0];
                }
                break;

            default:
                break;
        } 
    }
}
Beispiel #17
0
static void
node_invalidated (GeglNode            *node,
                  const GeglRectangle *rect,
                  GeglOperation       *operation)
{
  /* if the node is invalidated, clear all cached data.  in particular, redraw
   * the entire stroke upon the next call to process().
   */
  clear_cache (GEGL_PROPERTIES (operation));
}
Beispiel #18
0
void
refetch_mregs( void )
{
	mol_dgram_t *dg;
	clear_cache();

	send_dgram( sv.fd, kMDG_mregs );
	if( (dg=dgram_wait( kMDG_mregs )) )
		free( dg );
}
Beispiel #19
0
/*
 * get_passwd - get string with "*" local echo  
 *
 * @return : status 
 */
int get_passwd(int row, int col, char *password)
{
    int ret;
    int key, offset = 0;
    char ascii_no[USER_PASSWD_LEN + 1] = {0}; 
    char pass_wd[USER_PASSWD_LEN + 1] = {0};

    if (password[0] != '\0') {
        offset = snprintf(ascii_no, USER_PASSWD_LEN + 1, "%s", password);
    }

    ret = SUCCESS;    
    set_ime_status(INPUT_LOW_CASE); 

    clear_cache();
    while (1) {
        show_str(row, col, ascii_no);

        key = get_keycode();
        if (key >= '0' && key <= '9') {
            if (offset < USER_PASSWD_LEN) {
                sprintf(ascii_no + offset, "%c", '*');
                pass_wd[offset] = key;
                offset ++;
            }
        } else {
            switch (key) {
                case ESC:
                   return -EUI_ESC;

                case BACK:
                    if (offset > 0) {
                        ascii_no[offset - 1] = '\0';
                        pass_wd[offset - 1] = '\0';
                        offset --;
                    }
                    break;

                case ENTER:
                    if (offset > 0) {
                        ret = SUCCESS;
                        goto handled;
                    }
                    break;

                default:
                    break;
            }
        }
    }

handled:
    strcpy(password, pass_wd);
    return ret;
}
Beispiel #20
0
void
intel_batchbuffer_reset_to_saved(struct intel_context *intel)
{
   drm_intel_gem_bo_clear_relocs(intel->batch.bo, intel->batch.saved.reloc_count);

   intel->batch.used = intel->batch.saved.used;

   /* Cached batch state is dead, since we just cleared some unknown part of the
    * batchbuffer.  Assume that the caller resets any other state necessary.
    */
   clear_cache(intel);
}
Beispiel #21
0
/*
 * get_string - get a string(letter&number) with local echo  
 *
 * @return : status 
 */
int get_string(int row, int col, char *str)
{
    int ret;
    int key, offset = 0;
    char ascii_no[MAX_STR_LEN + 1] = {0}; 

    if (strlen(str) > 0) {
        offset = snprintf(ascii_no, MAX_STR_LEN + 1, "%s", str);
    }

    ret = SUCCESS;
    set_ime_status(INPUT_LOW_CASE); 

    clear_cache();
    while (1) { 
        show_str(row, col, ascii_no);

        key = get_keycode();
        if (islower(key) || (key >= '0' && key <= '9')) {
            if (offset < MAX_STR_LEN) {
                sprintf(ascii_no + offset, "%c", (char)key);
                offset ++;
            }
        } else {
            switch (key) { 
                case ESC:
                    return -EUI_ESC;

                case BACK:
                    if (offset > 0) {
                        ascii_no[offset - 1] = '\0';
                        offset --;
                    }
                    break;

                case ENTER:
                    if (offset > 0) {
                        ret = SUCCESS;
                        goto handled;
                    }
                    break;

                default:
                    break;
            }
        }
    }

handled:
    strcpy(str, ascii_no);
    return ret;
}
Beispiel #22
0
/*
 * question_user - show question and get user option
 *  @return : user option
 */
int question_user(char *title)
{
    int key, ime_state;

    /* 1 : yes, 2: no*/
    int pos = 1, chioce = 1;
    ACTION handle;

    set_questtion_title(title);
    show_current_ui(7);

    lcm_printf(3, 3, "*"); 

    ime_state = get_ime_status();
    set_ime_status(INPUT_FUNC);

    clear_cache();
    while (1) {
        key = get_keycode();
        switch (key) {
            case ENTER:
                handle = get_next_action(7, pos);
                chioce = handle();
                goto handled;
                break;

            case RIGHT:
                if (pos == 1) {
                    lcm_printf(3, 3, " ");
                    lcm_printf(3, 7, "*"); 
                    pos = 2;
                }
                break;

            case LEFT:
                if (pos == 2) {
                    lcm_printf(3, 7, " ");
                    lcm_printf(3, 3, "*");
                    pos = 1;
                }
                break;

            default:
                break;
        }
    } 

handled:
    set_ime_status(ime_state);
    return chioce;
}
Beispiel #23
0
static void
schedule(struct ir3_sched_ctx *ctx, struct ir3_instruction *instr)
{
	debug_assert(ctx->block == instr->block);

	/* maybe there is a better way to handle this than just stuffing
	 * a nop.. ideally we'd know about this constraint in the
	 * scheduling and depth calculation..
	 */
	if (ctx->scheduled && is_sfu_or_mem(ctx->scheduled) && is_sfu_or_mem(instr))
		ir3_NOP(ctx->block);

	/* remove from depth list:
	 */
	list_delinit(&instr->node);

	if (writes_addr(instr)) {
		debug_assert(ctx->addr == NULL);
		ctx->addr = instr;
	}

	if (writes_pred(instr)) {
		debug_assert(ctx->pred == NULL);
		ctx->pred = instr;
	}

	instr->flags |= IR3_INSTR_MARK;

	list_addtail(&instr->node, &instr->block->instr_list);
	ctx->scheduled = instr;

	if (writes_addr(instr) || writes_pred(instr) || is_input(instr)) {
		clear_cache(ctx, NULL);
	} else {
		/* invalidate only the necessary entries.. */
		clear_cache(ctx, instr);
	}
}
Beispiel #24
0
static void
finalize (GObject *object)
{
  GeglProperties *o = GEGL_PROPERTIES (object);

  if (o->user_data)
    {
      clear_cache (o);

      g_slice_free (WarpPrivate, o->user_data);
      o->user_data = NULL;
    }

  G_OBJECT_CLASS (gegl_op_parent_class)->finalize (object);
}
void
gtk_source_pixbuf_helper_set_stock_id (GtkSourcePixbufHelper *helper,
                                       const gchar           *stock_id)
{
	helper->type = ICON_TYPE_STOCK;

	if (helper->stock_id)
	{
		g_free (helper->stock_id);
	}

	helper->stock_id = g_strdup (stock_id);

	clear_cache (helper);
}
void
gtk_source_pixbuf_helper_set_icon_name (GtkSourcePixbufHelper *helper,
                                        const gchar           *icon_name)
{
	helper->type = ICON_TYPE_NAME;

	if (helper->icon_name)
	{
		g_free (helper->icon_name);
	}

	helper->icon_name = g_strdup (icon_name);

	clear_cache (helper);
}
int sub_00000514(int fd)
{
	int ret;
	
	ret = sceIoClose(fd);

	if(fd == g_iso_fd) {
		g_iso_fd = -1;
		_sw(-1, g_sceNp9660_driver_text_addr + g_offs->StoreFd);
		clear_cache();

		return ret;
	} else {
		return ret;
	}
}
static void
intel_batchbuffer_reset(struct brw_context *brw)
{
   if (brw->batch.last_bo != NULL) {
      drm_intel_bo_unreference(brw->batch.last_bo);
      brw->batch.last_bo = NULL;
   }
   brw->batch.last_bo = brw->batch.bo;

   clear_cache(brw);

   brw->batch.bo = drm_intel_bo_alloc(brw->bufmgr, "batchbuffer",
					BATCH_SZ, 4096);
   if (brw->has_llc) {
      drm_intel_bo_map(brw->batch.bo, true);
      brw->batch.map = brw->batch.bo->virtual;
   }
Beispiel #29
0
void
intel_batchbuffer_reset(struct intel_context *intel)
{
   if (intel->batch.last_bo != NULL) {
      drm_intel_bo_unreference(intel->batch.last_bo);
      intel->batch.last_bo = NULL;
   }
   intel->batch.last_bo = intel->batch.bo;

   clear_cache(intel);

   intel->batch.bo = drm_intel_bo_alloc(intel->bufmgr, "batchbuffer",
					intel->maxBatchSize, 4096);

   intel->batch.reserved_space = BATCH_RESERVED;
   intel->batch.state_batch_offset = intel->batch.bo->size;
   intel->batch.used = 0;
   intel->batch.needs_sol_reset = false;
}
void
gtk_source_pixbuf_helper_set_pixbuf (GtkSourcePixbufHelper *helper,
                                     const GdkPixbuf       *pixbuf)
{
	helper->type = ICON_TYPE_PIXBUF;

	if (helper->pixbuf)
	{
		g_object_unref (helper->pixbuf);
		helper->pixbuf = NULL;
	}

	if (pixbuf)
	{
		helper->pixbuf = gdk_pixbuf_copy (pixbuf);
	}

	clear_cache (helper);
}