1 #include <inttypes.h>
2 #include <stdint.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5
6 #include "dynamicCharacterOperations.h"
7
8 #define __STDC_FORMAT_MACROS
9
dynCharSize(size_t alphSize,size_t numElems)10 size_t dynCharSize(size_t alphSize, size_t numElems) { return 1; }
11
dcElemSize(size_t alphSize)12 size_t dcElemSize(size_t alphSize) { return 1; }
13
allocatePackedChar(size_t alphSize,size_t numElems)14 packedChar *allocatePackedChar( size_t alphSize, size_t numElems ) {
15 packedChar *outChar = (packedChar*) calloc( dynCharSize(alphSize, numElems), sizeof(packedChar) );
16 if (outChar == NULL) {
17 printf("Out of memory.\n");
18 fflush(stdout);
19 exit(1);
20 }
21 return outChar;
22 }
23
makePackedCharCopy(packedChar * inChar,size_t alphSize,size_t numElems)24 packedChar *makePackedCharCopy( packedChar *inChar, size_t alphSize, size_t numElems) {
25 packedChar *outChar = allocatePackedChar(alphSize, numElems);
26 size_t length = dynCharSize(alphSize, numElems);
27 for (size_t i = 0; i < length; i++) {
28 outChar[i] = inChar[i];
29 }
30 return outChar;
31 }
32
freeDynChar(dynChar_t * p)33 void freeDynChar( dynChar_t *p ) { free( p->dynChar ); }
34
freeDCElem(const dcElement_t * p)35 void freeDCElem( const dcElement_t *p ) { free( p->element ); }
36