home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / DIFF15.ZIP / IO.C < prev    next >
C/C++ Source or Header  |  1990-11-29  |  18KB  |  634 lines

  1. /* File I/O for GNU DIFF.
  2.    Copyright (C) 1988, 1989 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU DIFF.
  5.  
  6. GNU DIFF is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GNU DIFF is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU DIFF; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "diff.h"
  21.  
  22. /* Rotate a value n bits to the left. */
  23. #define UINT_BIT (sizeof (unsigned) * CHAR_BIT)
  24. #define ROL(v, n) ((v) << (n) | (v) >> UINT_BIT - (n))
  25.  
  26. /* Given a hash value and a new character, return a new hash value. */
  27. #define HASH(h, c) ((c) + ROL (h, 7))
  28.  
  29. /* Current file under consideration. */
  30. struct file_data *current;
  31.  
  32. /* Check for binary files and compare them for exact identity.  */
  33.  
  34. /* Return 1 if BUF contains a non text character.
  35.    SIZE is the number of characters in BUF.  */
  36.  
  37. static int
  38. binary_file_p (buf, size)
  39.      char *buf;
  40.      int size;
  41. {
  42.   static const char textchar[] = {
  43.     /* ISO 8859 */
  44.     0, 0, 0, 0, 0, 0, 0, 0,
  45.     0, 1, 1, 1, 1, 1, 0, 0,
  46.     0, 0, 0, 0, 0, 0, 0, 0,
  47.     0, 0, 0, 0, 0, 0, 0, 0,
  48.     1, 1, 1, 1, 1, 1, 1, 1,
  49.     1, 1, 1, 1, 1, 1, 1, 1,
  50.     1, 1, 1, 1, 1, 1, 1, 1,
  51.     1, 1, 1, 1, 1, 1, 1, 1,
  52.     1, 1, 1, 1, 1, 1, 1, 1,
  53.     1, 1, 1, 1, 1, 1, 1, 1,
  54.     1, 1, 1, 1, 1, 1, 1, 1,
  55.     1, 1, 1, 1, 1, 1, 1, 1,
  56.     1, 1, 1, 1, 1, 1, 1, 1,
  57.     1, 1, 1, 1, 1, 1, 1, 1,
  58.     1, 1, 1, 1, 1, 1, 1, 1,
  59.     1, 1, 1, 1, 1, 1, 1, 0,
  60.     0, 0, 0, 0, 0, 0, 0, 0,
  61.     0, 0, 0, 0, 0, 0, 0, 0,
  62.     0, 0, 0, 0, 0, 0, 0, 0,
  63.     0, 0, 0, 0, 0, 0, 0, 0,
  64.     1, 1, 1, 1, 1, 1, 1, 1,
  65.     1, 1, 1, 1, 1, 1, 1, 1,
  66.     1, 1, 1, 1, 1, 1, 1, 1,
  67.     1, 1, 1, 1, 1, 1, 1, 1,
  68.     1, 1, 1, 1, 1, 1, 1, 1,
  69.     1, 1, 1, 1, 1, 1, 1, 1,
  70.     1, 1, 1, 1, 1, 1, 1, 1,
  71.     1, 1, 1, 1, 1, 1, 1, 1,
  72.     1, 1, 1, 1, 1, 1, 1, 1,
  73.     1, 1, 1, 1, 1, 1, 1, 1,
  74.     1, 1, 1, 1, 1, 1, 1, 1,
  75.     1, 1, 1, 1, 1, 1, 1, 1,
  76.   };
  77.   while (--size >= 0)
  78.     if (!textchar[*buf++ & 0377])
  79.       return 1;
  80.   return 0;
  81. }
  82.  
  83. int binary_file_threshold = 512;
  84.  
  85. /* Slurp the current file completely into core.
  86.    Return nonzero if it appears to be a binary file.  */
  87.  
  88. static int
  89. slurp ()
  90. {
  91.   /* If we have a nonexistent file at this stage, treat it as empty.  */
  92.   if (current->desc < 0)
  93.     {
  94.       current->bufsize = 0;
  95.       current->buffered_chars = 0;
  96.       current->buffer = 0;
  97.     }
  98.   /* If it's a regular file, we can just get the size out of the stat
  99.      block and slurp it in all at once. */
  100.   /* In all cases, we leave room in the buffer for 2 extra chars
  101.      beyond those that current->bufsize describes:
  102.      one for a newline (in case the text does not end with one)
  103.      and one for a sentinel in find_identical_ends.  */
  104.   else if ((current->stat.st_mode & S_IFMT) == S_IFREG)
  105.     {
  106.       current->bufsize = current->stat.st_size;
  107.       current->buffer = (char *) xmalloc (current->bufsize + 2);
  108.       current->buffered_chars
  109.     = read (current->desc, current->buffer, current->bufsize);
  110.       if (current->buffered_chars < 0)
  111.     pfatal_with_name (current->name);
  112.     }
  113.   else
  114.     {
  115.       int cc;
  116.  
  117.       current->bufsize = 4096;
  118.       current->buffer = (char *) xmalloc (current->bufsize + 2);
  119.       current->buffered_chars = 0;
  120.       
  121.       /* Not a regular file; read it in a little at a time, growing the
  122.      buffer as necessary. */
  123.       while ((cc = read (current->desc,
  124.              current->buffer + current->buffered_chars,
  125.              current->bufsize - current->buffered_chars))
  126.          > 0)
  127.     {
  128.       current->buffered_chars += cc;
  129.       if (current->buffered_chars == current->bufsize)
  130.         {
  131.           current->bufsize = current->bufsize * 2;
  132.           current->buffer = (char *) xrealloc (current->buffer,
  133.                            current->bufsize + 2);
  134.         }
  135.     }
  136.       if (cc < 0)
  137.     pfatal_with_name (current->name);
  138.     }
  139.   
  140.   /* Check first part of file to see if it's a binary file.  */
  141.   if (! always_text_flag
  142.       && binary_file_p (current->buffer,
  143.             min (current->buffered_chars, binary_file_threshold)))
  144.     return 1;
  145.  
  146.   /* If not binary, make sure text ends in a newline,
  147.      but remember that we had to add one unless -B is in effect.  */
  148.   if (current->buffered_chars > 0
  149.       && current->buffer[current->buffered_chars - 1] != '\n')
  150.     {
  151.       current->missing_newline = !ignore_blank_lines_flag;
  152.       current->buffer[current->buffered_chars++] = '\n';
  153.     }
  154.   else
  155.     current->missing_newline = 0;
  156.  
  157.   /* Don't use uninitialized storage. */
  158.   if (current->buffer != 0)
  159.     current->buffer[current->buffered_chars] = '\0';
  160.  
  161.   return 0;
  162. }
  163.  
  164. /* Split the file into lines, simultaneously computing the hash codes for
  165.    each line. */
  166.  
  167. void
  168. find_and_hash_each_line ()
  169. {
  170.   unsigned h;
  171.   int i;
  172.   unsigned char *p = (unsigned char *) current->prefix_end, *ip, c;
  173.  
  174.   /* Attempt to get a good initial guess as to the number of lines. */
  175.   current->linbufsize = current->buffered_chars / 50 + 5;
  176.   current->linbuf
  177.     = (struct line_def *) xmalloc (current->linbufsize * sizeof (struct line_def));
  178.  
  179.   if (function_regexp || output_style == OUTPUT_IFDEF)
  180.     {
  181.       /* If the -C, -D or -F option is used, we need to find the lines
  182.      of the matching prefix.  At least we will need to find the last few,
  183.      but since we don't know how many, it's easiest to find them all.
  184.      If -D is specified, we need all the lines of the first file.  */
  185.       current->buffered_lines = 0;
  186.       p = (unsigned char *) current->buffer;
  187.     }
  188.   else
  189.     {
  190.       /* Skip the identical prefixes, except be prepared to handle context.
  191.      In fact, handle 1 more preceding line than the context says,
  192.      in case shift_boundaries moves things backwards in this file.  */
  193.       current->buffered_lines = current->prefix_lines - context - 1;
  194.       if (current->buffered_lines < 0)
  195.     current->buffered_lines = 0;
  196.       for (i = 0; i < context + 1; ++i)
  197.     /* Unless we are at the beginning, */
  198.     if ((char *) p != current->buffer)
  199.       /* Back up at least 1 char until at the start of a line.  */
  200.       while ((char *) --p != current->buffer && p[-1] != '\n')
  201.         ;
  202.     }
  203.  
  204.   while ((char *) p < current->suffix_begin)
  205.     {
  206.       h = 0;
  207.       ip = p;
  208.  
  209.       if (current->prefix_end <= (char *) p)
  210.     {
  211.       /* Hash this line until we find a newline. */
  212.       if (ignore_case_flag)
  213.         {
  214.           if (ignore_all_space_flag)
  215.         while ((c = *p) != '\n')
  216.           {
  217.             if (! isspace (c))
  218.               if (isupper (c))
  219.             h = HASH (h, tolower (c));
  220.               else
  221.             h = HASH (h, c);
  222.             ++p;
  223.           }
  224.           else if (ignore_space_change_flag)
  225.  
  226.         while ((c = *p) != '\n')
  227.           {
  228.             if (c == ' ' || c == '\t')
  229.               {
  230.             while ((c = *p) == ' ' || c == '\t')
  231.               ++p;
  232.             if (c == '\n')
  233.               break;
  234.             h = HASH (h, ' ');
  235.               }
  236.             /* C is now the first non-space.  */
  237.             if (isupper (c))
  238.               h = HASH (h, tolower (c));
  239.             else
  240.               h = HASH (h, c);
  241.             ++p;
  242.           }
  243.           else
  244.         while ((c = *p) != '\n')
  245.           {
  246.             if (isupper (c))
  247.               h = HASH (h, tolower (c));
  248.             else
  249.               h = HASH (h, c);
  250.             ++p;
  251.           }
  252.         }
  253.       else
  254.         {
  255.           if (ignore_all_space_flag)
  256.         while ((c = *p) != '\n')
  257.           {
  258.             if (! isspace (c))
  259.               h = HASH (h, c);
  260.             ++p;
  261.           }
  262.           else if (ignore_space_change_flag)
  263.         while ((c = *p) != '\n')
  264.           {
  265.             if (c == ' ' || c == '\t')
  266.               {
  267.             while ((c = *p) == ' ' || c == '\t')
  268.               ++p;
  269.             if (c == '\n')
  270.               break;
  271.             h = HASH (h, ' ');
  272.               }
  273.             /* C is not the first non-space.  */
  274.             h = HASH (h, c);
  275.             ++p;
  276.           }
  277.           else
  278.         while ((c = *p) != '\n')
  279.           {
  280.             h = HASH (h, c);
  281.             ++p;
  282.           }
  283.         }
  284.     }
  285.       else
  286.     /* This line is part of the matching prefix,
  287.        so we don't need to hash it.  */
  288.     while (*p != '\n')
  289.       ++p;
  290.       
  291.       /* Maybe increase the size of the line table. */
  292.       if (current->buffered_lines >= current->linbufsize)
  293.     {
  294.       while (current->buffered_lines >= current->linbufsize)
  295.         current->linbufsize *= 2;
  296.       current->linbuf
  297.         = (struct line_def *) xrealloc (current->linbuf,
  298.                         current->linbufsize
  299.                         * sizeof (struct line_def));
  300.     }
  301.       current->linbuf[current->buffered_lines].text = (char *) ip;
  302.       current->linbuf[current->buffered_lines].length = p - ip + 1;
  303.       current->linbuf[current->buffered_lines].hash = h;
  304.       ++current->buffered_lines;
  305.       ++p;
  306.     }
  307.  
  308.   i = 0;
  309.   while ((i < context || output_style == OUTPUT_IFDEF)
  310.      && (char *) p < current->buffer + current->buffered_chars)
  311.     {
  312.       ip = p;
  313.       while (*p++ != '\n')
  314.     ;
  315.       /* Maybe increase the size of the line table. */
  316.       if (current->buffered_lines >= current->linbufsize)
  317.     {
  318.       while (current->buffered_lines >= current->linbufsize)
  319.         current->linbufsize *= 2;
  320.       current->linbuf
  321.         = (struct line_def *) xrealloc (current->linbuf,
  322.                         current->linbufsize
  323.                         * sizeof (struct line_def));
  324.     }
  325.       current->linbuf[current->buffered_lines].text = (char *) ip;
  326.       current->linbuf[current->buffered_lines].length = p - ip;
  327.       current->linbuf[current->buffered_lines].hash = 0;
  328.       ++current->buffered_lines;
  329.       ++i;
  330.     }
  331.  
  332.   if (ROBUST_OUTPUT_STYLE (output_style)
  333.       && current->missing_newline
  334.       && current->suffix_begin == current->buffer + current->buffered_chars)
  335.     --current->linbuf[current->buffered_lines - 1].length;
  336. }
  337.  
  338. /* Given a vector of two file_data objects, find the identical
  339.    prefixes and suffixes of each object. */
  340.  
  341. static void
  342. find_identical_ends (filevec)
  343.      struct file_data filevec[];
  344. {
  345.   char *p0, *p1, *end0, *beg0;
  346.   int lines;
  347.  
  348.   if (filevec[0].buffered_chars == 0 || filevec[1].buffered_chars == 0)
  349.     {
  350.       filevec[0].prefix_end = filevec[0].buffer;
  351.       filevec[1].prefix_end = filevec[1].buffer;
  352.       filevec[0].prefix_lines = filevec[1].prefix_lines = 0;
  353.       filevec[0].suffix_begin = filevec[0].buffer + filevec[0].buffered_chars;
  354.       filevec[1].suffix_begin = filevec[1].buffer + filevec[1].buffered_chars;
  355.       filevec[0].suffix_lines = filevec[1].suffix_lines = 0;
  356.       return;
  357.     }
  358.  
  359.   /* Find identical prefix.  */
  360.  
  361.   p0 = filevec[0].buffer;
  362.   p1 = filevec[1].buffer;
  363.   lines = 0;
  364.  
  365.   /* Insert end "sentinels", in this case characters that are guaranteed
  366.      to make the equality test false, and thus terminate the loop.  */
  367.  
  368.   if (filevec[0].buffered_chars < filevec[1].buffered_chars)
  369.     p0[filevec[0].buffered_chars] = ~p1[filevec[0].buffered_chars];
  370.   else
  371.     p1[filevec[1].buffered_chars] = ~p0[filevec[1].buffered_chars];
  372.  
  373.   /* Loop until first mismatch, or to the sentinel characters.  */
  374.   while (1)
  375.     {
  376.       char c = *p0++;
  377.       if (c != *p1++)
  378.     break;
  379.       if (c == '\n')
  380.     ++lines;
  381.     }
  382.  
  383.   /* Don't count missing newline as part of prefix in RCS mode. */
  384.   if (ROBUST_OUTPUT_STYLE (output_style)
  385.       && ((filevec[0].missing_newline
  386.        && p0 - filevec[0].buffer > filevec[0].buffered_chars)
  387.       ||
  388.       (filevec[1].missing_newline
  389.        && p1 - filevec[1].buffer > filevec[1].buffered_chars)))
  390.     --p0, --p1, --lines;
  391.  
  392.   /* If the sentinel was passed, and lengths are equal, the
  393.      files are identical.  */
  394.   if (p0 - filevec[0].buffer > filevec[0].buffered_chars
  395.       && filevec[0].buffered_chars == filevec[1].buffered_chars)
  396.     {
  397.       filevec[0].prefix_end = p0 - 1;
  398.       filevec[1].prefix_end = p1 - 1;
  399.       filevec[0].prefix_lines = filevec[1].prefix_lines = lines;
  400.       filevec[0].suffix_begin = filevec[0].buffer;
  401.       filevec[1].suffix_begin = filevec[1].buffer;
  402.       filevec[0].suffix_lines = filevec[1].suffix_lines = lines;
  403.       return;
  404.     }
  405.  
  406.   /* Point at first nonmatching characters.  */
  407.   --p0, --p1;
  408.  
  409.   /* Skip back to last line-beginning in the prefix.  */
  410.   while (p0 != filevec[0].buffer && p0[-1] != '\n')
  411.     --p0, --p1;
  412.  
  413.   /* Record the prefix.  */
  414.   filevec[0].prefix_end = p0;
  415.   filevec[1].prefix_end = p1;
  416.   filevec[0].prefix_lines = filevec[1].prefix_lines = lines;
  417.   
  418.   /* Find identical suffix.  */
  419.  
  420.   /* P0 and P1 point beyond the last chars not yet compared.  */
  421.   p0 = filevec[0].buffer + filevec[0].buffered_chars;
  422.   p1 = filevec[1].buffer + filevec[1].buffered_chars;
  423.   lines = 0;
  424.  
  425.   if (! ROBUST_OUTPUT_STYLE (output_style)
  426.       || filevec[0].missing_newline == filevec[1].missing_newline)
  427.     {
  428.       end0 = p0;        /* Addr of last char in file 0.  */
  429.  
  430.       /* Get value of P0 at which we should stop scanning backward:
  431.      this is when either P0 or P1 points just past the last char
  432.      of the identical prefix.  */
  433.       if (filevec[0].buffered_chars < filevec[1].buffered_chars)
  434.     beg0 = filevec[0].prefix_end;
  435.       else
  436.     /* Figure out where P0 will be when P1 is at the end of the prefix.
  437.        Thus we only need to test P0.  */
  438.     beg0 = (filevec[0].prefix_end
  439.         + filevec[0].buffered_chars - filevec[1].buffered_chars);
  440.  
  441.       /* Scan back until chars don't match or we reach that point.  */
  442.       while (p0 != beg0)
  443.     {
  444.       char c = *--p0;
  445.       if (c != *--p1)
  446.         {
  447.           /* Point at the first char of the matching suffix.  */
  448.           ++p0, ++p1;
  449.           break;
  450.         }
  451.       if (c == '\n')
  452.         ++lines;
  453.     }
  454.  
  455.       /* Are we at a line-beginning in both files?  */
  456.       if (p0 != end0
  457.       && !((p0 == filevec[0].buffer || p0[-1] == '\n')
  458.            &&
  459.            (p1 == filevec[1].buffer || p1[-1] == '\n')))
  460.     {
  461.       /* No.  We counted one line too many.  */
  462.       --lines;
  463.       /* Advance to next place that is a line-beginning in both files.  */
  464.       do
  465.         {
  466.           ++p0, ++p1;
  467.         }
  468.       while (p0 != end0 && p0[-1] != '\n');
  469.     }
  470.     }
  471.  
  472.   /* Record the suffix.  */
  473.   filevec[0].suffix_begin = p0;
  474.   filevec[1].suffix_begin = p1;
  475.   filevec[0].suffix_lines = filevec[1].suffix_lines = lines;
  476. }
  477.  
  478. /* Lines are put into equivalence classes (of lines that match in line_cmp).
  479.    Each equivalence class is represented by one of these structures,
  480.    but only while the classes are being computed.
  481.    Afterward, each class is represented by a number.  */
  482. struct equivclass
  483. {
  484.   struct equivclass *next;    /* Next item in this bucket. */
  485.   struct line_def line;    /* A line that fits this class. */
  486. };
  487.  
  488. /* Hash-table: array of buckets, each being a chain of equivalence classes.  */
  489. static struct equivclass **buckets;
  490.   
  491. /* Size of the bucket array. */
  492. static int nbuckets;
  493.  
  494. /* Array in which the equivalence classes are allocated.
  495.    The bucket-chains go through the elements in this array.
  496.    The number of an equivalence class is its index in this array.  */
  497. static struct equivclass *equivs;
  498.  
  499. /* Index of first free element in the array `equivs'.  */
  500. static int equivs_index;
  501.  
  502. /* Size allocated to the array `equivs'.  */
  503. static int equivs_alloc;
  504.  
  505. /* Largest primes less than some power of two, for nbuckets.  Values range
  506.    from useful to preposterous.  If one of these numbers isn't prime
  507.    after all, don't blame it on me, blame it on primes (6) . . . */
  508. static int primes[] =
  509. {
  510.   509,
  511.   1021,
  512.   2039,
  513.   4093,
  514.   8191,
  515.   16381,
  516.   32749,
  517.   65521,
  518.   131071,
  519.   262139,
  520.   524287,
  521.   1048573,
  522.   2097143,
  523.   4194301,
  524.   8388593,
  525.   16777213,
  526.   33554393,
  527.   67108859,            /* Preposterously large . . . */
  528.   -1
  529. };
  530.  
  531. /* Index of current nbuckets in primes. */
  532. static int primes_index;
  533.  
  534. /* Find the equiv class associated with line N of the current file.  */
  535.  
  536. static int
  537. find_equiv_class (n)
  538.      int n;
  539. {
  540.   int bucket;
  541.   struct equivclass *b, *p = NULL;
  542.  
  543.   /* Equivalence class 0 is permanently allocated to lines that were
  544.      not hashed because they were parts of identical prefixes or
  545.      suffixes. */
  546.   if (n < current->prefix_lines
  547.       || current->linbuf[n].text >= current->suffix_begin)
  548.     return 0;
  549.  
  550.   /* Check through the appropriate bucket to see if there isn't already
  551.      an equivalence class for this line. */
  552.   bucket = current->linbuf[n].hash % nbuckets;
  553.   b = buckets[bucket];
  554.   while (b)
  555.     {
  556.       if (b->line.hash == current->linbuf[n].hash
  557.       && (b->line.length == current->linbuf[n].length
  558.           /* Lines of different lengths can match with certain options.  */
  559.           || length_varies)
  560.       && !line_cmp (&b->line, ¤t->linbuf[n]))
  561.     return b - equivs;
  562.       p = b, b = b->next;
  563.     }
  564.  
  565.   /* Create a new equivalence class in this bucket. */
  566.  
  567.   p = &equivs[equivs_index++];
  568.   p->next = buckets[bucket];
  569.   buckets[bucket] = p;
  570.   p->line = current->linbuf[n];
  571.  
  572.   return equivs_index - 1;
  573. }
  574.  
  575. /* Given a vector of two file_data objects, read the file associated
  576.    with each one, and build the table of equivalence classes.
  577.    Return nonzero if either file appears to be a binary file.  */
  578.  
  579. int
  580. read_files (filevec)
  581.      struct file_data filevec[];
  582. {
  583.   int i, j;
  584.   int binary = 0;
  585.   int this_binary;
  586.  
  587.   current = &filevec[0];
  588.   binary = this_binary = slurp ();
  589.  
  590.   current = &filevec[1];
  591.   this_binary = slurp ();
  592.   if (binary || this_binary)
  593.     return 1;
  594.  
  595.   find_identical_ends (filevec);
  596.  
  597.   for (i = 0; i < 2; ++i)
  598.     {
  599.       current = &filevec[i];
  600.       find_and_hash_each_line ();
  601.     }
  602.  
  603.   /* This is guaranteed to be enough space.  */
  604.   equivs_alloc = filevec[0].buffered_lines + filevec[1].buffered_lines + 1;
  605.   equivs = (struct equivclass *) xmalloc (equivs_alloc * sizeof (struct equivclass));
  606.   /* Equivalence class 0 is permanently safe for lines that were not
  607.      hashed.  Real equivalence classes start at 1. */
  608.   equivs_index = 1;
  609.   
  610.   primes_index = 0;
  611.   while (primes[primes_index] < equivs_alloc / 3)
  612.     primes_index++;
  613.  
  614.   buckets = (struct equivclass **) xmalloc (primes[primes_index] * sizeof (struct equivclass *));
  615.   bzero (buckets, primes[primes_index] * sizeof (struct equivclass *));
  616.   nbuckets = primes[primes_index];
  617.  
  618.   for (i = 0; i < 2; ++i)
  619.     {
  620.       current = &filevec[i];
  621.       current->equivs
  622.     = (int *) xmalloc (current->buffered_lines * sizeof (int));
  623.       for (j = 0; j < current->buffered_lines; ++j)
  624.     current->equivs[j] = find_equiv_class (j);
  625.     }
  626.  
  627.   filevec[0].equiv_max = filevec[1].equiv_max = equivs_index;
  628.  
  629.   free (equivs);
  630.   free (buckets);
  631.  
  632.   return 0;
  633. }
  634.