Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
c23c620d
Commit
c23c620d
authored
Jul 13, 2015
by
Maor Itzkovitch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applied struct parameter fix to Go and Python generated classes
parent
147fbb42
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
12 deletions
+12
-12
idl_gen_go.cpp
src/idl_gen_go.cpp
+2
-2
idl_gen_python.cpp
src/idl_gen_python.cpp
+3
-3
Vec3.go
tests/MyGame/Example/Vec3.go
+3
-3
Vec3.py
tests/MyGame/Example/Vec3.py
+3
-3
generate_code.sh
tests/generate_code.sh
+1
-1
No files found.
src/idl_gen_go.cpp
View file @
c23c620d
...
@@ -332,7 +332,7 @@ static void StructBuilderArgs(const StructDef &struct_def,
...
@@ -332,7 +332,7 @@ static void StructBuilderArgs(const StructDef &struct_def,
// don't clash, and to make it obvious these arguments are constructing
// don't clash, and to make it obvious these arguments are constructing
// a nested struct, prefix the name with the struct name.
// a nested struct, prefix the name with the struct name.
StructBuilderArgs
(
*
field
.
value
.
type
.
struct_def
,
StructBuilderArgs
(
*
field
.
value
.
type
.
struct_def
,
(
field
.
value
.
type
.
struct_def
->
name
+
"_"
).
c_str
(),
(
nameprefix
+
(
field
.
name
+
"_"
)
).
c_str
(),
code_ptr
);
code_ptr
);
}
else
{
}
else
{
std
::
string
&
code
=
*
code_ptr
;
std
::
string
&
code
=
*
code_ptr
;
...
@@ -365,7 +365,7 @@ static void StructBuilderBody(const StructDef &struct_def,
...
@@ -365,7 +365,7 @@ static void StructBuilderBody(const StructDef &struct_def,
code
+=
" builder.Pad("
+
NumToString
(
field
.
padding
)
+
")
\n
"
;
code
+=
" builder.Pad("
+
NumToString
(
field
.
padding
)
+
")
\n
"
;
if
(
IsStruct
(
field
.
value
.
type
))
{
if
(
IsStruct
(
field
.
value
.
type
))
{
StructBuilderBody
(
*
field
.
value
.
type
.
struct_def
,
StructBuilderBody
(
*
field
.
value
.
type
.
struct_def
,
(
field
.
value
.
type
.
struct_def
->
name
+
"_"
).
c_str
(),
(
nameprefix
+
(
field
.
name
+
"_"
)
).
c_str
(),
code_ptr
);
code_ptr
);
}
else
{
}
else
{
code
+=
" builder.Prepend"
+
GenMethod
(
field
)
+
"("
;
code
+=
" builder.Prepend"
+
GenMethod
(
field
)
+
"("
;
...
...
src/idl_gen_python.cpp
View file @
c23c620d
...
@@ -307,9 +307,9 @@ static void StructBuilderArgs(const StructDef &struct_def,
...
@@ -307,9 +307,9 @@ static void StructBuilderArgs(const StructDef &struct_def,
if
(
IsStruct
(
field
.
value
.
type
))
{
if
(
IsStruct
(
field
.
value
.
type
))
{
// Generate arguments for a struct inside a struct. To ensure names
// Generate arguments for a struct inside a struct. To ensure names
// don't clash, and to make it obvious these arguments are constructing
// don't clash, and to make it obvious these arguments are constructing
// a nested struct, prefix the name with the
struct
name.
// a nested struct, prefix the name with the
field
name.
StructBuilderArgs
(
*
field
.
value
.
type
.
struct_def
,
StructBuilderArgs
(
*
field
.
value
.
type
.
struct_def
,
(
field
.
value
.
type
.
struct_def
->
name
+
"_"
).
c_str
(),
(
nameprefix
+
(
field
.
name
+
"_"
)
).
c_str
(),
code_ptr
);
code_ptr
);
}
else
{
}
else
{
std
::
string
&
code
=
*
code_ptr
;
std
::
string
&
code
=
*
code_ptr
;
...
@@ -341,7 +341,7 @@ static void StructBuilderBody(const StructDef &struct_def,
...
@@ -341,7 +341,7 @@ static void StructBuilderBody(const StructDef &struct_def,
code
+=
" builder.Pad("
+
NumToString
(
field
.
padding
)
+
")
\n
"
;
code
+=
" builder.Pad("
+
NumToString
(
field
.
padding
)
+
")
\n
"
;
if
(
IsStruct
(
field
.
value
.
type
))
{
if
(
IsStruct
(
field
.
value
.
type
))
{
StructBuilderBody
(
*
field
.
value
.
type
.
struct_def
,
StructBuilderBody
(
*
field
.
value
.
type
.
struct_def
,
(
field
.
value
.
type
.
struct_def
->
name
+
"_"
).
c_str
(),
(
nameprefix
+
(
field
.
name
+
"_"
)
).
c_str
(),
code_ptr
);
code_ptr
);
}
else
{
}
else
{
code
+=
" builder.Prepend"
+
GenMethod
(
field
)
+
"("
;
code
+=
" builder.Prepend"
+
GenMethod
(
field
)
+
"("
;
...
...
tests/MyGame/Example/Vec3.go
View file @
c23c620d
...
@@ -27,13 +27,13 @@ func (rcv *Vec3) Test3(obj *Test) *Test {
...
@@ -27,13 +27,13 @@ func (rcv *Vec3) Test3(obj *Test) *Test {
return
obj
return
obj
}
}
func
CreateVec3
(
builder
*
flatbuffers
.
Builder
,
x
float32
,
y
float32
,
z
float32
,
test1
float64
,
test2
int8
,
Test_a
int16
,
Test
_b
int8
)
flatbuffers
.
UOffsetT
{
func
CreateVec3
(
builder
*
flatbuffers
.
Builder
,
x
float32
,
y
float32
,
z
float32
,
test1
float64
,
test2
int8
,
test3_a
int16
,
test3
_b
int8
)
flatbuffers
.
UOffsetT
{
builder
.
Prep
(
16
,
32
)
builder
.
Prep
(
16
,
32
)
builder
.
Pad
(
2
)
builder
.
Pad
(
2
)
builder
.
Prep
(
2
,
4
)
builder
.
Prep
(
2
,
4
)
builder
.
Pad
(
1
)
builder
.
Pad
(
1
)
builder
.
PrependInt8
(
Test
_b
)
builder
.
PrependInt8
(
test3
_b
)
builder
.
PrependInt16
(
Test
_a
)
builder
.
PrependInt16
(
test3
_a
)
builder
.
Pad
(
1
)
builder
.
Pad
(
1
)
builder
.
PrependInt8
(
test2
)
builder
.
PrependInt8
(
test2
)
builder
.
PrependFloat64
(
test1
)
builder
.
PrependFloat64
(
test1
)
...
...
tests/MyGame/Example/Vec3.py
View file @
c23c620d
...
@@ -27,13 +27,13 @@ class Vec3(object):
...
@@ -27,13 +27,13 @@ class Vec3(object):
return
obj
return
obj
def
CreateVec3
(
builder
,
x
,
y
,
z
,
test1
,
test2
,
Test_a
,
Test
_b
):
def
CreateVec3
(
builder
,
x
,
y
,
z
,
test1
,
test2
,
test3_a
,
test3
_b
):
builder
.
Prep
(
16
,
32
)
builder
.
Prep
(
16
,
32
)
builder
.
Pad
(
2
)
builder
.
Pad
(
2
)
builder
.
Prep
(
2
,
4
)
builder
.
Prep
(
2
,
4
)
builder
.
Pad
(
1
)
builder
.
Pad
(
1
)
builder
.
PrependInt8
(
Test
_b
)
builder
.
PrependInt8
(
test3
_b
)
builder
.
PrependInt16
(
Test
_a
)
builder
.
PrependInt16
(
test3
_a
)
builder
.
Pad
(
1
)
builder
.
Pad
(
1
)
builder
.
PrependInt8
(
test2
)
builder
.
PrependInt8
(
test2
)
builder
.
PrependFloat64
(
test1
)
builder
.
PrependFloat64
(
test1
)
...
...
tests/generate_code.sh
View file @
c23c620d
../flatc
-c
-j
-n
-g
-b
--gen-mutable
--no-includes
monster_test.fbs monsterdata_test.json
../flatc
-c
-j
-n
-g
-b
-
p
-
-gen-mutable
--no-includes
monster_test.fbs monsterdata_test.json
../flatc
-b
--schema
monster_test.fbs
../flatc
-b
--schema
monster_test.fbs
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