[Coco] ... and now on Ubuntu 13.04...

Lothan lothan at newsguy.com
Tue Jul 16 15:58:58 EDT 2013


From: Gene Heskett

> I may have a clue, but I can't find any references to it in lwtools docs.
>
> Does anyone have a clue what the assembly line:DefTime dtb, or in another
> place DefName dts is?

Looking at the code in lwasm/pseudo.c, it looks as if dts and dtb emit the 
date and/or time? It's been too long since I looked at the output of ctime, 
so here's the actual code.

// for "dts"
PARSEFUNC(pseudo_parse_dts)
{
    time_t tp;
    char *t;

    skip_operand(p);
    l -> len = 0;

    tp = time(NULL);
    t = ctime(&tp);

    while (*t)
    {
        if (*t == '\n')
            break;
        lwasm_emit(l, *t);
        t++;
        l -> len += 1;
    }
}

EMITFUNC(pseudo_emit_dts)
{
}

// for "dtb"
PARSEFUNC(pseudo_parse_dtb)
{
    skip_operand(p);
    l -> len = 6;
}

EMITFUNC(pseudo_emit_dtb)
{
    time_t tp;
    struct tm *t;

    tp = time(NULL);
    t = localtime(&tp);

    lwasm_emit(l, t -> tm_year);
    lwasm_emit(l, t -> tm_mon + 1);
    lwasm_emit(l, t -> tm_mday);
    lwasm_emit(l, t -> tm_hour);
    lwasm_emit(l, t -> tm_min);
    lwasm_emit(l, t -> tm_sec);
}




More information about the Coco mailing list