Files
sics/dynstring.h
koennecke 045029dfd3 - Currently disabled attempts at logging commands
- Added a warning for excessive data rates on monitors
- Added statistics to devser and thus to scriptcontext
- Added byte concatenation to dynstring
- Added aborting for reflection generation to fourmess.c
- Added data checksum testing to hipadaba, use for update tests
- Fixed interrupt discovery in network.c, caused invalid interrupt
  codes which in turn confused sicscron which had to be fixed too.
- Renamed ubcalc into ubcalcint in order to reclaim the ubcalc for Jurg
- Added an a3offset to tasub in order to fix what I perceive an IS problem
- Added support for the newer version of the Siemens SPS, the S7
- Added a not yet fully working sinqhttpopt driver which talks to
  http HM without libghttp


SKIPPED:
	psi/delcam.c
	psi/make_gen
	psi/psi.c
	psi/sinq.c
	psi/sinq.h
	psi/sinqhttpopt.c
	psi/slsvme.c
	psi/spss7.c
2010-12-20 10:18:01 +00:00

100 lines
3.2 KiB
C

/*---------------------------------------------------------------------------
D Y N S T R I N G
A dynamic String Implementation. You can append and insert into this
string at will. It automatically takes care of allocating more
memory when needed.
COPYRIGHT:
CopyLeft, 1998, Mark Koennecke
There are two things you MAY NOT DO with this code:
- Sue me or my employer because it does not work.
- Use it in a critical environment, i.e health,
radioactive device control, military control
systems and the like.
You may do everything else with this code. It has been
written with swiss taxpayers money.
NOTE:
All functions return 1 or a pointer on success,
0, or NULL on failure
Mark Koennecke, March 1998
----------------------------------------------------------------------------*/
#ifndef DYNAMICSTRING
#define DYNAMICSTRING
typedef struct __DynString *pDynString;
/*----------------------- live and death ----------------------------------*/
pDynString CreateDynString(int iInitialLength, int iResizeLength);
/*
Create a new DynString Object. Its initial length will be iInitialLength.
It will be resized in iResizeLength steps. This allows for efficient
storage management. It woul be seriously inefficient to allocate
per added character.
*/
void DeleteDynString(pDynString self);
/*----------------------- interface to it --------------------------------- */
int DynStringCopy(pDynString self, char *pText);
/*
Copies the text in Text into the DynString starting at 0 and over
writing anything there beforehand.
*/
int DynStringConcat(pDynString self, char *pText);
/*
Concatenates the string in DynString with the one supplied
in string.
*/
int DynStringConcatChar(pDynString self, char c);
/*
adds one character at the end of the string
*/
int DynStringConcatBytes(pDynString self, char *data, int datalen);
/*
* adds datalen bytes from data to the buffer
*/
int DynStringInsert(pDynString self, char *pText, int iPos);
/*
inserts the text in pText at Position iPos in the DynString.
Everything behind iPos will be pushed outwards in order to create
space for pText.
*/
int DynStringReplace(pDynString self, char *pText, int iPos);
/*
Starting at iPos, replace everything after it with ptext. In
contrats to insert this won't push data backwards.
*/
char *GetCharArray(pDynString self);
/*
retrieves a pointer to the character array keeping the current
text. NEVER, ever free this pointer, otherwise you are rewarded
with a core dump. The pointer belongs to DynString and will be
deleted when deleting the DynString.
*/
int GetDynStringLength(pDynString self);
/*
returns the current length of the dynamic string.
*/
int DynStringClear(pDynString self);
/*
removes all old data from the dynstring
*/
int DynStringBackspace(pDynString self);
/*
removes one character at the end from the dynstring
*/
#endif