Example #1
0
static void read_hilight_config(void)
{
	CONFIG_NODE *node;
	HILIGHT_REC *rec;
	GSList *tmp;
	char *text, *color;

	hilights_destroy_all();

	node = iconfig_node_traverse("hilights", FALSE);
	if (node == NULL) {
                reset_cache();
		return;
	}

	tmp = config_node_first(node->value);
	for (; tmp != NULL; tmp = config_node_next(tmp)) {
		node = tmp->data;

		if (node->type != NODE_TYPE_BLOCK)
			continue;

		text = config_node_get_str(node, "text", NULL);
		if (text == NULL || *text == '\0')
			continue;

		rec = g_new0(HILIGHT_REC, 1);
		hilights = g_slist_append(hilights, rec);

		rec->text = g_strdup(text);

		color = config_node_get_str(node, "color", NULL);
		rec->color = color == NULL || *color == '\0' ? NULL :
			g_strdup(color);

		color = config_node_get_str(node, "act_color", NULL);
		rec->act_color = color == NULL || *color == '\0' ? NULL :
			g_strdup(color);

		rec->level = config_node_get_int(node, "level", 0);
		rec->priority = config_node_get_int(node, "priority", 0);
		rec->nick = config_node_get_bool(node, "nick", TRUE);
		rec->word = config_node_get_bool(node, "word", TRUE);
		rec->case_sensitive = config_node_get_bool(node, "matchcase", FALSE);

		rec->nickmask = config_node_get_bool(node, "mask", FALSE);
		rec->fullword = config_node_get_bool(node, "fullword", FALSE);
		rec->regexp = config_node_get_bool(node, "regexp", FALSE);
		rec->servertag = config_node_get_str(node, "servertag", NULL);
		hilight_init_rec(rec);

		node = iconfig_node_section(node, "channels", -1);
		if (node != NULL) rec->channels = config_node_get_list(node);
	}

	reset_cache();
}
Example #2
0
static void reset_cache(struct exfat* ef, struct exfat_node* node)
{
	char buffer[UTF8_BYTES(EXFAT_NAME_MAX) + 1];

	while (node->child)
	{
		struct exfat_node* p = node->child;
		reset_cache(ef, p);
		tree_detach(p);
		free(p);
	}
	node->flags &= ~EXFAT_ATTRIB_CACHED;
	if (node->references != 0)
	{
		exfat_get_name(node, buffer, sizeof(buffer) - 1);
		exfat_warn("non-zero reference counter (%d) for '%s'",
				node->references, buffer);
	}
	if (node != ef->root && (node->flags & EXFAT_ATTRIB_DIRTY))
	{
		exfat_get_name(node, buffer, sizeof(buffer) - 1);
		exfat_bug("node '%s' is dirty", buffer);
	}
	while (node->references)
		exfat_put_node(ef, node);
}
Example #3
0
void substitution::reset() {
    m_subst.reset(); 
    m_vars.reset();
    m_refs.reset();
    m_scopes.reset();
    reset_cache();
}
Example #4
0
 std::shared_ptr<rs2::video_stream_profile> align::create_aligned_profile(
     rs2::video_stream_profile& original_profile,
     rs2::video_stream_profile& to_profile)
 {
     auto from_to = std::make_pair(original_profile.get()->profile, to_profile.get()->profile);
     auto it = _align_stream_unique_ids.find(from_to);
     if (it != _align_stream_unique_ids.end())
     {
         return it->second;
     }
     auto aligned_profile = std::make_shared<rs2::video_stream_profile>(original_profile.clone(original_profile.stream_type(), original_profile.stream_index(), original_profile.format()));
     aligned_profile->get()->profile->set_framerate(original_profile.fps());
     if (auto original_video_profile = As<video_stream_profile_interface>(original_profile.get()->profile))
     {
         if (auto to_video_profile = As<video_stream_profile_interface>(to_profile.get()->profile))
         {
             if (auto aligned_video_profile = As<video_stream_profile_interface>(aligned_profile->get()->profile))
             {
                 aligned_video_profile->set_dims(to_video_profile->get_width(), to_video_profile->get_height());
                 auto aligned_intrinsics = to_video_profile->get_intrinsics();
                 aligned_intrinsics.width = to_video_profile->get_width();
                 aligned_intrinsics.height = to_video_profile->get_height();
                 aligned_video_profile->set_intrinsics([aligned_intrinsics]() { return aligned_intrinsics; });
             }
         }
     }
     _align_stream_unique_ids[from_to] = aligned_profile;
     reset_cache(original_profile.stream_type(), to_profile.stream_type());
     return aligned_profile;
 }
Example #5
0
void ast_translation::cleanup() {
    reset_cache();
    m_cache.finalize();
    m_result_stack.finalize();
    m_frame_stack.finalize();
    m_extra_children_stack.finalize();
}
Example #6
0
static gint
gail_notebook_real_remove_gtk (GtkContainer *container,
                               GtkWidget    *widget,
                               gpointer      data)    
{
  GailNotebook *gail_notebook;
  AtkObject *obj;
  gint index;

  g_return_val_if_fail (container != NULL, 1);
  gail_notebook = GAIL_NOTEBOOK (gtk_widget_get_accessible (GTK_WIDGET (container)));
  index = gail_notebook->remove_index;
  gail_notebook->remove_index = -1;

  obj = find_child_in_list (gail_notebook->page_cache, index);
  g_return_val_if_fail (obj, 1);
  gail_notebook->page_cache = g_list_remove (gail_notebook->page_cache, obj);
  gail_notebook->page_count -= 1;
  reset_cache (gail_notebook, index);
  g_signal_emit_by_name (gail_notebook,
                         "children_changed::remove",
                          GAIL_NOTEBOOK_PAGE (obj)->index, 
                          obj, NULL);
  g_object_unref (obj);
  return 1;
}
Example #7
0
/*!
 * \brief LineSensor::LineSensor creates sensor object, that is connected to
 *        the linesensor port of V-REP.
 */
LineSensor::LineSensor() :
    SimComm(PORT_NUM_LINE)  // call superclass constructor with correct port number
{
    this->cachevalues = this->pvalues;
    this->pvalues.reset();

    QObject::connect(this, SIGNAL(cache_expired()), this, SLOT(reset_cache()));
}
Example #8
0
static void
cleanup (void)
{
	dyn_array_ptr_set_size (&scan_stack, 0);
	dyn_array_ptr_set_size (&loop_stack, 0);
	dyn_array_ptr_set_size (&registered_bridges, 0);
	free_object_buckets ();
	free_color_buckets ();
	reset_cache ();
	object_index = 0;
	num_colors_with_bridges = 0;
}
Example #9
0
/**
 * If there's anything in the bitmap cache, draw/flush it now.
 */
