/*
    THWIF.C

Started by DavidW, 6/12/91

Time text extension to h layer of hwif

*/

#include <hwif.g>
#include <htime.g>
#include <hwif.h>


GLDEF_C VOID *hTTOpen(VOID)
    {
    return(uCheckHandle(p_new(CAT_HWIF_HWIM,C_HTIME)));
    }

GLDEF_C INT hTTSetTime(VOID *handle,INT type,VOID *data)
    {
    return(p_send4(handle,O_TO_SET,type,data));
    }

GLDEF_C INT hTTSenseString(VOID *handle,INT type,TEXT *buf)
    {
    return(p_send4(handle,O_TO_SENSE,type,buf));
    }

#define TIME_DEFAULTS (PR_TIME_NO_SECS|PR_TIME_DAY_NAME|PR_TIME_SUFFIX_NAME|PR_TIME_MONTH_NAME|PR_TIME_FORCE_UPDATE_FORMAT)

GLDEF_C VOID hTTSetFormat(VOID *handle,INT values)
    {
    p_send3(handle,O_TO_SET_FORMAT,NULL);
    ((PR_TIME *)handle)->time.f.flags&=(~TIME_DEFAULTS);
    ((PR_TIME *)handle)->time.f.flags|=values;
    }

GLDEF_C VOID hTTSetAbbreviations(VOID *handle,INT dayabb,INT monabb)
    {
    p_send4(handle,O_TO_SET_ABBREVIATIONS,dayabb,monabb);
    ((PR_TIME *)handle)->time.f.flags|=PR_TIME_ABBREVIATE;
    }

GLDEF_C VOID hTTClose(VOID *handle)
    {
    p_send2(handle,O_DESTROY);
    }
