Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.pm and Preproc.pm - Enhancement Request #813

Closed
veripoolbot opened this issue Aug 28, 2014 · 6 comments
Closed

File.pm and Preproc.pm - Enhancement Request #813

veripoolbot opened this issue Aug 28, 2014 · 6 comments
Assignees

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Ed Carstens
Original Redmine Issue: 813 from https://www.veripool.org
Original Date: 2014-08-28
Original Assignee: Wilson Snyder (@wsnyder)


I would like the following simple enhancement made to File.pm:

Add a method called 'set_fileref(fileref)' to Preproc.pm which sets {fileref} to a File object reference
In the constructor for File.pm add a call to this set_fileref method with $params{fileref} argument.

This allows me to make a derived Preproc class that has a ref to the File obj, which in turn has a ref
to Netlist obj, which I supplied with {parent} to point back to my Connect obj. Otherwise, one has to use
an ugly full Module reference to get data back to the Connect obj.

I do have my own modified version of File.pm I am using. Instead of modifying Preproc.pm, I have a derived
Preproc class. I uploaded File.pm.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-08-29T15:42:39Z


Looking at the current sources, there is a "parser" option passed to the read method of Netlist::File which was added since the version you based your patch upon. Can you see if this also solves your issue?

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Ed Carstens
Original Date: 2014-08-29T16:08:01Z


I don't see a "parser" option in 3.404, but I do make use of the "preproc" one. "preproc" passes the class name for the new object to be created (my derived class). The Preproc obj still needs a ref back to File obj. At one point I also thought it would be good to have a ref to the Preproc obj from File obj, but it turns out I don't need this.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-08-29T16:25:41Z


Please make sure your $VERSION in that file is 3.404 or 3.405, the File.pm you sent is much older VERSION.

Here's the change, which was first in 3.404.

585bc4d (Wilson Snyder 2014-05-02 12:37:46 -0400 441) my $parser_class = ($params{parser} || $netlist->{parser});

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Ed Carstens
Original Date: 2014-08-29T16:55:23Z


Okay, now I see what you are talking about. This would let me pass in my own derived File::Parser class which could change the constructor to do what I need. I prefer not to do this, though. I don't like having to maintain my own copied versions of things, in this case the constructor. And because $preproc is a local var, I can't just call super new and then call $preproc->fileref(..) I guess one solution would be to make $preproc be a member of the File::Parser class instead of a private var.

So I still think what I first described would be a nice thing to put in the base File::Parser class.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-09-09T21:36:23Z


I added Verilog::Preproc->parent() and Verilog::Netlist::File->preproc()

Fixed in git towards 3.405. Please test the git version, thanks.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-09-21T13:01:03Z


In 3.406.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants