• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • dcop
 

dcop

  • dcop
  • dcopidl
dcopidl/main.cpp
1 /*****************************************************************
2 Copyright (c) 1999 Torben Weis <weis@kde.org>
3 Copyright (c) 2000 Matthias Ettrich <ettrich@kde.org>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11 
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14 
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22 ******************************************************************/
23 #include <tqstring.h>
24 #include <tqfile.h>
25 #include <tqcstring.h>
26 #include <stdlib.h>
27 
28 void dcopidlParse( const char *_code );
29 
30 int idl_line_no;
31 
32 #if YYDEBUG
33 extern int yydebug;
34 #endif
35 
36 int main( int argc, char** argv )
37 {
38  if (argc != 2)
39  {
40  fprintf(stderr, "Usage : dcopidl input_file\n");
41  return -1;
42  }
43  TQFile file( argv[1] );
44  if ( !file.open( IO_ReadOnly ) )
45  {
46  fprintf(stderr, "Can't open input file\n");
47  return -1;
48  }
49 
50  TQByteArray arr = TQByteArray(file.readAll());
51  uint len = arr.size();
52  uint j = 1;
53  for (uint i = 1; i<len; i++, j++) {
54  if (arr[ i-1 ] == '\r' && ((i+1)==len || arr[ i ] != '\n')) {
55  // change single \r's (Mac OS line endings) to \n
56  arr[ j-1 ] = '\n';
57  if ((i+1)==len) //special case: cut last character
58  j--;
59  }
60  else if (arr[ i-1 ] == '\r' && arr[ i ] == '\n') {
61  // change \r\n's (win32 line endings) to \n
62  arr[ j-1 ] = '\n';
63  i++; //skip \n
64  }
65  else if (i!=j) {
66  arr[ j-1 ] = arr[ i-1 ];
67  }
68  }
69  len = j;
70  arr.resize( len + 1 );
71  arr[ len ] = 0;
72 
73 #if YYDEBUG
74  char *debug = getenv("DEBUG");
75  if (debug)
76  yydebug = 1;
77 #endif
78  idl_line_no = 1;
79 
80  printf("<!DOCTYPE DCOP-IDL><DCOP-IDL>\n");
81  printf("<SOURCE>%s</SOURCE>\n", argv[1] );
82  dcopidlParse( arr.data() );
83  printf("</DCOP-IDL>\n");
84 
85  file.close();
86  return 0;
87 }

dcop

Skip menu "dcop"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

dcop

Skip menu "dcop"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for dcop by doxygen 1.9.1
This website is maintained by Timothy Pearson.