7 Copyright (C) 2009-2010, Nicolas VIVIEN
8 Copyright (C) 2005-2012, Net Direct Inc. (http://www.netdirect.ca/)
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
24 #include <barry/barry.h>
25 #include <barry/barryalx.h>
31 #include "barrygetopt.h"
34 using namespace Barry
;
39 const char *description
;
43 const static struct Languages langs
[] = {
44 { "en", OS_LANG_ENGLISH
, "English" },
45 { "ar", OS_LANG_ARABIC
, "Arabic" },
46 { "ca", OS_LANG_CATALAN
, "Catalan" },
47 { "cs", OS_LANG_CZECH
, "Czech" },
48 { "de", OS_LANG_GERMAN
, "German" },
49 { "sp", OS_LANG_SPANISH
, "Spanish" },
50 { "fr", OS_LANG_FRENCH
, "French" },
51 { "he", OS_LANG_HEBREW
, "Hebrew" },
52 { "hu", OS_LANG_HUNGARIAN
, "Hungarian" },
53 { "it", OS_LANG_ITALIAN
, "Italian" },
54 { "ja", OS_LANG_JAPANESE
, "Japanese" },
55 { "ko", OS_LANG_KOREAN
, "Korean" },
61 int logical
, major
, minor
;
62 const char *Version
= Barry::Version(logical
, major
, minor
);
65 << "balxparse - Command line ALX parser\n"
66 << " Copyright 2009-2010, Nicolas VIVIEN.\n"
67 << " Copyright 2005-2012, Net Direct Inc. (http://www.netdirect.ca/)\n"
68 << " Using: " << Version
<< "\n"
71 << " -i lang Internationalization language\n"
72 << " -d path OS path with all ALX files\n"
73 << " -o file OS ALX filename (Platform.alx)\n"
75 << " <ALX file> ...\n"
76 << " Parse one or several ALX files.\n"
78 << " Language supported :\n"
81 for (int i
=0; langs
[i
].code
!=NULL
; i
++) {
82 string s
= (string
) langs
[i
].code
+ " : " + (string
) langs
[i
].description
;
84 cerr
<< left
<< setfill(' ') << setw(18) << s
;
94 int main(int argc
, char *argv
[], char *envp
[])
104 vector
<string
> filenames
;
106 // process command line options
108 int cmd
= getopt(argc
, argv
, "hi:d:o:");
114 case 'd': // ALX path
118 case 'o': // OS ALX filename (Platform.alx)
122 case 'i': // Language
136 // Put the remaining arguments into an array
137 for (; argc
> 0; argc
--, argv
++) {
138 filenames
.push_back(string(argv
[0]));
145 os
.AddProperties("_vendorID", "");
148 if (lang
.length() > 0) {
149 for (int i
=0; langs
[i
].code
!=NULL
; i
++) {
150 string code
= langs
[i
].code
;
153 os
.AddProperties("langid", langs
[i
].alxid
);
157 if (osfilename
.length() > 0)
158 os
.LoadALXFile(osfilename
, false);
160 if (pathname
.length() > 0)
163 if (!filenames
.empty()) {
164 vector
<string
>::iterator i
= filenames
.begin(), end
= filenames
.end();
165 for( ; i
!= end
; ++i
) {
166 os
.LoadALXFile((*i
), true);
173 } catch( std::exception
&e
) {
174 cout
<< e
.what() << endl
;