utils/testparse.c
author Ryan C. Gordon <icculus@icculus.org>
Sun, 29 May 2011 17:34:12 -0400
changeset 1028 74e7ee46ac93
parent 1019 e8988ca01c6d
child 1030 a407c516e325
permissions -rw-r--r--
Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
244
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     1
/**
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     2
 * MojoShader; generate shader programs from bytecode of compiled
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     3
 *  Direct3D shaders.
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     4
 *
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     5
 * Please see the file LICENSE.txt in the source's root directory.
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     6
 *
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     7
 *  This file written by Ryan C. Gordon.
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     8
 */
30ceb789b9a1 More comment headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 192
diff changeset
     9
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
    10
#include <stdio.h>
9
aea1b254e6a5 [svn] Patched to compile.
icculus
parents: 7
diff changeset
    11
#include <stdlib.h>
37
63b5ba0bcda0 [svn] Update testparse for renames.
icculus
parents: 18
diff changeset
    12
#include "mojoshader.h"
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
    13
254
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 244
diff changeset
    14
#ifdef _MSC_VER
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 244
diff changeset
    15
#define snprintf _snprintf
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 244
diff changeset
    16
#endif
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    17
50
427f32b5eeff [svn] Fixed test malloc.
icculus
parents: 48
diff changeset
    18
