[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strings module



Hi.

I uploaded the file Strings.tar.gz to the incoming/lib directory.
Here is the README:


Here are some new lib modules: Strings, CharClass, Ascii.  Strings has
been tested somewhat, and I'm quite sure that it works as it should.
But don't hold me on this :).  Most code is derived from o2c anyway.
There isn't much to test with Ascii and CharClass.

Here is some additional info:

------------------------------------------------------------------------

Strings.Mod is an (almost) ISO M2 compliant implementation of the
basic string manipulation functions.

It has been tested somewhat by module StringsTest.Mod, using
StringsTest.in as input.  I put the output of the command `StringsTest
<StringTest.in' into StringsTest.out.  This file also can serve as a
list of examples for various calls to the Strings procedures. 

Notes:
- Unlike Modula-2, the behaviour of a procedure is undefined, if one
  of its input parameters is an unterminated character array.
- Unlike Modula-2, it is possible to pass a negative value to an input
  parameter that represents an array position or a string length.  All
  procedures use ASSERT to ensure that the actual parameter is not
  negative in this case (exception: `FindPrev' accepts a negative
  `startPos'). 

Differences from Oakwood Guidelines:
- `Delete' is defined for `startPos' greater than `Length(stringVar)' 
- `Insert' is defined for `startPos' greater than `Length(destination)' 
- `Replace' is defined for `startPos' greater than `Length(destination)'
- `Replace' will never return a string in `destination' that is longer
  than the initial value of `destination' before the call.
- `Capitalize' replaces `Cap'
- `FindNext' replaces `Pos' with slightly changed call pattern
- the `CanSomethingAll' predicates are new  
- also new: `Compare', `Equal', `FindPrev', and `FindDiff'

------------------------------------------------------------------------

MODULE CharClass;  (* Classification of values of the type CHAR *)

Notes:
- This module boldly assumes ASCII character encoding. ;-)
- The procedures IsEOL and EOL are not part of the Modula-2 DIS.  Both
  are, strictly speaking, system dependent.  Ascii.lf is for Unix and
  AmigaOS the end of line marker, but this may differ for other 
  systems.  Take for example MSDOS, which uses the two letter
  combination Ascii.cr plus Ascii.lf.  But I think we can safely
  ignore this particular OS.

------------------------------------------------------------------------

MODULE Ascii;  (* Standard short character names for control chars.  *)

Not much to say about this module...




-- Michael van Acken <acken@informatik.uni-kl.de>