File: ops1.c

package info (click to toggle)
yorick 1.4-14
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,948 kB
  • ctags: 6,609
  • sloc: ansic: 63,898; yacc: 889; makefile: 605; sh: 65; lisp: 60; fortran: 19
file content (557 lines) | stat: -rw-r--r-- 17,399 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
/*
    OPS1.C
    Implement bitwise binary operations and unary operations:

    Or |   And &   Xor ~
    ShiftL <<   ShiftR >>

    Negate -   Complement ~   Not !   True (no explicit operator)

    $Id: ops1.c,v 1.1 1993/08/27 18:32:09 munro Exp munro $
 */
/*    Copyright (c) 1994.  The Regents of the University of California.
                    All rights reserved.  */

#include "ydata.h"

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

extern VMaction ShiftL, ShiftR,
  AndBits, XorBits, OrBits, AndLogical, OrLogical;
extern VMaction Negate, Complement, Not, True;

extern StackOp OrII, OrIL, OrIB,
               OrLI, OrLL, OrLB,
               OrBI, OrBL, OrBB, OrXX;
extern BinaryOp OrC, OrS, OrI, OrL, OrX;

extern StackOp AndII, AndIL, AndIB,
               AndLI, AndLL, AndLB,
               AndBI, AndBL, AndBB, AndXX;
extern BinaryOp AndC, AndS, AndI, AndL, AndX;

extern StackOp XorII, XorIL, XorIB,
               XorLI, XorLL, XorLB,
               XorBI, XorBL, XorBB, XorXX;
extern BinaryOp XorC, XorS, XorI, XorL, XorX;

extern StackOp ShiftLII, ShiftLIL, ShiftLIB,
               ShiftLLI, ShiftLLL, ShiftLLB,
               ShiftLBI, ShiftLBL, ShiftLBB, ShiftLXX;
extern BinaryOp ShiftLC, ShiftLS, ShiftLI, ShiftLL, ShiftLX;

extern StackOp ShiftRII, ShiftRIL, ShiftRIB,
               ShiftRLI, ShiftRLL, ShiftRLB,
               ShiftRBI, ShiftRBL, ShiftRBB, ShiftRXX;
extern BinaryOp ShiftRC, ShiftRS, ShiftRI, ShiftRL, ShiftRX;

extern StackOp ComplementIS, ComplementLS,
               ComplementDB, ComplementXX;
extern UnaryOp ComplementC, ComplementS, ComplementI, ComplementL,
               ComplementX;

extern StackOp NegateIS, NegateLS, NegateDS, NegateDB, NegateXX;
extern UnaryOp NegateC, NegateS, NegateI, NegateL,
               NegateF, NegateD, NegateZ, NegateX;

extern StackOp NotIS, NotLS, NotDS, NotDB;
extern UnaryOp NotC, NotS, NotI, NotL, NotF, NotD, NotZ,
               NotQ, NotP, NotSI, NotVD, NotX;

extern StackOp TrueIS, TrueLS, TrueDS, TrueDB;
extern UnaryOp TrueC, TrueS, TrueI, TrueL, TrueF, TrueD, TrueZ,
               TrueQ, TrueP, TrueSI, TrueVD, TrueX;

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

extern Operand *FormOperandIS(Symbol *owner, Operand *op);
extern Operand *FormOperandLS(Symbol *owner, Operand *op);
extern Operand *FormOperandDS(Symbol *owner, Operand *op);
extern Operand *FormOperandDB(Symbol *owner, Operand *op);

extern void PopToI(Symbol *s);
extern void PopToL(Symbol *s);
extern void PopToD(Symbol *s);

extern void *BuildResult2(Operand *l, Operand *r);
extern void *BuildResult1(Operand *l, Operand *r);
extern void *BuildResult0(Operand *l, Operand *r, StructDef *base);

extern void *BuildResultU(Operand *op, StructDef *base);

extern void PopToI(Symbol *s);
extern void PopToL(Symbol *s);
extern void PopToD(Symbol *s);

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

static Operand lop, rop;

/*--------------------------------------------------------------------------*/
/* OrBits */

void OrBits(void) { (sp-1)->ops->Or[sp->ops->id](); }

static void Or_BB(Operand *l, Operand *r);

void OrII(void) { Symbol *spr= sp--; sp->value.i|= spr->value.i; }
void OrIL(void) { Symbol *spr= sp--;
  sp->value.l= sp->value.i|spr->value.l; sp->ops= &longScalar; }