void
st_flush_bitmap_cache(struct st_context *st)
{
   if (!st->bitmap.cache->empty) {
      struct bitmap_cache *cache = st->bitmap.cache;

      if (st->ctx->DrawBuffer) {
         struct pipe_context *pipe = st->pipe;
         struct pipe_sampler_view *sv;

         assert(cache->xmin <= cache->xmax);
 
/*         printf("flush size %d x %d  at %d, %d\n",
                cache->xmax - cache->xmin,
                cache->ymax - cache->ymin,
                cache->xpos, cache->ypos);
*/

         /* The texture transfer has been mapped until now.
          * So unmap and release the texture transfer before drawing.
          */
         if (cache->trans) {
            if (0)
               print_cache(cache);
            pipe_transfer_unmap(pipe, cache->trans);
            cache->buffer = NULL;

            pipe->transfer_destroy(pipe, cache->trans);
            cache->trans = NULL;
         }

         sv = st_create_texture_sampler_view(st->pipe, cache->texture);
         if (sv) {
            draw_bitmap_quad(st->ctx,
                             cache->xpos,
                             cache->ypos,
                             cache->zpos,
                             BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
                             sv,
                             cache->color);

            pipe_sampler_view_reference(&sv, NULL);
         }
      }

      /* release/free the texture */
      pipe_resource_reference(&cache->texture, NULL);

      reset_cache(st);
   }
}
Example #10
0
/** Per-context init */
void
st_init_bitmap(struct st_context *st)
{
   struct pipe_sampler_state *sampler = &st->bitmap.samplers[0];
   struct pipe_context *pipe = st->pipe;
   struct pipe_screen *screen = pipe->screen;

   /* init sampler state once */
   memset(sampler, 0, sizeof(*sampler));
   sampler->wrap_s = PIPE_TEX_WRAP_CLAMP;
   sampler->wrap_t = PIPE_TEX_WRAP_CLAMP;
   sampler->wrap_r = PIPE_TEX_WRAP_CLAMP;
   sampler->min_img_filter = PIPE_TEX_FILTER_NEAREST;
   sampler->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
   sampler->mag_img_filter = PIPE_TEX_FILTER_NEAREST;
   st->bitmap.samplers[1] = *sampler;
   st->bitmap.samplers[1].normalized_coords = 1;

   /* init baseline rasterizer state once */
   memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer));
   st->bitmap.rasterizer.half_pixel_center = 1;
   st->bitmap.rasterizer.bottom_edge_rule = 1;
   st->bitmap.rasterizer.depth_clip = 1;

   /* find a usable texture format */
   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM,
                                   PIPE_TEXTURE_2D, 0,
                                   PIPE_BIND_SAMPLER_VIEW)) {
      st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
   }
   else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM,
                                        PIPE_TEXTURE_2D, 0,
                                        PIPE_BIND_SAMPLER_VIEW)) {
      st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
   }
   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM,
                                        PIPE_TEXTURE_2D, 0,
                                        PIPE_BIND_SAMPLER_VIEW)) {
      st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
   }
   else {
      /* XXX support more formats */
      assert(0);
   }

   /* alloc bitmap cache object */
   st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);

   reset_cache(st);
}
Example #11
0
void FATDrive::small_cache()
{
	if (_FATCache)
		free(_FATCache);

	if (_CacheSec) {
		free(_CacheSec), _CacheSec = NULL;
		free(_CacheCnt);
		free(_CacheDty);
	}

	_Caches = CACHE_SIZE_LOW;
	_FATCache = (struct Cache *) malloc((_Caches+1) * _drive._bufl);

	reset_cache();
}
Example #12
0
File: node.c Project: ZeroJim/twrp
static void reset_cache(struct exfat* ef, struct exfat_node* node)
{
	while (node->child)
	{
		struct exfat_node* p = node->child;
		reset_cache(ef, p);
		tree_detach(p);
		free(p);
	}
	node->flags &= ~EXFAT_ATTRIB_CACHED;
	if (node->references != 0)
	{
		char buffer[EXFAT_NAME_MAX + 1];
		exfat_get_name(node, buffer, EXFAT_NAME_MAX);
		exfat_warn("non-zero reference counter (%d) for `%s'",
				node->references, buffer);
	}
	while (node->references)
		exfat_put_node(ef, node);
}
Example #13
0
/* SYNTAX: DEHILIGHT <id>|<mask> */
static void cmd_dehilight(const char *data)
{
    HILIGHT_REC *rec;
    GSList *tmp;

    if (is_numeric(data, ' ')) {
        /* with index number */
        tmp = g_slist_nth(hilights, atoi(data)-1);
        rec = tmp == NULL ? NULL : tmp->data;
    } else {
        /* with mask */
        char *chans[2] = { "*", NULL };
        rec = hilight_find(data, chans);
    }

    if (rec == NULL)
        printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_HILIGHT_NOT_FOUND, data);
    else {
        printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_HILIGHT_REMOVED, rec->text);
        hilight_remove(rec);
        reset_cache();
    }
}
static void reset_cache(struct exfat* ef, struct exfat_node* node)
{
    struct exfat_node* child;
    struct exfat_node* next;

    for (child = node->child; child; child = next)
    {
        reset_cache(ef, child);
        next = child->next;
        free(child);
    }
    if (node->references != 0)
    {
        char buffer[EXFAT_NAME_MAX + 1];
        exfat_get_name(node, buffer, EXFAT_NAME_MAX);
        exfat_warn("non-zero reference counter (%d) for `%s'",
                   node->references, buffer);
    }
    while (node->references--)
        exfat_put_node(ef, node);
    node->child = NULL;
    node->flags &= ~EXFAT_ATTRIB_CACHED;
}
Example #15
0
ast_translation::~ast_translation() {
    reset_cache();
}
Example #16
0
/**
 * One-time init for drawing bitmaps.
 */
