main.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #include <qstring.h>
00024 #include <qfile.h>
00025 #include <qcstring.h>
00026 #include <stdlib.h>
00027 
00028 void dcopidlParse( const char *_code );
00029 
00030 int idl_line_no;
00031 
00032 #if YYDEBUG
00033 extern int yydebug;
00034 #endif
00035 
00036 int main( int argc, char** argv )
00037 {
00038     if (argc != 2)
00039     {
00040         fprintf(stderr, "Usage : dcopidl input_file\n");
00041         return -1;
00042     }
00043     QFile file( argv[1] );
00044     if ( !file.open( IO_ReadOnly ) )
00045     {
00046         fprintf(stderr, "Can't open input file\n");
00047         return -1;
00048     }
00049 
00050     QByteArray arr = file.readAll();
00051     int len = arr.size();
00052     arr.resize( len + 1 );
00053     arr[ len ] = 0;
00054 
00055 #if YYDEBUG
00056     char *debug = getenv("DEBUG");
00057     if (debug)
00058     yydebug = 1;
00059 #endif
00060     idl_line_no = 1;
00061 
00062     printf("<!DOCTYPE DCOP-IDL><DCOP-IDL>\n");
00063     printf("<SOURCE>%s</SOURCE>\n", argv[1] );
00064     dcopidlParse( arr.data() );
00065     printf("</DCOP-IDL>\n");
00066 
00067     file.close();
00068     return 0;
00069 }
 
This file is part of the documentation for dcop Library Version 3.2.0.