示例#1
0
文件: util.c 项目: aosm/subversion
svn_error_t *
svn_diff_output(svn_diff_t *diff,
                void *output_baton,
                const svn_diff_output_fns_t *vtable)
{
  svn_error_t *(*output_fn)(void *,
                            apr_off_t, apr_off_t,
                            apr_off_t, apr_off_t,
                            apr_off_t, apr_off_t);

  while (diff != NULL)
    {
      switch (diff->type)
        {
        case svn_diff__type_common:
          output_fn = vtable->output_common;
          break;

        case svn_diff__type_diff_common:
          output_fn = vtable->output_diff_common;
          break;

        case svn_diff__type_diff_modified:
          output_fn = vtable->output_diff_modified;
          break;

        case svn_diff__type_diff_latest:
          output_fn = vtable->output_diff_latest;
          break;

        case svn_diff__type_conflict:
          output_fn = NULL;
          if (vtable->output_conflict != NULL)
            {
              SVN_ERR(vtable->output_conflict(output_baton,
                               diff->original_start, diff->original_length,
                               diff->modified_start, diff->modified_length,
                               diff->latest_start, diff->latest_length,
                               diff->resolved_diff));
            }
          break;

        default:
          output_fn = NULL;
          break;
        }

      if (output_fn != NULL)
        {
          SVN_ERR(output_fn(output_baton,
                            diff->original_start, diff->original_length,
                            diff->modified_start, diff->modified_length,
                            diff->latest_start, diff->latest_length));
        }

      diff = diff->next;
    }

  return SVN_NO_ERROR;
}
示例#2
0
/* This function has this clunky interface because it needs to be called
   from outside this module (no MimeObject, etc.)
 */
