| 1 |
– |
/* Copyright (c) 1995 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Convert MGF (Materials and Geometry Format) to Metafile 2-d graphics |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
|
#include <stdio.h> |
| 9 |
+ |
#include <stdlib.h> |
| 10 |
+ |
#include <string.h> |
| 11 |
|
#include <math.h> |
| 12 |
+ |
|
| 13 |
|
#include "random.h" |
| 14 |
|
#include "mgflib/parser.h" |
| 15 |
+ |
#include "plocate.h" /* XXX shouldn't this rather be in rtmath.h? */ |
| 16 |
|
|
| 17 |
|
#define MSIZE ((1<<14)-1) |
| 18 |
|
#define MX(v) (int)(MSIZE*(v)[(proj_axis+1)%3]) |
| 19 |
|
#define MY(v) (int)(MSIZE*(v)[(proj_axis+2)%3]) |
| 20 |
|
|
| 20 |
– |
#ifdef DCL_ATOF |
| 21 |
– |
extern double atof(); |
| 22 |
– |
#endif |
| 23 |
– |
|
| 24 |
– |
int r_face(); |
| 21 |
|
int proj_axis; |
| 22 |
|
double limit[3][2]; |
| 23 |
|
int layer; |
| 25 |
|
|
| 26 |
|
extern int mg_nqcdivs; |
| 27 |
|
|
| 28 |
+ |
static int r_face(int ac, char **av); |
| 29 |
+ |
static void newlayer(void); |
| 30 |
+ |
static int doline(int v1x, int v1y, int v2x, int v2y); |
| 31 |
|
|
| 32 |
< |
main(argc, argv) /* convert files to stdout */ |
| 33 |
< |
int argc; |
| 34 |
< |
char *argv[]; |
| 32 |
> |
|
| 33 |
> |
int |
| 34 |
> |
main( /* convert files to stdout */ |
| 35 |
> |
int argc, |
| 36 |
> |
char *argv[] |
| 37 |
> |
) |
| 38 |
|
{ |
| 39 |
|
int i; |
| 40 |
|
/* initialize dispatch table */ |
| 77 |
|
|
| 78 |
|
|
| 79 |
|
int |
| 80 |
< |
r_face(ac, av) /* convert a face */ |
| 81 |
< |
int ac; |
| 82 |
< |
char **av; |
| 80 |
> |
r_face( /* convert a face */ |
| 81 |
> |
int ac, |
| 82 |
> |
char **av |
| 83 |
> |
) |
| 84 |
|
{ |
| 85 |
|
static FVECT bbmin = {0,0,0}, bbmax = {1,1,1}; |
| 86 |
|
register int i, j; |
| 118 |
|
(long)(mx2)<<5 ^ (long)(my2)) |
| 119 |
|
|
| 120 |
|
|
| 121 |
< |
newlayer() /* start a new layer */ |
| 121 |
> |
void |
| 122 |
> |
newlayer(void) /* start a new layer */ |
| 123 |
|
{ |
| 124 |
< |
#ifdef BSD |
| 121 |
< |
bzero((char *)hshtab, sizeof(hshtab)); |
| 122 |
< |
#else |
| 123 |
< |
(void)memset((char *)hshtab, 0, sizeof(hshtab)); |
| 124 |
< |
#endif |
| 124 |
> |
(void)memset((char *)hshtab, '\0', sizeof(hshtab)); |
| 125 |
|
if (++layer >= 16) { |
| 126 |
|
mendpage(); |
| 127 |
|
layer = 0; |
| 130 |
|
|
| 131 |
|
|
| 132 |
|
int |
| 133 |
< |
doline(v1x, v1y, v2x, v2y) /* draw line conditionally */ |
| 134 |
< |
int v1x, v1y, v2x, v2y; |
| 133 |
> |
doline( /* draw line conditionally */ |
| 134 |
> |
int v1x, |
| 135 |
> |
int v1y, |
| 136 |
> |
int v2x, |
| 137 |
> |
int v2y |
| 138 |
> |
) |
| 139 |
|
{ |
| 140 |
|
register int h; |
| 141 |
|
|