Source Code for Unit Conversion


The following source files, led by gray banners, contain class functions in Unit Conversion for SansGUI utility program.  The sections highlighted by a yellow background Color are manually entered.  Code sections with white background color are generated by the SansGUI Source Code Framework.  The source file is compiled into a dynamic linked library to be invoked by SansGUI when the user clicks on the Check Data button in a Table Object Properties dialog.

Class Table.Vector is the base class of class Table.Vector.Length and other unit dimensions.  The SG_xEndEdit_Table_Vector() function serves as the common copy function for all the subclasses.  The function in class Table.Vector.Length is listed as an example to show how the base class function is called from all the subclasses.  Other generated place-holder functions have not been modified and are omitted from this code listing.

For more details about the complete package, please read the Unit Conversion for SansGUI Manual on-line.

Implementation in C/C++ (MSVC)

Functions in Class Table.Vector     [Go to Top]

/* Table_Vector.c

* - DLL routines for class <Reference>Table.Vector

* DATE: Saturday, July 28, 2001 TIME: 08:32:28 PM

* The skeleton of this file is generated by SansGUI(tm)

*/

#include <stdio.h>

#include <memory.h>

#include "SGdll.h"

#ifdef __cplusplus

extern "C"

{

#endif

SG_EXPORT SG_SIM_FUNC SG_xEndEdit_Table_Vector;

SG_EXPORT SG_SIM_FUNC SG_xLoadSize_Table_Vector;

SG_EXPORT SG_SIM_FUNC SG_xLoad_Table_Vector;

#ifdef __cplusplus

}

#endif

/* Macros for attribute indices in class version [1.0.0.0] */

#define SG_NDX_ISIZE 0 /* iSize - Table Size */

#define SG_NDX_ISHEETS 1 /* iSheets - Number of Sheets */

/* Manually added macros for subclass attribute access */

#define SG_NDX_DATA 2 /* Data - User Data */

/* ============================================================

* SG_xEndEdit - End Edit Check

* ------------------------------------------------------------

*/

SG_RET_CODE SG_xEndEdit_Table_Vector(SG_OBJ *const self,

          SG_OBJ *const simCtrl, SG_OBJ *const chgChild,
          SG_OBJ *const refObjs[], const INT *const piRefObjs,
          SG_OBJ *const adjObjs[], const INT *const piAdjObjs,
          SG_OBJ *const lnkObjs[], const INT *const piLnkObjs,
          TCHAR *const cMessage, const INT iMsgLen,
          TCHAR *const cCommand, const INT iCmdLen,
          SG_FILE *const pOutFile )
{

    /* TODO: declare your local variables here */

    INT i, iSize;

    if (!SG_IsSchemaOK(self->nSGobjSchema))

        return SG_R_SCHM;

    /* TODO: put your simulator code here */

    if (self->iNumVars > SG_NDX_DATA)

    {

        iSize = sizeof(FLOAT) * self->zValues[SG_NDX_DATA].iSize;

        // simply copy data from user data column to all the other columns

        for (i = (SG_NDX_DATA + 1); i < self->iNumVars; i++)

            memcpy(self->zValues[i].fData, self->zValues[SG_NDX_DATA].fData,

                 iSize );

    }

return SG_R_OK;

}

/* ============================================================

* SG_xLoadSize - Resize for Load

* ------------------------------------------------------------

*/

SG_RET_CODE SG_xLoadSize_Table_Vector(SG_OBJ *const self,

          SG_OBJ *const simCtrl, SG_OBJ *const chgChild,
          SG_OBJ *const refObjs[], const INT *const piRefObjs,
          SG_OBJ *const adjObjs[], const INT *const piAdjObjs,
          SG_OBJ *const lnkObjs[], const INT *const piLnkObjs,
          TCHAR *const cMessage, const INT iMsgLen,
          TCHAR *const cCommand, const INT iCmdLen,
          SG_FILE *const pOutFile )

{

    /* TODO: declare your local variables here */

 

    if (!SG_IsSchemaOK(self->nSGobjSchema))

        return SG_R_SCHM;

 

    /* TODO: put your simulator code here */

 

    return SG_R_OK;

}

/* ============================================================

* SG_xLoad - Load Data

* ------------------------------------------------------------

*/

SG_RET_CODE SG_xLoad_Table_Vector(SG_OBJ *const self,

          SG_OBJ *const simCtrl, SG_OBJ *const chgChild,
          SG_OBJ *const refObjs[], const INT *const piRefObjs,
          SG_OBJ *const adjObjs[], const INT *const piAdjObjs,
          SG_OBJ *const lnkObjs[], const INT *const piLnkObjs,
          TCHAR *const cMessage, const INT iMsgLen,
          TCHAR *const cCommand, const INT iCmdLen,
          SG_FILE *const pOutFile )
{

    /* TODO: declare your local variables here */

 

    if (!SG_IsSchemaOK(self->nSGobjSchema))

        return SG_R_SCHM;

 

    /* TODO: put your simulator code here */

 

    return SG_R_OK;

}