static void
init_bitmap_state(struct st_context *st)
{
    struct pipe_context *pipe = st->pipe;
    struct pipe_screen *screen = pipe->screen;

    /* This function should only be called once */
    assert(st->bitmap.cache == NULL);

    assert(st->internal_target == PIPE_TEXTURE_2D ||
           st->internal_target == PIPE_TEXTURE_RECT);

    /* alloc bitmap cache object */
    st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);

    /* init sampler state once */
    memset(&st->bitmap.sampler, 0, sizeof(st->bitmap.sampler));
    st->bitmap.sampler.wrap_s = PIPE_TEX_WRAP_CLAMP;
    st->bitmap.sampler.wrap_t = PIPE_TEX_WRAP_CLAMP;
    st->bitmap.sampler.wrap_r = PIPE_TEX_WRAP_CLAMP;
    st->bitmap.sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
    st->bitmap.sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
    st->bitmap.sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
    st->bitmap.sampler.normalized_coords = st->internal_target == PIPE_TEXTURE_2D;

    st->bitmap.atlas_sampler = st->bitmap.sampler;
    st->bitmap.atlas_sampler.normalized_coords = 0;

    /* init baseline rasterizer state once */
    memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer));
    st->bitmap.rasterizer.half_pixel_center = 1;
    st->bitmap.rasterizer.bottom_edge_rule = 1;
    st->bitmap.rasterizer.depth_clip = 1;

    /* find a usable texture format */
    if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM,
                                    st->internal_target, 0,
                                    PIPE_BIND_SAMPLER_VIEW)) {
        st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
    }
    else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM,
                                         st->internal_target, 0,
                                         PIPE_BIND_SAMPLER_VIEW)) {
        st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
    }
    else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM,
                                         st->internal_target, 0,
                                         PIPE_BIND_SAMPLER_VIEW)) {
        st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
    }
    else {
        /* XXX support more formats */
        assert(0);
    }

    /* Create the vertex shader */
    {
        const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
                                        TGSI_SEMANTIC_COLOR,
                                        st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD :
                                        TGSI_SEMANTIC_GENERIC
                                      };
        const uint semantic_indexes[] = { 0, 0, 0 };
        st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
                        semantic_names,
                        semantic_indexes,
                        FALSE);
    }

    reset_cache(st);
}
Example #17
0
///////////////////////////////////////////////////////////////////////////////
// sinsp_fdtable implementation
///////////////////////////////////////////////////////////////////////////////
sinsp_fdtable::sinsp_fdtable(sinsp* inspector)
{
	m_inspector = inspector;
	reset_cache();
}
void exfat_reset_cache(struct exfat* ef)
{
	reset_cache(ef, ef->root);
}
Example #19
0
/* SYNTAX: HILIGHT [-nick | -word | -line] [-mask | -full | -regexp]
                   [-color <color>] [-actcolor <color>] [-level <level>]
		   [-network <network>] [-channels <channels>] <text> */
