Fixed a few bugs
This commit is contained in:
parent
162c1c81e9
commit
9aee9cb62f
7 changed files with 48 additions and 12 deletions
|
@ -73,6 +73,7 @@ static int
|
||||||
printchar(c, esc)
|
printchar(c, esc)
|
||||||
int c;
|
int c;
|
||||||
{
|
{
|
||||||
|
c &= 0377;
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case '\n':
|
case '\n':
|
||||||
fputs("\\n", db_out);
|
fputs("\\n", db_out);
|
||||||
|
|
|
@ -45,6 +45,7 @@ commands
|
||||||
int give_prompt;
|
int give_prompt;
|
||||||
}
|
}
|
||||||
:
|
:
|
||||||
|
{ errorgiven = 0; }
|
||||||
[ %persistent command_line(&com)
|
[ %persistent command_line(&com)
|
||||||
[ '\n' { give_prompt = 1; }
|
[ '\n' { give_prompt = 1; }
|
||||||
| %default ';' { give_prompt = 0; }
|
| %default ';' { give_prompt = 0; }
|
||||||
|
@ -109,7 +110,9 @@ command_line(p_tree *p;)
|
||||||
| FIND qualified_name(p){ *p = mknode(OP_FIND, *p); }
|
| FIND qualified_name(p){ *p = mknode(OP_FIND, *p); }
|
||||||
| WHICH qualified_name(p){ *p = mknode(OP_WHICH, *p); }
|
| WHICH qualified_name(p){ *p = mknode(OP_WHICH, *p); }
|
||||||
| able_command(p)
|
| able_command(p)
|
||||||
| '!' { shellescape(); }
|
| '!' { shellescape();
|
||||||
|
errorgiven = 1; /* to prevent execution of lastcomm */
|
||||||
|
}
|
||||||
|
|
|
|
||||||
]
|
]
|
||||||
;
|
;
|
||||||
|
|
|
@ -786,6 +786,7 @@ DbRead(f)
|
||||||
/* another N_SO follows ... */
|
/* another N_SO follows ... */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
clean_tp_tab();
|
||||||
while (CurrentScope != PervasiveScope) {
|
while (CurrentScope != PervasiveScope) {
|
||||||
close_scope();
|
close_scope();
|
||||||
}
|
}
|
||||||
|
@ -796,7 +797,6 @@ DbRead(f)
|
||||||
open_scope(sym, 0);
|
open_scope(sym, 0);
|
||||||
sym->sy_file->f_scope = CurrentScope;
|
sym->sy_file->f_scope = CurrentScope;
|
||||||
FileScope = CurrentScope;
|
FileScope = CurrentScope;
|
||||||
clean_tp_tab();
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case N_SOL:
|
case N_SOL:
|
||||||
if (! line_file) line_file = n;
|
if (! line_file) line_file = n;
|
||||||
|
|
|
@ -158,7 +158,7 @@ convert(pbuf, psize, ptp, tp, size)
|
||||||
malloc_succeeded(*pbuf);
|
malloc_succeeded(*pbuf);
|
||||||
}
|
}
|
||||||
if ((*ptp)->ty_class == T_SUBRANGE) *ptp = (*ptp)->ty_base;
|
if ((*ptp)->ty_class == T_SUBRANGE) *ptp = (*ptp)->ty_base;
|
||||||
switch((*ptp)->ty_class) {
|
if (tp && *ptp) switch((*ptp)->ty_class) {
|
||||||
case T_INTEGER:
|
case T_INTEGER:
|
||||||
case T_UNSIGNED:
|
case T_UNSIGNED:
|
||||||
case T_POINTER:
|
case T_POINTER:
|
||||||
|
@ -1154,6 +1154,12 @@ eval_expr(p, pbuf, psize, ptp)
|
||||||
}
|
}
|
||||||
*psize = 0;
|
*psize = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if ((*ptp)->ty_class == T_CROSS) {
|
||||||
|
*ptp = (*ptp)->ty_cross;
|
||||||
|
if (! *ptp) *ptp = void_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,5 +1228,17 @@ eval_desig(p, paddr, psize, ptp)
|
||||||
if (! retval) {
|
if (! retval) {
|
||||||
*psize = 0;
|
*psize = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if ((*ptp)->ty_class == T_CROSS) {
|
||||||
|
*ptp = (*ptp)->ty_cross;
|
||||||
|
if (! *ptp) {
|
||||||
|
*ptp = void_type;
|
||||||
|
print_node(p, 0);
|
||||||
|
fputs(" designator has unknown type\n", db_out);
|
||||||
|
retval = 0;
|
||||||
|
*psize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ static int
|
||||||
print_char(c)
|
print_char(c)
|
||||||
int c;
|
int c;
|
||||||
{
|
{
|
||||||
|
c &= 0377;
|
||||||
fprintf(db_out, (c >= 040 && c < 0177) ? "'%c'" : "%oC", c);
|
fprintf(db_out, (c >= 040 && c < 0177) ? "'%c'" : "%oC", c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,6 +350,7 @@ resolve_cross(tp)
|
||||||
sym->sy_type->ty_size == tp->ty_class &&
|
sym->sy_type->ty_size == tp->ty_class &&
|
||||||
scope_encloses(tp->ty_sym->sy_scope, sym->sy_scope)) {
|
scope_encloses(tp->ty_sym->sy_scope, sym->sy_scope)) {
|
||||||
sym->sy_type->ty_cross = tp;
|
sym->sy_type->ty_cross = tp;
|
||||||
|
sym->sy_type->ty_size = tp->ty_size;
|
||||||
}
|
}
|
||||||
sym = sym->sy_next;
|
sym = sym->sy_next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "idf.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
#include "sizes.h"
|
#include "sizes.h"
|
||||||
#include "symbol.h"
|
#include "symbol.h"
|
||||||
|
@ -275,7 +276,7 @@ init_types()
|
||||||
*/
|
*/
|
||||||
static struct tp_index {
|
static struct tp_index {
|
||||||
unsigned len;
|
unsigned len;
|
||||||
p_type *row;
|
p_type **row;
|
||||||
} *list_row;
|
} *list_row;
|
||||||
static unsigned list_len;
|
static unsigned list_len;
|
||||||
|
|
||||||
|
@ -301,16 +302,19 @@ tp_lookup(type_index)
|
||||||
}
|
}
|
||||||
p = &list_row[type_index[0]];
|
p = &list_row[type_index[0]];
|
||||||
while (type_index[1] >= p->len) {
|
while (type_index[1] >= p->len) {
|
||||||
|
int indx = p->len/NINCR;
|
||||||
|
p->len += NINCR;
|
||||||
if (p->len) {
|
if (p->len) {
|
||||||
p->row = (p_type *) Realloc((char *) p->row,
|
p->row = (p_type **) Realloc((char *) p->row,
|
||||||
(p->len += NINCR) * sizeof(p_type));
|
(unsigned) (indx + 1) * sizeof(p_type *));
|
||||||
}
|
}
|
||||||
else p->row = (p_type *) Malloc((p->len = NINCR) * sizeof(p_type));
|
else p->row = (p_type **) Malloc(sizeof(p_type *));
|
||||||
for (i = NINCR; i > 0; i--) {
|
p->row[indx] = (p_type *) Malloc(NINCR * sizeof(p_type));
|
||||||
p->row[p->len - i] = 0;
|
for (i = NINCR-1; i >= 0; i--) {
|
||||||
|
p->row[indx][i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &(p->row[type_index[1]]);
|
return &(p->row[type_index[1]/NINCR][type_index[1]%NINCR]);
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_tp_tab()
|
clean_tp_tab()
|
||||||
|
@ -322,11 +326,19 @@ clean_tp_tab()
|
||||||
register int j = list_row[i].len;
|
register int j = list_row[i].len;
|
||||||
if (j) {
|
if (j) {
|
||||||
while (--j > 0) {
|
while (--j > 0) {
|
||||||
p_type p = list_row[i].row[j];
|
p_type p = list_row[i].row[j/NINCR][j%NINCR];
|
||||||
if (p && p->ty_class == 0) {
|
if (p && p->ty_class == 0) {
|
||||||
error("incomplete type (%d,%d) 0x%x", i, j, &list_row[i].row[j]);
|
error("%s: incomplete type (%d,%d)",
|
||||||
|
listfile->sy_idf->id_text,
|
||||||
|
i,
|
||||||
|
j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
j = list_row[i].len;
|
||||||
|
while (j > 0) {
|
||||||
|
free((char *) list_row[i].row[j/NINCR-1]);
|
||||||
|
j -= NINCR;
|
||||||
|
}
|
||||||
free((char *) list_row[i].row);
|
free((char *) list_row[i].row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue