1987-04-29 10:22:07 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*
|
|
|
|
* Author: Ceriel J.H. Jacobs
|
|
|
|
*/
|
|
|
|
|
1986-05-01 19:06:53 +00:00
|
|
|
/* C A S E S T A T E M E N T C O D E G E N E R A T I O N */
|
|
|
|
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1987-04-29 10:22:07 +00:00
|
|
|
|
1986-10-06 20:36:30 +00:00
|
|
|
/* Generation of case statements is done by first creating a
|
|
|
|
description structure for the statement, build a list of the
|
|
|
|
case-labels, then generating a case description in the code,
|
|
|
|
and generating either CSA or CSB, and then generating code for the
|
|
|
|
cases themselves.
|
|
|
|
*/
|
1986-05-01 19:06:53 +00:00
|
|
|
|
2013-05-14 21:24:38 +00:00
|
|
|
#include "parameters.h"
|
1986-05-01 19:06:53 +00:00
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include <em_label.h>
|
|
|
|
#include <em_arith.h>
|
1986-07-08 14:59:02 +00:00
|
|
|
#include <em_code.h>
|
1986-05-01 19:06:53 +00:00
|
|
|
#include <alloc.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "Lpars.h"
|
|
|
|
#include "type.h"
|
|
|
|
#include "LLlex.h"
|
|
|
|
#include "node.h"
|
1986-05-21 18:32:20 +00:00
|
|
|
#include "desig.h"
|
1986-06-20 14:36:49 +00:00
|
|
|
#include "walk.h"
|
1987-07-30 13:37:39 +00:00
|
|
|
#include "chk_expr.h"
|
1987-10-19 11:28:37 +00:00
|
|
|
#include "def.h"
|
1986-05-01 19:06:53 +00:00
|
|
|
|
|
|
|
struct switch_hdr {
|
1986-10-06 20:36:30 +00:00
|
|
|
label sh_break; /* label of statement after this one */
|
|
|
|
label sh_default; /* label of ELSE part, or 0 */
|
|
|
|
int sh_nrofentries; /* number of cases */
|
1987-09-23 16:39:43 +00:00
|
|
|
t_type *sh_type; /* type of case expression */
|
1986-10-06 20:36:30 +00:00
|
|
|
arith sh_lowerbd; /* lowest case label */
|
|
|
|
arith sh_upperbd; /* highest case label */
|
|
|
|
struct case_entry *sh_entries; /* the cases with their generated
|
|
|
|
labels
|
|
|
|
*/
|
1986-05-01 19:06:53 +00:00
|
|
|
};
|
|
|
|
|
1986-10-06 20:36:30 +00:00
|
|
|
/* STATICALLOCDEF "switch_hdr" 5 */
|
1986-05-01 19:06:53 +00:00
|
|
|
|
|
|
|
struct case_entry {
|
1987-07-17 13:50:04 +00:00
|
|
|
struct case_entry *ce_next; /* next in list */
|
1986-10-06 20:36:30 +00:00
|
|
|
label ce_label; /* generated label */
|
1990-03-06 13:22:30 +00:00
|
|
|
arith ce_low, ce_up; /* lower and upper bound of range */
|
1986-05-01 19:06:53 +00:00
|
|
|
};
|
|
|
|
|
2016-11-10 21:04:18 +00:00
|
|
|
void AddCases();
|
|
|
|
void AddOneCase();
|
|
|
|
|
1986-10-06 20:36:30 +00:00
|
|
|
/* STATICALLOCDEF "case_entry" 20 */
|
1986-05-01 19:06:53 +00:00
|
|
|
|
|
|
|
/* The constant DENSITY determines when CSA and when CSB instructions
|
|
|
|
are generated. Reasonable values are: 2, 3, 4.
|
|
|
|
On machines that have lots of address space and memory, higher values
|
1986-10-06 20:36:30 +00:00
|
|
|
might also be reasonable. On these machines the density of jump tables
|
1986-05-01 19:06:53 +00:00
|
|
|
may be lower.
|
|
|
|
*/
|
1987-10-05 15:40:53 +00:00
|
|
|
|
|
|
|
compact(nr, low, up)
|
|
|
|
arith low, up;
|
|
|
|
{
|
|
|
|
/* Careful! up - low might not fit in an arith. And then,
|
|
|
|
the test "up-low < 0" might also not work to detect this
|
|
|
|
situation! Or is this just a bug in the M68020/M68000?
|
|
|
|
*/
|
|
|
|
arith diff = up - low;
|
|
|
|
|
1988-03-21 16:36:31 +00:00
|
|
|
return (nr != 0 && diff >= 0 && fit(diff, (int) word_size) &&
|
|
|
|
diff / nr <= (DENSITY - 1));
|
1987-10-05 15:40:53 +00:00
|
|
|
}
|
1991-03-06 10:52:34 +00:00
|
|
|
#define nd_lab nd_symb
|
1986-05-01 19:06:53 +00:00
|
|
|
|
1989-03-20 13:32:06 +00:00
|
|
|
int
|
|
|
|
CaseCode(nd, exitlabel, end_reached)
|
1987-09-23 16:39:43 +00:00
|
|
|
t_node *nd;
|
1986-05-01 19:06:53 +00:00
|
|
|
label exitlabel;
|
|
|
|
{
|
|
|
|
/* Check the expression, stack a new case header and
|
|
|
|
fill in the necessary fields.
|
1986-10-06 20:36:30 +00:00
|
|
|
"exitlabel" is the exit-label of the closest enclosing
|
|
|
|
LOOP-statement, or 0.
|
1986-05-01 19:06:53 +00:00
|
|
|
*/
|
|
|
|
register struct switch_hdr *sh = new_switch_hdr();
|
1987-09-23 16:39:43 +00:00
|
|
|
register t_node *pnode = nd;
|
1986-05-01 19:06:53 +00:00
|
|
|
register struct case_entry *ce;
|
|
|
|
register arith val;
|
1986-10-06 20:36:30 +00:00
|
|
|
label CaseDescrLab;
|
1989-03-20 13:32:06 +00:00
|
|
|
int rval;
|
1986-05-01 19:06:53 +00:00
|
|
|
|
1986-05-28 18:36:51 +00:00
|
|
|
assert(pnode->nd_class == Stat && pnode->nd_symb == CASE);
|
1986-05-01 19:06:53 +00:00
|
|
|
|
1991-03-12 16:52:00 +00:00
|
|
|
if (ChkExpression(&(pnode->nd_LEFT))) {
|
|
|
|
MkCoercion(&(pnode->nd_LEFT),BaseType(pnode->nd_LEFT->nd_type));
|
|
|
|
CodePExpr(pnode->nd_LEFT);
|
1987-07-30 13:37:39 +00:00
|
|
|
}
|
1991-03-12 16:52:00 +00:00
|
|
|
sh->sh_type = pnode->nd_LEFT->nd_type;
|
1986-06-20 14:36:49 +00:00
|
|
|
sh->sh_break = ++text_label;
|
1986-05-01 19:06:53 +00:00
|
|
|
|
|
|
|
/* Now, create case label list
|
|
|
|
*/
|
1991-03-12 16:52:00 +00:00
|
|
|
while (pnode = pnode->nd_RIGHT) {
|
1986-05-01 19:06:53 +00:00
|
|
|
if (pnode->nd_class == Link && pnode->nd_symb == '|') {
|
1991-03-12 16:52:00 +00:00
|
|
|
if (pnode->nd_LEFT) {
|
1986-10-06 20:36:30 +00:00
|
|
|
/* non-empty case
|
|
|
|
*/
|
1991-03-12 16:52:00 +00:00
|
|
|
pnode->nd_LEFT->nd_lab = ++text_label;
|
1989-03-20 13:32:06 +00:00
|
|
|
AddCases(sh, /* to descriptor */
|
1991-03-12 16:52:00 +00:00
|
|
|
pnode->nd_LEFT->nd_LEFT,
|
1989-03-20 13:32:06 +00:00
|
|
|
/* of case labels */
|
1991-03-12 16:52:00 +00:00
|
|
|
(label) pnode->nd_LEFT->nd_lab
|
1989-03-20 13:32:06 +00:00
|
|
|
/* and code label */
|
|
|
|
);
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Else part
|
|
|
|
*/
|
1986-06-10 13:18:52 +00:00
|
|
|
|
1986-06-20 14:36:49 +00:00
|
|
|
sh->sh_default = ++text_label;
|
1986-10-06 20:36:30 +00:00
|
|
|
break;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1987-11-13 16:19:51 +00:00
|
|
|
if (!sh->sh_nrofentries) {
|
1986-11-05 14:33:00 +00:00
|
|
|
/* There were no cases, so we have to check the case-expression
|
|
|
|
here
|
|
|
|
*/
|
|
|
|
if (! (sh->sh_type->tp_fund & T_DISCRETE)) {
|
|
|
|
node_error(nd, "illegal type in CASE-expression");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1986-05-01 19:06:53 +00:00
|
|
|
/* Now generate code for the switch itself
|
1986-10-06 20:36:30 +00:00
|
|
|
First the part that CSA and CSB descriptions have in common.
|
1986-05-01 19:06:53 +00:00
|
|
|
*/
|
1986-10-06 20:36:30 +00:00
|
|
|
CaseDescrLab = ++data_label; /* the rom must have a label */
|
|
|
|
C_df_dlb(CaseDescrLab);
|
1986-05-01 19:06:53 +00:00
|
|
|
if (sh->sh_default) C_rom_ilb(sh->sh_default);
|
1986-06-20 14:36:49 +00:00
|
|
|
else C_rom_ucon("0", pointer_size);
|
1986-05-01 19:06:53 +00:00
|
|
|
if (compact(sh->sh_nrofentries, sh->sh_lowerbd, sh->sh_upperbd)) {
|
1986-10-06 20:36:30 +00:00
|
|
|
/* CSA
|
|
|
|
*/
|
1990-03-06 13:22:30 +00:00
|
|
|
int gen = 1;
|
|
|
|
|
1986-05-01 19:06:53 +00:00
|
|
|
ce = sh->sh_entries;
|
1992-10-21 10:53:45 +00:00
|
|
|
while (! ce->ce_label) ce = ce->ce_next;
|
1988-03-21 16:36:31 +00:00
|
|
|
C_rom_cst((arith) 0);
|
|
|
|
C_rom_cst(sh->sh_upperbd - sh->sh_lowerbd);
|
|
|
|
for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) {
|
1986-05-01 19:06:53 +00:00
|
|
|
assert(ce);
|
1990-03-06 13:22:30 +00:00
|
|
|
if (gen || val == ce->ce_low) {
|
|
|
|
gen = 1;
|
1986-05-01 19:06:53 +00:00
|
|
|
C_rom_ilb(ce->ce_label);
|
1990-03-06 13:22:30 +00:00
|
|
|
if (val == ce->ce_up) {
|
|
|
|
gen = 0;
|
|
|
|
ce = ce->ce_next;
|
1992-11-09 14:30:28 +00:00
|
|
|
while (ce && ! ce->ce_label) ce = ce->ce_next;
|
1990-03-06 13:22:30 +00:00
|
|
|
}
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
else if (sh->sh_default) C_rom_ilb(sh->sh_default);
|
1986-06-20 14:36:49 +00:00
|
|
|
else C_rom_ucon("0", pointer_size);
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
1988-03-21 16:36:31 +00:00
|
|
|
C_loc(sh->sh_lowerbd);
|
|
|
|
C_sbu(word_size);
|
1987-09-23 16:39:43 +00:00
|
|
|
c_lae_dlb(CaseDescrLab); /* perform the switch */
|
1986-05-01 19:06:53 +00:00
|
|
|
C_csa(word_size);
|
|
|
|
}
|
1986-10-06 20:36:30 +00:00
|
|
|
else {
|
|
|
|
/* CSB
|
|
|
|
*/
|
1986-05-01 19:06:53 +00:00
|
|
|
C_rom_cst((arith)sh->sh_nrofentries);
|
1987-07-17 13:50:04 +00:00
|
|
|
for (ce = sh->sh_entries; ce; ce = ce->ce_next) {
|
1986-10-06 20:36:30 +00:00
|
|
|
/* generate the entries: value + prog.label
|
|
|
|
*/
|
1992-10-21 10:53:45 +00:00
|
|
|
if (! ce->ce_label) continue;
|
1990-03-06 13:22:30 +00:00
|
|
|
val = ce->ce_low;
|
|
|
|
do {
|
|
|
|
C_rom_cst(val);
|
|
|
|
C_rom_ilb(ce->ce_label);
|
|
|
|
} while (val++ != ce->ce_up);
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
1987-09-23 16:39:43 +00:00
|
|
|
c_lae_dlb(CaseDescrLab); /* perform the switch */
|
1986-05-01 19:06:53 +00:00
|
|
|
C_csb(word_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now generate code for the cases
|
|
|
|
*/
|
|
|
|
pnode = nd;
|
1989-03-20 13:32:06 +00:00
|
|
|
rval = 0;
|
1991-03-12 16:52:00 +00:00
|
|
|
while (pnode = pnode->nd_RIGHT) {
|
1986-05-01 19:06:53 +00:00
|
|
|
if (pnode->nd_class == Link && pnode->nd_symb == '|') {
|
1991-03-12 16:52:00 +00:00
|
|
|
if (pnode->nd_LEFT) {
|
|
|
|
rval |= LblWalkNode((label) pnode->nd_LEFT->nd_lab,
|
|
|
|
pnode->nd_LEFT->nd_RIGHT,
|
1989-03-20 13:32:06 +00:00
|
|
|
exitlabel, end_reached);
|
1993-11-19 09:53:47 +00:00
|
|
|
c_bra(sh->sh_break);
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Else part
|
|
|
|
*/
|
|
|
|
assert(sh->sh_default != 0);
|
|
|
|
|
1989-03-20 13:32:06 +00:00
|
|
|
rval |= LblWalkNode(sh->sh_default,
|
|
|
|
pnode, exitlabel, end_reached);
|
1986-10-06 20:36:30 +00:00
|
|
|
break;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1988-01-28 16:15:16 +00:00
|
|
|
def_ilb(sh->sh_break);
|
1986-05-01 19:06:53 +00:00
|
|
|
FreeSh(sh);
|
1989-03-20 13:32:06 +00:00
|
|
|
return rval;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FreeSh(sh)
|
1986-10-06 20:36:30 +00:00
|
|
|
register struct switch_hdr *sh;
|
1986-05-01 19:06:53 +00:00
|
|
|
{
|
|
|
|
/* free the allocated switch structure
|
|
|
|
*/
|
|
|
|
register struct case_entry *ce;
|
|
|
|
|
|
|
|
ce = sh->sh_entries;
|
|
|
|
while (ce) {
|
1987-07-17 13:50:04 +00:00
|
|
|
struct case_entry *tmp = ce->ce_next;
|
1986-05-01 19:06:53 +00:00
|
|
|
|
|
|
|
free_case_entry(ce);
|
|
|
|
ce = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
free_switch_hdr(sh);
|
|
|
|
}
|
|
|
|
|
2016-11-10 21:04:18 +00:00
|
|
|
void
|
1986-05-01 19:06:53 +00:00
|
|
|
AddCases(sh, node, lbl)
|
|
|
|
struct switch_hdr *sh;
|
1987-09-23 16:39:43 +00:00
|
|
|
register t_node *node;
|
1986-05-01 19:06:53 +00:00
|
|
|
label lbl;
|
|
|
|
{
|
|
|
|
/* Add case labels to the case label list
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (node->nd_class == Link) {
|
|
|
|
if (node->nd_symb == UPTO) {
|
1991-03-12 16:52:00 +00:00
|
|
|
assert(node->nd_LEFT->nd_class == Value);
|
|
|
|
assert(node->nd_RIGHT->nd_class == Value);
|
1986-05-28 18:36:51 +00:00
|
|
|
|
1991-03-12 16:52:00 +00:00
|
|
|
AddOneCase(sh, node->nd_LEFT, node->nd_RIGHT, lbl);
|
1989-03-20 13:32:06 +00:00
|
|
|
return;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assert(node->nd_symb == ',');
|
1991-03-12 16:52:00 +00:00
|
|
|
AddCases(sh, node->nd_LEFT, lbl);
|
|
|
|
AddCases(sh, node->nd_RIGHT, lbl);
|
1989-03-20 13:32:06 +00:00
|
|
|
return;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assert(node->nd_class == Value);
|
1990-03-06 13:22:30 +00:00
|
|
|
AddOneCase(sh, node, node, lbl);
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
|
2016-11-10 21:04:18 +00:00
|
|
|
void
|
1990-03-06 13:22:30 +00:00
|
|
|
AddOneCase(sh, lnode, rnode, lbl)
|
1986-05-01 19:06:53 +00:00
|
|
|
register struct switch_hdr *sh;
|
1990-03-06 13:22:30 +00:00
|
|
|
t_node *lnode, *rnode;
|
1986-05-01 19:06:53 +00:00
|
|
|
label lbl;
|
|
|
|
{
|
|
|
|
register struct case_entry *ce = new_case_entry();
|
|
|
|
register struct case_entry *c1 = sh->sh_entries, *c2 = 0;
|
1987-10-05 15:40:53 +00:00
|
|
|
int fund = sh->sh_type->tp_fund;
|
1991-10-29 09:18:46 +00:00
|
|
|
arith diff;
|
1986-05-01 19:06:53 +00:00
|
|
|
|
1990-03-06 13:22:30 +00:00
|
|
|
if (! ChkCompat(&lnode, sh->sh_type, "case") ||
|
|
|
|
! ChkCompat(&rnode, sh->sh_type, "case")) {
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
1992-10-21 10:53:45 +00:00
|
|
|
ce->ce_label = lbl;
|
|
|
|
ce->ce_low = lnode->nd_INT;
|
|
|
|
ce->ce_up = rnode->nd_INT;
|
1991-10-29 09:18:46 +00:00
|
|
|
diff = rnode->nd_INT - lnode->nd_INT;
|
|
|
|
#define MAXRANGE 100
|
|
|
|
if (diff < 0 || diff > MAXRANGE) {
|
|
|
|
/* This is a bit of a hack, but it prevents the compiler
|
|
|
|
from crashing on things like
|
|
|
|
CASE a OF
|
|
|
|
10 .. MAX(CARDINAL): ....
|
|
|
|
|
|
|
|
If the range covers more than MAXRANGE cases, this case
|
|
|
|
is dealt with separately.
|
|
|
|
*/
|
|
|
|
label cont = ++text_label;
|
|
|
|
|
|
|
|
C_dup(int_size);
|
|
|
|
C_loc(lnode->nd_INT);
|
|
|
|
if (fund == T_INTEGER) {
|
|
|
|
C_blt(cont);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
C_cmu(int_size);
|
|
|
|
C_zlt(cont);
|
|
|
|
}
|
|
|
|
C_dup(int_size);
|
|
|
|
C_loc(rnode->nd_INT);
|
|
|
|
if (fund == T_INTEGER) {
|
|
|
|
C_bgt(cont);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
C_cmu(int_size);
|
|
|
|
C_zgt(cont);
|
|
|
|
}
|
|
|
|
C_asp(int_size);
|
1993-11-19 09:53:47 +00:00
|
|
|
c_bra(lbl);
|
1991-10-29 09:18:46 +00:00
|
|
|
C_df_ilb(cont);
|
1992-10-21 10:53:45 +00:00
|
|
|
ce->ce_label = 0;
|
1991-10-29 09:18:46 +00:00
|
|
|
}
|
1986-05-01 19:06:53 +00:00
|
|
|
if (sh->sh_entries == 0) {
|
1986-10-06 20:36:30 +00:00
|
|
|
/* first case entry
|
|
|
|
*/
|
1986-05-01 19:06:53 +00:00
|
|
|
sh->sh_entries = ce;
|
1992-10-21 10:53:45 +00:00
|
|
|
if (ce->ce_label) {
|
|
|
|
sh->sh_lowerbd = ce->ce_low;
|
|
|
|
sh->sh_upperbd = ce->ce_up;
|
|
|
|
}
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
else {
|
1986-10-06 20:36:30 +00:00
|
|
|
/* second etc. case entry
|
|
|
|
find the proper place to put ce into the list
|
|
|
|
*/
|
1986-05-01 19:06:53 +00:00
|
|
|
|
1992-10-21 10:53:45 +00:00
|
|
|
while (c1 && chk_bounds(c1->ce_low, ce->ce_low, fund)) {
|
1986-05-01 19:06:53 +00:00
|
|
|
c2 = c1;
|
1987-07-17 13:50:04 +00:00
|
|
|
c1 = c1->ce_next;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
/* At this point three cases are possible:
|
|
|
|
1: c1 != 0 && c2 != 0:
|
|
|
|
insert ce somewhere in the middle
|
|
|
|
2: c1 != 0 && c2 == 0:
|
|
|
|
insert ce right after the head
|
|
|
|
3: c1 == 0 && c2 != 0:
|
|
|
|
append ce to last element
|
|
|
|
The case c1 == 0 && c2 == 0 cannot occur, since
|
|
|
|
the list is guaranteed not to be empty.
|
|
|
|
*/
|
1990-03-06 13:22:30 +00:00
|
|
|
if (c2) {
|
|
|
|
if ( chk_bounds(ce->ce_low, c2->ce_up, fund)) {
|
|
|
|
node_error(rnode, "multiple case entry for value %ld", (long)(ce->ce_low));
|
1986-05-01 19:06:53 +00:00
|
|
|
free_case_entry(ce);
|
1990-03-06 13:22:30 +00:00
|
|
|
return;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
1990-03-06 13:22:30 +00:00
|
|
|
}
|
|
|
|
if (c1) {
|
1992-10-21 10:53:45 +00:00
|
|
|
if ( chk_bounds(c1->ce_low, ce->ce_up, fund)) {
|
|
|
|
node_error(rnode, "multiple case entry for value %ld", (long)(ce->ce_up));
|
|
|
|
free_case_entry(ce);
|
|
|
|
return;
|
|
|
|
}
|
1986-05-01 19:06:53 +00:00
|
|
|
if (c2) {
|
1987-07-17 13:50:04 +00:00
|
|
|
ce->ce_next = c2->ce_next;
|
|
|
|
c2->ce_next = ce;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
|
|
|
else {
|
1987-07-17 13:50:04 +00:00
|
|
|
ce->ce_next = sh->sh_entries;
|
1986-05-01 19:06:53 +00:00
|
|
|
sh->sh_entries = ce;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert(c2);
|
|
|
|
|
1987-07-17 13:50:04 +00:00
|
|
|
c2->ce_next = ce;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
1992-11-09 14:30:28 +00:00
|
|
|
if (ce->ce_label) {
|
|
|
|
if (! chk_bounds(sh->sh_lowerbd, ce->ce_low, fund)) {
|
|
|
|
sh->sh_lowerbd = ce->ce_low;
|
|
|
|
}
|
|
|
|
if (! chk_bounds(ce->ce_up, sh->sh_upperbd, fund)) {
|
|
|
|
sh->sh_upperbd = ce->ce_up;
|
|
|
|
}
|
|
|
|
}
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|
1992-10-21 10:53:45 +00:00
|
|
|
if (ce->ce_label) sh->sh_nrofentries += ce->ce_up - ce->ce_low + 1;
|
1986-05-01 19:06:53 +00:00
|
|
|
}
|