summaryrefslogtreecommitdiff
path: root/bc/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'bc/load.c')
-rw-r--r--bc/load.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/bc/load.c b/bc/load.c
index 40b8051..1035198 100644
--- a/bc/load.c
+++ b/bc/load.c
@@ -1,7 +1,6 @@
-/* load.c: This code "loads" code into the code segments. */
-
/* This file is part of GNU bc.
- Copyright (C) 1991-1994, 1997, 2000 Free Software Foundation, Inc.
+
+ Copyright (C) 1991-1994, 1997, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,10 +13,10 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to
+ along with this program; see the file COPYING. If not, write to:
The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111 USA
+ Foundation, Inc. 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301 USA
You may contact the author by:
e-mail: philnelson@acm.org
@@ -28,8 +27,9 @@
*************************************************************************/
+/* load.c: This code "loads" code into the code segments. */
+
#include "bcdefs.h"
-#include "global.h"
#include "proto.h"
/* Load variables. */
@@ -51,10 +51,10 @@ init_load ()
/* addbyte adds one BYTE to the current code segment. */
void
-addbyte (byte)
- char byte;
+addbyte (thebyte)
+ int thebyte;
{
- int pc;
+ int prog_addr;
bc_function *f;
char *new_body;
@@ -62,10 +62,10 @@ addbyte (byte)
if (had_error) return;
/* Calculate the segment and offset. */
- pc = load_adr.pc_addr++;
+ prog_addr = load_adr.pc_addr++;
f = &functions[load_adr.pc_func];
- if (pc >= f->f_body_size)
+ if (prog_addr >= f->f_body_size)
{
f->f_body_size *= 2;
new_body = (char *) bc_malloc (f->f_body_size);
@@ -74,8 +74,8 @@ addbyte (byte)
f->f_body = new_body;
}
- /* Store the byte. */
- f->f_body[pc] = byte;
+ /* Store the thebyte. */
+ f->f_body[prog_addr] = (char) (thebyte & 0xff);
f->f_code_size++;
}
@@ -126,7 +126,7 @@ def_label (lab)
long
long_val (str)
- char **str;
+ const char **str;
{ int val = 0;
char neg = FALSE;
@@ -149,14 +149,14 @@ long_val (str)
void
load_code (code)
- char *code;
+ const char *code;
{
- char *str;
+ const char *str;
long ap_name; /* auto or parameter name. */
long label_no;
long vaf_name; /* variable, array or function number. */
long func;
- program_counter save_adr;
+ static program_counter save_adr;
/* Initialize. */
str = code;