ftp.nice.ch/pub/next/developer/languages/lisp/AKCL.1.599.s.tar.gz#/akcl-1-599/V/c/bind.c

This is bind.c in view mode; [Download] [Up]

Changes file for /usr/local/src/kcl/c/bind.c
Created on Mon Apr 29 20:47:09 1991
Usage \n@s[Original text\n@s|Replacement Text\n@s]
See the file rascal.ics.utexas.edu:/usr2/ftp/merge.c
for a program to merge change files.  Anything not between
"\n@s[" and  "\n@s]" is a simply a comment.
This file was constructed using emacs and  merge.el
Enhancements Copyright (c) W. Schelter All rights reserved.
   by (Bill Schelter)  wfs@carl.ma.utexas.edu 


****Change:(orig (11 11 a))
@s[*/

#include "include.h"

@s|*/

#include "include.h"
#include "varargs.h"

@s]


****Change:(orig (51 55 d))
@s[object ANDoptional;
object ANDrest;
object ANDkey;
object ANDallow_other_keys;

@s,object ANDaux;

@s|
@s]


****Change:(orig (57 57 d))
@s[object Kallow_other_keys;

@s|
@s]


****Change:(orig (689 691 d))
@s[#ifdef AV
#define	key(i)		ktab[i]
#endif

@s|
@s]


****Change:(orig (700 700 c))
@s[parse_key(base, rest, allow_other_keys, n, first_key)

@s|parse_key(base, rest, allow_other_keys, n, va_alist)

@s]


****Change:(orig (704 706 c))
@s[object first_key;
{
	object *ktab = &first_key;

@s|va_dcl
{       va_list ap;

@s]


****Change:(orig (737 737 a))
@s[		top = base + n;
		other_key = k;

@s|		top = base + n;
		other_key = k;
		va_start(ap);

@s]


****Change:(orig (739 739 c))
@s[		for (i = 0;  i < n;  i++) {
			if (key(i) == k) {

@s|		for (i = 0;  i < n;  i++) {
		    
			if (va_arg(ap,object) == k) {

@s]


****Change:(orig (747 747 a))
@s[				top[i] = Cnil;
			}
		}

@s|				top[i] = Cnil;
			}
		}
		va_end(ap);

@s]


****Change:(orig (755 755 a))
@s[			FEerror("The keyword ~S is not allowed.",1,other_key);
		return;
	}

@s|			FEerror("The keyword ~S is not allowed.",1,other_key);
		return;
	}
	va_start(ap);

@s]


****Change:(orig (757 757 c))
@s[	for (i = 0;  i < n;  i++) {
		k = key(i);

@s|	for (i = 0;  i < n;  i++) {
		k = va_arg(ap,object);

@s]


****Change:(orig (760 760 a))
@s[		k->s.s_dbind = Cnil;
	}

@s|		k->s.s_dbind = Cnil;
	}
	va_end(ap);

@s]


****Change:(orig (786 786 a))
@s[		vs_top = top;
	}
	top = base + n;

@s|		vs_top = top;
	}
	top = base + n;
	va_start(ap);

@s]


****Change:(orig (788 788 c))
@s[	for (i = 0;  i < n;  i++) {
		k = key(i);

@s|	for (i = 0;  i < n;  i++) {
		k = va_arg(ap,object);

@s]


****Change:(orig (793 793 a))
@s[		k->s.s_stype = (short)stp_constant;
	}

@s|		k->s.s_stype = (short)stp_constant;
	}
	va_end(ap);

@s]


****Change:(orig (800 800 c))
@s[check_other_key(l, n, first_key)

@s|check_other_key(l, n, va_alist)

@s]


****Change:(orig (803 803 c))
@s[int n;
object first_key;

@s|int n;
va_dcl

@s]


****Change:(orig (805 805 c))
@s[	object *ktab = &first_key;

@s|	va_list ap;

@s]


****Change:(orig (819 819 c))
@s[			allow_other_keys = TRUE;
		} else {

@s|			allow_other_keys = TRUE;
		} else {register object *loc;
			char buf [100];
			bzero(buf,n);
			va_start(ap);

@s]


