File: strings.ads

package info (click to toggle)
libtexttools 2.0.3-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,188 kB
  • ctags: 635
  • sloc: ada: 13,120; cpp: 1,679; ansic: 777; makefile: 156; sh: 2
file content (93 lines) | stat: -rw-r--r-- 5,283 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
------------------------------------------------------------------------------
-- STRINGS                                                                  --
--                                                                          --
-- Part of TextTools                                                        --
-- Designed and Programmed by Ken O. Burtch                                 --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
--                 Copyright (C) 1999-2003 Ken O. Burtch                    --
--                                                                          --
-- This is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion.  This is distributed in the hope that it will be useful, but WITH- --
-- OUT 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  distributed with this;  see file COPYING.  If not, write --
-- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
-- MA 02111-1307, USA.                                                      --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
-- This is maintained at http://www.vaxxine.com/pegasoft                    --
--                                                                          --
------------------------------------------------------------------------------
with common; use common;
  pragma Elaborate( common ); -- remind Ada the common elaborates first

package strings is

---> Misc Functions
--
-- FixSpacing - remove leading/trailing spaces, etc.
-- HashOf - compute a random value from the string
-- PhoneticsOf - compute English phonetics of the string
-- TypoOf - true if first string is a typo of the second
-- Tokenize - represent the position of the string in a list as an
--            encoded character, or ' ' if not in list or list too long
-- Untokenize - return the string represented by the encoded character
-- FGREP - search for a string is a list of text
-- SED   - search for a string in a list of text and operate on it
-- AWK   - UNIX awk on a list of text

procedure FixSpacing( s : in out str255 );
function HashOf( hashstr : str255 ) return long_integer;
function PhoneticsOf( s : str255 ) return str255;
function TypoOf( BadString, GoodString : Str255 ) return boolean;
procedure Tokenize( s : str255; words : in out Str255List.List;
   ch : in out character );
procedure Untokenize( ch : character ; words : in out Str255List.List;
  s : in out str255 );
function  ToUpper( s : str255 ) return str255;
function  ToLower( s : str255 ) return str255;
function  FGREP( s : str255; text : str255; filter_out : boolean := false;
  case_insensitive : boolean := false ) return boolean;
function  FGREP( s : str255; text : str255; filter_out : boolean := false;
  case_insensitive : boolean := false ) return str255;
procedure FGREP( s : str255; text : in out Str255List.List;
  filter_out : boolean := false; case_insensitive : boolean := false );
procedure FGREP( s : str255; text : in out Str255List.List;
  result : out boolean; filter_out : boolean := false;
  case_insensitive : boolean := false );
procedure SED( sedexpr : str255; text : in out Str255List.List );
procedure AWK( awkexpr, text : in out Str255List.List );

---> ASCII Encoding/Decoding
--
-- Compresses and appends a basic data item to the given string

subtype EncodedString is str255;

procedure Encode( estr : in out EncodedString; b : boolean );
procedure Encode( estr : in out EncodedString; c : character );
procedure Encode( estr : in out EncodedString; i : integer );
procedure Encode( estr : in out EncodedString; l : long_integer );
procedure Encode( estr : in out EncodedString; r : ARect );
procedure Encode( estr : in out EncodedString; s : str255 );

procedure Decode( estr : in out EncodedString; b : in out boolean );
procedure Decode( estr : in out EncodedString; c : in out character );
procedure Decode( estr : in out EncodedString; i : in out integer );
procedure Decode( estr : in out EncodedString; l : in out long_integer );
procedure Decode( estr : in out EncodedString; r : in out ARect );
procedure Decode( estr : in out EncodedString; s : in out str255 );

end strings;