int
MimeRichtextConvert (const char *line, PRInt32 length,
           int (*output_fn) (const char *buf, PRInt32 size, void *closure),
           void *closure,
           char **obufferP,
           PRInt32 *obuffer_sizeP,
           PRBool enriched_p)
{
  /* RFC 1341 (the original MIME spec) defined text/richtext.
   RFC 1563 superceded text/richtext with text/enriched.
   The changes from text/richtext to text/enriched are:
    - CRLF semantics are different
    - << maps to <
    - These tags were added:
       <VERBATIM>, <NOFILL>, <PARAM>, <FLUSHBOTH>
    - These tags were removed:
       <COMMENT>, <OUTDENT>, <OUTDENTRIGHT>, <SAMEPAGE>, <SUBSCRIPT>,
         <SUPERSCRIPT>, <HEADING>, <FOOTING>, <PARAGRAPH>, <SIGNATURE>,
       <LT>, <NL>, <NP>
   This method implements them both.

   draft-resnick-text-enriched-03.txt is a proposed update to 1563.
    - These tags were added:
      <FONTFAMILY>, <COLOR>, <PARAINDENT>, <LANG>.
    However, all of these rely on the magic <PARAM> tag, which we
    don't implement, so we're ignoring all of these.
   Interesting fact: it's by Peter W. Resnick from Qualcomm (Eudora).
   And it also says "It is fully expected that other text formatting
   standards like HTML and SGML will supplant text/enriched in
   Internet mail."
   */
  int status = 0;
  char *out;
  const char *data_end;
  const char *last_end;
  const char *this_start;
  const char *this_end;
  unsigned int desired_size;

  // The code below must never expand the input by more than 5x;
  // if it does, the desired_size multiplier (5) below must be changed too
#define BGROWTH 5
  if ( (PRUint32)length >= ( (PRUint32) 0xfffffffe)/BGROWTH )
      return -1;
  desired_size = (length * BGROWTH) + 1;
#undef BGROWTH  
  if (desired_size >= (PRUint32) *obuffer_sizeP)
  status = mime_GrowBuffer (desired_size, sizeof(char), 1024,
               obufferP, obuffer_sizeP);
  if (status < 0) return status;

  if (enriched_p)
  {
    for (this_start = line; this_start < line + length; this_start++)
    if (!IS_SPACE (*this_start)) break;
    if (this_start >= line + length) /* blank line */
    {
      PL_strncpyz (*obufferP, "<BR>", *obuffer_sizeP);
      return output_fn (*obufferP, strlen(*obufferP), closure);
    }
  }

  PRUint32 outlen = (PRUint32) *obuffer_sizeP;
  out = *obufferP;
  *out = 0;

  data_end = line + length;
  last_end = line;
  this_start = last_end;
  this_end = this_start;
  PRUint32 addedlen = 0;
  while (this_end < data_end)
  {
    /* Skip forward to next special character. */
    while (this_start < data_end &&
       *this_start != '<' && *this_start != '>' &&
       *this_start != '&')
    this_start++;

    this_end = this_start;

    /* Skip to the end of the tag. */
    if (this_start < data_end && *this_start == '<')
    {
      this_end++;
      while (this_end < data_end &&
         !IS_SPACE(*this_end) &&
         *this_end != '<' && *this_end != '>' &&
         *this_end != '&')
      this_end++;
    }

    this_end++;

    /* Push out the text preceeding the tag. */
    if (last_end && last_end != this_start)
    {
      memcpy (out, last_end, this_start - last_end);
      out += this_start - last_end;
      *out = 0;
      outlen -= (this_start - last_end);
    }

    if (this_start >= data_end)
    break;
    else if (*this_start == '&')
    {
      PL_strncpyz (out, "&amp;", outlen); 
      addedlen = strlen(out);
      outlen -= addedlen; 
      out += addedlen;
    }
    else if (*this_start == '>')
    {
      PL_strncpyz (out, "&gt;", outlen); 
      addedlen = strlen(out); 
      outlen -= addedlen; 
      out += addedlen;
    }
    else if (enriched_p &&
         this_start < data_end + 1 &&
         this_start[0] == '<' &&
         this_start[1] == '<')
    {
      PL_strncpyz (out, "&lt;", outlen); 
      addedlen = strlen(out); 
      outlen -= addedlen; 
      out += addedlen;
    }
    else if (this_start != this_end)
    {
      /* Push out this ID. */
      const char *old = this_start + 1;
      const char *tag_open  = 0;
      const char *tag_close = 0;
      if (*old == '/')
      {
        /* This is </tag> */
        old++;
      }

      switch (*old)
      {
      case 'b': case 'B':
        if (!PL_strncasecmp ("BIGGER>", old, 7))
        tag_open = "<FONT SIZE=\"+1\">", tag_close = "</FONT>";
        else if (!PL_strncasecmp ("BLINK>", old, 5))
        /* Of course, both text/richtext and text/enriched must be
           enhanced *somehow*...  Or else what would people think. */
        tag_open = "<BLINK>", tag_close = "</BLINK>";
        else if (!PL_strncasecmp ("BOLD>", old, 5))
        tag_open = "<B>", tag_close = "</B>";
        break;
      case 'c': case 'C':
        if (!PL_strncasecmp ("CENTER>", old, 7))
        tag_open = "<CENTER>", tag_close = "</CENTER>";
        else if (!enriched_p &&
             !PL_strncasecmp ("COMMENT>", old, 8))
        tag_open = "<!-- ", tag_close = " -->";
        break;
      case 'e': case 'E':
        if (!PL_strncasecmp ("EXCERPT>", old, 8))
        tag_open = "<BLOCKQUOTE>", tag_close = "</BLOCKQUOTE>";
        break;
      case 'f': case 'F':
        if (!PL_strncasecmp ("FIXED>", old, 6))
        tag_open = "<TT>", tag_close = "</TT>";
        else if (enriched_p &&
             !PL_strncasecmp ("FLUSHBOTH>", old, 10))
        tag_open = "<P ALIGN=LEFT>", tag_close = "</P>";
        else if (!PL_strncasecmp ("FLUSHLEFT>", old, 10))
        tag_open = "<P ALIGN=LEFT>", tag_close = "</P>";
        else if (!PL_strncasecmp ("FLUSHRIGHT>", old, 11))
        tag_open = "<P ALIGN=RIGHT>", tag_close = "</P>";
        else if (!enriched_p &&
             !PL_strncasecmp ("FOOTING>", old, 8))
        tag_open = "<H6>", tag_close = "</H6>";
        break;
      case 'h': case 'H':
        if (!enriched_p &&
          !PL_strncasecmp ("HEADING>", old, 8))
        tag_open = "<H6>", tag_close = "</H6>";
        break;
      case 'i': case 'I':
        if (!PL_strncasecmp ("INDENT>", old, 7))
        tag_open = "<UL>", tag_close = "</UL>";
        else if (!PL_strncasecmp ("INDENTRIGHT>", old, 12))
        tag_open = 0, tag_close = 0;
/*        else if (!enriched_p &&
               !PL_strncasecmp ("ISO-8859-", old, 9))
        tag_open = 0, tag_close = 0; */
        else if (!PL_strncasecmp ("ITALIC>", old, 7))
        tag_open = "<I>", tag_close = "</I>";
        break;
      case 'l': case 'L':
        if (!enriched_p &&
          !PL_strncasecmp ("LT>", old, 3))
        tag_open = "&lt;", tag_close = 0;
        break;
      case 'n': case 'N':
        if (!enriched_p &&
          !PL_strncasecmp ("NL>", old, 3))
        tag_open = "<BR>", tag_close = 0;
        if (enriched_p &&
          !PL_strncasecmp ("NOFILL>", old, 7))
        tag_open = "<NOBR>", tag_close = "</NOBR>";
/*        else if (!enriched_p &&
               !PL_strncasecmp ("NO-OP>", old, 6))
        tag_open = 0, tag_close = 0; */
/*        else if (!enriched_p &&
               !PL_strncasecmp ("NP>", old, 3))
        tag_open = 0, tag_close = 0; */
        break;
      case 'o': case 'O':
        if (!enriched_p &&
          !PL_strncasecmp ("OUTDENT>", old, 8))
        tag_open = 0, tag_close = 0;
        else if (!enriched_p &&
             !PL_strncasecmp ("OUTDENTRIGHT>", old, 13))
        tag_open = 0, tag_close = 0;
        break;
      case 'p': case 'P':
        if (enriched_p &&
          !PL_strncasecmp ("PARAM>", old, 6))
        tag_open = "<!-- ", tag_close = " -->";
        else if (!enriched_p &&
             !PL_strncasecmp ("PARAGRAPH>", old, 10))
        tag_open = "<P>", tag_close = 0;
        break;
      case 's': case 'S':
        if (!enriched_p &&
          !PL_strncasecmp ("SAMEPAGE>", old, 9))
        tag_open = 0, tag_close = 0;
        else if (!enriched_p &&
             !PL_strncasecmp ("SIGNATURE>", old, 10))
        tag_open = "<I><FONT SIZE=\"-1\">", tag_close = "</FONT></I>";
        else if (!PL_strncasecmp ("SMALLER>", old, 8))
        tag_open = "<FONT SIZE=\"-1\">", tag_close = "</FONT>";
        else if (!enriched_p &&
             !PL_strncasecmp ("SUBSCRIPT>", old, 10))
        tag_open = "<SUB>", tag_close = "</SUB>";
        else if (!enriched_p &&
             !PL_strncasecmp ("SUPERSCRIPT>", old, 12))
        tag_open = "<SUP>", tag_close = "</SUP>";
        break;
      case 'u': case 'U':
        if (!PL_strncasecmp ("UNDERLINE>", old, 10))
        tag_open = "<U>", tag_close = "</U>";
/*        else if (!enriched_p &&
             !PL_strncasecmp ("US-ASCII>", old, 10))
        tag_open = 0, tag_close = 0; */
        break;
      case 'v': case 'V':
        if (enriched_p &&
          !PL_strncasecmp ("VERBATIM>", old, 9))
        tag_open = "<PRE>", tag_close = "</PRE>";
        break;
      }

      if (this_start[1] == '/')
      {
        if (tag_close) PL_strncpyz (out, tag_close, outlen);
        addedlen = strlen (out);
        outlen -= addedlen;
        out += addedlen;
      }
      else
      {
        if (tag_open) PL_strncpyz (out, tag_open, outlen);
        addedlen = strlen (out);
        outlen -= addedlen;
        out += addedlen;
      }
    }

    /* now go around again */
    last_end = this_end;
    this_start = last_end;
  }
  *out = 0;

  return output_fn (*obufferP, out - *obufferP, closure);
}
示例#3
0
int main(int argc, char* argv[])
{
  int i, j, k, l;

  printf("\n");
  printf("#include \"common.h\"\n"
         "#include \"shapeset.h\"\n"
         "#include \"shapeset_l2_all.h\"\n"
         "#include \"shapeset_common.h\"\n\n");


  printf("//// triangle legendre shapeset /////////////////////////////////////////////////////////////////\n\n\n");

  for (i = 0; i <= 10; i++)
  {
    for (j = i; j <= 10 - i; j++)
    {
      output_fn(i, j);
      if (i != j) output_fn(j, i);
    }
  }
/////////////////////////////////////////////////////////////////////////

  printf("static Shapeset::shape_fn_t leg_tri_fn[] = \n"
         "{\n  "  );
  int r = 0;
  for (i = 0; i <= 10; i++)
    for (j = i; j <= 10 - i; j++)
    {
      printf("leg_tri_l%d_l%d,   ", i, j);
      r++;
      if (r % 5 == 0) printf("\n  ");
      if (i != j)
      {
        printf("leg_tri_l%d_l%d,   ", j, i);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }

  printf("\n};\n");

  printf("static Shapeset::shape_fn_t leg_tri_fn_dx[] =  \n"
         "{\n  "  );
  r = 0;
  for (i = 0; i <= 10; i++)
    for (j = i; j <= 10 - i; j++)
    {
      printf("leg_tri_l%d_l%dx,   ", i, j);
      r++;
      if (r % 5 == 0) printf("\n  ");
      if (i != j)
      {
        printf("leg_tri_l%d_l%dx,   ", j, i);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  printf("\n};\n");

  printf("static Shapeset::shape_fn_t leg_tri_fn_dy[] =  \n"
         "{\n  "  );
  r = 0;
  for (i = 0; i <= 10; i++)
    for (j = i; j <= 10 - i; j++)
    {
      printf("leg_tri_l%d_l%dy,   ", i, j);
      r++;
      if (r % 5 == 0) printf("\n  ");
      if (i != j)
      {
        printf("leg_tri_l%d_l%dy,   ", j, i);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  printf("\n};\n");


//////////////////////////////////////////////////////////////////////////////////////////////

  printf("Shapeset::shape_fn_t* leg_tri_shape_fn_table[1]     = { leg_tri_fn };\n");

  printf("Shapeset::shape_fn_t* leg_tri_shape_fn_table_dx[1]  = { leg_tri_fn_dx };\n");

  printf("Shapeset::shape_fn_t* leg_tri_shape_fn_table_dy[1]  = { leg_tri_fn_dy };\n");

  printf("\n");
//////////////////////////////////////////////////////////////////////////////////////////////

  int tem[11] = {0, 21, 38, 51, 60, 65, 66, 66, 66, 66, 66};

  for (int p = 0; p <= 10; p++)
  {
    printf("static int qb_%d[] = { ", p);
    for (k = 0; k <= p; k++)
    {
      for (l = k; l <= p - k; l++)
      {
        if (l > k) printf("%d, %d, ", tem[k] + 1 + 2*(l - k - 1), tem[k] + 1 + 2*(l - k - 1) + 1);
        else printf("%d, ", tem[k]);
      }
    }
    printf("};\n");
  }
  printf("\n\n");


  printf("int* leg_tri_bubble_indices[11] =\n{\n");
  for (i = 0; i <= 10; i++)
  {
      printf(" qb_%d,  ", i);
  }
  printf("};\n\n");


  printf("int leg_tri_bubble_count[11] =\n{\n");
  for (i = 0; i <= 10; i++)
  {
    printf("  %d,", (i+1) * (i+2) / 2);
  }
  printf("};\n\n");

  printf("int leg_tri_vertex_indices[4] = { -1, -1, -1, -1 };\n\n");
  printf("static int leg_tri_edge_indices_0[22] =  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1  };\n"
         "static int leg_tri_edge_indices_1[22] =  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1  };\n"
         "static int leg_tri_edge_indices_2[22] =  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1  };\n"
         "static int leg_tri_edge_indices_3[22] =  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1  };\n"
  );
  printf("\n\n");

  printf("int* leg_tri_edge_indices[4] = \n"
         "{\n"
         "  leg_tri_edge_indices_0,\n"
         "  leg_tri_edge_indices_1,\n"
         "  leg_tri_edge_indices_2,\n"
         "  leg_tri_edge_indices_3\n"
         "};\n"
 );

 printf("\n\n");


 printf("int leg_tri_index_to_order[] = {\n");
 r = 0;
 for (i = 0; i <= 10; i++)
   for (j = i; j <= 10 - i; j++)
 {
   printf("   %d,", i + j);
   r++;
   if (r % 10 == 0) printf("\n");
   if (i != j)
   {
     printf("   %d,", j + i);
     r++;
     if (r % 10 == 0) printf("\n");
   }
 }
 printf("\n};\n");

  printf("\n\n");


 return 0;

}
示例#4
0
int main(int argc, char* argv[])
{
  int i, j, k, l;

  printf("\n");
  printf("#include \"common.h\"\n"
         "#include \"shapeset.h\"\n"
         "#include \"shapeset_common.h\"\n\n");


  printf("//// quad simple lobatto shapeset /////////////////////////////////////////////////////////////////\n\n\n");

  for (i = 0; i <= 10; i++)
    for (j = 0; j <= 10; j++)
      output_fn(i, j);

/////////////////////////////////////////////////////////////////////////

  printf("static Shapeset::shape_fn_t simple_quad_fn[] = \n"
         "{\n  "
  );
  int r = 0;
  for (i = 0; i <= 10; i++)
  {

    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
      {
        printf("simple_quad_l%d_l%d_0, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
        printf("simple_quad_l%d_l%d_1, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
      else
      {
        printf("simple_quad_l%d_l%d,   ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  }
  printf("\n};\n");

  printf("static Shapeset::shape_fn_t simple_quad_fn_dx[] =  \n"
         "{\n  "
  );
  r = 0;
  for (i = 0; i <= 10; i++)
  {

    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
      {
        printf("simple_quad_l%d_l%dx_0, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
        printf("simple_quad_l%d_l%dx_1, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
      else
      {
        printf("simple_quad_l%d_l%dx,   ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  }
  printf("\n};\n");

  printf("static Shapeset::shape_fn_t simple_quad_fn_dy[] =  \n"
         "{\n  "
  );
  r = 0;
  for (i = 0; i <= 10; i++)
  {

    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
      {
        printf("simple_quad_l%d_l%dy_0, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
        printf("simple_quad_l%d_l%dy_1, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
      else
      {
        printf("simple_quad_l%d_l%dy,   ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  }
  printf("\n};\n");

  printf("static Shapeset::shape_fn_t simple_quad_fn_dxx[] =  \n"
         "{\n  "
  );
  r = 0;
  for (i = 0; i <= 10; i++)
  {

    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
      {
        printf("simple_quad_l%d_l%dxx_0, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
        printf("simple_quad_l%d_l%dxx_1, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
      else
      {
        printf("simple_quad_l%d_l%dxx,   ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  }
  printf("\n};\n");

  printf("static Shapeset::shape_fn_t simple_quad_fn_dxy[] =  \n"
         "{\n  "
  );
  r = 0;
  for (i = 0; i <= 10; i++)
  {

    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
      {
        printf("simple_quad_l%d_l%dxy_0, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
        printf("simple_quad_l%d_l%dxy_1, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
      else
      {
        printf("simple_quad_l%d_l%dxy,   ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  }
  printf("\n};\n");

  printf("static Shapeset::shape_fn_t simple_quad_fn_dyy[] =  \n"
         "{\n  "
  );
  r = 0;
  for (i = 0; i <= 10; i++)
  {

    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
      {
        printf("simple_quad_l%d_l%dyy_0, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
        printf("simple_quad_l%d_l%dyy_1, ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
      else
      {
        printf("simple_quad_l%d_l%dyy,   ", i, j);
        r++;
        if (r % 5 == 0) printf("\n  ");
      }
    }
  }
  printf("\n};\n");

//////////////////////////////////////////////////////////////////////////////////////////////

  printf("Shapeset::shape_fn_t* simple_quad_shape_fn_table[1]     = { simple_quad_fn };\n");

  printf("Shapeset::shape_fn_t* simple_quad_shape_fn_table_dx[1]  = { simple_quad_fn_dx };\n");

  printf("Shapeset::shape_fn_t* simple_quad_shape_fn_table_dy[1]  = { simple_quad_fn_dy };\n");

  printf("Shapeset::shape_fn_t* simple_quad_shape_fn_table_dxx[1] = { simple_quad_fn_dxx };\n");

  printf("Shapeset::shape_fn_t* simple_quad_shape_fn_table_dxy[1] = { simple_quad_fn_dxy };\n");

  printf("Shapeset::shape_fn_t* simple_quad_shape_fn_table_dyy[1] = { simple_quad_fn_dyy };\n");

  printf("\n");
//////////////////////////////////////////////////////////////////////////////////////////////

  int vol[11] = {0, 0, 0, 13, 24, 37, 48, 61, 72, 85, 96};

  for (i = 2; i <= 10; i++)
  {
    for (j = 2; j <= 10; j++)
    {
      printf("static int qb_%d_%d[] = { ", i, j);
      for (k = 2; k <= i; k++)
      {
        for (l = 2; l <= j; l++)
        {
          printf("%d,", 30 + vol[k] + l);
        }
      }
      printf("};\n");
    }
  }
  printf("\n\n");


  printf("#define NULL16 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,  NULL, NULL, NULL, NULL, NULL\n\n");

  printf("int* simple_quad_bubble_indices[] =\n{\n");
  printf("  NULL, NULL, NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,     NULL, NULL, NULL, NULL, NULL, NULL16,\n");
  printf("  NULL, NULL, NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,     NULL, NULL, NULL, NULL, NULL, NULL16,\n");
  for (i = 2; i <= 10; i++)
  {
    printf("  NULL, NULL, ");
    for (j = 2; j <= 10; j++)
    {
      if (j == 10) printf("qb_%d_%d, ", i, j);
      else if (i == 10) printf("qb_%d_%d, ", i, j);
      else printf("qb_%d_%d,  ", i, j);
    }
    printf(" NULL, NULL, NULL, NULL, NULL, NULL16,\n");
  }
  printf("};\n\n");


  printf("#define zero16  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n\n");

  printf("int simple_quad_bubble_count[] =\n{\n");
  printf("  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, zero16,\n");
  printf("  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, zero16,\n");
  for (j = 2; j <= 10; j++)
  {
    printf("  0,  0,");
    for (i = 2; i <= 10; i++)
    {
      if ((i-1) * (j-1) > 9) printf(" %d,", (i-1) * (j-1));
      else printf("  %d,", (i-1) * (j-1));
    }
    printf("  0,  0,  0,  0,  0, zero16,\n");
  }
  printf("};\n\n");

  printf("int simple_quad_vertex_indices[4] = { 0, 15, 16, 1 };\n\n");
  printf("static int simple_quad_edge_indices_0[22] =  {  0, 15, 15, 0,  30, 30, 41, 42, 54, 54, 65, 66, 78, 78, 89, 90, 102, 102, 113, 114, 126, 126 };\n"
         "static int simple_quad_edge_indices_1[22] =  { 15, 16, 16, 15, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26,   26,  27,  28,  29,  29 };\n"
         "static int simple_quad_edge_indices_2[22] =  { 16,  1,  1, 16, 31, 31, 43, 44, 55, 55, 67, 68, 79, 79, 91, 92, 103, 103, 115, 116, 127, 127 };\n"
         "static int simple_quad_edge_indices_3[22] =  {  1,  0,  0,  1,  2,  2,  3,  4,  5,  5,  6,  7,  8,  8,  9, 10,  11,  11,  12,  13,  14,  14 };\n"
  );
  printf("\n\n");

  printf("int* simple_quad_edge_indices[4] = \n"
         "{\n"
         "  simple_quad_edge_indices_0,\n"
         "  simple_quad_edge_indices_1,\n"
         "  simple_quad_edge_indices_2,\n"
         "  simple_quad_edge_indices_3\n"
         "};\n"
 );

 printf("\n\n");

 printf("#define oo make_quad_order\n"
        "#define XX(a,b) oo(a,b), oo(a,b)\n\n");

 #define max(a,b) (((a) > (b)) ? (a) : (b))

 printf("int simple_quad_index_to_order[] = {\n");
  for (i = 0; i <= 10; i++)
  {
    for (j = 0; j <= 10; j++)
    {
      if (((i == 0 || i == 1) && (j & 1) && (j != 1)) || ((j == 0 || j == 1) && (i & 1) && (i != 1)))
        printf("  XX(%d,%d), ", max(i,1), max(j,1));
      else {
        if (i == 10) printf("  oo(%d,%d),", max(i,1), max(j,1));
        else printf("  oo(%d,%d), ", max(i,1), max(j,1));
      }
    }
    printf("\n");
  }
  printf("};\n");

  printf("\n\n");


 return 0;

}