2 * This file is part of the OpenPTS project.
4 * The Initial Developer of the Original Code is International
5 * Business Machines Corporation. Portions created by IBM
6 * Corporation are Copyright (C) 2010 International Business
7 * Machines Corporation. All Rights Reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the Common Public License as published by
11 * IBM Corporation; either version 1 of the License, or (at your option)
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * Common Public License for more details.
19 * You should have received a copy of the Common Public License
20 * along with this program; if not, a copy can be viewed at
21 * http://www.opensource.org/licenses/cpl1.0.php.
26 * \brief Utility, generate dot file from UML2 state siagram
27 * @author Seiji Munetoh <munetoh@users.sourceforge.jp>
30 * UML State Diagram -> DOT --(graphviz)--> Graph(PNG,JPG etc)
39 #include <sys/types.h>
40 #include <sys/socket.h>
41 #include <netinet/in.h>
53 fprintf(stderr, NLS(MS_OPENPTS, OPENPTS_UML2DOT_USAGE,
54 "usage: uml2dot [options] UMLfile \n"
55 "\t-o output\tset output file (default is stdout)\n"
56 "\t$ dot -Tpng foo.dot -o foo.png; eog foo.png\n"
63 int main(int argc, char *argv[]) {
66 OPENPTS_FSM_CONTEXT *ctx;
67 char *input_filename = NULL;
68 char *output_filename = NULL;
72 while ((c = getopt(argc, argv, "do:h")) != EOF) {
78 output_filename = optarg;
89 input_filename = argv[0];
91 /* Read UML(XML) file */
93 if (input_filename == NULL) {
94 printf(NLS(MS_OPENPTS, OPENPTS_UML2DOT_MISSING_XML_FILE, "ERROR missing XMLfile\n"));
100 ctx = newFsmContext();
101 rc = readUmlModel(ctx, argv[0]);
109 rc = writeDotModel(ctx, output_filename);