ripole.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ripOLE_object

Functions

int ROLE_set_defaults (struct ripOLE_object *role)
int ROLE_parse_parameters (struct ripOLE_object *role, int argc, char **argv)
int ROLE_set_parameters (struct ripOLE_object *role, struct OLE_object *ole)
int ROLE_report_filename_decoded (char *filename)
int ROLE_init (struct ripOLE_object *role)
int ROLE_done (struct ripOLE_object *role)
int ROLE_validate (struct ripOLE_object *role)
int ripole (char *inputfile, char *outputdir, int debug, int verbose)


Function Documentation

int ripole ( char *  inputfile,
char *  outputdir,
int  debug,
int  verbose 
)

end of ripOLE

Definition at line 369 of file ripole.c.

00370 {
00371   /*struct OLE_object *ole = NULL;*/
00372   struct OLE_object ole;
00373        int result = 0;
00374 
00375        /*ole = MALLOC(sizeof(struct OLE_object));
00376        if (ole == NULL)
00377        {
00378                LOGGER_log("ripOLE: Cannot allocate memory for OLE object");
00379                return 1;
00380        }*/
00381 
00382        LOGGER_set_output_mode(_LOGGER_STDOUT);
00383 
00384        OLE_init(&ole);
00385        if (debug ==1 ) OLE_set_debug(&ole, OLE_DEBUG_NORMAL);
00386        if (verbose == 1) OLE_set_verbose(&ole, OLE_VERBOSE_NORMAL);
00387        /*ole->save_unknown_streams==2 added for Scilab to extract onlyexcel streams
00388          see  OLE_decode_stream in ole.c file */
00389        OLE_set_save_unknown_streams(&ole, 2); /* get only excel streams */
00390 
00391        OLE_set_filename_report_fn(&ole, ROLE_report_filename_decoded );
00392 
00393        result = OLE_decode_file( &ole, inputfile, outputdir);
00394        OLE_decode_file_done(&ole);
00395 
00396 
00397        if ((result != 0)&&(verbose==1))
00398          LOGGER_log("ripOLE: decoding of %s resulted in error %d\n", inputfile, result );
00399 
00400        /*if (ole != NULL) FREE(ole);*/
00401        return result;
00402 }

int ROLE_done ( struct ripOLE_object role  ) 

Definition at line 255 of file ripole.c.

References FREE, ripOLE_object::inputfile, NULL, and ripOLE_object::outputdir.

00256 {
00257         if (role->inputfile != NULL) FREE(role->inputfile);
00258         if (role->outputdir != NULL) FREE(role->outputdir);
00259 
00260         return 0;
00261 }

int ROLE_init ( struct ripOLE_object role  ) 

Definition at line 227 of file ripole.c.

References ripOLE_object::debug, ripOLE_object::inputfile, NULL, ripOLE_object::outputdir, ripOLE_object::save_unknown_streams, and ripOLE_object::verbose.

00228 {
00229         role->debug = 0;
00230         role->verbose = 0;
00231         role->save_unknown_streams = 0;
00232 
00233         role->inputfile = NULL;
00234         role->outputdir = NULL;
00235 
00236         return 0;
00237 }

int ROLE_parse_parameters ( struct ripOLE_object role,
int  argc,
char **  argv 
)

Definition at line 71 of file ripole.c.

References ripOLE_object::debug, defaultdir, help, i, ripOLE_object::inputfile, ripOLE_object::outputdir, result, ripOLE_object::save_unknown_streams, ripOLE_object::verbose, and version.

