home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
-
-
- Funzioni catturate da SPY
-
- by Federico Giannici
-
-
-
-
- -----------------------------------------------------------------------------
- This source is provided for you to see the techniques I used to write SPY.
- You can, obviously, use it to make your experiments and you can take some
- routines to insert in your programs. But you CANNOT modify, recompile and
- distribute the modified version to anyone without my permission.
- Be a programmer not a copier.
- -----------------------------------------------------------------------------
-
- ****************************************************************************/
-
-
- #include "SPY.h"
-
- #define TEMPLEN 60 /* Lunghezza stringhe temporanee per i nomi */
- #define COPYTEMP( to, from ) strncpy( to, from, TEMPLEN )
-
- extern struct MenuItem itemverbose;
- extern struct MenuItem itemeverytime;
-
-
-
- /***** Le proto di SPY *****/
- extern void goin( void );
- extern void goout( void );
- extern BOOL canoutput( void );
- extern void initout( UBYTE *funname );
- extern void endout( void );
- extern void status( UBYTE *text );
- extern void setvect( WORD v );
- extern void resetvect( WORD v );
- extern void fsetvect( WORD v );
- extern void fresetvect( WORD v );
- extern void newline( void );
- extern void prints( UBYTE *testo );
- extern void printname( UBYTE *name );
- extern void printpname( UBYTE *name );
- extern void printbuffer( UBYTE *buffer, LONG len );
- extern void printlock( BPTR lock );
- extern void printfh( BPTR fh );
- extern void printd( LONG numero );
- extern void printpd( LONG numero );
- extern void printh( ULONG numero );
- extern void addfh( BPTR fh, UBYTE *name );
- extern void remfh( BPTR fh );
- extern struct fhnode *findfh( BPTR fh );
- extern void clearfh( void );
-
- extern BOOL cannotwait;
- extern struct Window *window;
-
-
-
- UBYTE returntext[]="Return: ";
- UBYTE unknow[]="Unknow!!";
-
- UBYTE *openmodetext[]=
- {
- unknow,
- "MODE_READWRITE",
- "MODE_OLDFILE",
- "MODE_NEWFILE"
- };
-
- UBYTE *lockmodetext[]=
- {
- unknow,
- "EXCLUSIVE_LOCK",
- "SHARED_LOCK"
- };
-
- UBYTE *seekmodetext[]=
- {
- unknow,
- "OFFSET_BEGINNING",
- "OFFSET_CURRENT",
- "OFFSET_END"
- };
-
-
- /***** Nuova routine Open *****/
- BPTR __saveds __asm newopen( register __d1 char *name, register __d2 long accessmode )
- {
- BPTR ret;
-
- goin();
- fresetvect( OPENV );
- ret=Open( name, accessmode );
- fsetvect( OPENV );
- addfh( ret, name );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "Open");
- if( VERBOSE )
- prints( "FileName: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( "AccessMode: " );
- prints( openmodetext[accessmode<1004 && accessmode>1006 ? 0 : accessmode-1003] );
- printpd( accessmode );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Close *****/
- void __saveds __asm newclose( register __d1 BPTR file )
- {
- goin();
- fresetvect( CLOSEV );
- Close( file );
- fsetvect( CLOSEV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "Close");
- if( VERBOSE )
- prints( "FileHandle: " );
- printfh( file );
- endout();
- }
- remfh( file );
- goout();
- return;
- }
-
-
- /***** Nuova routine Read *****/
- long __saveds __asm newread( register __d1 BPTR file, register __d2 char *buffer, register __d3 long length )
- {
- long ret;
-
- goin();
- fresetvect( READV );
- ret=Read( file, buffer, length );
- fsetvect( READV );
- if( canoutput() && (EVERYTIME || ret==-1) )
- {
- initout( "Read");
- if( VERBOSE )
- prints( "FileHandle: " );
- printfh( file );
- if( VERBOSE )
- {
- newline();
- prints( "Buffer: " );
- printbuffer( buffer, length );
- newline();
- prints( "Length: " );
- printd( length );
- newline();
- prints( returntext );
- printd( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Write *****/
- long __saveds __asm newwrite( register __d1 BPTR file, register __d2 char *buffer, register __d3 long length )
- {
- long ret;
-
- goin();
- fresetvect( WRITEV );
- ret=Write( file, buffer, length );
- fsetvect( WRITEV );
- if( canoutput() && (EVERYTIME || ret==-1) )
- {
- initout( "Write");
- if( VERBOSE )
- prints( "FileHandle: " );
- printfh( file );
- if( VERBOSE )
- {
- newline();
- prints( "Buffer: " );
- printbuffer( buffer, length );
- newline();
- prints( "Length: " );
- printd( length );
- newline();
- prints( returntext );
- printd( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Input *****/
- BPTR __saveds __asm newinput( void )
- {
- BPTR ret;
-
- goin();
- fresetvect( INPUTV );
- ret=Input();
- fsetvect( INPUTV );
- addfh( ret, "<Input>" );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "Input");
- if( VERBOSE )
- prints( returntext );
- printh( (ULONG)ret );
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Output *****/
- BPTR __saveds __asm newoutput( void )
- {
- BPTR ret;
-
- goin();
- fresetvect( OUTPUTV );
- ret=Input();
- fsetvect( OUTPUTV );
- addfh( ret, "<Output>" );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "Output");
- if( VERBOSE )
- prints( returntext );
- printh( (ULONG)ret );
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Lock *****/
- BPTR __saveds __asm newlock( register __d1 char *name, register __d2 long accessmode )
- {
- BPTR ret;
-
- goin();
- fresetvect( LOCKV );
- ret=Lock( name, accessmode );
- fsetvect( LOCKV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "Lock");
- if( VERBOSE )
- prints( "FileName: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( "AccessMode: " );
- prints( lockmodetext[accessmode==-1 || accessmode==-2 ? -accessmode : 0] );
- printpd( accessmode );
- newline();
- prints( returntext );
- printlock( ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine UnLock *****/
- void __saveds __asm newunlock( register __d1 BPTR lock )
- {
- goin();
- /* Prima l'output, altrimenti lock non e` piu` valido */
- if( canoutput() && (EVERYTIME) )
- {
- initout( "UnLock");
- if( VERBOSE )
- prints( "Lock: " );
- printlock( lock );
- endout();
- }
- fresetvect( UNLOCKV );
- UnLock( lock );
- fsetvect( UNLOCKV );
- goout();
- return;
- }
-
-
- /***** Nuova routine DupLock *****/
- BPTR __saveds __asm newduplock( register __d1 BPTR lock )
- {
- BPTR ret;
-
- goin();
- fresetvect( DUPLOCKV );
- ret=DupLock( lock );
- fsetvect( DUPLOCKV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "DupLock");
- if( VERBOSE )
- prints( "Lock: " );
- printlock( lock );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printlock( ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Examine *****/
- long __saveds __asm newexamine( register __d1 BPTR lock, register __d2 struct FileInfoBlock *fib )
- {
- long ret;
-
- goin();
- fresetvect( EXAMINEV );
- ret=Examine( lock, fib );
- fsetvect( EXAMINEV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "Examine");
- if( VERBOSE )
- prints( "Lock: " );
- printlock( lock );
- if( VERBOSE )
- {
- newline();
- prints( "FileInfoBlock: " );
- printh( (ULONG)fib );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine ExNext *****/
- long __saveds __asm newexnext( register __d1 BPTR lock, register __d2 struct FileInfoBlock *fib )
- {
- long ret;
-
- goin();
- fresetvect( EXNEXTV );
- ret=ExNext( lock, fib );
- fsetvect( EXNEXTV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "ExNext");
- if( VERBOSE )
- prints( "Lock: " );
- printlock( lock );
- if( VERBOSE )
- {
- newline();
- prints( "FileInfoBlock: " );
- printh( (ULONG)fib );
- if( ret!=DOSFALSE )
- printpname( fib->fib_FileName );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Info *****/
- long __saveds __asm newinfo( register __d1 BPTR lock, register __d2 struct InfoData *infodata )
- {
- long ret;
-
- goin();
- fresetvect( INFOV );
- ret=Info( lock, infodata );
- fsetvect( INFOV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "Info");
- if( VERBOSE )
- prints( "Lock: " );
- printlock( lock );
- if( VERBOSE )
- {
- newline();
- prints( "InfoData: " );
- printh( (ULONG)infodata );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine DeleteFile *****/
- long __saveds __asm newdeletefile( register __d1 char *name )
- {
- long ret;
-
- goin();
- fresetvect( DELETEFILEV );
- ret=DeleteFile( name );
- fsetvect( DELETEFILEV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "DeleteFile");
- if( VERBOSE )
- prints( "File: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Rename *****/
- long __saveds __asm newrename( register __d1 char *oldname, register __d2 char *newname )
- {
- long ret;
-
- goin();
- fresetvect( RENAMEV );
- ret=Rename( oldname, newname );
- fsetvect( RENAMEV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "Rename");
- if( VERBOSE )
- prints( "OldName: " );
- printname( oldname );
- if( VERBOSE )
- {
- newline();
- prints( "NewName: " );
- printname( newname );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine CreateDir *****/
- BPTR __saveds __asm newcreatedir( register __d1 char *name )
- {
- BPTR ret;
-
- goin();
- fresetvect( CREATEDIRV );
- ret=CreateDir( name );
- fsetvect( CREATEDIRV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "CreateDir");
- if( VERBOSE )
- prints( "Directory: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine CurrentDir *****/
- BPTR __saveds __asm newcurrentdir( register __d1 BPTR lock )
- {
- BPTR ret;
-
- goin();
- fresetvect( CURRENTDIRV );
- ret=CurrentDir( lock );
- fsetvect( CURRENTDIRV );
- if( canoutput() && (EVERYTIME || ret==-1) )
- {
- initout( "CurrentDir");
- if( VERBOSE )
- prints( "NewLock: " );
- printlock( lock );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printlock( ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine ParentDir *****/
- BPTR __saveds __asm newparentdir( register __d1 BPTR lock )
- {
- BPTR ret;
-
- goin();
- fresetvect( PARENTDIRV );
- ret=ParentDir( lock );
- fsetvect( PARENTDIRV );
- if( canoutput() && (EVERYTIME || ret==-1) )
- {
- initout( "ParentDir");
- if( VERBOSE )
- prints( "Lock: " );
- printlock( lock );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printlock( ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Seek *****/
- long __saveds __asm newseek( register __d1 BPTR file, register __d2 long position, register __d3 long mode )
- {
- long ret;
-
- goin();
- fresetvect( SEEKV );
- ret=Seek( file, position, mode );
- fsetvect( SEEKV );
- if( canoutput() && (EVERYTIME || ret==-1) )
- {
- initout( "Seek");
- if( VERBOSE )
- prints( "FileHandle: " );
- printfh( file );
- if( VERBOSE )
- {
- newline();
- prints( "Position: " );
- printd( position );
- newline();
- prints( "Mode: " );
- prints( seekmodetext[ ABS(mode)>1 ? 0 : mode+2 ] );
- printpd( mode );
- newline();
- prints( returntext );
- printd( ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Execute *****/
- long __saveds __asm newexecute( register __d1 char *command, register __d2 BPTR input, register __d3 BPTR output )
- {
- long ret;
-
- goin();
- status( "Entering Execute" );
- fresetvect( EXECUTEV );
- ret=Execute( command, input, output );
- fsetvect( EXECUTEV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "Execute");
- if( VERBOSE )
- prints( "Command: " );
- printname( command );
- if( VERBOSE )
- {
- newline();
- prints( "Input: " );
- printfh( input );
- newline();
- prints( "Output: " );
- printfh( output );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine LoadSeg *****/
- BPTR __saveds __asm newloadseg( register __d1 char *name )
- {
- BPTR ret;
-
- goin();
- fresetvect( LOADSEGV );
- ret=LoadSeg( name );
- fsetvect( LOADSEGV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "LoadSeg");
- if( VERBOSE )
- prints( "Name: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine UnLoadSeg *****/
- void __saveds __asm newunloadseg( register __d1 BPTR segment )
- {
- goin();
- fresetvect( UNLOADSEGV );
- UnLoadSeg( segment );
- fsetvect( UNLOADSEGV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "UnLoadSeg");
- if( VERBOSE )
- prints( "Segment: " );
- printh( (ULONG)segment );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine CreateProc *****/
- struct MsgPort * __saveds __asm newcreateproc( register __d1 char *name, register __d2 long pri, register __d3 BPTR segment, register __d4 long stacksize )
- {
- struct MsgPort *ret;
-
- goin();
- fresetvect( CREATEPROCV );
- ret=CreateProc( name, pri, segment, stacksize);
- fsetvect( CREATEPROCV );
- if( canoutput() && (EVERYTIME || ret==DOSFALSE) )
- {
- initout( "CreateProc");
- if( VERBOSE )
- prints( "Name: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( "Priority: " );
- printd( pri );
- newline();
- prints( "Segment: " );
- printh( (ULONG)segment );
- newline();
- prints( "StackSize: " );
- printd( stacksize );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine Exit *****/
- void __saveds __asm newexit( register __d1 long returncode )
- {
- struct IntuiMessage *msg;
-
- goin();
- if( canoutput() && (EVERYTIME || returncode) )
- {
- initout( "Exit");
- if( VERBOSE )
- prints( "ReturnCode: " );
- printd( returncode );
- endout();
- }
- fresetvect( EXITV );
- /* Facciamo in modo di far eseguire fsetvect( EXITV ) a SPY */
- if( (msg=AllocMem( sizeof(struct IntuiMessage), MEMF_CLEAR | MEMF_PUBLIC ))==NULL )
- status( "INTERNAL ERROR #20" );
- /* Class==NULL */
- SetTaskPri( FindTask(NULL), SPYPRIORITY+1 ); /* Assicuriamoci di non essere interrotti */
- PutMsg( window->UserPort, (struct Message *)msg );
- goout();
- Exit( returncode );
- }
-
- /***** Nuova routine IoErr *****/
- long __saveds __asm newioerr( void )
- {
- long ret;
-
- goin();
- fresetvect( IOERRV );
- ret=IoErr();
- fsetvect( IOERRV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "IoErr");
- if( VERBOSE )
- prints( returntext );
- printd( ret );
- endout();
- }
- goout();
- return( ret );
- }
-
- /***** Inizio routines EXEC *****/
-
- /***** Nuova routine AllocMem *****/
- void * __saveds __asm newallocmem( register __d0 long size, register __d1 long requirements )
- {
- void *ret;
-
- goin();
- fresetvect( ALLOCMEMV );
- ret=AllocMem( size, requirements );
- if( canoutput() && (ret==NULL) ) /* Solo se fallisce! */
- {
- initout( "AllocMem");
- if( VERBOSE )
- prints( "Size: " );
- printd( size );
- if( VERBOSE )
- {
- newline();
- prints( "Requirements: " );
- printd( requirements );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- fsetvect( ALLOCMEMV ); /* Qui per evitare chiamate a spirale infinita */
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine OpenDevice *****/
- long __saveds __asm newopendevice( register __a0 char *name, register __d0 long unit, register __a1 struct IORequest *iorequest, register __d1 long flags )
- {
- long ret;
-
- goin();
- fresetvect( OPENDEVICEV );
- ret=OpenDevice( name, unit, iorequest, flags );
- fsetvect( OPENDEVICEV );
- if( canoutput() && (EVERYTIME || ret!=NULL) )
- {
- initout( "OpenDevice");
- if( VERBOSE )
- prints( "Device: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( "Unit: " );
- printd( unit );
- newline();
- prints( "IORequest: " );
- printh( (ULONG)iorequest );
- newline();
- prints( "Flags: " );
- printd( flags );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine CloseDevice *****/
- void __saveds __asm newclosedevice( register __a1 struct IORequest *iorequest )
- {
- UBYTE devname[TEMPLEN];
-
- goin();
- COPYTEMP( devname, iorequest->io_Device->dd_Library.lib_Node.ln_Name );
- fresetvect( CLOSEDEVICEV );
- CloseDevice( iorequest );
- fsetvect( CLOSEDEVICEV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "CloseDevice");
- if( VERBOSE )
- prints( "IORequest: " );
- printh( (ULONG)iorequest );
- printpname( devname );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine AddDevice *****/
- void __saveds __asm newadddevice( register __a1 struct Device *device )
- {
- goin();
- fresetvect( ADDDEVICEV );
- AddDevice( device );
- fsetvect( ADDDEVICEV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "AddDevice");
- if( VERBOSE )
- prints( "Device: " );
- printh( (ULONG)device );
- printpname( device->dd_Library.lib_Node.ln_Name );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine OpenLibrary *****/
- struct Library * __saveds __asm newopenlibrary( register __a1 char *name, register __d0 long version )
- {
- struct Library *ret;
-
- goin();
- fresetvect( OPENLIBRARYV );
- ret=OpenLibrary( name, version );
- fsetvect( OPENLIBRARYV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "OpenLibrary");
- if( VERBOSE )
- prints( "Library: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( "Version: " );
- printd( version );
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine OldOpenLibrary *****/
- struct Library * __saveds __asm newoldopenlibrary( register __a1 char *name )
- {
- struct Library *ret;
-
- goin();
- fresetvect( OLDOPENLIBRARYV );
- ret=OldOpenLibrary( name );
- fsetvect( OLDOPENLIBRARYV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "OldOpenLibrary");
- if( VERBOSE )
- prints( "Library: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine CloseLibrary *****/
- void __saveds __asm newcloselibrary( register __a1 struct Library *library )
- {
- UBYTE libname[TEMPLEN];
-
- goin();
- COPYTEMP( libname, library->lib_Node.ln_Name );
- fresetvect( CLOSELIBRARYV );
- CloseLibrary( library );
- fsetvect( CLOSELIBRARYV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "CloseLibrary");
- if( VERBOSE )
- prints( "Library: " );
- printh( (ULONG)library );
- printpname( libname );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine AddLibrary *****/
- void __saveds __asm newaddlibrary( register __a1 struct Library *library )
- {
- goin();
- fresetvect( ADDLIBRARYV );
- AddLibrary( library );
- fsetvect( ADDLIBRARYV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "AddLibrary");
- if( VERBOSE )
- prints( "Library: " );
- printh( (ULONG)library );
- printpname( library->lib_Node.ln_Name );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine OpenResource ****/
- struct Resource * __saveds __asm newopenresource( register __a1 char *name )
- {
- struct Resource *ret;
-
- goin();
- fresetvect( OPENRESOURCEV );
- ret=OpenResource( name );
- fsetvect( OPENRESOURCEV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "OpenResource");
- if( VERBOSE )
- prints( "Resource: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine AddResource *****/
- void __saveds __asm newaddresource( register __a1 struct Resource *resource )
- {
- goin();
- fresetvect( ADDRESOURCEV );
- AddResource( resource );
- fsetvect( ADDRESOURCEV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "AddResource");
- if( VERBOSE )
- prints( "Resource: " );
- printh( (ULONG)resource );
- printpname( ((struct Node *)resource)->ln_Name );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine FindPort ****/
- struct MsgPort * __saveds __asm newfindport( register __a1 char *name )
- {
- struct MsgPort *ret;
-
- goin();
- fresetvect( FINDPORTV );
- ret=FindPort( name );
- fsetvect( FINDPORTV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "FindPort");
- if( VERBOSE )
- prints( "PortName: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine AddPort *****/
- void __saveds __asm newaddport( register __a1 struct MsgPort *msgport )
- {
- goin();
- fresetvect( ADDPORTV );
- AddPort( msgport );
- fsetvect( ADDPORTV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "AddPort");
- if( VERBOSE )
- prints( "MsgPort: " );
- printh( (ULONG)msgport );
- printpname( msgport->mp_Node.ln_Name );
- if( strcmp( msgport->mp_Node.ln_Name, "IDCMP" )==0 )
- cannotwait=TRUE;
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine FindSemaphore ****/
- struct SignalSemaphore * __saveds __asm newfindsemaphore( register __a0 char *name )
- {
- struct SignalSemaphore *ret;
-
- goin();
- fresetvect( FINDSEMAPHOREV );
- ret=FindSemaphore( name );
- fsetvect( FINDSEMAPHOREV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "FindSemaphore");
- if( VERBOSE )
- prints( "SemaphoreName: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /***** Nuova routine AddSemaphore *****/
- void __saveds __asm newaddsemaphore( register __a0 struct SignalSemaphore *ss )
- {
- goin();
- fresetvect( ADDSEMAPHOREV );
- AddSemaphore( ss );
- fsetvect( ADDSEMAPHOREV );
- if( canoutput() && (EVERYTIME) )
- {
- initout( "AddSemaphore");
- if( VERBOSE )
- prints( "SignalSemaphore: " );
- printh( (ULONG)ss );
- printpname( ss->ss_Link.ln_Name );
- endout();
- }
- goout();
- return;
- }
-
-
- /***** Nuova routine FindName ****/
- struct Node * __saveds __asm newfindname( register __a0 struct List *list, register __a1 char *name )
- {
- struct Node *ret;
-
- goin();
- fresetvect( FINDNAMEV );
- ret=FindName( list, name );
- fsetvect( FINDNAMEV );
- if( canoutput() && (EVERYTIME || ret==NULL) )
- {
- initout( "FindName" );
- if( VERBOSE )
- prints( "Name: " );
- printname( name );
- if( VERBOSE )
- {
- newline();
- prints( "List: " );
- printh( (ULONG)list ); /* Occorre stampare type */
- newline();
- prints( returntext );
- printh( (ULONG)ret );
- }
- endout();
- }
- goout();
- return( ret );
- }
-
-
- /********** Fine delle nuove routines **********/
-