Exemplo n.º 1
0
Arquivo: init.c Projeto: kawatea/cedit
void init_window(void)
{
    load_setting();
    
    //メインウィンドウの外観の設定
    main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(main_window), "cedit");
    gtk_window_set_icon(GTK_WINDOW(main_window), get_icon("icon.png"));
    gtk_window_move(GTK_WINDOW(main_window), window_x, window_y);
    gtk_window_set_default_size(GTK_WINDOW(main_window), window_width, window_height);
    
    //ウィンドウの内部の設定
    GtkWidget *main_vbox = gtk_vbox_new(FALSE, 3);
    gtk_container_add(GTK_CONTAINER(main_window), main_vbox);
    init_bar(main_vbox);
    init_editor(main_vbox);
    
    //全体の動作の設定
    init_tag();
    init_library();
    set_action("New", FALSE);
    set_action("Save", FALSE);
    set_action("Undo", FALSE);
    set_action("Redo", FALSE);
    set_action("Cut", FALSE);
    set_action("Copy", FALSE);
    set_action("Delete", FALSE);
    static GtkTargetEntry target[] = {{"text/uri-list",  0, 10}};
    gtk_drag_dest_set(view, GTK_DEST_DEFAULT_ALL, target, 1, GDK_ACTION_COPY);
    gtk_drag_dest_set(main_window, GTK_DEST_DEFAULT_ALL, target, 1, GDK_ACTION_COPY);
    set_signal();
}
Exemplo n.º 2
0
void NativeScriptLanguage::frame() {
#ifndef NO_THREADS
	if (has_objects_to_register) {
		MutexLock lock(mutex);
		for (Set<Ref<GDNativeLibrary> >::Element *L = libs_to_init.front(); L; L = L->next()) {
			init_library(L->get());
		}
		libs_to_init.clear();
		for (Set<NativeScript *>::Element *S = scripts_to_register.front(); S; S = S->next()) {
			register_script(S->get());
		}
		scripts_to_register.clear();
		has_objects_to_register = false;
	}
#endif

#ifdef DEBUG_ENABLED
	{
#ifndef NO_THREADS
		MutexLock lock(mutex);
#endif

		for (Map<StringName, ProfileData>::Element *d = profile_data.front(); d; d = d->next()) {
			d->get().last_frame_call_count = d->get().frame_call_count;
			d->get().last_frame_self_time = d->get().frame_self_time;
			d->get().last_frame_total_time = d->get().frame_total_time;
			d->get().frame_call_count = 0;
			d->get().frame_self_time = 0;
			d->get().frame_total_time = 0;
		}
	}
#endif

	call_libraries_cb(_frame_call_name);
}
Exemplo n.º 3
0
int main()
{
    if( init_library() )
        hello_message("Dmitry");
    else
        printf("Library was not loaded\n");
    return 0;
}
Exemplo n.º 4
0
int main()
{
    if(init_library())
        hello_message("EK");
    else
        printf("Error, Library not found\n");
    return 0;
}
void 
JB2Dict::JB2Codec::Encode::code(const GP<JB2Dict> &gjim)
{
  if(!gjim)
  {
    G_THROW( ERR_MSG("JB2Image.bad_number") );
  }
  JB2Dict &jim=*gjim;
      // -------------------------
      // THIS IS THE ENCODING PART
      // -------------------------
      int firstshape = jim.get_inherited_shape_count();
      int nshape = jim.get_shape_count();
      init_library(jim);
      // Code headers.
      int rectype = REQUIRED_DICT_OR_RESET;
      if (jim.get_inherited_shape_count() > 0)
        code_record(rectype, gjim, 0);
      rectype = START_OF_DATA;
      code_record(rectype, gjim, 0);
      // Code Comment.
      rectype = PRESERVED_COMMENT;
      if (!! jim.comment)
        code_record(rectype, gjim, 0);
      // Encode every shape
      int shapeno;
      DJVU_PROGRESS_TASK(jb2code,"jb2 encode", nshape-firstshape);
      for (shapeno=firstshape; shapeno<nshape; shapeno++)
        {
          DJVU_PROGRESS_RUN(jb2code, (shapeno-firstshape)|0xff);
          // Code shape
          JB2Shape &jshp = jim.get_shape(shapeno);
          rectype=(jshp.parent >= 0)
            ?MATCHED_REFINE_LIBRARY_ONLY:NEW_MARK_LIBRARY_ONLY;
          code_record(rectype, gjim, &jshp);
          add_library(shapeno, jshp);
	  // Check numcoder status
	  if (cur_ncell > CELLCHUNK) 
	    {
	      rectype = REQUIRED_DICT_OR_RESET;
	      code_record(rectype, 0, 0);	      
	    }
        }
      // Code end of data record
      rectype = END_OF_DATA;
      code_record(rectype, gjim, 0); 
      gzp=0;
}
Exemplo n.º 6
0
void NativeScriptLanguage::frame() {
#ifndef NO_THREADS
	if (has_objects_to_register) {
		MutexLock lock(mutex);
		for (Set<Ref<GDNativeLibrary> >::Element *L = libs_to_init.front(); L; L = L->next()) {
			init_library(L->get());
		}
		libs_to_init.clear();
		for (Set<NativeScript *>::Element *S = scripts_to_register.front(); S; S = S->next()) {
			register_script(S->get());
		}
		scripts_to_register.clear();
		has_objects_to_register = false;
	}
#endif
	call_libraries_cb(_frame_call_name);
}
Exemplo n.º 7
0
/* Initialize a cpp_reader structure.  */
cpp_reader *
cpp_create_reader (enum c_lang lang, hash_table *table,
		   struct line_maps *line_table)
{
  cpp_reader *pfile;

