verzia 1.11, 2002/10/09 22:06:35 |
verzia 1.12, 2002/10/11 22:56:04 |
Riadok 74 char *name(char *buffer) |
|
Riadok 74 char *name(char *buffer) |
|
if (*buffer == '#') { |
if (*buffer == '#') { |
num[2] = *(buffer + 1); |
num[2] = *(buffer + 1); |
num[3] = *(buffer + 2); |
num[3] = *(buffer + 2); |
*ret = (char) strtoul((char *) &num, NULL, 16); |
*ret = (char) strtoul(num, NULL, 16); |
ret++; |
ret++; |
buffer += 3; |
buffer += 3; |
} |
} |
Riadok 88 char *name(char *buffer) |
|
Riadok 88 char *name(char *buffer) |
|
/* parse arrays */ |
/* parse arrays */ |
char **array(char *buffer) |
char **array(char *buffer) |
{ |
{ |
char **ret = NULL; |
char **ret; |
int end = 1, len, index = 0; |
int len, index, end; |
if (*buffer != '[') |
if (*buffer != '[') |
return NULL; |
return NULL; |
ret[index] = (char *) xmalloc(1); |
ret = (char **) xmalloc(1); |
*ret[index] = '['; |
ret[0] = (char *) xmalloc(2 * sizeof(char)); |
index++; |
*ret[0] = '['; |
buffer += 2; |
ret[0][1] = '\0'; |
|
if(*(buffer + 1) == ' ') |
|
buffer += 2; |
|
else |
|
buffer++; |
|
end = index = 1; |
do { |
do { |
if (*buffer == ']') |
if (*buffer == ']') |
end--; |
end--; |
if (*buffer == '[') |
if (*buffer == '[') |
end++; |
end++; |
|
ret = (char **) realloc(ret,index + 1); |
len = strlento(buffer, ' '); |
len = strlento(buffer, ' '); |
ret[index] = (char *) xmalloc(len); |
ret[index] = (char *) xcalloc(len,1); |
strncpy(ret[index], buffer, len); |
strncpy(ret[index], buffer, len); |
|
ret[index][len] = '\0'; |
buffer += len + 1; |
buffer += len + 1; |
index++; |
index++; |
} while (end > 0); |
} while (end > 0); |
Riadok 199 long get_startxref(void) |
|
Riadok 206 long get_startxref(void) |
|
void probe_ptree(int num) |
void probe_ptree(int num) |
{ |
{ |
char *p, **kids; |
char *p, **kids; |
p = strstr(object[num]->unparsed, "/Type "); |
p = strstr(object[num]->unparsed, "/Page"); |
if (!p) { |
if (!p) { |
/* error */ |
/* error */ |
return; |
return; |
} |
} |
if (!strcmp(p, "/Pages")) |
if (*(p + 5) == 's') |
object[num]->type = PAGES; |
object[num]->type = PAGES; |
else { |
else { |
object[num]->type = PAGE; |
page_tree[current_page] = num; |
/* parse_page(num); */ |
current_page++; |
return; |
return; |
} |
} |
p = strstr(object[num]->unparsed, "/Kids "); |
p = strstr(object[num]->unparsed, "/Kids "); |
Riadok 216 void probe_ptree(int num) |
|
Riadok 223 void probe_ptree(int num) |
|
/* error */ |
/* error */ |
return; |
return; |
} |
} |
kids = array(p); |
kids = array(p + 6); |
while (**kids != ']') { |
for (kids++;**kids != ']';kids += 2) |
/* some code */ |
probe_ptree(atoi(*kids)); |
kids += 2; |
return; |
} |
|
} |
} |
|
|
/* find objects and add it to object structure */ |
/* find objects and add it to object structure */ |
Riadok 288 int parse_catalog(void) |
|
Riadok 294 int parse_catalog(void) |
|
p = strstr(object[trailer.root]->unparsed, "/Pages"); |
p = strstr(object[trailer.root]->unparsed, "/Pages"); |
if (!p) { |
if (!p) { |
/* error */ |
/* error */ |
return; |
|
} |
} |
object[trailer.root]->parsed = c = |
object[trailer.root]->parsed = c = |
(struct catalog *) xmalloc(sizeof(struct catalog)); |
(struct catalog *) xmalloc(sizeof(struct catalog)); |
Riadok 298 int parse_catalog(void) |
|
Riadok 303 int parse_catalog(void) |
|
return c->pages; |
return c->pages; |
} |
} |
|
|
int parse_pdf(void) |
void parse_pdf(void) |
{ |
{ |
int ret; |
int ret,count; |
|
char *p; |
xref(); |
xref(); |
ret = parse_catalog(); |
ret = parse_catalog(); |
|
p = strstr(object[ret]->unparsed,"/Count "); |
|
sscanf(p,"/Count %d \n",&count); |
|
page_tree = (int *) malloc(count); |
|
current_page = 0; |
|
sleep(60); |
/* probe_ptree(ret); */ |
/* probe_ptree(ret); */ |
return 0; |
return; |
} |
} |