many minor mods: name changes

This commit is contained in:
ceriel 1988-03-23 17:55:57 +00:00
parent 7f9fd963fd
commit 36e934583a
17 changed files with 111 additions and 101 deletions

View file

@ -9,9 +9,9 @@
Version: $Header$ Version: $Header$
*/ */
extern char **_argv, **_environ; extern char **argv, **environ;
extern int _argc; extern int argc;
unsigned int Arguments_Argc; unsigned int _Arguments__Argc;
static char * static char *
findname(s1, s2) findname(s1, s2)
@ -42,27 +42,27 @@ scopy(src, dst, max)
return i + 1; return i + 1;
} }
Arguments() _Arguments_()
{ {
Arguments_Argc = _argc; _Arguments__Argc = argc;
} }
unsigned unsigned
_Arguments_Argv(n, argument, l, u, s) _Arguments__Argv(n, argument, l, u, s)
unsigned int u; unsigned int u;
char *argument; char *argument;
{ {
if (n >= _argc) return 0; if (n >= argc) return 0;
return scopy(_argv[n], argument, u); return scopy(argv[n], argument, u);
} }
unsigned unsigned
_Arguments_GetEnv(name, nn, nu, ns, value, l, u, s) _Arguments__GetEnv(name, nn, nu, ns, value, l, u, s)
char *name, *value; char *name, *value;
unsigned int nu, u; unsigned int nu, u;
{ {
register char **p = _environ; register char **p = environ;
register char *v = 0; register char *v = 0;
while (*p && !(v = findname(name, *p++))) { while (*p && !(v = findname(name, *p++))) {

View file

@ -74,14 +74,14 @@
; - procedure instance identifier (PROC) ; - procedure instance identifier (PROC)
; and returns the old traphandler. ; and returns the old traphandler.
exa _handler exa handler
exp $SIG exp $SIG
pro $SIG, 0 pro $SIG, 0
lae _handler lae handler
loi EM_PSIZE loi EM_PSIZE
lal PROC lal PROC
loi EM_PSIZE loi EM_PSIZE
lae _handler lae handler
sti EM_PSIZE sti EM_PSIZE
ret EM_PSIZE ret EM_PSIZE
end ? end ?

View file

@ -10,7 +10,7 @@
; ;
mes 2,EM_WSIZE,EM_PSIZE mes 2,EM_WSIZE,EM_PSIZE
; _LtoUset is called for set displays containing { expr1 .. expr2 }. ; LtoUset is called for set displays containing { expr1 .. expr2 }.
; It has six parameters, of which the caller must pop five: ; It has six parameters, of which the caller must pop five:
; - The set in which bits must be set. ; - The set in which bits must be set.
; - the lower bound of the set type. ; - the lower bound of the set type.
@ -25,8 +25,8 @@
#define USETSIZ 2*EM_WSIZE #define USETSIZ 2*EM_WSIZE
#define LWB EM_WSIZE #define LWB EM_WSIZE
#define UPB 0 #define UPB 0
exp $_LtoUset exp $LtoUset
pro $_LtoUset,0 pro $LtoUset,0
lal SETBASE ; address of initial set lal SETBASE ; address of initial set
lol SETSIZE lol SETSIZE
los EM_WSIZE ; load initial set los EM_WSIZE ; load initial set

View file

@ -9,7 +9,7 @@
Author: Ceriel J.H. Jacobs Author: Ceriel J.H. Jacobs
Version: $Header$ Version: $Header$
*/ */
_StringAssign(dstsiz, srcsiz, dstaddr, srcaddr) StringAssign(dstsiz, srcsiz, dstaddr, srcaddr)
register char *dstaddr, *srcaddr; register char *dstaddr, *srcaddr;
{ {
while (srcsiz > 0) { while (srcsiz > 0) {

View file

@ -10,7 +10,7 @@
*/ */
#ifndef NOFLOAT #ifndef NOFLOAT
double double
_absd(i) absd(i)
double i; double i;
{ {
return i >= 0 ? i : -i; return i >= 0 ? i : -i;

View file

@ -9,8 +9,8 @@
; Version: $Header$ ; Version: $Header$
; ;
mes 2,EM_WSIZE,EM_PSIZE mes 2,EM_WSIZE,EM_PSIZE
exp $_absf exp $absf
pro $_absf,0 pro $absf,0
mes 5 mes 5
mes 9,8 mes 9,8
lal 0 lal 0

View file

@ -9,7 +9,7 @@
Version: $Header$ Version: $Header$
*/ */
_absi(i) absi(i)
{ {
return i >= 0 ? i : -i; return i >= 0 ? i : -i;
} }

View file

@ -9,7 +9,7 @@
Version: $Header$ Version: $Header$
*/ */
long long
_absl(i) absl(i)
long i; long i;
{ {
return i >= 0 ? i : -i; return i >= 0 ? i : -i;

View file

@ -15,7 +15,7 @@ typedef unsigned pcnt;
typedef unsigned long pcnt; typedef unsigned long pcnt;
#endif #endif
_blockmove(siz, dst, src) blockmove(siz, dst, src)
pcnt siz; pcnt siz;
register char *dst, *src; register char *dst, *src;
{ {

View file

@ -52,7 +52,7 @@ static struct errm {
extern exit(); extern exit();
_catch(trapno) catch(trapno)
int trapno; int trapno;
{ {
register struct errm *ep = &errors[0]; register struct errm *ep = &errors[0];
@ -64,7 +64,7 @@ _catch(trapno)
while (ep->errno != trapno && ep->errmes != 0) ep++; while (ep->errno != trapno && ep->errmes != 0) ep++;
if (p = ep->errmes) { if (p = ep->errmes) {
while (*p) p++; while (*p) p++;
_Traps_Message(ep->errmes, 0, (int) (p - ep->errmes), 1); _Traps__Message(ep->errmes, 0, (int) (p - ep->errmes), 1);
} }
else { else {
int i = trapno; int i = trapno;
@ -81,8 +81,8 @@ _catch(trapno)
while (i /= 10); while (i /= 10);
while (s > buf) *p++ = *--s; while (s > buf) *p++ = *--s;
*p = 0; *p = 0;
_Traps_Message(q, 0, (int) (p - q), 1); _Traps__Message(q, 0, (int) (p - q), 1);
} }
if (trapno != M2_FORCH) exit(trapno); if (trapno != M2_FORCH) exit(trapno);
SIG(_catch); SIG(catch);
} }

View file

@ -27,7 +27,7 @@ static struct descr *descrs[10];
static struct descr **ppdescr = descrs; static struct descr **ppdescr = descrs;
char * char *
_new_stackptr(pdescr, a) new_stackptr(pdescr, a)
register struct descr *pdescr; register struct descr *pdescr;
{ {
pcnt size = (((pdescr->highminlow + 1) * pdescr->size + pcnt size = (((pdescr->highminlow + 1) * pdescr->size +
@ -45,7 +45,7 @@ _new_stackptr(pdescr, a)
else return (char *) &a + size; else return (char *) &a + size;
} }
_copy_array(p, a) copy_array(p, a)
register char *p; register char *p;
{ {
register char *q; register char *q;

View file

@ -34,7 +34,7 @@ CallAtEnd(p)
return 1; return 1;
} }
_halt() halt()
{ {
exit(0); exit(0);
} }

View file

@ -13,35 +13,35 @@
#define STACKSIZE 2048 /* maximum stack size for a coroutine */ #define STACKSIZE 2048 /* maximum stack size for a coroutine */
exa _handler exa handler
exa _environ exa environ
exa _argv exa argv
exa _argc exa argc
exa _CurrentProcess exa CurrentProcess
exa _MainProcess exa MainProcess
exa _StackBase exa StackBase
exa _MainLB exa MainLB
exa _StackSize exa StackSize
exp $_catch exp $catch
inp $trap_handler inp $trap_handler
_handler handler
con $_catch con $catch
_environ environ
bss EM_PSIZE,0,0 bss EM_PSIZE,0,0
_argv argv
bss EM_PSIZE,0,0 bss EM_PSIZE,0,0
_argc argc
bss EM_WSIZE,0,0 bss EM_WSIZE,0,0
_CurrentProcess CurrentProcess
bss EM_PSIZE,0,0 bss EM_PSIZE,0,0
_MainProcess MainProcess
bss EM_PSIZE,0,0 bss EM_PSIZE,0,0
_StackBase StackBase
bss EM_PSIZE,0,0 bss EM_PSIZE,0,0
_MainLB MainLB
bss EM_PSIZE,0,0 bss EM_PSIZE,0,0
_StackSize StackSize
bss EM_WSIZE,0,0 bss EM_WSIZE,0,0
mainroutine mainroutine
bss 2*EM_PSIZE,0,0 bss 2*EM_PSIZE,0,0
@ -50,50 +50,50 @@ mainroutine
pro $m_a_i_n, STACKSIZE pro $m_a_i_n, STACKSIZE
loc STACKSIZE loc STACKSIZE
ste _StackSize ste StackSize
lor 0 lor 0
lae _MainLB lae MainLB
sti EM_PSIZE sti EM_PSIZE
lal -EM_WSIZE lal -EM_WSIZE
adp EM_WSIZE adp EM_WSIZE
lae _StackBase lae StackBase
sti EM_PSIZE sti EM_PSIZE
lae mainroutine lae mainroutine
adp 2*EM_PSIZE adp 2*EM_PSIZE
dup EM_PSIZE dup EM_PSIZE
lae _CurrentProcess lae CurrentProcess
sti EM_PSIZE sti EM_PSIZE
lae _MainProcess lae MainProcess
sti EM_PSIZE sti EM_PSIZE
lal EM_WSIZE+EM_PSIZE lal EM_WSIZE+EM_PSIZE
loi EM_PSIZE loi EM_PSIZE
lae _environ ; save environment pointer lae environ ; save environment pointer
sti EM_PSIZE sti EM_PSIZE
lal EM_WSIZE lal EM_WSIZE
loi EM_PSIZE loi EM_PSIZE
lae _argv ; save argument pointer lae argv ; save argument pointer
sti EM_PSIZE sti EM_PSIZE
lol 0 lol 0
ste _argc ; save argument count ste argc ; save argument count
lpi $trap_handler lpi $trap_handler
sig sig
asp EM_PSIZE asp EM_PSIZE
cal $_M2M cal $__M2M_
cal $_halt cal $halt
loc 0 ; should not get here loc 0 ; should not get here
ret EM_WSIZE ret EM_WSIZE
end end
pro $trap_handler,0 pro $trap_handler,0
lol 0 ; trap number lol 0 ; trap number
lae _handler lae handler
loi EM_PSIZE loi EM_PSIZE
cai cai
lpi $trap_handler lpi $trap_handler

View file

@ -17,7 +17,7 @@ typedef unsigned pcnt;
typedef long pcnt; typedef long pcnt;
#endif #endif
_load(siz, addr, p) load(siz, addr, p)
register char *addr; register char *addr;
register pcnt siz; register pcnt siz;
{ {

View file

@ -8,10 +8,20 @@
Author: Ceriel J.H. Jacobs Author: Ceriel J.H. Jacobs
Version: $Header$ Version: $Header$
*/ */
_stackprio(n)
static unsigned prio;
stackprio(n)
unsigned n;
{ {
unsigned old = prio;
if (n > prio) prio = n;
return old;
} }
_unstackprio() unstackprio(n)
unsigned n;
{ {
prio = n;
} }

View file

@ -17,7 +17,7 @@ typedef unsigned pcnt;
typedef long pcnt; typedef long pcnt;
#endif #endif
_store(siz, addr, p) store(siz, addr, p)
register char *addr; register char *addr;
register pcnt siz; register pcnt siz;
{ {

View file

@ -57,18 +57,18 @@
; place in the stack. Therefore, in the runtime startoff a piece of the ; place in the stack. Therefore, in the runtime startoff a piece of the
; stack is allocated for coroutines. ; stack is allocated for coroutines.
exp $_SYSTEM_NEWPROCESS exp $_SYSTEM__NEWPROCESS
exp $_SYSTEM_TRANSFER exp $_SYSTEM__TRANSFER
inp $_ChkSize inp $ChkSize
pro $_SYSTEM_NEWPROCESS, 0 pro $_SYSTEM__NEWPROCESS, 0
; This procedure only initializes the area used for saving the stack. ; This procedure only initializes the area used for saving the stack.
; Its definition is: ; Its definition is:
; PROCEDURE NEWPROCESS(P:PROC; A:ADDRESS; n:CARDINAL; VAR p1:ADDRESS); ; PROCEDURE NEWPROCESS(P:PROC; A:ADDRESS; n:CARDINAL; VAR p1:ADDRESS);
lol 2*EM_PSIZE ; size of frame (n) lol 2*EM_PSIZE ; size of frame (n)
cal $_ChkSize cal $ChkSize
asp EM_WSIZE asp EM_WSIZE
lfr EM_WSIZE lfr EM_WSIZE
sil EM_PSIZE ; store size in area (indicated by A) sil EM_PSIZE ; store size in area (indicated by A)
@ -89,10 +89,10 @@
ret 0 ret 0
end 0 end 0
_target target
bss EM_PSIZE, 0, 0 bss EM_PSIZE, 0, 0
pro $_SYSTEM_TRANSFER, 0 pro $_SYSTEM__TRANSFER, 0
; This procedure does all the hard work. ; This procedure does all the hard work.
; It must save the current environment, and restore the one to which the ; It must save the current environment, and restore the one to which the
@ -107,7 +107,7 @@ _target
loi EM_PSIZE loi EM_PSIZE
loi EM_PSIZE ; address of target coroutine loi EM_PSIZE ; address of target coroutine
dup EM_PSIZE dup EM_PSIZE
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE loi EM_PSIZE
dup EM_PSIZE dup EM_PSIZE
lal 0 lal 0
@ -119,69 +119,69 @@ _target
asp EM_PSIZE asp EM_PSIZE
ret 0 ; just return ret 0 ; just return
1 1
lae _target lae target
sti EM_PSIZE ; store it in _target sti EM_PSIZE ; store it in target
; Now, we save the current stack ; Now, we save the current stack
; Use local base from main program ; Use local base from main program
lor 0 ; load LB lor 0 ; load LB
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE loi EM_PSIZE
adp -2*EM_PSIZE adp -2*EM_PSIZE
sti EM_PSIZE ; save it sti EM_PSIZE ; save it
lor 1 ; load SP lor 1 ; load SP
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE loi EM_PSIZE
adp -EM_PSIZE adp -EM_PSIZE
sti EM_PSIZE ; save it sti EM_PSIZE ; save it
; Now, we must find a stack we can temporarily use. ; Now, we must find a stack we can temporarily use.
; Just take the one from the main program. ; Just take the one from the main program.
lae _MainProcess lae MainProcess
loi EM_PSIZE loi EM_PSIZE
adp -EM_PSIZE adp -EM_PSIZE
loi EM_PSIZE loi EM_PSIZE
str 1 ; temporary stackpointer str 1 ; temporary stackpointer
lae _MainLB lae MainLB
loi EM_PSIZE loi EM_PSIZE
str 0 str 0
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE loi EM_PSIZE
lae _MainProcess lae MainProcess
loi EM_PSIZE loi EM_PSIZE
cmp cmp
zeq *2 zeq *2
lae _StackBase lae StackBase
loi EM_PSIZE loi EM_PSIZE
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE-EM_WSIZE adp -3*EM_PSIZE-EM_WSIZE
loi EM_WSIZE ; get size loi EM_WSIZE ; get size
ngi EM_WSIZE ngi EM_WSIZE
ads EM_WSIZE ; gives source address ads EM_WSIZE ; gives source address
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE ; destination address loi EM_PSIZE ; destination address
lae _CurrentProcess lae CurrentProcess
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE-EM_WSIZE adp -3*EM_PSIZE-EM_WSIZE
loi EM_WSIZE loi EM_WSIZE
bls EM_WSIZE ; copy bls EM_WSIZE ; copy
2 2
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
dup EM_PSIZE dup EM_PSIZE
lae _CurrentProcess lae CurrentProcess
sti EM_PSIZE ; store target process descriptor in _CurrentProcess sti EM_PSIZE ; store target process descriptor in _CurrentProcess
lae _MainProcess lae MainProcess
loi EM_PSIZE loi EM_PSIZE
cmp cmp
zeq *4 zeq *4
; Now check if the coroutine was called before ; Now check if the coroutine was called before
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE adp -3*EM_PSIZE
loi EM_PSIZE loi EM_PSIZE
@ -189,45 +189,45 @@ _target
cmp cmp
zeq *5 zeq *5
; No, it was'nt ; No, it was'nt
lae _StackBase lae StackBase
loi EM_PSIZE loi EM_PSIZE
str 1 ; new stack pointer str 1 ; new stack pointer
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE adp -3*EM_PSIZE
loi EM_PSIZE loi EM_PSIZE
zer EM_PSIZE zer EM_PSIZE
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE adp -3*EM_PSIZE
sti EM_PSIZE sti EM_PSIZE
cai cai
loc 0 loc 0
cal $_exit cal $exit
ret 0 ret 0
5 5
lae _target lae target
loi EM_PSIZE ; push source address loi EM_PSIZE ; push source address
lae _StackBase lae StackBase
loi EM_PSIZE ; subtract size from this and we have the destination address loi EM_PSIZE ; subtract size from this and we have the destination address
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE-EM_WSIZE adp -3*EM_PSIZE-EM_WSIZE
loi EM_WSIZE loi EM_WSIZE
ngi EM_WSIZE ngi EM_WSIZE
ads EM_WSIZE ; got it ads EM_WSIZE ; got it
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -3*EM_PSIZE-EM_WSIZE adp -3*EM_PSIZE-EM_WSIZE
loi EM_WSIZE loi EM_WSIZE
bls EM_WSIZE bls EM_WSIZE
4 4
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -2*EM_PSIZE adp -2*EM_PSIZE
loi EM_PSIZE loi EM_PSIZE
str 0 ; restore LB str 0 ; restore LB
lae _target lae target
loi EM_PSIZE loi EM_PSIZE
adp -EM_PSIZE adp -EM_PSIZE
loi EM_PSIZE loi EM_PSIZE
@ -235,13 +235,13 @@ _target
ret 0 ret 0
end 0 end 0
pro $_ChkSize, 0 pro $ChkSize, 0
lol 0 lol 0
loc 3*EM_PSIZE+EM_WSIZE loc 3*EM_PSIZE+EM_WSIZE
sbi EM_WSIZE sbi EM_WSIZE
dup EM_WSIZE dup EM_WSIZE
stl 0 stl 0
loe _StackSize loe StackSize
cmu EM_WSIZE cmu EM_WSIZE
zle *1 zle *1
loc M2_TOOLARGE ; trap number for "stack size too large" loc M2_TOOLARGE ; trap number for "stack size too large"