1*ab595ff6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*ab595ff6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*ab595ff6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*ab595ff6SAndrew Rist * distributed with this work for additional information
6*ab595ff6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*ab595ff6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*ab595ff6SAndrew Rist * "License"); you may not use this file except in compliance
9*ab595ff6SAndrew Rist * with the License. You may obtain a copy of the License at
10*ab595ff6SAndrew Rist *
11*ab595ff6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*ab595ff6SAndrew Rist *
13*ab595ff6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*ab595ff6SAndrew Rist * software distributed under the License is distributed on an
15*ab595ff6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ab595ff6SAndrew Rist * KIND, either express or implied. See the License for the
17*ab595ff6SAndrew Rist * specific language governing permissions and limitations
18*ab595ff6SAndrew Rist * under the License.
19*ab595ff6SAndrew Rist *
20*ab595ff6SAndrew Rist *************************************************************/
21*ab595ff6SAndrew Rist
22*ab595ff6SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include <iostream>
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include "dependy.hxx"
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir int
30cdf0e10cSrcweir #ifdef WNT
31cdf0e10cSrcweir _cdecl
32cdf0e10cSrcweir #endif
main(int argc,char * argv[])33cdf0e10cSrcweir main( int argc,
34cdf0e10cSrcweir char * argv[] )
35cdf0e10cSrcweir {
36cdf0e10cSrcweir if (argc < 2 || *argv[1] == '?')
37cdf0e10cSrcweir {
38cdf0e10cSrcweir std::cout << "\nUse:\n"
39cdf0e10cSrcweir << "srvdepy.exe <xml-component-descriptions-root-directory>\n"
40cdf0e10cSrcweir << std::endl;
41cdf0e10cSrcweir return 0;
42cdf0e10cSrcweir }
43cdf0e10cSrcweir
44cdf0e10cSrcweir
45cdf0e10cSrcweir DependencyFinder aDependencies;
46cdf0e10cSrcweir
47cdf0e10cSrcweir aDependencies.GatherData(argv[1]);
48cdf0e10cSrcweir char sInput[500] = "";
49cdf0e10cSrcweir std::vector<Simstr> aLibs;
50cdf0e10cSrcweir std::vector<Simstr> aServs;
51cdf0e10cSrcweir
52cdf0e10cSrcweir
53cdf0e10cSrcweir std::cout
54cdf0e10cSrcweir << "\nNow you can start to put in Service names.\n"
55cdf0e10cSrcweir << "Please use correct case, but don't use namespaces.\n"
56cdf0e10cSrcweir << "Just the Service's own name.\n\n"
57cdf0e10cSrcweir << "To stop the program, put in a hashmark \"#\" + ENTER.\n"
58cdf0e10cSrcweir << std::endl;
59cdf0e10cSrcweir
60cdf0e10cSrcweir
61cdf0e10cSrcweir
62cdf0e10cSrcweir do {
63cdf0e10cSrcweir
64cdf0e10cSrcweir sInput[0] = 0;
65cdf0e10cSrcweir std::cin >> sInput;
66cdf0e10cSrcweir Simstr sImplService(sInput);
67cdf0e10cSrcweir if (*sInput != '#')
68cdf0e10cSrcweir {
69cdf0e10cSrcweir aLibs.erase( aLibs.begin(), aLibs.end() );
70cdf0e10cSrcweir aServs.erase( aServs.begin(), aServs.end() );
71cdf0e10cSrcweir
72cdf0e10cSrcweir aDependencies.FindNeededServices( aLibs, aServs, sImplService );
73cdf0e10cSrcweir
74cdf0e10cSrcweir std::cout << "\n\n\nNeeded libraries: " << std::endl;
75cdf0e10cSrcweir for ( unsigned i = 0; i < aLibs.size(); ++i )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir std::cout << " " << aLibs[i].str() << std::endl;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir std::cout << "\nNeeded services: " << std::endl;
80cdf0e10cSrcweir for ( unsigned s= 0; s < aServs.size(); ++s )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir std::cout << " " << aServs[s].str() << std::endl;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir std::cout << "\n\n" << std::endl;
85cdf0e10cSrcweir }
86cdf0e10cSrcweir } while (*sInput != '#');
87cdf0e10cSrcweir
88cdf0e10cSrcweir return 0;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir
91cdf0e10cSrcweir
92