  /* Initialize this instance of the library if it hasn't been already.  */
  init_library ();

  pfile = XCNEW (cpp_reader);
  memset (&pfile->base_context, 0, sizeof (pfile->base_context));

  cpp_set_lang (pfile, lang);
  CPP_OPTION (pfile, warn_multichar) = 1;
  CPP_OPTION (pfile, discard_comments) = 1;
  CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1;
  CPP_OPTION (pfile, tabstop) = 8;
  CPP_OPTION (pfile, operator_names) = 1;
  CPP_OPTION (pfile, warn_trigraphs) = 2;
  CPP_OPTION (pfile, warn_endif_labels) = 1;
  CPP_OPTION (pfile, cpp_warn_deprecated) = 1;
  CPP_OPTION (pfile, cpp_warn_long_long) = 0;
  CPP_OPTION (pfile, dollars_in_ident) = 1;
  CPP_OPTION (pfile, warn_dollars) = 1;
  CPP_OPTION (pfile, warn_variadic_macros) = 1;
  CPP_OPTION (pfile, warn_builtin_macro_redefined) = 1;
  /* By default, track locations of tokens resulting from macro
     expansion.  The '2' means, track the locations with the highest
     accuracy.  Read the comments for struct
     cpp_options::track_macro_expansion to learn about the other
     values.  */
  CPP_OPTION (pfile, track_macro_expansion) = 2;
  CPP_OPTION (pfile, warn_normalize) = normalized_C;
  CPP_OPTION (pfile, warn_literal_suffix) = 1;

  /* Default CPP arithmetic to something sensible for the host for the
     benefit of dumb users like fix-header.  */
  CPP_OPTION (pfile, precision) = CHAR_BIT * sizeof (long);
  CPP_OPTION (pfile, char_precision) = CHAR_BIT;
  CPP_OPTION (pfile, wchar_precision) = CHAR_BIT * sizeof (int);
  CPP_OPTION (pfile, int_precision) = CHAR_BIT * sizeof (int);
  CPP_OPTION (pfile, unsigned_char) = 0;
  CPP_OPTION (pfile, unsigned_wchar) = 1;
  CPP_OPTION (pfile, bytes_big_endian) = 1;  /* does not matter */

  /* Default to no charset conversion.  */
  CPP_OPTION (pfile, narrow_charset) = _cpp_default_encoding ();
  CPP_OPTION (pfile, wide_charset) = 0;

