The R Project SVN R

Rev

Rev 15641 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15641 Rev 15789
Line 30... Line 30...
30
#include "Graphics.h"
30
#include "Graphics.h"
31
#include "R_ext/Error.h"
31
#include "R_ext/Error.h"
32
#include "Fileio.h"
32
#include "Fileio.h"
33
#include <Rdevices.h>
33
#include <Rdevices.h>
34
 
34
 
-
 
35
#ifdef __MRC__
-
 
36
extern char *R_fgets(char *buf, int i, FILE *fp);
-
 
37
#endif
-
 
38
 
35
#define INVALID_COL 0xff0a0b0c
39
#define INVALID_COL 0xff0a0b0c
36
 
40
 
37
/* Define this to use hyphen except in -[0-9] */
41
/* Define this to use hyphen except in -[0-9] */
38
#undef USE_HYPHEN
42
#undef USE_HYPHEN
39
/* In ISOLatin1, minus is 45 and hyphen is 173 */
43
/* In ISOLatin1, minus is 45 and hyphen is 173 */
Line 202... Line 206...
202
}
206
}
203
 
207
 
204
static int KeyType(char *s)
208
static int KeyType(char *s)
205
{
209
{
206
    int i;
210
    int i;
-
 
211
#ifdef __MRC__
-
 
212
    if (*s == '\n' || *s == '\r')
-
 
213
#else
207
    if (*s == '\n')
214
    if (*s == '\n')
-
 
215
#endif
208
	return Empty;
216
	return Empty;
209
    for (i = 0; KeyWordDictionary[i].keyword; i++)
217
    for (i = 0; KeyWordDictionary[i].keyword; i++)
210
	if (MatchKey(s, KeyWordDictionary[i].keyword))
218
	if (MatchKey(s, KeyWordDictionary[i].keyword))
211
	    return KeyWordDictionary[i].code;
219
	    return KeyWordDictionary[i].code;
212
    return Unknown;
220
    return Unknown;
Line 356... Line 364...
356
 
364
 
357
    if (c < 0) p = NULL;
365
    if (c < 0) p = NULL;
358
    while (1) {
366
    while (1) {
359
	if (feof(fp)) { p = NULL; return 1; }
367
	if (feof(fp)) { p = NULL; return 1; }
360
	if (!p || *p == '\n' || *p == '\0') {
368
	if (!p || *p == '\n' || *p == '\0') {
-
 
369
#ifdef __MRC__
-
 
370
	p = R_fgets(buf, 1000, fp);	 
-
 
371
#else
361
	    p = fgets(buf, 1000, fp);
372
	    p = fgets(buf, 1000, fp);
-
 
373
#endif
-
 
374
	    
362
	}
375
	}
363
	while (isspace((int)*p)) p++;
376
	while (isspace((int)*p)) p++;
364
	if (p == '\0' || *p == '%'|| *p == '\n') { p = NULL; continue; }
377
	if (p == '\0' || *p == '%'|| *p == '\n') { p = NULL; continue; }
365
	p0 = p;
378
	p0 = p;
366
	while (!isspace((int)*p)) p++;
379
	while (!isspace((int)*p)) p++;
Line 431... Line 444...
431
    for (ii = 0; ii < 256; ii++) {
444
    for (ii = 0; ii < 256; ii++) {
432
	charnames[ii][0] = '\0';
445
	charnames[ii][0] = '\0';
433
	metrics->CharInfo[ii].WX = NA_SHORT;
446
	metrics->CharInfo[ii].WX = NA_SHORT;
434
	for(j = 0; j < 4; j++) metrics->CharInfo[ii].BBox[j] = 0;
447
	for(j = 0; j < 4; j++) metrics->CharInfo[ii].BBox[j] = 0;
435
    }
448
    }
-
 
449
#ifdef __MRC__
-
 
450
    while (R_fgets(buf, BUFSIZE, fp)) { 
-
 
451
#else
436
    while (fgets(buf, BUFSIZE, fp)) {
452
    while (fgets(buf, BUFSIZE, fp)) {
-
 
453
#endif
437
	switch(KeyType(buf)) {
454
	switch(KeyType(buf)) {
438
 
455
 
439
	case StartFontMetrics:
456
	case StartFontMetrics:
440
	    mode = StartFontMetrics;
457
	    mode = StartFontMetrics;
441
	    break;
458
	    break;