unoidl2

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/unoidl2.git/
Log | Files | Refs

unoidl2xml.c (1313B)


      1 /* unoidl2xml -- convert uno idl input to xml */
      2 /*
      3    This file is part of unoidl2.
      4 
      5    unoidl2 is free software: you can redistribute it and/or modify
      6    it under the terms of the GNU General Public License as published by
      7    the Free Software Foundation, either version 3 of the License, or
      8    (at your option) any later version.
      9 
     10    unoidl2 is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13    GNU General Public License for more details.
     14 
     15    You should have received a copy of the GNU General Public License
     16    along with unoidl2.  If not, see <http://www.gnu.org/licenses/>.
     17 */
     18 
     19 #include "unoidl2.h"
     20 #include "parse.c.h"
     21 
     22 #include <stdio.h>
     23 
     24 extern int yyparse();
     25 
     26 extern Any ast;
     27 
     28 void pr(Any x) {
     29   if(x) {
     30     if(consp(x)) {
     31       printf("<");
     32       print(car(x));
     33       printf(">");
     34       Any d;
     35       for(d = cdr(x); d; d = cdr(d)) {
     36         printf(" ");
     37         if(consp(d))
     38           pr(car(d));
     39         else {
     40           printf(". ");
     41           pr(d);
     42           break;
     43         }
     44       }
     45       printf("</");
     46       print(car(x));
     47       printf(">\n");
     48     } else
     49       print(x);
     50   } else
     51     printf("NIL");
     52 }
     53 
     54 int main() {
     55   init();
     56   yyparse();
     57   pr(ast);
     58   return 0;
     59 }