Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
Update to latest gore
Browse files Browse the repository at this point in the history
  • Loading branch information
TcM1911 committed Oct 23, 2021
1 parent 408fb79 commit fc99821
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 71 deletions.
8 changes: 0 additions & 8 deletions cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,8 @@ func convertPackages(pkgs []*gore.Package, arena *arena) *C.struct_packages {
for j, m := range p.Methods {
cf := (*C.struct_function)(arena.malloc(C.sizeof_struct_function))
cf.name = arena.cstring(m.Name)
cf.srcLineLength = C.int(m.SrcLineLength)
cf.srcLineStart = C.int(m.SrcLineStart)
cf.srcLineEnd = C.int(m.SrcLineEnd)
cf.offset = C.ulonglong(m.Offset)
cf.end = C.ulonglong(m.End)
cf.fileName = arena.cstring(m.Filename)
cf.packageName = arena.cstring(m.PackageName)
cm := (*C.struct_method)(arena.malloc(C.sizeof_struct_method))
cm.receiver = arena.cstring(m.Receiver)
Expand All @@ -334,12 +330,8 @@ func convertPackages(pkgs []*gore.Package, arena *arena) *C.struct_packages {
func convertFunction(f *gore.Function, arena *arena) *C.struct_function {
cf := (*C.struct_function)(arena.malloc(C.sizeof_struct_function))
cf.name = arena.cstring(f.Name)
cf.srcLineLength = C.int(f.SrcLineLength)
cf.srcLineStart = C.int(f.SrcLineStart)
cf.srcLineEnd = C.int(f.SrcLineEnd)
cf.offset = C.ulonglong(f.Offset)
cf.end = C.ulonglong(f.End)
cf.fileName = arena.cstring(f.Filename)
cf.packageName = arena.cstring(f.PackageName)
return cf
}
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module github.com/goretk/libgore

go 1.13
go 1.17

require github.com/goretk/gore v0.10.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/goretk/gore v0.8.18
github.com/kr/pretty v0.1.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/mod v0.5.1 // indirect
)
29 changes: 20 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/goretk/gore v0.8.18 h1:o+FnKF1c0ukPS14dw16BN34X77siMZibLpb4fyqxFOs=
github.com/goretk/gore v0.8.18/go.mod h1:pswwr4VKZRoqrVzlvEU53Tg9i/RTPCf9ipkfP0jP9eE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/goretk/gore v0.10.0 h1:ewk402Z0cBTSe+DB5ooBa8CsEAnEWE+E8cbJS7heqyM=
github.com/goretk/gore v0.10.0/go.mod h1:cQa3kuurmyYBGPAlfeENhSm5tjdgoLP6Fs3jqJM8ayU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
golang.org/x/arch v0.0.0-20201207233722-1e68675e650f/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
105 changes: 55 additions & 50 deletions structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,80 @@
// Use of this source code is governed by the license that
// can be found in the LICENSE file.

struct compilerVersion{
char* name;
char* sha;
char* timestamp;
struct compilerVersion
{
char *name;
char *sha;
char *timestamp;
};

struct function {
char* name;
int srcLineLength;
int srcLineStart;
int srcLineEnd;
struct function
{
char *name;
unsigned long long offset;
unsigned long long end;
char* fileName;
char* packageName;
char *packageName;
};

struct method {
char* receiver;
struct function* function;
struct method
{
char *receiver;
struct function *function;
};

struct package {
char* name;
char* filepath;
struct function** function;
struct method** method;
struct package
{
char *name;
char *filepath;
struct function **function;
struct method **method;
unsigned long numFuncs;
unsigned long numMeths;
};

struct packages {
struct package** packages;
struct packages
{
struct package **packages;
unsigned long length;
};

struct method_type {
char* name;
struct type* gotype;
unsigned long long ifaceCallOffset;
unsigned long long funcCallOffset;
struct method_type
{
char *name;
struct type *gotype;
unsigned long long ifaceCallOffset;
unsigned long long funcCallOffset;
};

struct methods_type {
struct method_type** methods;
unsigned long length;
struct methods_type
{
struct method_type **methods;
unsigned long length;
};

struct type {
unsigned int kind;
char* name;
unsigned long long addr;
unsigned long long ptrResolved;
char* packagePath;
struct types* fields;
char* fieldName;
char* fieldTag;
int fieldAnon;
struct type* element;
int length;
int chanDir;
struct type* key;
struct types* funcArgs;
struct types* funcReturns;
int isVariadic;
struct methods_type* methods;
struct type
{
unsigned int kind;
char *name;
unsigned long long addr;
unsigned long long ptrResolved;
char *packagePath;
struct types *fields;
char *fieldName;
char *fieldTag;
int fieldAnon;
struct type *element;
int length;
int chanDir;
struct type *key;
struct types *funcArgs;
struct types *funcReturns;
int isVariadic;
struct methods_type *methods;
};

struct types {
struct type** types;
unsigned long length;
struct types
{
struct type **types;
unsigned long length;
};

0 comments on commit fc99821

Please sign in to comment.