Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
0b76dea9
Commit
0b76dea9
authored
11 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
explain
parent
f3ff1013
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/OS.cpp
+9
-6
9 additions, 6 deletions
Common/OS.cpp
Common/onelab.h
+3
-4
3 additions, 4 deletions
Common/onelab.h
with
12 additions
and
10 deletions
Common/OS.cpp
+
9
−
6
View file @
0b76dea9
...
...
@@ -43,7 +43,7 @@
#if defined(WIN32) && !defined(__CYGWIN__)
// U
TF8
utility routines borrowed from FLTK
// U
nicode
utility routines borrowed from FLTK
static
unsigned
utf8decode
(
const
char
*
p
,
const
char
*
end
,
int
*
len
)
{
...
...
@@ -93,7 +93,7 @@ static unsigned utf8decode(const char* p, const char* end, int* len)
((
p
[
2
]
&
0x3f
)
<<
6
)
+
((
p
[
3
]
&
0x3f
));
}
else
if
(
c
==
0xf4
)
{
if
(((
unsigned
char
*
)
p
)[
1
]
>
0x8f
)
goto
FAIL
;
/
*
after 0x10ffff
*/
if
(((
unsigned
char
*
)
p
)[
1
]
>
0x8f
)
goto
FAIL
;
/
/
after 0x10ffff
goto
UTF8_4
;
}
else
{
FAIL:
...
...
@@ -110,7 +110,7 @@ static unsigned utf8toUtf16(const char* src, unsigned srclen,
unsigned
count
=
0
;
if
(
dstlen
)
for
(;;)
{
if
(
p
>=
e
)
{
dst
[
count
]
=
0
;
return
count
;}
if
(
!
(
*
p
&
0x80
))
{
/
*
ascii
*/
if
(
!
(
*
p
&
0x80
))
{
/
/
ascii
dst
[
count
]
=
*
p
++
;
}
else
{
int
len
;
unsigned
ucs
=
utf8decode
(
p
,
e
,
&
len
);
...
...
@@ -118,7 +118,7 @@ static unsigned utf8toUtf16(const char* src, unsigned srclen,
if
(
ucs
<
0x10000
)
{
dst
[
count
]
=
ucs
;
}
else
{
/
*
make a surrogate pair:
*/
/
/
make a surrogate pair:
if
(
count
+
2
>=
dstlen
)
{
dst
[
count
]
=
0
;
count
+=
2
;
break
;}
dst
[
count
]
=
(((
ucs
-
0x10000u
)
>>
10
)
&
0x3ff
)
|
0xd800
;
dst
[
++
count
]
=
(
ucs
&
0x3ff
)
|
0xdc00
;
...
...
@@ -126,7 +126,7 @@ static unsigned utf8toUtf16(const char* src, unsigned srclen,
}
if
(
++
count
==
dstlen
)
{
dst
[
count
-
1
]
=
0
;
break
;}
}
/
*
we filled dst, measure the rest:
*/
/
/
we filled dst, measure the rest:
while
(
p
<
e
)
{
if
(
!
(
*
p
&
0x80
))
p
++
;
else
{
...
...
@@ -143,6 +143,9 @@ static wchar_t *wbuf[2] = {NULL, NULL};
static
void
setwbuf
(
int
i
,
const
char
*
f
)
{
// all strings in Gmsh are supposed to be UTF8-encoded, which is natively
// supported by Mac and Linux. Windows does not support UTF-8, but UTF-16
// (through wchar_t), so we need to convert.
if
(
i
!=
0
&&
i
!=
1
)
return
;
size_t
l
=
strlen
(
f
);
unsigned
wn
=
utf8toUtf16
(
f
,
(
unsigned
)
l
,
NULL
,
0
)
+
1
;
...
...
@@ -153,7 +156,7 @@ static void setwbuf(int i, const char *f)
#endif
FILE
*
Fopen
(
const
char
*
f
,
const
char
*
mode
)
FILE
*
Fopen
(
const
char
*
f
,
const
char
*
mode
)
{
#if defined (WIN32) && !defined(__CYGWIN__)
setwbuf
(
0
,
f
);
...
...
This diff is collapsed.
Click to expand it.
Common/onelab.h
+
3
−
4
View file @
0b76dea9
...
...
@@ -46,13 +46,12 @@ namespace onelab{
// the name of the parameter, including its '/'-separated path in the
// parameter hierarchy. Parameters or subpaths can start with numbers to
// force their relative ordering (such numbers are automatically hidden in
// the interface).
// the interface).
All strings in onelab are supposed to be UTF8-encoded.
std
::
string
_name
;
// the parameter label: if provided it serves as a better way to display the
// parameter in the interface (richer encoding (UTF? HTML?) might be used in
// the future)
// parameter in the interface
std
::
string
_label
;
// a help string
(richer encoding (UTF? HTML?) might be used in the future)
// a help string
std
::
string
_help
;
// clients that use this parameter
std
::
set
<
std
::
string
>
_clients
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment