Use dfallent

String gsProjectName
String gsProgrammname
String gsVerionsNr
Move "KURANT Project"   To gsProjectName
Move "The Hammer"       To gsProgrammname
Move "2.0"              To gsVerionsNr

// 2001-01-09 -RvdW
Define CURRENT$WORKSPACE  For "Hammer"

Use vWin32fh.pkg
Use cWorkspaceHandlerEx.pkg
//Use cWorkspaceEx.pkg

//  Set date attributes as needed
Set_Date_Attribute sysdate4_State To (True)
Set_Date_Attribute Date4_State    To (True)
Set_Date_Attribute epoch_value    To 30

    // Modified WorkSpace, to allow variable WrkSpc name.
Define CS_ApplicationDescription For "ASDBC"
//Integer ghoWorkSpaceHandlerEx

Object oWorkSpaceHandlerEx Is a cWorkSpaceHandlerEx
    Move Self           To ghoWorkSpaceHandlerEx
    Set psVDFVersion    To "12.1" // Hardcoded VDF version to start with
    Send InitWithCurrentWrkSpc
End_Object



Procedure AppStop_Box global String sMessage
  String sCaption
  Move CS_ApplicationDescription to sCaption
  Send Stop_Box sMessage sCaption
  Abort
End_Procedure // AppStop_box
Use cApplication.pkg

Object oApplication is a cApplication

  Property String psVDFVersion  "11.1"
  Property String psWorkspace   ""
  Property String psProgramFile ""

  Procedure DoShowHelp
    String sMsg
    String sCaption
    Move "  -v version   : vdf version of the \n" To sMsg
    Move (sMsg+"  -w workspace : workspace \n") To sMsg
    Move (sMsg+"  -f program   : program source filename (.src file)\n") To sMsg
    Move (CS_ApplicationDescription+" :: Command line Help") To sCaption
    Send Info_Box sMsg sCaption
  End_Procedure // DoShowHelp

  Procedure ProcessCommandline
    Handle  hoCmdLine
    Integer iArg
    Integer iNumArgs
    Boolean bHasParams
    String  sArgument
    String  sParam

    Get phoCommandLine To hoCmdLine
    Get CountOfArgs of hoCmdLine To iNumArgs
    If (iNumArgs>0) Begin
      Move True To  bHasParams
    End
    Else Begin
      Send DoShowHelp
      Abort
    End
    If (bHasParams) Begin

      Move 1 To iArg
      While (iArg <= iNumArgs)
        Get Argument Of hoCmdLine Item iArg To sArgument
        Move (Lowercase(sArgument)) To sArgument
        If (Left(sArgument,1)= "/") Move (Replace("/",sArgument,"")) To sArgument
        If (Left(sArgument,1)= "-") Move (Replace("-",sArgument,"")) To sArgument
        Case Begin
          Case ((sArgument="?") Or (sArgument="h") Or (sArgument="help"))
            Send DoShowHelp
            Abort
            Case Break
          Case (sArgument="v")
            Get Argument Of hoCmdLine Item (iArg+1) To sParam
            Set psVDFVersion to sParam
            Showln "VDF Version = " sParam
            Increment iArg
            Case Break
          Case (sArgument="w")
            Get Argument Of hoCmdLine Item (iArg+1) To sParam
            Set psWorkspace To sParam
            Showln "Workspace = " sParam
            Increment iArg
            Case Break
          Case (sArgument="f")
            Get Argument Of hoCmdLine Item (iArg+1) To sParam
            Set psProgramFile To sParam
            Showln "Program file = " sParam
            Increment iArg
            Case Break
          Case Else
            Send AppStop_box ("Unknown command line parameter for ASDBC.\n Aborting now...")
        Case End
        Increment iArg
      Loop
    End
  End_Procedure // ProcessCommandline

  Procedure OnCreate
      //Send DoOpenWorkspace CURRENT$WORKSPACE
      Send ProcessCommandline
  End_Procedure

End_Object    // oApplication

//Object ProgramWorkspace is a cWorkspaceEx
//    Set piCmdLineSupport    to True                 // Use it for CommandLine Parameters.
//    Set WorkspaceName       to CURRENT$WORKSPACE
//
//        // Propeties to store some global flags.
//    Property String  psWrkSpcOpenFileName           Public ""
//    Property Integer piWrkSpcNewFile                Public False
//    Property Integer piWrkSpcSetVersion             Public False
//    Property Integer piWrkSpcRegister               Public False
//
//        // Procedure which are called when the CommandLineParameters are received.
//    Procedure WrkSpcRegister
//        Set piWrkSpcRegister    to True
//    End_Procedure
//
//    Procedure WrkSpcOpenFile String sFile
//        Local Integer iArg
//        Local String  sArg
//        Set psWrkSpcOpenFileName    to sFile
//        Send Delete_Data            to (oWrkSpcOpenFileNames(Self))
//        for iArg from 1 to NUM_Arguments
//            Movestr iArg&   to sArg
//            If (Trim(sArg)) Ne "" Begin
//                Set value of (oWrkSpcOpenFileNames(Self)) item (Item_Count(oWrkSpcOpenFileNames(Self))) to sArg
//            End
//        End
//    End_Procedure
//
//    Procedure WrkSpcNewFile
//        Set piWrkSpcNewFile         to True
//    End_Procedure
//
//    Procedure WrkSpcSetVersion
//        Set piWrkSpcSetVersion      to True
//    End_Procedure
//
////        // Commands which should been handled from the CmdLine:
////    Send RegisterCommand "-REGISTER"    Msg_WrkSpcRegister      0 "Associates all VDF Filetypes to the Hammer."
////    Send RegisterCommand "-OPEN"        Msg_WrkSpcOpenFile      0 "Opens the given file."
////    Send SetDefaultCommand              // -OPEN is the default Command.
////    Send RegisterCommand "-NEW"         Msg_WrkSpcNewFile       0 "Opens a empty file view."
////    Send RegisterCommand "-SETVERSION"  Msg_WrkSpcSetVersion    0 "Opens the Version/ Workspace dialog on startup"
//End_Object

Use asdbc.dg

Send Popup To (oASDBC(Self))