Hi,
in the current GPC version, I've included a StringUtils unit for general string handling routines (on a higher level than the built-in and RTS routines).
Up to now, it only contains routines for a string hash table, but I'm planning to add some more routines. Perhaps some of you also have some routines to contribute (or features to request). Conditions for inclusion into this unit should be, IMHO:
- Generally useful (not meant specifically for a certain program or something),
- self-contained (not relying on an external library etc.),
- new functionality compared to the existing routines (whereas the same or similar functionality under a different interface for compatibility purposes should go into other units, like GPCUtil for compatibility to `Turbo Power' units),
- and, of course, compilable with the current GPC version, portable, bug-free, etc. ;-)
The same goes for the FileUtils unit which has been there for some months already.
Frank
On Wed, 13 Sep 2000, Frank Heckenbach wrote:
Hi,
in the current GPC version, I've included a StringUtils unit for general string handling routines (on a higher level than the built-in and RTS routines).
Up to now, it only contains routines for a string hash table, but I'm planning to add some more routines. Perhaps some of you also have some routines to contribute (or features to request).
May be a unit in my tool box is a candidate. Everybody can read it at: http://www.desy.de/~bohnen/gpc/dictionary.pas I can't give anwers next 3 weeks, will be back on Oct 7. Ernst-Ludwig Bohnen
Conditions for inclusion into this unit should be, IMHO:
Generally useful (not meant specifically for a certain program or something),
self-contained (not relying on an external library etc.),
new functionality compared to the existing routines (whereas the same or similar functionality under a different interface for compatibility purposes should go into other units, like GPCUtil for compatibility to `Turbo Power' units),
and, of course, compilable with the current GPC version, portable, bug-free, etc. ;-)
The same goes for the FileUtils unit which has been there for some months already.
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
Ernst-Ludwig Bohnen wrote:
On Wed, 13 Sep 2000, Frank Heckenbach wrote:
in the current GPC version, I've included a StringUtils unit for general string handling routines (on a higher level than the built-in and RTS routines).
Up to now, it only contains routines for a string hash table, but I'm planning to add some more routines. Perhaps some of you also have some routines to contribute (or features to request).
May be a unit in my tool box is a candidate. Everybody can read it at: http://www.desy.de/~bohnen/gpc/dictionary.pas
I think this unit is good as a standalone unit. Be welcome to contribute it to GPC (if you agree to release it under some free license). If you like to upload it to some "official" place, Peter Gerwinski can arrange for that.
Frank
On Mon, 16 Oct 2000, Frank Heckenbach wrote:
Ernst-Ludwig Bohnen wrote:
On Wed, 13 Sep 2000, Frank Heckenbach wrote:
in the current GPC version, I've included a StringUtils unit for general string handling routines (on a higher level than the built-in and RTS routines).
Up to now, it only contains routines for a string hash table, but I'm planning to add some more routines. Perhaps some of you also have some routines to contribute (or features to request).
May be a unit in my tool box is a candidate. Everybody can read it at: http://www.desy.de/~bohnen/gpc/dictionary.pas
I think this unit is good as a standalone unit. Be welcome to contribute it to GPC (if you agree to release it under some free license). If you like to upload it to some "official" place,
Ok, let's do this. The unit dictionary.pas needs base.pas found on the same place. If there is any action I should do, please tell me. How do we handle new releases?
Ernst-Ludwig
Peter Gerwinski can arrange for that.
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
Long time ago, Ernst-Ludwig Bohnen wrote:
On Mon, 16 Oct 2000, Frank Heckenbach wrote:
Ernst-Ludwig Bohnen wrote:
May be a unit in my tool box is a candidate. Everybody can read it at: http://www.desy.de/~bohnen/gpc/dictionary.pas
I think this unit is good as a standalone unit. Be welcome to contribute it to GPC (if you agree to release it under some free license). If you like to upload it to some "official" place,
Ok, let's do this. The unit dictionary.pas needs base.pas found on the same place. If there is any action I should do, please tell me. How do we handle new releases?
This seems to have been forgotten. But now, with GPC on the new server, it's possible again to upload things in the contrib area.
So if you still like to contribute it, please let me know. I can either give you an account (ssh/scp) so you can upload and update things yourself, or you can send things to me and I'll put them up.
Frank
On Fri, 26 Apr 2002, Frank Heckenbach wrote:
Long time ago, Ernst-Ludwig Bohnen wrote:
On Mon, 16 Oct 2000, Frank Heckenbach wrote:
Ernst-Ludwig Bohnen wrote:
May be a unit in my tool box is a candidate. Everybody can read it at: http://www.desy.de/~bohnen/gpc/dictionary.pas
I think this unit is good as a standalone unit. Be welcome to contribute it to GPC (if you agree to release it under some free license). If you like to upload it to some "official" place,
Ok, let's do this. The unit dictionary.pas needs base.pas found on the same place. If there is any action I should do, please tell me. How do we handle new releases?
This seems to have been forgotten. But now, with GPC on the new server, it's possible again to upload things in the contrib area.
So if you still like to contribute it, please let me know. I can either give you an account (ssh/scp) so you can upload and update things yourself, or you can send things to me and I'll put them up.
I had been out several weeks, so the answer is somewhat late. I still like to contribute, though missing or poor documentation may be a severe handicap. But nevertheless let's start with an account with ssh, scp, wget etc. and some (writable) disk space.
BTW, in order to compile and test some units with the new gpc-2.1 release I realised that my lovely GPC installer (install.gpc) doesn't work anymore. Beside some simple other problems (wich have been solved within the script) after unzipping the gpc-2.1.tar.gz file the dir name is gpc-20020510 instead of gpc-2.1 but install.gpc expects only identical base names. I could repair this behavior as well in the script, but we would loose the very usefull feature of simple switching between different gpc versions in case of trouble.
Two questions: - Is there a way to access ALL gpc versions from the same URL-directory, possibly by symlinks? - Could gpc-versionxyz.tar.gz resolve after untaring to dir gpc-versionxyz ?
If I am not wrong a link ../beta/gpc-20020510.tar.gz to ../current/gpc-2.1.tar.gz can do the job in a single step, and in addition dissolve the (little) confusion that the newest GPC-manual for 2.1 is labeled with 'version 20020510' anyway.
Ernst-Ludwig
PS: Current work around for the problem mentioned above is download manually gpc-2.1.tar.gz, rename it to gpc-20020510.tar.gz, then run 'install.gpc -pv gpc-20020510' Install.gpc doesn't download again if it finds a valid gpc...tar.gz file in dir /tmp/${USER}/install.gpc. Installation works fine, gpc 2.1 as well but I hadn't time enough to test everything.
Ernst-Ludwig Bohnen wrote:
I had been out several weeks, so the answer is somewhat late. I still like to contribute, though missing or poor documentation may be a severe handicap. But nevertheless let's start with an account with ssh, scp, wget etc. and some (writable) disk space.
OK. Details by private mail.
BTW, in order to compile and test some units with the new gpc-2.1 release I realised that my lovely GPC installer (install.gpc) doesn't work anymore. Beside some simple other problems (wich have been solved within the script) after unzipping the gpc-2.1.tar.gz file the dir name is gpc-20020510 instead of gpc-2.1 but install.gpc expects only identical base names. I could repair this behavior as well in the script, but we would loose the very usefull feature of simple switching between different gpc versions in case of trouble.
Some who worked on this script may already have solved (part of) this problem, but I didn't follow this closely ...
Two questions:
- Is there a way to access ALL gpc versions from the same URL-directory, possibly by symlinks?
- Could gpc-versionxyz.tar.gz resolve after untaring to dir gpc-versionxyz ?
If I am not wrong a link ../beta/gpc-20020510.tar.gz to ../current/gpc-2.1.tar.gz can do the job in a single step,
... except that it isn't really a beta version. ;-)
and in addition dissolve the (little) confusion that the newest GPC-manual for 2.1 is labeled with 'version 20020510' anyway.
As far as I'm concerned, I don't give much for the "release" version numbers, anyway. I'd prefer to always use the date. But somehow the release versions seem to be "expected" ...
Anyway, the next updates will be labelled alpha again (though they probably won't be less stable than 2.1, but I'll do less thorough testing before uploads). I think we should leave 2.1 (and only this one) in current, shouldn't we? OTOH, we can probably remove the betas before 2.1 soon (whereas it will probably be some time before any 2.2 betas will appear).
So maybe I should link 2.1 to 20020510 in current, and the script would need to find the latest in alpha, beta and current (maybe with an option to ignore alphas for those who don't want to try them) ...?
Frank
On Thu, 30 May 2002, Frank Heckenbach wrote:
Ernst-Ludwig Bohnen wrote:
I had been out several weeks, so the answer is somewhat late. I still like to contribute, though missing or poor documentation may be a severe handicap. But nevertheless let's start with an account with ssh, scp, wget etc. and some (writable) disk space.
OK. Details by private mail.
BTW, in order to compile and test some units with the new gpc-2.1 release I realised that my lovely GPC installer (install.gpc) doesn't work anymore. Beside some simple other problems (wich have been solved within the script) after unzipping the gpc-2.1.tar.gz file the dir name is gpc-20020510 instead of gpc-2.1 but install.gpc expects only identical base names. I could repair this behavior as well in the script, but we would loose the very usefull feature of simple switching between different gpc versions in case of trouble.
Some who worked on this script may already have solved (part of) this problem, but I didn't follow this closely ...
Two questions:
- Is there a way to access ALL gpc versions from the same URL-directory, possibly by symlinks?
- Could gpc-versionxyz.tar.gz resolve after untaring to dir gpc-versionxyz ?
If I am not wrong a link ../beta/gpc-20020510.tar.gz to ../current/gpc-2.1.tar.gz can do the job in a single step,
... except that it isn't really a beta version. ;-)
You are right, it is not a very clean solution.
and in addition dissolve the (little) confusion that the newest GPC-manual for 2.1 is labeled with 'version 20020510' anyway.
As far as I'm concerned, I don't give much for the "release" version numbers, anyway. I'd prefer to always use the date. But somehow the release versions seem to be "expected" ...
Anyway, the next updates will be labelled alpha again (though they probably won't be less stable than 2.1, but I'll do less thorough testing before uploads). I think we should leave 2.1 (and only this one) in current, shouldn't we? OTOH, we can probably remove the betas before 2.1 soon (whereas it will probably be some time before any 2.2 betas will appear).
So maybe I should link 2.1 to 20020510 in current, and the script would need to find the latest in alpha, beta and current (maybe with an option to ignore alphas for those who don't want to try them) ...?
Ok, I change the script this way: looking in current by default and as an option looking in alpha and/or beta (but expecting always the date format gpc-yyyymmdd.tar.gz, which resolves to dir gpc-yyyymmdd). I put the last version to ../contrib/ernst/tools/install.gpc. It allows selection of URLs & versions at the command line, but 'beta' is the default yet.
Thank you for help. Ernst-Ludwig
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html
Ernst-Ludwig Bohnen wrote:
So maybe I should link 2.1 to 20020510 in current, and the script would need to find the latest in alpha, beta and current (maybe with an option to ignore alphas for those who don't want to try them) ...?
Ok, I change the script this way: looking in current by default and as an option looking in alpha and/or beta (but expecting always the date format gpc-yyyymmdd.tar.gz, which resolves to dir gpc-yyyymmdd). I put the last version to ../contrib/ernst/tools/install.gpc. It allows selection of URLs & versions at the command line, but 'beta' is the default yet.
OK, I made the symlink in current.
Frank
I've added the following functions to StringUtils. If someone has any comments (possible interface changes, etc.), please let me know. (Most of them have been used in my IDE PENG for some time.)
{ Returns the number of disjoint occurences of SubStr in s. Returns 0 if SubStr is empty. } function StrCount (const SubStr : String; s : String) : Integer;
{ Returns s, with all disjoint occurences of Source replaced by Dest. } function StrReplace (const s, Source, Dest : String) : TString;
{ Converts a digit character to its numeric value. Handles every base up to 36 (0 .. 9, a .. z, upper and lower case recognized). Returns -1 if the character is not a digit at all. If you want to use it for a base < 36, you have to check if the result is smaller than the base and not equal to -1. } function Char2Digit (ch : Char) : Integer;
{ Encode a string in a printable format (quoted printable and surrounded with `"'). All occurences of `"' within the string are encoded, so the result string contains exactly two `"' characters (at the beginning and ending). This is useful to store arbitrary strings in text files while keeping them as readable as possible (which is the goal of the quoted printable encoding in general, RFC 1521, section 5.1) and being able to read them back losslessly (with UnQuoteString). } function QuoteString (const s : String) : TString;
{ Decode a string encoded by QuoteString (removing the `"' and expanding quoted printable encoded characters). Returns True if successful and False if the string has an invalid form. A string returned by QuoteString is always valid. } function UnQuoteString (var s : String) : Boolean;
{ Replaces all tab characters in s with the appropriate amount of spaces, assuming tab stops at every TabSize columns. Returns True if successful and False if the expanded string would exceed the capacity of s. In the latter case, some, but not all of the tabs in s may have been expanded. } function ExpandTabs (var s : String; TabSize : Integer) : Boolean;
{ Returns s, with all occurences of C style escape sequences (e.g. `\n') replaced by the characters they mean. If AllowOctal is True, also octal character specifications (e.g. `\007') are replaced. If RemoveQuoteChars is True, any other backslashes are removed (e.g. `*' -> `*' and `\' -> `'), otherwise they are kept, and also `\' is left as two backslashes then. } function ExpandCEscapeSequences (const s : String; RemoveQuoteChars, AllowOctal : Boolean) : TString;
I'm also planning to add the following routines for parsing strings (again, comments welcome):
{ Sets of characters accepted for `True' and `False' by Char2Boolean and StrReadBoolean. } var CharactersTrue : CharSet = ['Y', 'y']; CharactersFalse : CharSet = ['N', 'n'];
{ If ch is an element of CharactersTrue, Dest is set to True, otherwise if it is an element of CharactersFalse, Dest is set to False. In both cases True is returned. If ch is not an element of either set, Dest is set to False and False is returned. } function Char2Boolean (ch : Char; var Dest : Boolean) : Boolean;
{ All the following StrReadFoo functions behave similarly. They read items from a string s, starting at index i, to a variable Dest. They skip any space characters (spaces and tabs) by incrementing i first. They return True if successful, False otherwise. i is incremented accordingly if successful, otherwise i is left unchanged, apart from the skipping of space characters, and Dest is undefined. This behaviour makes it easy to use the functions in a row like this: i := 1; if StrReadInt (s, i, Size) and StrReadComma (s, i) and StrReadQuoted (s, i, Name) and StrReadComma (s, i) and ... }
{ Just skip any space characters as described above. } procedure StrSkipSpaces (const s : String; var i : Integer);
{ Read a quoted string (as produced by QuoteString) from a string and unquote the result using UnQuoteString. It is considered failure if the result (unquoted) would be longer than the capacity of Dest.} function StrReadQuoted (const s : String; var i : Integer; var Dest : String) : Boolean;
{ Read a string delimited with Delimiter from a string and return the result with the delimiters removed. It is considered failure if the result (without delimiters) would be longer than the capacity of Dest. } function StrReadDelimited (const s : String; var i : Integer; var Dest : String; Delimiter : Char) : Boolean;
{ Read a word (consisting of anything but space characters and commas) from a string. It is considered failure if the result would be longer than the capacity of Dest. } function StrReadWord (const s : String; var i : Integer; var Dest : String) : Boolean;
{ Check that a certain string is contained in s (after possible space characters). } function StrReadConst (const s : String; var i : Integer; const Expected : String) : Boolean;
{ A simpler to use version of StrReadConst that expects a `,'. } function StrReadComma (const s : String; var i : Integer) : Boolean;
{ Read an integer number from a string. } function StrReadInt (const s : String; var i : Integer; var Dest : Integer) : Boolean;
{ Read a real number from a string. } function StrReadReal (const s : String; var i : Integer; var Dest : Real) : Boolean;
{ Read a Boolean value, represented by a single character from CharactersTrue or CharactersFalse (cf. Char2Boolean), from a string. } function StrReadBoolean (const s : String; var i : Integer; var Dest : Boolean) : Boolean;
{ Read an enumerated value, i.e., one of the entries of IDs, from a string, and stores the ordinal value, i.e., the index in IDs (always zero-based) in Dest. } function StrReadEnum (const s : String; var i : Integer; var Dest : Integer; var IDs : array of PString) : Boolean;
Frank
I wrote:
I'm also planning to add the following routines [to the StringUtils unit] for parsing strings (again, comments welcome):
function Char2Boolean (ch : Char; var Dest : Boolean) : Boolean; procedure StrSkipSpaces (const s : String; var i : Integer); [...] function StrReadEnum (const s : String; var i : Integer; var Dest : Integer; var IDs : array of PString) : Boolean;
Just to let you know, I've added them now (will be in the CVS soon).
Frank