Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
754513c8
Commit
754513c8
authored
Jun 28, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Date_toString implementation.
parent
9b011bd0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
2 deletions
+127
-2
date.c
dlls/jscript/date.c
+127
-2
No files found.
dlls/jscript/date.c
View file @
754513c8
...
...
@@ -451,11 +451,136 @@ static SYSTEMTIME create_systemtime(DOUBLE time)
return
st
;
}
/* ECMA-262 3rd Edition 15.9.1.2 */
static
HRESULT
Date_toString
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
' '
,
'U'
,
'T'
,
'C'
,
'%'
,
'c'
,
'%'
,
'0'
,
'2'
,
'd'
,
'%'
,
'0'
,
'2'
,
'd'
,
' '
,
'%'
,
'd'
,
'%'
,
's'
,
0
};
static
const
WCHAR
formatUTCW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
' '
,
'U'
,
'T'
,
'C'
,
' '
,
'%'
,
'd'
,
'%'
,
's'
,
0
};
static
const
WCHAR
ADW
[]
=
{
0
};
static
const
WCHAR
BCW
[]
=
{
' '
,
'B'
,
'.'
,
'C'
,
'.'
,
0
};
static
const
DWORD
week_ids
[]
=
{
LOCALE_SABBREVDAYNAME7
,
LOCALE_SABBREVDAYNAME1
,
LOCALE_SABBREVDAYNAME2
,
LOCALE_SABBREVDAYNAME3
,
LOCALE_SABBREVDAYNAME4
,
LOCALE_SABBREVDAYNAME5
,
LOCALE_SABBREVDAYNAME6
};
static
const
DWORD
month_ids
[]
=
{
LOCALE_SABBREVMONTHNAME1
,
LOCALE_SABBREVMONTHNAME2
,
LOCALE_SABBREVMONTHNAME3
,
LOCALE_SABBREVMONTHNAME4
,
LOCALE_SABBREVMONTHNAME5
,
LOCALE_SABBREVMONTHNAME6
,
LOCALE_SABBREVMONTHNAME7
,
LOCALE_SABBREVMONTHNAME8
,
LOCALE_SABBREVMONTHNAME9
,
LOCALE_SABBREVMONTHNAME10
,
LOCALE_SABBREVMONTHNAME11
,
LOCALE_SABBREVMONTHNAME12
};
BOOL
formatAD
=
TRUE
;
BSTR
week
,
month
;
DateInstance
*
date
;
BSTR
date_str
;
DOUBLE
time
;
int
len
,
size
,
year
,
day
,
offset
;
DWORD
lcid_en
,
week_id
,
month_id
;
WCHAR
sign
=
'-'
;
TRACE
(
"
\n
"
);
if
(
!
is_class
(
dispex
,
JSCLASS_DATE
))
{
FIXME
(
"throw TypeError
\n
"
);
return
E_FAIL
;
}
date
=
(
DateInstance
*
)
dispex
;
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
}
return
S_OK
;
}
time
=
local_time
(
date
->
time
,
date
);
if
(
retv
)
{
len
=
21
;
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
week_id
=
week_ids
[(
int
)
week_day
(
time
)];
size
=
GetLocaleInfoW
(
lcid_en
,
week_id
,
NULL
,
0
);
week
=
SysAllocStringLen
(
NULL
,
size
);
if
(
!
week
)
return
E_OUTOFMEMORY
;
GetLocaleInfoW
(
lcid_en
,
week_id
,
week
,
size
);
len
+=
size
-
1
;
month_id
=
month_ids
[(
int
)
month_from_time
(
time
)];
size
=
GetLocaleInfoW
(
lcid_en
,
month_id
,
NULL
,
0
);
month
=
SysAllocStringLen
(
NULL
,
size
);
if
(
!
month
)
{
SysFreeString
(
week
);
return
E_OUTOFMEMORY
;
}
GetLocaleInfoW
(
lcid_en
,
month_id
,
month
,
size
);
len
+=
size
-
1
;
year
=
year_from_time
(
time
)
/
10
;
while
(
year
)
{
year
/=
10
;
len
++
;
}
year
=
year_from_time
(
time
);
if
(
year
<
0
)
{
formatAD
=
FALSE
;
year
=
-
year
+
1
;
len
+=
5
;
}
day
=
date_from_time
(
time
)
/
10
;
while
(
day
)
{
day
/=
10
;
len
++
;
}
day
=
date_from_time
(
time
);
offset
=
date
->
bias
+
daylight_saving_ta
(
time
,
date
);
if
(
offset
==
0
)
len
-=
5
;
else
if
(
offset
<
0
)
{
sign
=
'+'
;
offset
=
-
offset
;
}
date_str
=
SysAllocStringLen
(
NULL
,
len
);
if
(
!
date_str
)
{
SysFreeString
(
week
);
SysFreeString
(
month
);
return
E_OUTOFMEMORY
;
}
if
(
offset
)
sprintfW
(
date_str
,
formatW
,
week
,
month
,
day
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
),
sign
,
offset
/
60
,
offset
%
60
,
year
,
formatAD
?
ADW
:
BCW
);
else
sprintfW
(
date_str
,
formatUTCW
,
week
,
month
,
day
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
),
year
,
formatAD
?
ADW
:
BCW
);
SysFreeString
(
week
);
SysFreeString
(
month
);
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
date_str
;
}
return
S_OK
;
}
/* ECMA-262 3rd Edition 15.9.1.5 */
...
...
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