mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	libs/fst: Update from upstream
Add shell script (based on minisat lib) to clone and copy relevant files. Unclear if there are any changes lost that we need to patch back in.
This commit is contained in:
		
							parent
							
								
									f137509505
								
							
						
					
					
						commit
						2edb9397c3
					
				
					 7 changed files with 8983 additions and 6596 deletions
				
			
		
							
								
								
									
										13
									
								
								libs/fst/00_UPDATE.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								libs/fst/00_UPDATE.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mv config.h config.h.bak
 | 
				
			||||||
 | 
					rm -f *.txt *.cc *.h
 | 
				
			||||||
 | 
					git clone --depth 1 https://github.com/gtkwave/gtkwave fst_upstream
 | 
				
			||||||
 | 
					rm fst_upstream/lib/libfst/CMakeLists.txt
 | 
				
			||||||
 | 
					mv fst_upstream/lib/libfst/*.{h,c,txt} .
 | 
				
			||||||
 | 
					rm -rf fst_upstream
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for src in *.c; do
 | 
				
			||||||
 | 
					    mv -- "$src" "${src%.c}.cc"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					mv config.h.bak config.h
 | 
				
			||||||
| 
						 | 
					@ -36,15 +36,16 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define FASTLZ_SAFE
 | 
					#define FASTLZ_SAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Give hints to the compiler for branch prediction optimization.
 | 
					 * Give hints to the compiler for branch prediction optimization.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#if defined(__GNUC__) && (__GNUC__ > 2)
 | 
					#if defined(__GNUC__) && (__GNUC__ > 2)
 | 
				
			||||||
#define FASTLZ_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1))
 | 
					#define FASTLZ_EXPECT_CONDITIONAL(c)    (__builtin_expect((c), 1))
 | 
				
			||||||
#define FASTLZ_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0))
 | 
					#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define FASTLZ_EXPECT_CONDITIONAL(c) (c)
 | 
					#define FASTLZ_EXPECT_CONDITIONAL(c)    (c)
 | 
				
			||||||
#define FASTLZ_UNEXPECT_CONDITIONAL(c) (c)
 | 
					#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (c)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -63,7 +64,7 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#if !defined(FASTLZ_STRICT_ALIGN)
 | 
					#if !defined(FASTLZ_STRICT_ALIGN)
 | 
				
			||||||
#define FASTLZ_STRICT_ALIGN
 | 
					#define FASTLZ_STRICT_ALIGN
 | 
				
			||||||
#if defined(__i386__) || defined(__386) /* GNU C, Sun Studio */
 | 
					#if defined(__i386__) || defined(__386)  /* GNU C, Sun Studio */
 | 
				
			||||||
#undef FASTLZ_STRICT_ALIGN
 | 
					#undef FASTLZ_STRICT_ALIGN
 | 
				
			||||||
#elif defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__amd64) /* GNU C */
 | 
					#elif defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__amd64) /* GNU C */
 | 
				
			||||||
#undef FASTLZ_STRICT_ALIGN
 | 
					#undef FASTLZ_STRICT_ALIGN
 | 
				
			||||||
| 
						 | 
					@ -79,29 +80,24 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* prototypes */
 | 
					/* prototypes */
 | 
				
			||||||
int fastlz_compress(const void *input, int length, void *output);
 | 
					int fastlz_compress(const void* input, int length, void* output);
 | 
				
			||||||
int fastlz_compress_level(int level, const void *input, int length, void *output);
 | 
					int fastlz_compress_level(int level, const void* input, int length, void* output);
 | 
				
			||||||
int fastlz_decompress(const void *input, int length, void *output, int maxout);
 | 
					int fastlz_decompress(const void* input, int length, void* output, int maxout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_COPY 32
 | 
					#define MAX_COPY       32
 | 
				
			||||||
#define MAX_LEN 264 /* 256 + 8 */
 | 
					#define MAX_LEN       264  /* 256 + 8 */
 | 
				
			||||||
#define MAX_DISTANCE 8192
 | 
					#define MAX_DISTANCE 8192
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(FASTLZ_STRICT_ALIGN)
 | 
					#if !defined(FASTLZ_STRICT_ALIGN)
 | 
				
			||||||
#define FASTLZ_READU16(p) *((const flzuint16 *)(p))
 | 
					#define FASTLZ_READU16(p) *((const flzuint16*)(p))
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define FASTLZ_READU16(p) ((p)[0] | (p)[1] << 8)
 | 
					#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define HASH_LOG 13
 | 
					#define HASH_LOG  13
 | 
				
			||||||
#define HASH_SIZE (1 << HASH_LOG)
 | 
					#define HASH_SIZE (1<< HASH_LOG)
 | 
				
			||||||
#define HASH_MASK (HASH_SIZE - 1)
 | 
					#define HASH_MASK  (HASH_SIZE-1)
 | 
				
			||||||
#define HASH_FUNCTION(v, p)                                                                                            \
 | 
					#define HASH_FUNCTION(v,p) { v = FASTLZ_READU16(p); v ^= FASTLZ_READU16(p+1)^(v>>(16-HASH_LOG));v &= HASH_MASK; }
 | 
				
			||||||
    {                                                                                                                  \
 | 
					 | 
				
			||||||
        v = FASTLZ_READU16(p);                                                                                         \
 | 
					 | 
				
			||||||
        v ^= FASTLZ_READU16(p + 1) ^ (v >> (16 - HASH_LOG));                                                           \
 | 
					 | 
				
			||||||
        v &= HASH_MASK;                                                                                                \
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef FASTLZ_LEVEL
 | 
					#undef FASTLZ_LEVEL
 | 
				
			||||||
#define FASTLZ_LEVEL 1
 | 
					#define FASTLZ_LEVEL 1
 | 
				
			||||||
| 
						 | 
					@ -110,419 +106,444 @@ int fastlz_decompress(const void *input, int length, void *output, int maxout);
 | 
				
			||||||
#undef FASTLZ_DECOMPRESSOR
 | 
					#undef FASTLZ_DECOMPRESSOR
 | 
				
			||||||
#define FASTLZ_COMPRESSOR fastlz1_compress
 | 
					#define FASTLZ_COMPRESSOR fastlz1_compress
 | 
				
			||||||
#define FASTLZ_DECOMPRESSOR fastlz1_decompress
 | 
					#define FASTLZ_DECOMPRESSOR fastlz1_decompress
 | 
				
			||||||
static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void *input, int length, void *output);
 | 
					static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
 | 
				
			||||||
static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void *input, int length, void *output, int maxout);
 | 
					static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
 | 
				
			||||||
#include "fastlz.cc"
 | 
					#include "fastlz.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef FASTLZ_LEVEL
 | 
					#undef FASTLZ_LEVEL
 | 
				
			||||||
#define FASTLZ_LEVEL 2
 | 
					#define FASTLZ_LEVEL 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef MAX_DISTANCE
 | 
					#undef MAX_DISTANCE
 | 
				
			||||||
#define MAX_DISTANCE 8191
 | 
					#define MAX_DISTANCE 8191
 | 
				
			||||||
#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
 | 
					#define MAX_FARDISTANCE (65535+MAX_DISTANCE-1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef FASTLZ_COMPRESSOR
 | 
					#undef FASTLZ_COMPRESSOR
 | 
				
			||||||
#undef FASTLZ_DECOMPRESSOR
 | 
					#undef FASTLZ_DECOMPRESSOR
 | 
				
			||||||
#define FASTLZ_COMPRESSOR fastlz2_compress
 | 
					#define FASTLZ_COMPRESSOR fastlz2_compress
 | 
				
			||||||
#define FASTLZ_DECOMPRESSOR fastlz2_decompress
 | 
					#define FASTLZ_DECOMPRESSOR fastlz2_decompress
 | 
				
			||||||
static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void *input, int length, void *output);
 | 
					static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
 | 
				
			||||||
static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void *input, int length, void *output, int maxout);
 | 
					static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
 | 
				
			||||||
