:- module(strings,['strings.<.p2'/2,'strings.>.p2'/2 ]).  % converted djd

:- style_check(-singleton). % added djd
%% :- module('strings', []).
:- discontiguous 'strings':'strings.split.p4'/4. %% added djd
:- discontiguous 'strings':'~strings.split.p4'/4. %% added djd
:- discontiguous 'strings.split.p4'/4. %% added djd
:- discontiguous '~strings.split.p4'/4. %% added djd



:- op(500, yfx, and).
:- op(400, yfx, or).

'strings.lastSubstring.p3'(A, B, C) :-
        user:goedel_freeze(ground([A])and ground([B])or ground([C]), 'strings':'strings.lastSubstring.p3.0'(A,B,C)).
'~strings.lastSubstring.p3'(A, B, C) :-
        user:goedel_freeze(ground([A])and ground([B])or ground([C]), 'strings':'~strings.lastSubstring.p3.0'(A,B,C)).
'strings.lastSubstring.p3.0'(A, B, C) :-
        'integers':'integers.>=.p2'(B, 0),
        'strings.stringInts.p2'(A, D),
        'lists':'lists.length.p2'(D, E),
        'integers':minus(E, B, F),
        'strings.split.p4'(F, D, _, G),
        'strings.stringInts.p2'(C, G).
'~strings.lastSubstring.p3.0'(A, B, C) :-
        'integers':'~integers.>=.p2'(B, 0),
        '~strings.stringInts.p2'(A, D),
        'lists':'~lists.length.p2'(D, E),
        'integers':minus(E, B, F),
        '~strings.split.p4'(F, D, _, G),
        '~strings.stringInts.p2'(C, G).
'strings.firstSubstring.p3'(A, B, C) :-
        user:goedel_freeze(ground([A])and ground([B])or ground([C]), 'strings':'strings.firstSubstring.p3.0'(A,B,C)).
'~strings.firstSubstring.p3'(A, B, C) :-
        user:goedel_freeze(ground([A])and ground([B])or ground([C]), 'strings':'~strings.firstSubstring.p3.0'(A,B,C)).
'strings.firstSubstring.p3.0'(A, B, C) :-
        'integers':'integers.>=.p2'(B, 0),
        'strings.stringInts.p2'(A, D),
        'strings.split.p4'(B, D, E, _),
        'strings.stringInts.p2'(C, E).
'~strings.firstSubstring.p3.0'(A, B, C) :-
        'integers':'~integers.>=.p2'(B, 0),
        '~strings.stringInts.p2'(A, D),
        '~strings.split.p4'(B, D, E, _),
        '~strings.stringInts.p2'(C, E).
'strings.split.p4'(0, A, [], A).
'~strings.split.p4'(0, A, [], A).
'strings.split.p4'(A, [B|C], [B|D], E) :-
        'integers':'integers.>.p2'(A, 0),
        'integers':minus(A, 1, F),
        'strings.split.p4'(F, C, D, E).
'~strings.split.p4'(A, [B|C], [B|D], E) :-
        'integers':'~integers.>.p2'(A, 0),
        'integers':minus(A, 1, F),
        '~strings.split.p4'(F, C, D, E).
'strings.width.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'strings':'strings.width.p2.0'(A,B)).
'~strings.width.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'strings':'~strings.width.p2.0'(A,B)).
'strings.width.p2.0'(A, B) :-
        'strings.stringInts.p2'(A, C),
        'lists':'lists.length.p2'(C, B).
'~strings.width.p2.0'(A, B) :-
        '~strings.stringInts.p2'(A, C),
        'lists':'~lists.length.p2'(C, B).

%%%% module(strings_sup,[]).  %% converted djd
/*
File:		strings.sup
Subject:	the system module Strings.
Author:		Jiwei Wang
Date:		17 September 1991

================================================================================
*/

%%'$$module'('@(#)Strings.sup 1.10 last updated 93/12/08 17:56:01 by jiwei').


'strings.stringInts.p2'(String, IntList) :-
   nonvar(String), !,
   name(String, [34|IntList]).  % 34 for "

'strings.stringInts.p2'(String, IntList) :-
   ground(IntList), !,
   name(String, [34|IntList]).  % 34 for "

'strings.stringInts.p2'(String, IntList) :-
   user:goedel_freeze(ground([IntList]) or ground([String]),
		'strings':'strings.stringInts.p2'(String, IntList)).

