Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - Looking at code in the libraries
Author Message
  Post subject:  Re: Looking at code in the libraries  Reply with quote
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
Post Posted: Tue Jul 28, 2009 8:42 am
  Post subject:  Re: Looking at code in the libraries  Reply with quote
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
Post Posted: Tue Jul 28, 2009 5:23 am
  Post subject:  Re: Looking at code in the libraries  Reply with quote
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
Post Posted: Mon Jul 27, 2009 7:37 pm
  Post subject:  Re: Looking at code in the libraries  Reply with quote
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
Post Posted: Mon Jul 27, 2009 6:32 pm
  Post subject:  Re: Looking at code in the libraries  Reply with quote
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
Post Posted: Mon Jul 27, 2009 4:12 pm
  Post subject:  Re: Looking at code in the libraries  Reply with quote
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.
Post Posted: Mon Jul 27, 2009 11:55 am
  Post subject:  Looking at code in the libraries  Reply with quote
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
Post Posted: Mon Jul 27, 2009 6:14 am


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