open-axiom repository from github
/*1Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.2All rights reserved.3Copyright (C) 2007-2008, Gabriel Dos Reis.4all rights reserved.56Redistribution and use in source and binary forms, with or without7modification, are permitted provided that the following conditions are8met:910- Redistributions of source code must retain the above copyright11notice, this list of conditions and the following disclaimer.1213- Redistributions in binary form must reproduce the above copyright14notice, this list of conditions and the following disclaimer in15the documentation and/or other materials provided with the16distribution.1718- Neither the name of The Numerical Algorithms Group Ltd. nor the19names of its contributors may be used to endorse or promote products20derived from this software without specific prior written permission.2122THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS23IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED24TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A25PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER26OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,27EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,28PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR29PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF30LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING31NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS32SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.33*/3435#define _VIEWALONE_C36#include "openaxiom-c-macros.h"3738#include <stdlib.h>39#include "viewAlone.h"4041#include "all_alone.H1"4243/************* global variables **************/4445viewManager viewP; /* note that in viewman, this is called viewports */4647/* 3D stuff */48view3DStruct doView3D;4950/* 2D stuff */51view2DStruct doView2D;52graphStruct graphArray[maxGraphs];53graphStateStruct graphStateArray[maxGraphs];5455/* tube stuff */56tubeModel doViewTube;5758int viewType;59int filedes,ack;6061char errorStr[80];626364int viewOkay = 0;65int viewError = -1;6667FILE *viewFile;68char filename[256];69char pathname[256];7071/************* main program **************/7273int main (int argc,char *argv[])74{75printf("viewAlone called with argc=%d\n",argc);76printf("viewAlone called with argv[1]=%s\n",argv[0]);77printf("viewAlone called with argv[2]=%s\n",argv[1]);78/******** Open files and Figure out the viewport type ********/7980sprintf(filename,"%s%s",argv[1],".VIEW/data");81if((viewFile = fopen(filename,"r")) == NULL ) {8283sprintf(filename,"%s%s",argv[1],"/data");84if((viewFile = fopen(filename,"r")) == NULL ){85fprintf(stderr,"Error: Cannot find the file %s%s or %s%s\n",86argv[1],".VIEW/data",argv[1],"/data");87exit(-1);88}89sprintf(pathname,"%s",argv[1]);90}91else{92sprintf(pathname,"%s%s",argv[1],".VIEW");93}94fscanf(viewFile,"%d\n",&viewType);95printf("filename = %s\n",filename);96printf("viewType = %d\n",viewType);97switch (viewType) {9899case view3DType:100case viewTubeType:101printf("calling spoonView3D\n");102spoonView3D(viewType);103break;104105case view2DType:106printf("calling spoonView2D\n");107spoonView2D();108break;109110} /* switch */111printf("The first number in the file, %d, called the viewType, not a valid value. It must be a number in the range of [1..4]\n",viewType);112return(0);113}114115116