scanner

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package scanner provides a Wayland protocol scanner that generates Go bindings from XML protocol files.

This scanner parses Wayland protocol XML files and generates idiomatic Go code with: - Type-safe interfaces and implementations - Proper marshalling/unmarshalling of Wayland wire format - Connection handling and message dispatching - Error handling and validation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name      string `xml:"name,attr"`
	Type      string `xml:"type,attr"`
	Summary   string `xml:"summary,attr"`
	Interface string `xml:"interface,attr"`
	AllowNull bool   `xml:"allow-null,attr"`
	Enum      string `xml:"enum,attr"`
}

Arg represents a message argument

type Description

type Description struct {
	Summary string `xml:"summary,attr"`
	Text    string `xml:",chardata"`
}

Description represents documentation

type Entry

type Entry struct {
	Name    string `xml:"name,attr"`
	Value   string `xml:"value,attr"`
	Summary string `xml:"summary,attr"`
	Since   int    `xml:"since,attr"`
}

Entry represents an enum value

type Enum

type Enum struct {
	Name        string       `xml:"name,attr"`
	Since       int          `xml:"since,attr"`
	Bitfield    bool         `xml:"bitfield,attr"`
	Description *Description `xml:"description"`
	Entries     []Entry      `xml:"entry"`
}

Enum represents an enumeration type

type Event

type Event struct {
	Name        string       `xml:"name,attr"`
	Since       int          `xml:"since,attr"`
	Description *Description `xml:"description"`
	Args        []Arg        `xml:"arg"`
}

Event represents a server-to-client message

type Interface

type Interface struct {
	Name        string       `xml:"name,attr"`
	Version     int          `xml:"version,attr"`
	Description *Description `xml:"description"`
	Requests    []Request    `xml:"request"`
	Events      []Event      `xml:"event"`
	Enums       []Enum       `xml:"enum"`
}

Interface represents a Wayland interface in the protocol

type Protocol

type Protocol struct {
	XMLName     xml.Name     `xml:"protocol"`
	Name        string       `xml:"name,attr"`
	Copyright   string       `xml:"copyright"`
	Description *Description `xml:"description"`
	Interfaces  []Interface  `xml:"interface"`
}

Protocol represents a Wayland protocol specification

type Request

type Request struct {
	Name        string       `xml:"name,attr"`
	Type        string       `xml:"type,attr"` // "destructor" or empty
	Since       int          `xml:"since,attr"`
	Description *Description `xml:"description"`
	Args        []Arg        `xml:"arg"`
}

Request represents a client-to-server message

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner generates Go bindings from Wayland protocol XML

func NewScanner

func NewScanner() *Scanner

NewScanner creates a new protocol scanner

func (*Scanner) Generate

func (s *Scanner) Generate(packageName string) ([]byte, error)

Generate creates Go source code for the parsed protocol

func (*Scanner) ParseXML

func (s *Scanner) ParseXML(path string) error

ParseXML parses a Wayland protocol XML file

Directories

Path Synopsis
cmd
wayland-scanner command
Command wayland-scanner generates Go bindings from Wayland protocol XML files.
Command wayland-scanner generates Go bindings from Wayland protocol XML files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL