Exemplo n.º 1
0
NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
{
    int err = E_SYSTEM_ERROR;
    FORM *form = (FORM *)0;

    T((T_CALLED("new_form(%p,%p)"), (void *)SP_PARM, (void *)fields));

    if (IsValidScreen(SP_PARM))
    {
        form = typeMalloc(FORM, 1);

        if (form)
        {
            T((T_CREATE("form %p"), (void *)form));
            *form = *_nc_Default_Form;
            /* This ensures win and sub are always non-null,
               so we can derive always the SCREEN that this form is
               running on. */
            form->win = StdScreen(SP_PARM);
            form->sub = StdScreen(SP_PARM);
            if ((err = Associate_Fields(form, fields)) != E_OK)
            {
                free_form(form);
                form = (FORM *)0;
            }
        }
    }

    if (!form)
        SET_ERROR(err);

    returnForm(form);
}
Exemplo n.º 2
0
new_form(FIELD **fields)
{
    int err = E_SYSTEM_ERROR;

    FORM *form = typeMalloc(FORM, 1);

    T((T_CALLED("new_form(%p)"), fields));
    if (form)
    {
        T((T_CREATE("form %p"), form));
        *form = *_nc_Default_Form;
        if ((err = Associate_Fields(form, fields)) != E_OK)
        {
            free_form(form);
            form = (FORM *)0;
        }
    }

    if (!form)
        SET_ERROR(err);

    returnForm(form);
}