× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Number of objects in a library
  • From: Kurt Goolsbee <K.goolsbee@xxxxxxxxxxxxx>
  • Date: Fri, 4 Aug 2000 13:24:09 -0500

Doug,

Your method seems to be accurate for most libraries.  For non-system
libraries it is usually dead on.  Thanks for taking time to answer and
provide sample code.

Here the same thing in C.

#include "stdlib.h"                              
#include "stdio.h"                               
#include "string.h"                              
#include "qusmiapi.h"                            
#include "matctx.mih"                            
#include "rslvsp.mih"                            
                                                 
typedef struct {                                 
   _Gen_Mat_ID_T Object;                         
} Lib_Entry_T;                                   
                                                 
int main(int argc, char* argv[])  {              
int nentries;                                    
_SYSPTR libptr;                                  
                                                 
_MCTX_Options_T Options;                         
_MCTX_Template_T Template;                       
                                                 
memset(&Options,  0, sizeof(Options));
memset(&Template, 0, sizeof(Template));                         
                                                                
/* get a pointer to the library  */                             
libptr = rslvsp(_Library, argv[1], "QSYS",_AUTH_ALL);           
                                                                
/* get the a count of everything */                             
Options.Info   = _MCTX_SYMBOLS + _MCTX_NO_VALIDATE;             
Options.Select = 0;                                             
Template.Template_Size = 8;                                     
QusMaterializeContext(&Template, libptr, &Options);             
                                                                
nentries = (Template.Bytes_Used - 96) / sizeof(Lib_Entry_T);    
                                                                
/* get the number of MEMBERS  */                                
Options.Select = _MCTX_TYPE_SUBTYPE;                            
Options.Object.Type_Subtype = 0x0D50;                           
QusMaterializeContext(&Template, libptr, &Options);             
                                                                
/* reduce the total by the number of MEMBERS */                 
nentries -= (Template.Bytes_Used - 96) / sizeof(Lib_Entry_T);              

printf("%s contains %d objects.\n",argv[1],nentries);    
                                                         
return nentries;                                         
}                                                        
+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.