Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Looking at code in the libraries
PostPosted: Mon Jul 27, 2009 6:14 am 

Joined: Wed Jul 15, 2009 3:38 pm
Posts: 10
Hello,
How does one print out the code of procedures in the built-in libraries? For example, I want to examine the code of the procedure called "invariant_basis" in finvar.lib.
Is that possible?

Ravi


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking at code in the libraries
PostPosted: Mon Jul 27, 2009 11:55 am 

Joined: Fri Dec 05, 2008 4:48 pm
Posts: 5
All the standard distributed libraries are contained in the LIB folder of your distribution. Since they are in plaintext, you may simply look for LIB/finvar.lib and then find the realization of "invariant_basis" by a search command.

_________________
Dr. Stanislav Bulygin
Post Doctoral researcher
Working group Cryptographic Primitives
Department Secure Data
Center for Advanced Security Reseach Darmstadt
http://www.mathematik.uni-kl.de/~bulygin/


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking at code in the libraries
PostPosted: Mon Jul 27, 2009 4:12 pm 

Joined: Tue Jun 23, 2009 10:33 pm
Posts: 51
Location: Kaiserslautern
Dear Ravi,

you can get the code of any procedure (e.g. invariant_basis) via
string(invariant_basis);

but for this to work you have to call the procedure at least once.
Therefore i suggest you to do the following:

Code:
LIB "finvar.lib"; // load lib
example invariant_basis; // take a look at the example
string(invariant_basis); // view its source


I hope that helps.

Regards,
Oleksandr


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking at code in the libraries
PostPosted: Mon Jul 27, 2009 6:32 pm 
Hello,
The finvar.lib file in the LIB folder is a binary file (with text annotations), so I found it easier to use the "string" command suggested by Oleksandr.
The string command only prints to the terminal, so to print to file for easy reading, do this:
Code:
    > write("a-file-name.txt", name-of-procedure)


Thanks for the help,

Ravi


Report this post
Top
  
Reply with quote  
 Post subject: Re: Looking at code in the libraries
PostPosted: Mon Jul 27, 2009 7:37 pm 

Joined: Tue Jun 23, 2009 10:33 pm
Posts: 51
Location: Kaiserslautern
Dear Ravi,

how do you detect that finvar.lib file in the LIB folder is a binary file (with text annotations)?

AFAIK, LIB/*.lib should be plain text files.
If you cannot read/edit them with a plain text editor then something went wrong...

Besides, you still need to call you procedure before doing:
"write("a-file-name.txt", name-of-procedure);"

Regards,
Oleksandr


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking at code in the libraries
PostPosted: Tue Jul 28, 2009 5:23 am 

Joined: Wed Jul 15, 2009 3:38 pm
Posts: 10
Hello,
Yes, I am calling the procedure before calling the write function. (And the second argument is string(proc_name).)

I had opened the finvar.lib file using TextPad (a text editor on Windows) and it actually appears as a binary file there! Maybe something about the way TextPad treats the lib extension?

I checked that it is a plain text file in another plain text editor.

Thanks
Ravi


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking at code in the libraries
PostPosted: Tue Jul 28, 2009 8:42 am 
Site Admin

Joined: Thu Nov 13, 2008 10:52 am
Posts: 26
Ravi wrote:
I had opened the finvar.lib file using TextPad (a text editor on Windows) and it actually appears as a binary file there! Maybe something about the way TextPad treats the lib extension?

Right .lib means static library on Windows, so it is assumed to be something binary. Also text files are different (different end of line markers) between Windows and Unix, and therefore some Windows-editors cannot deal with them (notepad can't, while wordpad can).

Regards,
Alexander


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 11:06 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group