Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cppdap
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
cppdap
Commits
bb3dbcd2
Commit
bb3dbcd2
authored
Jun 10, 2020
by
Ben Clayton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update DAP protocol to 1.41.0
Update the script to include the DAP version in the file headers. Remove http file caching. Was never used.
parent
f0c28f93
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
186 additions
and
46 deletions
+186
-46
protocol.h
include/dap/protocol.h
+99
-4
protocol_events.cpp
src/protocol_events.cpp
+2
-0
protocol_requests.cpp
src/protocol_requests.cpp
+12
-0
protocol_response.cpp
src/protocol_response.cpp
+12
-0
protocol_types.cpp
src/protocol_types.cpp
+21
-0
protocol_gen.go
tools/protocol_gen/protocol_gen.go
+40
-42
No files found.
include/dap/protocol.h
View file @
bb3dbcd2
...
...
@@ -14,6 +14,8 @@
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version 1.41.0
#ifndef dap_protocol_h
#define dap_protocol_h
...
...
@@ -125,8 +127,8 @@ struct Source {
DAP_DECLARE_STRUCT_TYPEINFO
(
Source
);
// Information about a Breakpoint created in setBreakpoints
or
// setFunctionBreakpoints.
// Information about a Breakpoint created in setBreakpoints
,
// setFunctionBreakpoints
, setInstructionBreakpoints, or setDataBreakpoints
.
struct
Breakpoint
{
Breakpoint
();
~
Breakpoint
();
...
...
@@ -142,12 +144,17 @@ struct Breakpoint {
// An optional identifier for the breakpoint. It is needed if breakpoint
// events are used to update or remove breakpoints.
optional
<
integer
>
id
;
// An optional memory reference to where the breakpoint is set.
optional
<
string
>
instructionReference
;
// The start line of the actual range covered by the breakpoint.
optional
<
integer
>
line
;
// An optional message about the state of the breakpoint.
// This is shown to the user and can be used to explain why a breakpoint could
// not be verified.
optional
<
string
>
message
;
// An optional offset from the instruction reference.
// This can be negative.
optional
<
integer
>
offset
;
// The source where the breakpoint is located.
optional
<
Source
>
source
;
// If true breakpoint could be set (but not necessarily at the desired
...
...
@@ -374,6 +381,9 @@ struct Capabilities {
// The debug adapter supports breakpoints that break execution after a
// specified number of hits.
optional
<
boolean
>
supportsHitConditionalBreakpoints
;
// The debug adapter supports adding breakpoints based on instruction
// references.
optional
<
boolean
>
supportsInstructionBreakpoints
;
// The debug adapter supports the 'loadedSources' request.
optional
<
boolean
>
supportsLoadedSourcesRequest
;
// The debug adapter supports logpoints by interpreting the 'logMessage'
...
...
@@ -398,6 +408,9 @@ struct Capabilities {
optional
<
boolean
>
supportsStepBack
;
// The debug adapter supports the 'stepInTargets' request.
optional
<
boolean
>
supportsStepInTargetsRequest
;
// The debug adapter supports stepping granularities (argument 'granularity')
// for the stepping requests.
optional
<
boolean
>
supportsSteppingGranularity
;
// The debug adapter supports the 'terminate' request.
optional
<
boolean
>
supportsTerminateRequest
;
// The debug adapter supports the 'terminateThreads' request.
...
...
@@ -1094,6 +1107,9 @@ struct InitializeResponse : public Response {
// The debug adapter supports breakpoints that break execution after a
// specified number of hits.
optional
<
boolean
>
supportsHitConditionalBreakpoints
;
// The debug adapter supports adding breakpoints based on instruction
// references.
optional
<
boolean
>
supportsInstructionBreakpoints
;
// The debug adapter supports the 'loadedSources' request.
optional
<
boolean
>
supportsLoadedSourcesRequest
;
// The debug adapter supports logpoints by interpreting the 'logMessage'
...
...
@@ -1118,6 +1134,9 @@ struct InitializeResponse : public Response {
optional
<
boolean
>
supportsStepBack
;
// The debug adapter supports the 'stepInTargets' request.
optional
<
boolean
>
supportsStepInTargetsRequest
;
// The debug adapter supports stepping granularities (argument 'granularity')
// for the stepping requests.
optional
<
boolean
>
supportsSteppingGranularity
;
// The debug adapter supports the 'terminate' request.
optional
<
boolean
>
supportsTerminateRequest
;
// The debug adapter supports the 'terminateThreads' request.
...
...
@@ -1376,6 +1395,15 @@ struct NextResponse : public Response {
DAP_DECLARE_STRUCT_TYPEINFO
(
NextResponse
);
// The granularity of one 'step' in the stepping requests 'next', 'stepIn',
// 'stepOut', and 'stepBack'.
struct
SteppingGranularity
{
SteppingGranularity
();
~
SteppingGranularity
();
};
DAP_DECLARE_STRUCT_TYPEINFO
(
SteppingGranularity
);
// The request starts the debuggee to run again for one step.
// The debug adapter first sends the response and then a 'stopped' event (with
// reason 'step') after the step has completed.
...
...
@@ -1385,6 +1413,9 @@ struct NextRequest : public Request {
NextRequest
();
~
NextRequest
();
// Optional granularity to step. If no granularity is specified, a granularity
// of 'statement' is assumed.
optional
<
SteppingGranularity
>
granularity
;
// Execute 'next' for this thread.
integer
threadId
;
};
...
...
@@ -2063,6 +2094,61 @@ struct SetFunctionBreakpointsRequest : public Request {
DAP_DECLARE_STRUCT_TYPEINFO
(
SetFunctionBreakpointsRequest
);
// Response to 'setInstructionBreakpoints' request
struct
SetInstructionBreakpointsResponse
:
public
Response
{
SetInstructionBreakpointsResponse
();
~
SetInstructionBreakpointsResponse
();
// Information about the breakpoints. The array elements correspond to the
// elements of the 'breakpoints' array.
array
<
Breakpoint
>
breakpoints
;
};
DAP_DECLARE_STRUCT_TYPEINFO
(
SetInstructionBreakpointsResponse
);
// Properties of a breakpoint passed to the setInstructionBreakpoints request
struct
InstructionBreakpoint
{
InstructionBreakpoint
();
~
InstructionBreakpoint
();
// An optional expression for conditional breakpoints.
// It is only honored by a debug adapter if the capability
// 'supportsConditionalBreakpoints' is true.
optional
<
string
>
condition
;
// An optional expression that controls how many hits of the breakpoint are
// ignored. The backend is expected to interpret the expression as needed. The
// attribute is only honored by a debug adapter if the capability
// 'supportsHitConditionalBreakpoints' is true.
optional
<
string
>
hitCondition
;
// The instruction reference of the breakpoint.
// This should be a memory or instruction pointer reference from an
// EvaluateResponse, Variable, StackFrame, GotoTarget, or Breakpoint.
string
instructionReference
;
// An optional offset from the instruction reference.
// This can be negative.
optional
<
integer
>
offset
;
};
DAP_DECLARE_STRUCT_TYPEINFO
(
InstructionBreakpoint
);
// Replaces all existing instruction breakpoints. Typically, instruction
// breakpoints would be set from a diassembly window. To clear all instruction
// breakpoints, specify an empty array. When an instruction breakpoint is hit, a
// 'stopped' event (with reason 'instruction breakpoint') is generated. Clients
// should only call this request if the capability
// 'supportsInstructionBreakpoints' is true.
struct
SetInstructionBreakpointsRequest
:
public
Request
{
using
Response
=
SetInstructionBreakpointsResponse
;
SetInstructionBreakpointsRequest
();
~
SetInstructionBreakpointsRequest
();
// The instruction references of the breakpoints
array
<
InstructionBreakpoint
>
breakpoints
;
};
DAP_DECLARE_STRUCT_TYPEINFO
(
SetInstructionBreakpointsRequest
);
// Response to 'setVariable' request.
struct
SetVariableResponse
:
public
Response
{
SetVariableResponse
();
...
...
@@ -2263,6 +2349,9 @@ struct StepBackRequest : public Request {
StepBackRequest
();
~
StepBackRequest
();
// Optional granularity to step. If no granularity is specified, a granularity
// of 'statement' is assumed.
optional
<
SteppingGranularity
>
granularity
;
// Execute 'stepBack' for this thread.
integer
threadId
;
};
...
...
@@ -2292,6 +2381,9 @@ struct StepInRequest : public Request {
StepInRequest
();
~
StepInRequest
();
// Optional granularity to step. If no granularity is specified, a granularity
// of 'statement' is assumed.
optional
<
SteppingGranularity
>
granularity
;
// Optional id of the target to step into.
optional
<
integer
>
targetId
;
// Execute 'stepIn' for this thread.
...
...
@@ -2360,6 +2452,9 @@ struct StepOutRequest : public Request {
StepOutRequest
();
~
StepOutRequest
();
// Optional granularity to step. If no granularity is specified, a granularity
// of 'statement' is assumed.
optional
<
SteppingGranularity
>
granularity
;
// Execute 'stepOut' for this thread.
integer
threadId
;
};
...
...
@@ -2368,7 +2463,7 @@ DAP_DECLARE_STRUCT_TYPEINFO(StepOutRequest);
// The event indicates that the execution of the debuggee has stopped due to
// some condition. This can be caused by a break point previously set, a
// stepping
action
has completed, by executing a debugger statement etc.
// stepping
request
has completed, by executing a debugger statement etc.
struct
StoppedEvent
:
public
Event
{
StoppedEvent
();
~
StoppedEvent
();
...
...
@@ -2392,7 +2487,7 @@ struct StoppedEvent : public Event {
//
// May be one of the following enumeration values:
// 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function
// breakpoint', 'data breakpoint'
// breakpoint', 'data breakpoint'
, 'instruction breakpoint'
string
reason
;
// Additional information. E.g. if reason is 'exception', text contains the
// exception name. This string is shown in the UI.
...
...
src/protocol_events.cpp
View file @
bb3dbcd2
...
...
@@ -14,6 +14,8 @@
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version 1.41.0
#include "dap/protocol.h"
...
...
src/protocol_requests.cpp
View file @
bb3dbcd2
...
...
@@ -14,6 +14,8 @@
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version 1.41.0
#include "dap/protocol.h"
...
...
@@ -157,6 +159,7 @@ NextRequest::NextRequest() = default;
NextRequest
::~
NextRequest
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
NextRequest
,
"next"
,
DAP_FIELD
(
granularity
,
"granularity"
),
DAP_FIELD
(
threadId
,
"threadId"
));
PauseRequest
::
PauseRequest
()
=
default
;
...
...
@@ -242,6 +245,12 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(SetFunctionBreakpointsRequest,
"setFunctionBreakpoints"
,
DAP_FIELD
(
breakpoints
,
"breakpoints"
));
SetInstructionBreakpointsRequest
::
SetInstructionBreakpointsRequest
()
=
default
;
SetInstructionBreakpointsRequest
::~
SetInstructionBreakpointsRequest
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
SetInstructionBreakpointsRequest
,
"setInstructionBreakpoints"
,
DAP_FIELD
(
breakpoints
,
"breakpoints"
));
SetVariableRequest
::
SetVariableRequest
()
=
default
;
SetVariableRequest
::~
SetVariableRequest
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
SetVariableRequest
,
...
...
@@ -272,12 +281,14 @@ StepBackRequest::StepBackRequest() = default;
StepBackRequest
::~
StepBackRequest
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
StepBackRequest
,
"stepBack"
,
DAP_FIELD
(
granularity
,
"granularity"
),
DAP_FIELD
(
threadId
,
"threadId"
));
StepInRequest
::
StepInRequest
()
=
default
;
StepInRequest
::~
StepInRequest
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
StepInRequest
,
"stepIn"
,
DAP_FIELD
(
granularity
,
"granularity"
),
DAP_FIELD
(
targetId
,
"targetId"
),
DAP_FIELD
(
threadId
,
"threadId"
));
...
...
@@ -291,6 +302,7 @@ StepOutRequest::StepOutRequest() = default;
StepOutRequest
::~
StepOutRequest
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
StepOutRequest
,
"stepOut"
,
DAP_FIELD
(
granularity
,
"granularity"
),
DAP_FIELD
(
threadId
,
"threadId"
));
TerminateRequest
::
TerminateRequest
()
=
default
;
...
...
src/protocol_response.cpp
View file @
bb3dbcd2
...
...
@@ -14,6 +14,8 @@
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version 1.41.0
#include "dap/protocol.h"
...
...
@@ -134,6 +136,7 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(
DAP_FIELD
(
supportsGotoTargetsRequest
,
"supportsGotoTargetsRequest"
),
DAP_FIELD
(
supportsHitConditionalBreakpoints
,
"supportsHitConditionalBreakpoints"
),
DAP_FIELD
(
supportsInstructionBreakpoints
,
"supportsInstructionBreakpoints"
),
DAP_FIELD
(
supportsLoadedSourcesRequest
,
"supportsLoadedSourcesRequest"
),
DAP_FIELD
(
supportsLogPoints
,
"supportsLogPoints"
),
DAP_FIELD
(
supportsModulesRequest
,
"supportsModulesRequest"
),
...
...
@@ -144,6 +147,7 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(
DAP_FIELD
(
supportsSetVariable
,
"supportsSetVariable"
),
DAP_FIELD
(
supportsStepBack
,
"supportsStepBack"
),
DAP_FIELD
(
supportsStepInTargetsRequest
,
"supportsStepInTargetsRequest"
),
DAP_FIELD
(
supportsSteppingGranularity
,
"supportsSteppingGranularity"
),
DAP_FIELD
(
supportsTerminateRequest
,
"supportsTerminateRequest"
),
DAP_FIELD
(
supportsTerminateThreadsRequest
,
"supportsTerminateThreadsRequest"
),
...
...
@@ -240,6 +244,14 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(SetFunctionBreakpointsResponse,
""
,
DAP_FIELD
(
breakpoints
,
"breakpoints"
));
SetInstructionBreakpointsResponse
::
SetInstructionBreakpointsResponse
()
=
default
;
SetInstructionBreakpointsResponse
::~
SetInstructionBreakpointsResponse
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
SetInstructionBreakpointsResponse
,
""
,
DAP_FIELD
(
breakpoints
,
"breakpoints"
));
SetVariableResponse
::
SetVariableResponse
()
=
default
;
SetVariableResponse
::~
SetVariableResponse
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
SetVariableResponse
,
...
...
src/protocol_types.cpp
View file @
bb3dbcd2
...
...
@@ -14,6 +14,8 @@
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version 1.41.0
#include "dap/protocol.h"
...
...
@@ -51,8 +53,11 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(Breakpoint,
DAP_FIELD
(
endColumn
,
"endColumn"
),
DAP_FIELD
(
endLine
,
"endLine"
),
DAP_FIELD
(
id
,
"id"
),
DAP_FIELD
(
instructionReference
,
"instructionReference"
),
DAP_FIELD
(
line
,
"line"
),
DAP_FIELD
(
message
,
"message"
),
DAP_FIELD
(
offset
,
"offset"
),
DAP_FIELD
(
source
,
"source"
),
DAP_FIELD
(
verified
,
"verified"
));
...
...
@@ -112,6 +117,7 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(
DAP_FIELD
(
supportsGotoTargetsRequest
,
"supportsGotoTargetsRequest"
),
DAP_FIELD
(
supportsHitConditionalBreakpoints
,
"supportsHitConditionalBreakpoints"
),
DAP_FIELD
(
supportsInstructionBreakpoints
,
"supportsInstructionBreakpoints"
),
DAP_FIELD
(
supportsLoadedSourcesRequest
,
"supportsLoadedSourcesRequest"
),
DAP_FIELD
(
supportsLogPoints
,
"supportsLogPoints"
),
DAP_FIELD
(
supportsModulesRequest
,
"supportsModulesRequest"
),
...
...
@@ -122,6 +128,7 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(
DAP_FIELD
(
supportsSetVariable
,
"supportsSetVariable"
),
DAP_FIELD
(
supportsStepBack
,
"supportsStepBack"
),
DAP_FIELD
(
supportsStepInTargetsRequest
,
"supportsStepInTargetsRequest"
),
DAP_FIELD
(
supportsSteppingGranularity
,
"supportsSteppingGranularity"
),
DAP_FIELD
(
supportsTerminateRequest
,
"supportsTerminateRequest"
),
DAP_FIELD
(
supportsTerminateThreadsRequest
,
"supportsTerminateThreadsRequest"
),
...
...
@@ -230,6 +237,10 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(Module,
DAP_FIELD
(
symbolStatus
,
"symbolStatus"
),
DAP_FIELD
(
version
,
"version"
));
SteppingGranularity
::
SteppingGranularity
()
=
default
;
SteppingGranularity
::~
SteppingGranularity
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
SteppingGranularity
,
""
);
Scope
::
Scope
()
=
default
;
Scope
::~
Scope
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
Scope
,
...
...
@@ -288,6 +299,16 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(FunctionBreakpoint,
DAP_FIELD
(
hitCondition
,
"hitCondition"
),
DAP_FIELD
(
name
,
"name"
));
InstructionBreakpoint
::
InstructionBreakpoint
()
=
default
;
InstructionBreakpoint
::~
InstructionBreakpoint
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
InstructionBreakpoint
,
""
,
DAP_FIELD
(
condition
,
"condition"
),
DAP_FIELD
(
hitCondition
,
"hitCondition"
),
DAP_FIELD
(
instructionReference
,
"instructionReference"
),
DAP_FIELD
(
offset
,
"offset"
));
StackFrame
::
StackFrame
()
=
default
;
StackFrame
::~
StackFrame
()
=
default
;
DAP_IMPLEMENT_STRUCT_TYPEINFO
(
StackFrame
,
...
...
tools/protocol_gen/protocol_gen.go
View file @
bb3dbcd2
...
...
@@ -33,29 +33,29 @@ import (
"strings"
)
var
(
cache
=
flag
.
String
(
"cache"
,
""
,
"File cache of the .json schema"
)
)
const
(
jsonURL
=
"https://raw.githubusercontent.com/microsoft/vscode-debugadapter-node/master/debugProtocol.json"
protocolURL
=
"https://raw.githubusercontent.com/microsoft/vscode-debugadapter-node/master/debugProtocol.json"
packageURL
=
"https://raw.githubusercontent.com/microsoft/vscode-debugadapter-node/master/protocol/package.json"
versionTag
=
"${version}"
commonPrologue
=
`// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version ${version}
`
headerPrologue
=
commonPrologue
+
`
...
...
@@ -527,18 +527,20 @@ type cppFilePaths map[structType]string
type
cppFiles
map
[
structType
]
*
os
.
File
func
run
()
error
{
data
,
err
:=
loadJSONFile
()
if
err
!=
nil
{
pkg
:=
struct
{
Version
string
`json:"version"`
}{}
if
err
:=
loadJSONFile
(
packageURL
,
&
pkg
);
err
!=
nil
{
return
err
}
r
:=
root
{}
d
:=
json
.
NewDecoder
(
bytes
.
NewReader
(
data
))
if
err
:=
d
.
Decode
(
&
r
);
err
!=
nil
{
protocol
:=
root
{}
if
err
:=
loadJSONFile
(
protocolURL
,
&
protocol
);
err
!=
nil
{
return
err
}
hPath
,
cppPaths
:=
outputPaths
()
if
err
:=
emitFiles
(
&
r
,
hPath
,
cppPaths
);
err
!=
nil
{
if
err
:=
emitFiles
(
&
protocol
,
hPath
,
cppPaths
,
pkg
.
Version
);
err
!=
nil
{
return
err
}
...
...
@@ -551,12 +553,14 @@ func run() error {
return
err
}
}
}
else
{
fmt
.
Printf
(
"clang-format not found on PATH. Please format before committing."
)
}
return
nil
}
func
emitFiles
(
r
*
root
,
hPath
string
,
cppPaths
map
[
structType
]
string
)
error
{
func
emitFiles
(
r
*
root
,
hPath
string
,
cppPaths
map
[
structType
]
string
,
version
string
)
error
{
h
,
err
:=
os
.
Create
(
hPath
)
if
err
!=
nil
{
return
err
...
...
@@ -572,9 +576,9 @@ func emitFiles(r *root, hPath string, cppPaths map[structType]string) error {
defer
f
.
Close
()
}
h
.
WriteString
(
headerPrologue
)
h
.
WriteString
(
strings
.
ReplaceAll
(
headerPrologue
,
versionTag
,
version
)
)
for
_
,
f
:=
range
cppFiles
{
f
.
WriteString
(
cppPrologue
)
f
.
WriteString
(
strings
.
ReplaceAll
(
cppPrologue
,
versionTag
,
version
)
)
}
structs
,
err
:=
buildStructs
(
r
)
...
...
@@ -618,25 +622,19 @@ func emitFiles(r *root, hPath string, cppPaths map[structType]string) error {
return
nil
}
func
loadJSONFile
()
([]
byte
,
error
)
{
if
*
cache
!=
""
{
data
,
err
:=
ioutil
.
ReadFile
(
*
cache
)
if
err
==
nil
{
return
data
,
nil
}
}
resp
,
err
:=
http
.
Get
(
jsonURL
)
func
loadJSONFile
(
url
string
,
obj
interface
{})
error
{
resp
,
err
:=
http
.
Get
(
url
)
if
err
!=
nil
{
return
nil
,
err
return
err
}
data
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
nil
,
err
return
err
}
if
*
cache
!=
""
{
ioutil
.
WriteFile
(
*
cache
,
data
,
0777
)
if
err
:=
json
.
NewDecoder
(
bytes
.
NewReader
(
data
))
.
Decode
(
obj
);
err
!=
nil
{
return
err
}
return
data
,
nil
return
nil
}
func
outputPaths
()
(
string
,
cppFilePaths
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment