- Adapted indenation to new agreed upon system

- Added support for second generation scriptcontext based counter
This commit is contained in:
koennecke
2009-02-13 09:00:03 +00:00
parent a3dcad2bfa
commit 91d4af0541
405 changed files with 88101 additions and 88173 deletions

View File

@ -9,138 +9,134 @@
/_|__| A.Reitsma, Delft, The Netherlands.
/ | \ --------------------------------------------------------------- */
#include <stdlib.h> /* for malloc() */
#include "lld.h" /* the generic LLD functions ... */
#include "lld_blob.h" /* also includes portable.h if necessary */
#include <stdlib.h> /* for malloc() */
#include "lld.h" /* the generic LLD functions ... */
#include "lld_blob.h" /* also includes portable.h if necessary */
struct BlobDesc
{
void * data ; /* 'data' can be obtained by LLDnodePtr() ! */
unsigned size ;
struct BlobDesc {
void *data; /* 'data' can be obtained by LLDnodePtr() ! */
unsigned size;
};
#define ERR_MEMORY -1
/* ---- LL blob system mangement -------------------------------------- */
int LLDblobCreate( void )
int LLDblobCreate(void)
{
return LLDcreate( sizeof( struct BlobDesc ));
return LLDcreate(sizeof(struct BlobDesc));
}
/*---------------------------------------------------------------------*/
int LLDdeleteBlob(int List)
{
struct BlobDesc Blob ;
int status;
status = LLDnodePtr2First(List);
while(status == 1){
LLDnodeDataTo( List, & Blob );
free(Blob.data);
status = LLDnodePtr2Next(List);
}
LLDdelete(List);
return 1;
struct BlobDesc Blob;
int status;
status = LLDnodePtr2First(List);
while (status == 1) {
LLDnodeDataTo(List, &Blob);
free(Blob.data);
status = LLDnodePtr2Next(List);
}
LLDdelete(List);
return 1;
}
/* ---- LL blob node mangement ---------------------------------------- */
int LLDblobInsert( int List, void * Source, unsigned Size )
{ /* insert _BEFORE_ current node */
struct BlobDesc Blob ;
int LLDblobInsert(int List, void *Source, unsigned Size)
{ /* insert _BEFORE_ current node */
struct BlobDesc Blob;
Blob.size = Size ;
Blob.data = malloc( Size );
Blob.size = Size;
Blob.data = malloc(Size);
if( NULL == Blob.data )
{
return ERR_MEMORY ;
}
if (NULL == Blob.data) {
return ERR_MEMORY;
}
memcpy( Blob.data, Source, Size );
LLDnodeInsertFrom( List, & Blob );
memcpy(Blob.data, Source, Size);
LLDnodeInsertFrom(List, &Blob);
return LIST_NO_PROBLEMS ;
return LIST_NO_PROBLEMS;
}
int LLDblobAdd( int List, void * Source, unsigned Size )
{ /* insert _AFTER_ current node */
struct BlobDesc Blob ;
int LLDblobAdd(int List, void *Source, unsigned Size)
{ /* insert _AFTER_ current node */
struct BlobDesc Blob;
Blob.size = Size ;
Blob.data = malloc( Size );
Blob.size = Size;
Blob.data = malloc(Size);
if( NULL == Blob.data )
{
return ERR_MEMORY ;
}
if (NULL == Blob.data) {
return ERR_MEMORY;
}
memcpy( Blob.data, Source, Size );
LLDnodeAddFrom( List, & Blob );
memcpy(Blob.data, Source, Size);
LLDnodeAddFrom(List, &Blob);
return LIST_NO_PROBLEMS ;
return LIST_NO_PROBLEMS;
}
int LLDblobPrepend( int List, void * Source, unsigned Size )
{ /* insert as first node */
struct BlobDesc Blob ;
int LLDblobPrepend(int List, void *Source, unsigned Size)
{ /* insert as first node */
struct BlobDesc Blob;
Blob.size = Size ;
Blob.data = malloc( Size );
Blob.size = Size;
Blob.data = malloc(Size);
if( NULL == Blob.data )
{
return ERR_MEMORY ;
}
if (NULL == Blob.data) {
return ERR_MEMORY;
}
memcpy( Blob.data, Source, Size );
LLDnodePrependFrom( List, & Blob );
memcpy(Blob.data, Source, Size);
LLDnodePrependFrom(List, &Blob);
return LIST_NO_PROBLEMS ;
return LIST_NO_PROBLEMS;
}
int LLDblobAppend( int List, void * Source, unsigned Size )
{ /* insert as last node */
struct BlobDesc Blob ;
int LLDblobAppend(int List, void *Source, unsigned Size)
{ /* insert as last node */
struct BlobDesc Blob;
Blob.size = Size ;
Blob.data = malloc( Size );
Blob.size = Size;
Blob.data = malloc(Size);
if( NULL == Blob.data )
{
return ERR_MEMORY ;
}
if (NULL == Blob.data) {
return ERR_MEMORY;
}
memcpy( Blob.data, Source, Size );
LLDnodeAppendFrom( List, & Blob );
memcpy(Blob.data, Source, Size);
LLDnodeAppendFrom(List, &Blob);
return LIST_NO_PROBLEMS ;
return LIST_NO_PROBLEMS;
}
void LLDblobDelete( int List )
void LLDblobDelete(int List)
{
struct BlobDesc Blob ;
struct BlobDesc Blob;
LLDnodeDataTo( List, & Blob );
free( Blob.data );
LLDnodeDataTo(List, &Blob);
free(Blob.data);
LLDnodeDelete( List );
LLDnodeDelete(List);
return ;
return;
}
/* ---- stored data management ---------------------------------------- */
unsigned LLDblobData( int List, void * Destination )
unsigned LLDblobData(int List, void *Destination)
{
struct BlobDesc Blob ;
struct BlobDesc Blob;
LLDnodeDataTo( List, & Blob );
LLDnodeDataTo(List, &Blob);
if( NULL != Destination )
memcpy( Destination, Blob.data, Blob.size );
if (NULL != Destination)
memcpy(Destination, Blob.data, Blob.size);
return Blob.size ; /* size needed for blob */
return Blob.size; /* size needed for blob */
}
/* ==== LLD_BLOB.c end =============================================== */