/****************************************************************************/
/** Copyright (c) Quest Engineering Technologies, 1991                     **/
/**                                                                        **/
/** All Rights Reserved.  Unpublished rights reserved under the  copyright **/
/** laws of the United States.                                             **/
/**                                                                        **/
/** The software contained on this media is proprietary  to  and  embodies **/
/** the   confidential   technology  of  Quest  Engineering  Technologies. **/
/** Possession, use, duplication or  dissemination  of  the  software  and **/
/** media  is  authorized  only  pursuant  to a valid written license from **/
/** Quest Engineering Technologies.                                        **/
/**                                                                        **/
/** RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by  the  U.S. **/
/** Government  is  subject  to  restrictions as set forth in Subparagraph **/
/** (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable.  **/
/****************************************************************************/

#ifndef mvdll_h
#define mvdll_h
#include "dllinter.h"

// functions index
#define   MVDLL_ADD         0
#define   MVDLL_MUL         1
#define   MVDLL_CONCATSTR   2
#define   MVDLL_MAX         3
#define   MVDLL_DONOTHING   4

// error codes
#define BAD_ARGUMENT   2
#define ARG_ERROR      2
#define ARG_VAL_ERROR  2

typedef struct {
   INDINT   m, n;   // data dim
   int      type;   // data type
   double  *pval;   // data pointer
   } MvArg;

class MvDll {
protected :
   int          Initialized;
   MV_INTERFACE MV;

   // variables
   MvArg        Arg1, Arg2, ArgOut;

   // utility methods
   void         IssueError(int Code, char *);
   void         ReadArg   (Datum *d, MvArg &arg);
   int          StringOf  (Datum *d, char *buf, int len);

   // the MathViews functions
   int          AddArgs   (Datum *&dout);
   int          MulArgs   (Datum *&dout);
   int          ConcatArgs(Datum *&d1, Datum *&d2, Datum *&dout);
   int          MaxArg    (Datum *&dout);
   int          DoNothing (Datum *&dout);

public:
                MvDll(MV_INTERFACE *mv);  
               ~MvDll();
   int          DllFunction(int type, int * nout, Datum ** dat_out, int nin, Datum ** dat_in);

   void         Abort();              
};

#endif //
