whelpush.c

来自「详细介绍了一篇关于pci开发的接口芯片」· C语言 代码 · 共 52 行

C
52
字号
/*  CXL - Copyright (c) 1987-1989 by Mike Smedley - All Rights Reserved  */
/*  WHELPUSH.C  - whelpush()  pushes the current help category onto the stack
                - whelpushc() pushes the given help category onto the stack
                - whelpop()   pops last saved help category, sets current  */

#include "cxldef.h"
#include "cxlwin.h"

int whelpush(void)
{
    /* make sure help has been defined */
    if(_winfo.helptr==NULL) return(_winfo.errno=W_NOHLPDEF);

    /* push the current help category onto the help stack */
    return(whelpushc(_winfo.help));
}

/*---------------------------------------------------------------------------*/

int whelpushc(int cat)
{
    /* make sure help has been defined */
    if(_winfo.helptr==NULL) return(_winfo.errno=W_NOHLPDEF);

    /* check for stack overflow */
    if(_winfo.helptr->helpptr==19) return(_winfo.errno=W_HLPSTKOV);

    /* add help category to stack and increment stack pointer */
    _winfo.helptr->help[++_winfo.helptr->helpptr]=cat;

    /* return normally */
    return(_winfo.errno=W_NOERROR);
}

/*---------------------------------------------------------------------------*/

int whelpop(void)
{
    /* make sure help has been defined */
    if(_winfo.helptr==NULL) return(_winfo.errno=W_NOHLPDEF);

    /* check for stack underflow */
    if(_winfo.helptr->helpptr==-1) return(_winfo.errno=W_HLPSTKUN);

    /* restore help category and decrement stack pointer */
    _winfo.help=_winfo.helptr->help[_winfo.helptr->helpptr--];

    /* return normally */
    return(_winfo.errno=W_NOERROR);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?