Previous: Messages to the driver
Up: Class Drivers
Previous Page: Messages to the driver
Next Page: Installing a Class

Examples

EXEC driver

subroutine ds_exec_dr(msg,ivdsn,instr,idone)
* 
*   ********************************************************************
*   *                                                                  *
*$$ *   subroutine ds_exec_dr  Driver of exec class                    *
*   *                                                                  *
*   *   Ryszard Zybert    May 26 16:02:47 1994                         *
*   ********************************************************************
* 
      structure/instr_t/
        character*16 name
        integer class
        integer type
        integer lun
        integer pnt
      end structure
      record/instr_t/ instr
      character*(*) msg
      integer ivdsn,idone
      character*4 cid
      pointer (cid_p,cid)
      save

if( msg.eq.'INIT' ) then if( ids_done(ierr).gt.0 ) then call ds_execdr_init idone = 1 else idone = 0 endif else if( msg.eq.'LIST' ) then write(instr.lun,'(''Exec Class (CLASS=50,IDENT=exec)'')') idone = 1 else if( msg.eq.'IDENT' ) then cid_p = instr.pnt cid = 'exec' idone = 1 else call ds_execdr_fill(instr.type,msg,idone) endif

end

CALC driver

#include "dspack_cl.h"
typedef struct instr_t \{
    char name[16];
    int class;
    int type;
    int lun;
    char *ident;
\};

/* * ******************************************************************** * * * *$$ * void ds_calc_dr_ calculator class driver * * * Input: * * * comm - character - command * * * ivdsn - integer - object handle * * * instr - struct - input structure * * * Output: * * * idone - integer - 'done' flag * * * 0 if not done * * * 1 if done * * * * * * Ryszard Zybert Apr 14 16:21:13 1994 * * ******************************************************************** */ #define REFILL_TYPE 2

void ds_calc_dr_(comm,ivdsn,instr,idone,len) char *comm; int *ivdsn; struct instr_t *instr; int *idone; int len; { int ierr; char coml[80]; static int last_iv;

*idone = 0; if ( instr->class==CALCULATOR_CLASS ) { memcpy(coml,comm,len); coml[len] = '\(\backslash\)0'; if ( str_equal(coml,"FILL") || ( str_equal(coml,"REFILL") && instr->type==REFILL_TYPE ) ) { if( *ivdsn!=last_iv ) /* Don't allow recursive calls here */ { last_iv = *ivdsn; ds_calc_dr_fill_(ivdsn); last_iv = 0; *idone = 1; } } else if ( str_equal(coml,"INIT") ) { last_iv = 0; *idone = 1; } else if ( str_equal(coml,"LIST") ) { if ( ids_done_(&ierr) ) printf( "Calculator Class (CLASS=10,IDENT=calc)\(\backslash\)n" ); *idone = 1; } else if ( str_equal(coml,"IDENT") ) { strcpy(instr->ident,"calc",4); *idone = 1; } } }

wwwd@na49
Fri Nov 4 01:19:29 MET 1994