'~strings.stringInts.p2'(String, IntList) :-
   'strings.stringInts.p2'(String, IntList).

%------------------------------------------------------------------------------

'strings.<.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @< Y.

'strings.<.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @< Y).


'~strings.<.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @< Y.

'~strings.<.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @< Y).

%------------------------------------------------------------------------------

'strings.>.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @> Y.

'strings.>.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @> Y).


'~strings.>.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @> Y.

'~strings.>.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @> Y).

%------------------------------------------------------------------------------

'strings.=<.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @=< Y.

'strings.=<.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @=< Y).

'~strings.=<.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @=< Y.

'~strings.=<.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @=< Y).

%------------------------------------------------------------------------------

'strings.>=.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @>= Y.

'strings.>=.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @>= Y).

'~strings.>=.p2'(X, Y) :-
   atom(X), atom(Y), !,
   X @>= Y.

'~strings.>=.p2'(X, Y) :-
   user:goedel_freeze(ground([X,Y]),  X @>= Y).

%------------------------------------------------------------------------------
% for ++

concat(X, Y, Z) :-
   nonvar(X), nonvar(Y), !,
   name(X, Xs),
   name(Y, [34|Ys]),   % 34 for "
   user:append(Xs, Ys, L),
   name(Z, L).

concat(X, Y, Z) :-
   nonvar(Z), !,
   name(Z, [34|Zs]),    % 34 for "
   ( nonvar(X)
     -> name(X, [34|Xs]),    % 34 for "
	user:append(Xs, Ys, Zs),
	name(Y, [34|Ys])   % 34 for "
     ;  ( nonvar(Y)
          -> name(Y, [34|Ys]),    % 34 for "
	     user:append(Xs, Ys, Zs), !,
	     name(X, [34|Xs])   % 34 for "
	  ;  user:append(Xs, Ys, Zs),
	     name(Y, [34|Ys]),    % 34 for "
	     name(X, [34|Xs])    % 34 for "
	)
   ).

concat(X, Y, Z) :-
   user:goedel_freeze(ground([Z]) or ground([X,Y]), 'strings':concat(X,Y,Z)).

Dump of variables at termination

Natural variables

ABORT = PATTERN
ALPHANUMETC = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'
ARB = PATTERN
BAL = PATTERN
FAIL = PATTERN
FENCE = PATTERN
FOUND = 0
LOWER = 'abcdefghijklmnopqrstuvwxyz'
PART1 = '   user:goedel_freeze(ground([Z]) or ground([X,Y]), '
PART2 = '''
PART3 = 'S'
PART3B = 's'
PART4 = 'trings'
PART6 = ':concat(X,Y,Z)).'
REM = PATTERN
SUCCEED = PATTERN
UPPER = 'aBCDEFGHIJKLMNOPQRSTUVWXYZ'

Unprotected keywords

&ABEND = 0
&ANCHOR = 1
&CASE = 1
&CODE = 0
&DUMP = 1
&ERRLIMIT = 0
&FILL = ' '
&FTRACE = 0
&FULLSCAN = 0
&GTRACE = 0
&INPUT = 1
&MAXLNGTH = 4294967295
&OUTPUT = 1
&STLIMIT = 10000
&TRACE = 0
&TRIM = 0
Dump of variables at termination

Natural variables

ABORT = PATTERN
ALPHANUMETC = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'
ARB = PATTERN
BAL = PATTERN
FAIL = PATTERN
FENCE = PATTERN
FOUND = 0
INPUT = '&TRIM = 0'
LINE = '&TRIM = 0'
LOWER = 'abcdefghijklmnopqrstuvwxyz'
OUTPUT = '&TRIM = 0'
PART1 = 'UPPER = '
PART2 = '''
PART3 = 'A'
PART3B = 'a'
PART4 = 'BCDEFGHIJKLMNOPQRSTUVWXYZ'
REM = PATTERN
SUCCEED = PATTERN
UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

Unprotected keywords

&ABEND = 0
&ANCHOR = 1
&CASE = 1
&CODE = 0
&DUMP = 1
&ERRLIMIT = 0
&FILL = ' '
&FTRACE = 0
&FULLSCAN = 0
&GTRACE = 0
&INPUT = 1
&MAXLNGTH = 4294967295
&OUTPUT = 1
&STLIMIT = 100000000
&TRACE = 0
&TRIM = 0
