File: popva.c

package info (click to toggle)
icmake 7.18.00-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,840 kB
  • sloc: ansic: 7,784; makefile: 3,811; sh: 319; cpp: 83
file content (38 lines) | stat: -rw-r--r-- 990 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
\funcref{fun\_pop\_var}{void fun\_pop\_var ()}
    {}
    {}
    {getint16(), pop()}
    {fun\_copy\_var()}
    {funpopva.c}
    {

        This function is called when an {\em op\_pop\_var} is encountered in
        the binary makefile. Following the opcode a variable index is expected.
        The logic of the function is as follows:

        \begin{itemize}

            \item The original contents of the variable are released if
            necessary by calling {\em discard()}.

            \item The last used stack element is copied into the variable.

            \item The stack pointer is decremented to reflect the shrinking of
            the stack.

        \end{itemize}

        Note that the memory associated with the stack variable remains
        unchanged.

    }
*/

#include "opcodefun.ih"

void fun_pop_var()
{
   assign(getdest(), top());   /* increments the reference count       */
   pop();                      /* and resets it to its former value    */
}