#include <string.h>
#include <stdlib.h>
#include <stdio.h>
Go to the source code of this file.
|
#define | MAX_STRING 2048 |
|
#define | STRDUP(str) ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL) |
|
#define | STRDEL(str) {if((str)!=NULL) {free(str);str=NULL;}} |
|
#define STRDEL |
( |
|
str | ) |
{if((str)!=NULL) {free(str);str=NULL;}} |
#define STRDUP |
( |
|
str | ) |
((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL) |
char ** GetWords |
( |
char * |
a_string, |
|
|
char * |
a_limiter, |
|
|
int * |
a_number |
|
) |
| |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition at line 104 of file win32def.c.
References free(), malloc(), realloc(), STRDEL, and STRDUP.
Referenced by main().
112 #define STRDUP(str) ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
113 #define STRDEL(str) {if((str)!=NULL) {free(str);str=NULL;}}
121 if(a_number!=NULL) *a_number = 0;
122 if( (a_string==NULL) || (*a_string==
'\0') )
return NULL;
123 if(a_limiter==NULL)
return NULL;
125 string =
STRDUP(a_string);
126 if(
string==NULL)
return NULL;
129 list = (
char**)
malloc(nline*
sizeof(
char*));
130 if(list==NULL)
return NULL;
136 pos = strstr (token,a_limiter);
142 list = (
char**)
realloc(list,nline*
sizeof(
char*));
143 if(list==NULL)
return NULL;
148 token = pos + strlen(a_limiter);
153 list = (
char**)
realloc(list,nline*
sizeof(
char*));
154 if(list==NULL)
return NULL;
163 for(count=0;count<iline;count++) list[count] =
STRDUP(list[count]);
168 if(a_number!=NULL) *a_number = 0;
171 if(a_number!=NULL) *a_number = iline;
void * realloc(void *__ptr, size_t __size)
void * malloc(size_t __size)
int main |
( |
int |
aArgn, |
|
|
char ** |
aArgs |
|
) |
| |
Definition at line 31 of file win32def.c.
References buffer, free(), GetWords(), and MAX_STRING.
37 #define MAX_STRING 2048
48 if(fgets(buffer,
MAX_STRING,stdin)==NULL)
return EXIT_FAILURE;
53 length = strlen(buffer);
54 if( (length>=2) && (buffer[length-2]==
'\r') && (buffer[length-1]==
'\n') ) {
55 buffer[length-2] =
'\0';
58 }
else if((length>=1) && (buffer[length-1]==
'\n')) {
59 buffer[length-1] =
'\0';
62 if(strstr(buffer,
"SECT")==NULL)
continue;
63 if(strstr(buffer,
"External")==NULL)
continue;
64 if(strstr(buffer,
"??_")!=NULL) {
65 if(strstr(buffer,
"operator/=")==NULL)
continue;
72 words =
GetWords (buffer,
" ",&wordn);
76 if(strcmp(words[4],
"()")==0) {
78 }
else if(strcmp(words[4],
"External")==0) {
81 if(words[iword][0]==
'_') offset = 1;
83 if( (iword==6) && (strstr(buffer,
"static class")!=NULL) ){
85 printf(
" %s\n",words[iword]+offset);
88 printf(
" %s\tDATA\n",words[iword]+offset);
91 printf(
" %s\n",words[iword]+offset);
96 for(count=0;count<wordn;count++)
if(words[count])
free(words[count]);
97 if(words)
free(words);}
char ** GetWords(char *, char *, int *)