****Change:(orig (821 821 c))
@s[				if (key(i) == k) {key(i) = Cnil; break;}

@s|			  { if (va_arg(ap,object) == k &&
				buf[i] ==0) {buf[i]=1; break;}}
			va_end(ap);

@s]


****Change:(orig (828 828 a))
@s[		FEerror("The keyword ~S is not allowed or is duplicated.",
			1, other_key);
}

@s|		FEerror("The keyword ~S is not allowed or is duplicated.",
			1, other_key);
}


struct key {short n,allow_other_keys;
	    iobject *defaults;
	    iobject keys[1];
	   };


object Cstd_key_defaults[15]={Cnil,Cnil,Cnil,Cnil,Cnil,Cnil,Cnil,
				Cnil,Cnil,Cnil,Cnil,Cnil,Cnil,Cnil,Cnil};

parse_key_new(n,base,keys,ap)
     int n;
     object *base;
     struct key *keys;
     va_list ap;
{object *new;
 COERCE_VA_LIST(new,ap,n);

 /* from here down identical to parse_key_rest */
 new = new + n ;
  {int j=keys->n;
   object *p= (object *)(keys->defaults);
   while (--j >=0) base[j]=p[j];
 }
 {if (n==0){ return;}
 {int allow = keys->allow_other_keys;
  object k;
 top:
  while (n>=2)
    {int i= keys->n;
     iobject *ke=keys->keys ;
     new = new -2;
     k = *new;
     while(--i >= 0)
       {if ((*(ke++)).o == k)
	  {base[i]= new[1];
	   n=n-2;
	   goto top;
	 }}
     /* the key is a new one */
     if (allow  )
       {
	 n=n-2;
      }
     else
       {int m = n -2;
	object *p = new;
	while (m >= 0)
	  {if (*p == Kallow_other_keys)
	     { allow = (p[1] !=Cnil) ; break;}
	   p -= 2;
	   m -= 2;}
	if (allow) n = n -2 ; else goto error;}
   }
  if (n!=0) FEerror("Odd number of keys");
  return 0;
 error:
  FEerror("Unrecognized key ~a",1,k);
}}}

parse_key_rest(rest,n,base,keys,ap)
     int n;
     object *base;
     struct key *keys;
     va_list ap;
     object rest;
{object *new;
 COERCE_VA_LIST(new,ap,n);

 /* copy the rest arg */
 {object *p = new;
  int m = n;
  while (--m >= 0)
    {rest->c.c_car = *p++;
     rest = rest->c.c_cdr;}}
    
 new = new + n ;
  {int j=keys->n;
   object *p= (object *)(keys->defaults);
   while (--j >=0) base[j]=p[j];
 }
 {if (n==0){ return;}
 {int allow = keys->allow_other_keys;
  object k;
 top:
  while (n>=2)
    {int i= keys->n;
     iobject *ke=keys->keys ;
     new = new -2;
     k = *new;
     while(--i >= 0)
       {if ((*(ke++)).o == k)
	  {base[i]= new[1];
	   n=n-2;
	   goto top;
	 }}
     /* the key is a new one */
     if (allow)
       {
	 n=n-2;
      }
     else
       {int m = n -2;
	object *p = new;
	while (m >= 0)
	  {if (*p == Kallow_other_keys)
	     { allow = (p[1] !=Cnil) ; break;}
	   p -= 2;
	   m -= 2;}
	if (allow) n = n -2 ; else goto error;}

   }
  if (n!=0) FEerror("Odd number of keys");
  return 0;
 error:
  FEerror("Unrecognized key ~a",1,k);
}}}

  
set_key_struct(ks,data)
     object data;
     struct key *ks;
{int i=ks->n;
 while (--i >=0)
   {ks->keys[i].o =   data->cfd.cfd_self[ ks->keys[i].i ];
    if (ks->defaults != (iobject *)Cstd_key_defaults)
     {int m=ks->defaults[i].i;
        ks->defaults[i].o=
	  (m==-2 ? Cnil :
	   m==-1 ? (object)0 :
	   data->cfd.cfd_self[m]);}
}}


@s]

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.