More strict checks...
This commit is contained in:
parent
a8d9183e25
commit
2bbd5a38de
@ -11,6 +11,14 @@
|
||||
|
||||
void C_flush();
|
||||
void C_internal_error();
|
||||
void C_putbyte(int c);
|
||||
|
||||
#ifndef arith
|
||||
#define arith long
|
||||
#endif
|
||||
#ifndef label
|
||||
#define label unsigned int
|
||||
#endif
|
||||
|
||||
_PROTOTYPE(void C_ms_com, (char *));
|
||||
_PROTOTYPE(void C_ms_ego, (int, arith, arith, int));
|
||||
|
||||
@ -3,5 +3,9 @@
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
#ifndef H_LABEL_H
|
||||
#define H_LABEL_H
|
||||
|
||||
#define label unsigned int
|
||||
|
||||
#endif /* H_LABEL_H */
|
||||
@ -1,4 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include "em_code.h"
|
||||
#include "em_arith.h"
|
||||
#include "em_label.h"
|
||||
#include "../read_em/em_comp.h"
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhcst(op, n, w, i)
|
||||
arith n;
|
||||
arith w;
|
||||
int i;
|
||||
void CC_bhcst(int op, arith n, arith w, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value a cst w, and flag i
|
||||
*/
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhdlb(op, n, s, off, i)
|
||||
arith n;
|
||||
label s;
|
||||
arith off;
|
||||
int i;
|
||||
void CC_bhdlb(int op, arith n, label s, arith off, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value a dlb(s, off),
|
||||
and flag i
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhdnam(op, n, s, off, i)
|
||||
arith n;
|
||||
char *s;
|
||||
arith off;
|
||||
int i;
|
||||
void CC_bhdnam(int op, arith n, char *s, arith off, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value a dnam(s, off),
|
||||
and flag i
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhfcon(op, n, s, sz, i)
|
||||
arith n;
|
||||
char *s;
|
||||
arith sz;
|
||||
int i;
|
||||
void CC_bhfcon(int op, arith n, char *s, arith sz, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value an FCON (s, sz),
|
||||
and flag i
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhicon(op, n, s, sz, i)
|
||||
arith n;
|
||||
char *s;
|
||||
arith sz;
|
||||
int i;
|
||||
void CC_bhicon(int op, arith n, char *s, arith sz, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value an ICON (s, sz),
|
||||
and flag i
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhilb(op, n, l, i)
|
||||
arith n;
|
||||
label l;
|
||||
int i;
|
||||
void CC_bhilb(int op, arith n, label l, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value a ILB(l),
|
||||
and flag i
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhpnam(op, n, p, i)
|
||||
arith n;
|
||||
char *p;
|
||||
int i;
|
||||
void CC_bhpnam(int op, arith n, char *p, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value a PNAM(p),
|
||||
and flag i
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_bhucon(op, n, s, sz, i)
|
||||
arith n;
|
||||
char *s;
|
||||
arith sz;
|
||||
int i;
|
||||
void CC_bhucon(int op, arith n, char *s, arith sz, int i)
|
||||
{
|
||||
/* BSS or HOL with size n, initial value an UCON (s, sz),
|
||||
and flag i
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crcst(op, v)
|
||||
arith v;
|
||||
void CC_crcst(int op, arith v)
|
||||
{
|
||||
/* CON or ROM with argument CST(v)
|
||||
*/
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crdlb(op, v, off)
|
||||
label v;
|
||||
arith off;
|
||||
void CC_crdlb(int op, label v, arith off)
|
||||
{
|
||||
/* CON or ROM with argument DLB(v, off)
|
||||
*/
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crdnam(op, s, off)
|
||||
char *s;
|
||||
arith off;
|
||||
void CC_crdnam(int op, char *s, arith off)
|
||||
{
|
||||
/* CON or ROM with argument DNAM(s, off)
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crilb(op, l)
|
||||
label l;
|
||||
void CC_crilb(int op, label l)
|
||||
{
|
||||
/* CON or ROM with argument ILB(l)
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crpnam(op, p)
|
||||
char *p;
|
||||
void CC_crpnam(int op, char *p)
|
||||
{
|
||||
/* CON or ROM with argument PNAM(p)
|
||||
*/
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crscon(op, v, s)
|
||||
char *v;
|
||||
arith s;
|
||||
void CC_crscon(int op, char *v, arith s)
|
||||
{
|
||||
/* CON or ROM with argument SCON(v,z)
|
||||
*/
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_crxcon(op, spec, v, s)
|
||||
char *v;
|
||||
arith s;
|
||||
void CC_crxcon(int op, int spec, char *v, arith s)
|
||||
{
|
||||
/* CON or ROM with argument ICON(v,z)
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_cst(l)
|
||||
arith l;
|
||||
void CC_cst(arith l)
|
||||
{
|
||||
COMMA();
|
||||
CST(l);
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_dfdlb(l)
|
||||
label l;
|
||||
void CC_dfdlb(label l)
|
||||
{
|
||||
/* Define numeric data label
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_dfdnam(s)
|
||||
char *s;
|
||||
void CC_dfdnam(char *s)
|
||||
{
|
||||
/* Define data label
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_dfilb(l)
|
||||
label l;
|
||||
void CC_dfilb(label l)
|
||||
{
|
||||
/* Define instruction label
|
||||
*/
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_dlb(l, val)
|
||||
label l;
|
||||
arith val;
|
||||
void CC_dlb(label l, arith val)
|
||||
{
|
||||
COMMA();
|
||||
DOFF(l, val);
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_dnam(str, val)
|
||||
char *str;
|
||||
arith val;
|
||||
void CC_dnam(char *str, arith val)
|
||||
{
|
||||
COMMA();
|
||||
NOFF(str, val);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "alloc.h"
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
#include "em_arith.h"
|
||||
#include "insert.h"
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_end(l)
|
||||
arith l;
|
||||
void CC_end(arith l)
|
||||
{
|
||||
/* END pseudo of procedure with l locals
|
||||
*/
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_endnarg()
|
||||
void CC_endnarg()
|
||||
{
|
||||
/* END pseudo of procedure with unknown # of locals
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_exc(c1,c2)
|
||||
arith c1,c2;
|
||||
void CC_exc(arith c1, arith c2)
|
||||
{
|
||||
PS(ps_exc);
|
||||
CST(c1);
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
*/
|
||||
#include <system.h>
|
||||
|
||||
void
|
||||
C_failed()
|
||||
void C_failed()
|
||||
{
|
||||
sys_write(STDERR,"read, write, or open failed\n",28);
|
||||
sys_stop(S_EXIT);
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_fcon(val, siz)
|
||||
char *val;
|
||||
arith siz;
|
||||
void CC_fcon(char *val, arith siz)
|
||||
{
|
||||
COMMA();
|
||||
WCON(sp_fcon, val, siz);
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
/* Get a unique id for C_insertpart, etc.
|
||||
*/
|
||||
|
||||
int
|
||||
C_getid()
|
||||
int C_getid()
|
||||
{
|
||||
static int id = 0;
|
||||
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_icon(val, siz)
|
||||
char *val;
|
||||
arith siz;
|
||||
void CC_icon(char *val, arith siz)
|
||||
{
|
||||
COMMA();
|
||||
WCON(sp_icon, val, siz);
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_ilb(l)
|
||||
label l;
|
||||
void CC_ilb(label l)
|
||||
{
|
||||
COMMA();
|
||||
ILB(l);
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
*/
|
||||
#include <system.h>
|
||||
|
||||
void
|
||||
C_internal_error()
|
||||
void C_internal_error()
|
||||
{
|
||||
sys_write(STDERR,"internal error\n",15);
|
||||
sys_stop(S_EXIT);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_msend()
|
||||
void CC_msend()
|
||||
{
|
||||
CEND();
|
||||
NL();
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_msstart(cst)
|
||||
int cst;
|
||||
void CC_msstart(int cst)
|
||||
{
|
||||
/* start of message
|
||||
*/
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_op(opcode)
|
||||
void CC_op(int opcode)
|
||||
{
|
||||
/* Instruction that never has an argument
|
||||
Argument types: -
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_opcst(opcode, cst)
|
||||
arith cst;
|
||||
void CC_opcst(int opcode, arith cst)
|
||||
{
|
||||
/* Instruction with a constant argument
|
||||
Argument types: c, d, l, g, f, n, s, z, o, w, r
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_opdlb(opcode, dlb, offset)
|
||||
label dlb;
|
||||
arith offset;
|
||||
void CC_opdlb(int opcode, label dlb, arith offset)
|
||||
{
|
||||
/* Instruction that as a numeric datalabel + offset as argument
|
||||
Argument types: g
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_opdnam(opcode, dnam, offset)
|
||||
char *dnam;
|
||||
arith offset;
|
||||
void CC_opdnam(int opcode, char *dnam, arith offset)
|
||||
{
|
||||
/* Instruction that has a datalabel + offset as argument
|
||||
Argument types: g
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_opilb(opcode, ilb)
|
||||
label ilb;
|
||||
void CC_opilb(int opcode, label ilb)
|
||||
{
|
||||
/* Instruction with instruction label argument
|
||||
Argument types: b
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_opnarg(opcode)
|
||||
void CC_opnarg(int opcode)
|
||||
{
|
||||
/* Instruction with optional argument, but now without one
|
||||
Argument types: w
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_oppnam(opcode, pnam)
|
||||
char *pnam;
|
||||
void CC_oppnam(int opcode, char *pnam)
|
||||
{
|
||||
/* Instruction that has a procedure name as argument
|
||||
Argument types: p
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_pnam(str)
|
||||
char *str;
|
||||
void CC_pnam(char *str)
|
||||
{
|
||||
COMMA();
|
||||
PNAM(str);
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_pro(pnam, l)
|
||||
char *pnam;
|
||||
arith l;
|
||||
void CC_pro(char *pnam, arith l)
|
||||
{
|
||||
/* PRO pseudo with procedure name pnam and # of locals l
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_pronarg(pnam)
|
||||
char *pnam;
|
||||
void CC_pronarg(char *pnam)
|
||||
{
|
||||
/* PRO pseudo with procedure name pnam and unknown # of locals
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_psdlb(op, dlb)
|
||||
label dlb;
|
||||
void CC_psdlb(int op, label dlb)
|
||||
{
|
||||
/* Pseudo with numeric datalabel
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_psdnam(op, dnam)
|
||||
char *dnam;
|
||||
void CC_psdnam(int op, char *dnam)
|
||||
{
|
||||
/* Pseudo with data label
|
||||
*/
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_pspnam(op, pnam)
|
||||
char *pnam;
|
||||
void CC_pspnam(int op, char *pnam)
|
||||
{
|
||||
/* Pseudo with procedure name
|
||||
*/
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_scon(str, siz)
|
||||
char *str;
|
||||
arith siz;
|
||||
void CC_scon(char *str, arith siz)
|
||||
{
|
||||
COMMA();
|
||||
SCON(str, siz);
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "em_code.h"
|
||||
#include "em_private.h"
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void
|
||||
CC_ucon(val,siz)
|
||||
char *val;
|
||||
arith siz;
|
||||
void CC_ucon(char *val, arith siz)
|
||||
{
|
||||
COMMA();
|
||||
WCON(sp_ucon, val, siz);
|
||||
|
||||
@ -6,10 +6,7 @@
|
||||
#include <em.h>
|
||||
#include <em_mes.h>
|
||||
|
||||
void
|
||||
C_ms_ego(hint, offs, siz, regno)
|
||||
int hint, regno;
|
||||
arith offs, siz;
|
||||
void C_ms_ego(int hint, arith offs, arith siz, int regno)
|
||||
{
|
||||
C_mes_begin(ms_ego);
|
||||
C_cst((arith)hint);
|
||||
|
||||
@ -84,110 +84,110 @@ for (i=1;i<20;i++) {
|
||||
|
||||
*/
|
||||
static flt_arith s10pow[] = { /* representation of 10 ** i */
|
||||
{ 0, 0, 0x80000000, 0 },
|
||||
{ 0, 3, 0xA0000000, 0 },
|
||||
{ 0, 6, 0xC8000000, 0 },
|
||||
{ 0, 9, 0xFA000000, 0 },
|
||||
{ 0, 13, 0x9C400000, 0 },
|
||||
{ 0, 16, 0xC3500000, 0 },
|
||||
{ 0, 19, 0xF4240000, 0 },
|
||||
{ 0, 23, 0x98968000, 0 },
|
||||
{ 0, 26, 0xBEBC2000, 0 },
|
||||
{ 0, 29, 0xEE6B2800, 0 },
|
||||
{ 0, 33, 0x9502F900, 0 },
|
||||
{ 0, 36, 0xBA43B740, 0 },
|
||||
{ 0, 39, 0xE8D4A510, 0 },
|
||||
{ 0, 43, 0x9184E72A, 0 },
|
||||
{ 0, 46, 0xB5E620F4, 0x80000000 },
|
||||
{ 0, 49, 0xE35FA931, 0xA0000000 },
|
||||
{ 0, 53, 0x8E1BC9BF, 0x04000000 },
|
||||
{ 0, 56, 0xB1A2BC2E, 0xC5000000 },
|
||||
{ 0, 59, 0xDE0B6B3A, 0x76400000 },
|
||||
{ 0, 63, 0x8AC72304, 0x89E80000 },
|
||||
{ 0, 66, 0xAD78EBC5, 0xAC620000 },
|
||||
{ 0, 69, 0xD8D726B7, 0x177A8000 },
|
||||
{ 0, 73, 0x87867832, 0x6EAC9000 },
|
||||
{ 0, 76, 0xA968163F, 0x0A57B400 },
|
||||
{ 0, 79, 0xD3C21BCE, 0xCCEDA100 },
|
||||
{ 0, 83, 0x84595161, 0x401484A0 },
|
||||
{ 0, 86, 0xA56FA5B9, 0x9019A5C8 },
|
||||
{ 0, 89, 0xCECB8F27, 0xF4200F3A }
|
||||
{ 0, 0, { 0x80000000, 0 } },
|
||||
{ 0, 3, { 0xA0000000, 0 } },
|
||||
{ 0, 6, { 0xC8000000, 0 } },
|
||||
{ 0, 9, { 0xFA000000, 0 } },
|
||||
{ 0, 13, { 0x9C400000, 0 } },
|
||||
{ 0, 16, { 0xC3500000, 0 } },
|
||||
{ 0, 19, { 0xF4240000, 0 } },
|
||||
{ 0, 23, { 0x98968000, 0 } },
|
||||
{ 0, 26, { 0xBEBC2000, 0 } },
|
||||
{ 0, 29, { 0xEE6B2800, 0 } },
|
||||
{ 0, 33, { 0x9502F900, 0 } },
|
||||
{ 0, 36, { 0xBA43B740, 0 } },
|
||||
{ 0, 39, { 0xE8D4A510, 0 } },
|
||||
{ 0, 43, { 0x9184E72A, 0 } },
|
||||
{ 0, 46, { 0xB5E620F4, 0x80000000 } },
|
||||
{ 0, 49, { 0xE35FA931, 0xA0000000 } },
|
||||
{ 0, 53, { 0x8E1BC9BF, 0x04000000 } },
|
||||
{ 0, 56, { 0xB1A2BC2E, 0xC5000000 } },
|
||||
{ 0, 59, { 0xDE0B6B3A, 0x76400000 } },
|
||||
{ 0, 63, { 0x8AC72304, 0x89E80000 } },
|
||||
{ 0, 66, { 0xAD78EBC5, 0xAC620000 } },
|
||||
{ 0, 69, { 0xD8D726B7, 0x177A8000 } },
|
||||
{ 0, 73, { 0x87867832, 0x6EAC9000 } },
|
||||
{ 0, 76, { 0xA968163F, 0x0A57B400 } },
|
||||
{ 0, 79, { 0xD3C21BCE, 0xCCEDA100 } },
|
||||
{ 0, 83, { 0x84595161, 0x401484A0 } },
|
||||
{ 0, 86, { 0xA56FA5B9, 0x9019A5C8 } },
|
||||
{ 0, 89, { 0xCECB8F27, 0xF4200F3A } }
|
||||
};
|
||||
static flt_arith big_10pow[] = { /* representation of 10 ** (28*i) */
|
||||
{ 0, 0, 0x80000000, 0 },
|
||||
{ 0, 93, 0x813F3978, 0xF8940984 },
|
||||
{ 0, 186, 0x82818F12, 0x81ED44A0 },
|
||||
{ 0, 279, 0x83C7088E, 0x1AAB65DB },
|
||||
{ 0, 372, 0x850FADC0, 0x9923329E },
|
||||
{ 0, 465, 0x865B8692, 0x5B9BC5C2 },
|
||||
{ 0, 558, 0x87AA9AFF, 0x79042287 },
|
||||
{ 0, 651, 0x88FCF317, 0xF22241E2 },
|
||||
{ 0, 744, 0x8A5296FF, 0xE33CC930 },
|
||||
{ 0, 837, 0x8BAB8EEF, 0xB6409C1A },
|
||||
{ 0, 930, 0x8D07E334, 0x55637EB3 },
|
||||
{ 0, 1023, 0x8E679C2F, 0x5E44FF8F },
|
||||
{ 0, 1116, 0x8FCAC257, 0x558EE4E6 },
|
||||
{ 0, 1209, 0x91315E37, 0xDB165AA9 },
|
||||
{ 0, 1302, 0x929B7871, 0xDE7F22B9 },
|
||||
{ 0, 1395, 0x940919BB, 0xD4620B6D },
|
||||
{ 0, 1488, 0x957A4AE1, 0xEBF7F3D4 },
|
||||
{ 0, 1581, 0x96EF14C6, 0x454AA840 },
|
||||
{ 0, 1674, 0x98678061, 0x27ECE4F5 },
|
||||
{ 0, 1767, 0x99E396C1, 0x3A3ACFF2 }
|
||||
{ 0, 0, { 0x80000000, 0 } },
|
||||
{ 0, 93, { 0x813F3978, 0xF8940984 } },
|
||||
{ 0, 186, { 0x82818F12, 0x81ED44A0 } },
|
||||
{ 0, 279, { 0x83C7088E, 0x1AAB65DB } },
|
||||
{ 0, 372, { 0x850FADC0, 0x9923329E } },
|
||||
{ 0, 465, { 0x865B8692, 0x5B9BC5C2 } },
|
||||
{ 0, 558, { 0x87AA9AFF, 0x79042287 } },
|
||||
{ 0, 651, { 0x88FCF317, 0xF22241E2 } },
|
||||
{ 0, 744, { 0x8A5296FF, 0xE33CC930 } },
|
||||
{ 0, 837, { 0x8BAB8EEF, 0xB6409C1A } },
|
||||
{ 0, 930, { 0x8D07E334, 0x55637EB3 } },
|
||||
{ 0, 1023, { 0x8E679C2F, 0x5E44FF8F } },
|
||||
{ 0, 1116, { 0x8FCAC257, 0x558EE4E6 } },
|
||||
{ 0, 1209, { 0x91315E37, 0xDB165AA9 } },
|
||||
{ 0, 1302, { 0x929B7871, 0xDE7F22B9 } },
|
||||
{ 0, 1395, { 0x940919BB, 0xD4620B6D } },
|
||||
{ 0, 1488, { 0x957A4AE1, 0xEBF7F3D4 } },
|
||||
{ 0, 1581, { 0x96EF14C6, 0x454AA840 } },
|
||||
{ 0, 1674, { 0x98678061, 0x27ECE4F5 } },
|
||||
{ 0, 1767, { 0x99E396C1, 0x3A3ACFF2 } }
|
||||
};
|
||||
|
||||
static flt_arith r_10pow[] = { /* representation of 10 ** -i */
|
||||
{ 0, 0, 0x80000000, 0 },
|
||||
{ 0, -4, 0xCCCCCCCC, 0xCCCCCCCD },
|
||||
{ 0, -7, 0xA3D70A3D, 0x70A3D70A },
|
||||
{ 0, -10, 0x83126E97, 0x8D4FDF3B },
|
||||
{ 0, -14, 0xD1B71758, 0xE219652C },
|
||||
{ 0, -17, 0xA7C5AC47, 0x1B478423 },
|
||||
{ 0, -20, 0x8637BD05, 0xAF6C69B6 },
|
||||
{ 0, -24, 0xD6BF94D5, 0xE57A42BC },
|
||||
{ 0, -27, 0xABCC7711, 0x8461CEFD },
|
||||
{ 0, -30, 0x89705F41, 0x36B4A597 },
|
||||
{ 0, -34, 0xDBE6FECE, 0xBDEDD5BF },
|
||||
{ 0, -37, 0xAFEBFF0B, 0xCB24AAFF },
|
||||
{ 0, -40, 0x8CBCCC09, 0x6F5088CC },
|
||||
{ 0, -44, 0xE12E1342, 0x4BB40E13 },
|
||||
{ 0, -47, 0xB424DC35, 0x095CD80F },
|
||||
{ 0, -50, 0x901D7CF7, 0x3AB0ACD9 },
|
||||
{ 0, -54, 0xE69594BE, 0xC44DE15B },
|
||||
{ 0, -57, 0xB877AA32, 0x36A4B449 },
|
||||
{ 0, -60, 0x9392EE8E, 0x921D5D07 },
|
||||
{ 0, -64, 0xEC1E4A7D, 0xB69561A5 },
|
||||
{ 0, -67, 0xBCE50864, 0x92111AEB },
|
||||
{ 0, -70, 0x971DA050, 0x74DA7BEF },
|
||||
{ 0, -74, 0xF1C90080, 0xBAF72CB1 },
|
||||
{ 0, -77, 0xC16D9A00, 0x95928A27 },
|
||||
{ 0, -80, 0x9ABE14CD, 0x44753B53 },
|
||||
{ 0, -84, 0xF79687AE, 0xD3EEC551 },
|
||||
{ 0, -87, 0xC6120625, 0x76589DDB },
|
||||
{ 0, -90, 0x9E74D1B7, 0x91E07E48 }
|
||||
{ 0, 0, { 0x80000000, 0 } },
|
||||
{ 0, -4, { 0xCCCCCCCC, 0xCCCCCCCD } },
|
||||
{ 0, -7, { 0xA3D70A3D, 0x70A3D70A } },
|
||||
{ 0, -10, { 0x83126E97, 0x8D4FDF3B } },
|
||||
{ 0, -14, { 0xD1B71758, 0xE219652C } },
|
||||
{ 0, -17, { 0xA7C5AC47, 0x1B478423 } },
|
||||
{ 0, -20, { 0x8637BD05, 0xAF6C69B6 } },
|
||||
{ 0, -24, { 0xD6BF94D5, 0xE57A42BC } },
|
||||
{ 0, -27, { 0xABCC7711, 0x8461CEFD } },
|
||||
{ 0, -30, { 0x89705F41, 0x36B4A597 } },
|
||||
{ 0, -34, { 0xDBE6FECE, 0xBDEDD5BF } },
|
||||
{ 0, -37, { 0xAFEBFF0B, 0xCB24AAFF } },
|
||||
{ 0, -40, { 0x8CBCCC09, 0x6F5088CC } },
|
||||
{ 0, -44, { 0xE12E1342, 0x4BB40E13 } },
|
||||
{ 0, -47, { 0xB424DC35, 0x095CD80F } },
|
||||
{ 0, -50, { 0x901D7CF7, 0x3AB0ACD9 } },
|
||||
{ 0, -54, { 0xE69594BE, 0xC44DE15B } },
|
||||
{ 0, -57, { 0xB877AA32, 0x36A4B449 } },
|
||||
{ 0, -60, { 0x9392EE8E, 0x921D5D07 } },
|
||||
{ 0, -64, { 0xEC1E4A7D, 0xB69561A5 } },
|
||||
{ 0, -67, { 0xBCE50864, 0x92111AEB } },
|
||||
{ 0, -70, { 0x971DA050, 0x74DA7BEF } },
|
||||
{ 0, -74, { 0xF1C90080, 0xBAF72CB1 } },
|
||||
{ 0, -77, { 0xC16D9A00, 0x95928A27 } },
|
||||
{ 0, -80, { 0x9ABE14CD, 0x44753B53 } },
|
||||
{ 0, -84, { 0xF79687AE, 0xD3EEC551 } },
|
||||
{ 0, -87, { 0xC6120625, 0x76589DDB } },
|
||||
{ 0, -90, { 0x9E74D1B7, 0x91E07E48 } }
|
||||
};
|
||||
|
||||
static flt_arith r_big_10pow[] = { /* representation of 10 ** -(28*i) */
|
||||
{ 0, 0, 0x80000000, 0 },
|
||||
{ 0, -94, 0xFD87B5F2, 0x8300CA0E },
|
||||
{ 0, -187, 0xFB158592, 0xBE068D2F },
|
||||
{ 0, -280, 0xF8A95FCF, 0x88747D94 },
|
||||
{ 0, -373, 0xF64335BC, 0xF065D37D },
|
||||
{ 0, -466, 0xF3E2F893, 0xDEC3F126 },
|
||||
{ 0, -559, 0xF18899B1, 0xBC3F8CA2 },
|
||||
{ 0, -652, 0xEF340A98, 0x172AACE5 },
|
||||
{ 0, -745, 0xECE53CEC, 0x4A314EBE },
|
||||
{ 0, -838, 0xEA9C2277, 0x23EE8BCB },
|
||||
{ 0, -931, 0xE858AD24, 0x8F5C22CA },
|
||||
{ 0, -1024, 0xE61ACF03, 0x3D1A45DF },
|
||||
{ 0, -1117, 0xE3E27A44, 0x4D8D98B8 },
|
||||
{ 0, -1210, 0xE1AFA13A, 0xFBD14D6E },
|
||||
{ 0, -1303, 0xDF82365C, 0x497B5454 },
|
||||
{ 0, -1396, 0xDD5A2C3E, 0xAB3097CC },
|
||||
{ 0, -1489, 0xDB377599, 0xB6074245 },
|
||||
{ 0, -1582, 0xD91A0545, 0xCDB51186 },
|
||||
{ 0, -1675, 0xD701CE3B, 0xD387BF48 },
|
||||
{ 0, -1768, 0xD4EEC394, 0xD6258BF8 }
|
||||
{ 0, 0, { 0x80000000, 0 } },
|
||||
{ 0, -94, { 0xFD87B5F2, 0x8300CA0E } },
|
||||
{ 0, -187, { 0xFB158592, 0xBE068D2F } },
|
||||
{ 0, -280, { 0xF8A95FCF, 0x88747D94 } },
|
||||
{ 0, -373, { 0xF64335BC, 0xF065D37D } },
|
||||
{ 0, -466, { 0xF3E2F893, 0xDEC3F126 } },
|
||||
{ 0, -559, { 0xF18899B1, 0xBC3F8CA2 } },
|
||||
{ 0, -652, { 0xEF340A98, 0x172AACE5 } },
|
||||
{ 0, -745, { 0xECE53CEC, 0x4A314EBE } },
|
||||
{ 0, -838, { 0xEA9C2277, 0x23EE8BCB } },
|
||||
{ 0, -931, { 0xE858AD24, 0x8F5C22CA } },
|
||||
{ 0, -1024, { 0xE61ACF03, 0x3D1A45DF } },
|
||||
{ 0, -1117, { 0xE3E27A44, 0x4D8D98B8 } },
|
||||
{ 0, -1210, { 0xE1AFA13A, 0xFBD14D6E } },
|
||||
{ 0, -1303, { 0xDF82365C, 0x497B5454 } },
|
||||
{ 0, -1396, { 0xDD5A2C3E, 0xAB3097CC } },
|
||||
{ 0, -1489, { 0xDB377599, 0xB6074245 } },
|
||||
{ 0, -1582, { 0xD91A0545, 0xCDB51186 } },
|
||||
{ 0, -1675, { 0xD701CE3B, 0xD387BF48 } },
|
||||
{ 0, -1768, { 0xD4EEC394, 0xD6258BF8 } }
|
||||
};
|
||||
|
||||
#define BIGSZ (sizeof(big_10pow)/sizeof(big_10pow[0]))
|
||||
|
||||
@ -9,6 +9,14 @@
|
||||
#ifndef __OBJECT_INCLUDED__
|
||||
#define __OBJECT_INCLUDED__
|
||||
|
||||
struct fil;
|
||||
struct outhead;
|
||||
struct outsect;
|
||||
struct outname;
|
||||
struct ar_hdr;
|
||||
struct ranlib;
|
||||
struct outrelo;
|
||||
|
||||
_PROTOTYPE(int wr_open, (char *f));
|
||||
_PROTOTYPE(void wr_close, (void));
|
||||
_PROTOTYPE(void wr_ohead, (struct outhead *h));
|
||||
@ -24,6 +32,7 @@ _PROTOTYPE(void wr_ranlib, (int fd, struct ranlib *r, long cnt));
|
||||
_PROTOTYPE(void wr_int2, (int fd, int i));
|
||||
_PROTOTYPE(void wr_long, (int fd, long l));
|
||||
_PROTOTYPE(void wr_bytes, (int fd, char *buf, long l));
|
||||
_PROTOTYPE(void __wr_flush, (struct fil *ptr));
|
||||
_PROTOTYPE(int rd_open, (char *f));
|
||||
_PROTOTYPE(int rd_fdopen, (int f));
|
||||
_PROTOTYPE(void rd_close, (void));
|
||||
@ -38,6 +47,7 @@ _PROTOTYPE(void rd_string, (char *s, long c));
|
||||
_PROTOTYPE(int rd_arhdr, (int fd, struct ar_hdr *a));
|
||||
_PROTOTYPE(void rd_ranlib, (int fd, struct ranlib *r, long cnt));
|
||||
_PROTOTYPE(int rd_int2, (int fd));
|
||||
_PROTOTYPE(unsigned int rd_unsigned2, (int fd));
|
||||
_PROTOTYPE(long rd_long, (int fd));
|
||||
_PROTOTYPE(void rd_bytes, (int fd, char *buf, long l));
|
||||
_PROTOTYPE(int rd_fd, (void));
|
||||
|
||||
@ -22,7 +22,8 @@ module_object = clibrary {
|
||||
|
||||
outputs = {"%U%/lib_object.a"},
|
||||
install = {
|
||||
pm.install(LIBDIR.."libobject.a")
|
||||
pm.install(LIBDIR.."libobject.a"),
|
||||
pm.install(d.."object.h", "%HEADERDIR%object.h")
|
||||
}
|
||||
}
|
||||
--[[
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
|
||||
#include "obj.h"
|
||||
|
||||
unsigned int
|
||||
rd_unsigned2(fd)
|
||||
unsigned int rd_unsigned2(int fd)
|
||||
{
|
||||
char buf[2];
|
||||
|
||||
|
||||
@ -12,6 +12,12 @@
|
||||
*/
|
||||
|
||||
#include "obj.h"
|
||||
#include "object.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* Parts of the output file.
|
||||
@ -50,11 +56,13 @@ void __wr_flush(struct fil *ptr)
|
||||
ptr->pbegin = ptr->pbuf;
|
||||
}
|
||||
|
||||
static void
|
||||
OUTWRITE(p, b, n)
|
||||
int p; /* part number */
|
||||
register char *b; /* buffer pointer */
|
||||
long n; /* write count */
|
||||
#if 0
|
||||
int p part number
|
||||
char *b buffer pointer
|
||||
long number write count
|
||||
#endif
|
||||
static void OUTWRITE(int p, char *b, long n)
|
||||
|
||||
{
|
||||
register struct fil *ptr = &__parts[p];
|
||||
register char *pn = ptr->pnow;
|
||||
@ -116,10 +124,12 @@ OUTWRITE(p, b, n)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
BEGINSEEK(p, o)
|
||||
int p; /* part number */
|
||||
long o; /* offset in file */
|
||||
/*
|
||||
int p; part number
|
||||
long o; offset in file
|
||||
*/
|
||||
static void BEGINSEEK(int p, long o)
|
||||
|
||||
{
|
||||
register struct fil *ptr = &__parts[p];
|
||||
|
||||
@ -160,10 +170,9 @@ wr_open(f)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
wr_close()
|
||||
void wr_close()
|
||||
{
|
||||
register struct fil *ptr;
|
||||
struct fil *ptr;
|
||||
|
||||
for (ptr = &__parts[PARTEMIT]; ptr < &__parts[NPARTS]; ptr++) {
|
||||
__wr_flush(ptr);
|
||||
@ -178,12 +187,10 @@ wr_close()
|
||||
#endif /* OUTSEEK */
|
||||
}
|
||||
|
||||
void
|
||||
wr_ohead(head)
|
||||
register struct outhead *head;
|
||||
void wr_ohead(struct outhead *head)
|
||||
{
|
||||
{
|
||||
register long off = OFF_RELO(*head);
|
||||
long off = OFF_RELO(*head);
|
||||
|
||||
BEGINSEEK(PARTEMIT, 0L);
|
||||
BEGINSEEK(PARTRELO, off);
|
||||
@ -200,7 +207,7 @@ wr_ohead(head)
|
||||
{
|
||||
char buf[SZ_HEAD];
|
||||
|
||||
register char *c = &buf[0];
|
||||
char *c = &buf[0];
|
||||
|
||||
put2(head->oh_magic, c); c += 2;
|
||||
put2(head->oh_stamp, c); c += 2;
|
||||
@ -215,12 +222,10 @@ wr_ohead(head)
|
||||
else OUTWRITE(PARTEMIT, (char *)head, (long)SZ_HEAD);
|
||||
}
|
||||
|
||||
void
|
||||
wr_sect(sect, cnt)
|
||||
register struct outsect *sect;
|
||||
register unsigned int cnt;
|
||||
void wr_sect(struct outsect *sect, unsigned int cnt)
|
||||
{
|
||||
{ register unsigned int i = cnt;
|
||||
{
|
||||
unsigned int i = cnt;
|
||||
|
||||
while (i--) {
|
||||
if (offcnt >= 1 && offcnt < SECTCNT) {
|
||||
@ -236,8 +241,8 @@ wr_sect(sect, cnt)
|
||||
#endif
|
||||
while (cnt)
|
||||
{
|
||||
register char *c;
|
||||
register unsigned int i;
|
||||
char *c;
|
||||
unsigned int i;
|
||||
|
||||
i = __parts[PARTEMIT].cnt/SZ_SECT;
|
||||
c = __parts[PARTEMIT].pnow;
|
||||
@ -264,11 +269,10 @@ wr_sect(sect, cnt)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
wr_outsect(s)
|
||||
int s; /* section number */
|
||||
/* s => section number */
|
||||
void wr_outsect(int s)
|
||||
{
|
||||
register struct fil *ptr = &__parts[PARTEMIT + getsect(sectionnr)];
|
||||
struct fil *ptr = &__parts[PARTEMIT + getsect(sectionnr)];
|
||||
|
||||
if (s != sectionnr && s >= (SECTCNT-1) && sectionnr >= (SECTCNT-1)) {
|
||||
#ifdef OUTSEEK
|
||||
@ -297,27 +301,20 @@ wr_outsect(s)
|
||||
/*
|
||||
* We don't have to worry about byte order here.
|
||||
*/
|
||||
void
|
||||
wr_emit(emit, cnt)
|
||||
char *emit;
|
||||
long cnt;
|
||||
void wr_emit(char *emit, long cnt)
|
||||
{
|
||||
OUTWRITE(PARTEMIT + getsect(sectionnr) , emit, cnt);
|
||||
}
|
||||
|
||||
void
|
||||
wr_relo(relo, cnt)
|
||||
register struct outrelo *relo;
|
||||
unsigned int cnt;
|
||||
void wr_relo(struct outrelo *relo, unsigned int cnt)
|
||||
{
|
||||
|
||||
#if BYTE_ORDER == 0x0123
|
||||
if (sizeof(struct outrelo) != SZ_RELO)
|
||||
#endif
|
||||
while (cnt)
|
||||
{
|
||||
register char *c;
|
||||
register unsigned int i;
|
||||
char *c;
|
||||
unsigned int i;
|
||||
|
||||
i = __parts[PARTRELO].cnt/SZ_RELO;
|
||||
c = __parts[PARTRELO].pnow;
|
||||
@ -343,18 +340,15 @@ wr_relo(relo, cnt)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
wr_name(name, cnt)
|
||||
register struct outname *name;
|
||||
unsigned int cnt;
|
||||
void wr_name(struct outname *name, unsigned int cnt)
|
||||
{
|
||||
#if BYTE_ORDER == 0x0123
|
||||
if (sizeof(struct outname) != SZ_NAME)
|
||||
#endif
|
||||
while (cnt)
|
||||
{
|
||||
register char *c;
|
||||
register unsigned int i;
|
||||
char *c;
|
||||
unsigned int i;
|
||||
|
||||
i = __parts[PARTNAME].cnt/SZ_NAME;
|
||||
c = __parts[PARTNAME].pnow;
|
||||
@ -379,10 +373,7 @@ wr_name(name, cnt)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
wr_string(addr, len)
|
||||
char *addr;
|
||||
long len;
|
||||
void wr_string(char *addr, long len)
|
||||
{
|
||||
|
||||
OUTWRITE(PARTCHAR, addr, len);
|
||||
@ -390,10 +381,7 @@ wr_string(addr, len)
|
||||
|
||||
#ifdef SYMDBUG
|
||||
|
||||
void
|
||||
wr_dbug(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
void wr_dbug(char *buf, long size)
|
||||
{
|
||||
OUTWRITE(PARTDBUG, buf, size);
|
||||
}
|
||||
|
||||
@ -7,10 +7,9 @@
|
||||
|
||||
extern int __sectionnr;
|
||||
|
||||
void
|
||||
wr_putc(ch)
|
||||
void wr_putc(int ch)
|
||||
{
|
||||
register struct fil *ptr = &__parts[PARTEMIT+getsect(__sectionnr)];
|
||||
struct fil *ptr = &__parts[PARTEMIT+getsect(__sectionnr)];
|
||||
|
||||
if (ptr->cnt == 0) __wr_flush(ptr);
|
||||
ptr->cnt--; *ptr->pnow++ = ch;
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <assert.h>
|
||||
#include <alloc.h>
|
||||
#include <system.h>
|
||||
#include <ctype.h>
|
||||
#include <em_label.h>
|
||||
#include <em_arith.h>
|
||||
#include <em_pseu.h>
|
||||
@ -40,8 +41,7 @@
|
||||
static File *fd;
|
||||
static char *_ich;
|
||||
|
||||
PRIVATE int
|
||||
_fill()
|
||||
static int _fill()
|
||||
{
|
||||
static char text[BUFSIZ + 1];
|
||||
static int sz;
|
||||
@ -79,7 +79,7 @@ static int state; /* What state are we in? */
|
||||
|
||||
static int EM_initialized; /* EM_open called? */
|
||||
|
||||
static long wordmask[] = { /* allowed bits in a word */
|
||||
long wordmask[] = { /* allowed bits in a word */
|
||||
0x00000000,
|
||||
0x000000FF,
|
||||
0x0000FFFF,
|
||||
@ -99,18 +99,14 @@ static char *argrange = "Argument range error";
|
||||
/* Error handling
|
||||
*/
|
||||
|
||||
PRIVATE void
|
||||
xerror(s)
|
||||
char *s;
|
||||
static void xerror(char *s)
|
||||
{
|
||||
if (emhead->em_type != EM_FATAL) emhead->em_type = EM_ERROR;
|
||||
if (!EM_error) EM_error = s;
|
||||
}
|
||||
|
||||
#ifdef COMPACT
|
||||
PRIVATE void
|
||||
xfatal(s)
|
||||
char *s;
|
||||
void xfatal(char *s)
|
||||
{
|
||||
emhead->em_type = EM_FATAL;
|
||||
if (!EM_error) EM_error = s;
|
||||
@ -123,9 +119,8 @@ xfatal(s)
|
||||
|
||||
/* EM_open: Open input file, get magic word if COMPACT.
|
||||
*/
|
||||
EXPORT int
|
||||
EM_open(filename)
|
||||
char *filename;
|
||||
|
||||
int EM_open(char *filename)
|
||||
{
|
||||
if (EM_initialized) {
|
||||
EM_error = "EM_open already called";
|
||||
@ -157,10 +152,8 @@ EM_open(filename)
|
||||
|
||||
/* EM_close: Close input file
|
||||
*/
|
||||
EXPORT void
|
||||
EM_close()
|
||||
void EM_close()
|
||||
{
|
||||
|
||||
if (fd != STDIN) {
|
||||
sys_close(fd);
|
||||
fd = STDIN;
|
||||
@ -175,11 +168,8 @@ EM_close()
|
||||
again, but also to deliver the arguments on next calls to EM_getinstr.
|
||||
This is indicated by the variable "argp".
|
||||
*/
|
||||
PRIVATE void
|
||||
startmes(p)
|
||||
register struct e_instr *p;
|
||||
static void startmes(struct e_instr *p)
|
||||
{
|
||||
|
||||
getarg(cst_ptyp, &(p->em_arg));
|
||||
state = MES;
|
||||
|
||||
@ -206,11 +196,8 @@ startmes(p)
|
||||
|
||||
/* EM_getinstr: read an "EM_line"
|
||||
*/
|
||||
EXPORT int
|
||||
EM_getinstr(p)
|
||||
register struct e_instr *p;
|
||||
int EM_getinstr(struct e_instr *p)
|
||||
{
|
||||
|
||||
EM_error = 0;
|
||||
if (ahead) {
|
||||
register int i;
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* Since isascii is not standard, as c89 or C99, privide another method */
|
||||
#define IsAscii(_c) (((_c) & ~0x7f) == 0)
|
||||
|
||||
/* get16, get32: read a signed constant
|
||||
*/
|
||||
PRIVATE int
|
||||
get16()
|
||||
static int get16()
|
||||
{
|
||||
register int l_byte, h_byte;
|
||||
int l_byte, h_byte;
|
||||
|
||||
l_byte = getbyte();
|
||||
h_byte = getbyte();
|
||||
@ -22,11 +24,10 @@ get16()
|
||||
return l_byte | (h_byte << 8);
|
||||
}
|
||||
|
||||
PRIVATE arith
|
||||
get32()
|
||||
static arith get32()
|
||||
{
|
||||
register arith l;
|
||||
register int h_byte;
|
||||
arith l;
|
||||
int h_byte;
|
||||
|
||||
l = getbyte();
|
||||
l |= ((unsigned) getbyte() << 8);
|
||||
@ -36,16 +37,14 @@ get32()
|
||||
return l | ((arith) h_byte << 24);
|
||||
}
|
||||
|
||||
PRIVATE struct string *getstring();
|
||||
static struct string *getstring();
|
||||
|
||||
/* getarg : read an argument of any type, and check it against "typset"
|
||||
if neccesary. Put result in "ap".
|
||||
*/
|
||||
PRIVATE void
|
||||
getarg(typset, ap)
|
||||
register struct e_arg *ap;
|
||||
static void getarg(int typset, struct e_arg *ap)
|
||||
{
|
||||
register int i = getbyte();
|
||||
int i = getbyte();
|
||||
#ifdef CHECKING
|
||||
int argtyp;
|
||||
#endif /* CHECKING */
|
||||
@ -106,7 +105,7 @@ getarg(typset, ap)
|
||||
|
||||
case sp_pnam: /* A procedure name */
|
||||
{
|
||||
register struct string *p;
|
||||
struct string *p;
|
||||
|
||||
p = getstring(1);
|
||||
ap->ema_pnam = p->str;
|
||||
@ -116,7 +115,7 @@ getarg(typset, ap)
|
||||
|
||||
case sp_dnam: /* A Non-numeric data label */
|
||||
{
|
||||
register struct string *p;
|
||||
struct string *p;
|
||||
|
||||
p = getstring(1);
|
||||
ap->ema_dnam = p->str;
|
||||
@ -139,7 +138,7 @@ getarg(typset, ap)
|
||||
case sp_ucon: /* An unsigned constant */
|
||||
case sp_fcon: /* A floating constant */
|
||||
{
|
||||
register struct string *p;
|
||||
struct string *p;
|
||||
|
||||
getarg(cst_ptyp, ap);
|
||||
ap->ema_szoroff = ap->ema_cst;
|
||||
@ -151,7 +150,7 @@ getarg(typset, ap)
|
||||
|
||||
case sp_scon: /* A string constant */
|
||||
{
|
||||
register struct string *p;
|
||||
struct string *p;
|
||||
|
||||
p = getstring(0);
|
||||
ap->ema_argtype = str_ptyp;
|
||||
@ -190,20 +189,18 @@ getarg(typset, ap)
|
||||
#ifdef CHECKING
|
||||
/* checkident: check that a string indeed represents an identifier
|
||||
*/
|
||||
PRIVATE int
|
||||
checkident(s)
|
||||
register struct string *s;
|
||||
static int checkident(struct string *s)
|
||||
{
|
||||
register char *p;
|
||||
register int n;
|
||||
char *p;
|
||||
int n;
|
||||
|
||||
p = s->str;
|
||||
if (!isascii(*p) || (!isalpha(*p) && *p != '_')) {
|
||||
if (!IsAscii(*p) || (!isalpha(*p) && *p != '_')) {
|
||||
return 0;
|
||||
}
|
||||
p++;
|
||||
for (n = s->length; --n > 0; p++) {
|
||||
if (!isascii(*p) || (!isalnum(*p) && *p != '_')) {
|
||||
if (!IsAscii(*p) || (!isalnum(*p) && *p != '_')) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -214,12 +211,11 @@ checkident(s)
|
||||
/* getstring: read a string from the input
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
PRIVATE struct string *
|
||||
getstring(isident)
|
||||
static struct string *getstring(int isident)
|
||||
{
|
||||
register char *p;
|
||||
register int n;
|
||||
register struct string *s = &string;
|
||||
char *p;
|
||||
int n;
|
||||
struct string *s = &string;
|
||||
struct e_arg dummy;
|
||||
|
||||
getarg(cst_ptyp, &dummy);
|
||||
@ -259,11 +255,9 @@ getstring(isident)
|
||||
|
||||
/* gethead: read the start of an EM-line
|
||||
*/
|
||||
PRIVATE void
|
||||
gethead(p)
|
||||
register struct e_instr *p;
|
||||
static void gethead(struct e_instr *p)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
EM_lineno++;
|
||||
|
||||
|
||||
@ -3,10 +3,6 @@
|
||||
* This file is copied into Lpars.c.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char *rcsid = "$Id$";
|
||||
#endif
|
||||
|
||||
unsigned int LLtcnt[LL_NTERMINALS];
|
||||
unsigned int LLscnt[LL_NSETS];
|
||||
int LLcsymb, LLsymb;
|
||||
|
||||
@ -68,7 +68,7 @@ typedef struct {
|
||||
#define p_cont(elem) ((path *)l_content(elem))
|
||||
|
||||
/* Return values of setpath() */
|
||||
enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
|
||||
enum f_path { FP_OK, FP_NOMATCH, FP_NOPATH } ;
|
||||
|
||||
/* Own routines */
|
||||
enum f_path getpath(trf **first);
|
||||
@ -84,6 +84,66 @@ char *changecore(char *ptr, unsigned int size);
|
||||
#define freecore(area) free(area)
|
||||
growstring scanb(char *line);
|
||||
growstring scanvars(char *line);
|
||||
void throws(char *str);
|
||||
void start_scan();
|
||||
void scan_found();
|
||||
void find_cpp();
|
||||
void try(list_elem *f_scan, char *suffix);
|
||||
void setlist(char *name);
|
||||
void fuerror(const char *fmt, ...);
|
||||
void transini();
|
||||
int process(char *arg);
|
||||
void setsvar(char *name, char *str);
|
||||
void getmapflags(trf *phase);
|
||||
void vprint(const char* fmt, ...);
|
||||
void disc_inputs(trf *phase);
|
||||
int startrf(trf *first);
|
||||
void setpvar(char *name,char *(*rout)(void));
|
||||
void l_add(list_head *header, char *string);
|
||||
void error(const char *fmt, ...);
|
||||
void do_Rflag(char *argp);
|
||||
void werror(const char *fmt, ...);
|
||||
void add_input(path *file, trf *phase);
|
||||
void add_head(char *str);
|
||||
void add_tail(char *str);
|
||||
int mayprep();
|
||||
int transform(trf *phase);
|
||||
void fatal(const char* fmt, ...);
|
||||
void l_clear(list_head *header);
|
||||
int satisfy(trf *trafo, char *suffix);
|
||||
int setfiles(trf *phase);
|
||||
void disc_files(trf *phase);
|
||||
int runphase(trf *phase);
|
||||
void rmfile(path *file);
|
||||
int mapflag(list_head *maplist, char *cflag);
|
||||
void clr_noscan(char *str);
|
||||
void l_throw(list_head *header);
|
||||
int mapexpand(char *mapentry, char *cflag);
|
||||
void prns(char *s);
|
||||
void set_Rflag(char *argp);
|
||||
void condit(growstring *line, list_head *fsuff, list_head *lsuff, char *tailval);
|
||||
void doassign(char *line, char *star, int length);
|
||||
void getcallargs(trf *phase);
|
||||
void discardargs(trf *phase);
|
||||
void quit(int code);
|
||||
void rmtemps();
|
||||
void intrf();
|
||||
void open_in(char *name);
|
||||
void close_in();
|
||||
int getinchar();
|
||||
int getln();
|
||||
void keephead(char *suffix);
|
||||
void varinit();
|
||||
void vieuwargs(int argc, char *argv[]);
|
||||
void firstarg(char *argp);
|
||||
void block(trf *first);
|
||||
void keeptail(char *suffix);
|
||||
void scanneeds();
|
||||
void setneeds(char *suffix, int tail);
|
||||
int run_exec(trf *phase, char *prog);
|
||||
void do_flush();
|
||||
void file_final(path *file);
|
||||
|
||||
|
||||
#define DEBUG 1 /* Allow debugging of Ack */
|
||||
|
||||
|
||||
@ -6,15 +6,8 @@
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#define EXTERN
|
||||
|
||||
#include "data.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_data[] = RCS_DATA ;
|
||||
#endif
|
||||
|
||||
@ -14,12 +14,7 @@
|
||||
#include "data.h"
|
||||
#include <em_path.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
void file_final(path *file);
|
||||
void disc_inputs(trf *phase);
|
||||
#include <unistd.h>
|
||||
|
||||
char *add_u(int part, char *ptr)
|
||||
{
|
||||
|
||||
@ -15,11 +15,6 @@
|
||||
#include "ack.h"
|
||||
#include "grows.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_grows[] = RCS_GROWS ;
|
||||
#endif
|
||||
|
||||
void gr_add(growstring *id, char c)
|
||||
{
|
||||
if ( id->gr_size==id->gr_max) {
|
||||
|
||||
@ -10,11 +10,6 @@
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_list[] = RCS_LIST ;
|
||||
#endif
|
||||
|
||||
/* List handling, operations allowed:
|
||||
adding strings to the list,
|
||||
throwing away whole lists,
|
||||
|
||||
@ -7,31 +7,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
#include <local.h>
|
||||
#include "data.h"
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_ack[] = RCS_ACK ;
|
||||
#endif
|
||||
|
||||
static int sigs[] = { SIGINT, SIGHUP, SIGTERM, 0 } ;
|
||||
static int arg_count;
|
||||
|
||||
void varinit();
|
||||
void vieuwargs(int argc, char *argv[]);
|
||||
void firstarg(char *argp);
|
||||
void block(trf *first);
|
||||
void keephead(char *suffix);
|
||||
void keeptail(char *suffix);
|
||||
void scanneeds();
|
||||
void setneeds(char *suffix, int tail);
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
register list_elem *elem ;
|
||||
@ -297,15 +287,15 @@ int process(char *arg)
|
||||
p_basename= keeps(basename(arg)) ;
|
||||
/* Try to find a path through the transformations */
|
||||
switch( getpath(&phase) ) {
|
||||
case F_NOPATH :
|
||||
case FP_NOPATH :
|
||||
error("Cannot produce the desired file from %s",arg) ;
|
||||
if ( linker ) add_input(&orig,linker) ;
|
||||
return 1 ;
|
||||
case F_NOMATCH :
|
||||
case FP_NOMATCH :
|
||||
if ( stopsuffix ) werror("Unknown suffix in %s",arg) ;
|
||||
if ( linker ) add_input(&orig,linker) ;
|
||||
return 1 ;
|
||||
case F_OK :
|
||||
case FP_OK :
|
||||
break ;
|
||||
}
|
||||
if ( !phase ) return 1 ;
|
||||
@ -457,7 +447,7 @@ void setneeds(char *suffix, int tail)
|
||||
|
||||
p_suffix= suffix ;
|
||||
switch ( getpath(&phase) ) {
|
||||
case F_OK :
|
||||
case FP_OK :
|
||||
for ( ; phase ; phase= phase->t_next ) {
|
||||
if ( phase->t_needed ) {
|
||||
if ( tail )
|
||||
@ -467,10 +457,10 @@ void setneeds(char *suffix, int tail)
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case F_NOMATCH :
|
||||
case FP_NOMATCH :
|
||||
werror("\"%s\": unrecognized suffix",suffix) ;
|
||||
break ;
|
||||
case F_NOPATH :
|
||||
case FP_NOPATH :
|
||||
werror("sorry, cannot produce the desired file(s) from %s files",
|
||||
suffix) ;
|
||||
break ;
|
||||
|
||||
@ -9,9 +9,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
#define IsAscii(_c) (((_c) & ~0x7f) == 0)
|
||||
|
||||
char *fname = 0 ;
|
||||
char dname[200] ;
|
||||
@ -80,9 +78,9 @@ FILE *do_open(char *file)
|
||||
|
||||
void readm()
|
||||
{
|
||||
register int i ;
|
||||
register int token ;
|
||||
register FILE *in ;
|
||||
int i ;
|
||||
int token ;
|
||||
FILE *in ;
|
||||
|
||||
in=do_open(fname) ;
|
||||
if ( in==NULL ) {
|
||||
@ -101,7 +99,7 @@ void readm()
|
||||
} else {
|
||||
fprintf(intab," ") ;
|
||||
}
|
||||
if ( !isascii(token) || !(isprint(token) || isspace(token)) ){
|
||||
if ( !IsAscii(token) || !(isprint(token) || isspace(token)) ){
|
||||
if ( token!=EOF ) {
|
||||
fprintf(stderr,"warning: non-ascii in %s\n",fname) ;
|
||||
fprintf(intab,"%4d,",token) ;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ack.h"
|
||||
@ -15,11 +16,6 @@
|
||||
#include "data.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_dmach[] = RCS_DMACH ;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Read machine definitions and transformations */
|
||||
@ -52,10 +48,6 @@ static char *ty_name ;
|
||||
static char *bol ;
|
||||
static char *inname ;
|
||||
|
||||
void intrf();
|
||||
void open_in(char *name);
|
||||
void close_in();
|
||||
|
||||
void setlist(char *name)
|
||||
{
|
||||
/* Name is sought in the internal tables,
|
||||
|
||||
@ -6,16 +6,18 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
#include "grows.h"
|
||||
#include "data.h"
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#define ARG_MORE 40 /* The size of args chunks to allocate */
|
||||
|
||||
|
||||
@ -10,15 +10,6 @@
|
||||
#include "list.h"
|
||||
#include "data.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
void start_scan();
|
||||
void scan_found();
|
||||
void find_cpp();
|
||||
void try(list_elem *f_scan, char *suffix);
|
||||
|
||||
enum f_path getpath(trf **first)
|
||||
{
|
||||
/* Try to find a transformation path */
|
||||
@ -225,7 +216,7 @@ enum f_path scan_end(trf **first)
|
||||
#ifdef DEBUG
|
||||
if ( debug>=3 ) vprint("End_scan\n");
|
||||
#endif
|
||||
if ( last_ncount== -1 ) return suf_found ? F_NOPATH : F_NOMATCH ;
|
||||
if ( last_ncount== -1 ) return suf_found ? FP_NOPATH : FP_NOMATCH ;
|
||||
#ifdef DEBUG
|
||||
if ( debug>=2 ) vprint("Transformation found\n");
|
||||
#endif
|
||||
@ -240,7 +231,7 @@ enum f_path scan_end(trf **first)
|
||||
*first= curr ;
|
||||
}
|
||||
if ( curr->t_next ) {
|
||||
return F_OK ;
|
||||
return FP_OK ;
|
||||
}
|
||||
prev=curr ;
|
||||
}
|
||||
@ -252,7 +243,7 @@ enum f_path scan_end(trf **first)
|
||||
if ( prev ) {
|
||||
prev->t_keep=YES ;
|
||||
}
|
||||
return F_OK ;
|
||||
return FP_OK ;
|
||||
}
|
||||
|
||||
void find_cpp()
|
||||
|
||||
@ -7,10 +7,6 @@
|
||||
#include <string.h>
|
||||
#include "ack.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
/* The processing of string valued variables,
|
||||
this is an almost self contained module.
|
||||
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
#include "grows.h"
|
||||
#include "data.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_trans[] = RCS_TRANS ;
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* Routines for transforming from one file type to another */
|
||||
/****************************************************************************/
|
||||
@ -26,12 +21,6 @@ static int touch_head= NO ;
|
||||
static growstring tail ;
|
||||
static int touch_tail= NO ;
|
||||
|
||||
void set_Rflag(char *argp);
|
||||
void condit(growstring *line, list_head *fsuff, list_head *lsuff, char *tailval);
|
||||
void doassign(char *line, char *star, int length);
|
||||
void getcallargs(trf *phase);
|
||||
void discardargs(trf *phase);
|
||||
|
||||
int transform(trf *phase)
|
||||
{
|
||||
int ok ;
|
||||
|
||||
@ -18,10 +18,6 @@
|
||||
#include <ctype.h>
|
||||
#include "ack.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
extern char *progname ;
|
||||
extern int w_flag ;
|
||||
extern int n_error;
|
||||
@ -32,10 +28,7 @@ extern int n_error;
|
||||
# define STDOUT stderr
|
||||
#endif
|
||||
|
||||
void fuerror(const char *fmt, ...);
|
||||
void werror(const char *fmt, ...);
|
||||
void quit(int code);
|
||||
|
||||
#define IsAscii(_c) (((_c) & ~0x7f) == 0)
|
||||
|
||||
char *basename(char *string)
|
||||
{
|
||||
@ -53,7 +46,7 @@ char *basename(char *string)
|
||||
case '/' : last_start=fetch+1 ; break ;
|
||||
case 0 : goto out ;
|
||||
}
|
||||
if ( !isascii(ctoken) || !isprint(ctoken) ) {
|
||||
if ( !IsAscii(ctoken) || !isprint(ctoken) ) {
|
||||
werror("non-ascii characters in argument %s",string) ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,8 +6,6 @@
|
||||
/* Made into arch/aal by Ceriel Jacobs
|
||||
*/
|
||||
|
||||
static char RcsId[] = "$Id$";
|
||||
|
||||
/*
|
||||
* Usage: [arch|aal] [qdprtx][vlcu] archive [file] ...
|
||||
* v: verbose
|
||||
@ -35,6 +33,13 @@ static char RcsId[] = "$Id$";
|
||||
#include <arch.h>
|
||||
#include <ranlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
#include "object.h"
|
||||
#include <missing_proto.h>
|
||||
|
||||
#ifdef AAL
|
||||
#include <out.h>
|
||||
#define MAGIC_NUMBER AALMAG
|
||||
@ -458,7 +463,7 @@ void add(char *name, int fd, char *mess)
|
||||
return;
|
||||
}
|
||||
else if (u_fl && status.st_mtime <= member.ar_date) {
|
||||
wr_arhdr(fd, member);
|
||||
wr_arhdr(fd, &member);
|
||||
copy_member(&member, ar_fd, fd, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -27,9 +27,6 @@ int AccFileSpecifier = 0; /* return filespecifier <...> */
|
||||
int AccDefined = 0; /* accept "defined(...)" */
|
||||
int UnknownIdIsZero = 0; /* interpret unknown id as integer 0 */
|
||||
|
||||
char *string_token(char *nm, int stop_char);
|
||||
void skipcomment();
|
||||
|
||||
void PushLex()
|
||||
{
|
||||
DOT = 0;
|
||||
@ -43,6 +40,10 @@ int LLlex()
|
||||
return (DOT != EOF) ? GetToken(&dot) : EOF;
|
||||
}
|
||||
|
||||
#ifdef BUFSIZ
|
||||
#undef BUFSIZ
|
||||
#endif
|
||||
|
||||
#define BUFSIZ 1024
|
||||
|
||||
int GetToken(struct token *ptok)
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
*/
|
||||
|
||||
#include <em_arith.h>
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
|
||||
/* the structure of a token: */
|
||||
struct token {
|
||||
@ -42,3 +44,34 @@ extern int err_occurred; /* "error.c" */
|
||||
#define DOT dot.tk_symb
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#include <symbol2str.h>
|
||||
struct idf;
|
||||
struct token;
|
||||
|
||||
char *string_token(char *nm, int stop_char);
|
||||
void skipcomment();
|
||||
int GetToken(struct token *ptok);
|
||||
void fatal(char *fmt, ...);
|
||||
void EnableMacros();
|
||||
int replace(struct idf *idef);
|
||||
void error(char *fmt, ...);
|
||||
int quoted(int c);
|
||||
int val_in_base(int c, int base);
|
||||
void crash(char *fmt, ...);
|
||||
void skipline();
|
||||
void warning(char *fmt, ...);
|
||||
void PushLex();
|
||||
void If_expr(void);
|
||||
void PopLex();
|
||||
void add_dependency(char *s);
|
||||
int skipspaces(int ch, int skipnl);
|
||||
void macro_def(struct idf *id, char *text, int nformals, int length, int flags);
|
||||
void DoUnstack();
|
||||
void init_pp();
|
||||
void do_option(char *text);
|
||||
void preprocess(char *fn);
|
||||
void domacro();
|
||||
|
||||
/* External */
|
||||
int InsertFile(char *, char **, char **);
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
/* EVALUATION OF BINARY OPERATORS */
|
||||
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
#include <em_arith.h>
|
||||
|
||||
|
||||
@ -51,7 +51,6 @@ static void do_undef();
|
||||
static void do_line(unsigned int l);
|
||||
static int getparams(char *buf[], char parbuf[]);
|
||||
static int macroeq(char *s, char *t);
|
||||
void macro_def(struct idf *id, char *text, int nformals, int length, int flags);
|
||||
static char *get_text(char *formals[], int *length);
|
||||
|
||||
/* Externel dependency */
|
||||
@ -84,7 +83,7 @@ char *GetIdentifier()
|
||||
void domacro()
|
||||
{
|
||||
struct token tk; /* the token itself */
|
||||
register struct idf *id;
|
||||
struct idf *id;
|
||||
|
||||
switch(GetToken(&tk)) { /* select control line action */
|
||||
case IDENTIFIER: /* is it a macro keyword? */
|
||||
@ -169,8 +168,8 @@ static void skip_block(int to_endif)
|
||||
#ifndef or #elif until the corresponding #endif is
|
||||
seen.
|
||||
*/
|
||||
register int ch;
|
||||
register int skiplevel = nestlevel; /* current nesting level */
|
||||
int ch;
|
||||
int skiplevel = nestlevel; /* current nesting level */
|
||||
struct token tk;
|
||||
struct idf *id;
|
||||
|
||||
@ -315,7 +314,7 @@ static void do_define()
|
||||
char parbuf[PARBUFSIZE]; /* names of formals */
|
||||
char *repl_text; /* start of the replacement text */
|
||||
int length; /* length of the replacement text */
|
||||
register ch;
|
||||
int ch;
|
||||
|
||||
/* read the #defined macro's name */
|
||||
if (!(str = GetIdentifier())) {
|
||||
@ -403,7 +402,7 @@ static void do_if()
|
||||
|
||||
static void do_ifdef(int how)
|
||||
{
|
||||
register struct idf *id;
|
||||
struct idf *id;
|
||||
char *str;
|
||||
|
||||
/* how == 1 : ifdef; how == 0 : ifndef
|
||||
@ -432,8 +431,8 @@ static void do_ifdef(int how)
|
||||
|
||||
static void do_undef()
|
||||
{
|
||||
register struct idf *id;
|
||||
register char *str = GetIdentifier();
|
||||
struct idf *id;
|
||||
char *str = GetIdentifier();
|
||||
|
||||
/* Forget a macro definition. */
|
||||
if (str) {
|
||||
@ -475,10 +474,10 @@ static int getparams(char *buf[], char parbuf[])
|
||||
Note that the '(' has already been eaten.
|
||||
The names of the formal parameters are stored into parbuf.
|
||||
*/
|
||||
register char **pbuf = &buf[0];
|
||||
register int c;
|
||||
register char *ptr = &parbuf[0];
|
||||
register char **pbuf2;
|
||||
char **pbuf = &buf[0];
|
||||
int c;
|
||||
char *ptr = &parbuf[0];
|
||||
char **pbuf2;
|
||||
|
||||
LoadChar(c);
|
||||
c = skipspaces(c,0);
|
||||
@ -536,7 +535,7 @@ void macro_def(struct idf *id, char *text, int nformals, int length, int flags)
|
||||
table entry belonging to the name of the macro.
|
||||
A warning is given if the definition overwrites another.
|
||||
*/
|
||||
register struct macro *newdef = id->id_macro;
|
||||
struct macro *newdef = id->id_macro;
|
||||
|
||||
if (newdef) { /* is there a redefinition? */
|
||||
if (macroeq(newdef->mc_text, text))
|
||||
@ -545,7 +544,7 @@ void macro_def(struct idf *id, char *text, int nformals, int length, int flags)
|
||||
}
|
||||
else {
|
||||
#ifdef DOBITS
|
||||
register char *p = id->id_text;
|
||||
unsigned char *p = (unsigned char *)id->id_text;
|
||||
#define setbit(bx) if (!*p) goto go_on; bits[*p++] |= (bx)
|
||||
setbit(bit0);
|
||||
setbit(bit1);
|
||||
@ -573,7 +572,7 @@ static int find_name(char *nm, char *index[])
|
||||
"index" if it can be found there. 0 is returned if it is
|
||||
not there.
|
||||
*/
|
||||
register char **ip = &index[0];
|
||||
char **ip = &index[0];
|
||||
|
||||
while (*ip)
|
||||
if (strcmp(nm, *ip++) == 0)
|
||||
@ -599,10 +598,10 @@ static char *get_text(char *formals[], int *length)
|
||||
identifiers, because they might be replaced by some actual
|
||||
parameter. Other tokens will not be seen as such.
|
||||
*/
|
||||
register int c;
|
||||
register unsigned int text_size;
|
||||
int c;
|
||||
unsigned int text_size;
|
||||
char *text = Malloc(text_size = ITEXTSIZE);
|
||||
register unsigned int pos = 0;
|
||||
unsigned int pos = 0;
|
||||
|
||||
LoadChar(c);
|
||||
|
||||
@ -639,7 +638,7 @@ static char *get_text(char *formals[], int *length)
|
||||
else
|
||||
if (formals && class(c) == STIDF) {
|
||||
char id_buf[IDFSIZE + 1];
|
||||
register char *idp = id_buf;
|
||||
char *idp = id_buf;
|
||||
int n;
|
||||
|
||||
/* read identifier: it may be a formal parameter */
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
*/
|
||||
/* F I L E I N F O R M A T I O N S T R U C T U R E */
|
||||
|
||||
#ifndef UTIL_CPP_FILE_INFO_H
|
||||
#define UTIL_CPP_FILE_INFO_H
|
||||
|
||||
struct file_info {
|
||||
unsigned int fil_lino;
|
||||
char *fil_name;
|
||||
@ -16,3 +19,5 @@ struct file_info {
|
||||
#define WorkingDir finfo.fil_wdir
|
||||
|
||||
extern struct file_info finfo; /* input.c */
|
||||
|
||||
#endif /* UTIL_CPP_FILE_INFO_H */
|
||||
@ -8,6 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <system.h>
|
||||
#include <alloc.h>
|
||||
#include "LLlex.h"
|
||||
#include "class.h"
|
||||
#include "macro.h"
|
||||
#include "idf.h"
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "LLlex.h"
|
||||
#include "file_info.h"
|
||||
#include "input.h"
|
||||
#define INP_TYPE struct file_info
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <em_arith.h>
|
||||
#include <assert.h>
|
||||
#include <system.h>
|
||||
#include "LLlex.h"
|
||||
#include "file_info.h"
|
||||
#include "idfsize.h"
|
||||
#include "idf.h"
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <alloc.h>
|
||||
#include "LLlex.h"
|
||||
#include "idfsize.h"
|
||||
#include "class.h"
|
||||
#include "macro.h"
|
||||
@ -29,7 +30,7 @@ void do_option(char *text)
|
||||
{
|
||||
switch(*text++) {
|
||||
case '-':
|
||||
options[*text] = 1;
|
||||
options[*(unsigned char *)text] = 1;
|
||||
break;
|
||||
case 'u':
|
||||
if (! strcmp(text,"ndef")) {
|
||||
@ -42,7 +43,7 @@ void do_option(char *text)
|
||||
break;
|
||||
case 'C' : /* comment output */
|
||||
case 'P' : /* run preprocessor stand-alone, without #'s */
|
||||
options[*(text-1)] = 1;
|
||||
options[*(unsigned char *)(text-1)] = 1;
|
||||
break;
|
||||
case 'A' : /* for Amake */
|
||||
case 'd' : /* dependency generation */
|
||||
@ -56,7 +57,7 @@ void do_option(char *text)
|
||||
break;
|
||||
case 'm':
|
||||
case 'i':
|
||||
options[*(text-1)] = 1;
|
||||
options[*(unsigned char *)(text-1)] = 1;
|
||||
break;
|
||||
|
||||
case 'D' : /* -Dname : predefine name */
|
||||
|
||||
@ -27,12 +27,11 @@ void Xflush()
|
||||
if (do_preprocess) sys_write(STDOUT, _obuf, OBUFSIZE);
|
||||
}
|
||||
|
||||
void preprocess(fn)
|
||||
char *fn;
|
||||
void preprocess(char *fn)
|
||||
{
|
||||
register int c;
|
||||
register char *op = _obuf;
|
||||
register char *ob = &_obuf[OBUFSIZE];
|
||||
int c;
|
||||
char *op = _obuf;
|
||||
char *ob = &_obuf[OBUFSIZE];
|
||||
char Xbuf[256];
|
||||
int lineno = 0;
|
||||
extern char options[];
|
||||
@ -45,7 +44,7 @@ void preprocess(fn)
|
||||
/* Generate a line directive communicating the
|
||||
source filename
|
||||
*/
|
||||
register char *p = Xbuf;
|
||||
char *p = Xbuf;
|
||||
|
||||
sprint(p, "%s 1 \"%s\"\n",
|
||||
LINE_PREFIX,
|
||||
@ -68,7 +67,7 @@ void preprocess(fn)
|
||||
fn = FileName;
|
||||
lineno = LineNumber;
|
||||
if (! options['P']) {
|
||||
register char *p = Xbuf;
|
||||
char *p = Xbuf;
|
||||
|
||||
sprint(p, "%s %d \"%s\"\n",
|
||||
LINE_PREFIX,
|
||||
@ -140,7 +139,7 @@ void preprocess(fn)
|
||||
break;
|
||||
case STSTR:
|
||||
case STCHAR: {
|
||||
register int stopc = c;
|
||||
int stopc = c;
|
||||
int escaped;
|
||||
|
||||
do {
|
||||
@ -199,9 +198,9 @@ void preprocess(fn)
|
||||
case STIDF: {
|
||||
extern int idfsize; /* ??? */
|
||||
char buf[IDFSIZE + 1];
|
||||
register char *tg = &buf[0];
|
||||
register char *maxpos = &buf[idfsize];
|
||||
register struct idf *idef;
|
||||
char *tg = &buf[0];
|
||||
char *maxpos = &buf[idfsize];
|
||||
struct idf *idef;
|
||||
|
||||
#define tstmac(bx) if (!(bits[c] & bx)) goto nomac
|
||||
#define cpy if (Unstacked) EnableMacros(); *tg++ = c
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
#include "interface.h"
|
||||
#include "file_info.h"
|
||||
|
||||
#include "LLlex.h"
|
||||
|
||||
#define EOS '\0'
|
||||
#define overflow() (fatal("actual parameter buffer overflow"))
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ static char rcsid[] = "$Id$";
|
||||
#define IND_DBUG(x) (IND_RELO(x) + sizeof(ind_t))
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
extern char *core_alloc();
|
||||
extern bool incore;
|
||||
extern int infile;
|
||||
extern int passnumber;
|
||||
@ -66,12 +65,10 @@ static void read_modul();
|
||||
*/
|
||||
int getfile(char *filename)
|
||||
{
|
||||
unsigned int rd_unsigned2();
|
||||
struct ar_hdr archive_header;
|
||||
unsigned short magic_number;
|
||||
#ifdef SYMDBUG
|
||||
struct stat statbuf;
|
||||
extern int fstat();
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
archname = (char *)0;
|
||||
@ -189,7 +186,6 @@ static void scan_modul()
|
||||
static bool all_alloc()
|
||||
{
|
||||
struct outhead head;
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
if (hard_alloc(ALLOMODL, (long)sizeof(struct outhead)) == BADOFF)
|
||||
fatal("no space for module header");
|
||||
@ -212,8 +208,6 @@ static bool direct_alloc(struct outhead *head)
|
||||
struct outsect *sects;
|
||||
unsigned short nsect = head->oh_nsect;
|
||||
long size, rest;
|
||||
extern ind_t hard_alloc();
|
||||
extern ind_t alloc();
|
||||
|
||||
#ifdef SYMDBUG
|
||||
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
|
||||
@ -282,7 +276,6 @@ static bool putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
|
||||
{
|
||||
long flen;
|
||||
ind_t emitindex;
|
||||
extern ind_t alloc();
|
||||
static long zeros[MAXSECT];
|
||||
long zero = zeros[allopiece - ALLOEMIT];
|
||||
|
||||
@ -320,7 +313,6 @@ static bool putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
|
||||
static bool putreloindex(ind_t relooff, long nrelobytes)
|
||||
{
|
||||
ind_t reloindex;
|
||||
extern ind_t alloc();
|
||||
|
||||
if ((reloindex = alloc(ALLORELO, nrelobytes)) != BADOFF) {
|
||||
*(ind_t *)modulptr(relooff) = reloindex;
|
||||
@ -335,7 +327,6 @@ static bool putreloindex(ind_t relooff, long nrelobytes)
|
||||
static bool putdbugindex(ind_t dbugoff, long ndbugbytes)
|
||||
{
|
||||
ind_t dbugindex;
|
||||
extern ind_t alloc();
|
||||
|
||||
if ((dbugindex = alloc(ALLODBUG, ndbugbytes)) != BADOFF) {
|
||||
*(ind_t *)modulptr(dbugoff) = dbugindex;
|
||||
@ -410,7 +401,6 @@ static void read_modul()
|
||||
unsigned short nsect, nname;
|
||||
long size;
|
||||
long nchar;
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
assert(passnumber == SECOND);
|
||||
assert(!incore);
|
||||
@ -536,7 +526,6 @@ char *getemit(struct outhead *head, struct outsect *sects, int sectindex)
|
||||
{
|
||||
char *ret;
|
||||
ind_t off;
|
||||
extern char *core_alloc();
|
||||
|
||||
if (!incore) {
|
||||
ret = core_alloc(ALLOMODL, sects[sectindex].os_flen);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user