static void cmd_hilight(const char *data)
{
    GHashTable *optlist;
    HILIGHT_REC *rec;
    char *colorarg, *actcolorarg, *levelarg, *priorityarg, *chanarg, *text, *servertag;
    char **channels;
    void *free_arg;

    g_return_if_fail(data != NULL);

    if (*data == '\0') {
        cmd_hilight_show();
        return;
    }

    if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
                        PARAM_FLAG_GETREST, "hilight", &optlist, &text))
        return;

    chanarg = g_hash_table_lookup(optlist, "channels");
    levelarg = g_hash_table_lookup(optlist, "level");
    priorityarg = g_hash_table_lookup(optlist, "priority");
    colorarg = g_hash_table_lookup(optlist, "color");
    actcolorarg = g_hash_table_lookup(optlist, "actcolor");
    servertag = g_hash_table_lookup(optlist, "network");

    if (*text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

    channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
               g_strsplit(chanarg, ",", -1);

    rec = hilight_find(text, channels);
    if (rec == NULL) {
        rec = g_new0(HILIGHT_REC, 1);

        /* default to nick/word hilighting */
        rec->nick = TRUE;
        rec->word = TRUE;

        rec->text = g_strdup(text);
        rec->channels = channels;
    } else {
        g_strfreev(channels);
    }

    rec->level = (levelarg == NULL || *levelarg == '\0') ? 0 :
                 level2bits(replace_chars(levelarg, ',', ' '), NULL);
    rec->priority = priorityarg == NULL ? 0 : atoi(priorityarg);

    if (g_hash_table_lookup(optlist, "line") != NULL) {
        rec->word = FALSE;
        rec->nick = FALSE;
    }

    if (g_hash_table_lookup(optlist, "word") != NULL) {
        rec->word = TRUE;
        rec->nick = FALSE;
    }

    if (g_hash_table_lookup(optlist, "nick") != NULL)
        rec->nick = TRUE;

    rec->nickmask = g_hash_table_lookup(optlist, "mask") != NULL;
    rec->fullword = g_hash_table_lookup(optlist, "full") != NULL;
    rec->regexp = g_hash_table_lookup(optlist, "regexp") != NULL;

    if (colorarg != NULL) {
        g_free_and_null(rec->color);
        if (*colorarg != '\0')
            rec->color = g_strdup(colorarg);
    }
    if (actcolorarg != NULL) {
        g_free_and_null(rec->act_color);
        if (*actcolorarg != '\0')
            rec->act_color = g_strdup(actcolorarg);
    }
    if (servertag != NULL) {
        g_free_and_null(rec->servertag);
        if (*servertag != '\0')
            rec->servertag = g_strdup(servertag);
    }

    hilight_create(rec);

    hilight_print(g_slist_index(hilights, rec)+1, rec);
    cmd_params_free(free_arg);

    reset_cache();
}
Example #20
0
static void test2(void) {
  uint16_t tag;
  int32_t x, y;
  uint32_t i;
  cache_elem_t *e0, *e1;
  uint32_t level;


  printf("***************************\n"
	 "*        TEST 2           *\n"
	 "***************************\n");

  level = 1;

  init_cache(&cache);
  printf("---- INITIAL ----\n");
  print_cache_stack(stdout, &cache);
  print_cache_bank(stdout, &cache);
  printf("\n");

  for (i=0; i<4000; i++) {
    tag = (uint16_t) (random() % NUMTAGS);
    x = (int32_t) (random() % 20);
    y = (int32_t) (random() % 20);
    e0 = cache_find(&cache, tag, x, y);
    e1 = cache_get(&cache, tag, x, y);

    if (e0 == NULL && e1->flag != NEW_CACHE_ELEM) {
      printf("*** caching bug ***\n");
      printf("  element: [%s %"PRId32" %"PRId32"]\n", tag2string[tag], x, y);
      printf("  find: returned NULL\n");
      printf("  get:  returned %p: ", e1);
      print_cache_elem(stdout, e1);
      printf("\n");
    }

    if (e0 != NULL && e1 != e0) {
      printf("*** caching bug ***\n");
      printf("  element: [%s %"PRId32" %"PRId32"]\n", tag2string[tag], x, y);
      printf("  find: returned %p: ", e0);
      print_cache_elem(stdout, e0);
      printf("\n");
      printf("  get:  returned %p: ", e1);
      print_cache_elem(stdout, e1);
      printf("\n");
    }

    if (e1->flag == NEW_CACHE_ELEM) {
      e1->flag = (uint16_t) level;
    }

    if (i % 100 == 49) {
      printf("\n--- Push to level %"PRIu32" ---\n", level);
      cache_push(&cache);
      level ++;
      print_cache_stack(stdout, &cache);
      print_cache_bank(stdout, &cache);
    }
  }

  printf("\n--- After random additions (level = %"PRIu32") ---\n", level);
  print_all_cache(stdout, &cache);
  print_cache_stack(stdout, &cache);
  print_cache_bank(stdout, &cache);

  while (level > 1) {
    level --;
    printf("\n--- Pop to level %"PRIu32" ---\n", level);
    cache_pop(&cache);
    print_all_cache(stdout, &cache);
    print_cache_stack(stdout, &cache);
    print_cache_bank(stdout, &cache);
  }

  printf("\n--- After reset ---\n");
  reset_cache(&cache);
  print_all_cache(stdout, &cache);
  print_cache_stack(stdout, &cache);
  print_cache_bank(stdout, &cache);

  delete_cache(&cache);
}
Example #21
0
 ~imp() {
     reset_cache();
     if (m_expr2var_owner)
         dealloc(m_expr2var);
 }