File: funpushs.c

package info (click to toggle)
icmake 6.22-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,120 kB
  • ctags: 1,045
  • sloc: ansic: 9,241; makefile: 1,138; asm: 126; sh: 124
file content (41 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (3)
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
39
40
41
/*
\funcref{fun\_push\_strconst} {void fun\_push\_strconst ()}
    {}
    {}
    {getint16(), getstring(), error(), push()}
    {}
    {funpushs.c}
    {

        This function is called when a string constant is to be pushed onto the
        stack. The offset of the string to be pushed, relative to the strings
        section of the binary makefile, is expected to follow the opcode. This
        relative offset is an {\em UNS16} variable.

        A variable of type {\em e\_str} and with field {\em vu.str} set to
        a duplicate of the string constant is pushed.

    }
*/

#include "icm-exec.h"

void fun_push_strconst ()
{
    UNS16
        offs;
    register char
        *str;
    VAR_
        tmp;

    offs = (UNS16) getint16 (infile);

    if ( (str = getstring (infile, headerp->offset[0], offs)) == (char *) -1 )
        error ("cannot get string, opcode at %s", hexstring (curoffs, 4));

    tmp = newvar (e_str);
    tmp.vu.i->ls.str = str;		/* note: str is already alloced */
					/* due to getstring () */
    push (tmp);
}