1*5be0f76fSbostic /*- 2*5be0f76fSbostic * Copyright (c) 1980 The Regents of the University of California. 3*5be0f76fSbostic * All rights reserved. 40be233f3Smckusick * 5*5be0f76fSbostic * %sccs.include.proprietary.c% 6*5be0f76fSbostic * 7*5be0f76fSbostic * @(#)data.h 5.2 (Berkeley) 04/12/91 80be233f3Smckusick */ 90be233f3Smckusick 100be233f3Smckusick /* Forms of data list elements */ 110be233f3Smckusick 120be233f3Smckusick #define SIMPLE 1 130be233f3Smckusick #define NESTED 2 140be233f3Smckusick 150be233f3Smckusick 160be233f3Smckusick /* data expression block types */ 170be233f3Smckusick 180be233f3Smckusick #define DVALUE 1 190be233f3Smckusick #define DVAR 2 200be233f3Smckusick #define DNAME 3 210be233f3Smckusick #define DEXPR 4 220be233f3Smckusick #define DERROR 5 230be233f3Smckusick 240be233f3Smckusick 250be233f3Smckusick /* status codes for integer values */ 260be233f3Smckusick 270be233f3Smckusick #define NORMAL 1 280be233f3Smckusick #define MAXPLUS1 2 290be233f3Smckusick #define MINLESS1 3 300be233f3Smckusick #define ERRVAL 4 310be233f3Smckusick 320be233f3Smckusick 330be233f3Smckusick 340be233f3Smckusick /* data types for data statements */ 350be233f3Smckusick 360be233f3Smckusick 370be233f3Smckusick typedef 380be233f3Smckusick struct Dvalue 390be233f3Smckusick { 400be233f3Smckusick char tag; 410be233f3Smckusick char status; 420be233f3Smckusick ftnint value; 430be233f3Smckusick } 440be233f3Smckusick dvalue; 450be233f3Smckusick 460be233f3Smckusick 470be233f3Smckusick typedef 480be233f3Smckusick struct Dvar 490be233f3Smckusick { 500be233f3Smckusick char tag; 510be233f3Smckusick struct Dvalue *valp; 520be233f3Smckusick } 530be233f3Smckusick dvar; 540be233f3Smckusick 550be233f3Smckusick 560be233f3Smckusick typedef 570be233f3Smckusick struct Dname 580be233f3Smckusick { 590be233f3Smckusick char tag; 600be233f3Smckusick int len; 610be233f3Smckusick char *repr; 620be233f3Smckusick } 630be233f3Smckusick dname; 640be233f3Smckusick 650be233f3Smckusick 660be233f3Smckusick typedef 670be233f3Smckusick struct Dexpr 680be233f3Smckusick { 690be233f3Smckusick char tag; 700be233f3Smckusick char opcode; 710be233f3Smckusick union Vexpr *left; 720be233f3Smckusick union Vexpr *right; 730be233f3Smckusick } 740be233f3Smckusick dexpr; 750be233f3Smckusick 760be233f3Smckusick 770be233f3Smckusick typedef 780be233f3Smckusick struct Derror 790be233f3Smckusick { 800be233f3Smckusick char tag; 810be233f3Smckusick } 820be233f3Smckusick derror; 830be233f3Smckusick 840be233f3Smckusick 850be233f3Smckusick typedef 860be233f3Smckusick union Vexpr 870be233f3Smckusick { 880be233f3Smckusick char tag; 890be233f3Smckusick struct Dvalue dvalue; 900be233f3Smckusick struct Dvar dvar; 910be233f3Smckusick struct Dname dname; 920be233f3Smckusick struct Dexpr dexpr; 930be233f3Smckusick struct Derror derror; 940be233f3Smckusick } 950be233f3Smckusick vexpr; 960be233f3Smckusick 970be233f3Smckusick 980be233f3Smckusick typedef 990be233f3Smckusick struct Elist 1000be233f3Smckusick { 1010be233f3Smckusick struct Elist *next; 1020be233f3Smckusick union Delt *elt; 1030be233f3Smckusick } 1040be233f3Smckusick elist; 1050be233f3Smckusick 1060be233f3Smckusick 1070be233f3Smckusick typedef 1080be233f3Smckusick struct Aelt 1090be233f3Smckusick { 1100be233f3Smckusick char tag; 1110be233f3Smckusick Namep var; 1120be233f3Smckusick struct Vlist *subs; 1130be233f3Smckusick struct Rpair *range; 1140be233f3Smckusick } 1150be233f3Smckusick aelt; 1160be233f3Smckusick 1170be233f3Smckusick 1180be233f3Smckusick typedef 1190be233f3Smckusick struct DoList 1200be233f3Smckusick { 1210be233f3Smckusick char tag; 1220be233f3Smckusick struct Elist *elts; 1230be233f3Smckusick union Vexpr *dovar; 1240be233f3Smckusick union Vexpr *init; 1250be233f3Smckusick union Vexpr *limit; 1260be233f3Smckusick union Vexpr *step; 1270be233f3Smckusick } 1280be233f3Smckusick dolist; 1290be233f3Smckusick 1300be233f3Smckusick 1310be233f3Smckusick typedef 1320be233f3Smckusick union Delt 1330be233f3Smckusick { 1340be233f3Smckusick char tag; 1350be233f3Smckusick struct Aelt simple; 1360be233f3Smckusick struct DoList nested; 1370be233f3Smckusick } 1380be233f3Smckusick delt; 1390be233f3Smckusick 1400be233f3Smckusick 1410be233f3Smckusick typedef 1420be233f3Smckusick struct Rpair 1430be233f3Smckusick { 1440be233f3Smckusick union Vexpr *low; 1450be233f3Smckusick union Vexpr *high; 1460be233f3Smckusick } 1470be233f3Smckusick rpair; 1480be233f3Smckusick 1490be233f3Smckusick 1500be233f3Smckusick typedef 1510be233f3Smckusick struct ValList 1520be233f3Smckusick { 1530be233f3Smckusick struct ValList *next; 1540be233f3Smckusick char status; 1550be233f3Smckusick int repl; 1560be233f3Smckusick Constp value; 1570be233f3Smckusick } 1580be233f3Smckusick vallist; 1590be233f3Smckusick 1600be233f3Smckusick 1610be233f3Smckusick typedef 1620be233f3Smckusick struct Vlist 1630be233f3Smckusick { 1640be233f3Smckusick struct Vlist *next; 1650be233f3Smckusick union Vexpr *val; 1660be233f3Smckusick } 1670be233f3Smckusick vlist; 1680be233f3Smckusick 1690be233f3Smckusick 1700be233f3Smckusick typedef 1710be233f3Smckusick struct DoVars 1720be233f3Smckusick { 1730be233f3Smckusick struct DoVars *next; 1740be233f3Smckusick int len; 1750be233f3Smckusick char *repr; 1760be233f3Smckusick dvalue *valp; 1770be233f3Smckusick } 1780be233f3Smckusick dovars; 1790be233f3Smckusick 1800be233f3Smckusick 1810be233f3Smckusick 1820be233f3Smckusick /* Global variables */ 1830be233f3Smckusick 1840be233f3Smckusick extern int badvalue; 1850be233f3Smckusick extern flag overlapflag; 1860be233f3Smckusick 1870be233f3Smckusick 1880be233f3Smckusick /* Global procedures */ 1890be233f3Smckusick 1900be233f3Smckusick extern frvexpr(); 1910be233f3Smckusick extern frvlist(); 1920be233f3Smckusick extern elist *revelist(); 1930be233f3Smckusick extern vlist *revvlist(); 1940be233f3Smckusick extern vlist *prepvexpr(); 1950be233f3Smckusick extern elist *preplval(); 1960be233f3Smckusick extern delt *mkdlval(); 1970be233f3Smckusick extern delt *mkdatado(); 1980be233f3Smckusick extern rpair *mkdrange(); 1990be233f3Smckusick extern vallist *mkdrval(); 2000be233f3Smckusick extern vexpr *evicon(); 2010be233f3Smckusick extern vexpr *mkdname(); 2020be233f3Smckusick extern expptr ivaltoicon(); 2030be233f3Smckusick extern expptr evparam(); 2040be233f3Smckusick extern vexpr *evaldname(); 2050be233f3Smckusick extern vexpr *mkdexpr(); 2060be233f3Smckusick extern vexpr *addivals(); 2070be233f3Smckusick extern vexpr *subivals(); 2080be233f3Smckusick extern vexpr *mulivals(); 2090be233f3Smckusick extern vexpr *divivals(); 2100be233f3Smckusick extern vexpr *powivals(); 2110be233f3Smckusick extern vexpr *negival(); 2120be233f3Smckusick extern expptr convconst(); 2130be233f3Smckusick extern savedata(); 214