uTox/ 0000700 0001750 0000144 00000000000 14003056553 010500 5 ustar rak users uTox/tools/ 0000700 0001750 0000144 00000000000 14003056216 011634 5 ustar rak users uTox/tools/update-changelog.sh 0000700 0001750 0000144 00000000363 14003056216 015404 0 ustar rak users #!/bin/sh
TOKEN=$(git config --get user.token)
if [ -z "$TOKEN" ]; then
echo "Please add your github token to user.token"
echo "Run git config --local user.token [token]"
exit 1
fi
github_changelog_generator -u uTox -t "$TOKEN"
uTox/tools/update-bootstrap.py 0000600 0001750 0000144 00000011620 14003056216 015505 0 ustar rak users #
# Update bootstrap nodes
#
# This script is used to generate src/tox_bootstrap.h by adding a list
# of bootstrap nodes from https://nodes.tox.chat/
#
# It should be executed on a regular basis (before a release) to make sure
# the list is up to date and contains active bootstrap nodes.
# This will make sure clients can connect to the network quickly and do not have to waste
# time trying to connect to nodes that do no longer exist.
#
# You can run the script like this:
#
# python3 tools/update-bootstrap.py > src/tox_bootstrap.h
#
# Status information will be printed to stderr.
#
import http.client
import json
from datetime import datetime
import re
import sys
# print for stderr
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# check whether arg is an IP or a hostname
def is_ip(ip):
# these are not exactly nice patterns but the are sufficient to distinguish IP from hostname
ipv4 = re.compile("^\\d+\\.\\d+\\.\\d+\\.\\d+$")
ipv6 = re.compile("^[0-9a-f:]+$")
return ipv4.match(ip) or ipv6.match(ip)
# select a tcp port from a given range, use 443 if available
def select_tcp_port(ports):
if ports.count(443) > 0:
return 443
else:
return ports[0]
# http://stackoverflow.com/questions/18854620/whats-the-best-way-to-split-a-string-into-fixed-length-chunks-and-work-with-the#18854817
def chunkstring(string, length):
return (string[0+i:length+i] for i in range(0, len(string), length))
# get latest node data
connection = http.client.HTTPSConnection('nodes.tox.chat')
connection.request('GET', '/json')
response = connection.getresponse()
nodeData = response.read().decode()
data = json.loads(nodeData)
# print some info
eprint("Last scan: " + datetime.fromtimestamp(data.get('last_scan')).isoformat(' '))
eprint("Last refresh: " + datetime.fromtimestamp(data.get('last_refresh')).isoformat(' '))
eprint("Nodes: " + len(data.get('nodes')).__str__())
# filter out offline nodes
# only keep nodes that are active on tcp and udp
# also filter nodes that specify a hostname instead of IP
# we do not want utox to make DNS queries
# some of those are on a DynDNS so it does not even make sense to do the query in this script
nodes = []
for n in data.get('nodes'):
if not n.get('status_udp') or not n.get('status_tcp'):
continue
if is_ip(n.get('ipv4')):
# eprint(n.get('ipv4'), " udp: " + n.get('port').__str__(), " tcp:", *n.get('tcp_ports'))
# eprint(" pkey:", n.get('public_key'))
nodes.append({
'ip': n.get('ipv4'),
'ipv6': 'false',
'udp': n.get('port'),
'tcp': select_tcp_port(n.get('tcp_ports')),
'version': n.get('version'),
'pubkey': n.get('public_key'),
'maintainer': n.get('maintainer'),
'location': n.get('location'),
})
if is_ip(n.get('ipv6')):
# eprint(n.get('ipv6'), " udp: " + n.get('port').__str__(), " tcp:", *n.get('tcp_ports'))
# eprint(" pkey:", n.get('public_key'))
nodes.append({
'ip': n.get('ipv6'),
'ipv6': 'true',
'udp': n.get('port'),
'tcp': select_tcp_port(n.get('tcp_ports')),
'version': n.get('version'),
'pubkey': n.get('public_key'),
'maintainer': n.get('maintainer'),
'location': n.get('location'),
})
eprint("filtered offline and hostname-only nodes: ", len(nodes), "candidate entries")
# sort by the following criteria:
# - 1. sort by version, prefer nodes that are up to date
# - 2. prefer low udp port, i.e. 443 gets listed higher
# - 3. prefer tcp with port 443 over tcp without it
eprint("sorting by criteria...")
nodes = sorted(nodes, key = lambda n: (n.get('version'), -n.get('udp'), 1 if n.get('tcp') == 443 else 0), reverse=True)
#f = open("tox_bootstrap.h.test", 'w')
f = sys.stdout
f.write("""#ifndef TOX_BOOTSTRAP_H
#define TOX_BOOTSTRAP_H
//
// IMPORTANT: This file is generated by the /tools/update-bootstrap.py script, do not edit manually.
//
struct bootstrap_node {
char *address;
bool ipv6;
uint16_t port_udp;
uint16_t port_tcp;
uint8_t key[32];
} bootstrap_nodes[] = {
""")
# use the first 32 nodes that match the criteria above
k = 0
for n in nodes:
if k >= 32:
break
eprint("adding ", n.get('ip'), " (", n.get('udp'), n.get('tcp'), ") by", n.get('maintainer') + ', ' + n.get('location'), "version: ", n.get('version'))
f.write(" /* by " + n.get('maintainer') + ', ' + n.get('location') + " */\n")
f.write(' { "' + n.get('ip') + '", ' + n.get('ipv6') + ', ' + n.get('udp').__str__() + ', ' + n.get('tcp').__str__() + ",\n")
f.write(" {")
i = 0
for p in chunkstring(n.get('pubkey'), 2):
i += 1
if i > 16:
f.write("\n ")
i = 0
f.write(" 0x" + p + ",")
f.write(" }\n },\n")
k += 1
f.write("""
};
#endif
""")
f.close()
eprint("added", k, "nodes.")
uTox/tools/timediff.py 0000600 0001750 0000144 00000000740 14003056216 014000 0 ustar rak users # Tool for GitHub CI logs to prepend time diffs between lines.
#
# Processes lines from stdin or from the files passed via argv.
#
from datetime import datetime
import fileinput
prevdate = datetime(1970, 1, 1)
for l in fileinput.input():
datestr = l.split(maxsplit=1)[0]
datestr = datestr[:-2] + datestr[-1:] # hack to limit µsec precision
date = datetime.strptime(datestr, "%Y-%m-%dT%H:%M:%S.%fZ")
print(f"{date - prevdate} | {l}", end='')
prevdate = date
uTox/tools/sign-release.sh 0000700 0001750 0000144 00000002167 14003056216 014557 0 ustar rak users #!/bin/sh
# set -e
TAG=$(git describe --abbrev=0 --tags)
USER=${USER:-$(git config --get user.name)}
VERSION=${TAG#v}
echo "Going to verify and sign releases."
echo ""
echo ""
git diff --exit-code >> /dev/null || (echo "Working Dir not clean, this script won't work." && false)
echo ""
echo "Getting $TAG.zip"
curl -LOs "https://github.com/uTox/uTox/archive/$TAG.zip"
unzip -q "$TAG.zip"
cp -r "uTox-$VERSION"/* .
rm -r "uTox-$VERSION"
echo "Checking $TAG.zip"
if git diff --exit-code >> /dev/null; then
echo "PASSED $TAG.zip"
gpg --armor --detach-sign "$TAG.zip"
mv "$TAG.zip.asc" "uTox-$TAG.$USER.zip.asc"
rm "$TAG.zip"
else
echo "FAILED $TAG.zip"
rm "$TAG.zip"
fi
echo ""
echo "Getting $TAG.tar.gz"
curl -LOs "https://github.com/uTox/uTox/archive/$TAG.tar.gz"
tar xf "$TAG.tar.gz"
cp -r "uTox-$VERSION"/* .
rm -r "uTox-$VERSION"
echo "Checking $TAG.tar.gz"
if git diff --exit-code >> /dev/null; then
echo "PASSED $TAG.tar.gz"
gpg --armor --detach-sign "$TAG.tar.gz"
mv "$TAG.tar.gz.asc" "uTox-$TAG.$USER.tar.gz.asc"
rm "$TAG.tar.gz"
else
echo "FAILED $TAG.tar.gz"
rm "$TAG.tar.gz"
fi
uTox/tools/relnotes_to_cstring.sed 0000700 0001750 0000144 00000001102 14003056216 016414 0 ustar rak users #!/bin/sed -f
# This is a helper script to convert release notes written in Markdown
# to C-strings for langs/*.h
# This is not supposed to be perfect.
# (@user)
s/(@\([^)]*\))/(Thanks, \1!)/
# (commit)
s/ ([ 0-9a-f]\+)//
# escape "
s/"/\\"/g
# ## (Features:) → " \1\n"
s/^## \(.*\)$/" \1\\n"/
# * (Fix …) → " \1\n"
s/^* \(.*\)$/" \1\\n"/
# (-…) → " \1\n"
s/^[[:space:]]\+\(-.*\)$/" \1\\n"/
# **(…)** → " \1\n" [important notes]
s/^\*\*\(.*\)\*\*$/" \1\\n"/
# c-string the rest
s/^\([^"].*\)$/"\1\\n"/
s/^$/"\\n"/
uTox/tools/hexdump_for_chatlogs.sh 0000700 0001750 0000144 00000001033 14003056216 016374 0 ustar rak users #!/usr/bin/zsh
#TODO use the author length + msglength from hexdump to gener
OFFSET=(14 150 15 22 110 24 17 47 98)
HEADER='1/8 "Vers : %u \n" " Time : " 1/8 "%12u \n" 1/8 " Author: %12u \n" 1/8 " MsgLen: %12u \n" 1/1 " Flags : %12u \n" 1/1 " MSGTYP: %12u \n" 1/6 " \n"'
I=1
START=0
NUM=40
for len in $OFFSET; do
hexdump -s $START -n $NUM -v -e $HEADER log2.txt
((START=START+40))
((START=START+len))
((I++))
done
hexdump -s $START -n $NUM -v -e $HEADER log2.txt
((START=START+40))
((START=START+len))
((I++))
uTox/tools/checksum.sh 0000700 0001750 0000144 00000001006 14003056216 013772 0 ustar rak users #!/bin/sh
TAG=$(git describe --abbrev=0 --tags)
curl -LOs "https://github.com/uTox/uTox/archive/$TAG.zip"
curl -LOs "https://github.com/uTox/uTox/archive/$TAG.tar.gz"
echo
echo "md5"
echo "-----------------------------------------"
md5sum "$TAG.zip"
md5sum "$TAG.tar.gz"
echo "-----------------------------------------"
echo
echo "sha256"
echo "-----------------------------------------"
sha256sum "$TAG.zip"
sha256sum "$TAG.tar.gz"
echo "-----------------------------------------"
rm "$TAG.zip"
rm "$TAG.tar.gz"
uTox/tools/build-android.sh 0000700 0001750 0000144 00000010547 14003056216 014717 0 ustar rak users #!/usr/bin/env bash
# read settings from a custom settings file.
[ -f settings.android ] && source settings.android
set -ex
# You may need to change these values, to what ever your system has available
DEV_VERSION="25.0.0"
SDK_VERSION="android-23"
NDK_VERSION="android-12"
# $TOXCLIORE_LIBS is the compilation of all the required dependencies you can
# scrape from build.tox.chat needed to cross compile uTox to Android, you
# might choose to store them elsewhere.
TOXCORE_LIBS=${TOXCORE_LIBS-./libs/android/lib}
LDFLAGS=${LDFLAGS--L$TOXCORE_LIBS/}
TOOLCHAIN=${TOOLCHAIN-./toolchain}
BUILD_DIR=${BUILD_DIR-./build_android}
# Standard dev kit locations on posix
ANDROID_NDK_HOME=${ANDROID_NDK_HOME-/opt/android-ndk}
ANDROID_SDK_HOME=${ANDROID_SDK_HOME-/opt/android-sdk}
KEYSTORE=${KEYSTORE-~/.android/utox.keystore}
SYSROOT=${SYSROOT-${ANDROID_NDK_HOME}/platforms/${NDK_VERSION}/arch-arm}
AAPT=${AAPT-${ANDROID_SDK_HOME}/build-tools/${DEV_VERSION}/aapt}
DX=${DX-${ANDROID_SDK_HOME}/build-tools/${DEV_VERSION}/dx}
ZIPALIGN=${ZIPALIGN-$ANDROID_SDK_HOME/build-tools/${DEV_VERSION}/zipalign}
mkdir -p ${BUILD_DIR}/{lib/armeabi,java}
mkdir -p ./.android/
if [ $1 == "--new" ]; then
rm ${BUILD_DIR}/lib/armeabi/libuTox.so || true
fi
if [ $1 == "--auto-CI" ]; then
curl -O https://utox.io/android.tar.gz
tar xf android.tar.gz
fi
[ -d ${TOOLCHAIN} ] || "$ANDROID_NDK_HOME/build/tools/make-standalone-toolchain.sh" \
--toolchain="arm-linux-androideabi-clang" \
--install-dir=${TOOLCHAIN}/ \
--platform=${NDK_VERSION}
TOX_LIBS=${TOX_LIBS-\
$TOXCORE_LIBS/libtoxcore.a \
$TOXCORE_LIBS/libtoxav.a \
$TOXCORE_LIBS/libtoxencryptsave.a }
MORE_LIBS=${MORE_LIBS-\
$TOXCORE_LIBS/libsodium.a \
$TOXCORE_LIBS/libopus.a \
$TOXCORE_LIBS/libvpx.a \
$TOXCORE_LIBS/libopenal.a \
$TOXCORE_LIBS/libfreetype.a }
PLATFORM_LIBS=${PLATFORM_LIBS--llog -landroid -lEGL -lGLESv2 -lOpenSLES -lm -lz -ldl}
if ! [ -f ${BUILD_DIR}/lib/armeabi/libuTox.so ]; then
${TOOLCHAIN}/bin/arm-linux-androideabi-clang -std=gnu11 \
-Wformat=0 \
-Wl,--unresolved-symbols=report-all \
-I ./toolchain/include \
-I ./libs/android/include/freetype2/ \
-I ./libs/android/include/ \
-I ./sys/ \
${CFLAGS} \
./src/*.c \
./src/ui/*.c \
./src/av/*.c \
./src/layout/*.c \
./src/android/*.c \
./toxcore/toxcore/*.c \
./toxcore/toxav/*.c \
./toxcore/toxencryptsave/*.c \
$ANDROID_NDK_HOME/sources/android/cpufeatures/cpu-features.c \
${LDFLAGS} \
${MORE_LIBS} \
-o ${BUILD_DIR}/lib/armeabi/libuTox.so \
--sysroot=$SYSROOT \
${PLATFORM_LIBS} \
-DPLATFORM_ANDROID=1 \
-shared -s
fi
$AAPT package -f \
-M ./src/android/AndroidManifest.xml \
-S ./src/android/res \
-I $ANDROID_SDK_HOME/platforms/${SDK_VERSION}/android.jar \
-F ${BUILD_DIR}/uTox.apk \
-J ${BUILD_DIR}/java
javac \
-d ${BUILD_DIR}/java \
-source 7 \
-target 7 \
${BUILD_DIR}/java/R.java
$DX --dex \
--output="${BUILD_DIR}/classes.dex" \
${BUILD_DIR}/java
# the class path is likely hacky, but I can't be arsed to find the real fix now
java \
-classpath $ANDROID_SDK_HOME/tools/lib/sdklib-25.3.0.jar \
com.android.sdklib.build.ApkBuilderMain \
${BUILD_DIR}/uTox.unsigned.apk \
-u -z ${BUILD_DIR}/uTox.apk \
-f ${BUILD_DIR}/classes.dex \
-nf ${BUILD_DIR}/lib
if [ "$1" == "--auto-CI" ]; then
keytool -genkeypair -v \
-dname "cn=uToxer, ou=uTox, o=Tox, c=US" \
-keystore ./tmp.keystore \
-keyalg RSA \
-keysize 2048 \
-validity 36500 \
-alias "utox-default" \
-keypass "the default password...really?" \
-storepass "the default password...really?"
jarsigner \
-sigalg SHA1withRSA \
-digestalg SHA1 \
-keystore ./tmp.keystore \
${BUILD_DIR}/uTox.unsigned.apk \
-keypass "the default password...really?" \
-storepass "the default password...really?" \
"utox-default"
else
jarsigner \
-sigalg SHA1withRSA \
-digestalg SHA1 \
-keystore ${KEYSTORE} \
${BUILD_DIR}/uTox.unsigned.apk \
utox-dev
fi
mv ${BUILD_DIR}/uTox.unsigned.apk ${BUILD_DIR}/uTox.signed.apk
$ZIPALIGN \
-f 4 \
${BUILD_DIR}/uTox.signed.apk \
./uTox.ready.apk
uTox/third_party/ 0000700 0001750 0000144 00000000000 14003056216 013025 5 ustar rak users uTox/third_party/stb/ 0000700 0001750 0000144 00000000000 14003056216 013615 5 ustar rak users uTox/third_party/stb/stb.h 0000600 0001750 0000144 00000000454 14003056216 014563 0 ustar rak users #ifndef STB_H
#define STB_H
#include "stb/stb_image.h"
#include "stb/stb_image_write.h"
// uTox uses internal stb functions.
extern unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes,
int x, int y, int n, int *out_len);
#endif
uTox/third_party/stb/stb.c 0000600 0001750 0000144 00000000204 14003056216 014547 0 ustar rak users #define STB_IMAGE_IMPLEMENTATION
#include "stb/stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb/stb_image_write.h"
uTox/third_party/stb/stb/ 0000700 0001750 0000144 00000000000 14003056224 014404 5 ustar rak users uTox/third_party/stb/stb/tools/ 0000700 0001750 0000144 00000000000 14003056224 015544 5 ustar rak users uTox/third_party/stb/stb/tools/unicode/ 0000700 0001750 0000144 00000000000 14003056224 017172 5 ustar rak users uTox/third_party/stb/stb/tools/unicode/unicode.dsp 0000600 0001750 0000144 00000007466 14003056224 021347 0 ustar rak users # Microsoft Developer Studio Project File - Name="unicode" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=unicode - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "unicode.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "unicode.mak" CFG="unicode - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "unicode - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "unicode - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "unicode - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "unicode - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "unicode - Win32 Release"
# Name "unicode - Win32 Debug"
# Begin Source File
SOURCE=..\unicode.c
# End Source File
# End Target
# End Project
uTox/third_party/stb/stb/tools/unicode.c 0000600 0001750 0000144 00000052503 14003056224 017345 0 ustar rak users #define STB_DEFINE
#include "../stb.h"
// create unicode mappings
//
// Two kinds of mappings:
// map to a number
// map to a bit
//
// For mapping to a number, we use the following strategy:
//
// User supplies:
// 1. a table of numbers (for now we use uint16, so full Unicode table is 4MB)
// 2. a "don't care" value
// 3. define a 'fallback' value (typically 0)
// 4. define a fast-path range (typically 0..255 or 0..1023) [@TODO: automate detecting this]
//
// Code:
// 1. Determine range of *end* of unicode codepoints (U+10FFFF and down) which
// all have the same value (or don't care). If large enough, emit this as a
// special case in the code.
// 2. Repeat above, limited to at most U+FFFF.
// 3. Cluster the data into intervals of 8,16,32,64,128,256 numeric values.
// 3a. If all the values in an interval are fallback/dont-care, no further processing
// 3b. Find the "trimmed range" outside which all the values are the fallback or don't care
// 3c. Find the "special trimmed range" outside which all the values are some constant or don't care
// 4. Pack the clusters into continuous memory, and find previous instances of
// the cluster. Repeat for trimmed & special-trimmed. In the first case, find
// previous instances of the cluster (allow don't-care to match in either
// direction), both aligned and mis-aligned; in the latter, starting where
// things start or mis-aligned. Build an index table specifiying the
// location of each cluster (and its length). Allow an extra indirection here;
// the full-sized index can index a smaller table which has the actual offset
// (and lengths).
// 5. Associate with each packed continuous memory above the amount of memory
// required to store the data w/ smallest datatype (of uint8, uint16, uint32).
// Discard the continuous memory. Recurse on each index table, but avoid the
// smaller packing.
//
// For mapping to a bit, we pack the results for 8 characters into a byte, and then apply
// the above strategy. Note that there may be more optimal approaches with e.g. packing
// 8 different bits into a single structure, though, which we should explore eventually.
// currently we limit *indices* to being 2^16, and we pack them as
// index + end_trim*2^16 + start_trim*2^24; specials have to go in a separate table
typedef uint32 uval;
#define UVAL_DONT_CARE_DEFAULT 0xffffffff
typedef struct
{
uval *input;
uint32 dont_care;
uint32 fallback;
int fastpath;
int length;
int depth;
int has_sign;
int splittable;
int replace_fallback_with_codepoint;
size_t input_size;
size_t inherited_storage;
} table;
typedef struct
{
int split_log2;
table result; // index into not-returned table
int storage;
} output;
typedef struct
{
table t;
char **output_name;
} info;
typedef struct
{
size_t path;
size_t size;
} result;
typedef struct
{
uint8 trim_end;
uint8 trim_start;
uint8 special;
uint8 aligned;
uint8 indirect;
uint16 overhead; // add some forced overhead for each mode to avoid getting complex encoding when it doesn't save much
} mode_info;
mode_info modes[] =
{
{ 0,0,0,0,0, 32, },
{ 0,0,0,0,1, 100, },
{ 0,0,0,1,0, 32, },
{ 0,0,0,1,1, 100, },
{ 0,0,1,0,1, 100, },
{ 0,0,1,1,0, 32, },
{ 0,0,1,1,1, 200, },
{ 1,0,0,0,0, 100, },
{ 1,0,0,0,1, 120, },
{ 1,1,0,0,0, 100, },
{ 1,1,0,0,1, 130, },
{ 1,0,1,0,0, 130, },
{ 1,0,1,0,1, 180, },
{ 1,1,1,0,0, 180, },
{ 1,1,1,0,1, 200, },
};
#define MODECOUNT (sizeof(modes)/sizeof(modes[0]))
#define CLUSTERSIZECOUNT 6 // 8,16, 32,64, 128,256
size_t size_for_max_number(uint32 number)
{
if (number == 0) return 0;
if (number < 256) return 1;
if (number < 256*256) return 2;
if (number < 256*256*256) return 3;
return 4;
}
size_t size_for_max_number_aligned(uint32 number)
{
size_t n = size_for_max_number(number);
return n == 3 ? 4 : n;
}
uval get_data(uval *data, int offset, uval *end)
{
if (data + offset >= end)
return 0;
else
return data[offset];
}
int safe_len(uval *data, int len, uval *end)
{
if (len > end - data)
return end - data;
return len;
}
uval tempdata[256];
int dirty=0;
size_t find_packed(uval **packed, uval *data, int len, int aligned, int fastpath, uval *end, int offset, int replace)
{
int packlen = stb_arr_len(*packed);
int i,p;
if (data+len > end || replace) {
int safelen = safe_len(data, len, end);
memset(tempdata, 0, dirty*sizeof(tempdata[0]));
memcpy(tempdata, data, safelen * sizeof(data[0]));
data = tempdata;
dirty = len;
}
if (replace) {
int i;
int safelen = safe_len(data, len, end);
for (i=0; i < safelen; ++i)
if (data[i] == 0)
data[i] = offset+i;
}
if (len <= 0)
return 0;
if (!fastpath) {
if (aligned) {
for (i=0; i < packlen; i += len)
if ((*packed)[i] == data[0] && 0==memcmp(&(*packed)[i], data, len * sizeof(uval)))
return i / len;
} else {
for (i=0; i < packlen-len+1; i += 1 )
if ((*packed)[i] == data[0] && 0==memcmp(&(*packed)[i], data, len * sizeof(uval)))
return i;
}
}
p = stb_arr_len(*packed);
for (i=0; i < len; ++i)
stb_arr_push(*packed, data[i]);
return p;
}
void output_table(char *name1, char *name2, uval *data, int length, int sign, char **names)
{
char temp[20];
uval maxv = 0;
int bytes, numlen, at_newline;
int linelen = 79; // @TODO: make table more readable by choosing a length that's a multiple?
int i,pos, do_split=0;
for (i=0; i < length; ++i)
if (sign)
maxv = stb_max(maxv, (uval)abs((int)data[i]));
else
maxv = stb_max(maxv, data[i]);
bytes = size_for_max_number_aligned(maxv);
sprintf(temp, "%d", maxv);
numlen=strlen(temp);
if (sign)
++numlen;
if (bytes == 0)
return;
printf("uint%d %s%s[%d] = {\n", bytes*8, name1, name2, length);
at_newline = 1;
for (i=0; i < length; ++i) {
if (pos + numlen + 2 > linelen) {
printf("\n");
at_newline = 1;
pos = 0;
}
if (at_newline) {
printf(" ");
pos = 2;
at_newline = 0;
} else {
printf(" ");
++pos;
}
printf("%*d,", numlen, data[i]);
pos += numlen+1;
}
if (!at_newline) printf("\n");
printf("};\n");
}
void output_table_with_trims(char *name1, char *name2, uval *data, int length)
{
uval maxt=0, maxp=0;
int i,d,s,e, count;
// split the table into two pieces
uval *trims = NULL;
if (length == 0)
return;
for (i=0; i < stb_arr_len(data); ++i) {
stb_arr_push(trims, data[i] >> 16);
data[i] &= 0xffff;
maxt = stb_max(maxt, trims[i]);
maxp = stb_max(maxp, data[i]);
}
d=s=e=1;
if (maxt >= 256) {
// need to output start & end values
if (maxp >= 256) {
// can pack into a single table
printf("struct { uint16 val; uint8 start, end; } %s%s[%d] = {\n", name1, name2, length);
} else {
output_table(name1, name2, data, length, 0, 0);
d=0;
printf("struct { uint8 start, end; } %s%s_trim[%d] = {\n", name1, name2, length);
}
} else if (maxt > 0) {
if (maxp >= 256) {
output_table(name1, name2, data, length, 0, 0);
output_table(name1, stb_sprintf("%s_end", name2), trims, length, 0, 0);
return;
} else {
printf("struct { uint8 val, end; } %s%s[%d] = {\n", name1, name2, length);
s=0;
}
} else {
output_table(name1, name2, data, length, 0, 0);
return;
}
// d or s can be zero (but not both), e is always present and last
count = d + s + e;
assert(count >= 2 && count <= 3);
{
char temp[60];
uval maxv = 0;
int numlen, at_newline, len;
int linelen = 79; // @TODO: make table more readable by choosing a length that's a multiple?
int i,pos, do_split=0;
numlen = 0;
for (i=0; i < length; ++i) {
if (count == 2)
sprintf(temp, "{%d,%d}", d ? data[i] : (trims[i]>>8), trims[i]&255);
else
sprintf(temp, "{%d,%d,%d}", data[i], trims[i]>>8, trims[i]&255);
len = strlen(temp);
numlen = stb_max(len, numlen);
}
at_newline = 1;
for (i=0; i < length; ++i) {
if (pos + numlen + 2 > linelen) {
printf("\n");
at_newline = 1;
pos = 0;
}
if (at_newline) {
printf(" ");
pos = 2;
at_newline = 0;
} else {
printf(" ");
++pos;
}
if (count == 2)
sprintf(temp, "{%d,%d}", d ? data[i] : (trims[i]>>8), trims[i]&255);
else
sprintf(temp, "{%d,%d,%d}", data[i], trims[i]>>8, trims[i]&255);
printf("%*s,", numlen, temp);
pos += numlen+1;
}
if (!at_newline) printf("\n");
printf("};\n");
}
}
int weight=1;
table pack_for_mode(table *t, int mode, char *table_name)
{
size_t extra_size;
int i;
uval maxv;
mode_info mi = modes[mode % MODECOUNT];
int size = 8 << (mode / MODECOUNT);
table newtab;
uval *packed = NULL;
uval *index = NULL;
uval *indirect = NULL;
uval *specials = NULL;
newtab.dont_care = UVAL_DONT_CARE_DEFAULT;
if (table_name)
printf("// clusters of %d\n", size);
for (i=0; i < t->length; i += size) {
uval newval;
int fastpath = (i < t->fastpath);
if (mi.special) {
int end_trim = size-1;
int start_trim = 0;
uval special;
// @TODO: pick special from start or end instead of only end depending on which is longer
for(;;) {
special = t->input[i + end_trim];
if (special != t->dont_care || end_trim == 0)
break;
--end_trim;
}
// at this point, special==inp[end_trim], and end_trim >= 0
if (special == t->dont_care && !fastpath) {
// entire block is don't care, so OUTPUT don't care
stb_arr_push(index, newtab.dont_care);
continue;
} else {
uval pos, trim;
if (mi.trim_end && !fastpath) {
while (end_trim >= 0) {
if (t->input[i + end_trim] == special || t->input[i + end_trim] == t->dont_care)
--end_trim;
else
break;
}
}
if (mi.trim_start && !fastpath) {
while (start_trim < end_trim) {
if (t->input[i + start_trim] == special || t->input[i + start_trim] == t->dont_care)
++start_trim;
else
break;
}
}
// end_trim points to the last character we have to output
// find the first match, or add it
pos = find_packed(&packed, &t->input[i+start_trim], end_trim-start_trim+1, mi.aligned, fastpath, &t->input[t->length], i+start_trim, t->replace_fallback_with_codepoint);
// encode as a uval
if (!mi.trim_end) {
if (end_trim == 0)
pos = special;
else
pos = pos | 0x80000000;
} else {
assert(end_trim < size && end_trim >= -1);
if (!fastpath) assert(end_trim < size-1); // special always matches last one
assert(end_trim < size && end_trim+1 >= 0);
if (!fastpath) assert(end_trim+1 < size);
if (mi.trim_start)
trim = start_trim*256 + (end_trim+1);
else
trim = end_trim+1;
assert(pos < 65536); // @TODO: if this triggers, just bail on this search path
pos = pos + (trim << 16);
}
newval = pos;
stb_arr_push(specials, special);
}
} else if (mi.trim_end) {
int end_trim = size-1;
int start_trim = 0;
uval pos, trim;
while (end_trim >= 0 && !fastpath)
if (t->input[i + end_trim] == t->fallback || t->input[i + end_trim] == t->dont_care)
--end_trim;
else
break;
if (mi.trim_start && !fastpath) {
while (start_trim < end_trim) {
if (t->input[i + start_trim] == t->fallback || t->input[i + start_trim] == t->dont_care)
++start_trim;
else
break;
}
}
// end_trim points to the last character we have to output, and can be -1
++end_trim; // make exclusive at end
if (end_trim == 0 && size == 256)
start_trim = end_trim = 1; // we can't make encode a length from 0..256 in 8 bits, so restrict end_trim to 1..256
// find the first match, or add it
pos = find_packed(&packed, &t->input[i+start_trim], end_trim - start_trim, mi.aligned, fastpath, &t->input[t->length], i+start_trim, t->replace_fallback_with_codepoint);
assert(end_trim <= size && end_trim >= 0);
if (size == 256)
assert(end_trim-1 < 256 && end_trim-1 >= 0);
else
assert(end_trim < 256 && end_trim >= 0);
if (size == 256)
--end_trim;
if (mi.trim_start)
trim = start_trim*256 + end_trim;
else
trim = end_trim;
assert(pos < 65536); // @TODO: if this triggers, just bail on this search path
pos = pos + (trim << 16);
newval = pos;
} else {
newval = find_packed(&packed, &t->input[i], size, mi.aligned, fastpath, &t->input[t->length], i, t->replace_fallback_with_codepoint);
}
if (mi.indirect) {
int j;
for (j=0; j < stb_arr_len(indirect); ++j)
if (indirect[j] == newval)
break;
if (j == stb_arr_len(indirect))
stb_arr_push(indirect, newval);
stb_arr_push(index, j);
} else {
stb_arr_push(index, newval);
}
}
// total up the new size for everything but the index table
extra_size = mi.overhead * weight; // not the actual overhead cost; a penalty to avoid excessive complexity
extra_size += 150; // per indirection
if (table_name)
extra_size = 0;
if (t->has_sign) {
// 'packed' contains two values, which should be packed positive & negative for size
uval maxv2;
for (i=0; i < stb_arr_len(packed); ++i)
if (packed[i] & 0x80000000)
maxv2 = stb_max(maxv2, packed[i]);
else
maxv = stb_max(maxv, packed[i]);
maxv = stb_max(maxv, maxv2) << 1;
} else {
maxv = 0;
for (i=0; i < stb_arr_len(packed); ++i)
if (packed[i] > maxv && packed[i] != t->dont_care)
maxv = packed[i];
}
extra_size += stb_arr_len(packed) * (t->splittable ? size_for_max_number(maxv) : size_for_max_number_aligned(maxv));
if (table_name) {
if (t->splittable)
output_table_with_trims(table_name, "", packed, stb_arr_len(packed));
else
output_table(table_name, "", packed, stb_arr_len(packed), t->has_sign, NULL);
}
maxv = 0;
for (i=0; i < stb_arr_len(specials); ++i)
if (specials[i] > maxv)
maxv = specials[i];
extra_size += stb_arr_len(specials) * size_for_max_number_aligned(maxv);
if (table_name)
output_table(table_name, "_default", specials, stb_arr_len(specials), 0, NULL);
maxv = 0;
for (i=0; i < stb_arr_len(indirect); ++i)
if (indirect[i] > maxv)
maxv = indirect[i];
extra_size += stb_arr_len(indirect) * size_for_max_number(maxv);
if (table_name && stb_arr_len(indirect)) {
if (mi.trim_end)
output_table_with_trims(table_name, "_index", indirect, stb_arr_len(indirect));
else {
assert(0); // this case should only trigger in very extreme circumstances
output_table(table_name, "_index", indirect, stb_arr_len(indirect), 0, NULL);
}
mi.trim_end = mi.special = 0;
}
if (table_name)
printf("// above tables should be %d bytes\n", extra_size);
maxv = 0;
for (i=0; i < stb_arr_len(index); ++i)
if (index[i] > maxv && index[i] != t->dont_care)
maxv = index[i];
newtab.splittable = mi.trim_end;
newtab.input_size = newtab.splittable ? size_for_max_number(maxv) : size_for_max_number_aligned(maxv);
newtab.input = index;
newtab.length = stb_arr_len(index);
newtab.inherited_storage = t->inherited_storage + extra_size;
newtab.fastpath = 0;
newtab.depth = t->depth+1;
stb_arr_free(indirect);
stb_arr_free(packed);
stb_arr_free(specials);
return newtab;
}
result pack_table(table *t, size_t path, int min_storage)
{
int i;
result best;
best.size = t->inherited_storage + t->input_size * t->length;
best.path = path;
if ((int) t->inherited_storage > min_storage) {
best.size = stb_max(best.size, t->inherited_storage);
return best;
}
if (t->length <= 256 || t->depth >= 4) {
//printf("%08x: %7d\n", best.path, best.size);
return best;
}
path <<= 7;
for (i=0; i < MODECOUNT * CLUSTERSIZECOUNT; ++i) {
table newtab;
result r;
newtab = pack_for_mode(t, i, 0);
r = pack_table(&newtab, path+i+1, min_storage);
if (r.size < best.size)
best = r;
stb_arr_free(newtab.input);
//printf("Size: %6d + %6d\n", newtab.inherited_storage, newtab.input_size * newtab.length);
}
return best;
}
int pack_table_by_modes(table *t, int *modes)
{
table s = *t;
while (*modes > -1) {
table newtab;
newtab = pack_for_mode(&s, *modes, 0);
if (s.input != t->input)
stb_arr_free(s.input);
s = newtab;
++modes;
}
return s.inherited_storage + s.input_size * s.length;
}
int strip_table(table *t, int exceptions)
{
uval terminal_value;
int p = t->length-1;
while (t->input[p] == t->dont_care)
--p;
terminal_value = t->input[p];
while (p >= 0x10000) {
if (t->input[p] != terminal_value && t->input[p] != t->dont_care) {
if (exceptions)
--exceptions;
else
break;
}
--p;
}
return p+1; // p is a character we must output
}
void optimize_table(table *t, char *table_name)
{
int modelist[3] = { 85, -1 };
int modes[8];
int num_modes = 0;
int decent_size;
result r;
size_t path;
table s;
// strip tail end of table
int orig_length = t->length;
int threshhold = 0xffff;
int p = strip_table(t, 2);
int len_saved = t->length - p;
if (len_saved >= threshhold) {
t->length = p;
while (p > 0x10000) {
p = strip_table(t, 0);
len_saved = t->length - p;
if (len_saved < 0x10000)
break;
len_saved = orig_length - p;
if (len_saved < threshhold)
break;
threshhold *= 2;
}
}
t->depth = 1;
// find size of table if we use path 86
decent_size = pack_table_by_modes(t, modelist);
#if 1
// find best packing of remainder of table by exploring tree of packings
r = pack_table(t, 0, decent_size);
// use the computed 'path' to evaluate and output tree
path = r.path;
#else
path = 86;//90;//132097;
#endif
while (path) {
modes[num_modes++] = (path & 127) - 1;
path >>= 7;
}
printf("// modes: %d\n", r.path);
s = *t;
while (num_modes > 0) {
char name[256];
sprintf(name, "%s_%d", table_name, num_modes+1);
--num_modes;
s = pack_for_mode(&s, modes[num_modes], name);
}
// output the final table as-is
if (s.splittable)
output_table_with_trims(table_name, "_1", s.input, s.length);
else
output_table(table_name, "_1", s.input, s.length, 0, NULL);
}
uval unicode_table[0x110000];
typedef struct
{
uval lo,hi;
} char_range;
char_range get_range(char *str)
{
char_range cr;
char *p;
cr.lo = strtol(str, &p, 16);
p = stb_skipwhite(p);
if (*p == '.')
cr.hi = strtol(p+2, NULL, 16);
else
cr.hi = cr.lo;
return cr;
}
char *skip_semi(char *s, int count)
{
while (count) {
s = strchr(s, ';');
assert(s != NULL);
++s;
--count;
}
return s;
}
int main(int argc, char **argv)
{
table t;
uval maxv=0;
int i,n=0;
char **s = stb_stringfile("../../data/UnicodeData.txt", &n);
assert(s);
for (i=0; i < n; ++i) {
if (s[i][0] == '#' || s[i][0] == '\n' || s[i][0] == 0)
;
else {
char_range cr = get_range(s[i]);
char *t = skip_semi(s[i], 13);
uval j, v;
if (*t == ';' || *t == '\n' || *t == 0)
v = 0;
else {
v = strtol(t, NULL, 16);
if (v < 65536) {
maxv = stb_max(v, maxv);
for (j=cr.lo; j <= cr.hi; ++j) {
unicode_table[j] = v;
//printf("%06x => %06x\n", j, v);
}
}
}
}
}
t.depth = 0;
t.dont_care = UVAL_DONT_CARE_DEFAULT;
t.fallback = 0;
t.fastpath = 256;
t.inherited_storage = 0;
t.has_sign = 0;
t.splittable = 0;
t.input = unicode_table;
t.input_size = size_for_max_number(maxv);
t.length = 0x110000;
t.replace_fallback_with_codepoint = 1;
optimize_table(&t, "stbu_upppercase");
return 0;
}
uTox/third_party/stb/stb/tools/mr.bat 0000600 0001750 0000144 00000000022 14003056224 016646 0 ustar rak users debug\make_readme
uTox/third_party/stb/stb/tools/make_readme.dsp 0000600 0001750 0000144 00000007767 14003056224 020531 0 ustar rak users # Microsoft Developer Studio Project File - Name="make_readme" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=make_readme - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "make_readme.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "make_readme.mak" CFG="make_readme - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "make_readme - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "make_readme - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "make_readme - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "make_readme - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug\make_readme"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "make_readme - Win32 Release"
# Name "make_readme - Win32 Debug"
# Begin Source File
SOURCE=.\make_readme.c
# End Source File
# Begin Source File
SOURCE=.\README.header.md
# End Source File
# Begin Source File
SOURCE=.\README.list
# End Source File
# End Target
# End Project
uTox/third_party/stb/stb/tools/make_readme.c 0000600 0001750 0000144 00000004717 14003056224 020155 0 ustar rak users #define STB_DEFINE
#include "../stb.h"
int main(int argc, char **argv)
{
int i;
int hlen, flen, listlen, total_lines = 0;
char *header = stb_file("README.header.md", &hlen); // stb_file - read file into malloc()ed buffer
char *footer = stb_file("README.footer.md", &flen); // stb_file - read file into malloc()ed buffer
char **list = stb_stringfile("README.list", &listlen); // stb_stringfile - read file lines into malloced array of strings
FILE *f = fopen("../README.md", "wb");
fprintf(f, "\n\n");
fwrite(header, 1, hlen, f);
for (i=0; i < listlen; ++i) {
int num,j;
char **tokens = stb_tokens_stripwhite(list[i], "|", &num); // stb_tokens -- tokenize string into malloced array of strings
int num_lines;
char **lines = stb_stringfile(stb_sprintf("../%s", tokens[0]), &num_lines);
char *s1, *s2,*s3;
s1 = strchr(lines[0], '-');
if (!s1) stb_fatal("Couldn't find '-' before version number in %s", tokens[0]); // stb_fatal -- print error message & exit
s2 = strchr(s1+2, '-');
if (!s2) stb_fatal("Couldn't find '-' after version number in %s", tokens[0]); // stb_fatal -- print error message & exit
*s2 = 0;
s1 += 1;
s1 = stb_trimwhite(s1); // stb_trimwhite -- advance pointer to after whitespace & delete trailing whitespace
if (*s1 == 'v') ++s1;
s3 = tokens[0];
stb_trimwhite(s3);
fprintf(f, "**[");
if (strlen(s3) < 21) {
fprintf(f, "%s", tokens[0]);
} else {
char buffer[256];
strncpy(buffer, s3, 18);
buffer[18] = 0;
strcat(buffer, "...");
fprintf(f, "%s", buffer);
}
fprintf(f, "](%s)**", tokens[0]);
fprintf(f, " | %s", s1);
s1 = stb_trimwhite(tokens[1]); // stb_trimwhite -- advance pointer to after whitespace & delete trailing whitespace
s2 = stb_dupreplace(s1, " ", " "); // stb_dupreplace -- search & replace string and malloc result
fprintf(f, " | %s", s2);
free(s2);
fprintf(f, " | %d", num_lines);
total_lines += num_lines;
for (j=2; j < num; ++j)
fprintf(f, " | %s", tokens[j]);
fprintf(f, "\n");
}
fprintf(f, "\n");
fprintf(f, "Total libraries: %d \n", listlen);
fprintf(f, "Total lines of C code: %d\n\n", total_lines);
fwrite(footer, 1, flen, f);
fclose(f);
return 0;
}
uTox/third_party/stb/stb/tools/easy_font_maker.c 0000600 0001750 0000144 00000012050 14003056224 021056 0 ustar rak users // This program was used to encode the data for stb_simple_font.h
#define STB_DEFINE
#include "stb.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
int w,h;
uint8 *data;
int last_x[2], last_y[2];
int num_seg[2], non_empty;
#if 0
typedef struct
{
unsigned short first_segment;
unsigned char advance;
} chardata;
typedef struct
{
unsigned char x:4;
unsigned char y:4;
unsigned char len:3;
unsigned char dir:1;
} segment;
segment *segments;
void add_seg(int x, int y, int len, int horizontal)
{
segment s;
s.x = x;
s.y = y;
s.len = len;
s.dir = horizontal;
assert(s.x == x);
assert(s.y == y);
assert(s.len == len);
stb_arr_push(segments, s);
}
#else
typedef struct
{
unsigned char first_segment:8;
unsigned char first_v_segment:8;
unsigned char advance:5;
unsigned char voff:1;
} chardata;
#define X_LIMIT 1
#define LEN_LIMIT 7
typedef struct
{
unsigned char dx:1;
unsigned char y:4;
unsigned char len:3;
} segment;
segment *segments;
segment *vsegments;
void add_seg(int x, int y, int len, int horizontal)
{
segment s;
while (x - last_x[horizontal] > X_LIMIT) {
add_seg(last_x[horizontal] + X_LIMIT, 0, 0, horizontal);
}
while (len > LEN_LIMIT) {
add_seg(x, y, LEN_LIMIT, horizontal);
len -= LEN_LIMIT;
x += LEN_LIMIT*horizontal;
y += LEN_LIMIT*!horizontal;
}
s.dx = x - last_x[horizontal];
s.y = y;
s.len = len;
non_empty += len != 0;
//assert(s.x == x);
assert(s.y == y);
assert(s.len == len);
++num_seg[horizontal];
if (horizontal)
stb_arr_push(segments, s);
else
stb_arr_push(vsegments, s);
last_x[horizontal] = x;
}
void print_segments(segment *s)
{
int i, hpos;
printf(" ");
hpos = 4;
for (i=0; i < stb_arr_len(s); ++i) {
// repack for portability
unsigned char seg = s[i].len + s[i].dx*8 + s[i].y*16;
hpos += printf("%d,", seg);
if (hpos > 72 && i+1 < stb_arr_len(s)) {
hpos = 4;
printf("\n ");
}
}
printf("\n");
}
#endif
chardata charinfo[128];
int parse_char(int x, chardata *c, int offset)
{
int start_x = x, end_x, top_y = 0, y;
c->first_segment = stb_arr_len(segments);
c->first_v_segment = stb_arr_len(vsegments) - offset;
assert(c->first_segment == stb_arr_len(segments));
assert(c->first_v_segment + offset == stb_arr_len(vsegments));
// find advance distance
end_x = x+1;
while (data[end_x*3] == 255)
++end_x;
c->advance = end_x - start_x + 1;
last_x[0] = last_x[1] = 0;
last_y[0] = last_y[1] = 0;
for (y=2; y < h; ++y) {
for (x=start_x; x < end_x; ++x) {
if (data[y*3*w+x*3+1] < 255) {
top_y = y;
break;
}
}
if (top_y)
break;
}
c->voff = top_y > 2;
if (top_y > 2)
top_y = 3;
for (x=start_x; x < end_x; ++x) {
int y;
for (y=2; y < h; ++y) {
if (data[y*3*w+x*3+1] < 255) {
if (data[y*3*w+x*3+0] == 255) { // red
int len=0;
while (y+len < h && data[(y+len)*3*w+x*3+0] == 255 && data[(y+len)*3*w+x*3+1] == 0) {
data[(y+len)*3*w+x*3+0] = 0;
++len;
}
add_seg(x-start_x,y-top_y,len,0);
}
if (data[y*3*w+x*3+2] == 255) { // blue
int len=0;
while (x+len < end_x && data[y*3*w+(x+len)*3+2] == 255 && data[y*3*w+(x+len)*3+1] == 0) {
data[y*3*w+(x+len)*3+2] = 0;
++len;
}
add_seg(x-start_x,y-top_y,len,1);
}
}
}
}
return end_x;
}
int main(int argc, char **argv)
{
int c, x=0;
data = stbi_load("easy_font_raw.png", &w, &h, 0, 3);
for (c=32; c < 127; ++c) {
x = parse_char(x, &charinfo[c], 0);
printf("%3d -- %3d %3d\n", c, charinfo[c].first_segment, charinfo[c].first_v_segment);
}
printf("===\n");
printf("%d %d %d\n", num_seg[0], num_seg[1], non_empty);
printf("%d\n", sizeof(segments[0]) * stb_arr_len(segments));
printf("%d\n", sizeof(segments[0]) * stb_arr_len(segments) + sizeof(segments[0]) * stb_arr_len(vsegments) + sizeof(charinfo[32])*95);
printf("struct {\n"
" unsigned char advance;\n"
" unsigned char h_seg;\n"
" unsigned char v_seg;\n"
"} stb_easy_font_charinfo[96] = {\n");
charinfo[c].first_segment = stb_arr_len(segments);
charinfo[c].first_v_segment = stb_arr_len(vsegments);
for (c=32; c < 128; ++c) {
if ((c & 3) == 0) printf(" ");
printf("{ %2d,%3d,%3d },",
charinfo[c].advance + 16*charinfo[c].voff,
charinfo[c].first_segment,
charinfo[c].first_v_segment);
if ((c & 3) == 3) printf("\n"); else printf(" ");
}
printf("};\n\n");
printf("unsigned char stb_easy_font_hseg[%d] = {\n", stb_arr_len(segments));
print_segments(segments);
printf("};\n\n");
printf("unsigned char stb_easy_font_vseg[%d] = {\n", stb_arr_len(vsegments));
print_segments(vsegments);
printf("};\n");
return 0;
}
uTox/third_party/stb/stb/tools/README.list 0000600 0001750 0000144 00000004017 14003056224 017402 0 ustar rak users stb_vorbis.c | audio | decode ogg vorbis files from file/memory to float/16-bit signed output
stb_image.h | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
stb_truetype.h | graphics | parse, decode, and rasterize characters from truetype fonts
stb_image_write.h | graphics | image writing to disk: PNG, TGA, BMP
stb_image_resize.h | graphics | resize images larger/smaller with good quality
stb_rect_pack.h | graphics | simple 2D rectangle packer with decent quality
stb_sprintf.h | utility | fast sprintf, snprintf for C/C++
stretchy_buffer.h | utility | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
stb_textedit.h | user interface | guts of a text editor for games etc implementing them from scratch
stb_voxel_render.h | 3D graphics | Minecraft-esque voxel rendering "engine" with many more features
stb_dxt.h | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor
stb_perlin.h | 3D graphics | revised Perlin noise (3D input, 1D output)
stb_easy_font.h | 3D graphics | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
stb_tilemap_editor.h | game dev | embeddable tilemap editor
stb_herringbone_wang_tile.h | game dev | herringbone Wang tile map generator
stb_c_lexer.h | parsing | simplify writing parsers for C-like languages
stb_divide.h | math | more useful 32-bit modulus e.g. "euclidean divide"
stb_connected_components.h | misc | incrementally compute reachability on grids
stb.h | misc | helper functions for C, mostly redundant in C++; basically author's personal stuff
stb_leakcheck.h | misc | quick-and-dirty malloc/free leak-checking
uTox/third_party/stb/stb/tools/README.header.md 0000600 0001750 0000144 00000000602 14003056224 020252 0 ustar rak users stb
===
single-file public domain (or MIT licensed) libraries for C/C++
Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
library | lastest version | category | LoC | description
--------------------- | ---- | -------- | --- | --------------------------------
uTox/third_party/stb/stb/tools/README.footer.md 0000600 0001750 0000144 00000011646 14003056224 020332 0 ustar rak users
FAQ
---
#### What's the license?
These libraries are in the public domain. You can do anything you
want with them. You have no legal obligation
to do anything else, although I appreciate attribution.
They are also licensed under the MIT open source license, if you have lawyers
who are unhappy with public domain. Every source file includes an explicit
dual-license for you to choose from.
#### Are there other single-file public-domain/open source libraries with minimal dependencies out there?
[Yes.](https://github.com/nothings/single_file_libs)
#### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?
No, because it's public domain you can freely relicense it to whatever license your new
library wants to be.
#### What's the deal with SSE support in GCC-based compilers?
stb_image will either use SSE2 (if you compile with -msse2) or
will not use any SIMD at all, rather than trying to detect the
processor at runtime and handle it correctly. As I understand it,
the approved path in GCC for runtime-detection require
you to use multiple source files, one for each CPU configuration.
Because stb_image is a header-file library that compiles in only
one source file, there's no approved way to build both an
SSE-enabled and a non-SSE-enabled variation.
While we've tried to work around it, we've had multiple issues over
the years due to specific versions of gcc breaking what we're doing,
so we've given up on it. See https://github.com/nothings/stb/issues/280
and https://github.com/nothings/stb/issues/410 for examples.
#### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?
Generally they're only better in that they're easier to integrate,
easier to use, and easier to release (single file; good API; no
attribution requirement). They may be less featureful, slower,
and/or use more memory. If you're already using an equivalent
library, there's probably no good reason to switch.
#### Can I link directly to the table of stb libraries?
You can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.
#### Why do you list "lines of code"? It's a terrible metric.
Just to give you some idea of the internal complexity of the library,
to help you manage your expectations, or to let you know what you're
getting into. While not all the libraries are written in the same
style, they're certainly similar styles, and so comparisons between
the libraries are probably still meaningful.
Note though that the lines do include both the implementation, the
part that corresponds to a header file, and the documentation.
#### Why single-file headers?
Windows doesn't have standard directories where libraries
live. That makes deploying libraries in Windows a lot more
painful than open source developers on Unix-derivates generally
realize. (It also makes library dependencies a lot worse in Windows.)
There's also a common problem in Windows where a library was built
against a different version of the runtime library, which causes
link conflicts and confusion. Shipping the libs as headers means
you normally just compile them straight into your project without
making libraries, thus sidestepping that problem.
Making them a single file makes it very easy to just
drop them into a project that needs them. (Of course you can
still put them in a proper shared library tree if you want.)
Why not two files, one a header and one an implementation?
The difference between 10 files and 9 files is not a big deal,
but the difference between 2 files and 1 file is a big deal.
You don't need to zip or tar the files up, you don't have to
remember to attach *two* files, etc.
#### Why "stb"? Is this something to do with Set-Top Boxes?
No, they are just the initials for my name, Sean T. Barrett.
This was not chosen out of egomania, but as a moderately sane
way of namespacing the filenames and source function names.
#### Will you add more image types to stb_image.h?
If people submit them, I generally add them, but the goal of stb_image
is less for applications like image viewer apps (which need to support
every type of image under the sun) and more for things like games which
can choose what images to use, so I may decline to add them if they're
too rare or if the size of implementation vs. apparent benefit is too low.
#### Do you have any advice on how to create my own single-file library?
Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
#### Why public domain?
I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.
Some of them are listed here:
https://github.com/nothings/stb/blob/master/docs/why_public_domain.md
#### Why C?
Primarily, because I use C, not C++. But it does also make it easier
for other people to use them from other languages.
#### Why not C99? stdint.h, declare-anywhere, etc.
I still use MSVC 6 (1998) as my IDE because it has better human factors
for me than later versions of MSVC.
uTox/third_party/stb/stb/tests/ 0000700 0001750 0000144 00000000000 14003056224 015546 5 ustar rak users uTox/third_party/stb/stb/tests/vorbseek/ 0000700 0001750 0000144 00000000000 14003056224 017366 5 ustar rak users uTox/third_party/stb/stb/tests/vorbseek/vorbseek.dsp 0000600 0001750 0000144 00000007767 14003056224 021741 0 ustar rak users # Microsoft Developer Studio Project File - Name="vorbseek" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=vorbseek - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "vorbseek.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "vorbseek.mak" CFG="vorbseek - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "vorbseek - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "vorbseek - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "vorbseek - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Zd /O2 /I "..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
!ELSEIF "$(CFG)" == "vorbseek - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "vorbseek - Win32 Release"
# Name "vorbseek - Win32 Debug"
# Begin Source File
SOURCE=..\..\stb_vorbis.c
# End Source File
# Begin Source File
SOURCE=.\vorbseek.c
# End Source File
# End Target
# End Project
uTox/third_party/stb/stb/tests/vorbseek/vorbseek.c 0000600 0001750 0000144 00000007455 14003056224 021367 0 ustar rak users #include
#include
#include
#include
#define STB_VORBIS_HEADER_ONLY
#include "stb_vorbis.c"
#define SAMPLES_TO_TEST 3000
int test_count [5] = { 5000, 3000, 2000, 50000, 50000 };
int test_spacing[5] = { 1, 111, 3337, 7779, 72717 };
int try_seeking(stb_vorbis *v, unsigned int pos, short *output, unsigned int num_samples)
{
int count;
short samples[SAMPLES_TO_TEST*2];
assert(pos <= num_samples);
if (!stb_vorbis_seek(v, pos)) {
fprintf(stderr, "Seek to %u returned error from stb_vorbis\n", pos);
return 0;
}
count = stb_vorbis_get_samples_short_interleaved(v, 2, samples, SAMPLES_TO_TEST*2);
if (count > (int) (num_samples - pos)) {
fprintf(stderr, "Seek to %u allowed decoding %d samples when only %d should have been valid.\n",
pos, count, (int) (num_samples - pos));
return 0;
}
if (count < SAMPLES_TO_TEST && count < (int) (num_samples - pos)) {
fprintf(stderr, "Seek to %u only decoded %d samples of %d attempted when at least %d should have been valid.\n",
pos, count, SAMPLES_TO_TEST, num_samples - pos);
return 0;
}
if (0 != memcmp(samples, output + pos*2, count*2)) {
int k;
for (k=0; k < SAMPLES_TO_TEST*2; ++k) {
if (samples[k] != output[k]) {
fprintf(stderr, "Seek to %u produced incorrect samples starting at sample %u (short #%d in buffer).\n",
pos, pos + (k/2), k);
break;
}
}
assert(k != SAMPLES_TO_TEST*2);
return 0;
}
return 1;
}
int main(int argc, char **argv)
{
int num_chan, samprate;
int i, j, test, phase;
short *output;
if (argc == 1) {
fprintf(stderr, "Usage: vorbseek {vorbisfile} [{vorbisfile]*]\n");
fprintf(stderr, "Tests various seek offsets to make sure they're sample exact.\n");
return 0;
}
#if 0
{
// check that outofmem occurs correctly
stb_vorbis_alloc va;
va.alloc_buffer = malloc(1024*1024);
for (i=0; i < 1024*1024; i += 10) {
int error=0;
stb_vorbis *v;
va.alloc_buffer_length_in_bytes = i;
v = stb_vorbis_open_filename(argv[1], &error, &va);
if (v != NULL)
break;
printf("Error %d at %d\n", error, i);
}
}
#endif
for (j=1; j < argc; ++j) {
unsigned int successes=0, attempts = 0;
unsigned int num_samples = stb_vorbis_decode_filename(argv[j], &num_chan, &samprate, &output);
break;
if (num_samples == 0xffffffff) {
fprintf(stderr, "Error: couldn't open file or not vorbis file: %s\n", argv[j]);
goto fail;
}
if (num_chan != 2) {
fprintf(stderr, "vorbseek testing only works with files with 2 channels, %s has %d\n", argv[j], num_chan);
goto fail;
}
for (test=0; test < 5; ++test) {
int error;
stb_vorbis *v = stb_vorbis_open_filename(argv[j], &error, NULL);
if (v == NULL) {
fprintf(stderr, "Couldn't re-open %s for test #%d\n", argv[j], test);
goto fail;
}
for (phase=0; phase < 3; ++phase) {
unsigned int base = phase == 0 ? 0 : phase == 1 ? num_samples - test_count[test]*test_spacing[test] : num_samples/3;
for (i=0; i < test_count[test]; ++i) {
unsigned int pos = base + i*test_spacing[test];
if (pos > num_samples) // this also catches underflows
continue;
successes += try_seeking(v, pos, output, num_samples);
attempts += 1;
}
}
stb_vorbis_close(v);
}
printf("%d of %d seeks failed in %s (%d samples)\n", attempts-successes, attempts, argv[j], num_samples);
free(output);
}
return 0;
fail:
return 1;
} uTox/third_party/stb/stb/tests/tilemap_editor_integration_example.c 0000600 0001750 0000144 00000014320 14003056224 025033 0 ustar rak users // This isn't compilable as-is, as it was extracted from a working
// integration-in-a-game and makes reference to symbols from that game.
#include
#include
#include "game.h"
#include "SDL.h"
#include "stb_tilemap_editor.h"
extern void editor_draw_tile(int x, int y, unsigned short tile, int mode, float *props);
extern void editor_draw_rect(int x0, int y0, int x1, int y1, unsigned char r, unsigned char g, unsigned char b);
static int is_platform(short *tiles);
static unsigned int prop_type(int n, short *tiles);
static char *prop_name(int n, short *tiles);
static float prop_range(int n, short *tiles, int is_max);
static int allow_link(short *src, short *dest);
#define STBTE_MAX_PROPERTIES 8
#define STBTE_PROP_TYPE(n, tiledata, p) prop_type(n,tiledata)
#define STBTE_PROP_NAME(n, tiledata, p) prop_name(n,tiledata)
#define STBTE_PROP_MIN(n, tiledata, p) prop_range(n,tiledata,0)
#define STBTE_PROP_MAX(n, tiledata, p) prop_range(n,tiledata,1)
#define STBTE_PROP_FLOAT_SCALE(n,td,p) (0.1)
#define STBTE_ALLOW_LINK(srctile, srcprop, desttile, destprop) \
allow_link(srctile, desttile)
#define STBTE_LINK_COLOR(srctile, srcprop, desttile, destprop) \
(is_platform(srctile) ? 0xff80ff : 0x808040)
#define STBTE_DRAW_RECT(x0,y0,x1,y1,c) \
editor_draw_rect(x0,y0,x1,y1,(c)>>16,((c)>>8)&255,(c)&255)
#define STBTE_DRAW_TILE(x,y,id,highlight,props) \
editor_draw_tile(x,y,id,highlight,props)
#define STB_TILEMAP_EDITOR_IMPLEMENTATION
#include "stb_tilemap_editor.h"
stbte_tilemap *edit_map;
void editor_key(enum stbte_action act)
{
stbte_action(edit_map, act);
}
void editor_process_sdl_event(SDL_Event *e)
{
switch (e->type) {
case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
case SDL_MOUSEWHEEL:
stbte_mouse_sdl(edit_map, e, 1.0f/editor_scale,1.0f/editor_scale,0,0);
break;
case SDL_KEYDOWN:
if (in_editor) {
switch (e->key.keysym.sym) {
case SDLK_RIGHT: editor_key(STBTE_scroll_right); break;
case SDLK_LEFT : editor_key(STBTE_scroll_left ); break;
case SDLK_UP : editor_key(STBTE_scroll_up ); break;
case SDLK_DOWN : editor_key(STBTE_scroll_down ); break;
}
switch (e->key.keysym.scancode) {
case SDL_SCANCODE_S: editor_key(STBTE_tool_select); break;
case SDL_SCANCODE_B: editor_key(STBTE_tool_brush ); break;
case SDL_SCANCODE_E: editor_key(STBTE_tool_erase ); break;
case SDL_SCANCODE_R: editor_key(STBTE_tool_rectangle ); break;
case SDL_SCANCODE_I: editor_key(STBTE_tool_eyedropper); break;
case SDL_SCANCODE_L: editor_key(STBTE_tool_link); break;
case SDL_SCANCODE_G: editor_key(STBTE_act_toggle_grid); break;
}
if ((e->key.keysym.mod & KMOD_CTRL) && !(e->key.keysym.mod & ~KMOD_CTRL)) {
switch (e->key.keysym.scancode) {
case SDL_SCANCODE_X: editor_key(STBTE_act_cut ); break;
case SDL_SCANCODE_C: editor_key(STBTE_act_copy ); break;
case SDL_SCANCODE_V: editor_key(STBTE_act_paste); break;
case SDL_SCANCODE_Z: editor_key(STBTE_act_undo ); break;
case SDL_SCANCODE_Y: editor_key(STBTE_act_redo ); break;
}
}
}
break;
}
}
void editor_init(void)
{
int i;
edit_map = stbte_create_map(20,14, 8, 16,16, 100);
stbte_set_background_tile(edit_map, T_empty);
for (i=0; i < T__num_types; ++i) {
if (i != T_reserved1 && i != T_entry && i != T_doorframe)
stbte_define_tile(edit_map, 0+i, 1, "Background");
}
stbte_define_tile(edit_map, 256+O_player , 8, "Char");
stbte_define_tile(edit_map, 256+O_robot , 8, "Char");
for (i=O_lockeddoor; i < O__num_types-2; ++i)
if (i == O_platform || i == O_vplatform)
stbte_define_tile(edit_map, 256+i, 4, "Object");
else
stbte_define_tile(edit_map, 256+i, 2, "Object");
//stbte_set_layername(edit_map, 0, "background");
//stbte_set_layername(edit_map, 1, "objects");
//stbte_set_layername(edit_map, 2, "platforms");
//stbte_set_layername(edit_map, 3, "characters");
}
static int is_platform(short *tiles)
{
// platforms are only on layer #2
return tiles[2] == 256 + O_platform || tiles[2] == 256 + O_vplatform;
}
static int is_object(short *tiles)
{
return (tiles[1] >= 256 || tiles[2] >= 256 || tiles[3] >= 256);
}
static unsigned int prop_type(int n, short *tiles)
{
if (is_platform(tiles)) {
static unsigned int platform_types[STBTE_MAX_PROPERTIES] = {
STBTE_PROP_bool, // phantom
STBTE_PROP_int, // x_adjust
STBTE_PROP_int, // y_adjust
STBTE_PROP_float, // width
STBTE_PROP_float, // lspeed
STBTE_PROP_float, // rspeed
STBTE_PROP_bool, // autoreturn
STBTE_PROP_bool, // one-shot
// remainder get 0, means 'no property in this slot'
};
return platform_types[n];
} else if (is_object(tiles)) {
if (n == 0)
return STBTE_PROP_bool;
}
return 0;
}
static char *prop_name(int n, short *tiles)
{
if (is_platform(tiles)) {
static char *platform_vars[STBTE_MAX_PROPERTIES] = {
"phantom",
"x_adjust",
"y_adjust",
"width",
"lspeed",
"rspeed",
"autoreturn",
"one-shot",
};
return platform_vars[n];
}
return "phantom";
}
static float prop_range(int n, short *tiles, int is_max)
{
if (is_platform(tiles)) {
static float ranges[8][2] = {
{ 0, 1 }, // phantom-flag, range is ignored
{ -15, 15 }, // x_adjust
{ -15, 15 }, // y_adjust
{ 0, 6 }, // width
{ 0, 10 }, // lspeed
{ 0, 10 }, // rspeed
{ 0, 1 }, // autoreturn, range is ignored
{ 0, 1 }, // one-shot, range is ignored
};
return ranges[n][is_max];
}
return 0;
}
static int allow_link(short *src, short *dest)
{
if (is_platform(src))
return dest[1] == 256+O_lever;
if (src[1] == 256+O_endpoint)
return is_platform(dest);
return 0;
}
uTox/third_party/stb/stb/tests/textedit_sample.c 0000600 0001750 0000144 00000006643 14003056224 021120 0 ustar rak users // I haven't actually tested this yet, this is just to make sure it compiles
#include
#include // memmove
#include // isspace
#define STB_TEXTEDIT_CHARTYPE char
#define STB_TEXTEDIT_STRING text_control
// get the base type
#include "stb_textedit.h"
// define our editor structure
typedef struct
{
char *string;
int stringlen;
STB_TexteditState state;
} text_control;
// define the functions we need
void layout_func(StbTexteditRow *row, STB_TEXTEDIT_STRING *str, int start_i)
{
int remaining_chars = str->stringlen - start_i;
row->num_chars = remaining_chars > 20 ? 20 : remaining_chars; // should do real word wrap here
row->x0 = 0;
row->x1 = 20; // need to account for actual size of characters
row->baseline_y_delta = 1.25;
row->ymin = -1;
row->ymax = 0;
}
int delete_chars(STB_TEXTEDIT_STRING *str, int pos, int num)
{
memmove(&str->string[pos], &str->string[pos+num], str->stringlen - (pos+num));
str->stringlen -= num;
return 1; // always succeeds
}
int insert_chars(STB_TEXTEDIT_STRING *str, int pos, STB_TEXTEDIT_CHARTYPE *newtext, int num)
{
str->string = realloc(str->string, str->stringlen + num);
memmove(&str->string[pos+num], &str->string[pos], str->stringlen - pos);
memcpy(&str->string[pos], newtext, num);
str->stringlen += num;
return 1; // always succeeds
}
// define all the #defines needed
#define KEYDOWN_BIT 0x80000000
#define STB_TEXTEDIT_STRINGLEN(tc) ((tc)->stringlen)
#define STB_TEXTEDIT_LAYOUTROW layout_func
#define STB_TEXTEDIT_GETWIDTH(tc,n,i) (1) // quick hack for monospaced
#define STB_TEXTEDIT_KEYTOTEXT(key) (((key) & KEYDOWN_BIT) ? 0 : (key))
#define STB_TEXTEDIT_GETCHAR(tc,i) ((tc)->string[i])
#define STB_TEXTEDIT_NEWLINE '\n'
#define STB_TEXTEDIT_IS_SPACE(ch) isspace(ch)
#define STB_TEXTEDIT_DELETECHARS delete_chars
#define STB_TEXTEDIT_INSERTCHARS insert_chars
#define STB_TEXTEDIT_K_SHIFT 0x40000000
#define STB_TEXTEDIT_K_CONTROL 0x20000000
#define STB_TEXTEDIT_K_LEFT (KEYDOWN_BIT | 1) // actually use VK_LEFT, SDLK_LEFT, etc
#define STB_TEXTEDIT_K_RIGHT (KEYDOWN_BIT | 2) // VK_RIGHT
#define STB_TEXTEDIT_K_UP (KEYDOWN_BIT | 3) // VK_UP
#define STB_TEXTEDIT_K_DOWN (KEYDOWN_BIT | 4) // VK_DOWN
#define STB_TEXTEDIT_K_LINESTART (KEYDOWN_BIT | 5) // VK_HOME
#define STB_TEXTEDIT_K_LINEEND (KEYDOWN_BIT | 6) // VK_END
#define STB_TEXTEDIT_K_TEXTSTART (STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_TEXTEND (STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_DELETE (KEYDOWN_BIT | 7) // VK_DELETE
#define STB_TEXTEDIT_K_BACKSPACE (KEYDOWN_BIT | 8) // VK_BACKSPACE
#define STB_TEXTEDIT_K_UNDO (KEYDOWN_BIT | STB_TEXTEDIT_K_CONTROL | 'z')
#define STB_TEXTEDIT_K_REDO (KEYDOWN_BIT | STB_TEXTEDIT_K_CONTROL | 'y')
#define STB_TEXTEDIT_K_INSERT (KEYDOWN_BIT | 9) // VK_INSERT
#define STB_TEXTEDIT_K_WORDLEFT (STB_TEXTEDIT_K_LEFT | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_WORDRIGHT (STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_PGUP (KEYDOWN_BIT | 10) // VK_PGUP -- not implemented
#define STB_TEXTEDIT_K_PGDOWN (KEYDOWN_BIT | 11) // VK_PGDOWN -- not implemented
#define STB_TEXTEDIT_IMPLEMENTATION
#include "stb_textedit.h"
uTox/third_party/stb/stb/tests/test_vorbis.c 0000600 0001750 0000144 00000001034 14003056224 020255 0 ustar rak users #define STB_IMAGE_STATIC
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_VORBIS_HEADER_ONLY
#include "stb_vorbis.c"
#include "stb.h"
extern void stb_vorbis_dumpmem(void);
#ifdef VORBIS_TEST
int main(int argc, char **argv)
{
size_t memlen;
unsigned char *mem = stb_fileu("c:/x/sketch008.ogg", &memlen);
int chan, samplerate;
short *output;
int samples = stb_vorbis_decode_memory(mem, memlen, &chan, &samplerate, &output);
stb_filewrite("c:/x/sketch008.raw", output, samples*4);
return 0;
}
#endif
uTox/third_party/stb/stb/tests/test_truetype.c 0000600 0001750 0000144 00000005672 14003056224 020646 0 ustar rak users #include "stb_rect_pack.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h"
#include "stb_image_write.h"
#ifdef TT_TEST
#include
char ttf_buffer[1<<25];
unsigned char output[512*100];
void debug(void)
{
stbtt_fontinfo font;
fread(ttf_buffer, 1, 1<<25, fopen("c:/x/lm/LiberationMono-Regular.ttf", "rb"));
stbtt_InitFont(&font, ttf_buffer, 0);
stbtt_MakeGlyphBitmap(&font, output, 6, 9, 512, 5.172414E-03f, 5.172414E-03f, 54);
}
#define BITMAP_W 256
#define BITMAP_H 512
unsigned char temp_bitmap[BITMAP_H][BITMAP_W];
stbtt_bakedchar cdata[256*2]; // ASCII 32..126 is 95 glyphs
stbtt_packedchar pdata[256*2];
int main(int argc, char **argv)
{
stbtt_fontinfo font;
unsigned char *bitmap;
int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 34807), s = (argc > 2 ? atoi(argv[2]) : 32);
//debug();
// @TODO: why is minglui.ttc failing?
fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/mingliu.ttc", "rb"));
//fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/x/DroidSansMono.ttf", "rb"));
{
static stbtt_pack_context pc;
static stbtt_packedchar cd[256];
static unsigned char atlas[1024*1024];
stbtt_PackBegin(&pc, atlas, 1024,1024,1024,1,NULL);
stbtt_PackFontRange(&pc, ttf_buffer, 0, 32.0, 0, 256, cd);
stbtt_PackEnd(&pc);
}
#if 0
stbtt_BakeFontBitmap(ttf_buffer,stbtt_GetFontOffsetForIndex(ttf_buffer,0), 40.0, temp_bitmap[0],BITMAP_W,BITMAP_H, 32,96, cdata); // no guarantee this fits!
stbi_write_png("fonttest1.png", BITMAP_W, BITMAP_H, 1, temp_bitmap, 0);
{
stbtt_pack_context pc;
stbtt_PackBegin(&pc, temp_bitmap[0], BITMAP_W, BITMAP_H, 0, 1, NULL);
stbtt_PackFontRange(&pc, ttf_buffer, 0, 20.0, 32, 95, pdata);
stbtt_PackFontRange(&pc, ttf_buffer, 0, 20.0, 0xa0, 0x100-0xa0, pdata);
stbtt_PackEnd(&pc);
stbi_write_png("fonttest2.png", BITMAP_W, BITMAP_H, 1, temp_bitmap, 0);
}
{
stbtt_pack_context pc;
stbtt_pack_range pr[2];
stbtt_PackBegin(&pc, temp_bitmap[0], BITMAP_W, BITMAP_H, 0, 1, NULL);
pr[0].chardata_for_range = pdata;
pr[0].first_unicode_char_in_range = 32;
pr[0].num_chars_in_range = 95;
pr[0].font_size = 20.0f;
pr[1].chardata_for_range = pdata+256;
pr[1].first_unicode_char_in_range = 0xa0;
pr[1].num_chars_in_range = 0x100 - 0xa0;
pr[1].font_size = 20.0f;
stbtt_PackSetOversampling(&pc, 2, 2);
stbtt_PackFontRanges(&pc, ttf_buffer, 0, pr, 2);
stbtt_PackEnd(&pc);
stbi_write_png("fonttest3.png", BITMAP_W, BITMAP_H, 1, temp_bitmap, 0);
}
return 0;
#endif
stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));
bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, (float)s), c, &w, &h, 0,0);
for (j=0; j < h; ++j) {
for (i=0; i < w; ++i)
putchar(" .:ioVM@"[bitmap[j*w+i]>>5]);
putchar('\n');
}
return 0;
}
#endif
uTox/third_party/stb/stb/tests/test_cpp_compilation.cpp 0000600 0001750 0000144 00000011636 14003056224 022502 0 ustar rak users #include "stb_sprintf.h"
#define STB_SPRINTF_IMPLEMENTATION
#include "stb_sprintf.h"
#define STB_TRUETYPE_IMPLEMENTATION
#define STB_PERLIN_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define STB_DXT_IMPLEMENATION
#define STB_C_LEXER_IMPLEMENTATIOn
#define STB_DIVIDE_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION
#define STB_RECT_PACK_IMPLEMENTATION
#define STB_VOXEL_RENDER_IMPLEMENTATION
#define STB_CONNECTED_COMPONENTS_IMPLEMENTATION
#define STBI_MALLOC my_malloc
#define STBI_FREE my_free
#define STBI_REALLOC my_realloc
void *my_malloc(size_t) { return 0; }
void *my_realloc(void *, size_t) { return 0; }
void my_free(void *) { }
#include "stb_image.h"
#include "stb_rect_pack.h"
#include "stb_truetype.h"
#include "stb_image_write.h"
#include "stb_perlin.h"
#include "stb_dxt.h"
#include "stb_c_lexer.h"
#include "stb_divide.h"
#include "stb_herringbone_wang_tile.h"
#define STBCC_GRID_COUNT_X_LOG2 10
#define STBCC_GRID_COUNT_Y_LOG2 10
#include "stb_connected_components.h"
#define STBVOX_CONFIG_MODE 1
#include "stb_voxel_render.h"
#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) do ; while(0)
#define STBTE_DRAW_TILE(x,y,id,highlight,data) do ; while(0)
#define STB_TILEMAP_EDITOR_IMPLEMENTATION
#include "stb_tilemap_editor.h"
#include "stb_easy_font.h"
#define STB_LEAKCHECK_IMPLEMENTATION
#include "stb_leakcheck.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb_image_resize.h"
#include "stretchy_buffer.h"
////////////////////////////////////////////////////////////
//
// text edit
#include
#include // memmove
#include // isspace
#define STB_TEXTEDIT_CHARTYPE char
#define STB_TEXTEDIT_STRING text_control
// get the base type
#include "stb_textedit.h"
// define our editor structure
typedef struct
{
char *string;
int stringlen;
STB_TexteditState state;
} text_control;
// define the functions we need
void layout_func(StbTexteditRow *row, STB_TEXTEDIT_STRING *str, int start_i)
{
int remaining_chars = str->stringlen - start_i;
row->num_chars = remaining_chars > 20 ? 20 : remaining_chars; // should do real word wrap here
row->x0 = 0;
row->x1 = 20; // need to account for actual size of characters
row->baseline_y_delta = 1.25;
row->ymin = -1;
row->ymax = 0;
}
int delete_chars(STB_TEXTEDIT_STRING *str, int pos, int num)
{
memmove(&str->string[pos], &str->string[pos+num], str->stringlen - (pos+num));
str->stringlen -= num;
return 1; // always succeeds
}
int insert_chars(STB_TEXTEDIT_STRING *str, int pos, STB_TEXTEDIT_CHARTYPE *newtext, int num)
{
str->string = (char *) realloc(str->string, str->stringlen + num);
memmove(&str->string[pos+num], &str->string[pos], str->stringlen - pos);
memcpy(&str->string[pos], newtext, num);
str->stringlen += num;
return 1; // always succeeds
}
// define all the #defines needed
#define KEYDOWN_BIT 0x80000000
#define STB_TEXTEDIT_STRINGLEN(tc) ((tc)->stringlen)
#define STB_TEXTEDIT_LAYOUTROW layout_func
#define STB_TEXTEDIT_GETWIDTH(tc,n,i) (1) // quick hack for monospaced
#define STB_TEXTEDIT_KEYTOTEXT(key) (((key) & KEYDOWN_BIT) ? 0 : (key))
#define STB_TEXTEDIT_GETCHAR(tc,i) ((tc)->string[i])
#define STB_TEXTEDIT_NEWLINE '\n'
#define STB_TEXTEDIT_IS_SPACE(ch) isspace(ch)
#define STB_TEXTEDIT_DELETECHARS delete_chars
#define STB_TEXTEDIT_INSERTCHARS insert_chars
#define STB_TEXTEDIT_K_SHIFT 0x40000000
#define STB_TEXTEDIT_K_CONTROL 0x20000000
#define STB_TEXTEDIT_K_LEFT (KEYDOWN_BIT | 1) // actually use VK_LEFT, SDLK_LEFT, etc
#define STB_TEXTEDIT_K_RIGHT (KEYDOWN_BIT | 2) // VK_RIGHT
#define STB_TEXTEDIT_K_UP (KEYDOWN_BIT | 3) // VK_UP
#define STB_TEXTEDIT_K_DOWN (KEYDOWN_BIT | 4) // VK_DOWN
#define STB_TEXTEDIT_K_LINESTART (KEYDOWN_BIT | 5) // VK_HOME
#define STB_TEXTEDIT_K_LINEEND (KEYDOWN_BIT | 6) // VK_END
#define STB_TEXTEDIT_K_TEXTSTART (STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_TEXTEND (STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_DELETE (KEYDOWN_BIT | 7) // VK_DELETE
#define STB_TEXTEDIT_K_BACKSPACE (KEYDOWN_BIT | 8) // VK_BACKSPACE
#define STB_TEXTEDIT_K_UNDO (KEYDOWN_BIT | STB_TEXTEDIT_K_CONTROL | 'z')
#define STB_TEXTEDIT_K_REDO (KEYDOWN_BIT | STB_TEXTEDIT_K_CONTROL | 'y')
#define STB_TEXTEDIT_K_INSERT (KEYDOWN_BIT | 9) // VK_INSERT
#define STB_TEXTEDIT_K_WORDLEFT (STB_TEXTEDIT_K_LEFT | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_WORDRIGHT (STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_CONTROL)
#define STB_TEXTEDIT_K_PGUP (KEYDOWN_BIT | 10) // VK_PGUP -- not implemented
#define STB_TEXTEDIT_K_PGDOWN (KEYDOWN_BIT | 11) // VK_PGDOWN -- not implemented
#define STB_TEXTEDIT_IMPLEMENTATION
#include "stb_textedit.h"
uTox/third_party/stb/stb/tests/test_c_compilation.c 0000600 0001750 0000144 00000002113 14003056224 021570 0 ustar rak users #include "stb_sprintf.h"
#define STB_SPRINTF_IMPLEMENTATION
#include "stb_sprintf.h"
#define STB_PERLIN_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define STB_DXT_IMPLEMENATION
#define STB_C_LEXER_IMPLEMENTATIOn
#define STB_DIVIDE_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_HERRINGBONE_WANG_TILE_IMEPLEMENTATIOn
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#define STB_RECT_PACK_IMPLEMENTATION
#define STB_VOXEL_RENDER_IMPLEMENTATION
#define STB_EASY_FONT_IMPLEMENTATION
#include "stb_easy_font.h"
#include "stb_herringbone_wang_tile.h"
#include "stb_image.h"
#include "stb_image_write.h"
#include "stb_perlin.h"
#include "stb_dxt.h"
#include "stb_c_lexer.h"
#include "stb_divide.h"
#include "stb_image_resize.h"
#include "stb_rect_pack.h"
#define STBVOX_CONFIG_MODE 1
#include "stb_voxel_render.h"
#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) 0
#define STBTE_DRAW_TILE(x,y,id,highlight,data) 0
#define STB_TILEMAP_EDITOR_IMPLEMENTATION
#include "stb_tilemap_editor.h"
int quicktest(void)
{
char buffer[999];
stbsp_sprintf(buffer, "test%%test");
return 0;
} uTox/third_party/stb/stb/tests/stretchy_buffer_test.c 0000600 0001750 0000144 00000000034 14003056224 022146 0 ustar rak users #include "stretchy_buffer.h" uTox/third_party/stb/stb/tests/stretch_test.dsp 0000600 0001750 0000144 00000007731 14003056224 021003 0 ustar rak users # Microsoft Developer Studio Project File - Name="stretch_test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=stretch_test - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "stretch_test.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "stretch_test.mak" CFG="stretch_test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "stretch_test - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "stretch_test - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "stretch_test - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\.." /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "TT_TEST" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "stretch_test - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "stretch_test___Win32_Debug"
# PROP BASE Intermediate_Dir "stretch_test___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug\stretch_test"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "stretch_test - Win32 Release"
# Name "stretch_test - Win32 Debug"
# Begin Source File
SOURCE=.\stretch_test.c
# End Source File
# End Target
# End Project
uTox/third_party/stb/stb/tests/stretch_test.c 0000600 0001750 0000144 00000001016 14003056224 020425 0 ustar rak users // check that stb_truetype compiles with no stb_rect_pack.h
#define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h"
#include "stretchy_buffer.h"
#include
int main(int arg, char **argv)
{
int i;
int *arr = NULL;
for (i=0; i < 1000000; ++i)
sb_push(arr, i);
assert(sb_count(arr) == 1000000);
for (i=0; i < 1000000; ++i)
assert(arr[i] == i);
sb_free(arr);
arr = NULL;
for (i=0; i < 1000; ++i)
sb_add(arr, 1000);
assert(sb_count(arr) == 1000000);
return 0;
} uTox/third_party/stb/stb/tests/stb_cpp.dsp 0000600 0001750 0000144 00000007777 14003056224 017734 0 ustar rak users # Microsoft Developer Studio Project File - Name="stb_cpp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=stb_cpp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "stb_cpp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "stb_cpp.mak" CFG="stb_cpp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "stb_cpp - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "stb_cpp - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "stb_cpp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "stb_cpp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug\stb_cpp"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /GX /Zd /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "stb_cpp - Win32 Release"
# Name "stb_cpp - Win32 Debug"
# Begin Source File
SOURCE=.\stb_cpp.cpp
# End Source File
# Begin Source File
SOURCE=..\stb_vorbis.c
# End Source File
# Begin Source File
SOURCE=.\test_cpp_compilation.cpp
# End Source File
# End Target
# End Project
uTox/third_party/stb/stb/tests/stb_cpp.cpp 0000600 0001750 0000144 00000004161 14003056224 017710 0 ustar rak users #define WIN32_MEAN_AND_LEAN
#define WIN32_LEAN_AND_MEAN
//#include
#include
#define STB_STUA
#define STB_DEFINE
#define STB_NPTR
#define STB_ONLY
#include "stb.h"
//#include "stb_file.h"
int count;
void c(int truth, char *error)
{
if (!truth) {
fprintf(stderr, "Test failed: %s\n", error);
++count;
}
}
char *expects(stb_matcher *m, char *s, int result, int len, char *str)
{
int res2,len2=0;
res2 = stb_lex(m, s, &len2);
c(result == res2 && len == len2, str);
return s + len;
}
void test_lex(void)
{
stb_matcher *m = stb_lex_matcher();
// tok_en5 .3 20.1 20. .20 .1
char *s = "tok_en5.3 20.1 20. .20.1";
stb_lex_item(m, "[a-zA-Z_][a-zA-Z0-9_]*", 1 );
stb_lex_item(m, "[0-9]*\\.?[0-9]*" , 2 );
stb_lex_item(m, "[\r\n\t ]+" , 3 );
stb_lex_item(m, "." , -99 );
s=expects(m,s,1,7, "stb_lex 1");
s=expects(m,s,2,2, "stb_lex 2");
s=expects(m,s,3,1, "stb_lex 3");
s=expects(m,s,2,4, "stb_lex 4");
s=expects(m,s,3,1, "stb_lex 5");
s=expects(m,s,2,3, "stb_lex 6");
s=expects(m,s,3,1, "stb_lex 7");
s=expects(m,s,2,3, "stb_lex 8");
s=expects(m,s,2,2, "stb_lex 9");
s=expects(m,s,0,0, "stb_lex 10");
stb_matcher_free(m);
}
int main(int argc, char **argv)
{
char *p;
p = "abcdefghijklmnopqrstuvwxyz";
c(stb_ischar('c', p), "stb_ischar 1");
c(stb_ischar('x', p), "stb_ischar 2");
c(!stb_ischar('#', p), "stb_ischar 3");
c(!stb_ischar('X', p), "stb_ischar 4");
p = "0123456789";
c(!stb_ischar('c', p), "stb_ischar 5");
c(!stb_ischar('x', p), "stb_ischar 6");
c(!stb_ischar('#', p), "stb_ischar 7");
c(!stb_ischar('X', p), "stb_ischar 8");
p = "#####";
c(!stb_ischar('c', p), "stb_ischar a");
c(!stb_ischar('x', p), "stb_ischar b");
c(stb_ischar('#', p), "stb_ischar c");
c(!stb_ischar('X', p), "stb_ischar d");
p = "xXyY";
c(!stb_ischar('c', p), "stb_ischar e");
c(stb_ischar('x', p), "stb_ischar f");
c(!stb_ischar('#', p), "stb_ischar g");
c(stb_ischar('X', p), "stb_ischar h");
test_lex();
if (count) {
_getch();
}
return 0;
}
uTox/third_party/stb/stb/tests/stb.dsw 0000600 0001750 0000144 00000005521 14003056224 017062 0 ustar rak users Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "c_lexer_test"=.\c_lexer_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "herringbone"=.\herringbone.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "herringbone_map"=.\herringbone_map.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "image_test"=.\image_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "make_readme"=..\tools\make_readme.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "pg_test"=.\pg_test\pg_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "resize"=.\resize.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "stb"=.\stb.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name stb_cpp
End Project Dependency
Begin Project Dependency
Project_Dep_Name image_test
End Project Dependency
Begin Project Dependency
Project_Dep_Name stretch_test
End Project Dependency
Begin Project Dependency
Project_Dep_Name c_lexer_test
End Project Dependency
}}}
###############################################################################
Project: "stb_cpp"=.\stb_cpp.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "stretch_test"=.\stretch_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "unicode"=..\tools\unicode\unicode.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "vorbseek"=.\vorbseek\vorbseek.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
uTox/third_party/stb/stb/tests/stb.dsp 0000600 0001750 0000144 00000013331 14003056224 017051 0 ustar rak users # Microsoft Developer Studio Project File - Name="stb" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=stb - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "stb.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "stb.mak" CFG="stb - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "stb - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "stb - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "stb - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /Z7 /O2 /Ob2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GRID_TEST" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
!ELSEIF "$(CFG)" == "stb - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug\stb"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "VORBIS_TEST" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /force
!ENDIF
# Begin Target
# Name "stb - Win32 Release"
# Name "stb - Win32 Debug"
# Begin Source File
SOURCE=.\grid_reachability.c
# End Source File
# Begin Source File
SOURCE=.\stb.c
# End Source File
# Begin Source File
SOURCE=..\stb.h
# End Source File
# Begin Source File
SOURCE=..\stb_c_lexer.h
# End Source File
# Begin Source File
SOURCE=..\stb_connected_components.h
# End Source File
# Begin Source File
SOURCE=..\stb_divide.h
# End Source File
# Begin Source File
SOURCE=..\stb_dxt.h
# End Source File
# Begin Source File
SOURCE=..\stb_easy_font.h
# End Source File
# Begin Source File
SOURCE=..\stb_herringbone_wang_tile.h
# End Source File
# Begin Source File
SOURCE=..\stb_image.h
# End Source File
# Begin Source File
SOURCE=..\stb_image_resize.h
# End Source File
# Begin Source File
SOURCE=..\stb_image_write.h
# End Source File
# Begin Source File
SOURCE=..\stb_leakcheck.h
# End Source File
# Begin Source File
SOURCE=..\stb_malloc.h
# End Source File
# Begin Source File
SOURCE=..\stb_perlin.h
# End Source File
# Begin Source File
SOURCE=..\stb_pg.h
# End Source File
# Begin Source File
SOURCE=..\stb_rect_pack.h
# End Source File
# Begin Source File
SOURCE=..\stb_sprintf.h
# End Source File
# Begin Source File
SOURCE=..\stb_textedit.h
# End Source File
# Begin Source File
SOURCE=..\stb_tilemap_editor.h
# End Source File
# Begin Source File
SOURCE=..\stb_truetype.h
# End Source File
# Begin Source File
SOURCE=..\stb_vorbis.c
# End Source File
# Begin Source File
SOURCE=..\stb_voxel_render.h
# End Source File
# Begin Source File
SOURCE=..\stretchy_buffer.h
# End Source File
# Begin Source File
SOURCE=.\stretchy_buffer_test.c
# End Source File
# Begin Source File
SOURCE=.\test_c_compilation.c
# End Source File
# Begin Source File
SOURCE=.\test_truetype.c
# End Source File
# Begin Source File
SOURCE=.\test_vorbis.c
# End Source File
# Begin Source File
SOURCE=.\textedit_sample.c
# End Source File
# End Target
# End Project
uTox/third_party/stb/stb/tests/stb.c 0000600 0001750 0000144 00000363330 14003056224 016514 0 ustar rak users /*
* Unit tests for "stb.h"
*/
//#include
#include
#include
#include
#include
#include
#ifdef _WIN32
#include
#endif
#define STB_STUA
//#define STB_FASTMALLOC
#ifdef _DEBUG
#define STB_MALLOC_WRAPPER_DEBUG
#endif
#define STB_NPTR
#define STB_DEFINE
#include "stb.h"
//#include "stb_file.h"
//#include "stb_pixel32.h"
//#define DEBUG_BLOCK
#ifdef DEBUG_BLOCK
#include
#endif
#ifdef STB_FASTMALLOC
#error "can't use FASTMALLOC with threads"
#endif
int count;
void c(int truth, char *error)
{
if (!truth) {
fprintf(stderr, "Test failed: %s\n", error);
++count;
}
}
#if 0
void show(void)
{
#ifdef _WIN32
SYSTEM_INFO x;
GetSystemInfo(&x);
printf("%d\n", x.dwPageSize);
#endif
}
#endif
void test_classes(void)
{
unsigned char size_base[32], size_shift[32];
int class_to_pages[256];
int class_to_size[256], cl;
int lg, size, wasted_pages;
int kAlignShift = 3;
int kAlignment = 1 << kAlignShift;
int kMaxSize = 8 * 4096;
int kPageShift = 12;
int kPageSize = (1 << kPageShift);
int next_class = 1;
int alignshift = kAlignShift;
int last_lg = -1;
for (lg = 0; lg < kAlignShift; lg++) {
size_base[lg] = 1;
size_shift[lg] = kAlignShift;
}
for (size = kAlignment; size <= kMaxSize; size += (1 << alignshift)) {
int lg = stb_log2_floor(size);
if (lg > last_lg) {
// Increase alignment every so often.
//
// Since we double the alignment every time size doubles and
// size >= 128, this means that space wasted due to alignment is
// at most 16/128 i.e., 12.5%. Plus we cap the alignment at 256
// bytes, so the space wasted as a percentage starts falling for
// sizes > 2K.
if ((lg >= 7) && (alignshift < 8)) {
alignshift++;
}
size_base[lg] = next_class - ((size-1) >> alignshift);
size_shift[lg] = alignshift;
}
class_to_size[next_class] = size;
last_lg = lg;
next_class++;
}
// Initialize the number of pages we should allocate to split into
// small objects for a given class.
wasted_pages = 0;
for (cl = 1; cl < next_class; cl++) {
// Allocate enough pages so leftover is less than 1/8 of total.
// This bounds wasted space to at most 12.5%.
size_t psize = kPageSize;
const size_t s = class_to_size[cl];
while ((psize % s) > (psize >> 3)) {
psize += kPageSize;
}
class_to_pages[cl] = psize >> kPageShift;
wasted_pages += psize;
}
printf("TCMalloc can waste as much as %d memory on one-shot allocations\n", wasted_pages);
return;
}
void test_script(void)
{
stua_run_script(
"var g = (2+3)*5 + 3*(2+1) + ((7)); \n"
"func sprint(x) _print(x) _print(' ') x end;\n"
"func foo(y) var q = func(x) sprint(x) end; q end;\n "
"var z=foo(5); z(77);\n"
"func counter(z) func(x) z=z+1 end end\n"
"var q=counter(0), p=counter(5);\n"
"sprint(q()) sprint(p()) sprint(q()) sprint(p()) sprint(q()) sprint(p())\n"
"var x=2222;\n"
"if 1 == 2 then 3333 else 4444 end; => x; sprint(x);\n"
"var x1 = sprint(1.5e3); \n"
"var x2 = sprint(.5); \n"
"var x3 = sprint(1.); \n"
"var x4 = sprint(1.e3); \n"
"var x5 = sprint(1e3); \n"
"var x6 = sprint(0.5e3); \n"
"var x7 = sprint(.5e3); \n"
" func sum(x,y) x+y end \n"
" func sumfunc(a) sum+{x=a} end \n"
" var q = sumfunc(3) \n"
" var p = sumfunc(20) \n"
" var d = sprint(q(5)) - sprint(q(8)) \n"
" var e = sprint(p(5)) - sprint(p(8)) \n"
" func test3(x) \n"
" sprint(x) \n"
" x = x+3 \n"
" sprint(x) \n"
" x+5 \n"
" end \n"
" var y = test3(4); \n"
" func fib(x) \n"
" if x < 3 then \n"
" 1 \n"
" else \n"
" fib(x-1) + fib(x-2); \n"
" end \n"
" end \n"
" \n"
" func fib2(x) \n"
" var a=1 \n"
" var b=1 \n"
" sprint(a) \n"
" sprint(b) \n"
" while x > 2 do \n"
" var c=a+b \n"
" a=b \n"
" b=c \n"
" sprint(b) \n"
" x=x-1 \n"
" end \n"
" b \n"
" end \n"
" \n"
" func assign(z) \n"
" var y = { 'this', 'is', 'a', 'lame', 'day', 'to', 'die'} \n"
" y[3] = z \n"
" var i = 0 \n"
" while y[i] != nil do \n"
" sprint(y[i]) \n"
" i = i+1 \n"
" end \n"
" end \n"
" \n"
" sprint(fib(12)); \n"
" assign(\"good\"); \n"
" fib2(20); \n"
" sprint('ok'); \n"
" sprint(-5); \n"
" // final comment with no newline"
);
}
#ifdef STB_THREADS
extern void __stdcall Sleep(unsigned long);
void * thread_1(void *x)
{
Sleep(80);
printf("thread 1\n"); fflush(stdout);
return (void *) 2;
}
void * thread_2(void *y)
{
stb_work(thread_1, NULL, y);
Sleep(50);
printf("thread 2\n"); fflush(stdout);
return (void *) 3;
}
stb_semaphore stest;
stb_mutex mutex;
volatile int tc1, tc2;
void *thread_3(void *p)
{
stb_mutex_begin(mutex);
++tc1;
stb_mutex_end(mutex);
stb_sem_waitfor(stest);
stb_mutex_begin(mutex);
++tc2;
stb_mutex_end(mutex);
return NULL;
}
void test_threads(void)
{
volatile int a=0,b=0;
//stb_work_numthreads(2);
stb_work(thread_2, (void *) &a, (void *) &b);
while (a==0 || b==0) {
Sleep(10);
//printf("a=%d b=%d\n", a, b);
}
c(a==2 && b == 3, "stb_thread");
stb_work_numthreads(4);
stest = stb_sem_new(8);
mutex = stb_mutex_new();
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
while (tc1 < 4)
Sleep(10);
c(tc1 == 4, "stb_work 1");
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
Sleep(40);
while (tc1 != 8 || tc2 != 8)
Sleep(10);
c(tc1 == 8 && tc2 == 8, "stb_work 2");
stb_work_numthreads(2);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
stb_work(thread_3, NULL, NULL);
while (tc1 < 10)
Sleep(10);
c(tc1 == 10, "stb_work 1");
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
stb_sem_release(stest);
Sleep(100);
stb_sem_delete(stest);
stb_mutex_delete(mutex);
}
#else
void test_threads(void)
{
}
#endif
void *thread4(void *p)
{
return NULL;
}
#ifdef STB_THREADS
stb_threadqueue *tq;
stb_sync synch;
stb_mutex msum;
volatile int thread_sum;
void *consume1(void *p)
{
volatile int *q = (volatile int *) p;
for(;;) {
int z;
stb_threadq_get_block(tq, &z);
stb_mutex_begin(msum);
thread_sum += z;
*q += z;
stb_mutex_end(msum);
stb_sync_reach(synch);
}
}
void test_threads2(void)
{
int array[256],i,n=0;
volatile int which[4];
synch = stb_sync_new();
stb_sync_set_target(synch,2);
stb_work_reach(thread4, NULL, NULL, synch);
stb_sync_reach_and_wait(synch);
printf("ok\n");
tq = stb_threadq_new(4, 1, TRUE,TRUE);
msum = stb_mutex_new();
thread_sum = 0;
stb_sync_set_target(synch, 65);
for (i=0; i < 4; ++i) {
which[i] = 0;
stb_create_thread(consume1, (int *) &which[i]);
}
for (i=1; i <= 64; ++i) {
array[i] = i;
n += i;
stb_threadq_add_block(tq, &array[i]);
}
stb_sync_reach_and_wait(synch);
stb_barrier();
c(thread_sum == n, "stb_threadq 1");
c(which[0] + which[1] + which[2] + which[3] == n, "stb_threadq 2");
printf("(Distribution: %d %d %d %d)\n", which[0], which[1], which[2], which[3]);
stb_sync_delete(synch);
stb_threadq_delete(tq);
stb_mutex_delete(msum);
}
#else
void test_threads2(void)
{
}
#endif
char tc[] = "testing compression test quick test voila woohoo what the hell";
char storage1[1 << 23];
int test_compression(char *buffer, int length)
{
char *storage2;
int c_len = stb_compress(storage1, buffer, length);
int dc_len;
printf("Compressed %d to %d\n", length, c_len);
dc_len = stb_decompress_length(storage1);
storage2 = malloc(dc_len);
dc_len = stb_decompress(storage2, storage1, c_len);
if (dc_len != length) { free(storage2); return -1; }
if (memcmp(buffer, storage2, length) != 0) { free(storage2); return -1; }
free(storage2);
return c_len;
}
#if 0
int test_en_compression(char *buffer, int length)
{
int c_len = stb_en_compress(storage1, buffer, length);
int dc_len;
printf("Encompressed %d to %d\n", length, c_len);
dc_len = stb_en_decompress(storage2, storage1, c_len);
if (dc_len != length) return -1;
if (memcmp(buffer, storage2, length) != 0) return -1;
return c_len;
}
#endif
#define STR_x "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#define STR_y "yyyyyyyyyyyyyyyyyy"
#define STR_xy STR_x STR_y
#define STR_xyyxy STR_xy STR_y STR_xy
#define STR_1 "testing"
#define STR_2 STR_xyyxy STR_xy STR_xyyxy STR_xyyxy STR_xy STR_xyyxy
#define STR_3 "buh"
char buffer[] = STR_1 "\r\n" STR_2 STR_2 STR_2 "\n" STR_3;
char str1[] = STR_1;
char str2[] = STR_2 STR_2 STR_2;
char str3[] = STR_3;
int sum(short *s)
{
int i,total=0;
for (i=0; i < stb_arr_len(s); ++i)
total += s[i];
return total;
}
stb_uint stb_adler32_old(stb_uint adler32, stb_uchar *buffer, stb_uint buflen)
{
const stb_uint ADLER_MOD = 65521;
stb_uint s1 = adler32 & 0xffff;
stb_uint s2 = adler32 >> 16;
while (buflen-- > 0) { // NOTE: much faster implementations are possible!
s1 += *buffer++; if (s1 > ADLER_MOD) s1 -= ADLER_MOD;
s2 += s1 ; if (s2 > ADLER_MOD) s2 -= ADLER_MOD;
}
return (s2 << 16) + s1;
}
static int sample_test[3][5] =
{
{ 1,2,3,4,5 },
{ 6,7,8,9,10, },
{ 11,12,13,14,15 },
};
typedef struct { unsigned short x,y,z; } struct1;
typedef struct { double a; int x,y,z; } struct2;
char *args_raw[] = { "foo", "-dxrf", "bar", "-ts" };
char *args[8];
void do_compressor(int,char**);
void test_sha1(void);
int alloc_num, alloc_size;
void dumpfunc(void *ptr, int sz, char *file, int line)
{
printf("%p (%6d) -- %3d:%s\n", ptr, sz, line, file);
alloc_size += sz;
alloc_num += 1;
}
char *expects(stb_matcher *m, char *s, int result, int len, char *str)
{
int res2,len2=0;
res2 = stb_lex(m, s, &len2);
c(result == res2 && len == len2, str);
return s + len;
}
void test_lex(void)
{
stb_matcher *m = stb_lex_matcher();
// tok_en5 .3 20.1 20. .20 .1
char *s = "tok_en5.3 20.1 20. .20.1";
stb_lex_item(m, "[a-zA-Z_][a-zA-Z0-9_]*", 1 );
stb_lex_item(m, "[0-9]*\\.?[0-9]*" , 2 );
stb_lex_item(m, "[\r\n\t ]+" , 3 );
stb_lex_item(m, "." , -99 );
s=expects(m,s,1,7, "stb_lex 1");
s=expects(m,s,2,2, "stb_lex 2");
s=expects(m,s,3,1, "stb_lex 3");
s=expects(m,s,2,4, "stb_lex 4");
s=expects(m,s,3,1, "stb_lex 5");
s=expects(m,s,2,3, "stb_lex 6");
s=expects(m,s,3,1, "stb_lex 7");
s=expects(m,s,2,3, "stb_lex 8");
s=expects(m,s,2,2, "stb_lex 9");
s=expects(m,s,0,0, "stb_lex 10");
stb_matcher_free(m);
}
typedef struct Btest
{
struct Btest stb_bst_fields(btest_);
int v;
} Btest;
stb_bst(Btest, btest_, BT2,bt2,v, int, a - b)
void bst_test(void)
{
Btest *root = NULL, *t;
int items[500], sorted[500];
int i,j,z;
for (z=0; z < 10; ++z) {
for (i=0; i < 500; ++i)
items[i] = stb_rand() & 0xfffffff;
// check for collisions, and retrry if so
memcpy(sorted, items, sizeof(sorted));
qsort(sorted, 500, sizeof(sorted[0]), stb_intcmp(0));
for (i=1; i < 500; ++i)
if (sorted[i-1] == sorted[i])
break;
if (i != 500) { --z; break; }
for (i=0; i < 500; ++i) {
t = malloc(sizeof(*t));
t->v = items[i];
root = btest_insert(root, t);
#ifdef STB_DEBUG
btest__validate(root,1);
#endif
for (j=0; j <= i; ++j)
c(btest_find(root, items[j]) != NULL, "stb_bst 1");
for ( ; j < 500; ++j)
c(btest_find(root, items[j]) == NULL, "stb_bst 2");
}
t = btest_first(root);
for (i=0; i < 500; ++i)
t = btest_next(root,t);
c(t == NULL, "stb_bst 5");
t = btest_last(root);
for (i=0; i < 500; ++i)
t = btest_prev(root,t);
c(t == NULL, "stb_bst 6");
memcpy(sorted, items, sizeof(sorted));
qsort(sorted, 500, sizeof(sorted[0]), stb_intcmp(0));
t = btest_first(root);
for (i=0; i < 500; ++i) {
assert(t->v == sorted[i]);
t = btest_next(root, t);
}
assert(t == NULL);
if (z==1)
stb_reverse(items, 500, sizeof(items[0]));
else if (z)
stb_shuffle(items, 500, sizeof(items[0]), stb_rand());
for (i=0; i < 500; ++i) {
t = btest_find(root, items[i]);
assert(t != NULL);
root = btest_remove(root, t);
c(btest_find(root, items[i]) == NULL, "stb_bst 5");
#ifdef STB_DEBUG
btest__validate(root, 1);
#endif
for (j=0; j <= i; ++j)
c(btest_find(root, items[j]) == NULL, "stb_bst 3");
for ( ; j < 500; ++j)
c(btest_find(root, items[j]) != NULL, "stb_bst 4");
free(t);
}
}
}
extern void stu_uninit(void);
stb_define_sort(sort_int, int, *a < *b)
stb_rand_define(prime_rand, 1)
void test_packed_floats(void);
void test_parser_generator(void);
void rec_print(stb_dirtree2 *d, int depth)
{
int i;
for (i=0; i < depth; ++i) printf(" ");
printf("%s (%d)\n", d->relpath, stb_arr_len(d->files));
for (i=0; i < stb_arr_len(d->subdirs); ++i)
rec_print(d->subdirs[i], depth+1);
d->weight = (float) stb_arr_len(d->files);
}
#ifdef MAIN_TEST
int main(int argc, char **argv)
{
char *z;
stb__wchar buffer7[1024],buffer9[1024];
char buffer8[4096];
FILE *f;
char *p1 = "foo/bar\\baz/test.xyz";
char *p2 = "foo/.bar";
char *p3 = "foo.bar";
char *p4 = "foo/bar";
char *wildcards[] = { "*foo*", "*bar", "baz", "*1*2*3*", "*/CVS/repository", "*oof*" };
char **s;
char buf[256], *p;
int n,len2,*q,i;
stb_matcher *mt=NULL;
if (argc > 1) {
do_compressor(argc,argv);
return 0;
}
test_classes();
//show();
//stb_malloc_check_counter(2,2);
//_CrtSetBreakAlloc(10398);
stbprint("Checking {!if} the {$fancy} print function {#works}? - should\n");
stbprint(" - align\n");
stbprint("But {#3this}} {one}} - shouldn't\n");
#if 0
{
int i;
char **s = stb_readdir_recursive("/sean", NULL);
stb_dirtree *d = stb_dirtree_from_files_relative("", s, stb_arr_len(s));
stb_dirtree **e;
rec_print(d, 0);
e = stb_summarize_tree(d,12,4);
for (i=0; i < stb_arr_len(e); ++i) {
printf("%s\n", e[i]->fullpath);
}
stb_arr_free(e);
stb_fatal("foo");
}
#endif
stb_("Started stb.c");
test_threads2();
test_threads();
for (i=0; i < 1023 && 5+77*i < 0xd800; ++i)
buffer7[i] = 5+77*i;
buffer7[i++] = 0xd801;
buffer7[i++] = 0xdc02;
buffer7[i++] = 0xdbff;
buffer7[i++] = 0xdfff;
buffer7[i] = 0;
p = stb_to_utf8(buffer8, buffer7, sizeof(buffer8));
c(p != NULL, "stb_to_utf8");
if (p != NULL) {
stb_from_utf8(buffer9, buffer8, sizeof(buffer9)/2);
c(!memcmp(buffer7, buffer9, i*2), "stb_from_utf8");
}
z = "foo.*[bd]ak?r";
c( stb_regex(z, "muggle man food is barfy") == 1, "stb_regex 1");
c( stb_regex("foo.*bar", "muggle man food is farfy") == 0, "stb_regex 2");
c( stb_regex("[^a-zA-Z]foo[^a-zA-Z]", "dfoobar xfood") == 0, "stb_regex 3");
c( stb_regex(z, "muman foob is bakrfy") == 1, "stb_regex 4");
z = "foo.*[bd]bk?r";
c( stb_regex(z, "muman foob is bakrfy") == 0, "stb_regex 5");
c( stb_regex(z, "muman foob is bbkrfy") == 1, "stb_regex 6");
stb_regex(NULL,NULL);
#if 0
test_parser_generator();
stb_wrapper_listall(dumpfunc);
if (alloc_num)
printf("Memory still in use: %d allocations of %d bytes.\n", alloc_num, alloc_size);
#endif
test_script();
p = stb_file("sieve.stua", NULL);
if (p) {
stua_run_script(p);
free(p);
}
stua_uninit();
//stb_wrapper_listall(dumpfunc);
printf("Memory still in use: %d allocations of %d bytes.\n", alloc_num, alloc_size);
c(stb_alloc_count_alloc == stb_alloc_count_free, "stb_alloc 0");
bst_test();
c(stb_alloc_count_alloc == stb_alloc_count_free, "stb_alloc 0");
#if 0
// stb_block
{
int inuse=0, freespace=0;
int *x = malloc(10000*sizeof(*x));
stb_block *b = stb_block_new(1, 10000);
#define BLOCK_COUNT 1000
int *p = malloc(sizeof(*p) * BLOCK_COUNT);
int *l = malloc(sizeof(*l) * BLOCK_COUNT);
int i, n, k = 0;
memset(x, 0, 10000 * sizeof(*x));
n = 0;
while (n < BLOCK_COUNT && k < 1000) {
l[n] = 16 + (rand() & 31);
p[n] = stb_block_alloc(b, l[n], 0);
if (p[n] == 0)
break;
inuse += l[n];
freespace = 0;
for (i=0; i < b->len; ++i)
freespace += b->freelist[i].len;
assert(freespace + inuse == 9999);
for (i=0; i < l[n]; ++i)
x[ p[n]+i ] = p[n];
++n;
if (k > 20) {
int sz;
i = (stb_rand() % n);
sz = l[i];
stb_block_free(b, p[i], sz);
inuse -= sz;
p[i] = p[n-1];
l[i] = l[n-1];
--n;
freespace = 0;
for (i=0; i < b->len; ++i)
freespace += b->freelist[i].len;
assert(freespace + inuse == 9999);
}
++k;
// validate
if ((k % 50) == 0) {
int j;
for (j=0; j < n; ++j) {
for (i=0; i < l[j]; ++i)
assert(x[ p[j]+i ] == p[j]);
}
}
if ((k % 200) == 0) {
stb_block_compact_freelist(b);
}
}
for (i=0; i < n; ++i)
stb_block_free(b, p[i], l[i]);
stb_block_destroy(b);
free(p);
free(l);
free(x);
}
blockfile_test();
#endif
mt = stb_lex_matcher();
for (i=0; i < 5; ++i)
stb_lex_item_wild(mt, wildcards[i], i+1);
c(1==stb_lex(mt, "this is a foo in the middle",NULL), "stb_matcher_match 1");
c(0==stb_lex(mt, "this is a bar in the middle",NULL), "stb_matcher_match 2");
c(0==stb_lex(mt, "this is a baz in the middle",NULL), "stb_matcher_match 3");
c(2==stb_lex(mt, "this is a bar",NULL), "stb_matcher_match 4");
c(0==stb_lex(mt, "this is a baz",NULL), "stb_matcher_match 5");
c(3==stb_lex(mt, "baz",NULL), "stb_matcher_match 6");
c(4==stb_lex(mt, "1_2_3_4",NULL), "stb_matcher_match 7");
c(0==stb_lex(mt, "1 3 3 3 3 2 ",NULL), "stb_matcher_match 8");
c(4==stb_lex(mt, "1 3 3 3 2 3 ",NULL), "stb_matcher_match 9");
c(5==stb_lex(mt, "C:/sean/prj/old/gdmag/mipmap/hqp/adol-c/CVS/Repository",NULL), "stb_matcher_match 10");
stb_matcher_free(mt);
{
#define SSIZE 500000
static int arr[SSIZE],arr2[SSIZE];
int i,good;
for (i=0; i < SSIZE; ++i)
arr2[i] = stb_rand();
memcpy(arr,arr2,sizeof(arr));
printf("stb_define_sort:\n");
sort_int(arr, SSIZE);
good = 1;
for (i=0; i+1 < SSIZE; ++i)
if (arr[i] > arr[i+1])
good = 0;
c(good, "stb_define_sort");
printf("qsort:\n");
qsort(arr2, SSIZE, sizeof(arr2[0]), stb_intcmp(0));
printf("done\n");
// check for bugs
memset(arr, 0, sizeof(arr[0]) * 1000);
sort_int(arr, 1000);
}
c(stb_alloc_count_alloc == stb_alloc_count_free, "stb_alloc -2");
c( stb_is_prime( 2), "stb_is_prime 1");
c( stb_is_prime( 3), "stb_is_prime 2");
c( stb_is_prime( 5), "stb_is_prime 3");
c( stb_is_prime( 7), "stb_is_prime 4");
c(!stb_is_prime( 9), "stb_is_prime 5");
c( stb_is_prime(11), "stb_is_prime 6");
c(!stb_is_prime(25), "stb_is_prime 7");
c(!stb_is_prime(27), "stb_is_prime 8");
c( stb_is_prime(29), "stb_is_prime 9");
c( stb_is_prime(31), "stb_is_prime a");
c(!stb_is_prime(33), "stb_is_prime b");
c(!stb_is_prime(35), "stb_is_prime c");
c(!stb_is_prime(36), "stb_is_prime d");
for (n=7; n < 64; n += 3) {
int i;
stb_perfect s;
unsigned int *p = malloc(n * sizeof(*p));
for (i=0; i < n; ++i)
p[i] = i*i;
c(stb_perfect_create(&s, p, n), "stb_perfect_hash 1");
stb_perfect_destroy(&s);
for (i=0; i < n; ++i)
p[i] = stb_rand();
c(stb_perfect_create(&s, p, n), "stb_perfect_hash 2");
stb_perfect_destroy(&s);
for (i=0; i < n; ++i)
p[i] = (0x80000000 >> stb_log2_ceil(n>>1)) * i;
c(stb_perfect_create(&s, p, n), "stb_perfect_hash 2");
stb_perfect_destroy(&s);
for (i=0; i < n; ++i)
p[i] = (int) malloc(1024);
c(stb_perfect_create(&s, p, n), "stb_perfect_hash 3");
stb_perfect_destroy(&s);
for (i=0; i < n; ++i)
free((void *) p[i]);
free(p);
}
printf("Maximum attempts required to find perfect hash: %d\n",
stb_perfect_hash_max_failures);
p = "abcdefghijklmnopqrstuvwxyz";
c(stb_ischar('c', p), "stb_ischar 1");
c(stb_ischar('x', p), "stb_ischar 2");
c(!stb_ischar('#', p), "stb_ischar 3");
c(!stb_ischar('X', p), "stb_ischar 4");
p = "0123456789";
c(!stb_ischar('c', p), "stb_ischar 5");
c(!stb_ischar('x', p), "stb_ischar 6");
c(!stb_ischar('#', p), "stb_ischar 7");
c(!stb_ischar('X', p), "stb_ischar 8");
p = "#####";
c(!stb_ischar('c', p), "stb_ischar a");
c(!stb_ischar('x', p), "stb_ischar b");
c(stb_ischar('#', p), "stb_ischar c");
c(!stb_ischar('X', p), "stb_ischar d");
p = "xXyY";
c(!stb_ischar('c', p), "stb_ischar e");
c(stb_ischar('x', p), "stb_ischar f");
c(!stb_ischar('#', p), "stb_ischar g");
c(stb_ischar('X', p), "stb_ischar h");
c(stb_alloc_count_alloc == stb_alloc_count_free, "stb_alloc 1");
q = stb_wordwrapalloc(15, "How now brown cow. Testinglishously. Okey dokey");
// How now brown
// cow. Testinglis
// hously. Okey
// dokey
c(stb_arr_len(q) == 8, "stb_wordwrap 8");
c(q[2] == 14 && q[3] == 15, "stb_wordwrap 9");
c(q[4] == 29 && q[5] == 12, "stb_wordwrap 10");
stb_arr_free(q);
q = stb_wordwrapalloc(20, "How now brown cow. Testinglishously. Okey dokey");
// How now brown cow.
// Testinglishously.
// Okey dokey
c(stb_arr_len(q) == 6, "stb_wordwrap 1");
c(q[0] == 0 && q[1] == 18, "stb_wordwrap 2");
c(q[2] == 19 && q[3] == 17, "stb_wordwrap 3");
c(q[4] == 37 && q[5] == 10, "stb_wordwrap 4");
stb_arr_free(q);
q = stb_wordwrapalloc(12, "How now brown cow. Testinglishously. Okey dokey");
// How now
// brown cow.
// Testinglisho
// usly. Okey
// dokey
c(stb_arr_len(q) == 10, "stb_wordwrap 5");
c(q[4] == 19 && q[5] == 12, "stb_wordwrap 6");
c(q[6] == 31 && q[3] == 10, "stb_wordwrap 7");
stb_arr_free(q);
//test_script();
//test_packed_floats();
c(stb_alloc_count_alloc == stb_alloc_count_free, "stb_alloc 0");
if (stb_alloc_count_alloc != stb_alloc_count_free) {
printf("%d allocs, %d frees\n", stb_alloc_count_alloc, stb_alloc_count_free);
}
test_lex();
mt = stb_regex_matcher(".*foo.*bar.*");
c(stb_matcher_match(mt, "foobarx") == 1, "stb_matcher_match 1");
c(stb_matcher_match(mt, "foobar") == 1, "stb_matcher_match 2");
c(stb_matcher_match(mt, "foo bar") == 1, "stb_matcher_match 3");
c(stb_matcher_match(mt, "fo foo ba ba bar ba") == 1, "stb_matcher_match 4");
c(stb_matcher_match(mt, "fo oo oo ba ba bar foo") == 0, "stb_matcher_match 5");
stb_free(mt);
mt = stb_regex_matcher(".*foo.?bar.*");
c(stb_matcher_match(mt, "abfoobarx") == 1, "stb_matcher_match 6");
c(stb_matcher_match(mt, "abfoobar") == 1, "stb_matcher_match 7");
c(stb_matcher_match(mt, "abfoo bar") == 1, "stb_matcher_match 8");
c(stb_matcher_match(mt, "abfoo bar") == 0, "stb_matcher_match 9");
c(stb_matcher_match(mt, "abfo foo ba ba bar ba") == 0, "stb_matcher_match 10");
c(stb_matcher_match(mt, "abfo oo oo ba ba bar foo") == 0, "stb_matcher_match 11");
stb_free(mt);
mt = stb_regex_matcher(".*m((foo|bar)*baz)m.*");
c(stb_matcher_match(mt, "abfoobarx") == 0, "stb_matcher_match 12");
c(stb_matcher_match(mt, "a mfoofoofoobazm d") == 1, "stb_matcher_match 13");
c(stb_matcher_match(mt, "a mfoobarbazfoom d") == 0, "stb_matcher_match 14");
c(stb_matcher_match(mt, "a mbarbarfoobarbazm d") == 1, "stb_matcher_match 15");
c(stb_matcher_match(mt, "a mfoobarfoo bazm d") == 0, "stb_matcher_match 16");
c(stb_matcher_match(mt, "a mm foobarfoobarfoobar ") == 0, "stb_matcher_match 17");
stb_free(mt);
mt = stb_regex_matcher("f*|z");
c(stb_matcher_match(mt, "fz") == 0, "stb_matcher_match 0a");
c(stb_matcher_match(mt, "ff") == 1, "stb_matcher_match 0b");
c(stb_matcher_match(mt, "z") == 1, "stb_matcher_match 0c");
stb_free(mt);
mt = stb_regex_matcher("m(f|z*)n");
c(stb_matcher_match(mt, "mfzn") == 0, "stb_matcher_match 0d");
c(stb_matcher_match(mt, "mffn") == 0, "stb_matcher_match 0e");
c(stb_matcher_match(mt, "mzn") == 1, "stb_matcher_match 0f");
c(stb_matcher_match(mt, "mn") == 1, "stb_matcher_match 0g");
c(stb_matcher_match(mt, "mzfn") == 0, "stb_matcher_match 0f");
c(stb_matcher_find(mt, "manmanmannnnnnnmmmmmmmmm ") == 0, "stb_matcher_find 1");
c(stb_matcher_find(mt, "manmanmannnnnnnmmmmmmmmm ") == 0, "stb_matcher_find 2");
c(stb_matcher_find(mt, "manmanmannnnnnnmmmmmmmmmffzzz ") == 0, "stb_matcher_find 3");
c(stb_matcher_find(mt, "manmanmannnnnnnmmmmmmmmmnfzzz ") == 1, "stb_matcher_find 4");
c(stb_matcher_find(mt, "mmmfn aanmannnnnnnmmmmmm fzzz ") == 1, "stb_matcher_find 5");
c(stb_matcher_find(mt, "mmmzzn anmannnnnnnmmmmmm fzzz ") == 1, "stb_matcher_find 6");
c(stb_matcher_find(mt, "mm anmannnnnnnmmmmmm fzmzznzz ") == 1, "stb_matcher_find 7");
c(stb_matcher_find(mt, "mm anmannnnnnnmmmmmm fzmzzfnzz ") == 0, "stb_matcher_find 8");
c(stb_matcher_find(mt, "manmfnmannnnnnnmmmmmmmmmffzzz ") == 1, "stb_matcher_find 9");
stb_free(mt);
mt = stb_regex_matcher(".*m((foo|bar)*|baz)m.*");
c(stb_matcher_match(mt, "abfoobarx") == 0, "stb_matcher_match 18");
c(stb_matcher_match(mt, "a mfoofoofoobazm d") == 0, "stb_matcher_match 19");
c(stb_matcher_match(mt, "a mfoobarbazfoom d") == 0, "stb_matcher_match 20");
c(stb_matcher_match(mt, "a mbazm d") == 1, "stb_matcher_match 21");
c(stb_matcher_match(mt, "a mfoobarfoom d") == 1, "stb_matcher_match 22");
c(stb_matcher_match(mt, "a mm foobarfoobarfoobar ") == 1, "stb_matcher_match 23");
stb_free(mt);
mt = stb_regex_matcher("[a-fA-F]..[^]a-zA-Z]");
c(stb_matcher_match(mt, "Axx1") == 1, "stb_matcher_match 24");
c(stb_matcher_match(mt, "Fxx1") == 1, "stb_matcher_match 25");
c(stb_matcher_match(mt, "Bxx]") == 0, "stb_matcher_match 26");
c(stb_matcher_match(mt, "Cxxz") == 0, "stb_matcher_match 27");
c(stb_matcher_match(mt, "gxx[") == 0, "stb_matcher_match 28");
c(stb_matcher_match(mt, "-xx0") == 0, "stb_matcher_match 29");
stb_free(mt);
c(stb_wildmatch("foo*bar", "foobarx") == 0, "stb_wildmatch 0a");
c(stb_wildmatch("foo*bar", "foobar") == 1, "stb_wildmatch 1a");
c(stb_wildmatch("foo*bar", "foo bar") == 1, "stb_wildmatch 2a");
c(stb_wildmatch("foo*bar", "fo foo ba ba bar ba") == 0, "stb_wildmatch 3a");
c(stb_wildmatch("foo*bar", "fo oo oo ba ba ar foo") == 0, "stb_wildmatch 4a");
c(stb_wildmatch("*foo*bar*", "foobar") == 1, "stb_wildmatch 1b");
c(stb_wildmatch("*foo*bar*", "foo bar") == 1, "stb_wildmatch 2b");
c(stb_wildmatch("*foo*bar*", "fo foo ba ba bar ba") == 1, "stb_wildmatch 3b");
c(stb_wildmatch("*foo*bar*", "fo oo oo ba ba ar foo") == 0, "stb_wildmatch 4b");
c(stb_wildmatch("foo*bar*", "foobarx") == 1, "stb_wildmatch 1c");
c(stb_wildmatch("foo*bar*", "foobabar") == 1, "stb_wildmatch 2c");
c(stb_wildmatch("foo*bar*", "fo foo ba ba bar ba") == 0, "stb_wildmatch 3c");
c(stb_wildmatch("foo*bar*", "fo oo oo ba ba ar foo") == 0, "stb_wildmatch 4c");
c(stb_wildmatch("*foo*bar", "foobar") == 1, "stb_wildmatch 1d");
c(stb_wildmatch("*foo*bar", "foo bar") == 1, "stb_wildmatch 2d");
c(stb_wildmatch("*foo*bar", "fo foo ba ba bar ba") == 0, "stb_wildmatch 3d");
c(stb_wildmatch("*foo*bar", "fo oo oo ba ba ar foo") == 0, "stb_wildmatch 4d");
c(stb_wildfind("foo*bar", "xyfoobarx") == 2, "stb_wildfind 0a");
c(stb_wildfind("foo*bar", "aaafoobar") == 3, "stb_wildfind 1a");
c(stb_wildfind("foo*bar", "foo bar") == 0, "stb_wildfind 2a");
c(stb_wildfind("foo*bar", "fo foo ba ba bar ba") == 3, "stb_wildfind 3a");
c(stb_wildfind("foo*bar", "fo oo oo ba ba ar foo") == -1, "stb_wildfind 4a");
c(stb_wildmatch("*foo*;*bar*", "foobar") == 1, "stb_wildmatch 1e");
c(stb_wildmatch("*foo*;*bar*", "afooa") == 1, "stb_wildmatch 2e");
c(stb_wildmatch("*foo*;*bar*", "abara") == 1, "stb_wildmatch 3e");
c(stb_wildmatch("*foo*;*bar*", "abaza") == 0, "stb_wildmatch 4e");
c(stb_wildmatch("*foo*;*bar*", "foboar") == 0, "stb_wildmatch 5e");
test_sha1();
n = sizeof(args_raw)/sizeof(args_raw[0]);
memcpy(args, args_raw, sizeof(args_raw));
s = stb_getopt(&n, args);
c(n >= 1 && !strcmp(args[1], "bar" ), "stb_getopt 1");
c(stb_arr_len(s) >= 2 && !strcmp(s[2] , "r" ), "stb_getopt 2");
stb_getopt_free(s);
n = sizeof(args_raw)/sizeof(args_raw[0]);
memcpy(args, args_raw, sizeof(args_raw));
s = stb_getopt_param(&n, args, "f");
c(stb_arr_len(s) >= 3 && !strcmp(s[3] , "fbar"), "stb_getopt 3");
stb_getopt_free(s);
n = sizeof(args_raw)/sizeof(args_raw[0]);
memcpy(args, args_raw, sizeof(args_raw));
s = stb_getopt_param(&n, args, "x");
c(stb_arr_len(s) >= 2 && !strcmp(s[1] , "xrf" ), "stb_getopt 4");
stb_getopt_free(s);
n = sizeof(args_raw)/sizeof(args_raw[0]);
memcpy(args, args_raw, sizeof(args_raw));
s = stb_getopt_param(&n, args, "s");
c(s == NULL && n == 0 , "stb_getopt 5");
stb_getopt_free(s);
#if 0
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, -1, -1) == 1, "stb_csample_int 1");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, 1, -3) == 2, "stb_csample_int 2");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, 12, -2) == 5, "stb_csample_int 3");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, 15, 1) == 10, "stb_csample_int 4");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, 5, 4) == 15, "stb_csample_int 5");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, 3, 3) == 14, "stb_csample_int 6");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, -2, 5) == 11, "stb_csample_int 7");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, -7, 0) == 1, "stb_csample_int 8");
c(*stb_csample_int(sample_test[0], 1, 5, 5, 3, 2, 1) == 8, "stb_csample_int 9");
#endif
c(!strcmp(stb_splitpath(buf, p1, STB_PATH ), "foo/bar\\baz/"), "stb_splitpath 1");
c(!strcmp(stb_splitpath(buf, p1, STB_FILE ), "test"), "stb_splitpath 2");
c(!strcmp(stb_splitpath(buf, p1, STB_EXT ), ".xyz"), "stb_splitpath 3");
c(!strcmp(stb_splitpath(buf, p1, STB_PATH_FILE ), "foo/bar\\baz/test"), "stb_splitpath 4");
c(!strcmp(stb_splitpath(buf, p1, STB_FILE_EXT ), "test.xyz"), "stb_splitpath 5");
c(!strcmp(stb_splitpath(buf, p2, STB_PATH ), "foo/"), "stb_splitpath 6");
c(!strcmp(stb_splitpath(buf, p2, STB_FILE ), ""), "stb_splitpath 7");
c(!strcmp(stb_splitpath(buf, p2, STB_EXT ), ".bar"), "stb_splitpath 8");
c(!strcmp(stb_splitpath(buf, p2, STB_PATH_FILE ), "foo/"), "stb_splitpath 9");
c(!strcmp(stb_splitpath(buf, p2, STB_FILE_EXT ), ".bar"), "stb_splitpath 10");
c(!strcmp(stb_splitpath(buf, p3, STB_PATH ), "./"), "stb_splitpath 11");
c(!strcmp(stb_splitpath(buf, p3, STB_FILE ), "foo"), "stb_splitpath 12");
c(!strcmp(stb_splitpath(buf, p3, STB_EXT ), ".bar"), "stb_splitpath 13");
c(!strcmp(stb_splitpath(buf, p3, STB_PATH_FILE ), "foo"), "stb_splitpath 14");
c(!strcmp(stb_splitpath(buf, p4, STB_PATH ), "foo/"), "stb_splitpath 16");
c(!strcmp(stb_splitpath(buf, p4, STB_FILE ), "bar"), "stb_splitpath 17");
c(!strcmp(stb_splitpath(buf, p4, STB_EXT ), ""), "stb_splitpath 18");
c(!strcmp(stb_splitpath(buf, p4, STB_PATH_FILE ), "foo/bar"), "stb_splitpath 19");
c(!strcmp(stb_splitpath(buf, p4, STB_FILE_EXT ), "bar"), "stb_splitpath 20");
c(!strcmp(p=stb_dupreplace("testfootffooo foo fox", "foo", "brap"), "testbraptfbrapo brap fox"), "stb_dupreplace 1"); free(p);
c(!strcmp(p=stb_dupreplace("testfootffooo foo fox", "foo", "" ), "testtfo fox" ), "stb_dupreplace 2"); free(p);
c(!strcmp(p=stb_dupreplace("abacab", "a", "aba"), "abababacabab" ), "stb_dupreplace 3"); free(p);
#if 0
m = stb_mml_parse("xy<&f>");
c(m != NULL, "stb_mml_parse 1");
if (m) {
c(!strcmp(m->child[0]->child[0]->child[1]->tag, "d"), "stb_mml_parse 2");
c(!strcmp(m->child[0]->child[1]->leaf_data, "<&f>"), "stb_mml_parse 3");
}
if (m)
stb_mml_free(m);
c(stb_alloc_count_alloc == stb_alloc_count_free, "stb_alloc 1");
if (stb_alloc_count_alloc != stb_alloc_count_free) {
printf("%d allocs, %d frees\n", stb_alloc_count_alloc, stb_alloc_count_free);
}
#endif
c(stb_linear_remap(3.0f,0,8,1,2) == 1.375, "stb_linear_remap()");
c(stb_bitreverse(0x1248fec8) == 0x137f1248, "stb_bitreverse() 1");
c(stb_bitreverse8(0x4e) == 0x72, "stb_bitreverse8() 1");
c(stb_bitreverse8(0x31) == 0x8c, "stb_bitreverse8() 2");
for (n=1; n < 255; ++n) {
unsigned int m = stb_bitreverse8((uint8) n);
c(stb_bitreverse8((uint8) m) == (unsigned int) n, "stb_bitreverse8() 3");
}
for (n=2; n <= 31; ++n) {
c(stb_is_pow2 ((1 << n) ) == 1 , "stb_is_pow2() 1");
c(stb_is_pow2 ((1 << n)+1) == 0 , "stb_is_pow2() 2");
c(stb_is_pow2 ((1 << n)-1) == 0 , "stb_is_pow2() 3");
c(stb_log2_floor((1 << n) ) == n , "stb_log2_floor() 1");
c(stb_log2_floor((1 << n)+1) == n , "stb_log2_floor() 2");
c(stb_log2_floor((1 << n)-1) == n-1, "stb_log2_floor() 3");
c(stb_log2_ceil ((1 << n) ) == n , "stb_log2_ceil() 1");
c(stb_log2_ceil ((1 << n)+1) == n+1, "stb_log2_ceil() 2");
c(stb_log2_ceil ((1 << n)-1) == n , "stb_log2_ceil() 3");
c(stb_bitreverse(1 << n) == 1U << (31-n), "stb_bitreverse() 2");
}
c(stb_log2_floor(0) == -1, "stb_log2_floor() 4");
c(stb_log2_ceil (0) == -1, "stb_log2_ceil () 4");
c(stb_log2_floor(-1) == 31, "stb_log2_floor() 5");
c(stb_log2_ceil (-1) == 32, "stb_log2_ceil () 5");
c(stb_bitcount(0xffffffff) == 32, "stb_bitcount() 1");
c(stb_bitcount(0xaaaaaaaa) == 16, "stb_bitcount() 2");
c(stb_bitcount(0x55555555) == 16, "stb_bitcount() 3");
c(stb_bitcount(0x00000000) == 0, "stb_bitcount() 4");
c(stb_lowbit8(0xf0) == 4, "stb_lowbit8 1");
c(stb_lowbit8(0x10) == 4, "stb_lowbit8 2");
c(stb_lowbit8(0xf3) == 0, "stb_lowbit8 3");
c(stb_lowbit8(0xf8) == 3, "stb_lowbit8 4");
c(stb_lowbit8(0x60) == 5, "stb_lowbit8 5");
for (n=0; n < sizeof(buf); ++n)
buf[n] = 0;
for (n = 0; n < 200000; ++n) {
unsigned int k = stb_rand();
int i,z=0;
for (i=0; i < 32; ++i)
if (k & (1 << i)) ++z;
c(stb_bitcount(k) == z, "stb_bitcount() 5");
buf[k >> 24] = 1;
if (k != 0) {
if (stb_is_pow2(k)) {
c(stb_log2_floor(k) == stb_log2_ceil(k), "stb_is_pow2() 1");
c(k == 1U << stb_log2_floor(k), "stb_is_pow2() 2");
} else {
c(stb_log2_floor(k) == stb_log2_ceil(k)-1, "stb_is_pow2() 3");
}
}
c(stb_bitreverse(stb_bitreverse(n)) == (uint32) n, "stb_bitreverse() 3");
}
// make sure reasonable coverage from stb_rand()
for (n=0; n < sizeof(buf); ++n)
c(buf[n] != 0, "stb_rand()");
for (n=0; n < sizeof(buf); ++n)
buf[n] = 0;
for (n=0; n < 60000; ++n) {
float z = (float) stb_frand();
int n = (int) (z * sizeof(buf));
c(z >= 0 && z < 1, "stb_frand() 1");
c(n >= 0 && n < sizeof(buf), "stb_frand() 2");
buf[n] = 1;
}
// make sure reasonable coverage from stb_frand(),
// e.g. that the range remap isn't incorrect
for (n=0; n < sizeof(buf); ++n)
c(buf[n] != 0, "stb_frand()");
// stb_arr
{
short *s = NULL;
c(sum(s) == 0, "stb_arr 1");
stb_arr_add(s); s[0] = 3;
stb_arr_push(s,7);
c( stb_arr_valid(s,1), "stb_arr 2");
c(!stb_arr_valid(s,2), "stb_arr 3");
// force a realloc
stb_arr_push(s,0);
stb_arr_push(s,0);
stb_arr_push(s,0);
stb_arr_push(s,0);
c(sum(s) == 10, "stb_arr 4");
stb_arr_push(s,0);
s[0] = 1; s[1] = 5; s[2] = 20;
c(sum(s) == 26, "stb_arr 5");
stb_arr_setlen(s,2);
c(sum(s) == 6, "stb_arr 6");
stb_arr_setlen(s,1);
c(sum(s) == 1, "stb_arr 7");
stb_arr_setlen(s,0);
c(sum(s) == 0, "stb_arr 8");
stb_arr_push(s,3);
stb_arr_push(s,4);
stb_arr_push(s,5);
stb_arr_push(s,6);
stb_arr_push(s,7);
stb_arr_deleten(s,1,3);
c(stb_arr_len(s)==2 && sum(s) == 10, "stb_arr_9");
stb_arr_push(s,2);
// 3 7 2
stb_arr_insertn(s,2,2);
// 3 7 x x 2
s[2] = 5;
s[3] = 6;
c(s[0]==3 && s[1] == 7 && s[2] == 5 && s[3] == 6 && s[4] == 2, "stb_arr 10");
stb_arr_free(s);
}
#if 1
f= stb_fopen("data/stb.test", "wb");
fwrite(buffer, 1, sizeof(buffer)-1, f);
stb_fclose(f, stb_keep_yes);
#ifndef WIN32
sleep(1); // andLinux has some synchronization problem here
#endif
#else
f= fopen("data/stb.test", "wb");
fwrite(buffer, 1, sizeof(buffer)-1, f);
fclose(f);
#endif
if (!stb_fexists("data/stb.test")) {
fprintf(stderr, "Error: couldn't open file just written, or stb_fexists() is broken.\n");
}
f = fopen("data/stb.test", "rb");
// f = NULL; // test stb_fatal()
if (!f) { stb_fatal("Error: couldn't open file just written\n"); }
else {
char temp[4];
int len1 = stb_filelen(f), len2;
int n1,n2;
if (fread(temp,1,4,f) == 0) {
int n = ferror(f);
if (n) { stb_fatal("Error reading from stream: %d", n); }
if (feof(f)) stb_fatal("Weird, read 0 bytes and hit eof");
stb_fatal("Read 0, but neither feof nor ferror is true");
}
fclose(f);
p = stb_file("data/stb.test", &len2);
if (p == NULL) stb_fatal("Error: stb_file() failed");
c(len1 == sizeof(buffer)-1, "stb_filelen()");
c(len2 == sizeof(buffer)-1, "stb_file():n");
c(memcmp(p, buffer, sizeof(buffer)-1) == 0, "stb_file()");
c(strcmp(p, buffer)==0, "stb_file() terminated");
free(p);
s = stb_stringfile("data/stb.test", &n1);
c(n1 == 3, "stb_stringfile():n");
n2 = 0;
while (s[n2]) ++n2;
c(n1 == n2, "stb_stringfile():n length matches the non-NULL strings");
if (n2 == 3) {
c(strcmp(s[0],str1)==0, "stb_stringfile()[0]");
c(strcmp(s[1],str2)==0, "stb_stringfile()[1]");
c(strcmp(s[2],str3)==0, "stb_stringfile()[2] (no terminating newlines)");
}
free(s);
f = fopen("data/stb.test", "rb");
stb_fgets(buf, sizeof(buf), f);
//c(strcmp(buf, str1)==0, "stb_fgets()");
p = stb_fgets_malloc(f);
n1 = strlen(p);
n2 = strlen(str2);
c(strcmp(p, str2)==0, "stb_fgets_malloc()");
free(p);
stb_fgets(buf, sizeof(buf), f);
c(strcmp(buf, str3)==0, "stb_fgets()3");
}
c( stb_prefix("foobar", "foo"), "stb_prefix() 1");
c(!stb_prefix("foo", "foobar"), "stb_prefix() 2");
c( stb_prefix("foob", "foob" ), "stb_prefix() 3");
stb_strncpy(buf, "foobar", 6); c(strcmp(buf,"fooba" )==0, "stb_strncpy() 1");
stb_strncpy(buf, "foobar", 8); c(strcmp(buf,"foobar")==0, "stb_strncpy() 2");
c(!strcmp(p=stb_duplower("FooBar"), "foobar"), "stb_duplower()"); free(p);
strcpy(buf, "FooBar");
stb_tolower(buf);
c(!strcmp(buf, "foobar"), "stb_tolower()");
p = stb_strtok(buf, "foo=ba*r", "#=*");
c(!strcmp(buf, "foo" ), "stb_strtok() 1");
c(!strcmp(p , "ba*r"), "stb_strtok() 2");
p = stb_strtok(buf, "foobar", "#=*");
c(*p == 0, "stb_strtok() 3");
c(!strcmp(stb_skipwhite(" \t\n foo"), "foo"), "stb_skipwhite()");
s = stb_tokens("foo == ba*r", "#=*", NULL);
c(!strcmp(s[0], "foo "), "stb_tokens() 1");
c(!strcmp(s[1], " ba"), "stb_tokens() 2");
c(!strcmp(s[2], "r"), "stb_tokens() 3");
c(s[3] == 0, "stb_tokens() 4");
free(s);
s = stb_tokens_allowempty("foo == ba*r", "#=*", NULL);
c(!strcmp(s[0], "foo "), "stb_tokens_allowempty() 1");
c(!strcmp(s[1], "" ), "stb_tokens_allowempty() 2");
c(!strcmp(s[2], " ba"), "stb_tokens_allowempty() 3");
c(!strcmp(s[3], "r"), "stb_tokens_allowempty() 4");
c(s[4] == 0, "stb_tokens_allowempty() 5");
free(s);
s = stb_tokens_stripwhite("foo == ba*r", "#=*", NULL);
c(!strcmp(s[0], "foo"), "stb_tokens_stripwhite() 1");
c(!strcmp(s[1], "" ), "stb_tokens_stripwhite() 2");
c(!strcmp(s[2], "ba"), "stb_tokens_stripwhite() 3");
c(!strcmp(s[3], "r"), "stb_tokens_stripwhite() 4");
c(s[4] == 0, "stb_tokens_stripwhite() 5");
free(s);
s = stb_tokens_quoted("foo =\"=\" ba*\"\"r \" foo\" bah ", "#=*", NULL);
c(!strcmp(s[0], "foo"), "stb_tokens_quoted() 1");
c(!strcmp(s[1], "= ba"), "stb_tokens_quoted() 2");
c(!strcmp(s[2], "\"r foo bah"), "stb_tokens_quoted() 3");
c(s[3] == 0, "stb_tokens_quoted() 4");
free(s);
p = stb_file("stb.h", &len2);
if (p) {
uint32 z = stb_adler32_old(1, p, len2);
uint32 x = stb_adler32 (1, p, len2);
c(z == x, "stb_adler32() 1");
memset(p,0xff,len2);
z = stb_adler32_old((65520<<16) + 65520, p, len2);
x = stb_adler32 ((65520<<16) + 65520, p, len2);
c(z == x, "stb_adler32() 2");
free(p);
}
// stb_hheap
{
#define HHEAP_COUNT 100000
void **p = malloc(sizeof(*p) * HHEAP_COUNT);
int i, j;
#if 0
stb_hheap *h2, *h = stb_newhheap(sizeof(struct1),0);
for (i=0; i < HHEAP_COUNT; ++i)
p[i] = stb_halloc(h);
stb_shuffle(p, HHEAP_COUNT, sizeof(*p), stb_rand());
for (i=0; i < HHEAP_COUNT; ++i)
stb_hfree(p[i]);
c(h->num_alloc == 0, "stb_hheap 1");
stb_delhheap(h);
h = stb_newhheap(sizeof(struct1),0);
h2 = stb_newhheap(sizeof(struct2),8);
for (i=0; i < HHEAP_COUNT; ++i) {
if (i & 1)
p[i] = stb_halloc(h);
else {
p[i] = stb_halloc(h2);
c((((int) p[i]) & 4) == 0, "stb_hheap 2");
}
}
stb_shuffle(p, HHEAP_COUNT, sizeof(*p), stb_rand());
for (i=0; i < HHEAP_COUNT; ++i)
stb_hfree(p[i]);
c(h->num_alloc == 0, "stb_hheap 3");
c(h2->num_alloc == 0, "stb_hheap 4");
stb_delhheap(h);
stb_delhheap(h2);
#else
for (i=0; i < HHEAP_COUNT; ++i)
p[i] = malloc(32);
stb_shuffle(p, HHEAP_COUNT, sizeof(*p), stb_rand());
for (i=0; i < HHEAP_COUNT; ++i)
free(p[i]);
#endif
// now use the same array of pointers to do pointer set operations
for (j=100; j < HHEAP_COUNT; j += 25000) {
stb_ps *ps = NULL;
for (i=0; i < j; ++i)
ps = stb_ps_add(ps, p[i]);
for (i=0; i < HHEAP_COUNT; ++i)
c(stb_ps_find(ps, p[i]) == (i < j), "stb_ps 1");
c(stb_ps_count(ps) == j, "stb_ps 1b");
for (i=j; i < HHEAP_COUNT; ++i)
ps = stb_ps_add(ps, p[i]);
for (i=0; i < j; ++i)
ps = stb_ps_remove(ps, p[i]);
for (i=0; i < HHEAP_COUNT; ++i)
c(stb_ps_find(ps, p[i]) == !(i < j), "stb_ps 2");
stb_ps_delete(ps);
}
#define HHEAP_COUNT2 100
// now use the same array of pointers to do pointer set operations
for (j=1; j < 40; ++j) {
stb_ps *ps = NULL;
for (i=0; i < j; ++i)
ps = stb_ps_add(ps, p[i]);
for (i=0; i < HHEAP_COUNT2; ++i)
c(stb_ps_find(ps, p[i]) == (i < j), "stb_ps 3");
c(stb_ps_count(ps) == j, "stb_ps 3b");
for (i=j; i < HHEAP_COUNT2; ++i)
ps = stb_ps_add(ps, p[i]);
for (i=0; i < j; ++i)
ps = stb_ps_remove(ps, p[i]);
for (i=0; i < HHEAP_COUNT2; ++i)
c(stb_ps_find(ps, p[i]) == !(i < j), "stb_ps 4");
stb_ps_delete(ps);
}
free(p);
}
n = test_compression(tc, sizeof(tc));
c(n >= 0, "stb_compress()/stb_decompress() 1");
p = stb_file("stb.h", &len2);
if (p) {
FILE *f = fopen("data/stb_h.z", "wb");
if (stb_compress_stream_start(f)) {
int i;
void *q;
int len3;
for (i=0; i < len2; ) {
int n = stb_rand() % 10;
if (n <= 6) n = 1 + stb_rand()%16;
else if (n <= 8) n = 20 + stb_rand() % 1000;
else n = 15000;
if (i + n > len2) n = len2 - i;
stb_write(p + i, n);
i += n;
}
stb_compress_stream_end(1);
q = stb_decompress_fromfile("data/stb_h.z", &len3);
c(len3 == len2, "stb_compress_stream 2");
if (len2 == len3)
c(!memcmp(p,q,len2), "stb_compress_stream 3");
if (q) free(q);
} else {
c(0, "stb_compress_stream 1");
}
free(p);
stb_compress_window(65536*4);
}
p = stb_file("stb.h", &len2);
if (p) {
n = test_compression(p, len2);
c(n >= 0, "stb_compress()/stb_decompress() 2");
#if 0
n = test_en_compression(p, len2);
c(n >= 0, "stb_en_compress()/stb_en_decompress() 2");
#endif
free(p);
} else {
fprintf(stderr, "No stb.h to compression test.\n");
}
p = stb_file("data/test.bmp", &len2);
if (p) {
n = test_compression(p, len2);
c(n == 106141, "stb_compress()/stb_decompress() 4");
#if 0
n = test_en_compression(p, len2);
c(n >= 0, "stb_en_compress()/stb_en_decompress() 4");
#endif
free(p);
}
// the hardcoded compressed lengths being verified _could_
// change if you changed the compresser parameters; but pure
// performance optimizations shouldn't change them
p = stb_file("data/cantrbry.zip", &len2);
if (p) {
n = test_compression(p, len2);
c(n == 642787, "stb_compress()/stb_decompress() 3");
#if 0
n = test_en_compression(p, len2);
c(n >= 0, "stb_en_compress()/stb_en_decompress() 3");
#endif
free(p);
}
p = stb_file("data/bible.txt", &len2);
if (p) {
n = test_compression(p, len2);
c(n == 2022520, "stb_compress()/stb_decompress() 4");
#if 0
n = test_en_compression(p, len2);
c(n >= 0, "stb_en_compress()/stb_en_decompress() 4");
#endif
free(p);
}
{
int len = 1 << 25, o=0; // 32MB
char *buffer = malloc(len);
int i;
for (i=0; i < 8192; ++i)
buffer[o++] = (char) stb_rand();
for (i=0; i < (1 << 15); ++i)
buffer[o++] = 1;
for (i=0; i < 64; ++i)
buffer[o++] = buffer[i];
for (i=0; i < (1 << 21); ++i)
buffer[o++] = 2;
for (i=0; i < 64; ++i)
buffer[o++] = buffer[i];
for (i=0; i < (1 << 21); ++i)
buffer[o++] = 3;
for (i=0; i < 8192; ++i)
buffer[o++] = buffer[i];
for (i=0; i < (1 << 21); ++i)
buffer[o++] = 4;
assert(o < len);
stb_compress_window(1 << 24);
i = test_compression(buffer, len);
c(n >= 0, "stb_compress() 6");
free(buffer);
}
#ifdef STB_THREADS
stb_thread_cleanup();
#endif
stb_ischar(0,NULL);
stb_wrapper_listall(dumpfunc);
printf("Memory still in use: %d allocations of %d bytes.\n", alloc_num, alloc_size);
// force some memory checking
for (n=1; n < 20; ++n)
malloc(1 << n);
printf("Finished stb.c with %d errors.\n", count);
#ifdef _MSC_VER
if (count)
__asm int 3;
#endif
return 0;
}
#endif
// NIST test vectors
struct
{
int length;
char *message;
char *digest;
} sha1_tests[] =
{
24,
"616263",
"a9993e364706816aba3e25717850c26c9cd0d89d",
1304,
"ec29561244ede706b6eb30a1c371d74450a105c3f9735f7fa9fe38cf67f304a5736a106e"
"92e17139a6813b1c81a4f3d3fb9546ab4296fa9f722826c066869edacd73b25480351858"
"13e22634a9da44000d95a281ff9f264ecce0a931222162d021cca28db5f3c2aa24945ab1"
"e31cb413ae29810fd794cad5dfaf29ec43cb38d198fe4ae1da2359780221405bd6712a53"
"05da4b1b737fce7cd21c0eb7728d08235a9011",
"970111c4e77bcc88cc20459c02b69b4aa8f58217",
2096,
"5fc2c3f6a7e79dc94be526e5166a238899d54927ce470018fbfd668fd9dd97cbf64e2c91"
"584d01da63be3cc9fdff8adfefc3ac728e1e335b9cdc87f069172e323d094b47fa1e652a"
"fe4d6aa147a9f46fda33cacb65f3aa12234746b9007a8c85fe982afed7815221e43dba55"
"3d8fe8a022cdac1b99eeeea359e5a9d2e72e382dffa6d19f359f4f27dc3434cd27daeeda"
"8e38594873398678065fbb23665aba9309d946135da0e4a4afdadff14db18e85e71dd93c"
"3bf9faf7f25c8194c4269b1ee3d9934097ab990025d9c3aaf63d5109f52335dd3959d38a"
"e485050e4bbb6235574fc0102be8f7a306d6e8de6ba6becf80f37415b57f9898a5824e77"
"414197422be3d36a6080",
"0423dc76a8791107d14e13f5265b343f24cc0f19",
2888,
"0f865f46a8f3aed2da18482aa09a8f390dc9da07d51d1bd10fe0bf5f3928d5927d08733d"
"32075535a6d1c8ac1b2dc6ba0f2f633dc1af68e3f0fa3d85e6c60cb7b56c239dc1519a00"
"7ea536a07b518ecca02a6c31b46b76f021620ef3fc6976804018380e5ab9c558ebfc5cb1"
"c9ed2d974722bf8ab6398f1f2b82fa5083f85c16a5767a3a07271d67743f00850ce8ec42"
"8c7f22f1cf01f99895c0c844845b06a06cecb0c6cf83eb55a1d4ebc44c2c13f6f7aa5e0e"
"08abfd84e7864279057abc471ee4a45dbbb5774afa24e51791a0eada11093b88681fe30b"
"aa3b2e94113dc63342c51ca5d1a6096d0897b626e42cb91761058008f746f35465465540"
"ad8c6b8b60f7e1461b3ce9e6529625984cb8c7d46f07f735be067588a0117f23e34ff578"
"00e2bbe9a1605fde6087fb15d22c5d3ac47566b8c448b0cee40373e5ba6eaa21abee7136"
"6afbb27dbbd300477d70c371e7b8963812f5ed4fb784fb2f3bd1d3afe883cdd47ef32bea"
"ea",
"6692a71d73e00f27df976bc56df4970650d90e45",
3680,
"4893f1c763625f2c6ce53aacf28026f14b3cd8687e1a1d3b60a81e80fcd1e2b038f9145a"
"b64a0718f948f7c3c9ac92e3d86fb669a5257da1a18c776291653688338210a3242120f1"
"01788e8acc9110db9258b1554bf3d26602516ea93606a25a7f566c0c758fb39ecd9d876b"
"c5d8abc1c3205095382c2474cb1f8bbdb45c2c0e659cb0fc703ec607a5de6bcc7a28687d"
"b1ee1c8f34797bb2441d5706d210df8c2d7d65dbded36414d063c117b52a51f7a4eb9cac"
"0782e008b47459ed5acac0bc1f20121087f992ad985511b33c866d18e63f585478ee5a5e"
"654b19d81231d98683ae3f0533565aba43dce408d7e3c4c6be11d8f05165f29c9dcb2030"
"c4ee31d3a04e7421aa92c3231a1fc07e50e95fea7389a5e65891afaba51cf55e36a9d089"
"bf293accb356d5d06547307d6e41456d4ed146a056179971c56521c83109bf922866186e"
"184a99a96c7bb96df8937e35970e438412a2b8d744cf2ad87cb605d4232e976f9f151697"
"76e4e5b6b786132c966b25fc56d815c56c819af5e159aa39f8a93d38115f5580cda93bc0"
"73c30b39920e726fe861b72483a3f886269ab7a8eefe952f35d25c4eb7f443f4f3f26e43"
"d51fb54591e6a6dad25fcdf5142033084e5624bdd51435e77dea86b8",
"dc5859dd5163c4354d5d577b855fa98e37f04384",
4472,
"cf494c18a4e17bf03910631471bca5ba7edea8b9a63381e3463517961749848eb03abefd"
"4ce676dece3740860255f57c261a558aa9c7f11432f549a9e4ce31d8e17c79450ce2ccfc"
"148ad904aedfb138219d7052088520495355dadd90f72e6f69f9c6176d3d45f113f275b7"
"fbc2a295784d41384cd7d629b23d1459a22e45fd5097ec9bf65fa965d3555ec77367903c"
"32141065fc24da5c56963d46a2da3c279e4035fb2fb1c0025d9dda5b9e3443d457d92401"
"a0d3f58b48469ecb1862dc975cdbe75ca099526db8b0329b03928206f084c633c04eef5e"
"8e377f118d30edf592504be9d2802651ec78aeb02aea167a03fc3e23e5fc907c324f283f"
"89ab37e84687a9c74ccf055402db95c29ba2c8d79b2bd4fa96459f8e3b78e07e923b8119"
"8267492196ecb71e01c331f8df245ec5bdf8d0e05c91e63bb299f0f6324895304dda721d"
"39410458f117c87b7dd6a0ee734b79fcbe482b2c9e9aa0cef03a39d4b0c86de3bc34b4aa"
"dabfa373fd2258f7c40c187744d237080762382f547a36adb117839ca72f8ebbc5a20a07"
"e86f4c8bb923f5787698d278f6db0040e76e54645bb0f97083995b34b9aa445fc4244550"
"58795828dd00c32471ec402a307f5aa1b37b1a86d6dae3bcbfbe9ba41cab0beeabf489af"
"0073d4b3837d3f14b815120bc3602d072b5aeefcdec655fe756b660eba7dcf34675acbce"
"317746270599424b9248791a0780449c1eabbb9459cc1e588bfd74df9b1b711c85c09d8a"
"a171b309281947e8f4b6ac438753158f4f36fa",
"4c17926feb6e87f5bca7890d8a5cde744f231dab",
5264,
"8236153781bd2f1b81ffe0def1beb46f5a70191142926651503f1b3bb1016acdb9e7f7ac"
"ced8dd168226f118ff664a01a8800116fd023587bfba52a2558393476f5fc69ce9c65001"
"f23e70476d2cc81c97ea19caeb194e224339bcb23f77a83feac5096f9b3090c51a6ee6d2"
"04b735aa71d7e996d380b80822e4dfd43683af9c7442498cacbea64842dfda238cb09992"
"7c6efae07fdf7b23a4e4456e0152b24853fe0d5de4179974b2b9d4a1cdbefcbc01d8d311"
"b5dda059136176ea698ab82acf20dd490be47130b1235cb48f8a6710473cfc923e222d94"
"b582f9ae36d4ca2a32d141b8e8cc36638845fbc499bce17698c3fecae2572dbbd4705524"
"30d7ef30c238c2124478f1f780483839b4fb73d63a9460206824a5b6b65315b21e3c2f24"
"c97ee7c0e78faad3df549c7ca8ef241876d9aafe9a309f6da352bec2caaa92ee8dca3928"
"99ba67dfed90aef33d41fc2494b765cb3e2422c8e595dabbfaca217757453fb322a13203"
"f425f6073a9903e2dc5818ee1da737afc345f0057744e3a56e1681c949eb12273a3bfc20"
"699e423b96e44bd1ff62e50a848a890809bfe1611c6787d3d741103308f849a790f9c015"
"098286dbacfc34c1718b2c2b77e32194a75dda37954a320fa68764027852855a7e5b5274"
"eb1e2cbcd27161d98b59ad245822015f48af82a45c0ed59be94f9af03d9736048570d6e3"
"ef63b1770bc98dfb77de84b1bb1708d872b625d9ab9b06c18e5dbbf34399391f0f8aa26e"
"c0dac7ff4cb8ec97b52bcb942fa6db2385dcd1b3b9d567aaeb425d567b0ebe267235651a"
"1ed9bf78fd93d3c1dd077fe340bb04b00529c58f45124b717c168d07e9826e33376988bc"
"5cf62845c2009980a4dfa69fbc7e5a0b1bb20a5958ca967aec68eb31dd8fccca9afcd30a"
"26bab26279f1bf6724ff",
"11863b483809ef88413ca9b0084ac4a5390640af",
6056,
"31ec3c3636618c7141441294fde7e72366a407fa7ec6a64a41a7c8dfda150ca417fac868"
"1b3c5be253e3bff3ab7a5e2c01b72790d95ee09b5362be835b4d33bd20e307c3c702aa15"
"60cdc97d190a1f98b1c78e9230446e31d60d25155167f73e33ed20cea27b2010514b57ba"
"b05ed16f601e6388ea41f714b0f0241d2429022e37623c11156f66dd0fa59131d8401dba"
"f502cffb6f1d234dcb53e4243b5cf9951688821586a524848123a06afa76ab8058bcfa72"
"27a09ce30d7e8cb100c8877bb7a81b615ee6010b8e0daced7cc922c971940b757a9107de"
"60b8454dda3452e902092e7e06faa57c20aadc43c8012b9d28d12a8cd0ba0f47ab4b377f"
"316902e6dff5e4f2e4a9b9de1e4359f344e66d0565bd814091e15a25d67d89cf6e30407b"
"36b2654762bbe53a6f204b855a3f9108109e351825cf9080c89764c5f74fb4afef89d804"
"e7f7d097fd89d98171d63eaf11bd719df44c5a606be0efea358e058af2c265b2da2623fd"
"afc62b70f0711d0150625b55672060cea6a253c590b7db1427a536d8a51085756d1e6ada"
"41d9d506b5d51bcae41249d16123b7df7190e056777a70feaf7d9f051fdbbe45cbd60fc6"
"295dda84d4ebbd7284ad44be3ee3ba57c8883ead603519b8ad434e3bf630734a9243c00a"
"a07366b8f88621ec6176111f0418c66b20ff9a93009f43432aaea899dad0f4e3ae72e9ab"
"a3f678f140118eb7117230c357a5caa0fe36c4e6cf1957bbe7499f9a68b0f1536e476e53"
"457ed826d9dea53a6ded52e69052faaa4d3927b9a3f9e8b435f424b941bf2d9cd6849874"
"42a44d5acaa0da6d9f390d1a0dd6c19af427f8bb7c082ae405a8dd535dea76aa360b4faa"
"d786093e113424bb75b8cc66c41af637a7b2acdca048a501417919cf9c5cd3b2fa668860"
"d08b6717eea6f125fa1b0bae1dbb52aafce8ae2deaf92aeb5be003fb9c09fedbc286ffb5"
"e16ad8e07e725faa46ebc35500cf205fc03250075ddc050c263814b8d16d141db4ca289f"
"386719b28a09a8e5934722202beb3429899b016dfeb972fee487cdd8d18f8a681042624f"
"51",
"f43937922444421042f76756fbed0338b354516f",
6848,
"21b9a9686ec200456c414f2e6963e2d59e8b57e654eced3d4b57fe565b51c9045c697566"
"44c953178f0a64a6e44d1b46f58763c6a71ce4c373b0821c0b3927a64159c32125ec916b"
"6edd9bf41c3d80725b9675d6a97c8a7e3b662fac9dbcf6379a319a805b5341a8d360fe00"
"5a5c9ac1976094fea43566d66d220aee5901bd1f2d98036b2d27eb36843e94b2e5d1f09c"
"738ec826de6e0034cf8b1dca873104c5c33704cae290177d491d65f307c50a69b5c81936"
"a050e1fe2b4a6f296e73549323b6a885c3b54ee5eca67aa90660719126b590163203909e"
"470608f157f033f017bcf48518bf17d63380dabe2bc9ac7d8efe34aedcae957aeb68f10c"
"8ad02c4465f1f2b029d5fbb8e8538d18be294394b54b0ee6e67a79fce11731604f3ac4f8"
"d6ffa9ef3d2081f3d1c99ca107a7bf3d624324a7978ec38af0bcd0d7ee568572328b212b"
"9dc831efb7880e3f4d6ca7e25f8e80d73913fb8edfffd758ae4df61b4140634a92f49314"
"6138ebdcdaa083ea72d52a601230aa6f77874dcad9479f5bcac3763662cc30cb99823c5f"
"f469dcbd64c028286b0e579580fd3a17b56b099b97bf62d555798f7a250e08b0e4f238c3"
"fcf684198bd48a68c208a6268be2bb416eda3011b523388bce8357b7f26122640420461a"
"bcabcb5004519adfa2d43db718bce7d0c8f1b4645c89315c65df1f0842e5741244bba3b5"
"10801d2a446818635d0e8ffcd80c8a6f97ca9f878793b91780ee18eb6c2b99ffac3c38ef"
"b7c6d3af0478317c2b9c421247eba8209ea677f984e2398c7c243696a12df2164417f602"
"d7a1d33809c865b73397550ff33fe116166ae0ddbccd00e2b6fc538733830ac39c328018"
"bcb87ac52474ad3cce8780d6002e14c6734f814cb551632bcc31965c1cd23d048b9509a4"
"e22ab88f76a6dba209d5dd2febd1413a64d32be8574a22341f2a14e4bd879abb35627ef1"
"35c37be0f80843006a7cc7158d2bb2a71bf536b36de20ca09bb5b674e5c408485106e6fa"
"966e4f2139779b46f6010051615b5b41cda12d206d48e436b9f75d7e1398a656abb0087a"
"a0eb453368fc1ecc71a31846080f804d7b67ad6a7aa48579c3a1435eff7577f4e6004d46"
"aac4130293f6f62ae6d50c0d0c3b9876f0728923a94843785966a27555dd3ce68602e7d9"
"0f7c7c552f9bda4969ec2dc3e30a70620db6300e822a93e633ab9a7a",
"5d4d18b24b877092188a44be4f2e80ab1d41e795",
7640,
"1c87f48f4409c3682e2cf34c63286dd52701b6c14e08669851a6dc8fa15530ad3bef692c"
"7d2bf02238644561069df19bdec3bccae5311fce877afc58c7628d08d32d9bd2dc1df0a6"
"24360e505944219d211f33bff62e9ff2342ac86070240a420ccaf14908e6a93c1b27b6e2"
"0324e522199e83692805cc4c7f3ea66f45a490a50d4dd558aa8e052c45c1a5dfad452674"
"edc7149024c09024913f004ceee90577ff3eaec96a1eebbdc98b440ffeb0cad9c6224efc"
"9267d2c192b53dc012fb53010926e362ef9d4238d00df9399f6cbb9acc389a7418007a6c"
"a926c59359e3608b548bdeece213f4e581d02d273781dffe26905ec161956f6dfe1c008d"
"6da8165d08f8062eea88e80c055b499f6ff8204ffdb303ab132d9b0cba1e5675f3525bbe"
"4cf2c3f2b00506f58336b36aefd865d37827f2fad7d1e59105b52f1596ea19f848037dfe"
"dc9136e824ead5505e2995d4c0769276548835430667f333fc77375125b29c1b1535602c"
"10fe161864f49a98fc274ae7335a736be6bf0a98cd019d120b87881103f86c0a6efadd8c"
"aa405b6855c384141b4f8751cc42dc0cb2913382210baaa84fe242ca66679472d815c08b"
"f3d1a7c6b5705a3de17ad157522de1eb90c568a8a1fbcbb422cca293967bb14bfdd91bc5"
"a9c4d2774dee524057e08f937f3e2bd8a04ced0fc7b16fb78a7b16ee9c6447d99e53d846"
"3726c59066af25c317fc5c01f5dc9125809e63a55f1cd7bdf7f995ca3c2655f4c7ab940f"
"2aa48bc3808961eb48b3a03c731ce627bb67dd0037206c5f2c442fc72704258548c6a9db"
"e16da45e40da009dc8b2600347620eff8361346116b550087cb9e2ba6b1d6753622e8b22"
"85589b90a8e93902aa17530104455699a1829efef153327639b2ae722d5680fec035575c"
"3b48d9ec8c8e9550e15338cc76b203f3ab597c805a8c6482676deabc997a1e4ba857a889"
"97ceba32431443c53d4d662dd5532aa177b373c93bf93122b72ed7a3189e0fa171dfabf0"
"520edf4b9d5caef595c9a3a13830c190cf84bcf9c3596aadb2a674fbc2c951d135cb7525"
"3ee6c59313444f48440a381e4b95f5086403beb19ff640603394931f15d36b1cc9f3924f"
"794c965d4449bfbdd8b543194335bdf70616dc986b49582019ac2bf8e68cfd71ec67e0aa"
"dff63db39e6a0ef207f74ec6108fae6b13f08a1e6ae01b813cb7ee40961f95f5be189c49"
"c43fbf5c594f5968e4e820a1d38f105f2ff7a57e747e4d059ffb1d0788b7c3c772b9bc1f"
"e147c723aca999015230d22c917730b935e902092f83e0a8e6db9a75d2626e0346e67e40"
"8d5b815439dab8ccb8ea23f828fff6916c4047",
"32e0f5d40ceec1fbe45ddd151c76c0b3fef1c938",
8432,
"084f04f8d44b333dca539ad2f45f1d94065fbb1d86d2ccf32f9486fe98f7c64011160ec0"
"cd66c9c7478ed74fde7945b9c2a95cbe14cedea849978cc2d0c8eb0df48d4834030dfac2"
"b043e793b6094a88be76b37f836a4f833467693f1aa331b97a5bbc3dbd694d96ce19d385"
"c439b26bc16fc64919d0a5eab7ad255fbdb01fac6b2872c142a24aac69b9a20c4f2f07c9"
"923c9f0220256b479c11c90903193d4e8f9e70a9dbdf796a49ca5c12a113d00afa844694"
"de942601a93a5c2532031308ad63c0ded048633935f50a7e000e9695c1efc1e59c426080"
"a7d1e69a93982a408f1f6a4769078f82f6e2b238b548e0d4af271adfa15aa02c5d7d7052"
"6e00095ffb7b74cbee4185ab54385f2707e8362e8bd1596937026f6d95e700340b6338ce"
"ba1ee854a621ce1e17a016354016200b1f98846aa46254ab15b7a128b1e840f494b2cdc9"
"daccf14107c1e149a7fc27d33121a5cc31a4d74ea6945816a9b7a83850dc2c11d26d767e"
"ec44c74b83bfd2ef8a17c37626ed80be10262fe63cf9f804b8460c16d62ae63c8dd0d124"
"1d8aaac5f220e750cb68d8631b162d80afd6b9bf929875bf2e2bc8e2b30e05babd8336be"
"31e41842673a66a68f0c5acd4d7572d0a77970f42199a4da26a56df6aad2fe420e0d5e34"
"448eb2ed33afbfb35dffaba1bf92039df89c038bae3e11c02ea08aba5240c10ea88a45a1"
"d0a8631b269bec99a28b39a3fc5b6b5d1381f7018f15638cc5274ab8dc56a62b2e9e4fee"
"f172be20170b17ec72ff67b81c15299f165810222f6a001a281b5df1153a891206aca89e"
"e7baa761a5af7c0493a3af840b9219e358b1ec1dd301f35d4d241b71ad70337bda42f0ea"
"dc9434a93ed28f96b6ea073608a314a7272fefd69d030cf22ee6e520b848fa705ed6160f"
"e54bd3bf5e89608506e882a16aced9c3cf80657cd03749f34977ced9749caa9f52b683e6"
"4d96af371b293ef4e5053a8ea9422df9dd8be45d5574730f660e79bf4cbaa5f3c93a79b4"
"0f0e4e86e0fd999ef4f26c509b0940c7a3eaf1f87c560ad89aff43cd1b9d4863aa3ebc41"
"a3dd7e5b77372b6953dae497fc7f517efe99e553052e645e8be6a3aeb362900c75ce712d"
"fcba712c4c25583728db9a883302939655ef118d603e13fcf421d0cea0f8fb7c49224681"
"d013250defa7d4fd64b69b0b52e95142e4cc1fb6332486716a82a3b02818b25025ccd283"
"198b07c7d9e08519c3c52c655db94f423912b9dc1c95f2315e44be819477e7ff6d2e3ccd"
"daa6da27722aaadf142c2b09ce9472f7fd586f68b64d71fc653decebb4397bf7af30219f"
"25c1d496514e3c73b952b8aa57f4a2bbf7dcd4a9e0456aaeb653ca2d9fa7e2e8a532b173"
"5c4609e9c4f393dd70901393e898ed704db8e9b03b253357f333a66aba24495e7c3d1ad1"
"b5200b7892554b59532ac63af3bdef590b57bd5df4fbf38d2b3fa540fa5bf89455802963"
"036bd173fe3967ed1b7d",
"ee976e4ad3cad933b283649eff9ffdb41fcccb18",
9224,
"bd8320703d0cac96a96aeefa3abf0f757456bf42b3e56f62070fc03e412d3b8f4e4e427b"
"c47c4600bb423b96de6b4910c20bc5c476c45feb5b429d4b35088813836fa5060ceb26db"
"bb9162e4acd683ef879a7e6a0d6549caf0f0482de8e7083d03ed2f583de1b3ef505f4b2c"
"cd8a23d86c09d47ba05093c56f21a82c815223d777d0cabb7ee4550423b5deb6690f9394"
"1862ae41590ea7a580dda79229d141a786215d75f77e74e1db9a03c9a7eb39eb35adf302"
"5e26eb31ca2d2ca507edca77d9e7cfcfd136784f2117a2afafa87fa468f08d07d720c933"
"f61820af442d260d172a0a113494ca169d33a3aeaacdcc895b356398ed85a871aba769f6"
"071abd31e9f2f5834721d0fef6f6ee0fc0e38760b6835dfcc7dbefb592e1f0c3793af7ad"
"f748786d3364f3cfd5686b1a18711af220e3637d8fad08c553ce9d5dc1183d48e8337b16"
"1fe69b50e1920316dbffec07425b5d616a805a699576590e0939f5c965bce6c7342d314a"
"c37b9c4d30166567c4f633f182de4d6b00e20a1c762789f915eaa1c89ac31b85222b1f05"
"403dedd94db9ce75ff4e49923d1999d032695fa0a1c595617830c3c9a7ab758732fcec26"
"85ae14350959b6a5f423ef726587e186b055a8daf6fa8fdefa02841b2fdbca1616dcee78"
"c685fc6dcc09f24a36097572eba3c37a3eabe98bc23836085f63ef71a54b4488615d83b2"
"6ed28c9fce78852df9b6cf8a75ca3899a7567298e91bc4ffdd04ffab0066b43b8286a4bb"
"555c78808496b252c6e0e4d153631f11f68baf88630e052acc2af5d2af2e22e4f23bb630"
"314c561a577455f86b6727bcad3c19d3e271404dec30af3d9dd0ed63cd9fa708aadfa12a"
"500ef2d99a6b71e137b56ba90036975b88004b45f577ef800f0fb3cf97577dc9da37253b"
"8675e5c8bb7e0bd26564f19eca232fb25f280f82e014424c9fbdd1411d7556e5d7906bb8"
"62206316ba03385cd820c54c82ed35b36735bc486b1885d84053eba036c1ebfb5422d93d"
"a71c53deda7f74db07cd4959cdfa898ba37080d76b564d344b124dd7b80cd70ed3b52a6c"
"f9c9a32695d134bd39eb11ddeecdac86c808e469bd8a7995b667c452e7d9a54d5c85bcf6"
"d5ffdc27d491bc06f438f02c7cf018073431587c78ba08d18a8daccb2d3b26136f612ade"
"c673f3cd5eb83412b29652d55a10d0d6238d0b5365db272c917349450aff062c36191cfc"
"d45660819083f89cd42ecae9e26934a020cafeb9b2b68d544edf59574c0ca159fd195dbf"
"3e3e74244d942fffdbd4ed7f626219bab88b5a07e50b09a832d3e8ad82091114e54f2c35"
"6b48e55e36589ebad3ac6077cb7b1827748b00670df65bbf0a2e65caad3f8a97d654d64e"
"1c7dad171cafbc37110d2f7ca66524dc08fe60593e914128bd95f41137bfe819b5ca835f"
"e5741344b5c907ce20a35f4f48726141c6398e753ed9d46d3692050628c78859d5014fe4"
"dd3708e58d4d9807f8dac540492e32fa579491717ad4145c9efc24cf95605660b2e09b89"
"9369b74d3ebff41e707917ff314d93e6ac8dfd643ef2c087cd9912005b4b2681da01a369"
"42a756a3e22123cbf38c429373c6a8663130c24b24b2690b000013960b1c46a32d1d5397"
"47",
"2df09b10933afedfcd3f2532dfd29e7cb6213859",
10016,
"7a94978bec7f5034b12c96b86498068db28cd2726b676f54d81d8d7350804cc106bead8a"
"252b465a1f413b1c41e5697f8cece49ec0dea4dfb9fa7b1bfe7a4a00981875b420d094bb"
"1ce86c1b8c2e1dbebf819c176b926409fdec69042e324e71d7a8d75006f5a11f512811fe"
"6af88a12f450e327950b18994dfc3f740631beda6c78bca5fe23d54e6509120e05cd1842"
"d3639f1466cf26585030e5b4aefe0404fe900afc31e1980f0193579085342f1803c1ba27"
"0568f80eaf92440c4f2186b736f6ab9dc7b7522ccdcfc8cf12b6375a2d721aa89b5ef482"
"112a42c31123aebabcb485d0e72d6b6b70c44e12d2da98d1f87fa9df4f37847e1ffec823"
"1b8be3d737d282ddb9cc4b95937acfa0f028ba450def4d134a7d0fc88119bf7296e18cd4"
"4f56890b661b5b72ddfa34c29228067e13caf08eb3b7fd29de800df9a9ae137aad4a81a4"
"16a301c9f74b66c0e163e243b3187996b36eb569de3d9c007d78df91f9b554eef0eaa663"
"88754ce20460b75d95e2d0747229a1502a5652cf39ca58e1daa0e9321d7ab3093981cd70"
"23a7ee956030dd70177028a66ad619ad0629e631f91228b7c5db8e81b276d3b168c1edb1"
"bc0888d1cbcbb23245c2d8e40c1ff14bfe13f9c70e93a1939a5c45eef9351e795374b9e1"
"b5c3a7bd642477ba7233e1f590ab44a8232c53099a3c0a6ffe8be8b7ca7b58e6fedf700f"
"6f03dd7861ee1ef857e3f1a32a2e0baa591d0c7ca04cb231cc254d29cda873f00d68f465"
"00d6101cfdc2e8004c1f333d8007325d06ffe6b0ff7b80f24ba51928e65aa3cb78752028"
"27511207b089328bb60264595a2cebfc0b84d9899f5eca7ea3e1d2f0f053b4e67f975500"
"7ff3705ca4178ab9c15b29dd99494135f35befbcec05691d91f6361cad9c9a32e0e65577"
"f14d8dc66515081b51d09e3f6c25eea868cf519a83e80c935968cae6fce949a646ad53c5"
"6ee1f07dda23daef3443310bc04670afedb1a0132a04cb64fa84b4af4b3dc501044849cd"
"dd4adb8d733d1eac9c73afa4f7d75864c87787f4033ffe5ba707cbc14dd17bd1014b8b61"
"509c1f55a25cf6c0cbe49e4ddcc9e4de3fa38f7203134e4c7404ee52ef30d0b3f4e69bcc"
"7d0b2e4d8e60d9970e02cc69d537cfbc066734eb9f690a174e0194ca87a6fadad3883d91"
"6bd1700a052b26deee832701590d67e6f78938eac7c4beef3061a3474dd90dd588c1cd6e"
"6a4cda85b110fd08a30dcd85a3ebde910283366a17a100db920885600db7578be46bcfa6"
"4765ba9a8d6d5010cb1766d5a645e48365ed785e4b1d8c7c233c76291c92ef89d70bc77f"
"bf37d7ce9996367e5b13b08242ce73971f1e0c6ff2d7920fb9c821768a888a7fe0734908"
"33efb854cbf482aed5cb594fb715ec82a110130664164db488666d6198279006c1aa521f"
"9cf04250476c934eba0914fd586f62d6c5825b8cf82cd7ef915d93106c506ea6760fd8b0"
"bf39875cd1036b28417de54783173446026330ef701c3a6e5b6873b2025a2c1666bb9e41"
"a40adb4a81c1052047dabe2ad092df2ae06d6d67b87ac90be7d826ca647940c4da264cad"
"43c32a2bb8d5e27f87414e6887561444a80ed879ce91af13e0fbd6af1b5fa497ad0cbd2e"
"7f0f898f52f9e4710de2174e55ad07c45f8ead3b02cac6c811becc51e72324f2439099a0"
"5740090c1b165ecae7dec0b341d60a88f46d7ad8624aac231a90c93fad61fcfbbea12503"
"59fcd203862a6b0f1d71ac43db6c58a6b60c2c546edc12dd658998e8",
"f32e70862a16e3e8b199e9d81a9949d66f812cad",
10808,
"88dd7f273acbe799219c23184782ac0b07bade2bc46b4f8adbd25ed3d59c0fd3e2931638"
"837d31998641bbb7374c7f03d533ca60439ac4290054ff7659cc519bdda3dff2129a7bdb"
"66b3300068931ade382b7b813c970c8e15469187d25cb04b635403dc50ea6c65ab38a97c"
"431f28a41ae81c16192bd0c103f03b8fa815d6ea5bf0aa7fa534ad413b194eb12eb74f5d"
"62b3d3a7411eb8c8b09a261542bf6880acbdfb617a42e577009e482992253712f8d4c8bd"
"1c386bad068c7aa10a22111640041f0c35dabd0de00ebf6cd82f89cbc49325df12419278"
"ec0d5ebb670577b2fe0c3e0840c5dd0dc5b3da00669eed8ead380f968b00d42f4967faec"
"c131425fce1f7edb01cbec7e96d3c26fa6390a659e0ab069ef3edadc07e077bb816f1b22"
"98830a0fe2b393693bb79f41feca89577c5230e0a6c34b860dc1fdb10d85aa054481082c"
"494779d59ba798fcd817116c3059b7831857d0364352b354ce3b960fbb61a1b8a04d47ca"
"a0ead52a9bea4bada2646cdbaec211f391dac22f2c5b8748e36bfc3d4e8ea45131ca7f52"
"af09df21babe776fcecbb5c5dfa352c790ab27b9a5e74242bbd23970368dbefd7c3c74d1"
"61ae01c7e13c65b415f38aa660f51b69ea1c9a504fe1ad31987cb9b26a4db2c37d7b326c"
"50dbc8c91b13925306ff0e6098532dee7282a99c3ddf99f9e1024301f76e31e58271870b"
"d94b9356e892a6a798d422a48c7fd5b80efe855a4925cc93b8cf27badec5498338e2b538"
"70758b45d3e7a2fa059ed88df320a65e0a7cf87fa7e63b74cea1b7371e221f8004726642"
"30d4d57945a85b23d58f248c8cd06ccfabfa969ab8cb78317451fab60e4fdfa796e2e2a8"
"b46405839a91266d37e8d38bae545fb4060c357923b86d62f5d59d7bef5af20fbb9c7fb4"
"2c6fd487748ed3b9973dbf4b1f2c9615129fa10d21cc49c622842c37c01670be71715765"
"a98814634efbdee66bf3420f284dbd3efafc8a9117a8b9a72d9b81aa53ded78c409f3f90"
"bad6e30d5229e26f4f0cea7ee82c09e3b60ec0e768f35a7fb9007b869f9bfc49c518f648"
"3c951d3b6e22505453266ec4e7fe6a80dbe6a2458a1d6cd93044f2955607412091009c7d"
"6cd81648a3b0603c92bfdff9ec3c0104b07ed2105962ca7c56ede91cb932073c337665e2"
"409387549f9a46da05bc21c5126bd4b084bc2c06ab1019c51df30581aa4464ab92978c13"
"f6d7c7ac8d30a78f982b9a43181bbe3c3eb9f7a1230b3e53b98a3c2a028317827fbe8cf6"
"ec5e3e6b2a084d517d472b25f72fab3a34415bba488f14e7f621cfa72396ba40890e8c60"
"b04815601a0819c9bebc5e18b95e04be3f9c156bd7375d8cc8a97c13ce0a3976123419fa"
"592631317ca638c1182be06886f9663d0e8e6839573df8f52219eeb5381482a6a1681a64"
"173660bfbb6d98bf06ee31e601ee99b4b99b5671ed0253260b3077ed5b977c6a79b4ff9a"
"08efd3cba5c39bec1a1e9807d40bbf0c988e0fd071cf2155ed7b014c88683cd869783a95"
"4cbfced9c0e80c3a92d45b508985cbbc533ba868c0dc4f112e99400345cf7524e42bf234"
"5a129e53da4051c429af2ef09aba33ae3c820ec1529132a203bd2b81534f2e865265f55c"
"9395caf0e0d3e1762c95eaaec935e765dc963b3e0d0a04b28373ab560fa9ba5ca71ced5d"
"17bb8b56f314f6f0d0bc8104b3f1835eca7eaac15adf912cf9a6945cfd1de392342dd596"
"d67e7ffcb7e086a6c1ea318aa2e0c2b5c2da079078232c637de0d317a1f26640bc1dac5b"
"e8699b53edc86e4bfdfaf797a2ae350bf4ea29790face675c4d2e85b8f37a694c91f6a14"
"1fd561274392ee6ee1a14424d5c134a69bcb4333079400f03615952fc4c99bf03f5733a8"
"dc71524269fc5c648371f5f3098314d9d10258",
"08632c75676571a5db5971f5d99cb8de6bf1792a",
11600,
"85d43615942fcaa449329fd1fe9efb17545eb252cac752228f1e9d90955a3cf4e72cb116"
"3c3d8e93ccb7e4826206ff58b3e05009ee82ab70943db3f18a32925d6d5aed1525c91673"
"bd33846571af815b09bb236466807d935b5816a8be8e9becbe65d05d765bcc0bc3ae66c2"
"5320ebe9fff712aa5b4931548b76b0fd58f6be6b83554435587b1725873172e130e1a3ca"
"3d9d0425f4632d79cca0683780f266a0633230e4f3b25f87b0c390092f7b13c66ab5e31b"
"5a58dbcac8dd26a0600bf85507057bb36e870dfae76da8847875a1a52e4596d5b4b0a211"
"2435d27e1dc8dd5016d60feaf2838746d436a2983457b72e3357059b2bf1e9148bb0551a"
"e2b27d5a39abd3d1a62c36331e26668e8baabc2a1ef218b5e7a51a9ca35795bcd54f403a"
"188eafafb30d82896e45ddaea4f418629a1fb76a0f539c7114317bac1e2a8fba5a868bce"
"40abd40f6b9ced3fa8c0329b4de5ca03cc84d75b8746ef31e6c8d0a0a79b4f747690928e"
"be327f8bbe9374a0df4c39c845bf3322a49fda9455b36db5a9d6e4ea7d4326cf0e0f7cd8"
"0ff74538f95cec01a38c188d1243221e9272ccc1053e30787c4cf697043cca6fc3730d2a"
"431ecbf60d73ee667a3ab114c68d578c66dc1c659b346cb148c053980190353f6499bfef"
"acfd1d73838d6dc1188c74dd72b690fb0481eee481a3fd9af1d4233f05d5ae33a7b10d7d"
"d643406cb1f88d7dd1d77580dcbee6f757eeb2bfbcc940f2cddb820b2718264b1a64115c"
"b85909352c44b13d4e70bbb374a8594d8af7f41f65b221bf54b8d1a7f8f9c7da563550cb"
"2b062e7a7f21d5e07dd9da8d82e5a89074627597551c745718094c2eb316ca077526d27f"
"9a589c461d891dc7cd1bc20ba3f464da53c97924219c87a0f683dfb3b3ac8793c59e78ac"
"fac109439221ac599a6fd8d2754946d6bcba60784805f7958c9e34ff287ad1dbbc888848"
"fa80cc4200dbb8c5e4224535906cbffdd0237a77a906c10ced740f9c0ce7821f2dbf8c8d"
"7d41ecfcc7dfdc0846b98c78b765d01fb1eb15ff39149ab592e5dd1152665304bba85bbf"
"4705751985aaaf31245361554d561a2337e3daeef58a826492fd886d5f18ef568c1e772e"
"f6461170407695e3254eb7bf0c683811ddde5960140d959114998f08bdb24a104095987d"
"3255d590e0dbd41ae32b1ae4f4ea4a4f011de1388034231e034756870c9f2d9f23788723"
"27055a7de2b5e931dfb53e7780b6d4294bf094e08567025b026db9203b681565a1d52f30"
"318d0ebe49471b22ba5fd62e1ed6c8966c99b853c9062246a1ace51ef7523c7bf93bef53"
"d8a9cb96d6a04f0da1eca888df66e0380a72525a7ecc6115d08569a66248f6ba34e2341b"
"fd01a78f7b3c1cfe0754e0d26cba2fa3f951ef14d5749ff8933b8aba06fa40fb570b467c"
"54ce0d3f0bed21e998e5a36b3bc2f9e1ae29c4bab59c121af6fad67c0b45959cd6a86194"
"14b90b4535fb95f86ca7e64502acc135eff4f8a3abe9dde84238fab7a7d402454a3f07ad"
"ec05ec94b2891e0879037fae6acaa31dcecf3f85236ade946f5ad69ad4077beb65099285"
"38ee09f2bc38e5704da67b5006b5e39cd765aafcd740c7dadb99d0c547126e1324610fcb"
"7353dac2c110e803fca2b17485b1c4b78690bc4f867e6f043b2568889f67985a465a48eb"
"ee915200589e915756d4968d26529c3ffe3dbe70e84c682ad08a0c68db571634fbb0210d"
"c1b16b8b725886465c8c51f36a5e27d0f78e5643e051d3bddd512ce511f6bdf3dfe42759"
"00c5fea9d248c2b3f36911ed0ff41a19f6445521f251724657ea8f795b3ead0928a1657f"
"308dd7c7c1e7e490d9849df43becfa5cc25ed09ef614fd69ddc7e5e3147623901d647876"
"fb60077ffc48c51ed7d02b35f6802e3715fc708a0c88b82fe9cba0a442d38d09ca5ae483"
"21487bdef1794e7636bf7457dd2b51a391880c34d229438347e5fec8555fe263f08ba87b"
"b16dcde529248a477628067d13d0cb3bf51776f4d39fb3fbc5f669e91019323e40360e4b"
"78b6584f077bf9e03b66",
"ab7213f6becb980d40dc89fbda0ca39f225a2d33",
12392,
"7ae3ca60b3a96be914d24980fb5652eb68451fed5fa47abe8e771db8301fbd5331e64753"
"93d96a4010d6551701e5c23f7ecb33bec7dd7bade21381e9865d410c383a139cb4863082"
"8e9372bd197c5b5788b6599853e8487bddfd395e537772fdd706b6a1de59c695d63427da"
"0dc3261bce2e1ae3cd6de90ec45ecd7e5f14580f5672b6ccd8f9336330dffcd6a3612a74"
"975afc08fb136450e25dc6b071ddfc28fca89d846c107fd2e4bd7a19a4ff6f482d62896d"
"a583c3277e23ab5e537a653112cdf2306043b3cc39f5280bd744fe81d66f497b95650e7d"
"dfd704efcb929b13e00c3e3a7d3cd53878af8f1506d9de05dba9c39a92604b394ea25acb"
"a2cda7b4ae8b08098ba3f0fdea15359df76517be84377f33631c844313ac335aa0d590fe"
"c472d805521f0905d44ca40d7391b292184105acd142c083761c1a038c4f5ed869ea3696"
"99592a37817f64cb4205b66be1f1de6fa47a08e1bf1a94312fe61a29e71bab242af95a7b"
"38d4fb412c682b30256d91e2a46b634535d02b495240cbdb842cbe17cba6a2b94073f3d5"
"f9621ac92ddda66f98bed997216466b4bb0579d58945f8d7450808d9e285d4f1709d8a1d"
"416aa57d4a1a72bfcbfecdda33de2cff3e90e0cc60c897c4663224fc5bbe8316a83c1773"
"802837a57bc7e9238173ed41ea32fe5fe38e546014a16d5e80700d9bac7a84bb03902f31"
"79e641f86f6bc383d656daf69801499633fb367ea7593195934c72bc9bf9624c0c845ebf"
"c36eb7ad4b22fdfb45ca7d4f0d6708c69a21f6eaa6db6bde0f0bd9dc7ec9c6e24626d0a7"
"8fbeeed4b391f871e80e6a9d207165832d4ff689296f9bca15dc03c7c0381659ea5335eb"
"aafdc3e50d18e46b00f1844870d09c25afcdb0ff1ae69dd8f94f91aca6095ba6f2b6e594"
"c4acfe9903485d21b684e31a6acc2162d40e1a7bb8114a860a07e76f5265666555f2418d"
"f11ef8f7499656d12215f5da8d7d041ac72648d15d7661ad93b24f3f071334b0921d5bb0"
"6f2c7ab09f5034518b5ae21cec379373e87d51c77d44a70c2337606aadeb9036716fd920"
"a824e7ae18ce3de9f0ec3456f3454027d8c476b3f1854b240c309f6f9786fa8a073915d9"
"7a019ce99aec3260c5f6b6346cd9c41cb9267f4475958e45289965548238c6b9f91a8784"
"b4e0957ba8b73956012c9a2fc3428434b1c1679f6ed2a3e8e2c90238df428622046f668e"
"e2b053f55e64ffd45600e05a885e3264af573bacee93d23d72a0222b5442ac80bc0a8b79"
"4c2afcf3bc881d20c111f57e3450b50a703f3db1fc5de2076a006f3b7eed694b93269874"
"3b03c2ed2684bad445e69a692e744c7ac3a04f1e0e52b7a6708076d1fbffdb3f1c995828"
"7d5f884e29407030f2db06811092efd80ae08da9daec39744c5ecd3ca771663b8f4968d4"
"2a88c2c9821c73ae2a5a4d9e2551f82c03583b9c4dea775423b4748d24eb604e8ee3159b"
"a6de9bea5b22eed6264e011734ed02b2c74ce06dda890b8604ed7ba49e7bf30e28c9871b"
"e90f5cead67eaf52b5d3181c822b10701219b28ef6f6bebfa278e38acf863e2a1d4b1e40"
"fd8a0ac6ce31054446301046148bf10dc3ae3385e2026e7762bdc8003ffebc4263191a59"
"c72f4f90db03e7d52808506b33bfe1dfa53f1a3daa152e83974fbe56cfd4e8f4e7f7806a"
"084b9d0795b858100eced0b5355a72446f37779d6c67ade60a627b8077ae1f3996b03bc3"
"a5c290651c8609f0d879fbf578cbab35086e1159dd6ddbe3bf7fb5654edcc8f09e4f80d0"
"258c9376d7c53fb68f78d333b18b70170d9a11070790c956f5744c78c986b1baf08b7631"
"7a65c5f07ae6f57eb0e65488659324d29709e3735623d0426e90aa8c4629bb080881150c"
"02be1c004da84414ac001c2eb6138c26388f5a36d594f3acef0e69e2cb43b870efa84da0"
"cff9c923a9880202aed64ad76260f53c45bb1584b3e388a909d13586094b924680006a1d"
"25d4dd36c579a8ec9d3fa63c082d977a5a5021440b5314b51850f2daa6e6af6ae88cb5b1"
"44242bceb1d4771e641101f8abfc3a9b19f2de64e35e76458ad22072ba57925d73015de5"
"66c66fcaa28fdc656f90de967ad51afd331e246d74ed469d63dd7d219935c59984bd9629"
"09d1af296eb3121d782650e7d038063bab5fa854aac77de5ffebeb53d263f521e3fc02ac"
"70",
"b0e15d39025f5263e3efa255c1868d4a37041382",
13184,
"fa922061131282d91217a9ff07463843ae34ff7f8c28b6d93b23f1ea031d5020aa92f660"
"8c3d3df0ee24a8958fd41af880ee454e36e26438defb2de8f09c018607c967d2f0e8b80a"
"00c91c0eabe5b4c253e319b45e6106ff8bf0516f866020e5ba3f59fd669c5aeff310ebb3"
"85007069d01c64f72d2b02f4ec0b45c5ecf313056afcb52b17e08b666d01fecc42adb5b4"
"9ea00c60cacac2e0a953f1324bdd44aec00964a22a3cb33916a33da10d74ec6c6577fb37"
"5dc6ac8a6ad13e00cba419a8636d4daac8383a2e98fe90790cde7b59cfaa17c410a52abc"
"d68b127593d2fcbafd30578d195d890e981ae09e6772cb4382404a4e09f1a33c958b57db"
"ccee54ae335b6c91443206a0c100135647b844f226417a1f70317fd350d9f3789d81894a"
"aff4730072401aaeb8b713ead4394e2e64b6917d6eee2549af7bd0952f12035719065320"
"ca0d2dfe2847c6a2357c52bee4a676b12bafff66597bd479aa29299c1896f63a7523a85a"
"b7b916c5930ab66b4d191103cefc74f2f7e0e96e354f65e355ae43959a0af1880d14ea9d"
"1569e4fd47174aba7f5decb430b3f6baf80a1ef27855227b62487250d3602970e423423c"
"7ca90920685bcf75adfbe2a61ce5bd9228947b32f567927cb1a5bd8727c03aef91d6367b"
"ae7d86fd15c0977ac965a88b0d7236037aefb8d24eec8d2a07c633e031a7b9147c4c7714"
"110bfc7e261448a5d0f73c3619664e1c533c81a0acbf95d502227a33f84f0b8249e3f9fa"
"5c7905a8192b7313fc56bb20679e81333d32c797ac5162204a0eaa0e64507635921c485b"
"8f17c4e2484667a733197529e2a833eed83c57229b11bd820b5a5b78f1867787dbc217ea"
"28bfba785fb545cbc5a840a12eea428213e1aaa4e50a900ba13efcf4a5345574c2481c5d"
"927ada610bba567a55630c89d905db3d9b67fe36c9cc3d6a947664c83e69f51c74711a33"
"df66dd3ff6af9b7c1605b614d4798b4192b9a4b1508f2e2ec5aaad7eaea1ee8867353db9"
"b8d7d9a6f16aa5f339492073238c979082879aee7f94ac4be8133eaacbaedfb044e2ad4e"
"93ba0fa071dea615a5cd80d1d2678f4f93ae5a4bc9cdf3df345a29ec41d8febb23805ce4"
"2541036f3f05c63ae736f79a29802045fad9f370cabf843458c1b636ca41f387fd7821c9"
"1abbd1946afcb9186b936403233f28a5b467595131a6bc07b0873e51a08de66b5d7709a6"
"02c1bd0e7f6e8f4beb0579c51bda0e0c738ef876fcd9a40ab7873c9c31c1d63a588eebc7"
"8d9a0ae6fa35cd1a269e0d2bc68252cbd7c08d79e96f0aa6be22a016136a2b8abe9d3c9c"
"f9d60eeafe3dbc76d489b24d68c36167df4c38cf2b21cf03dc5e659e39018c3490f1237e"
"ca3f85b742ab0045d86a899c4126ad60a147cbc95b71814c274d6478668df41eb32acfb4"
"bbf024fb4e3d6be0b60653a0471afc3037ab67dcb00a2b2e24b26911e1880136e56106b7"
"f3c570fbe6f311d94624cb001914ff96fbbf481f71686aa17be0850568058fc1ee8900b4"
"7af5cf51c5ed9e00a8b532c131f42513f6b8df14a9bbc2e9ede5a560681184d41a147552"
"edfbdef98d95e6a7793229d25ba9b0b395a020aa1c0731de89e662246d59ec22e5d8f4b4"
"6fbc048efcffbc234744c5c66417070f9c751c81788f04691ccb1a09d60c46f6f73375bf"
"e2e646cf6290069541a8dfe216374c925e94d06ece72e851e81d3e8acd011f82526c2f9f"
"55955c6752dc10e93153ab58627e30fa2c573e4042954337982eec1f741be058c85bad86"
"bf3a02ed96d3201dadd48bd4de8105200dfcbcc400c3c3dd717abfc562ebe338b14b1eb5"
"ecbe9227661e49c58bf8233770d813faafc78b05711135adcc4ce4c65095ca0bdc1debc0"
"b6e5d195dbc582ce94b3afa14a422edf9b69abd7ae869a78c3a26fb50ef7122ec5af8d0c"
"78ef082ca114f8817c3d93b31809870caea2eb9533fa767c2954efb9ba07e4f1077e9f9b"
"be845661eabea2c91079321477a7c167c7234528d63d6aabbe723e0e337b2e61138a310a"
"3fd04368aa4215b7af9d0334a8a74681bcb86b4af87a0329a1ed9dc7c9aef14521785eda"
"0eeb97bdff8c9945fd0ee04e84d0dae091a69c0bfcdcd4150878fed839c0db6565fc1fed"
"0e7d6ae2efde7a59d58a9fb3b07e6f7cea51ba93f771c18b2eafa252d7fe171085776052"
"a6a17e6858f0a20b7e8be54413523989bf20a028a84d9ce98b78e6ee0b8362df49de5344"
"b409cc322354672a21ea383e870d047551a3af71aaf2f44f49a859cf001e61b592dd036f"
"c6625bf7b91ea0fb78c1563cceb8c4345bf4a9fbe6ee2b6bf5e81083",
"8b6d59106f04300cb57c7c961945cd77f3536b0a",
13976,
"162cca41155de90f6e4b76a34261be6666ef65bdb92b5831b47604ce42e0c6c8d2eda265"
"ab9a3716809bf2e745e7831a41768d0f6349a268d9ac6e6adfb832a5d51b75d7951cf60e"
"03d9e40de6d351f1f6ade5143531cf32839401ca6dfb9dc7473daa607aeb0c3d1e8eb3db"
"cc2f1231ad1dd394d7eac9d8dab726b895b1ee774fdcabc8031063ecfa41c71a9f03ad23"
"904cc056f17c76a1059c43faffe30dfd157fdfd7d792e162bf7a889109550a0fc4c41523"
"2af0c0d72dcbc2595299e1a1c2aeae549f7970e994c15e0ab02f113d740d38c32a4d8ec0"
"79cd099d37d954ab7ef2800902cdf7c7a19fb14b3c98aaf4c6ad93fe9a9bc7a61229828e"
"55ad4d6270d1bdbca9975d450f9be91e5699bd7ee22e8c9c22e355cf1f6793f3551cb510"
"c1d5cd363bdf8cab063e6e49a6383221f1188d64692c1f84c910a696de2e72fb9886193f"
"61ab6b41ad0ea894d37ff1261bf1fd1f187e0d0c38ab223d99ec6d6b1e6b079fc305e24e"
"2d9500c98676e2d587434495d6e107b193c06fb12d5d8eaa7b0c001d08f4d91cae5bdcae"
"6624ee755e95ca8e4c5ef5b903d7f5ba438abeffd6f16d82d88138f157e7a50d1c91fb50"
"c770f6d222fcbf6daf791b1f8379e3b157a3b496ddb2e71650c1c4ac4fc5f2aceb5b3228"
"ffc44e15c02d4baa9434e60928a93f21bc91cfd3c2719f53a8c9bcd2f2dee65a8bbc88f9"
"5d7ced211fc3b04f6e8b74eb2026d66fd57fa0cccea43f0a0381782e6fee5660afed674d"
"cb2c28cb54d2bdbbaf78e534b0742ede6b5e659b46cd516d5362a194dd0822f6417935c4"
"ff05815b118fe5687cd8b050240015cfe449d9dfde1f4fdb105586e429b2c1849aac2791"
"ef73bc54603190eba39037ec057e784bb92d497e705dfcde2addb3514b4f1926f12d5440"
"850935779019b23bd0f2977a8c9478c424a7eaaeec04f3743a77bee2bec3937412e707bc"
"92a070046e2f9c35fe5cc3f755bbb91a182e683591ab7e8cff40633730546e81522f588f"
"07bdf142b78e115d2a22d2eb5664fcdb7574c1ee5ba9abd307d7d29078cd5223c222fc69"
"60324c40cc639be84dad96b01059efce7b08538ebef89bafab834609c7e82774a14e5be6"
"62067edba6111efa8ae270f5066442b17e3f31a793581c8a3f96d92921ec26981594e28a"
"08987d020b97ad2ba5c662836e35fd3fd954bcec52b579528913959d0d942fbf1c4b9910"
"ba010c3700359a4eb7616541257f0f7727cc71b580cc903f718ecc408a315b6bbfa7f6e3"
"beb9d258804bd2731ee2fb75e763281baf1effc4690a23d5f952ab5d4311d4f5885af2eb"
"f27cad9f6d84692cb903064bbd11ca751f919b4811b7722c6ec80c360521e34d357b5c8b"
"ba6d42e5c632730f53add99ab8aa9c607b6796216753086ede158bc670d04900aca66ce8"
"357bd72d19fb147b5fde8ee4df6a0184573a2e65ba3fd3a0cb04dac5eb36d17d2f639a6e"
"b602645f3ab4da9de4c9999d6506e8e242a5a3216f9e79a4202558ecdc74249ad3caaf90"
"71b4e653338b48b3ba3e9daf1e51e49384268d63f37ce87c6335de79175cdf542d661bcd"
"74b8f5107d6ab492f54b7c3c31257ecb0b426b77ed2e2ed22bbfdaf49653e1d54e5988fa"
"d71397546f9955659f22b3a4117fc823a1e87d6fb6fb8ab7d302a1316975e8baf0c0adbd"
"35455655f6a596b6ac3be7c9a8ea34166119d5e70dfbc1aa6e14ff98eff95e94ef576656"
"5d368ec8857fb0b029bcb990d420a5ca6bc7ab08053eb4dbfc4612a345d56faefc5e03a4"
"43520b224de776a5b618e1aa16edc513d5fcefcd413031b0ddc958a6fca45d108fbde065"
"3cf2d11cb00a71cd35f57993875598b4e33e2384623a0986859105d511c717c21d6534bf"
"69fd3d7cf1682e4fc25298d90df951e77a316996beac61bb7078988118c906548af92cfe"
"72cd4b102ffad584e5e721a0cdb5621ed07dda8955d84bea57a5afa4ba06289ddfac3a9e"
"765538fd9392fc7904cedb65e38cd90967f01845ff819777a22d199f608e62c13e6ba98b"
"40824b38c784bdb41d62c4014fc7e8d93be52695e975e54d1ff92b412f451177143d74a6"
"bde0ee53a986043ab465a1ef315ac4c538e775ef4178fde5f2ea560a364de18b8fe9578a"
"ad80027c3fd32dcf0967d9d03789b1cdf19040762f626289cf3af8afe5a8e0a152d9258e"
"981872c1ec95cd7f8d65812e55cb5cbd8db61b3f068a23d9652372dfbf18d43a663c5a0d"
"026b0898e383ce5c95b0ba7fb5ed6b7304c7c9d3ba64f38d1dc579465148ccfa7271f2e3"
"e0e97e9ddac7c0874f0f396cf07851638a734df393687b7b0343afd1652ff32a2da17b3a"
"4c99d79c02256c73f32625527e5666594a8a42a12135eddb022e743371b3ab7b12ad6785"
"7635eed03558ac673d17280769b2368056276d5d72f5dbc75525f8a7558bd90b544aa6cb"
"dd964e6c70be79441969bfdf471f17a2dc0c92",
"6144c4786145852e2a01b20604c369d1b9721019",
14768,
"c9bed88d93806b89c2d028866842e6542ab88c895228c96c1f9f05125f8697c7402538b0"
"6465b7ae33daef847500f73d20c598c86e4804e633e1c4466e61f3ed1e9baadc5723bbed"
"9455a2ff4f99b852cfe6aa3442852ade0b18e4995ddab4250928165a9441de108d4a293d"
"1d95935de022aa17f366a31d4f4c4c54557a4235a9d56473444787ddc5c06c87087aef24"
"fa8280b7ac74d76ba685e4be7dc705e5a8a97c6c8fbd201ee5bf522438d23371c60c155d"
"93352f8fb8cc9421fe4b66ffabad46909c2c1099944fc55ed424c90aecca4f50d0331153"
"2e2844c3ff8ecb495de7ab26941cbf177b79ad7b05f918b713c417da8cf6e67db0a2dcee"
"a9179d8d636191759e13955f4244f0c4f2d88842e3015641ef0417d6e54144e8246e4591"
"6823e2c6e39bfa3b90b97781c44981710689f2ce20e70a26760d65f9971b291e12338461"
"8b3b56710dde2afaa2d46b0e2164d5c9482729350a0e256b2aa6b3fb099b618ebd7c11ca"
"62bdf176b502aedfdf9be57a8e4adbca4a4d6d8407984af2f6635f95a1e4930e375eb53f"
"245ab2ade5340c281bda87afded1268e537955c9819168bd60fd440533c75c9b1865e03f"
"de3a301d165f97aa6da236cf39cf3e49512f6350224f8d76ff02d0d3b9a99e5f70b23b9f"
"a85f72849fc98790df246c3a0f4437940e60d42b4317f72e2eb055d343a614f7f9648005"
"1e4dff186dff476462d9ced24dbb82eaa60cbbf6a0026e64001da36d30f529f48f3688b1"
"0ce9378ef3f50f5106e5007cd0eb037136254fda4f20d048769bd51a9d8d09a1e469a482"
"6aa0e25b6267b5a96abcb6e919a362fdd7b683d2f2dcec40ee5969311c07f6066ee22f36"
"89ca08381c85bea470040e9541e7a451cd43d62c2aa292a9dc4b95e3a7c4de2ba29663f3"
"8d5002eb64ceba6934bb1b0e2e55fba7fa706b514ebeeae1be4dd882d6512da066246a05"
"1d8bd042593bd0513e9cc47806ccdc7097e75bc75b8603834c85cd084e0ade3cc2c2b7e8"
"586eac62249f9769f5bdcd50e24e515f257548762db9adf3ee0846d67cfcd723d85d9588"
"09e6dd406f4c2637557c356fc52490a2a0763429ee298a1c72c098bb810e740c15faffc6"
"1e80cf6e18f86dc0e29bc150ce43ca71f5729356cd966277fd8b32366f6263c3a761b13d"
"544a631a25e1c4c8dea8d794abed47ccb4069d20f1dcb54e40a673ffb5f7b2eb31fb7d44"
"36fd8252f92dc35bb9a18fc55099b17e0807e79caf4f9641ee4bbbc2d6922508bcfae236"
"475bf78bc796548bc8d60659e816af68e5e43352fa64b5086c97c22c60ddcbbbefb9d9ef"
"7cd57c64454604793910f4f90aedb4fb824a86061a93bb79c9b0272a1ad0d24e8165f099"
"ef6f14a6a4fea09845f280022e061804090d7ab79f7bddcbef264b6f7d4e9971eddb9ca7"
"d0e79a8dbe7cff2fa59f514a608d66ae8c44d5e69745aa1b19995e366812064567d3ca20"
"9e12994c901d1b1f489be7253615f7c339b5581afd4d262e879ab8480ecb18990d3db61f"
"96895dcde9c065e645f52baafefcbe34d072dba373fd1c786fd56c3f3284be7260eaff9a"
"6a8348b762ed59e20ea443313b1164db53c3989c32fcae5b366f190b9548e8cff46df961"
"350369b490354ed8e530a91f5072967eff45c63540862fb2deab02b3ae05deac65414368"
"ac3549f277da92b692947de47cba9c1579526931e31c3490c1d3605f9bafcf468c2e9b47"
"981407ea40b0b59754621943095a2d4f4ba266ac545fe7447e54f69555a7ac9ff1e8f001"
"834fa65f2d4523061726e4d3bf4680519032dc21b7389e9f3229e4c2295d354482f8b803"
"b06ca3a8cb3ff786e60f6bc59dd3a5bfed63b0aa493bab78e97bbefb6633534d84de826f"
"4e2ccc3069050d50a2caace6c9de15ffc2656988d94b736e5688df0351a3a6a4c875cd99"
"ef304f3cc7a0585df2b0b3e6c62f86bba0d43de47b80c4eec1c4f98e60a36188219919cf"
"36dc10ee11e174a67d226ad9e71f02a7fca26ad67a4862773f3defc6a747545314063e5f"
"ce7a3f890ec57daa5532acfd027739832437c8a58dcbe11c2842e60e8ca64979d081fbd5"
"a1a028f59317212fb5869abc689a156171d69e4f4c93b949c3459904c00192d3603cd184"
"48d64b843c57f34aee7830f313e58e2abc41b44be46a96c845ffebcb7120e21d1d751046"
"c072adf65dd901a39c8019742054be5e159ea88d0885ee05fcd4c189bafe5abb68603186"
"5dc570b9342fa7f41fd5c1c87e68371ab19a83c82ae1d890c678102d5da8e6c29845657c"
"027ba07362cba4d24950ab38e747925e22ce8df9eaec1ae2c6d23374b360c8352feb6cb9"
"913e4fc49bde6caf5293030d0d234a8ecd616023cc668262591f812de208738e5336a9e6"
"9f9be2479b86be1e1369761518dfc93797ed3a55308878a944581eba50bc9c7f7a0e75c7"
"6a28acd95b277857726f3f684eefc215e0a696f47d65d30431d710d957c08ef96682b385"
"0ee5ba1c8417aafc1af2846a127ec155b4b7fb369e90eb3a5c3793a3389bbc6b532ca32b"
"f5e1f03c2280e71c6e1ae21312d4ff163eee16ebb1fdee8e887bb0d453829b4e6ed5fa70"
"8f2053f29b81e277be46",
"a757ead499a6ec3d8ab9814f839117354ae563c8"
};
void test_sha1(void)
{
unsigned char buffer[4000];
int i;
for (i=0; i < sizeof(sha1_tests) / sizeof(sha1_tests[0]); ++i) {
stb_uint len = sha1_tests[i].length / 8;
unsigned char digest[20], fdig[20];
unsigned int h;
assert(len <= sizeof(buffer));
assert(strlen(sha1_tests[i].message) == len*2);
assert(strlen(sha1_tests[i].digest) == 20 * 2);
for (h=0; h < len; ++h) {
char v[3];
v[0] = sha1_tests[i].message[h*2];
v[1] = sha1_tests[i].message[h*2+1];
v[2] = 0;
buffer[h] = (unsigned char) strtol(v, NULL, 16);
}
stb_sha1(digest, buffer, len);
for (h=0; h < 20; ++h) {
char v[3];
int res;
v[0] = sha1_tests[i].digest[h*2];
v[1] = sha1_tests[i].digest[h*2+1];
v[2] = 0;
res = digest[h] == strtol(v, NULL, 16);
c(res, sha1_tests[i].digest);
if (!res)
break;
}
{
int z;
FILE *f = fopen("data/test.bin", "wb");
if (!f) stb_fatal("Couldn't write to test.bin");
fwrite(buffer, len, 1, f);
fclose(f);
#ifdef _WIN32
z = stb_sha1_file(fdig, "data/test.bin");
if (!z) stb_fatal("Couldn't digest test.bin");
c(memcmp(digest, fdig, 20)==0, "stb_sh1_file");
#endif
}
}
}
#if 0
stb__obj zero, one;
void test_packed_floats(void)
{
stb__obj *p;
float x,y,*q;
clock_t a,b,c;
int i;
stb_float_init();
for (i=-10; i < 10; ++i) {
float f = (float) pow(10,i);
float g = f * 10;
float delta = (g - f) / 10000;
while (f < g) {
stb__obj z = stb_float(f);
float k = stb_getfloat(z);
float p = stb_getfloat_table(z);
assert((z & 1) == 1);
assert(f == k);
assert(k == p);
f += delta;
}
}
zero = stb_float(0);
one = stb_float(1);
p = malloc(8192 * 4);
for (i=0; i < 8192; ++i)
p[i] = stb_rand();
for (i=0; i < 8192; ++i)
if ((stb_rand() & 31) < 28)
p[i] = zero;
q = malloc(4 * 1024);
a = clock();
x = y = 0;
for (i=0; i < 200000000; ++i)
q[i&1023] = stb_getfloat_table(p[i&8191]);
b = clock();
for (i=0; i < 200000000; ++i)
q[i&1023] = stb_getfloat_table2(p[i&8191]);
c = clock();
free(p);
free(q);
printf("Table: %d\nIFs: %d\n", b-a, c-b);
}
#endif
void do_compressor(int argc,char**argv)
{
char *p;
int len;
int window;
if (argc == 2) {
p = stb_file(argv[1], &len);
if (p) {
int dlen, clen = stb_compress_tofile("data/dummy.bin", p, len);
char *q = stb_decompress_fromfile("data/dummy.bin", &dlen);
if (len != dlen) {
printf("FAILED %d -> %d\n", len, clen);
} else {
int z = memcmp(q,p,dlen);
if (z != 0)
printf("FAILED %d -> %d\n", len, clen);
else
printf("%d -> %d\n", len, clen);
}
}
return;
}
window = atoi(argv[1]);
if (window && argc == 4) {
p = stb_file(argv[3], &len);
if (p) {
stb_compress_hashsize(window);
stb_compress_tofile(argv[2], p, len);
}
} else if (argc == 3) {
p = stb_decompress_fromfile(argv[2], &len);
if (p) {
FILE *f = fopen(argv[1], "wb");
fwrite(p,1,len,f);
fclose(f);
} else {
fprintf(stderr, "FAILED.\n");
}
} else {
fprintf(stderr, "Usage: stb