#include <plib.h>
#include <wlib.h>

GLREF_D TEXT *DatStatusNamePtr;

LOCAL_D WSERV_SPEC wSpec;

LOCAL_C VOID CDECL Alert3(TEXT *m1,TEXT *m2,TEXT *m3)
    {
    TEXT *pt;
    TEXT **pps;
    DESC *pd,*pdend;
    struct {
        WORD zero;
        DESC line[3];
        TEXT buf[W_ALERT_TEXT_MAX_LEN];
        } al;

    al.zero=0;
    pt=&al.buf[0];
    pps=&m1;
    for (pd=&al.line[0],pdend=pd+3;pd<pdend;pd++)
        {
        pd->hposition=0xff;
        pd->length=p_slen(*pps);
        pd->offset=pt-(TEXT *)&al;
        pt=(TEXT *)p_bcpy(pt,*pps++,pd->length);
        }
    wsAlertW(WS_ALERT_CLIENT,(TEXT *)&al,NULL,NULL);
    }

LOCAL_C VOID AlertErr(INT err,TEXT *msg)
    {
    TEXT bb[3];

    bb[0]=0;
    bb[1]=0xfe;
    bb[2]=err;
    wsAlertW(WS_ALERT_CLIENT,msg,&bb[0],NULL);
    }

GLDEF_C INT main(VOID)
    {
    DatStatusNamePtr="Sample";
    wConnect(&wSpec,0,W_CONNECT_PRIORITY);
    wsAlertW(WS_ALERT_CLIENT,"Hello World",NULL,NULL);
    AlertErr(E_GEN_NOMEMORY,"Failed to save");
    Alert3("Line 1","Line 2","Line 3");
    return(0);
    }
