Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to check if a library is loaded?
PostPosted: Sun Aug 24, 2008 8:16 am 

Joined: Fri Aug 08, 2008 1:10 pm
Posts: 4
I would like to automatically check if a library is loaded. One idea was to use "listvar(package)", but this seems to print such a list to the screen, rather than return an object that I can search through.

I think this used to be possible in Singular 2 with "string(LIB)", but that doesn't seem to be the case anymore.

Does anybody know how to do this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 24, 2008 6:32 pm 
In Singular-2.x you could look up the global variable LIB (of type string) and search
for the library using the command find e.g.

Code:
> LIB;
standard.lib
> find("LIB","standard.lib");
1
> find(LIB,"ring.lib");
0
> LIB "ring.lib";
// ** loaded /usr/o0/Singular-203/sparcv7-sun-solaris2.7/Singular/2-0-3/LIB/ring.lib (1.17.2.1,2002/02/20)
// some more output here
> LIB;
standard.lib,ring.lib,general.lib,matrix.lib,random.lib,poly.lib,inout.lib
> find(LIB,"ring.lib");
14


This does no longer work, as LIB is now the string "_".

In Singular-3.x you have to use the command defined
with capitalized first letter of the library (without the trailing .lib):

Code:
> defined(Sing);
0
> LIB "sing.lib";
// ** loaded /LIB/sing.lib (1.30,2006/08/02)
> defined(Sing);
1


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 25, 2008 10:36 pm 

Joined: Fri Aug 08, 2008 1:10 pm
Posts: 4
Perfect, that works. Thanks a lot!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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:03 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group