1 /* $Id: $ */
2
3 /* Copyright (C) 1997 Sverre Hvammen Johansen,
4 * Department of Informatics, University of Oslo.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "cim.h"
21 #include "simfile.h"
22
23 /******************************************************************************
24 PROCEDURE OUTINT(i,w) */
25
26 __dhp
__rooutint(p,i,w)27 __rooutint (p, i, w)
28 __bs2FILE *p;
29 long i,
30 w;
31 {
32 __txt ti;
33 long k;
34 if (w == 0)
35 {
36 /* Bruker ikke IMAGE, men oppretter et midlertidig tekstobjekt og
37 * sender den som parameter til __rtputint */
38 static char th[sizeof (__th) + __RTPUTTEXTLENGTH + 1];
39 __tobj *tob = (__tobj *) th;
40 __txt tv;
41 tob->h.konstant = 0;
42 tv.obj = tob;
43 tv.length = __RTPUTTEXTLENGTH;
44 tv.pos = 1;
45 tv.start = 1;
46 __rtputint (&tv, i);
47 __rfield (((__bs2FILE *) p), __rputlen);
48 p->IMAGE.pos += __rputlen;
49 for (k = 0; k < __rputlen; k++)
50 __et.obj->string[__et.start - 1 + k]
51 = tob->string[__RTPUTTEXTLENGTH - __rputlen + k];
52 }
53 else if (w < 0)
54 {
55 __rfield (((__bs2FILE *) p), -w); /* Returverdier i et */
56 ti.obj = __et.obj;
57 ti.length = __et.length;
58 ti.pos = __et.pos;
59 ti.start = __et.start;
60 __rtputint (&ti, i);
61 __rleftshift (&ti, -w - __rputlen);
62 p->IMAGE.pos -= w;
63 }
64 else
65 {
66 __rfield (((__bs2FILE *) p), w); /* Returverdier i et */
67 ti.obj = __et.obj;
68 ti.length = __et.length;
69 ti.pos = __et.pos;
70 ti.start = __et.start;
71 (void) __rtputint (&ti, i);
72 p->IMAGE.pos += w;
73 }
74 return ((__dhp) p);
75 }
76