Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lyskom-server-ceder-1616-generations-topgit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
5160e80f
Commit
5160e80f
authored
Jul 06, 1991
by
nobody
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This commit was manufactured by cvs2svn to create tag 'v0.31.6'.
parent
4d51be97
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
0 additions
and
2054 deletions
+0
-2054
src/libraries/libmisc/ChangeLog
src/libraries/libmisc/ChangeLog
+0
-39
src/libraries/libmisc/pom.c
src/libraries/libmisc/pom.c
+0
-168
src/libraries/libmisc/pom.h
src/libraries/libmisc/pom.h
+0
-34
src/libraries/libmisc/s-collat-tabs.c
src/libraries/libmisc/s-collat-tabs.c
+0
-108
src/libraries/libmisc/s-collat-tabs.h
src/libraries/libmisc/s-collat-tabs.h
+0
-35
src/libraries/libmisc/s-string.c
src/libraries/libmisc/s-string.c
+0
-938
src/libraries/libmisc/s-string.h
src/libraries/libmisc/s-string.h
+0
-445
src/libraries/libmisc/zmalloc.c
src/libraries/libmisc/zmalloc.c
+0
-171
src/libraries/libmisc/zmalloc.h
src/libraries/libmisc/zmalloc.h
+0
-116
No files found.
src/libraries/libmisc/ChangeLog
deleted
100644 → 0
View file @
4d51be97
Sat Jul 6 05:43:41 1991 Per Cederqvist (ceder at lysator)
* Fullbordade {ndringen fr}n char till unsigned char i
s-string.[hc] som Peter p}b|rjade.
* Skrev om Makefilen f|r att klara RCS.
* Alla filer i libmisc.a placerade under RCS.
* s-collat-tables.[hco] omd|pt till s-collat-tabs.[hco]. ar tycker
inte om f|r l}nga namn.
Thu Dec 20 04:59:36 1990 Thomas Bellman (bellman at lave)
* s-string.[ch]: s_strchr() och s_strrchr(): Lade till en
parameter som anger var s|kningen ska b|rja.
* s-string.c: [ndrat fr}n if-satser f|r kontroll av parametrar
till att anv{nda assert()-makrot.
* s-string.[ch]: Lade till s_strrchr().
* zmalloc.c: Fixat en del buggar d{r pekare till z_info-structen
returnerades i st f pekare efter denna, samt lite annat.
Sat Dec 8 03:05:51 1990 Thomas Bellman (bellman at laila)
* [ndrade tillbaka s_strcpy(). Den ska sl{ppa loss minnet {ven om
den f}r en EMPTY_STRING.
Sat Dec 1 12:09:35 1990 Lars Willf|r (willfor at nanny)
* [ndrade s_strcpy s} att den med s{kerhet fungerar {ven om
source_string == EMPTY_STRING.
Thu Aug 9 05:12:52 1990 Thomas Bellman (bellman at laila)
* Biblioteket skapat ig}r.
src/libraries/libmisc/pom.c
deleted
100644 → 0
View file @
4d51be97
/*
* pom.c -- Calculate the Phase Of the Moon
*
* Written by G|ran ]hlstr|m 1984-04-05, revision 5 1986-03-03
*
* Modified by Thomas Bellman 1991-01-29
*/
#include <sys/types.h>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include "pom.h"
#define EXPORT
#define RADS (M_PI/180.0)
static
char
*
pmt
[]
=
{
"NM"
,
"FQ"
,
"FM"
,
"LQ"
};
static
short
ix
;
static
double
m
;
/* Sun's Mean Anomaly */
static
double
mp
;
/* Moon's Mean Anomaly */
static
double
f
;
/* Moon's Argument of Latitude */
static
struct
tm
dt
;
/* New & Full Moon correction */
static
double
mcorr
(
double
t
)
{
double
tmp
;
tmp
=
(
0
.
1734
-
3.93E-4
*
t
)
*
sin
(
m
)
+
0
.
0021
*
sin
(
2
.
0
*
m
)
-
0
.
4068
*
sin
(
mp
);
tmp
+=
0
.
0161
*
sin
(
2
.
0
*
mp
)
-
0
.
0004
*
sin
(
3
.
0
*
mp
)
+
0
.
0104
*
sin
(
2
.
0
*
f
);
tmp
+=
0
.
0004
*
sin
(
2
.
0
*
f
+
m
)
-
0
.
0051
*
sin
(
m
+
mp
)
-
0
.
0074
*
sin
(
m
-
mp
);
tmp
-=
0
.
0004
*
sin
(
2
.
0
*
f
-
m
)
+
0
.
0006
*
sin
(
2
.
0
*
f
+
mp
);
return
tmp
+=
0
.
0010
*
sin
(
2
.
0
*
f
-
mp
)
+
0
.
0005
*
sin
(
m
+
2
.
0
*
mp
);
}
/* First & Last Quarter correction */
static
double
qcorr
(
double
t
)
{
double
tmp
,
tmp2
;
tmp
=
(
0
.
1721
-
0
.
0004
*
t
)
*
sin
(
m
)
+
0
.
0021
*
sin
(
2
.
0
*
m
)
-
0
.
628
*
sin
(
mp
);
tmp
+=
0
.
00
89
*
sin
(
2
.
0
*
mp
)
-
0
.
0004
*
sin
(
3
.
0
*
mp
)
+
0
.
007
9
*
sin
(
2
.
0
*
f
);
tmp
+=
0
.
0003
*
sin
(
2
.
0
*
f
+
m
)
-
0
.
011
9
*
sin
(
m
+
mp
)
-
0
.
0047
*
sin
(
m
-
mp
);
tmp
+=
0
.
0021
*
sin
(
2
.
0
*
f
-
mp
)
-
0
.
0004
*
sin
(
2
.
0
*
f
-
m
);
tmp
+=
-
0
.
0006
*
sin
(
2
.
0
*
f
+
mp
)
+
0
.
0003
*
sin
(
m
+
2
.
0
*
mp
);
tmp
+=
0
.
0004
*
sin
(
m
-
2
.
0
*
mp
)
-
0
.
0003
*
sin
(
2
.
0
*
m
+
mp
);
tmp2
=
(
0
.
002
8
-
0
.
0004
*
cos
(
m
)
+
0
.
0003
*
cos
(
mp
));
if
(
ix
==
1
)
tmp
+=
tmp2
;
else
tmp
-=
tmp2
;
return
tmp
;
}
/* When is nearest phase? */
static
double
pcon
(
void
)
{
double
frc
;
double
year
;
double
k
;
double
t
;
double
tmp
;
int
leap
;
year
=
(
dt
.
tm_hour
+
((
dt
.
tm_min
+
(
dt
.
tm_sec
/
60
.
0
))
/
60
.
0
))
/
24
.
0
;
year
+=
dt
.
tm_yday
;
/* Leap year? */
leap
=
dt
.
tm_year
+
1900
;
leap
=
(
leap
%
4
==
0
&&
(
leap
%
100
!=
0
||
leap
%
400
==
0
));
/* This year with decimals */
year
=
dt
.
tm_year
+
year
/
(
365
.
0
+
leap
);
k
=
year
*
12
.
3685
;
k
-=
(
frc
=
k
-
floor
(
k
));
/* Determine nearest phase */
for
(
ix
=
0
;
frc
>
ix
*
0
.
25
+
0
.
125
;
ix
++
)
;
t
=
(
k
+=
ix
*
0
.
25
)
/
1236
.
85
;
tmp
=
2415020
.
75933
+
29
.
53058868
*
k
+
(
1.178E-4
-
1.55E-7
*
t
)
*
pow
(
t
,
2
.
0
);
tmp
+=
3.3E-4
*
sin
(
166
.
56
*
RADS
+
132
.
87
*
RADS
*
t
-
9.173E-3
*
RADS
*
pow
(
t
,
2
.
0
));
m
=
RADS
*
fmod
(
359
.
2242
+
29
.
10535608
*
k
-
(
3.47e-6
*
t
+
3.33e-5
)
*
pow
(
t
,
2
.
0
),
360
.
0
);
mp
=
RADS
*
fmod
(
306
.
0253
+
385
.
81691806
*
k
+
(
1.236e-5
*
t
+
0
.
0107306
)
*
pow
(
t
,
2
.
0
),
360
.
0
);
f
=
RADS
*
fmod
(
21
.
2964
+
390
.
67050646
*
k
-
(
2.39e-6
*
t
+
1.6528e-3
)
*
pow
(
t
,
2
.
0
),
360
.
0
);
return
tmp
+=
((
ix
%
2
==
0
)
?
mcorr
(
t
)
:
qcorr
(
t
));
}
/* JD at this instant */
static
double
dcon
(
void
)
{
double
a
,
b
,
d
,
m
,
y
;
m
=
dt
.
tm_mon
;
y
=
dt
.
tm_year
+
1900
.
0
;
d
=
dt
.
tm_mday
+
dt
.
tm_hour
/
24
.
0
+
dt
.
tm_min
/
1440
.
0
+
dt
.
tm_sec
/
86400
.
0
;
if
(
m
<=
2
.
0
)
{
y
-=
1
.
0
;
m
+=
12
.
0
;
}
a
=
floor
(
y
/
100
.
0
);
/* Gregorian Calendar correction */
b
=
2
.
0
-
a
+
floor
(
a
/
4
.
0
);
return
(
floor
(
365
.
25
*
y
)
+
floor
(
30
.
6001
*
(
m
+
1
.
0
))
+
d
+
1720994
.
5
+
b
);
}
EXPORT
struct
pom
phase_of_the_moon
(
struct
tm
*
when
)
{
int
p1
,
p2
,
p3
,
p4
;
char
sgn
;
long
ts
;
double
tmp
;
struct
pom
result
;
dt
=
*
when
;
dt
.
tm_mon
++
;
dt
.
tm_yday
++
;
tmp
=
pcon
()
-
dcon
();
sgn
=
(
tmp
>
0
)
?
'-'
:
'+'
;
tmp
=
fabs
(
tmp
);
tmp
-=
(
p1
=
floor
(
tmp
));
tmp
=
tmp
*
24
.
0
-
(
p2
=
floor
(
tmp
*
24
.
0
));
tmp
=
tmp
*
60
.
0
-
(
p3
=
floor
(
tmp
*
60
.
0
));
p4
=
floor
(
tmp
*
60
.
0
);
result
.
quarter
=
ix
%
4
;
result
.
days
=
(
sgn
==
'+'
)
?
p1
:
-
p1
;
result
.
hours
=
(
sgn
==
'+'
)
?
p2
:
-
p2
;
result
.
minutes
=
(
sgn
==
'+'
)
?
p3
:
-
p3
;
result
.
seconds
=
(
sgn
==
'+'
)
?
p4
:
-
p4
;
return
result
;
}
src/libraries/libmisc/pom.h
deleted
100644 → 0
View file @
4d51be97
/*
* pom.h
* Calculate the phase of the moon at any given time.
*
*
* This file is in the public domain. No rights reserved.
*/
#ifndef POM_H_INCLUDED__
#define POM_H_INCLUDED__
struct
pom
{
enum
{
pom_NM
,
pom_FQ
,
pom_FM
,
pom_LQ
}
quarter
;
/* Nearest quarter */
/* Time since nearest quarter. All fields are negative if
* nearest quarter is in the future. */
int
days
;
int
hours
;
int
minutes
;
int
seconds
;
};
/*
* Calculate the phase of the moon at the time WHEN, which should be
* the GMT time.
*/
extern
struct
pom
phase_of_the_moon
(
struct
tm
*
when
);
#endif
/* POM_H_INCLUDED__ */
src/libraries/libmisc/s-collat-tabs.c
deleted
100644 → 0
View file @
4d51be97
/*
* s-collat-tables.c -- Collating tables used for the s_usr_strcmp()
* routine in s-string.[ch]
*
*
* Copyright (C) 1990 Lysator Computer Club,
* Linkoping University, Sweden
*
* Everyone is granted permission to copy, modify and redistribute
* this code, provided the people they give it to can.
*
*
* Author: Thomas Bellman
* Lysator Computer Club
* Linkoping University
* Sweden
*
* email: Bellman@Lysator.LiU.SE
*/
#include "s-collat-tabs.h"
/*
* Collating tables:
* swedish_collate_tab: Swedish text. "][\}{|" in the right
* order. Upper and lower case letters
* are equal.
* english_collate_tab: English text. Upper and lower case
* letters are equal.
*/
char
swedish_collate_tab
[
COLLAT_TAB_SIZE
]
=
{
'\000'
,
'\001'
,
'\002'
,
'\003'
,
'\004'
,
'\005'
,
'\006'
,
'\007'
,
'\010'
,
'\011'
,
'\012'
,
'\013'
,
'\014'
,
'\015'
,
'\016'
,
'\017'
,
'\020'
,
'\021'
,
'\022'
,
'\023'
,
'\024'
,
'\025'
,
'\026'
,
'\027'
,
'\030'
,
'\031'
,
'\032'
,
'\033'
,
'\034'
,
'\035'
,
'\036'
,
'\037'
,
' '
,
'!'
,
'"'
,
'#'
,
'$'
,
'%'
,
'&'
,
'\''
,
'('
,
')'
,
'*'
,
'+'
,
','
,
'-'
,
'.'
,
'/'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
':'
,
';'
,
'<'
,
'='
,
'>'
,
'?'
,
'@'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'}'
,
'{'
,
'|'
,
'~'
,
'_'
,
'`'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'}'
,
'{'
,
'|'
,
'~'
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
};
char
english_collate_tab
[
COLLAT_TAB_SIZE
]
=
{
'\000'
,
'\001'
,
'\002'
,
'\003'
,
'\004'
,
'\005'
,
'\006'
,
'\007'
,
'\010'
,
'\011'
,
'\012'
,
'\013'
,
'\014'
,
'\015'
,
'\016'
,
'\017'
,
'\020'
,
'\021'
,
'\022'
,
'\023'
,
'\024'
,
'\025'
,
'\026'
,
'\027'
,
'\030'
,
'\031'
,
'\032'
,
'\033'
,
'\034'
,
'\035'
,
'\036'
,
'\037'
,
' '
,
'!'
,
'"'
,
'#'
,
'$'
,
'%'
,
'&'
,
'\''
,
'('
,
')'
,
'*'
,
'+'
,
','
,
'-'
,
'.'
,
'/'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
':'
,
';'
,
'<'
,
'='
,
'>'
,
'?'
,
'@'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'['
,
'\\'
,
']'
,
'~'
,
'_'
,
'`'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'{'
,
'|'
,
'}'
,
'~'
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
};
src/libraries/libmisc/s-collat-tabs.h
deleted
100644 → 0
View file @
4d51be97
/*
* s-collat-tables.h -- Declarations for collating tables
*
*
* Copyright (C) 1990 Lysator Computer Club,
* Linkoping University, Sweden
*
* Everyone is granted permission to copy, modify and redistribute
* this code, provided the people they give it to can.
*
*
* Author: Thomas Bellman
* Lysator Computer Club
* Linkoping University
* Sweden
*
* email: Bellman@Lysator.LiU.SE
*
*
* Any opinions expressed in this code are the author's PERSONAL opinions,
* and does NOT, repeat NOT, represent any official standpoint of Lysator,
* even if so stated.
*/
#include <limits.h>
#define COLLAT_TAB_SIZE (UCHAR_MAX+1)
extern
char
swedish_collate_tab
[
COLLAT_TAB_SIZE
];
extern
char
english_collate_tab
[
COLLAT_TAB_SIZE
];
#if 0
extern char iso8859_1_collate_tab [ COLLAT_TAB_SIZE ];
#endif
src/libraries/libmisc/s-string.c
deleted
100644 → 0
View file @
4d51be97
This diff is collapsed.
Click to expand it.
src/libraries/libmisc/s-string.h
deleted
100644 → 0
View file @
4d51be97
/*
* s-string.h
* Our own string type. Definition of string type,
* and functions to manipulate these strings.
*
*
* Copyright (C) 1990 Lysator Computer Club,
* Linkoping University, Sweden
*
* Everyone is granted permission to copy, modify and redistribute
* this code, provided the people they give it to can.
*
*
* Author: Thomas Bellman
* Lysator Computer Club
* Linkoping University
* Sweden
*
* email: Bellman@Lysator.LiU.SE
*/
#ifndef S_STRING_H_ALREADY_INCLUDED__
#define S_STRING_H_ALREADY_INCLUDED__
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <misc-types.h>
#include "s-collat-tabs.h"
typedef
long
String_size
;
#define END_OF_STRING LONG_MAX
/*
* All objects of type String *must* be initialized to EMPTY_STRING
* before using any destructive function on them. If you only use
* non-destructive functions (s_strlen(), s_strcmp(), ...), you can
* set them with
* str = s_fcrea_str("Hej hopp i lingonskogen");
* But the value of this may *not* be used in any destructive call,
* since str.string points to read-only memory.
* Note also that you need to call s_free() on any auto variables
* of type String before exiting the block they are declared in,
* since otherwise the memory they use will still be allocated.
* This is of course the same rules as for normal pointers.
* To make it possible for people to use their own storage
* management routines, you can set the functions to use for
* malloc(), realloc() and free() with the
* s_set_storage_management() function. This MUST be called
* before using any of the other functions, even if you want to
* use the normal malloc(), realloc() and free().
* Terminology:
* -- A "separate" String is an object that points to some memory
* that is somehow obtained from malloc() or its cousins. This
* means that it is legal to free() or realloc() it.
*/
typedef
struct
{
String_size
len
;
unsigned
char
*
string
;
}
String
;
/*
* Note that the first character is String.string[0], and the last
* character is String.string[String.len-1]
*/
/* This is the representation of the empty String */
#define EMPTY_STRING_i ((String) { 0, NULL })
extern
const
String
EMPTY_STRING
;
/*
* Functions to manipulate strings of type 'String'.
* All these functions return a value of type Success, which is
* an enum of OK an FAILURE (do NOT trust the order of these!).
*
* All functions automatically allocates (and deallocates) any
* necessary storage.
*/
typedef
void
(
*
free_function
)
(
void
*
);
typedef
void
*
(
*
malloc_function
)
(
size_t
);
typedef
void
*
(
*
realloc_function
)
(
void
*
,
size_t
);
/*
* Set the functions to use for storage management. These must
* be call compatible with the normal functions malloc(),
* realloc() and free().
*/
extern
void
s_set_storage_management
(
malloc_function
new_malloc
,
realloc_function
new_realloc
,
free_function
new_free
);
/*
* Returns the number of characters in a String
*/
#define s_strlen(str) ((str).len)
/*
* Create an object of type String from an ordinary C string.
*/
extern
Success
s_crea_str
(
String
*
dest_string
,
const
char
*
c_string
);
/*
* Create a string from a buffer. The contents of the buffer
* are copied into the new string.
*/
extern
Success
s_mem_crea_str
(
String
*
dest_string
,
const
char
*
buffer
,
String_size
length
);
/*
* Create a string of a given size. The contents of the string
* are unspecified. The LysKOM-server uses this to get a string
* of a fixed size into which it can fread() data. This is probably
* not a good idea since it relies heavily on the implementation
* of strings. However, by using this function, those places are
* easy to identify if the implementation should be done differently.
*/
extern
Success
s_size_crea_str
(
String
*
result
,
String_size
length
);
/*
* Return a temporary String from a C string, i e return a struct
* pointing to the actual C string. Suitable for sending a 'String'
* object as parameter to a function (IF that function does not modify
* it's parameter. Note that normally String variables should be set
* by s_crea_str(), to deallocate the memory used by it.
*/
extern
String
s_fcrea_str
(
const
unsigned
char
*
c_string
);
/*
* Free's the space used by a String object. The object is
* set to EMPTY_STRING.
*/
extern
void
s_clear
(
String
*
str
);
/*
* Create an ordinary C string from a String.
* The pointer returned will point to a '\0'-terminated character
* array which is obtained with the malloc-function supplied to
* s_set_storage_management(). It should be freed by the caller.
* NULL is returned if there is an error. The String may contain
* '\0's, but the resulting string will be truncated at the first
* '\n'. Thou shalt not depend on this behaviour. Later versions
* might substitute "foobar" for '\0's.
*/
extern
char
*
s_crea_c_str
(
const
String
source
);
/*
* Copy SOURCE_STRING to DEST_STRING. Old value of DEST_STRING is
* retained if an error was encountered. Note that it is never
* legal to do 's_strcpy(&foo, foo)', since the string 'foo' is
* pointing to is reallocated before it is read.
*/
extern
Success
s_strcpy
(
String
*
dest_string
,
const
String
source_string
);
/*
* In String STR remove the characters starting with number FIRST
* and ending with number LAST, inclusive. If FIRST > LAST, then
* no characters are removed.
*/
extern
Success
s_strdel
(
String
*
str
,
String_size
first
,
String_size
last
);
/*
* Append SOURCE_STRING to the end of DEST_STRING. DEST_STRING is not
* changed if an error is encountered.
*/
extern
Success
s_strcat
(
String
*
dest_string
,
const
String
source_string
);
/*
* Extract a substring from SOURCE_STRING, starting with char no
* START_CHAR and ending with char no END_CHAR. First character
* is character no 0. If END_CHAR < START_CHAR, then DEST_STRING
* is set to 'EMPTY_STRING'. If END_CHAR is equal to the macro
* 'END_OF_STRING', then the substring reaches to the last character
* in SOURCE_STRING.
*/
extern
Success
s_substr
(
String
*
dest_string
,
const
String
source_string
,
String_size
start_char
,
String_size
end_char
);
/*
* Fast extraction of a substring. Returns an object of type
* String wich points into SOURCE_STRING. Thus you should NEVER
* modify the result of this function. (Raw character modifying
* is OK if you know what you are doing, but never use anything
* that might call free or realloc on it.) If END_CHAR is equal