Esempio n. 1
0
struct ErrInfo *PushErr(const STRPTR Data, const ULONG Line,
                        const ULONG Column, const ULONG ErrLen,
                        const STRPTR LineCpy, struct Stack *Stk)
{
    struct ErrInfo      *ci;

    if((ci = malloc(sizeof(struct ErrInfo))))
    {
        if((ci->Data = strdup(Data)))
        {
            ci->File = CurStkName(&InputStack);
            ci->Line = Line;
            ci->ErrLen = ErrLen;
            ci->Column = Column;
            ci->LineBuf = LineCpy;
            ci->Flags = efNone;

            if(StkPush(ci, Stk))
                return(ci);
        }
        else
            PrintPrgErr(pmStrDupErr);
        free(ci);
    }

    return(NULL);
}
Esempio n. 2
0
BOOL InsertWord(const STRPTR Word, struct WordList *WL)
{
    STRPTR      WrdCpy;
    ULONG       Len;

    if((WrdCpy = strdupx(Word, WALLBYTES)))
    {
        if(StkPush(WrdCpy, &WL->Stack))
        {
            Len = strlen(Word);
            if(WL->MaxLen < Len)
                WL->MaxLen = Len;

            InsertHash(WrdCpy, &WL->Hash);
            return(TRUE);
        }

        free(WrdCpy);
    }

    return(FALSE);
}
Esempio n. 3
0
int InsertWord(const char *Word, struct WordList *WL)
{
    char *WrdCpy;
    unsigned long Len;

    if ((WrdCpy = strdupx(Word, WALLBYTES)))
    {
        if (StkPush(WrdCpy, &WL->Stack))
        {
            Len = strlen(Word);
            if (WL->MaxLen < Len)
                WL->MaxLen = Len;

            InsertHash(WrdCpy, &WL->Hash);
            return (TRUE);
        }

        free(WrdCpy);
    }

    return (FALSE);
}
Esempio n. 4
0
BOOL PushFile(STRPTR Name, FILE *fh, struct Stack *stack)
{
    struct FileNode     *fn;

    if(Name && fh && stack)
    {
        if((fn = malloc(sizeof(struct FileNode))))
        {
            if((fn->Name = strdup(Name)))
            {
                fn->fh = fh;
                fn->Line = 0L;
                if(StkPush(fn, stack))
                    return(TRUE);
                free(fn->Name);
            }
            free(fn);
        }
        PrintPrgErr(pmNoStackMem);
    }

    return(FALSE);
}