home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / GPTX01AS.ZIP / GPTX.INF < prev    next >
Encoding:
Text File  |  1990-08-05  |  35.2 KB  |  824 lines

  1. Info file gptx.info, produced by Makeinfo, -*- Text -*- from input
  2. file gptx.texinfo.
  3.  
  4.    Copyright (C) 1990 Free Software Foundation, Inc.  Francois Pinard
  5. <pinard@iro.umontreal.ca>, 1988.
  6.  
  7.    $Id$
  8.  
  9.    This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License as
  11. published by the Free Software Foundation; either version 1, or (at
  12. your option) any later version.
  13.  
  14.    This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23.  
  24. 
  25. File: gptx.info,  Node: Top,  Next: Usage,  Up: (DIR)
  26.  
  27. `gptx' - GNU permuted index generator
  28. =====================================
  29.  
  30.    This is the GNU prerelease of `gptx', a permuted index generator. 
  31. This prerelease has the main goal of providing a `ptx' *almost*
  32. compatible replacement, able to handle small files quickly, while
  33. providing a platform for more development.
  34.  
  35.    This version reimplements and extends standard `ptx'.  In
  36. particular, it can produce a readable "KWIC" without the need of
  37. `nroff'.  This program does not repeat all `ptx' disposition quirks
  38. (but should it really do?).  Also, this version does not yet handle
  39. huge input files, that is, those files which do not fit in memory all
  40. at once.
  41.  
  42. * Menu:
  43.  
  44. * Usage::    How to use the program, its options and parameters.
  45. * Regexps::    How a regular expression is written and used.
  46. * ptx mode::    In which ways `ptx' mode is different.
  47. * Future::    What are the development lines of this program.
  48.  
  49.  
  50. 
  51. File: gptx.info,  Node: Usage,  Next: Regexps,  Prev: Top,  Up: Top
  52.  
  53. How to use this program
  54. -----------------------
  55.  
  56.    This tool reads a text file and essentially produces a permuted
  57. index, with each keyword in its context.  The calling sketch is one of:
  58.  
  59.      gptx [OPTION]... [INPUT]... >OUTPUT
  60.  
  61.    or:
  62.  
  63.      ptx [OPTION]... [INPUT [OUTPUT]]
  64.  
  65.    If the program is called as `ptx' instead of `gptx', or if `-p'
  66. option is selected, this implies `ptx' compatibility mode,
  67. disallowing extensions, introducing some limitations, and changing
  68. several of the program's default option values.  See *Note ptx mode::
  69. for a list of differences.
  70.  
  71.    As usual, each option is represented by an hyphen followed by a
  72. single letter.  Some options require a parameter in the form of a
  73. decimal number or a file name, in which case the parameter follows
  74. the option after some whitespace.  Option letters may be grouped and
  75. tied together as a string which follows only one hyphen; if one of
  76. several of them require parameters, they should follow the combined
  77. options in the order of appearance of individual letters in the
  78. string.  Individual options are explained below.
  79.  
  80.    When *not* in `ptx' compatibility mode, there may be zero, one or
  81. several parameters after the options.  If there is no parameters, the
  82. program reads the standard input.  If there is one or several
  83. parameters, they give the name of input files, which are all read in
  84. turn; a little as if all the input files were concatenated.  However,
  85. there is a full contextual break between each file; and when
  86. automatic referencing is requested, file names and line numbers refer
  87. to individual text input files.  In all cases, the program produces
  88. the permuted index onto the standard output.
  89.  
  90.    When in `ptx' compatibility mode, besides the options, there may
  91. be zero, one or two parameters.  If there is no parameters, the
  92. program reads the standard input and produces the permuted index onto
  93. the standard output.  If there is only one parameter, it names the
  94. text file to be read instead of the standard input.  If two
  95. parameters are given, they give respectively the name of the file to
  96. read and the name of the file to produce.
  97.  
  98.    Note that for *any* file named as the value of an option or as an
  99. input text file, a single dash `-' may be used, in which case
  100. standard input is assumed.  However, it would not make sense to use
  101. this convention more than once per program invocation.
  102.  
  103. * Menu:
  104.  
  105. * General options::    Options which affect general program behaviour.
  106. * Charset selection::    Underlying character set considerations.
  107. * Input processing::    Input fields, contexts, and keyword selection.
  108. * Output formatting::    Types of output format, and sizing the fields.
  109.  
  110.  
  111. 
  112. File: gptx.info,  Node: General options,  Next: Charset selection,  Up: Usage
  113.  
  114. General options
  115. ...............
  116.  
  117. `-p'
  118.      This requests `ptx' behaviour, as far as we understand it.  This
  119.      option is selected by default when the program is installed
  120.      under the name `ptx'.
  121.  
  122.      This option is not available once the program is operating in
  123.      `ptx' compatibility mode.
  124.  
  125. `-C'
  126.      Prints a short note about the Copyright and copying conditions.
  127.  
  128.  
  129. 
  130. File: gptx.info,  Node: Charset selection,  Next: Input processing,  Prev: General options,  Up: Usage
  131.  
  132. Charset selection
  133. .................
  134.  
  135.     As it is setup now, the program assumes that the input file is
  136. coded using 8-bit ISO 8859-1 code, also known as Latin-1 character
  137. set, *unless* if it is compiled for MS-DOS, in which case it uses the
  138. character set of the IBM-PC.  Compared to 7-bit ASCII, the set of
  139. characters which are letters is then different, this fact alters the
  140. behaviour of regular expression matching.  Thus, the default regular
  141. expression for a keyword allows foreign or diacriticized letters. 
  142. Keyword sorting, however, is still crude; it obeys the underlying
  143. character set ordering quite blindly.
  144.  
  145. `-f'
  146.      Fold lower case letters to upper case for sorting.
  147.  
  148.  
  149. 
  150. File: gptx.info,  Node: Input processing,  Next: Output formatting,  Prev: Charset selection,  Up: Usage
  151.  
  152. Word selection
  153. ..............
  154.  
  155. `-b FILE'
  156.      This option is an alternative way to option `-W' for describing
  157.      which characters make up words.  This option introduces the name
  158.      of a file which contains a list of characters which can*not* be
  159.      part of one word, this file is called the "Break file".  Any
  160.      character which is not part of the Break file is a word
  161.      constituent.  If both options `-b' and `-W' are specified, then
  162.      `-W' has precedence and `-b' is ignored.
  163.  
  164.      In normal mode, the only way to avoid newline as a break
  165.      character is to write all the break characters in the file with
  166.      no newline at all, not even at the end of the file.  In `ptx'
  167.      compatibility mode, spaces, tabs and newlines are always
  168.      considered as break characters even if not included in the Break
  169.      file.
  170.  
  171. `-i FILE'
  172.      The file associated with this option contains a list of words
  173.      which will never be taken as keywords in concordance output.  It
  174.      is called the "Ignore file".  The file contains exactly one word
  175.      in each line; the end of line separation of words is not subject
  176.      to the value of the `-S' option.
  177.  
  178.      If not specified, there might be a default Ignore file.  Default
  179.      Ignore files are not necessarily the same in normal mode or in
  180.      `ptx' compatibility mode.  Unless changed by the local
  181.      installation, there is *no* default Ignore file in normal mode,
  182.      and the Ignore file is `/usr/lib/eign' in `ptx' compatibility
  183.      mode.  If you want to deactivate a default Ignore file, use
  184.      `/dev/null' instead.
  185.  
  186. `-o FILE'
  187.      The file associated with this option contains a list of words
  188.      which will be retained in concordance output, any word not
  189.      mentionned in this file is ignored.  The file is called the
  190.      "Only file".  The file contains exactly one word in each line;
  191.      the end of line separation of words is not subject to the value
  192.      of the `-S' option.
  193.  
  194.      There is no default for the Only file.  In the case there are
  195.      both an Only file and an Ignore file, a word will be subject to
  196.      be a keyword only if it is given in the Only file and not given
  197.      in the Ignore file.
  198.  
  199. `-r'
  200.      On each input line, the leading sequence of non white characters
  201.      will be taken to be a reference that has the purpose of
  202.      identifying this input line on the produced permuted index.  See
  203.      *Note Output formatting:: for more information about reference
  204.      production.  Using this option change the default value for
  205.      option `-S'.
  206.  
  207.      Using this option, the program does not try very hard to remove
  208.      references from contexts in output, but it succeeds in doing so
  209.      *when* the context ends exactly at the newline.  If option `-r'
  210.      is used with `-S' default value, or when in `ptx' compatibility
  211.      mode, this condition is always met and references are completely
  212.      excluded from the output contexts.
  213.  
  214. `-S REGEXP'
  215.      This option selects which regular expression will describe the
  216.      end of a line or the end of a sentence.  In fact, there is other
  217.      distinction between end of lines or end of sentences than the
  218.      effect of this regular expression, and input line boundaries
  219.      have no special significance outside this option.  By default,
  220.      in `ptx' compatibility mode or if `-r' option is used, end of
  221.      lines are used; in this case, the REGEXP used is very simple:
  222.  
  223.           \n
  224.  
  225.      In normal mode and if `-r' option is not used, by default, end
  226.      of sentences are used; the precise REGEX is imported from GNU
  227.      emacs:
  228.  
  229.           [.?!][]\"')}]*\\($\\|\t\\|  \\)[ \t\n]*
  230.  
  231.      An empty REGEXP is equivalent to completly disabling end of line
  232.      or end of sentence recognition.  In this case, the whole file is
  233.      considered to be a single big line or sentence.  The user might
  234.      want to disallow all truncation flag generation as well, through
  235.      option `-F ""'.  On regular expression writing and usage, see
  236.      *Note Regexps::.
  237.  
  238.      When the keywords happen to be near the beginning of the input
  239.      line or sentence, this often creates an unused area at the
  240.      beginning of the output context line; when the keywords happen
  241.      to be near the end of the input line or sentence, this often
  242.      creates an unused area at the end of the output context line. 
  243.      The program tries to fill those unused areas by wrapping around
  244.      context in them; the tail of the input line or sentence is used
  245.      to fill the unused area on the left of the output line; the head
  246.      of the input line or sentence is used to fill the unused area on
  247.      the right of the output line.
  248.  
  249.      This option is not available when the program is operating `ptx'
  250.      compatibility mode.
  251.  
  252. `-W REGEXP'
  253.      This option selects which regular expression will describe each
  254.      keyword.  By default, in `ptx' compatibility mode, a word is
  255.      anything which ends with a space, a tab or a newline; the REGEXP
  256.      used is `[^ \t\n]+'.
  257.  
  258.      In normal mode, a word is a sequence of letters; the REGEXP used
  259.      is `\w+'.
  260.  
  261.      An empty REGEXP is equivalent to not using this option, letting
  262.      the default dive in.  On regular expression writing and usage,
  263.      see *Note Regexps::.
  264.  
  265.      This option is not available when the program is operating `ptx'
  266.      compatibility mode.
  267.  
  268.  
  269. 
  270. File: gptx.info,  Node: Output formatting,  Prev: Input processing,  Up: Usage
  271.  
  272. Output formatting
  273. .................
  274.  
  275.     Output format is mainly controlled by `-O' and `-T' options,
  276. described in the table below.  However, when neither `-O' nor `-T' is
  277. selected, and if we are not running in `ptx' compatibility mode, the
  278. program choose an output format suited for a dumb terminal.  This is
  279. the default format when working in normal mode.  Each keyword
  280. occurrence is output to the center of one line, surrounded by its
  281. left and rigth contexts.  Each field is properly justified, so the
  282. concordance output could readily be observed.  As a special feature,
  283. if automatic references are selected by option `-A' and are output
  284. before the left context, that is, if option `-R' is *not* selected,
  285. then a colon is added after the reference; this nicely interface with
  286. GNU Emacs `next-error' processing.  In this default output format,
  287. each white space character, like newline and tab, is merely changed
  288. to exactly one space, with no special attempt to compress consecutive
  289. spaces.  This might change in the future.  Except for those white
  290. space characters, every other character of the underlying set of 256
  291. characters is transmitted verbatim.
  292.  
  293.    Output format is further controlled by the following options.
  294.  
  295. `-g NUMBER'
  296.      Select the size of the minimum white gap between the fields on
  297.      the output line.
  298.  
  299. `-w NUMBER'
  300.      Select the output maximum width of each final line.  If
  301.      references are used, they are included or excluded from the
  302.      output maximum width depending on the value of option `-R'.  If
  303.      this option is not selected, that is, when references are output
  304.      before the left context, the output maximum width takes into
  305.      account the maximum length of all references.  If this options
  306.      is selected, that is, when references are output after the right
  307.      context, the output maximum width does not take into account the
  308.      space taken by references, nor the gap that precedes them.
  309.  
  310. `-A'
  311.      Select automatic references.  Each input line will have an
  312.      automatic reference made up of the file name, an open
  313.      parenthesis, the line ordinal and a close parenthesis.  However,
  314.      the file name will be empty when standard input is being read. 
  315.      If both `-A' and `-r' are selected, then the input reference is
  316.      still read and skipped, but the automatic reference is used at
  317.      output time, overriding the input reference.
  318.  
  319.      This option is not available when the program is operating `ptx'
  320.      compatibility mode.
  321.  
  322. `-R'
  323.      In default output format, when option `-R' is not used, any
  324.      reference produced by the effect of options `-r' or `-A' are
  325.      given to the far right of output lines, after the right context.
  326.      In default output format, when option `-R' is specified,
  327.      references are rather given to the beginning of each output
  328.      line, before the left context.  For any other output format,
  329.      option `-R' is almost ignored, except for the fact that the
  330.      width of references is *not* taken into account in total output
  331.      width given by `-w' whenever `-R' is selected.
  332.  
  333.      This option is not explicitely selectable when the program is
  334.      operating in `ptx' compatibility mode.  However, in this case,
  335.      it is always implicitely selected.
  336.  
  337. `-F STRING'
  338.      This option will request that any truncation in the output be
  339.      reported using the string STRING.  Most output fields
  340.      theoretically extend towards the beginning or the end of the
  341.      current line, or current sentence, as selected with option `-S'.
  342.      But there is a maximum allowed output line width, changeable
  343.      through option `-w', which is further divided into space for
  344.      various output fields.  When a field has to be truncated because
  345.      cannot extend until the beginning or the end of the current line
  346.      to fit in the, then a truncation occurs.  By default, the string
  347.      used is a single slash, as in `-F /'.
  348.  
  349.      STRING may have more than one character, as in `-F ...'.  Also,
  350.      in the particular case STRING is empty (`-F ""'), truncation
  351.      flagging is disabled, and no truncation marks are appended in
  352.      this case.
  353.  
  354.      This option is not available when the program is operating `ptx'
  355.      compatibility mode.
  356.  
  357. `-O'
  358.      Choose an output format suitable for `nroff' or `troff'
  359.      processing.  Each output line will look like:
  360.  
  361.           .xx "TAIL" "BEFORE" "KEYWORD_AND_AFTER" "HEAD" "REF"
  362.  
  363.      so it will be possible to write an `.xx' roff macro to take care
  364.      of the output typesetting.  This is the default output format
  365.      when working in `ptx' compatibility mode.
  366.  
  367.      In this output format, each non-graphical character, like
  368.      newline and tab, is merely changed to exactly one space, with no
  369.      special attempt to compress consecutive spaces.  Each quote
  370.      character: `"' is doubled so it will be correctly processed by
  371.      `nroff' or `troff'.  All characters having their eight bit set
  372.      are turned into spaces in this version.  It is expectable that
  373.      diacriticized characters will be correctly expressed in `roff'
  374.      terms if I learn how to do this.  So, let me know how to improve
  375.      this special character processing.
  376.  
  377.      This option is not available when the program is operating `ptx'
  378.      compatibility mode.  In fact, it then becomes the default and
  379.      sole output format.
  380.  
  381. `-T'
  382.      Choose an output format suitable for TeX processing.  Each
  383.      output line will look like:
  384.  
  385.           \xx {TAIL}{BEFORE}{KEYWORD}{AFTER}{HEAD}{REF}
  386.  
  387.      so it will be possible to write write a `\xx' definition to take
  388.      care of the output typesetting.  Note that when references are
  389.      not being produced, that is, neither option `-A' nor option `-r'
  390.      is selected, the last parameter of each `\xx' call is inhibited.
  391.  
  392.      In this output format, some special characters, like `$', `%',
  393.      `&', `#' and `_' are automatically protected with a backslash. 
  394.      Curly brackets `{', `}' are also protected with a backslash, but
  395.      also enclosed in a pair of dollar signs to force mathematical
  396.      mode.  The backslash itself produces the sequence
  397.      `\backslash{}'.  Circumflex and tilde diacritics produce the
  398.      sequence `^\{ }' and `~\{ }' respectively.  Other diacriticized
  399.      characters of the underlying character set produce an
  400.      appropriate TeX sequence as far as possible.  The other
  401.      non-graphical characters, like newline and tab, and all others
  402.      characters which are not part of ASCII, are merely changed to
  403.      exactly one space, with no special attempt to compress
  404.      consecutive spaces.  Let me know how to improve this special
  405.      character processing for TeX.
  406.  
  407.      This option is not available when the program is operating `ptx'
  408.      compatibility mode.
  409.  
  410.  
  411. 
  412. File: gptx.info,  Node: Regexps,  Next: ptx mode,  Prev: Usage,  Up: Top
  413.  
  414. Syntax of Regular Expressions
  415. -----------------------------
  416.  
  417.    Regular expressions have a syntax in which a few characters are
  418. special constructs and the rest are "ordinary".  An ordinary
  419. character is a simple regular expression which matches that character
  420. and nothing else.  The special characters are `$', `^', `.', `*',
  421. `+', `?', `[', `]' and `\'; no new special characters will be
  422. defined.  Any other character appearing in a regular expression is
  423. ordinary, unless a `\' precedes it.
  424.  
  425.    For example, `f' is not a special character, so it is ordinary,
  426. and therefore `f' is a regular expression that matches the string `f'
  427. and no other string.  (It does not match the string `ff'.)  Likewise,
  428. `o' is a regular expression that matches only `o'.
  429.  
  430.    Any two regular expressions A and B can be concatenated.  The
  431. result is a regular expression which matches a string if A matches
  432. some amount of the beginning of that string and B matches the rest of
  433. the string.
  434.  
  435.    As a simple example, we can concatenate the regular expressions
  436. `f' and `o' to get the regular expression `fo', which matches only
  437. the string `fo'.  Still trivial.  To do something nontrivial, you
  438. need to use one of the special characters.  Here is a list of them.
  439.  
  440. `. (Period)'
  441.      is a special character that matches any single character except
  442.      a newline.  Using concatenation, we can make regular expressions
  443.      like `a.b' which matches any three-character string which begins
  444.      with `a' and ends with `b'.
  445.  
  446. `*'
  447.      is not a construct by itself; it is a suffix, which means the
  448.      preceding regular expression is to be repeated as many times as
  449.      possible.  In `fo*', the `*' applies to the `o', so `fo*'
  450.      matches one `f' followed by any number of `o's.  The case of
  451.      zero `o's is allowed: `fo*' does match `f'.
  452.  
  453.      `*' always applies to the smallest possible preceding
  454.      expression.  Thus, `fo*' has a repeating `o', not a repeating
  455.      `fo'.
  456.  
  457.      The matcher processes a `*' construct by matching, immediately,
  458.      as many repetitions as can be found.  Then it continues with the
  459.      rest of the pattern.  If that fails, backtracking occurs,
  460.      discarding some of the matches of the `*'-modified construct in
  461.      case that makes it possible to match the rest of the pattern. 
  462.      For example, matching `ca*ar' against the string `caaar', the
  463.      `a*' first tries to match all three `a's; but the rest of the
  464.      pattern is `ar' and there is only `r' left to match, so this try
  465.      fails.  The next alternative is for `a*' to match only two `a's.
  466.      With this choice, the rest of the regexp matches successfully.
  467.  
  468. `+'
  469.      Is a suffix character similar to `*' except that it requires
  470.      that the preceding expression be matched at least once.  So, for
  471.      example, `ca+r' will match the strings `car' and `caaaar' but
  472.      not the string `cr', whereas `ca*r' would match all three strings.
  473.  
  474. `?'
  475.      Is a suffix character similar to `*' except that it can match
  476.      the preceding expression either once or not at all.  For
  477.      example, `ca?r' will match `car' or `cr'; nothing else.
  478.  
  479. `[ ... ]'
  480.      `[' begins a "character set", which is terminated by a `]'.  In
  481.      the simplest case, the characters between the two form the set. 
  482.      Thus, `[ad]' matches either one `a' or one `d', and `[ad]*'
  483.      matches any string composed of just `a's and `d's (including the
  484.      empty string), from which it follows that `c[ad]*r' matches
  485.      `cr', `car', `cdr', `caddaar', etc.
  486.  
  487.      Character ranges can also be included in a character set, by
  488.      writing two characters with a `-' between them.  Thus, `[a-z]'
  489.      matches any lower-case letter.  Ranges may be intermixed freely
  490.      with individual characters, as in `[a-z$%.]', which matches any
  491.      lower case letter or `$', `%' or period.
  492.  
  493.      Note that the usual special characters are not special any more
  494.      inside a character set.  A completely different set of special
  495.      characters exists inside character sets: `]', `-' and `^'.
  496.  
  497.      To include a `]' in a character set, you must make it the first
  498.      character.  For example, `[]a]' matches `]' or `a'.  To include
  499.      a `-', write `--', which is a range containing only `-'.  To
  500.      include `^', make it other than the first character in the set.
  501.  
  502. `[^ ... ]'
  503.      `[^' begins a "complement character set", which matches any
  504.      character except the ones specified.  Thus, `[^a-z0-9A-Z]'
  505.      matches all characters except letters and digits.
  506.  
  507.      `^' is not special in a character set unless it is the first
  508.      character.  The character following the `^' is treated as if it
  509.      were first (`-' and `]' are not special there).
  510.  
  511.      Note that a complement character set can match a newline, unless
  512.      newline is mentioned as one of the characters not to match.
  513.  
  514. `^'
  515.      is a special character that matches the empty string, but only
  516.      if at the beginning of a line in the text being matched. 
  517.      Otherwise it fails to match anything.  Thus, `^foo' matches a
  518.      `foo' which occurs at the beginning of a line.
  519.  
  520. `$'
  521.      is similar to `^' but matches only at the end of a line.  Thus,
  522.      `xx*$' matches a string of one `x' or more at the end of a line.
  523.  
  524. `\'
  525.      has two functions: it quotes the special characters (including
  526.      `\'), and it introduces additional special constructs.
  527.  
  528.      Because `\' quotes special characters, `\$' is a regular
  529.      expression which matches only `$', and `\[' is a regular
  530.      expression which matches only `[', and so on.
  531.  
  532.    Note: for historical compatibility, special characters are treated
  533. as ordinary ones if they are in contexts where their special meanings
  534. make no sense.  For example, `*foo' treats `*' as ordinary since
  535. there is no preceding expression on which the `*' can act.  It is
  536. poor practice to depend on this behavior; better to quote the special
  537. character anyway, regardless of where is appears.
  538.  
  539.    For the most part, `\' followed by any character matches only that
  540. character.  However, there are several exceptions: characters which,
  541. when preceded by `\', are special constructs.  Such characters are
  542. always ordinary when encountered on their own.  Here is a table of
  543. `\' constructs.
  544.  
  545. `\|'
  546.      specifies an alternative.  Two regular expressions A and B with
  547.      `\|' in between form an expression that matches anything that
  548.      either A or B will match.
  549.  
  550.      Thus, `foo\|bar' matches either `foo' or `bar' but no other
  551.      string.
  552.  
  553.      `\|' applies to the largest possible surrounding expressions. 
  554.      Only a surrounding `\( ... \)' grouping can limit the grouping
  555.      power of `\|'.
  556.  
  557.      Full backtracking capability exists to handle multiple uses of
  558.      `\|'.
  559.  
  560. `\( ... \)'
  561.      is a grouping construct that serves three purposes:
  562.  
  563.        1. To enclose a set of `\|' alternatives for other operations.
  564.           Thus, `\(foo\|bar\)x' matches either `foox' or `barx'.
  565.  
  566.        2. To enclose a complicated expression for the postfix `*' to
  567.           operate on.  Thus, `ba\(na\)*' matches `bananana', etc.,
  568.           with any (zero or more) number of `na' strings.
  569.  
  570.        3. To mark a matched substring for future reference.
  571.  
  572.      This last application is not a consequence of the idea of a
  573.      parenthetical grouping; it is a separate feature which happens
  574.      to be assigned as a second meaning to the same `\( ... \)'
  575.      construct because there is no conflict in practice between the
  576.      two meanings.  Here is an explanation of this feature:
  577.  
  578. `\DIGIT'
  579.      after the end of a `\( ... \)' construct, the matcher remembers
  580.      the beginning and end of the text matched by that construct. 
  581.      Then, later on in the regular expression, you can use `\'
  582.      followed by DIGIT to mean "match the same text matched the
  583.      DIGIT'th time by the `\( ... \)' construct."
  584.  
  585.      The strings matching the first nine `\( ... \)' constructs
  586.      appearing in a regular expression are assigned numbers 1 through
  587.      9 in order that the open-parentheses appear in the regular
  588.      expression.  `\1' through `\9' may be used to refer to the text
  589.      matched by the corresponding `\( ... \)' construct.
  590.  
  591.      For example, `\(.*\)\1' matches any newline-free string that is
  592.      composed of two identical halves.  The `\(.*\)' matches the
  593.      first half, which may be anything, but the `\1' that follows
  594.      must match the same exact text.
  595.  
  596. `\`'
  597.      matches the empty string, provided it is at the beginning of the
  598.      buffer.
  599.  
  600. `\''
  601.      matches the empty string, provided it is at the end of the buffer.
  602.  
  603. `\b'
  604.      matches the empty string, provided it is at the beginning or end
  605.      of a word.  Thus, `\bfoo\b' matches any occurrence of `foo' as a
  606.      separate word.  `\bballs?\b' matches `ball' or `balls' as a
  607.      separate word.
  608.  
  609. `\B'
  610.      matches the empty string, provided it is not at the beginning or
  611.      end of a word.
  612.  
  613. `\<'
  614.      matches the empty string, provided it is at the beginning of a
  615.      word.
  616.  
  617. `\>'
  618.      matches the empty string, provided it is at the end of a word.
  619.  
  620. `\w'
  621.      matches any word-constituent character.  The editor syntax table
  622.      determines which characters these are.
  623.  
  624. `\W'
  625.      matches any character that is not a word-constituent.
  626.  
  627.    Here is a complicated regexp, used by Emacs to recognize the end
  628. of a sentence together with any whitespace that follows.  It is given
  629. in Lisp syntax to enable you to distinguish the spaces from the tab
  630. characters.  In Lisp syntax, the string constant begins and ends with
  631. a double-quote.  `\"' stands for a double-quote as part of the
  632. regexp, `\\' for a backslash as part of the regexp, `\t' for a tab
  633. and `\n' for a newline.
  634.  
  635.      "[.?!][]\"')]*\\($\\|\t\\|  \\)[ \t\n]*"
  636.  
  637.    This contains four parts in succession: a character set matching
  638. period, `?' or `!'; a character set matching close-brackets, quotes
  639. or parentheses, repeated any number of times; an alternative in
  640. backslash-parentheses that matches end-of-line, a tab or two spaces;
  641. and a character set matching whitespace characters, repeated any
  642. number of times.
  643.  
  644.  
  645. 
  646. File: gptx.info,  Node: ptx mode,  Next: Future,  Prev: Regexps,  Up: Top
  647.  
  648. `ptx' compatibility mode
  649. ------------------------
  650.  
  651.    This section outlines the differences between this program and
  652. standard `ptx'.  There is also a `ptx' compatibility mode in this
  653. program which is activated implicitely when the program is called
  654. under the name `ptx' or explicitely through the usage of option `-p'.
  655. For someone used to standard `ptx', here are some points worth
  656. noticing when not using `ptx' compatibility mode:
  657.  
  658.    * In normal mode, concordance output is not formatted for `troff'
  659.      or `nroff'.  By default, output is rather formatted for a dumb
  660.      terminal.  `troff' or `nroff' output may still be selected
  661.      through option `-O'.
  662.  
  663.    * In normal mode, unless `-R' option is used, the maximum
  664.      reference width is subtracted from the total output line width. 
  665.      In `ptx' compatibility mode, width of references are not taken
  666.      into account in the output line width computations.
  667.  
  668.    * In normal mode, all 256 characters, even `NUL's, are read and
  669.      processed from input file with no adverse effect.  No attempt is
  670.      made to limit this in `ptx' compatibility mode.  However,
  671.      standard `ptx' does not accept 8-bit characters, a few control
  672.      characters are rejected, and the tilde `~' is condemned.
  673.  
  674.    * In normal mode, input lines may be of infinite length.  No
  675.      attempt is made to limit this in `ptx' compatibility mode. 
  676.      However, standard `ptx' processes only the first 200 characters
  677.      in each line.
  678.  
  679.    * In normal mode, the break (non-word) characters default to be
  680.      every character except letters.  In `ptx' compatibility mode,
  681.      the break characters default to space, tab and newline only.
  682.  
  683.    * In some circumstances, output lines are filled a little more
  684.      completely in normal mode than in `ptx' compatibility mode. 
  685.      Even in `ptx' mode, there are some slight disposition glitches
  686.      this program does not completely reproduce, even if it comes
  687.      quite close.
  688.  
  689.    * The Ignore file default in `ptx' compatibility mode is not the
  690.      same as in normal mode.  In default installation, default Ignore
  691.      files are `/usr/lib/eign' in `ptx' compatibility mode, and
  692.      nothing in normal mode.
  693.  
  694.    * Standard `ptx' disallows specifying both the Ignore file and the
  695.      Only file at the same time.  This version allows both, and
  696.      specifying an Only file does not inhibit processing the Ignore
  697.      file.
  698.  
  699.  
  700. 
  701. File: gptx.info,  Node: Future,  Prev: ptx mode,  Up: Top
  702.  
  703. Development guidelines
  704. ----------------------
  705.  
  706.    This should evolve towards a concordance package for GNU, able to
  707. tackle true, real, big concordance jobs, while being fast and of easy
  708. use for little jobs.  The start point is standard `ptx'.  Because
  709. several packages of this kind are awfully slow, I should reasonnably
  710. try to keep speed in mind.  On the other end, I do not want to burden
  711. myself too much about interactive query for now; so, a future
  712. reorientation along this topic might require some work.
  713.  
  714.    Here is a *What To Do Next* list, in expected execution order.
  715.  
  716.   1. Increase short term usability:
  717.  
  718.         * Support the program for the GNU community.  As directed by
  719.           user comments, test and debug the whole thing more fully,
  720.           and on bigger examples.  Solve portability glitches as long
  721.           as this do not induce too ugly things in the code.
  722.  
  723.         * Provide sample macros in the documentation.
  724.  
  725.         * Understand and mimic `-t' option, if I can.
  726.  
  727.         * See how TeX mode could be made more useful, and if a
  728.           texinfo mode would mean something to someone.
  729.  
  730.         * Sort keywords intelligently for Latin-1 code.  See how to
  731.           interface this character set with various output formats. 
  732.           Also, introduce options to inverse-sort and possibly to
  733.           reverse-sort.
  734.  
  735.         * Improve speed for Ignore and Only tables.  Consider hashing
  736.           instead of sorting.  Consider playing with obstacks to
  737.           digest them.
  738.  
  739.         * Provide better handling of format effectors obtained from
  740.           input, and also attempt white space compression on output
  741.           which would still maximize full output width usage.
  742.  
  743.   2. Provide multiple language support.
  744.  
  745.         Most of the boosting work should go along the line of fast
  746.      recognition of multiple and complex boundaries, which define
  747.      various `languages'.  Each such language has its own rules for
  748.      words, sentences, paragraphs, and reporting requests.  This is
  749.      less difficult than I first thought:
  750.  
  751.         * Learn how to use getopt, or write something if necessary. 
  752.           Recognize language modifiers with each option.  At least
  753.           -b, -i, -o, -W, -S, and also new language switcher options,
  754.           will have such modifiers.  Modifiers on language switchers
  755.           will allow or disallow language transitions.
  756.  
  757.         * Complete the transformation of underlying variables into
  758.           arrays in the code.
  759.  
  760.         * Implement a heap of positions in the input file.  There is
  761.           one entry in the heap for each compiled regexp; it is
  762.           initialized by a re_search after each regexp compile. 
  763.           Regexps reschedule themselves in the heap when their
  764.           position passes while scanning input.  In this way, looking
  765.           simultaneously for a lot of regexps should not be too
  766.           inefficient, once the scanning starts.  If this works ok,
  767.           maybe consider accepting regexps in Only and Ignore tables.
  768.  
  769.         * Merge with language processing boundary processing options,
  770.           really integrating -S processing as a special case.  Maybe,
  771.           implement several level of boundaries.  See how to
  772.           implement a stack of languages, for handling quotations. 
  773.           See if more sophisticated references could be handled as
  774.           another special case of a language.
  775.  
  776.   3. Tackle other aspects, in a more long term view:
  777.  
  778.         * Add options for statistics, frequency lists, referencing,
  779.           and all other prescreening tools and subsidiary tasks of
  780.           concordance production.
  781.  
  782.         * Develop an interactive mode.  Even better, construct a GNU
  783.           emacs interface.  I'm looking at Gene Myers
  784.           <gene@cs.arizona.edu> suffix arrays as a possible
  785.           implementation along those ideas.
  786.  
  787.         * Implement hooks so word classification and tagging should
  788.           be merged in.  See how to effectively hook in lemmatisation
  789.           or other morphological features.  It is far from being
  790.           clear by now how to interface this correctly, so some
  791.           experimentation is mandatory.
  792.  
  793.         * Profile and speed up the whole thing.
  794.  
  795.         * Make it work on small address space machines.  Consider
  796.           three levels of hugeness for files, and three corresponding
  797.           algorithms to make optimal use of memory.  The first case
  798.           is when all the input files and all the word references fit
  799.           in memory: this is the case currently implemented.  The
  800.           second case is when the files cannot fit all together in
  801.           memory, but the word references do.  The third case is when
  802.           even the word references cannot fit in memory.
  803.  
  804.         * There also are subsidiary developments for in-core
  805.           incremental sort routines as well as for a huge external
  806.           sort package.  The need for more flexible sort packages
  807.           comes partly from the fact that linguists use kinds of keys
  808.           which compare in unusual and more sophisticated ways.
  809.  
  810.  
  811.    
  812. Tag Table:
  813. Node: Top856
  814. Node: Usage1818
  815. Node: General options4537
  816. Node: Charset selection4995
  817. Node: Input processing5781
  818. Node: Output formatting11223
  819. Node: Regexps18062
  820. Node: ptx mode28171
  821. Node: Future30648
  822. 
  823. End Tag Table
  824.