Functions in Class Table.Vector.Length     [Go to Top]

/* Table_Vector_Length.c

* - DLL routines for class <Reference>Table.Vector.Length

* DATE: Saturday, July 28, 2001 TIME: 08:32:28 PM

* The skeleton of this file is generated by SansGUI(tm)

*/

#include <stdio.h>

#include "SGdll.h"

#ifdef __cplusplus

extern "C"

{

#endif

SG_EXPORT SG_SIM_FUNC SG_xEndEdit_Table_Vector_Length;

SG_EXPORT SG_SIM_FUNC SG_xLoadSize_Table_Vector_Length;

SG_EXPORT SG_SIM_FUNC SG_xLoad_Table_Vector_Length;

#ifdef __cplusplus

}

#endif

/* Macros for attribute indices in class version [1.0.0.0] */

#define SG_NDX_ISIZE 0 /* iSize - Table Size */

#define SG_NDX_ISHEETS 1 /* iSheets - Number of Sheets */

#define SG_NDX_DATA 2 /* Data - User Data */

#define SG_NDX_TO_1 3 /* To_1 - To Unit 1 */

#define SG_NDX_TO_2 4 /* To_2 - To Unit 2 */

#define SG_NDX_TO_3 5 /* To_3 - To Unit 3 */

#define SG_NDX_TO_4 6 /* To_4 - To Unit 4 */

#define SG_NDX_TO_5 7 /* To_5 - To Unit 5 */

/* ============================================================

* SG_xEndEdit - End Edit Check

* ------------------------------------------------------------

*/

SG_RET_CODE SG_xEndEdit_Table_Vector_Length(SG_OBJ *const self,

          SG_OBJ *const simCtrl, SG_OBJ *const chgChild,
          SG_OBJ *const refObjs[], const INT *const piRefObjs,
          SG_OBJ *const adjObjs[], const INT *const piAdjObjs,
          SG_OBJ *const lnkObjs[], const INT *const piLnkObjs,
          TCHAR *const cMessage, const INT iMsgLen,
          TCHAR *const cCommand, const INT iCmdLen,
          SG_FILE *const pOutFile )
{

    /* TODO: declare your local variables here */

    extern SG_SIM_FUNC SG_xEndEdit_Table_Vector;

    if (!SG_IsSchemaOK(self->nSGobjSchema))
        return SG_R_SCHM;

    /* TODO: put your simulator code here */

    /* call the interface function in the base class */

    return SG_xEndEdit_Table_Vector(self, simCtrl, chgChild,

                                    refObjs, piRefObjs, adjObjs, piAdjObjs,

                                    lnkObjs, piLnkObjs, cMessage, iMsgLen,

                                    cCommand, iCmdLen, pOutFile );

}

/* ============================================================

* SG_xLoadSize - Resize for Load

* ------------------------------------------------------------

*/

SG_RET_CODE SG_xLoadSize_Table_Vector_Length(SG_OBJ *const self,

          SG_OBJ *const simCtrl, SG_OBJ *const chgChild,
          SG_OBJ *const refObjs[], const INT *const piRefObjs,
          SG_OBJ *const adjObjs[], const INT *const piAdjObjs,
          SG_OBJ *const lnkObjs[], const INT *const piLnkObjs,
          TCHAR *const cMessage, const INT iMsgLen,
          TCHAR *const cCommand, const INT iCmdLen,
          SG_FILE *const pOutFile )
{

    /* TODO: declare your local variables here */

 

    if (!SG_IsSchemaOK(self->nSGobjSchema))

        return SG_R_SCHM;

 

    /* TODO: put your simulator code here */

 

    return SG_R_OK;

}

/* ============================================================

* SG_xLoad - Load Data

* ------------------------------------------------------------

*/

SG_RET_CODE SG_xLoad_Table_Vector_Length(SG_OBJ *const self,

          SG_OBJ *const simCtrl, SG_OBJ *const chgChild,
          SG_OBJ *const refObjs[], const INT *const piRefObjs,
          SG_OBJ *const adjObjs[], const INT *const piAdjObjs,
          SG_OBJ *const lnkObjs[], const INT *const piLnkObjs,
          TCHAR *const cMessage, const INT iMsgLen,
          TCHAR *const cCommand, const INT iCmdLen,
          SG_FILE *const pOutFile )
{

    /* TODO: declare your local variables here */

 

    if (!SG_IsSchemaOK(self->nSGobjSchema))

        return SG_R_SCHM;

 

    /* TODO: put your simulator code here */

 

    return SG_R_OK;

}

 


Unit Conversion for SansGUI version 1.1

Copyright © 2001-2002 ProtoDesign, Inc. All rights reserved.

http://protodesign-inc.com