#if MOJOSHADER_DEBUG_MALLOC
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    19
static void *Malloc(int len)
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    20
{
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    21
    void *ptr = malloc(len + sizeof (int));
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    22
    int *store = (int *) ptr;
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    23
    printf("malloc() %d bytes (%p)\n", len, ptr);
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    24
    if (ptr == NULL) return NULL;
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    25
    *store = len;
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    26
    return (void *) (store + 1);
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    27
} // Malloc
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    28
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    29
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    30
static void Free(void *_ptr)
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    31
{
50
427f32b5eeff [svn] Fixed test malloc.
icculus
parents: 48
diff changeset
    32
    int *ptr = (((int *) _ptr) - 1);
427f32b5eeff [svn] Fixed test malloc.
icculus
parents: 48
diff changeset
    33
    int len = *ptr;
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    34
    printf("free() %d bytes (%p)\n", len, ptr);
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    35
    free(ptr);
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    36
} // Free
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    37
#else
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    38
#define Malloc NULL
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    39
#define Free NULL
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    40
#endif
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    41
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    42
static inline void do_indent(const unsigned int indent)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    43
{
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    44
    unsigned int i;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    45
    for (i = 0; i < indent; i++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    46
        printf("    ");
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    47
}
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    48
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    49
#define INDENT() do { if (indent) { do_indent(indent); } } while (0)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    50
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
    51
48
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 47
diff changeset
    52
static const char *shader_type(const MOJOSHADER_shaderType s)
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    53
{
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    54
    switch (s)
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    55
    {
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    56
        case MOJOSHADER_TYPE_UNKNOWN: return "unknown";
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    57
        case MOJOSHADER_TYPE_PIXEL: return "pixel";
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    58
        case MOJOSHADER_TYPE_VERTEX: return "vertex";
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    59
        case MOJOSHADER_TYPE_GEOMETRY: return "geometry";
48
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 47
diff changeset
    60
        default: return "(bogus value?)";
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    61
    } // switch
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    62
48
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 47
diff changeset
    63
    return NULL;  // shouldn't hit this.
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    64
} // shader_type
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    65
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
    66
1028
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    67
static void print_typeinfo(const MOJOSHADER_symbolTypeInfo *info,
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    68
                           unsigned int indent)
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    69
{
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    70
    static const char *symclasses[] = {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    71
        "scalar", "vector", "row-major matrix",
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    72
        "column-major matrix", "object", "struct"
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    73
    };
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    74
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    75
    static const char *symtypes[] = {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    76
        "void", "bool", "int", "float", "string", "texture",
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    77
        "texture1d", "texture2d", "texture3d", "texturecube",
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    78
        "sampler", "sampler1d", "sampler2d", "sampler3d",
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    79
        "samplercube", "pixelshader", "vertexshader", "unsupported"
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    80
    };
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    81
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    82
    INDENT();
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    83
    printf("      symbol class %s\n", symclasses[info->parameter_class]);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    84
    INDENT();
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    85
    printf("      symbol type %s\n", symtypes[info->parameter_type]);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    86
    INDENT();
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    87
    printf("      rows %u\n", info->rows);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    88
    INDENT();
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    89
    printf("      columns %u\n", info->columns);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    90
    INDENT();
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    91
    printf("      elements %u\n", info->elements);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    92
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    93
    if (info->member_count > 0)
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    94
    {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    95
        int i;
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    96
        INDENT(); printf("      MEMBERS:\n");
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    97
        for (i = 0; i < info->member_count; i++)
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    98
        {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
    99
            const MOJOSHADER_symbolStructMember *member = &info->members[i];
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   100
            INDENT(); printf("      MEMBERS:\n");
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   101
            indent++;
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   102
            INDENT(); printf("      * %d: \"%s\"\n", i, member->name);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   103
            print_typeinfo(&member->info, indent);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   104
            indent--;
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   105
        } // for
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   106
    } // if
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   107
} // print_typeinfo
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   108
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   109
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   110
static void print_shader(const char *fname, const MOJOSHADER_parseData *pd,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   111
                         unsigned int indent)
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
   112
{
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   113
    INDENT(); printf("PROFILE: %s\n", pd->profile);
536
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   114
    if (pd->error_count > 0)
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   115
    {
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   116
        int i;
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   117
        for (i = 0; i < pd->error_count; i++)
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   118
        {
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   119
            const MOJOSHADER_error *err = &pd->errors[i];
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   120
            INDENT();
577
bec531dd448e Report filenames in error messages.
Ryan C. Gordon <icculus@icculus.org>
parents: 536
diff changeset
   121
            printf("%s:%d: ERROR: %s\n",
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   122
                    err->filename ? err->filename : fname,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   123
                    err->error_position, err->error);
536
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   124
        } // for
5af65fe6e917 Allow multiple errors from parsing.
Ryan C. Gordon <icculus@icculus.org>
parents: 475
diff changeset
   125
    } // if
53
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   126
    else
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   127
    {
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   128
        INDENT(); printf("SHADER TYPE: %s\n", shader_type(pd->shader_type));
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   129
        INDENT(); printf("VERSION: %d.%d\n", pd->major_ver, pd->minor_ver);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   130
        INDENT(); printf("INSTRUCTION COUNT: %d\n", (int) pd->instruction_count);
100
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   131
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   132
        INDENT(); printf("ATTRIBUTES:");
100
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   133
        if (pd->attribute_count == 0)
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   134
            printf(" (none.)\n");
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   135
        else
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   136
        {
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   137
            int i;
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   138
            printf("\n");
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   139
            for (i = 0; i < pd->attribute_count; i++)
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   140
            {
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   141
                static const char *usagenames[] = {
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   142
                    "position", "blendweight", "blendindices", "normal",
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   143
                    "psize", "texcoord", "tangent", "binormal", "tessfactor",
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   144
                    "positiont", "color", "fog", "depth", "sample"
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   145
                };
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   146
                const MOJOSHADER_attribute *a = &pd->attributes[i];
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   147
                char numstr[16] = { 0 };
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   148
                if (a->index != 0)
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   149
                    snprintf(numstr, sizeof (numstr), "%d", a->index);
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   150
                INDENT();
192
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   151
                printf("    * %s%s", usagenames[(int) a->usage], numstr);
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   152
                if (a->name != NULL)
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   153
                    printf(" (\"%s\")", a->name);
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   154
                printf("\n");
100
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   155
            } // for
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   156
        } // else
2b88649b6f98 First shot at attributes reporting API.
Ryan C. Gordon <icculus@icculus.org>
parents: 97
diff changeset
   157
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   158
        INDENT(); printf("CONSTANTS:");
278
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   159
        if (pd->constant_count == 0)
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   160
            printf(" (none.)\n");
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   161
        else
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   162
        {
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   163
            int i;
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   164
            printf("\n");
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   165
            for (i = 0; i < pd->constant_count; i++)
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   166
            {
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   167
                static const char *typenames[] = { "float", "int", "bool" };
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   168
                const MOJOSHADER_constant *c = &pd->constants[i];
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   169
                INDENT(); 
278
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   170
                printf("    * %d: %s (", c->index, typenames[(int) c->type]);
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   171
                if (c->type == MOJOSHADER_UNIFORM_FLOAT)
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   172
                {
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   173
                    printf("%f %f %f %f", c->value.f[0], c->value.f[1],
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   174
                                          c->value.f[2], c->value.f[3]);
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   175
                } // if
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   176
                else if (c->type == MOJOSHADER_UNIFORM_INT)
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   177
                {
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   178
                    printf("%d %d %d %d", c->value.i[0], c->value.i[1],
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   179
                                          c->value.i[2], c->value.i[3]);
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   180
                } // else if
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   181
                else if (c->type == MOJOSHADER_UNIFORM_BOOL)
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   182
                {
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   183
                    printf("%s", c->value.b ? "true" : "false");
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   184
                } // else if
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   185
                else
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   186
                {
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   187
                    printf("???");
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   188
                } // else
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   189
                printf(")\n");
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   190
            } // for
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   191
        } // else
5c432d216078 Report hardcoded constants in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
   192
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   193
        INDENT(); printf("UNIFORMS:");
92
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   194
        if (pd->uniform_count == 0)
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   195
            printf(" (none.)\n");
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   196
        else
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   197
        {
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   198
            int i;
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   199
            printf("\n");
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   200
            for (i = 0; i < pd->uniform_count; i++)
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   201
            {
94
57adfb4769a0 Simplifed public uniform information.
Ryan C. Gordon <icculus@icculus.org>
parents: 92
diff changeset
   202
                static const char *typenames[] = { "float", "int", "bool" };
92
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   203
                const MOJOSHADER_uniform *u = &pd->uniforms[i];
280
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   204
                const char *arrayof = "";
438
73492129c1af Expose true constant arrays in parseData, load them at link time for GLSL.
Ryan C. Gordon <icculus@icculus.org>
parents: 280
diff changeset
   205
                const char *constant = u->constant ? "const " : "";
280
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   206
                char arrayrange[64] = { '\0' };
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   207
                if (u->array_count > 0)
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   208
                {
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   209
                    arrayof = "array[";
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   210
                    snprintf(arrayrange, sizeof (arrayrange), "%d] ",
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   211
                             u->array_count);
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   212
                } // if
61b2abd9c927 Relative addressing fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 278
diff changeset
   213
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   214
                INDENT();
438
73492129c1af Expose true constant arrays in parseData, load them at link time for GLSL.
Ryan C. Gordon <icculus@icculus.org>
parents: 280
diff changeset
   215
                printf("    * %d: %s%s%s%s", u->index, constant, arrayof,
73492129c1af Expose true constant arrays in parseData, load them at link time for GLSL.
Ryan C. Gordon <icculus@icculus.org>
parents: 280
diff changeset
   216
                        arrayrange, typenames[(int) u->type]);
192
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   217
                if (u->name != NULL)
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   218
                    printf(" (\"%s\")", u->name);
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   219
                printf("\n");
92
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   220
            } // for
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   221
        } // else
bc1bb138e855 Implemented foundation for reporting uniforms to calling app.
Ryan C. Gordon <icculus@icculus.org>
parents: 53
diff changeset
   222
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   223
        INDENT(); printf("SAMPLERS:");
148
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   224
        if (pd->sampler_count == 0)
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   225
            printf(" (none.)\n");
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   226
        else
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   227
        {
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   228
            int i;
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   229
            printf("\n");
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   230
            for (i = 0; i < pd->sampler_count; i++)
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   231
            {
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   232
                static const char *typenames[] = { "2d", "cube", "volume" };
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   233
                const MOJOSHADER_sampler *s = &pd->samplers[i];
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   234
                INDENT();
192
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   235
                printf("    * %d: %s", s->index, typenames[(int) s->type]);
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   236
                if (s->name != NULL)
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   237
                    printf(" (\"%s\")", s->name);
e7c864575d1c Print variable names in testparse.c.
Ryan C. Gordon <icculus@icculus.org>
parents: 148
diff changeset
   238
                printf("\n");
148
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   239
            } // for
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   240
        } // else
645003ec6623 Hopefully sorted out the reported uniform/attribute mess.
Ryan C. Gordon <icculus@icculus.org>
parents: 142
diff changeset
   241
1028
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   242
        INDENT(); printf("SYMBOLS:");
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   243
        if (pd->symbol_count == 0)
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   244
            printf(" (none.)\n");
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   245
        else
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   246
        {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   247
            int i;
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   248
            printf("\n");
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   249
            for (i = 0; i < pd->symbol_count; i++)
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   250
            {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   251
                static const char *regsets[] = {
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   252
                    "bool", "int4", "float4", "sampler"
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   253
                };
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   254
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   255
                const MOJOSHADER_symbol *sym = &pd->symbols[i];
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   256
                INDENT(); printf("    * %d: \"%s\"\n", i, sym->name);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   257
                INDENT(); printf("      register set %s\n", regsets[sym->register_set]);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   258
                INDENT(); printf("      register index %u\n", sym->register_index);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   259
                INDENT(); printf("      register count %u\n", sym->register_count);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   260
                print_typeinfo(&sym->info, indent);
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   261
            } // for
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   262
            printf("\n");
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   263
        } // else
74e7ee46ac93 Parse symbols in the CTAB, export them in MOJOSHADER_parseData.
Ryan C. Gordon <icculus@icculus.org>
parents: 1019
diff changeset
   264
53
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   265
        if (pd->output != NULL)
113
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   266
        {
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   267
            int i;
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   268
            INDENT();
113
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   269
            printf("OUTPUT:\n");
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   270
            indent++;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   271
            INDENT();
113
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   272
            for (i = 0; i < pd->output_len; i++)
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   273
            {
113
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   274
                putchar((int) pd->output[i]);
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   275
                if (pd->output[i] == '\n')
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   276
                    INDENT();
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   277
            } // for
113
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   278
            printf("\n");
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   279
            indent--;
113
8ebf445c5305 Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Ryan C. Gordon <icculus@icculus.org>
parents: 100
diff changeset
   280
        } // if
53
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   281
    } // else
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
   282
    printf("\n\n");
1019
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   283
} // print_shader
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   284
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   285
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   286
static void print_effect(const char *fname, const MOJOSHADER_effect *effect,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   287
                         const unsigned int indent)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   288
{
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   289
    INDENT(); printf("PROFILE: %s\n", effect->profile);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   290
    printf("\n");
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   291
    if (effect->error_count > 0)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   292
    {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   293
        int i;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   294
        for (i = 0; i < effect->error_count; i++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   295
        {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   296
            const MOJOSHADER_error *err = &effect->errors[i];
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   297
            INDENT();
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   298
            printf("%s:%d: ERROR: %s\n",
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   299
                    err->filename ? err->filename : fname,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   300
                    err->error_position, err->error);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   301
        } // for
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   302
    } // if
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   303
    else
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   304
    {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   305
        int i, j, k;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   306
        const MOJOSHADER_effectTechnique *technique = effect->techniques;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   307
        const MOJOSHADER_effectTexture *texture = effect->textures;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   308
        const MOJOSHADER_effectShader *shader = effect->shaders;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   309
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   310
        for (i = 0; i < effect->technique_count; i++, technique++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   311
        {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   312
            const MOJOSHADER_effectPass *pass = technique->passes;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   313
            INDENT(); printf("TECHNIQUE #%d ('%s'):\n", i, technique->name);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   314
            for (j = 0; j < technique->pass_count; j++, pass++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   315
            {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   316
                const MOJOSHADER_effectState *state = pass->states;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   317
                INDENT(); printf("    PASS #%d ('%s'):\n", j, pass->name);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   318
                for (k = 0; k < pass->state_count; k++, state++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   319
                {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   320
                    INDENT(); printf("        STATE 0x%X\n", state->type);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   321
                } // for
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   322
            } // for
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   323
            printf("\n");
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   324
        } // for
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   325
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   326
        for (i = 0; i < effect->texture_count; i++, texture++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   327
        {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   328
            INDENT();
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   329
            printf("TEXTURE #%d ('%s'): %u\n", i,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   330
                    texture->name, texture->param);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   331
        } // for
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   332
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   333
        printf("\n");
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   334
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   335
        for (i = 0; i < effect->shader_count; i++, shader++)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   336
        {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   337
            INDENT();
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   338
            printf("SHADER #%d: technique %u, pass %u\n", i,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   339
                    shader->technique, shader->pass);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   340
            print_shader(fname, shader->shader, indent + 1);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   341
        } // for
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   342
    } // else
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   343
} // print_effect
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   344
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   345
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   346
static int do_parse(const char *fname, const unsigned char *buf,
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   347
                    const int len, const char *prof)
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   348
{
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   349
    int retval = 0;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   350
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   351
    // magic for an effects file (!!! FIXME: I _think_).
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   352
    if ( (buf[0] == 0x01) && (buf[1] == 0x09) &&
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   353
         (buf[2] == 0xFF) && (buf[3] == 0xFE) )
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   354
    {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   355
        const MOJOSHADER_effect *effect;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   356
        effect = MOJOSHADER_parseEffect(prof, buf, len, 0, 0, Malloc, Free, 0);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   357
        retval = (effect->error_count == 0);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   358
        printf("EFFECT: %s\n", fname);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   359
        print_effect(fname, effect, 1);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   360
        MOJOSHADER_freeEffect(effect);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   361
    } // if
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   362
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   363
    else  // do it as a regular compiled shader.
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   364
    {
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   365
        const MOJOSHADER_parseData *pd;
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   366
        pd = MOJOSHADER_parse(prof, buf, len, NULL, 0, Malloc, Free, NULL);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   367
        retval = (pd->error_count == 0);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   368
        printf("SHADER: %s\n", fname);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   369
        print_shader(fname, pd, 1);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   370
        MOJOSHADER_freeParseData(pd);
e8988ca01c6d Initial work on parsing binary Effects files.
Ryan C. Gordon <icculus@icculus.org>
parents: 902
diff changeset
   371
    } // else
142
e064b4cefb4e Return a more-meaningful pass/fail error code from testparse main().
Ryan C. Gordon <icculus@icculus.org>
parents: 113
diff changeset
   372
e064b4cefb4e Return a more-meaningful pass/fail error code from testparse main().
Ryan C. Gordon <icculus@icculus.org>
parents: 113
diff changeset
   373
    return retval;
46
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
   374
} // do_parse
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
   375
ff5a0ec44f00 [svn] Lots and lots of work on the public API.
icculus
parents: 37
diff changeset
   376
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   377
int main(int argc, char **argv)
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   378
{
142
e064b4cefb4e Return a more-meaningful pass/fail error code from testparse main().
Ryan C. Gordon <icculus@icculus.org>
parents: 113
diff changeset
   379
    int retval = 0;
e064b4cefb4e Return a more-meaningful pass/fail error code from testparse main().
Ryan C. Gordon <icculus@icculus.org>
parents: 113
diff changeset
   380
47
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   381
    printf("MojoShader testparse\n");
901
a9f799b93150 Report changeset, not version.
Ryan C. Gordon <icculus@icculus.org>
parents: 588
diff changeset
   382
    printf("Compiled against changeset %s\n", MOJOSHADER_CHANGESET);
a9f799b93150 Report changeset, not version.
Ryan C. Gordon <icculus@icculus.org>
parents: 588
diff changeset
   383
    printf("Linked against changeset %s\n", MOJOSHADER_changeset());
47
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   384
    printf("\n");
37
63b5ba0bcda0 [svn] Update testparse for renames.
icculus
parents: 18
diff changeset
   385
53
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   386
    if (argc <= 2)
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   387
        printf("\n\nUSAGE: %s <profile> [file1] ... [fileN]\n\n", argv[0]);
47
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   388
    else
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   389
    {
53
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   390
        const char *profile = argv[1];
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   391
        int i;
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   392
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   393
        for (i = 2; i < argc; i++)
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   394
        {
47
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   395
            FILE *io = fopen(argv[i], "rb");
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   396
            if (io == NULL)
53
8c856f73908e [svn] More testparse tweakage.
icculus
parents: 50
diff changeset
   397
                printf(" ... fopen('%s') failed.\n", argv[i]);
47
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   398
            else
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   399
            {
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   400
                unsigned char *buf = (unsigned char *) malloc(1000000);
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   401
                int rc = fread(buf, 1, 1000000, io);
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   402
                fclose(io);
902
cff5841d29e7 Report actual filename in errors.
Ryan C. Gordon <icculus@icculus.org>
parents: 901
diff changeset
   403
                if (!do_parse(argv[i], buf, rc, profile))
142
e064b4cefb4e Return a more-meaningful pass/fail error code from testparse main().
Ryan C. Gordon <icculus@icculus.org>
parents: 113
diff changeset
   404
                    retval = 1;
47
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   405
                free(buf);
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   406
            } // else
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   407
        } // for
49953c7cb142 [svn] Some testparse cleanups.
icculus
parents: 46
diff changeset
   408
    } // else
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   409
142
e064b4cefb4e Return a more-meaningful pass/fail error code from testparse main().
Ryan C. Gordon <icculus@icculus.org>
parents: 113
diff changeset
   410
    return retval;
7
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   411
} // main
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   412
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   413
// end of testparse.c ...
18bf77bb8c07 [svn] Cleanups, split things out.
icculus
parents:
diff changeset
   414