473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get the refernces Stored.

import __main__

tempbuffer= None

permbuffer={}

class E:
def __init__(self):
# print id(self)
self.hasVar = False
def doOperation(self,op,rightOperand):
e = E()
if self.__class__ == E:
e.hasVar = self.hasVar
elif self.__class__ == V or rightOperand.__class__ == V or \
(rightOperand.__class__ == E and rightOperand.hasVar == True):
e.hasVar = True
e.operator = op
e.left = self
e.right = rightOperand
global tempbuffer
global permbuffer
print "bll"
f = copy.copy(e)
print f
r =findNonTempBufferRef(tempbuffer)
print r
if r != 'tempbuffer':
print "hello"
permbuffer[r] =tempbuffer
tempbuffer = f
return e
def relationalOperators(self,op,rightOperand):
print self,rightOperand
e=E()
e.operator =op
e.left=self
e.right=rightOperand
return e

def __neg__(self):
return self

def __radd__(self,e2):
return self.doOperation('+',e2)

def __add__(self,e2):
return self.doOperation('+',e2)

class V(E):
""" This is a variable for MPY"""
def __init__(self):
print "V",
E.__init__(self)
self.hasVar = True
self.val = None

def __str__(self):
if self.val:
# print "self.val *****"
return str(self.val)
else:
return findRefTo(self) or "MPY Error! Printing unnamed variable."

def findRefTo(obj):
import expression # Needed to get access to main.
vnames = vars(__main__)
for name in vnames.keys():
if vnames[name] == obj:
return name
return None

def findNonTempBufferRef(obj):
import expression # Needed to get access to main.
vnames = vars(__main__)
print vnames
for name in vnames.keys():
if vnames[name] == obj:
return name
return None

**************************************************

This my code...

On interpretor if i

create x=V() and y=V() creates two instances of class variable which
inherits from expression class E.

now if i say

x+y

and then c=x+y

and ce=x+y

i think i loose the original one...

i want to store in a permbuffer all asignments made..

after assigning c and ce i want a copy of both in a permbuffer..

Iam at my witends .. Please help...

Balaji
Jul 18 '05 #1
0 805

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
0
by: Boris | last post by:
Hi, folks! I need to change a refernces path (Solution Explorer -> Property Pages -> Common Properties -> Refernces Path) of a project very often. All changes is adding/removing constant path (...
3
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
5
by: Rhino | last post by:
This question relates to DB2 Version 6 on OS/390. Can a (COBOL) stored procedure on this platform do file I/O, i.e. write to a sequential file? I am trying to debug a stored procedure. As far...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
11
by: peter | last post by:
I am trying to get a SQL stored procedure to use user maintained MQT implicitly which raises questions on when they are used or not used. In theory you would expect the stored procedure to pick up...
0
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.