Ejemplo n.º 1
0
static void
gen_mirroring_tab (
  int max_depth,
  const char *data_file_type
)
{
  int key_bytes;
  const char *key_type;

  fprintf (stderr,
	   "Generating `" outputname "', it may take up to a few minutes\n");
  printf ("/* " outputname "\n * generated by " appname " "
	  "\n" " * from the file %s of */\n\n", data_file_type);

  printf ("#define PACKTAB_UINT8 guint8\n"
	  "#define PACKTAB_UINT16 guint16\n"
	  "#define PACKTAB_UINT32 guint32\n\n");

  key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
  key_type = key_bytes == 1 ? "gint8" : key_bytes == 2 ?
    "gint16" : "gint32";

  if (!pack_table
      (table, UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
       key_type, table_name, macro_name "_DELTA", stdout))
    die ("error: insufficient memory, decrease max_depth");

  printf ("#undef PACKTAB_UINT8\n"
	  "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");

  printf ("#define " macro_name "(x) ((x) + " macro_name "_DELTA(x))\n\n");

  printf ("/* End of generated " outputname " */\n");
}
Ejemplo n.º 2
0
static void
output_actions(void)
{
    nvectors = 2 * nstates + nvars;

    froms = NEW2(nvectors, Value_t *);
    tos = NEW2(nvectors, Value_t *);
    tally = NEW2(nvectors, Value_t);
    width = NEW2(nvectors, Value_t);

    token_actions();
    FREE(lookaheads);
    FREE(LA);
    FREE(LAruleno);
    FREE(accessing_symbol);

    goto_actions();
    FREE(goto_map + ntokens);
    FREE(from_state);
    FREE(to_state);

    sort_actions();
    pack_table();
    output_base();
    output_table();
    output_check();
}
Ejemplo n.º 3
0
Archivo: output.c Proyecto: npe9/sprite
output_actions()
{
  nvectors = nstates + nvars;

  froms = NEW2(nvectors, short *);
  tos = NEW2(nvectors, short *);
  tally = NEW2(nvectors, short);
  width = NEW2(nvectors, short);

  token_actions();
  free_shifts();
  free_reductions();
  FREE(lookaheads);
  FREE(LA);
  FREE(LAruleno);
  FREE(accessing_symbol);

  goto_actions();
  FREE(goto_map + ntokens);
  FREE(from_state);
  FREE(to_state);

  sort_actions();
  pack_table();
  output_base();
  output_table();
  output_check();
}
Ejemplo n.º 4
0
static bool pack_table_std(lima_symbol_table_t* table, unsigned num_vec4s)
{
	std_pack_state_t state;
	state.free_low[0] = state.free_low[1] = state.free_low[2]
		= state.free_low[3] = 0;
	state.free_high[0] = state.free_high[1] = state.free_high[2]
		= state.free_high[3] = num_vec4s;
	
	if (pack_table(table, pack_std, &state))
	{
		//determine total size
		
		for (unsigned i = 0; i < 4; i++)
			if (state.free_high[i] != num_vec4s)
			{
				table->total_size = num_vec4s;
				return true;
			}
		
		table->total_size = 0;
		for (unsigned i = 0; i < 4; i++)
			if (state.free_low[i] > table->total_size)
				table->total_size = state.free_low[i];
		
		table->total_size *= 4;
		
		return true;
	}
	
	return false;
}
Ejemplo n.º 5
0
void output_actions()
{
    nvectors = 3*nstates + nvars;

    froms = NEW2(nvectors, Yshort *);
    tos = NEW2(nvectors, Yshort *);
    tally = NEW2(nvectors, Yshort);
    width = NEW2(nvectors, Yshort);
    if (SRtotal+RRtotal)
	conflicts = NEW2(4*(SRtotal+RRtotal), Yshort);
    else
	conflicts = 0;
    nconflicts = 0;

    token_actions();
    FREE(lookaheads);
    FREE(LA);
    FREE(LAruleno);

    goto_actions();
    FREE(goto_map + ntokens);
    FREE(from_state);
    FREE(to_state);

    sort_actions();
    pack_table();
    output_base();
    output_table();
    output_check();
    output_ctable();
    output_astable();
    FREE(accessing_symbol);
}
Ejemplo n.º 6
0
static void
gen_joining_type_tab (
  int max_depth,
  const char *data_file_type[]
)
{
  fprintf (stderr,
	   "Generating `" outputname "', it may take up to a few minutes\n");
  printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
	  FRIBIDI_VERSION ")\n" " * from the files %s, %s of Unicode version "
	  FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
	  data_file_type[1]);

  printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
	  "#define PACKTAB_UINT16 fribidi_uint16\n"
	  "#define PACKTAB_UINT32 fribidi_uint32\n\n");

  if (!pack_table
      (table, FRIBIDI_UNICODE_CHARS, 1, U, max_depth, 1, names,
       "unsigned char", table_name, macro_name, stdout))
    die ("error: insufficient memory, decrease max_depth");

  printf ("#undef PACKTAB_UINT8\n"
	  "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");

  printf ("/* End of generated " outputname " */\n");
}
Ejemplo n.º 7
0
static bool pack_table_attr(lima_symbol_table_t* table, unsigned num_vec4s)
{
	attr_pack_state_t state;
	state.pos = 0;
	pack_table(table, pack_attr, &state);
	table->total_size = 4 * state.pos;
	return state.pos <= num_vec4s;
}
Ejemplo n.º 8
0
static bool pack_table_align(lima_symbol_table_t* table, unsigned size)
{
	align_pack_state_t state;
	state.pos = 0;
	pack_table(table, pack_align, &state);
	table->total_size = state.pos;
	return table->total_size <= size;
}
Ejemplo n.º 9
0
static void
write_char_type (char *file,
		 int max_depth)
{
  int i;
  FILE *f;
  char *FILENAME = headermacro (file);

  printf ("Writing `%s', it may take a few minutes\n", file);
  if (!(f = fopen (file, "wt")))
    err2 ("error: cannot open `%s' for writing", file);
  fprintf (f, "/*\n"
	   "  This file was automatically created from UnicodeData.txt version %s\n"
	   "  by fribidi_create_char_types\n*/\n\n", FRIBIDI_UNICODE_VERSION);

  fprintf (f, "#ifndef %s\n#define %s\n\n#include \"fribidi.h\"\n\n",
	   FILENAME, FILENAME);

  for (i = 0; i < type_names_count; i++)
    if (names[i])
      fprintf (f, "#define %s FRIBIDI_PROP_TYPE_%s\n", names[i], names[i]);
  fprintf (f, "\n");

  fprintf (f, "#define PACKTAB_UINT8 fribidi_uint8\n");
  fprintf (f, "#define PACKTAB_UINT16 fribidi_uint16\n");
  fprintf (f, "#define PACKTAB_UINT32 fribidi_uint32\n");

  if (!pack_table
      (table, FRIBIDI_UNICODE_CHARS, SIZEOF_CHAR, max_depth, 3, names,
       key_type_name, table_name, macro_name, f))
    err ("error: insufficient memory, decrease max_depth");

  for (i = type_names_count - 1; i >= 0; i--)
    if (names[i])
      fprintf (f, "#undef %s\n", names[i]);

  fprintf (f,
	   "/*======================================================================\n"
	   " *  %s() returns the bidi type of a character.\n"
	   " *----------------------------------------------------------------------*/\n"
	   "%s %s\n"
	   "%s (%s uch)\n"
	   "{\n"
	   "  if (uch < 0x%x)\n"
	   "    return %s[(unsigned char)%s (uch)];\n"
	   "  else\n"
	   "    return FRIBIDI_TYPE_%s;\n"
	   "  /* Non-Unicode chars */\n"
	   "}\n"
	   "\n",
	   function_name, export_api, char_type_name, function_name,
	   char_name, FRIBIDI_UNICODE_CHARS, prop_to_type_name, macro_name,
	   default_type);
  fprintf (f, "\n#endif /* %s */\n", FILENAME);

  fclose (f);
}
Ejemplo n.º 10
0
 toml_string_type&
 define ()
 {
     if (defined)
         return *this;
     defined = true;
     define_charset ();
     define_state ();
     squarize_table ();
     pack_table (base, check);
     return *this;
 }
Ejemplo n.º 11
0
static void
gen_bidi_type_tab (
  int max_depth,
  const char *data_file_type
)
{
  printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
	  FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
	  FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);

  printf ("#define PACKTAB_UINT8 uint8_t\n"
	  "#define PACKTAB_UINT16 uint16_t\n"
	  "#define PACKTAB_UINT32 uint32_t\n\n");

  if (!pack_table
      (table, FRIBIDI_UNICODE_CHARS, 1, LTR, max_depth, 3, names,
       "unsigned char", table_name, macro_name, stdout))
    die ("error: insufficient memory, decrease max_depth");

  printf ("#undef PACKTAB_UINT8\n"
	  "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");

  printf ("/* End of generated " outputname " */\n");
}
Ejemplo n.º 12
0
/*
 * table
 */
static void
enc_table(amqp_value_t *v, mnbytestream_t *bs)
{
    pack_table(bs, &v->value.t);
}
Ejemplo n.º 13
0
Hash_Table *Pack_Hash_Table(Hash_Table *hash_table)
{ pack_table(((Table *) hash_table));
  return (hash_table);
}