00072 {
00073         int i;
00074         int result = 0;
00075 
00076         role->outputdir = defaultdir;
00077 
00078         for (i = 1; i < argc; i++)
00079         {
00080                 if (argv[i][0] == '-')
00081                 {
00082                         switch (argv[i][1])
00083                         {
00084                                 case 'i':
00085                                         i++;
00086                                         role->inputfile = strdup(argv[i]);
00087                                         break;
00088 
00089                                 case 'd':
00090                                         i++;
00091                                         role->outputdir = strdup(argv[i]);
00092                                         break;
00093 
00094                                 case 'v':
00095                                         role->verbose = 1;
00096                                         break;
00097 
00098                                 case 'V':
00099                                         fprintf (stdout, "%s\n", version);
00100                                         exit (1);
00101                                         break;
00102                                 case 'h':
00103                                         fprintf (stdout, "%s\n", help);
00104                                         exit (1);
00105                                         break;
00106 
00107                                         /* if we get ANOTHER - symbol, then we have an extended flag*/
00108 
00109                                 case '-':
00110                                         if (strncmp (&(argv[i][2]), "verbose", 7) == 0)
00111                                         {
00112                                                 role->verbose=1;
00113 
00114                                         } else if (strncmp (&(argv[i][2]), "save-unknown-streams", 20) == 0) {
00115                                                 role->save_unknown_streams = 1;
00116 
00117                                         } else if (strncmp (&(argv[i][2]), "debug", 5) == 0) {
00118                                                 role->debug=1;
00119 
00120                                         } else if (strncmp (&(argv[i][2]), "version", 7) == 0) {
00121                                                 fprintf (stdout, "%s\n", version);
00122                                                 exit (1);
00123 
00124                                         } else if (strncmp(&(argv[i][2]),"help",4)==0) {
00125                                                 fprintf(stdout,"%s\n",help);
00126                                                 exit(1);
00127 
00128                                         } else {
00129                                                 fprintf(stdout,"Cannot interpret option \"%s\"\n%s\n", argv[i], help);
00130                                                 exit (1);
00131                                                 break;
00132                                         }
00133                                         break;
00134 
00135                                         /* else, just dump out the help message*/
00136 
00137                                 default:
00138                                         fprintf(stdout,"Cannot interpret option \"%s\"\n%s\n", argv[i], help);
00139                                         exit (1);
00140                                         break;
00141 
00142                         }                       /* Switch argv[i][1]*/
00143 
00144                 }                       /* if argv[i][0] == -*/
00145 
00146         }                               /* for*/
00147 
00148         return result;
00149 }

int ROLE_report_filename_decoded ( char *  filename  ) 

Definition at line 203 of file ripole.c.

References LOGGER_log().

Referenced by ripole().

00204 {
00205         LOGGER_log("Decoding filename=%s", filename);
00206 
00207         return 0;
00208 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ROLE_set_defaults ( struct ripOLE_object role  ) 

Definition at line 43 of file ripole.c.

References ripOLE_object::debug, defaultdir, ripOLE_object::inputfile, NULL, ripOLE_object::outputdir, ripOLE_object::save_unknown_streams, and ripOLE_object::verbose.

00044 {
00045         role->outputdir = defaultdir;
00046         role->debug = 0;
00047         role->verbose = 0;
00048         role->save_unknown_streams = 0;
00049         role->inputfile = NULL;
00050 
00051         return 0;
00052 }

int ROLE_set_parameters ( struct ripOLE_object role,
struct OLE_object ole 
)

Definition at line 167 of file ripole.c.

References ripOLE_object::debug, OLE_DEBUG_NORMAL, OLE_set_debug(), OLE_set_save_unknown_streams(), OLE_set_verbose(), OLE_VERBOSE_NORMAL, ripOLE_object::save_unknown_streams, and ripOLE_object::verbose.

00168 {
00169         if(role->debug == 1)
00170         {
00171                 OLE_set_debug(ole, OLE_DEBUG_NORMAL);
00172         } 
00173 
00174         if (role->verbose == 1)
00175         {
00176                 OLE_set_verbose(ole, OLE_VERBOSE_NORMAL);
00177         }
00178 
00179         if (role->save_unknown_streams == 1)
00180         {
00181                 OLE_set_save_unknown_streams(ole, 1);
00182         }
00183 
00184         return 0;
00185 }

Here is the call graph for this function:

int ROLE_validate ( struct ripOLE_object role  ) 

Definition at line 279 of file ripole.c.

References ripOLE_object::inputfile, NULL, and result.

00280 {
00281         int result = 0;
00282 
00283         if (role->inputfile == NULL) {
00284                 fprintf(stderr,"ripOLE requires an input file to decode\n");
00285                 return -1;
00286         }
00287 
00288         return result;
00289 }


Generated on Sun Mar 4 15:19:22 2007 for Scilab [trunk] by  doxygen 1.5.1