cd /home/SHARE cmanE.txt prog/prtps -p lib/man/cmanE.txt | lpr ~~~~~~~~~ Source files included in the Library: /home/SHARE/lib/psplot.c /home/SHARE/lib/pspaint.c /home/SHARE/lib/ptext.c /home/SHARE/lib/cont.c /home/SHARE/lib/axis.c /home/SHARE/lib/xyconv.c /home/SHARE/lib/xw84t.c /home/SHARE/lib/wshore.c /home/SHARE/lib/igrf.c /home/SHARE/lib/calma.c /home/SHARE/lib/sml.c /home/SHARE/lib/rand.c /home/SHARE/lib/lwkdir.c Aarchive file of the Library: /home/SHARE/lib/libgm.a All subprograms included in this Library are coded in C language. The prototypes and outlines of all entry names are described very short bellow. For FORTRAN callable routines and their equivalents, see also manpsE.txt and manxyE.txt, which describe further in detail. [Useful Setting] alias cc 'gcc \!* -L/home/SHARE/lib -lgm -lm' alias f77 'g77 \!* -L/home/SHARE/lib -lgm' ------------------------------------------------------------------------------- PSPLOT (LINE Graphics PostScript Output) int psopn(char *pfile, char *sheet); void psopn_(char *pfile, char *sheet); Select sheet size, and open PostScript output filename. int plots(double xo, double yo); void plots_(float *xo, float *yo); Define start of page, and initial origin. int plote(void); void plote_(void); Define end of page. int pscls(void); void pscls_(void); Close PostScript output file. int plot(double xp, double yp, int md); void plot_(float *xp, float *yp, int *md); Move pen according to mode. int clspath(int join); Draw to the first point of continuous pen-down drawing to close polygon, with corner joining parameter (Miter join if join=0, Bevel join if join=2, and Round join otherwise). int scisor(double xlm, double ylm, double wlm, double hlm); void scisor_(float *xlm, float *ylm, float *wlm, float *hlm); Scisor out the outside of rectangle range. int factor(double fac); void factor_(float *fac); Set scale factor. int penatr(int jpen, int icol, int ityp, double thick); void penatr_(int *jpen, int *icol, int *ityp, float *thick); Setup pen attributes. int newpen(int npen); void newpen_(int *npen); Select new pen number. int qpatr(int mpen, int *lcol, int *ltyp, double *wthick); Get the pen attributes, i.e., color (lcol), line type (ltyp), and line width (wthick), of current pen, and its pen number is returned as function value. int qpsfp(FILE **fps); Get file pointer (fps) of PS output file. int qapos(int *ixp, int *iyp); Get current absolute pen position (ixp,iyp). int where(double *wx, double *wy, double *wfac); void where_(float *wx, float *wy, float *wfac); Get current pen coordinates and scale factor. int wrect(double xl, double yl, double wide, double high); void wrect_(float *xl, float *yl, float *wide, float *high); Draw a rectangle. void wpolyg_(float *xm, float *ym, int *npt, int *inc); Draw a polygon. int wcirc(double xc, double yc, double radius, double ang1, double ang2); void wcirc_(float *xc, float *yc, float *radius, float *ang1, float *ang2); Draw a circle. ------------------------------------------------------------------------------- PSPAINT (Surface Graphics PostScript Output) int dftone(int nlevel, int mtone[], int ktnlo, int ktnhi, int ktnvd); void dftone_(int *nlevel, int mtone[], int *ktnlo, int *ktnhi, int *ktnvd); Define and assign monochromatic gray-scale grading for 2D surface representation 'paintm'. int dfcols(int nclev, double fh, double fd, int kcnv); void dfcols_(int *nclev, float *fh, float *fd, int *kcnv); Auto-generate and assign color grading for 2D surface representation 'paintm', and also auto-generate shaded color grading for dual 2D surface representation 'paintw'. int dfrgbt(int nclev, int mrgb[], int kclo, int kchi, int kcnv); void dfrgbt_(int *nclev, int mrgb[], int *kclo, int *kchi, int *kcnv); Define and assign color grading for 2D surface representation 'paintm'. int dresol(int nras); void dresol_(int *nras); Modify resolution of 'paintm'/'paintw' representation. int dframe(double xo, double yo, double wd, double hi, int imax, int jmax); void dframe_(float *xo, float *yo, float *wd, float *hi, int *imax, int *jmax); Define frame of 'paintm'/'paintw' representation. int paintm(float *v, float vlo, float vhi, float vnvd); void paintm_(float *v, float *vlo, float *vhi, float *vnvd); Repesent 2D surface with gray-scale or color grading. int paintw(float *v, float vlo, float vhi, float vnvd, float *u); void paintw_(float *v, float *vlo, float *vhi, float *vnvd, float *u); Repesent dual 2D surface with shaded color grading. int dfpcol(int key, int mcol); void dfpcol_(int *key, int *mcol); Assign color to paint object by 'paintc'/'paintr'/'paintp'. int paintc(double xc, double yc, double radius); void paintc_(float *xc, float *yc, float *radius); Paint a circle. int paintr(double xorg, double yorg, double wide, double high); void paintr_(float *xorg, float *yorg, float *wide, float *high); Paint a rectangle. int paintp(float xa[], float ya[], int npt, int inc); void paintp_(float xa[], float ya[], int *npt, int *inc); Paint a polygon. ------------------------------------------------------------------------------- PTEXT (Font TEXT Graphics PostScript Output) int lstyle(char *fnt, double high, double ang, int tcol, int bcol); void lstyle_(char fnt[3], float *high, float *ang, int *tcol, int *bcol); Select font style. int ptext(char *text, int ltxt, double xp, double yp, int kp); void ptext_(char *text, int *ltxt, float *xp, float *yp, int *kp); Draw text string by the font style defined by 'lstyle'. int pcstr(double xp, double yp, double chi, char *text, double ang, int ns); void pcstr_(float *xp, float *yp, float *chi, char *text, float *ang, int *ns); Draw text string by Courier font. int pmark(int mark, double xc, double yc, double size, double thick, int mcol); void pmark_(int *mark, float *xc, float *yc, float *sz, float *th, int *mcol); Draw a centered symbol mark. ------------------------------------------------------------------------------- CONT (Drawing Graphic Line Contour Map) int conts(double xorg, double yorg, double wide, double high, int imax, int jmax, double csize); void conts_(float *xorg, float *yorg, float *wide, float *high, int *imax, int *jmax, float *csize); Specify the framework of 2D contouring 'contx'. int contx(float *v, float undef, int istep, int lcapt, int lml, int lmh, int kln); void contx_(float *v, float *undef, int *istep, int *lcapt, int *lml, int *lmh, int *kln); Execute contour map drawing. ------------------------------------------------------------------------------- AXIS (Drawing character/mark/axis etc. using stroke table) Following routines are obsolete, and still remain only for compatibility purposes. int chtype(double ang, double slope, double high, double ratio); void chtype_(float *ang, float *slope, float *high, float *ratio); Define character type. int p1char(char c); int pchars(char *bcd); void pchar_(char *s, int *nc, float *xs, float *ys, int *kk); void gsymbl_(float *xs, float *ys, float *high, char *s, float *ang, int *nc); Draw 1 character or character string. int psmset(int ksms); void pnorm_(void); void psubsc_(void); void psupsc_(void); Select normal/subscript/superscript mode. int pscdef(char csb, char csp); void pshift_(char cs[2]); Specify shift-code characters. int pcsymb(int ics, double size, double ang); void csymbl_(float *xs, float *ys, float *sz, int *ics, float *ang, int *mp); Draw a centered symbol. int symbol(double xp, double yp, double high, char *text, double ang, int nc); void symbol_(float *xp, float *yp, float *high, char *text, float *ang, int *nc); Draw a text string. int number(double xp, double yp, double high, double fv, double ang, int ndec); void number_(float *xp, float *yp, float *high, float *fv, float *ang, int *ndec); Draw a number. int scale(float va[], double axlen, int npt, int inc); void scale_(float va[], float *axlen, int *npt, int *inc); Prepare for scaling. int line(float xa[], float ya[], int npt, int inc, int ltype, int mark); void line_(float xa[], float ya[], int *npt, int *inc, int *ltype, int *mark); Draw a line graph of array data. int axis(double xp, double yp, char *text, int ltx, double axlen, double angle, double firstv, double deltav); void axis_(float *xp, float *yp, char *text, int *ltx, float *axlen, float *angle, float *firstv, float *deltav); Draw a axis. ------------------------------------------------------------------------------- XYCONV (Conversion for Map Projection) int cvinit(int nca, double gi, double gk, double sp1, double sp2); void cvinit_(int *nca, float *gi, float *gk, float *sp1, float *sp2); void cvdinit_(int *nca, double *gi, double *gk, double *sp1, double *sp2); Specify projection method. int cviken(double fi, double fk, double *ye, double *xn); void cviken_(float *fi, float *fk, float *ye, float *xn); void cvdiken_(double *fi, double *fk, double *ye, double *xn); Convert Lat./Lon. into plane rectangular coordinates. int cvenik(double ye, double xn, double *fi, double *fk); void cvenik_(float *ye, float *xn, float *fi, float *fk); void cvdenik_(double *ye, double *xn, double *fi, double *fk); Convert plane rectangular coordinates into lat./lon. void xyconv_(float *gi, float *gk, float *fi, float *fk, float *x, float *y); void nxycnv_(float *gi, float *gk, float *fi, float *fk, float *x, float *y); Convert Lat./Lon. into Japanes Transverse Mercator X/Y void utm_(int *nz, float *fi, float *fk, float *x, float *y); Convert Lat./Lon. into Universal Transverse Mercator X/Y void ikconv_(float *gi, float *gk, float *x, float *y, float *fi, float *fk); void nikcnv_(float *gi, float *gk, float *x, float *y, float *fi, float *fk); Convert Japanes Transverse Mercator X/Y into Lat./Lon. void utmik_(int *nz, float *x, float *y, float *fi, float *fk); Convert Universal Transverse Mercator X/Y into Lat./Lon. ------------------------------------------------------------------------------- XW84T (Geodetic Coordinates Conversion) void xw84t(double wlat, double wlon, double walt, double *tlat, double *tlon, double *talt); void xw84t_(float *wlat, float *wlon, float *walt, float *tlat, float *tlon, float *talt); void xw84td_(double *wlat, double *wlon, double *walt, double *tlat, double *tlon, double *talt); Convert WGS84 Lat./Lon./Alt. into Old-Tokyo datum. void xtw84(double tlat, double tlon, double talt, double *wlat, double *wlon, double *walt); void xtw84_(float *tlat, float *tlon, float *talt, float *wlat, float *wlon, float *walt); void xtw84d_(double *tlat, double *tlon, double *talt, double *wlat, double *wlon, double *walt); Convert Old-Tokyo datum Lat./Lon./Alt. into WGS84 coordinates. ------------------------------------------------------------------------------- WSHORE (Draw Coastlines / Rivers and Lakes / Prefecture Boundaries) void rshore(int m, int is, int in, int kw, int ke); void rshore_(int *m, int *is, int *in, int *kw, int *ke); Define the range to draw coastlines etc. by 'pshore'. void pshore(double xorg, double yorg, int mpen, double scl, void (*conv)(float *alat, float *alon, float *xe, float *yn)); void pshore_(float *xorg, float *yorg, int *mpen, float *scl, void (*conv)(float *alat, float *alon, float *xe, float *yn)); Draw coastlins, lakes, rivers, prefecture boundaries with larger scale. void wshore(double xorg, double yorg, int mpen, double scl, void (*conv)(float *alat, float *alon, float *xe, float *yn)); void wshore_(float *xorg, float *yorg, int *mpen, float *scl, void (*conv)(float *alat, float *alon, float *xe, float *yn)); Draw coastlines, lakes and rivers with smaller scale. ------------------------------------------------------------------------------- IGRF (Calculate International Geomagnetic Reference Field) void field(double are, double aflat, double ara, int maxoda); Give equatorial radius (are) and reciprocal flattening (aflat) of Earth ellipsoid, and radius of reference sphere (ara) and maximum order/degree (maxoda) of IGRF calculation. void tcoef(double agh[MxOD+1][MxOD+1], double aght[MxOD+1][MxOD+1], double atzero, int kexta, double aext[3]); Give Gauss coeficients (agh) and their time variations (aght), base year (atzero), external source flag (kexta), and coefficients of external (aext). void tyear(double ayear); Give time epoch (ayear) of calculation. void mfldg(double alat, double alon, double ahi, double *ax, double *ay, double *az, double *af); Calculate geocentric 3 components (ax,ay,az) and total intensity (af) of IGRF model, from geographic latitude (alat), longitude (alon), and altitude (ahi). void mfldc(double athe, double alon, double ar, double *ax, double *ay, double *az, double *af); Calculate geocentric 3 components (ax,ay,az) and total intensity (af) of IGRF model, from geocentric colatitude (athe), longitude (alon), and geocentric distance (ar). void gcomp(double *axg, double *ayg, double *azg); Get geopgraphic 3 component (axg,ayg,azg) of IGRF model for the point last specified by 'mfldg' or 'mfldc'. void stigrf(int l, double year); void stdgrf(int l, double year); void stpgrf(int l, double year); Select IGRF model (IGRF/DGRF/PGFR), model generation number, and specify the time epoch (year) of IGRF calculation. void igrfs(double year); void igrfs_(float *year); void dgrfs(double year); void dgrfs_(float *year); void pgrfs(double year); void pgrfs_(float *year); Select IGRF model (IGRF/DGRF/PGFR), and specify time epoch (year) of IGRF calculation. Generation of model is selected automatically from the value of time epoch (year). void igrfs2(double year, int mdl); void igrfs2_(float *year, int *mdl); void dgrfs2(double year, int mdl); void dgrfs2_(float *year, int *mdl); void pgrfs2(double year, int mdl); void pgrfs2_(float *year, int *mdl); Select IGRF model (IGRF/DGRF/PGFR) and model base year (year), and specify time epoch (year) of IGRF calculation. void igrfc(double fido, double fkeido, double high, double *tf); void igrfc_(float *fi, float *fk, float *h, float *f); Specify position and get total force IGRF value. void igrfm(double fm[6]); void igrfm_(float fm[6]); Get full components of IGRF vector. ------------------------------------------------------------------------------- CALMA (Calculate Synthetic Magnetic Anomaly of Simple Model) void magafd(double am, double the, double phi, double dip, double dec); void magafd_(float *am, float *the, float *phi, float *dip, float *dec); Give intensity (am), inclination (the) and declination (phi) of source magnetization, and inclination (dip) and declination (dec) of Earth's magnetic filed. void mpoint(double xc, double yc, double zc, double vol); void mpoint_(float *xc, float *yc, float *zc, float *vol); Select point source model, and set source parameters. void mvline(double xc, double yc, double zs, double w, double area); void mvline_(float *xc, float *yc, float *zs, float *w, float *area); Select line source model, and set source parameters. void mhrect(double xs, double xt, double ys, double yt, double zc, double h); void mhrect_(float *xs, float *xt, float *ys, float *yt, float *zc, float *h); Select rectangle sheet source model, and set source parameters. void mprism(double xs, double xt, double ys, double yt, double zs, double w); void mprism_(float *xs, float *xt, float *ys, float *yt, float *zs, float *w); Select block source model, and set source parameters. double calma(double xp, double yp, double zp); float calma_(float *xp, float *yp, float *zp); Calculate magnetic anomaly for specified position (xp,yp,zp). ------------------------------------------------------------------------------- SML (Regression Analysis) int sm1opn(int nvar, int nsrc); void sm1opn_(int *nvar, int *nsrc); Initialize n-parameters linear regression. int sm1ex(double var[], double src[]); void sm1ex_(float fv[], float fs[]); Process n-parameters linear regression. int sm1cls(double *coef); void sm1cls_(float *fc, int *mc, int *nc); Get regression coefficients of n-parameters linear regression. int sm1rv(double vr[], double sr[]); void sm1rv_(float fvr[], float fsr[]); Calculate linear regression formula value for specified n-parameters. int sm2opn(int ndg2, int nsrc); void sm2opn_(int *ndg2, int *nsrc); Initialize 2-parameters n-th order regression. int sm2ex(double u, double v, double src[]); void sm2ex_(float *fu, float *fv, float fs[]); Process 2-parameters n-th order regression. int sm2cls(double *coef); void sm2cls_(float *fc, int *mc, int *nc); Get regression coefficients of 2-parameters n-th order regression. int sm2rv(double ur, double vr, double sr[]); void sm2rv_(float *fur, float *fvr, float fsr[]); Calculate n-th order regression formula value for specified 2-parameters. int sm3opn(int ndg3, int nsrc); void sm3opn_(int *ndg3, int *nsrc); Initialize 3-parameters n-th order regression. int sm3ex(double x, double y, double z, double src[]); void sm3ex_(float *fx, float *fy, float *fz, float fs[]); Process 3-parameters n-th order regression. int sm3cls(double *coef); void sm3cls_(float *fc, int *mc, int *nc); Get regression coefficients of 3-parameters n-th order regression. int sm3rv(double xr, double yr, double zr, double sr[]); void sm3rv_(float *fxr, float *fyr, float *fzr, float fsr[]); Calculate n-th order regression formula value for specified 3-parameters. ------------------------------------------------------------------------------- RAND (Random Number Generation) double rand1(void); float rand1_(void); Generate uniform random number within the range of [-1., +1.] double randg(void); float randg_(void); Generate Gaussian random number with zero mean and dispersion 1. ------------------------------------------------------------------------------- LWKDIR ( Assistance to Show the progress of loop operation, to Set-up Working Directory Path, and to Read-in Process Parameters ) int prompt(char *str); void prompt_(char *str, size_t ls); void premsg_(char *str, size_t ls); Output message to screen with/without NewLine int dpcent(int m, int n); void dpcent_(int *m, int *n); Display the percentage of the progress of loop operation. int opnpin(void); void opnpin_(void); Provide a chance to select predefined data file as a data source for reading process parameters. int clspin(void); void clspin_(void); Close 'opnpin' mechanism. int get_wkdir(char *dnm, size_t len); int lwkdir_(int *len, char *dnm); Establish the Working Directory Path. int parmin(int lbuf, char *buf); Read preocess parameter(s) as a raw string. void parmin_(char *str, int lbuf, char *buf, size_t ls); Output prompt message and read process parameter(s) as a raw string. void gparma(char *str, int lnam, char *nam); void gparma_(char *str, int *lnam, char *nam, size_t ls); Output prompt message and read process parameter as a string. void gparmi(char *str, int *iv); void gparmi_(char *str, int *iv, size_t ls); Output prompt message and read process parameter as a integer value. void gparmf(char *str, float *fv); void gparmf_(char *str, float *fv, size_t ls); Output prompt message and read process parameter as a floating value. void gparmd(char *str, double *dv); void gparmd_(char *str, double *dv, size_t ls); Output prompt message and read process parameter as a double-float value. void gparmif(char *str, int *iv, float *fv); void gparmif_(char *str, int *iv, float *fv, size_t ls); Output prompt message and read process parameter as two values of integer and floating void gparmid(char *str, int *iv, double *dv); void gparmid_(char *str, int *iv, double *dv, size_t ls); Output prompt message and read process parameter as two values of integer and double-float void gparmi2(char *str, int *iv1, int *iv2); void gparmi2_(char *str, int *iv1, int *iv2, size_t ls); Output prompt message and read process parameter as two integer values. void gparmf2(char *str, float *fv1, float *fv2); void gparmf2_(char *str, float *fv1, float *fv2, size_t ls); Output prompt message and read process parameter as two floating values. void gparmd2(char *str, double *dv1, double *dv2); void gparmd2_(char *str, double *dv1, double *dv2, size_t ls); Output prompt message and read process parameter as two double-float values. -------------------------------------------------------------------------------