delorie.com/archives/browse.cgi | search |
Message-ID: | <378182F5.AF4797B3@unb.ca> |
From: | Endlisnis <s257m AT unb DOT ca> |
Organization: | Nortel Networks |
X-Mailer: | Mozilla 4.51 [en] (Win98; U) |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: bison variable access |
References: | <199907020051 DOT UAA06732 AT indy DOT delorie DOT com> <377C404E DOT 36E22B7 AT hotmail DOT com> |
Lines: | 29 |
Date: | Tue, 06 Jul 1999 04:14:49 GMT |
NNTP-Posting-Host: | 209.226.124.243 |
X-Trace: | news21.bellglobal.com 931234489 209.226.124.243 (Tue, 06 Jul 1999 00:14:49 EDT) |
NNTP-Posting-Date: | Tue, 06 Jul 1999 00:14:49 EDT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Denis Lamarche wrote: > what is my_foo? what if I wanted to access the varables declared at the > beggining of my c code from inside > the script language. like: status=12 Whitch is the VAR '=' exp. so > how do I tell my program > that I wan to put 12 in the previously declares status variable? Are you saying you have a variable declared in your bison code like: int status; And when you parse the input file and find a line reading something like: status = 12 you want to assign 12 to the status variable inside the parser? If so, there is no trivial way to do it, the easiest way I can think of is to make an array of structs containing strings and int pointers. Each time you find a VAR = exp, compare the string version of VAR to every entry in your array of structs, when you find the right struct, make an assinment to the pointer, and make sure to initialize the pointer to point to the correct variable. -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT HotMail DOT com ICQ: 32959047
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |