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 #include "plplotP.h"
00026
00027
00028
00029 static struct line {
00030 PLINT nels;
00031 PLINT mark[4];
00032 PLINT space[4];
00033 } line[] = {
00034
00035 {
00036 0,
00037 {
00038 0, 0, 0, 0
00039 },
00040 {
00041 0, 0, 0, 0
00042 }
00043 },
00044 {
00045 1,
00046 {
00047 1000, 0, 0, 0
00048 },
00049 {
00050 1000, 0, 0, 0
00051 }
00052 },
00053 {
00054 1,
00055 {
00056 2000, 0, 0, 0
00057 },
00058 {
00059 2000, 0, 0, 0
00060 }
00061 },
00062 {
00063 1,
00064 {
00065 2000, 0, 0, 0
00066 },
00067 {
00068 1000, 0, 0, 0
00069 }
00070 },
00071 {
00072 2,
00073 {
00074 2500, 1000, 0, 0
00075 },
00076 {
00077 1000, 1000, 0, 0
00078 }
00079 },
00080 {
00081 2,
00082 {
00083 2000, 1000, 0, 0
00084 },
00085 {
00086 2000, 1000, 0, 0
00087 }
00088 },
00089 {
00090 3,
00091 {
00092 1000, 1500, 2000, 0
00093 },
00094 {
00095 1000, 1500, 2000, 0
00096 }
00097 },
00098 {
00099 3,
00100 {
00101 1000, 1500, 2000, 0
00102 },
00103 {
00104 1000, 1000, 1000, 0
00105 }
00106 }
00107 };
00108
00109
00110
00111 static struct pattern {
00112 PLINT nlines;
00113 PLINT inc[2];
00114 PLINT del[2];
00115 } pattern[] = {
00116
00117 {
00118 1,
00119 {
00120 0, 0
00121 },
00122 {
00123 2000, 0
00124 }
00125 },
00126 {
00127 1,
00128 {
00129 900, 0
00130 },
00131 {
00132 2000, 0
00133 }
00134 },
00135 {
00136 1,
00137 {
00138 450, 0
00139 },
00140 {
00141 2000, 0
00142 }
00143 },
00144 {
00145 1,
00146 {
00147 -450, 0
00148 },
00149 {
00150 2000, 0
00151 }
00152 },
00153 {
00154 1,
00155 {
00156 300, 0
00157 },
00158 {
00159 2000, 0
00160 }
00161 },
00162 {
00163 1,
00164 {
00165 -300, 0
00166 },
00167 {
00168 2000, 0
00169 }
00170 },
00171 {
00172 2,
00173 {
00174 0, 900
00175 },
00176 {
00177 2000, 2000
00178 }
00179 },
00180 {
00181 2,
00182 {
00183 450, -450
00184 },
00185 {
00186 2000, 2000
00187 }
00188 }
00189 };
00190
00191
00192
00193 static void
00194 spat(PLINT inc[], PLINT del[], PLINT nlin);
00195
00196
00197
00198
00199
00200
00201
00202 void
00203 c_plschr(PLFLT def, PLFLT scale)
00204 {
00205 if (def != 0.0)
00206 plsc->chrdef = def;
00207
00208 plsc->chrht = scale * plsc->chrdef;
00209 }
00210
00211
00212
00213
00214
00215
00216
00217 void
00218 c_plsmin(PLFLT def, PLFLT scale)
00219 {
00220 if (def != 0.0)
00221 plsc->mindef = def;
00222
00223 plsc->minht = scale * plsc->mindef;
00224 }
00225
00226
00227
00228
00229
00230
00231
00232 void
00233 c_plsmaj(PLFLT def, PLFLT scale)
00234 {
00235 if (def != 0.0)
00236 plsc->majdef = def;
00237
00238 plsc->majht = scale * plsc->majdef;
00239 }
00240
00241
00242
00243
00244
00245
00246
00247 void
00248 c_plssym(PLFLT def, PLFLT scale)
00249 {
00250 if (def != 0.0)
00251 plsc->symdef = def;
00252
00253 plsc->symht = scale * plsc->symdef;
00254 }
00255
00256
00257
00258
00259
00260
00261
00262 void
00263 c_pllsty(PLINT lin)
00264 {
00265 if (plsc->level < 1) {
00266 plabort("pllsty: Please call plinit first");
00267 return;
00268 }
00269 if (lin < 1 || lin > 8) {
00270 plabort("pllsty: Invalid line style");
00271 return;
00272 }
00273
00274 plstyl(line[lin - 1].nels,
00275 &line[lin - 1].mark[0], &line[lin - 1].space[0]);
00276 }
00277
00278
00279
00280
00281
00282
00283
00284 void
00285 c_plpat(PLINT nlin, PLINT *inc, PLINT *del)
00286 {
00287 PLINT i;
00288
00289 if (plsc->level < 1) {
00290 plabort("plpat: Please call plinit first");
00291 return;
00292 }
00293 if (nlin < 1 || nlin > 2) {
00294 plabort("plpat: Only 1 or 2 line styles allowed");
00295 return;
00296 }
00297 for (i = 0; i < nlin; i++) {
00298 if (del[i] < 0) {
00299 plabort("plpat: Line spacing must be greater than 0");
00300 return;
00301 }
00302 }
00303 spat(inc, del, nlin);
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313 void
00314 c_plpsty(PLINT patt)
00315 {
00316 if (plsc->level < 1) {
00317 plabort("plpsty: Please call plinit first");
00318 return;
00319 }
00320 if (patt > 8) {
00321 plabort("plpsty: Invalid pattern");
00322 return;
00323 }
00324 if (patt != plsc->patt) {
00325 plsc->patt = patt;
00326
00327 if (plsc->level > 0) {
00328 plP_state(PLSTATE_FILL);
00329 }
00330 }
00331 if (patt > 0) {
00332 spat(&pattern[patt - 1].inc[0], &pattern[patt - 1].del[0],
00333 pattern[patt - 1].nlines);
00334 }
00335 }
00336
00337
00338
00339
00340
00341
00342
00343 static void
00344 spat(PLINT inc[], PLINT del[], PLINT nlin)
00345 {
00346 PLINT i;
00347
00348 plsc->nps = nlin;
00349 for (i = 0; i < nlin; i++) {
00350 plsc->inclin[i] = inc[i];
00351 plsc->delta[i] = del[i];
00352 }
00353 }