提交 26a1f388 编写于 作者: R Richard Wilkes

Update to CEF v3.3626.1891.g52be333 (2/15/2019)

上级 240376d9
......@@ -83,8 +83,12 @@ func gocef_resource_handler_process_request(self *C.cef_resource_handler_t, requ
// (0) or the specified number of bytes have been read. Use the |response|
// object to set the mime type, http status code and other optional header
// values. To redirect the request to a new URL set |redirectUrl| to the new
// URL. If an error occured while setting up the request you can call
// set_error() on |response| to indicate the error condition.
// URL. |redirectUrl| can be either a relative or fully qualified URL. It is
// also possible to set |response| to a redirect http status code and pass the
// new URL via a Location header. Likewise with |redirectUrl| it is valid to
// set a relative or fully qualified URL as the Location header value. If an
// error occured while setting up the request you can call set_error() on
// |response| to indicate the error condition.
func (d *ResourceHandler) GetResponseHeaders(response *Response, response_length *int64, redirectUrl *string) {
lookupResourceHandlerProxy(d.Base()).GetResponseHeaders(d, response, response_length, redirectUrl)
}
......
......@@ -127,9 +127,10 @@ type Settings struct {
LogFile string
// LogSeverity (log_severity)
// The log severity. Only messages of this severity level or higher will be
// logged. Also configurable using the "log-severity" command-line switch with
// a value of "verbose", "info", "warning", "error", "error-report" or
// "disable".
// logged. When set to DISABLE no messages will be written to the log file,
// but FATAL messages will still be output to stderr. Also configurable using
// the "log-severity" command-line switch with a value of "verbose", "info",
// "warning", "error", "fatal" or "disable".
LogSeverity LogSeverity
// JavascriptFlags (javascript_flags)
// Custom flags that will be used when initializing the V8 JavaScript engine.
......
......@@ -8,7 +8,7 @@ import (
// WindowInfo (cef_window_info_t) - Mac-specific variant
// Class representing window information.
type WindowInfo struct {
type WindowInfo struct { //nolint:maligned
// WindowName (window_name)
WindowName string
// X (x)
......
......@@ -644,7 +644,10 @@ const (
LogseverityWarning LogSeverity = ((LogseverityVerbose) + 1) + 1 // LOGSEVERITY_WARNING
// DEBUG logging.
LogseverityError LogSeverity = (((LogseverityVerbose) + 1) + 1) + 1 // LOGSEVERITY_ERROR
// Completely disable logging.
// DEBUG logging.
LogseverityFatal LogSeverity = ((((LogseverityVerbose) + 1) + 1) + 1) + 1 // LOGSEVERITY_FATAL
// Disable logging to file for all messages, and to stderr for messages with
// severity less than FATAL.
LogseverityDisable LogSeverity = 99 // LOGSEVERITY_DISABLE
)
......
......@@ -367,9 +367,8 @@ func ListValueCreate() *ListValue {
// have a visible frame at all times, center alignment, additional padding and a
// default minimum size of 70x33 DIP. If |with_frame| is false (0) the button
// will only have a visible frame on hover/press, left alignment, less padding
// and no default minimum size. If |with_menu_marker| is true (1) a menu marker
// will be added to the button.
func MenuButtonCreate(delegate *MenuButtonDelegate, text string, with_frame, with_menu_marker int32) *MenuButton {
// and no default minimum size.
func MenuButtonCreate(delegate *MenuButtonDelegate, text string, with_frame int32) *MenuButton {
var delegate_ *C.cef_menu_button_delegate_t
if delegate != nil {
delegate_ = delegate.toNative()
......@@ -379,7 +378,7 @@ func MenuButtonCreate(delegate *MenuButtonDelegate, text string, with_frame, wit
defer func() {
C.cef_string_userfree_free(text_)
}()
return (*MenuButton)(C.cef_menu_button_create(delegate_, (*C.cef_string_t)(text_), C.int(with_frame), C.int(with_menu_marker)))
return (*MenuButton)(C.cef_menu_button_create(delegate_, (*C.cef_string_t)(text_), C.int(with_frame)))
}
// MenuModelCreate (cef_menu_model_create from include/capi/cef_menu_model_capi.h)
......
module github.com/richardwilkes/cef
require (
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 // indirect
github.com/richardwilkes/toolbox v1.1.3
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/sys v0.0.0-20190114130336-2be517255631 // indirect
)
require github.com/richardwilkes/toolbox v1.1.6
......@@ -8,23 +8,18 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
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/pkg/term v0.0.0-20181116001808-27bbf2edb814 h1:qWlKm6sU/AyVAgBC1Pg1uuY/X/p4lNYG7t4v8/f4FJE=
github.com/pkg/term v0.0.0-20181116001808-27bbf2edb814/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ=
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 h1:A7GG7zcGjl3jqAqGPmcNjd/D9hzL95SuoOQAaFNdLU0=
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ=
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/richardwilkes/toolbox v1.1.3 h1:alQu+xxpfWKpzlxAkYevRY40IiD8U2aegJ6USDELpGw=
github.com/richardwilkes/toolbox v1.1.3/go.mod h1:e/y5ODoUj7gDs7Rrovgn7g4btCm/eA7IALsVGwAW9hg=
github.com/richardwilkes/toolbox v1.1.6 h1:PB6UljMWRB4bxM5bCbblOX+ybnpcjnV6qY5zcAheRUQ=
github.com/richardwilkes/toolbox v1.1.6/go.mod h1:edL6Olij9w158Mdr9kkoRGGAokwDrlMPjIJ+jkRmdG4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/sys v0.0.0-20181212120007-b05ddf57801d h1:G59MrP9Qg6bymPjN3yGmqnmuCEH1h0eFP8zpRpl1RiU=
golang.org/x/sys v0.0.0-20181212120007-b05ddf57801d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190114130336-2be517255631 h1:g/5trXm6f9Tm+ochb21RlFNnF63lt+elB9hVBqtPu5Y=
golang.org/x/sys v0.0.0-20190114130336-2be517255631/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190220154126-629670e5acc5 h1:3Nsfe5Xa1wTt01QxlAFIY5j9ycDtS+d7mhvI8ZY5bn0=
golang.org/x/sys v0.0.0-20190220154126-629670e5acc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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=
......
......@@ -8,6 +8,8 @@ import (
"github.com/richardwilkes/toolbox/log/jot"
)
const baseFieldName = "base"
type field struct {
Owner *structDef
Var *variable
......@@ -89,7 +91,7 @@ func (f *field) CallFunctionPointer() string {
func (f *field) ReturnField() string {
var buffer strings.Builder
buffer.WriteString("return ")
if f.Var.Name == "base" {
if f.Var.Name == baseFieldName {
if sdef, exists := sdefsMap[f.Var.BaseType]; exists && !sdef.isClassEquivalent() {
buffer.WriteString("(&d.base).toGo()")
return buffer.String()
......@@ -101,7 +103,7 @@ func (f *field) ReturnField() string {
buffer.WriteString(f.Var.GoType)
}
buffer.WriteString("(")
if f.Var.Name == "base" {
if f.Var.Name == baseFieldName {
buffer.WriteString("&")
}
fmt.Fprintf(&buffer, "d.%s)", f.Var.Name)
......@@ -114,16 +116,16 @@ func (f *field) ToNative() string {
fmt.Fprintf(&buffer, "d.%s.toNative(&native.%s)", f.Var.GoName, f.Var.Name)
} else {
switch f.Var.CType {
case "void *":
case voidPtrType:
fmt.Fprintf(&buffer, "native.%s = d.%s", f.Var.Name, f.Var.GoName)
case "cef_string_t":
case cefStringType:
fmt.Fprintf(&buffer, `setCEFStr(d.%s, &native.%s)`, f.Var.GoName, f.Var.Name)
case "cef_string_t *":
case cefStringPtrType:
fmt.Fprintf(&buffer, `setCEFStr(d.%s, native.%s)`, f.Var.GoName, f.Var.Name)
default:
fmt.Fprintf(&buffer, "native.%s = ", f.Var.Name)
if i := strings.Index(f.Var.CType, " "); i != -1 {
if f.Var.Name == "base" {
if f.Var.Name == baseFieldName {
fmt.Fprintf(&buffer, "*(%sC.%s)(unsafe.Pointer(d.Base))", f.Var.CType[i+1:], f.Var.CType[:i])
} else {
fmt.Fprintf(&buffer, "(%sC.%s)(d.%s)", f.Var.CType[i+1:], f.Var.CType[:i], f.Var.GoName)
......@@ -143,14 +145,14 @@ func (f *field) IntoGo() string {
} else {
fmt.Fprintf(&buffer, "d.%s = ", f.Var.GoName)
switch f.Var.CType {
case "void *":
case voidPtrType:
fmt.Fprintf(&buffer, "n.%s", f.Var.Name)
case "cef_string_t":
case cefStringType:
fmt.Fprintf(&buffer, "cefstrToString(&n.%s)", f.Var.Name)
case "cef_string_t *":
case cefStringPtrType:
fmt.Fprintf(&buffer, "cefstrToString(n.%s)", f.Var.Name)
default:
if f.Var.Name == "base" {
if f.Var.Name == baseFieldName {
fmt.Fprintf(&buffer, "(%s)(&n.base)", f.Var.GoType)
} else {
if strings.HasPrefix(f.Var.GoType, "*") {
......@@ -247,7 +249,7 @@ func (f *field) CallbackParams() string {
buffer.WriteString(", ")
}
buffer.WriteString(p.Name)
if p.BaseType == "void" {
if p.BaseType == voidType {
switch p.Ptrs {
case "":
case "*":
......
......@@ -54,27 +54,28 @@ func (f *funcDef) Body() string {
return buffer.String()
}
func prepGoVarsForC(vars []*variable) (string, []string) {
func prepGoVarsForC(vars []*variable) (prep string, names []string) {
var buffer strings.Builder
names := make([]string, len(vars))
names = make([]string, len(vars))
for i, p := range vars {
names[i] = p.Name
if p.BaseType == "cef_string_t" {
switch {
case p.BaseType == cefStringType:
names[i] = p.Name + "_"
fmt.Fprintf(&buffer, "%s_ := C.cef_string_userfree_alloc()\n", p.Name)
ptrs := p.Ptrs
if !p.HadConst && p.paramGoType() == "*string" {
if !p.HadConst && p.paramGoType() == stringPtrGoType {
ptrs = "*"
} else if len(ptrs) > 0 {
ptrs = ptrs[1:]
}
fmt.Fprintf(&buffer, "setCEFStr(%[1]s%[2]s, %[2]s_)\n", ptrs, p.Name)
buffer.WriteString("defer func() {\n")
if !p.HadConst && p.paramGoType() == "*string" {
if !p.HadConst && p.paramGoType() == stringPtrGoType {
fmt.Fprintf(&buffer, "*%[1]s = cefstrToString(%[1]s_)\n", p.Name)
}
fmt.Fprintf(&buffer, "C.cef_string_userfree_free(%s_)\n}()\n", p.Name)
} else if p.Ptrs == "**" {
case p.Ptrs == "**":
if sdef, exists := sdefsMap[p.BaseType]; exists {
names[i] = p.Name + "_"
fmt.Fprintf(&buffer, "%[1]s_ := (*%[1]s).toNative(", p.Name)
......@@ -82,7 +83,7 @@ func prepGoVarsForC(vars []*variable) (string, []string) {
fmt.Fprintf(&buffer, "&C.%s{}", p.BaseType)
}
buffer.WriteString(")\n")
} else if p.BaseType == "char" {
} else if p.BaseType == charType {
names[i] = p.Name + "_"
fmt.Fprintf(&buffer, `%[1]s_ := C.calloc(C.size_t(len(%[1]s)), C.size_t(unsafe.Sizeof(uintptr(0))))
%[1]s_p := (*[1<<30 - 1]*C.char)(%[1]s_)
......@@ -91,7 +92,7 @@ for i, one := range %[1]s {
}
`, p.Name)
}
} else if p.Ptrs == "*" {
case p.Ptrs == "*":
if _, exists := edefsMap[p.BaseType]; exists {
names[i] = p.Name + "_"
fmt.Fprintf(&buffer, "%[1]s_ := C.%[2]s(*%[1]s)\n", p.Name, p.BaseType)
......@@ -106,6 +107,7 @@ for i, one := range %[1]s {
buffer.WriteString(")\n")
buffer.WriteString("}\n")
}
default:
}
}
return buffer.String(), names
......@@ -125,12 +127,12 @@ return result__`, expression, retVar.GoType)
}
} else {
switch retVar.CType {
case "void *":
case voidPtrType:
fmt.Fprintf(buffer, "return %s", expression)
case "cef_string_t":
case cefStringType:
fmt.Fprintf(buffer, `native__ := %s
return cefstrToString(&native__)`, expression)
case "cef_string_t *":
case cefStringPtrType:
fmt.Fprintf(buffer, "return cefstrToString(%s)", expression)
case "cef_string_userfree_t":
fmt.Fprintf(buffer, "return cefuserfreestrToString(%s)", expression)
......@@ -151,18 +153,21 @@ func emitParamsForCCall(buffer *strings.Builder, vars []*variable, names []strin
if !omitFirstComma || i != 0 {
buffer.WriteString(", ")
}
if p.BaseType == "void" {
switch {
case p.BaseType == voidType:
buffer.WriteString(names[i])
} else if p.BaseType == "char" && p.Ptrs == "**" {
case p.BaseType == charType && p.Ptrs == "**":
fmt.Fprintf(buffer, "(**C.char)(%s)", names[i])
} else {
default:
if p.Ptrs == "*" {
if _, exists := edefsMap[p.BaseType]; exists {
fmt.Fprintf(buffer, "&%s", names[i])
continue
}
}
if sdef, exists := sdefsMap[p.BaseType]; exists {
sdef, exists := sdefsMap[p.BaseType]
switch {
case exists:
if len(p.Ptrs) > 1 {
fmt.Fprintf(buffer, "&%s", names[i])
} else {
......@@ -176,9 +181,9 @@ func emitParamsForCCall(buffer *strings.Builder, vars []*variable, names []strin
buffer.WriteString(")")
}
}
} else if len(p.Ptrs) > 0 {
case len(p.Ptrs) > 0:
fmt.Fprintf(buffer, "(%sC.%s)(%s)", p.Ptrs, p.BaseType, names[i])
} else {
default:
fmt.Fprintf(buffer, "C.%s(%s)", p.BaseType, names[i])
}
}
......
......@@ -179,13 +179,14 @@ func headerList(dir string) []os.FileInfo {
func clangArgs(headers []string) []string {
args := make([]string, 0, len(headers)+7)
args = append(args, "-I")
args = append(args, ".")
args = append(args, "-Xclang")
args = append(args, "-ast-dump")
args = append(args, "-fsyntax-only")
args = append(args, "-fno-color-diagnostics")
args = append(args, "-Wno-visibility")
args = append(args,
"-I",
".",
"-Xclang",
"-ast-dump",
"-fsyntax-only",
"-fno-color-diagnostics",
"-Wno-visibility")
args = append(args, headers...)
return args
}
......@@ -193,7 +194,7 @@ func clangArgs(headers []string) []string {
func createCommonHeader(headers []string) {
f, err := os.Create(filepath.Join(outputBaseDir, "capi_gen.h"))
jot.FatalIfErr(err)
f.WriteString(`// Code generated - DO NOT EDIT.
_, err = f.WriteString(`// Code generated - DO NOT EDIT.
#ifndef GOCEF_CAPI_H_
#define GOCEF_CAPI_H_
......@@ -201,12 +202,14 @@ func createCommonHeader(headers []string) {
#include <stdlib.h>
`)
jot.FatalIfErr(err)
for _, header := range headers {
fmt.Fprintf(f, `#include "%s"
`, header)
}
f.WriteString(`
_, err = f.WriteString(`
#endif // GOCEF_CAPI_H_
`)
jot.FatalIfErr(err)
jot.FatalIfErr(f.Close())
}
......@@ -129,7 +129,7 @@ func (p position) Text(line, startCol, endCol int) string {
return ""
}
text := lines[line-1]
if len(text) == 0 {
if text == "" {
return ""
}
if startCol < 1 {
......
......@@ -51,7 +51,7 @@ func (s *structDef) NeedsUnsafeImport() bool {
}
func (s *structDef) hasInheritance() bool {
return !s.isClassEquivalent() && len(s.Fields) > 0 && s.Fields[0].Var.Name == "base"
return !s.isClassEquivalent() && len(s.Fields) > 0 && s.Fields[0].Var.Name == baseFieldName
}
func (s *structDef) isClassEquivalent() bool {
......
......@@ -30,7 +30,7 @@ func newTypeDef(name, refersTo string, pos position) *typeDef {
}
var excludeMap = map[string]bool{
"cef_string_t": true,
cefStringType: true,
"cef_string_userfree_t": true,
"cef_string_userfree_utf8_t": true,
"cef_string_userfree_utf16_t": true,
......@@ -83,7 +83,7 @@ func dumpTypedefs() {
func translateRefersToType(in string) string {
switch in {
case "void *":
case voidPtrType:
return "unsafe.Pointer"
case "uint32":
return in
......
......@@ -10,6 +10,15 @@ import (
"github.com/richardwilkes/toolbox/txt"
)
const (
voidType = "void"
voidPtrType = "void *"
charType = "char"
cefStringType = "cef_string_t"
cefStringPtrType = "cef_string_t *"
stringPtrGoType = "*string"
)
var (
cNamesToPrefixForAccess = []string{"range", "type"}
paramRenames = []string{"chan", "defer", "error", "fallthrough", "func", "go", "import", "interface", "map", "package", "range", "select", "string", "type", "var"}
......@@ -70,7 +79,7 @@ func newCVar(name, typeInfo string, pos position) *variable {
typeInfo = strings.TrimSpace(typeInfo)
typeInfo = strings.TrimPrefix(typeInfo, "struct _")
typeInfo = strings.Replace(typeInfo, "long long", "longlong", -1)
if v.Name == "base" {
if v.Name == baseFieldName {
typeInfo += " *"
}
v.CType = typeInfo
......@@ -81,7 +90,7 @@ func newCVar(name, typeInfo string, pos position) *variable {
v.BaseType = typeInfo
}
switch v.BaseType {
case "void":
case voidType:
switch v.Ptrs {
case "":
case "*":
......@@ -93,7 +102,7 @@ func newCVar(name, typeInfo string, pos position) *variable {
default:
jot.Fatal(1, errs.Newf("Unhandled void case: %s", v.Ptrs))
}
case "char":
case charType:
if v.Ptrs == "**" {
v.NeedUnsafe = true
v.GoType = "[]string"
......@@ -112,14 +121,14 @@ func newCVar(name, typeInfo string, pos position) *variable {
v.GoType = v.Ptrs + "float64"
case "size_t":
v.GoType = v.Ptrs + "uint64"
case "cef_string_t", "cef_string_userfree_t", "cef_string_userfree_utf8_t",
case cefStringType, "cef_string_userfree_t", "cef_string_userfree_utf8_t",
"cef_string_userfree_utf16_t", "cef_string_userfree_wide_t",
"cef_string_utf8_t", "cef_string_utf16_t", "cef_string_wide_t":
switch v.Ptrs {
case "", "*":
v.GoType = "string"
case "**":
v.GoType = "*string"
v.GoType = stringPtrGoType
default:
jot.Fatal(1, errs.Newf("Unhandled string case: %s", v.Ptrs))
}
......@@ -172,7 +181,7 @@ func adjustedParamName(name string) string {
func (v *variable) paramGoType() string {
if !v.HadConst && v.GoType == "string" {
return "*string"
return stringPtrGoType
}
return v.GoType
}
......@@ -188,29 +197,31 @@ func (v *variable) transformCToGo(w io.Writer) string {
fmt.Fprintf(w, "%[1]s__p := &%[1]s_\n", v.Name)
return fmt.Sprintf("%s__p", v.Name)
}
} else {
if v.Ptrs == "*" {
fmt.Fprintf(w, "%[1]s_ := %[1]s.toGo()\n", v.Name)
return fmt.Sprintf("%s_", v.Name)
}
} else if v.Ptrs == "*" {
fmt.Fprintf(w, "%[1]s_ := %[1]s.toGo()\n", v.Name)
return fmt.Sprintf("%s_", v.Name)
}
} else if _, exists := edefsMap[v.BaseType]; exists {
switch v.Ptrs {
case "":
} else {
_, exists := edefsMap[v.BaseType]
switch {
case exists:
switch v.Ptrs {
case "":
return v.GoCast(v.Name)
case "*":
fmt.Fprintf(w, "%[1]s_ := %[2]s(*%[1]s)\n", v.Name, v.GoType[1:])
return fmt.Sprintf("&%s_", v.Name)
}
case v.BaseType == cefStringType:
addressOf := ""
if !v.HadConst {
addressOf = "&"
}
fmt.Fprintf(w, "%[1]s_ := cefstrToString(%[1]s)\n", v.Name)
return fmt.Sprintf("%s%s_", addressOf, v.Name)
default:
return v.GoCast(v.Name)
case "*":
fmt.Fprintf(w, "%[1]s_ := %[2]s(*%[1]s)\n", v.Name, v.GoType[1:])
return fmt.Sprintf("&%s_", v.Name)
}
} else if v.BaseType == "cef_string_t" {
addressOf := ""
if !v.HadConst {
addressOf = "&"
}
fmt.Fprintf(w, "%[1]s_ := cefstrToString(%[1]s)\n", v.Name)
return fmt.Sprintf("%s%s_", addressOf, v.Name)
} else {
return v.GoCast(v.Name)
}
jot.Fatal(1, errs.Newf("Unhandled param conversion: %s", v.Name))
return ""
......@@ -230,7 +241,7 @@ func (v *variable) CGoCast(expression string) string {
}
func (v *variable) GoCast(expression string) string {
if v.BaseType == "void" {
if v.BaseType == voidType {
return expression
}
if strings.HasPrefix(v.GoType, "*") {
......
......@@ -40,7 +40,7 @@ func NewDist() cmdline.Cmd {
copyrightOwner: "Unknown",
}
switch runtime.GOOS {
case "darwin":
case MacOS:
d.root = path.Join(d.root, "macos")
d.icon = "AppIcon.icns"
default:
......@@ -76,9 +76,9 @@ func (d *dist) Run(cl *cmdline.CmdLine, args []string) error {
}
createDir(d.root, 0755)
switch runtime.GOOS {
case "darwin":
case MacOS:
d.distMacOS()
case "linux", "windows":
case LinuxOS, WindowsOS:
d.distNotMacOS()
default:
return fmt.Errorf("Unhandled OS: %s", runtime.GOOS)
......
......@@ -83,7 +83,7 @@ int main(int argc, char **argv) {
}
`), 0644), "write", name)
c.untar(bytes.NewBuffer(c.downloadAndUncompressArchive()))
if runtime.GOOS == "windows" {
if runtime.GOOS == WindowsOS {
dir := path.Join(path.Dir(os.Getenv("MINGW_PREFIX")), "lib/pkgconfig")
createDir(dir, 0755)
name = path.Join(dir, "cef.pc")
......
......@@ -9,6 +9,13 @@ import (
"github.com/richardwilkes/toolbox/atexit"
)
// Constants for comparison to runtime.GOOS
const (
MacOS = "darwin"
WindowsOS = "windows"
LinuxOS = "linux"
)
var (
installPrefix = "/usr/local/cef"
cefPlatform string
......@@ -16,11 +23,11 @@ var (
func checkPlatform() {
switch runtime.GOOS {
case "darwin":
case MacOS:
cefPlatform = "macosx64"
case "linux":
case LinuxOS:
cefPlatform = "linux64"
case "windows":
case WindowsOS:
if os.Getenv("MSYSTEM") != "MINGW64" {
fmt.Println("Windows is only supported through the use of MINGW64")
atexit.Exit(1)
......
......@@ -9,7 +9,7 @@ import (
"github.com/richardwilkes/toolbox/cmdline"
)
const desiredCEFVersion = "3.3578.1863.gbf8cff2"
const desiredCEFVersion = "3.3626.1891.g52be333"
func main() {
cmdline.CopyrightYears = "2018-2019"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册