void OrIB(void)
{ Or_BB(FormOperandIS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void OrLI(void) { Symbol *spr= sp--; sp->value.l|= spr->value.i; }
void OrLL(void) { Symbol *spr= sp--; sp->value.l|= spr->value.l; }
void OrLB(void)
{ Or_BB(FormOperandLS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void OrBI(void)
{ Or_BB(FormOperandDB(sp-1, &lop), FormOperandIS(sp, &rop)); }
void OrBL(void)
{ Or_BB(FormOperandDB(sp-1, &lop), FormOperandLS(sp, &rop)); }
void OrBB(void)
{ Or_BB(FormOperandDB(sp-1, &lop), FormOperandDB(sp, &rop)); }

void OrXX(void) { OrX((Operand *)0, (Operand *)0); }

static void Or_BB(Operand *l, Operand *r)
{
  Operations *ops= l->ops->Promote[r->ops->promoteID](l, r);
  if (!ops) YError("bad data type(s) in binary |");
  ops->Or(l, r);
  Drop(1);
}

static void OrError(void);
static void OrError(void)
{ YError("operands not conformable in binary |"); }

#undef OPERATION
#define OPERATION(opname, typd, Popper) \
void opname(Operand *l, Operand *r) \
{ typd *dst= BuildResult2(l, r); \
  if (dst) { \
    long i, n= l->type.number; \
    typd *lv= l->value, *rv= r->value; \
    for (i=0 ; i<n ; i++) dst[i]= lv[i]|rv[i]; \
    Popper(l->owner); \
  } else OrError(); }

OPERATION(OrC, char, PopTo)
OPERATION(OrS, short, PopTo)
OPERATION(OrI, int, PopToI)
OPERATION(OrL, long, PopToL)
void OrX(Operand *l, Operand *r)
{ YError("non-integer data type in binary |"); }

/*--------------------------------------------------------------------------*/
/* AndBits */

void AndBits(void) { (sp-1)->ops->And[sp->ops->id](); }

static void And_BB(Operand *l, Operand *r);

void AndII(void) { Symbol *spr= sp--; sp->value.i&= spr->value.i; }
void AndIL(void) { Symbol *spr= sp--;
  sp->value.l= sp->value.i&spr->value.l; sp->ops= &longScalar; }
void AndIB(void)
{ And_BB(FormOperandIS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void AndLI(void) { Symbol *spr= sp--; sp->value.l&= spr->value.i; }
void AndLL(void) { Symbol *spr= sp--; sp->value.l&= spr->value.l; }
void AndLB(void)
{ And_BB(FormOperandLS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void AndBI(void)
{ And_BB(FormOperandDB(sp-1, &lop), FormOperandIS(sp, &rop)); }
void AndBL(void)
{ And_BB(FormOperandDB(sp-1, &lop), FormOperandLS(sp, &rop)); }
void AndBB(void)
{ And_BB(FormOperandDB(sp-1, &lop), FormOperandDB(sp, &rop)); }

void AndXX(void) { AndX((Operand *)0, (Operand *)0); }

static void And_BB(Operand *l, Operand *r)
{
  Operations *ops= l->ops->Promote[r->ops->promoteID](l, r);
  if (!ops) YError("bad data type(s) in binary &");
  ops->And(l, r);
  Drop(1);
}

static void AndError(void);
static void AndError(void)
{ YError("operands not conformable in binary &"); }

#undef OPERATION
#define OPERATION(opname, typd, Popper) \
void opname(Operand *l, Operand *r) \
{ typd *dst= BuildResult2(l, r); \
  if (dst) { \
    long i, n= l->type.number; \
    typd *lv= l->value, *rv= r->value; \
    for (i=0 ; i<n ; i++) dst[i]= lv[i]&rv[i]; \
    Popper(l->owner); \
  } else AndError(); }

OPERATION(AndC, char, PopTo)
OPERATION(AndS, short, PopTo)
OPERATION(AndI, int, PopToI)
OPERATION(AndL, long, PopToL)
void AndX(Operand *l, Operand *r)
{ YError("non-integer data type in binary &"); }

/*--------------------------------------------------------------------------*/
/* XorBits */

void XorBits(void) { (sp-1)->ops->Xor[sp->ops->id](); }

static void Xor_BB(Operand *l, Operand *r);

void XorII(void) { Symbol *spr= sp--; sp->value.i^= spr->value.i; }
void XorIL(void) { Symbol *spr= sp--;
  sp->value.l= sp->value.i^spr->value.l; sp->ops= &longScalar; }
void XorIB(void)
{ Xor_BB(FormOperandIS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void XorLI(void) { Symbol *spr= sp--; sp->value.l^= spr->value.i; }
void XorLL(void) { Symbol *spr= sp--; sp->value.l^= spr->value.l; }
void XorLB(void)
{ Xor_BB(FormOperandLS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void XorBI(void)
{ Xor_BB(FormOperandDB(sp-1, &lop), FormOperandIS(sp, &rop)); }
void XorBL(void)
{ Xor_BB(FormOperandDB(sp-1, &lop), FormOperandLS(sp, &rop)); }
void XorBB(void)
{ Xor_BB(FormOperandDB(sp-1, &lop), FormOperandDB(sp, &rop)); }

void XorXX(void) { XorX((Operand *)0, (Operand *)0); }

static void Xor_BB(Operand *l, Operand *r)
{
  Operations *ops= l->ops->Promote[r->ops->promoteID](l, r);
  if (!ops) YError("bad data type(s) in binary ~");
  ops->Xor(l, r);
  Drop(1);
}

static void XorError(void);
static void XorError(void)
{ YError("operands not conformable in binary ~"); }

#undef OPERATION
#define OPERATION(opname, typd, Popper) \
void opname(Operand *l, Operand *r) \
{ typd *dst= BuildResult2(l, r); \
  if (dst) { \
    long i, n= l->type.number; \
    typd *lv= l->value, *rv= r->value; \
    for (i=0 ; i<n ; i++) dst[i]= lv[i]^rv[i]; \
    Popper(l->owner); \
  } else XorError(); }

OPERATION(XorC, char, PopTo)
OPERATION(XorS, short, PopTo)
OPERATION(XorI, int, PopToI)
OPERATION(XorL, long, PopToL)
void XorX(Operand *l, Operand *r)
{ YError("non-integer data type in binary ~"); }

/*--------------------------------------------------------------------------*/
/* ShiftL */

void ShiftL(void) { (sp-1)->ops->ShiftL[sp->ops->id](); }

static void ShiftL_BB(Operand *l, Operand *r);

void ShiftLII(void) { Symbol *spr= sp--; sp->value.i<<= spr->value.i; }
void ShiftLIL(void) { Symbol *spr= sp--; sp->value.i<<= spr->value.l; }
void ShiftLIB(void)
{ ShiftL_BB(FormOperandIS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void ShiftLLI(void) { Symbol *spr= sp--; sp->value.l<<= spr->value.i; }
void ShiftLLL(void) { Symbol *spr= sp--; sp->value.l<<= spr->value.l; }
void ShiftLLB(void)
{ ShiftL_BB(FormOperandLS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void ShiftLBI(void)
{ ShiftL_BB(FormOperandDB(sp-1, &lop), FormOperandIS(sp, &rop)); }
void ShiftLBL(void)
{ ShiftL_BB(FormOperandDB(sp-1, &lop), FormOperandLS(sp, &rop)); }
void ShiftLBB(void)
{ ShiftL_BB(FormOperandDB(sp-1, &lop), FormOperandDB(sp, &rop)); }

void ShiftLXX(void) { ShiftLX((Operand *)0, (Operand *)0); }

static void ShiftL_BB(Operand *l, Operand *r)
{
  Operations *ops= l->ops;
  if (r->ops->promoteID>T_LONG)
    YError("non-integer right operand in binary <<");
  r->ops->ToInt(r);
  ops->ShiftL(l, r);
  Drop(1);
}

static void ShiftLError(void);
static void ShiftLError(void)
{ YError("operands not conformable in binary <<"); }

#undef OPERATION
#define OPERATION(opname, typd, Popper) \
void opname(Operand *l, Operand *r) \
{ typd *dst= BuildResult1(l, r); \
  if (dst) { \
    long i, n= l->type.number; \
    typd *lv= l->value; int *rv= r->value; \
    for (i=0 ; i<n ; i++) dst[i]= lv[i]<<rv[i]; \
    Popper(l->owner); \
  } else ShiftLError(); }

OPERATION(ShiftLC, unsigned char, PopTo)
OPERATION(ShiftLS, short, PopTo)
OPERATION(ShiftLI, int, PopToI)
OPERATION(ShiftLL, long, PopToL)
void ShiftLX(Operand *l, Operand *r)
{ YError("non-integer left operand in binary <<"); }

/*--------------------------------------------------------------------------*/
/* ShiftR */

void ShiftR(void) { (sp-1)->ops->ShiftR[sp->ops->id](); }

static void ShiftR_BB(Operand *l, Operand *r);

void ShiftRII(void) { Symbol *spr= sp--; sp->value.i>>= spr->value.i; }
void ShiftRIL(void) { Symbol *spr= sp--; sp->value.i>>= spr->value.l; }
void ShiftRIB(void)
{ ShiftR_BB(FormOperandIS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void ShiftRLI(void) { Symbol *spr= sp--; sp->value.l>>= spr->value.i; }
void ShiftRLL(void) { Symbol *spr= sp--; sp->value.l>>= spr->value.l; }
void ShiftRLB(void)
{ ShiftR_BB(FormOperandLS(sp-1, &lop), FormOperandDB(sp, &rop)); }

void ShiftRBI(void)
{ ShiftR_BB(FormOperandDB(sp-1, &lop), FormOperandIS(sp, &rop)); }
void ShiftRBL(void)
{ ShiftR_BB(FormOperandDB(sp-1, &lop), FormOperandLS(sp, &rop)); }
void ShiftRBB(void)
{ ShiftR_BB(FormOperandDB(sp-1, &lop), FormOperandDB(sp, &rop)); }

void ShiftRXX(void) { ShiftRX((Operand *)0, (Operand *)0); }

static void ShiftR_BB(Operand *l, Operand *r)
{
  Operations *ops= l->ops;
  if (r->ops->promoteID>T_LONG)
    YError("non-integer right operand in binary >>");
  r->ops->ToInt(r);
  ops->ShiftR(l, r);
  Drop(1);
}

static void ShiftRError(void);
static void ShiftRError(void)
{ YError("operands not conformable in binary >>"); }

#undef OPERATION
#define OPERATION(opname, typd, Popper) \
void opname(Operand *l, Operand *r) \
{ typd *dst= BuildResult1(l, r); \
  if (dst) { \
    long i, n= l->type.number; \
    typd *lv= l->value; int *rv= r->value; \
    for (i=0 ; i<n ; i++) dst[i]= lv[i]>>rv[i]; \
    Popper(l->owner); \
  } else ShiftRError(); }

OPERATION(ShiftRC, unsigned char, PopTo)
OPERATION(ShiftRS, short, PopTo)
OPERATION(ShiftRI, int, PopToI)
OPERATION(ShiftRL, long, PopToL)
void ShiftRX(Operand *l, Operand *r)
{ YError("non-integer left operand in binary >>"); }

/*--------------------------------------------------------------------------*/
/* Complement */

void Complement(void) { sp->ops->Complement(); }

void ComplementXX(void) { ComplementX((Operand *)0); }

void ComplementIS(void) { sp->value.i= ~sp->value.i; }
void ComplementLS(void) { sp->value.l= ~sp->value.l; }
void ComplementDB(void) { FormOperandDB(sp, &lop); lop.ops->Complement(&lop); }

#undef OPERATION
#define OPERATION(opname, typd, baseD, Popper) \
void opname(Operand *op) \
{ typd *dst= BuildResultU(op, &baseD); \
  long i, n= op->type.number; \
  typd *lv= op->value; \
  for (i=0 ; i<n ; i++) dst[i]= ~lv[i]; \
  Popper(op->owner); }

OPERATION(ComplementC, char, charStruct, PopTo)
OPERATION(ComplementS, short, shortStruct, PopTo)
OPERATION(ComplementI, int, intStruct, PopToI)
OPERATION(ComplementL, long, longStruct, PopToL)

void ComplementX(Operand *op)
{ YError("non-integer data type in unary ~"); }

/*--------------------------------------------------------------------------*/
/* Negate */

void Negate(void) { sp->ops->Negate(); }

void NegateXX(void) { NegateX((Operand *)0); }

void NegateIS(void) { sp->value.i= -sp->value.i; }
void NegateLS(void) { sp->value.l= -sp->value.l; }
void NegateDS(void) { sp->value.d= -sp->value.d; }
void NegateDB(void) { FormOperandDB(sp, &lop); lop.ops->Negate(&lop); }

#undef OPERATION
#define OPERATION(opname, typd, baseD, Popper) \
void opname(Operand *op) \
{ typd *dst= BuildResultU(op, &baseD); \
  long i, n= op->type.number; \
  typd *lv= op->value; \
  for (i=0 ; i<n ; i++) dst[i]= -lv[i]; \
  Popper(op->owner); }

OPERATION(NegateC, char, charStruct, PopTo)
OPERATION(NegateS, short, shortStruct, PopTo)
OPERATION(NegateI, int, intStruct, PopToI)
OPERATION(NegateL, long, longStruct, PopToL)
OPERATION(NegateF, float, floatStruct, PopTo)
OPERATION(NegateD, double, doubleStruct, PopToD)
void NegateZ(Operand *op)
{ double *dst= BuildResultU(op, &complexStruct);
  long i, n= 2*op->type.number;
  double *lv= op->value;
  for (i=0 ; i<n ; i++) dst[i]= -lv[i];
  PopTo(op->owner);
}

void NegateX(Operand *op)
{ YError("non-numeric data type in unary -"); }

/*--------------------------------------------------------------------------*/
/* Not */

void Not(void) { sp->ops->Not(); }

void NotIS(void) { sp->value.i= !sp->value.i; }
void NotLS(void) { sp->value.i= !sp->value.l; sp->ops= &intScalar; }
void NotDS(void) { sp->value.i= !sp->value.d; sp->ops= &intScalar; }
void NotDB(void) { FormOperandDB(sp, &lop); lop.ops->Not(&lop); }

#undef OPERATION
#define OPERATION(opname, typd) \
void opname(Operand *op) \
{ int *dst= BuildResultU(op, &intStruct); \
  long i, n= op->type.number; \
  typd *lv= op->value; \
  for (i=0 ; i<n ; i++) dst[i]= !lv[i]; \
  PopToI(op->owner); }

OPERATION(NotC, char)
OPERATION(NotS, short)
OPERATION(NotI, int)
OPERATION(NotL, long)
OPERATION(NotF, float)
OPERATION(NotD, double)
void NotZ(Operand *op)
{ int *dst= BuildResultU(op, &intStruct);
  long i, n= op->type.number;
  double *lv= op->value;
  for (i=0 ; i<n ; i++) dst[i]= !(lv[2*i]||lv[2*i+1]);
  PopToI(op->owner);
}

OPERATION(NotQ, char *)
OPERATION(NotP, void *)

void NotSI(Operand *op)
{ int *dst= BuildResultU(op, &intStruct);
  long i, n= op->type.number, j, size= op->type.base->size;
  char *lv= op->value;
  for (i=0 ; i<n ; i++) { dst[i]= 1;
    for (j=0 ; j<size ; j++) if (lv[j]) { dst[i]= 0; break; }}
  PopToI(op->owner);
}

void NotVD(Operand *op)
{ Symbol *s= op->owner; s->ops= &intScalar; s->value.i= 1; Unref(&nilDB); }

void NotX(Operand *op)
{
  Symbol *s= op->owner;
  DataBlock *db= (s->ops==&dataBlockSym)? s->value.db : 0;
  s->ops= &intScalar;
  s->value.i= 0;
  Unref(db);
}

/*--------------------------------------------------------------------------*/
/* True */

void True(void) { sp->ops->True(); }

void TrueIS(void) { sp->value.i= sp->value.i!=0; }
void TrueLS(void) { sp->value.i= sp->value.l!=0; sp->ops= &intScalar; }
void TrueDS(void) { sp->value.i= sp->value.d!=0; sp->ops= &intScalar; }
void TrueDB(void) { FormOperandDB(sp, &lop); lop.ops->True(&lop); }

#undef OPERATION
#define OPERATION(opname, typd) \
void opname(Operand *op) \
{ int *dst= BuildResultU(op, &intStruct); \
  long i, n= op->type.number; \
  typd *lv= op->value; \
  for (i=0 ; i<n ; i++) dst[i]= lv[i]!=0; \
  PopToI(op->owner); }

OPERATION(TrueC, char)
OPERATION(TrueS, short)
OPERATION(TrueI, int)
OPERATION(TrueL, long)
OPERATION(TrueF, float)
OPERATION(TrueD, double)
void TrueZ(Operand *op)
{ int *dst= BuildResultU(op, &intStruct);
  long i, n= op->type.number;
  double *lv= op->value;
  for (i=0 ; i<n ; i++) dst[i]= (lv[2*i]||lv[2*i+1]);
  PopToI(op->owner);
}

OPERATION(TrueQ, char *)
OPERATION(TrueP, void *)

void TrueSI(Operand *op)
{ int *dst= BuildResultU(op, &intStruct);
  long i, n= op->type.number, j, size= op->type.base->size;
  char *lv= op->value;
  for (i=0 ; i<n ; i++) { dst[i]= 0;
    for (j=0 ; j<size ; j++) if (lv[j]) { dst[i]= 1; break; }}
  PopToI(op->owner);
}

void TrueVD(Operand *op)
{ Symbol *s= op->owner; s->ops= &intScalar; s->value.i= 0; Unref(&nilDB); }

void TrueX(Operand *op)
{
  Symbol *s= op->owner;
  DataBlock *db= (s->ops==&dataBlockSym)? s->value.db : 0;
  s->ops= &intScalar;
  s->value.i= 1;
  Unref(db);
}

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