🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.sources.bugs
Article #895

mod.sources Volume 7, Issue 73 (BASIC)

#895
From: Stan Barber
Date: Thu, 15 Jan 1987 17:22
116 lines
3258 bytes
There was a basic interpreter posted in Mod.sources in late November/early December.
It was great, but there was a problem (on my compiler at least) with bas3.c.
The problem was due to a typedef called "value" and a structure member called "value".
I altered the latter to "valuename" and all was happy.
Here is the diff!

*** bas3.c.BAK	Wed Dec 17 17:01:54 1986
--- bas3.c	Thu Jan 15 11:14:41 1987
***************
*** 36,42
  struct  m {
  	value   r1;
  	int     lastop;
! 	char    value;
  	char    vty;
  	};
  

--- 36,42 -----
  struct  m {
  	value   r1;
  	int     lastop;
! 	char    valuename;
  	char    vty;
  	};
  
***************
*** 63,69
  
  	checksp();
  	j=restab;
! 	j->value=0;
  
  for(;;){
  	c=getch();

--- 63,69 -----
  
  	checksp();
  	j=restab;
! 	j->valuename=0;
  
  for(;;){
  	c=getch();
***************
*** 160,166
  	}
  	if(i>2)
  		firsttime = 0;
! ame:    if(j->value< (char)i){          /* current operator has higher */
  		(++j)->lastop=c;                        /* precedence */
  #ifndef V6C
  		j->r1 = res;

--- 160,166 -----
  	}
  	if(i>2)
  		firsttime = 0;
! ame:    if(j->valuename< (char)i){          /* current operator has higher */
  		(++j)->lastop=c;                        /* precedence */
  #ifndef V6C
  		j->r1 = res;
***************
*** 167,173
  #else
  		push(&j->r1);  /* block moving */
  #endif
! 		j->value=i;
  		j->vty=vartype;
  		continue;
  	}

--- 167,173 -----
  #else
  		push(&j->r1);  /* block moving */
  #endif
! 		j->valuename=i;
  		j->vty=vartype;
  		continue;
  	}
***************
*** 171,177
  		j->vty=vartype;
  		continue;
  	}
! 	if(! j->value ){                /* end of expression */
  		point--;
  		return;
  	}

--- 171,177 -----
  		j->vty=vartype;
  		continue;
  	}
! 	if(! j->valuename ){                /* end of expression */
  		point--;
  		return;
  	}
***************
*** 182,188
  			cvt(&j->r1);    /* if changed then they must be */
  		vartype=0;              /* changed to reals */
  	}
! 	(*mbin[(j->value<<1)+vartype])(&j->r1,&res,j->lastop);
  	j--;                    /* execute it then pop the stack and */
  	goto ame;               /* deal with the next operator */
  	}

--- 182,188 -----
  			cvt(&j->r1);    /* if changed then they must be */
  		vartype=0;              /* changed to reals */
  	}
! 	(*mbin[(j->valuename<<1)+vartype])(&j->r1,&res,j->lastop);
  	j--;                    /* execute it then pop the stack and */
  	goto ame;               /* deal with the next operator */
  	}
Technical Details
Message-ID: <2779@soma.bcm.tmc.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!cbatt!cbosgd!soma!sob

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!cbatt!cbosgd!soma!sob
From: sob@soma.bcm.tmc.edu (Stan Barber)
Newsgroups: net.sources.bugs,comp.bugs.misc
Subject: mod.sources Volume 7, Issue 73 (BASIC)
Message-ID: <2779@soma.bcm.tmc.edu>
Date: Thu, 15-Jan-87 12:22:03 EST
Article-I.D.: soma.2779
Posted: Thu Jan 15 12:22:03 1987
Date-Received: Fri, 16-Jan-87 02:20:53 EST
Reply-To: sob@soma.UUCP (Stan Barber)
Distribution: world
Organization: Neurology, Baylor College of Medicine, Houston, Tx
Lines: 116
Keywords: BASIC mod.sources BUGS Masscomp FIX