Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
1baa890f
Commit
1baa890f
authored
Jul 12, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New language design with textfile and binary tree
parent
8e9d0172
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
320 additions
and
171 deletions
+320
-171
src/lib/co/src/co_lng.cpp
src/lib/co/src/co_lng.cpp
+242
-160
src/lib/co/src/co_lng.h
src/lib/co/src/co_lng.h
+78
-11
No files found.
src/lib/co/src/co_lng.cpp
View file @
1baa890f
This diff is collapsed.
Click to expand it.
src/lib/co/src/co_lng.h
View file @
1baa890f
...
...
@@ -8,6 +8,9 @@
<Description>. */
#include <iostream.h>
#include <fstream.h>
#if defined __cplusplus
extern
"C"
{
#endif
...
...
@@ -16,11 +19,70 @@ extern "C" {
# include "pwr.h"
#endif
#ifndef co_tree_h
# include "co_tree.h"
#endif
typedef
enum
{
lng_eLanguage_en_us
=
0
,
lng_eLanguage_sv_se
=
1
lng_eLanguage_
,
lng_eLanguage_en_us
,
lng_eLanguage_sv_se
,
lng_eLanguage_ru_ru
}
lng_eLanguage
;
typedef
struct
{
char
text
[
80
];
char
type
;
}
lang_sKey
;
typedef
struct
{
tree_sNode
n
;
lang_sKey
key
;
char
transl
[
80
];
}
lang_sRecord
;
class
Row
{
public:
char
type
;
int
n1
;
int
n2
;
int
n3
;
char
text
[
200
];
int
row
;
ifstream
&
fp
;
char
fname
[
200
];
Row
(
ifstream
&
f
,
char
*
filename
)
:
row
(
0
),
fp
(
f
)
{
strcpy
(
text
,
""
);
strcpy
(
fname
,
filename
);}
bool
eq
(
Row
&
r
)
{
return
n1
==
r
.
n1
&&
n2
==
r
.
n2
&&
n3
==
r
.
n3
;}
bool
lt
(
Row
&
r
)
{
if
(
n1
<
r
.
n1
)
return
true
;
else
if
(
n1
>
r
.
n1
)
return
false
;
if
(
n2
<
r
.
n2
)
return
true
;
else
if
(
n2
>
r
.
n2
)
return
false
;
if
(
n3
<
r
.
n3
)
return
true
;
return
false
;
}
bool
gt
(
Row
&
r
)
{
if
(
n1
>
r
.
n1
)
return
true
;
else
if
(
n1
<
r
.
n1
)
return
false
;
if
(
n2
>
r
.
n2
)
return
true
;
else
if
(
n2
<
r
.
n2
)
return
false
;
if
(
n3
>
r
.
n3
)
return
true
;
return
false
;
}
};
class
Lng
{
public:
Lng
()
{};
...
...
@@ -41,19 +103,24 @@ class Lng {
static
const
int
Open_Plc___
=
13
;
static
char
items
[][
2
][
40
];
static
void
set
(
lng_eLanguage
language
)
{
lang
=
language
;};
static
tree_sTable
*
tree
;
static
bool
read
();
static
bool
read_line
(
Row
&
r
);
static
char
*
translate
(
char
*
text
);
static
char
*
get_language_str
();
static
int
translate
(
char
*
in
,
char
*
out
);
static
void
unload
();
static
void
set
(
lng_eLanguage
language
);
static
lng_eLanguage
current
()
{
return
lang
;}
static
void
set
(
char
*
language
)
{
if
(
strcmp
(
language
,
"en_us"
)
==
0
)
lang
=
lng_eLanguage_en_us
;
else
if
(
strcmp
(
language
,
"sv_se"
)
==
0
)
lang
=
lng_eLanguage_sv_se
;};
static
void
set
(
char
*
language
);
static
char
*
get
(
int
item
)
{
return
items
[
lang
][
item
];}
;
{
return
items
[
lang
][
item
];}
static
char
*
get
(
lng_eLanguage
language
,
int
item
)
{
return
items
[
language
][
item
];};
static
char
*
translate
(
char
*
str
);
static
int
translate
(
char
*
in
,
char
*
out
);
static
char
*
get_language_str
();
{
return
items
[
language
][
item
];}
static
void
get_uid
(
char
*
in
,
char
*
out
);
static
lng_eLanguage
str_to_lang
(
char
*
str
);
static
char
*
lang_to_str
(
lng_eLanguage
language
);
};
#if defined __cplusplus
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment