home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
gnuish
/
gptx01.arc
/
patches
< prev
next >
Wrap
Text File
|
1990-09-24
|
29KB
|
974 lines
*** e:\tmp/RCSt1006052 Sat Sep 22 00:28:24 1990
--- gptx.c Sat Sep 22 00:20:50 1990
***************
*** 2,8 ****
Copyright (C) 1990 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, 1988.
! $Id: gptx.c 0.1 90/08/11 09:18:50 tho Exp $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 2,8 ----
Copyright (C) 1990 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, 1988.
! $Id: gptx.c 0.1.0.4 90/09/22 00:18:19 tho Exp $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 117,124 ****
typedef struct
{
! char *start; /* pointer to beginning of region */
! char *end; /* pointer to end + 1 of region */
}
BLOCK;
--- 117,124 ----
typedef struct
{
! char HUGE *start; /* pointer to beginning of region */
! char HUGE *end; /* pointer to end + 1 of region */
}
BLOCK;
***************
*** 186,192 ****
int *file_line_count; /* array of `total_line_count' values at end */
BLOCK text_buffer; /* file to study */
! char *text_buffer_maxend; /* allocated end of text_buffer */
/* SKIP_NON_WHITE used only for getting or skipping the reference. */
--- 186,192 ----
int *file_line_count; /* array of `total_line_count' values at end */
BLOCK text_buffer; /* file to study */
! char HUGE *text_buffer_maxend; /* allocated end of text_buffer */
/* SKIP_NON_WHITE used only for getting or skipping the reference. */
***************
*** 207,213 ****
if (word_regex_string) \
{ \
int count; \
! count = re_match (word_regex, cursor, limit - cursor, 0, NULL); \
cursor += count <= 0 ? 1 : count; \
} \
else if (word_fastmap[(unsigned char) *cursor]) \
--- 207,214 ----
if (word_regex_string) \
{ \
int count; \
! count = re_match (word_regex, cursor, \
! L_PDIFF(limit, cursor), ZERO, NULL); \
cursor += count <= 0 ? 1 : count; \
} \
else if (word_fastmap[(unsigned char) *cursor]) \
***************
*** 368,374 ****
--- 369,380 ----
if (pattern->allocated > pattern->used)
{
+ #ifdef MSDOS
+ pattern->buffer
+ = (char *) xrealloc (pattern->buffer, (size_t) pattern->used);
+ #else /* not MSDOS */
pattern->buffer = (char *) xrealloc (pattern->buffer, pattern->used);
+ #endif /* not MSDOS */
pattern->allocated = pattern->used;
}
***************
*** 469,477 ****
{
int file_handle; /* file descriptor number */
struct stat stat_block; /* stat block for file */
! int allocated_length; /* allocated length of memory buffer */
! int used_length; /* used length in memory buffer */
! int read_length; /* number of character gotten on last read */
/* As special cases, a file name which is NULL or "-" indicates standard
input, which is already opened. In all other cases, open the file from
--- 475,483 ----
{
int file_handle; /* file descriptor number */
struct stat stat_block; /* stat block for file */
! LONG allocated_length; /* allocated length of memory buffer */
! LONG used_length; /* used length in memory buffer */
! LONG read_length; /* number of character gotten on last read */
/* As special cases, a file name which is NULL or "-" indicates standard
input, which is already opened. In all other cases, open the file from
***************
*** 493,498 ****
--- 499,513 ----
if ((stat_block.st_mode & S_IFMT) == S_IFREG)
{
+ #ifdef MSDOS
+ block->start = (char HUGE *) xhalloc (stat_block.st_size);
+
+ read_length = hread (file_handle, block->start, stat_block.st_size);
+ if (read_length <= 0L)
+ perror_and_exit (file_name);
+
+ block->end = block->start + read_length;
+ #else /* not MSDOS */
block->start = (char *) xmalloc ((int) stat_block.st_size);
if (read (file_handle, block->start, (int) stat_block.st_size)
***************
*** 500,508 ****
--- 515,533 ----
perror_and_exit (file_name);
block->end = block->start + stat_block.st_size;
+ #endif /* not MSDOS */
}
else
{
+ #ifdef MSDOS
+ block->start = (char HUGE *) xhalloc (1L << SWALLOW_REALLOC_LOG);
+ used_length = 0;
+ allocated_length = (1 << SWALLOW_REALLOC_LOG);
+
+ while ((read_length = hread (file_handle,
+ block->start + used_length,
+ allocated_length - used_length)) > 0L)
+ #else /* not MSDOS */
block->start = (char *) xmalloc (1 << SWALLOW_REALLOC_LOG);
used_length = 0;
allocated_length = (1 << SWALLOW_REALLOC_LOG);
***************
*** 510,522 ****
--- 535,556 ----
while ((read_length = read (file_handle,
block->start + used_length,
allocated_length - used_length)) > 0)
+ #endif /* not MSDOS */
{
used_length += read_length;
if (used_length == allocated_length)
{
+ #ifdef MSDOS
+ block->start
+ = (char HUGE *) xhrealloc (block->start, allocated_length,
+ allocated_length
+ + (1L << SWALLOW_REALLOC_LOG));
+ allocated_length += (1L << SWALLOW_REALLOC_LOG);
+ #else /* not MSDOS */
allocated_length += (1 << SWALLOW_REALLOC_LOG);
block->start
= (char *) xrealloc (block->start, allocated_length);
+ #endif /* not MSDOS */
}
}
***************
*** 594,600 ****
--- 628,642 ----
int value;
value = compare_words (&first->key, &second->key);
+
+ #ifdef MSDOS
+ return
+ value == 0
+ ? (L_PDIFF (first->key.start, second->key.start) >= 0L ? 1 : -1)
+ : value;
+ #else /* not MSDOS */
return value == 0 ? first->key.start - second->key.start : value;
+ #endif /* not MSDOS */
}
***************
*** 645,650 ****
--- 687,696 ----
/* Only one language for the time being. */
+ #ifdef MSDOS
+ assert ((long) number_of_occurs[0] * (long) sizeof_occurs < 0x10000L);
+ #endif
+
qsort (occurs_table[0], number_of_occurs[0],
sizeof_occurs, compare_occurs);
}
***************
*** 734,740 ****
{
ALLOC_NEW_WORD (table);
table->start[table->length].start = word_start;
! table->start[table->length].size = cursor - word_start;
table->length++;
}
--- 780,786 ----
{
ALLOC_NEW_WORD (table);
table->start[table->length].start = word_start;
! table->start[table->length].size = I_PDIFF (cursor, word_start);
table->length++;
}
***************
*** 746,751 ****
--- 792,801 ----
/* Finally, sort all the words read. */
+ #ifdef MSDOS
+ assert ((long) table->length * (long) sizeof (WORD) < 0x10000L);
+ #endif
+
qsort (table->start, table->length, sizeof (WORD), compare_words);
}
***************
*** 762,778 ****
find_occurs_in_text ()
#endif
{
! char *cursor; /* for scanning the source text */
! char *scan; /* for scanning the source text also */
! char *line_start; /* start of the current input line */
! char *line_scan; /* newlines scanned until this point */
int reference_length; /* length of reference in input mode */
WORD possible_key; /* possible key, to ease searches */
OCCURS *occurs_cursor; /* current OCCURS under construction */
! char *context_start; /* start of left context */
! char *context_end; /* end of right context */
! char *next_context_start; /* next start of left context */
/* Tracking where lines start is helpful for reference processing. In
auto reference mode, this allows counting lines. In input reference
--- 812,828 ----
find_occurs_in_text ()
#endif
{
! char HUGE *cursor; /* for scanning the source text */
! char HUGE *scan; /* for scanning the source text also */
! char HUGE *line_start; /* start of the current input line */
! char HUGE *line_scan; /* newlines scanned until this point */
int reference_length; /* length of reference in input mode */
WORD possible_key; /* possible key, to ease searches */
OCCURS *occurs_cursor; /* current OCCURS under construction */
! char HUGE *context_start; /* start of left context */
! char HUGE *context_end; /* end of right context */
! char HUGE *next_context_start;/* next start of left context */
/* Tracking where lines start is helpful for reference processing. In
auto reference mode, this allows counting lines. In input reference
***************
*** 788,794 ****
if (input_reference)
{
SKIP_NON_WHITE (line_scan, text_buffer.end);
! reference_length = line_scan - line_start;
SKIP_WHITE (line_scan, text_buffer.end);
}
--- 838,844 ----
if (input_reference)
{
SKIP_NON_WHITE (line_scan, text_buffer.end);
! reference_length = I_PDIFF (line_scan, line_start);
SKIP_WHITE (line_scan, text_buffer.end);
}
***************
*** 814,821 ****
sentence at the end of the buffer. */
if (context_regex_string
! && (re_search (context_regex, cursor, text_buffer.end - cursor,
! 0, text_buffer.end - cursor, &context_regs)
>= 0))
next_context_start = cursor + context_regs.end[0];
--- 864,872 ----
sentence at the end of the buffer. */
if (context_regex_string
! && (re_search (context_regex, cursor,
! L_PDIFF (text_buffer.end, cursor),
! ZERO, L_PDIFF (text_buffer.end, cursor), &context_regs)
>= 0))
next_context_start = cursor + context_regs.end[0];
***************
*** 841,848 ****
the loop. */
{
! if (re_search (word_regex, cursor, context_end - cursor,
! 0, context_end - cursor, &word_regs)
< 0)
break;
}
--- 892,900 ----
the loop. */
{
! if (re_search (word_regex, cursor,
! L_PDIFF (context_end, cursor),
! ZERO, L_PDIFF (context_end, cursor), &word_regs)
< 0)
break;
}
***************
*** 862,874 ****
if (scan == context_end)
break;
! word_regs.start[0] = scan - cursor;
while (scan < context_end
&& word_fastmap[(unsigned char) *scan])
scan++;
! word_regs.end[0] = scan - cursor;
}
/* Skip right to the beginning of the found word. */
--- 914,926 ----
if (scan == context_end)
break;
! word_regs.start[0] = I_PDIFF (scan, cursor);
while (scan < context_end
&& word_fastmap[(unsigned char) *scan])
scan++;
! word_regs.end[0] = I_PDIFF (scan, cursor);
}
/* Skip right to the beginning of the found word. */
***************
*** 912,918 ****
line_scan++;
line_start = line_scan;
SKIP_NON_WHITE (line_scan, text_buffer.end);
! reference_length = line_scan - line_start;
}
else
line_scan++;
--- 964,971 ----
line_scan++;
line_start = line_scan;
SKIP_NON_WHITE (line_scan, text_buffer.end);
!
! reference_length = I_PDIFF (line_scan, line_start);
}
else
line_scan++;
***************
*** 976,982 ****
value of `line_start'. */
occurs_cursor->reference
! = (DELTA) (line_start - possible_key.start);
if (reference_length > reference_max_width)
reference_max_width = reference_length;
}
--- 1029,1035 ----
value of `line_start'. */
occurs_cursor->reference
! = (DELTA) I_PDIFF (line_start, possible_key.start);
if (reference_length > reference_max_width)
reference_max_width = reference_length;
}
***************
*** 992,1000 ****
/* Completes the OCCURS structure. */
occurs_cursor->key = possible_key;
! occurs_cursor->left = context_start - possible_key.start;
! occurs_cursor->right = context_end - possible_key.start;
number_of_occurs[0]++;
}
}
--- 1045,1056 ----
/* Completes the OCCURS structure. */
occurs_cursor->key = possible_key;
! occurs_cursor->left = I_PDIFF (context_start, possible_key.start);
! occurs_cursor->right = I_PDIFF (context_end, possible_key.start);
+ #ifdef MSDOS
+ assert (number_of_occurs[0] < 32767);
+ #endif /* MSDOS */
number_of_occurs[0]++;
}
}
***************
*** 1030,1036 ****
BLOCK field;
#endif
{
! char *cursor; /* Cursor in field to print */
int character; /* Current character */
int base; /* Base character, without diacritic */
int diacritic; /* Diacritic code for the character */
--- 1086,1092 ----
BLOCK field;
#endif
{
! char HUGE *cursor; /* Cursor in field to print */
int character; /* Current character */
int base; /* Base character, without diacritic */
int diacritic; /* Diacritic code for the character */
***************
*** 1356,1365 ****
{
int tail_max_width; /* allowable width of tail field */
int head_max_width; /* allowable width of head field */
! char *cursor; /* running cursor in source text */
! char *left_context_start; /* start of left context */
! char *right_context_end; /* end of right context */
! char *left_field_start; /* conservative start for `head'/`before' */
int file_index; /* index in text input file arrays */
STRING *file_name; /* file name for reference */
int line_ordinal; /* line ordinal for reference */
--- 1412,1421 ----
{
int tail_max_width; /* allowable width of tail field */
int head_max_width; /* allowable width of head field */
! char HUGE *cursor; /* running cursor in source text */
! char HUGE *left_context_start;/* start of left context */
! char HUGE *right_context_end; /* end of right context */
! char HUGE *left_field_start; /* conservative start for `head'/`before' */
int file_index; /* index in text input file arrays */
STRING *file_name; /* file name for reference */
int line_ordinal; /* line ordinal for reference */
***************
*** 1442,1448 ****
has no suffixed spaces. */
tail_max_width
! = before_max_width - (before.end - before.start) - gap_size;
if (tail_max_width > 0)
{
--- 1498,1504 ----
has no suffixed spaces. */
tail_max_width
! = before_max_width - I_PDIFF (before.end, before.start) - gap_size;
if (tail_max_width > 0)
{
***************
*** 1488,1494 ****
contain only part of a word, and has no suffixed spaces. */
head_max_width
! = keyafter_max_width - (keyafter.end - keyafter.start) - gap_size;
if (head_max_width > 0)
{
--- 1544,1550 ----
contain only part of a word, and has no suffixed spaces. */
head_max_width
! = keyafter_max_width - I_PDIFF (keyafter.end, keyafter.start) - gap_size;
if (head_max_width > 0)
{
***************
*** 1624,1630 ****
{
BLOCK key; /* key field, isolated */
BLOCK after; /* after field, isolated */
! char *cursor; /* running cursor in source text */
printf ("\\xx ");
printf ("{");
--- 1680,1686 ----
{
BLOCK key; /* key field, isolated */
BLOCK after; /* after field, isolated */
! char HUGE *cursor; /* running cursor in source text */
printf ("\\xx ");
printf ("{");
***************
*** 1675,1681 ****
putchar (':');
print_spaces (reference_max_width
+ gap_size
! - (reference.end - reference.start)
- 1);
}
else
--- 1731,1737 ----
putchar (':');
print_spaces (reference_max_width
+ gap_size
! - I_PDIFF (reference.end, reference.start)
- 1);
}
else
***************
*** 1686,1692 ****
print_field (reference);
print_spaces (reference_max_width
+ gap_size
! - (reference.end - reference.start));
}
if (tail.start < tail.end)
--- 1742,1748 ----
print_field (reference);
print_spaces (reference_max_width
+ gap_size
! - I_PDIFF (reference.end, reference.start));
}
if (tail.start < tail.end)
***************
*** 1698,1711 ****
printf ("%s", truncation_string);
print_spaces (half_line_width - gap_size
! - (before.end - before.start)
- (before_truncation ? truncation_string_length : 0)
! - (tail.end - tail.start)
- (tail_truncation ? truncation_string_length : 0));
}
else
print_spaces (half_line_width - gap_size
! - (before.end - before.start)
- (before_truncation ? truncation_string_length : 0));
/* Output the `before' field. */
--- 1754,1767 ----
printf ("%s", truncation_string);
print_spaces (half_line_width - gap_size
! - I_PDIFF (before.end, before.start)
- (before_truncation ? truncation_string_length : 0)
! - I_PDIFF (tail.end, tail.start)
- (tail_truncation ? truncation_string_length : 0));
}
else
print_spaces (half_line_width - gap_size
! - I_PDIFF (before.end, before.start)
- (before_truncation ? truncation_string_length : 0));
/* Output the `before' field. */
***************
*** 1727,1735 ****
/* Output the `head' field. */
print_spaces (half_line_width
! - (keyafter.end - keyafter.start)
- (keyafter_truncation ? truncation_string_length : 0)
! - (head.end - head.start)
- (head_truncation ? truncation_string_length : 0));
if (head_truncation)
printf ("%s", truncation_string);
--- 1783,1791 ----
/* Output the `head' field. */
print_spaces (half_line_width
! - I_PDIFF (keyafter.end, keyafter.start)
- (keyafter_truncation ? truncation_string_length : 0)
! - I_PDIFF (head.end, head.start)
- (head_truncation ? truncation_string_length : 0));
if (head_truncation)
printf ("%s", truncation_string);
***************
*** 1739,1745 ****
if ((auto_reference || input_reference) && right_reference)
print_spaces (half_line_width
! - (keyafter.end - keyafter.start)
- (keyafter_truncation ? truncation_string_length : 0));
if ((auto_reference || input_reference) && right_reference)
--- 1795,1801 ----
if ((auto_reference || input_reference) && right_reference)
print_spaces (half_line_width
! - I_PDIFF (keyafter.end, keyafter.start)
- (keyafter_truncation ? truncation_string_length : 0));
if ((auto_reference || input_reference) && right_reference)
*** e:\tmp/RCSt1006052 Sat Sep 22 00:28:28 1990
--- xmalloc.c Fri Sep 21 23:39:02 1990
***************
*** 2,8 ****
Copyright (C) 1990 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, September 1989.
! $Id: xmalloc.c 0.1 90/08/11 09:18:57 tho Exp $
*/
#include <stdio.h>
--- 2,8 ----
Copyright (C) 1990 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, September 1989.
! $Id: xmalloc.c 0.1.0.1 90/08/12 00:53:35 tho Exp $
*/
#include <stdio.h>
***************
*** 66,68 ****
--- 66,163 ----
}
return result_pointer;
}
+
+ #ifdef MSDOS
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <io.h>
+
+ #if defined (_MSC_VER) && (_MSC_VER >= 600)
+ #define HUGE _huge
+ #else
+ #define HUGE huge
+ #endif
+
+
+ /* malloc a block of memory, with fatal error message if we can't do it. */
+
+ #include <malloc.h>
+ #include <dos.h>
+
+ void HUGE *
+ xhalloc (long size)
+ {
+ void HUGE *value = (void HUGE *) halloc (size, (size_t)1 );
+
+ if (!value)
+ {
+ fprintf (stderr, "Out of memory!\n");
+ abort ();
+ }
+
+ return value;
+ }
+
+ /* Here we do a HUGE "realloc" by allocating a new block and
+ moving the old block afterwards. This is *slow*, but should
+ be reliable. */
+
+ void HUGE *
+ xhrealloc (void HUGE *ptr, long new_size, long old_size)
+ {
+ void HUGE *value = (void HUGE *) halloc (new_size, (size_t)1 );
+
+ if (!value)
+ {
+ fprintf (stderr, "Out of memory!\n");
+ abort ();
+ }
+ else
+ {
+ char HUGE *dest = value;
+ char HUGE *src = ptr;
+
+ while (old_size > 0L)
+ {
+ unsigned int bytes = (unsigned int) min (0x8000L, old_size);
+ memcpy (dest, src, bytes);
+ old_size -= (long) bytes;
+ dest += (long) bytes;
+ src += (long) bytes;
+ }
+ }
+ hfree (ptr);
+ return value;
+ }
+
+ long
+ hread (int fd, void HUGE *buffer, long bytes)
+ {
+ long bytes_read = 0L;
+
+ while (1)
+ {
+ int n = read (fd, buffer, (unsigned int) min (0x4000L, bytes));
+
+ if (n > 0)
+ {
+ bytes_read += (long) n;
+ bytes -= (long) n;
+ /* we can't say buffer += n here, because we have to make
+ sure that the offset of BUFFER doesn't overflow during
+ the read() system call. Therefore we add what we read
+ to the segment of BUFFER. */
+ FP_SEG(buffer) += (n >> 4);
+ FP_OFF(buffer) += (n & 0x0F);
+ }
+ else if (n == 0)
+ return bytes_read; /* done */
+ else
+ {
+ perror ("Out of memory");
+ abort ();
+ }
+ }
+ }
+ #endif /* MSDOS */
*** e:\tmp/RCSt1006052 Sat Sep 22 00:28:30 1990
--- hregex.c Sat Sep 22 00:25:50 1990
***************
*** 0 ****
--- 1,119 ----
+ /* hregex.c - use re_search () and re_match () on huge buffers
+ Copyright (C) 1990 Free Software Foundation, Inc.
+ Francois Pinard <pinard@iro.umontreal.ca>, 1988.
+ Thorsten Ohl <td12@ddagsi3.bitnet>, 1990.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Header: e:/gnu/gptx/RCS/hregex.c 0.1.0.1 90/09/22 00:23:03 tho Exp $
+ */
+
+ #if defined (_MSC_VER) && (_MSC_VER >= 600)
+ #define HUGE _huge
+ #else
+ #define HUGE huge
+ #endif
+
+ #define LONG long
+ #define IMAX 0x7fffL
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <dos.h>
+ #include <regex.h>
+
+ extern char *program_name;
+
+ /* Normalize a "huge" ix86 pointer by moving part of the offset into
+ the segment. (We do it only if the offset is sufficiently large.)
+ Note: Don't do this with pointers to memory blocks owned by malloc,
+ as a subsequent free () or realloc () will fail! */
+
+ #define FP_NORM(fp) \
+ if (FP_OFF (fp) & 0xf000) \
+ { \
+ FP_SEG (fp) += (FP_OFF(fp) >> 4); \
+ FP_OFF (fp) &= 0x0f; \
+ }
+
+ /* This is a kludge for using the GNU regex library on huge (>32k)
+ buffers. This "implementation" assumes that a match will be found in
+ the first 32k and will simply abort with a diagnostic message if not.
+ While this is certainly not a clean solution, it is appropriate in
+ cases where a failure is extremely unlikely, since it avoids the
+ enormous computational overhead of using huge pointers for regexp
+ matching, which is furthermore very error-prone.
+ Note: once these functions are real implementation, they should return
+ a long, but for the moment ints are more convenient. */
+
+ int
+ re_hsearch (struct re_pattern_buffer *pbufp, char HUGE *string, long size,
+ long startpos, long range, struct re_registers *regs)
+ {
+ int match;
+ int isize = (int) min (size, IMAX);
+ int istartpos = (int) min (startpos, IMAX);
+ int irange = (int) min (range, IMAX);
+
+ FP_NORM (string);
+
+ match = re_search (pbufp, string, isize, istartpos, irange, regs);
+
+ if (match == -1 && size > IMAX)
+ {
+ fprintf (stderr, "%s: re_search() failed in truncated buffer\n"
+ " buffer: `%.30s...'\n"
+ " length: %ld\n",
+ program_name, string, size);
+ abort ();
+ }
+
+ return match;
+ }
+
+ int
+ re_hmatch (struct re_pattern_buffer *pbufp, char HUGE *string, long size,
+ long pos, struct re_registers *regs)
+ {
+ int match;
+ int isize = (int) min (size, IMAX);
+ int ipos = (int) min (pos, IMAX);
+
+ FP_NORM (string);
+
+ match = re_match (pbufp, string, isize, ipos, regs);
+
+ if (match == -1 && size > IMAX)
+ {
+ fprintf (stderr, "%s: re_match() failed against truncated buffer\n"
+ " buffer: `%.30s...'\n"
+ " length: %ld\n",
+ program_name, string, size);
+ abort ();
+ }
+
+ return match;
+ }
+
+
+ /*
+ Local Variables:
+ mode:C
+ ChangeLog:ChangeLog
+ compile-command:make
+ End:
+ */
+
+
*** e:\tmp/RCSt1006052 Sat Sep 22 00:28:34 1990
--- gptx.h Sat Sep 22 00:23:24 1990
***************
*** 2,8 ****
Copyright (C) 1990 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, 1988.
! $Id: gptx.h 0.1 90/08/11 09:18:59 tho Exp $
*/
--- 2,8 ----
Copyright (C) 1990 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, 1988.
! $Id: gptx.h 0.1.0.4 90/09/22 00:22:40 tho Exp $
*/
***************
*** 38,43 ****
--- 38,53 ----
#ifndef STDLIB_PROTO_ALREADY
+ #include <assert.h>
+
+ #ifdef MSDOS
+
+ #include <stdlib.h>
+ #include <io.h>
+ int getopt (int, char **, const char *);
+
+ #else /* not MSDOS */
+
#ifdef BUFSIZ /* stdio dependant -- how ugly! */
int _filbuf PROTO ((FILE *));
int _flsbuf PROTO ((unsigned char, FILE *));
***************
*** 54,59 ****
--- 64,71 ----
void qsort PROTO ((void *, int, int, int ()));
int read PROTO ((int, void *, unsigned));
+ #endif /* not MSDOS */
+
#endif /* not STDLIB_PROTO_ALREADY */
***************
*** 66,68 ****
--- 78,143 ----
void print_copyright PROTO ((void));
void print_version PROTO ((void));
+
+ /* Teach MS-DOS to handel long files */
+
+ #ifdef MSDOS
+
+ #if defined (_MSC_VER) && (_MSC_VER >= 600)
+ #define HUGE _huge
+ #else
+ #define HUGE huge
+ #endif
+ #define LONG long
+
+ void HUGE *xhalloc (long size);
+ void HUGE *xhrealloc (void HUGE *ptr, long new_size, long old_size);
+ long hread (int fd, void HUGE *buffer, long bytes);
+
+ #if defined (M_I86CM) || defined (M_I86LM)
+
+ #define L_PDIFF(ptr1,ptr2) \
+ ((long)((char HUGE *)(ptr1) - (char HUGE *)(ptr2)))
+
+ #define I_PDIFF(ptr1,ptr2) \
+ (assert ((long)((char HUGE *)(ptr1) - (char HUGE *)(ptr2)) < (1L << 15)), \
+ ((int)(long)((char HUGE *)(ptr1) - (char HUGE *)(ptr2))))
+
+ extern int re_hsearch (struct re_pattern_buffer *pbufp, char HUGE *string,
+ long size, long startpos, long range,
+ struct re_registers *regs);
+ extern int re_hmatch (struct re_pattern_buffer *pbufp, char HUGE *string,
+ long size, long pos, struct re_registers *regs);
+
+ /* We must mask re_search () and re_match () *after* the prototypes
+ in regex.h! */
+
+ #include <regex.h>
+
+ #define re_search re_hsearch
+ #define re_match re_hmatch
+
+ #define ZERO 0L
+
+ #else /* not M_I86CM and not M_I86LM */
+
+ #define L_PDIFF(ptr1,ptr2) ((ptr1) - (ptr2))
+ #define I_PDIFF(ptr1,ptr2) ((ptr1) - (ptr2))
+
+ #define ZERO 0
+
+ #endif /* not M_I86CM and not M_I86LM */
+
+ #else /* not MSDOS */
+
+ #define HUGE
+ #define LONG int
+
+ #define L_PDIFF(ptr1,ptr2) ((ptr1) - (ptr2))
+ #define I_PDIFF(ptr1,ptr2) ((ptr1) - (ptr2))
+
+ #define ZERO 0
+
+ #endif /* not MSDOS */
+
+