  /* Default the input character set to UTF-8.  */
  CPP_OPTION (pfile, input_charset) = _cpp_default_encoding ();

  /* A fake empty "directory" used as the starting point for files
     looked up without a search path.  Name cannot be '/' because we
     don't want to prepend anything at all to filenames using it.  All
     other entries are correct zero-initialized.  */
  pfile->no_search_path.name = (char *) "";

  /* Initialize the line map.  */
  pfile->line_table = line_table;

  /* Initialize lexer state.  */
  pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);

  /* Set up static tokens.  */
  pfile->avoid_paste.type = CPP_PADDING;
  pfile->avoid_paste.val.source = NULL;
  pfile->eof.type = CPP_EOF;
  pfile->eof.flags = 0;

  /* Create a token buffer for the lexer.  */
  _cpp_init_tokenrun (&pfile->base_run, 250);
  pfile->cur_run = &pfile->base_run;
  pfile->cur_token = pfile->base_run.base;

  /* Initialize the base context.  */
  pfile->context = &pfile->base_context;
  pfile->base_context.c.macro = 0;
  pfile->base_context.prev = pfile->base_context.next = 0;

  /* Aligned and unaligned storage.  */
  pfile->a_buff = _cpp_get_buff (pfile, 0);
  pfile->u_buff = _cpp_get_buff (pfile, 0);

  /* Initialize table for push_macro/pop_macro.  */
  pfile->pushed_macros = 0;

  /* Do not force token locations by default.  */
  pfile->forced_token_location_p = NULL;

  /* The expression parser stack.  */
  _cpp_expand_op_stack (pfile);

  /* Initialize the buffer obstack.  */
  _obstack_begin (&pfile->buffer_ob, 0, 0,
		  (void *(*) (long)) xmalloc,
		  (void (*) (void *)) free);

  _cpp_init_files (pfile);

  _cpp_init_hashtable (pfile, table);

  return pfile;
}
Exemplo n.º 8
0
int main()
{
	init_library();
	start_socket_server();
	return 0;
}
Exemplo n.º 9
0
tsd_t *ReginaInitializeProcess(void)
{
   int OK;

   if (__regina_tsd_initialized)
      return(&__regina_tsd);
   __regina_tsd_initialized = 1;

                                        /* Set up the current (single) tsd_t:*/
                                        /* Default all values to zero        */
   memset(&__regina_tsd,0,sizeof(__regina_tsd));
   __regina_tsd.MTMalloc = MTMalloc;
   __regina_tsd.MTFree = MTFree;
   __regina_tsd.MTExit = MTExit;

   /* Since the local data structure contains a memory chain for the memory
    * management we initialize it first.
    */
   if ((__regina_tsd.mt_tsd = malloc(sizeof(mt_tsd_t))) == NULL)
      return(NULL);                     /* This is a catastrophy             */
   memset(__regina_tsd.mt_tsd,0,sizeof(mt_tsd_t));

   OK = init_memory(&__regina_tsd);     /* Initialize the memory module FIRST*/

   /* Without the initial memory we don't have ANY chance! */
   if (!OK)
      return(NULL);

   /*
    * Some systems with an own MT file don't compile in MT mode. But they
    * still are systems of that kind.
    */
#if defined(WIN32) || defined(__WIN32__)
   {
      extern OS_Dep_funcs __regina_OS_Win;
      __regina_tsd.OS = &__regina_OS_Win;
   }
#elif defined(OS2) && !defined(DOS)
   {
      extern OS_Dep_funcs __regina_OS_Os2;
      __regina_tsd.OS = &__regina_OS_Os2;
   }
#elif defined(GO32)
   {
      extern OS_Dep_funcs __regina_OS_Other;
      __regina_tsd.OS = &__regina_OS_Other;
   }
#elif defined(unix) || defined(__unix__) || defined(__unix) || defined(__QNX__) || defined(__BEOS__) || defined(SKYOS) || ( defined( __APPLE_CC__ ) && defined( __MACH__ ) )
   {
      extern OS_Dep_funcs __regina_OS_Unx;
      __regina_tsd.OS = &__regina_OS_Unx;
   }
#else
   {
      extern OS_Dep_funcs __regina_OS_Other;
      __regina_tsd.OS = &__regina_OS_Other;
   }
#endif
   __regina_tsd.OS->init();
   OK |= init_vars(&__regina_tsd);      /* Initialize the variable module    */
   OK |= init_stacks(&__regina_tsd);    /* Initialize the stack module       */
   OK |= init_filetable(&__regina_tsd); /* Initialize the files module       */
   OK |= init_math(&__regina_tsd);      /* Initialize the math module        */
   OK |= init_spec_vars(&__regina_tsd); /* Initialize the interprt module    */
   OK |= init_tracing(&__regina_tsd);   /* Initialize the tracing module     */
   OK |= init_builtin(&__regina_tsd);   /* Initialize the builtin module     */
   OK |= init_client(&__regina_tsd);    /* Initialize the client module      */
   OK |= init_library(&__regina_tsd);   /* Initialize the library module     */
   OK |= init_rexxsaa(&__regina_tsd);   /* Initialize the rexxsaa module     */
   OK |= init_shell(&__regina_tsd);     /* Initialize the shell module       */
   OK |= init_envir(&__regina_tsd);     /* Initialize the envir module       */
   OK |= init_expr(&__regina_tsd);      /* Initialize the expr module        */
   OK |= init_error(&__regina_tsd);     /* Initialize the error module       */
#ifdef VMS
   OK |= init_vms(&__regina_tsd);       /* Initialize the vmscmd module      */
   OK |= init_vmf(&__regina_tsd);       /* Initialize the vmsfuncs module    */
#endif
   OK |= init_arexxf(&__regina_tsd);    /* Initialize the arxfuncs modules */
   __regina_tsd.loopcnt = 1;            /* stupid r2perl-module              */
   __regina_tsd.traceparse = -1;
   __regina_tsd.thread_id = 1;

   if (!OK)
      exiterror( ERR_STORAGE_EXHAUSTED, 0 ) ;

   return(&__regina_tsd);
}
void 
JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim)
{
  if(!gjim)
  {
    G_THROW( ERR_MSG("JB2Image.bad_number") );
  }
  JB2Image &jim=*gjim;
      // -------------------------
      // THIS IS THE ENCODING PART
      // -------------------------
      int i;
      init_library(jim);
      int firstshape = jim.get_inherited_shape_count();
      int nshape = jim.get_shape_count();
      int nblit = jim.get_blit_count();
      // Initialize shape2lib 
      shape2lib.resize(0,nshape-1);
      for (i=firstshape; i<nshape; i++)
        shape2lib[i] = -1;
      // Determine shapes that go into library (shapeno>=firstshape)
      //  shape2lib is -2 if used by one blit
      //  shape2lib is -3 if used by more than one blit
      //  shape2lib is -4 if used as a parent
      for (i=0; i<nblit; i++)
        {
          JB2Blit *jblt = jim.get_blit(i);
          int shapeno = jblt->shapeno;
          if (shapeno < firstshape)
            continue;
          if (shape2lib[shapeno] >= -2) 
            shape2lib[shapeno] -= 1;
          shapeno = jim.get_shape(shapeno).parent;
          while (shapeno>=firstshape && shape2lib[shapeno]>=-3)
            {
              shape2lib[shapeno] = -4;
              shapeno = jim.get_shape(shapeno).parent;
            }
        }
      // Code headers.
      int rectype = REQUIRED_DICT_OR_RESET;
      if (jim.get_inherited_shape_count() > 0)
        code_record(rectype, gjim, 0, 0);
      rectype = START_OF_DATA;
      code_record(rectype, gjim, 0, 0);
      // Code Comment.
      rectype = PRESERVED_COMMENT;
      if (!! jim.comment)
        code_record(rectype, gjim, 0, 0);
      // Encode every blit
      int blitno;
      DJVU_PROGRESS_TASK(jb2code,"jb2 encode", nblit);
      for (blitno=0; blitno<nblit; blitno++)
        {
          DJVU_PROGRESS_RUN(jb2code, blitno|0xff);
          JB2Blit *jblt = jim.get_blit(blitno);
          int shapeno = jblt->shapeno;
          JB2Shape &jshp = jim.get_shape(shapeno);
          // Tests if shape exists in library
          if (shape2lib[shapeno] >= 0)
            {
              int rectype = MATCHED_COPY;
              code_record(rectype, gjim, 0, jblt);
            }
          // Avoid coding null shapes/blits
          else if (jshp.bits) 
            {
              // Make sure all parents have been coded
              if (jshp.parent>=0 && shape2lib[jshp.parent]<0)
                encode_libonly_shape(gjim, jshp.parent);
              // Allocate library entry when needed
#define LIBRARY_CONTAINS_ALL
              int libraryp = 0;
#ifdef LIBRARY_CONTAINS_MARKS // baseline
              if (jshp.parent >= -1)
                libraryp = 1;
#endif
#ifdef LIBRARY_CONTAINS_SHARED // worse             
              if (shape2lib[shapeno] <= -3)
                libraryp = 1;
#endif
#ifdef LIBRARY_CONTAINS_ALL // better
              libraryp = 1;
#endif
              // Test all blit cases
              if (jshp.parent<-1 && !libraryp)
                {
                  int rectype = NON_MARK_DATA;
                  code_record(rectype, gjim, &jshp, jblt);
                }
              else if (jshp.parent < 0)
                {
                  int rectype = (libraryp ? NEW_MARK : NEW_MARK_IMAGE_ONLY);
                  code_record(rectype, gjim, &jshp, jblt);
                }
              else 
                {
                  int rectype = (libraryp ? MATCHED_REFINE : MATCHED_REFINE_IMAGE_ONLY);
                  code_record(rectype, gjim, &jshp, jblt);
                }
              // Add shape to library
              if (libraryp) 
                add_library(shapeno, jshp);
            }
	  // Check numcoder status
	  if (cur_ncell > CELLCHUNK) 
	    {
	      rectype = REQUIRED_DICT_OR_RESET;
	      code_record(rectype, 0, 0);
	    }
        }
      // Code end of data record
      rectype = END_OF_DATA;
      code_record(rectype, gjim, 0, 0); 
      gzp=0;
}
Exemplo n.º 11
0
xslt::init::init (void) {
    if ( ms_counter++ == 0 )
        init_library();
}
Exemplo n.º 12
0
void 
monitor_init_library()
{
  init_library();
  /* process initialized with interception of libc_start_main */
}
Exemplo n.º 13
0
void
JB2Dict::JB2Codec::code_record(
  int &rectype, const GP<JB2Dict> &gjim, JB2Shape *xjshp)
{
  GP<GBitmap> cbm;
  GP<GBitmap> bm;
  int shapeno = -1;

  // Code record type
  code_record_type(rectype);
  
  // Pre-coding actions
  switch(rectype)
    {
    case NEW_MARK_LIBRARY_ONLY:
    case MATCHED_REFINE_LIBRARY_ONLY:
      {
        if(!xjshp)
        {
          G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Shape &jshp=*xjshp;
        if (!encoding) 
        {
          jshp.bits = GBitmap::create();
          jshp.parent = -1;
        }
        bm = jshp.bits;
        break;
      }
    }
  // Coding actions
  switch (rectype)
    {
    case START_OF_DATA:
      {
        if(!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Dict &jim=*gjim;
        code_image_size (jim);
        code_eventual_lossless_refinement ();
        if (! encoding)
          init_library(jim);
        break;
      }
    case NEW_MARK_LIBRARY_ONLY:
      {
        code_absolute_mark_size (*bm, 4);
        code_bitmap_directly (*bm);
        break;
      }
    case MATCHED_REFINE_LIBRARY_ONLY:
      {
        if(!xjshp||!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Dict &jim=*gjim;
        JB2Shape &jshp=*xjshp;
        int match = code_match_index (jshp.parent, jim);
        cbm = jim.get_shape(jshp.parent).bits;
        LibRect &l = libinfo[match];
        code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4);
        code_bitmap_by_cross_coding (*bm, cbm, jshp.parent);
        break;
      }
    case PRESERVED_COMMENT:
      {
        if(!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Dict &jim=*gjim;
        code_comment(jim.comment);
        break;
      }
    case REQUIRED_DICT_OR_RESET:
      {
        if (! gotstartrecordp)
        {
	  // Indicates need for a shape dictionary
          if(!gjim)
          {
             G_THROW( ERR_MSG("JB2Image.bad_number") );
          }
	  code_inherited_shape_count(*gjim);
        }else
	  // Reset all numerical contexts to zero
	  reset_numcoder();
        break;
      }
    case END_OF_DATA:
      {
        break;
      }
    default:
      {
        G_THROW( ERR_MSG("JB2Image.bad_type") );
      }
    }
  // Post-coding action
  if (!encoding)
    {
      // add shape to dictionary
      switch(rectype)
        {
        case NEW_MARK_LIBRARY_ONLY:
        case MATCHED_REFINE_LIBRARY_ONLY:
          {
            if(!xjshp||!gjim)
            {
               G_THROW( ERR_MSG("JB2Image.bad_number") );
            }
            JB2Shape &jshp=*xjshp;
            shapeno = gjim->add_shape(jshp);
            add_library(shapeno, jshp);
            break;
          }
        }
      // make sure everything is compacted
      // decompaction will occur automatically when needed
      if (bm)
        bm->compress();
    }
}
Exemplo n.º 14
0
void
JB2Dict::JB2Codec::code_record(
  int &rectype, const GP<JB2Image> &gjim, JB2Shape *xjshp, JB2Blit *jblt)
{
  GP<GBitmap> bm;
  GP<GBitmap> cbm;
  int shapeno = -1;
  int match;

  // Code record type
  code_record_type(rectype);
  
  // Pre-coding actions
  switch(rectype)
    {
    case NEW_MARK:
    case NEW_MARK_LIBRARY_ONLY:
    case NEW_MARK_IMAGE_ONLY:
    case MATCHED_REFINE:
    case MATCHED_REFINE_LIBRARY_ONLY:
    case MATCHED_REFINE_IMAGE_ONLY:
    case NON_MARK_DATA:
      {
        if(!xjshp)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Shape &jshp=*xjshp;
        if (!encoding) 
        {
          jshp.bits = GBitmap::create();
          jshp.parent = -1;
          if (rectype == NON_MARK_DATA)
            jshp.parent = -2;
        }
        bm = jshp.bits;
        break;
      }
    }
  // Coding actions
  switch (rectype)
    {
    case START_OF_DATA:
      {
        if(!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Image &jim=*gjim;
        code_image_size (jim);
        code_eventual_lossless_refinement ();
        if (! encoding)
          init_library(jim);
        break;
      }
    case NEW_MARK:
      {
        code_absolute_mark_size (*bm, 4);
        code_bitmap_directly (*bm);
        code_relative_location (jblt, bm->rows(), bm->columns() );
        break;
      }
    case NEW_MARK_LIBRARY_ONLY:
      {
        code_absolute_mark_size (*bm, 4);
        code_bitmap_directly (*bm);
        break;
      }
    case NEW_MARK_IMAGE_ONLY:
      {
        code_absolute_mark_size (*bm, 3);
        code_bitmap_directly (*bm);
        code_relative_location (jblt, bm->rows(), bm->columns() );
        break;
      }
    case MATCHED_REFINE:
      {
        if(!xjshp || !gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Shape &jshp=*xjshp;
        JB2Image &jim=*gjim;
        match = code_match_index (jshp.parent, jim);
        cbm = jim.get_shape(jshp.parent).bits;
        LibRect &l = libinfo[match];
        code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4); 
        code_bitmap_by_cross_coding (*bm, cbm, match);
        code_relative_location (jblt, bm->rows(), bm->columns() );
        break;
      }
    case MATCHED_REFINE_LIBRARY_ONLY:
      {
        if(!xjshp||!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Image &jim=*gjim;
        JB2Shape &jshp=*xjshp;
        match = code_match_index (jshp.parent, jim);
        cbm = jim.get_shape(jshp.parent).bits;
        LibRect &l = libinfo[match];
        code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4);
        break;
      }
    case MATCHED_REFINE_IMAGE_ONLY:
      {
        if(!xjshp||!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Image &jim=*gjim;
        JB2Shape &jshp=*xjshp;
        match = code_match_index (jshp.parent, jim);
        cbm = jim.get_shape(jshp.parent).bits;
        LibRect &l = libinfo[match];
        code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4);
        code_bitmap_by_cross_coding (*bm, cbm, match);
        code_relative_location (jblt, bm->rows(), bm->columns() );
        break;
      }
    case MATCHED_COPY:
      {
        int temp;
        if (encoding) temp = jblt->shapeno;
        if(!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Image &jim=*gjim;
        match = code_match_index (temp, jim);
        if (!encoding) jblt->shapeno = temp;
        bm = jim.get_shape(jblt->shapeno).bits;
        LibRect &l = libinfo[match];
        jblt->left += l.left;
        jblt->bottom += l.bottom;
        if (jim.reproduce_old_bug)
          code_relative_location (jblt, bm->rows(), bm->columns() );
        else
          code_relative_location (jblt, l.top-l.bottom+1, l.right-l.left+1 );
        jblt->left -= l.left;
        jblt->bottom -= l.bottom; 
        break;
      }
    case NON_MARK_DATA:
      {
        code_absolute_mark_size (*bm, 3);
        code_bitmap_directly (*bm);
        code_absolute_location (jblt, bm->rows(), bm->columns() );
        break;
      }
    case PRESERVED_COMMENT:
      {
        if(!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Image &jim=*gjim;
        code_comment(jim.comment);
        break;
      }
    case REQUIRED_DICT_OR_RESET:
      {
        if(!gjim)
        {
           G_THROW( ERR_MSG("JB2Image.bad_number") );
        }
        JB2Image &jim=*gjim;
        if (! gotstartrecordp)
	  // Indicates need for a shape dictionary
	  code_inherited_shape_count(jim);
	else
	  // Reset all numerical contexts to zero
	  reset_numcoder();
        break;
      }
    case END_OF_DATA:
      {
        break;
      }
    default:
      {
        G_THROW( ERR_MSG("JB2Image.unknown_type") );
      }
    }
  
  // Post-coding action
  if (!encoding)
    {
      // add shape to image
      switch(rectype)
        {
        case NEW_MARK:
        case NEW_MARK_LIBRARY_ONLY:
        case NEW_MARK_IMAGE_ONLY:
        case MATCHED_REFINE:
        case MATCHED_REFINE_LIBRARY_ONLY:
        case MATCHED_REFINE_IMAGE_ONLY:
        case NON_MARK_DATA:
          {
            if(!xjshp||!gjim)
            {
              G_THROW( ERR_MSG("JB2Image.bad_number") );
            }
            JB2Shape &jshp=*xjshp;
            shapeno = gjim->add_shape(jshp);
            shape2lib.touch(shapeno);
            shape2lib[shapeno] = -1;
            break;
          }
        }
      // add shape to library
      switch(rectype)
        {
        case NEW_MARK:
        case NEW_MARK_LIBRARY_ONLY:
        case MATCHED_REFINE:
        case MATCHED_REFINE_LIBRARY_ONLY:
          if(!xjshp)
          {
            G_THROW( ERR_MSG("JB2Image.bad_number") );
          }
          add_library(shapeno, *xjshp);
          break;
        }
      // make sure everything is compacted
      // decompaction will occur automatically on cross-coding bitmaps
      if (bm)
        bm->compress();
      // add blit to image
      switch (rectype)
        {
        case NEW_MARK:
        case NEW_MARK_IMAGE_ONLY:
        case MATCHED_REFINE:
        case MATCHED_REFINE_IMAGE_ONLY:
        case NON_MARK_DATA:
          jblt->shapeno = shapeno;
        case MATCHED_COPY:
          if(!gjim)
          {
            G_THROW( ERR_MSG("JB2Image.bad_number") );
          }
          gjim->add_blit(* jblt);
          break;
        }
    }
}
Exemplo n.º 15
0
/* Initialize a cpp_reader structure.  */
cpp_reader *
cpp_create_reader (enum c_lang lang, hash_table *table)
{
  cpp_reader *pfile;

  /* Initialize this instance of the library if it hasn't been already.  */
  init_library ();

  pfile = xcalloc (1, sizeof (cpp_reader));

  cpp_set_lang (pfile, lang);
  CPP_OPTION (pfile, warn_multichar) = 1;
  CPP_OPTION (pfile, discard_comments) = 1;
  CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1;
  CPP_OPTION (pfile, show_column) = 1;
  CPP_OPTION (pfile, tabstop) = 8;
  CPP_OPTION (pfile, operator_names) = 1;
  CPP_OPTION (pfile, warn_trigraphs) = 2;
  CPP_OPTION (pfile, warn_endif_labels) = 1;
  CPP_OPTION (pfile, warn_deprecated) = 1;
  CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99);
  CPP_OPTION (pfile, dollars_in_ident) = 1;
  CPP_OPTION (pfile, warn_dollars) = 1;

  /* Default CPP arithmetic to something sensible for the host for the
     benefit of dumb users like fix-header.  */
  CPP_OPTION (pfile, precision) = CHAR_BIT * sizeof (long);
  CPP_OPTION (pfile, char_precision) = CHAR_BIT;
  CPP_OPTION (pfile, wchar_precision) = CHAR_BIT * sizeof (int);
  CPP_OPTION (pfile, int_precision) = CHAR_BIT * sizeof (int);
  CPP_OPTION (pfile, unsigned_char) = 0;
  CPP_OPTION (pfile, unsigned_wchar) = 1;
  CPP_OPTION (pfile, bytes_big_endian) = 1;  /* does not matter */

  /* Default to locale/UTF-8.  */
  CPP_OPTION (pfile, narrow_charset) = _cpp_default_encoding ();
  CPP_OPTION (pfile, wide_charset) = 0;
  CPP_OPTION (pfile, input_charset) = _cpp_default_encoding ();

  /* A fake empty "directory" used as the starting point for files
     looked up without a search path.  Name cannot be '/' because we
     don't want to prepend anything at all to filenames using it.  All
     other entries are correct zero-initialized.  */
  pfile->no_search_path.name = (char *) "";

  /* Initialize the line map.  Start at logical line 1, so we can use
     a line number of zero for special states.  */
  linemap_init (&pfile->line_maps);
  pfile->line = 1;

  /* Initialize lexer state.  */
  pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);

  /* Set up static tokens.  */
  pfile->avoid_paste.type = CPP_PADDING;
  pfile->avoid_paste.val.source = NULL;
  pfile->eof.type = CPP_EOF;
  pfile->eof.flags = 0;

  /* Create a token buffer for the lexer.  */
  _cpp_init_tokenrun (&pfile->base_run, 250);
  pfile->cur_run = &pfile->base_run;
  pfile->cur_token = pfile->base_run.base;

  /* Initialize the base context.  */
  pfile->context = &pfile->base_context;
  pfile->base_context.macro = 0;
  pfile->base_context.prev = pfile->base_context.next = 0;

  /* Aligned and unaligned storage.  */
  pfile->a_buff = _cpp_get_buff (pfile, 0);
  pfile->u_buff = _cpp_get_buff (pfile, 0);

  /* The expression parser stack.  */
  _cpp_expand_op_stack (pfile);

  /* Initialize the buffer obstack.  */
  _obstack_begin (&pfile->buffer_ob, 0, 0,
		  (void *(*) (long)) xmalloc,
		  (void (*) (void *)) free);

  _cpp_init_files (pfile);

  _cpp_init_hashtable (pfile, table);

  return pfile;
}