RZ

01: // DemandMediator.gateway.cc # the actual synthesize algorithm
02:
03: #include <cstring>
04: #include <string>
05: #include <sstream>
06: #include <iostream>
07:
08: #include "RZError.hh"
09: #include "GetoptVerbose.hh"
10:
11: #include "DemandWrapper.hh"
12: #include "DemandMediator.hh"
13:
14: namespace RZ {
15:     int debug = 0, verbose = 0;
16: }
17:
18: namespace RZ {
19:     struct FullWrapper rz_wrapper;
20:     struct ConTable rz_tab;
21: }
22:
23: int main(unsigned int argc, char **argv)
24: {
25:     // ######## gnu and library specific stuff ########
26:
27:     //std::ios::sync_with_stdio(false);
28:     std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
29:
30:     // invocation DemandMediate.gateway
31:     //   -I includedirectory
32:     //   RANGEFD REMOTEFD RECONSTITUTEDFD 
33:     //   debuglevel verbosity [--given[fd] GIVENFD...]*
34:
35:     if (argc < 9)
36:         throw RZ::Error("Insufficient number of commandline arguments");
37:
38:     if (argc % 2 == 1)
39:         throw RZ::Error("Impossible number of commandline arguments");
40:
41:     if (std::strcmp("-I", argv[1]))
42:         throw RZ::Error("no include directory in commandline arguments");
43:     std::string included(argv[2]);
44:
45:     int reconstitutedfd = 0, rangefd = 0, remotefd = 0;
46:     std::vector< int > givenfd;
47:     std::vector< std::string > given;
48:     (std::istringstream(argv[3])) >> rangefd;
49:     (std::istringstream(argv[4])) >> remotefd;
50:     (std::istringstream(argv[5])) >> reconstitutedfd;
51:     (std::istringstream(argv[6])) >> RZ::debug;
52:     (std::istringstream(argv[7])) >> RZ::verbose;
53:     for (unsigned int i = 8; i < argc; i += 2) {
54:         if (std::strcmp("--givenfd", argv[i]) == 0) {
55:             int t = 0;
56:             (std::istringstream(argv[i + 1])) >> t;
57:             givenfd.push_back(t);
58:         }
59:         else if (std::strcmp("--given", argv[i]) == 0) {
60:             given.push_back(argv[i]);
61:         }
62:     }
63:
64:     DemandMediator::demand_mediator(
65:         included, 0, rangefd, remotefd, reconstitutedfd,
66:         givenfd.begin(), givenfd.end(), given.begin(), given.end());
67:
68:     return 0;
69: }
70:     
71: // DemandMediator.gateway.cc # the actual synthesize algorithm