| verzia 1.12, 2002/11/30 19:38:09 |
verzia 1.13, 2002/12/19 00:16:44 |
|
|
| #include "cpdf.h" |
#include "cpdf.h" |
| #include "svga.h" |
#include "svga.h" |
| |
|
| /* $Platon: cpdf/cpdf.c,v 1.11 2002/11/10 16:58:30 lynx Exp $ */ |
/* $Platon: cpdf/cpdf.c,v 1.12 2002/11/30 19:38:09 lynx Exp $ */ |
| static struct option lopt[] = { |
static struct option lopt[] = { |
| |
|
| {"mode", required_argument, 0, 'm'}, |
{"mode", required_argument, 0, 'm'}, |
| Riadok 29 void usage(char *prg) |
|
| Riadok 29 void usage(char *prg) |
|
| int main(int argc, char **argv) |
int main(int argc, char **argv) |
| { |
{ |
| char c; |
char c; |
| int mode = G800x600x64K, index = 0; |
int mode = G800x600x64K, in = 0; |
| int p = 0; |
int p = 0; |
| if (argc == 1) |
if (argc == 1) |
| usage(argv[0]); |
usage(argv[0]); |
| while ((c = |
while ((c = |
| getopt_long(argc - 1, &argv[1], "m:p:", lopt, |
getopt_long(argc - 1, &argv[1], "m:p:", lopt, |
| &index)) != -1) { |
&in)) != -1) { |
| switch (c) { |
switch (c) { |
| case 'm': |
case 'm': |
| if (argv[optind + 1] == NULL) |
if (argv[optind + 1] == NULL) |
| Riadok 67 int main(int argc, char **argv) |
|
| Riadok 67 int main(int argc, char **argv) |
|
| } |
} |
| { |
{ |
| char ispdf[5]; |
char ispdf[5]; |
| fread(ispdf, 5, 1, fp); |
fread(ispdf, sizeof(ispdf), sizeof(char), fp); |
| if (strncmp(ispdf, "%PDF-", 5) != 0) { |
if (strncmp(ispdf, "%PDF-", sizeof(ispdf)) != 0) { |
| fprintf(stderr, "%s is not PDF document!\n", |
fprintf(stderr, "%s is not PDF document!\n", |
| argv[1]); |
argv[1]); |
| exit(errno); |
exit(errno); |
| } |
} |
| } |
} |
| #ifdef DEBUG |
#ifndef DEBUG |
| printf("Using %s mode\n", vga_getmodename(mode)); |
printf("Using %s mode\n", vga_getmodename(mode)); |
| #endif |
|
| vga_init(); |
vga_init(); |
| vga_setmode(mode); |
vga_setmode(mode); |
| gl_setcontextvga(mode); |
gl_setcontextvga(mode); |
| Riadok 87 int main(int argc, char **argv) |
|
| Riadok 86 int main(int argc, char **argv) |
|
| gl_getcontext(virtualscreen); |
gl_getcontext(virtualscreen); |
| gl_setcontext(virtualscreen); |
gl_setcontext(virtualscreen); |
| gl_clearscreen(0xFFFFFFFF); |
gl_clearscreen(0xFFFFFFFF); |
| |
{ |
| |
char *i; |
| |
i = vga_getmodename(mode) + 1; |
| |
screen.x = (int) strtoul(i,NULL,10); |
| |
i = (char *) memchr(i,'x',sizeof(G1280x1024x16M32)) + 1; |
| |
screen.y = (int) strtoul(i,NULL,10); |
| |
i = (char *) memchr(i,'x',sizeof(G1280x1024x16M32)) + 1; |
| |
if(*i == '2' && *(i + 1) == '\0') |
| |
screen.color = 2; |
| |
if(*i == '1' && *(i + 1) == '6' && *(i + 2) == '\0') |
| |
screen.color = 16; |
| |
if(!strncmp(i,"256",3)) |
| |
screen.color = 256; |
| |
if(!strncmp(i,"32K",3)) |
| |
screen.color = K32; |
| |
if(!strncmp(i,"64K",3)) |
| |
screen.color = K64; |
| |
if(!strncmp(i,"16M",3)) |
| |
screen.color = M16; |
| |
} |
| |
#endif |
| parse_pdf(); |
parse_pdf(); |
| current_page = p; |
current_page = p; |
| loop(); |
loop(); |