'#Uses "..\include\Global.inc"
'#Uses "..\include\Const.inc"
'#Uses "..\include\Format.inc"
'#Uses "..\classes\FunctionClass.cls"
Option Explicit
'*****************************************************************************
' Module:
'        MAIN
'-----------------------------------------------------------------------------
' Description:
'        This module contains all functions that are used in the 
'        MAIN dialog script and in the MAIN codegenerator script.
'
'-----------------------------------------------------------------------------
' History:
'                 
'        Rev. Author         Date        Description
'        ---------------------------------------------------------------------
'        1.0   ahe         27.04.00     final version
'        1.1   ahe         20.06.00     final version for C167CS
'
'        ---------------------------------------------------------------------
'        5.0   ahe         31.07.00     final version for C161CS/JC/JI
'
'        ---------------------------------------------------------------------
'              ahe         23.10.00     final version for 
'				        C167CS
'				        C161CS/JC/JI
'				        C167CS/CR r2
'
'        ---------------------------------------------------------------------
'        5.1   ahe         23.08.02     no changes
'
'*****************************************************************************


'*****************************************************************************
' @Constants
'*****************************************************************************


'*****************************************************************************
' @Function descriptions
'*****************************************************************************

'*****************************************************************************
'Description:
'        For each function which should be used for this module a line 
'        "If (Not func.AddFunction .." must be insert in this function.
'        For each parameter that should be used for this function a  
'        line "If (Not func.AddParameter .." must be insert in this function.
'
'        Note:
'        For each added function a project variable with the name 
'        "DUMMY_NAME_Functionname" must be exist in the *.vars file. 
'-----------------------------------------------------------------------------
'Parameters:
'        func             reference to the FunctionClass object
'        r                reference to the Registers object
'-----------------------------------------------------------------------------
'Returns:
'        True            on successfull operation
'        False           else
'*****************************************************************************
Public Function RefreshFunctionDescriptions(vIndex As Variant, func As FunctionClass, r As ProjectData) As Boolean
  On Error Resume Next 

  RefreshFunctionDescriptions = False

  Dim sDescription As String
  Dim sReturnValue As String
  Dim sIndex As String
  Dim sPrefix As String

  sIndex = "MAIN"


  ' for each function of this module the property AddFunction must be called
  '
  ' AddFunction(sFuncName As String, sFuncType As String, sFuncDescription As String, 
  '             sReturnvalue As String, lSort As Long) As Boolean
  '
  ' sFuncName          | String | function name as key (use the name of the variable 
  '                               for the function name e.g. SSC_NAME_Init) 
  ' sFuncType          | String | type of the function
  ' sFuncDescription   | String | description of the function
  ' sReturnvalue       | String | description of the return value
  ' lSort              | Long   | ' sort of the function (0 => macro, 1 => function, 2 => ISR, 3 => TRAP)

    ' for each parameter of a function the property AddParameter must be called
    '
    'AddParameter(sParName As String, sPar As String, sParType As String, sParDescription As String) As Boolean    
    '
    ' sParName         | String | parameter name (key)
    ' sPar             | String | parameter name
    ' sParType         | String | type of the parameter
    ' sParDescription  | String | description of the parameter


  '------------------------------------------------------------------------------------------------
  ' Description for MAIN_NAME_Init
  '------------------------------------------------------------------------------------------------
  sDescription = "This function initializes the microcontroller."
  sReturnValue = "None" 
  If (Not func.AddFunction(sIndex & "_NAME_Init", "void", sDescription, sReturnValue, 1)) Then Exit Function

  '------------------------------------------------------------------------------------------------
  ' Description for MAIN_NAME_Main
  '------------------------------------------------------------------------------------------------
  sDescription = "This is the main function."
  sReturnValue = "None" 
  If (Not func.AddFunction(sIndex & "_NAME_Main", "void", sDescription, sReturnValue, 1)) Then Exit Function
'    sDescription = "Data to be send"
'    If (Not func.AddParameter(sIndex & "_NAME_SendData_Par1", "usData", "ushort", sDescription)) Then Exit Function



 	If (Not func.Sort) Then Exit Function

  RefreshFunctionDescriptions = True
End Function



'*****************************************************************************
' @Functions
'*****************************************************************************



'*****************************************************************************
'Description:
'        This function returns a formated disabled tooltip if the pin #EA = 0
'        e.g. fetch code from internal ROM
'-----------------------------------------------------------------------------
'Parameters:
'        r               reference to the ProjectData object
'        PinName         Alternatpinname
'        lowIndex        low index
'        highIndex       high index
'
'-----------------------------------------------------------------------------
'Returns:
'        Formated tooltip
'*****************************************************************************
Function GetTooltipIfInternROM(r As ProjectData) As String

    GetTooltipIfInternROM = FormatDisabledTooltip("fetch code from internal ROM (#EA = high during reset)")

End Function

