00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #ifndef lint
00077 static const char RCSid[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/libbn/fortran.c,v 14.11 2006/09/02 14:02:14 lbutler Exp $ (BRL)";
00078 #endif
00079
00080 #include "common.h"
00081
00082
00083
00084 #include <stdio.h>
00085
00086 #include "machine.h"
00087 #include "plot3.h"
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 void
00098 pl_strncpy(register char *out, register char *in, register int sz)
00099 {
00100 register int c = '\0';
00101
00102 while( --sz > 0 && (c = *in++) != '\0' && c != '$' )
00103 *out++ = c;
00104 *out++ = '\0';
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114 #if CRAY
00115 # define F(lc,uc) uc
00116 #endif
00117 #if defined(apollo) || defined(mips) || defined(aux)
00118
00119 #ifdef __STDC__
00120 # define F(lc,uc) lc ## _
00121 #else
00122 # define F(lc,uc) lc_
00123 #endif
00124 #endif
00125 #if !defined(F)
00126 # define F(lc,uc) lc
00127 #endif
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 void
00140 F(ifdopn,IFDOPN)( plotfp, fd )
00141 FILE **plotfp;
00142 int *fd;
00143 {
00144 if( (*plotfp = fdopen(*fd, "w")) == NULL )
00145 perror("IFDOPN/fdopen");
00146 }
00147
00148
00149
00150
00151
00152
00153 void
00154 F(ifopen,IFOPEN)( plotfp, name )
00155 FILE **plotfp;
00156 char *name;
00157 {
00158 char buf[128];
00159
00160 pl_strncpy( buf, name, (int)sizeof(buf) );
00161 if( (*plotfp = fopen(buf, "w")) == NULL )
00162 perror(buf);
00163 }
00164
00165
00166
00167
00168
00169 void
00170 F(i2pnt,I2PNT)( plotfp, x, y )
00171 FILE **plotfp;
00172 int *x, *y;
00173 {
00174 pl_point( *plotfp, *x, *y );
00175 }
00176
00177 void
00178 F(i2line,I2LINE)( plotfp, x1, y1, x2, y2 )
00179 FILE **plotfp;
00180 int *x1, *y1, *x2, *y2;
00181 {
00182 pl_line( *plotfp, *x1, *y1, *x2, *y2 );
00183 }
00184
00185 void
00186 F(ilinmd,ILINMD)( plotfp, s )
00187 FILE **plotfp;
00188 char *s;
00189 {
00190 char buf[32];
00191 pl_strncpy( buf, s, (int)sizeof(buf) );
00192 pl_linmod( *plotfp, buf );
00193 }
00194
00195 void
00196 F(i2move,I2MOVE)( plotfp, x, y )
00197 FILE **plotfp;
00198 int *x, *y;
00199 {
00200 pl_move( *plotfp, *x, *y );
00201 }
00202
00203 void
00204 F(i2cont,I2CONT)( plotfp, x, y )
00205 FILE **plotfp;
00206 int *x, *y;
00207 {
00208 pl_cont( *plotfp, *x, *y );
00209 }
00210
00211 void
00212 F(i2labl,I2LABL)( plotfp, s )
00213 FILE **plotfp;
00214 char *s;
00215 {
00216 char buf[256];
00217 pl_strncpy( buf, s, (int)sizeof(buf) );
00218 pl_label( *plotfp, buf );
00219 }
00220
00221 void
00222 F(i2spac,I2SPAC)( plotfp, x1, y1, x2, y2 )
00223 FILE **plotfp;
00224 int *x1, *y1, *x2, *y2;
00225 {
00226 pl_space( *plotfp, *x1, *y1, *x2, *y2 );
00227 }
00228
00229 void
00230 F(ierase,IERASE)( plotfp )
00231 FILE **plotfp;
00232 {
00233 pl_erase( *plotfp );
00234 }
00235
00236 void
00237 F(i2circ,I2CIRC)( plotfp, x, y, r )
00238 FILE **plotfp;
00239 int *x, *y, *r;
00240 {
00241 pl_circle( *plotfp, *x, *y, *r );
00242 }
00243
00244 void
00245 F(i2arc,I2ARC)( plotfp, xc, yc, x1, y1, x2, y2 )
00246 FILE **plotfp;
00247 int *xc, *yc, *x1, *y1, *x2, *y2;
00248 {
00249 pl_arc( *plotfp, *xc, *yc, *x1, *y1, *x2, *y2 );
00250 }
00251
00252 void
00253 F(i2box,I2BOX)( plotfp, x1, y1, x2, y2 )
00254 FILE **plotfp;
00255 int *x1, *y1, *x2, *y2;
00256 {
00257 pl_box( *plotfp, *x1, *y1, *x2, *y2 );
00258 }
00259
00260
00261
00262
00263
00264
00265 void
00266 F(icolor,ICOLOR)( plotfp, r, g, b )
00267 FILE **plotfp;
00268 int *r, *g, *b;
00269 {
00270 pl_color( *plotfp, *r, *g, *b );
00271 }
00272
00273 void
00274 F(iflush,IFLUSH)( plotfp )
00275 FILE **plotfp;
00276 {
00277 pl_flush( *plotfp );
00278 }
00279
00280 void
00281 F(i3spac,I3SPAC)( plotfp, x1, y1, z1, x2, y2, z2 )
00282 FILE **plotfp;
00283 int *x1, *y1, *z1, *x2, *y2, *z2;
00284 {
00285 pl_3space( *plotfp, *x1, *y1, *z1, *x2, *y2, *z2 );
00286 }
00287
00288 void
00289 F(i3pnt,I3PNT)( plotfp, x, y, z )
00290 FILE **plotfp;
00291 int *x, *y, *z;
00292 {
00293 pl_3point( *plotfp, *x, *y, *z );
00294
00295 }
00296
00297 void
00298 F(i3move,I3MOVE)( plotfp, x, y, z )
00299 FILE **plotfp;
00300 int *x, *y, *z;
00301 {
00302 pl_3move( *plotfp, *x, *y, *z );
00303 }
00304
00305 void
00306 F(i3cont,I3CONT)( plotfp, x, y, z )
00307 FILE **plotfp;
00308 int *x, *y, *z;
00309 {
00310 pl_3cont( *plotfp, *x, *y, *z );
00311 }
00312
00313 void
00314 F(i3line,I3LINE)( plotfp, x1, y1, z1, x2, y2, z2 )
00315 FILE **plotfp;
00316 int *x1, *y1, *z1, *x2, *y2, *z2;
00317 {
00318 pl_3line( *plotfp, *x1, *y1, *z1, *x2, *y2, *z2 );
00319 }
00320
00321 void
00322 F(i3box,I3BOX)( plotfp, x1, y1, z1, x2, y2, z2 )
00323 FILE **plotfp;
00324 int *x1, *y1, *z1, *x2, *y2, *z2;
00325 {
00326 pl_3box( *plotfp, *x1, *y1, *z1, *x2, *y2, *z2 );
00327 }
00328
00329
00330
00331
00332
00333 void
00334 F(f2pnt,F2PNT)( plotfp, x, y )
00335 FILE **plotfp;
00336 float *x, *y;
00337 {
00338 pd_point( *plotfp, *x, *y );
00339 }
00340
00341 void
00342 F(f2line,F2LINE)( plotfp, x1, y1, x2, y2 )
00343 FILE **plotfp;
00344 float *x1, *y1, *x2, *y2;
00345 {
00346 pd_line( *plotfp, *x1, *y1, *x2, *y2 );
00347 }
00348
00349 void
00350 F(f2move,F2MOVE)( plotfp, x, y )
00351 FILE **plotfp;
00352 float *x, *y;
00353 {
00354 pd_move( *plotfp, *x, *y );
00355 }
00356
00357 void
00358 F(f2cont,F2CONT)( plotfp, x, y )
00359 FILE **plotfp;
00360 float *x, *y;
00361 {
00362 pd_cont( *plotfp, *x, *y );
00363 }
00364
00365 void
00366 F(f2spac,F2SPAC)( plotfp, x1, y1, x2, y2 )
00367 FILE **plotfp;
00368 float *x1, *y1, *x2, *y2;
00369 {
00370 pd_space( *plotfp, *x1, *y1, *x2, *y2 );
00371 }
00372
00373 void
00374 F(f2circ,F2CIRC)( plotfp, x, y, r )
00375 FILE **plotfp;
00376 float *x, *y, *r;
00377 {
00378 pd_circle( *plotfp, *x, *y, *r );
00379 }
00380
00381 void
00382 F(f2arc,F2ARC)( plotfp, xc, yc, x1, y1, x2, y2 )
00383 FILE **plotfp;
00384 float *xc, *yc, *x1, *y1, *x2, *y2;
00385 {
00386 pd_arc( *plotfp, *xc, *yc, *x1, *y1, *x2, *y2 );
00387 }
00388
00389 void
00390 F(f2box,F2BOX)( plotfp, x1, y1, x2, y2 )
00391 FILE **plotfp;
00392 float *x1, *y1, *x2, *y2;
00393 {
00394 pd_box( *plotfp, *x1, *y1, *x2, *y2 );
00395 }
00396
00397
00398
00399
00400
00401
00402 void
00403 F(a2spac,A3SPAC)( plotfp, min, max )
00404 FILE **plotfp;
00405 float min[3];
00406 float max[3];
00407 {
00408 pd_3space( *plotfp, min[0], min[1], min[2], max[0], max[1], max[2] );
00409 }
00410
00411 void
00412 F(f3spac,F3SPAC)( plotfp, x1, y1, z1, x2, y2, z2 )
00413 FILE **plotfp;
00414 float *x1, *y1, *z1, *x2, *y2, *z2;
00415 {
00416 pd_3space( *plotfp, *x1, *y1, *z1, *x2, *y2, *z2 );
00417 }
00418
00419 void
00420 F(a3pnt,A3PNT)( plotfp, pt )
00421 FILE **plotfp;
00422 float pt[3];
00423 {
00424 pd_3point( *plotfp, pt[0], pt[1], pt[2] );
00425 }
00426
00427 void
00428 F(f3pnt,F3PNT)( plotfp, x, y, z )
00429 FILE **plotfp;
00430 float *x, *y, *z;
00431 {
00432 pd_3point( *plotfp, *x, *y, *z );
00433 }
00434
00435 void
00436 F(a3move,A3MOVE)( plotfp, pt )
00437 FILE **plotfp;
00438 float pt[3];
00439 {
00440 pd_3move( *plotfp, pt[0], pt[1], pt[2] );
00441 }
00442
00443 void
00444 F(f3move,F3MOVE)( plotfp, x, y, z )
00445 FILE **plotfp;
00446 float *x, *y, *z;
00447 {
00448 pd_3move( *plotfp, *x, *y, *z );
00449 }
00450
00451 void
00452 F(a3cont,A3CONT)( plotfp, pt )
00453 FILE **plotfp;
00454 float pt[3];
00455 {
00456 pd_3cont( *plotfp, pt[0], pt[1], pt[2] );
00457 }
00458
00459 void
00460 F(f3cont,F3CONT)( plotfp, x, y, z )
00461 FILE **plotfp;
00462 float *x, *y, *z;
00463 {
00464 pd_3cont( *plotfp, *x, *y, *z );
00465 }
00466
00467 void
00468 F(a3line,A3LINE)( plotfp, a, b )
00469 FILE **plotfp;
00470 float a[3], b[3];
00471 {
00472 pd_3line( *plotfp, a[0], a[1], a[2], b[0], b[1], b[2] );
00473 }
00474
00475 void
00476 F(f3line,F3LINE)( plotfp, x1, y1, z1, x2, y2, z2 )
00477 FILE **plotfp;
00478 float *x1, *y1, *z1, *x2, *y2, *z2;
00479 {
00480 pd_3line( *plotfp, *x1, *y1, *z1, *x2, *y2, *z2 );
00481 }
00482
00483 void
00484 F(a3box,A3BOX)( plotfp, a, b )
00485 FILE **plotfp;
00486 float a[3], b[3];
00487 {
00488 pd_3box( *plotfp, a[0], a[1], a[2], b[0], b[1], b[2] );
00489 }
00490
00491 void
00492 F(f3box,F3BOX)( plotfp, x1, y1, z1, x2, y2, z2 )
00493 FILE **plotfp;
00494 float *x1, *y1, *z1, *x2, *y2, *z2;
00495 {
00496 pd_3box( *plotfp, *x1, *y1, *z1, *x2, *y2, *z2 );
00497 }
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508