Update of /cvsroot/aimmath/AIM/WEB-INF/maple
In directory sc8-pr-cvs1:/tmp/cvs-serv1764/WEB-INF/maple
Added Files:
Tag: develop_2_1
OS0Win.mpl OSWin.c OSWin.dll
Log Message:
New files using external calling to access operating system functions
--- NEW FILE: OS0Win.mpl ---
cookdate :=
define_external(
'cookdate',
't'::integer[4],
'a'::ARRAY(datatype=integer[2]),
LIB="OSWin.dll"):
uncookdate :=
define_external(
'uncookdate',
'a'::ARRAY(datatype=integer[2]),
'RETURN'::integer[4],
LIB="OSWin.dll"):
--- NEW FILE: OSWin.c ---
/*
This file should be compiled as follows to produce OSWin.dll:
cl -Gz OSWin.c -link -dll -export:cookdate -export:uncookdate -out:OSWin.dll
*/
#include <stdio.h>
#include <time.h>
#include <Windows.h>
void cookdate(DWORD t,WORD *r)
{
FILETIME ft;
SYSTEMTIME stUTC,stLocal;
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
ft.dwLowDateTime = (DWORD) ll;
ft.dwHighDateTime = ll >>32;
FileTimeToSystemTime(&ft,&stUTC);
SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
r[0] = stLocal.wYear;
r[1] = stLocal.wMonth;
r[2] = stLocal.wDay;
r[3] = stLocal.wDayOfWeek;
if (r[3] == 0) { r[3] = 7; };
r[4] = stLocal.wHour;
r[5] = stLocal.wMinute;
r[6] = stLocal.wSecond;
}
DWORD uncookdate(WORD *r)
{
FILETIME ftLocal,ft;
SYSTEMTIME st;
LONGLONG l0,l1,l2,l3,l4,ll;
st.wYear = r[0];
st.wMonth = r[1];
st.wDay = r[2];
st.wDayOfWeek = r[3];
if (r[3] == 7) { st.wDayOfWeek = 0; };
st.wHour = r[4];
st.wMinute = r[5];
st.wSecond = r[6];
SystemTimeToFileTime(&st,&ftLocal);
LocalFileTimeToFileTime(&ftLocal,&ft);
ll = ((((LONGLONG) ft.dwHighDateTime) << 32) +
((LONGLONG) ft.dwLowDateTime) - 116444736000000000)/10000000;
return (DWORD) ll;
}
--- NEW FILE: OSWin.dll ---
(This appears to be a binary file; contents omitted.)
|