tioga 1.5 → 1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Tioga_README +70 -30
- data/split/Dtable/defs.h +6 -0
- data/split/Dtable/dtable.c +13 -8
- data/split/Dvector/defs.h +6 -0
- data/split/Dvector/dvector.c +29 -11
- data/split/Flate/defs.h +6 -0
- data/split/Flate/flate.c +6 -4
- data/split/Function/defs.h +6 -0
- data/split/Function/function.c +4 -2
- data/split/Tioga/axes.c +15 -3
- data/split/Tioga/defs.h +6 -0
- data/split/Tioga/figures.c +8 -0
- data/split/Tioga/figures.h +6 -0
- data/split/Tioga/init.c +4 -0
- data/split/Tioga/lib/FigMkr.rb +3 -3
- data/split/Tioga/lib/TeX_Text.rb +12 -4
- data/split/Tioga/lib/X_and_Y_Axes.rb +59 -2
- data/split/Tioga/lib/maker.rb +4 -4
- data/split/Tioga/pdfcolor.c +4 -4
- data/split/Tioga/pdfimage.c +4 -4
- data/split/Tioga/pdfpath.c +0 -1
- data/split/Tioga/pdftext.c +3 -6
- data/split/Tioga/texout.c +2 -2
- data/split/defs.h +6 -0
- data/split/mkmf2.rb +2 -2
- data/tests/tc_Dvector.rb +21 -0
- data/tests/tc_Flate.rb +3 -2
- metadata +2 -2
data/Tioga_README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
This is the README for the Tioga kernel, version 1.
|
1
|
+
This is the README for the Tioga kernel, version 1.6, March 17, 2007.
|
2
2
|
|
3
3
|
Copyright (C) 2005, 2006, 2007 Bill Paxton
|
4
4
|
|
@@ -20,35 +20,15 @@ This is the README for the Tioga kernel, version 1.5, March 17, 2007.
|
|
20
20
|
|
21
21
|
<< What's new >>
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
Version 1.6 adds numeric label "frequency" and "phase" attributes for
|
24
|
+
both axes. Previously Tioga assumed that every major tick mark got a numeric
|
25
|
+
label. Now the i'th major tick on the axis gets a label only if
|
26
|
+
mod(i+j,k)==0 where j is the phase and k is the frequency. The default
|
27
|
+
frequency is naturally 1 so that every major tick gets a label.
|
28
|
+
The full names for these attributes are xaxis_numeric_label_frequency,
|
29
|
+
xaxis_numeric_label_phase, and similar for yaxis.
|
29
30
|
|
30
|
-
Cheers, Bill
|
31
31
|
|
32
|
-
[Vincent] Version 1.5 has seen a not-so-s�mall change inthe structure of the
|
33
|
-
tutorial, which now has local links to images. So the images are now included in the
|
34
|
-
tarball (though the -without-images don't have them, for those who have sparse
|
35
|
-
disk space or bandwidth). To get a local copy of the tutorial, just run rdoc
|
36
|
-
and then link doc/images to images using the following commands:
|
37
|
-
|
38
|
-
cd doc; ln -s ../images .
|
39
|
-
|
40
|
-
There are just a few new functions this time:
|
41
|
-
* FigureMaker#create_figure_temp_files has been made part of the public
|
42
|
-
interface of tioga, it produces only the intermediate pdf and TeX files but
|
43
|
-
doesn't run pdflatex (used by ctioga)
|
44
|
-
* a Function#derivative method has been added, that does what you think it
|
45
|
-
does.
|
46
|
-
|
47
|
-
The C code has been heavily tweaked to prevent segfaults on some
|
48
|
-
architectures/distributions, and some samples were added, notably one for
|
49
|
-
insets (I'll let you find it !).
|
50
|
-
|
51
|
-
Cheers, Vincent
|
52
32
|
|
53
33
|
|
54
34
|
<< Quick Installation of Tioga >>
|
@@ -196,6 +176,41 @@ Bill Paxton
|
|
196
176
|
|
197
177
|
Here are the old release messages:
|
198
178
|
|
179
|
+
|
180
|
+
--------------------------
|
181
|
+
|
182
|
+
Version 1.5 is mainly Vincent's work, so my part of this release message
|
183
|
+
will be short. Remember how I killed off the Mac GUI last time? Turns out there
|
184
|
+
was one user who couldn't live without it -- me! So it's back, but I'm still not
|
185
|
+
making any promises about keeping it alive if Apple does something stupid in
|
186
|
+
coming releases. If you're interested in playing with it in spite of that warning,
|
187
|
+
it's available from my website (http://theory.kitp.ucsb.edu/~paxton/Tioga-1.5.dmg).
|
188
|
+
|
189
|
+
Cheers, Bill
|
190
|
+
|
191
|
+
[Vincent] Version 1.5 has seen a not-so-s�mall change inthe structure of the
|
192
|
+
tutorial, which now has local links to images. So the images are now included in the
|
193
|
+
tarball (though the -without-images don't have them, for those who have sparse
|
194
|
+
disk space or bandwidth). To get a local copy of the tutorial, just run rdoc
|
195
|
+
and then link doc/images to images using the following commands:
|
196
|
+
|
197
|
+
cd doc; ln -s ../images .
|
198
|
+
|
199
|
+
There are just a few new functions this time:
|
200
|
+
* FigureMaker#create_figure_temp_files has been made part of the public
|
201
|
+
interface of tioga, it produces only the intermediate pdf and TeX files but
|
202
|
+
doesn't run pdflatex (used by ctioga)
|
203
|
+
* a Function#derivative method has been added, that does what you think it
|
204
|
+
does.
|
205
|
+
|
206
|
+
The C code has been heavily tweaked to prevent segfaults on some
|
207
|
+
architectures/distributions, and some samples were added, notably one for
|
208
|
+
insets (I'll let you find it !).
|
209
|
+
|
210
|
+
Cheers, Vincent
|
211
|
+
|
212
|
+
--------------------------
|
213
|
+
|
199
214
|
Version 1.4 is a major overhaul with particular emphasis on the tioga user interface.
|
200
215
|
Please take a moment to go through the new section of the tutorial titled, CommandLine.
|
201
216
|
It gives a detailed discussion of the new tioga command line interface that replaces
|
@@ -226,7 +241,8 @@ Additionnally, some more classical functionalities have been added:
|
|
226
241
|
the markers, see the plot samples/figures/figures.rb: Arrows_second_take
|
227
242
|
* a function Dvector.write has been added that does exactly the
|
228
243
|
reverse of Dvector.(fancy_)read.
|
229
|
-
|
244
|
+
|
245
|
+
--------------------------
|
230
246
|
|
231
247
|
Version 1.3.1 is as usual a bug-fix release, although bugs
|
232
248
|
were not that obvious this time. Among other things,
|
@@ -255,6 +271,8 @@ uses that as its default; the previous algorithm, CONREC, is still available as
|
|
255
271
|
However, the new one seems superior -- especially if you'd like to be able to fill the contour
|
256
272
|
rather than simply stroke it. In addition, you can optionally provide it with a "mask" of flags
|
257
273
|
indicating which entries in the table are valid for use in forming the contours. Neat stuff.
|
274
|
+
|
275
|
+
--------------------------
|
258
276
|
|
259
277
|
Version 1.3.0 will automatically remove the tex temporary files it creates
|
260
278
|
(unless the autocleanup attribute is set false). Commands that used to have
|
@@ -312,10 +330,12 @@ about the change in my model of what Tioga is really doing:
|
|
312
330
|
|
313
331
|
--Bill
|
314
332
|
|
315
|
-
|
333
|
+
--------------------------
|
316
334
|
|
317
335
|
Version 1.2.1 is as usual a bug-fix release fixing some installation problems...
|
318
336
|
|
337
|
+
--------------------------
|
338
|
+
|
319
339
|
Version 1.2.0 brings in a lot of new features. First and most important, we came up with a
|
320
340
|
proper design for a real-size scheme. Now, you can use the page_setup function to ask Tioga to
|
321
341
|
produce a preview PDF of the exact size requested, so that you can include the PDF directly in
|
@@ -323,19 +343,29 @@ your documents (not only LaTeX, then). A whole bunch of debugging tools have bee
|
|
323
343
|
now set tracing tools with the (enter|exit)_(show_plot|subplot|subfigure) functions. As usual,
|
324
344
|
there is a whole bunch of small improvements and new functions to Dvector and Function.
|
325
345
|
|
346
|
+
--------------------------
|
347
|
+
|
326
348
|
Version 1.1.7 fixes a nasty runtime bug on MacOS X.
|
327
349
|
|
350
|
+
--------------------------
|
351
|
+
|
328
352
|
Version 1.1.6 provides marshalling for Dtable and Dvector. You can now use Marshal.dump and
|
329
353
|
Marshal.load with Dvectors. Dvectors and Function now have a bounds function, which return both the
|
330
354
|
minima and the maxima. Ruby is no longer complaining about Tioga when used with the -w switch.
|
331
355
|
|
356
|
+
--------------------------
|
357
|
+
|
332
358
|
Version 1.1.5 is a bug-fix release - updated to the latest mkmf2.rb to make sure all
|
333
359
|
necessary files are generated during make.
|
334
360
|
|
361
|
+
--------------------------
|
362
|
+
|
335
363
|
Version 1.1.4 is a bug-fix release - a nasty symbol clash was preventing Tioga from running
|
336
364
|
on MacOS X.3. This should now be fixed. Moreover, the load time should improve a little bit on few
|
337
365
|
architectures.
|
338
366
|
|
367
|
+
--------------------------
|
368
|
+
|
339
369
|
Version 1.1.3 provides a better integration of output within LaTeX
|
340
370
|
documents. A tioga.sty file is now available, with many macros for figure
|
341
371
|
inclusion and color names like the ones provided by Tioga.
|
@@ -353,6 +383,8 @@ X,Y data. Not many features for now, but there's room for plenty more work.
|
|
353
383
|
convert_inches_to_output, convert_output_to_inches,
|
354
384
|
convert_mm_to_output, convert_output_to_mm
|
355
385
|
|
386
|
+
--------------------------
|
387
|
+
|
356
388
|
Version 1.1.2 provides more complete control over page layout and font
|
357
389
|
selection. Here's a list of new features:
|
358
390
|
|
@@ -380,6 +412,8 @@ selection. Here's a list of new features:
|
|
380
412
|
tex_preview_fontseries
|
381
413
|
tex_preview_fontshape
|
382
414
|
|
415
|
+
--------------------------
|
416
|
+
|
383
417
|
Version 1.1.1 is the first Tioga to be called a "beta" release. You can
|
384
418
|
interpret that anyway you'd like, but to me it means Tioga has been around long
|
385
419
|
enough and had enough use to justify inviting more folks to give it a try.
|
@@ -387,21 +421,27 @@ The "alpha" label is a warning to "proceed at your own risk", and only brave
|
|
387
421
|
souls go ahead when they see that. I think Tioga has gotten stable enough
|
388
422
|
that we can drop the "threat level" down a notch. (Fingers crossed of course!)
|
389
423
|
|
424
|
+
--------------------------
|
390
425
|
|
391
426
|
Version 1.1.0 splits off the Dvector & Dtable modules from the FigureMaker so
|
392
427
|
that they can be used in other packages (Vincent Fourmond both suggested this and
|
393
428
|
did the work to make it happen).
|
394
429
|
|
430
|
+
--------------------------
|
395
431
|
|
396
432
|
Version 1.0.M no longer raises error for calls on 'stroke', 'fill', and such with an empty path.
|
397
433
|
It has also been reconfigured to support the new Mac GUI which now works with both PowerPC and Intel
|
398
434
|
processors.
|
399
435
|
|
436
|
+
--------------------------
|
437
|
+
|
400
438
|
Version 1.0.L adds 'transparency' as a synonym for (1.0 - opacity). So
|
401
439
|
now you can set 'fill_transparency' to 0.3 instead of setting 'fill_opacity'
|
402
440
|
to 0.7. I'm sure that makes your day. The documentation has also been
|
403
441
|
updated of course.
|
404
442
|
|
443
|
+
--------------------------
|
444
|
+
|
405
445
|
Version 1.0.K was Vincent Fourmond's fault! The same day that J was released,
|
406
446
|
he sent me an email pointing out an oversight in the legend functionality.
|
407
447
|
Not only that, he sent along an implementation to fix the problem! What could I do?
|
data/split/Dtable/defs.h
CHANGED
@@ -31,3 +31,9 @@
|
|
31
31
|
#define isnan(x) ((x) != (x))
|
32
32
|
/* yes, as funny as it may look NaN != NaN, and that's the only one */
|
33
33
|
#endif
|
34
|
+
|
35
|
+
/* Fix old versions of ruby.h */
|
36
|
+
#ifndef RSTRING_PTR
|
37
|
+
# define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
38
|
+
# define RSTRING_LEN(x) (RSTRING(x)->len)
|
39
|
+
#endif
|
data/split/Dtable/dtable.c
CHANGED
@@ -1531,9 +1531,10 @@ PRIVATE
|
|
1531
1531
|
/*======================================================================*/ VALUE Read_Dtable(VALUE dest, char *filename, int skip_lines) {
|
1532
1532
|
FILE *file = NULL;
|
1533
1533
|
long num_cols, num_rows;
|
1534
|
-
int i, j, k;
|
1534
|
+
int i, j, k, len;
|
1535
1535
|
const int buff_len = 10000;
|
1536
|
-
|
1536
|
+
const int err_len = 100;
|
1537
|
+
char c, buff[buff_len], *p, *pend, err_str[err_len];
|
1537
1538
|
double *data, **ptr = Dtable_Ptr(dest, &num_cols, &num_rows);
|
1538
1539
|
if ((file=fopen(filename,"r")) == NULL)
|
1539
1540
|
rb_raise(rb_eArgError, "failed to open %s", filename);
|
@@ -1571,9 +1572,12 @@ PRIVATE
|
|
1571
1572
|
}
|
1572
1573
|
if (!is_okay_number(data[j])) {
|
1573
1574
|
fclose(file);
|
1575
|
+
len = (pend-buff < err_len-1)? pend-buff : err_len-1;
|
1576
|
+
printf("len %i\n", len);
|
1577
|
+
strncpy(err_str,buff,len);
|
1574
1578
|
rb_raise(rb_eArgError,
|
1575
|
-
"
|
1576
|
-
filename, num_cols, num_rows, i+1, j);
|
1579
|
+
"failed to read requested amount of data in %s (asked for %i xs and %i ys; found only %i and %i). last attempt to read got %g from string starting with: %s",
|
1580
|
+
filename, num_cols, num_rows, i+1, j, data[j], err_str);
|
1577
1581
|
}
|
1578
1582
|
}
|
1579
1583
|
}
|
@@ -1664,9 +1668,10 @@ VALUE dtable_dump(VALUE ary, VALUE limit)
|
|
1664
1668
|
+ 8 /* 2 * length */
|
1665
1669
|
+ cols * rows * 8 ;
|
1666
1670
|
unsigned u_len;
|
1667
|
-
VALUE str =
|
1671
|
+
VALUE str = rb_str_new2("");
|
1672
|
+
rb_str_resize(str,target_len); /* This seems to do the trick */
|
1668
1673
|
/* \begin{playing with ruby's internals} */
|
1669
|
-
unsigned char * ptr = (unsigned char *)
|
1674
|
+
unsigned char * ptr = (unsigned char *) RSTRING_PTR(str);
|
1670
1675
|
/* signature byte */
|
1671
1676
|
(*ptr++) = DTABLE_DUMP_VERSION;
|
1672
1677
|
u_len = (unsigned) rows; /* limits to 4 billions rows */
|
@@ -1682,7 +1687,7 @@ VALUE dtable_dump(VALUE ary, VALUE limit)
|
|
1682
1687
|
ptr += 8;
|
1683
1688
|
}
|
1684
1689
|
}
|
1685
|
-
|
1690
|
+
/* RSTRING_LEN(str) = target_len;*/
|
1686
1691
|
return str;
|
1687
1692
|
/* \end{playing with ruby's internals} */
|
1688
1693
|
}
|
@@ -1697,7 +1702,7 @@ VALUE dtable_load(VALUE klass, VALUE str)
|
|
1697
1702
|
VALUE ret = Qnil;
|
1698
1703
|
VALUE s = StringValue(str);
|
1699
1704
|
unsigned char * buf = (unsigned char *) StringValuePtr(s);
|
1700
|
-
unsigned char * dest = buf +
|
1705
|
+
unsigned char * dest = buf + RSTRING_LEN(s);
|
1701
1706
|
unsigned i; /* for GET_UNSIGNED */
|
1702
1707
|
unsigned tmp = 0;
|
1703
1708
|
long rows, cols;
|
data/split/Dvector/defs.h
CHANGED
@@ -31,3 +31,9 @@
|
|
31
31
|
#define isnan(x) ((x) != (x))
|
32
32
|
/* yes, as funny as it may look NaN != NaN, and that's the only one */
|
33
33
|
#endif
|
34
|
+
|
35
|
+
/* Fix old versions of ruby.h */
|
36
|
+
#ifndef RSTRING_PTR
|
37
|
+
# define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
38
|
+
# define RSTRING_LEN(x) (RSTRING(x)->len)
|
39
|
+
#endif
|
data/split/Dvector/dvector.c
CHANGED
@@ -78,6 +78,17 @@ static void dvector_free(Dvector *d);
|
|
78
78
|
|
79
79
|
PRIVATE bool Is_Dvector(VALUE obj) { return is_a_dvector(obj); }
|
80
80
|
|
81
|
+
PRIVATE
|
82
|
+
/* Checks if the given object is a Dvector. Mainly here for testing
|
83
|
+
purposes, as it corresponds to the internal +is_a_dvector+.
|
84
|
+
*/
|
85
|
+
VALUE dvector_is_a_dvector(VALUE self, VALUE obj)
|
86
|
+
{
|
87
|
+
if(Is_Dvector(obj))
|
88
|
+
return Qtrue;
|
89
|
+
return Qfalse;
|
90
|
+
}
|
91
|
+
|
81
92
|
static inline void dvector_mem_clear(double *mem, int size) {
|
82
93
|
while (size--) {
|
83
94
|
*mem++ = 0.0;
|
@@ -662,7 +673,8 @@ PRIVATE
|
|
662
673
|
* a.first -> 1
|
663
674
|
* a.first(1) -> Dvector[ 1 ]
|
664
675
|
* a.first(3) -> Dvector[ 1, 2, 3 ]
|
665
|
-
*/
|
676
|
+
*/
|
677
|
+
VALUE dvector_first(int argc, VALUE *argv, VALUE ary) {
|
666
678
|
VALUE nv, result;
|
667
679
|
long n, i;
|
668
680
|
Dvector *d = Get_Dvector(ary);
|
@@ -1414,7 +1426,7 @@ PRIVATE VALUE dvector_join(VALUE ary, VALUE sep) {
|
|
1414
1426
|
len += d->len * 10;
|
1415
1427
|
if (!NIL_P(sep)) {
|
1416
1428
|
StringValue(sep);
|
1417
|
-
len +=
|
1429
|
+
len += RSTRING_LEN(sep) * (d->len - 1); /* So it works for ruby 1.9 */
|
1418
1430
|
}
|
1419
1431
|
result = rb_str_buf_new(len);
|
1420
1432
|
for (i=0; i < d->len; i++) {
|
@@ -1437,7 +1449,8 @@ PRIVATE
|
|
1437
1449
|
*
|
1438
1450
|
* Dvector[ 1, 2, 3 ].join -> "1 2 3"
|
1439
1451
|
* Dvector[ 1, 2, 3 ].join("-") -> "1-2-3"
|
1440
|
-
*/
|
1452
|
+
*/
|
1453
|
+
VALUE dvector_join_m(int argc, VALUE *argv, VALUE ary) {
|
1441
1454
|
VALUE sep;
|
1442
1455
|
rb_scan_args(argc, argv, "01", &sep);
|
1443
1456
|
if (NIL_P(sep)) sep = dvector_output_fs;
|
@@ -4405,7 +4418,7 @@ VALUE Read_Dvectors(char *filename, VALUE destinations, int first_row_of_file, i
|
|
4405
4418
|
|
4406
4419
|
if (!is_okay_number(v)) {
|
4407
4420
|
fclose(file);
|
4408
|
-
rb_raise(rb_eArgError, "ERROR:
|
4421
|
+
rb_raise(rb_eArgError, "ERROR: bad value %g in line %i of %s -- %s", v, i, filename, num_str);
|
4409
4422
|
}
|
4410
4423
|
if (row >= d->capa)
|
4411
4424
|
Dvector_Store_Double(col_obj, row, v);
|
@@ -4516,7 +4529,7 @@ VALUE Read_Rows_of_Dvectors(char *filename, VALUE destinations, int first_row_of
|
|
4516
4529
|
|
4517
4530
|
if (!is_okay_number(v)) {
|
4518
4531
|
fclose(file);
|
4519
|
-
rb_raise(rb_eArgError, "ERROR:
|
4532
|
+
rb_raise(rb_eArgError, "ERROR: bad value %g in line i% of file %s", v, i, filename);
|
4520
4533
|
}
|
4521
4534
|
if (col < d->capa) { row_data[col] = v; d->len = col+1; }
|
4522
4535
|
else {
|
@@ -4609,7 +4622,7 @@ VALUE Read_Row(char *filename, int row, VALUE row_ary) {
|
|
4609
4622
|
|
4610
4623
|
if (!is_okay_number(v)) {
|
4611
4624
|
fclose(file);
|
4612
|
-
rb_raise(rb_eArgError, "ERROR:
|
4625
|
+
rb_raise(rb_eArgError, "ERROR: bad value %g in line %i of file %s", v, i, filename);
|
4613
4626
|
}
|
4614
4627
|
Dvector_Store_Double(row_ary, col, v);
|
4615
4628
|
}
|
@@ -4991,11 +5004,13 @@ VALUE dvector_dump(VALUE ary, VALUE limit)
|
|
4991
5004
|
+ len * 8 ;
|
4992
5005
|
unsigned u_len = (unsigned) len; /* this is bad, I know, but it
|
4993
5006
|
won't hurt before it is common
|
4994
|
-
that computers have
|
5007
|
+
that computers have 32 GB of RAM...
|
4995
5008
|
*/
|
4996
|
-
|
5009
|
+
|
5010
|
+
VALUE str = rb_str_new2("");
|
5011
|
+
rb_str_resize(str,target_len); /* This seems to do the trick */
|
4997
5012
|
/* \begin{playing with ruby's internals} */
|
4998
|
-
unsigned char * ptr = (unsigned char *)
|
5013
|
+
unsigned char * ptr = (unsigned char *) RSTRING_PTR(str);
|
4999
5014
|
/* signature byte */
|
5000
5015
|
(*ptr++) = DVECTOR_DUMP_VERSION;
|
5001
5016
|
STORE_UNSIGNED(u_len, ptr); /* destroys u_len */
|
@@ -5004,7 +5019,7 @@ VALUE dvector_dump(VALUE ary, VALUE limit)
|
|
5004
5019
|
store_double(*(data++), ptr);
|
5005
5020
|
ptr += 8;
|
5006
5021
|
}
|
5007
|
-
|
5022
|
+
/* RSTRING_LEN(str) = target_len; */
|
5008
5023
|
return str;
|
5009
5024
|
/* \end{playing with ruby's internals} */
|
5010
5025
|
}
|
@@ -5019,7 +5034,7 @@ VALUE dvector_load(VALUE klass, VALUE str)
|
|
5019
5034
|
VALUE ret = Qnil;
|
5020
5035
|
VALUE s = StringValue(str);
|
5021
5036
|
unsigned char * buf = (unsigned char *) StringValuePtr(s);
|
5022
|
-
unsigned char * dest = buf +
|
5037
|
+
unsigned char * dest = buf + RSTRING_LEN(s);
|
5023
5038
|
unsigned i; /* for GET_UNSIGNED */
|
5024
5039
|
unsigned tmp = 0;
|
5025
5040
|
double * data;
|
@@ -5217,6 +5232,9 @@ void Init_Dvector() {
|
|
5217
5232
|
rb_define_singleton_method(cDvector, "linear_interpolate", dvector_linear_interpolate, -1);
|
5218
5233
|
rb_define_singleton_method(cDvector, "min_of_many", dvector_min_of_many, 1);
|
5219
5234
|
rb_define_singleton_method(cDvector, "max_of_many", dvector_max_of_many, 1);
|
5235
|
+
|
5236
|
+
rb_define_singleton_method(cDvector, "is_a_dvector", dvector_is_a_dvector, 1);
|
5237
|
+
|
5220
5238
|
|
5221
5239
|
rb_define_method(cDvector, "make_bezier_control_points_for_cubic_in_x", dvector_make_bezier_control_points_for_cubic_in_x, 6);
|
5222
5240
|
|
data/split/Flate/defs.h
CHANGED
@@ -31,3 +31,9 @@
|
|
31
31
|
#define isnan(x) ((x) != (x))
|
32
32
|
/* yes, as funny as it may look NaN != NaN, and that's the only one */
|
33
33
|
#endif
|
34
|
+
|
35
|
+
/* Fix old versions of ruby.h */
|
36
|
+
#ifndef RSTRING_PTR
|
37
|
+
# define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
38
|
+
# define RSTRING_LEN(x) (RSTRING(x)->len)
|
39
|
+
#endif
|
data/split/Flate/flate.c
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
#include "../symbols.c"
|
6
6
|
#include "zlib.h"
|
7
7
|
#include "flate_intern.h"
|
8
|
+
|
9
|
+
#include <defs.h>
|
8
10
|
/*
|
9
11
|
Copyright (C) 2005 Bill Paxton
|
10
12
|
|
@@ -65,8 +67,8 @@ PRIVATE
|
|
65
67
|
*/
|
66
68
|
VALUE do_compress(VALUE klass, VALUE str) {
|
67
69
|
str = rb_String(str);
|
68
|
-
unsigned char *ptr = (unsigned char *)
|
69
|
-
long len =
|
70
|
+
unsigned char *ptr = (unsigned char *)RSTRING_PTR(str);
|
71
|
+
long len = RSTRING_LEN(str);
|
70
72
|
unsigned long new_len = (len * 11) / 10 + 100;
|
71
73
|
unsigned char *new_ptr = ALLOC_N(unsigned char, new_len);
|
72
74
|
if (flate_compress(new_ptr, &new_len, ptr, len) != Z_OK) {
|
@@ -94,8 +96,8 @@ PRIVATE
|
|
94
96
|
|
95
97
|
VALUE do_expand(VALUE klass, VALUE str) {
|
96
98
|
str = rb_String(str);
|
97
|
-
unsigned char *ptr = (unsigned char *)
|
98
|
-
long len =
|
99
|
+
unsigned char *ptr = (unsigned char *)RSTRING_PTR(str);
|
100
|
+
long len = RSTRING_LEN(str);
|
99
101
|
unsigned long new_len = len * 4 + 100;
|
100
102
|
unsigned char *new_ptr = ALLOC_N(unsigned char, new_len);
|
101
103
|
if (flate_expand(&new_ptr, &new_len, ptr, len) != Z_OK) {
|
data/split/Function/defs.h
CHANGED
@@ -31,3 +31,9 @@
|
|
31
31
|
#define isnan(x) ((x) != (x))
|
32
32
|
/* yes, as funny as it may look NaN != NaN, and that's the only one */
|
33
33
|
#endif
|
34
|
+
|
35
|
+
/* Fix old versions of ruby.h */
|
36
|
+
#ifndef RSTRING_PTR
|
37
|
+
# define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
38
|
+
# define RSTRING_LEN(x) (RSTRING(x)->len)
|
39
|
+
#endif
|
data/split/Function/function.c
CHANGED
@@ -157,6 +157,8 @@ static VALUE function_initialize(VALUE self, VALUE x, VALUE y)
|
|
157
157
|
set_x_vector(self, x);
|
158
158
|
set_y_vector(self, y);
|
159
159
|
/* fine, this could have been written in pure Ruby...*/
|
160
|
+
set_spline_vector(self,Qnil);
|
161
|
+
/* We initialize the @spline_cache var */
|
160
162
|
}
|
161
163
|
else
|
162
164
|
rb_raise(rb_eArgError,"both vectors must have the same size");
|
@@ -638,7 +640,7 @@ static VALUE function_strip_nan(VALUE self)
|
|
638
640
|
}
|
639
641
|
|
640
642
|
/*
|
641
|
-
Splits the function into monotonic sub-functions.
|
643
|
+
Splits the function into strictly monotonic sub-functions.
|
642
644
|
Returns the array of the subfunctions. The returned values are
|
643
645
|
necessarily new values.
|
644
646
|
*/
|
@@ -678,7 +680,7 @@ static VALUE function_split_monotonic(VALUE self)
|
|
678
680
|
|
679
681
|
for(i = 2; i < size; i++)
|
680
682
|
{
|
681
|
-
if(direction * (x[i] - last_x)
|
683
|
+
if(direction * (x[i] - last_x) <= 0)
|
682
684
|
{
|
683
685
|
/* we need to add a new set of Dvectors */
|
684
686
|
f = Function_Create(cur_x, cur_y);
|
data/split/Tioga/axes.c
CHANGED
@@ -46,6 +46,8 @@ typedef struct {
|
|
46
46
|
double numeric_label_angle;
|
47
47
|
int numeric_label_alignment;
|
48
48
|
int numeric_label_justification;
|
49
|
+
int numeric_label_frequency;
|
50
|
+
int numeric_label_phase;
|
49
51
|
int numeric_label_decimal_digits; // set to 0 to use default
|
50
52
|
double *majors; /* if not NULL, then points to array of places where major ticks should appear (in figure coords) */
|
51
53
|
int nmajors; /* if majors != NULL, then this tells how many entries it contains */
|
@@ -125,6 +127,8 @@ static void Get_xaxis_Specs(FM *p, PlotAxis *s)
|
|
125
127
|
s->numeric_label_angle = p->xaxis_numeric_label_angle;
|
126
128
|
s->numeric_label_alignment = p->xaxis_numeric_label_alignment;
|
127
129
|
s->numeric_label_justification = p->xaxis_numeric_label_justification;
|
130
|
+
s->numeric_label_frequency = p->xaxis_numeric_label_frequency;
|
131
|
+
s->numeric_label_phase = p->xaxis_numeric_label_phase;
|
128
132
|
}
|
129
133
|
|
130
134
|
static void Get_yaxis_Specs(FM *p, PlotAxis *s)
|
@@ -154,6 +158,8 @@ static void Get_yaxis_Specs(FM *p, PlotAxis *s)
|
|
154
158
|
s->numeric_label_angle = p->yaxis_numeric_label_angle;
|
155
159
|
s->numeric_label_alignment = p->yaxis_numeric_label_alignment;
|
156
160
|
s->numeric_label_justification = p->yaxis_numeric_label_justification;
|
161
|
+
s->numeric_label_frequency = p->yaxis_numeric_label_frequency;
|
162
|
+
s->numeric_label_phase = p->yaxis_numeric_label_phase;
|
157
163
|
}
|
158
164
|
|
159
165
|
/*======================================================================*/
|
@@ -381,18 +387,24 @@ static char **Get_Labels(FM *p, PlotAxis *s)
|
|
381
387
|
{
|
382
388
|
char **labels = (char **)ALLOC_N(char *, s->nmajors);
|
383
389
|
char postfix[50], *ps;
|
384
|
-
int i;
|
390
|
+
int i, k, j;
|
391
|
+
k = s->numeric_label_frequency;
|
392
|
+
j = s->numeric_label_phase;
|
385
393
|
if (s->tick_labels==Qnil) { // create label strings
|
386
394
|
int mode, prec, scale;
|
387
395
|
Pick_Label_Precision(s->axis_min, s->axis_max, s->interval, s->use_fixed_pt, &mode, &prec, s->digits_max, &scale);
|
388
|
-
int i
|
396
|
+
int i;
|
397
|
+
int upper_right = (s->reversed)? 0 : s->nmajors-1;
|
398
|
+
int lower_left = (s->reversed)? s->nmajors-1 : 0;
|
389
399
|
for (i = 0; i < s->nmajors; i++) {
|
390
400
|
ps = NULL;
|
391
401
|
if (i == upper_right && !s->log_values && mode && scale)
|
392
402
|
sprintf(ps = postfix,
|
393
403
|
(s->vertical)? "$\\times$\\tiogayaxisnumericlabel{10^{%d}}" : "$\\times$\\tiogaxaxisnumericlabel{10^{%d}}",
|
394
404
|
scale);
|
395
|
-
if (i
|
405
|
+
if ((i+j) % k != 0) {
|
406
|
+
labels[i] = NULL;
|
407
|
+
} else if (i == lower_left && s->nmajors >= 2 && s->vertical &&
|
396
408
|
(s->majors[i] == ((s->reversed)? s->axis_max : s->axis_min)) &&
|
397
409
|
(s->other_axis_type == AXIS_WITH_MAJOR_TICKS_AND_NUMERIC_LABELS ||
|
398
410
|
s->other_axis_type == AXIS_WITH_TICKS_AND_NUMERIC_LABELS)) {
|
data/split/Tioga/defs.h
CHANGED
@@ -31,3 +31,9 @@
|
|
31
31
|
#define isnan(x) ((x) != (x))
|
32
32
|
/* yes, as funny as it may look NaN != NaN, and that's the only one */
|
33
33
|
#endif
|
34
|
+
|
35
|
+
/* Fix old versions of ruby.h */
|
36
|
+
#ifndef RSTRING_PTR
|
37
|
+
# define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
38
|
+
# define RSTRING_LEN(x) (RSTRING(x)->len)
|
39
|
+
#endif
|
data/split/Tioga/figures.c
CHANGED
@@ -202,6 +202,8 @@ FM *Get_FM(VALUE fmkr) {
|
|
202
202
|
DBL_ATTR(xaxis_numeric_label_angle)
|
203
203
|
INT_ATTR(xaxis_numeric_label_alignment)
|
204
204
|
INT_ATTR(xaxis_numeric_label_justification)
|
205
|
+
INT_ATTR(xaxis_numeric_label_frequency)
|
206
|
+
INT_ATTR(xaxis_numeric_label_phase)
|
205
207
|
INT_ATTR(top_edge_type)
|
206
208
|
RO_BOOL_ATTR(top_edge_visible)
|
207
209
|
INT_ATTR(bottom_edge_type)
|
@@ -234,6 +236,8 @@ FM *Get_FM(VALUE fmkr) {
|
|
234
236
|
DBL_ATTR(yaxis_numeric_label_angle)
|
235
237
|
INT_ATTR(yaxis_numeric_label_alignment)
|
236
238
|
INT_ATTR(yaxis_numeric_label_justification)
|
239
|
+
INT_ATTR(yaxis_numeric_label_frequency)
|
240
|
+
INT_ATTR(yaxis_numeric_label_phase)
|
237
241
|
INT_ATTR(left_edge_type)
|
238
242
|
RO_BOOL_ATTR(left_edge_visible)
|
239
243
|
INT_ATTR(right_edge_type)
|
@@ -575,6 +579,8 @@ void Init_FigureMaker(void) {
|
|
575
579
|
attr_accessors(xaxis_numeric_label_angle)
|
576
580
|
attr_accessors(xaxis_numeric_label_alignment)
|
577
581
|
attr_accessors(xaxis_numeric_label_justification)
|
582
|
+
attr_accessors(xaxis_numeric_label_frequency)
|
583
|
+
attr_accessors(xaxis_numeric_label_phase)
|
578
584
|
attr_accessors(top_edge_type)
|
579
585
|
attr_reader(top_edge_visible)
|
580
586
|
attr_accessors(bottom_edge_type)
|
@@ -607,6 +613,8 @@ void Init_FigureMaker(void) {
|
|
607
613
|
attr_accessors(yaxis_numeric_label_angle)
|
608
614
|
attr_accessors(yaxis_numeric_label_alignment)
|
609
615
|
attr_accessors(yaxis_numeric_label_justification)
|
616
|
+
attr_accessors(yaxis_numeric_label_frequency)
|
617
|
+
attr_accessors(yaxis_numeric_label_phase)
|
610
618
|
attr_accessors(left_edge_type)
|
611
619
|
attr_reader(left_edge_visible)
|
612
620
|
attr_accessors(right_edge_type)
|
data/split/Tioga/figures.h
CHANGED
@@ -32,6 +32,8 @@
|
|
32
32
|
#include "ruby.h"
|
33
33
|
#include "intern.h"
|
34
34
|
|
35
|
+
#include <defs.h>
|
36
|
+
|
35
37
|
// Axes
|
36
38
|
|
37
39
|
#define NO_TICKS 0
|
@@ -231,6 +233,8 @@ typedef struct {
|
|
231
233
|
double xaxis_numeric_label_angle;
|
232
234
|
int xaxis_numeric_label_alignment;
|
233
235
|
int xaxis_numeric_label_justification;
|
236
|
+
int xaxis_numeric_label_frequency;
|
237
|
+
int xaxis_numeric_label_phase;
|
234
238
|
// note that the top and bottom edges and drawn in addition to the x axis.
|
235
239
|
// if the edge type specifies ticks, the ticks match those of the x axis.
|
236
240
|
bool top_edge_visible;
|
@@ -268,6 +272,8 @@ typedef struct {
|
|
268
272
|
double yaxis_numeric_label_angle;
|
269
273
|
int yaxis_numeric_label_alignment;
|
270
274
|
int yaxis_numeric_label_justification;
|
275
|
+
int yaxis_numeric_label_frequency;
|
276
|
+
int yaxis_numeric_label_phase;
|
271
277
|
// note that the left and right edges and drawn in addition to the y axis.
|
272
278
|
// if the edge type specifies ticks, the ticks match those of the y axis.
|
273
279
|
int left_edge_type;
|
data/split/Tioga/init.c
CHANGED
@@ -228,6 +228,8 @@ void Initialize_Figure(VALUE fmkr) {
|
|
228
228
|
p->xaxis_numeric_label_angle = 0.0;
|
229
229
|
p->xaxis_numeric_label_alignment = ALIGNED_AT_MIDHEIGHT;
|
230
230
|
p->xaxis_numeric_label_justification = CENTERED;
|
231
|
+
p->xaxis_numeric_label_frequency = 1;
|
232
|
+
p->xaxis_numeric_label_phase = 0;
|
231
233
|
p->top_edge_type = EDGE_WITH_TICKS;
|
232
234
|
p->top_edge_visible = true;
|
233
235
|
p->bottom_edge_type = EDGE_WITH_TICKS;
|
@@ -263,6 +265,8 @@ void Initialize_Figure(VALUE fmkr) {
|
|
263
265
|
p->yaxis_numeric_label_angle = 0.0;
|
264
266
|
p->yaxis_numeric_label_alignment = ALIGNED_AT_MIDHEIGHT;
|
265
267
|
p->yaxis_numeric_label_justification = CENTERED;
|
268
|
+
p->yaxis_numeric_label_frequency = 1;
|
269
|
+
p->yaxis_numeric_label_phase = 0;
|
266
270
|
p->left_edge_type = EDGE_WITH_TICKS;
|
267
271
|
p->left_edge_visible = true;
|
268
272
|
p->right_edge_type = EDGE_WITH_TICKS;
|
data/split/Tioga/lib/FigMkr.rb
CHANGED
@@ -33,7 +33,7 @@ class FigureMaker
|
|
33
33
|
|
34
34
|
|
35
35
|
# The tag used for cvs export
|
36
|
-
CVS_TAG = "
|
36
|
+
CVS_TAG = "rel_1_6" # now manually cheating...
|
37
37
|
|
38
38
|
# Version now uses the CVS_TAG to create the version number. CVS_TAG should
|
39
39
|
# look like 'rel_1_1_0' for the 1.1.0 release.
|
@@ -43,10 +43,11 @@ class FigureMaker
|
|
43
43
|
if version.length > 0
|
44
44
|
return version
|
45
45
|
else
|
46
|
-
return "
|
46
|
+
return "SVN $Revision: 385 $" # Can't do better than that.
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
|
50
51
|
def FigureMaker.default
|
51
52
|
@@default_figure_maker = FigureMaker.new if @@default_figure_maker == nil
|
52
53
|
@@default_figure_maker
|
@@ -335,7 +336,6 @@ class FigureMaker
|
|
335
336
|
def figure_pdf(name)
|
336
337
|
if name.kind_of?(Integer)
|
337
338
|
num = name
|
338
|
-
name = @figure_names[num]
|
339
339
|
else
|
340
340
|
num = @figure_names.index(name)
|
341
341
|
end
|
data/split/Tioga/lib/TeX_Text.rb
CHANGED
@@ -434,8 +434,12 @@ link:images/Framebox.png
|
|
434
434
|
# tex_xaxis_numeric_label = a_string
|
435
435
|
#
|
436
436
|
# The string for a numeric label is put in this TeX command string to be formatted.
|
437
|
-
# For example,
|
438
|
-
#
|
437
|
+
# For example,
|
438
|
+
# $#1$
|
439
|
+
# will give the numbers in math mode, while
|
440
|
+
# $\mathsf{#1}$
|
441
|
+
# will show the label using the math sans-serif font.
|
442
|
+
# Alias for xaxis_numeric_label_tex.
|
439
443
|
def tex_xaxis_numeric_label
|
440
444
|
end
|
441
445
|
|
@@ -444,8 +448,12 @@ link:images/Framebox.png
|
|
444
448
|
# tex_yaxis_numeric_label = a_string
|
445
449
|
#
|
446
450
|
# The string for a numeric label is put in this TeX command string to be formatted.
|
447
|
-
# For example,
|
448
|
-
#
|
451
|
+
# For example,
|
452
|
+
# $#1$
|
453
|
+
# will give the numbers in math mode, while
|
454
|
+
# $\mathsf{#1}$
|
455
|
+
# will show the label using the math sans-serif font.
|
456
|
+
# Alias for yaxis_numeric_label_tex.
|
449
457
|
def tex_yaxis_numeric_label
|
450
458
|
end
|
451
459
|
|
@@ -468,6 +468,63 @@ class X_and_Y_Axes < Doc < FigureMaker
|
|
468
468
|
def xaxis_numeric_label_justification
|
469
469
|
end
|
470
470
|
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
# :call-seq:
|
475
|
+
# xaxis_numeric_label_frequency
|
476
|
+
# xaxis_numeric_label_frequency = an_integer
|
477
|
+
#
|
478
|
+
# The #frequency setting for numeric labels on the x axis.
|
479
|
+
# Major ticks are numbered from 0 at the small x end of the axis. Tick number k gets a
|
480
|
+
# label only if mod(i+j,k)==0 where j=xaxis_numeric_label_phase
|
481
|
+
# and k=xaxis_numeric_label_frequency.
|
482
|
+
# The default for xaxis_numeric_label_frequency is 1 so that
|
483
|
+
# every major tick gets a label.
|
484
|
+
# See also xaxis_numeric_label_phase.
|
485
|
+
def xaxis_numeric_label_frequency
|
486
|
+
end
|
487
|
+
|
488
|
+
# :call-seq:
|
489
|
+
# xaxis_numeric_label_phase
|
490
|
+
# xaxis_numeric_label_phase = an_integer
|
491
|
+
#
|
492
|
+
# The #phase setting for numeric labels on the x axis.
|
493
|
+
# The default phase is 0.
|
494
|
+
# See xaxis_numeric_label_frequency for details.
|
495
|
+
def xaxis_numeric_label_phase
|
496
|
+
end
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
# :call-seq:
|
502
|
+
# yaxis_numeric_label_frequency
|
503
|
+
# yaxis_numeric_label_frequency = an_integer
|
504
|
+
#
|
505
|
+
# The #frequency setting for numeric labels on the y axis.
|
506
|
+
# Major ticks are numbered from 0 at the small y end of the axis. Tick number k gets a
|
507
|
+
# label only if mod(i+j,k)==0 where j=yaxis_numeric_label_phase
|
508
|
+
# and k=yaxis_numeric_label_frequency.
|
509
|
+
# The default for yaxis_numeric_label_frequency is 1 so that
|
510
|
+
# every major tick gets a label.
|
511
|
+
# See also yaxis_numeric_label_phase.
|
512
|
+
def yaxis_numeric_label_frequency
|
513
|
+
end
|
514
|
+
|
515
|
+
# :call-seq:
|
516
|
+
# yaxis_numeric_label_phase
|
517
|
+
# yaxis_numeric_label_phase = an_integer
|
518
|
+
#
|
519
|
+
# The #phase setting for numeric labels on the y axis.
|
520
|
+
# The default phase is 0.
|
521
|
+
# See yaxis_numeric_label_frequency for details.
|
522
|
+
def yaxis_numeric_label_phase
|
523
|
+
end
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
471
528
|
# :call-seq:
|
472
529
|
# yaxis_visible
|
473
530
|
# yaxis_visible = false
|
@@ -737,8 +794,8 @@ link:images/Special_Y.png
|
|
737
794
|
end
|
738
795
|
|
739
796
|
# :call-seq:
|
740
|
-
#
|
741
|
-
#
|
797
|
+
# xaxis_tick_interval
|
798
|
+
# xaxis_tick_interval = a_float
|
742
799
|
#
|
743
800
|
# If 0, then tioga will pick the interval between major tick marks on the x axis.
|
744
801
|
# Otherwise, this will be used as the interval in x coordinates for the spacing between major ticks.
|
data/split/Tioga/lib/maker.rb
CHANGED
@@ -113,8 +113,8 @@ def command_loop
|
|
113
113
|
if fname == nil
|
114
114
|
puts "must give file name as argument for make_portfolio command"
|
115
115
|
else
|
116
|
-
fm.
|
117
|
-
|
116
|
+
result = fm.make_portfolio(fname,nil,true)
|
117
|
+
puts result
|
118
118
|
puts "####00" # GUI uses this
|
119
119
|
end
|
120
120
|
end
|
@@ -142,8 +142,8 @@ def command_loop
|
|
142
142
|
if !have_loaded
|
143
143
|
puts "must load a file before make_all"
|
144
144
|
else
|
145
|
-
|
146
|
-
fm.num_figures.times {|i| fm.make_preview_pdf(i) }
|
145
|
+
fm.require_all(nil, true)
|
146
|
+
#fm.num_figures.times {|i| fm.make_preview_pdf(i) }
|
147
147
|
end
|
148
148
|
puts "####00" # GUI uses this
|
149
149
|
elsif cmd == "name"
|
data/split/Tioga/pdfcolor.c
CHANGED
@@ -233,7 +233,7 @@ VALUE FM_private_axial_shading(VALUE fmkr, VALUE x0, VALUE y0, VALUE x1, VALUE y
|
|
233
233
|
lookup = rb_String(lookup);
|
234
234
|
c_axial_shading(p, convert_figure_to_output_x(p,NUM2DBL(x0)), convert_figure_to_output_y(p,NUM2DBL(y0)),
|
235
235
|
convert_figure_to_output_x(p,NUM2DBL(x1)), convert_figure_to_output_y(p,NUM2DBL(y1)),
|
236
|
-
NUM2INT(hival),
|
236
|
+
NUM2INT(hival), RSTRING_LEN(lookup), (unsigned char *)(RSTRING_PTR(lookup)),
|
237
237
|
extend_start == Qtrue, extend_end == Qtrue);
|
238
238
|
return fmkr;
|
239
239
|
}
|
@@ -291,7 +291,7 @@ VALUE FM_private_radial_shading(VALUE fmkr,
|
|
291
291
|
c_radial_shading(p,
|
292
292
|
NUM2DBL(x0), NUM2DBL(y0), NUM2DBL(r0),
|
293
293
|
NUM2DBL(x1), NUM2DBL(y1), NUM2DBL(r1),
|
294
|
-
NUM2INT(hival),
|
294
|
+
NUM2INT(hival), RSTRING_LEN(lookup), (unsigned char *)(RSTRING_PTR(lookup)),
|
295
295
|
convert_figure_to_output_dx(p,NUM2DBL(a)), convert_figure_to_output_dy(p,NUM2DBL(b)),
|
296
296
|
convert_figure_to_output_dx(p,NUM2DBL(c)), convert_figure_to_output_dy(p,NUM2DBL(d)),
|
297
297
|
convert_figure_to_output_x(p,0.0), convert_figure_to_output_y(p,0.0),
|
@@ -356,8 +356,8 @@ VALUE FM_get_color_from_colormap(VALUE fmkr, VALUE color_map, VALUE color_positi
|
|
356
356
|
color_position = rb_Float(color_position);
|
357
357
|
double x = NUM2DBL(color_position);
|
358
358
|
color_map = rb_String(color_map);
|
359
|
-
unsigned char *buff = (unsigned char *)(
|
360
|
-
int len =
|
359
|
+
unsigned char *buff = (unsigned char *)(RSTRING_PTR(color_map)), r, g, b, i;
|
360
|
+
int len = RSTRING_LEN(color_map);
|
361
361
|
if (len % 3 != 0) rb_raise(rb_eArgError, "Sorry: color_map length must be a multiple of 3 (for R G B components)");
|
362
362
|
i = 3 * ROUND(x * ((len/3)-1));
|
363
363
|
r = buff[i]; g = buff[i+1]; b = buff[i+2];
|
data/split/Tioga/pdfimage.c
CHANGED
@@ -260,7 +260,7 @@ VALUE FM_private_show_jpg(VALUE fmkr, VALUE filename, VALUE width, VALUE height,
|
|
260
260
|
height = rb_Integer(height);
|
261
261
|
mask_obj_num = rb_Integer(mask_obj_num);
|
262
262
|
filename = rb_String(filename);
|
263
|
-
c_show_jpg(p,
|
263
|
+
c_show_jpg(p, RSTRING_PTR(filename), NUM2INT(width), NUM2INT(height), dest, NUM2INT(mask_obj_num));
|
264
264
|
return fmkr;
|
265
265
|
}
|
266
266
|
|
@@ -487,8 +487,8 @@ static VALUE private_show_image(int image_type, VALUE fmkr, VALUE llx, VALUE lly
|
|
487
487
|
hival = rb_Integer(hival);
|
488
488
|
hivalue = NUM2INT(hival);
|
489
489
|
lookup = rb_String(lookup);
|
490
|
-
lookup_str = (unsigned char *)(
|
491
|
-
lookup_len =
|
490
|
+
lookup_str = (unsigned char *)(RSTRING_PTR(lookup));
|
491
|
+
lookup_len = RSTRING_LEN(lookup);
|
492
492
|
}
|
493
493
|
dest[0] = convert_figure_to_output_x(p,NUM2DBL(llx));
|
494
494
|
dest[1] = convert_figure_to_output_y(p,NUM2DBL(lly));
|
@@ -497,7 +497,7 @@ static VALUE private_show_image(int image_type, VALUE fmkr, VALUE llx, VALUE lly
|
|
497
497
|
dest[4] = convert_figure_to_output_x(p,NUM2DBL(ulx));
|
498
498
|
dest[5] = convert_figure_to_output_y(p,NUM2DBL(uly));
|
499
499
|
int obj_num = c_private_show_image(p, image_type, dest, (interpolate != Qfalse), (reversed == Qtrue), NUM2INT(w), NUM2INT(h),
|
500
|
-
(unsigned char *)
|
500
|
+
(unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data), mask_min, mask_max, hivalue, lookup_str, lookup_len, NUM2INT(mask_obj_num));
|
501
501
|
return INT2FIX(obj_num);
|
502
502
|
}
|
503
503
|
|
data/split/Tioga/pdfpath.c
CHANGED
@@ -34,7 +34,6 @@ static void croak_on_nonok(FM *p, const char * function)
|
|
34
34
|
}
|
35
35
|
|
36
36
|
/* small macro to check if a number is ok to be output */
|
37
|
-
#define is_okay_number(x) ((x) - (x) == 0.0)
|
38
37
|
|
39
38
|
#define CROAK_ON_NONOK(p) croak_on_nonok(p, __FUNCTION__)
|
40
39
|
#define ARE_OK_NUMBERS(x,y) if(! is_okay_number(x) || ! is_okay_number(y)) {\
|
data/split/Tioga/pdftext.c
CHANGED
@@ -149,7 +149,7 @@ static int c_register_font(char *font_name)
|
|
149
149
|
VALUE FM_register_font(VALUE fmkr, VALUE font_name)
|
150
150
|
{
|
151
151
|
font_name = rb_String(font_name);
|
152
|
-
int font_num = c_register_font(
|
152
|
+
int font_num = c_register_font(RSTRING_PTR(font_name));
|
153
153
|
return INT2FIX(font_num);
|
154
154
|
}
|
155
155
|
|
@@ -253,7 +253,7 @@ VALUE FM_marker_string_info(VALUE fmkr, VALUE font_number, VALUE string, VALUE s
|
|
253
253
|
FM *p = Get_FM(fmkr);
|
254
254
|
font_number = rb_Integer(font_number);
|
255
255
|
string = rb_String(string);
|
256
|
-
unsigned char *text = (unsigned char *)(
|
256
|
+
unsigned char *text = (unsigned char *)(RSTRING_PTR(string));
|
257
257
|
scale = rb_Float(scale);
|
258
258
|
double ft_ht = p->default_text_scale * NUM2DBL(scale) * p->default_font_size * ENLARGE;
|
259
259
|
int ft_height = ROUND(ft_ht);
|
@@ -277,9 +277,6 @@ VALUE FM_marker_string_info(VALUE fmkr, VALUE font_number, VALUE string, VALUE s
|
|
277
277
|
|
278
278
|
#define TRANSFORM_VEC(dx,dy) tmp = dx; dx = (dx) * a + (dy) * c; dy = tmp * b + (dy) * d;
|
279
279
|
|
280
|
-
/* This macro checks that it's a real number we're looking at */
|
281
|
-
#define is_okay_number(x) ((x) - (x) == 0.0)
|
282
|
-
|
283
280
|
void c_rotated_string_at_points(FM *p, double rotation, int font_number, unsigned char *text, double scale,
|
284
281
|
int n, double *xs, double *ys, int alignment, int justification, double horizontal_scaling, double vertical_scaling,
|
285
282
|
double italic_angle, double ascent_angle)
|
@@ -403,7 +400,7 @@ VALUE FM_private_show_marker(VALUE fmkr, VALUE integer_args, VALUE stroke_width,
|
|
403
400
|
}
|
404
401
|
} else {
|
405
402
|
string = rb_String(string);
|
406
|
-
text = (unsigned char *)(
|
403
|
+
text = (unsigned char *)(RSTRING_PTR(string));
|
407
404
|
}
|
408
405
|
fprintf(TF, "%d Tr\n", mode);
|
409
406
|
if (stroke_color != Qnil && stroke_color != p->stroke_color &&
|
data/split/Tioga/texout.c
CHANGED
@@ -151,7 +151,7 @@ VALUE FM_show_rotated_text(VALUE fmkr, VALUE text, VALUE frame_side, VALUE shift
|
|
151
151
|
angle = rb_Float(angle);
|
152
152
|
justification = rb_Integer(justification);
|
153
153
|
alignment = rb_Integer(alignment);
|
154
|
-
c_show_rotated_text(p,
|
154
|
+
c_show_rotated_text(p, RSTRING_PTR(text), NUM2INT(frame_side), NUM2DBL(shift),
|
155
155
|
NUM2DBL(fraction), NUM2DBL(scale), NUM2DBL(angle), NUM2INT(justification), NUM2INT(alignment));
|
156
156
|
return fmkr;
|
157
157
|
}
|
@@ -174,7 +174,7 @@ VALUE FM_show_rotated_label(VALUE fmkr, VALUE text,
|
|
174
174
|
angle = rb_Float(angle);
|
175
175
|
justification = rb_Integer(justification);
|
176
176
|
alignment = rb_Integer(alignment);
|
177
|
-
c_show_rotated_label(p,
|
177
|
+
c_show_rotated_label(p, RSTRING_PTR(text), NUM2DBL(xloc), NUM2DBL(yloc),
|
178
178
|
NUM2DBL(scale), NUM2DBL(angle), NUM2INT(justification), NUM2INT(alignment));
|
179
179
|
return fmkr;
|
180
180
|
}
|
data/split/defs.h
CHANGED
@@ -31,3 +31,9 @@
|
|
31
31
|
#define isnan(x) ((x) != (x))
|
32
32
|
/* yes, as funny as it may look NaN != NaN, and that's the only one */
|
33
33
|
#endif
|
34
|
+
|
35
|
+
/* Fix old versions of ruby.h */
|
36
|
+
#ifndef RSTRING_PTR
|
37
|
+
# define RSTRING_PTR(x) (RSTRING(x)->ptr)
|
38
|
+
# define RSTRING_LEN(x) (RSTRING(x)->len)
|
39
|
+
#endif
|
data/split/mkmf2.rb
CHANGED
@@ -78,7 +78,7 @@ module Mkmf2
|
|
78
78
|
include Config
|
79
79
|
|
80
80
|
# The CVS tag used for the release.
|
81
|
-
CVS_TAG = '$Name$'
|
81
|
+
CVS_TAG = '$Name: $'
|
82
82
|
|
83
83
|
# The module version; it is computed from CVS_TAG
|
84
84
|
VERSION = CVS_TAG.match(/\D+(.*?)\s*\$?$/)[1].tr('_-','..')
|
@@ -616,7 +616,7 @@ module Mkmf2
|
|
616
616
|
MAKEFILE_CONFIG["INCLUDE_INSTALL_DIR"] =
|
617
617
|
"$(DESTDIR)$(includedir)"
|
618
618
|
MAKEFILE_CONFIG["EXEC_INSTALL_DIR"] =
|
619
|
-
File.join("$(prefix)", "bin")
|
619
|
+
File.join("$(DESTDIR)$(prefix)", "bin")
|
620
620
|
|
621
621
|
when "local"
|
622
622
|
MAKEFILE_CONFIG["RUBYLIB_INSTALL_DIR"] =
|
data/tests/tc_Dvector.rb
CHANGED
@@ -16,6 +16,13 @@ class TestDvector < Test::Unit::TestCase
|
|
16
16
|
return "#{dir}/#{file_name}"
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
# Checks if the internal Is_Dvector is working properly,
|
21
|
+
# as it seems problematic in Ruby 1.9
|
22
|
+
def test_isa_dvector
|
23
|
+
a = Dvector.new
|
24
|
+
assert(Dvector.is_a_dvector(a))
|
25
|
+
end
|
19
26
|
|
20
27
|
def test_read_nasty_fortran_data
|
21
28
|
row = Dvector.read_row(real_file_name("dvector_read_test.data"))
|
@@ -771,6 +778,19 @@ EOT
|
|
771
778
|
assert_equal(v, v_bis)
|
772
779
|
end
|
773
780
|
|
781
|
+
NB_NUMBERS = 10000
|
782
|
+
def test_stress_marshall
|
783
|
+
1.times do
|
784
|
+
v = Dvector.new
|
785
|
+
1.upto(NB_NUMBERS) do
|
786
|
+
v << rand * 10 ** (100 - 100 * rand)
|
787
|
+
end
|
788
|
+
s = Marshal.dump(v)
|
789
|
+
v_bis = Marshal.restore(s)
|
790
|
+
assert_equal(v, v_bis)
|
791
|
+
end
|
792
|
+
end
|
793
|
+
|
774
794
|
def test_bounds
|
775
795
|
v = Dvector[0.0/0.0, 0.0/0.0, 1,2,4,5,9,0.0/0.0,0.1]
|
776
796
|
assert_equal(v.bounds, [0.1, 9])
|
@@ -787,5 +807,6 @@ EOT
|
|
787
807
|
assert_equal(a,c)
|
788
808
|
assert_equal(b,d)
|
789
809
|
end
|
810
|
+
|
790
811
|
|
791
812
|
end
|
data/tests/tc_Flate.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: tioga
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "1.
|
7
|
-
date: 2007-
|
6
|
+
version: "1.6"
|
7
|
+
date: 2007-05-23 00:00:00 +02:00
|
8
8
|
summary: Tioga - a powerful scientific plotting library
|
9
9
|
require_paths:
|
10
10
|
- lib
|