home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ======================================================================== */ /* = Programmname : NewInfoList V7.1 = */ /* = = */ /* ======================================================================== */ /* = Author/Copyright : (c) 1993-94 by Andreas Ralph Kleinert. = */ /* = Freeware. All rights reserved. = */ /* = = */ /* = Use it as an example for programming = */ /* = superview.library ! = */ /* = = */ /* ======================================================================== */ /* = Function : Demonstrates handling and creation of = */ /* = SVObjectInfo- and SVDriverInfo-Lists. = */ /* = = */ /* ======================================================================== */ /* = Last Update : 15.7.1994 = */ /* = = */ /* ======================================================================== */ /* = Remarks : Needs "superview.library" V6+. = */ /* = = */ /* ======================================================================== */ /* = Compiler : SAS/C V6.51 = */ /* = (smakefile) = */ /* ======================================================================== */ #include <exec/types.h> #include <exec/memory.h> #include <superview/superview.h> #include <superviewsupport/superviewsupport.h> #include <proto/exec.h> #include <proto/dos.h> #include <proto/superview.h> #include <proto/superviewsupport.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /* Help- and Info- Texts */ char entry1_text [] = "\2331;32;40mNewInfoList V7.1 \2330;32;40m\2333;32;40m(FREEWARE)\2330;32;40m\n(c) 1993-94 by Andreas Ralph Kleinert.\nAndreas R. Kleinert, Grube Hohe Grethe 23, D-57074 Siegen, Germany.\n"; char entry2_text [] = "Tests some superview.library functions.\n"; char entry3_text [] = "USAGE : \2330;33;40mNewInfoList\2330;31;40m\n"; char ver_text [] = "\0$VER: NewInfoList V7.1 (15.7.94)"; /* *************************************************** */ /* * * */ /* * Error-Messages for Leave() and KF_Message() * */ /* * * */ /* *************************************************** */ char svlib_text [] = "You need \42superview.library\42 V6+ !"; /* *************************************************** */ /* * * */ /* * Function Declarations * */ /* * * */ /* *************************************************** */ void __regargs SVObjectInfo_Test(void); void __regargs SVDriverInfo_Test(void); void __regargs Leave(char *endtext, long code); /* Functions from module "NL_Subs.o" : */ extern void __stdargs K_Printf(char *formatstring, ...); /* *************************************************** */ /* * * */ /* * Additional Base Declarations * */ /* * * */ /* *************************************************** */ extern struct ExecBase *SysBase; struct SuperViewBase *SuperViewBase = N; /* *************************************************** */ /* * * */ /* * MAIN * */ /* * * */ /* *************************************************** */ void main(long argc, char **argv) { if(!argc) Leave(N, 0); if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?')) { K_Printf("%s%s%s", entry1_text, entry2_text, entry3_text); Leave(N, 0); } SuperViewBase = (struct SuperViewBase *) OpenLibrary("superview.library", 6); if(!SuperViewBase) Leave(svlib_text, 103); SVObjectInfo_Test(); SVDriverInfo_Test(); Leave("\n", 0); } void __regargs SVObjectInfo_Test(void) { struct SVObjectInfo *pad; struct SVObjectInfo *fpad; K_Printf("\n\nTesting SVObjectInfo functions :\n"); if(!SVL_GetSVObjectList(&pad)) { fpad = pad; while(pad) { K_Printf("\n %-24s (SubTypeCode : %2ld), Flags : 0x%lx", pad->soi_TypeName, pad->soi_Type, pad->soi_Flags); pad = pad->soi_NextEntry; } if(fpad) SVL_FreeSVObjectList(fpad); } } void __regargs SVDriverInfo_Test(void) { struct SVDriverInfo *pad; struct SVDriverInfo *fpad; K_Printf("\n\nTesting SVDriverInfo functions :\n"); if(!SVL_GetSVDriverList(&pad)) { fpad = pad; while(pad) { K_Printf("\n %-24s, Flags : 0x%lx", pad->sdi_Name, pad->sdi_Flags); pad = pad->sdi_NextEntry; } if(fpad) SVL_FreeSVDriverList(fpad); } } /* *************************************************** */ /* * * */ /* * LEAVE : Global Exit Function Replacement * */ /* * * */ /* *************************************************** */ void __regargs Leave(char *endtext, long code) { if(SuperViewBase) CloseLibrary((APTR) SuperViewBase); if(endtext) K_Printf("%s\n", endtext); exit(code); }