#include "fastlz.cc"
 | 
					#include "fastlz.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int fastlz_compress(const void *input, int length, void *output)
 | 
					int fastlz_compress(const void* input, int length, void* output)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* for short block, choose fastlz1 */
 | 
					  /* for short block, choose fastlz1 */
 | 
				
			||||||
    if (length < 65536)
 | 
					  if(length < 65536)
 | 
				
			||||||
        return fastlz1_compress(input, length, output);
 | 
					    return fastlz1_compress(input, length, output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* else... */
 | 
					  /* else... */
 | 
				
			||||||
 | 
					  return fastlz2_compress(input, length, output);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int fastlz_decompress(const void* input, int length, void* output, int maxout)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  /* magic identifier for compression level */
 | 
				
			||||||
 | 
					  int level = ((*(const flzuint8*)input) >> 5) + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if(level == 1)
 | 
				
			||||||
 | 
					    return fastlz1_decompress(input, length, output, maxout);
 | 
				
			||||||
 | 
					  if(level == 2)
 | 
				
			||||||
 | 
					    return fastlz2_decompress(input, length, output, maxout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* unknown level, trigger error */
 | 
				
			||||||
 | 
					  return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int fastlz_compress_level(int level, const void* input, int length, void* output)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  if(level == 1)
 | 
				
			||||||
 | 
					    return fastlz1_compress(input, length, output);
 | 
				
			||||||
 | 
					  if(level == 2)
 | 
				
			||||||
    return fastlz2_compress(input, length, output);
 | 
					    return fastlz2_compress(input, length, output);
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
int fastlz_decompress(const void *input, int length, void *output, int maxout)
 | 
					  return 0;
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /* magic identifier for compression level */
 | 
					 | 
				
			||||||
    int level = ((*(const flzuint8 *)input) >> 5) + 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (level == 1)
 | 
					 | 
				
			||||||
        return fastlz1_decompress(input, length, output, maxout);
 | 
					 | 
				
			||||||
    if (level == 2)
 | 
					 | 
				
			||||||
        return fastlz2_decompress(input, length, output, maxout);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* unknown level, trigger error */
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int fastlz_compress_level(int level, const void *input, int length, void *output)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    if (level == 1)
 | 
					 | 
				
			||||||
        return fastlz1_compress(input, length, output);
 | 
					 | 
				
			||||||
    if (level == 2)
 | 
					 | 
				
			||||||
        return fastlz2_compress(input, length, output);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
 | 
					#else /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void *input, int length, void *output)
 | 
					static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const flzuint8 *ip = (const flzuint8 *)input;
 | 
					  const flzuint8* ip = (const flzuint8*) input;
 | 
				
			||||||
    const flzuint8 *ip_bound = ip + length - 2;
 | 
					  const flzuint8* ip_bound = ip + length - 2;
 | 
				
			||||||
    const flzuint8 *ip_limit = ip + length - 12;
 | 
					  const flzuint8* ip_limit = ip + length - 12;
 | 
				
			||||||
    flzuint8 *op = (flzuint8 *)output;
 | 
					  flzuint8* op = (flzuint8*) output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const flzuint8 *htab[HASH_SIZE];
 | 
					  const flzuint8* htab[HASH_SIZE];
 | 
				
			||||||
    const flzuint8 **hslot;
 | 
					  const flzuint8** hslot;
 | 
				
			||||||
    flzuint32 hval;
 | 
					  flzuint32 hval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    flzuint32 copy;
 | 
					  flzuint32 copy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* sanity check */
 | 
					  /* sanity check */
 | 
				
			||||||
    if (FASTLZ_UNEXPECT_CONDITIONAL(length < 4)) {
 | 
					  if(FASTLZ_UNEXPECT_CONDITIONAL(length < 4))
 | 
				
			||||||
        if (length) {
 | 
					  {
 | 
				
			||||||
            /* create literal copy only */
 | 
					    if(length)
 | 
				
			||||||
            *op++ = length - 1;
 | 
					    {
 | 
				
			||||||
            ip_bound++;
 | 
					      /* create literal copy only */
 | 
				
			||||||
            while (ip <= ip_bound)
 | 
					      *op++ = length-1;
 | 
				
			||||||
                *op++ = *ip++;
 | 
					      ip_bound++;
 | 
				
			||||||
            return length + 1;
 | 
					      while(ip <= ip_bound)
 | 
				
			||||||
        } else
 | 
					        *op++ = *ip++;
 | 
				
			||||||
            return 0;
 | 
					      return length+1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      return 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* initializes hash table */
 | 
					  /* initializes hash table */
 | 
				
			||||||
    for (hslot = htab; hslot < htab + HASH_SIZE; hslot++)
 | 
					  for (hslot = htab; hslot < htab + HASH_SIZE; hslot++)
 | 
				
			||||||
        *hslot = ip;
 | 
					    *hslot = ip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* we start with literal copy */
 | 
					  /* we start with literal copy */
 | 
				
			||||||
    copy = 2;
 | 
					  copy = 2;
 | 
				
			||||||
    *op++ = MAX_COPY - 1;
 | 
					  *op++ = MAX_COPY-1;
 | 
				
			||||||
    *op++ = *ip++;
 | 
					  *op++ = *ip++;
 | 
				
			||||||
    *op++ = *ip++;
 | 
					  *op++ = *ip++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* main loop */
 | 
					  /* main loop */
 | 
				
			||||||
    while (FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit)) {
 | 
					  while(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
 | 
				
			||||||
        const flzuint8 *ref;
 | 
					  {
 | 
				
			||||||
        flzuint32 distance;
 | 
					    const flzuint8* ref;
 | 
				
			||||||
 | 
					    flzuint32 distance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* minimum match length */
 | 
					    /* minimum match length */
 | 
				
			||||||
        flzuint32 len = 3;
 | 
					    flzuint32 len = 3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* comparison starting-point */
 | 
					    /* comparison starting-point */
 | 
				
			||||||
        const flzuint8 *anchor = ip;
 | 
					    const flzuint8* anchor = ip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* check for a run */
 | 
					    /* check for a run */
 | 
				
			||||||
#if FASTLZ_LEVEL == 2
 | 
					#if FASTLZ_LEVEL==2
 | 
				
			||||||
        if (ip[0] == ip[-1] && FASTLZ_READU16(ip - 1) == FASTLZ_READU16(ip + 1)) {
 | 
					    if(ip[0] == ip[-1] && FASTLZ_READU16(ip-1)==FASTLZ_READU16(ip+1))
 | 
				
			||||||
            distance = 1;
 | 
					    {
 | 
				
			||||||
            /* ip += 3; */ /* scan-build, never used */
 | 
					      distance = 1;
 | 
				
			||||||
            ref = anchor - 1 + 3;
 | 
					      /* ip += 3; */ /* scan-build, never used */
 | 
				
			||||||
            goto match;
 | 
					      ref = anchor - 1 + 3;
 | 
				
			||||||
        }
 | 
					      goto match;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* find potential match */
 | 
					    /* find potential match */
 | 
				
			||||||
        HASH_FUNCTION(hval, ip);
 | 
					    HASH_FUNCTION(hval,ip);
 | 
				
			||||||
        hslot = htab + hval;
 | 
					    hslot = htab + hval;
 | 
				
			||||||
        ref = htab[hval];
 | 
					    ref = htab[hval];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* calculate distance to the match */
 | 
					    /* calculate distance to the match */
 | 
				
			||||||
        distance = anchor - ref;
 | 
					    distance = anchor - ref;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* update hash table */
 | 
					    /* update hash table */
 | 
				
			||||||
        *hslot = anchor;
 | 
					    *hslot = anchor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* is this a match? check the first 3 bytes */
 | 
					    /* is this a match? check the first 3 bytes */
 | 
				
			||||||
        if (distance == 0 ||
 | 
					    if(distance==0 ||
 | 
				
			||||||
#if FASTLZ_LEVEL == 1
 | 
					#if FASTLZ_LEVEL==1
 | 
				
			||||||
            (distance >= MAX_DISTANCE) ||
 | 
					    (distance >= MAX_DISTANCE) ||
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
            (distance >= MAX_FARDISTANCE) ||
 | 
					    (distance >= MAX_FARDISTANCE) ||
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
            *ref++ != *ip++ || *ref++ != *ip++ || *ref++ != *ip++)
 | 
					    *ref++ != *ip++ || *ref++!=*ip++ || *ref++!=*ip++)
 | 
				
			||||||
            goto literal;
 | 
					      goto literal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if FASTLZ_LEVEL == 2
 | 
					#if FASTLZ_LEVEL==2
 | 
				
			||||||
        /* far, needs at least 5-byte match */
 | 
					    /* far, needs at least 5-byte match */
 | 
				
			||||||
        if (distance >= MAX_DISTANCE) {
 | 
					    if(distance >= MAX_DISTANCE)
 | 
				
			||||||
            if (*ip++ != *ref++ || *ip++ != *ref++)
 | 
					    {
 | 
				
			||||||
                goto literal;
 | 
					      if(*ip++ != *ref++ || *ip++!= *ref++)
 | 
				
			||||||
            len += 2;
 | 
					        goto literal;
 | 
				
			||||||
        }
 | 
					      len += 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    match:
 | 
					    match:
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* last matched byte */
 | 
					    /* last matched byte */
 | 
				
			||||||
        ip = anchor + len;
 | 
					    ip = anchor + len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* distance is biased */
 | 
					    /* distance is biased */
 | 
				
			||||||
        distance--;
 | 
					    distance--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!distance) {
 | 
					    if(!distance)
 | 
				
			||||||
            /* zero distance means a run */
 | 
					    {
 | 
				
			||||||
            flzuint8 x = ip[-1];
 | 
					      /* zero distance means a run */
 | 
				
			||||||
            while (ip < ip_bound)
 | 
					      flzuint8 x = ip[-1];
 | 
				
			||||||
                if (*ref++ != x)
 | 
					      while(ip < ip_bound)
 | 
				
			||||||
                    break;
 | 
					        if(*ref++ != x) break; else ip++;
 | 
				
			||||||
                else
 | 
					    }
 | 
				
			||||||
                    ip++;
 | 
					    else
 | 
				
			||||||
        } else
 | 
					    for(;;)
 | 
				
			||||||
            for (;;) {
 | 
					    {
 | 
				
			||||||
                /* safe because the outer check against ip limit */
 | 
					      /* safe because the outer check against ip limit */
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                    break;
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                    break;
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                    break;
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                    break;
 | 
					      if(*ref++ != *ip++) break;
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					      while(ip < ip_bound)
 | 
				
			||||||
                    break;
 | 
					        if(*ref++ != *ip++) break;
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					      break;
 | 
				
			||||||
                    break;
 | 
					    }
 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                if (*ref++ != *ip++)
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                while (ip < ip_bound)
 | 
					 | 
				
			||||||
                    if (*ref++ != *ip++)
 | 
					 | 
				
			||||||
                        break;
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* if we have copied something, adjust the copy count */
 | 
					    /* if we have copied something, adjust the copy count */
 | 
				
			||||||
        if (copy)
 | 
					    if(copy)
 | 
				
			||||||
            /* copy is biased, '0' means 1 byte copy */
 | 
					      /* copy is biased, '0' means 1 byte copy */
 | 
				
			||||||
            *(op - copy - 1) = copy - 1;
 | 
					      *(op-copy-1) = copy-1;
 | 
				
			||||||
        else
 | 
					    else
 | 
				
			||||||
            /* back, to overwrite the copy count */
 | 
					      /* back, to overwrite the copy count */
 | 
				
			||||||
            op--;
 | 
					      op--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* reset literal counter */
 | 
					    /* reset literal counter */
 | 
				
			||||||
        copy = 0;
 | 
					    copy = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* length is biased, '1' means a match of 3 bytes */
 | 
					    /* length is biased, '1' means a match of 3 bytes */
 | 
				
			||||||
        ip -= 3;
 | 
					    ip -= 3;
 | 
				
			||||||
        len = ip - anchor;
 | 
					    len = ip - anchor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* encode the match */
 | 
					    /* encode the match */
 | 
				
			||||||
#if FASTLZ_LEVEL == 2
 | 
					#if FASTLZ_LEVEL==2
 | 
				
			||||||
        if (distance < MAX_DISTANCE) {
 | 
					    if(distance < MAX_DISTANCE)
 | 
				
			||||||
            if (len < 7) {
 | 
					    {
 | 
				
			||||||
                *op++ = (len << 5) + (distance >> 8);
 | 
					      if(len < 7)
 | 
				
			||||||
                *op++ = (distance & 255);
 | 
					      {
 | 
				
			||||||
            } else {
 | 
					        *op++ = (len << 5) + (distance >> 8);
 | 
				
			||||||
                *op++ = (7 << 5) + (distance >> 8);
 | 
					        *op++ = (distance & 255);
 | 
				
			||||||
                for (len -= 7; len >= 255; len -= 255)
 | 
					      }
 | 
				
			||||||
                    *op++ = 255;
 | 
					      else
 | 
				
			||||||
                *op++ = len;
 | 
					      {
 | 
				
			||||||
                *op++ = (distance & 255);
 | 
					        *op++ = (7 << 5) + (distance >> 8);
 | 
				
			||||||
            }
 | 
					        for(len-=7; len >= 255; len-= 255)
 | 
				
			||||||
        } else {
 | 
					          *op++ = 255;
 | 
				
			||||||
            /* far away, but not yet in the another galaxy... */
 | 
					        *op++ = len;
 | 
				
			||||||
            if (len < 7) {
 | 
					        *op++ = (distance & 255);
 | 
				
			||||||
                distance -= MAX_DISTANCE;
 | 
					      }
 | 
				
			||||||
                *op++ = (len << 5) + 31;
 | 
					    }
 | 
				
			||||||
                *op++ = 255;
 | 
					    else
 | 
				
			||||||
                *op++ = distance >> 8;
 | 
					    {
 | 
				
			||||||
                *op++ = distance & 255;
 | 
					      /* far away, but not yet in the another galaxy... */
 | 
				
			||||||
            } else {
 | 
					      if(len < 7)
 | 
				
			||||||
                distance -= MAX_DISTANCE;
 | 
					      {
 | 
				
			||||||
                *op++ = (7 << 5) + 31;
 | 
					        distance -= MAX_DISTANCE;
 | 
				
			||||||
                for (len -= 7; len >= 255; len -= 255)
 | 
					        *op++ = (len << 5) + 31;
 | 
				
			||||||
                    *op++ = 255;
 | 
					        *op++ = 255;
 | 
				
			||||||
                *op++ = len;
 | 
					        *op++ = distance >> 8;
 | 
				
			||||||
                *op++ = 255;
 | 
					        *op++ = distance & 255;
 | 
				
			||||||
                *op++ = distance >> 8;
 | 
					      }
 | 
				
			||||||
                *op++ = distance & 255;
 | 
					      else
 | 
				
			||||||
            }
 | 
					      {
 | 
				
			||||||
        }
 | 
					        distance -= MAX_DISTANCE;
 | 
				
			||||||
 | 
					        *op++ = (7 << 5) + 31;
 | 
				
			||||||
 | 
					        for(len-=7; len >= 255; len-= 255)
 | 
				
			||||||
 | 
					          *op++ = 255;
 | 
				
			||||||
 | 
					        *op++ = len;
 | 
				
			||||||
 | 
					        *op++ = 255;
 | 
				
			||||||
 | 
					        *op++ = distance >> 8;
 | 
				
			||||||
 | 
					        *op++ = distance & 255;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN - 2))
 | 
					    if(FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN-2))
 | 
				
			||||||
            while (len > MAX_LEN - 2) {
 | 
					      while(len > MAX_LEN-2)
 | 
				
			||||||
                *op++ = (7 << 5) + (distance >> 8);
 | 
					      {
 | 
				
			||||||
                *op++ = MAX_LEN - 2 - 7 - 2;
 | 
					        *op++ = (7 << 5) + (distance >> 8);
 | 
				
			||||||
                *op++ = (distance & 255);
 | 
					        *op++ = MAX_LEN - 2 - 7 -2;
 | 
				
			||||||
                len -= MAX_LEN - 2;
 | 
					        *op++ = (distance & 255);
 | 
				
			||||||
            }
 | 
					        len -= MAX_LEN-2;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (len < 7) {
 | 
					    if(len < 7)
 | 
				
			||||||
            *op++ = (len << 5) + (distance >> 8);
 | 
					    {
 | 
				
			||||||
            *op++ = (distance & 255);
 | 
					      *op++ = (len << 5) + (distance >> 8);
 | 
				
			||||||
        } else {
 | 
					      *op++ = (distance & 255);
 | 
				
			||||||
            *op++ = (7 << 5) + (distance >> 8);
 | 
					    }
 | 
				
			||||||
            *op++ = len - 7;
 | 
					    else
 | 
				
			||||||
            *op++ = (distance & 255);
 | 
					    {
 | 
				
			||||||
        }
 | 
					      *op++ = (7 << 5) + (distance >> 8);
 | 
				
			||||||
 | 
					      *op++ = len - 7;
 | 
				
			||||||
 | 
					      *op++ = (distance & 255);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* update the hash at match boundary */
 | 
					    /* update the hash at match boundary */
 | 
				
			||||||
        HASH_FUNCTION(hval, ip);
 | 
					    HASH_FUNCTION(hval,ip);
 | 
				
			||||||
        htab[hval] = ip++;
 | 
					    htab[hval] = ip++;
 | 
				
			||||||
        HASH_FUNCTION(hval, ip);
 | 
					    HASH_FUNCTION(hval,ip);
 | 
				
			||||||
        htab[hval] = ip++;
 | 
					    htab[hval] = ip++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* assuming literal copy */
 | 
					    /* assuming literal copy */
 | 
				
			||||||
        *op++ = MAX_COPY - 1;
 | 
					    *op++ = MAX_COPY-1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        continue;
 | 
					    continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    literal:
 | 
					    literal:
 | 
				
			||||||
        *op++ = *anchor++;
 | 
					      *op++ = *anchor++;
 | 
				
			||||||
        ip = anchor;
 | 
					      ip = anchor;
 | 
				
			||||||
        copy++;
 | 
					      copy++;
 | 
				
			||||||
        if (FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY)) {
 | 
					      if(FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY))
 | 
				
			||||||
            copy = 0;
 | 
					      {
 | 
				
			||||||
            *op++ = MAX_COPY - 1;
 | 
					        copy = 0;
 | 
				
			||||||
        }
 | 
					        *op++ = MAX_COPY-1;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* left-over as literal copy */
 | 
				
			||||||
 | 
					  ip_bound++;
 | 
				
			||||||
 | 
					  while(ip <= ip_bound)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    *op++ = *ip++;
 | 
				
			||||||
 | 
					    copy++;
 | 
				
			||||||
 | 
					    if(copy == MAX_COPY)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      copy = 0;
 | 
				
			||||||
 | 
					      *op++ = MAX_COPY-1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* left-over as literal copy */
 | 
					  /* if we have copied something, adjust the copy length */
 | 
				
			||||||
    ip_bound++;
 | 
					  if(copy)
 | 
				
			||||||
    while (ip <= ip_bound) {
 | 
					    *(op-copy-1) = copy-1;
 | 
				
			||||||
        *op++ = *ip++;
 | 
					  else
 | 
				
			||||||
        copy++;
 | 
					    op--;
 | 
				
			||||||
        if (copy == MAX_COPY) {
 | 
					 | 
				
			||||||
            copy = 0;
 | 
					 | 
				
			||||||
            *op++ = MAX_COPY - 1;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* if we have copied something, adjust the copy length */
 | 
					#if FASTLZ_LEVEL==2
 | 
				
			||||||
    if (copy)
 | 
					  /* marker for fastlz2 */
 | 
				
			||||||
        *(op - copy - 1) = copy - 1;
 | 
					  *(flzuint8*)output |= (1 << 5);
 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        op--;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if FASTLZ_LEVEL == 2
 | 
					 | 
				
			||||||
    /* marker for fastlz2 */
 | 
					 | 
				
			||||||
    *(flzuint8 *)output |= (1 << 5);
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return op - (flzuint8 *)output;
 | 
					  return op - (flzuint8*)output;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void *input, int length, void *output, int maxout)
 | 
					static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const flzuint8 *ip = (const flzuint8 *)input;
 | 
					  const flzuint8* ip = (const flzuint8*) input;
 | 
				
			||||||
    const flzuint8 *ip_limit = ip + length;
 | 
					  const flzuint8* ip_limit  = ip + length;
 | 
				
			||||||
    flzuint8 *op = (flzuint8 *)output;
 | 
					  flzuint8* op = (flzuint8*) output;
 | 
				
			||||||
    flzuint8 *op_limit = op + maxout;
 | 
					  flzuint8* op_limit = op + maxout;
 | 
				
			||||||
    flzuint32 ctrl = (*ip++) & 31;
 | 
					  flzuint32 ctrl = (*ip++) & 31;
 | 
				
			||||||
    int loop = 1;
 | 
					  int loop = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    do {
 | 
					  do
 | 
				
			||||||
        const flzuint8 *ref = op;
 | 
					  {
 | 
				
			||||||
        flzuint32 len = ctrl >> 5;
 | 
					    const flzuint8* ref = op;
 | 
				
			||||||
        flzuint32 ofs = (ctrl & 31) << 8;
 | 
					    flzuint32 len = ctrl >> 5;
 | 
				
			||||||
 | 
					    flzuint32 ofs = (ctrl & 31) << 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ctrl >= 32) {
 | 
					    if(ctrl >= 32)
 | 
				
			||||||
#if FASTLZ_LEVEL == 2
 | 
					    {
 | 
				
			||||||
            flzuint8 code;
 | 
					#if FASTLZ_LEVEL==2
 | 
				
			||||||
 | 
					      flzuint8 code;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
            len--;
 | 
					      len--;
 | 
				
			||||||
            ref -= ofs;
 | 
					      ref -= ofs;
 | 
				
			||||||
            if (len == 7 - 1)
 | 
					      if (len == 7-1)
 | 
				
			||||||
#if FASTLZ_LEVEL == 1
 | 
					#if FASTLZ_LEVEL==1
 | 
				
			||||||
                len += *ip++;
 | 
					        len += *ip++;
 | 
				
			||||||
            ref -= *ip++;
 | 
					      ref -= *ip++;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
                do {
 | 
					        do
 | 
				
			||||||
                    code = *ip++;
 | 
					        {
 | 
				
			||||||
                    len += code;
 | 
					          code = *ip++;
 | 
				
			||||||
                } while (code == 255);
 | 
					          len += code;
 | 
				
			||||||
            code = *ip++;
 | 
					        } while (code==255);
 | 
				
			||||||
            ref -= code;
 | 
					      code = *ip++;
 | 
				
			||||||
 | 
					      ref -= code;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* match from 16-bit distance */
 | 
					      /* match from 16-bit distance */
 | 
				
			||||||
            if (FASTLZ_UNEXPECT_CONDITIONAL(code == 255))
 | 
					      if(FASTLZ_UNEXPECT_CONDITIONAL(code==255))
 | 
				
			||||||
                if (FASTLZ_EXPECT_CONDITIONAL(ofs == (31 << 8))) {
 | 
					      if(FASTLZ_EXPECT_CONDITIONAL(ofs==(31 << 8)))
 | 
				
			||||||
                    ofs = (*ip++) << 8;
 | 
					      {
 | 
				
			||||||
                    ofs += *ip++;
 | 
					        ofs = (*ip++) << 8;
 | 
				
			||||||
                    ref = op - ofs - MAX_DISTANCE;
 | 
					        ofs += *ip++;
 | 
				
			||||||
                }
 | 
					        ref = op - ofs - MAX_DISTANCE;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef FASTLZ_SAFE
 | 
					#ifdef FASTLZ_SAFE
 | 
				
			||||||
            if (FASTLZ_UNEXPECT_CONDITIONAL(op + len + 3 > op_limit))
 | 
					      if (FASTLZ_UNEXPECT_CONDITIONAL(op + len + 3 > op_limit))
 | 
				
			||||||
                return 0;
 | 
					        return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (FASTLZ_UNEXPECT_CONDITIONAL(ref - 1 < (flzuint8 *)output))
 | 
					      if (FASTLZ_UNEXPECT_CONDITIONAL(ref-1 < (flzuint8 *)output))
 | 
				
			||||||
                return 0;
 | 
					        return 0;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
 | 
					      if(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
 | 
				
			||||||
                ctrl = *ip++;
 | 
					        ctrl = *ip++;
 | 
				
			||||||
            else
 | 
					      else
 | 
				
			||||||
                loop = 0;
 | 
					        loop = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (ref == op) {
 | 
					      if(ref == op)
 | 
				
			||||||
                /* optimize copy for a run */
 | 
					      {
 | 
				
			||||||
                flzuint8 b = ref[-1];
 | 
					        /* optimize copy for a run */
 | 
				
			||||||
                *op++ = b;
 | 
					        flzuint8 b = ref[-1];
 | 
				
			||||||
                *op++ = b;
 | 
					        *op++ = b;
 | 
				
			||||||
                *op++ = b;
 | 
					        *op++ = b;
 | 
				
			||||||
                for (; len; --len)
 | 
					        *op++ = b;
 | 
				
			||||||
                    *op++ = b;
 | 
					        for(; len; --len)
 | 
				
			||||||
            } else {
 | 
					          *op++ = b;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
#if !defined(FASTLZ_STRICT_ALIGN)
 | 
					#if !defined(FASTLZ_STRICT_ALIGN)
 | 
				
			||||||
                const flzuint16 *p;
 | 
					        const flzuint16* p;
 | 
				
			||||||
                flzuint16 *q;
 | 
					        flzuint16* q;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
                /* copy from reference */
 | 
					        /* copy from reference */
 | 
				
			||||||
                ref--;
 | 
					        ref--;
 | 
				
			||||||
                *op++ = *ref++;
 | 
					        *op++ = *ref++;
 | 
				
			||||||
                *op++ = *ref++;
 | 
					        *op++ = *ref++;
 | 
				
			||||||
                *op++ = *ref++;
 | 
					        *op++ = *ref++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(FASTLZ_STRICT_ALIGN)
 | 
					#if !defined(FASTLZ_STRICT_ALIGN)
 | 
				
			||||||
                /* copy a byte, so that now it's word aligned */
 | 
					        /* copy a byte, so that now it's word aligned */
 | 
				
			||||||
                if (len & 1) {
 | 
					        if(len & 1)
 | 
				
			||||||
                    *op++ = *ref++;
 | 
					        {
 | 
				
			||||||
                    len--;
 | 
					          *op++ = *ref++;
 | 
				
			||||||
                }
 | 
					          len--;
 | 
				
			||||||
 | 
					 | 
				
			||||||
                /* copy 16-bit at once */
 | 
					 | 
				
			||||||
                q = (flzuint16 *)op;
 | 
					 | 
				
			||||||
                op += len;
 | 
					 | 
				
			||||||
                p = (const flzuint16 *)ref;
 | 
					 | 
				
			||||||
                for (len >>= 1; len > 4; len -= 4) {
 | 
					 | 
				
			||||||
                    *q++ = *p++;
 | 
					 | 
				
			||||||
                    *q++ = *p++;
 | 
					 | 
				
			||||||
                    *q++ = *p++;
 | 
					 | 
				
			||||||
                    *q++ = *p++;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                for (; len; --len)
 | 
					 | 
				
			||||||
                    *q++ = *p++;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
                for (; len; --len)
 | 
					 | 
				
			||||||
                    *op++ = *ref++;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            ctrl++;
 | 
					 | 
				
			||||||
#ifdef FASTLZ_SAFE
 | 
					 | 
				
			||||||
            if (FASTLZ_UNEXPECT_CONDITIONAL(op + ctrl > op_limit))
 | 
					 | 
				
			||||||
                return 0;
 | 
					 | 
				
			||||||
            if (FASTLZ_UNEXPECT_CONDITIONAL(ip + ctrl > ip_limit))
 | 
					 | 
				
			||||||
                return 0;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            *op++ = *ip++;
 | 
					 | 
				
			||||||
            for (--ctrl; ctrl; ctrl--)
 | 
					 | 
				
			||||||
                *op++ = *ip++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
 | 
					 | 
				
			||||||
            if (loop)
 | 
					 | 
				
			||||||
                ctrl = *ip++;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } while (FASTLZ_EXPECT_CONDITIONAL(loop));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return op - (flzuint8 *)output;
 | 
					        /* copy 16-bit at once */
 | 
				
			||||||
 | 
					        q = (flzuint16*) op;
 | 
				
			||||||
 | 
					        op += len;
 | 
				
			||||||
 | 
					        p = (const flzuint16*) ref;
 | 
				
			||||||
 | 
					        for(len>>=1; len > 4; len-=4)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          *q++ = *p++;
 | 
				
			||||||
 | 
					          *q++ = *p++;
 | 
				
			||||||
 | 
					          *q++ = *p++;
 | 
				
			||||||
 | 
					          *q++ = *p++;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        for(; len; --len)
 | 
				
			||||||
 | 
					          *q++ = *p++;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        for(; len; --len)
 | 
				
			||||||
 | 
					          *op++ = *ref++;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      ctrl++;
 | 
				
			||||||
 | 
					#ifdef FASTLZ_SAFE
 | 
				
			||||||
 | 
					      if (FASTLZ_UNEXPECT_CONDITIONAL(op + ctrl > op_limit))
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					      if (FASTLZ_UNEXPECT_CONDITIONAL(ip + ctrl > ip_limit))
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      *op++ = *ip++;
 | 
				
			||||||
 | 
					      for(--ctrl; ctrl; ctrl--)
 | 
				
			||||||
 | 
					        *op++ = *ip++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
 | 
				
			||||||
 | 
					      if(loop)
 | 
				
			||||||
 | 
					        ctrl = *ip++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  while(FASTLZ_EXPECT_CONDITIONAL(loop));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return op - (flzuint8*)output;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
 | 
					#endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										52
									
								
								libs/fst/fst_win_unistd.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								libs/fst/fst_win_unistd.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,52 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright (c) 2009-2018 Tony Bybell.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Permission is hereby granted, free of charge, to any person obtaining a
 | 
				
			||||||
 | 
					 * copy of this software and associated documentation files (the "Software"),
 | 
				
			||||||
 | 
					 * to deal in the Software without restriction, including without limitation
 | 
				
			||||||
 | 
					 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 | 
				
			||||||
 | 
					 * and/or sell copies of the Software, and to permit persons to whom the
 | 
				
			||||||
 | 
					 * Software is furnished to do so, subject to the following conditions:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The above copyright notice and this permission notice shall be included in
 | 
				
			||||||
 | 
					 * all copies or substantial portions of the Software.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
				
			||||||
 | 
					 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
				
			||||||
 | 
					 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
				
			||||||
 | 
					 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
				
			||||||
 | 
					 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 | 
				
			||||||
 | 
					 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 | 
				
			||||||
 | 
					 * DEALINGS IN THE SOFTWARE.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * SPDX-License-Identifier: MIT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef WIN_UNISTD_H
 | 
				
			||||||
 | 
					#define WIN_UNISTD_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#ifdef _WIN64
 | 
				
			||||||
 | 
					#include <io.h>
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#include <sys/io.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <process.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define ftruncate _chsize_s
 | 
				
			||||||
 | 
					#define unlink _unlink
 | 
				
			||||||
 | 
					#define fileno _fileno
 | 
				
			||||||
 | 
					#define lseek _lseeki64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN64
 | 
				
			||||||
 | 
					#define ssize_t __int64
 | 
				
			||||||
 | 
					#define SSIZE_MAX 9223372036854775807i64
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define ssize_t long
 | 
				
			||||||
 | 
					#define SSIZE_MAX 2147483647L
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "stdint.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif //WIN_UNISTD_H
 | 
				
			||||||
							
								
								
									
										9532
									
								
								libs/fst/fstapi.cc
									
										
									
									
									
								
							
							
						
						
									
										9532
									
								
								libs/fst/fstapi.cc
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -33,30 +33,12 @@ extern "C" {
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <ctype.h>
 | 
					#include <ctype.h>
 | 
				
			||||||
 | 
					#include <zlib.h>
 | 
				
			||||||
#include <inttypes.h>
 | 
					#include <inttypes.h>
 | 
				
			||||||
#if defined(_MSC_VER)
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
#include "libs/zlib/zlib.h"
 | 
					    #include "fst_win_unistd.h"
 | 
				
			||||||
#include <io.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <process.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define ftruncate _chsize_s
 | 
					 | 
				
			||||||
#define unlink _unlink
 | 
					 | 
				
			||||||
#define fileno _fileno
 | 
					 | 
				
			||||||
#define lseek _lseeki64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef _WIN64
 | 
					 | 
				
			||||||
#define ssize_t __int64
 | 
					 | 
				
			||||||
#define SSIZE_MAX 9223372036854775807i64
 | 
					 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define ssize_t long
 | 
					    #include <unistd.h>
 | 
				
			||||||
#define SSIZE_MAX 2147483647L
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "stdint.h"
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#include <zlib.h>
 | 
					 | 
				
			||||||
#include <unistd.h>
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,433 +47,417 @@ extern "C" {
 | 
				
			||||||
typedef uint32_t fstHandle;
 | 
					typedef uint32_t fstHandle;
 | 
				
			||||||
typedef uint32_t fstEnumHandle;
 | 
					typedef uint32_t fstEnumHandle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstWriterPackType
 | 
					enum fstWriterPackType {
 | 
				
			||||||
{
 | 
					    FST_WR_PT_ZLIB             = 0,
 | 
				
			||||||
    FST_WR_PT_ZLIB = 0,
 | 
					    FST_WR_PT_FASTLZ           = 1,
 | 
				
			||||||
    FST_WR_PT_FASTLZ = 1,
 | 
					    FST_WR_PT_LZ4              = 2
 | 
				
			||||||
    FST_WR_PT_LZ4 = 2
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstFileType
 | 
					enum fstFileType {
 | 
				
			||||||
{
 | 
					    FST_FT_MIN                 = 0,
 | 
				
			||||||
    FST_FT_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_FT_VERILOG = 0,
 | 
					    FST_FT_VERILOG             = 0,
 | 
				
			||||||
    FST_FT_VHDL = 1,
 | 
					    FST_FT_VHDL                = 1,
 | 
				
			||||||
    FST_FT_VERILOG_VHDL = 2,
 | 
					    FST_FT_VERILOG_VHDL        = 2,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_FT_MAX = 2
 | 
					    FST_FT_MAX                 = 2
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstBlockType
 | 
					enum fstBlockType {
 | 
				
			||||||
{
 | 
					    FST_BL_HDR                 = 0,
 | 
				
			||||||
    FST_BL_HDR = 0,
 | 
					    FST_BL_VCDATA              = 1,
 | 
				
			||||||
    FST_BL_VCDATA = 1,
 | 
					    FST_BL_BLACKOUT            = 2,
 | 
				
			||||||
    FST_BL_BLACKOUT = 2,
 | 
					    FST_BL_GEOM                = 3,
 | 
				
			||||||
    FST_BL_GEOM = 3,
 | 
					    FST_BL_HIER                = 4,
 | 
				
			||||||
    FST_BL_HIER = 4,
 | 
					    FST_BL_VCDATA_DYN_ALIAS    = 5,
 | 
				
			||||||
    FST_BL_VCDATA_DYN_ALIAS = 5,
 | 
					    FST_BL_HIER_LZ4            = 6,
 | 
				
			||||||
    FST_BL_HIER_LZ4 = 6,
 | 
					    FST_BL_HIER_LZ4DUO         = 7,
 | 
				
			||||||
    FST_BL_HIER_LZ4DUO = 7,
 | 
					    FST_BL_VCDATA_DYN_ALIAS2   = 8,
 | 
				
			||||||
    FST_BL_VCDATA_DYN_ALIAS2 = 8,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_BL_ZWRAPPER = 254, /* indicates that whole trace is gz wrapped */
 | 
					    FST_BL_ZWRAPPER            = 254,   /* indicates that whole trace is gz wrapped */
 | 
				
			||||||
    FST_BL_SKIP = 255      /* used while block is being written */
 | 
					    FST_BL_SKIP                = 255    /* used while block is being written */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstScopeType
 | 
					enum fstScopeType {
 | 
				
			||||||
{
 | 
					    FST_ST_MIN                 = 0,
 | 
				
			||||||
    FST_ST_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_ST_VCD_MODULE = 0,
 | 
					    FST_ST_VCD_MODULE          = 0,
 | 
				
			||||||
    FST_ST_VCD_TASK = 1,
 | 
					    FST_ST_VCD_TASK            = 1,
 | 
				
			||||||
    FST_ST_VCD_FUNCTION = 2,
 | 
					    FST_ST_VCD_FUNCTION        = 2,
 | 
				
			||||||
    FST_ST_VCD_BEGIN = 3,
 | 
					    FST_ST_VCD_BEGIN           = 3,
 | 
				
			||||||
    FST_ST_VCD_FORK = 4,
 | 
					    FST_ST_VCD_FORK            = 4,
 | 
				
			||||||
    FST_ST_VCD_GENERATE = 5,
 | 
					    FST_ST_VCD_GENERATE        = 5,
 | 
				
			||||||
    FST_ST_VCD_STRUCT = 6,
 | 
					    FST_ST_VCD_STRUCT          = 6,
 | 
				
			||||||
    FST_ST_VCD_UNION = 7,
 | 
					    FST_ST_VCD_UNION           = 7,
 | 
				
			||||||
    FST_ST_VCD_CLASS = 8,
 | 
					    FST_ST_VCD_CLASS           = 8,
 | 
				
			||||||
    FST_ST_VCD_INTERFACE = 9,
 | 
					    FST_ST_VCD_INTERFACE       = 9,
 | 
				
			||||||
    FST_ST_VCD_PACKAGE = 10,
 | 
					    FST_ST_VCD_PACKAGE         = 10,
 | 
				
			||||||
    FST_ST_VCD_PROGRAM = 11,
 | 
					    FST_ST_VCD_PROGRAM         = 11,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_ST_VHDL_ARCHITECTURE = 12,
 | 
					    FST_ST_VHDL_ARCHITECTURE   = 12,
 | 
				
			||||||
    FST_ST_VHDL_PROCEDURE = 13,
 | 
					    FST_ST_VHDL_PROCEDURE      = 13,
 | 
				
			||||||
    FST_ST_VHDL_FUNCTION = 14,
 | 
					    FST_ST_VHDL_FUNCTION       = 14,
 | 
				
			||||||
    FST_ST_VHDL_RECORD = 15,
 | 
					    FST_ST_VHDL_RECORD         = 15,
 | 
				
			||||||
    FST_ST_VHDL_PROCESS = 16,
 | 
					    FST_ST_VHDL_PROCESS        = 16,
 | 
				
			||||||
    FST_ST_VHDL_BLOCK = 17,
 | 
					    FST_ST_VHDL_BLOCK          = 17,
 | 
				
			||||||
    FST_ST_VHDL_FOR_GENERATE = 18,
 | 
					    FST_ST_VHDL_FOR_GENERATE   = 18,
 | 
				
			||||||
    FST_ST_VHDL_IF_GENERATE = 19,
 | 
					    FST_ST_VHDL_IF_GENERATE    = 19,
 | 
				
			||||||
    FST_ST_VHDL_GENERATE = 20,
 | 
					    FST_ST_VHDL_GENERATE       = 20,
 | 
				
			||||||
    FST_ST_VHDL_PACKAGE = 21,
 | 
					    FST_ST_VHDL_PACKAGE        = 21,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_ST_MAX = 21,
 | 
					    FST_ST_MAX                 = 21,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_ST_GEN_ATTRBEGIN = 252,
 | 
					    FST_ST_GEN_ATTRBEGIN       = 252,
 | 
				
			||||||
    FST_ST_GEN_ATTREND = 253,
 | 
					    FST_ST_GEN_ATTREND         = 253,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_ST_VCD_SCOPE = 254,
 | 
					    FST_ST_VCD_SCOPE           = 254,
 | 
				
			||||||
    FST_ST_VCD_UPSCOPE = 255
 | 
					    FST_ST_VCD_UPSCOPE         = 255
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstVarType
 | 
					enum fstVarType {
 | 
				
			||||||
{
 | 
					    FST_VT_MIN                 = 0,     /* start of vartypes */
 | 
				
			||||||
    FST_VT_MIN = 0, /* start of vartypes */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_VT_VCD_EVENT = 0,
 | 
					    FST_VT_VCD_EVENT           = 0,
 | 
				
			||||||
    FST_VT_VCD_INTEGER = 1,
 | 
					    FST_VT_VCD_INTEGER         = 1,
 | 
				
			||||||
    FST_VT_VCD_PARAMETER = 2,
 | 
					    FST_VT_VCD_PARAMETER       = 2,
 | 
				
			||||||
    FST_VT_VCD_REAL = 3,
 | 
					    FST_VT_VCD_REAL            = 3,
 | 
				
			||||||
    FST_VT_VCD_REAL_PARAMETER = 4,
 | 
					    FST_VT_VCD_REAL_PARAMETER  = 4,
 | 
				
			||||||
    FST_VT_VCD_REG = 5,
 | 
					    FST_VT_VCD_REG             = 5,
 | 
				
			||||||
    FST_VT_VCD_SUPPLY0 = 6,
 | 
					    FST_VT_VCD_SUPPLY0         = 6,
 | 
				
			||||||
    FST_VT_VCD_SUPPLY1 = 7,
 | 
					    FST_VT_VCD_SUPPLY1         = 7,
 | 
				
			||||||
    FST_VT_VCD_TIME = 8,
 | 
					    FST_VT_VCD_TIME            = 8,
 | 
				
			||||||
    FST_VT_VCD_TRI = 9,
 | 
					    FST_VT_VCD_TRI             = 9,
 | 
				
			||||||
    FST_VT_VCD_TRIAND = 10,
 | 
					    FST_VT_VCD_TRIAND          = 10,
 | 
				
			||||||
    FST_VT_VCD_TRIOR = 11,
 | 
					    FST_VT_VCD_TRIOR           = 11,
 | 
				
			||||||
    FST_VT_VCD_TRIREG = 12,
 | 
					    FST_VT_VCD_TRIREG          = 12,
 | 
				
			||||||
    FST_VT_VCD_TRI0 = 13,
 | 
					    FST_VT_VCD_TRI0            = 13,
 | 
				
			||||||
    FST_VT_VCD_TRI1 = 14,
 | 
					    FST_VT_VCD_TRI1            = 14,
 | 
				
			||||||
    FST_VT_VCD_WAND = 15,
 | 
					    FST_VT_VCD_WAND            = 15,
 | 
				
			||||||
    FST_VT_VCD_WIRE = 16,
 | 
					    FST_VT_VCD_WIRE            = 16,
 | 
				
			||||||
    FST_VT_VCD_WOR = 17,
 | 
					    FST_VT_VCD_WOR             = 17,
 | 
				
			||||||
    FST_VT_VCD_PORT = 18,
 | 
					    FST_VT_VCD_PORT            = 18,
 | 
				
			||||||
    FST_VT_VCD_SPARRAY = 19, /* used to define the rownum (index) port for a sparse array */
 | 
					    FST_VT_VCD_SPARRAY         = 19,    /* used to define the rownum (index) port for a sparse array */
 | 
				
			||||||
    FST_VT_VCD_REALTIME = 20,
 | 
					    FST_VT_VCD_REALTIME        = 20,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_VT_GEN_STRING =
 | 
					    FST_VT_GEN_STRING          = 21,    /* generic string type   (max len is defined dynamically via fstWriterEmitVariableLengthValueChange) */
 | 
				
			||||||
            21, /* generic string type   (max len is defined dynamically via fstWriterEmitVariableLengthValueChange) */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_VT_SV_BIT = 22,
 | 
					    FST_VT_SV_BIT              = 22,
 | 
				
			||||||
    FST_VT_SV_LOGIC = 23,
 | 
					    FST_VT_SV_LOGIC            = 23,
 | 
				
			||||||
    FST_VT_SV_INT = 24,      /* declare as size = 32 */
 | 
					    FST_VT_SV_INT              = 24,    /* declare as size = 32 */
 | 
				
			||||||
    FST_VT_SV_SHORTINT = 25, /* declare as size = 16 */
 | 
					    FST_VT_SV_SHORTINT         = 25,    /* declare as size = 16 */
 | 
				
			||||||
    FST_VT_SV_LONGINT = 26,  /* declare as size = 64 */
 | 
					    FST_VT_SV_LONGINT          = 26,    /* declare as size = 64 */
 | 
				
			||||||
    FST_VT_SV_BYTE = 27,     /* declare as size = 8  */
 | 
					    FST_VT_SV_BYTE             = 27,    /* declare as size = 8  */
 | 
				
			||||||
    FST_VT_SV_ENUM = 28,     /* declare as appropriate type range */
 | 
					    FST_VT_SV_ENUM             = 28,    /* declare as appropriate type range */
 | 
				
			||||||
    FST_VT_SV_SHORTREAL =
 | 
					    FST_VT_SV_SHORTREAL        = 29,    /* declare and emit same as FST_VT_VCD_REAL (needs to be emitted as double, not a float) */
 | 
				
			||||||
            29, /* declare and emit same as FST_VT_VCD_REAL (needs to be emitted as double, not a float) */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_VT_MAX = 29 /* end of vartypes */
 | 
					    FST_VT_MAX                 = 29     /* end of vartypes */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstVarDir
 | 
					enum fstVarDir {
 | 
				
			||||||
{
 | 
					    FST_VD_MIN         = 0,
 | 
				
			||||||
    FST_VD_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_VD_IMPLICIT = 0,
 | 
					    FST_VD_IMPLICIT    = 0,
 | 
				
			||||||
    FST_VD_INPUT = 1,
 | 
					    FST_VD_INPUT       = 1,
 | 
				
			||||||
    FST_VD_OUTPUT = 2,
 | 
					    FST_VD_OUTPUT      = 2,
 | 
				
			||||||
    FST_VD_INOUT = 3,
 | 
					    FST_VD_INOUT       = 3,
 | 
				
			||||||
    FST_VD_BUFFER = 4,
 | 
					    FST_VD_BUFFER      = 4,
 | 
				
			||||||
    FST_VD_LINKAGE = 5,
 | 
					    FST_VD_LINKAGE     = 5,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_VD_MAX = 5
 | 
					    FST_VD_MAX         = 5
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstHierType
 | 
					enum fstHierType {
 | 
				
			||||||
{
 | 
					    FST_HT_MIN         = 0,
 | 
				
			||||||
    FST_HT_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_HT_SCOPE = 0,
 | 
					    FST_HT_SCOPE       = 0,
 | 
				
			||||||
    FST_HT_UPSCOPE = 1,
 | 
					    FST_HT_UPSCOPE     = 1,
 | 
				
			||||||
    FST_HT_VAR = 2,
 | 
					    FST_HT_VAR         = 2,
 | 
				
			||||||
    FST_HT_ATTRBEGIN = 3,
 | 
					    FST_HT_ATTRBEGIN   = 3,
 | 
				
			||||||
    FST_HT_ATTREND = 4,
 | 
					    FST_HT_ATTREND     = 4,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* FST_HT_TREEBEGIN and FST_HT_TREEEND are not yet used by FST but are currently used when fstHier bridges other
 | 
					    /* FST_HT_TREEBEGIN and FST_HT_TREEEND are not yet used by FST but are currently used when fstHier bridges other formats */
 | 
				
			||||||
       formats */
 | 
					    FST_HT_TREEBEGIN   = 5,
 | 
				
			||||||
    FST_HT_TREEBEGIN = 5,
 | 
					    FST_HT_TREEEND     = 6,
 | 
				
			||||||
    FST_HT_TREEEND = 6,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_HT_MAX = 6
 | 
					    FST_HT_MAX         = 6
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstAttrType
 | 
					enum fstAttrType {
 | 
				
			||||||
{
 | 
					    FST_AT_MIN         = 0,
 | 
				
			||||||
    FST_AT_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_AT_MISC = 0, /* self-contained: does not need matching FST_HT_ATTREND */
 | 
					    FST_AT_MISC        = 0,     /* self-contained: does not need matching FST_HT_ATTREND */
 | 
				
			||||||
    FST_AT_ARRAY = 1,
 | 
					    FST_AT_ARRAY       = 1,
 | 
				
			||||||
    FST_AT_ENUM = 2,
 | 
					    FST_AT_ENUM        = 2,
 | 
				
			||||||
    FST_AT_PACK = 3,
 | 
					    FST_AT_PACK        = 3,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_AT_MAX = 3
 | 
					    FST_AT_MAX         = 3
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstMiscType
 | 
					enum fstMiscType {
 | 
				
			||||||
{
 | 
					    FST_MT_MIN         = 0,
 | 
				
			||||||
    FST_MT_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_MT_COMMENT = 0,     /* use fstWriterSetComment() to emit */
 | 
					    FST_MT_COMMENT     = 0,     /* use fstWriterSetComment() to emit */
 | 
				
			||||||
    FST_MT_ENVVAR = 1,      /* use fstWriterSetEnvVar() to emit */
 | 
					    FST_MT_ENVVAR      = 1,     /* use fstWriterSetEnvVar() to emit */
 | 
				
			||||||
    FST_MT_SUPVAR = 2,      /* use fstWriterCreateVar2() to emit */
 | 
					    FST_MT_SUPVAR      = 2,     /* use fstWriterCreateVar2() to emit */
 | 
				
			||||||
    FST_MT_PATHNAME = 3,    /* reserved for fstWriterSetSourceStem() string -> number management */
 | 
					    FST_MT_PATHNAME    = 3,     /* reserved for fstWriterSetSourceStem() string -> number management */
 | 
				
			||||||
    FST_MT_SOURCESTEM = 4,  /* use fstWriterSetSourceStem() to emit */
 | 
					    FST_MT_SOURCESTEM  = 4,     /* use fstWriterSetSourceStem() to emit */
 | 
				
			||||||
    FST_MT_SOURCEISTEM = 5, /* use fstWriterSetSourceInstantiationStem() to emit */
 | 
					    FST_MT_SOURCEISTEM = 5,     /* use fstWriterSetSourceInstantiationStem() to emit */
 | 
				
			||||||
    FST_MT_VALUELIST = 6,   /* use fstWriterSetValueList() to emit, followed by fstWriterCreateVar*() */
 | 
					    FST_MT_VALUELIST   = 6,	/* use fstWriterSetValueList() to emit, followed by fstWriterCreateVar*() */
 | 
				
			||||||
    FST_MT_ENUMTABLE = 7,   /* use fstWriterCreateEnumTable() and fstWriterEmitEnumTableRef() to emit */
 | 
					    FST_MT_ENUMTABLE   = 7,	/* use fstWriterCreateEnumTable() and fstWriterEmitEnumTableRef() to emit */
 | 
				
			||||||
    FST_MT_UNKNOWN = 8,
 | 
					    FST_MT_UNKNOWN     = 8,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_MT_MAX = 8
 | 
					    FST_MT_MAX         = 8
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstArrayType
 | 
					enum fstArrayType {
 | 
				
			||||||
{
 | 
					    FST_AR_MIN         = 0,
 | 
				
			||||||
    FST_AR_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_AR_NONE = 0,
 | 
					    FST_AR_NONE        = 0,
 | 
				
			||||||
    FST_AR_UNPACKED = 1,
 | 
					    FST_AR_UNPACKED    = 1,
 | 
				
			||||||
    FST_AR_PACKED = 2,
 | 
					    FST_AR_PACKED      = 2,
 | 
				
			||||||
    FST_AR_SPARSE = 3,
 | 
					    FST_AR_SPARSE      = 3,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_AR_MAX = 3
 | 
					    FST_AR_MAX         = 3
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstEnumValueType
 | 
					enum fstEnumValueType {
 | 
				
			||||||
{
 | 
					    FST_EV_SV_INTEGER           = 0,
 | 
				
			||||||
    FST_EV_SV_INTEGER = 0,
 | 
					    FST_EV_SV_BIT               = 1,
 | 
				
			||||||
    FST_EV_SV_BIT = 1,
 | 
					    FST_EV_SV_LOGIC             = 2,
 | 
				
			||||||
    FST_EV_SV_LOGIC = 2,
 | 
					    FST_EV_SV_INT               = 3,
 | 
				
			||||||
    FST_EV_SV_INT = 3,
 | 
					    FST_EV_SV_SHORTINT          = 4,
 | 
				
			||||||
    FST_EV_SV_SHORTINT = 4,
 | 
					    FST_EV_SV_LONGINT           = 5,
 | 
				
			||||||
    FST_EV_SV_LONGINT = 5,
 | 
					    FST_EV_SV_BYTE              = 6,
 | 
				
			||||||
    FST_EV_SV_BYTE = 6,
 | 
					    FST_EV_SV_UNSIGNED_INTEGER  = 7,
 | 
				
			||||||
    FST_EV_SV_UNSIGNED_INTEGER = 7,
 | 
					    FST_EV_SV_UNSIGNED_BIT      = 8,
 | 
				
			||||||
    FST_EV_SV_UNSIGNED_BIT = 8,
 | 
					    FST_EV_SV_UNSIGNED_LOGIC    = 9,
 | 
				
			||||||
    FST_EV_SV_UNSIGNED_LOGIC = 9,
 | 
					    FST_EV_SV_UNSIGNED_INT      = 10,
 | 
				
			||||||
    FST_EV_SV_UNSIGNED_INT = 10,
 | 
					 | 
				
			||||||
    FST_EV_SV_UNSIGNED_SHORTINT = 11,
 | 
					    FST_EV_SV_UNSIGNED_SHORTINT = 11,
 | 
				
			||||||
    FST_EV_SV_UNSIGNED_LONGINT = 12,
 | 
					    FST_EV_SV_UNSIGNED_LONGINT  = 12,
 | 
				
			||||||
    FST_EV_SV_UNSIGNED_BYTE = 13,
 | 
					    FST_EV_SV_UNSIGNED_BYTE     = 13,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_EV_REG = 14,
 | 
					    FST_EV_REG			= 14,
 | 
				
			||||||
    FST_EV_TIME = 15,
 | 
					    FST_EV_TIME			= 15,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_EV_MAX = 15
 | 
					    FST_EV_MAX                  = 15
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstPackType
 | 
					enum fstPackType {
 | 
				
			||||||
{
 | 
					    FST_PT_NONE          = 0,
 | 
				
			||||||
    FST_PT_NONE = 0,
 | 
					    FST_PT_UNPACKED      = 1,
 | 
				
			||||||
    FST_PT_UNPACKED = 1,
 | 
					    FST_PT_PACKED        = 2,
 | 
				
			||||||
    FST_PT_PACKED = 2,
 | 
					 | 
				
			||||||
    FST_PT_TAGGED_PACKED = 3,
 | 
					    FST_PT_TAGGED_PACKED = 3,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_PT_MAX = 3
 | 
					    FST_PT_MAX           = 3
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstSupplementalVarType
 | 
					enum fstSupplementalVarType {
 | 
				
			||||||
{
 | 
					    FST_SVT_MIN                    = 0,
 | 
				
			||||||
    FST_SVT_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SVT_NONE = 0,
 | 
					    FST_SVT_NONE                   = 0,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SVT_VHDL_SIGNAL = 1,
 | 
					    FST_SVT_VHDL_SIGNAL            = 1,
 | 
				
			||||||
    FST_SVT_VHDL_VARIABLE = 2,
 | 
					    FST_SVT_VHDL_VARIABLE          = 2,
 | 
				
			||||||
    FST_SVT_VHDL_CONSTANT = 3,
 | 
					    FST_SVT_VHDL_CONSTANT          = 3,
 | 
				
			||||||
    FST_SVT_VHDL_FILE = 4,
 | 
					    FST_SVT_VHDL_FILE              = 4,
 | 
				
			||||||
    FST_SVT_VHDL_MEMORY = 5,
 | 
					    FST_SVT_VHDL_MEMORY            = 5,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SVT_MAX = 5
 | 
					    FST_SVT_MAX                    = 5
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum fstSupplementalDataType
 | 
					enum fstSupplementalDataType {
 | 
				
			||||||
{
 | 
					    FST_SDT_MIN                    = 0,
 | 
				
			||||||
    FST_SDT_MIN = 0,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SDT_NONE = 0,
 | 
					    FST_SDT_NONE                   = 0,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SDT_VHDL_BOOLEAN = 1,
 | 
					    FST_SDT_VHDL_BOOLEAN           = 1,
 | 
				
			||||||
    FST_SDT_VHDL_BIT = 2,
 | 
					    FST_SDT_VHDL_BIT               = 2,
 | 
				
			||||||
    FST_SDT_VHDL_BIT_VECTOR = 3,
 | 
					    FST_SDT_VHDL_BIT_VECTOR        = 3,
 | 
				
			||||||
    FST_SDT_VHDL_STD_ULOGIC = 4,
 | 
					    FST_SDT_VHDL_STD_ULOGIC        = 4,
 | 
				
			||||||
    FST_SDT_VHDL_STD_ULOGIC_VECTOR = 5,
 | 
					    FST_SDT_VHDL_STD_ULOGIC_VECTOR = 5,
 | 
				
			||||||
    FST_SDT_VHDL_STD_LOGIC = 6,
 | 
					    FST_SDT_VHDL_STD_LOGIC         = 6,
 | 
				
			||||||
    FST_SDT_VHDL_STD_LOGIC_VECTOR = 7,
 | 
					    FST_SDT_VHDL_STD_LOGIC_VECTOR  = 7,
 | 
				
			||||||
    FST_SDT_VHDL_UNSIGNED = 8,
 | 
					    FST_SDT_VHDL_UNSIGNED          = 8,
 | 
				
			||||||
    FST_SDT_VHDL_SIGNED = 9,
 | 
					    FST_SDT_VHDL_SIGNED            = 9,
 | 
				
			||||||
    FST_SDT_VHDL_INTEGER = 10,
 | 
					    FST_SDT_VHDL_INTEGER           = 10,
 | 
				
			||||||
    FST_SDT_VHDL_REAL = 11,
 | 
					    FST_SDT_VHDL_REAL              = 11,
 | 
				
			||||||
    FST_SDT_VHDL_NATURAL = 12,
 | 
					    FST_SDT_VHDL_NATURAL           = 12,
 | 
				
			||||||
    FST_SDT_VHDL_POSITIVE = 13,
 | 
					    FST_SDT_VHDL_POSITIVE          = 13,
 | 
				
			||||||
    FST_SDT_VHDL_TIME = 14,
 | 
					    FST_SDT_VHDL_TIME              = 14,
 | 
				
			||||||
    FST_SDT_VHDL_CHARACTER = 15,
 | 
					    FST_SDT_VHDL_CHARACTER         = 15,
 | 
				
			||||||
    FST_SDT_VHDL_STRING = 16,
 | 
					    FST_SDT_VHDL_STRING            = 16,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SDT_MAX = 16,
 | 
					    FST_SDT_MAX                    = 16,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FST_SDT_SVT_SHIFT_COUNT =
 | 
					    FST_SDT_SVT_SHIFT_COUNT        = 10, /* FST_SVT_* is ORed in by fstWriterCreateVar2() to the left after shifting FST_SDT_SVT_SHIFT_COUNT */
 | 
				
			||||||
            10, /* FST_SVT_* is ORed in by fstWriterCreateVar2() to the left after shifting FST_SDT_SVT_SHIFT_COUNT */
 | 
					    FST_SDT_ABS_MAX                = ((1<<(FST_SDT_SVT_SHIFT_COUNT))-1)
 | 
				
			||||||
    FST_SDT_ABS_MAX = ((1 << (FST_SDT_SVT_SHIFT_COUNT)) - 1)
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct fstHier
 | 
					struct fstHier
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    unsigned char htyp;
 | 
					unsigned char htyp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    union
 | 
					union {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        /* if htyp == FST_HT_SCOPE */
 | 
					        /* if htyp == FST_HT_SCOPE */
 | 
				
			||||||
        struct fstHierScope
 | 
					        struct fstHierScope {
 | 
				
			||||||
        {
 | 
					                unsigned char typ; /* FST_ST_MIN ... FST_ST_MAX */
 | 
				
			||||||
            unsigned char typ; /* FST_ST_MIN ... FST_ST_MAX */
 | 
					                const char *name;
 | 
				
			||||||
            const char *name;
 | 
					                const char *component;
 | 
				
			||||||
            const char *component;
 | 
					                uint32_t name_length;           /* strlen(u.scope.name) */
 | 
				
			||||||
            uint32_t name_length;      /* strlen(u.scope.name) */
 | 
					                uint32_t component_length;      /* strlen(u.scope.component) */
 | 
				
			||||||
            uint32_t component_length; /* strlen(u.scope.component) */
 | 
					                } scope;
 | 
				
			||||||
        } scope;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* if htyp == FST_HT_VAR */
 | 
					        /* if htyp == FST_HT_VAR */
 | 
				
			||||||
        struct fstHierVar
 | 
					        struct fstHierVar {
 | 
				
			||||||
        {
 | 
					                unsigned char typ; /* FST_VT_MIN ... FST_VT_MAX */
 | 
				
			||||||
            unsigned char typ;           /* FST_VT_MIN ... FST_VT_MAX */
 | 
					                unsigned char direction; /* FST_VD_MIN ... FST_VD_MAX */
 | 
				
			||||||
            unsigned char direction;     /* FST_VD_MIN ... FST_VD_MAX */
 | 
					                unsigned char svt_workspace; /* zeroed out by FST reader, for client code use */
 | 
				
			||||||
            unsigned char svt_workspace; /* zeroed out by FST reader, for client code use */
 | 
					                unsigned char sdt_workspace; /* zeroed out by FST reader, for client code use */
 | 
				
			||||||
            unsigned char sdt_workspace; /* zeroed out by FST reader, for client code use */
 | 
					                unsigned int  sxt_workspace; /* zeroed out by FST reader, for client code use */
 | 
				
			||||||
            unsigned int sxt_workspace;  /* zeroed out by FST reader, for client code use */
 | 
					                const char *name;
 | 
				
			||||||
            const char *name;
 | 
					                uint32_t length;
 | 
				
			||||||
            uint32_t length;
 | 
					                fstHandle handle;
 | 
				
			||||||
            fstHandle handle;
 | 
					                uint32_t name_length; /* strlen(u.var.name) */
 | 
				
			||||||
            uint32_t name_length; /* strlen(u.var.name) */
 | 
					                unsigned is_alias : 1;
 | 
				
			||||||
            unsigned is_alias : 1;
 | 
					                } var;
 | 
				
			||||||
        } var;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* if htyp == FST_HT_ATTRBEGIN */
 | 
					        /* if htyp == FST_HT_ATTRBEGIN */
 | 
				
			||||||
        struct fstHierAttr
 | 
					        struct fstHierAttr {
 | 
				
			||||||
        {
 | 
					                unsigned char typ; /* FST_AT_MIN ... FST_AT_MAX */
 | 
				
			||||||
            unsigned char typ;     /* FST_AT_MIN ... FST_AT_MAX */
 | 
					                unsigned char subtype; /* from fstMiscType, fstArrayType, fstEnumValueType, fstPackType */
 | 
				
			||||||
            unsigned char subtype; /* from fstMiscType, fstArrayType, fstEnumValueType, fstPackType */
 | 
					                const char *name;
 | 
				
			||||||
            const char *name;
 | 
					                uint64_t arg; /* number of array elements, struct members, or some other payload (possibly ignored) */
 | 
				
			||||||
            uint64_t arg; /* number of array elements, struct members, or some other payload (possibly ignored) */
 | 
					                uint64_t arg_from_name; /* for when name is overloaded as a variable-length integer (FST_AT_MISC + FST_MT_SOURCESTEM) */
 | 
				
			||||||
            uint64_t arg_from_name; /* for when name is overloaded as a variable-length integer (FST_AT_MISC +
 | 
					                uint32_t name_length; /* strlen(u.attr.name) */
 | 
				
			||||||
                                       FST_MT_SOURCESTEM) */
 | 
					                } attr;
 | 
				
			||||||
            uint32_t name_length;   /* strlen(u.attr.name) */
 | 
					        } u;
 | 
				
			||||||
        } attr;
 | 
					 | 
				
			||||||
    } u;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct fstETab
 | 
					struct fstETab
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char *name;
 | 
					char *name;
 | 
				
			||||||
    uint32_t elem_count;
 | 
					uint32_t elem_count;
 | 
				
			||||||
    char **literal_arr;
 | 
					char **literal_arr;
 | 
				
			||||||
    char **val_arr;
 | 
					char **val_arr;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * writer functions
 | 
					 * writer functions
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void fstWriterClose(void *ctx);
 | 
					void            fstWriterClose(void *ctx);
 | 
				
			||||||
void *fstWriterCreate(const char *nam, int use_compressed_hier);
 | 
					void *          fstWriterCreate(const char *nam, int use_compressed_hier);
 | 
				
			||||||
fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits,
 | 
					fstEnumHandle   fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr);
 | 
				
			||||||
                                       const char **literal_arr, const char **val_arr);
 | 
					                /* used for Verilog/SV */
 | 
				
			||||||
/* used for Verilog/SV */
 | 
					fstHandle       fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir vd,
 | 
				
			||||||
fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir vd, uint32_t len, const char *nam,
 | 
					                        uint32_t len, const char *nam, fstHandle aliasHandle);
 | 
				
			||||||
                             fstHandle aliasHandle);
 | 
					                /* future expansion for VHDL and other languages.  The variable type, data type, etc map onto
 | 
				
			||||||
/* future expansion for VHDL and other languages.  The variable type, data type, etc map onto
 | 
					                   the current Verilog/SV one.  The "type" string is optional for a more verbose or custom description */
 | 
				
			||||||
   the current Verilog/SV one.  The "type" string is optional for a more verbose or custom description */
 | 
					fstHandle       fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDir vd,
 | 
				
			||||||
fstHandle fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDir vd, uint32_t len, const char *nam,
 | 
					                        uint32_t len, const char *nam, fstHandle aliasHandle,
 | 
				
			||||||
                              fstHandle aliasHandle, const char *type, enum fstSupplementalVarType svt,
 | 
					                        const char *type, enum fstSupplementalVarType svt, enum fstSupplementalDataType sdt);
 | 
				
			||||||
                              enum fstSupplementalDataType sdt);
 | 
					void            fstWriterEmitDumpActive(void *ctx, int enable);
 | 
				
			||||||
void fstWriterEmitDumpActive(void *ctx, int enable);
 | 
					void 		fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle);
 | 
				
			||||||
void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle);
 | 
					void            fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val);
 | 
				
			||||||
void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val);
 | 
					void            fstWriterEmitValueChange32(void *ctx, fstHandle handle,
 | 
				
			||||||
void fstWriterEmitValueChange32(void *ctx, fstHandle handle, uint32_t bits, uint32_t val);
 | 
					                        uint32_t bits, uint32_t val);
 | 
				
			||||||
void fstWriterEmitValueChange64(void *ctx, fstHandle handle, uint32_t bits, uint64_t val);
 | 
					void            fstWriterEmitValueChange64(void *ctx, fstHandle handle,
 | 
				
			||||||
void fstWriterEmitValueChangeVec32(void *ctx, fstHandle handle, uint32_t bits, const uint32_t *val);
 | 
					                        uint32_t bits, uint64_t val);
 | 
				
			||||||
void fstWriterEmitValueChangeVec64(void *ctx, fstHandle handle, uint32_t bits, const uint64_t *val);
 | 
					void            fstWriterEmitValueChangeVec32(void *ctx, fstHandle handle,
 | 
				
			||||||
void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len);
 | 
					                        uint32_t bits, const uint32_t *val);
 | 
				
			||||||
void fstWriterEmitTimeChange(void *ctx, uint64_t tim);
 | 
					void            fstWriterEmitValueChangeVec64(void *ctx, fstHandle handle,
 | 
				
			||||||
void fstWriterFlushContext(void *ctx);
 | 
					                        uint32_t bits, const uint64_t *val);
 | 
				
			||||||
int fstWriterGetDumpSizeLimitReached(void *ctx);
 | 
					void            fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len);
 | 
				
			||||||
int fstWriterGetFseekFailed(void *ctx);
 | 
					void            fstWriterEmitTimeChange(void *ctx, uint64_t tim);
 | 
				
			||||||
void fstWriterSetAttrBegin(void *ctx, enum fstAttrType attrtype, int subtype, const char *attrname, uint64_t arg);
 | 
					void            fstWriterFlushContext(void *ctx);
 | 
				
			||||||
void fstWriterSetAttrEnd(void *ctx);
 | 
					int             fstWriterGetDumpSizeLimitReached(void *ctx);
 | 
				
			||||||
void fstWriterSetComment(void *ctx, const char *comm);
 | 
					int             fstWriterGetFseekFailed(void *ctx);
 | 
				
			||||||
void fstWriterSetDate(void *ctx, const char *dat);
 | 
					void            fstWriterSetAttrBegin(void *ctx, enum fstAttrType attrtype, int subtype,
 | 
				
			||||||
void fstWriterSetDumpSizeLimit(void *ctx, uint64_t numbytes);
 | 
					                        const char *attrname, uint64_t arg);
 | 
				
			||||||
void fstWriterSetEnvVar(void *ctx, const char *envvar);
 | 
					void            fstWriterSetAttrEnd(void *ctx);
 | 
				
			||||||
void fstWriterSetFileType(void *ctx, enum fstFileType filetype);
 | 
					void            fstWriterSetComment(void *ctx, const char *comm);
 | 
				
			||||||
void fstWriterSetPackType(void *ctx, enum fstWriterPackType typ);
 | 
					void            fstWriterSetDate(void *ctx, const char *dat);
 | 
				
			||||||
void fstWriterSetParallelMode(void *ctx, int enable);
 | 
					void            fstWriterSetDumpSizeLimit(void *ctx, uint64_t numbytes);
 | 
				
			||||||
void fstWriterSetRepackOnClose(void *ctx, int enable); /* type = 0 (none), 1 (libz) */
 | 
					void            fstWriterSetEnvVar(void *ctx, const char *envvar);
 | 
				
			||||||
void fstWriterSetScope(void *ctx, enum fstScopeType scopetype, const char *scopename, const char *scopecomp);
 | 
					void            fstWriterSetFileType(void *ctx, enum fstFileType filetype);
 | 
				
			||||||
void fstWriterSetSourceInstantiationStem(void *ctx, const char *path, unsigned int line, unsigned int use_realpath);
 | 
					void            fstWriterSetPackType(void *ctx, enum fstWriterPackType typ);
 | 
				
			||||||
void fstWriterSetSourceStem(void *ctx, const char *path, unsigned int line, unsigned int use_realpath);
 | 
					void            fstWriterSetParallelMode(void *ctx, int enable);
 | 
				
			||||||
void fstWriterSetTimescale(void *ctx, int ts);
 | 
					void            fstWriterSetRepackOnClose(void *ctx, int enable);       /* type = 0 (none), 1 (libz) */
 | 
				
			||||||
void fstWriterSetTimescaleFromString(void *ctx, const char *s);
 | 
					void            fstWriterSetScope(void *ctx, enum fstScopeType scopetype,
 | 
				
			||||||
void fstWriterSetTimezero(void *ctx, int64_t tim);
 | 
					                        const char *scopename, const char *scopecomp);
 | 
				
			||||||
void fstWriterSetUpscope(void *ctx);
 | 
					void            fstWriterSetSourceInstantiationStem(void *ctx, const char *path, unsigned int line, unsigned int use_realpath);
 | 
				
			||||||
void fstWriterSetValueList(void *ctx, const char *vl);
 | 
					void            fstWriterSetSourceStem(void *ctx, const char *path, unsigned int line, unsigned int use_realpath);
 | 
				
			||||||
void fstWriterSetVersion(void *ctx, const char *vers);
 | 
					void            fstWriterSetTimescale(void *ctx, int ts);
 | 
				
			||||||
 | 
					void            fstWriterSetTimescaleFromString(void *ctx, const char *s);
 | 
				
			||||||
 | 
					void            fstWriterSetTimezero(void *ctx, int64_t tim);
 | 
				
			||||||
 | 
					void            fstWriterSetUpscope(void *ctx);
 | 
				
			||||||
 | 
					void		fstWriterSetValueList(void *ctx, const char *vl);
 | 
				
			||||||
 | 
					void            fstWriterSetVersion(void *ctx, const char *vers);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * reader functions
 | 
					 * reader functions
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void fstReaderClose(void *ctx);
 | 
					void            fstReaderClose(void *ctx);
 | 
				
			||||||
void fstReaderClrFacProcessMask(void *ctx, fstHandle facidx);
 | 
					void            fstReaderClrFacProcessMask(void *ctx, fstHandle facidx);
 | 
				
			||||||
void fstReaderClrFacProcessMaskAll(void *ctx);
 | 
					void            fstReaderClrFacProcessMaskAll(void *ctx);
 | 
				
			||||||
uint64_t fstReaderGetAliasCount(void *ctx);
 | 
					uint64_t        fstReaderGetAliasCount(void *ctx);
 | 
				
			||||||
const char *fstReaderGetCurrentFlatScope(void *ctx);
 | 
					const char *    fstReaderGetCurrentFlatScope(void *ctx);
 | 
				
			||||||
void *fstReaderGetCurrentScopeUserInfo(void *ctx);
 | 
					void *          fstReaderGetCurrentScopeUserInfo(void *ctx);
 | 
				
			||||||
int fstReaderGetCurrentScopeLen(void *ctx);
 | 
					int             fstReaderGetCurrentScopeLen(void *ctx);
 | 
				
			||||||
const char *fstReaderGetDateString(void *ctx);
 | 
					const char *    fstReaderGetDateString(void *ctx);
 | 
				
			||||||
int fstReaderGetDoubleEndianMatchState(void *ctx);
 | 
					int             fstReaderGetDoubleEndianMatchState(void *ctx);
 | 
				
			||||||
uint64_t fstReaderGetDumpActivityChangeTime(void *ctx, uint32_t idx);
 | 
					uint64_t        fstReaderGetDumpActivityChangeTime(void *ctx, uint32_t idx);
 | 
				
			||||||
unsigned char fstReaderGetDumpActivityChangeValue(void *ctx, uint32_t idx);
 | 
					unsigned char   fstReaderGetDumpActivityChangeValue(void *ctx, uint32_t idx);
 | 
				
			||||||
uint64_t fstReaderGetEndTime(void *ctx);
 | 
					uint64_t        fstReaderGetEndTime(void *ctx);
 | 
				
			||||||
int fstReaderGetFacProcessMask(void *ctx, fstHandle facidx);
 | 
					int             fstReaderGetFacProcessMask(void *ctx, fstHandle facidx);
 | 
				
			||||||
int fstReaderGetFileType(void *ctx);
 | 
					int             fstReaderGetFileType(void *ctx);
 | 
				
			||||||
int fstReaderGetFseekFailed(void *ctx);
 | 
					int             fstReaderGetFseekFailed(void *ctx);
 | 
				
			||||||
fstHandle fstReaderGetMaxHandle(void *ctx);
 | 
					fstHandle       fstReaderGetMaxHandle(void *ctx);
 | 
				
			||||||
uint64_t fstReaderGetMemoryUsedByWriter(void *ctx);
 | 
					uint64_t        fstReaderGetMemoryUsedByWriter(void *ctx);
 | 
				
			||||||
uint32_t fstReaderGetNumberDumpActivityChanges(void *ctx);
 | 
					uint32_t        fstReaderGetNumberDumpActivityChanges(void *ctx);
 | 
				
			||||||
uint64_t fstReaderGetScopeCount(void *ctx);
 | 
					uint64_t        fstReaderGetScopeCount(void *ctx);
 | 
				
			||||||
uint64_t fstReaderGetStartTime(void *ctx);
 | 
					uint64_t        fstReaderGetStartTime(void *ctx);
 | 
				
			||||||
signed char fstReaderGetTimescale(void *ctx);
 | 
					signed char     fstReaderGetTimescale(void *ctx);
 | 
				
			||||||
int64_t fstReaderGetTimezero(void *ctx);
 | 
					int64_t         fstReaderGetTimezero(void *ctx);
 | 
				
			||||||
uint64_t fstReaderGetValueChangeSectionCount(void *ctx);
 | 
					uint64_t        fstReaderGetValueChangeSectionCount(void *ctx);
 | 
				
			||||||
char *fstReaderGetValueFromHandleAtTime(void *ctx, uint64_t tim, fstHandle facidx, char *buf);
 | 
					char *          fstReaderGetValueFromHandleAtTime(void *ctx, uint64_t tim, fstHandle facidx, char *buf);
 | 
				
			||||||
uint64_t fstReaderGetVarCount(void *ctx);
 | 
					uint64_t        fstReaderGetVarCount(void *ctx);
 | 
				
			||||||
const char *fstReaderGetVersionString(void *ctx);
 | 
					const char *    fstReaderGetVersionString(void *ctx);
 | 
				
			||||||
struct fstHier *fstReaderIterateHier(void *ctx);
 | 
					struct fstHier *fstReaderIterateHier(void *ctx);
 | 
				
			||||||
int fstReaderIterateHierRewind(void *ctx);
 | 
					int             fstReaderIterateHierRewind(void *ctx);
 | 
				
			||||||
int fstReaderIterBlocks(void *ctx,
 | 
					int             fstReaderIterBlocks(void *ctx,
 | 
				
			||||||
                        void (*value_change_callback)(void *user_callback_data_pointer, uint64_t time, fstHandle facidx,
 | 
					                        void (*value_change_callback)(void *user_callback_data_pointer, uint64_t time, fstHandle facidx, const unsigned char *value),
 | 
				
			||||||
                                                      const unsigned char *value),
 | 
					 | 
				
			||||||
                        void *user_callback_data_pointer, FILE *vcdhandle);
 | 
					                        void *user_callback_data_pointer, FILE *vcdhandle);
 | 
				
			||||||
int fstReaderIterBlocks2(void *ctx,
 | 
					int             fstReaderIterBlocks2(void *ctx,
 | 
				
			||||||
                         void (*value_change_callback)(void *user_callback_data_pointer, uint64_t time,
 | 
					                        void (*value_change_callback)(void *user_callback_data_pointer, uint64_t time, fstHandle facidx, const unsigned char *value),
 | 
				
			||||||
                                                       fstHandle facidx, const unsigned char *value),
 | 
					                        void (*value_change_callback_varlen)(void *user_callback_data_pointer, uint64_t time, fstHandle facidx, const unsigned char *value, uint32_t len),
 | 
				
			||||||
                         void (*value_change_callback_varlen)(void *user_callback_data_pointer, uint64_t time,
 | 
					                        void *user_callback_data_pointer, FILE *vcdhandle);
 | 
				
			||||||
                                                              fstHandle facidx, const unsigned char *value,
 | 
					void            fstReaderIterBlocksSetNativeDoublesOnCallback(void *ctx, int enable);
 | 
				
			||||||
                                                              uint32_t len),
 | 
					void *          fstReaderOpen(const char *nam);
 | 
				
			||||||
                         void *user_callback_data_pointer, FILE *vcdhandle);
 | 
					void *          fstReaderOpenForUtilitiesOnly(void);
 | 
				
			||||||
void fstReaderIterBlocksSetNativeDoublesOnCallback(void *ctx, int enable);
 | 
					const char *    fstReaderPopScope(void *ctx);
 | 
				
			||||||
void *fstReaderOpen(const char *nam);
 | 
					int             fstReaderProcessHier(void *ctx, FILE *vcdhandle);
 | 
				
			||||||
void *fstReaderOpenForUtilitiesOnly(void);
 | 
					const char *    fstReaderPushScope(void *ctx, const char *nam, void *user_info);
 | 
				
			||||||
const char *fstReaderPopScope(void *ctx);
 | 
					void            fstReaderResetScope(void *ctx);
 | 
				
			||||||
int fstReaderProcessHier(void *ctx, FILE *vcdhandle);
 | 
					void            fstReaderSetFacProcessMask(void *ctx, fstHandle facidx);
 | 
				
			||||||
const char *fstReaderPushScope(void *ctx, const char *nam, void *user_info);
 | 
					void            fstReaderSetFacProcessMaskAll(void *ctx);
 | 
				
			||||||
void fstReaderResetScope(void *ctx);
 | 
					void            fstReaderSetLimitTimeRange(void *ctx, uint64_t start_time, uint64_t end_time);
 | 
				
			||||||
void fstReaderSetFacProcessMask(void *ctx, fstHandle facidx);
 | 
					void            fstReaderSetUnlimitedTimeRange(void *ctx);
 | 
				
			||||||
void fstReaderSetFacProcessMaskAll(void *ctx);
 | 
					void            fstReaderSetVcdExtensions(void *ctx, int enable);
 | 
				
			||||||
void fstReaderSetLimitTimeRange(void *ctx, uint64_t start_time, uint64_t end_time);
 | 
					
 | 
				
			||||||
void fstReaderSetUnlimitedTimeRange(void *ctx);
 | 
					 | 
				
			||||||
void fstReaderSetVcdExtensions(void *ctx, int enable);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * utility functions
 | 
					 * utility functions
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len); /* used for mallocs for fstUtilityBinToEsc() */
 | 
					int             fstUtilityBinToEscConvertedLen(const unsigned char *s, int len); /* used for mallocs for fstUtilityBinToEsc() */
 | 
				
			||||||
int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len);
 | 
					int             fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len);
 | 
				
			||||||
int fstUtilityEscToBin(unsigned char *d, unsigned char *s, int len);
 | 
					int             fstUtilityEscToBin(unsigned char *d, unsigned char *s, int len);
 | 
				
			||||||
struct fstETab *fstUtilityExtractEnumTableFromString(const char *s);
 | 
					struct fstETab *fstUtilityExtractEnumTableFromString(const char *s);
 | 
				
			||||||
void fstUtilityFreeEnumTable(struct fstETab *etab); /* must use to free fstETab properly */
 | 
					void 		fstUtilityFreeEnumTable(struct fstETab *etab); /* must use to free fstETab properly */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3488
									
								
								libs/fst/lz4.cc
									
										
									
									
									
								
							
							
						
						
									
										3488
									
								
								libs/fst/lz4.cc
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1095
									
								
								libs/fst/lz4.h
									
										
									
									
									
								
							
							
						
						
									
										1095
									
								
								libs/fst/lz4.h
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue