Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensyn_to_c.c
Go to the documentation of this file.
00001 #include <stdio.h> 00002 00003 static int was_space = 0; 00004 static int first_char = 1; 00005 00006 static void put_char (int c) 00007 { 00008 if (c == '\n') { 00009 if (!first_char) { 00010 fputs ("\\n\"\n\"", stdout); 00011 first_char = 1; 00012 } 00013 } 00014 else { 00015 first_char = 0; 00016 if (c == '\\') 00017 fputs ("\\\\", stdout); 00018 else if (c == '\"') 00019 fputs ("\\\"", stdout); 00020 else if (!was_space || !(c == ' ' || c == '\t')) 00021 fputc (c, stdout); 00022 was_space = (c == ' ' || c == '\t'); 00023 } 00024 } 00025 00026 int main (int argc, char *argv[]) 00027 { 00028 int c; 00029 FILE *f; 00030 00031 if (argc == 1) 00032 return 1; 00033 f = fopen (argv[1], "r"); 00034 if (f == NULL) 00035 return 1; 00036 00037 fputs ("\n", stdout); 00038 fputs ("/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */\n", stdout); 00039 fputs ("\n", stdout); 00040 fputs ("\"", stdout); 00041 c = getc (f); 00042 while (c != EOF) { 00043 if (c == '/') { 00044 int c2 = getc (f); 00045 if (c2 == '*') { 00046 was_space = 0; 00047 c = getc (f); 00048 for (;;) { 00049 if (c == '*') { 00050 c2 = getc (f); 00051 if (c2 == '/') 00052 break; 00053 } 00054 c = getc (f); 00055 } 00056 } 00057 else { 00058 put_char (c); 00059 put_char (c2); 00060 } 00061 } 00062 else { 00063 put_char (c); 00064 } 00065 c = getc (f); 00066 } 00067 fputs ("\"\n", stdout); 00068 00069 fclose (f); 00070 return 0; 00071 } 00072 Generated on Sun May 27 2012 04:20:35 for ReactOS by
1.7.6.1
|