Skip to content

Commit

Permalink
TestMergeHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Jun 21, 2024
1 parent e471c7e commit f1ba94c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
31 changes: 16 additions & 15 deletions gengo/clang/invoke.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package clang

import (
"github.com/ddkwork/golibrary/stream"
"os"
"path/filepath"

"github.com/ddkwork/golibrary/stream"

"github.com/ddkwork/golibrary/mylog"
)

Expand All @@ -26,9 +27,9 @@ func (o *Options) ClangPath() string {
}

func (o *Options) ClangCommand(opt ...string) ([]byte, error) {
//cmd := exec.Command(o.ClangPath(), opt...)
//cmd.Args = append(cmd.Args, o.AdditionalParams...)
//cmd.Args = append(cmd.Args, o.Sources...)
// cmd := exec.Command(o.ClangPath(), opt...)
// cmd.Args = append(cmd.Args, o.AdditionalParams...)
// cmd.Args = append(cmd.Args, o.Sources...)
c := make([]string, 0)
c = append(c, o.ClangPath())
c = append(c, opt...)
Expand All @@ -37,14 +38,14 @@ func (o *Options) ClangCommand(opt ...string) ([]byte, error) {
return stream.RunCommandArgs(c...).Output.Bytes(), nil

// cmd.Args = append(cmd.Args, "2>&1")
//mylog.Trace("commands", strings.Join(cmd.Args, " "))
//Stdout := &bytes.Buffer{}
//Stderr := &bytes.Buffer{}
//cmd.Stdout = Stdout
//cmd.Stderr = Stderr
//mylog.CheckIgnore(cmd.Run())
//mylog.Check(Stderr.Bytes())
//return Stdout.Bytes(), nil
// mylog.Trace("commands", strings.Join(cmd.Args, " "))
// Stdout := &bytes.Buffer{}
// Stderr := &bytes.Buffer{}
// cmd.Stdout = Stdout
// cmd.Stderr = Stderr
// mylog.CheckIgnore(cmd.Run())
// mylog.Check(Stderr.Bytes())
// return Stdout.Bytes(), nil
}

func CreateAST(opt *Options) ([]byte, error) {
Expand All @@ -70,9 +71,9 @@ func CreateLayoutMap(opt *Options) ([]byte, error) {

func Parse(opt *Options) (ast Node, layout *LayoutMap, err error) {
stream.RunCommand("clang -E -dM " + opt.Sources[0] + " > macros.log") // 2>&1
//errg := &errgroup.Group{}
// errg := &errgroup.Group{}

//errg.Go(func() error {
// errg.Go(func() error {
res := mylog.Check2(CreateLayoutMap(opt))

stream.WriteTruncate("astLayout.log", res)
Expand All @@ -87,6 +88,6 @@ func Parse(opt *Options) (ast Node, layout *LayoutMap, err error) {
//return nil
//})

//mylog.Check(errg.Wait())
// mylog.Check(errg.Wait())
return ast, layout, nil
}
3 changes: 2 additions & 1 deletion gengo/gengo/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package gengo
import (
"bytes"
"fmt"
"github.com/ddkwork/golibrary/stream"
"go/ast"
"go/token"
"io"
"os"
"path/filepath"
"strconv"

"github.com/ddkwork/golibrary/stream"

"github.com/can1357/gengo/clang"
"github.com/dave/dst"
"github.com/dave/dst/decorator"
Expand Down
2 changes: 1 addition & 1 deletion gengo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (

require (
github.com/dave/dst v0.27.3
github.com/ddkwork/golibrary v0.0.66
github.com/ddkwork/golibrary v0.0.69
github.com/valyala/fastjson v1.6.4
golang.org/x/sync v0.7.0
)
2 changes: 2 additions & 0 deletions gengo/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/ddkwork/golibrary v0.0.65 h1:/WyTQzoVywAlCbNQgVhnoPXQ91NS6KclXvUBLc1Z
github.com/ddkwork/golibrary v0.0.65/go.mod h1:/55gYXaVeq2QkSTCaBk3sL0yzbg+DDPr9u3AvyFJblU=
github.com/ddkwork/golibrary v0.0.66 h1:8tsV0lUHZ0sfoqFTl6fF43GL4Kt+ttB0vyLc7LVbrEg=
github.com/ddkwork/golibrary v0.0.66/go.mod h1:/55gYXaVeq2QkSTCaBk3sL0yzbg+DDPr9u3AvyFJblU=
github.com/ddkwork/golibrary v0.0.69 h1:rNev68wjOxcivzZLq96Ct9oWtxP1I++0wKnWOZKIQqs=
github.com/ddkwork/golibrary v0.0.69/go.mod h1:/55gYXaVeq2QkSTCaBk3sL0yzbg+DDPr9u3AvyFJblU=
github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA=
github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.4

require (
github.com/ddkwork/app v0.0.0-20240620141554-df6a26375313
github.com/ddkwork/golibrary v0.0.66
github.com/ddkwork/golibrary v0.0.69
github.com/richardwilkes/unison v0.71.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ github.com/ddkwork/golibrary v0.0.65 h1:/WyTQzoVywAlCbNQgVhnoPXQ91NS6KclXvUBLc1Z
github.com/ddkwork/golibrary v0.0.65/go.mod h1:/55gYXaVeq2QkSTCaBk3sL0yzbg+DDPr9u3AvyFJblU=
github.com/ddkwork/golibrary v0.0.66 h1:8tsV0lUHZ0sfoqFTl6fF43GL4Kt+ttB0vyLc7LVbrEg=
github.com/ddkwork/golibrary v0.0.66/go.mod h1:/55gYXaVeq2QkSTCaBk3sL0yzbg+DDPr9u3AvyFJblU=
github.com/ddkwork/golibrary v0.0.69 h1:rNev68wjOxcivzZLq96Ct9oWtxP1I++0wKnWOZKIQqs=
github.com/ddkwork/golibrary v0.0.69/go.mod h1:/55gYXaVeq2QkSTCaBk3sL0yzbg+DDPr9u3AvyFJblU=
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ=
Expand Down

0 comments on commit f1ba94c

Please sign in to comment.