~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to librib2/tests/ribprinter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "librib.h"
 
2
#include "librib2stream.h"
 
3
 
 
4
#include <iostream>
 
5
#include <fstream>
 
6
 
 
7
RtBasis RiBezierBasis   = {{ -1, 3, -3, 1},
 
8
                         {3, -6, 3, 0},
 
9
                         { -3, 3, 0, 0},
 
10
                         {1, 0, 0, 0}};
 
11
RtBasis RiBSplineBasis  = {{ -1, 3, -3, 1},
 
12
                          {3, -6, 3, 0},
 
13
                          { -3, 0, 3, 0},
 
14
                          {1, 4, 1, 0}};
 
15
RtBasis RiCatmullRomBasis       = {{ -1, 3, -3, 1},
 
16
                             {2, -5, 4, -1},
 
17
                             { -1, 0, 1, 0},
 
18
                             {0, 2, 0, 0}};
 
19
RtBasis RiHermiteBasis  = {{ 2, 1, -2, 1},
 
20
                          { -3, -2, 3, -1},
 
21
                          {0, 1, 0, 0},
 
22
                          {1, 0, 0, 0}};
 
23
RtBasis RiPowerBasis    = {{ 1, 0, 0, 0},
 
24
                        {0, 1, 0, 0},
 
25
                        {0, 0, 1, 0},
 
26
                        {0, 0, 0, 1}};
 
27
 
 
28
int main( int argc, char* argv[] )
 
29
{
 
30
    if ( argc < 2 )
 
31
    {
 
32
        std::cerr << argv[ 0 ] << " usage: " << argv[ 0 ] << " ribfile1, [ribfile2 ...]" << std::endl;
 
33
        return 1;
 
34
    }
 
35
 
 
36
    for ( int i = 1; i < argc; i++ )
 
37
    {
 
38
        FILE* file = fopen( argv[ i ], "rb" );
 
39
        if ( NULL == file )
 
40
        {
 
41
            std::cerr << argv[ 0 ] << ": error opening " << argv[ i ] << ", aborting." << std::endl;
 
42
            return 2;
 
43
        }
 
44
 
 
45
        librib2stream::Stream stream( std::cout );
 
46
        librib::StandardDeclarations( stream );
 
47
        if ( !librib::Parse( file, argv[ i ], stream, std::cerr, NULL ) )
 
48
        {
 
49
            fclose( file );
 
50
            return 3;
 
51
        }
 
52
        fclose( file );
 
53
        librib::CleanupDeclarations( stream );
 
54
    }
 
55
 
 
56
    return 0;
 
57
}
 
58