Annotation of 43BSD/contrib/dipress/src/lib/libip/operator.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *  Interpress utilities
                      3:  *
                      4:  *  Written for Xerox Corporation by William LeFebvre
                      5:  *  24-May-1984
                      6:  *
                      7:  * Copyright (c) 1984, 1985 Xerox Corp.
                      8:  *
                      9:  * HISTORY
                     10:  * 15-Jan-86  lee at Xerox, WRC
                     11:  *     Removed vax dependencies.
                     12:  *
                     13:  *     29-apr-85  ed flint     add conditional compilation for vax-11 c (vms)
                     14:  */
                     15: 
                     16: /*
                     17:  *  Subroutines to help build interpress files:
                     18:  *
                     19:  *  operator interface level - these routines call routines at the literal
                     20:  *                            interface level to provide an easy way to
                     21:  *                            write operators along with their parameters.
                     22:  */
                     23: 
                     24: # include "iptokens.h"
                     25: # include "literal.h"
                     26: # include "operator.h"
                     27: 
                     28: char *index();
                     29: 
                     30: op_i(opcode, i)
                     31: 
                     32: int opcode;
                     33: long i;
                     34: 
                     35: {
                     36:     AppendInteger(i);
                     37:     AppendOp(opcode);
                     38: }
                     39: 
                     40: op_n(opcode, n)
                     41: 
                     42: int opcode;
                     43: double n;
                     44: 
                     45: {
                     46:     AppendNumber(n);
                     47:     AppendOp(opcode);
                     48: }
                     49: 
                     50: op_ii(opcode, i1, i2)
                     51: 
                     52: int opcode;
                     53: long i1, i2;
                     54: 
                     55: {
                     56:     AppendInteger(i1);
                     57:     AppendInteger(i2);
                     58:     AppendOp(opcode);
                     59: }
                     60: 
                     61: op_ni(opcode, n, i)
                     62: 
                     63: int opcode;
                     64: double n;
                     65: long i;
                     66: 
                     67: {
                     68:     AppendNumber(n);
                     69:     AppendInteger(i);
                     70:     AppendOp(opcode);
                     71: }
                     72: 
                     73: op_nn(opcode, n1, n2)
                     74: 
                     75: int opcode;
                     76: double n1, n2;
                     77: 
                     78: {
                     79:     AppendNumber(n1);
                     80:     AppendNumber(n2);
                     81:     AppendOp(opcode);
                     82: }
                     83: 
                     84: op_nnnn(opcode, n1, n2, n3, n4)
                     85: 
                     86: int opcode;
                     87: double n1, n2, n3, n4;
                     88: 
                     89: {
                     90:     AppendNumber(n1);
                     91:     AppendNumber(n2);
                     92:     AppendNumber(n3);
                     93:     AppendNumber(n4);
                     94:     AppendOp(opcode);
                     95: }
                     96: 
                     97: op_nnnnnn(opcode, n1, n2, n3, n4, n5, n6)
                     98: 
                     99: int opcode;
                    100: double n1, n2, n3, n4, n5, n6;
                    101: 
                    102: {
                    103:     AppendNumber(n1);
                    104:     AppendNumber(n2);
                    105:     AppendNumber(n3);
                    106:     AppendNumber(n4);
                    107:     AppendNumber(n5);
                    108:     AppendNumber(n6);
                    109:     AppendOp(opcode);
                    110: }
                    111: 
                    112: /*
                    113:  *  Here are some extra and useful goodies 
                    114:  */
                    115: 
                    116: SetupFont(name, size, frame_index)
                    117: 
                    118: char *name;
                    119: double size;
                    120: int frame_index;
                    121: 
                    122: {
                    123:     int i = 1;
                    124:     char *slashp;
                    125:     char *namep = name;
                    126: 
                    127:     /* make heirarchical name vector using slash as separator */
                    128: #ifdef vax11c
                    129:     while((slashp = strchr(namep, '/')) != 0)
                    130: #else
                    131:     while((slashp = index(namep, '/')) != 0)
                    132: #endif
                    133: 
                    134:     {
                    135:        *slashp = '\0';
                    136:        AppendIdentifier(namep);
                    137:        namep = slashp + 1;
                    138:        *slashp = '/';
                    139:        i++;
                    140:     }
                    141:     AppendIdentifier(namep);
                    142:     AppendInteger((long) i);
                    143:     AppendOp(OP_makevec);
                    144: 
                    145:     /* find the font */
                    146:     AppendOp(OP_findfont);
                    147: 
                    148:     /* build a scaling transform */
                    149:     Scale(size);
                    150: 
                    151:     /* apply the transform to the font */
                    152:     AppendOp(OP_modifyfont);
                    153: 
                    154:     /* set the frame index of choice */
                    155:     AppendInteger((long) frame_index);
                    156:     AppendOp(OP_fset);
                    157: }
                    158: 
                    159: ShowString(string)
                    160: 
                    161: char *string;
                    162: 
                    163: {
                    164:     AppendString(string);
                    165:     AppendOp(OP_show);
                    166: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.