#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
gehe zum Quellcode dieser Datei
void add_hash |
( |
unsigned int |
val, |
|
|
char * |
sym |
|
) |
| |
void cut_export_token |
( |
char * |
sym) | |
|
Definiert in Zeile 250 der Datei makeexport.c.
252 const char*
token=
"_EXPORTEDSYM_";
253 int sizetoken =
strlen(token);
256 fin=sym+
strlen(sym)-sizetoken;
257 for(;sym<=fin;sym++) {
258 if (!
memcmp(sym,token,sizetoken)) {
259 for (src=sym+
strlen(token); *
src; src++,sym++)
char * find_last_token |
( |
char * |
sym) | |
|
Definiert in Zeile 267 der Datei makeexport.c.
273 if ( *sym==
' ' && sym[1]>
' ')
unsigned int hash |
( |
unsigned char * |
str) | |
|
Definiert in Zeile 59 der Datei makeexport.c.
61 unsigned int hash = 5381;
65 while ((c = *
str++) != 0)
66 hash = ((hash << 5) + hash) ^ c;
char * load_from_file |
( |
const char * |
filename) | |
|
Definiert in Zeile 229 der Datei makeexport.c.
232 static struct stat st;
237 size = (
stat((
char*)filename, &st)==0)?st.st_size:0;
239 buf = (
char*)
malloc(size+1);
241 size =
read(f, buf, size);
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definiert in Zeile 143 der Datei makeexport.c.
147 printf(
"#error Not enough arguments for export list maker.\n");
157 printf(
"#error Error creation exportlist.h.\n");
162 printf(
"#error Error creation exportlist.txt.\n");
166 fprintf(out_h,
"//Auto generated file. Do not edit the contents of this file.\n");
167 fprintf(out_h,
"//Update the modules/module_exportlist.c file\n\n");
168 fprintf(out_h,
"#ifndef MODULE_EXPORTLIST_H\n");
169 fprintf(out_h,
"#define MODULE_EXPORTLIST_H\n\n");
172 char* build = BUILD_NUMBER;
176 for ( ; *build; build++) {
177 if ( *build<'0' || *build>
'9')
continue;
178 build_num += mult*
strtol(build, &e, 0);
179 if ( mult==1 )
break;
184 fprintf(out_h,
"#define CHDK_BUILD_NUM %d\n\n",build_num);
191 fprintf(out_hash,
"// This is an automatically generated file. DO NOT EDIT!\n");
192 fprintf(out_hash,
"\n#include \"module_hash.h\"\n\n");
193 fprintf(out_hash,
"// Address references so that symbol table will compile and link.\n// Don't need correct signatures here, just the name for linking.\n");
198 fprintf(out_hash,
"extern int %s;\n",
hash_vals[n].symbol+1);
202 fprintf(out_hash,
"extern void %s(void);\n",
hash_vals[n].symbol);
205 fprintf(out_hash,
"\n// Symbol hash table for resolving exported symbol references\nsym_hash symbol_hash_table[] =\n{\n");
210 fprintf(out_hash,
"};\n");
213 fprintf(out_h,
"#define EXPORTLIST_COUNT %d\n\n",hash_idx);
215 fprintf(out_h,
"#error Malformed export list. Only %d valid records\n\n",hash_idx);
218 fprintf(out_h,
"#endif\n");
int process_file |
( |
const char * |
name, |
|
|
FILE * |
out_txt |
|
) |
| |
Definiert in Zeile 71 der Datei makeexport.c.
79 printf(
"makeexport: file not found '%s'\n", name);
86 for(; *cur==9 || *cur==
' '; cur++)
89 for(cur++; *cur && *cur!=
')'; cur++);
90 for(; *cur==9 || *cur==
' ' || *cur==
')'; cur++);
97 for(cur++; *cur==9 || *cur==
' '; cur++);
101 for(; (*cur>=
'A' && *cur<=
'Z') ||
102 (*cur>=
'a' && *cur<=
'z') ||
103 (*cur>=
'0' && *cur<=
'9') ||
108 char symbol[256], full_symbol[257];
111 if ( size>255) {size=255;}
112 memcpy(symbol,cursym,size);
115 if (is_address)
strcpy(full_symbol,
"&");
116 strcat(full_symbol,symbol);
121 fprintf(out_txt,
"%08x %s\n",hash_val,symbol);
122 for(; size>=0; size--)
124 if ( symbol[size]>=
'a' && symbol[size]<=
'z')
129 for(; *cur && *cur!=10; cur++);
130 for(; *cur==10; cur++);