//Init initializing the dissection. If opening inputfile or savefile fail,
//return err. After dissection finish, should use Clean() to end the dissection.
func Init(inputfile, outputfile string) error {
	var err C.int

	if outputfile == "" {
		err = C.init(C.CString(inputfile), nil)
	} else {
		err = C.init(C.CString(inputfile), C.CString(outputfile))
	}

	if err != 0 {
		return fmt.Errorf("can't open file")
	}
	return nil
}
Exemple #2
0
func main() {
	C.init(C.CString(os.Args[1]))
	for _, a := range os.Args[2:] {
		C.write_file(C.CString(a+"\n"), C.size_t(len(a)+1))
	}
	C.finish()
}
Exemple #3
0
func init() {
	if AlwaysFalse {
		// by referencing this C init() in a noop test, it will ensure the compiler
		// links in the C function.
		// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65134
		C.init()
	}
}
func init() {
	C.init()
	// Mirror db.
	for rows := 3; rows <= BoardSize; rows++ {
		for cols := 3; cols <= BoardSize; cols++ {
			q := (*queue)(C.db[rows][cols])
			db[rows][cols] = q.slice()
		}
	}
}
Exemple #5
0
func initGTK() {

	// pass command line arguments to GTK+
	argc := int(C.init(C.int(len(os.Args)), unsafe.Pointer(&os.Args[0])))

	// update os.Args
	os.Args = os.Args[0:0]
	for i := 0; i < argc; i++ {
		os.Args = append(os.Args, C.GoString(C.return_arg(C.int(i))))
	}

	fmt.Println("Remaining command line arguments:", os.Args)
}
Exemple #6
0
// Initialize sets up the application properties.
func Initialize(title string, imageData []byte, items []MenuItem) {
	cTitle := C.CString(title)
	defer C.free(unsafe.Pointer(cTitle))
	img, freeImg := create_image(Image{Kind: "png", Bytes: imageData})
	defer freeImg()

	// Initialize menu.
	C.init(cTitle, img)

	menuItems = items
	for id, item := range menuItems {
		addItem(id, item)
	}
}
Exemple #7
0
func main() {
	InitI18n()
	Textdomain("dde-daemon")

	if !lib.UniqueOnSession("com.deepin.daemon") {
		logger.Warning("There already has a dde-daemon running.")
		return
	}
	if len(os.Args) >= 2 {
		for _, disabledModuleName := range os.Args[1:] {
			loader.Enable(disabledModuleName, false)
		}
	}

	C.init()
	proxy.SetupProxy()

	initModules()
	listenDaemonSettings()

	loader.StartAll()
	defer loader.StopAll()

	go func() {
		if err := dbus.Wait(); err != nil {
			logger.Errorf("Lost dbus: %v", err)
			os.Exit(-1)
		} else {
			logger.Info("dbus connection is closed by user")
			os.Exit(0)
		}
	}()

	ddeSessionRegister()
	dbus.DealWithUnhandledMessage()
	glib.StartLoop()
}
Exemple #8
0
func init() {
	C.init(callback.Func)
}
Exemple #9
0
func init() {
	C.init()
}
Exemple #10
0
func Test() {
	C.init()
	C.sofunc()
}
Exemple #11
0
func New(prompt string) *Tecla {
	prompts := make(map[string]*C.char)

	return &Tecla{C.init(), intern(prompts, prompt), prompts}
}
Exemple #12
0
func test5227(t *testing.T) {
	C.init()
}
Exemple #13
0
// Init initializes the graphics subsystem
func Init() (int, int) {
	var rh, rw C.int
	C.init(&rw, &rh)
	return int(rw), int(rh)
}
func initializeXmlSec(signatureManager *C.SignatureManager) {
	returnCode := C.init(signatureManager)
	if returnCode != 0 {
		panic("xmlsec initialization failed")
	}
}
Exemple #15
0
func cdrv_init() {
	C.init()
}
Exemple #16
0
func init() {
	C.init(C.CString(*haarFile))
}
Exemple #17
0
// Init initializes the graphics subsystem
func Init() (int, int) {
	runtime.LockOSThread()
	var rh, rw C.int
	C.init(&rw, &rh)
	return int(rw), int(rh)
}
func initialize(title string) {
	titlePtr := C.CString(title)
	defer C.free(unsafe.Pointer(titlePtr))
	C.init((*C.char)(unsafe.Pointer(titlePtr)))
}
func initialize(title string) {
	titlePtr, _ := syscall.UTF16PtrFromString(title)
	C.init((*C.char)(unsafe.Pointer(titlePtr)))
}
Exemple #20
0
func Gfun() {
	fmt.Println("Gfun()")
	C.init()
}