Project

General

Profile

Statistics
| Revision:

vdfsplat / AppSrc / cSplatApplication.pkg @ 62

History | View | Annotate | Download (2.69 KB)

1
//TH-Header
2
//*****************************************************************************************
3
// Copyright (c)  2015 Antwise Solutions
4
// All rights reserved.
5
//
6
// $FileName    : .\AppSrc\cSplatApplication.pkg
7
// $ProjectName : VdfSplat DataFlex Debugger
8
// $Authors     : Wil van Antwerpen
9
// $Created     : 09.14.2015  11:37
10
// $Type        : GPL v2
11
//
12
// Contents:
13
//  Read command line parameters
14
//
15
//*****************************************************************************************
16
//TH-RevisionStart
17
//TH-RevisionEnd
18
Use cApplication.pkg
19

    
20
Class cSplatApplication is a cApplication
21

    
22
  Procedure Construct_Object
23
    Forward Send Construct_Object
24
    Property String  psWorkspace      ""    // the filename and path of the current workspace's configuration file. e.g. "c:\projects\orders\orders.sws"
25
    Property String  psApplication    ""    // filename and path of the executable that you want to debug
26
    Property Boolean pbStartedFromCLI False // Debug was started from the command line.
27
  End_Procedure
28
  
29
  // Reads parameters from the command line.
30
  //
31
  // The .sws file (optional)
32
  // -x "c:\path\to\your\workspace\MyApp.sws"
33
  //
34
  // The application, points to the actual application to debug.
35
  // Needs to have a .dbg file present in order to debug.
36
  // -f "c:\path\to\your\workspace\Programs\MyApp.exe"
37
  //
38
  //
39
  //
40
  //
41
  //
42
  Procedure ReadCommandLineParameters
43
    Integer iArg
44
    Integer iCount
45
    String  sArgument
46
    String  sApplication
47
    String  sWorkspace
48
    Handle  hoCommandLine
49
    
50
    Get phoCommandLine To hoCommandLine
51
    If (hoCommandLine > 0) Begin
52
      Get CountOfArgs Of hoCommandLine To iCount
53
      For iArg From 1 To iCount
54
        Get Argument of hoCommandLine iArg To sArgument
55
        If (Left(sArgument,2)="-x") Begin
56
          If (iArg<iCount) Begin
57
            Increment iArg
58
            Get Argument of hoCommandLine iArg to sWorkspace
59
            Set psWorkspace To sWorkspace
60
          End
61
          Else Begin
62
            Send info_box "-x specified on command line, but <workspace>.sws file missing as parameter."
63
          End
64
        End
65
        If (left(sArgument,2)="-f") Begin
66
          If (iArg<iCount) Begin
67
            Increment iArg
68
            Get Argument of hoCommandLine iArg to sApplication
69
            Set psApplication    To sApplication
70
            Set pbStartedFromCLI To True
71
          End
72
          Else Begin
73
            Send info_box "-f specified on command line, but actual <application>.exe file missing as parameter."
74
          End
75
        End
76
      Loop
77
    End
78
  End_Procedure
79

    
80
  Procedure OnCreate
81
    Send ReadCommandLineParameters
82
  End_Procedure
83
End_Class