Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5412b02d50
commit
338b8dc301
6
Jamfile
6
Jamfile
@ -1,6 +1,4 @@
|
||||
SubDir OBOS_TOP ;
|
||||
|
||||
InstallFloppy installfloppy : $(OBOS_FLOPPY) ;
|
||||
SubDir HAIKU_TOP ;
|
||||
|
||||
NotFile alltests ;
|
||||
Depends alltests : r5tests obostests ;
|
||||
@ -132,4 +130,4 @@ Depends ScreenSaverKit :
|
||||
Haiku
|
||||
;
|
||||
|
||||
SubInclude OBOS_TOP src ;
|
||||
SubInclude HAIKU_TOP src ;
|
||||
|
157
build/jam/BeOSRules
Normal file
157
build/jam/BeOSRules
Normal file
@ -0,0 +1,157 @@
|
||||
# BeOS specific rules
|
||||
|
||||
|
||||
rule AddStringDataResource
|
||||
{
|
||||
# AddStringDataResource <target> : <resourceID> : <dataString>
|
||||
# Adds a single resource to the resources of an executable/library.
|
||||
# <target>: The executable/library.
|
||||
# <resourceID>: A resource ID string as understood by xres (type:id[:name]).
|
||||
# <dataString>: The string <dataString> will be written to the resource.
|
||||
# Defaults to "".
|
||||
#
|
||||
local target = $(1) ;
|
||||
local resourceID = $(2) ;
|
||||
local dataString = $(3:E="") ;
|
||||
|
||||
# the resource file
|
||||
local resources
|
||||
= [ FGristFiles $(target:B)-added-string-data-resources.rsrc ] ;
|
||||
|
||||
# add the resource file to the target, if not yet done
|
||||
if ! [ on $(resources) return $(RESOURCES_ADDED) ] {
|
||||
RESOURCES_ADDED on $(resources) = true ;
|
||||
MakeLocateArch $(resources) ;
|
||||
Depends $(resources) : <build>xres ;
|
||||
AddStringDataResource1 $(resources) : <build>xres ;
|
||||
AddResources $(target) : $(resources) ;
|
||||
}
|
||||
|
||||
RESOURCE_STRINGS on $(resources)
|
||||
+= "-a "$(resourceID)" -s \""$(dataString)"\"" ;
|
||||
}
|
||||
|
||||
actions together AddStringDataResource1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -o "$(1)" $(RESOURCE_STRINGS)
|
||||
}
|
||||
|
||||
|
||||
rule AddFileDataResource
|
||||
{
|
||||
# AddFileDataResource <target> : <resourceID> : [ <dataFile> ]
|
||||
# : [ <dataString> ]
|
||||
# Adds a single resource to the resources of an executable/library.
|
||||
# <target>: The executable/library.
|
||||
# <resourceID>: A resource ID string as understood by xres (type:id[:name]).
|
||||
# <dataFile>: The data to be written into the resource will be read from
|
||||
# that file.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local resourceID = $(2) ;
|
||||
local dataFile = $(3) ;
|
||||
|
||||
# the resource file
|
||||
local resources
|
||||
= <added-resources>file-data-$(resourceID)-$(dataFile).rsrc ;
|
||||
|
||||
# add it to the resources of the given target
|
||||
AddResources $(target) : $(resources) ;
|
||||
|
||||
# if the rule for creating the resource file has not been invoked yet, do it
|
||||
if ! [ on $(resources) return $(RESOURCES_DEFINED) ] {
|
||||
RESOURCES_DEFINED on $(resources) = true ;
|
||||
RESOURCE_ID on $(resources) = $(resourceID) ;
|
||||
MakeLocateArch $(resources) ;
|
||||
|
||||
Depends $(resources) : <build>xres $(dataFile) ;
|
||||
AddFileDataResource1 $(resources) : <build>xres $(dataFile) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions AddFileDataResource1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -o "$(1)" -a "$(RESOURCE_ID)" "$(2[2])" ;
|
||||
}
|
||||
|
||||
rule XRes
|
||||
{
|
||||
# XRes <target> : <resource files>
|
||||
if $(2)
|
||||
{
|
||||
Depends $(1) : <build>xres $(2) ;
|
||||
XRes1 $(1) : <build>xres $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions XRes1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -o "$(1)" "$(2[2-])" ;
|
||||
}
|
||||
|
||||
rule SetVersion
|
||||
{
|
||||
# SetVersion <target>
|
||||
|
||||
Depends $(1) : <build>setversion ;
|
||||
SetVersion1 $(1) : <build>setversion ;
|
||||
}
|
||||
|
||||
actions SetVersion1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) "$(1)" -system $(HAIKU_BUILD_VERSION) -short "$(HAIKU_BUILD_DESCRIPTION)" ;
|
||||
}
|
||||
|
||||
rule SetType
|
||||
{
|
||||
# SetType <target>
|
||||
|
||||
Depends $(1) : <build>settype ;
|
||||
SetType1 $(1) : <build>settype ;
|
||||
}
|
||||
|
||||
actions SetType1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ;
|
||||
}
|
||||
|
||||
rule MimeSet
|
||||
{
|
||||
# MimeSet <target>
|
||||
}
|
||||
|
||||
rule ResComp
|
||||
{
|
||||
# ResComp <resource file> : <rdef file> ;
|
||||
#
|
||||
# <resource file> and <rdef file> must be gristed.
|
||||
|
||||
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
||||
MakeLocateArch $(1) ;
|
||||
Depends $(1) : $(2) <build>rc ;
|
||||
LocalClean clean : $(1) ;
|
||||
ResComp1 $(1) : <build>rc $(2) ;
|
||||
}
|
||||
|
||||
actions ResComp1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) --auto-names -o $(1) $(2[2-])
|
||||
}
|
||||
|
||||
|
||||
if $(OS) = BEOS
|
||||
{
|
||||
|
||||
actions MimeSet
|
||||
{
|
||||
mimeset -f "$(1)" ;
|
||||
}
|
||||
|
||||
} # if BEOS
|
||||
|
577
build/jam/BuildSetup
Normal file
577
build/jam/BuildSetup
Normal file
@ -0,0 +1,577 @@
|
||||
|
||||
# Variable naming conventions:
|
||||
# TARGET_*: A build system variable specifying a property for building for
|
||||
# the target platform (usually Haiku). E.g. TARGET_CC specifies the
|
||||
# compiler when building a target for the target platform.
|
||||
# HOST_*: A build system variable specifying a property of the platform
|
||||
# hosting the build. E.g. HOST_CC specifies the compiler when
|
||||
# building a target for the host platform (a build tool for
|
||||
# instance).
|
||||
# HAIKU_*: A build system variable specifying a build system property. Usually
|
||||
# directory paths and the like.
|
||||
|
||||
|
||||
# Include BuildConfig/Timezones/libgccObjects
|
||||
{
|
||||
local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ;
|
||||
local timezones = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : Timezones ] ;
|
||||
local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ;
|
||||
|
||||
if ! $(buildConfig) {
|
||||
ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
|
||||
EXIT "Run ./configure in the source tree's root directory first!" ;
|
||||
}
|
||||
if ! ( $(timezones) && $(libgccObjects) ) {
|
||||
ECHO "No `Timezones' or `libgccObjects' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
|
||||
EXIT "Please run ./configure in the source tree's root directory again!" ;
|
||||
}
|
||||
|
||||
LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
||||
LOCATE on Timezones = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
||||
LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
||||
|
||||
include BuildConfig ;
|
||||
include Timezones ;
|
||||
include libgccObjects ;
|
||||
}
|
||||
|
||||
|
||||
# supported debug levels
|
||||
HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ;
|
||||
|
||||
# BeOS, BONE, Dan0 compatible platforms
|
||||
HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano ;
|
||||
HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano ;
|
||||
HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano ;
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# haiku target platform settings
|
||||
|
||||
# initial state for flags etc.
|
||||
HAIKU_C++ ?= $(HAIKU_CC) ;
|
||||
HAIKU_LINK = $(HAIKU_CC) ;
|
||||
HAIKU_LINKFLAGS = ;
|
||||
|
||||
HAIKU_HDRS = [ FStandardHeaders ] ;
|
||||
HAIKU_CCFLAGS = -nostdinc ;
|
||||
HAIKU_C++FLAGS = -nostdinc ;
|
||||
HAIKU_DEFINES = __HAIKU__ ;
|
||||
|
||||
# analyze the gcc machine spec to determine HAIKU_CPU
|
||||
switch $(HAIKU_GCC_MACHINE) {
|
||||
case i386-* : HAIKU_CPU = x86 ;
|
||||
case i486-* : HAIKU_CPU = x86 ;
|
||||
case i586-* : HAIKU_CPU = x86 ;
|
||||
case i686-* : HAIKU_CPU = x86 ;
|
||||
# TODO: PPC?
|
||||
case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ;
|
||||
}
|
||||
|
||||
switch $(HAIKU_CPU) {
|
||||
case ppc :
|
||||
{
|
||||
HAIKU_DEFINES += __POWERPC__ ;
|
||||
HAIKU_BOOT_PLATFORM = openfirmware ;
|
||||
}
|
||||
case x86 :
|
||||
{
|
||||
HAIKU_DEFINES += __INTEL__ ;
|
||||
HAIKU_BOOT_PLATFORM = bios_ia32 ;
|
||||
}
|
||||
case * :
|
||||
Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ;
|
||||
}
|
||||
HAIKU_ARCH ?= $(HAIKU_CPU) ;
|
||||
HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ;
|
||||
HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ;
|
||||
|
||||
# directories
|
||||
HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ;
|
||||
HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ;
|
||||
HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ;
|
||||
HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ;
|
||||
HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ;
|
||||
|
||||
local level ;
|
||||
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
HAIKU_DEBUG_$(level)_OBJECT_DIR
|
||||
= [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ;
|
||||
}
|
||||
|
||||
# analyze GCC version
|
||||
if ! $(HAIKU_GCC_RAW_VERSION) {
|
||||
ECHO "Variable HAIKU_GCC_RAW_VERSION not set. Please run ./configure or" ;
|
||||
EXIT "specify it manually." ;
|
||||
}
|
||||
HAIKU_GCC_VERSION = ;
|
||||
{
|
||||
# split the raw version string at `.' and `-' characters
|
||||
local version = $(HAIKU_GCC_RAW_VERSION) ;
|
||||
while $(version) {
|
||||
local split = [ Match "([^.-]*)[.-](.*)" : $(version) ] ;
|
||||
if $(split) {
|
||||
HAIKU_GCC_VERSION += $(split[1]) ;
|
||||
version = $(split[2]) ;
|
||||
} else {
|
||||
HAIKU_GCC_VERSION += $(version) ;
|
||||
version = ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# assembler flags
|
||||
HAIKU_ASFLAGS = ;
|
||||
|
||||
# C/C++ flags
|
||||
HAIKU_CCFLAGS += -Wno-multichar ;
|
||||
HAIKU_C++FLAGS += -Wno-multichar ;
|
||||
|
||||
HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 3 {
|
||||
HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
|
||||
}
|
||||
|
||||
# If the environment variable DEBUG_PRINTF is defined we define an equally
|
||||
# named macro to the variable value. Some components use the macro to allow
|
||||
# another function than printf() to print the debug output. The variable should
|
||||
# be set to the name of the alternative function.
|
||||
#
|
||||
if $(DEBUG_PRINTF) {
|
||||
HAIKU_CCFLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
|
||||
HAIKU_C++FLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
|
||||
}
|
||||
|
||||
# warning flags
|
||||
HAIKU_WARNING_CCFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wcast-align
|
||||
-Wsign-compare ;
|
||||
HAIKU_WARNING_C++FLAGS = -Wall -Wmissing-prototypes -Wno-ctor-dtor-privacy
|
||||
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
|
||||
|
||||
HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wmissing-prototypes ;
|
||||
HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wmissing-prototypes ;
|
||||
|
||||
# debug flags
|
||||
HAIKU_DEBUG_FLAGS ?= -ggdb ;
|
||||
|
||||
# debug 0: suppress asserts
|
||||
HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
|
||||
HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
|
||||
local level ;
|
||||
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
|
||||
HAIKU_DEBUG_$(level)_CCFLAGS = $(flags) ;
|
||||
HAIKU_DEBUG_$(level)_C++FLAGS = $(flags) ;
|
||||
HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ;
|
||||
HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
|
||||
}
|
||||
|
||||
# private kernel headers do be used when compiling kernel code
|
||||
HAIKU_PRIVATE_KERNEL_HEADERS =
|
||||
[ PrivateHeaders $(DOT) kernel libroot
|
||||
kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ]
|
||||
[ ArchHeaders $(HAIKU_ARCH) ]
|
||||
;
|
||||
|
||||
# Add some grist to the libgcc objects
|
||||
HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ;
|
||||
|
||||
# the C++ library
|
||||
HAIKU_LIBSTDC++ = libstdc++.r4.so ;
|
||||
|
||||
# library and executable glue code
|
||||
local commonGlueCode =
|
||||
<src!system!glue>init_term_dyn.o
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
|
||||
;
|
||||
HAIKU_LIBRARY_BEGIN_GLUE_CODE =
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
|
||||
crtbegin.o
|
||||
<src!system!glue>init_term_dyn.o
|
||||
;
|
||||
HAIKU_LIBRARY_END_GLUE_CODE =
|
||||
crtend.o
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
|
||||
;
|
||||
HAIKU_EXECUTABLE_BEGIN_GLUE_CODE =
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
|
||||
crtbegin.o
|
||||
<src!system!glue>start_dyn.o
|
||||
<src!system!glue>init_term_dyn.o
|
||||
;
|
||||
HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ;
|
||||
|
||||
SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ;
|
||||
|
||||
HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
|
||||
|
||||
# TODO: The version stuff should probably go into a separate file and be made
|
||||
# available as macro, too.
|
||||
# Set our version number if not already set and mark it as a developer build
|
||||
if ! $(HAIKU_BUILD_VERSION) {
|
||||
HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ;
|
||||
HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ;
|
||||
}
|
||||
|
||||
# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as
|
||||
# an unknown build.
|
||||
HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
|
||||
|
||||
# init library name map
|
||||
{
|
||||
local i ;
|
||||
for i in be game mail media midi midi2 net netapi opengl screensaver root z
|
||||
textencoding tracker translation {
|
||||
HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# host platform settings
|
||||
|
||||
# save jam's variables for the build platform
|
||||
HOST_AR ?= $(AR) ;
|
||||
HOST_CC ?= $(CC) ;
|
||||
HOST_C++ ?= $(C++) ;
|
||||
HOST_LINK ?= $(LINK) ;
|
||||
HOST_LD ?= ld ; # TODO: Fix this!
|
||||
HOST_OBJCOPY ?= objcopy ; #
|
||||
HOST_RANLIB ?= $(RANLIB) ;
|
||||
HOST_CPPFLAGS ?= $(CPPFLAGS) ;
|
||||
HOST_CCFLAGS ?= $(CCFLAGS) ;
|
||||
HOST_C++FLAGS ?= $(C++FLAGS) ;
|
||||
HOST_LDFLAGS ?= $(LDFLAGS) ;
|
||||
HOST_LINKFLAGS ?= $(LINKFLAGS) ;
|
||||
HOST_DEFINES ?= $(DEFINES) ;
|
||||
HOST_HDRS ?= $(HDRS) ;
|
||||
|
||||
# split up HOST_AR into the command name and flags
|
||||
HOST_AR = [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ]
|
||||
$(HOST_AR[2-]) ;
|
||||
HOST_ARFLAGS = $(HOST_AR[2-]) ;
|
||||
HOST_AR = $(HOST_AR[1]) ;
|
||||
HOST_UNARFLAGS ?= x ;
|
||||
|
||||
# check the host platform compatibility
|
||||
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host : linux ;
|
||||
|
||||
if $(HOST_PLATFORM) = linux {
|
||||
# don't use lex: otherwise rc will not work correctly
|
||||
if $(LEX) = lex {
|
||||
LEX = flex ;
|
||||
}
|
||||
}
|
||||
|
||||
HOST_CPU ?= $(OSPLAT:L) ;
|
||||
|
||||
HOST_ARCH ?= $(HOST_CPU) ;
|
||||
HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ;
|
||||
|
||||
# directories
|
||||
HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ;
|
||||
HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ;
|
||||
HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_ARCH) ] ;
|
||||
HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ;
|
||||
HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ;
|
||||
|
||||
local level ;
|
||||
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
HOST_DEBUG_$(level)_OBJECT_DIR
|
||||
= [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ;
|
||||
}
|
||||
|
||||
# assembler flags
|
||||
HOST_ASFLAGS = ;
|
||||
|
||||
# C/C++ flags
|
||||
HOST_CCFLAGS += -Wno-multichar ;
|
||||
HOST_C++FLAGS += -Wno-multichar ;
|
||||
|
||||
HOST_KERNEL_CCFLAGS += -finline -fno-builtin
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
HOST_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
|
||||
# warning flags
|
||||
HOST_WARNING_CCFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wcast-align
|
||||
-Wsign-compare ;
|
||||
HOST_WARNING_C++FLAGS = -Wall -Wmissing-prototypes -Wno-ctor-dtor-privacy
|
||||
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
|
||||
|
||||
HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wmissing-prototypes ;
|
||||
HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wmissing-prototypes ;
|
||||
|
||||
# debug flags
|
||||
switch $(HOST_PLATFORM) {
|
||||
case haiku : HOST_DEBUG_FLAGS ?= -ggdb ;
|
||||
case linux : HOST_DEBUG_FLAGS ?= -ggdb ;
|
||||
case * : HOST_DEBUG_FLAGS ?= -g ;
|
||||
}
|
||||
|
||||
# debug 0: suppress asserts
|
||||
HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
|
||||
HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
|
||||
local level ;
|
||||
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
local flags = $(HOST_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
|
||||
HOST_DEBUG_$(level)_CCFLAGS = $(flags) ;
|
||||
HOST_DEBUG_$(level)_C++FLAGS = $(flags) ;
|
||||
HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ;
|
||||
HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
|
||||
}
|
||||
|
||||
# private kernel headers do be used when compiling kernel code
|
||||
HOST_PRIVATE_KERNEL_HEADERS = ;
|
||||
|
||||
# under BeOS use copyattr instead of cp
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE)
|
||||
{
|
||||
CP = copyattr --data ;
|
||||
}
|
||||
|
||||
HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ;
|
||||
HOST_DEFINES += _NO_INLINE_ASM ;
|
||||
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
# TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5
|
||||
# macro is used, it actually seems to mean r5/bone/dano.
|
||||
HOST_DEFINES += COMPILE_FOR_R5 ;
|
||||
}
|
||||
|
||||
# for builds of tools in the current environment
|
||||
HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ;
|
||||
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
HOST_LIBSTDC++ = stdc++.r4 ;
|
||||
HOST_LIBROOT = root ;
|
||||
HOST_LIBBE = be ;
|
||||
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = ;
|
||||
} else {
|
||||
HOST_LIBSTDC++ = stdc++ ;
|
||||
HOST_LIBROOT = libroot_build.so ;
|
||||
HOST_LIBBE = libbe_build.so ;
|
||||
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
|
||||
= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
|
||||
|
||||
# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
|
||||
# build platform we need to make sure, this is also defined.
|
||||
if $(HOST_CPU) = x86 {
|
||||
HOST_DEFINES += __INTEL__ ;
|
||||
} else if $(HOST_CPU) = ppc {
|
||||
HOST_DEFINES += __POWERPC__ ;
|
||||
}
|
||||
|
||||
# Supposing this is a glibc platform, let's try to get large file support
|
||||
HOST_DEFINES +=
|
||||
_LARGEFILE_SOURCE _LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64
|
||||
;
|
||||
}
|
||||
|
||||
# define the executable MIME type
|
||||
HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
|
||||
|
||||
if $(METROWERKS) {
|
||||
# at least parts of Haiku still can be compiled with
|
||||
# the Metrowerks compiler on BeOS/PPC
|
||||
HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ;
|
||||
}
|
||||
|
||||
# Be API compatibility
|
||||
HOST_BE_API_HEADERS = ;
|
||||
HOST_BE_API_CCFLAGS = ;
|
||||
HOST_BE_API_C++FLAGS = ;
|
||||
|
||||
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
HOST_BE_API_HEADERS =
|
||||
[ FDirName $(HAIKU_TOP) headers build ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os app ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os drivers ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os kernel ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os interface ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os storage ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os support ]
|
||||
;
|
||||
HOST_BE_API_CCFLAGS = -include HaikuBuildCompatibility.h ;
|
||||
HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# target platform settings
|
||||
|
||||
# check the target platform compatibility
|
||||
SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ;
|
||||
|
||||
# check the compatibility between host and target platform
|
||||
if $(TARGET_PLATFORM) != haiku {
|
||||
if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) {
|
||||
Exit ERROR: The host platform is not compatible with target platform
|
||||
$(TARGET_PLATFORM). ;
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: Fix the naming!
|
||||
if $(TARGET_PLATFORM_BONE_COMPATIBLE) {
|
||||
NETWORK_LIBS = libsocket.so libbind.so ;
|
||||
NETAPI_LIB = libbnetapi.so ;
|
||||
SELECT_UNAME_ETC_LIB = libroot.so ;
|
||||
} else {
|
||||
NETWORK_LIBS = libnet.so ;
|
||||
NETAPI_LIB = libnetapi.so ;
|
||||
SELECT_UNAME_ETC_LIB = libnet.so ;
|
||||
}
|
||||
|
||||
# TODO: For compatibility only. Remove when no longer used.
|
||||
R5_COMPATIBLE = $(TARGET_PLATFORM_BEOS_COMPATIBLE) ;
|
||||
BONE_COMPATIBLE = $(TARGET_PLATFORM_BONE_COMPATIBLE) ;
|
||||
DANO_COMPATIBLE = $(TARGET_PLATFORM_DANO_COMPATIBLE) ;
|
||||
HAIKU_COMPATIBLE = $(TARGET_PLATFORM_HAIKU_COMPATIBLE) ;
|
||||
|
||||
# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the
|
||||
# specified TARGET_PLATFORM.
|
||||
|
||||
local buildVars =
|
||||
ARCH CPU
|
||||
|
||||
AR CC C++ LD OBJCOPY RANLIB
|
||||
|
||||
HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES
|
||||
ARFLAGS UNARFLAGS
|
||||
|
||||
KERNEL_CCFLAGS KERNEL_C++FLAGS
|
||||
WARNING_CCFLAGS WARNING_C++FLAGS
|
||||
|
||||
KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
|
||||
|
||||
DEBUG_FLAGS
|
||||
|
||||
DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
|
||||
|
||||
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS
|
||||
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
|
||||
|
||||
PRIVATE_KERNEL_HEADERS
|
||||
|
||||
LIBSTDC++
|
||||
|
||||
ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE
|
||||
|
||||
OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
|
||||
DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
|
||||
;
|
||||
|
||||
if $(TARGET_PLATFORM) = haiku {
|
||||
local var ;
|
||||
for var in $(buildVars) {
|
||||
TARGET_$(var) = $(HAIKU_$(var)) ;
|
||||
}
|
||||
|
||||
TARGET_GCC_LIB_DIR = $(HAIKU_GCC_LIB_DIR) ;
|
||||
TARGET_GCC_HEADERS_DIR = $(HAIKU_GCC_HEADERS_DIR) ;
|
||||
TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ;
|
||||
TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ;
|
||||
|
||||
TARGET_BOOT_PLATFORM = $(HAIKU_BOOT_PLATFORM) ;
|
||||
|
||||
} else {
|
||||
local var ;
|
||||
for var in $(buildVars) {
|
||||
TARGET_$(var) = $(HOST_$(var)) ;
|
||||
}
|
||||
|
||||
TARGET_GCC_LIB_DIR = ;
|
||||
TARGET_GCC_HEADERS_DIR = ;
|
||||
TARGET_GCC_LIBGCC = ;
|
||||
TARGET_GCC_LIBGCC_OBJECTS = ;
|
||||
|
||||
TARGET_BOOT_PLATFORM = ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# common stuff
|
||||
|
||||
# start with a clean slate
|
||||
CCFLAGS = ;
|
||||
C++FLAGS = ;
|
||||
DEFINES = ;
|
||||
|
||||
# Set CC, C++, LINK to invalid values, so that we realize early, that we use
|
||||
# the wrong compiler.
|
||||
CC = bad-cc ;
|
||||
C++ = bad-c++ ;
|
||||
LINK = bad-link ;
|
||||
|
||||
# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage()
|
||||
# issues, they deprecated that nice function. This will enable it again:
|
||||
C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ;
|
||||
# TODO: Doesn't really belong here.
|
||||
|
||||
|
||||
# Defaults for warnings, optimization, and debugging.
|
||||
#
|
||||
WARNINGS ?= 1 ;
|
||||
OPTIM ?= -O2 ;
|
||||
DEBUG ?= 0 ;
|
||||
|
||||
|
||||
# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only
|
||||
# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS
|
||||
# can be overridden by the author of a component.
|
||||
PLATFORM = $(TARGET_PLATFORM) ;
|
||||
SUPPORTED_PLATFORMS = haiku ;
|
||||
|
||||
|
||||
# Instructs the Library rule to not make its object files temporary.
|
||||
# This is needed as some objects are used in a static library and for an
|
||||
# executable.
|
||||
KEEPOBJS = true ;
|
||||
|
||||
|
||||
# output directories
|
||||
# TODO: Review this.
|
||||
HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ;
|
||||
HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_DIR)
|
||||
documentation ] ;
|
||||
|
||||
# TODO: Rethink test stuff.
|
||||
HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests ] ;
|
||||
HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ;
|
||||
HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ;
|
||||
HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ;
|
||||
|
||||
HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ;
|
||||
HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ;
|
||||
|
||||
# automatically setup the objects directory per subdirectory
|
||||
SUBDIRRULES += SetupObjectsDir ;
|
||||
|
||||
# Add the standard (userland) warning flags variables to the ones restored in
|
||||
# every subdirectory. Thus we can easily meddle with them in subdirectories
|
||||
# with imported sources.
|
||||
AUTO_SET_UP_CONFIG_VARIABLES +=
|
||||
HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS
|
||||
TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS
|
||||
|
||||
# also add PLATFORM and SUPPORTED_PLATFORMS
|
||||
PLATFORM SUPPORTED_PLATFORMS
|
||||
;
|
168
build/jam/ConfigRules
Normal file
168
build/jam/ConfigRules
Normal file
@ -0,0 +1,168 @@
|
||||
# ConfigRules
|
||||
#
|
||||
# Contains rules providing the config variable feature. It allows to set the
|
||||
# values for certain variables for subdirectories in a central place. That is
|
||||
# one can, for instance, specify in a file like UserBuildConfig for which
|
||||
# directories to enable debugging, warnings, set special defines, compiler
|
||||
# flags and the like without needing to edit the Jamfiles for the respective
|
||||
# dirs.
|
||||
|
||||
rule ConfigObject
|
||||
{
|
||||
# ConfigObject <dir> [ : <varName> ] ;
|
||||
#
|
||||
# Private rule. Returns the dummy object on which the config variables are
|
||||
# set for a given subdir.
|
||||
#
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
#
|
||||
local config = $(2:E=__config__) ;
|
||||
local grist = [ FGrist root $(1) ] ;
|
||||
return $(config:G=$(grist)) ;
|
||||
}
|
||||
|
||||
rule SetConfigVar
|
||||
{
|
||||
# SetConfigVar <var> : <dir> : <value> [ : <scope> ] ;
|
||||
#
|
||||
# Sets a config variable for a specified directory to the given value.
|
||||
#
|
||||
# <var>: The name of the variable to be set.
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
# <value>: The value to which the variable shall be set.
|
||||
# <scope>: Either "global" or "local". The former implies that the variable
|
||||
# value shall also be used for subdirectories (recursively), if
|
||||
# for them the variable has not been set. The latter has the same
|
||||
# effect regarding subdirs as if the variable for the directory
|
||||
# is not set. Defaults to "global".
|
||||
#
|
||||
local var = $(1[1]) ;
|
||||
local config = [ ConfigObject $(2) ] ;
|
||||
local scope = $(4:E=global) ;
|
||||
|
||||
$(var) on $(config) = $(3) ;
|
||||
__set_$(var) on $(config) = $(scope) ;
|
||||
|
||||
if $(scope) = global {
|
||||
$(var) on [ ConfigObject $(2) : __inherited_config__ ] = $(3) ;
|
||||
}
|
||||
|
||||
if ! [ on $(config) return $(__configured) ] {
|
||||
__configured on $(config) = true ;
|
||||
__dir_tokens on $(config) = $(2) ;
|
||||
|
||||
HAIKU_EXISTING_SUBDIR_CONFIGS += $(config) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AppendToConfigVar
|
||||
{
|
||||
# AppendToConfigVar <var> : <dir> : <value> [ : <scope> ] ;
|
||||
#
|
||||
# Appends a value to a config variable for a specified directory. Shortcut
|
||||
# for
|
||||
# SetConfigVar <var> : <dir> : [ ConfigVar <var> : <dir> ] <value
|
||||
# : <scope> ;
|
||||
#
|
||||
# <var>: The name of the variable to be set.
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
# <value>: The value which to append to the variables current value.
|
||||
# <scope>: Either "global" or "local". The former implies that the variable
|
||||
# value shall also be used for subdirectories (recursively), if
|
||||
# for them the variable has not been set. The latter has the same
|
||||
# effect regarding subdirs as if the variable for the directory
|
||||
# is not set. Defaults to "global".
|
||||
#
|
||||
SetConfigVar $(1) : $(2) : [ ConfigVar $(1) : $(2) ] $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule ConfigVar
|
||||
{
|
||||
# ConfigVar <var> : <dir> [ : <scope> ] ;
|
||||
#
|
||||
# Returns the value of a configuration variable for a given subdir.
|
||||
# If the variable is not set for the subdir, the rule is invoked
|
||||
# recursively for the parent directory with the scope "global". When
|
||||
# the root is reached without yielding a value, the value of the global
|
||||
# variable <var> is returned.
|
||||
#
|
||||
# <var>: The name of the variable whose value shall be returned.
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
# <scope>: If not given any scope passed to SetConfigVar for the given
|
||||
# directory will be accepted, otherwise it must match the scope
|
||||
# passed to SetConfigVar.
|
||||
#
|
||||
local var = $(1[1]) ;
|
||||
local dir = $(2) ;
|
||||
local config = [ ConfigObject $(dir) ] ;
|
||||
local scope = $(3) ;
|
||||
local varScope = [ on $(config) return $(__set_$(var)) ] ;
|
||||
if ( ! $(scope) && $(varScope) )
|
||||
|| ( $(scope) && $(scope) = $(varScope) )
|
||||
|| ! $(dir) {
|
||||
on $(config) return $($(var)) ;
|
||||
} else {
|
||||
dir = [ FReverse $(dir) ] ;
|
||||
return [ ConfigVar $(var) : [ FReverse $(dir[2-]) ] : global ] ;
|
||||
}
|
||||
}
|
||||
|
||||
rule PrepareSubDirConfigVariables
|
||||
{
|
||||
local dirTokens = $(1) ;
|
||||
local config = [ ConfigObject $(dirTokens) ] ;
|
||||
|
||||
if ! [ on $(config) return $(__prepared) ] {
|
||||
# prepare config for parent dir
|
||||
local parentDir = [ FReverse $(dirTokens) ] ;
|
||||
parentDir = [ FReverse $(parentDir[2-]) ] ;
|
||||
PrepareSubDirConfigVariables $(parentDir) ;
|
||||
|
||||
# set values for all config variables for the config and the inherited
|
||||
# config for this directory
|
||||
local inheritedConfig = [ ConfigObject $(dirTokens)
|
||||
: __inherited_config__ ] ;
|
||||
|
||||
on [ ConfigObject $(parentDir) : __inherited_config__ ] {
|
||||
for var in $(AUTO_SET_UP_CONFIG_VARIABLES) {
|
||||
$(var) on $(config) ?= $($(var)) ;
|
||||
$(var) on $(inheritedConfig) ?= $($(var)) ;
|
||||
}
|
||||
}
|
||||
|
||||
HAIKU_INHERITED_SUBDIR_CONFIG on $(config) = $(inheritedConfig) ;
|
||||
|
||||
__prepared on $(config) = true ;
|
||||
}
|
||||
}
|
||||
|
||||
rule PrepareConfigVariables
|
||||
{
|
||||
# initialize variables on the root config and the root inherited config
|
||||
# objects to the global values
|
||||
local rootConfig = [ ConfigObject ] ; # the root config object
|
||||
local inheritedRootConfig = [ ConfigObject : __inherited_config__ ] ;
|
||||
|
||||
for var in $(AUTO_SET_UP_CONFIG_VARIABLES) {
|
||||
$(var) on $(rootConfig) = $($(var)) ;
|
||||
$(var) on $(inheritedRootConfig) = $($(var)) ;
|
||||
}
|
||||
__prepared on $(rootConfig) = true ;
|
||||
|
||||
HAIKU_INHERITED_SUBDIR_CONFIG = $(rootConfig) ;
|
||||
|
||||
local config ;
|
||||
for config in $(HAIKU_EXISTING_SUBDIR_CONFIGS) {
|
||||
PrepareSubDirConfigVariables [ on $(config) return $(__dir_tokens) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
# Some config variables that should be set up automatically for subdirs.
|
||||
AUTO_SET_UP_CONFIG_VARIABLES +=
|
||||
CCFLAGS C++FLAGS DEBUG DEFINES HDRS LINKFLAGS OPTIM OPTIMIZE
|
||||
SYSHDRS WARNINGS
|
||||
;
|
72
build/jam/DocumentationRules
Normal file
72
build/jam/DocumentationRules
Normal file
@ -0,0 +1,72 @@
|
||||
rule Man2Doc
|
||||
{
|
||||
local source = [ FGristFiles $(2) ] ;
|
||||
local binary = $(1) ;
|
||||
|
||||
SEARCH on $(source) = $(SEARCH_SOURCE) ;
|
||||
|
||||
MakeLocate $(binary)
|
||||
: [ FDirName $(HAIKU_DOCUMENTATION_OBJECT_DIR) Shell_Tools ] ;
|
||||
|
||||
Depends $(binary) : $(source) rman ;
|
||||
|
||||
LocalDepends doc_files : $(binary) ;
|
||||
Man2Doc1 $(binary) : rman $(source) ;
|
||||
LocalClean clean : $(binary) ;
|
||||
}
|
||||
|
||||
actions Man2Doc1
|
||||
{
|
||||
$(2[1]) -f XML "$(2[2])" > "$(1)" ;
|
||||
}
|
||||
|
||||
rule Man2Docs
|
||||
{
|
||||
# Man2Docs <sources> ;
|
||||
local source ;
|
||||
for source in [ FGristFiles $(1) ]
|
||||
{
|
||||
local target = $(source:S=.xml) ;
|
||||
|
||||
Man2Doc $(target) : $(source) ;
|
||||
}
|
||||
}
|
||||
|
||||
XSLTPROC ?= xsltproc ;
|
||||
|
||||
rule Doc2HTML
|
||||
{
|
||||
local source = [ FGristFiles $(1) ] ;
|
||||
local target = $(2) ;
|
||||
local xslsheet = $(3) ;
|
||||
local basedir = [ FDirName $(HAIKU_DOCUMENTATION_DIR) $(4) ] ;
|
||||
local paths = $(5) ;
|
||||
local options = $(6) ;
|
||||
|
||||
if ! $(target) {
|
||||
target = $(1:S=.html) ;
|
||||
}
|
||||
|
||||
SEARCH on $(source) = $(SEARCH_SOURCE) ;
|
||||
|
||||
MakeLocate $(target) : $(basedir) ;
|
||||
if $(2) {
|
||||
XSLBASEDIR on $(target) = -stringparam base.dir \"$(basedir)/\" ;
|
||||
}
|
||||
XSLSHEET on $(target) = $(xslsheet) ;
|
||||
XSLOPTIONS on $(target) = $(options) ;
|
||||
if $(2) = "" {
|
||||
XSLOUTPUT on $(target) = "-o "\"$(target:D=$(basedir))\" ;
|
||||
}
|
||||
|
||||
Depends $(target) : $(source) ;
|
||||
LocalDepends doc_files : $(target) ;
|
||||
XSLPROCPATHS on $(target) = -path \" $(paths:J=\ ) \" ;
|
||||
Doc2HTML1 $(target) : $(source) ;
|
||||
LocalClean clean : $(target) ;
|
||||
}
|
||||
|
||||
actions Doc2HTML1
|
||||
{
|
||||
$(XSLTPROC) -xinclude $(XSLPROCPATHS) $(XSLBASEDIR) $(XSLOPTIONS) $(XSLOUTPUT) $(XSLSHEET) $(2)
|
||||
}
|
219
build/jam/FileRules
Normal file
219
build/jam/FileRules
Normal file
@ -0,0 +1,219 @@
|
||||
rule SymLink
|
||||
{
|
||||
# SymLink <target> : <source> : <makeDefaultDependencies> ;
|
||||
# Links <target> to <source>.
|
||||
# <source> is the exact link contents. No binding is done.
|
||||
# <makeDefaultDependencies> If true, <target> will be made a dependency
|
||||
# of the `all' pseudo target, i.e. it will be made by default, and removed
|
||||
# on `jam clean'.
|
||||
|
||||
local target = $(1) ;
|
||||
local source = $(2) ;
|
||||
local makeDefaultDependencies = $(3) ;
|
||||
if ! $(makeDefaultDependencies) {
|
||||
makeDefaultDependencies = true ;
|
||||
}
|
||||
LINKCONTENTS on $(target) = $(source) ;
|
||||
SymLink1 $(target) ;
|
||||
if $(makeDefaultDependencies) = true {
|
||||
LocalDepends files : $(target) ;
|
||||
LocalClean clean : $(target) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions SymLink1
|
||||
{
|
||||
$(RM) "$(1)" && $(LN) -s "$(LINKCONTENTS)" "$(1)"
|
||||
}
|
||||
|
||||
rule RelSymLink
|
||||
{
|
||||
# RelSymLink <link> : <link target> : <makeDefaultDependencies> ;
|
||||
# Creates a relative symbolic link from <link> to <link target>.
|
||||
# <link> and <link target> can be usual targets. They may have a grist
|
||||
# and don't need to have any dirname. Their LOCATE variables are used to
|
||||
# find their locations.
|
||||
# <makeDefaultDependencies> If true (which is the default), <link> will be
|
||||
# made a dependency of the `files' pseudo target, i.e. it will be made by
|
||||
# default, and removed on `jam clean'.
|
||||
|
||||
local target = $(1) ;
|
||||
local source = $(2) ;
|
||||
local makeDefaultDependencies = $(3) ;
|
||||
local targetDir = [ on $(target) FDirName $(LOCATE[1]) $(target:D) ] ;
|
||||
local sourceDir = [ on $(source) FDirName $(LOCATE[1]) $(source:D) ] ;
|
||||
local sourcePath = $(source:G=) ;
|
||||
sourcePath = $(sourcePath:D=$(sourceDir)) ;
|
||||
local targetDirComponents = [ FSplitPath $(targetDir) ] ;
|
||||
local sourceComponents = [ FSplitPath $(sourcePath) ] ;
|
||||
|
||||
SymLink $(target)
|
||||
: [ FRelPath $(targetDirComponents) : $(sourceComponents) ]
|
||||
: $(makeDefaultDependencies) ;
|
||||
NOUPDATE $(target) ;
|
||||
Depends $(target) : $(source) ;
|
||||
}
|
||||
|
||||
rule AbsSymLink
|
||||
{
|
||||
# AbsSymLink <link> : <link target> : <link dir>
|
||||
# : <makeDefaultDependencies> ;
|
||||
# Creates an absolute symbolic link from <link> to <link target>.
|
||||
# <link> and <link target> must be usual targets. If <link dir> is
|
||||
# given, then it is set as LOCATE directory on <link>.
|
||||
# <makeDefaultDependencies> If true (which is the default), <link> will be
|
||||
# made a dependency of the `files' pseudo target, i.e. it will be made by
|
||||
# default, and removed on `jam clean'.
|
||||
|
||||
local makeDefaultDependencies = $(4) ;
|
||||
if ! $(makeDefaultDependencies) {
|
||||
makeDefaultDependencies = true ;
|
||||
}
|
||||
|
||||
Depends $(1) : $(2) ;
|
||||
if $(3) {
|
||||
MakeLocate $(1) : $(3) ;
|
||||
}
|
||||
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
||||
if $(makeDefaultDependencies) = true {
|
||||
LocalDepends files : $(1) ;
|
||||
LocalClean clean : $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions AbsSymLink
|
||||
{
|
||||
target="$(2)"
|
||||
case "$target" in
|
||||
/*) ;;
|
||||
*) target=`pwd`/"$target";;
|
||||
esac
|
||||
$(RM) "$(1)" && $(LN) -s "$target" "$(1)"
|
||||
}
|
||||
|
||||
rule HaikuInstall
|
||||
{
|
||||
# Usage: HaikuInstall <[ install [ and uninstall ] pseudotarget ]>
|
||||
# : <directory> : <sources to install>
|
||||
# : [ <installgrist> ] : [ <install rule> ] ;
|
||||
local install = $(1[1]) ;
|
||||
install ?= install ;
|
||||
local uninstall = $(1[2]) ;
|
||||
uninstall ?= un$(install) ;
|
||||
local dir = $(2) ;
|
||||
local sources = $(3) ;
|
||||
local installgrist = $(4) ;
|
||||
installgrist ?= $(INSTALLGRIST) ;
|
||||
local installRule = $(5) ;
|
||||
installRule ?= Install ;
|
||||
local targets = $(sources:G=$(installgrist)) ;
|
||||
|
||||
NotFile $(install) ;
|
||||
NotFile $(uninstall) ;
|
||||
Depends $(install) : $(targets) ;
|
||||
Clean $(uninstall) : $(targets) ;
|
||||
|
||||
SEARCH on $(sources) += $(SEARCH_SOURCE) ;
|
||||
MakeLocate $(targets) : $(dir) ;
|
||||
|
||||
local source ;
|
||||
for source in $(sources) {
|
||||
local target = $(source:G=$(installgrist)) ;
|
||||
|
||||
Depends $(target) : $(source) ;
|
||||
$(installRule) $(target) : $(source) ;
|
||||
|
||||
if [ on $(target) return $(MODE) ] {
|
||||
Chmod $(target) ;
|
||||
}
|
||||
|
||||
if $(OWNER) && $(CHOWN) {
|
||||
Chown $(target) ;
|
||||
OWNER on $(target) = $(OWNER) ;
|
||||
}
|
||||
|
||||
if $(GROUP) && $(CHGRP) {
|
||||
Chgrp $(target) ;
|
||||
GROUP on $(target) = $(GROUP) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule InstallAbsSymLinkAdapter
|
||||
{
|
||||
# InstallAbsSymLinkAdapter <link> : <link target>
|
||||
if ! [ on $(2) return $(TARGET) ] {
|
||||
TARGET on $(2) = [ on $(2) return $(SEARCH) ] ;
|
||||
}
|
||||
AbsSymLink $(1) : $(2) : : false ;
|
||||
}
|
||||
|
||||
rule HaikuInstallAbsSymLink
|
||||
{
|
||||
# Usage: HaikuInstallAbsSymLink <[ install [ and uninstall ] pseudotarget ]>
|
||||
# : <directory> : <sources to install>
|
||||
# : [ <installgrist> ] ;
|
||||
HaikuInstall $(1) : $(2) : $(3) : $(4) : InstallAbsSymLinkAdapter ;
|
||||
}
|
||||
|
||||
rule InstallRelSymLinkAdapter
|
||||
{
|
||||
# InstallRelSymLinkAdapter <link> : <link target>
|
||||
if ! [ on $(2) return $(TARGET) ] {
|
||||
TARGET on $(2) = [ on $(2) return $(SEARCH) ] ;
|
||||
}
|
||||
RelSymLink $(1) : $(2) : false ;
|
||||
}
|
||||
|
||||
rule HaikuInstallRelSymLink
|
||||
{
|
||||
# Usage: HaikuInstallRelSymLink <[ install [ and uninstall ] pseudotarget ]>
|
||||
# : <directory> : <sources to install>
|
||||
# : [ <installgrist> ] ;
|
||||
HaikuInstall $(1) : $(2) : $(3) : $(4) : InstallRelSymLinkAdapter ;
|
||||
}
|
||||
|
||||
|
||||
rule UnarchiveObjects
|
||||
{
|
||||
# UnarchiveObjects <target objects> : <static object>
|
||||
|
||||
MakeLocateArch $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
SEARCH on $(2) = $(SEARCH_SOURCE) ;
|
||||
}
|
||||
|
||||
actions UnarchiveObjects
|
||||
{
|
||||
( cd $(1[1]:D) && $(TARGET_AR) $(TARGET_UNARFLAGS) "$(2)" $(1:BS) )
|
||||
}
|
||||
|
||||
|
||||
rule ObjectReference
|
||||
{
|
||||
# ObjectReference <reference object> : <source object>
|
||||
# Makes <reference object> refer to the same file as <source object>.
|
||||
# The filenames must of course be identical.
|
||||
# <source object> must have already been LOCATEd.
|
||||
|
||||
local ref = $(1) ;
|
||||
local source = $(2) ;
|
||||
if $(ref) != $(source) {
|
||||
Depends $(ref) : $(source) ;
|
||||
LOCATE on $(ref) = [ on $(source) return $(LOCATE) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectReferences
|
||||
{
|
||||
# ObjectReferences <source objects>
|
||||
# Creates local references to <source objects>, i.e. identifiers with the
|
||||
# current grist referring to the same files. <source objects> must have
|
||||
# already been LOCATEd.
|
||||
|
||||
local source ;
|
||||
for source in $(1) {
|
||||
ObjectReference [ FGristFiles $(source) ] : $(source) ;
|
||||
}
|
||||
}
|
||||
|
85
build/jam/FreetypeRules
Normal file
85
build/jam/FreetypeRules
Normal file
@ -0,0 +1,85 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# FreeType 2 specific rules and variables
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
FT2_INCLUDE = [ FDirName $(HAIKU_TOP) headers libs freetype2 ] ;
|
||||
FT2_SRC = [ FDirName $(HAIKU_TOP) src libs freetype2 ] ;
|
||||
|
||||
FT2_LIB = freetype ;
|
||||
|
||||
FT2_COMPONENTS ?= gzip # support for gzip-compressed files.
|
||||
autohint # auto-hinter
|
||||
autofit
|
||||
base # base component (public APIs)
|
||||
bdf # BDF font driver
|
||||
cache # cache sub-system
|
||||
cff # CFF/CEF font driver
|
||||
cid # Postscript CID-keyed font driver
|
||||
lzw # LZW routines
|
||||
otvalid
|
||||
pcf # PCF font driver
|
||||
pfr # PFR/TrueDoc font driver
|
||||
psaux # Common Postscript routines module
|
||||
pshinter # Postscript hinter module
|
||||
psnames # Postscript names handling
|
||||
raster # Monochrome rasterizer
|
||||
smooth # Anti-aliased rasterizer
|
||||
sfnt # SFNT-based format support routines
|
||||
truetype # TrueType font driver
|
||||
type1 # Postscript Type 1 font driver
|
||||
type42 # Postscript Type 42 (embedded TrueType) driver
|
||||
winfonts # Windows FON/FNT font driver
|
||||
;
|
||||
|
||||
rule UseFreeTypeHeaders
|
||||
{
|
||||
SubDirSysHdrs $(FT2_INCLUDE) ;
|
||||
}
|
||||
|
||||
rule UseFreeTypeObjectHeaders
|
||||
{
|
||||
# UseFreeTypeObjectHeaders <sources> [ : <objects> ] ;
|
||||
SourceSysHdrs $(1) : $(FT2_INCLUDE) : $(2) ;
|
||||
}
|
||||
|
||||
rule FT2_SubDir
|
||||
{
|
||||
# FT2_SubDir <dir>
|
||||
# <dir>: Components of a directory in the original hierarchy.
|
||||
local dir = $(1) ;
|
||||
local topDir ;
|
||||
switch $(dir[1])
|
||||
{
|
||||
case "include" : topDir = $(FT2_INCLUDE) ;
|
||||
case src : topDir = $(FT2_SRC) ;
|
||||
case * : ECHO "Unknown FreeType2 directory: " $(dir) ;
|
||||
}
|
||||
return [ FDirName $(topDir) $(dir[2-]) ] ;
|
||||
}
|
||||
|
||||
rule FT2_Library
|
||||
{
|
||||
# FT2_Library <libname> : <sources>
|
||||
# Builds objects from sources and adds the objects to the list of objects
|
||||
# to be linked into the library.
|
||||
# <libname> The name of the library.
|
||||
# <sources> The sources.
|
||||
|
||||
local library = lib$(1).so ;
|
||||
local sources = $(2) ;
|
||||
|
||||
Objects $(sources) ;
|
||||
LIBRARY_OBJECTS on $(library) += [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
rule FT2_LinkLibrary
|
||||
{
|
||||
# FT2_LinkLibrary <libname>
|
||||
# Links the library from the objects build with FT2_LIBRARY before.
|
||||
|
||||
local library = lib$(1).so ;
|
||||
local objects = [ on $(library) return $(LIBRARY_OBJECTS) ] ;
|
||||
ObjectReferences $(objects) ;
|
||||
objects = [ FGristFiles $(objects) ] ;
|
||||
SharedLibraryFromObjects $(library) : $(objects) ;
|
||||
}
|
303
build/jam/HaikuImage
Normal file
303
build/jam/HaikuImage
Normal file
@ -0,0 +1,303 @@
|
||||
|
||||
# create directories that will remain empty
|
||||
AddDirectoryToHaikuImage home Desktop ;
|
||||
AddDirectoryToHaikuImage var log ;
|
||||
AddDirectoryToHaikuImage var tmp ;
|
||||
|
||||
# TODO: Remove the variables we don't need.
|
||||
BEOS_BIN = touch sync ln listarea listattr listsem listport
|
||||
true false ls df mount unmount cp mv ps sh mkdir sleep
|
||||
grep cat less clockconfig du rm date find locate xargs
|
||||
isvolume shutdown safemode sysinfo kill diff cmp
|
||||
renice rmattr addattr listdev pwd chmod chown chgrp dd
|
||||
tee md5sum catattr query lsindex mkindex roster listimage
|
||||
quit open translate setvolume waitfor uname iroster keymap
|
||||
strace rmdir error ifconfig ping traceroute arp pppconfig
|
||||
ppp_up gdb tail head zip unzip mountvolume top finddir groups
|
||||
id env basename factor tty dstcheck comm modifiers version
|
||||
csplit cut beep screen_blanker fortune play eject uptime sed gawk mimeset
|
||||
dirname
|
||||
;
|
||||
|
||||
BEOS_APPS = MiniTerminal Terminal Expander People ShowImage Clock Pulse
|
||||
Playground SoundRecorder BitmapDrawing Magnify DiskProbe AboutHaiku
|
||||
StyledEdit CDPlayer
|
||||
;
|
||||
BEOS_PREFERENCES = Backgrounds DataTranslations FileTypes Fonts Media Menu
|
||||
Mouse Keyboard Keymap Screen ScrollBar Sounds Time VirtualMemory
|
||||
Workspaces ScreenSaver
|
||||
;
|
||||
BEOS_SYSTEM_LIB = libbe.so libstdc++.r4.so libnet.so libmedia.so libtracker.so
|
||||
libtranslation.so libbind.so libnetapi.so libsocket.so libdebug.so
|
||||
libtextencoding.so libz.so libfreetype.so libpng.so libappserver.so
|
||||
libdevice.so libgame.so libscreensaver.so libroot.so
|
||||
;
|
||||
BEOS_SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server
|
||||
media_addon_server input_server app_server fake_app_server
|
||||
;
|
||||
|
||||
BEOS_NETWORK_CORE = core ;
|
||||
BEOS_NETWORK_INTERFACES = ethernet loopback ppp ;
|
||||
BEOS_NETWORK_PPP = ipcp modem pap pppoe ;
|
||||
BEOS_NETWORK_PROTOCOLS = icmp ipv4 raw route tcp udp ;
|
||||
|
||||
BEOS_ADD_ONS_ACCELERANTS = radeon.accelerant nv.accelerant mga.accelerant
|
||||
nm.accelerant vesa.accelerant
|
||||
;
|
||||
BEOS_ADD_ONS_TRANSLATORS = STXTTranslator RTF-Translator PNGTranslator
|
||||
JPEGTranslator GIFTranslator
|
||||
;
|
||||
BEOS_ADD_ONS_MEDIA = mixer.media_addon legacy.media_addon
|
||||
multi_audio.media_addon
|
||||
;
|
||||
BEOS_ADD_ONS_MEDIA_PLUGINS = aiff_reader avcodec mp3_decoder musepack
|
||||
raw_decoder wav_reader mov_reader au_reader avi_reader mp3_reader ogg
|
||||
speex vorbis
|
||||
# ac3_decoder theora matroska
|
||||
;
|
||||
BEOS_ADD_ONS_INPUT = <input>keyboard <input>mouse canna screen_saver ;
|
||||
BEOS_ADD_ONS_SCREENSAVERS = Haiku ;
|
||||
BEOS_ADD_ONS_DRIVERS_AUDIO = ich_ac97 auvia emuxki ;
|
||||
BEOS_ADD_ONS_DRIVERS_GRAPHICS = radeon.driver nv.driver nm.driver mga.driver
|
||||
vesa
|
||||
;
|
||||
BEOS_ADD_ONS_DRIVERS_MISC = keyboard scsi_dsk scsi_cd dprintf null zero random
|
||||
ps2_hid <driver>tty console <driver>config
|
||||
;
|
||||
BEOS_ADD_ONS_DRIVERS_NET = ipro1000 rtl8139 rtl8169 sis900
|
||||
via-rhine wb840 net_stack_driver
|
||||
# bcm440x bcm570x (only available with GPLd add-ons)
|
||||
;
|
||||
BEOS_ADD_ONS_BUS_MANAGERS = pci isa ide scsi config_manager ;
|
||||
BEOS_ADD_ONS_KERNEL_MISC = ide_isa generic_ide_pci block_io fast_log
|
||||
ide_adapter locked_pool scsi_periph intel keyboard vga_text
|
||||
;
|
||||
BEOS_ADD_ONS_FILESYSTEMS = bfs ;
|
||||
BEOS_DATA_FILES = timezone_files keymap_files ;
|
||||
|
||||
|
||||
# modules
|
||||
AddFilesToHaikuImage beos system add-ons kernel bus_managers
|
||||
: $(BEOS_ADD_ONS_BUS_MANAGERS) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel busses ide
|
||||
: generic_ide_pci ide_isa ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel console : vga_text ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel file_systems : bfs ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel generic
|
||||
: block_io fast_log ide_adapter locked_pool scsi_periph ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel partitioning_systems : intel ;
|
||||
|
||||
# drivers
|
||||
AddDriversToHaikuImage : console dprintf keyboard null random
|
||||
<driver>tty zero ;
|
||||
AddDriversToHaikuImage audio multi : $(BEOS_ADD_ONS_DRIVERS_AUDIO) ;
|
||||
AddDriversToHaikuImage disk scsi : scsi_cd scsi_dsk ;
|
||||
AddDriversToHaikuImage graphics : $(BEOS_ADD_ONS_DRIVERS_GRAPHICS) ;
|
||||
AddDriversToHaikuImage input : ps2_hid ;
|
||||
AddDriversToHaikuImage misc : <driver>config ;
|
||||
AddDriversToHaikuImage net : $(BEOS_ADD_ONS_DRIVERS_NET) ;
|
||||
|
||||
# kernel
|
||||
AddFilesToHaikuImage beos system : kernel_$(TARGET_ARCH) ;
|
||||
|
||||
# libs
|
||||
AddFilesToHaikuImage beos system lib : $(BEOS_SYSTEM_LIB) rld.so ;
|
||||
|
||||
# servers
|
||||
AddFilesToHaikuImage beos system servers : $(BEOS_SYSTEM_SERVERS) ;
|
||||
|
||||
# apps
|
||||
AddFilesToHaikuImage beos : Deskbar Tracker ;
|
||||
AddFilesToHaikuImage beos bin : $(BEOS_BIN) consoled <bin>route ;
|
||||
AddFilesToHaikuImage beos apps : $(BEOS_APPS) ;
|
||||
AddFilesToHaikuImage beos preferences : $(BEOS_PREFERENCES) ;
|
||||
|
||||
AddSymlinkToHaikuImage beos bin : more : less ;
|
||||
|
||||
|
||||
# scripts and data files
|
||||
local bootScripts = Bootscript SetupEnvironment Netscript ;
|
||||
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
||||
AddFilesToHaikuImage beos system boot : $(bootScripts) ;
|
||||
|
||||
# TODO: Use data/etc/termcap or src/libs/termcap.src?
|
||||
local etcFiles = fortunes profile termcap ;
|
||||
etcFiles = $(etcFiles:G=etc) ;
|
||||
SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ;
|
||||
AddFilesToHaikuImage beos etc : $(etcFiles) ;
|
||||
|
||||
local fontDir = [ FDirName $(HAIKU_TOP) data etc fonts ] ;
|
||||
local psFonts = [ Glob $(fontDir)/psfonts : *.afm *.pfb ] ;
|
||||
local ttFonts = [ Glob $(fontDir)/ttfonts : *.ttf ] ;
|
||||
AddFilesToHaikuImage beos etc fonts psfonts : $(psFonts) ;
|
||||
AddFilesToHaikuImage beos etc fonts ttfonts : $(ttFonts) ;
|
||||
|
||||
local kanbeDir = [ FDirName $(HAIKU_TOP) data etc KanBe ] ;
|
||||
local kanbeDefault = [ Glob $(kanbeDir)/default : *.canna *.gz ] ;
|
||||
local kanbeDic = [ Glob $(kanbeDir)/dic : *.cbp ] ;
|
||||
local kanbeDicCanna = [ Glob $(kanbeDir)/dic/canna
|
||||
: *.cld *.ctd *.cbd *.dir ] ;
|
||||
AddFilesToHaikuImage beos etc KanBe default : $(kanbeDefault) ;
|
||||
AddFilesToHaikuImage beos etc KanBe dic : $(kanbeDic) ;
|
||||
AddFilesToHaikuImage beos etc KanBe dic canna : $(kanbeDicCanna) ;
|
||||
AddDirectoryToHaikuImage beos etc KanBe dic group ;
|
||||
AddDirectoryToHaikuImage beos etc KanBe dic user ;
|
||||
|
||||
# TODO: We must get rid of this earlier or later.
|
||||
#
|
||||
# if [ -e /boot/beos/etc/fonts/ttfonts/Swiss721.ttf ]; then
|
||||
# $cp ${sPrefix}/boot/beos/etc/fonts/ttfonts/Courier10Pitch.ttf $targetDir/beos/etc/fonts/ttfonts/
|
||||
# $cp ${sPrefix}/boot/beos/etc/fonts/ttfonts/Swiss721_Bold.ttf $targetDir/beos/etc/fonts/ttfonts/
|
||||
# $cp ${sPrefix}/boot/beos/etc/fonts/ttfonts/Swiss721.ttf $targetDir/beos/etc/fonts/ttfonts/
|
||||
# fi
|
||||
|
||||
local libnetFiles = networks protocols resolv.conf services ;
|
||||
libnetFiles = $(libnetFiles:G=libnet-files) ;
|
||||
SEARCH on $(libnetFiles) = [ FDirName $(HAIKU_TOP) src kits network libnet ] ;
|
||||
AddFilesToHaikuImage beos etc : $(libnetFiles) ;
|
||||
|
||||
local keymapFiles = [ GLOB $(SUBDIR) : *.keymap ] ;
|
||||
keymapFiles = $(keymapFiles:BG=keymap) ;
|
||||
AddFilesToHaikuImage beos etc Keymap : $(libnetFiles) ;
|
||||
|
||||
local timezones = [ FTimeZoneBinaries $(HAIKU_TIME_ZONE_SOURCES) : : true ] ;
|
||||
for timezone in $(timezones) {
|
||||
local dir = [ on $(timezone) return $(RELATIVE_TIMEZONE_DIR) ] ;
|
||||
AddFilesToHaikuImage beos etc timezones $(dir) : $(timezone) ;
|
||||
}
|
||||
|
||||
local driverSettingsFiles = <driver-settings>kernel ;
|
||||
SEARCH on $(driverSettingsFiles)
|
||||
= [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ;
|
||||
AddFilesToHaikuImage home config settings kernel drivers
|
||||
: $(driverSettingsFiles) ;
|
||||
# TODO: This looks like it belongs to someones UserBuildConfig.
|
||||
# if [ -e data/settings/kernel/drivers/vesa ]; then
|
||||
# $cp ${sPrefix}data/settings/kernel/drivers/vesa \
|
||||
# $targetDir/home/config/settings/kernel/drivers/
|
||||
# fi
|
||||
|
||||
AddSymlinkToHaikuImage home config settings
|
||||
: /boot/beos/etc/timezones/Europe/Paris : timezone ;
|
||||
|
||||
AddFilesToHaikuImage home config settings kernel drivers
|
||||
: <keymap>US-International : Key_map ;
|
||||
|
||||
# boot loader
|
||||
AddFilesToHaikuImage beos system : zbeos ;
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinks config_manager bfs block_io fast_log generic_ide_pci isa
|
||||
ide ide_adapter ide_isa intel locked_pool pci scsi scsi_cd scsi_dsk
|
||||
scsi_periph
|
||||
;
|
||||
|
||||
# add-ons
|
||||
AddFilesToHaikuImage beos system add-ons accelerants
|
||||
: $(BEOS_ADD_ONS_ACCELERANTS) ;
|
||||
AddFilesToHaikuImage beos system add-ons Translators
|
||||
: $(BEOS_ADD_ONS_TRANSLATORS) ;
|
||||
AddFilesToHaikuImage beos system add-ons media : $(BEOS_ADD_ONS_MEDIA) ;
|
||||
AddFilesToHaikuImage beos system add-ons media plugins
|
||||
: $(BEOS_ADD_ONS_MEDIA_PLUGINS) ;
|
||||
AddFilesToHaikuImage beos system add-ons input_server devices
|
||||
: <input>keyboard <input>mouse ;
|
||||
AddFilesToHaikuImage beos system add-ons input_server filters : screen_saver ;
|
||||
AddFilesToHaikuImage beos system add-ons input_server methods : canna ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network
|
||||
: $(BEOS_NETWORK_CORE) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network interfaces
|
||||
: $(BEOS_NETWORK_INTERFACES) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network ppp
|
||||
: $(BEOS_NETWORK_PPP) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network protocols
|
||||
: $(BEOS_NETWORK_PROTOCOLS) ;
|
||||
AddFilesToHaikuImage beos system add-ons Screen\ Savers
|
||||
: $(BEOS_ADD_ONS_SCREENSAVERS) ;
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# Set image name and directory defaults and locate the image.
|
||||
HAIKU_IMAGE_NAME ?= haiku.image ;
|
||||
HAIKU_IMAGE_DIR ?= $(HAIKU_OUTPUT_DIR) ;
|
||||
HAIKU_IMAGE ?= $(HAIKU_IMAGE_NAME) ;
|
||||
HAIKU_IMAGE_SIZE ?= 80 ; # 80 MB
|
||||
MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ;
|
||||
|
||||
# Set the default installation directory.
|
||||
HAIKU_INSTALL_DIR ?= /haiku ;
|
||||
|
||||
# the pseudo target all image contents is attached to
|
||||
NotFile haiku-image-contents ;
|
||||
|
||||
# prepare the script that initializes the shell variables
|
||||
HAIKU_IMAGE_INIT_VARIABLES_SCRIPT = <HaikuImage>haiku.image-init-vars ;
|
||||
local script = $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
|
||||
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
|
||||
AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
|
||||
#AddVariableToScript $(script) : isImage : 1 ;
|
||||
AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
|
||||
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
||||
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
||||
AddTargetVariableToScript $(script) : bfs_shell : bfsShell ;
|
||||
AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ;
|
||||
AddTargetVariableToScript $(script) : <build>copyattr ;
|
||||
AddTargetVariableToScript $(script) : <build>makebootable ;
|
||||
AddTargetVariableToScript $(script) : <build>rc ;
|
||||
AddTargetVariableToScript $(script) : <build>resattr ;
|
||||
#AddTargetVariableToScript $(script) : $(HAIKU_IMAGE) : imagePath ;
|
||||
# causes a cyclic dependency
|
||||
AddVariableToScript $(script) : imagePath
|
||||
: [ FDirName $(HAIKU_IMAGE_DIR) $(HAIKU_IMAGE_NAME) ] ;
|
||||
|
||||
# create the other scripts
|
||||
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;
|
||||
HAIKU_IMAGE_COPY_FILES_SCRIPT = <HaikuImage>haiku.image-copy-files ;
|
||||
MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
: $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ;
|
||||
CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
|
||||
|
||||
# Convenience wrapper rule around BuildHaikuImage.
|
||||
rule _BuildHaikuImage
|
||||
{
|
||||
# _BuildHaikuImage <image target> : <isImage> ;
|
||||
#
|
||||
local image = $(1) ;
|
||||
local isImage = $(2) ;
|
||||
|
||||
# build the image
|
||||
# HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be
|
||||
# specified by the user.
|
||||
BuildHaikuImage $(image) :
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_EARLY_USER_SCRIPTS)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
|
||||
: $(isImage)
|
||||
;
|
||||
|
||||
# remove the scripts we have generated
|
||||
RmTemps $(image) :
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
;
|
||||
}
|
||||
|
||||
# build the image
|
||||
_BuildHaikuImage $(HAIKU_IMAGE) : true ;
|
||||
NotFile haiku-image ;
|
||||
Depends haiku-image : $(HAIKU_IMAGE) ;
|
||||
|
||||
# install Haiku into a directory
|
||||
NotFile install-haiku ;
|
||||
_BuildHaikuImage install-haiku : 0 ;
|
358
build/jam/HeadersRules
Normal file
358
build/jam/HeadersRules
Normal file
@ -0,0 +1,358 @@
|
||||
|
||||
# FSysIncludes <dirs> ;
|
||||
#
|
||||
# Counterpart of FIncludes for system include search paths.
|
||||
#
|
||||
#if $(OSPLAT) = X86 {
|
||||
rule FSysIncludes { return -I$(<) ; }
|
||||
HDRS_INCLUDES_SEPARATOR = -I- ;
|
||||
# } else {
|
||||
# rule FSysIncludes { return "-i "$(<) ; }
|
||||
# HDRS_INCLUDES_SEPARATOR = -i- ;
|
||||
# }
|
||||
# mwcc support commented out
|
||||
|
||||
rule SubDirSysHdrs
|
||||
{
|
||||
# SubDirSysHdrs <dirs> ;
|
||||
#
|
||||
# Adds directories to the system include search paths for the current
|
||||
# subdirectory. Counterpart of SubDirHdrs which adds non-system include
|
||||
# search paths.
|
||||
#
|
||||
# <dirs>: The directories to be added to the current subdir's system
|
||||
# include search paths.
|
||||
#
|
||||
SUBDIRSYSHDRS += [ FDirName $(1) ] ;
|
||||
}
|
||||
|
||||
rule ObjectSysHdrs
|
||||
{
|
||||
# ObjectSysHdrs <sources or objects> : <headers> : <gristed objects>
|
||||
#
|
||||
# Adds directories to the system include search paths for the given
|
||||
# sources or objects. Counterpart of ObjectHdrs which adds non-system
|
||||
# include search paths.
|
||||
#
|
||||
# NOTE: With this incarnation of the Haiku build system this rule doesn't
|
||||
# need to be invoked *after* the rule that generates the objects anymore.
|
||||
# Actually it is even encouraged to do that *before*. Same for ObjectHdrs.
|
||||
#
|
||||
# <sources or objects>: The targets for which to add system include
|
||||
# search paths.
|
||||
# <dirs>: The directories to be added to the given objects' system
|
||||
# include search paths.
|
||||
#
|
||||
|
||||
local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
|
||||
local headers = $(2) ;
|
||||
|
||||
local file ;
|
||||
for file in $(objects) {
|
||||
on $(file) {
|
||||
local sysHeaders = $(SYSHDRS) $(headers) ;
|
||||
SYSHDRS on $(file) = $(sysHeaders) ;
|
||||
|
||||
# reformat ASHDRS and CCHDRS
|
||||
local fileHeaders = [ FIncludes $(HDRS) ]
|
||||
$(HDRS_INCLUDES_SEPARATOR) [ FIncludes $(sysHeaders) ] ;
|
||||
ASHDRS on $(file) = $(fileHeaders) ;
|
||||
CCHDRS on $(file) = $(fileHeaders) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule SourceHdrs
|
||||
{
|
||||
# SourceHdrs <sources> : <headers> [ : <gristed objects> ] ;
|
||||
#
|
||||
# Is a wrapper for ObjectHdrs, that passes <sources> and <headers> or,
|
||||
# if supplied <objects> and <headers>, and also adjusts HDRSEARCH (not
|
||||
# done by ObjectHdrs).
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local headers = $(2) ;
|
||||
local objects = $(3) ;
|
||||
|
||||
ObjectHdrs $(sources) : $(headers) : $(objects) ;
|
||||
|
||||
# Also add the header search dirs to HDRSEARCH. Note, that these dirs
|
||||
# will be listed after the STDHDRS (if any), but that's better than not
|
||||
# being listed at all.
|
||||
HDRSEARCH on $(sources) += $(headers) ;
|
||||
}
|
||||
|
||||
rule SourceSysHdrs
|
||||
{
|
||||
# SourceSysHdrs <sources> : <headers> [ : <gristed objects> ] ;
|
||||
#
|
||||
# Is a wrapper for ObjectSysHdrs, that passes <sources> and <headers> or,
|
||||
# if supplied <objects> and <headers>, and also adjusts HDRSEARCH (not
|
||||
# done by ObjectSysHdrs).
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local headers = $(2) ;
|
||||
local objects = $(3) ;
|
||||
|
||||
ObjectSysHdrs $(sources) : $(headers) : $(objects) ;
|
||||
|
||||
# Also add the header search dirs to HDRSEARCH. Note, that these dirs
|
||||
# will be listed after the STDHDRS (if any), but that's better than not
|
||||
# being listed at all.
|
||||
HDRSEARCH on $(sources) += $(headers) ;
|
||||
}
|
||||
|
||||
rule PublicHeaders
|
||||
{
|
||||
# PublicHeaders <group list>
|
||||
#
|
||||
# Returns the directory names for the public header dirs identified by
|
||||
# <group list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local dirs = [ FDirName $(HAIKU_TOP) headers os ] ;
|
||||
|
||||
for i in $(list) {
|
||||
dirs += [ FDirName $(HAIKU_TOP) headers os $(i) ] ;
|
||||
}
|
||||
return $(dirs) ;
|
||||
}
|
||||
|
||||
rule PrivateHeaders
|
||||
{
|
||||
# PrivateHeaders <group list>
|
||||
#
|
||||
# Returns the directory names for the private header dirs identified by
|
||||
# <group list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local dirs ;
|
||||
for i in $(list) {
|
||||
dirs += [ FDirName $(HAIKU_TOP) headers private $(i) ] ;
|
||||
}
|
||||
return $(dirs) ;
|
||||
}
|
||||
|
||||
rule LibraryHeaders
|
||||
{
|
||||
# LibraryHeaders <group list>
|
||||
#
|
||||
# Returns the directory names for the library header dirs identified by
|
||||
# <group list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local dirs ;
|
||||
for i in $(list) {
|
||||
dirs += [ FDirName $(HAIKU_TOP) headers libs $(i) ] ;
|
||||
}
|
||||
return $(dirs) ;
|
||||
}
|
||||
|
||||
rule ArchHeaders
|
||||
{
|
||||
# usage: ArchHeaders <arch> ;
|
||||
#
|
||||
# <arch> specifies the architecture (e.g. x86).
|
||||
|
||||
return [ FDirName $(HAIKU_TOP) headers private kernel arch $(1) ] ;
|
||||
}
|
||||
|
||||
rule UseHeaders
|
||||
{
|
||||
# UseHeaders <headers> [ : <system> ] ;
|
||||
#
|
||||
# Adds the C header dirs <headers> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# If <system> is "true", the dirs are added as system otherwise local
|
||||
# search dirs.
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
local header ;
|
||||
if $(2) = true {
|
||||
for header in $(1) {
|
||||
SubDirSysHdrs $(header) ;
|
||||
}
|
||||
} else {
|
||||
for header in $(1) {
|
||||
SubDirHdrs $(header) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule UsePublicHeaders
|
||||
{
|
||||
# UsePublicHeaders <group list> ;
|
||||
#
|
||||
# Adds the public C header dirs given by <group list> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the
|
||||
# objects.
|
||||
|
||||
UseHeaders [ PublicHeaders $(1) ] : true ;
|
||||
}
|
||||
|
||||
rule UsePublicObjectHeaders
|
||||
{
|
||||
# UsePublicObjectHeaders <sources> : <group list> [ : <objects> ] ;
|
||||
#
|
||||
# Adds the public C header dirs given by <group list> to the header search
|
||||
# dirs of either the object targets of <sources> or if supplied to
|
||||
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
SourceSysHdrs $(1) : [ PublicHeaders $(2) ] : $(3) ;
|
||||
}
|
||||
|
||||
rule UsePrivateHeaders
|
||||
{
|
||||
# UsePrivateHeaders <group list> [ : <system> ] ;
|
||||
#
|
||||
# Adds the private C header dirs given by <group list> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# <system> specifies whether to add the dirs as system or local header
|
||||
# search dirs. Defaults to "true".
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
local system = $(2) ;
|
||||
system ?= true ;
|
||||
|
||||
UseHeaders [ PrivateHeaders $(1) ] : $(system) ;
|
||||
}
|
||||
|
||||
rule UsePrivateObjectHeaders
|
||||
{
|
||||
# UsePrivateObjectHeaders <sources> : <group list> [ : <objects>
|
||||
# [ : <system> ] ] ;
|
||||
#
|
||||
# Adds the private C header dirs given by <group list> to the header search
|
||||
# dirs of either the object targets of <sources> or if supplied to
|
||||
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
||||
# <system> specifies whether to add the dirs as system or local header
|
||||
# search dirs. Defaults to "true".
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
local system = $(4) ;
|
||||
system ?= true ;
|
||||
|
||||
if $(system) = true {
|
||||
SourceSysHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
|
||||
} else {
|
||||
SourceHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule UseCppUnitHeaders
|
||||
{
|
||||
SubDirSysHdrs [ FDirName $(HAIKU_TOP) headers tools cppunit ] ;
|
||||
}
|
||||
|
||||
rule UseCppUnitObjectHeaders
|
||||
{
|
||||
# UseCppUnitObjectHeaders <sources> [ : <objects> ] ;
|
||||
SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers tools cppunit ]
|
||||
: $(2) ;
|
||||
}
|
||||
|
||||
rule UseArchHeaders
|
||||
{
|
||||
# usage: UseArchHeaders <arch> ;
|
||||
#
|
||||
# <arch> specifies the architecture (e.g. x86).
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
local headers = [ ArchHeaders $(1) ] ;
|
||||
|
||||
UseHeaders $(headers) : true ;
|
||||
}
|
||||
|
||||
rule UseArchObjectHeaders
|
||||
{
|
||||
# usage: UseArchObjectHeaders <sources> : <arch> : [ <objects> ] ;
|
||||
#
|
||||
# <arch> specifies the architecture (e.g. x86).
|
||||
# <sources_or_objects> Source or object files.
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
local sources = $(1) ;
|
||||
local headers = [ ArchHeaders $(2) ] ;
|
||||
local objects = $(3) ;
|
||||
local targets ;
|
||||
if $(objects) {
|
||||
targets = $(objects) ;
|
||||
} else {
|
||||
targets = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
SourceSysHdrs $(sources) : $(headers) : $(objects) ;
|
||||
}
|
||||
|
||||
rule UsePosixObjectHeaders
|
||||
{
|
||||
# UsePosixObjectHeaders <sources> [ : <objects> ] ;
|
||||
#
|
||||
# Adds the POSIX header dir to the header search
|
||||
# dirs of either the object targets of <sources> or if supplied to
|
||||
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers posix ] : $(2) ;
|
||||
}
|
||||
|
||||
rule UseLibraryHeaders
|
||||
{
|
||||
# UseLibraryHeaders <group list> ;
|
||||
#
|
||||
# Adds the library header dirs given by <group list> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
UseHeaders [ LibraryHeaders $(1) ] : true ;
|
||||
}
|
||||
|
||||
rule FStandardOSHeaders
|
||||
{
|
||||
local osIncludes = add-ons add-ons/file_system add-ons/graphics
|
||||
add-ons/input_server add-ons/screen_saver
|
||||
add-ons/tracker app device drivers game interface
|
||||
kernel media mail midi midi2 net opengl storage support
|
||||
translation ;
|
||||
|
||||
return [ PublicHeaders $(osIncludes) ] ;
|
||||
}
|
||||
|
||||
rule FStandardHeaders
|
||||
{
|
||||
local osIncludes = add-ons add-ons/file_system add-ons/graphics
|
||||
add-ons/input_server add-ons/screen_saver
|
||||
add-ons/tracker app device drivers game interface
|
||||
kernel media mail midi midi2 net opengl storage support
|
||||
translation ;
|
||||
|
||||
# Use headers directory, to allow to do things like include <posix/string.h>
|
||||
local headers = [ FDirName $(HAIKU_TOP) headers ] ;
|
||||
|
||||
# Use posix headers directory
|
||||
headers += [ FDirName $(HAIKU_TOP) headers posix ] ;
|
||||
|
||||
# Use GNU headers directory
|
||||
headers += [ FDirName $(HAIKU_TOP) headers gnu ] ;
|
||||
|
||||
# Use glibc headers
|
||||
headers += [ FDirName $(HAIKU_TOP) headers glibc ] ;
|
||||
|
||||
headers += [ FDirName $(HAIKU_TOP) headers cpp ] ;
|
||||
|
||||
# Use public OS header directories
|
||||
headers += [ PublicHeaders $(osIncludes) ] ;
|
||||
|
||||
# Use the root of the private headers -- not so nice, but simplifies things.
|
||||
headers += [ PrivateHeaders $(DOT) ] ;
|
||||
|
||||
# The platform (compiler actually) dependent headers.
|
||||
headers += $(HAIKU_GCC_HEADERS_DIR) ;
|
||||
|
||||
return $(headers) ;
|
||||
}
|
||||
|
||||
# SUBDIRSYSHDRS shall be reset automatically for each subdir
|
||||
SUBDIRRESET += SYSHDRS ;
|
248
build/jam/HelperRules
Normal file
248
build/jam/HelperRules
Normal file
@ -0,0 +1,248 @@
|
||||
# Rules without side effects.
|
||||
|
||||
# Vanilla Jam compatibility
|
||||
if ! $(INVOCATION_SUBDIR_SET) {
|
||||
rule FIsPrefix
|
||||
{
|
||||
# FIsPrefix <a> : <b> ;
|
||||
# Returns true, if list <a> is a prefix (a proper one or equal) of
|
||||
# list <b>, an empty list otherwise.
|
||||
local a = $(1) ;
|
||||
local b = $(2) ;
|
||||
while $(a) && $(a[1]) = $(b[1]) {
|
||||
a = $(a[2-]) ;
|
||||
b = $(b[2-]) ;
|
||||
}
|
||||
|
||||
if $(a) {
|
||||
return ;
|
||||
} else {
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
rule LocalClean { Clean $(1) : $(2) ; }
|
||||
|
||||
rule LocalDepends { Depends $(1) : $(2) ; }
|
||||
|
||||
} # vanilla Jam compatibility
|
||||
|
||||
rule FFilter
|
||||
{
|
||||
# FFilter <list> : <excludes> ;
|
||||
# Removes all occurrences of <excludes> in <list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local excludes = $(2) ;
|
||||
local newList ;
|
||||
local item ;
|
||||
for item in $(list) {
|
||||
local skip ;
|
||||
local exclude ;
|
||||
for exclude in $(excludes) {
|
||||
if $(item) = $(exclude) {
|
||||
skip = true ;
|
||||
}
|
||||
}
|
||||
if ! $(skip) {
|
||||
newList += $(item) ;
|
||||
}
|
||||
}
|
||||
return $(newList) ;
|
||||
}
|
||||
|
||||
rule FSplitPath
|
||||
{
|
||||
# SplitPath <path> ;
|
||||
# Decomposes a path into its components.
|
||||
local path = $(1:G=) ;
|
||||
local components ;
|
||||
# $(path:D) for "/" is "/". Therefore the second condition.
|
||||
while $(path:D) && $(path:D) != $(path)
|
||||
{
|
||||
# Note: $(path:B) returns "." for "..", but $(path:D=) is fine.
|
||||
components = $(path:D=) $(components) ;
|
||||
path = $(path:D) ;
|
||||
}
|
||||
components = $(path) $(components) ;
|
||||
return $(components) ;
|
||||
}
|
||||
|
||||
rule FTimeZoneBinaries
|
||||
{
|
||||
local sources = $(1:G=timezone-source) ;
|
||||
local locate = $(2) ;
|
||||
local setRelativeTimezoneDir = $(3) ;
|
||||
|
||||
local gristedBinaries ;
|
||||
|
||||
local source ;
|
||||
for source in $(sources) {
|
||||
local binaries = [ on $(source) return $(TZ_OBJECTS) ] ;
|
||||
|
||||
local targetDir = [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR)
|
||||
data etc timezones ] ;
|
||||
|
||||
local binary ;
|
||||
for binary in $(binaries) {
|
||||
local dir = $(binary:D) ;
|
||||
if $(dir) {
|
||||
binary = $(binary:BSG=timezone!$(dir)) ;
|
||||
if $(locate) {
|
||||
LOCATE on $(binary) = [ FDirName $(targetDir) $(dir) ] ;
|
||||
}
|
||||
} else {
|
||||
binary = $(binary:BSG=timezone) ;
|
||||
if $(locate) {
|
||||
LOCATE on $(binary) = $(targetDir) ;
|
||||
}
|
||||
}
|
||||
|
||||
if $(setRelativeTimezoneDir) {
|
||||
RELATIVE_TIMEZONE_DIR on $(binary) = $(dir) ;
|
||||
}
|
||||
|
||||
gristedBinaries += $(binary) ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(gristedBinaries) ;
|
||||
}
|
||||
|
||||
|
||||
rule SetPlatformCompatibilityFlagVariables
|
||||
{
|
||||
# SetPlatformCompatibilityFlagVariables <platform var> : <var prefix>
|
||||
# : <platform kind> [ : other platforms ] ;
|
||||
|
||||
local platformVar = $(1) ;
|
||||
local platform = $($(platformVar)) ;
|
||||
local varPrefix = $(2) ;
|
||||
local platformKind = $(3) ;
|
||||
local otherPlatforms = $(4) ;
|
||||
|
||||
if ! $(platform) {
|
||||
ECHO "Variable $(platformVar) not set. Please run ./configure or" ;
|
||||
EXIT "specify it manually." ;
|
||||
}
|
||||
|
||||
$(varPrefix)_PLATFORM_BEOS_COMPATIBLE = ;
|
||||
$(varPrefix)_PLATFORM_BONE_COMPATIBLE = ;
|
||||
$(varPrefix)_PLATFORM_DANO_COMPATIBLE = ;
|
||||
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = ;
|
||||
|
||||
switch $(platform)
|
||||
{
|
||||
case r5 :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_BEOS_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case bone :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_BONE_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case dano :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_DANO_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case haiku :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case * :
|
||||
{
|
||||
if ! ( $(platform) in $(otherPlatforms) ) {
|
||||
Exit Unsupported $(platformKind) platform: $(platform) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# set lesser flags, e.g. "DANO" for "HAIKU" and "BEOS" for "BONE"
|
||||
$(varPrefix)_PLATFORM_DANO_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_BONE_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_DANO_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_BEOS_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_BONE_COMPATIBLE) ;
|
||||
|
||||
# set the machine friendly flags
|
||||
$(varPrefix)_PLATFORM_(haiku)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_(dano)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_DANO_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_(bone)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_BONE_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_(r5)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_BEOS_COMPATIBLE) ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
rule SetPlatformForTarget
|
||||
{
|
||||
# SetPlatformForTarget <target> : <platform> ;
|
||||
|
||||
PLATFORM on $(1) = $(2) ;
|
||||
}
|
||||
|
||||
rule SetSubDirPlatform
|
||||
{
|
||||
# SetSubDirPlatform <platform> ;
|
||||
|
||||
PLATFORM = $(1) ;
|
||||
}
|
||||
|
||||
rule SetSupportedPlatformsForTarget
|
||||
{
|
||||
# SetSupportedPlatformsForTarget <target> : <platforms> ;
|
||||
|
||||
SUPPORTED_PLATFORMS on $(1) = $(2) ;
|
||||
}
|
||||
|
||||
rule SetSubDirSupportedPlatforms
|
||||
{
|
||||
# SetSubDirSupportedPlatforms <platforms> ;
|
||||
|
||||
SUPPORTED_PLATFORMS = $(1) ;
|
||||
}
|
||||
|
||||
rule SetSubDirSupportedPlatformsBeOSCompatible
|
||||
{
|
||||
# SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
SUPPORTED_PLATFORMS = $(HAIKU_BEOS_COMPATIBLE_PLATFORMS) ;
|
||||
}
|
||||
|
||||
rule IsPlatformSupportedForTarget
|
||||
{
|
||||
# IsPlatformSupportedForTarget <target> [ : <platform> ]
|
||||
#
|
||||
|
||||
on $(1) {
|
||||
if $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return true ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule InheritPlatform
|
||||
{
|
||||
# InheritPlatform <children> : <parent> ;
|
||||
# PLATFORM and SUPPORTED_PLATFORMS are set on <children> to their value
|
||||
# on <parent>.
|
||||
#
|
||||
local children = $(1) ;
|
||||
local parent = $(2) ;
|
||||
|
||||
on $(parent) {
|
||||
PLATFORM on $(children) = $(PLATFORM) ;
|
||||
SUPPORTED_PLATFORMS on $(children) = $(SUPPORTED_PLATFORMS) ;
|
||||
}
|
||||
}
|
341
build/jam/ImageRules
Normal file
341
build/jam/ImageRules
Normal file
@ -0,0 +1,341 @@
|
||||
rule FSameTargetWithPrependedGrist
|
||||
{
|
||||
# SameTargetWithPrependedGrist <target> : <grist to prepend> ;
|
||||
#
|
||||
local target = $(1) ;
|
||||
local gristToPrepend = $(2) ;
|
||||
local grist = $(target:G) ;
|
||||
|
||||
if $(grist) {
|
||||
grist = $(gristToPrepend)!$(grist) ;
|
||||
} else {
|
||||
grist = $(gristToPrepend) ;
|
||||
}
|
||||
|
||||
return $(target:G=$(grist)) ;
|
||||
}
|
||||
|
||||
rule InitScript
|
||||
{
|
||||
# Note: The script must have been LOCATEd before.
|
||||
local script = $(1) ;
|
||||
local initScript
|
||||
= [ FSameTargetWithPrependedGrist $(script) : init-script ] ;
|
||||
|
||||
if ! [ on $(script) return $(__is_initialized) ] {
|
||||
__is_initialized on $(script) = true ;
|
||||
|
||||
MakeLocate $(initScript) : [ on $(script) return $(LOCATE) ] ;
|
||||
Always $(initScript) ;
|
||||
Depends $(script) : $(initScript) ;
|
||||
|
||||
InitScript1 $(initScript) ;
|
||||
}
|
||||
|
||||
return $(initScript) ;
|
||||
}
|
||||
|
||||
actions InitScript1
|
||||
{
|
||||
rm -f $(1)
|
||||
echo -n > $(1)
|
||||
}
|
||||
|
||||
rule AddVariableToScript
|
||||
{
|
||||
# AddVariableToScript <script> : <variable> : <value> ;
|
||||
#
|
||||
local script = $(1) ;
|
||||
local variable = $(2) ;
|
||||
local value = $(3) ;
|
||||
|
||||
InitScript $(script) ;
|
||||
|
||||
VARIABLE_DEFS on $(script) += "echo $(variable)=\\\"$(value)\\\" >> " ;
|
||||
|
||||
AddVariableToScript1 $(script) ;
|
||||
}
|
||||
|
||||
actions together AddVariableToScript1
|
||||
{
|
||||
$(VARIABLE_DEFS)$(1);
|
||||
}
|
||||
|
||||
rule AddTargetVariableToScript
|
||||
{
|
||||
# AddTargetVariableToScript <script> : <target> [ : <variable> ] ;
|
||||
#
|
||||
local script = $(1) ;
|
||||
local target = $(2) ;
|
||||
local variable = $(3:E=$(target:BS)) ;
|
||||
|
||||
InitScript $(script) ;
|
||||
|
||||
# That's not completely save, if one has more than on target with the
|
||||
# same base name. A unique pseudo target would have to be introduced
|
||||
# to do it more correctly.
|
||||
VARIABLE_NAME($(target:BS)) on $(script) = $(variable) ;
|
||||
|
||||
Depends $(script) : $(target) ;
|
||||
AddTargetVariableToScript1 $(script) : $(target) ;
|
||||
}
|
||||
|
||||
actions AddTargetVariableToScript1
|
||||
{
|
||||
echo "$(VARIABLE_NAME($(2:BS)))=\"$(2)\"" >> $(1)
|
||||
}
|
||||
|
||||
|
||||
rule AddDirectoryToHaikuImage
|
||||
{
|
||||
# AddDirectoryToHaikuImage <directory>
|
||||
local directoryTokens = $(1) ;
|
||||
local directory = [ FDirName $(directoryTokens) ] ;
|
||||
directory = $(directory:G=HaikuImage) ;
|
||||
|
||||
if ! [ on $(directory) return $(__is_on_image) ] {
|
||||
INSTALL_DIRECTORIES on haiku-image-contents += $(directory) ;
|
||||
__is_on_image on $(directory) = true ;
|
||||
NotFile $(directory) ;
|
||||
|
||||
# mark the parent dir as not to be created
|
||||
local parent = [ FReverse $(directoryTokens) ] ;
|
||||
parent = [ FReverse $(parent[2-]) ] ;
|
||||
if $(parent) {
|
||||
parent = [ FDirName $(parent) ] ;
|
||||
parent = $(parent:G=HaikuImage) ;
|
||||
DONT_CREATE on $(parent) = true ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(directory) ;
|
||||
}
|
||||
|
||||
rule AddFilesToHaikuImage
|
||||
{
|
||||
# AddFilesToHaikuImage <directory> : <targets> [ : dest name ]
|
||||
#
|
||||
local directory = [ AddDirectoryToHaikuImage $(1) ] ;
|
||||
local targets = $(2) ;
|
||||
local destName = $(3) ;
|
||||
|
||||
INSTALL_DIR on $(targets) = $(directory) ;
|
||||
TARGETS_TO_INSTALL on $(directory) += $(targets) ;
|
||||
|
||||
if $(destName) {
|
||||
INSTALL_TARGET_NAME on $(targets) = $(destName) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AddSymlinkToHaikuImage
|
||||
{
|
||||
# AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ;
|
||||
#
|
||||
local directory = [ AddDirectoryToHaikuImage $(1) ] ;
|
||||
local linkTarget = $(2) ;
|
||||
local linkName = $(3) ;
|
||||
|
||||
if ! $(linkName) {
|
||||
local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ;
|
||||
linkName = $(path[1]) ;
|
||||
}
|
||||
|
||||
local link = $(directory)/$(linkName) ;
|
||||
SYMLINK_TARGET on $(link) = $(linkTarget) ;
|
||||
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
|
||||
}
|
||||
|
||||
rule AddDriversToHaikuImage
|
||||
{
|
||||
# AddDriversToHaikuImage <relative directory> : <targets> ;
|
||||
#
|
||||
local relativeDirectoryTokens = $(1) ;
|
||||
local targets = $(2) ;
|
||||
local directoryTokens = beos system add-ons kernel drivers dev
|
||||
$(relativeDirectoryTokens) ;
|
||||
|
||||
AddFilesToHaikuImage beos system add-ons kernel drivers bin : $(targets) ;
|
||||
|
||||
# get the relative symlink path prefix
|
||||
local linkPrefix = ;
|
||||
for i in $(relativeDirectoryTokens) {
|
||||
linkPrefix += .. ;
|
||||
}
|
||||
linkPrefix += .. bin ;
|
||||
|
||||
# add the symlinks
|
||||
local name ;
|
||||
for name in $(targets:BS) {
|
||||
AddSymlinkToHaikuImage $(directoryTokens)
|
||||
: [ FDirName $(linkPrefix) $(name) ] : $(name) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AddBootModuleSymlinks
|
||||
{
|
||||
# AddBootModuleSymlinks <targets> ;
|
||||
#
|
||||
local targets = $(1) ;
|
||||
|
||||
# add the symlinks
|
||||
local target ;
|
||||
for target in $(targets) {
|
||||
local installDir = [ on $(target) return $(INSTALL_DIR) ] ;
|
||||
|
||||
if ! $(installDir) {
|
||||
Echo "ERROR: AddBootModuleSymlinks: Can't create a symlink to"
|
||||
"target" \"$(target)"\"." ;
|
||||
Exit "ERROR: Add*ToHaikuImage has not been invoked for it yet." ;
|
||||
}
|
||||
|
||||
local name = $(target:BS) ;
|
||||
local linkTarget = [ FDirName /boot $(installDir:G=) $(name) ] ;
|
||||
|
||||
AddSymlinkToHaikuImage beos system add-ons kernel boot
|
||||
: $(linkTarget) : $(name) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule CreateHaikuImageMakeDirectoriesScript
|
||||
{
|
||||
local script = $(1) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
local initScript = [ InitScript $(script) ] ;
|
||||
|
||||
local scriptBody
|
||||
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
||||
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
||||
Depends $(scriptBody) : $(initScript) ;
|
||||
Depends $(script) : $(scriptBody) ;
|
||||
|
||||
local dirsToCreate ;
|
||||
local dir ;
|
||||
for dir in [ on haiku-image-contents return $(INSTALL_DIRECTORIES) ] {
|
||||
if ! [ on $(dir) return $(DONT_CREATE) ] {
|
||||
dirsToCreate += $(dir) ;
|
||||
}
|
||||
}
|
||||
|
||||
Depends $(scriptBody) : $(dirsToCreate) ;
|
||||
CreateHaikuImageMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ;
|
||||
}
|
||||
|
||||
actions piecemeal CreateHaikuImageMakeDirectoriesScript1
|
||||
{
|
||||
echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1)
|
||||
}
|
||||
|
||||
rule CreateHaikuImageCopyFilesScript
|
||||
{
|
||||
local script = $(1) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
local initScript = [ InitScript $(script) ] ;
|
||||
|
||||
local scriptBody
|
||||
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
||||
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
||||
Depends $(scriptBody) : $(initScript) ;
|
||||
Depends $(script) : $(scriptBody) ;
|
||||
|
||||
local dir ;
|
||||
for dir in [ on haiku-image-contents return $(INSTALL_DIRECTORIES) ] {
|
||||
local targets = [ on $(dir) return $(TARGETS_TO_INSTALL) ] ;
|
||||
|
||||
# filter the targets that shall be renamed; they have to be copied
|
||||
# individually
|
||||
local remainingTargets ;
|
||||
local target ;
|
||||
for target in $(targets) {
|
||||
local destName = [ on $(target) return $(INSTALL_TARGET_NAME) ] ;
|
||||
if $(destName) {
|
||||
# use a unique dummy target for this file, on which we
|
||||
# can define the TARGET_DIR variable
|
||||
local dummyTarget = $(script)-dummy-$(dir:G=)-$(target) ;
|
||||
NotFile $(dummyTarget) ;
|
||||
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
||||
INSTALL_TARGET_NAME on $(dummyTarget) = $(destName) ;
|
||||
|
||||
Depends $(dummyTarget) : $(initScript) $(target) ;
|
||||
Depends $(script) : $(dummyTarget) ;
|
||||
|
||||
AppendToHaikuImageCopyFilesScriptSingleFile $(dummyTarget)
|
||||
: $(initScript) $(target) ;
|
||||
} else {
|
||||
remainingTargets += $(target) ;
|
||||
}
|
||||
}
|
||||
targets = $(remainingTargets) ;
|
||||
|
||||
if $(targets) {
|
||||
# use a unique dummy target for this directory, on which we
|
||||
# can define the TARGET_DIR variable
|
||||
local dummyTarget = $(script)-dummy-$(dir:G=) ;
|
||||
NotFile $(dummyTarget) ;
|
||||
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
||||
|
||||
Depends $(dummyTarget) : $(initScript) $(targets) ;
|
||||
Depends $(script) : $(dummyTarget) ;
|
||||
|
||||
OUTPUT_SCRIPT on $(dummyTarget) = $(initScript) ;
|
||||
AppendToHaikuImageCopyFilesScript $(dummyTarget) : $(targets) ;
|
||||
}
|
||||
|
||||
local symlinks = [ on $(dir) return $(SYMLINKS_TO_INSTALL) ] ;
|
||||
local symlink ;
|
||||
for symlink in $(symlinks) {
|
||||
NotFile $(symlink) ;
|
||||
|
||||
Depends $(script) : $(symlink) ;
|
||||
Depends $(symlink) : $(initScript) ;
|
||||
|
||||
AddSymlinkToHaikuImageCopyFilesScript $(symlink) : $(initScript) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions piecemeal AppendToHaikuImageCopyFilesScript bind OUTPUT_SCRIPT
|
||||
{
|
||||
echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" >> $(OUTPUT_SCRIPT)
|
||||
}
|
||||
|
||||
actions AppendToHaikuImageCopyFilesScriptSingleFile
|
||||
{
|
||||
echo \$cp "\"\${sPrefix}$(2[2])\"" \
|
||||
"\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1])
|
||||
}
|
||||
|
||||
actions AddSymlinkToHaikuImageCopyFilesScript
|
||||
{
|
||||
echo \$ln -sf "\"$(SYMLINK_TARGET)\"" "\"\${tPrefix}$(1:G=)\"" >> $(2[1])
|
||||
}
|
||||
|
||||
rule BuildHaikuImage
|
||||
{
|
||||
# BuildHaikuImage <haiku image> : <scripts> : <is image> ;
|
||||
#
|
||||
local haikuImage = $(1) ;
|
||||
local scripts = $(2) ;
|
||||
local isImage = $(3) ;
|
||||
|
||||
if $(isImage) = 1 || $(isImage) = true {
|
||||
IS_IMAGE on $(haikuImage) = 1 ;
|
||||
} else {
|
||||
IS_IMAGE on $(haikuImage) = "" ;
|
||||
}
|
||||
|
||||
local mainScript = build_haiku_image ;
|
||||
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
||||
|
||||
Depends $(haikuImage) : $(mainScript) $(scripts) ;
|
||||
BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ;
|
||||
}
|
||||
|
||||
actions BuildHaikuImage1
|
||||
{
|
||||
export isImage="$(IS_IMAGE)"
|
||||
$(2[1]) $(2[2-])
|
||||
}
|
137
build/jam/KernelRules
Normal file
137
build/jam/KernelRules
Normal file
@ -0,0 +1,137 @@
|
||||
|
||||
rule SetupKernel
|
||||
{
|
||||
# Usage SetupKernel <sources_or_objects> : <extra_cc_flags>;
|
||||
#
|
||||
# <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
|
||||
# set for the sources and the sources some header
|
||||
# dependencies might be missing.
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
# add private kernel headers
|
||||
SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
|
||||
|
||||
local object ;
|
||||
for object in $(objects) {
|
||||
# add kernel flags for the object
|
||||
ObjectCcFlags $(object) : $(TARGET_KERNEL_CCFLAGS) $(2) ;
|
||||
ObjectC++Flags $(object) : $(TARGET_KERNEL_C++FLAGS) $(2) ;
|
||||
|
||||
# override warning flags
|
||||
TARGET_WARNING_CCFLAGS on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ;
|
||||
TARGET_WARNING_C++FLAGS on $(object)
|
||||
= $(TARGET_KERNEL_WARNING_C++FLAGS) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule KernelObjects
|
||||
{
|
||||
SetupKernel $(1) : $(2) ;
|
||||
Objects $(1) ;
|
||||
}
|
||||
|
||||
rule KernelLd
|
||||
{
|
||||
# KernelLd <name> : <objs> : <linkerscript> : <args> ;
|
||||
|
||||
LINK on $(1) = $(TARGET_LD) ;
|
||||
|
||||
LINKFLAGS on $(1) = $(4) ;
|
||||
if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
|
||||
|
||||
# Remove any preset LINKLIBS, but link against libgcc.a
|
||||
LINKLIBS on $(1) = $(TARGET_GCC_LIBGCC) ;
|
||||
|
||||
# TODO: Do we really want to invoke SetupKernel here? The objects should
|
||||
# have been compiled with KernelObjects anyway, so we're doing that twice.
|
||||
SetupKernel $(2) ;
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
LocalClean clean : $(1) ;
|
||||
LocalDepends all : $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
}
|
||||
|
||||
actions KernelLd
|
||||
{
|
||||
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) ;
|
||||
}
|
||||
|
||||
rule KernelAddon
|
||||
{
|
||||
# KernelAddon <name> : <relpath> : <sources> : <static-libraries> ;
|
||||
|
||||
local sources = $(3) ;
|
||||
|
||||
# platform supported?
|
||||
on $(1) {
|
||||
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
# When building for Haiku, we link against kernel.so, otherwise
|
||||
# against the system kernel.
|
||||
local kernel ;
|
||||
if [ on $(1) return $(PLATFORM) ] = haiku {
|
||||
kernel = <nogrist>kernel.so ;
|
||||
} else {
|
||||
kernel = /boot/develop/lib/x86/_KERNEL_ ;
|
||||
}
|
||||
|
||||
SetupKernel $(sources) : -fno-pic ;
|
||||
|
||||
Addon $(1) : $(2) : $(sources) ;
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ;
|
||||
LinkAgainst $(1) : $(4) $(kernel) ;
|
||||
}
|
||||
|
||||
rule KernelMergeObject
|
||||
{
|
||||
# KernelMergeObject <name> : <sources> : <extra CFLAGS> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <extra CFLAGS>: Additional flags for compilation.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
|
||||
SetupKernel $(2) : $(3) ;
|
||||
Objects $(2) ;
|
||||
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
|
||||
}
|
||||
|
||||
rule KernelStaticLibrary
|
||||
{
|
||||
# Usage KernelStaticLibrary <name> : <sources> : <extra cc flags> ;
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called lib<name>.a
|
||||
|
||||
SetupKernel $(2) : $(3) ;
|
||||
Library $(1) : $(2) ;
|
||||
}
|
||||
|
||||
rule KernelStaticLibraryObjects
|
||||
{
|
||||
# Usage KernelStaticLibrary <name> : <sources> ;
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called <name>
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
SetupKernel $(2) ;
|
||||
LocalClean clean : $(1) ;
|
||||
LocalDepends all : $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
}
|
||||
|
||||
actions KernelStaticLibraryObjects
|
||||
{
|
||||
$(HAIKU_AR) -r "$(1)" "$(2)" ;
|
||||
}
|
463
build/jam/MainBuildRules
Normal file
463
build/jam/MainBuildRules
Normal file
@ -0,0 +1,463 @@
|
||||
|
||||
rule AddSharedObjectGlueCode
|
||||
{
|
||||
# AddSharedObjectGlueCode <target> : <isExecutable> ;
|
||||
|
||||
# we link with -nostdlib and add the required libs manually, when building
|
||||
# for Haiku
|
||||
if [ on $(1) return $(PLATFORM) ] = haiku {
|
||||
local stdLibs = libroot.so ;
|
||||
local beginGlue ;
|
||||
local endGlue ;
|
||||
if $(2) = true {
|
||||
beginGlue += $(HAIKU_EXECUTABLE_BEGIN_GLUE_CODE) ;
|
||||
endGlue += $(HAIKU_EXECUTABLE_END_GLUE_CODE) ;
|
||||
} else {
|
||||
beginGlue += $(HAIKU_LIBRARY_BEGIN_GLUE_CODE) ;
|
||||
endGlue += $(HAIKU_LIBRARY_END_GLUE_CODE) ;
|
||||
|
||||
# special case for libroot: don't link it against itself
|
||||
if $(1) = libroot.so {
|
||||
stdLibs = ;
|
||||
}
|
||||
}
|
||||
|
||||
LINK_BEGIN_GLUE on $(1) = $(beginGlue) ;
|
||||
LINK_END_GLUE on $(1) = $(endGlue) ;
|
||||
|
||||
NEEDLIBS on $(1) = $(stdLibs) [ on $(1) return $(NEEDLIBS) ] ;
|
||||
Depends $(1) : $(stdLibs) $(beginGlue) $(endGlue) ;
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ;
|
||||
}
|
||||
}
|
||||
|
||||
rule Executable
|
||||
{
|
||||
# Executable <name> : <sources> : <libraries> : <res> ;
|
||||
#
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
AddResources $(1) : $(4) ;
|
||||
Main $(1) : $(2) ;
|
||||
LinkAgainst $(1) : $(3) ;
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
||||
-Xlinker -soname=_APP_ ;
|
||||
|
||||
# we link with -nostdlib and add the required libs manually, when building
|
||||
# for Haiku
|
||||
AddSharedObjectGlueCode $(1) : true ;
|
||||
}
|
||||
|
||||
rule Application
|
||||
{
|
||||
# Application <name> : <sources> : <libraries> : <res> ;
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule BinCommand
|
||||
{
|
||||
# BinCommand <name> : <sources> : <libraries> : <res> ;
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule StdBinCommands
|
||||
{
|
||||
# StdBinCommands <sources> : <libs> : <res> ;
|
||||
local libs = $(2) ;
|
||||
local ress = $(3) ;
|
||||
local source ;
|
||||
for source in $(1)
|
||||
{
|
||||
local target = $(source:S=) ;
|
||||
|
||||
BinCommand $(target) : $(source) : $(libs) : $(ress) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule Preference
|
||||
{
|
||||
# Preference <name> : <sources> : <libraries> : <res> ;
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule Server
|
||||
{
|
||||
# Server <name> : <sources> : <libraries> : <res> ;
|
||||
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule Addon
|
||||
{
|
||||
# Addon <name> : <relpath> : <sources> : <is executable> : <libraries> ;
|
||||
# <name>: Name of the add-on.
|
||||
# <relpath>: Path where the add-on shall live relative to the add-on dir.
|
||||
# <sources>: Source files.
|
||||
# <is executable>: true, if the target shall be executable as well.
|
||||
# <libraries>: Libraries to be linked against.
|
||||
# TODO: <relpath> is no longer needed
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
local isExecutable = $(4) ;
|
||||
|
||||
Main $(1) : $(3) ;
|
||||
|
||||
local linkFlags = -Xlinker -soname=\"$(1)\" ;
|
||||
if $(isExecutable) != true {
|
||||
linkFlags = -nostart $(linkFlags) ;
|
||||
}
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] $(linkFlags) ;
|
||||
LinkAgainst $(1) : $(5) ;
|
||||
|
||||
AddSharedObjectGlueCode $(1) : $(isExecutable) ;
|
||||
}
|
||||
|
||||
rule Translator
|
||||
{
|
||||
# Translator <name> : <sources> : <libraries> ;
|
||||
# TODO: Although they currently all are, translators don't need to be
|
||||
# executable. Introduce a flag as for Addon.
|
||||
Addon $(1) : Translators : $(2) : true : $(3) ;
|
||||
}
|
||||
|
||||
rule ScreenSaver
|
||||
{
|
||||
# ScreenSaver <name> : <sources> : <libraries> ;
|
||||
Addon $(1) : screen_savers : $(2) : false : $(3) ;
|
||||
}
|
||||
|
||||
rule StaticLibrary
|
||||
{
|
||||
# StaticLibrary <lib> : <sources> ;
|
||||
# Creates a static library from sources.
|
||||
# <lib>: The static library to be built.
|
||||
# <source>: List of source files.
|
||||
#
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
InheritPlatform $(objects) : $(lib) ;
|
||||
|
||||
StaticLibraryFromObjects $(lib) : $(objects) ;
|
||||
Objects $(2) ;
|
||||
}
|
||||
|
||||
rule StaticLibraryFromObjects
|
||||
{
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
LibraryFromObjects $(1) : $(2) ;
|
||||
}
|
||||
|
||||
rule MergeObjectFromObjects
|
||||
{
|
||||
# MergeObjectFromObjects <name> : <objects> : <other objects> ;
|
||||
# Merges object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <objects>: Object files to be merged. Grist will be added.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
local objects = [ FGristFiles $(2) ] ;
|
||||
|
||||
on $(1) {
|
||||
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
LINK on $(1) = $(HOST_LD) ;
|
||||
} else {
|
||||
LINK on $(1) = $(TARGET_LD) ;
|
||||
}
|
||||
}
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
Depends $(1) : $(objects) ;
|
||||
Depends $(1) : $(3) ;
|
||||
LocalDepends obj : $(1) ;
|
||||
MergeObjectFromObjects1 $(1) : $(objects) $(3) ;
|
||||
}
|
||||
|
||||
actions MergeObjectFromObjects1
|
||||
{
|
||||
$(LINK) -r $(2) -o $(1) ;
|
||||
}
|
||||
|
||||
rule MergeObject
|
||||
{
|
||||
# MergeObject <name> : <sources> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local otherObjects = $(3) ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
InheritPlatform $(objects) : $(target) ;
|
||||
Objects $(sources) ;
|
||||
MergeObjectFromObjects $(target) : $(objects) : $(otherObjects) ;
|
||||
}
|
||||
|
||||
rule SharedLibraryFromObjects
|
||||
{
|
||||
# SharedLibraryFromObjects <lib> : <objects> : <libraries> ;
|
||||
#
|
||||
local _lib = $(1) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
MainFromObjects $(_lib) : $(2) ;
|
||||
LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ]
|
||||
-nostart -Xlinker -soname=\"$(_lib)\" ;
|
||||
LinkAgainst $(_lib) : $(3) ;
|
||||
|
||||
AddSharedObjectGlueCode $(_lib) : false ;
|
||||
}
|
||||
|
||||
rule SharedLibrary
|
||||
{
|
||||
# SharedLibrary <lib> : <sources> : <libraries> ;
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
local libs = $(3) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
InheritPlatform $(objects) : $(lib) ;
|
||||
Objects $(sources) ;
|
||||
SharedLibraryFromObjects $(lib) : $(objects) : $(libs) ;
|
||||
}
|
||||
|
||||
rule LinkAgainst
|
||||
{
|
||||
# LinkAgainst <name> : <libs> ;
|
||||
# Valid elements for <libs> are e.g. "be" or "libopenbeos.so" or
|
||||
# "/boot/.../libfoo.so". If the basename starts with "lib" or the thingy
|
||||
# has a dirname or grist, it is added to the NEEDLIBS variable (i.e. the
|
||||
# file will be bound!), otherwise it is prefixed "-l" and added to
|
||||
# LINKLIBS. If you want to specify a target that isn't a library and
|
||||
# also has neither grist nor a dirname, you can prepend "<nogrist>" as
|
||||
# grist; it will be stripped by this rule.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local libs = $(2) ;
|
||||
local mapLibs = $(3) ;
|
||||
|
||||
on $(target) {
|
||||
# map libraries, if desired and target platform is Haiku
|
||||
if $(PLATFORM) = haiku {
|
||||
local mappedLibs ;
|
||||
|
||||
for i in $(libs) {
|
||||
local mapped = $(HAIKU_LIBRARY_NAME_MAP_$(i)) ;
|
||||
mapped ?= $(i) ;
|
||||
mappedLibs += $(mapped) ;
|
||||
}
|
||||
|
||||
libs = $(mappedLibs) ;
|
||||
}
|
||||
|
||||
local linkLibs ;
|
||||
local needLibs ;
|
||||
|
||||
for i in $(libs)
|
||||
{
|
||||
local isfile = ;
|
||||
if $(i:D) || $(i:G) {
|
||||
isfile = true ;
|
||||
if $(i:G) = <nogrist> {
|
||||
i = $(i:G=) ;
|
||||
}
|
||||
} else {
|
||||
switch $(i:B)
|
||||
{
|
||||
# XXX: _APP_ and _KERNEL_ should not be needed for ELF.
|
||||
case _APP_ : isfile = true ;
|
||||
case _KERNEL_ : isfile = true ;
|
||||
case lib* : isfile = true ;
|
||||
case * : isfile = ;
|
||||
}
|
||||
if ! $(isfile) && ( $(i:S) = .so || $(i:S) = .a ) {
|
||||
isfile = true ;
|
||||
}
|
||||
}
|
||||
|
||||
if $(isfile) {
|
||||
needLibs += $(i) ;
|
||||
} else {
|
||||
linkLibs += $(i) ;
|
||||
}
|
||||
}
|
||||
|
||||
NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ;
|
||||
LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ;
|
||||
|
||||
if $(needLibs) && ! $(NO_LIBRARY_DEPENDENCIES) {
|
||||
Depends $(1) : $(needLibs) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule AddResources
|
||||
{
|
||||
# AddResources <name> : <resourcefiles> ;
|
||||
|
||||
# add grist to the resource files which don't have any yet
|
||||
local resfiles ;
|
||||
local file ;
|
||||
for file in $(2) {
|
||||
if ! $(file:G) {
|
||||
file = [ FGristFiles $(file) ] ;
|
||||
}
|
||||
resfiles += $(file) ;
|
||||
}
|
||||
|
||||
SEARCH on $(resfiles) += $(SEARCH_SOURCE) ;
|
||||
|
||||
for file in $(resfiles) {
|
||||
if $(file:S) = .rdef {
|
||||
local rdef = $(file) ;
|
||||
file = $(rdef:S=.rsrc) ;
|
||||
ResComp $(file) : $(rdef) ;
|
||||
}
|
||||
RESFILES on $(1) += $(file) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule BuildPlatformObjects
|
||||
{
|
||||
# Usage BuildPlatformObjects <sources> ;
|
||||
# <sources> The sources.
|
||||
#
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(objects) = host ;
|
||||
SUPPORTED_PLATFORMS on $(objects) = host ;
|
||||
|
||||
Objects $(sources) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformMain
|
||||
{
|
||||
# Usage BuildPlatformMain <target> : <sources> : <libraries> ;
|
||||
# <target> The executable/library.
|
||||
# <sources> The sources.
|
||||
# <libraries> Libraries to link against.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libs = $(3) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(target) = host ;
|
||||
SUPPORTED_PLATFORMS on $(target) = host ;
|
||||
DONT_USE_BEOS_RULES on $(target) = true ;
|
||||
|
||||
local usesBeAPI = [ on $(target) return $(USES_BE_API) ] ;
|
||||
if $(usesBeAPI) {
|
||||
# propagate the flag to the objects
|
||||
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
||||
|
||||
# add the build libroot
|
||||
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
Depends $(target) : $(HOST_LIBROOT) ;
|
||||
NEEDLIBS on $(target) += $(HOST_LIBROOT) ;
|
||||
}
|
||||
}
|
||||
|
||||
Main $(target) : $(sources) ;
|
||||
LinkAgainst $(target) : $(libs) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformSharedLibrary
|
||||
{
|
||||
# Usage BuildPlatformSharedLibrary <target> : <sources> : <libraries> ;
|
||||
# <target> The library.
|
||||
# <sources> The sources.
|
||||
# <libraries> Libraries to link against.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libs = $(3) ;
|
||||
|
||||
BuildPlatformMain $(target) : $(sources) : $(libs) ;
|
||||
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
||||
-shared -Xlinker -soname=\"$(target)\" ;
|
||||
}
|
||||
|
||||
rule BuildPlatformMergeObject
|
||||
{
|
||||
# BuildPlatformMergeObject <name> : <sources> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local otherObjects = $(3) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(target) = host ;
|
||||
SUPPORTED_PLATFORMS on $(target) = host ;
|
||||
|
||||
local usesBeAPI = [ on $(target[1]) return $(USES_BE_API) ] ;
|
||||
if $(usesBeAPI) {
|
||||
# propagate the flag to the objects
|
||||
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
||||
}
|
||||
|
||||
MergeObject $(target) : $(sources) : $(otherObjects) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformStaticLibrary
|
||||
{
|
||||
# BuildPlatformStaticLibrary <lib> : <sources> ;
|
||||
# Creates a static library from sources.
|
||||
# <lib>: The library.
|
||||
# <sources>: List of source files.
|
||||
|
||||
local lib = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(lib) = host ;
|
||||
SUPPORTED_PLATFORMS on $(lib) = host ;
|
||||
|
||||
local usesBeAPI = [ on $(lib) return $(USES_BE_API) ] ;
|
||||
if $(usesBeAPI) {
|
||||
# propagate the flag to the objects
|
||||
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
||||
}
|
||||
|
||||
StaticLibrary $(lib) : $(sources) ;
|
||||
}
|
||||
|
78
build/jam/MiscRules
Normal file
78
build/jam/MiscRules
Normal file
@ -0,0 +1,78 @@
|
||||
|
||||
rule SetupObjectsDir
|
||||
{
|
||||
local relPath = [ FDirName $(SUBDIR_TOKENS[2-]) ] ;
|
||||
COMMON_PLATFORM_LOCATE_TARGET =
|
||||
[ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) $(relPath) ] ;
|
||||
|
||||
local var ;
|
||||
for var in COMMON_ARCH COMMON_DEBUG DEBUG_$(HAIKU_DEBUG_LEVELS) {
|
||||
HOST_$(var)_LOCATE_TARGET
|
||||
= [ FDirName $(HOST_$(var)_OBJECT_DIR) $(relPath) ] ;
|
||||
TARGET_$(var)_LOCATE_TARGET
|
||||
= [ FDirName $(TARGET_$(var)_OBJECT_DIR) $(relPath) ] ;
|
||||
}
|
||||
|
||||
LOCATE_TARGET = $(COMMON_PLATFORM_LOCATE_TARGET) ;
|
||||
LOCATE_SOURCE = $(LOCATE_TARGET) ;
|
||||
SEARCH_SOURCE = $(SUBDIR) $(LOCATE_SOURCE)
|
||||
$(HOST_COMMON_DEBUG_LOCATE_TARGET) # Also add the standard output
|
||||
$(TARGET_COMMON_DEBUG_LOCATE_TARGET) # dirs for generated sources.
|
||||
;
|
||||
}
|
||||
|
||||
rule SubIncludeGPL
|
||||
{
|
||||
# SubInclude rule that can be used to conditionally include GPL licensed
|
||||
# add-ons
|
||||
if $(INCLUDE_GPL_ADDONS) = 1 {
|
||||
SubInclude $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule MakeLocateCommonPlatform
|
||||
{
|
||||
MakeLocate $(1) : $(COMMON_PLATFORM_LOCATE_TARGET) ;
|
||||
}
|
||||
|
||||
rule MakeLocatePlatform
|
||||
{
|
||||
local files = $(1) ;
|
||||
local file ;
|
||||
for file in $(files) {
|
||||
if [ on $(file) return $(PLATFORM) ] = host {
|
||||
MakeLocate $(file) : $(HOST_COMMON_ARCH_LOCATE_TARGET) ;
|
||||
} else {
|
||||
MakeLocate $(file) : $(TARGET_COMMON_ARCH_LOCATE_TARGET) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule MakeLocateArch
|
||||
{
|
||||
local files = $(1) ;
|
||||
local file ;
|
||||
for file in $(files) {
|
||||
if [ on $(file) return $(PLATFORM) ] = host {
|
||||
MakeLocate $(file) : $(HOST_COMMON_DEBUG_LOCATE_TARGET) ;
|
||||
} else {
|
||||
MakeLocate $(file) : $(TARGET_COMMON_DEBUG_LOCATE_TARGET) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule MakeLocateDebug
|
||||
{
|
||||
local files = $(1) ;
|
||||
local file ;
|
||||
for file in $(files) {
|
||||
on $(file) {
|
||||
if $(PLATFORM) = host {
|
||||
MakeLocate $(file) : $(HOST_DEBUG_$(DEBUG)_LOCATE_TARGET) ;
|
||||
} else {
|
||||
MakeLocate $(file) : $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
598
build/jam/OverriddenJamRules
Normal file
598
build/jam/OverriddenJamRules
Normal file
@ -0,0 +1,598 @@
|
||||
# Overridden to allow spaces in file names.
|
||||
actions Chmod1
|
||||
{
|
||||
$(CHMOD) "$(MODE)" "$(1)"
|
||||
}
|
||||
|
||||
# Overridden to allow spaces in file names.
|
||||
actions piecemeal together existing Clean
|
||||
{
|
||||
$(RM) "$(>)"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Link rule/action are overwritten as they don't handle linking files who's name
|
||||
# contain spaces very well. Also adds resources and version to executable.
|
||||
#-------------------------------------------------------------------------------
|
||||
rule Link
|
||||
{
|
||||
# Note: RESFILES must be set before invocation.
|
||||
|
||||
if [ on $(1) return $(PLATFORM) ] = host {
|
||||
LINK on $(1) = $(HOST_LINK) ;
|
||||
LINKFLAGS on $(1) = $(HOST_LINKFLAGS) [ on $(1) return $(LINKFLAGS) ] ;
|
||||
} else {
|
||||
LINK on $(1) = $(TARGET_LINK) ;
|
||||
LINKFLAGS on $(1) = $(TARGET_LINKFLAGS)
|
||||
[ on $(1) return $(LINKFLAGS) ] ;
|
||||
}
|
||||
|
||||
NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] ;
|
||||
LINKLIBS on $(1) = [ on $(1) return $(LINKLIBS) ] ;
|
||||
|
||||
MODE on $(<) = $(EXEMODE) ;
|
||||
on $(1) XRes $(1) : $(RESFILES) ;
|
||||
Chmod $(<) ;
|
||||
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
|
||||
SetType $(1) ;
|
||||
MimeSet $(1) ;
|
||||
SetVersion $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions Link bind NEEDLIBS LINK_BEGIN_GLUE LINK_END_GLUE
|
||||
{
|
||||
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(LINK_BEGIN_GLUE)" "$(2)" "$(NEEDLIBS)" $(LINKLIBS) "$(LINK_END_GLUE)" ;
|
||||
}
|
||||
|
||||
rule Object
|
||||
{
|
||||
# find out which headers and defines to use
|
||||
local headers ;
|
||||
local sysHeaders ;
|
||||
local defines ;
|
||||
|
||||
on $(1) { # use on $(1) variable values
|
||||
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return ;
|
||||
}
|
||||
|
||||
# Save HDRS for -I$(HDRS) on compile.
|
||||
# We shouldn't need -I$(SEARCH_SOURCE) as cc can find headers
|
||||
# in the .c file's directory, but generated .c files (from
|
||||
# yacc, lex, etc) are located in $(LOCATE_TARGET), possibly
|
||||
# different from $(SEARCH_SOURCE).
|
||||
|
||||
headers = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ;
|
||||
sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ;
|
||||
defines = $(DEFINES) ;
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
sysHeaders += $(HOST_HDRS) ;
|
||||
defines += $(HOST_DEFINES) ;
|
||||
|
||||
if $(USES_BE_API) {
|
||||
sysHeaders += $(HOST_BE_API_HEADERS) ;
|
||||
}
|
||||
|
||||
} else {
|
||||
sysHeaders += $(TARGET_HDRS) ;
|
||||
defines += $(TARGET_DEFINES) ;
|
||||
}
|
||||
}
|
||||
|
||||
# locate object and search for source
|
||||
|
||||
LocalClean clean : $(<) ;
|
||||
|
||||
MakeLocateDebug $(<) ;
|
||||
SEARCH on $(>) = $(SEARCH_SOURCE) ;
|
||||
|
||||
HDRS on $(<) = $(headers) ;
|
||||
SYSHDRS on $(<) = $(sysHeaders) ;
|
||||
|
||||
# handle #includes for source: Jam scans for headers with
|
||||
# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
|
||||
# with the scanned file as the target and the found headers
|
||||
# as the sources. HDRSEARCH is the value of SEARCH used for
|
||||
# the found header files. Finally, if jam must deal with
|
||||
# header files of the same name in different directories,
|
||||
# they can be distinguished with HDRGRIST.
|
||||
|
||||
# $(SEARCH_SOURCE:E) is where cc first looks for #include
|
||||
# "foo.h" files. If the source file is in a distant directory,
|
||||
# look there. Else, look in "" (the current directory).
|
||||
|
||||
HDRRULE on $(>) = HdrRule ;
|
||||
HDRSCAN on $(>) = $(HDRPATTERN) ;
|
||||
HDRSEARCH on $(>) = $(headers) $(sysHeaders) $(STDHDRS) ;
|
||||
HDRGRIST on $(>) = $(HDRGRIST) ;
|
||||
|
||||
# propagate target specific-defines
|
||||
|
||||
DEFINES on $(1) = $(defines) ;
|
||||
|
||||
# if source is not .c, generate .c with specific rule
|
||||
|
||||
switch $(>:S)
|
||||
{
|
||||
case .asm : As $(<) : $(>) ;
|
||||
case .c : Cc $(<) : $(>) ;
|
||||
case .C : C++ $(<) : $(>) ;
|
||||
case .cc : C++ $(<) : $(>) ;
|
||||
case .cpp : C++ $(<) : $(>) ;
|
||||
case .f : Fortran $(<) : $(>) ;
|
||||
case .l : if [ on $(2) return $(GENERATE_C++) ] {
|
||||
C++ $(<) : $(<:S=.cpp) ;
|
||||
Lex $(<:S=.cpp) : $(>) ;
|
||||
} else {
|
||||
Cc $(<) : $(<:S=.c) ;
|
||||
Lex $(<:S=.c) : $(>) ;
|
||||
}
|
||||
case *.o : return ;
|
||||
case .s : As $(<) : $(>) ;
|
||||
case .S : As $(<) : $(>) ;
|
||||
case .y : if [ on $(2) return $(GENERATE_C++) ] {
|
||||
C++ $(1) : $(1:S=.cpp) ;
|
||||
Yacc $(1:S=.cpp) $(1:S=.hpp) : $(2) ;
|
||||
} else {
|
||||
Cc $(1) : $(1:S=.c) ;
|
||||
Yacc $(1:S=.c) $(1:S=.h) : $(2) ;
|
||||
}
|
||||
case * : UserObject $(<) : $(>) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule As
|
||||
{
|
||||
local flags ;
|
||||
if [ on $(1) return $(PLATFORM) ] = host {
|
||||
flags = [ on $(1) return $(HOST_ASFLAGS) $(ASFLAGS) ] ;
|
||||
|
||||
CC on $(1) = $(HOST_CC) ;
|
||||
|
||||
} else {
|
||||
flags = [ on $(1) return $(TARGET_ASFLAGS) $(ASFLAGS) ] ;
|
||||
|
||||
CC on $(1) = $(TARGET_CC) ;
|
||||
}
|
||||
|
||||
Depends $(<) : $(>) ;
|
||||
ASFLAGS on $(<) += $(flags) $(SUBDIRASFLAGS) ;
|
||||
ASHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ]
|
||||
$(HDRS_INCLUDES_SEPARATOR) [ on $(<) FSysIncludes $(SYSHDRS) ] ;
|
||||
ASDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;
|
||||
}
|
||||
|
||||
# TODO: The KERNEL_CCFLAGS were used here before. Check whether we need any
|
||||
# flags we don't have now.
|
||||
actions As
|
||||
{
|
||||
$(CC) -c "$(2)" -O2 $(ASFLAGS) -D_ASSEMBLER $(ASDEFS) $(ASHDRS) -o "$(1)" ;
|
||||
}
|
||||
|
||||
rule Lex
|
||||
{
|
||||
Depends $(1) : $(2) ;
|
||||
MakeLocateArch $(1) ;
|
||||
LocalClean clean : $(1) ;
|
||||
}
|
||||
|
||||
actions Lex
|
||||
{
|
||||
$(LEX) -o$(1) $(2)
|
||||
}
|
||||
|
||||
rule Yacc
|
||||
{
|
||||
local source = $(1[1]) ;
|
||||
local header = $(1[2]) ;
|
||||
local yaccSource = $(2) ;
|
||||
|
||||
MakeLocateArch $(source) $(header) ;
|
||||
|
||||
Depends $(source) $(header) : $(yaccSource) ;
|
||||
Yacc1 $(source) $(header) : $(yaccSource) ;
|
||||
LocalClean clean : $(source) $(header) ;
|
||||
|
||||
# make sure someone includes $(header) else it will be
|
||||
# a deadly independent target
|
||||
|
||||
Includes $(source) : $(header) ;
|
||||
}
|
||||
|
||||
actions Yacc1
|
||||
{
|
||||
bison $(YACCFLAGS) -o $(1[1]) $(2)
|
||||
[ -f $(1[1]).h ] && mv $(1[1]).h $(1[2]) || true
|
||||
}
|
||||
|
||||
rule Cc
|
||||
{
|
||||
Depends $(<) : $(>) ;
|
||||
|
||||
on $(1) {
|
||||
local flags ;
|
||||
|
||||
# optimization flags
|
||||
if $(DEBUG) = 0 {
|
||||
flags += $(OPTIM) ;
|
||||
} else {
|
||||
flags += -O0 ;
|
||||
}
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(HOST_WARNING_CCFLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(HOST_CCFLAGS) $(HOST_DEBUG_$(DEBUG)_CCFLAGS)
|
||||
$(SUBDIRCCFLAGS) $(CCFLAGS) ;
|
||||
|
||||
if $(USES_BE_API) {
|
||||
flags += $(HOST_BE_API_CCFLAGS) ;
|
||||
}
|
||||
|
||||
CC on $(1) = $(HOST_CC) ;
|
||||
|
||||
} else {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(TARGET_WARNING_CCFLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(TARGET_CCFLAGS) $(TARGET_DEBUG_$(DEBUG)_CCFLAGS)
|
||||
$(SUBDIRCCFLAGS) $(CCFLAGS) ;
|
||||
|
||||
CC on $(1) = $(TARGET_CC) ;
|
||||
}
|
||||
|
||||
CCFLAGS on $(<) = $(flags) ;
|
||||
CCHDRS on $(<) = [ FIncludes $(HDRS) ] $(HDRS_INCLUDES_SEPARATOR)
|
||||
[ FSysIncludes $(SYSHDRS) ] ;
|
||||
CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
actions Cc
|
||||
{
|
||||
$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
||||
}
|
||||
|
||||
rule C++
|
||||
{
|
||||
Depends $(<) : $(>) ;
|
||||
|
||||
on $(1) {
|
||||
local flags ;
|
||||
|
||||
# optimization flags
|
||||
if $(DEBUG) = 0 {
|
||||
flags += $(OPTIM) ;
|
||||
} else {
|
||||
flags += -O0 ;
|
||||
}
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(HOST_WARNING_C++FLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS)
|
||||
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
||||
|
||||
if $(USES_BE_API) {
|
||||
flags += $(HOST_BE_API_C++FLAGS) ;
|
||||
}
|
||||
|
||||
C++ on $(1) = $(HOST_C++) ;
|
||||
|
||||
} else {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(TARGET_WARNING_C++FLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(TARGET_C++FLAGS) $(TARGET_DEBUG_$(DEBUG)_C++FLAGS)
|
||||
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
||||
|
||||
C++ on $(1) = $(TARGET_C++) ;
|
||||
}
|
||||
|
||||
C++FLAGS on $(<) = $(flags) ;
|
||||
CCHDRS on $(<) = [ FIncludes $(HDRS) ] $(HDRS_INCLUDES_SEPARATOR)
|
||||
[ FSysIncludes $(SYSHDRS) ] ;
|
||||
CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
actions C++
|
||||
{
|
||||
$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
||||
}
|
||||
|
||||
rule Library
|
||||
{
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
InheritPlatform $(objects) : $(lib) ;
|
||||
LibraryFromObjects $(lib) : $(objects) ;
|
||||
Objects $(sources) ;
|
||||
}
|
||||
|
||||
rule LibraryFromObjects
|
||||
{
|
||||
local _i _l _s ;
|
||||
|
||||
# Add grist to file names
|
||||
# bonefish: No, don't. The Library rule does that anyway, and when we
|
||||
# have an object from another dir, we certainly don't want that.
|
||||
|
||||
_s = $(>) ;
|
||||
_l = $(<:S=$(SUFLIB)) ;
|
||||
|
||||
on $(_l) {
|
||||
# set the tools according to the platform
|
||||
if $(PLATFORM) = host {
|
||||
AR on $(1) = $(HOST_AR) $(HOST_ARFLAGS) ;
|
||||
RANLIB on $(1) = $(HOST_RANLIB) ;
|
||||
} else {
|
||||
AR on $(1) = $(TARGET_AR) $(TARGET_ARFLAGS) ;
|
||||
RANLIB on $(1) = $(TARGET_RANLIB) ;
|
||||
}
|
||||
|
||||
# library depends on its member objects
|
||||
|
||||
if $(KEEPOBJS)
|
||||
{
|
||||
LocalDepends obj : $(_s) ;
|
||||
}
|
||||
|
||||
LocalDepends lib : $(_l) ;
|
||||
|
||||
# Set LOCATE for the library and its contents. The bound
|
||||
# value shows up as $(NEEDLIBS) on the Link actions.
|
||||
# For compatibility, we only do this if the library doesn't
|
||||
# already have a path.
|
||||
|
||||
if ! $(_l:D)
|
||||
{
|
||||
# locate the library only, if it hasn't been located yet
|
||||
local dir = $(LOCATE[1]) ;
|
||||
if ! $(dir) {
|
||||
MakeLocateDebug $(_l) ;
|
||||
dir = [ on $(_l) return $(LOCATE[1]) ] ;
|
||||
# Note: The "on ..." is necessary, since our environment
|
||||
# isn't changed by MakeLocateDebug.
|
||||
}
|
||||
MakeLocate $(_l)($(_s:BS)) : $(dir) ;
|
||||
}
|
||||
|
||||
if $(NOARSCAN)
|
||||
{
|
||||
# If we can't scan the library to timestamp its contents,
|
||||
# we have to just make the library depend directly on the
|
||||
# on-disk object files.
|
||||
|
||||
Depends $(_l) : $(_s) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
# If we can scan the library, we make the library depend
|
||||
# on its members and each member depend on the on-disk
|
||||
# object file.
|
||||
|
||||
Depends $(_l) : $(_l)($(_s:BS)) ;
|
||||
|
||||
for _i in $(_s)
|
||||
{
|
||||
Depends $(_l)($(_i:BS)) : $(_i) ;
|
||||
}
|
||||
}
|
||||
|
||||
LocalClean clean : $(_l) ;
|
||||
|
||||
# bonefish: Not needed on the supported platforms. Maybe later...
|
||||
# if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; }
|
||||
|
||||
Archive $(_l) : $(_s) ;
|
||||
|
||||
if $(RANLIB) { Ranlib $(_l) ; }
|
||||
|
||||
# If we can't scan the library, we have to leave the .o's around.
|
||||
|
||||
if ! ( $(KEEPOBJS) || $(NOARSCAN) || $(NOARUPDATE) ) {
|
||||
RmTemps $(_l) : $(_s) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule Main
|
||||
{
|
||||
local target = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
InheritPlatform $(objects) : $(target) ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
Objects $(sources) ;
|
||||
}
|
||||
|
||||
rule MainFromObjects
|
||||
{
|
||||
local _s _t ;
|
||||
|
||||
# Add grist to file names
|
||||
# Add suffix to exe
|
||||
|
||||
_s = [ FGristFiles $(>) ] ;
|
||||
_t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;
|
||||
|
||||
# so 'jam foo' works when it's really foo.exe
|
||||
|
||||
if $(_t) != $(<)
|
||||
{
|
||||
Depends $(<) : $(_t) ;
|
||||
NotFile $(<) ;
|
||||
}
|
||||
|
||||
# make compiled sources a dependency of target
|
||||
|
||||
LocalDepends exe : $(_t) ;
|
||||
Depends $(_t) : $(_s) ;
|
||||
MakeLocateDebug $(_t) ;
|
||||
|
||||
LocalClean clean : $(_t) ;
|
||||
|
||||
Link $(_t) : $(_s) ;
|
||||
}
|
||||
|
||||
# Override Jam 2.5rc3 MakeLocate and MkDir to deal more intelligently
|
||||
# with grist set on the supplied directory name.
|
||||
rule MakeLocate
|
||||
{
|
||||
local dir = $(2[1]) ;
|
||||
|
||||
if $(dir)
|
||||
{
|
||||
if ! $(dir:G) {
|
||||
dir = $(dir:G=dir) ;
|
||||
}
|
||||
LOCATE on $(1) += $(dir:G=) ; # don't relocate once located
|
||||
Depends $(1) : $(dir) ;
|
||||
MkDir $(dir) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule MkDir
|
||||
{
|
||||
local dir = $(<) ;
|
||||
if ! $(dir:G) {
|
||||
dir = $(dir:G=dir) ;
|
||||
}
|
||||
|
||||
# make this and all super directories
|
||||
while true {
|
||||
# If dir exists, don't update it
|
||||
# Do this even for $(DOT).
|
||||
NoUpdate $(dir) ;
|
||||
|
||||
# Bail out when reaching the CWD (".") or a directory we've already
|
||||
# made.
|
||||
if $(dir:G=) = $(DOT) || $($(dir:G=)-mkdir) {
|
||||
return ;
|
||||
}
|
||||
|
||||
local s ;
|
||||
|
||||
# Cheesy gate to prevent multiple invocations on same dir
|
||||
# MkDir1 has the actions
|
||||
# Arrange for jam dirs
|
||||
|
||||
$(dir:G=)-mkdir = true ;
|
||||
MkDir1 $(dir) ;
|
||||
LocalDepends dirs : $(dir) ;
|
||||
|
||||
# Recursively make parent directories.
|
||||
# $(dir:P) = $(dir)'s parent, & we recurse until root
|
||||
|
||||
s = $(dir:P) ; # parent keeps grist
|
||||
|
||||
if $(s:G=) && $(s) != $(dir) {
|
||||
Depends $(dir) : $(s) ;
|
||||
dir = $(s) ;
|
||||
} else if $(s) {
|
||||
NotFile $(s) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectCcFlags
|
||||
{
|
||||
# supports inheriting the global variable value
|
||||
|
||||
local file ;
|
||||
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
||||
CCFLAGS on $(file) = [ on $(file) return $(CCFLAGS) ] $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectC++Flags
|
||||
{
|
||||
# supports inheriting the global variable value
|
||||
|
||||
local file ;
|
||||
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
||||
C++FLAGS on $(file) = [ on $(file) return $(C++FLAGS) ] $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectDefines
|
||||
{
|
||||
# supports inheriting the global variable value and multiple files
|
||||
|
||||
if $(2) {
|
||||
local file ;
|
||||
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
||||
DEFINES on $(file) = [ on $(file) return $(DEFINES) ] $(2) ;
|
||||
CCDEFS on $(file) = [ on $(file) FDefines $(DEFINES) ] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectHdrs
|
||||
{
|
||||
# ObjectHdrs <sources or objects> : <headers> : <gristed objects>
|
||||
# Note: Parameter 3 <gristed objects> is an extension.
|
||||
|
||||
local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
|
||||
local headers = $(2) ;
|
||||
|
||||
local file ;
|
||||
for file in $(objects) {
|
||||
HDRS on $(file) = [ on $(file) return $(HDRS) ] $(headers) ;
|
||||
|
||||
# reformat ASHDRS and CCHDRS
|
||||
local fileHeaders = [ on $(file) FIncludes $(HDRS) ]
|
||||
$(HDRS_INCLUDES_SEPARATOR) [ on $(file) FSysIncludes $(SYSHDRS) ] ;
|
||||
ASHDRS on $(file) = $(fileHeaders) ;
|
||||
CCHDRS on $(file) = $(fileHeaders) ;
|
||||
}
|
||||
}
|
||||
|
||||
# Overridden to avoid calling SubDir for a directory twice (in SubInclude
|
||||
# and from the Jamfile in the directory).
|
||||
rule SubInclude
|
||||
{
|
||||
# SubInclude TOP d1 ... ;
|
||||
#
|
||||
# Include a subdirectory's Jamfile.
|
||||
|
||||
if ! $($(<[1]))
|
||||
{
|
||||
Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
|
||||
}
|
||||
|
||||
# Set up the config variables for the subdirectory.
|
||||
local config = [ ConfigObject $(1) ] ;
|
||||
|
||||
__configured = ;
|
||||
if ! [ on $(config) return $(__configured) ] {
|
||||
# No custom configuration defined for the subdir. We use the variable
|
||||
# values inherited by the closest ancestor.
|
||||
config = $(HAIKU_INHERITED_SUBDIR_CONFIG) ;
|
||||
}
|
||||
|
||||
on $(config) {
|
||||
include [ FDirName $($(1[1])) $(1[2-) $(JAMFILE) ] ;
|
||||
}
|
||||
}
|
250
build/jam/PackageRules
Normal file
250
build/jam/PackageRules
Normal file
@ -0,0 +1,250 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# Packages for OBOS alpha/beta testers
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
rule Copy
|
||||
{
|
||||
if $(2) {
|
||||
SEARCH on $(2) = $(SEARCH_SOURCE) ;
|
||||
Depends $(1) : <build>copyattr $(2) ;
|
||||
Copy1 $(1) : <build>copyattr $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions Copy1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
"$(2[1])" -d "$(2[2-])" "$(1)"
|
||||
}
|
||||
|
||||
rule Packages
|
||||
{
|
||||
local packagenames = $(1) ;
|
||||
local packagefiles = $(2) ;
|
||||
local path = $(3) ;
|
||||
for name in $(packagenames) {
|
||||
Package $(name) : $(packagefiles) : $(path) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule FPackageConfigSubPath
|
||||
{
|
||||
# FPackageConfigSubPath <packagename>
|
||||
#
|
||||
local packagename = $(1) ;
|
||||
|
||||
local configSubPath ;
|
||||
on $(packagename) {
|
||||
if $(PLATFORM) = host {
|
||||
configSubPath = $(HOST_PLATFORM) $(HOST_ARCH) ;
|
||||
} else {
|
||||
configSubPath = $(TARGET_PLATFORM) $(TARGET_ARCH) ;
|
||||
}
|
||||
|
||||
if $(DEBUG) = 0 {
|
||||
configSubPath += release ;
|
||||
} else {
|
||||
configSubPath += debug_$(DEBUG) ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(configSubPath) ;
|
||||
}
|
||||
|
||||
rule Package
|
||||
{
|
||||
local packagename = $(1) ;
|
||||
local packagefiles = $(2) ;
|
||||
local path = $(3) ;
|
||||
|
||||
local configSubPath = [ FPackageConfigSubPath $(packagename) ] ;
|
||||
local packagezip = $(packagename:S=.zip:G=_packages) ;
|
||||
local targetDir = [ FDirName $(HAIKU_PACKAGE_DIR) $(configSubPath) ] ;
|
||||
local packagedir = [ FDirName $(targetDir) $(packagename) ] ;
|
||||
|
||||
local installscript = install.sh ;
|
||||
local packageinstallscript = $(installscript:G=_packages!$(packagename)) ;
|
||||
local installzip = install.zip ;
|
||||
local packageinstallzip = $(installzip:G=_packages!$(packagename)) ;
|
||||
|
||||
local packageobjectdir = [ FDirName $(HAIKU_PACKAGE_OBJECT_DIR)
|
||||
$(configSubPath) $(packagename) ] ;
|
||||
local packagefiledir = [ FDirName $(packageobjectdir) $(path) ] ;
|
||||
local packagefileinstallzip
|
||||
= $(installzip:G=_package_objects!$(packagename)) ;
|
||||
|
||||
# add the files to the install.zip
|
||||
local packagefilegrist = [ FGrist _package_files $(packagename) $(path) ] ;
|
||||
for file in $(packagefiles) {
|
||||
if $(path[0]) = "boot" {
|
||||
local packagefile = $(file:G=$(packagefilegrist)) ;
|
||||
MakeLocate $(packagefile) : $(packagefiledir) ;
|
||||
Copy $(packagefile) : $(file) ;
|
||||
Clean cleanPackages : $(packagefile) ;
|
||||
PackageInstallZip $(packagefileinstallzip) : $(packagefile) ;
|
||||
} else {
|
||||
local packagefile = $(file:G=_packages!$(packagename)) ;
|
||||
MakeLocate $(packagefile) : $(packagedir) ;
|
||||
Copy $(packagefile) : [ FGristFiles $(file) ] ;
|
||||
Clean cleanPackages : $(packagefile) ;
|
||||
Depends $(packagezip) : $(packagefile) ;
|
||||
}
|
||||
}
|
||||
|
||||
# general setup for this package -- only on first invocation
|
||||
if ! $(_setup_$(packagename)) {
|
||||
_setup_$(packagename) = true ;
|
||||
|
||||
NotFile $(packagename) ;
|
||||
LocalDepends packages : $(packagename) ;
|
||||
|
||||
MakeLocate $(packagezip) : $(targetDir) ;
|
||||
MakeLocate $(packageinstallscript) : $(packagedir) ;
|
||||
MakeLocate $(packageinstallzip) : $(packagedir) ;
|
||||
MakeLocate $(packagefileinstallzip) : $(packageobjectdir) ;
|
||||
|
||||
PackageInstallScript $(packageinstallscript) : $(packagedir) ;
|
||||
LinkInstallZip $(packageinstallzip) : $(packagefileinstallzip) ;
|
||||
Depends $(packagename) : $(packagezip) ;
|
||||
PackageZip $(packagezip) : $(packagedir)
|
||||
: $(packageinstallscript) $(packageinstallzip) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rule PackageSymLink
|
||||
{
|
||||
# PackageSymLink <packageName> : <symlink path components>
|
||||
# : <symlink target>
|
||||
#
|
||||
local packagename = $(1) ;
|
||||
local symlinkPath = $(2) ;
|
||||
local symlinkTarget = $(3) ;
|
||||
|
||||
local configSubPath = [ FPackageConfigSubPath $(packagename) ] ;
|
||||
|
||||
local symlinkDir = [ FReverse $(symlinkPath) ] ;
|
||||
local symlink = $(symlinkDir[1]) ;
|
||||
symlinkDir = [ FReverse $(symlinkDir[2-]) ] ;
|
||||
local symlinkGrist = [ FGrist _package $(packagename) $(symlinkDir) ] ;
|
||||
symlink = $(symlink:G=$(symlinkGrist)) ;
|
||||
|
||||
if $(symlinkDir[1]) = boot {
|
||||
local installzip = install.zip ;
|
||||
local packagefileinstallzip
|
||||
= $(installzip:G=_package_objects!$(packagename)) ;
|
||||
|
||||
local packageobjectdir = [ FDirName $(HAIKU_PACKAGE_OBJECT_DIR)
|
||||
$(configSubPath) $(packagename) ] ;
|
||||
symlinkDir = [ FDirName $(packageobjectdir) $(symlinkDir) ] ;
|
||||
|
||||
PackageInstallZip $(packagefileinstallzip) : $(symlink) ;
|
||||
|
||||
} else {
|
||||
local packagezip = $(packagename:S=.zip:G=_packages) ;
|
||||
|
||||
local packagedir = [ FDirName $(HAIKU_PACKAGE_DIR) $(configSubPath)
|
||||
$(packagename) ] ;
|
||||
symlinkDir = [ FDirName $(packagedir) $(symlinkDir) ] ;
|
||||
|
||||
Depends $(packagezip) : $(symlink) ;
|
||||
}
|
||||
|
||||
MakeLocate $(symlink) : $(symlinkDir) ;
|
||||
SymLink $(symlink) : $(symlinkTarget) : false ;
|
||||
Clean cleanPackages : $(symlink) ;
|
||||
}
|
||||
|
||||
rule PackageDriverSymLink
|
||||
{
|
||||
# PackageDriverSymLink <packageName> : <devRelativeSymlinkComponents> ;
|
||||
# <packageName>: Package name.
|
||||
# <devRelativeSymlinkComponents>: Path components relative to the
|
||||
# /boot/home/config/add-ons/kernel/drivers/dev directory, e.g.
|
||||
# "graphics mga.driver" (no quotation, of course).
|
||||
#
|
||||
local packageName = $(1) ;
|
||||
local symlinkComponents = $(2) ;
|
||||
|
||||
# construct the symlink contents
|
||||
local symlinkPath = [ FReverse $(symlinkComponents) ] ;
|
||||
symlinkPath = bin $(symlinkPath[1]) ;
|
||||
|
||||
for i in $(symlinkComponents) {
|
||||
symlinkPath = $(DOTDOT) $(symlinkPath) ;
|
||||
}
|
||||
|
||||
PackageSymLink $(packageName)
|
||||
: boot home config add-ons kernel drivers dev $(symlinkComponents)
|
||||
: [ FDirName $(symlinkPath) ] ;
|
||||
}
|
||||
|
||||
rule PackageZip
|
||||
{
|
||||
local dir = $(2:G=dir) ;
|
||||
Depends $(1) : $(dir) $(3) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
PackageZip1 $(1) : $(dir) ;
|
||||
}
|
||||
|
||||
actions together PackageZip1 {
|
||||
cd "$(2:P)" ;
|
||||
zip -rq "$(1:BS)" "$(2:BS)" ;
|
||||
}
|
||||
|
||||
rule PackageInstallScript
|
||||
{
|
||||
MakeLocate $(1) : $(2) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
PackageInstallScript1 $(1) : $(2:G=dir) ;
|
||||
}
|
||||
|
||||
actions together PackageInstallScript1
|
||||
{
|
||||
echo '#!/bin/sh
|
||||
base=`dirname "$0"`
|
||||
cd "$base"
|
||||
if [ -n "$TTY" ]
|
||||
then
|
||||
unzip -d / install.zip
|
||||
else
|
||||
response=`alert "Would you like to automatically overwrite existing files, or receive a prompt?" "Overwrite" "Prompt"`
|
||||
if [ $response == "Overwrite" ]
|
||||
then
|
||||
unzip -od / install.zip
|
||||
alert "Finished installing" "Thanks"
|
||||
else
|
||||
if [ -e /boot/beos/apps/Terminal ]
|
||||
then
|
||||
terminal=/boot/beos/apps/Terminal
|
||||
else
|
||||
terminal=`query Terminal | head -1`
|
||||
fi
|
||||
$terminal -t "installer" /bin/sh "$0"
|
||||
fi
|
||||
fi' > "$(1)" ;
|
||||
chmod 755 "$(1)" ;
|
||||
}
|
||||
|
||||
rule PackageInstallZip
|
||||
{
|
||||
Depends $(1) : $(2) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
}
|
||||
|
||||
actions together PackageInstallZip
|
||||
{
|
||||
cd "$(1:P)" ;
|
||||
zip -rqy "$(1:BS)" boot ;
|
||||
}
|
||||
|
||||
rule LinkInstallZip
|
||||
{
|
||||
Depends $(1) : $(2) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
}
|
||||
|
||||
actions together LinkInstallZip
|
||||
{
|
||||
ln -sf "`pwd`/$(2)" "$(1)" ;
|
||||
}
|
303
build/jam/TestsRules
Normal file
303
build/jam/TestsRules
Normal file
@ -0,0 +1,303 @@
|
||||
# test pseudo targets
|
||||
NOTFILE obostests ;
|
||||
NOTFILE r5tests ;
|
||||
|
||||
rule CommonTestLib
|
||||
{
|
||||
# CommonTestLib <target> : <sources> : <obos libraries>
|
||||
# : <r5 libraries> : <test libraries> : <public headers>;
|
||||
# Builds a unit test for both OBOS and R5 modules.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <obos libraries> A list of link libraries for the OBOS tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <r5 libraries> A list of link libraries for the R5 tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <test libraries> A list of link libraries for both OBOS tests and R5 tests
|
||||
# that have a common name (i.e. specify libx.so and the OBOS tests will link
|
||||
# to libx.so and the R5 tests will link to libx_r5.so).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
TestLib $(1) : $(2) : [ FDirName $(HAIKU_TEST_DIR) unittester lib ] : $(3) $(5) : $(6) ;
|
||||
R5TestLib $(1) : $(2) : [ FDirName $(HAIKU_TEST_DIR) unittester_r5 lib ] : $(4) [ R5SharedLibraryNames $(5) ] ;
|
||||
}
|
||||
|
||||
rule TestLib
|
||||
{
|
||||
# TestLib <target> : <sources> : <dest> : <libraries> : <public headers>
|
||||
# Builds a unit test library for an OBOS module.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local headerDirs = $(5) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : $(dest) ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : $(headerDirs) ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends obostests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ;
|
||||
}
|
||||
|
||||
rule R5TestLib
|
||||
{
|
||||
# R5TestLib <target> : <sources> : <dest> : <libraries>
|
||||
# Builds a unit test for an R5 module. "_r5" is appended to the object
|
||||
# and the target name.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
|
||||
local target = $(1:B)_r5$(1:S) ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local objects = [ R5ObjectNames $(sources) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : $(dest) ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : : true ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends r5tests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ;
|
||||
}
|
||||
|
||||
rule CommonUnitTest
|
||||
{
|
||||
# CommonUnitTest <target> : <sources> : <dest> : <obos libraries>
|
||||
# : <r5 libraries> : <public headers>;
|
||||
# Builds a unit test for both OBOS and R5 modules.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <obos libraries> A list of link libraries for the OBOS tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <r5 libraries> A list of link libraries for the R5 tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
UnitTest $(1) : $(2) : $(3) : $(4) : $(6) ;
|
||||
R5UnitTest $(1) : $(2) : $(3) : $(5) ;
|
||||
}
|
||||
|
||||
rule UnitTest
|
||||
{
|
||||
# UnitTest <target> : <sources> : <dest> : <libraries> : <public headers>
|
||||
# Builds a unit test for an OBOS module.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local headerDirs = $(5) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(dest) ] ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : $(headerDirs) ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends obostests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
}
|
||||
|
||||
rule R5UnitTest
|
||||
{
|
||||
# R5UnitTest <target> : <sources> : <dest> : <libraries>
|
||||
# Builds a unit test for an R5 module. "_r5" is appended to the object
|
||||
# and the target name.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
|
||||
local target = $(1)_r5 ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local objects = [ R5ObjectNames $(sources) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(dest) ] ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : : true ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends r5tests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
}
|
||||
|
||||
rule R5ObjectNames
|
||||
{
|
||||
# R5ObjectNames <sources> ;
|
||||
# Returns a list of gristed object names given a list of source file names.
|
||||
# Moreover each object names gets "_r5" inserted before the object suffix.
|
||||
local objects = $(1:S=)_r5 ;
|
||||
return [ FGristFiles $(objects:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
rule R5Objects
|
||||
{
|
||||
# R5Objects <sources>
|
||||
# Similar to Objects, but appends "_r5" to the object file names and
|
||||
# removes `-nostdinc' from the CC and C++ flags to enable system headers.
|
||||
# <sources> The source files.
|
||||
|
||||
# Remove `-nostdinc' from CCFLAGS and C++FLAGS.
|
||||
local oldCCFLAGS = $(CCFLAGS) ;
|
||||
local oldC++FLAGS = $(C++FLAGS) ;
|
||||
CCFLAGS = [ FFilter $(CCFLAGS) : -nostdinc ] ;
|
||||
C++FLAGS = [ FFilter $(C++FLAGS) : -nostdinc ] ;
|
||||
|
||||
local sources = $(1) ;
|
||||
local source ;
|
||||
for source in [ FGristFiles $(sources) ]
|
||||
{
|
||||
local object = [ R5ObjectNames $(source) ] ;
|
||||
Object $(object) : $(source) ;
|
||||
LocalDepends obj : $(object) ;
|
||||
}
|
||||
|
||||
# Reset CCFLAGS and C++FLAGS to original values.
|
||||
CCFLAGS = $(oldCCFLAGS) ;
|
||||
C++FLAGS = $(oldC++FLAGS) ;
|
||||
}
|
||||
|
||||
rule TestObjects
|
||||
{
|
||||
# TestLib <sources> : <public headers> : <r5>
|
||||
# Compiles objects for tests.
|
||||
# <sources> The list of sources.
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
# <r5> If set, "_r5" is appended to the object file names and
|
||||
# <public headers> is ignored. Furthermore the pre-processor macro
|
||||
# TEST_R5 is defined, TEST_OBOS otherwise.
|
||||
|
||||
local sources = $(1) ;
|
||||
local headerDirs = $(2) ;
|
||||
local r5 = $(3) ;
|
||||
local objects ;
|
||||
|
||||
if $(r5) {
|
||||
objects = [ R5ObjectNames $(sources) ] ;
|
||||
} else {
|
||||
objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
# Turn optimization off, if desired.
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
OPTIM on $(objects) = ;
|
||||
}
|
||||
|
||||
# set headers/defines
|
||||
UseCppUnitObjectHeaders $(sources) : $(objects) ;
|
||||
if $(r5) {
|
||||
ObjectDefines $(sources) : TEST_R5 ;
|
||||
} else {
|
||||
UsePublicObjectHeaders $(sources) : $(headerDirs) : $(objects) ;
|
||||
ObjectDefines $(sources) : TEST_OBOS ;
|
||||
}
|
||||
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
# Turn debugging on. That is usually desired for test code.
|
||||
ObjectCcFlags $(objects) : $(DEBUG_FLAGS) ;
|
||||
ObjectC++Flags $(objects) : $(DEBUG_FLAGS) ;
|
||||
}
|
||||
|
||||
# compile
|
||||
if $(r5) {
|
||||
R5Objects $(sources) ;
|
||||
} else {
|
||||
Objects $(sources) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule R5SharedLibraryNames
|
||||
{
|
||||
# R5SharedLibraryNames <sources> ;
|
||||
# Returns a list of shared library names given a list of file names. NO
|
||||
# GRISTING IS PERFORMED :-) However, each library names gets "_r5" inserted
|
||||
# before the shared lib suffix.
|
||||
return $(1:S=)_r5.so ;
|
||||
}
|
||||
|
||||
rule SimpleTest
|
||||
{
|
||||
# UnitTest <target> : <sources> : <libraries>
|
||||
# Builds a unit test for an OBOS module.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libraries = $(3) ;
|
||||
local relPath = [ FRelPath src tests : $(SUBDIR_TOKENS) ] ;
|
||||
|
||||
# Turn optimization off.
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
local optim = $(OPTIM) ;
|
||||
OPTIM = ;
|
||||
}
|
||||
|
||||
ObjectDefines $(sources) : TEST_OBOS ;
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(relPath) ] ;
|
||||
Main $(target) : $(sources) ;
|
||||
Depends obostests : $(target) ;
|
||||
LinkAgainst $(target) : $(libraries) ;
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
# Turn debugging on. That is usually desired for test code.
|
||||
ObjectCcFlags $(sources) : $(DEBUG_FLAGS) ;
|
||||
ObjectC++Flags $(sources) : $(DEBUG_FLAGS) ;
|
||||
|
||||
# Turn optimization on again.
|
||||
OPTIM = $(optim) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule BuildPlatformTest
|
||||
{
|
||||
# Usage BuildPlatformTest <target> : <sources> ;
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
|
||||
local relPath ;
|
||||
if [ FIsPrefix src tests : $(SUBDIR_TOKENS) ] {
|
||||
relPath = $(SUBDIR_TOKENS[3-]) ;
|
||||
} else {
|
||||
relPath = $(SUBDIR_TOKENS[2-]) ;
|
||||
}
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(relPath) ] ;
|
||||
|
||||
BuildPlatformMain $(target) : $(sources) ;
|
||||
}
|
74
build/jam/UserBuildConfig.sample
Normal file
74
build/jam/UserBuildConfig.sample
Normal file
@ -0,0 +1,74 @@
|
||||
# UserBuildConfig can be used to customize the build according to your needs.
|
||||
# If existent it is included by the build system, but it is ignored by svn.
|
||||
# This file documents a few examples, what can be done.
|
||||
|
||||
# Adjusting Build Variables
|
||||
|
||||
# Turn off warnings in directory src/system/kernel. As fourth (scope) parameter
|
||||
# "local" is specified, which means, that this setting applies only to the
|
||||
# given directory, but not any of its subdirectories.
|
||||
SetConfigVar WARNINGS : HAIKU_TOP src system kernel : 0 : local ;
|
||||
|
||||
# Add "RUN_WITHOUT_REGISTRAR" to the DEFINES for the directory src/kits and
|
||||
# all its subdirectories (scope is "global").
|
||||
AppendToConfigVar DEFINES : HAIKU_TOP src kits : RUN_WITHOUT_REGISTRAR
|
||||
: global ;
|
||||
|
||||
# Set the debug level for file src/bin/gdb/gdb/haiku-nat.c (note, that
|
||||
# the object file must be specified) to 1. It is worth mentioning, that the
|
||||
# executable the object file is linked into (gdb), will still be placed in
|
||||
# generated/objects/.../release/... Only when setting DEBUG for the executable,
|
||||
# too, it will be placed in .../debug_1/...
|
||||
DEBUG on <src!bin!gdb!gdb!>haiku-nat.o = 1 ;
|
||||
|
||||
|
||||
# Haiku Image Related Modifications
|
||||
|
||||
# Create a 100 MB image at /tmp/walter.image.
|
||||
HAIKU_IMAGE_NAME = walter.image ;
|
||||
HAIKU_IMAGE_DIR = /tmp ;
|
||||
HAIKU_IMAGE_SIZE = 100 ;
|
||||
|
||||
# Install Haiku in directory /Haiku.
|
||||
HAIKU_INSTALL_DIR = /Haiku ;
|
||||
|
||||
# Add "crashing_app" to the beos/bin directory of the Haiku image/installation.
|
||||
# Note, that this also makes the image depend on the target, i.e. it is
|
||||
# automatically updated when the image is built.
|
||||
AddFilesToHaikuImage beos bin : crashing_app ;
|
||||
|
||||
# Make a symlink to home/config/bin/crash.
|
||||
AddSymlinkToHaikuImage home config bin : /beos/bin/crashing_app : crash ;
|
||||
|
||||
# Specify scripts that shall be run when populating the image/installation
|
||||
# directory. The "early" script is run before anything has been copied onto
|
||||
# the image/into the installation directory. The "late" script is run after
|
||||
# everything has been copied, but before the MIME database is installed.
|
||||
HAIKU_IMAGE_EARLY_USER_SCRIPTS = $(HAIKU_TOP)/../early-image-script.sh ;
|
||||
HAIKU_IMAGE_LATE_USER_SCRIPTS = $(HAIKU_TOP)/../late-image-script.sh ;
|
||||
|
||||
|
||||
# Creating Sourceable Shell Scripts
|
||||
|
||||
# If you use shell scripts (e.g. for testing) that need to access targets or
|
||||
# build system properties, you can tell the build system to generate a
|
||||
# variables defining shell script you can source from your shell script.
|
||||
|
||||
# General setup for the shell script to generate. Name is test.inc, located
|
||||
# in the output directory.
|
||||
MakeLocate test.inc : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always test.inc ;
|
||||
|
||||
# Define variable "outputDir" in the shell script, with the value of
|
||||
# HAIKU_OUTPUT_DIR.
|
||||
AddVariableToScript test.inc : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
# Define variables "bfsShell" and "fsShellCommand" referring to the
|
||||
# generated bfs_shell and fs_shell_command respectively.
|
||||
AddTargetVariableToScript test.inc : bfs_shell : bfsShell ;
|
||||
AddTargetVariableToScript test.inc : fs_shell_command : fsShellCommand ;
|
||||
|
||||
# If no variable name is given, the name (without grist) of the target is
|
||||
# used, i.e. a variable "rc" referring to the rc command built for the host
|
||||
# platform is defined in the script.
|
||||
AddTargetVariableToScript test.inc : <build>rc ;
|
139
build/scripts/build_cross_tools
Executable file
139
build/scripts/build_cross_tools
Executable file
@ -0,0 +1,139 @@
|
||||
# parameters <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]
|
||||
|
||||
# get and check the parameters
|
||||
if [ $# \< 2 ]; then
|
||||
echo Usage: $0 '<haiku sourcedir> <buildtools dir> [ <haiku output dir> ]' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
haikuSourceDir=$1
|
||||
buildToolsDir=$2
|
||||
|
||||
if [ $# \< 3 ]; then
|
||||
haikuOutputDir=$haikuSourceDir/generated
|
||||
else
|
||||
haikuOutputDir=$3
|
||||
fi
|
||||
|
||||
if [ ! -d $haikuSourceDir ]; then
|
||||
echo "No such directory: \"$haikuSourceDir\"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $buildToolsDir ]; then
|
||||
echo "No such directory: \"$buildToolsDir\"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# create the output dir
|
||||
mkdir -p $haikuOutputDir || exit 1
|
||||
|
||||
|
||||
# get absolute paths
|
||||
currentDir=$(pwd)
|
||||
|
||||
cd $haikuSourceDir
|
||||
haikuSourceDir=$(pwd)
|
||||
cd $currentDir
|
||||
|
||||
cd $buildToolsDir
|
||||
buildToolsDir=$(pwd)
|
||||
cd $currentDir
|
||||
|
||||
cd $haikuOutputDir
|
||||
haikuOutputDir=$(pwd)
|
||||
|
||||
|
||||
# create the object and installation directories for the cross compilation tools
|
||||
installDir=$haikuOutputDir/cross-tools
|
||||
objDir=$haikuOutputDir/cross-tools-build
|
||||
binutilsObjDir=$objDir/binutils
|
||||
gccObjDir=$objDir/gcc
|
||||
tmpIncludeDir=$objDir/sysincludes
|
||||
tmpLibDir=$objDir/syslibs
|
||||
|
||||
rm -rf $installDir $objDir
|
||||
|
||||
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \
|
||||
$tmpLibDir || exit 1
|
||||
mkdir -p $installDir/lib/gcc-lib/i586-pc-beos/2.95.3-beos-041202
|
||||
|
||||
|
||||
# build binutils
|
||||
cd $binutilsObjDir
|
||||
CFLAGS="-O2" CXXFLAGS="-O2" $buildToolsDir/binutils/configure \
|
||||
--prefix=$installDir --target=i586-pc-beos --disable-nls \
|
||||
--enable-shared=yes || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
|
||||
export PATH=$PATH:$installDir/bin
|
||||
|
||||
|
||||
# build gcc
|
||||
|
||||
# prepare the include files
|
||||
copy_headers()
|
||||
{
|
||||
sourceDir=$1
|
||||
targetDir=$2
|
||||
|
||||
headers="$(find $sourceDir -name \*\.h | grep -v /.svn)"
|
||||
headers="$(echo $headers | sed -e s@$sourceDir/@@g)"
|
||||
for f in $headers; do
|
||||
headerTargetDir=$targetDir/$(dirname $f)
|
||||
mkdir -p $headerTargetDir
|
||||
cp $sourceDir/$f $headerTargetDir
|
||||
done
|
||||
}
|
||||
|
||||
copy_headers $haikuSourceDir/headers/os $tmpIncludeDir/be
|
||||
copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix
|
||||
|
||||
# configure gcc
|
||||
cd $gccObjDir
|
||||
CFLAGS="-O2" CXXFLAGS="-O2" $buildToolsDir/gcc/configure --prefix=$installDir \
|
||||
--target=i586-pc-beos --disable-nls --enable-shared=yes \
|
||||
--enable-languages=c,c++ --with-headers=$tmpIncludeDir \
|
||||
--with-libs=$tmpLibDir || exit 1
|
||||
|
||||
# hack the Makefile to avoid trouble with stuff we don't need anyway
|
||||
sedExpr=
|
||||
for toRemove in libiberty libio libjava libobjc libstdc++; do
|
||||
sedExpr="$sedExpr -e 's@^\(TARGET_CONFIGDIRS =.*\)$toRemove\(.*\)@\1\2@'"
|
||||
done
|
||||
echo sedExpr: $sedExpr
|
||||
mv Makefile Makefile.bak || exit 1
|
||||
eval "sed $sedExpr Makefile.bak > Makefile" || exit 1
|
||||
rm Makefile.bak
|
||||
|
||||
# make gcc
|
||||
make cross || {
|
||||
echo "ERROR: Building gcc failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# install gcc
|
||||
make install-gcc-cross || {
|
||||
echo "ERROR: Installing the cross compiler failed." >&2
|
||||
echo "ERROR: Note, that it is normal for the \"make cross\" to fail" >&2
|
||||
echo "ERROR: at some point, but it must not fail before all" >&2
|
||||
echo "ERROR: components we need have been built." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# cleanup
|
||||
|
||||
# remove the system headers from the installation dir
|
||||
# Only the ones from the source tree should be used.
|
||||
sysIncludeDir=$installDir/i586-pc-beos/sys-include
|
||||
rm -rf $sysIncludeDir/be $sysIncludeDir/posix
|
||||
|
||||
# remove the objects dir
|
||||
rm -rf $objDir
|
||||
|
||||
|
||||
echo "binutils and gcc for cross compilation have been built successfully!"
|
||||
|
123
build/scripts/build_haiku_image
Executable file
123
build/scripts/build_haiku_image
Executable file
@ -0,0 +1,123 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The first argument is the shell script that initializes the variables.
|
||||
# sourceDir
|
||||
# outputDir
|
||||
# tmpDir
|
||||
# installDir
|
||||
# isImage
|
||||
# imagePath
|
||||
# imageSize
|
||||
# addBuildCompatibilityLibDir
|
||||
#
|
||||
# bfsShell
|
||||
# copyattr
|
||||
# fsShellCommand
|
||||
# makebootable
|
||||
# resattr
|
||||
# rc
|
||||
#
|
||||
if [ $# -gt 0 ]; then
|
||||
. $1
|
||||
shift
|
||||
fi
|
||||
|
||||
# this adds the build library dir to LD_LIBRARY_PATH
|
||||
eval "$addBuildCompatibilityLibDir"
|
||||
|
||||
# map the shell commands
|
||||
if [ $isImage ]; then
|
||||
sPrefix=:
|
||||
tPrefix=/myfs/
|
||||
cd="$fsShellCommand cd"
|
||||
scd="$fsShellCommand cd"
|
||||
cp="$fsShellCommand cp"
|
||||
ln="$fsShellCommand ln"
|
||||
mkdir="$fsShellCommand mkdir"
|
||||
rm="$fsShellCommand rm"
|
||||
mkindex="$fsShellCommand mkindex"
|
||||
else
|
||||
sPrefix=
|
||||
# TODO: This should come from the environment.
|
||||
tPrefix="$installDir/"
|
||||
cd=cd
|
||||
scd=:
|
||||
cp="$copyattr -d"
|
||||
ln=ln
|
||||
mkdir=mkdir
|
||||
rm=rm
|
||||
mkindex=mkindex
|
||||
fi
|
||||
|
||||
# create the image and mount it
|
||||
if [ $isImage ]; then
|
||||
echo
|
||||
echo "Creating image ..."
|
||||
dd if=/dev/zero of=$imagePath bs=1M count=$imageSize
|
||||
$bfsShell --initialize $imagePath Haiku
|
||||
$makebootable $imagePath
|
||||
$bfsShell -n $imagePath > /dev/null &
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
$mkindex BEOS:APP_SIG
|
||||
# needed to launch apps via signature
|
||||
|
||||
echo "Populating image ..."
|
||||
while [ $# -gt 0 ]; do
|
||||
. $1
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# install MIME database
|
||||
# TODO: It should be possible to do that in the build system too.
|
||||
mimeDBSource=$sourceDir/src/data/beos_mime
|
||||
mimeDBDest=${tPrefix}home/config/settings/beos_mime
|
||||
|
||||
echo "Deleting old MIME database ..."
|
||||
|
||||
$rm -rf $mimeDBDest
|
||||
$mkdir -p $mimeDBDest
|
||||
mkdir -p $tmpDir
|
||||
|
||||
echo "Installing MIME database ..."
|
||||
|
||||
for inSuperFile in $mimeDBSource/*.super; do
|
||||
superType=$(basename $inSuperFile .super)
|
||||
outSuperDir=$mimeDBDest/$superType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
tmpFile=$tmpDir/mimedb$$.rsrc
|
||||
tmpFile2=$tmpDir/mimedb$$.mime
|
||||
$rc -o $tmpFile $inSuperFile
|
||||
mkdir -p $tmpFile2
|
||||
$resattr -O -o $tmpFile2 $tmpFile
|
||||
$cp -r ${sPrefix}$tmpFile2 $outSuperDir
|
||||
rm -rf $tmpFile $tmpFile2
|
||||
|
||||
# iterate through the sub types
|
||||
for inSubFile in $mimeDBSource/$superType/*; do
|
||||
# check, if the type exists
|
||||
if test -f $inSubFile && grep META:TYPE $inSubFile &> /dev/null; then
|
||||
subType=$(basename $inSubFile)
|
||||
outSubFile=$outSuperDir/$subType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
tmpFile=$tmpDir/mimedb$$.rsrc
|
||||
tmpFile2=$tmpDir/mimedb$$.mime
|
||||
$rc -o $tmpFile $inSubFile
|
||||
$resattr -O -o $tmpFile2 $tmpFile
|
||||
$cp ${sPrefix}$tmpFile2 $outSubFile
|
||||
rm -f $tmpFile $tmpFile2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
# unmount
|
||||
if [ $isImage ]; then
|
||||
echo "Unmounting ..."
|
||||
$fsShellCommand sync
|
||||
$fsShellCommand quit
|
||||
fi
|
221
configure
vendored
221
configure
vendored
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# configure [ --floppy <floppy location> ]
|
||||
# configure [ <options> ]
|
||||
|
||||
# usage
|
||||
#
|
||||
@ -16,10 +16,37 @@ options:
|
||||
(device or image).
|
||||
--bochs-debug Enables bochs serial debug emulation (activated
|
||||
via kernel settings file).
|
||||
--cross-tools-prefix <prefix>
|
||||
Assume cross compilation. <prefix> should be a
|
||||
path to the directory where the cross
|
||||
compilation tools are located, plus the platform
|
||||
prefix, e.g. "/path/to/tools/i586-pc-beos-".
|
||||
This overrides the HAIKU_* tool variables.
|
||||
--build-cross-tools <build tools dir>
|
||||
Assume cross compilation. <build tools dir>
|
||||
defines the location of the build tools sources.
|
||||
They will be compiled and placed in the output
|
||||
directory under "cross-tools". The HAIKU_* tools
|
||||
variables will be set accordingly.
|
||||
--target=TARGET Select build target platform. [default=${target}]
|
||||
valid targets=r5,bone,dano,haiku
|
||||
--include-gpl-addons Include GPL licensed add-ons.
|
||||
--help Prints out this help.
|
||||
|
||||
environment variables:
|
||||
HAIKU_AR The static library archiver. Defaults to "ar".
|
||||
HAIKU_CC The compiler. Defaults to "gcc".
|
||||
HAIKU_LD The linker. Defaults to "ld".
|
||||
HAIKU_OBJCOPY The objcopy to be used. Defaults to "objcopy".
|
||||
HAIKU_RANLIB The static library indexer. Defaults to "ranlib".
|
||||
HAIKU_CPPFLAGS The preprocessor flags. Defaults to "".
|
||||
HAIKU_CCFLAGS The C flags. Defaults to "".
|
||||
HAIKU_CXXFLAGS The C++ flags. Defaults to "".
|
||||
HAIKU_LDFLAGS The linker flags. Defaults to "".
|
||||
HAIKU_ARFLAGS The flags passed to HAIKU_AR for archiving.
|
||||
Defaults to "ru".
|
||||
HAIKU_UNARFLAGS The flags passed to HAIKU_AR for unarchiving.
|
||||
Defaults to "x".
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -42,31 +69,83 @@ assertparam()
|
||||
standard_gcc_settings()
|
||||
{
|
||||
# PLATFORM_LINKLIBS
|
||||
gcclib=`gcc -print-libgcc-file-name`
|
||||
gcclib=`$HAIKU_CC -print-libgcc-file-name`
|
||||
gccdir=`dirname ${gcclib}`
|
||||
gcc_version=`gcc -dumpversion`
|
||||
if [ "x${PLATFORM_LINKLIBS}" == "x" ] ; then
|
||||
PLATFORM_LINKLIBS="-L ${gccdir} -lgcc"
|
||||
fi
|
||||
if [ "x${PLATFORM_HEADERS}" == "x" ] ; then
|
||||
PLATFORM_HEADERS="${gccdir}/include"
|
||||
fi
|
||||
if [ "${LIBGCC_DIR}" == "" ] ; then
|
||||
LIBGCC_DIR="${gccdir}"
|
||||
fi
|
||||
if [ "${LIBGCC_OBJECTS}" == "" ] ; then
|
||||
LIBGCC_OBJECTS=`ar t ${gccdir}/libgcc.a`
|
||||
fi
|
||||
haikuGCCVersion=`$HAIKU_CC -dumpversion`
|
||||
haikuGCCMachine=`$HAIKU_CC -dumpmachine`
|
||||
|
||||
HAIKU_GCC_LIB_DIR=${gccdir}
|
||||
HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
|
||||
HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
|
||||
HAIKU_GCC_HEADERS_DIR=${gccdir}/include
|
||||
HAIKU_GCC_LIBGCC_OBJECTS=`ar t ${HAIKU_GCC_LIBGCC}`
|
||||
}
|
||||
|
||||
# set_default_value
|
||||
#
|
||||
# Set the value for a variable, if no value is set yet.
|
||||
#
|
||||
set_default_value()
|
||||
{
|
||||
local var=$1;
|
||||
# any better way?
|
||||
(set -u; (eval "echo \${$var}") &> /dev/null) || eval "$var=$2"
|
||||
}
|
||||
|
||||
# get_build_tool_path
|
||||
#
|
||||
# Gets a usable absolute path of a build tool.
|
||||
#
|
||||
get_build_tool_path()
|
||||
{
|
||||
local var="HAIKU_$1"
|
||||
local tool=$2
|
||||
local path="${crossToolsPrefix}$tool"
|
||||
|
||||
if [ -f "$path" ]; then
|
||||
# get absolute path
|
||||
local oldPwd=$(pwd)
|
||||
cd $(dirname "$path")
|
||||
path="$(pwd)/$(basename "$path")"
|
||||
cd $oldPwd
|
||||
else
|
||||
which "$path" &> /dev/null || {
|
||||
echo "Build tool \"$path\" not found." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
eval "$var=$path"
|
||||
}
|
||||
|
||||
# get cwd and the source directory
|
||||
currentDir=`pwd`
|
||||
cd `dirname $0`
|
||||
sourceDir=`pwd`
|
||||
cd $currentDir
|
||||
|
||||
# default parameter values
|
||||
#
|
||||
platform=`uname`
|
||||
gcc_version=
|
||||
haikuGCCVersion=
|
||||
floppy=
|
||||
bochs_debug=0
|
||||
include_gpl_addons=0
|
||||
target=haiku
|
||||
crossToolsPrefix=
|
||||
buildCrossTools=
|
||||
|
||||
set_default_value HAIKU_AR ar
|
||||
set_default_value HAIKU_CC gcc
|
||||
set_default_value HAIKU_LD ld
|
||||
set_default_value HAIKU_OBJCOPY objcopy
|
||||
set_default_value HAIKU_RANLIB ranlib
|
||||
set_default_value HAIKU_CPPFLAGS ""
|
||||
set_default_value HAIKU_CCFLAGS ""
|
||||
set_default_value HAIKU_CXXFLAGS ""
|
||||
set_default_value HAIKU_LDFLAGS ""
|
||||
set_default_value HAIKU_ARFLAGS ru
|
||||
set_default_value HAIKU_UNARFLAGS x
|
||||
|
||||
# host BeOS recognition not needed anymore
|
||||
# revision=`uname -r`
|
||||
@ -85,6 +164,8 @@ while [ $# \> 0 ] ; do
|
||||
--floppy) assertparam "$1" $#; floppy=$2; shift 2;;
|
||||
--bochs-debug) bochs_debug=1; shift 1;;
|
||||
--target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;;
|
||||
--cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;;
|
||||
--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
|
||||
--help | -h) usage; exit 0;;
|
||||
*) echo Invalid argument: \`$1\'; exit 1;;
|
||||
esac
|
||||
@ -100,55 +181,121 @@ if [ -n "$floppy" ]; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# platform specific GCC settings
|
||||
case "$platform" in
|
||||
BeOS | Haiku | Linux)
|
||||
standard_gcc_settings ;;
|
||||
*)
|
||||
# Unknown platform
|
||||
echo Unsupported platform: ${platform}
|
||||
exit 1 ;;
|
||||
case "${platform}" in
|
||||
BeOS) buildPlatform=r5 ;;
|
||||
Linux) buildPlatform=linux ;;
|
||||
*) echo Unsupported platform: ${platform}
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
# create output directory
|
||||
if [ "$currentDir" = "$sourceDir" ]; then
|
||||
outputDir=$currentDir/generated
|
||||
else
|
||||
outputDir=$currentDir
|
||||
fi
|
||||
buildOutputDir=$outputDir/build
|
||||
buildAttributesDir=$outputDir/attributes
|
||||
mkdir -p $buildOutputDir || exit 1
|
||||
|
||||
# build cross tools from sources
|
||||
if [ -n "$buildCrossTools" ]; then
|
||||
"$sourceDir/build/scripts/build_cross_tools" "$sourceDir" \
|
||||
"$buildCrossTools" || exit 1
|
||||
crossToolsPrefix=$outputDir/cross-tools/bin/i586-pc-beos-
|
||||
fi
|
||||
|
||||
# cross tools
|
||||
if [ -n "$crossToolsPrefix" ]; then
|
||||
get_build_tool_path AR ar
|
||||
get_build_tool_path CC gcc
|
||||
get_build_tool_path LD ld
|
||||
get_build_tool_path OBJCOPY objcopy
|
||||
get_build_tool_path RANLIB ranlib
|
||||
fi
|
||||
|
||||
# prepare gcc settings
|
||||
standard_gcc_settings
|
||||
|
||||
# Generate BuildConfig
|
||||
cat << EOF > build/BuildConfig
|
||||
cat << EOF > $buildOutputDir/BuildConfig
|
||||
# BuildConfig
|
||||
# Note: This file has been automatically generated by configure.
|
||||
|
||||
FLOPPY_PATH ?= "${floppy}" ;
|
||||
PLATFORM_LINKLIBS ?= ${PLATFORM_LINKLIBS} ;
|
||||
PLATFORM_HEADERS ?= ${PLATFORM_HEADERS} ;
|
||||
GCC_RAW_VERSION ?= ${gcc_version} ;
|
||||
LIBGCC_DIR ?= ${LIBGCC_DIR} ;
|
||||
BOCHS_DEBUG_HACK ?= ${bochs_debug} ;
|
||||
INCLUDE_GPL_ADDONS ?= ${include_gpl_addons} ;
|
||||
TARGET_PLATFORM ?= ${target} ;
|
||||
HOST_PLATFORM ?= ${buildPlatform} ;
|
||||
|
||||
HAIKU_GCC_RAW_VERSION ?= ${haikuGCCVersion} ;
|
||||
HAIKU_GCC_MACHINE ?= ${haikuGCCMachine} ;
|
||||
HAIKU_GCC_LIB_DIR ?= ${HAIKU_GCC_LIB_DIR} ;
|
||||
HAIKU_GCC_HEADERS_DIR ?= ${HAIKU_GCC_HEADERS_DIR} ;
|
||||
HAIKU_GCC_LIBGCC ?= ${HAIKU_GCC_LIBGCC} ;
|
||||
|
||||
HAIKU_BUILD_ATTRIBUTES_DIR ?= ${buildAttributesDir} ;
|
||||
|
||||
HAIKU_AR ?= ${HAIKU_AR} ;
|
||||
HAIKU_CC ?= ${HAIKU_CC} ;
|
||||
HAIKU_LD ?= ${HAIKU_LD} ;
|
||||
HAIKU_OBJCOPY ?= ${HAIKU_OBJCOPY} ;
|
||||
HAIKU_RANLIB ?= ${HAIKU_RANLIB} ;
|
||||
HAIKU_CPPFLAGS ?= ${HAIKU_CPPFLAGS} ;
|
||||
HAIKU_CCFLAGS ?= ${HAIKU_CCFLAGS} ;
|
||||
HAIKU_CXXFLAGS ?= ${HAIKU_CXXFLAGS} ;
|
||||
HAIKU_LDFLAGS ?= ${HAIKU_LDFLAGS} ;
|
||||
HAIKU_ARFLAGS ?= ${HAIKU_ARFLAGS} ;
|
||||
HAIKU_UNARFLAGS ?= ${HAIKU_UNARFLAGS} ;
|
||||
|
||||
EOF
|
||||
|
||||
# Libgcc.a objects
|
||||
|
||||
cat << EOF > build/libgccObjects
|
||||
cat << EOF > $buildOutputDir/libgccObjects
|
||||
# libgcc.a objects to be linked against libroot.so
|
||||
# Note: This file has been automatically generated by configure.
|
||||
|
||||
LIBGCC_OBJECTS ?= ${LIBGCC_OBJECTS} ;
|
||||
HAIKU_GCC_LIBGCC_OBJECTS ?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
|
||||
EOF
|
||||
|
||||
# Generate Timezones binaries bindings
|
||||
|
||||
cat << EOF > build/Timezones
|
||||
timezoneSources="africa antarctica asia australasia europe northamerica
|
||||
southamerica pacificnew etcetera factory backward"
|
||||
|
||||
cat << EOF > $buildOutputDir/Timezones
|
||||
# Timezones used for the build
|
||||
# Note: This file has been automatically generated by configure.
|
||||
|
||||
HAIKU_TIME_ZONE_SOURCES = ${timezoneSources} ;
|
||||
|
||||
EOF
|
||||
|
||||
timezones=`echo src/data/etc/timezones/* | sed -e s@src/data/etc/timezones/.svn@@`
|
||||
for f in ${timezones};
|
||||
do
|
||||
for source in ${timezoneSources}; do
|
||||
f=$sourceDir/src/data/etc/timezones/$source
|
||||
|
||||
TZOBJECTS=`gawk '/^Zone/ { print $2 } /^Link/ { print $3 } ' $f `
|
||||
|
||||
cat << EOF >> build/Timezones
|
||||
TZ_OBJECTS on <src!data!etc!timezones>${f##src/data/etc/timezones/} ?= $TZOBJECTS ;
|
||||
cat << EOF >> $buildOutputDir/Timezones
|
||||
TZ_OBJECTS on <timezone-source>${source} ?= $TZOBJECTS ;
|
||||
EOF
|
||||
done
|
||||
|
||||
# Generate a boot strap Jamfile in the output directory, if it is not in
|
||||
# the source dir.
|
||||
|
||||
if [ "$currentDir" != "$sourceDir" ]; then
|
||||
|
||||
cat << EOF > $outputDir/Jamfile
|
||||
# automatically generated Jamfile
|
||||
|
||||
HAIKU_TOP = ${sourceDir} ;
|
||||
HAIKU_OUTPUT_DIR = ${outputDir} ;
|
||||
|
||||
include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
|
55
headers/build/HaikuBuildCompatibility.h
Normal file
55
headers/build/HaikuBuildCompatibility.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef HAIKU_BUILD_COMPATIBILITY_H
|
||||
#define HAIKU_BUILD_COMPATIBILITY_H
|
||||
|
||||
typedef unsigned long haiku_build_addr_t;
|
||||
#define addr_t haiku_build_addr_t
|
||||
|
||||
#include <Errors.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Is kernel-only under Linux.
|
||||
extern size_t strlcpy(char *dest, const char *source, size_t length);
|
||||
|
||||
// BeOS only
|
||||
extern ssize_t read_pos(int fd, off_t pos, void *buffer, size_t count);
|
||||
extern ssize_t write_pos(int fd, off_t pos, const void *buffer,size_t count);
|
||||
|
||||
|
||||
// There's no O_NOTRAVERSE under Linux, but there's a O_NOFOLLOW, which
|
||||
// means something different (open() fails when the file is a symlink), but
|
||||
// we can abuse this flag for our purposes (we filter it in libroot).
|
||||
#ifndef O_NOTRAVERSE
|
||||
#ifdef O_NOFOLLOW
|
||||
#define O_NOTRAVERSE O_NOFOLLOW
|
||||
#else
|
||||
#define O_NOTRAVERSE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IUMSK
|
||||
#define S_IUMSK ALLPERMS
|
||||
#endif
|
||||
|
||||
|
||||
// remap strerror()
|
||||
extern char *_haiku_build_strerror(int errnum);
|
||||
|
||||
#ifndef BUILDING_HAIKU_ERROR_MAPPER
|
||||
|
||||
#undef strerror
|
||||
#define strerror(errnum) _haiku_build_strerror(errnum)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // HAIKU_BUILD_COMPATIBILITY_H
|
||||
|
17
headers/build/os/AppKit.h
Normal file
17
headers/build/os/AppKit.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Master include file for the App Kit.
|
||||
*
|
||||
*/
|
||||
#include <AppDefs.h>
|
||||
#include <Application.h>
|
||||
#include <Clipboard.h>
|
||||
#include <Handler.h>
|
||||
#include <Invoker.h>
|
||||
#include <Looper.h>
|
||||
#include <Message.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <MessageQueue.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <Messenger.h>
|
||||
#include <PropertyInfo.h>
|
||||
#include <Roster.h>
|
15
headers/build/os/Be.h
Normal file
15
headers/build/os/Be.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* All-in-one include file for the entire system.
|
||||
*
|
||||
*/
|
||||
#include <AppKit.h>
|
||||
#include <DeviceKit.h>
|
||||
#include <GameKit.h>
|
||||
#include <InterfaceKit.h>
|
||||
#include <KernelKit.h>
|
||||
#include <MediaKit.h>
|
||||
#include <MidiKit.h>
|
||||
#include <NetKit.h>
|
||||
#include <StorageKit.h>
|
||||
#include <SupportKit.h>
|
||||
#include <TranslationKit.h>
|
387
headers/build/os/BeBuild.h
Normal file
387
headers/build/os/BeBuild.h
Normal file
@ -0,0 +1,387 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: BeBuild.h
|
||||
/
|
||||
/ Description: Import/export macros
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#define _BE_BUILD_H
|
||||
|
||||
#define B_BEOS_VERSION_4 0x0400
|
||||
#define B_BEOS_VERSION_4_5 0x0450
|
||||
#define B_BEOS_VERSION_5 0x0500
|
||||
|
||||
#define B_BEOS_VERSION B_BEOS_VERSION_5
|
||||
#define B_BEOS_VERSION_MAUI B_BEOS_VERSION_5
|
||||
|
||||
#if defined(__POWERPC__)
|
||||
// the PowerPC build is using GCC now (BeOS R5 used to use the Metrowerks
|
||||
// compiler), so it is not compatible to any BeOS version on that platform
|
||||
// before. However, that wouldn't rule out source compatibility, which
|
||||
// we do here (for now).
|
||||
#define _PR2_COMPATIBLE_ 0
|
||||
#define _PR3_COMPATIBLE_ 0
|
||||
#define _R4_COMPATIBLE_ 0
|
||||
#define _R4_5_COMPATIBLE_ 0
|
||||
#elif defined(__INTEL__)
|
||||
#define _PR2_COMPATIBLE_ 0
|
||||
#define _PR3_COMPATIBLE_ 0
|
||||
#define _R4_COMPATIBLE_ 1
|
||||
#define _R4_5_COMPATIBLE_ 1
|
||||
#else
|
||||
# error Configure BeBuild.h for your platform
|
||||
#endif
|
||||
|
||||
#if __MWERKS__
|
||||
# define _UNUSED(x)
|
||||
# define _PACKED
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
# define _UNUSED(x) x
|
||||
# define _PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL__) || defined(__POWERPC__)
|
||||
|
||||
// This is the standard import/export definitions used for
|
||||
// the ELF binary format - this should be usable by all flavors
|
||||
// of OpenBeOS.
|
||||
|
||||
# define _EXPORT
|
||||
# define _IMPORT
|
||||
|
||||
# define _IMPEXP_KERNEL
|
||||
# define _IMPEXP_GL
|
||||
# define _IMPEXP_ROOT
|
||||
# define _IMPEXP_NET
|
||||
# define _IMPEXP_NETDEV
|
||||
# define _IMPEXP_ATALK
|
||||
# define _IMPEXP_BE
|
||||
# define _IMPEXP_TRACKER
|
||||
# define _IMPEXP_MAIL
|
||||
# define _IMPEXP_DEVICE
|
||||
# define _IMPEXP_MEDIA
|
||||
# define _IMPEXP_MIDI
|
||||
# define _IMPEXP_MIDI2
|
||||
# define _IMPEXP_GAME
|
||||
# define _IMPEXP_GSOUND
|
||||
# define _IMPEXP_TRANSLATION
|
||||
# define _IMPEXP_TEXTENCODING
|
||||
# define _IMPEXP_INPUT
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* cpp kit */
|
||||
|
||||
/* -- <typeinfo> */
|
||||
class _IMPEXP_ROOT bad_cast;
|
||||
class _IMPEXP_ROOT bad_typeid;
|
||||
class _IMPEXP_ROOT type_info;
|
||||
|
||||
/* -- <exception> */
|
||||
class _IMPEXP_ROOT exception;
|
||||
class _IMPEXP_ROOT bad_exception;
|
||||
|
||||
/* -- <new.h> */
|
||||
class _IMPEXP_ROOT bad_alloc;
|
||||
|
||||
/* -- <mexcept.h> */
|
||||
class _IMPEXP_ROOT logic_error;
|
||||
class _IMPEXP_ROOT domain_error;
|
||||
class _IMPEXP_ROOT invalid_argument;
|
||||
class _IMPEXP_ROOT length_error;
|
||||
class _IMPEXP_ROOT out_of_range;
|
||||
class _IMPEXP_ROOT runtime_error;
|
||||
class _IMPEXP_ROOT range_error;
|
||||
class _IMPEXP_ROOT overflow_error;
|
||||
|
||||
/* support kit */
|
||||
class _IMPEXP_BE BArchivable;
|
||||
class _IMPEXP_BE BAutolock;
|
||||
class _IMPEXP_BE BBlockCache;
|
||||
class _IMPEXP_BE BBufferIO;
|
||||
class _IMPEXP_BE BDataIO;
|
||||
class _IMPEXP_BE BPositionIO;
|
||||
class _IMPEXP_BE BMallocIO;
|
||||
class _IMPEXP_BE BMemoryIO;
|
||||
class _IMPEXP_BE BFlattenable;
|
||||
class _IMPEXP_BE BList;
|
||||
class _IMPEXP_BE BLocker;
|
||||
class _IMPEXP_BE BStopWatch;
|
||||
class _IMPEXP_BE BString;
|
||||
|
||||
class _IMPEXP_BE PointerList;
|
||||
|
||||
/*storage kit */
|
||||
struct _IMPEXP_BE entry_ref;
|
||||
struct _IMPEXP_BE node_ref;
|
||||
class _IMPEXP_BE BAppFileInfo;
|
||||
class _IMPEXP_BE BDirectory;
|
||||
class _IMPEXP_BE BEntry;
|
||||
class _IMPEXP_BE BFile;
|
||||
class _IMPEXP_BE BRefFilter;
|
||||
class _IMPEXP_BE BMimeType;
|
||||
class _IMPEXP_BE BNode;
|
||||
class _IMPEXP_BE BNodeInfo;
|
||||
class _IMPEXP_BE BPath;
|
||||
class _IMPEXP_BE BQuery;
|
||||
class _IMPEXP_BE BResources;
|
||||
class _IMPEXP_BE BResourceStrings;
|
||||
class _IMPEXP_BE BStatable;
|
||||
class _IMPEXP_BE BSymLink;
|
||||
class _IMPEXP_BE BVolume;
|
||||
class _IMPEXP_BE BVolumeRoster;
|
||||
|
||||
//class _IMPEXP_BE Partition;
|
||||
//class _IMPEXP_BE Session;
|
||||
//class _IMPEXP_BE Device;
|
||||
//class _IMPEXP_BE DeviceList;
|
||||
//class _IMPEXP_BE TNodeWalker;
|
||||
//class _IMPEXP_BE TQueryWalker;
|
||||
//class _IMPEXP_BE TVolWalker;
|
||||
|
||||
/*app kit */
|
||||
struct _IMPEXP_BE app_info;
|
||||
class _IMPEXP_BE BApplication;
|
||||
class _IMPEXP_BE BClipboard;
|
||||
class _IMPEXP_BE BHandler;
|
||||
class _IMPEXP_BE BInvoker;
|
||||
class _IMPEXP_BE BLooper;
|
||||
class _IMPEXP_BE BMessage;
|
||||
class _IMPEXP_BE BMessageFilter;
|
||||
class _IMPEXP_BE BMessageQueue;
|
||||
class _IMPEXP_BE BMessageRunner;
|
||||
class _IMPEXP_BE BMessenger;
|
||||
class _IMPEXP_BE BPropertyInfo;
|
||||
class _IMPEXP_BE BRoster;
|
||||
|
||||
class _IMPEXP_BE _BAppServerLink_;
|
||||
class _IMPEXP_BE _BSession_;
|
||||
|
||||
/*interface kit */
|
||||
class _IMPEXP_BE BAlert;
|
||||
class _IMPEXP_BE BBitmap;
|
||||
class _IMPEXP_BE BBox;
|
||||
class _IMPEXP_BE BButton;
|
||||
class _IMPEXP_BE BChannelControl;
|
||||
class _IMPEXP_BE BChannelSlider;
|
||||
class _IMPEXP_BE BCheckBox;
|
||||
class _IMPEXP_BE BColorControl;
|
||||
class _IMPEXP_BE BControl;
|
||||
class _IMPEXP_BE BDeskbar;
|
||||
class _IMPEXP_BE BDragger;
|
||||
class _IMPEXP_BE BFont;
|
||||
class _IMPEXP_BE BInputDevice;
|
||||
class _IMPEXP_BE BListItem;
|
||||
class _IMPEXP_BE BListView;
|
||||
class _IMPEXP_BE BStringItem;
|
||||
class _IMPEXP_BE BMenu;
|
||||
class _IMPEXP_BE BMenuBar;
|
||||
class _IMPEXP_BE BMenuField;
|
||||
class _IMPEXP_BE BMenuItem;
|
||||
class _IMPEXP_BE BOptionControl;
|
||||
class _IMPEXP_BE BOptionPopUp;
|
||||
class _IMPEXP_BE BOutlineListView;
|
||||
class _IMPEXP_BE BPicture;
|
||||
class _IMPEXP_BE BPictureButton;
|
||||
class _IMPEXP_BE BPoint;
|
||||
class _IMPEXP_BE BPolygon;
|
||||
class _IMPEXP_BE BPopUpMenu;
|
||||
class _IMPEXP_BE BPrintJob;
|
||||
class _IMPEXP_BE BRadioButton;
|
||||
class _IMPEXP_BE BRect;
|
||||
class _IMPEXP_BE BRegion;
|
||||
class _IMPEXP_BE BScreen;
|
||||
class _IMPEXP_BE BScrollBar;
|
||||
class _IMPEXP_BE BScrollView;
|
||||
class _IMPEXP_BE BSeparatorItem;
|
||||
class _IMPEXP_BE BShelf;
|
||||
class _IMPEXP_BE BShape;
|
||||
class _IMPEXP_BE BShapeIterator;
|
||||
class _IMPEXP_BE BSlider;
|
||||
class _IMPEXP_BE BStatusBar;
|
||||
class _IMPEXP_BE BStringView;
|
||||
class _IMPEXP_BE BTab;
|
||||
class _IMPEXP_BE BTabView;
|
||||
class _IMPEXP_BE BTextControl;
|
||||
class _IMPEXP_BE BTextView;
|
||||
class _IMPEXP_BE BView;
|
||||
class _IMPEXP_BE BWindow;
|
||||
|
||||
class _IMPEXP_BE _BTextInput_;
|
||||
class _IMPEXP_BE _BMCMenuBar_;
|
||||
class _IMPEXP_BE _BMCItem_;
|
||||
class _IMPEXP_BE _BWidthBuffer_;
|
||||
class _IMPEXP_BE BPrivateScreen;
|
||||
|
||||
/* net kit */
|
||||
class _IMPEXP_NET _Allocator;
|
||||
class _IMPEXP_NET _Transacter;
|
||||
class _IMPEXP_NET _FastIPC;
|
||||
|
||||
/* netdev kit */
|
||||
class _IMPEXP_NETDEV BNetPacket;
|
||||
class _IMPEXP_NETDEV BStandardPacket;
|
||||
class _IMPEXP_NETDEV BTimeoutHandler;
|
||||
class _IMPEXP_NETDEV BPacketHandler;
|
||||
class _IMPEXP_NETDEV BNetProtocol;
|
||||
class _IMPEXP_NETDEV BNetDevice;
|
||||
class _IMPEXP_NETDEV BCallBackHandler;
|
||||
class _IMPEXP_NETDEV BNetConfig;
|
||||
class _IMPEXP_NETDEV BIpDevice;
|
||||
|
||||
class _IMPEXP_NETDEV _NetBufList;
|
||||
class _IMPEXP_NETDEV _BSem;
|
||||
|
||||
/* atalk kit */
|
||||
class _IMPEXP_ATALK _PrinterNode;
|
||||
|
||||
/* tracker kit */
|
||||
class _IMPEXP_TRACKER BFilePanel;
|
||||
class _IMPEXP_TRACKER BRecentItemsList;
|
||||
class _IMPEXP_TRACKER BRecentFilesList;
|
||||
class _IMPEXP_TRACKER BRecentFoldersList;
|
||||
class _IMPEXP_TRACKER BRecentAppsList;
|
||||
|
||||
/* mail kit */
|
||||
class _IMPEXP_MAIL BMailMessage;
|
||||
|
||||
/* device kit */
|
||||
class _IMPEXP_DEVICE BA2D;
|
||||
class _IMPEXP_DEVICE BD2A;
|
||||
class _IMPEXP_DEVICE BDigitalPort;
|
||||
class _IMPEXP_DEVICE BJoystick;
|
||||
class _IMPEXP_DEVICE BSerialPort;
|
||||
|
||||
/* media kit */
|
||||
class _IMPEXP_MEDIA BDACRenderer;
|
||||
class _IMPEXP_MEDIA BAudioFileStream;
|
||||
class _IMPEXP_MEDIA BADCStream;
|
||||
class _IMPEXP_MEDIA BDACStream;
|
||||
class _IMPEXP_MEDIA BAbstractBufferStream;
|
||||
class _IMPEXP_MEDIA BBufferStreamManager;
|
||||
class _IMPEXP_MEDIA BBufferStream;
|
||||
class _IMPEXP_MEDIA BSoundFile;
|
||||
class _IMPEXP_MEDIA BSubscriber;
|
||||
|
||||
class _IMPEXP_MEDIA BMediaRoster;
|
||||
class _IMPEXP_MEDIA BMediaNode;
|
||||
class _IMPEXP_MEDIA BTimeSource;
|
||||
class _IMPEXP_MEDIA BBufferProducer;
|
||||
class _IMPEXP_MEDIA BBufferConsumer;
|
||||
class _IMPEXP_MEDIA BBuffer;
|
||||
class _IMPEXP_MEDIA BBufferGroup;
|
||||
class _IMPEXP_MEDIA BControllable;
|
||||
class _IMPEXP_MEDIA BFileInterface;
|
||||
class _IMPEXP_MEDIA BEntityInterface;
|
||||
class _IMPEXP_MEDIA BMediaAddOn;
|
||||
class _IMPEXP_MEDIA BMediaTheme;
|
||||
class _IMPEXP_MEDIA BParameterWeb;
|
||||
class _IMPEXP_MEDIA BParameterGroup;
|
||||
class _IMPEXP_MEDIA BParameter;
|
||||
class _IMPEXP_MEDIA BNullParameter;
|
||||
class _IMPEXP_MEDIA BDiscreteParameter;
|
||||
class _IMPEXP_MEDIA BContinuousParameter;
|
||||
class _IMPEXP_MEDIA BMediaFiles;
|
||||
class _IMPEXP_MEDIA BSound;
|
||||
class _IMPEXP_MEDIA BSoundCard;
|
||||
class _IMPEXP_MEDIA BSoundPlayer;
|
||||
class _IMPEXP_MEDIA BMediaFormats;
|
||||
class _IMPEXP_MEDIA BTimedEventQueue;
|
||||
//class _IMPEXP_MEDIA BEventIterator;
|
||||
class _IMPEXP_MEDIA BMediaEventLooper;
|
||||
class _IMPEXP_MEDIA BMediaFile;
|
||||
class _IMPEXP_MEDIA BMediaTrack;
|
||||
|
||||
class _IMPEXP_MEDIA media_node;
|
||||
struct _IMPEXP_MEDIA media_input;
|
||||
struct _IMPEXP_MEDIA media_output;
|
||||
struct _IMPEXP_MEDIA live_node_info;
|
||||
struct _IMPEXP_MEDIA buffer_clone_info;
|
||||
struct _IMPEXP_MEDIA media_source;
|
||||
struct _IMPEXP_MEDIA media_destination;
|
||||
struct _IMPEXP_MEDIA media_raw_audio_format;
|
||||
struct _IMPEXP_MEDIA media_raw_video_format;
|
||||
struct _IMPEXP_MEDIA media_video_display_info;
|
||||
struct _IMPEXP_MEDIA flavor_info;
|
||||
struct _IMPEXP_MEDIA dormant_node_info;
|
||||
struct _IMPEXP_MEDIA dormant_flavor_info;
|
||||
struct _IMPEXP_MEDIA media_source;
|
||||
struct _IMPEXP_MEDIA media_destination;
|
||||
struct _IMPEXP_MEDIA _media_format_description;
|
||||
struct _IMPEXP_MEDIA media_timed_event;
|
||||
|
||||
/* midi kit */
|
||||
class _IMPEXP_MIDI BMidi;
|
||||
class _IMPEXP_MIDI BMidiPort;
|
||||
class _IMPEXP_MIDI BMidiStore;
|
||||
class _IMPEXP_MIDI BMidiSynth;
|
||||
class _IMPEXP_MIDI BMidiSynthFile;
|
||||
class _IMPEXP_MIDI BMidiText;
|
||||
class _IMPEXP_MIDI BSamples;
|
||||
class _IMPEXP_MIDI BSynth;
|
||||
|
||||
class _IMPEXP_MIDI2 BMidiEndpoint;
|
||||
class _IMPEXP_MIDI2 BMidiProducer;
|
||||
class _IMPEXP_MIDI2 BMidiConsumer;
|
||||
class _IMPEXP_MIDI2 BMidiLocalProducer;
|
||||
class _IMPEXP_MIDI2 BMidiLocalConsumer;
|
||||
class _IMPEXP_MIDI2 BMidiRoster;
|
||||
|
||||
/* game kit */
|
||||
class _IMPEXP_GAME BWindowScreen;
|
||||
class _IMPEXP_GAME BDirectWindow;
|
||||
|
||||
/* gamesound kit */
|
||||
class _IMPEXP_GSOUND BGameSound;
|
||||
class _IMPEXP_GSOUND BSimpleGameSound;
|
||||
class _IMPEXP_GSOUND BStreamingGameSound;
|
||||
class _IMPEXP_GSOUND BFileGameSound;
|
||||
class _IMPEXP_GSOUND BPushGameSound;
|
||||
|
||||
/* translation kit */
|
||||
class _IMPEXP_TRANSLATION BTranslatorRoster;
|
||||
class _IMPEXP_TRANSLATION BTranslationUtils;
|
||||
class _IMPEXP_TRANSLATION BBitmapStream;
|
||||
class _IMPEXP_TRANSLATION BTranslator;
|
||||
struct _IMPEXP_TRANSLATION translation_format;
|
||||
struct _IMPEXP_TRANSLATION translator_info;
|
||||
|
||||
/* GL */
|
||||
class _IMPEXP_GL BGLView;
|
||||
class _IMPEXP_GL BGLScreen;
|
||||
class _IMPEXP_GL GLUnurbs;
|
||||
class _IMPEXP_GL GLUquadric;
|
||||
class _IMPEXP_GL GLUtesselator;
|
||||
|
||||
typedef class _IMPEXP_GL GLUnurbs GLUnurbsObj;
|
||||
typedef class _IMPEXP_GL GLUquadric GLUquadricObj;
|
||||
typedef class _IMPEXP_GL GLUtesselator GLUtesselatorObj;
|
||||
typedef class _IMPEXP_GL GLUtesselator GLUtriangulatorObj;
|
||||
|
||||
/* input_server */
|
||||
class _IMPEXP_INPUT BInputServerDevice;
|
||||
class _IMPEXP_INPUT BInputServerFilter;
|
||||
class _IMPEXP_INPUT BInputServerMethod;
|
||||
|
||||
#else /* __cplusplus */
|
||||
/*
|
||||
//typedef struct _IMPEXP_GL GLUnurbs GLUnurbs;
|
||||
//typedef struct _IMPEXP_GL GLUquadric GLUquadric;
|
||||
//typedef struct _IMPEXP_GL GLUtesselator GLUtesselator;
|
||||
|
||||
//typedef struct _IMPEXP_GL GLUnurbs GLUnurbsObj;
|
||||
//typedef struct _IMPEXP_GL GLUquadric GLUquadricObj;
|
||||
//typedef struct _IMPEXP_GL GLUtesselator GLUtesselatorObj;
|
||||
//typedef struct _IMPEXP_GL GLUtesselator GLUtriangulatorObj;
|
||||
*/
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _BE_BUILD_H */
|
15
headers/build/os/DeviceKit.h
Normal file
15
headers/build/os/DeviceKit.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Master include file for the Device Kit.
|
||||
*
|
||||
*/
|
||||
#include <A2D.h>
|
||||
#include <D2A.h>
|
||||
#include <DigitalPort.h>
|
||||
#include <Joystick.h>
|
||||
#include <SerialPort.h>
|
||||
#include <graphic_driver.h>
|
||||
/*
|
||||
#include <perfmon_cpu.h>
|
||||
#include <scsi.h>
|
||||
#include <scsiprobe_driver.h>
|
||||
*/
|
12
headers/build/os/GameKit.h
Normal file
12
headers/build/os/GameKit.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Master include file for the Game Kit.
|
||||
*
|
||||
*/
|
||||
#include <WindowScreen.h>
|
||||
#include <DirectWindow.h>
|
||||
#include <FileGameSound.h>
|
||||
#include <GameSound.h>
|
||||
#include <GameSoundDefs.h>
|
||||
#include <PushGameSound.h>
|
||||
#include <SimpleGameSound.h>
|
||||
#include <StreamingGameSound.h>
|
46
headers/build/os/InterfaceKit.h
Normal file
46
headers/build/os/InterfaceKit.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Master include file for the Interface Kit.
|
||||
*
|
||||
* <UnicodeBlockObjects.h> is not included on purpose.
|
||||
*/
|
||||
#include <Alert.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <CheckBox.h>
|
||||
#include <ColorControl.h>
|
||||
#include <Control.h>
|
||||
#include <Dragger.h>
|
||||
#include <Font.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Input.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <ListItem.h>
|
||||
#include <ListView.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuField.h>
|
||||
#include <MenuItem.h>
|
||||
#include <OutlineListView.h>
|
||||
#include <Picture.h>
|
||||
#include <PictureButton.h>
|
||||
#include <Point.h>
|
||||
#include <Polygon.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <PrintJob.h>
|
||||
#include <RadioButton.h>
|
||||
#include <Rect.h>
|
||||
#include <Region.h>
|
||||
#include <Screen.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <ScrollView.h>
|
||||
#include <Shape.h>
|
||||
#include <Shelf.h>
|
||||
#include <Slider.h>
|
||||
#include <StatusBar.h>
|
||||
#include <StringView.h>
|
||||
#include <TabView.h>
|
||||
#include <TextControl.h>
|
||||
#include <TextView.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
12
headers/build/os/KernelKit.h
Normal file
12
headers/build/os/KernelKit.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Master include file for the Kernel Kit.
|
||||
*
|
||||
*/
|
||||
#include <OS.h>
|
||||
#include <debugger.h>
|
||||
#include <fs_attr.h>
|
||||
#include <fs_index.h>
|
||||
#include <fs_info.h>
|
||||
#include <fs_query.h>
|
||||
#include <image.h>
|
||||
#include <scheduler.h>
|
5
headers/build/os/MailKit.h
Normal file
5
headers/build/os/MailKit.h
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Master include file for the Mail Kit.
|
||||
*
|
||||
*/
|
||||
#include <E-mail.h>
|
29
headers/build/os/MediaKit.h
Normal file
29
headers/build/os/MediaKit.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Master include file for the Media Kit.
|
||||
*
|
||||
*/
|
||||
#include <Buffer.h>
|
||||
#include <BufferConsumer.h>
|
||||
#include <BufferGroup.h>
|
||||
#include <BufferProducer.h>
|
||||
#include <Controllable.h>
|
||||
#include <FileInterface.h>
|
||||
#include <MediaAddOn.h>
|
||||
#include <MediaDefs.h>
|
||||
#include <MediaEventLooper.h>
|
||||
#include <MediaFile.h>
|
||||
#include <MediaFiles.h>
|
||||
#include <MediaFormats.h>
|
||||
#include <MediaNode.h>
|
||||
#include <MediaRoster.h>
|
||||
#include <MediaTheme.h>
|
||||
#include <MediaTrack.h>
|
||||
#include <ParameterWeb.h>
|
||||
#include <PlaySound.h>
|
||||
#include <RealtimeAlloc.h>
|
||||
#include <Sound.h>
|
||||
#include <SoundFile.h>
|
||||
#include <SoundPlayer.h>
|
||||
#include <TimeCode.h>
|
||||
#include <TimeSource.h>
|
||||
#include <TimedEventQueue.h>
|
13
headers/build/os/MidiKit.h
Normal file
13
headers/build/os/MidiKit.h
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Master include file for the Midi Kit.
|
||||
*
|
||||
*/
|
||||
#include <Midi.h>
|
||||
#include <MidiDefs.h>
|
||||
#include <MidiPort.h>
|
||||
#include <MidiStore.h>
|
||||
#include <MidiSynth.h>
|
||||
#include <MidiSynthFile.h>
|
||||
#include <MidiText.h>
|
||||
#include <Samples.h>
|
||||
#include <Synth.h>
|
8
headers/build/os/NetKit.h
Normal file
8
headers/build/os/NetKit.h
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Master include file for the Net Kit.
|
||||
*
|
||||
*/
|
||||
#include <net_settings.h>
|
||||
#include <netdb.h>
|
||||
#include <socket.h>
|
||||
#include <netinet/in.h>
|
9
headers/build/os/NetworkKit.h
Normal file
9
headers/build/os/NetworkKit.h
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Master include file for the Network Kit.
|
||||
*
|
||||
*/
|
||||
#include <socket.h>
|
||||
#include <NetAddress.h>
|
||||
#include <NetBuffer.h>
|
||||
#include <NetEndpoint.h>
|
||||
#include <NetDebug.h>
|
9
headers/build/os/OpenGLKit.h
Normal file
9
headers/build/os/OpenGLKit.h
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Master include file for the OpenGL Kit.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GLView.h>
|
25
headers/build/os/StorageKit.h
Normal file
25
headers/build/os/StorageKit.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Master include file for the Storage Kit.
|
||||
*
|
||||
*/
|
||||
#include <Alias.h>
|
||||
#include <AppFileInfo.h>
|
||||
#include <Directory.h>
|
||||
#include <Entry.h>
|
||||
#include <EntryList.h>
|
||||
#include <File.h>
|
||||
#include <FilePanel.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Mime.h>
|
||||
#include <Node.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <Path.h>
|
||||
#include <Query.h>
|
||||
#include <Resources.h>
|
||||
#include <ResourceStrings.h>
|
||||
#include <Statable.h>
|
||||
#include <StorageDefs.h>
|
||||
#include <SymLink.h>
|
||||
#include <Volume.h>
|
||||
#include <VolumeRoster.h>
|
23
headers/build/os/SupportKit.h
Normal file
23
headers/build/os/SupportKit.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Master include file for the Support Kit.
|
||||
*
|
||||
*/
|
||||
#include <Archivable.h>
|
||||
#include <Autolock.h>
|
||||
#include <Beep.h>
|
||||
#include <BlockCache.h>
|
||||
#include <BufferIO.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <ClassInfo.h>
|
||||
#include <DataIO.h>
|
||||
#include <Debug.h>
|
||||
#include <Errors.h>
|
||||
#include <Flattenable.h>
|
||||
#include <List.h>
|
||||
#include <Locker.h>
|
||||
#include <StopWatch.h>
|
||||
#include <String.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <TypeConstants.h>
|
||||
#include <UTF8.h>
|
||||
#include <syslog.h>
|
12
headers/build/os/TranslationKit.h
Normal file
12
headers/build/os/TranslationKit.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Master include file for the Translation Kit.
|
||||
*
|
||||
* <TranslatorAddOn.h> not included, as it's only required when building an add-on
|
||||
*/
|
||||
#include <BitmapStream.h>
|
||||
#include <TranslationDefs.h>
|
||||
#include <TranslationErrors.h>
|
||||
#include <TranslationUtils.h>
|
||||
#include <TranslatorFormats.h>
|
||||
#include <TranslatorRoster.h>
|
||||
#include <Translator.h>
|
261
headers/build/os/add-ons/file_system/fsproto.h
Normal file
261
headers/build/os/add-ons/file_system/fsproto.h
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
Copyright 1999-2001, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#ifndef _FSPROTO_H
|
||||
#define _FSPROTO_H
|
||||
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <iovec.h>
|
||||
|
||||
#include <OS.h>
|
||||
#include <fs_attr.h>
|
||||
#include <fs_info.h>
|
||||
#include <BeBuild.h>
|
||||
#include <Drivers.h>
|
||||
|
||||
typedef dev_t nspace_id;
|
||||
typedef ino_t vnode_id;
|
||||
|
||||
/*
|
||||
* PUBLIC PART OF THE FILE SYSTEM PROTOCOL
|
||||
*/
|
||||
|
||||
#define WSTAT_MODE 0x0001
|
||||
#define WSTAT_UID 0x0002
|
||||
#define WSTAT_GID 0x0004
|
||||
#define WSTAT_SIZE 0x0008
|
||||
#define WSTAT_ATIME 0x0010
|
||||
#define WSTAT_MTIME 0x0020
|
||||
#define WSTAT_CRTIME 0x0040
|
||||
|
||||
#define WFSSTAT_NAME 0x0001
|
||||
|
||||
#define B_ENTRY_CREATED 1
|
||||
#define B_ENTRY_REMOVED 2
|
||||
#define B_ENTRY_MOVED 3
|
||||
#define B_STAT_CHANGED 4
|
||||
#define B_ATTR_CHANGED 5
|
||||
#define B_DEVICE_MOUNTED 6
|
||||
#define B_DEVICE_UNMOUNTED 7
|
||||
|
||||
#define B_STOP_WATCHING 0x0000
|
||||
#define B_WATCH_NAME 0x0001
|
||||
#define B_WATCH_STAT 0x0002
|
||||
#define B_WATCH_ATTR 0x0004
|
||||
#define B_WATCH_DIRECTORY 0x0008
|
||||
|
||||
#define SELECT_READ 1
|
||||
#define SELECT_WRITE 2
|
||||
#define SELECT_EXCEPTION 3
|
||||
|
||||
#define B_CUR_FS_API_VERSION 2
|
||||
|
||||
#define IOCTL_FILE_UNCACHED_IO 10000
|
||||
#define IOCTL_CREATE_TIME 10002
|
||||
#define IOCTL_MODIFIED_TIME 10003
|
||||
|
||||
struct attr_info;
|
||||
struct index_info;
|
||||
|
||||
typedef int op_read_vnode(void *ns, vnode_id vnid, char r, void **node);
|
||||
typedef int op_write_vnode(void *ns, void *node, char r);
|
||||
typedef int op_remove_vnode(void *ns, void *node, char r);
|
||||
typedef int op_secure_vnode(void *ns, void *node);
|
||||
typedef int op_wake_vnode(void *ns, void *node);
|
||||
typedef int op_suspend_vnode(void *ns, void *node);
|
||||
|
||||
typedef int op_walk(void *ns, void *base, const char *file, char **newpath,
|
||||
vnode_id *vnid);
|
||||
|
||||
typedef int op_access(void *ns, void *node, int mode);
|
||||
|
||||
typedef int op_create(void *ns, void *dir, const char *name,
|
||||
int omode, int perms, vnode_id *vnid, void **cookie);
|
||||
typedef int op_mkdir(void *ns, void *dir, const char *name, int perms);
|
||||
typedef int op_symlink(void *ns, void *dir, const char *name,
|
||||
const char *path);
|
||||
typedef int op_link(void *ns, void *dir, const char *name, void *node);
|
||||
|
||||
typedef int op_rename(void *ns, void *olddir, const char *oldname,
|
||||
void *newdir, const char *newname);
|
||||
typedef int op_unlink(void *ns, void *dir, const char *name);
|
||||
typedef int op_rmdir(void *ns, void *dir, const char *name);
|
||||
|
||||
typedef int op_readlink(void *ns, void *node, char *buf, size_t *bufsize);
|
||||
|
||||
typedef int op_opendir(void *ns, void *node, void **cookie);
|
||||
typedef int op_closedir(void *ns, void *node, void *cookie);
|
||||
typedef int op_rewinddir(void *ns, void *node, void *cookie);
|
||||
typedef int op_readdir(void *ns, void *node, void *cookie, long *num,
|
||||
struct dirent *buf, size_t bufsize);
|
||||
|
||||
typedef int op_open(void *ns, void *node, int omode, void **cookie);
|
||||
typedef int op_close(void *ns, void *node, void *cookie);
|
||||
typedef int op_free_cookie(void *ns, void *node, void *cookie);
|
||||
typedef int op_read(void *ns, void *node, void *cookie, off_t pos, void *buf,
|
||||
size_t *len);
|
||||
typedef int op_write(void *ns, void *node, void *cookie, off_t pos,
|
||||
const void *buf, size_t *len);
|
||||
typedef int op_readv(void *ns, void *node, void *cookie, off_t pos, const iovec *vec,
|
||||
size_t count, size_t *len);
|
||||
typedef int op_writev(void *ns, void *node, void *cookie, off_t pos, const iovec *vec,
|
||||
size_t count, size_t *len);
|
||||
typedef int op_ioctl(void *ns, void *node, void *cookie, int cmd, void *buf,
|
||||
size_t len);
|
||||
typedef int op_setflags(void *ns, void *node, void *cookie, int flags);
|
||||
|
||||
typedef int op_rstat(void *ns, void *node, struct stat *);
|
||||
typedef int op_wstat(void *ns, void *node, struct stat *, long mask);
|
||||
typedef int op_fsync(void *ns, void *node);
|
||||
|
||||
typedef int op_select(void *ns, void *node, void *cookie, uint8 event,
|
||||
uint32 ref, selectsync *sync);
|
||||
typedef int op_deselect(void *ns, void *node, void *cookie, uint8 event,
|
||||
selectsync *sync);
|
||||
|
||||
typedef int op_initialize(const char *devname, void *parms, size_t len);
|
||||
typedef int op_mount(nspace_id nsid, const char *devname, ulong flags,
|
||||
void *parms, size_t len, void **data, vnode_id *vnid);
|
||||
typedef int op_unmount(void *ns);
|
||||
typedef int op_sync(void *ns);
|
||||
typedef int op_rfsstat(void *ns, struct fs_info *);
|
||||
typedef int op_wfsstat(void *ns, struct fs_info *, long mask);
|
||||
|
||||
|
||||
typedef int op_open_attrdir(void *ns, void *node, void **cookie);
|
||||
typedef int op_close_attrdir(void *ns, void *node, void *cookie);
|
||||
typedef int op_rewind_attrdir(void *ns, void *node, void *cookie);
|
||||
typedef int op_read_attrdir(void *ns, void *node, void *cookie, long *num,
|
||||
struct dirent *buf, size_t bufsize);
|
||||
typedef int op_remove_attr(void *ns, void *node, const char *name);
|
||||
typedef int op_rename_attr(void *ns, void *node, const char *oldname,
|
||||
const char *newname);
|
||||
typedef int op_stat_attr(void *ns, void *node, const char *name,
|
||||
struct attr_info *buf);
|
||||
|
||||
typedef int op_write_attr(void *ns, void *node, const char *name, int type,
|
||||
const void *buf, size_t *len, off_t pos);
|
||||
typedef int op_read_attr(void *ns, void *node, const char *name, int type,
|
||||
void *buf, size_t *len, off_t pos);
|
||||
|
||||
typedef int op_open_indexdir(void *ns, void **cookie);
|
||||
typedef int op_close_indexdir(void *ns, void *cookie);
|
||||
typedef int op_rewind_indexdir(void *ns, void *cookie);
|
||||
typedef int op_read_indexdir(void *ns, void *cookie, long *num,
|
||||
struct dirent *buf, size_t bufsize);
|
||||
typedef int op_create_index(void *ns, const char *name, int type, int flags);
|
||||
typedef int op_remove_index(void *ns, const char *name);
|
||||
typedef int op_rename_index(void *ns, const char *oldname,
|
||||
const char *newname);
|
||||
typedef int op_stat_index(void *ns, const char *name, struct index_info *buf);
|
||||
|
||||
typedef int op_open_query(void *ns, const char *query, ulong flags,
|
||||
port_id port, long token, void **cookie);
|
||||
typedef int op_close_query(void *ns, void *cookie);
|
||||
typedef int op_read_query(void *ns, void *cookie, long *num,
|
||||
struct dirent *buf, size_t bufsize);
|
||||
|
||||
typedef struct vnode_ops {
|
||||
op_read_vnode (*read_vnode);
|
||||
op_write_vnode (*write_vnode);
|
||||
op_remove_vnode (*remove_vnode);
|
||||
op_secure_vnode (*secure_vnode);
|
||||
op_walk (*walk);
|
||||
op_access (*access);
|
||||
op_create (*create);
|
||||
op_mkdir (*mkdir);
|
||||
op_symlink (*symlink);
|
||||
op_link (*link);
|
||||
op_rename (*rename);
|
||||
op_unlink (*unlink);
|
||||
op_rmdir (*rmdir);
|
||||
op_readlink (*readlink);
|
||||
op_opendir (*opendir);
|
||||
op_closedir (*closedir);
|
||||
op_free_cookie (*free_dircookie);
|
||||
op_rewinddir (*rewinddir);
|
||||
op_readdir (*readdir);
|
||||
op_open (*open);
|
||||
op_close (*close);
|
||||
op_free_cookie (*free_cookie);
|
||||
op_read (*read);
|
||||
op_write (*write);
|
||||
op_readv (*readv);
|
||||
op_writev (*writev);
|
||||
op_ioctl (*ioctl);
|
||||
op_setflags (*setflags);
|
||||
op_rstat (*rstat);
|
||||
op_wstat (*wstat);
|
||||
op_fsync (*fsync);
|
||||
op_initialize (*initialize);
|
||||
op_mount (*mount);
|
||||
op_unmount (*unmount);
|
||||
op_sync (*sync);
|
||||
op_rfsstat (*rfsstat);
|
||||
op_wfsstat (*wfsstat);
|
||||
op_select (*select);
|
||||
op_deselect (*deselect);
|
||||
op_open_indexdir (*open_indexdir);
|
||||
op_close_indexdir (*close_indexdir);
|
||||
op_free_cookie (*free_indexdircookie);
|
||||
op_rewind_indexdir (*rewind_indexdir);
|
||||
op_read_indexdir (*read_indexdir);
|
||||
op_create_index (*create_index);
|
||||
op_remove_index (*remove_index);
|
||||
op_rename_index (*rename_index);
|
||||
op_stat_index (*stat_index);
|
||||
op_open_attrdir (*open_attrdir);
|
||||
op_close_attrdir (*close_attrdir);
|
||||
op_free_cookie (*free_attrdircookie);
|
||||
op_rewind_attrdir (*rewind_attrdir);
|
||||
op_read_attrdir (*read_attrdir);
|
||||
op_write_attr (*write_attr);
|
||||
op_read_attr (*read_attr);
|
||||
op_remove_attr (*remove_attr);
|
||||
op_rename_attr (*rename_attr);
|
||||
op_stat_attr (*stat_attr);
|
||||
op_open_query (*open_query);
|
||||
op_close_query (*close_query);
|
||||
op_free_cookie (*free_querycookie);
|
||||
op_read_query (*read_query);
|
||||
// for Dano compatibility only
|
||||
op_wake_vnode (*wake_vnode);
|
||||
op_suspend_vnode (*suspend_vnode);
|
||||
} vnode_ops;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern _IMPEXP_KERNEL int new_path(const char *path, char **copy);
|
||||
extern _IMPEXP_KERNEL void free_path(char *p);
|
||||
|
||||
extern _IMPEXP_KERNEL int notify_listener(int op, nspace_id nsid,
|
||||
vnode_id vnida, vnode_id vnidb,
|
||||
vnode_id vnidc, const char *name);
|
||||
extern _IMPEXP_KERNEL int send_notification(port_id port, long token,
|
||||
ulong what, long op, nspace_id nsida,
|
||||
nspace_id nsidb, vnode_id vnida,
|
||||
vnode_id vnidb, vnode_id vnidc,
|
||||
const char *name);
|
||||
extern _IMPEXP_KERNEL int get_vnode(nspace_id nsid, vnode_id vnid, void **data);
|
||||
extern _IMPEXP_KERNEL int put_vnode(nspace_id nsid, vnode_id vnid);
|
||||
extern _IMPEXP_KERNEL int new_vnode(nspace_id nsid, vnode_id vnid, void *data);
|
||||
extern _IMPEXP_KERNEL int remove_vnode(nspace_id nsid, vnode_id vnid);
|
||||
extern _IMPEXP_KERNEL int unremove_vnode(nspace_id nsid, vnode_id vnid);
|
||||
extern _IMPEXP_KERNEL int is_vnode_removed(nspace_id nsid, vnode_id vnid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
extern _EXPORT vnode_ops fs_entry;
|
||||
extern _EXPORT int32 api_version;
|
||||
|
||||
#endif
|
249
headers/build/os/add-ons/graphics/Accelerant.h
Normal file
249
headers/build/os/add-ons/graphics/Accelerant.h
Normal file
@ -0,0 +1,249 @@
|
||||
#if !defined(_ACCELERANT_H_)
|
||||
#define _ACCELERANT_H_
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define B_ACCELERANT_ENTRY_POINT "get_accelerant_hook"
|
||||
#define B_ACCELERANT_VERSION 1
|
||||
|
||||
typedef void * (*GetAccelerantHook)(uint32, void *);
|
||||
|
||||
_EXPORT void * get_accelerant_hook(uint32 feature, void *data);
|
||||
|
||||
enum {
|
||||
/* initialization */
|
||||
B_INIT_ACCELERANT = 0, /* required */
|
||||
B_ACCELERANT_CLONE_INFO_SIZE, /* required */
|
||||
B_GET_ACCELERANT_CLONE_INFO, /* required */
|
||||
B_CLONE_ACCELERANT, /* required */
|
||||
B_UNINIT_ACCELERANT, /* required */
|
||||
B_GET_ACCELERANT_DEVICE_INFO, /* required */
|
||||
B_ACCELERANT_RETRACE_SEMAPHORE, /* optional */
|
||||
|
||||
/* mode configuration */
|
||||
B_ACCELERANT_MODE_COUNT = 0x100, /* required */
|
||||
B_GET_MODE_LIST, /* required */
|
||||
B_PROPOSE_DISPLAY_MODE, /* optional */
|
||||
B_SET_DISPLAY_MODE, /* required */
|
||||
B_GET_DISPLAY_MODE, /* required */
|
||||
B_GET_FRAME_BUFFER_CONFIG, /* required */
|
||||
B_GET_PIXEL_CLOCK_LIMITS, /* required */
|
||||
B_GET_TIMING_CONSTRAINTS, /* optional */
|
||||
B_MOVE_DISPLAY, /* optional */
|
||||
B_SET_INDEXED_COLORS, /* required if driver supports 8bit indexed modes */
|
||||
B_DPMS_CAPABILITIES, /* required if driver supports DPMS */
|
||||
B_DPMS_MODE, /* required if driver supports DPMS */
|
||||
B_SET_DPMS_MODE, /* required if driver supports DPMS */
|
||||
|
||||
/* cursor managment */
|
||||
B_MOVE_CURSOR = 0x200, /* optional */
|
||||
B_SET_CURSOR_SHAPE, /* optional */
|
||||
B_SHOW_CURSOR, /* optional */
|
||||
|
||||
/* synchronization */
|
||||
B_ACCELERANT_ENGINE_COUNT = 0x300, /* required */
|
||||
B_ACQUIRE_ENGINE, /* required */
|
||||
B_RELEASE_ENGINE, /* required */
|
||||
B_WAIT_ENGINE_IDLE, /* required */
|
||||
B_GET_SYNC_TOKEN, /* required */
|
||||
B_SYNC_TO_TOKEN, /* required */
|
||||
|
||||
/* 2D acceleration */
|
||||
B_SCREEN_TO_SCREEN_BLIT = 0x400, /* optional */
|
||||
B_FILL_RECTANGLE, /* optional */
|
||||
B_INVERT_RECTANGLE, /* optional */
|
||||
B_FILL_SPAN, /* optional */
|
||||
B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, /* optional */
|
||||
B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, /* optional. NOTE: source and dest may NOT overlap */
|
||||
|
||||
/* 3D acceleration */
|
||||
B_ACCELERANT_PRIVATE_START = (int)0x80000000
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32 version; /* structure version number */
|
||||
char name[32]; /* a name the user will recognize the device by */
|
||||
char chipset[32]; /* the chipset used by the device */
|
||||
char serial_no[32]; /* serial number for the device */
|
||||
uint32 memory; /* amount of memory on the device, in bytes */
|
||||
uint32 dac_speed; /* nominal DAC speed, in MHz */
|
||||
} accelerant_device_info;
|
||||
|
||||
typedef struct {
|
||||
uint32 pixel_clock; /* kHz */
|
||||
uint16 h_display; /* in pixels (not character clocks) */
|
||||
uint16 h_sync_start;
|
||||
uint16 h_sync_end;
|
||||
uint16 h_total;
|
||||
uint16 v_display; /* in lines */
|
||||
uint16 v_sync_start;
|
||||
uint16 v_sync_end;
|
||||
uint16 v_total;
|
||||
uint32 flags; /* sync polarity, etc. */
|
||||
} display_timing;
|
||||
|
||||
typedef struct {
|
||||
display_timing timing; /* CTRC info */
|
||||
uint32 space; /* pixel configuration */
|
||||
uint16 virtual_width; /* in pixels */
|
||||
uint16 virtual_height; /* in lines */
|
||||
uint16 h_display_start; /* first displayed pixel in line */
|
||||
uint16 v_display_start; /* first displayed line */
|
||||
uint32 flags; /* mode flags */
|
||||
} display_mode;
|
||||
|
||||
typedef struct {
|
||||
void *frame_buffer; /* pointer to first byte of frame buffer in virtual memory */
|
||||
void *frame_buffer_dma; /* pointer to first byte of frame buffer in physical memory for DMA */
|
||||
uint32 bytes_per_row; /* number of bytes in one virtual_width line */
|
||||
/* not neccesarily the same as virtual_width * byte_per_pixel */
|
||||
} frame_buffer_config;
|
||||
|
||||
typedef struct {
|
||||
uint16 h_res; /* minimum effective change in horizontal pixels, usually 8 */
|
||||
uint16 h_sync_min; /* min/max horizontal sync pulse width in pixels, a multiple of h_res */
|
||||
uint16 h_sync_max;
|
||||
uint16 h_blank_min; /* min/max horizontal blank pulse width in pixels, a multiple of h_res */
|
||||
uint16 h_blank_max;
|
||||
uint16 v_res; /* minimum effective change in vertical lines, usually 1 */
|
||||
uint16 v_sync_min; /* min/max vertical sync pulse width in lines, a multiple of v_res */
|
||||
uint16 v_sync_max;
|
||||
uint16 v_blank_min; /* min/max vertical blank pulse width in linex, a multiple of v_res */
|
||||
uint16 v_blank_max;
|
||||
} display_timing_constraints;
|
||||
|
||||
enum { /* mode flags */
|
||||
B_SCROLL = 1 << 0,
|
||||
B_8_BIT_DAC = 1 << 1,
|
||||
B_HARDWARE_CURSOR = 1 << 2,
|
||||
B_PARALLEL_ACCESS = 1 << 3,
|
||||
B_DPMS = 1 << 4,
|
||||
B_IO_FB_NA = 1 << 5
|
||||
};
|
||||
|
||||
enum { /* power saver flags */
|
||||
B_DPMS_ON = 1 << 0,
|
||||
B_DPMS_STAND_BY = 1 << 1,
|
||||
B_DPMS_SUSPEND = 1 << 2,
|
||||
B_DPMS_OFF = 1 << 3
|
||||
};
|
||||
|
||||
enum { /* timing flags */
|
||||
B_BLANK_PEDESTAL = 1 << 27,
|
||||
B_TIMING_INTERLACED = 1 << 28,
|
||||
B_POSITIVE_HSYNC = 1 << 29,
|
||||
B_POSITIVE_VSYNC = 1 << 30,
|
||||
B_SYNC_ON_GREEN = 1 << 31
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint16 src_left; /* guaranteed constrained to virtual width and height */
|
||||
uint16 src_top;
|
||||
uint16 dest_left;
|
||||
uint16 dest_top;
|
||||
uint16 width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
|
||||
uint16 height; /* 0 to M, where zero means one line, one means two lines, etc. */
|
||||
} blit_params;
|
||||
|
||||
typedef struct {
|
||||
uint16 src_left; /* guaranteed constrained to virtual width and height */
|
||||
uint16 src_top;
|
||||
uint16 src_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
|
||||
uint16 src_height; /* 0 to M, where zero means one line, one means two lines, etc. */
|
||||
uint16 dest_left;
|
||||
uint16 dest_top;
|
||||
uint16 dest_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
|
||||
uint16 dest_height; /* 0 to M, where zero means one line, one means two lines, etc. */
|
||||
} scaled_blit_params;
|
||||
|
||||
typedef struct {
|
||||
uint16 left; /* guaranteed constrained to virtual width and height */
|
||||
uint16 top;
|
||||
uint16 right;
|
||||
uint16 bottom;
|
||||
} fill_rect_params;
|
||||
|
||||
typedef struct {
|
||||
uint32 engine_id; /* 0 == no engine, 1,2,3 etc individual engines */
|
||||
uint32 capability_mask; /* features this engine supports */
|
||||
void *opaque; /* optional pointer to engine private storage */
|
||||
} engine_token;
|
||||
|
||||
enum { /* engine capabilities */
|
||||
B_2D_ACCELERATION = 1 << 0,
|
||||
B_3D_ACCELERATION = 1 << 1
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint64 counter; /* counts issued primatives */
|
||||
uint32 engine_id; /* what engine the counter is for */
|
||||
char opaque[12]; /* 12 bytes of private storage */
|
||||
} sync_token;
|
||||
|
||||
/* Masks for color info */
|
||||
/* B_CMAP8 - 0x000000ff */
|
||||
/* B_RGB15/16 - 0x0000ffff */
|
||||
/* B_RGB24 - 0x00ffffff */
|
||||
/* B_RGB32 - 0xffffffff */
|
||||
|
||||
typedef status_t (*init_accelerant)(int fd);
|
||||
typedef ssize_t (*accelerant_clone_info_size)(void);
|
||||
typedef void (*get_accelerant_clone_info)(void *data);
|
||||
typedef status_t (*clone_accelerant)(void *data);
|
||||
typedef void (*uninit_accelerant)(void);
|
||||
typedef status_t (*get_accelerant_device_info)(accelerant_device_info *adi);
|
||||
|
||||
typedef uint32 (*accelerant_mode_count)(void);
|
||||
typedef status_t (*get_mode_list)(display_mode *);
|
||||
typedef status_t (*propose_display_mode)(display_mode *target, display_mode *low, display_mode *high);
|
||||
typedef status_t (*set_display_mode)(display_mode *mode_to_set);
|
||||
typedef status_t (*get_display_mode)(display_mode *current_mode);
|
||||
typedef status_t (*get_frame_buffer_config)(frame_buffer_config *a_frame_buffer);
|
||||
typedef status_t (*get_pixel_clock_limits)(display_mode *dm, uint32 *low, uint32 *high);
|
||||
typedef status_t (*move_display_area)(uint16 h_display_start, uint16 v_display_start);
|
||||
typedef status_t (*get_timing_constraints)(display_timing_constraints *dtc);
|
||||
typedef void (*set_indexed_colors)(uint count, uint8 first, uint8 *color_data, uint32 flags);
|
||||
typedef uint32 (*dpms_capabilities)(void);
|
||||
typedef uint32 (*dpms_mode)(void);
|
||||
typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
|
||||
typedef sem_id (*accelerant_retrace_semaphore)(void);
|
||||
|
||||
typedef status_t (*set_cursor_shape)(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask);
|
||||
typedef void (*move_cursor)(uint16 x, uint16 y);
|
||||
typedef void (*show_cursor)(bool is_visible);
|
||||
|
||||
typedef uint32 (*accelerant_engine_count)(void);
|
||||
typedef status_t (*acquire_engine)(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et);
|
||||
typedef status_t (*release_engine)(engine_token *et, sync_token *st);
|
||||
typedef void (*wait_engine_idle)(void);
|
||||
typedef status_t (*get_sync_token)(engine_token *et, sync_token *st);
|
||||
typedef status_t (*sync_to_token)(sync_token *st);
|
||||
|
||||
typedef void (*screen_to_screen_blit)(engine_token *et, blit_params *list, uint32 count);
|
||||
typedef void (*fill_rectangle)(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
|
||||
typedef void (*invert_rectangle)(engine_token *et, fill_rect_params *list, uint32 count);
|
||||
typedef void (*screen_to_screen_transparent_blit)(engine_token *et, uint32 transparent_color, blit_params *list, uint32 count);
|
||||
typedef void (*screen_to_screen_scaled_filtered_blit)(engine_token *et, scaled_blit_params *list, uint32 count);
|
||||
|
||||
typedef void (*fill_span)(engine_token *et, uint32 color, uint16 *list, uint32 count);
|
||||
/*
|
||||
The uint16 *list points to a list of tripples:
|
||||
list[N+0] Y co-ordinate of span
|
||||
list[N+1] Left x co-ordinate of span
|
||||
list[N+2] Right x co-ordinate of span
|
||||
where N is in the range 0 to count-1.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
188
headers/build/os/add-ons/graphics/GraphicsCard.h
Normal file
188
headers/build/os/add-ons/graphics/GraphicsCard.h
Normal file
@ -0,0 +1,188 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: GraphicsCard.h
|
||||
/
|
||||
/ Description: App Server interface for graphics card add-ons.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _GRAPHICS_CARD_H
|
||||
#define _GRAPHICS_CARD_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Command Constants -------------------------------------*/
|
||||
|
||||
enum {
|
||||
B_OPEN_GRAPHICS_CARD,
|
||||
B_CLOSE_GRAPHICS_CARD,
|
||||
B_GET_GRAPHICS_CARD_INFO,
|
||||
B_GET_GRAPHICS_CARD_HOOKS,
|
||||
B_SET_INDEXED_COLOR,
|
||||
B_GET_SCREEN_SPACES,
|
||||
B_CONFIG_GRAPHICS_CARD,
|
||||
B_GET_REFRESH_RATES,
|
||||
B_SET_SCREEN_GAMMA,
|
||||
|
||||
B_GET_INFO_FOR_CLONE_SIZE,
|
||||
B_GET_INFO_FOR_CLONE,
|
||||
B_SET_CLONED_GRAPHICS_CARD,
|
||||
B_CLOSE_CLONED_GRAPHICS_CARD,
|
||||
B_PROPOSE_FRAME_BUFFER,
|
||||
B_SET_FRAME_BUFFER,
|
||||
B_SET_DISPLAY_AREA,
|
||||
B_MOVE_DISPLAY_AREA}
|
||||
;
|
||||
|
||||
/*----- Optional ---------------*/
|
||||
|
||||
enum {
|
||||
B_CRT_CONTROL = 0x0001,
|
||||
B_GAMMA_CONTROL = 0x0002,
|
||||
B_FRAME_BUFFER_CONTROL = 0x0004,
|
||||
B_PARALLEL_BUFFER_ACCESS = 0x0008,
|
||||
B_LAME_ASS_CARD = 0x0010
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Structures --------------------------------------------*/
|
||||
|
||||
typedef struct {
|
||||
int16 version;
|
||||
int16 id;
|
||||
void *frame_buffer;
|
||||
char rgba_order[4];
|
||||
int16 flags;
|
||||
int16 bits_per_pixel;
|
||||
int16 bytes_per_row;
|
||||
int16 width;
|
||||
int16 height;
|
||||
} graphics_card_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32 index;
|
||||
rgb_color color;
|
||||
} indexed_color;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32 space;
|
||||
float refresh_rate;
|
||||
uchar h_position;
|
||||
uchar v_position;
|
||||
uchar h_size;
|
||||
uchar v_size;
|
||||
} graphics_card_config;
|
||||
|
||||
|
||||
typedef struct {
|
||||
float min;
|
||||
float max;
|
||||
float current;
|
||||
} refresh_rate_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
void *screen_base;
|
||||
void *io_base;
|
||||
uint32 vendor_id;
|
||||
uint32 device_id;
|
||||
uint32 _reserved1_;
|
||||
uint32 _reserved2_;
|
||||
} graphics_card_spec;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16 x1;
|
||||
int16 y1;
|
||||
int16 x2;
|
||||
int16 y2;
|
||||
rgb_color color;
|
||||
} rgb_color_line;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16 x1;
|
||||
int16 y1;
|
||||
int16 x2;
|
||||
int16 y2;
|
||||
uchar color;
|
||||
} indexed_color_line;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16 bits_per_pixel;
|
||||
int16 bytes_per_row;
|
||||
int16 width;
|
||||
int16 height;
|
||||
int16 display_width;
|
||||
int16 display_height;
|
||||
int16 display_x;
|
||||
int16 display_y;
|
||||
} frame_buffer_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uchar red[256];
|
||||
uchar green[256];
|
||||
uchar blue[256];
|
||||
} screen_gamma;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Hook Function -----------------------------------------*/
|
||||
|
||||
typedef void (*graphics_card_hook) ();
|
||||
|
||||
#define B_GRAPHICS_HOOK_COUNT 48
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
_EXPORT int32 control_graphics_card(uint32, void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Debugging Functions ------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void dprintf(const char *format, ...);
|
||||
bool set_dprintf_enabled(bool); /* returns old enable flag */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Obsolete ---------------------------------------------*/
|
||||
#define B_HOOK_COUNT B_GRAPHICS_HOOK_COUNT
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _GRAPHICS_CARD_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
79
headers/build/os/add-ons/input_server/InputServerDevice.h
Normal file
79
headers/build/os/add-ons/input_server/InputServerDevice.h
Normal file
@ -0,0 +1,79 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerDevice.h
|
||||
/
|
||||
/ Description: Add-on class for input_server devices.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _INPUTSERVERDEVICE_H
|
||||
#define _INPUTSERVERDEVICE_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Input.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
struct input_device_ref {
|
||||
char *name;
|
||||
input_device_type type;
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
// B_KEYBOARD_DEVICE notifications
|
||||
B_KEY_MAP_CHANGED = 1,
|
||||
B_KEY_LOCKS_CHANGED,
|
||||
B_KEY_REPEAT_DELAY_CHANGED,
|
||||
B_KEY_REPEAT_RATE_CHANGED,
|
||||
|
||||
// B_POINTING_DEVICE notifications
|
||||
B_MOUSE_TYPE_CHANGED,
|
||||
B_MOUSE_MAP_CHANGED,
|
||||
B_MOUSE_SPEED_CHANGED,
|
||||
B_CLICK_SPEED_CHANGED,
|
||||
B_MOUSE_ACCELERATION_CHANGED
|
||||
};
|
||||
|
||||
|
||||
class _BDeviceAddOn_;
|
||||
|
||||
|
||||
class BInputServerDevice {
|
||||
public:
|
||||
BInputServerDevice();
|
||||
virtual ~BInputServerDevice();
|
||||
|
||||
virtual status_t InitCheck();
|
||||
virtual status_t SystemShuttingDown();
|
||||
|
||||
virtual status_t Start(const char *device, void *cookie);
|
||||
virtual status_t Stop(const char *device, void *cookie);
|
||||
virtual status_t Control(const char *device,
|
||||
void *cookie,
|
||||
uint32 code,
|
||||
BMessage *message);
|
||||
|
||||
status_t RegisterDevices(input_device_ref **devices);
|
||||
status_t UnregisterDevices(input_device_ref **devices);
|
||||
|
||||
status_t EnqueueMessage(BMessage *message);
|
||||
|
||||
status_t StartMonitoringDevice(const char *device);
|
||||
status_t StopMonitoringDevice(const char *device);
|
||||
|
||||
private:
|
||||
_BDeviceAddOn_* fOwner;
|
||||
|
||||
virtual void _ReservedInputServerDevice1();
|
||||
virtual void _ReservedInputServerDevice2();
|
||||
virtual void _ReservedInputServerDevice3();
|
||||
virtual void _ReservedInputServerDevice4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
39
headers/build/os/add-ons/input_server/InputServerFilter.h
Normal file
39
headers/build/os/add-ons/input_server/InputServerFilter.h
Normal file
@ -0,0 +1,39 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerFilter.h
|
||||
/
|
||||
/ Description: Add-on class for input_server filters.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _INPUTSERVERFILTER_H
|
||||
#define _INPUTSERVERFILTER_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class BInputServerFilter {
|
||||
public:
|
||||
BInputServerFilter();
|
||||
virtual ~BInputServerFilter();
|
||||
|
||||
virtual status_t InitCheck();
|
||||
|
||||
virtual filter_result Filter(BMessage *message, BList *outList);
|
||||
|
||||
status_t GetScreenRegion(BRegion *region) const;
|
||||
|
||||
private:
|
||||
virtual void _ReservedInputServerFilter1();
|
||||
virtual void _ReservedInputServerFilter2();
|
||||
virtual void _ReservedInputServerFilter3();
|
||||
virtual void _ReservedInputServerFilter4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
51
headers/build/os/add-ons/input_server/InputServerMethod.h
Normal file
51
headers/build/os/add-ons/input_server/InputServerMethod.h
Normal file
@ -0,0 +1,51 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerMethod.h
|
||||
/
|
||||
/ Description: Add-on class for input_server methods.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _INPUTSERVERMETHOD_H
|
||||
#define _INPUTSERVERMETHOD_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <InputServerFilter.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class _BMethodAddOn_;
|
||||
class AddOnManager;
|
||||
class InputServer;
|
||||
|
||||
class BInputServerMethod : public BInputServerFilter {
|
||||
public:
|
||||
BInputServerMethod(const char *name,
|
||||
const uchar *icon);
|
||||
virtual ~BInputServerMethod();
|
||||
|
||||
virtual status_t MethodActivated(bool active);
|
||||
|
||||
status_t EnqueueMessage(BMessage *message);
|
||||
|
||||
status_t SetName(const char *name);
|
||||
status_t SetIcon(const uchar *icon);
|
||||
status_t SetMenu(const BMenu *menu, const BMessenger target);
|
||||
|
||||
private:
|
||||
_BMethodAddOn_* fOwner;
|
||||
|
||||
friend class AddOnManager;
|
||||
friend class InputServer;
|
||||
|
||||
virtual void _ReservedInputServerMethod1();
|
||||
virtual void _ReservedInputServerMethod2();
|
||||
virtual void _ReservedInputServerMethod3();
|
||||
virtual void _ReservedInputServerMethod4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
98
headers/build/os/add-ons/mail_daemon/ChainRunner.h
Normal file
98
headers/build/os/add-ons/mail_daemon/ChainRunner.h
Normal file
@ -0,0 +1,98 @@
|
||||
#ifndef ZOIDBERG_MAIL_CHAIN_RUNNER_H
|
||||
#define ZOIDBERG_MAIL_CHAIN_RUNNER_H
|
||||
/* ChainRunner - runs the mail inbound and outbound chains
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include <MailAddon.h>
|
||||
#include <MailSettings.h>
|
||||
#include <Looper.h>
|
||||
|
||||
class BStringList;
|
||||
class BMailStatusWindow;
|
||||
class BMailStatusView;
|
||||
class BMailChain;
|
||||
|
||||
class BMailChainCallback {
|
||||
public:
|
||||
virtual void Callback(status_t result) = 0;
|
||||
// Called by the callback routines in ChainRunner
|
||||
// result is the message that ended the chain
|
||||
// (MD_HANDLED, MD_DISCARD, MD_NO_MORE_MESSAGES)
|
||||
// Obviously, for process callbacks, result is
|
||||
// gauranteed to be MD_NO_MORE_MESSAGES.
|
||||
};
|
||||
|
||||
class BMailChainRunner : public BLooper {
|
||||
public:
|
||||
BMailChainRunner(BMailChain *chain, BMailStatusWindow *status,
|
||||
bool self_destruct_when_done = true, bool save_chain_when_done = false,
|
||||
bool destruct_chain_when_done = false);
|
||||
~BMailChainRunner();
|
||||
|
||||
//----Callback functions. Callback objects will be deleted for you.
|
||||
|
||||
void RegisterMessageCallback(BMailChainCallback *callback);
|
||||
// Your callback->Callback() function will be called when
|
||||
// the current message is done being processed.
|
||||
|
||||
void RegisterProcessCallback(BMailChainCallback *callback);
|
||||
// Your callback->Callback() function will be called when
|
||||
// a filter returns MD_PASS_COMPLETE and before we go back
|
||||
// to waiting for new messages, or when the fetch list
|
||||
// runs out.
|
||||
|
||||
void RegisterChainCallback(BMailChainCallback *callback);
|
||||
// Your callback->Callback() function will be called when
|
||||
// a filter returns MD_ALL_PASSES_DONE and before everything
|
||||
// is unloaded and sent home.
|
||||
|
||||
void Stop(bool immediately = false);
|
||||
void ReportProgress(int bytes, int messages, const char *message = NULL);
|
||||
void ResetProgress(const char *message = NULL);
|
||||
|
||||
void GetMessages(BStringList *list, int32 bytes);
|
||||
void GetSingleMessage(const char *uid, int32 length, BPath *into);
|
||||
// The bytes or length field is the total size, used for updating the
|
||||
// progress bar. Use -1 for unknown maximum size.
|
||||
|
||||
bool QuitRequested();
|
||||
|
||||
void ShowError(const char *error);
|
||||
void ShowMessage(const char *message);
|
||||
|
||||
BMailChain *Chain();
|
||||
|
||||
//----The big, bad asynchronous RunChain() function. Pretty harmless looking, huh?
|
||||
status_t RunChain(bool asynchronous = true);
|
||||
|
||||
void MessageReceived (BMessage *msg);
|
||||
|
||||
private:
|
||||
void CallCallbacksFor(BList &list, status_t code);
|
||||
void get_messages(BStringList *list);
|
||||
status_t Init();
|
||||
#if USE_NASTY_SYNC_THREAD_HACK
|
||||
static int32 thread_sync_func(void *arg);
|
||||
status_t init_addons();
|
||||
#endif
|
||||
|
||||
BMailChain *_chain;
|
||||
BList message_cb, process_cb, chain_cb;
|
||||
|
||||
bool destroy_self, destroy_chain, save_chain;
|
||||
|
||||
BMailStatusWindow *_status;
|
||||
BMailStatusView *_statview;
|
||||
BList addons;
|
||||
|
||||
bool suicide;
|
||||
uint8 _other_reserved[3];
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
BMailChainRunner *GetMailChainRunner(int32 chain_id, BMailStatusWindow *status, bool selfDestruct = true);
|
||||
|
||||
#endif /* ZOIDBERG_MAIL_CHAIN_RUNNER_H */
|
151
headers/build/os/add-ons/mail_daemon/MailAddon.h
Normal file
151
headers/build/os/add-ons/mail_daemon/MailAddon.h
Normal file
@ -0,0 +1,151 @@
|
||||
#ifndef ZOIDBERG_MAIL_ADDON_H
|
||||
#define ZOIDBERG_MAIL_ADDON_H
|
||||
/* Filter - the base class for all mail filters
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
class BMessage;
|
||||
class BView;
|
||||
class BPositionIO;
|
||||
class BEntry;
|
||||
class BPath;
|
||||
class BView;
|
||||
class BString;
|
||||
class BPositionIO;
|
||||
class BEntry;
|
||||
|
||||
enum {
|
||||
B_MAIL_DISCARD = B_MAIL_ERROR_BASE + 8,
|
||||
//--- This terminates the chain and removes the message being processed
|
||||
// both from disk and from the server.
|
||||
B_MAIL_END_FETCH,
|
||||
//--- Terminates the current operation
|
||||
B_MAIL_END_CHAIN
|
||||
//--- This is for yikes errors, like an unreachable server.
|
||||
};
|
||||
|
||||
class BMailStatusView;
|
||||
class BMailChainRunner;
|
||||
|
||||
class BMailFilter
|
||||
{
|
||||
public:
|
||||
BMailFilter(BMessage* settings);
|
||||
// How to support queueing messages until a time of the
|
||||
// day/week/month/year? The settings will contain a
|
||||
// persistent ChainID field, the same for all Filters
|
||||
// on the same "chain".
|
||||
|
||||
virtual ~BMailFilter();
|
||||
// This will be called when the settings for this Filter
|
||||
// are changed, or there are no new messages to consume
|
||||
// after settings->FindInt32("timeout") seconds.
|
||||
|
||||
virtual status_t InitCheck(BString* out_message = NULL) = 0;
|
||||
// Returns B_OK if the Filter was constructed success-
|
||||
// fully. Otherwise it returns an error code. If it is
|
||||
// passed a valid BString*, it may add an error message
|
||||
// to the end of that BString iff it returns an error.
|
||||
// If it returns an error code then the MailFilter will
|
||||
// probably be deleted and the error shown to the user.
|
||||
|
||||
virtual status_t ProcessMailMessage
|
||||
(
|
||||
BPositionIO** io_message, BEntry* io_entry,
|
||||
BMessage* io_headers, BPath* io_folder, const char *io_uid
|
||||
) = 0;
|
||||
// Filters a message. On input and output, the arguments
|
||||
// are expected to be as below; however it is allowed for
|
||||
// the MailFilter to alter any of these values as nece-
|
||||
// ssary, so long as the constraints are as described when
|
||||
// the function returns:
|
||||
//
|
||||
// * io_message - a PositionIO that contains the message
|
||||
// data, pointing to the first byte of the message's
|
||||
// header. This can be swapped if, eg, the message
|
||||
// is copied across volume boundries. When the chain
|
||||
// begins this is a file in /tmp.
|
||||
// * io_entry - The entry for the PositionIO above.
|
||||
// * io_headers - a list of attributes that will be added
|
||||
// to the message file.
|
||||
// * io_folder - The message's "folder"---may be com-
|
||||
// pletely unrelated to its on-disk Entry.
|
||||
// * io_uid - The unique ID provided by the message's
|
||||
// Protocol
|
||||
//
|
||||
// At most one Filter::ProcessMailMessage() for a given
|
||||
// chain (and thus ChainID) will be called at a time.
|
||||
|
||||
private:
|
||||
virtual void _ReservedFilter1();
|
||||
virtual void _ReservedFilter2();
|
||||
virtual void _ReservedFilter3();
|
||||
virtual void _ReservedFilter4();
|
||||
};
|
||||
|
||||
//
|
||||
// The addon interface: export instantiate_mailfilter()
|
||||
// and instantiate_mailconfig() to create a Filter addon
|
||||
//
|
||||
|
||||
extern "C" _EXPORT BView* instantiate_config_panel(BMessage *settings,BMessage *metadata);
|
||||
// return a view that configures the MailProtocol or MailFilter
|
||||
// returned by the functions below. BView::Archive(foo,true)
|
||||
// produces this addon's settings, which are passed to the in-
|
||||
// stantiate_* functions and stored persistently. This function
|
||||
// should gracefully handle empty and NULL settings.
|
||||
// A note on the metadata argument: The metadata pointer is
|
||||
// guaranteed to remain valid as long as this view exists. As it is
|
||||
// a pointer to the chain's metadata, your view can save any
|
||||
// chain-global settings to it in its Archive() function. Note that
|
||||
// you must cache this pointer yourself! You will never get it again.
|
||||
// Also note that it is possible for it to be NULL.
|
||||
|
||||
extern "C" _EXPORT BMailFilter* instantiate_mailfilter(BMessage *settings,
|
||||
BMailChainRunner *runner);
|
||||
// Return a MailProtocol or MailFilter ready to do its thing,
|
||||
// based on settings produced by archiving your config panel.
|
||||
// Note that a Mail::Protocol is a Mail::Filter, so use
|
||||
// instantiate_mailfilter to start things up.
|
||||
|
||||
extern "C" _EXPORT status_t descriptive_name(BMessage *msg, char *buffer);
|
||||
// the config panel will show this name in the chains filter
|
||||
// list if this function returns B_OK.
|
||||
// The buffer is as big as B_FILE_NAME_LENGTH.
|
||||
|
||||
// standard Filters:
|
||||
//
|
||||
// * Parser - does ParseRFC2822(io_message,io_headers)
|
||||
// * Folder - stores the message in the specified folder,
|
||||
// optionally under io_folder, returns MD_HANDLED
|
||||
// * HeaderFilter(regex,Yes_fiters,No_filters) -
|
||||
// Applies Nes_filters to messages that have a header
|
||||
// matching regex; applies No_filters otherwise.
|
||||
// * CompatabilityFilter - Invokes the standard mail_dae-
|
||||
// mon filter ~/config/settings/add-ons/MailDaemon/Filter
|
||||
// on the message's Entry.
|
||||
// * Producer - Reads outbound messages from disk and inserts
|
||||
// them into the queue.
|
||||
// * SMTPSender - Sends the message, via the specified
|
||||
// SMTP server, to the people in header field
|
||||
// "MAIL:recipients", changes the the Entry's
|
||||
// "MAIL:flags" field to no longer pending, changes the
|
||||
// "MAIL:status" header field to "Sent", and adds a header
|
||||
// field "MAIL:when" with the time it was sent.
|
||||
// * Dumper - returns MD_DISCARD
|
||||
//
|
||||
//
|
||||
// Standard chain types:
|
||||
//
|
||||
// Incoming Mail: Protocol - Parser - Notifier - Folder
|
||||
// Outgoing Mail: Producer - SMTPSender
|
||||
//
|
||||
// "chains" are lists of addons that appear in, or can be
|
||||
// added to, the "Accounts" list in the config panel, a tree-
|
||||
// view ordered by the chain type and the chain's AccountName().
|
||||
// Their config views should be shown, one after the other,
|
||||
// in the config panel.
|
||||
|
||||
#endif /* ZOIDBERG_MAIL_ADDON_H */
|
107
headers/build/os/add-ons/mail_daemon/MailProtocol.h
Normal file
107
headers/build/os/add-ons/mail_daemon/MailProtocol.h
Normal file
@ -0,0 +1,107 @@
|
||||
#ifndef ZOIDBERG_MAIL_PROTOCOL_H
|
||||
#define ZOIDBERG_MAIL_PROTOCOL_H
|
||||
/* Protocol - the base class for protocol filters
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
#include <MailAddon.h>
|
||||
|
||||
|
||||
class BHandler;
|
||||
class BStringList;
|
||||
class BMailChainRunner;
|
||||
|
||||
class BMailProtocol : public BMailFilter
|
||||
{
|
||||
public:
|
||||
BMailProtocol(BMessage* settings, BMailChainRunner *runner);
|
||||
// Open a connection based on 'settings'. 'settings' will
|
||||
// contain a persistent uint32 ChainID field. At most one
|
||||
// Protocol per ChainID will exist at a given time.
|
||||
// The constructor of Mail::Protocol initializes manifest.
|
||||
// It is your responsibility to fill in unique_ids, *and
|
||||
// to keep it updated* in the course of whatever nefarious
|
||||
// things your protocol does.
|
||||
|
||||
virtual ~BMailProtocol();
|
||||
// Close the connection and clean up. This will be cal-
|
||||
// led after FetchMessage() or FetchNewMessage() returns
|
||||
// B_TIMED_OUT or B_ERROR, or when the settings for this
|
||||
// Protocol are changed.
|
||||
|
||||
virtual status_t GetMessage(
|
||||
const char* uid,
|
||||
BPositionIO** out_file, BMessage* out_headers,
|
||||
BPath* out_folder_location
|
||||
)=0;
|
||||
// Downloads the message with id uid, writing the message's
|
||||
// RFC2822 contents to *out_file and storing any headers it
|
||||
// wants to add other than those from the message itself into
|
||||
// out_headers. It may store a path (if this type of account
|
||||
// supports folders) in *out_folder_location.
|
||||
//
|
||||
// Returns B_OK if the message is now available in out_file,
|
||||
// B_NAME_NOT_FOUND if there is no message with id 'uid' on
|
||||
// the server, or another error if the connection failed.
|
||||
//
|
||||
// B_OK will cause the message to be stored and processed.
|
||||
// B_NAME_NOT_FOUND will cause appropriate recovery to be
|
||||
// taken (if such exists) but not cause the connection to
|
||||
// be terminated. Any other error will cause anything writen
|
||||
// to be discarded and and the connection closed.
|
||||
|
||||
// OBS:
|
||||
// The Protocol may replace *out_file with a custom (read-
|
||||
// only) BPositionIO-derived object that preserves the il-
|
||||
// lusion that the message is writen to *out_file, but in
|
||||
// fact only reads from the server and writes to *out_file
|
||||
// on demand. This BPositionIO must guarantee that any
|
||||
// data returned by Read() has also been writen to *out_-
|
||||
// file. It must return a read error if reading from the
|
||||
// network or writing to *out_file fails.
|
||||
//
|
||||
// The mail_daemon will delete *out_file before invoking
|
||||
// FetchMessage() or FetchNewMessage() again.
|
||||
|
||||
virtual status_t DeleteMessage(const char* uid)=0;
|
||||
// Removes the message from the server. After this, it's
|
||||
// assumed (but not required) that GetMessage(uid,...)
|
||||
// et al will fail with B_NAME_NOT_FOUND.
|
||||
|
||||
void CheckForDeletedMessages();
|
||||
// You can call this to trigger a sweep for deleted messages.
|
||||
// Automatically called at the beginning of the chain.
|
||||
|
||||
//------MailFilter calls
|
||||
virtual status_t ProcessMailMessage
|
||||
(
|
||||
BPositionIO** io_message, BEntry* io_entry,
|
||||
BMessage* io_headers, BPath* io_folder, const char* io_uid
|
||||
);
|
||||
|
||||
protected:
|
||||
BStringList *manifest, *unique_ids;
|
||||
BMessage *settings;
|
||||
|
||||
BMailChainRunner *runner;
|
||||
private:
|
||||
inline void error_alert(const char *process, status_t error);
|
||||
virtual void _ReservedProtocol1();
|
||||
virtual void _ReservedProtocol2();
|
||||
virtual void _ReservedProtocol3();
|
||||
virtual void _ReservedProtocol4();
|
||||
virtual void _ReservedProtocol5();
|
||||
|
||||
friend class DeletePass;
|
||||
|
||||
BHandler *trash_monitor;
|
||||
BStringList *uids_on_disk;
|
||||
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
#endif // ZOIDBERG_MAIL_PROTOCOL_H
|
38
headers/build/os/add-ons/mail_daemon/ProtocolConfigView.h
Normal file
38
headers/build/os/add-ons/mail_daemon/ProtocolConfigView.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef ZOIDBERG_PROTOCOL_CONFIG_VIEW_H
|
||||
#define ZOIDBERG_PROTOCOL_CONFIG_VIEW_H
|
||||
/* ProtocolConfigView - the standard config view for all protocols
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <View.h>
|
||||
|
||||
typedef enum {
|
||||
B_MAIL_PROTOCOL_HAS_AUTH_METHODS = 1,
|
||||
B_MAIL_PROTOCOL_HAS_FLAVORS = 2,
|
||||
B_MAIL_PROTOCOL_HAS_USERNAME = 4,
|
||||
B_MAIL_PROTOCOL_HAS_PASSWORD = 8,
|
||||
B_MAIL_PROTOCOL_HAS_HOSTNAME = 16,
|
||||
B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER = 32
|
||||
} b_mail_protocol_config_options;
|
||||
|
||||
class BMailProtocolConfigView : public BView {
|
||||
public:
|
||||
BMailProtocolConfigView(uint32 options_mask = B_MAIL_PROTOCOL_HAS_FLAVORS | B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD | B_MAIL_PROTOCOL_HAS_HOSTNAME);
|
||||
virtual ~BMailProtocolConfigView();
|
||||
|
||||
void SetTo(BMessage *archive);
|
||||
|
||||
void AddFlavor(const char *label);
|
||||
void AddAuthMethod(const char *label,bool needUserPassword = true);
|
||||
|
||||
virtual status_t Archive(BMessage *into, bool deep = true) const;
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
private:
|
||||
uint32 _reserved[5];
|
||||
};
|
||||
|
||||
#endif /* ZOIDBERG_PROTOCOL_CONFIG_VIEW_H */
|
41
headers/build/os/add-ons/mail_daemon/RemoteStorageProtocol.h
Normal file
41
headers/build/os/add-ons/mail_daemon/RemoteStorageProtocol.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef ZOIDBERG_MAIL_REMOTESTORAGEPROTOCOL_H
|
||||
#define ZOIDBERG_MAIL_REMOTESTORAGEPROTOCOL_H
|
||||
/* RemoteStorageProtocol - the base class for protocol filters
|
||||
**
|
||||
** Copyright 2003 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <MailProtocol.h>
|
||||
#include <StringList.h>
|
||||
|
||||
class BRemoteMailStorageProtocol : public BMailProtocol {
|
||||
public:
|
||||
BRemoteMailStorageProtocol(BMessage *settings, BMailChainRunner *runner);
|
||||
virtual ~BRemoteMailStorageProtocol();
|
||||
|
||||
virtual status_t GetMessage(const char *mailbox, const char *message, BPositionIO **, BMessage *headers) = 0;
|
||||
virtual status_t AddMessage(const char *mailbox, BPositionIO *data, BString *id) = 0;
|
||||
|
||||
virtual status_t DeleteMessage(const char *mailbox, const char *message) = 0;
|
||||
virtual status_t CopyMessage(const char *mailbox, const char *to_mailbox, BString *message) = 0;
|
||||
|
||||
virtual status_t CreateMailbox(const char *mailbox) = 0;
|
||||
virtual status_t DeleteMailbox(const char *mailbox) = 0;
|
||||
|
||||
void SyncMailbox(const char *mailbox);
|
||||
|
||||
//----Mail::Protocol stuff
|
||||
virtual status_t GetMessage(
|
||||
const char* uid,
|
||||
BPositionIO** out_file, BMessage* out_headers,
|
||||
BPath* out_folder_location);
|
||||
virtual status_t DeleteMessage(const char* uid);
|
||||
|
||||
//---Data members
|
||||
BStringList mailboxes;
|
||||
|
||||
private:
|
||||
BHandler *handler;
|
||||
};
|
||||
|
||||
#endif // ZOIDBERG_MAIL_REMOTESTORAGEPROTOCOL_H
|
73
headers/build/os/add-ons/mail_daemon/StringList.h
Normal file
73
headers/build/os/add-ons/mail_daemon/StringList.h
Normal file
@ -0,0 +1,73 @@
|
||||
#ifndef ZOIDBERG_STRING_LIST_H
|
||||
#define ZOIDBERG_STRING_LIST_H
|
||||
/* StringList - a string list implementation
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include <Flattenable.h>
|
||||
|
||||
class BList;
|
||||
|
||||
class BStringList : public BFlattenable {
|
||||
public:
|
||||
BStringList();
|
||||
BStringList(const BStringList&);
|
||||
|
||||
~BStringList(void);
|
||||
|
||||
BStringList &operator=(const BStringList &from);
|
||||
|
||||
/* Flattenable stuff */
|
||||
virtual bool IsFixedSize() const; //--false for obvious reasons
|
||||
virtual type_code TypeCode() const;
|
||||
virtual ssize_t FlattenedSize() const;
|
||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
||||
virtual bool AllowsTypeCode(type_code code) const;
|
||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
||||
|
||||
/* Adding and removing items. */
|
||||
void AddItem(const char *item);
|
||||
void AddList(const BStringList *newItems);
|
||||
bool RemoveItem(const char *item);
|
||||
void MakeEmpty();
|
||||
|
||||
/* Retrieving items. */
|
||||
const char *ItemAt(int32) const;
|
||||
int32 IndexOf(const char *) const;
|
||||
|
||||
/* Querying the list. */
|
||||
bool HasItem(const char *item) const;
|
||||
int32 CountItems() const;
|
||||
bool IsEmpty() const;
|
||||
|
||||
/* Determining differences between lists */
|
||||
void NotHere(BStringList &other_list, BStringList *results);
|
||||
void NotThere(BStringList &other_list, BStringList *results);
|
||||
|
||||
/* Useful list logic operators */
|
||||
BStringList &operator += (const char *item);
|
||||
BStringList &operator += (BStringList &list);
|
||||
|
||||
BStringList &operator -= (const char *item);
|
||||
BStringList &operator -= (BStringList &list);
|
||||
|
||||
BStringList operator | (BStringList &list);
|
||||
BStringList &operator |= (BStringList &list);
|
||||
|
||||
BStringList operator ^ (BStringList &list);
|
||||
BStringList &operator ^= (BStringList &list);
|
||||
|
||||
bool operator == (BStringList &list);
|
||||
const char *operator [] (int32 index);
|
||||
|
||||
private:
|
||||
void *_buckets[256];
|
||||
int32 _items;
|
||||
BList *_indexed;
|
||||
|
||||
uint32 _reserved[5];
|
||||
};
|
||||
|
||||
#endif /* ZOIDBERG_STRING_LIST_H */
|
82
headers/build/os/add-ons/screen_saver/ScreenSaver.h
Normal file
82
headers/build/os/add-ons/screen_saver/ScreenSaver.h
Normal file
@ -0,0 +1,82 @@
|
||||
#if ! defined _SCREENSAVER_H
|
||||
#define _SCREENSAVER_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <DirectWindow.h> // for direct_buffer_info
|
||||
#include <image.h>
|
||||
#include <Message.h>
|
||||
|
||||
class BView;
|
||||
|
||||
class BScreenSaver
|
||||
{
|
||||
public:
|
||||
BScreenSaver(BMessage *archive, image_id);
|
||||
virtual ~BScreenSaver();
|
||||
|
||||
// Return an error if something goes wrong or if you don't
|
||||
// like the running environment (lack of 3D acceleration,
|
||||
// lack of sound, ...).
|
||||
virtual status_t InitCheck();
|
||||
|
||||
// Animation start and stop. The view is not yet visible when
|
||||
// StartSaver is called.
|
||||
virtual status_t StartSaver(BView *view, bool preview);
|
||||
virtual void StopSaver();
|
||||
|
||||
// This hook is called periodically, you should
|
||||
// override it to do the drawing. Notice that you
|
||||
// should clear the screen when frame == 0 if you
|
||||
// don't want to paint over the desktop.
|
||||
virtual void Draw(BView *view, int32 frame);
|
||||
|
||||
// These hooks are for direct screen access, the first is
|
||||
// called every time the settings change, the second is
|
||||
// the equivalent of Draw to be called to access the screen
|
||||
// directly. Draw and DirectDraw can be used at the same time.
|
||||
virtual void DirectConnected(direct_buffer_info *info);
|
||||
virtual void DirectDraw(int32 frame);
|
||||
|
||||
// configuration dialog methods
|
||||
virtual void StartConfig(BView *configView);
|
||||
virtual void StopConfig();
|
||||
|
||||
// Module should fill this in with metadata
|
||||
// example: randomizable = true
|
||||
virtual void SupplyInfo(BMessage *info) const;
|
||||
|
||||
// Send all the metadata info to the module
|
||||
virtual void ModulesChanged(const BMessage *info);
|
||||
|
||||
// BArchivable like parameter saver method
|
||||
virtual status_t SaveState(BMessage *into) const;
|
||||
|
||||
// These methods can be used to control drawing frequency.
|
||||
void SetTickSize(bigtime_t ts);
|
||||
bigtime_t TickSize() const;
|
||||
|
||||
// These methods can be used to control animation loop cycles
|
||||
void SetLoop(int32 on_count, int32 off_count);
|
||||
int32 LoopOnCount() const;
|
||||
int32 LoopOffCount() const;
|
||||
|
||||
private:
|
||||
virtual void _ReservedScreenSaver1();
|
||||
virtual void _ReservedScreenSaver2();
|
||||
virtual void _ReservedScreenSaver3();
|
||||
virtual void _ReservedScreenSaver4();
|
||||
virtual void _ReservedScreenSaver5();
|
||||
virtual void _ReservedScreenSaver6();
|
||||
virtual void _ReservedScreenSaver7();
|
||||
virtual void _ReservedScreenSaver8();
|
||||
|
||||
bigtime_t ticksize;
|
||||
int32 looponcount;
|
||||
int32 loopoffcount;
|
||||
|
||||
uint32 _reservedScreenSaver[6];
|
||||
};
|
||||
|
||||
extern "C" _EXPORT BScreenSaver *instantiate_screen_saver(BMessage *msg, image_id id);
|
||||
|
||||
#endif
|
44
headers/build/os/add-ons/tracker/Background.h
Normal file
44
headers/build/os/add-ons/tracker/Background.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: Background.h
|
||||
/
|
||||
/ Description: Defines constants for setting Tracker background images
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _TRACKER_BACKGROUND_H
|
||||
#define _TRACKER_BACKGROUND_H
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Tracker background attribute name ----------------------*/
|
||||
|
||||
#define B_BACKGROUND_INFO "be:bgndimginfo"
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Tracker background BMessage entries --------------------*/
|
||||
|
||||
#define B_BACKGROUND_IMAGE "be:bgndimginfopath" // string path
|
||||
#define B_BACKGROUND_MODE "be:bgndimginfomode" // int32, the enum below
|
||||
#define B_BACKGROUND_ORIGIN "be:bgndimginfooffset" // BPoint
|
||||
#define B_BACKGROUND_ERASE_TEXT "be:bgndimginfoerasetext" // bool
|
||||
#define B_BACKGROUND_WORKSPACES "be:bgndimginfoworkspaces" // uint32
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Background mode values ---------------------------------*/
|
||||
|
||||
enum {
|
||||
B_BACKGROUND_MODE_USE_ORIGIN,
|
||||
B_BACKGROUND_MODE_CENTERED, // only works on Desktop
|
||||
B_BACKGROUND_MODE_SCALED, // only works on Desktop
|
||||
B_BACKGROUND_MODE_TILED
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to
|
||||
// use a new background image
|
||||
|
||||
#endif /* _TRACKER_BACKGROUND_H */
|
27
headers/build/os/add-ons/tracker/TrackerAddOn.h
Normal file
27
headers/build/os/add-ons/tracker/TrackerAddOn.h
Normal file
@ -0,0 +1,27 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: TrackerAddOn.h
|
||||
/
|
||||
/ Description: Protocol for the process_refs() hook function.
|
||||
/
|
||||
/ Copyright 1995-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _TRACKER_ADDON_H
|
||||
#define _TRACKER_ADDON_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
|
||||
struct entry_ref;
|
||||
class BMessage;
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*------- This is why you're here: ----------------------------*/
|
||||
extern "C" _EXPORT void process_refs(entry_ref dir_ref, BMessage* msg, void*);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _TRACKER_ADDON_H */
|
170
headers/build/os/app/AppDefs.h
Normal file
170
headers/build/os/app/AppDefs.h
Normal file
@ -0,0 +1,170 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: AppDefs.h
|
||||
// Author: Erik Jaesler (erik@cgsoftware.com)
|
||||
// Description: Message codes and the global cursors.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _APP_DEFS_H
|
||||
#define _APP_DEFS_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
// Global Cursors --------------------------------------------------------------
|
||||
|
||||
// Old-style cursors
|
||||
extern const unsigned char B_HAND_CURSOR[];
|
||||
extern const unsigned char B_I_BEAM_CURSOR[];
|
||||
|
||||
// New-style cursors
|
||||
#ifdef __cplusplus
|
||||
class BCursor;
|
||||
extern const BCursor *B_CURSOR_SYSTEM_DEFAULT;
|
||||
extern const BCursor *B_CURSOR_I_BEAM;
|
||||
#endif
|
||||
|
||||
// System Message Codes --------------------------------------------------------
|
||||
|
||||
enum {
|
||||
B_ABOUT_REQUESTED = '_ABR',
|
||||
B_WINDOW_ACTIVATED = '_ACT',
|
||||
B_APP_ACTIVATED = '_ACT', // Same as B_WINDOW_ACTIVATED
|
||||
B_ARGV_RECEIVED = '_ARG',
|
||||
B_QUIT_REQUESTED = '_QRQ',
|
||||
B_CLOSE_REQUESTED = '_QRQ', // Obsolete; use B_QUIT_REQUESTED
|
||||
B_CANCEL = '_CNC',
|
||||
B_KEY_DOWN = '_KYD',
|
||||
B_KEY_UP = '_KYU',
|
||||
B_UNMAPPED_KEY_DOWN = '_UKD',
|
||||
B_UNMAPPED_KEY_UP = '_UKU',
|
||||
B_MODIFIERS_CHANGED = '_MCH',
|
||||
B_MINIMIZE = '_WMN',
|
||||
B_MOUSE_DOWN = '_MDN',
|
||||
B_MOUSE_MOVED = '_MMV',
|
||||
B_MOUSE_ENTER_EXIT = '_MEX',
|
||||
B_MOUSE_UP = '_MUP',
|
||||
B_MOUSE_WHEEL_CHANGED = '_MWC',
|
||||
B_OPEN_IN_WORKSPACE = '_OWS',
|
||||
B_PRINTER_CHANGED = '_PCH',
|
||||
B_PULSE = '_PUL',
|
||||
B_READY_TO_RUN = '_RTR',
|
||||
B_REFS_RECEIVED = '_RRC',
|
||||
B_RELEASE_OVERLAY_LOCK = '_ROV',
|
||||
B_ACQUIRE_OVERLAY_LOCK = '_AOV',
|
||||
B_SCREEN_CHANGED = '_SCH',
|
||||
B_VALUE_CHANGED = '_VCH',
|
||||
B_VIEW_MOVED = '_VMV',
|
||||
B_VIEW_RESIZED = '_VRS',
|
||||
B_WINDOW_MOVED = '_WMV',
|
||||
B_WINDOW_RESIZED = '_WRS',
|
||||
B_WORKSPACES_CHANGED = '_WCG',
|
||||
B_WORKSPACE_ACTIVATED = '_WAC',
|
||||
B_ZOOM = '_WZM',
|
||||
_COLORS_UPDATED = '_CLU', // Currently internal-use only. Later, public as B_COLORS_UPDATED
|
||||
_FONTS_UPDATED = '_FNU', // Currently internal-use only. Later, public as B_FONTS_UPDATED
|
||||
_APP_MENU_ = '_AMN',
|
||||
_BROWSER_MENUS_ = '_BRM',
|
||||
_MENU_EVENT_ = '_MEV',
|
||||
_PING_ = '_PBL',
|
||||
_QUIT_ = '_QIT',
|
||||
_VOLUME_MOUNTED_ = '_NVL',
|
||||
_VOLUME_UNMOUNTED_ = '_VRM',
|
||||
_MESSAGE_DROPPED_ = '_MDP',
|
||||
_DISPOSE_DRAG_ = '_DPD',
|
||||
_MENUS_DONE_ = '_MND',
|
||||
_SHOW_DRAG_HANDLES_ = '_SDH',
|
||||
_EVENTS_PENDING_ = '_EVP',
|
||||
_UPDATE_ = '_UPD',
|
||||
_UPDATE_IF_NEEDED_ = '_UPN',
|
||||
_PRINTER_INFO_ = '_PIN',
|
||||
_SETUP_PRINTER_ = '_SUP',
|
||||
_SELECT_PRINTER_ = '_PSL'
|
||||
// Media Kit reserves all reserved codes starting in '_TR'
|
||||
};
|
||||
|
||||
|
||||
// Other Commands --------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
B_SET_PROPERTY = 'PSET',
|
||||
B_GET_PROPERTY = 'PGET',
|
||||
B_CREATE_PROPERTY = 'PCRT',
|
||||
B_DELETE_PROPERTY = 'PDEL',
|
||||
B_COUNT_PROPERTIES = 'PCNT',
|
||||
B_EXECUTE_PROPERTY = 'PEXE',
|
||||
B_GET_SUPPORTED_SUITES = 'SUIT',
|
||||
B_UNDO = 'UNDO',
|
||||
B_REDO = 'REDO',
|
||||
B_CUT = 'CCUT',
|
||||
B_COPY = 'COPY',
|
||||
B_PASTE = 'PSTE',
|
||||
B_SELECT_ALL = 'SALL',
|
||||
B_SAVE_REQUESTED = 'SAVE',
|
||||
B_MESSAGE_NOT_UNDERSTOOD = 'MNOT',
|
||||
B_NO_REPLY = 'NONE',
|
||||
B_REPLY = 'RPLY',
|
||||
B_SIMPLE_DATA = 'DATA',
|
||||
B_MIME_DATA = 'MIME',
|
||||
B_ARCHIVED_OBJECT = 'ARCV',
|
||||
B_UPDATE_STATUS_BAR = 'SBUP',
|
||||
B_RESET_STATUS_BAR = 'SBRS',
|
||||
B_NODE_MONITOR = 'NDMN',
|
||||
B_QUERY_UPDATE = 'QUPD',
|
||||
B_ENDORSABLE = 'ENDO',
|
||||
B_COPY_TARGET = 'DDCP',
|
||||
B_MOVE_TARGET = 'DDMV',
|
||||
B_TRASH_TARGET = 'DDRM',
|
||||
B_LINK_TARGET = 'DDLN',
|
||||
B_INPUT_DEVICES_CHANGED = 'IDCH',
|
||||
B_INPUT_METHOD_EVENT = 'IMEV',
|
||||
B_WINDOW_MOVE_TO = 'WDMT',
|
||||
B_WINDOW_MOVE_BY = 'WDMB',
|
||||
B_SILENT_RELAUNCH = 'AREL',
|
||||
B_OBSERVER_NOTICE_CHANGE = 'NTCH',
|
||||
B_CONTROL_INVOKED = 'CIVK',
|
||||
B_CONTROL_MODIFIED = 'CMOD'
|
||||
|
||||
// Media Kit reserves all reserved codes starting in 'TRI'
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _APP_DEFS_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
179
headers/build/os/app/Application.h
Normal file
179
headers/build/os/app/Application.h
Normal file
@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler (erik@cgsoftware.com)
|
||||
*/
|
||||
#ifndef _APPLICATION_H
|
||||
#define _APPLICATION_H
|
||||
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <AppDefs.h> // For convenience
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Looper.h>
|
||||
#include <Messenger.h>
|
||||
#include <Point.h>
|
||||
#include <Rect.h>
|
||||
|
||||
|
||||
class BCursor;
|
||||
class BList;
|
||||
class BWindow;
|
||||
class _BSession_;
|
||||
class BResources;
|
||||
class BMessageRunner;
|
||||
class BServer;
|
||||
struct _server_heap_;
|
||||
struct _drag_data_;
|
||||
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
}
|
||||
|
||||
|
||||
class BApplication : public BLooper {
|
||||
public:
|
||||
BApplication(const char* signature);
|
||||
BApplication(const char* signature,
|
||||
status_t* error);
|
||||
virtual ~BApplication();
|
||||
|
||||
// Archiving
|
||||
BApplication(BMessage* data);
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
// App control and System Message handling
|
||||
virtual thread_id Run();
|
||||
virtual void Quit();
|
||||
virtual bool QuitRequested();
|
||||
virtual void Pulse();
|
||||
virtual void ReadyToRun();
|
||||
virtual void MessageReceived(BMessage* msg);
|
||||
virtual void ArgvReceived(int32 argc, char** argv);
|
||||
virtual void AppActivated(bool active);
|
||||
virtual void RefsReceived(BMessage* message);
|
||||
virtual void AboutRequested();
|
||||
|
||||
// Scripting
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg,
|
||||
int32 index,
|
||||
BMessage* specifier,
|
||||
int32 form,
|
||||
const char* property);
|
||||
|
||||
// Cursor control, window/looper list, and app info
|
||||
void ShowCursor();
|
||||
void HideCursor();
|
||||
void ObscureCursor();
|
||||
bool IsCursorHidden() const;
|
||||
void SetCursor(const void* cursor);
|
||||
void SetCursor(const BCursor* cursor, bool sync = true);
|
||||
int32 CountWindows() const;
|
||||
BWindow* WindowAt(int32 index) const;
|
||||
int32 CountLoopers() const;
|
||||
BLooper* LooperAt(int32 index) const;
|
||||
bool IsLaunching() const;
|
||||
status_t GetAppInfo(app_info* info) const;
|
||||
static BResources* AppResources();
|
||||
|
||||
virtual void DispatchMessage(BMessage* message,
|
||||
BHandler* handler);
|
||||
void SetPulseRate(bigtime_t rate);
|
||||
|
||||
// More scripting
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
class Private;
|
||||
|
||||
private:
|
||||
typedef BLooper _inherited;
|
||||
|
||||
friend class Private;
|
||||
|
||||
friend class BServer;
|
||||
|
||||
BApplication(const char* signature, bool initGUI,
|
||||
status_t* error);
|
||||
BApplication(uint32 signature);
|
||||
BApplication(const BApplication&);
|
||||
BApplication& operator=(const BApplication&);
|
||||
|
||||
virtual void _ReservedApplication1();
|
||||
virtual void _ReservedApplication2();
|
||||
virtual void _ReservedApplication3();
|
||||
virtual void _ReservedApplication4();
|
||||
virtual void _ReservedApplication5();
|
||||
virtual void _ReservedApplication6();
|
||||
virtual void _ReservedApplication7();
|
||||
virtual void _ReservedApplication8();
|
||||
|
||||
virtual bool ScriptReceived(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* property);
|
||||
void run_task();
|
||||
void InitData(const char* signature, bool initGUI,
|
||||
status_t* error);
|
||||
void BeginRectTracking(BRect r, bool trackWhole);
|
||||
void EndRectTracking();
|
||||
status_t setup_server_heaps();
|
||||
void* rw_offs_to_ptr(uint32 offset);
|
||||
void* ro_offs_to_ptr(uint32 offset);
|
||||
void* global_ro_offs_to_ptr(uint32 offset);
|
||||
status_t _InitGUIContext();
|
||||
status_t connect_to_app_server();
|
||||
void send_drag( BMessage* msg,
|
||||
int32 vs_token,
|
||||
BPoint offset,
|
||||
BRect drag_rect,
|
||||
BHandler* reply_to);
|
||||
void send_drag( BMessage* msg,
|
||||
int32 vs_token,
|
||||
BPoint offset,
|
||||
int32 bitmap_token,
|
||||
drawing_mode dragMode,
|
||||
BHandler* reply_to);
|
||||
void write_drag(_BSession_* session, BMessage* a_message);
|
||||
bool quit_all_windows(bool force);
|
||||
bool window_quit_loop(bool, bool);
|
||||
void do_argv(BMessage* msg);
|
||||
void SetAppCursor();
|
||||
|
||||
uint32 InitialWorkspace();
|
||||
int32 count_windows(bool incl_menus) const;
|
||||
BWindow* window_at(uint32 index, bool incl_menus) const;
|
||||
status_t get_window_list(BList* list, bool incl_menus) const;
|
||||
static int32 async_quit_entry(void*);
|
||||
static BResources* _app_resources;
|
||||
static BLocker _app_resources_lock;
|
||||
|
||||
const char* fAppName;
|
||||
BPrivate::PortLink* fServerLink;
|
||||
uint32 _unused0;
|
||||
|
||||
void* fCursorData;
|
||||
_server_heap_* fServerHeap;
|
||||
bigtime_t fPulseRate;
|
||||
uint32 fInitialWorkspace;
|
||||
_drag_data_* fDraggedMessage;
|
||||
BMessageRunner* fPulseRunner;
|
||||
status_t fInitError;
|
||||
uint32 _reserved[11];
|
||||
|
||||
bool fReadyToRunCalled;
|
||||
};
|
||||
|
||||
// Global Objects
|
||||
|
||||
extern _IMPEXP_BE BApplication* be_app;
|
||||
extern _IMPEXP_BE BMessenger be_app_messenger;
|
||||
|
||||
#endif // _APPLICATION_H
|
105
headers/build/os/app/Clipboard.h
Normal file
105
headers/build/os/app/Clipboard.h
Normal file
@ -0,0 +1,105 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Clipboard.h
|
||||
// Author: Gabe Yoder (gyoder@stny.rr.com)
|
||||
// Description: BClipboard provides an interface to a system-wide clipboard
|
||||
// storage area.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _CLIPBOARD_H
|
||||
#define _CLIPBOARD_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Messenger.h>
|
||||
#include <Locker.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
class BMessage;
|
||||
|
||||
enum {
|
||||
B_CLIPBOARD_CHANGED = 'CLCH'
|
||||
};
|
||||
|
||||
// BClipboard class ---------------------------------------------------------------
|
||||
class BClipboard {
|
||||
public:
|
||||
BClipboard(const char *name, bool transient = false);
|
||||
virtual ~BClipboard();
|
||||
|
||||
const char *Name() const;
|
||||
|
||||
uint32 LocalCount() const;
|
||||
uint32 SystemCount() const;
|
||||
status_t StartWatching(BMessenger target);
|
||||
status_t StopWatching(BMessenger target);
|
||||
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
bool IsLocked() const;
|
||||
|
||||
status_t Clear();
|
||||
status_t Commit();
|
||||
status_t Revert();
|
||||
|
||||
BMessenger DataSource() const;
|
||||
BMessage *Data() const;
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
private:
|
||||
BClipboard(const BClipboard &);
|
||||
BClipboard &operator=(const BClipboard &);
|
||||
|
||||
virtual void _ReservedClipboard1();
|
||||
virtual void _ReservedClipboard2();
|
||||
virtual void _ReservedClipboard3();
|
||||
|
||||
bool AssertLocked() const;
|
||||
status_t DownloadFromSystem(bool force = false);
|
||||
status_t UploadToSystem();
|
||||
|
||||
uint32 _reserved0;
|
||||
BMessage *fData;
|
||||
BLocker fLock;
|
||||
BMessenger fClipHandler;
|
||||
BMessenger fDataSource;
|
||||
uint32 fCount;
|
||||
char *fName;
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
//----- Global Clipboard -------------------------------------------------------
|
||||
|
||||
extern _IMPEXP_BE BClipboard *be_clipboard;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _CLIPBOARD_H
|
||||
|
82
headers/build/os/app/Cursor.h
Normal file
82
headers/build/os/app/Cursor.h
Normal file
@ -0,0 +1,82 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Cursor.h
|
||||
// Author: Frans van Nispen (xlr8@tref.nl)
|
||||
// Description: BCursor describes a view-wide or application-wide cursor.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _CURSOR_H
|
||||
#define _CURSOR_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <Archivable.h>
|
||||
#include <BeBuild.h>
|
||||
#include <InterfaceDefs.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
// BCursor class ---------------------------------------------------------------
|
||||
class BCursor : BArchivable {
|
||||
public:
|
||||
BCursor(const void* cursorData);
|
||||
BCursor(BMessage* data);
|
||||
virtual ~BCursor();
|
||||
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
private:
|
||||
|
||||
virtual void _ReservedCursor1();
|
||||
virtual void _ReservedCursor2();
|
||||
virtual void _ReservedCursor3();
|
||||
virtual void _ReservedCursor4();
|
||||
|
||||
friend class BApplication;
|
||||
friend class BView;
|
||||
|
||||
int32 m_serverToken;
|
||||
int32 m_needToFree;
|
||||
uint32 _reserved[6];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _CURSOR_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
148
headers/build/os/app/Handler.h
Normal file
148
headers/build/os/app/Handler.h
Normal file
@ -0,0 +1,148 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Handler.cpp
|
||||
// Author: Erik Jaesler (erik@cgsoftware.com)
|
||||
// Description: BHandler defines the message-handling protocol.
|
||||
// MessageReceived() is its lynchpin.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _HANDLER_H
|
||||
#define _HANDLER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Archivable.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BLooper;
|
||||
class BMessageFilter;
|
||||
class BMessage;
|
||||
class BList;
|
||||
class _ObserverList;
|
||||
|
||||
#define B_OBSERVE_WHAT_CHANGE "be:observe_change_what"
|
||||
#define B_OBSERVE_ORIGINAL_WHAT "be:observe_orig_what"
|
||||
const uint32 B_OBSERVER_OBSERVE_ALL = 0xffffffff;
|
||||
|
||||
// BHandler class --------------------------------------------------------------
|
||||
class BHandler : public BArchivable {
|
||||
|
||||
public:
|
||||
BHandler(const char* name = NULL);
|
||||
virtual ~BHandler();
|
||||
|
||||
// Archiving
|
||||
BHandler(BMessage* data);
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
// BHandler guts.
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
BLooper* Looper() const;
|
||||
void SetName(const char* name);
|
||||
const char* Name() const;
|
||||
virtual void SetNextHandler(BHandler* handler);
|
||||
BHandler* NextHandler() const;
|
||||
|
||||
// Message filtering
|
||||
virtual void AddFilter(BMessageFilter* filter);
|
||||
virtual bool RemoveFilter(BMessageFilter* filter);
|
||||
virtual void SetFilterList(BList* filters);
|
||||
BList* FilterList();
|
||||
|
||||
bool LockLooper();
|
||||
status_t LockLooperWithTimeout(bigtime_t timeout);
|
||||
void UnlockLooper();
|
||||
|
||||
// Scripting
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg,
|
||||
int32 index,
|
||||
BMessage* specifier,
|
||||
int32 form,
|
||||
const char* property);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
|
||||
// Observer calls, inter-looper and inter-team
|
||||
status_t StartWatching(BMessenger, uint32 what);
|
||||
status_t StartWatchingAll(BMessenger);
|
||||
status_t StopWatching(BMessenger, uint32 what);
|
||||
status_t StopWatchingAll(BMessenger);
|
||||
|
||||
// Observer calls for observing targets in the same BLooper
|
||||
status_t StartWatching(BHandler* , uint32 what);
|
||||
status_t StartWatchingAll(BHandler* );
|
||||
status_t StopWatching(BHandler* , uint32 what);
|
||||
status_t StopWatchingAll(BHandler* );
|
||||
|
||||
|
||||
// Reserved
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
// Notifier calls
|
||||
virtual void SendNotices(uint32 what, const BMessage* = 0);
|
||||
bool IsWatched() const;
|
||||
|
||||
//----- Private or reserved -----------------------------------------
|
||||
private:
|
||||
typedef BArchivable _inherited;
|
||||
friend inline int32 _get_object_token_(const BHandler* );
|
||||
friend class BLooper;
|
||||
friend class BMessageFilter;
|
||||
|
||||
virtual void _ReservedHandler2();
|
||||
virtual void _ReservedHandler3();
|
||||
virtual void _ReservedHandler4();
|
||||
|
||||
void InitData(const char* name);
|
||||
|
||||
BHandler(const BHandler&);
|
||||
BHandler& operator=(const BHandler&);
|
||||
void SetLooper(BLooper* loop);
|
||||
|
||||
int32 fToken;
|
||||
char* fName;
|
||||
BLooper* fLooper;
|
||||
BHandler* fNextHandler;
|
||||
BList* fFilters;
|
||||
_ObserverList* fObserverList;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _HANDLER_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
128
headers/build/os/app/Invoker.h
Normal file
128
headers/build/os/app/Invoker.h
Normal file
@ -0,0 +1,128 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Invoker.h
|
||||
// Author: Frans van Nispen (xlr8@tref.nl)
|
||||
// Description: BInvoker class defines a protocol for objects that
|
||||
// post messages to a "target".
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _INVOKER_H
|
||||
#define _INVOKER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Messenger.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BHandler;
|
||||
class BLooper;
|
||||
class BMessage;
|
||||
|
||||
// BInvoker class --------------------------------------------------------------
|
||||
class BInvoker {
|
||||
public:
|
||||
BInvoker();
|
||||
BInvoker(BMessage *message,
|
||||
const BHandler *handler,
|
||||
const BLooper *looper = NULL);
|
||||
BInvoker(BMessage *message, BMessenger target);
|
||||
virtual ~BInvoker();
|
||||
|
||||
virtual status_t SetMessage(BMessage *message);
|
||||
BMessage *Message() const;
|
||||
uint32 Command() const;
|
||||
|
||||
virtual status_t SetTarget(const BHandler *h, const BLooper *loop = NULL);
|
||||
virtual status_t SetTarget(BMessenger messenger);
|
||||
bool IsTargetLocal() const;
|
||||
BHandler *Target(BLooper **looper = NULL) const;
|
||||
BMessenger Messenger() const;
|
||||
|
||||
virtual status_t SetHandlerForReply(BHandler *handler);
|
||||
BHandler *HandlerForReply() const;
|
||||
|
||||
virtual status_t Invoke(BMessage *msg = NULL);
|
||||
|
||||
// Invoke with BHandler notification. Use this to perform an
|
||||
// Invoke() with some other kind of notification change code.
|
||||
// (A raw invoke should always notify as B_CONTROL_INVOKED.)
|
||||
// Unlike a raw Invoke(), there is no standard message that is
|
||||
// sent. If 'msg' is NULL, then nothing will be sent to this
|
||||
// invoker's target... however, a notification message will
|
||||
// still be sent to any watchers of the invoker's handler.
|
||||
// Note that the BInvoker class does not actually implement
|
||||
// any of this behavior -- it is up to subclasses to override
|
||||
// Invoke() and call Notify() with the appropriate change code.
|
||||
status_t InvokeNotify(BMessage *msg, uint32 kind = B_CONTROL_INVOKED);
|
||||
status_t SetTimeout(bigtime_t timeout);
|
||||
bigtime_t Timeout() const;
|
||||
|
||||
protected:
|
||||
// Return the change code for a notification. This is either
|
||||
// B_CONTROL_INVOKED for raw Invoke() calls, or the kind
|
||||
// supplied to InvokeNotify(). In addition, 'notify' will be
|
||||
// set to true if this was an InvokeNotify() call, else false.
|
||||
uint32 InvokeKind(bool* notify = NULL);
|
||||
|
||||
// Start and end an InvokeNotify context around an Invoke() call.
|
||||
// These are only needed for writing custom methods that
|
||||
// emulate the standard InvokeNotify() call.
|
||||
void BeginInvokeNotify(uint32 kind = B_CONTROL_INVOKED);
|
||||
void EndInvokeNotify();
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
private:
|
||||
// to be able to keep binary compatibility
|
||||
virtual void _ReservedInvoker1();
|
||||
virtual void _ReservedInvoker2();
|
||||
virtual void _ReservedInvoker3();
|
||||
|
||||
BInvoker(const BInvoker&);
|
||||
BInvoker &operator=(const BInvoker&);
|
||||
|
||||
BMessage *fMessage;
|
||||
BMessenger fMessenger;
|
||||
BHandler *fReplyTo;
|
||||
bigtime_t fTimeout;
|
||||
uint32 fNotifyKind;
|
||||
uint32 _reserved[1]; // to be able to keep binary compatibility
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _INVOKER_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
238
headers/build/os/app/Looper.h
Normal file
238
headers/build/os/app/Looper.h
Normal file
@ -0,0 +1,238 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Looper.h
|
||||
// Author(s): Erik Jaesler (erik@cgsoftware.com)
|
||||
// DarkWyrm (bpmagic@columbus.rr.com)
|
||||
// Description: BLooper class spawns a thread that runs a message loop.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _LOOPER_H
|
||||
#define _LOOPER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Handler.h>
|
||||
#include <List.h>
|
||||
#include <OS.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BMessage;
|
||||
class BMessageQueue;
|
||||
namespace BPrivate {
|
||||
class BLooperList;
|
||||
}
|
||||
struct _loop_data_;
|
||||
|
||||
// Port (Message Queue) Capacity -----------------------------------------------
|
||||
#define B_LOOPER_PORT_DEFAULT_CAPACITY 100
|
||||
|
||||
|
||||
// BLooper class ---------------------------------------------------------------
|
||||
class BLooper : public BHandler {
|
||||
public:
|
||||
BLooper(const char* name = NULL,
|
||||
int32 priority = B_NORMAL_PRIORITY,
|
||||
int32 port_capacity = B_LOOPER_PORT_DEFAULT_CAPACITY);
|
||||
virtual ~BLooper();
|
||||
|
||||
// Archiving
|
||||
BLooper(BMessage* data);
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
// Message transmission
|
||||
status_t PostMessage(uint32 command);
|
||||
status_t PostMessage(BMessage* message);
|
||||
status_t PostMessage(uint32 command,
|
||||
BHandler* handler,
|
||||
BHandler* reply_to = NULL);
|
||||
status_t PostMessage(BMessage* message,
|
||||
BHandler* handler,
|
||||
BHandler* reply_to = NULL);
|
||||
|
||||
virtual void DispatchMessage(BMessage* message, BHandler* handler);
|
||||
virtual void MessageReceived(BMessage* msg);
|
||||
BMessage* CurrentMessage() const;
|
||||
BMessage* DetachCurrentMessage();
|
||||
BMessageQueue* MessageQueue() const;
|
||||
bool IsMessageWaiting() const;
|
||||
|
||||
// Message handlers
|
||||
void AddHandler(BHandler* handler);
|
||||
bool RemoveHandler(BHandler* handler);
|
||||
int32 CountHandlers() const;
|
||||
BHandler* HandlerAt(int32 index) const;
|
||||
int32 IndexOf(BHandler* handler) const;
|
||||
|
||||
BHandler* PreferredHandler() const;
|
||||
void SetPreferredHandler(BHandler* handler);
|
||||
|
||||
// Loop control
|
||||
virtual thread_id Run();
|
||||
virtual void Quit();
|
||||
virtual bool QuitRequested();
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
bool IsLocked() const;
|
||||
status_t LockWithTimeout(bigtime_t timeout);
|
||||
thread_id Thread() const;
|
||||
team_id Team() const;
|
||||
static BLooper* LooperForThread(thread_id tid);
|
||||
|
||||
// Loop debugging
|
||||
thread_id LockingThread() const;
|
||||
int32 CountLocks() const;
|
||||
int32 CountLockRequests() const;
|
||||
sem_id Sem() const;
|
||||
|
||||
// Scripting
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg,
|
||||
int32 index,
|
||||
BMessage* specifier,
|
||||
int32 form,
|
||||
const char* property);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
|
||||
// Message filters (also see BHandler).
|
||||
virtual void AddCommonFilter(BMessageFilter* filter);
|
||||
virtual bool RemoveCommonFilter(BMessageFilter* filter);
|
||||
virtual void SetCommonFilterList(BList* filters);
|
||||
BList* CommonFilterList() const;
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
protected:
|
||||
// called from overridden task_looper
|
||||
BMessage* MessageFromPort(bigtime_t = B_INFINITE_TIMEOUT);
|
||||
|
||||
private:
|
||||
typedef BHandler _inherited;
|
||||
friend class BWindow;
|
||||
friend class BApplication;
|
||||
friend class BMessenger;
|
||||
friend class BView;
|
||||
friend class BHandler;
|
||||
friend class BPrivate::BLooperList;
|
||||
friend port_id _get_looper_port_(const BLooper* );
|
||||
friend status_t _safe_get_server_token_(const BLooper* , int32* );
|
||||
friend team_id _find_cur_team_id_();
|
||||
|
||||
virtual void _ReservedLooper1();
|
||||
virtual void _ReservedLooper2();
|
||||
virtual void _ReservedLooper3();
|
||||
virtual void _ReservedLooper4();
|
||||
virtual void _ReservedLooper5();
|
||||
virtual void _ReservedLooper6();
|
||||
|
||||
BLooper(const BLooper&);
|
||||
BLooper& operator=(const BLooper&);
|
||||
|
||||
BLooper(int32 priority, port_id port, const char* name);
|
||||
|
||||
status_t _PostMessage(BMessage* msg,
|
||||
BHandler* handler,
|
||||
BHandler* reply_to);
|
||||
|
||||
static status_t _Lock(BLooper* loop,
|
||||
port_id port,
|
||||
bigtime_t timeout);
|
||||
static status_t _LockComplete(BLooper* loop,
|
||||
int32 old,
|
||||
thread_id this_tid,
|
||||
sem_id sem,
|
||||
bigtime_t timeout);
|
||||
void InitData();
|
||||
void InitData(const char* name, int32 prio, int32 capacity);
|
||||
void AddMessage(BMessage* msg);
|
||||
void _AddMessagePriv(BMessage* msg);
|
||||
static status_t _task0_(void* arg);
|
||||
|
||||
void* ReadRawFromPort(int32* code,
|
||||
bigtime_t tout = B_INFINITE_TIMEOUT);
|
||||
BMessage* ReadMessageFromPort(bigtime_t tout = B_INFINITE_TIMEOUT);
|
||||
virtual BMessage* ConvertToMessage(void* raw, int32 code);
|
||||
virtual void task_looper();
|
||||
void do_quit_requested(BMessage* msg);
|
||||
bool AssertLocked() const;
|
||||
BHandler* top_level_filter(BMessage* msg, BHandler* t);
|
||||
BHandler* handler_only_filter(BMessage* msg, BHandler* t);
|
||||
BHandler* apply_filters( BList* list,
|
||||
BMessage* msg,
|
||||
BHandler* target);
|
||||
void check_lock();
|
||||
BHandler* resolve_specifier(BHandler* target, BMessage* msg);
|
||||
void UnlockFully();
|
||||
|
||||
static uint32 sLooperID;
|
||||
static team_id sTeamID;
|
||||
|
||||
// DEPRECATED
|
||||
static void AddLooper(BLooper* l);
|
||||
static bool IsLooperValid(const BLooper* l);
|
||||
static void RemoveLooper(BLooper* l);
|
||||
static void GetLooperList(BList* list);
|
||||
static BLooper* LooperForName(const char* name);
|
||||
static BLooper* LooperForPort(port_id port);
|
||||
|
||||
uint32 fLooperID;
|
||||
BMessageQueue* fQueue;
|
||||
BMessage* fLastMessage;
|
||||
port_id fMsgPort;
|
||||
long fAtomicCount;
|
||||
sem_id fLockSem;
|
||||
long fOwnerCount;
|
||||
thread_id fOwner;
|
||||
thread_id fTaskID;
|
||||
uint32 _unused1;
|
||||
int32 fInitPriority;
|
||||
BHandler* fPreferred;
|
||||
BList fHandlers;
|
||||
BList* fCommonFilters;
|
||||
bool fTerminating;
|
||||
bool fRunCalled;
|
||||
thread_id fCachedPid;
|
||||
size_t fCachedStack;
|
||||
void* fMsgBuffer;
|
||||
size_t fMsgBufferSize;
|
||||
uint32 _reserved[6];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _LOOPER_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
439
headers/build/os/app/Message.h
Normal file
439
headers/build/os/app/Message.h
Normal file
@ -0,0 +1,439 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Message.h
|
||||
// Author(s): Erik Jaesler (erik@cgsoftware.com)
|
||||
// DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: BMessage class creates objects that store data and that
|
||||
// can be processed in a message loop. BMessage objects
|
||||
// are also used as data containers by the archiving and
|
||||
// the scripting mechanisms.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MESSAGE_H
|
||||
#define _MESSAGE_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <OS.h>
|
||||
#include <Rect.h>
|
||||
#include <DataIO.h>
|
||||
#include <Flattenable.h>
|
||||
|
||||
#include <AppDefs.h> /* For convenience */
|
||||
#include <TypeConstants.h> /* For convenience */
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
class BBlockCache;
|
||||
class BMessenger;
|
||||
class BHandler;
|
||||
class BString;
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
extern "C" void _msg_cache_cleanup_();
|
||||
extern "C" int _init_message_();
|
||||
extern "C" int _delete_message_();
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Name lengths and Scripting specifiers ---------------------------------------
|
||||
#define B_FIELD_NAME_LENGTH 255
|
||||
#define B_PROPERTY_NAME_LENGTH 255
|
||||
|
||||
enum
|
||||
{
|
||||
B_NO_SPECIFIER = 0,
|
||||
B_DIRECT_SPECIFIER = 1,
|
||||
B_INDEX_SPECIFIER,
|
||||
B_REVERSE_INDEX_SPECIFIER,
|
||||
B_RANGE_SPECIFIER,
|
||||
B_REVERSE_RANGE_SPECIFIER,
|
||||
B_NAME_SPECIFIER,
|
||||
B_ID_SPECIFIER,
|
||||
|
||||
B_SPECIFIERS_END = 128
|
||||
// app-defined specifiers start at B_SPECIFIERS_END+1
|
||||
};
|
||||
|
||||
namespace BPrivate {
|
||||
class BMessageBody;
|
||||
}
|
||||
|
||||
// BMessage class --------------------------------------------------------------
|
||||
class BMessage
|
||||
{
|
||||
public:
|
||||
uint32 what;
|
||||
|
||||
BMessage();
|
||||
BMessage(uint32 what);
|
||||
BMessage(const BMessage &a_message);
|
||||
virtual ~BMessage();
|
||||
|
||||
BMessage &operator=(const BMessage &msg);
|
||||
|
||||
// Statistics and misc info
|
||||
status_t GetInfo(type_code typeRequested, int32 which, char **name,
|
||||
type_code *typeReturned, int32 *count = NULL) const;
|
||||
|
||||
status_t GetInfo(const char *name, type_code *type, int32 *c = 0) const;
|
||||
status_t GetInfo(const char *name, type_code *type, bool *fixed_size) const;
|
||||
|
||||
int32 CountNames(type_code type) const;
|
||||
bool IsEmpty() const;
|
||||
bool IsSystem() const;
|
||||
bool IsReply() const;
|
||||
void PrintToStream() const;
|
||||
|
||||
status_t Rename(const char *old_entry, const char *new_entry);
|
||||
|
||||
// Delivery info
|
||||
bool WasDelivered() const;
|
||||
bool IsSourceWaiting() const;
|
||||
BMessenger ReturnAddress() const;
|
||||
const BMessage *Previous() const;
|
||||
bool WasDropped() const;
|
||||
BPoint DropPoint(BPoint *offset = NULL) const;
|
||||
|
||||
// Flattening data
|
||||
ssize_t FlattenedSize() const;
|
||||
status_t Flatten(char *buffer, ssize_t size) const;
|
||||
status_t Flatten(BDataIO *stream, ssize_t *size = NULL) const;
|
||||
status_t Unflatten(const char *flat_buffer);
|
||||
status_t Unflatten(BDataIO *stream);
|
||||
|
||||
|
||||
// Specifiers (scripting)
|
||||
status_t AddSpecifier(const char *property);
|
||||
status_t AddSpecifier(const char *property, int32 index);
|
||||
status_t AddSpecifier(const char *property, int32 index, int32 range);
|
||||
status_t AddSpecifier(const char *property, const char *name);
|
||||
status_t AddSpecifier(const BMessage *specifier);
|
||||
|
||||
status_t SetCurrentSpecifier(int32 index);
|
||||
status_t GetCurrentSpecifier(int32 *index, BMessage *specifier = NULL,
|
||||
int32 *form = NULL, const char **property = NULL) const;
|
||||
bool HasSpecifiers() const;
|
||||
status_t PopSpecifier();
|
||||
|
||||
// Adding data
|
||||
status_t AddRect(const char *name, BRect a_rect);
|
||||
status_t AddPoint(const char *name, BPoint a_point);
|
||||
status_t AddString(const char *name, const char *a_string);
|
||||
status_t AddString(const char *name, const BString& a_string);
|
||||
status_t AddInt8(const char *name, int8 val);
|
||||
status_t AddInt16(const char *name, int16 val);
|
||||
status_t AddInt32(const char *name, int32 val);
|
||||
status_t AddInt64(const char *name, int64 val);
|
||||
status_t AddBool(const char *name, bool a_boolean);
|
||||
status_t AddFloat(const char *name, float a_float);
|
||||
status_t AddDouble(const char *name, double a_double);
|
||||
status_t AddPointer(const char *name, const void *ptr);
|
||||
status_t AddMessenger(const char *name, BMessenger messenger);
|
||||
status_t AddRef(const char *name, const entry_ref *ref);
|
||||
status_t AddMessage(const char *name, const BMessage *msg);
|
||||
status_t AddFlat(const char *name, BFlattenable *obj, int32 count = 1);
|
||||
status_t AddData(const char *name, type_code type, const void *data,
|
||||
ssize_t numBytes, bool is_fixed_size = true, int32 count = 1);
|
||||
|
||||
// Removing data
|
||||
status_t RemoveData(const char *name, int32 index = 0);
|
||||
status_t RemoveName(const char *name);
|
||||
status_t MakeEmpty();
|
||||
|
||||
// Finding data
|
||||
status_t FindRect(const char *name, BRect *rect) const;
|
||||
status_t FindRect(const char *name, int32 index, BRect *rect) const;
|
||||
status_t FindPoint(const char *name, BPoint *pt) const;
|
||||
status_t FindPoint(const char *name, int32 index, BPoint *pt) const;
|
||||
status_t FindString(const char *name, const char **str) const;
|
||||
status_t FindString(const char *name, int32 index, const char **str) const;
|
||||
status_t FindString(const char *name, BString *str) const;
|
||||
status_t FindString(const char *name, int32 index, BString *str) const;
|
||||
status_t FindInt8(const char *name, int8 *value) const;
|
||||
status_t FindInt8(const char *name, int32 index, int8 *val) const;
|
||||
status_t FindInt16(const char *name, int16 *value) const;
|
||||
status_t FindInt16(const char *name, int32 index, int16 *val) const;
|
||||
status_t FindInt32(const char *name, int32 *value) const;
|
||||
status_t FindInt32(const char *name, int32 index, int32 *val) const;
|
||||
status_t FindInt64(const char *name, int64 *value) const;
|
||||
status_t FindInt64(const char *name, int32 index, int64 *val) const;
|
||||
status_t FindBool(const char *name, bool *value) const;
|
||||
status_t FindBool(const char *name, int32 index, bool *value) const;
|
||||
status_t FindFloat(const char *name, float *f) const;
|
||||
status_t FindFloat(const char *name, int32 index, float *f) const;
|
||||
status_t FindDouble(const char *name, double *d) const;
|
||||
status_t FindDouble(const char *name, int32 index, double *d) const;
|
||||
status_t FindPointer(const char *name, void **ptr) const;
|
||||
status_t FindPointer(const char *name, int32 index, void **ptr) const;
|
||||
status_t FindMessenger(const char *name, BMessenger *m) const;
|
||||
status_t FindMessenger(const char *name, int32 index, BMessenger *m) const;
|
||||
status_t FindRef(const char *name, entry_ref *ref) const;
|
||||
status_t FindRef(const char *name, int32 index, entry_ref *ref) const;
|
||||
status_t FindMessage(const char *name, BMessage *msg) const;
|
||||
status_t FindMessage(const char *name, int32 index, BMessage *msg) const;
|
||||
status_t FindFlat(const char *name, BFlattenable *obj) const;
|
||||
status_t FindFlat(const char *name, int32 index, BFlattenable *obj) const;
|
||||
status_t FindData(const char *name, type_code type,
|
||||
const void **data, ssize_t *numBytes) const;
|
||||
status_t FindData(const char *name, type_code type, int32 index,
|
||||
const void **data, ssize_t *numBytes) const;
|
||||
|
||||
// Replacing data
|
||||
status_t ReplaceRect(const char *name, BRect a_rect);
|
||||
status_t ReplaceRect(const char *name, int32 index, BRect a_rect);
|
||||
status_t ReplacePoint(const char *name, BPoint a_point);
|
||||
status_t ReplacePoint(const char *name, int32 index, BPoint a_point);
|
||||
status_t ReplaceString(const char *name, const char *string);
|
||||
status_t ReplaceString(const char *name, int32 index, const char *string);
|
||||
status_t ReplaceString(const char *name, const BString& string);
|
||||
status_t ReplaceString(const char *name, int32 index, const BString& string);
|
||||
status_t ReplaceInt8(const char *name, int8 val);
|
||||
status_t ReplaceInt8(const char *name, int32 index, int8 val);
|
||||
status_t ReplaceInt16(const char *name, int16 val);
|
||||
status_t ReplaceInt16(const char *name, int32 index, int16 val);
|
||||
status_t ReplaceInt32(const char *name, int32 val);
|
||||
status_t ReplaceInt32(const char *name, int32 index, int32 val);
|
||||
status_t ReplaceInt64(const char *name, int64 val);
|
||||
status_t ReplaceInt64(const char *name, int32 index, int64 val);
|
||||
status_t ReplaceBool(const char *name, bool a_bool);
|
||||
status_t ReplaceBool(const char *name, int32 index, bool a_bool);
|
||||
status_t ReplaceFloat(const char *name, float a_float);
|
||||
status_t ReplaceFloat(const char *name, int32 index, float a_float);
|
||||
status_t ReplaceDouble(const char *name, double a_double);
|
||||
status_t ReplaceDouble(const char *name, int32 index, double a_double);
|
||||
status_t ReplacePointer(const char *name, const void *ptr);
|
||||
status_t ReplacePointer(const char *name,int32 index,const void *ptr);
|
||||
status_t ReplaceMessenger(const char *name, BMessenger messenger);
|
||||
status_t ReplaceMessenger(const char *name, int32 index, BMessenger msngr);
|
||||
status_t ReplaceRef( const char *name,const entry_ref *ref);
|
||||
status_t ReplaceRef( const char *name, int32 index, const entry_ref *ref);
|
||||
status_t ReplaceMessage(const char *name, const BMessage *msg);
|
||||
status_t ReplaceMessage(const char *name, int32 index, const BMessage *msg);
|
||||
status_t ReplaceFlat(const char *name, BFlattenable *obj);
|
||||
status_t ReplaceFlat(const char *name, int32 index, BFlattenable *obj);
|
||||
status_t ReplaceData(const char *name, type_code type,
|
||||
const void *data, ssize_t data_size);
|
||||
status_t ReplaceData(const char *name, type_code type, int32 index,
|
||||
const void *data, ssize_t data_size);
|
||||
|
||||
void *operator new(size_t size);
|
||||
void *operator new(size_t, void* p);
|
||||
void operator delete(void *ptr, size_t size);
|
||||
|
||||
// Private, reserved, or obsolete ----------------------------------------------
|
||||
bool HasRect(const char *, int32 n = 0) const;
|
||||
bool HasPoint(const char *, int32 n = 0) const;
|
||||
bool HasString(const char *, int32 n = 0) const;
|
||||
bool HasInt8(const char *, int32 n = 0) const;
|
||||
bool HasInt16(const char *, int32 n = 0) const;
|
||||
bool HasInt32(const char *, int32 n = 0) const;
|
||||
bool HasInt64(const char *, int32 n = 0) const;
|
||||
bool HasBool(const char *, int32 n = 0) const;
|
||||
bool HasFloat(const char *, int32 n = 0) const;
|
||||
bool HasDouble(const char *, int32 n = 0) const;
|
||||
bool HasPointer(const char *, int32 n = 0) const;
|
||||
bool HasMessenger(const char *, int32 n = 0) const;
|
||||
bool HasRef(const char *, int32 n = 0) const;
|
||||
bool HasMessage(const char *, int32 n = 0) const;
|
||||
bool HasFlat(const char *, const BFlattenable *) const;
|
||||
bool HasFlat(const char *,int32 ,const BFlattenable *) const;
|
||||
bool HasData(const char *, type_code , int32 n = 0) const;
|
||||
BRect FindRect(const char *, int32 n = 0) const;
|
||||
BPoint FindPoint(const char *, int32 n = 0) const;
|
||||
const char *FindString(const char *, int32 n = 0) const;
|
||||
int8 FindInt8(const char *, int32 n = 0) const;
|
||||
int16 FindInt16(const char *, int32 n = 0) const;
|
||||
int32 FindInt32(const char *, int32 n = 0) const;
|
||||
int64 FindInt64(const char *, int32 n = 0) const;
|
||||
bool FindBool(const char *, int32 n = 0) const;
|
||||
float FindFloat(const char *, int32 n = 0) const;
|
||||
double FindDouble(const char *, int32 n = 0) const;
|
||||
|
||||
class Private;
|
||||
|
||||
private:
|
||||
class Header;
|
||||
|
||||
friend class BMessageQueue;
|
||||
friend class BMessenger;
|
||||
friend class BApplication;
|
||||
friend class Header;
|
||||
friend class Private;
|
||||
|
||||
friend inline void _set_message_target_(BMessage *, int32, bool);
|
||||
friend inline void _set_message_reply_(BMessage *, BMessenger);
|
||||
friend inline int32 _get_message_target_(BMessage *);
|
||||
friend inline bool _use_preferred_target_(BMessage *);
|
||||
|
||||
// deprecated
|
||||
BMessage(BMessage *a_message);
|
||||
|
||||
virtual void _ReservedMessage1();
|
||||
virtual void _ReservedMessage2();
|
||||
virtual void _ReservedMessage3();
|
||||
|
||||
void init_data();
|
||||
status_t flatten_target_info(BDataIO *stream,
|
||||
ssize_t size,
|
||||
uchar flags) const;
|
||||
status_t real_flatten(char *result,
|
||||
ssize_t size) const;
|
||||
status_t real_flatten(BDataIO *stream) const;
|
||||
char *stack_flatten(char *stack_ptr,
|
||||
ssize_t stack_size,
|
||||
bool incl_reply,
|
||||
ssize_t *size = NULL) const;
|
||||
|
||||
ssize_t calc_size(uchar flags) const;
|
||||
ssize_t calc_hdr_size(uchar flags) const;
|
||||
status_t nfind_data( const char *name,
|
||||
type_code type,
|
||||
int32 index,
|
||||
const void **data,
|
||||
ssize_t *data_size) const;
|
||||
status_t copy_data( const char *name,
|
||||
type_code type,
|
||||
int32 index,
|
||||
void *data,
|
||||
ssize_t data_size) const;
|
||||
|
||||
static void _StaticInit();
|
||||
static void _StaticCleanup();
|
||||
static void _StaticCacheCleanup();
|
||||
|
||||
static BBlockCache *sMsgCache;
|
||||
|
||||
struct dyn_array {
|
||||
int32 fLogicalBytes;
|
||||
int32 fPhysicalBytes;
|
||||
int32 fChunkSize;
|
||||
int32 fCount;
|
||||
int32 fEntryHdrSize;
|
||||
};
|
||||
|
||||
struct entry_hdr : public dyn_array {
|
||||
entry_hdr *fNext;
|
||||
uint32 fType;
|
||||
uchar fNameLength;
|
||||
char fName[1];
|
||||
};
|
||||
|
||||
struct var_chunk {
|
||||
int32 fDataSize;
|
||||
char fData[1];
|
||||
};
|
||||
|
||||
entry_hdr *entry_find(const char *name, uint32 type,status_t *result=NULL) const;
|
||||
void entry_remove(entry_hdr *entry);
|
||||
|
||||
void *da_create(int32 header_size, int32 chunk_size,
|
||||
bool fixed, int32 nchunks);
|
||||
status_t da_add_data(dyn_array **da, const void *data, int32 size);
|
||||
void *da_find_data(dyn_array *da, int32 index,
|
||||
int32 *size = NULL) const;
|
||||
status_t da_delete_data(dyn_array **pda, int32 index);
|
||||
status_t da_replace_data(dyn_array **pda, int32 index,
|
||||
const void *data, int32 dsize);
|
||||
int32 da_calc_size(int32 hdr_size, int32 chunksize,
|
||||
bool is_fixed, int32 nchunks) const;
|
||||
void *da_grow(dyn_array **pda, int32 increase);
|
||||
void da_dump(dyn_array *da);
|
||||
|
||||
int32 da_chunk_hdr_size() const
|
||||
{ return sizeof(int32); }
|
||||
int32 da_chunk_size(var_chunk *v) const
|
||||
{ return (v->fDataSize + da_chunk_hdr_size() + 7) & ~7; }
|
||||
var_chunk *da_first_chunk(dyn_array *da) const
|
||||
{ return (var_chunk *) da_start_of_data(da); }
|
||||
var_chunk *da_next_chunk(var_chunk *v) const
|
||||
{ return (var_chunk *) (((char*) v) + da_chunk_size(v)); }
|
||||
var_chunk *da_chunk_ptr(void *data) const
|
||||
{ return (var_chunk*) (((char *) data) - da_chunk_hdr_size()); }
|
||||
|
||||
int32 da_pad_8(int32 val) const
|
||||
{ return (val + 7) & ~7; }
|
||||
int32 da_total_size(dyn_array *da) const
|
||||
{ return (int32)sizeof(dyn_array) + da->fEntryHdrSize +
|
||||
da->fPhysicalBytes; }
|
||||
int32 da_total_logical_size(dyn_array *da) const
|
||||
{ return (int32)sizeof(dyn_array) + da->fEntryHdrSize +
|
||||
da->fLogicalBytes; }
|
||||
char *da_start_of_data(dyn_array *da) const
|
||||
{ return ((char *) da) + (sizeof(dyn_array) +
|
||||
da->fEntryHdrSize); }
|
||||
bool da_is_mini_data(dyn_array *da) const
|
||||
{ return ((da->fLogicalBytes <= (int32) UCHAR_MAX) &&
|
||||
(da->fCount <= (int32) UCHAR_MAX));}
|
||||
void da_swap_var_sized(dyn_array *da);
|
||||
void da_swap_fixed_sized(dyn_array *da);
|
||||
|
||||
BMessage *link;
|
||||
int32 fTarget;
|
||||
BMessage *fOriginal;
|
||||
uint32 fChangeCount;
|
||||
int32 fCurSpecifier;
|
||||
uint32 fPtrOffset;
|
||||
|
||||
// ejaesler: Stealing one for my whacky BMessageBody l33tness
|
||||
uint32 _reserved[2];
|
||||
BPrivate::BMessageBody* fBody;
|
||||
|
||||
BMessage::entry_hdr *fEntries;
|
||||
|
||||
struct reply_to_info {
|
||||
port_id port;
|
||||
int32 target;
|
||||
team_id team;
|
||||
bool preferred;
|
||||
} fReplyTo;
|
||||
|
||||
bool fPreferred;
|
||||
bool fReplyRequired;
|
||||
bool fReplyDone;
|
||||
bool fIsReply;
|
||||
bool fWasDelivered;
|
||||
bool fReadOnly;
|
||||
bool fHasSpecifiers;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _MESSAGE_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
126
headers/build/os/app/MessageFilter.h
Normal file
126
headers/build/os/app/MessageFilter.h
Normal file
@ -0,0 +1,126 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: MessageFilter.h
|
||||
// Author: Erik Jaesler (erik@cgsoftware.com)
|
||||
// Description: BMessageFilter class creates objects that filter
|
||||
// in-coming BMessages.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MESSAGE_FILTER_H
|
||||
#define _MESSAGE_FILTER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Handler.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BMessage;
|
||||
|
||||
// filter_hook Return Codes and Protocol ---------------------------------------
|
||||
enum filter_result {
|
||||
B_SKIP_MESSAGE,
|
||||
B_DISPATCH_MESSAGE
|
||||
};
|
||||
|
||||
typedef filter_result (*filter_hook)
|
||||
(BMessage* message, BHandler** target, BMessageFilter* filter);
|
||||
|
||||
|
||||
// BMessageFilter invocation criteria ------------------------------------------
|
||||
enum message_delivery {
|
||||
B_ANY_DELIVERY,
|
||||
B_DROPPED_DELIVERY,
|
||||
B_PROGRAMMED_DELIVERY
|
||||
};
|
||||
|
||||
enum message_source {
|
||||
B_ANY_SOURCE,
|
||||
B_REMOTE_SOURCE,
|
||||
B_LOCAL_SOURCE
|
||||
};
|
||||
|
||||
// BMessageFilter Class --------------------------------------------------------
|
||||
class BMessageFilter {
|
||||
|
||||
public:
|
||||
BMessageFilter( uint32 what,
|
||||
filter_hook func = NULL);
|
||||
BMessageFilter( message_delivery delivery,
|
||||
message_source source,
|
||||
filter_hook func = NULL);
|
||||
BMessageFilter( message_delivery delivery,
|
||||
message_source source,
|
||||
uint32 what,
|
||||
filter_hook func = NULL);
|
||||
BMessageFilter(const BMessageFilter& filter);
|
||||
BMessageFilter(const BMessageFilter* filter);
|
||||
virtual ~BMessageFilter();
|
||||
|
||||
BMessageFilter &operator=(const BMessageFilter& from);
|
||||
|
||||
// Hook function; ignored if filter_hook is non-NULL
|
||||
virtual filter_result Filter(BMessage* message, BHandler** target);
|
||||
|
||||
message_delivery MessageDelivery() const;
|
||||
message_source MessageSource() const;
|
||||
uint32 Command() const;
|
||||
bool FiltersAnyCommand() const;
|
||||
BLooper *Looper() const;
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
private:
|
||||
friend class BLooper;
|
||||
friend class BHandler;
|
||||
|
||||
virtual void _ReservedMessageFilter1();
|
||||
virtual void _ReservedMessageFilter2();
|
||||
|
||||
void SetLooper(BLooper* owner);
|
||||
filter_hook FilterFunction() const;
|
||||
bool fFiltersAny;
|
||||
uint32 what;
|
||||
message_delivery fDelivery;
|
||||
message_source fSource;
|
||||
BLooper *fLooper;
|
||||
filter_hook fFilterFunction;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _MESSAGE_FILTER_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
65
headers/build/os/app/MessageQueue.h
Normal file
65
headers/build/os/app/MessageQueue.h
Normal file
@ -0,0 +1,65 @@
|
||||
//
|
||||
// $Id: MessageQueue.h 1686 2002-10-26 18:59:16Z beveloper $
|
||||
//
|
||||
// This is the BMessageQueue interface for OpenBeOS. It has been created
|
||||
// to be source and binary compatible with the BeOS version of
|
||||
// BMessageQueue.
|
||||
//
|
||||
|
||||
|
||||
#ifndef _OPENBEOS_MESSAGEQUEUE_H
|
||||
#define _OPENBEOS_MESSAGEQUEUE_H
|
||||
|
||||
|
||||
#include <Locker.h>
|
||||
#include <Message.h> /* For convenience */
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BMessageQueue {
|
||||
public:
|
||||
BMessageQueue();
|
||||
virtual ~BMessageQueue();
|
||||
|
||||
void AddMessage(BMessage *message);
|
||||
void RemoveMessage(BMessage *message);
|
||||
|
||||
int32 CountMessages(void) const;
|
||||
bool IsEmpty(void) const;
|
||||
|
||||
BMessage *FindMessage(int32 index) const;
|
||||
BMessage *FindMessage(uint32 what, int32 index=0) const;
|
||||
|
||||
bool Lock(void);
|
||||
void Unlock(void);
|
||||
bool IsLocked(void);
|
||||
|
||||
BMessage *NextMessage(void);
|
||||
|
||||
private:
|
||||
|
||||
// Reserved space in the vtable for future changes to BMessageQueue
|
||||
virtual void _ReservedMessageQueue1(void);
|
||||
virtual void _ReservedMessageQueue2(void);
|
||||
virtual void _ReservedMessageQueue3(void);
|
||||
|
||||
BMessageQueue(const BMessageQueue &);
|
||||
BMessageQueue &operator=(const BMessageQueue &);
|
||||
|
||||
BMessage *fTheQueue;
|
||||
BMessage *fQueueTail;
|
||||
int32 fMessageCount;
|
||||
BLocker fLocker;
|
||||
|
||||
// Reserved space for future changes to BMessageQueue
|
||||
uint32 fReservedSpace[3];
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _OPENBEOS_MESSAGEQUEUE_H
|
67
headers/build/os/app/MessageRunner.h
Normal file
67
headers/build/os/app/MessageRunner.h
Normal file
@ -0,0 +1,67 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: MessageRunner.h
|
||||
// Author: Ingo Weinhold (bonefish@users.sf.net)
|
||||
// Description: A BMessageRunner periodically sends a message to a
|
||||
// specified target.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _MESSAGE_RUNNER_H
|
||||
#define _MESSAGE_RUNNER_H
|
||||
|
||||
#include <Messenger.h>
|
||||
|
||||
class BMessageRunner {
|
||||
public:
|
||||
BMessageRunner(BMessenger target, const BMessage *message,
|
||||
bigtime_t interval, int32 count = -1);
|
||||
BMessageRunner(BMessenger target, const BMessage *message,
|
||||
bigtime_t interval, int32 count, BMessenger replyTo);
|
||||
virtual ~BMessageRunner();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetInterval(bigtime_t interval);
|
||||
status_t SetCount(int32 count);
|
||||
status_t GetInfo(bigtime_t *interval, int32 *count) const;
|
||||
|
||||
|
||||
private:
|
||||
BMessageRunner(const BMessageRunner &);
|
||||
BMessageRunner &operator=(const BMessageRunner &);
|
||||
|
||||
void InitData(BMessenger target, const BMessage *message,
|
||||
bigtime_t interval, int32 count, BMessenger replyTo);
|
||||
status_t SetParams(bool resetInterval, bigtime_t interval, bool resetCount,
|
||||
int32 count);
|
||||
|
||||
virtual void _ReservedMessageRunner1();
|
||||
virtual void _ReservedMessageRunner2();
|
||||
virtual void _ReservedMessageRunner3();
|
||||
virtual void _ReservedMessageRunner4();
|
||||
virtual void _ReservedMessageRunner5();
|
||||
virtual void _ReservedMessageRunner6();
|
||||
|
||||
int32 fToken;
|
||||
uint32 _reserved[6];
|
||||
};
|
||||
|
||||
#endif // _MESSAGE_RUNNER_H
|
88
headers/build/os/app/Messenger.h
Normal file
88
headers/build/os/app/Messenger.h
Normal file
@ -0,0 +1,88 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Messenger.h
|
||||
// Author: Ingo Weinhold (bonefish@users.sf.net)
|
||||
// Description: BMessenger delivers messages to local or remote targets.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MESSENGER_H
|
||||
#define _MESSENGER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <OS.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <Message.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BHandler;
|
||||
class BLooper;
|
||||
|
||||
// BMessenger class ------------------------------------------------------------
|
||||
class BMessenger {
|
||||
public:
|
||||
BMessenger();
|
||||
BMessenger(const BMessenger &from);
|
||||
~BMessenger();
|
||||
|
||||
// Operators and misc
|
||||
|
||||
BMessenger &operator=(const BMessenger &from);
|
||||
bool operator==(const BMessenger &other) const;
|
||||
|
||||
bool IsValid() const;
|
||||
team_id Team() const;
|
||||
|
||||
//----- Private or reserved -----------------------------------------
|
||||
|
||||
class Private;
|
||||
|
||||
private:
|
||||
friend class Private;
|
||||
|
||||
void SetTo(team_id team, port_id port, int32 token, bool preferred);
|
||||
|
||||
private:
|
||||
port_id fPort;
|
||||
int32 fHandlerToken;
|
||||
team_id fTeam;
|
||||
int32 extra0;
|
||||
int32 extra1;
|
||||
bool fPreferredTarget;
|
||||
bool extra2;
|
||||
bool extra3;
|
||||
bool extra4;
|
||||
};
|
||||
|
||||
_IMPEXP_BE bool operator<(const BMessenger &a, const BMessenger &b);
|
||||
_IMPEXP_BE bool operator!=(const BMessenger &a, const BMessenger &b);
|
||||
|
||||
#endif // _MESSENGER_H
|
152
headers/build/os/app/PropertyInfo.h
Normal file
152
headers/build/os/app/PropertyInfo.h
Normal file
@ -0,0 +1,152 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: PropertyInfo.h
|
||||
/
|
||||
/ Description: Utility class for maintain scripting information
|
||||
/
|
||||
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
|
||||
/ Modified for use with OpenBeOS.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _PROPERTY_INFO_H
|
||||
#define _PROPERTY_INFO_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Flattenable.h>
|
||||
#include <TypeConstants.h> /* For convenience */
|
||||
|
||||
/*
|
||||
* The following define is used to turn off a number of member functions
|
||||
* and member variables in BPropertyInfo which are only there to faciliate
|
||||
* BeOS R3 compatibility. Be changed the property_info structure between
|
||||
* R3 and R4 and these functions ensure that BPropertyInfo is backward
|
||||
* compatible. However, between R3 and R4, Be changed the Intel executable
|
||||
* format so R4 was not backward compatible with R3.
|
||||
*
|
||||
* Because OpenBeOS is only targetting Intel platform compatibility at this
|
||||
* time, there is no need for R3 compatibility in OpenBeOS. By default
|
||||
* these members will be turned off with the R3_COMPATIBLE define.
|
||||
*/
|
||||
#undef R3_COMPATIBLE
|
||||
|
||||
#ifdef R3_COMPATIBLE
|
||||
struct _oproperty_info_;
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- the property_info structure ------------------------------*/
|
||||
|
||||
struct compound_type {
|
||||
struct field_pair {
|
||||
char *name; // name of entry in message
|
||||
type_code type; // type_code of entry in message
|
||||
};
|
||||
field_pair pairs[5];
|
||||
};
|
||||
|
||||
struct property_info {
|
||||
char *name;
|
||||
uint32 commands[10];
|
||||
uint32 specifiers[10];
|
||||
char *usage;
|
||||
uint32 extra_data;
|
||||
uint32 types[10];
|
||||
compound_type ctypes[3];
|
||||
uint32 _reserved[10];
|
||||
};
|
||||
|
||||
enum value_kind {
|
||||
B_COMMAND_KIND = 0,
|
||||
B_TYPE_CODE_KIND = 1
|
||||
};
|
||||
|
||||
struct value_info {
|
||||
char *name;
|
||||
uint32 value;
|
||||
value_kind kind;
|
||||
char *usage;
|
||||
uint32 extra_data;
|
||||
uint32 _reserved[10];
|
||||
};
|
||||
|
||||
#define B_PROPERTY_INFO_TYPE 'SCTD'
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BPropertyInfo class --------------------------------------*/
|
||||
|
||||
class BPropertyInfo : public BFlattenable {
|
||||
public:
|
||||
BPropertyInfo(property_info *p = NULL,
|
||||
value_info *ci = NULL,
|
||||
bool free_on_delete = false);
|
||||
virtual ~BPropertyInfo();
|
||||
|
||||
virtual int32 FindMatch(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *spec,
|
||||
int32 form,
|
||||
const char *prop,
|
||||
void *data = NULL) const;
|
||||
|
||||
virtual bool IsFixedSize() const;
|
||||
virtual type_code TypeCode() const;
|
||||
virtual ssize_t FlattenedSize() const;
|
||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
||||
virtual bool AllowsTypeCode(type_code code) const;
|
||||
virtual status_t Unflatten(type_code c,
|
||||
const void *buf,
|
||||
ssize_t s);
|
||||
const property_info *Properties() const;
|
||||
const value_info *Values() const;
|
||||
int32 CountProperties() const;
|
||||
int32 CountValues() const;
|
||||
|
||||
void PrintToStream() const;
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
protected:
|
||||
static bool FindCommand(uint32, int32, property_info *);
|
||||
static bool FindSpecifier(uint32, property_info *);
|
||||
|
||||
private:
|
||||
virtual void _ReservedPropertyInfo1();
|
||||
virtual void _ReservedPropertyInfo2();
|
||||
virtual void _ReservedPropertyInfo3();
|
||||
virtual void _ReservedPropertyInfo4();
|
||||
|
||||
BPropertyInfo(const BPropertyInfo &);
|
||||
BPropertyInfo &operator=(const BPropertyInfo &);
|
||||
void FreeMem();
|
||||
|
||||
property_info *fPropInfo;
|
||||
value_info *fValueInfo;
|
||||
int32 fPropCount;
|
||||
bool fInHeap;
|
||||
uint16 fValueCount;
|
||||
#ifndef R3_COMPATIBLE
|
||||
uint32 _reserved[4];
|
||||
#else
|
||||
_oproperty_info_ *fOldPropInfo;
|
||||
bool fOldInHeap;
|
||||
uint32 _reserved[2]; /* was 4 */
|
||||
|
||||
/* Deprecated */
|
||||
private:
|
||||
static property_info *ConvertToNew(const _oproperty_info_ *p);
|
||||
static _oproperty_info_ *ConvertFromNew(const property_info *p);
|
||||
const property_info *PropertyInfo() const;
|
||||
BPropertyInfo(property_info *p,
|
||||
bool free_on_delete);
|
||||
static bool MatchCommand(uint32, int32, property_info *);
|
||||
static bool MatchSpecifier(uint32, property_info *);
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _PROPERTY_INFO_H */
|
198
headers/build/os/app/Roster.h
Normal file
198
headers/build/os/app/Roster.h
Normal file
@ -0,0 +1,198 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Roster.h
|
||||
// Author: Ingo Weinhold (bonefish@users.sf.net)
|
||||
// Description: BRoster class lets you launch apps and keeps
|
||||
// track of apps that are running.
|
||||
// Global be_roster represents the default BRoster.
|
||||
// app_info structure provides info for a running app.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _ROSTER_H
|
||||
#define _ROSTER_H
|
||||
|
||||
#include <Entry.h>
|
||||
#include <Messenger.h>
|
||||
#include <OS.h>
|
||||
|
||||
// app_info
|
||||
struct app_info {
|
||||
app_info();
|
||||
~app_info();
|
||||
|
||||
thread_id thread;
|
||||
team_id team;
|
||||
port_id port;
|
||||
uint32 flags;
|
||||
entry_ref ref;
|
||||
char signature[B_MIME_TYPE_LENGTH];
|
||||
};
|
||||
|
||||
// app flags
|
||||
#define B_SINGLE_LAUNCH (0x0)
|
||||
#define B_MULTIPLE_LAUNCH (0x1)
|
||||
#define B_EXCLUSIVE_LAUNCH (0x2)
|
||||
#define B_LAUNCH_MASK (0x3)
|
||||
#define B_BACKGROUND_APP (0x4)
|
||||
#define B_ARGV_ONLY (0x8)
|
||||
#define _B_APP_INFO_RESERVED1_ (0x10000000)
|
||||
|
||||
// watching request flags
|
||||
enum {
|
||||
B_REQUEST_LAUNCHED = 0x00000001,
|
||||
B_REQUEST_QUIT = 0x00000002,
|
||||
B_REQUEST_ACTIVATED = 0x00000004,
|
||||
};
|
||||
|
||||
// notification message "what"
|
||||
enum {
|
||||
B_SOME_APP_LAUNCHED = 'BRAS',
|
||||
B_SOME_APP_QUIT = 'BRAQ',
|
||||
B_SOME_APP_ACTIVATED = 'BRAW',
|
||||
};
|
||||
|
||||
class BList;
|
||||
|
||||
// BRoster
|
||||
class BRoster {
|
||||
public:
|
||||
BRoster();
|
||||
~BRoster();
|
||||
|
||||
// running apps
|
||||
bool IsRunning(const char *mimeSig) const;
|
||||
bool IsRunning(entry_ref *ref) const;
|
||||
team_id TeamFor(const char *mimeSig) const;
|
||||
team_id TeamFor(entry_ref *ref) const;
|
||||
void GetAppList(BList *teamIDList) const;
|
||||
void GetAppList(const char *sig, BList *teamIDList) const;
|
||||
|
||||
// app infos
|
||||
status_t GetAppInfo(const char *sig, app_info *info) const;
|
||||
status_t GetAppInfo(entry_ref *ref, app_info *info) const;
|
||||
status_t GetRunningAppInfo(team_id team, app_info *info) const;
|
||||
status_t GetActiveAppInfo(app_info *info) const;
|
||||
|
||||
// find app
|
||||
status_t FindApp(const char *mimeType, entry_ref *app) const;
|
||||
status_t FindApp(entry_ref *ref, entry_ref *app) const;
|
||||
|
||||
// broadcast
|
||||
status_t Broadcast(BMessage *message) const;
|
||||
status_t Broadcast(BMessage *message, BMessenger replyTo) const;
|
||||
|
||||
// watching
|
||||
status_t StartWatching(BMessenger target,
|
||||
uint32 eventMask = B_REQUEST_LAUNCHED
|
||||
| B_REQUEST_QUIT) const;
|
||||
status_t StopWatching(BMessenger target) const;
|
||||
|
||||
status_t ActivateApp(team_id team) const;
|
||||
|
||||
// launch app
|
||||
status_t Launch(const char *mimeType, BMessage *initialMessage = 0,
|
||||
team_id *appTeam = 0) const;
|
||||
status_t Launch(const char *mimeType, BList *messageList,
|
||||
team_id *appTeam = 0) const;
|
||||
status_t Launch(const char *mimeType, int argc, char **args,
|
||||
team_id *appTeam = 0) const;
|
||||
status_t Launch(const entry_ref *ref, const BMessage *initialMessage = 0,
|
||||
team_id *appTeam = 0) const;
|
||||
status_t Launch(const entry_ref *ref, const BList *messageList,
|
||||
team_id *appTeam = 0) const;
|
||||
status_t Launch(const entry_ref *ref, int argc, const char * const *args,
|
||||
team_id *appTeam = 0) const;
|
||||
|
||||
// recent documents, folders, apps
|
||||
void GetRecentDocuments(BMessage *refList, int32 maxCount,
|
||||
const char *fileType = 0,
|
||||
const char *appSig = 0) const;
|
||||
void GetRecentDocuments(BMessage *refList, int32 maxCount,
|
||||
const char *fileTypes[], int32 fileTypesCount,
|
||||
const char *appSig = 0) const;
|
||||
void GetRecentFolders(BMessage *refList, int32 maxCount,
|
||||
const char *appSig = 0) const;
|
||||
void GetRecentApps(BMessage *refList, int32 maxCount) const;
|
||||
void AddToRecentDocuments(const entry_ref *doc,
|
||||
const char *appSig = 0) const;
|
||||
void AddToRecentFolders(const entry_ref *folder,
|
||||
const char *appSig = 0) const;
|
||||
|
||||
// private/reserved stuff starts here
|
||||
class Private;
|
||||
|
||||
private:
|
||||
class ArgVector;
|
||||
friend class Private;
|
||||
|
||||
status_t ShutDown(bool reboot, bool confirm, bool synchronous);
|
||||
|
||||
status_t AddApplication(const char *mimeSig, const entry_ref *ref,
|
||||
uint32 flags, team_id team, thread_id thread,
|
||||
port_id port, bool fullReg, uint32 *pToken,
|
||||
team_id *otherTeam) const;
|
||||
status_t SetSignature(team_id team, const char *mimeSig) const;
|
||||
void SetThread(team_id team, thread_id thread) const;
|
||||
status_t SetThreadAndTeam(uint32 entryToken, thread_id thread,
|
||||
team_id team) const;
|
||||
status_t CompleteRegistration(team_id team, thread_id thread,
|
||||
port_id port) const;
|
||||
bool IsAppPreRegistered(const entry_ref *ref, team_id team,
|
||||
app_info *info) const;
|
||||
status_t RemovePreRegApp(uint32 entryToken) const;
|
||||
status_t RemoveApp(team_id team) const;
|
||||
status_t xLaunchAppPrivate(const char *mimeType, const entry_ref *ref,
|
||||
const BList *messageList, int argc,
|
||||
const char *const *args,
|
||||
team_id *appTeam) const;
|
||||
bool UpdateActiveApp(team_id team) const;
|
||||
void SetAppFlags(team_id team, uint32 flags) const;
|
||||
void DumpRoster() const;
|
||||
status_t resolve_app(const char *inType, entry_ref *ref, entry_ref *appRef,
|
||||
char *appSig, uint32 *appFlags,
|
||||
bool *wasDocument) const;
|
||||
status_t translate_ref(entry_ref *ref, BMimeType *appMeta,
|
||||
entry_ref *appRef, BFile *appFile,
|
||||
bool *wasDocument) const;
|
||||
status_t translate_type(const char *mimeType, BMimeType *appMeta,
|
||||
entry_ref *appRef, BFile *appFile) const;
|
||||
status_t sniff_file(const entry_ref *file, BNodeInfo *nodeInfo,
|
||||
char *mimeType) const;
|
||||
status_t send_to_running(team_id team, int argc, const char *const *args,
|
||||
const BList *messageList, const entry_ref *ref,
|
||||
bool readyToRun) const;
|
||||
void InitMessengers();
|
||||
void AddToRecentApps(const char *appSig) const;
|
||||
void ClearRecentDocuments() const;
|
||||
void ClearRecentFolders() const;
|
||||
void ClearRecentApps() const;
|
||||
void LoadRecentLists(const char *filename) const;
|
||||
void SaveRecentLists(const char *filename) const;
|
||||
|
||||
BMessenger fMess;
|
||||
BMessenger fMimeMess;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
// global BRoster instance
|
||||
extern const BRoster *be_roster;
|
||||
|
||||
#endif // _ROSTER_H
|
12
headers/build/os/arch/ppc/arch_debugger.h
Normal file
12
headers/build/os/arch/ppc/arch_debugger.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ARCH_PPC_DEBUGGER_H
|
||||
#define _ARCH_PPC_DEBUGGER_H
|
||||
|
||||
struct debug_cpu_state {
|
||||
uint32 dummy;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
#endif // _ARCH_PPC_DEBUGGER_H
|
32
headers/build/os/arch/x86/arch_debugger.h
Normal file
32
headers/build/os/arch/x86/arch_debugger.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ARCH_X86_DEBUGGER_H
|
||||
#define _ARCH_X86_DEBUGGER_H
|
||||
|
||||
struct debug_cpu_state {
|
||||
uint8 extended_regs[512];
|
||||
|
||||
uint32 gs;
|
||||
uint32 fs;
|
||||
uint32 es;
|
||||
uint32 ds;
|
||||
uint32 edi;
|
||||
uint32 esi;
|
||||
uint32 ebp;
|
||||
uint32 esp;
|
||||
uint32 ebx;
|
||||
uint32 edx;
|
||||
uint32 ecx;
|
||||
uint32 eax;
|
||||
uint32 vector;
|
||||
uint32 error_code;
|
||||
uint32 eip;
|
||||
uint32 cs;
|
||||
uint32 eflags;
|
||||
uint32 user_esp;
|
||||
uint32 user_ss;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
#endif // _ARCH_X86_DEBUGGER_H
|
6
headers/build/os/be_apps/Deskbar/Deskbar.h
Normal file
6
headers/build/os/be_apps/Deskbar/Deskbar.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _DESKBAR_H
|
||||
// I don't know why this file exists in addition to the one we include
|
||||
// below, but who cares... (originally, in R5, both files exist and are
|
||||
// identical).
|
||||
# include <interface/Deskbar.h>
|
||||
#endif
|
51
headers/build/os/be_apps/NetPositive/NetPositive.h
Normal file
51
headers/build/os/be_apps/NetPositive/NetPositive.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: NetPositive.h
|
||||
/
|
||||
/ Description: Defines all public APIs for communicating with NetPositive
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _NETPOSITIVE_H
|
||||
#define _NETPOSITIVE_H
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- message command constants -------------------------------*/
|
||||
|
||||
enum {
|
||||
/* Can be sent to the NetPositive application, a window, or a replicant */
|
||||
/* view. Put the URL in a String field named be:url */
|
||||
B_NETPOSITIVE_OPEN_URL = 'NPOP',
|
||||
|
||||
/* Can be sent to a window or replicant view */
|
||||
B_NETPOSITIVE_BACK = 'NPBK',
|
||||
B_NETPOSITIVE_FORWARD = 'NPFW',
|
||||
B_NETPOSITIVE_HOME = 'NPHM',
|
||||
B_NETPOSITIVE_RELOAD = 'NPRL',
|
||||
B_NETPOSITIVE_STOP = 'NPST',
|
||||
B_NETPOSITIVE_DOWN = 'NPDN',
|
||||
B_NETPOSITIVE_UP = 'NPUP'
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- NetPositive-related MIME types --------------------------*/
|
||||
|
||||
/* The MIME types for the NetPositive application and its bookmark files */
|
||||
#define B_NETPOSITIVE_APP_SIGNATURE "application/x-vnd.Be-NPOS"
|
||||
#define B_NETPOSITIVE_BOOKMARK_SIGNATURE "application/x-vnd.Be-bookmark"
|
||||
|
||||
/* To set up your application to receive notification when the user */
|
||||
/* clicks on a specific type of URL (telnet URL's, for example), see the */
|
||||
/* details in TypeConstants.h. NetPositive will use external handlers */
|
||||
/* for all URL types except for http, https, file, netpositive, and */
|
||||
/* javascript, which it always handles internally. To maintain */
|
||||
/* compatibility with its previous behavior, if NetPositive does not */
|
||||
/* find a handler for mailto URL's, it will instead launch the handler */
|
||||
/* for "text/x-email". */
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
#endif /* _NETPOSITIVE_H */
|
68
headers/build/os/be_apps/Tracker/Background.h
Normal file
68
headers/build/os/be_apps/Tracker/Background.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Open Tracker License
|
||||
|
||||
Terms and Conditions
|
||||
|
||||
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice applies to all licensees
|
||||
and shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Be Incorporated shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||
this Software without prior written authorization from Be Incorporated.
|
||||
|
||||
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
|
||||
of Be Incorporated in the United States and other countries. Other brand product
|
||||
names are registered trademarks or trademarks of their respective holders.
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _TRACKER_BACKGROUND_H
|
||||
#define _TRACKER_BACKGROUND_H
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Tracker background attribute name ----------------------*/
|
||||
|
||||
#define B_BACKGROUND_INFO "be:bgndimginfo"
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Tracker background BMessage entries --------------------*/
|
||||
|
||||
#define B_BACKGROUND_IMAGE "be:bgndimginfopath" // string path
|
||||
#define B_BACKGROUND_MODE "be:bgndimginfomode" // int32, the enum below
|
||||
#define B_BACKGROUND_ORIGIN "be:bgndimginfooffset" // BPoint
|
||||
#define B_BACKGROUND_ERASE_TEXT "be:bgndimginfoerasetext" // bool
|
||||
#define B_BACKGROUND_WORKSPACES "be:bgndimginfoworkspaces" // uint32
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Background mode values ---------------------------------*/
|
||||
|
||||
enum {
|
||||
B_BACKGROUND_MODE_USE_ORIGIN,
|
||||
B_BACKGROUND_MODE_CENTERED, // only works on Desktop
|
||||
B_BACKGROUND_MODE_SCALED, // only works on Desktop
|
||||
B_BACKGROUND_MODE_TILED
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to
|
||||
// use a new background image
|
||||
|
||||
#endif /* _TRACKER_BACKGROUND_H */
|
207
headers/build/os/be_apps/Tracker/RecentItems.h
Normal file
207
headers/build/os/be_apps/Tracker/RecentItems.h
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
Open Tracker License
|
||||
|
||||
Terms and Conditions
|
||||
|
||||
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice applies to all licensees
|
||||
and shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Be Incorporated shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||
this Software without prior written authorization from Be Incorporated.
|
||||
|
||||
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
|
||||
of Be Incorporated in the United States and other countries. Other brand product
|
||||
names are registered trademarks or trademarks of their respective holders.
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __RECENT_ITEMS_LIST__
|
||||
#define __RECENT_ITEMS_LIST__
|
||||
|
||||
#include <Entry.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
|
||||
/* BRecentItemsList classes allow creating an entire menu with
|
||||
* recent files, folders, apps. If the user wishes to add items to
|
||||
* their own menu, they can instead use the GetNextMenuItem call to
|
||||
* get one menu at a time to add it to their app.
|
||||
*/
|
||||
|
||||
class BMenuItem;
|
||||
class BMenu;
|
||||
|
||||
class BRecentItemsList {
|
||||
public:
|
||||
BRecentItemsList(int32 maxItems, bool navMenuFolders);
|
||||
/* if <navMenuFolders> passed, folder items get NavMenu-style
|
||||
* subdirectories attached to them
|
||||
*/
|
||||
|
||||
virtual ~BRecentItemsList() {}
|
||||
|
||||
virtual void Rewind();
|
||||
/* resets the iteration */
|
||||
|
||||
virtual BMenuItem *GetNextMenuItem(const BMessage *fileOpenMessage = NULL,
|
||||
const BMessage *containerOpenMessage = NULL,
|
||||
BHandler *target = NULL, entry_ref *currentItemRef = NULL);
|
||||
/* if <fileOpenMessage> specified, the item for a file gets a copy with
|
||||
* the item ref attached as "refs", otherwise a default B_REFS_RECEIVED
|
||||
* message message gets attached
|
||||
* if <containerOpenMessage> specified, the item for a folder, volume or query
|
||||
* gets a copy with the item ref attached as "refs", otherwise a default
|
||||
* B_REFS_RECEIVED message message gets attached
|
||||
* if <currentItemRef> gets passed, the caller gets to look at the
|
||||
* entry_ref corresponding to the item
|
||||
*/
|
||||
|
||||
virtual status_t GetNextRef(entry_ref *);
|
||||
|
||||
protected:
|
||||
BMessage fItems;
|
||||
int32 fIndex;
|
||||
int32 fMaxItems;
|
||||
bool fNavMenuFolders;
|
||||
|
||||
private:
|
||||
|
||||
virtual void _r1();
|
||||
virtual void _r2();
|
||||
virtual void _r3();
|
||||
virtual void _r4();
|
||||
virtual void _r5();
|
||||
virtual void _r6();
|
||||
virtual void _r7();
|
||||
virtual void _r8();
|
||||
virtual void _r9();
|
||||
virtual void _r10();
|
||||
|
||||
uint32 _reserved[20];
|
||||
};
|
||||
|
||||
class BRecentFilesList : public BRecentItemsList {
|
||||
public:
|
||||
|
||||
/* use one of the two constructors to set up next item iteration */
|
||||
BRecentFilesList(int32 maxItems = 10, bool navMenuFolders = false,
|
||||
const char *ofType = NULL, const char *openedByAppSig = NULL);
|
||||
BRecentFilesList(int32 maxItems, bool navMenuFolders, const char *ofTypeList[],
|
||||
int32 ofTypeListCount, const char *openedByAppSig = NULL);
|
||||
virtual ~BRecentFilesList();
|
||||
|
||||
/* use one of the two NewFileListMenu calls to get an entire menu */
|
||||
static BMenu *NewFileListMenu(const char *title,
|
||||
BMessage *openFileMessage = NULL, BMessage *openFolderMessage = NULL,
|
||||
BHandler *target = NULL,
|
||||
int32 maxItems = 10, bool navMenuFolders = false,
|
||||
const char *ofType = NULL, const char *openedByAppSig = NULL);
|
||||
|
||||
static BMenu *NewFileListMenu(const char *title,
|
||||
BMessage *openFileMessage, BMessage *openFolderMessage,
|
||||
BHandler *target,
|
||||
int32 maxItems, bool navMenuFolders,
|
||||
const char *ofTypeList[], int32 ofTypeListCount,
|
||||
const char *openedByAppSig);
|
||||
|
||||
virtual status_t GetNextRef(entry_ref *);
|
||||
|
||||
protected:
|
||||
|
||||
BString fType;
|
||||
char **fTypes;
|
||||
int32 fTypeCount;
|
||||
BString fAppSig;
|
||||
|
||||
private:
|
||||
virtual void _r11();
|
||||
virtual void _r12();
|
||||
virtual void _r13();
|
||||
virtual void _r14();
|
||||
virtual void _r15();
|
||||
virtual void _r16();
|
||||
virtual void _r17();
|
||||
virtual void _r18();
|
||||
virtual void _r19();
|
||||
virtual void _r110();
|
||||
|
||||
uint32 _reserved[20];
|
||||
};
|
||||
|
||||
class BRecentFoldersList : public BRecentItemsList {
|
||||
public:
|
||||
/* use the constructor to set up next item iteration */
|
||||
BRecentFoldersList(int32 maxItems, bool navMenuFolders = false,
|
||||
const char *openedByAppSig = NULL);
|
||||
|
||||
/* use NewFolderListMenu to get an entire menu */
|
||||
static BMenu *NewFolderListMenu(const char *title,
|
||||
BMessage *openMessage = NULL, BHandler *target = NULL,
|
||||
int32 maxItems = 10, bool navMenuFolders = false,
|
||||
const char *openedByAppSig = NULL);
|
||||
|
||||
virtual status_t GetNextRef(entry_ref *);
|
||||
|
||||
protected:
|
||||
BString fAppSig;
|
||||
|
||||
private:
|
||||
virtual void _r21();
|
||||
virtual void _r22();
|
||||
virtual void _r23();
|
||||
virtual void _r24();
|
||||
virtual void _r25();
|
||||
virtual void _r26();
|
||||
virtual void _r27();
|
||||
virtual void _r28();
|
||||
virtual void _r29();
|
||||
virtual void _r210();
|
||||
|
||||
uint32 _reserved[20];
|
||||
};
|
||||
|
||||
class BRecentAppsList : public BRecentItemsList {
|
||||
public:
|
||||
/* use the constructor to set up next item iteration */
|
||||
BRecentAppsList(int32 maxItems);
|
||||
|
||||
/* use NewFolderListMenu to get an entire menu */
|
||||
static BMenu *NewAppListMenu(const char *title,
|
||||
BMessage *openMessage = NULL, BHandler *target = NULL,
|
||||
int32 maxItems = 10);
|
||||
|
||||
virtual status_t GetNextRef(entry_ref *);
|
||||
|
||||
private:
|
||||
virtual void _r31();
|
||||
virtual void _r32();
|
||||
virtual void _r33();
|
||||
virtual void _r34();
|
||||
virtual void _r35();
|
||||
virtual void _r36();
|
||||
virtual void _r37();
|
||||
virtual void _r38();
|
||||
virtual void _r39();
|
||||
virtual void _r310();
|
||||
|
||||
uint32 _reserved[20];
|
||||
};
|
||||
|
||||
#endif
|
43
headers/build/os/device/A2D.h
Normal file
43
headers/build/os/device/A2D.h
Normal file
@ -0,0 +1,43 @@
|
||||
/********************************************************************************
|
||||
/
|
||||
/ File: A2D.h
|
||||
/
|
||||
/ Description: Analog-to-Digital converter class header.
|
||||
/
|
||||
/ Copyright 1996-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _A2D_H
|
||||
#define _A2D_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <stddef.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
class BA2D {
|
||||
|
||||
public:
|
||||
BA2D();
|
||||
virtual ~BA2D();
|
||||
|
||||
status_t Open(const char *portName);
|
||||
void Close(void);
|
||||
bool IsOpen(void);
|
||||
|
||||
ssize_t Read(ushort *buf);
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
|
||||
private:
|
||||
virtual void _ReservedA2D1();
|
||||
virtual void _ReservedA2D2();
|
||||
virtual void _ReservedA2D3();
|
||||
|
||||
int ffd;
|
||||
uint32 _fReserved[3];
|
||||
};
|
||||
|
||||
#endif
|
711
headers/build/os/device/CAM.h
Normal file
711
headers/build/os/device/CAM.h
Normal file
@ -0,0 +1,711 @@
|
||||
/* ++++++++++
|
||||
CAM.h
|
||||
Copyright (c) 1996-98 by Be Incorporated. All Rights Reserved.
|
||||
|
||||
Definitions for the SCSI Common Access Method as implemented in the Be OS.
|
||||
|
||||
See also "Draft Proposed American National Standard, SCSI-2 Common
|
||||
Access Method Transport and SCSI Interface Module", Revision 12,
|
||||
ANSI refernce number X3.232-199x.
|
||||
|
||||
This file consists of the definitions for the fictional "UNIVOS"
|
||||
operating system described in the standard. The file is mostly
|
||||
the same text as the standard, with Be-provided additions as needed.
|
||||
+++++ */
|
||||
|
||||
|
||||
#ifndef _CAM_H
|
||||
#define _CAM_H
|
||||
|
||||
#include <bus_manager.h>
|
||||
|
||||
/* ---
|
||||
Be-provided additions to the standard include file.
|
||||
--- */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef U32
|
||||
typedef unsigned long U32;
|
||||
#endif
|
||||
|
||||
#ifndef I32
|
||||
typedef long I32;
|
||||
#endif
|
||||
|
||||
#ifndef U16
|
||||
typedef unsigned short U16;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint32 serial; /* operation serial number */
|
||||
uint32 micros; /* operation time in microseconds (4294s max) */
|
||||
uint32 bytes; /* number of bytes to transfer */
|
||||
uchar path; /* target SIM ID */
|
||||
uchar target; /* target device ID */
|
||||
uchar sgcount; /* # of sg segments (0 if non-sg operation) */
|
||||
uchar scsi_op; /* scsi operation byte */
|
||||
} cam_iostat;
|
||||
|
||||
|
||||
/* -----
|
||||
The rest of this file contains the definitions and data structures for
|
||||
the CAM Subsystem interface. The contents of this file should match the
|
||||
data structures and constants that are specified in the CAM document
|
||||
----- */
|
||||
|
||||
/* Defines for the XPT function codes, Table 8-2 in the CAM spec. */
|
||||
|
||||
/* Common function commands, 0x00 - 0x0F */
|
||||
#define XPT_NOOP 0x00 /* Execute Nothing */
|
||||
#define XPT_SCSI_IO 0x01 /* Execute the requested SCSI IO */
|
||||
#define XPT_GDEV_TYPE 0x02 /* Get the device type information */
|
||||
#define XPT_PATH_INQ 0x03 /* Path Inquiry */
|
||||
#define XPT_REL_SIMQ 0x04 /* Release the SIM queue that is frozen */
|
||||
#define XPT_SASYNC_CB 0x05 /* Set Async callback parameters */
|
||||
#define XPT_SDEV_TYPE 0x06 /* Set the device type information */
|
||||
#define XPT_SCAN_BUS 0x07 /* Scan the Scsi Bus */
|
||||
|
||||
/* XPT SCSI control functions, 0x10 - 0x1F */
|
||||
#define XPT_ABORT 0x10 /* Abort the selected CCB */
|
||||
#define XPT_RESET_BUS 0x11 /* Reset the SCSI bus */
|
||||
#define XPT_RESET_DEV 0x12 /* Reset the SCSI device, BDR */
|
||||
#define XPT_TERM_IO 0x13 /* Terminate the I/O process */
|
||||
|
||||
/* HBA engine commands, 0x20 - 0x2F */
|
||||
#define XPT_ENG_INQ 0x20 /* HBA engine inquiry */
|
||||
#define XPT_ENG_EXEC 0x21 /* HBA execute engine request */
|
||||
|
||||
/* Target mode commands, 0x30 - 0x3F */
|
||||
#define XPT_EN_LUN 0x30 /* Enable LUN, Target mode support */
|
||||
#define XPT_TARGET_IO 0x31 /* Execute the target IO request */
|
||||
#define XPT_ACCEPT_TARG 0x32 /* Accept Host Target Mode CDB */
|
||||
#define XPT_CONT_TARG 0x33 /* Cont. Host Target I/O Connection */
|
||||
#define XPT_IMMED_NOTIFY 0x34 /* Notify Host Target driver of event*/
|
||||
#define XPT_NOTIFY_ACK 0x35 /* Acknowledgement of event */
|
||||
|
||||
#define XPT_FUNC 0x7F /* TEMPLATE */
|
||||
#define XPT_VUNIQUE 0x80 /* All the rest are vendor unique commands */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* General allocation length defines for the CCB structures. */
|
||||
|
||||
#define IOCDBLEN 12 /* Space for the CDB bytes/pointer */
|
||||
#define VUHBA 14 /* Vendor Unique HBA length */
|
||||
#define SIM_ID 16 /* ASCII string len for SIM ID */
|
||||
#define HBA_ID 16 /* ASCII string len for HBA ID */
|
||||
|
||||
#define BE_SIM_CCB_SIZE 1536 /* we want to allocate 1.5k chunks */
|
||||
#define BE_SIM_SCSIIO_SIZE 88 /* sizeof(CAM_CCB_SCSIIO) - SIM_PRIV */
|
||||
#define SIM_PRIV (BE_SIM_CCB_SIZE - BE_SIM_SCSIIO_SIZE) /* Length of SIM private data area */
|
||||
|
||||
/* SIM_PRIV (sim private data area) Terms and Conditions:
|
||||
|
||||
- the size of SIM_PRIV shall be such that sizeof(CCB_SIZE_UNION) = 1.5k
|
||||
- all CCB's shall be allocated from locked, contiguous memory
|
||||
- CCB's shall be aligned on 512 byte boundaries
|
||||
- SIM_PRIV will be >= 1408 bytes
|
||||
- this provides 128 8byte sg entries (512mb worth of pages, worstcase fragmentation)
|
||||
- and 256 bytes for sense data and 128 bytes for whatever else the SIM needs
|
||||
|
||||
- These conditions are NULL and (void) where prohibited by law.
|
||||
- All sales are final.
|
||||
- Do not use near open flame.
|
||||
*/
|
||||
|
||||
/* Structure definitions for the CAM control blocks, CCB's for the
|
||||
subsystem. */
|
||||
|
||||
/* Common CCB header definition. */
|
||||
typedef struct ccb_header
|
||||
{
|
||||
uint32 phys_addr; /* physical address of this CCB */
|
||||
uint16 cam_ccb_len; /* Length of the entire CCB */
|
||||
uchar cam_func_code; /* XPT function code */
|
||||
uchar cam_status; /* Returned CAM subsystem status */
|
||||
uchar cam_hrsvd0; /* Reserved field, for alignment */
|
||||
uchar cam_path_id; /* Path ID for the request */
|
||||
uchar cam_target_id; /* Target device ID */
|
||||
uchar cam_target_lun; /* Target LUN number */
|
||||
uint32 cam_flags; /* Flags for operation of the subsystem */
|
||||
} CCB_HEADER;
|
||||
|
||||
/* Common SCSI functions. */
|
||||
|
||||
/* Union definition for the CDB space in the SCSI I/O request CCB */
|
||||
typedef union cdb_un
|
||||
{
|
||||
uchar *cam_cdb_ptr; /* Pointer to the CDB bytes to send */
|
||||
uchar cam_cdb_bytes[ IOCDBLEN ]; /* Area for the CDB to send */
|
||||
} CDB_UN;
|
||||
|
||||
/* Get device type CCB */
|
||||
typedef struct ccb_getdev
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
char *cam_inq_data; /* Ptr to the inquiry data space */
|
||||
uchar cam_pd_type; /* Periph device type from the TLUN */
|
||||
} CCB_GETDEV;
|
||||
|
||||
/* Path inquiry CCB */
|
||||
typedef struct ccb_pathinq
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uchar cam_version_num; /* Version number for the SIM/HBA */
|
||||
uchar cam_hba_inquiry; /* Mimic of INQ byte 7 for the HBA */
|
||||
uchar cam_target_sprt; /* Flags for target mode support */
|
||||
uchar cam_hba_misc; /* Misc HBA feature flags */
|
||||
uint16 cam_hba_eng_cnt; /* HBA engine count */
|
||||
uchar cam_vuhba_flags[ VUHBA ]; /* Vendor unique capabilities */
|
||||
uint32 cam_sim_priv; /* Size of SIM private data area */
|
||||
uint32 cam_async_flags; /* Event cap. for Async Callback */
|
||||
uchar cam_hpath_id; /* Highest path ID in the subsystem */
|
||||
uchar cam_initiator_id; /* ID of the HBA on the SCSI bus */
|
||||
uchar cam_prsvd0; /* Reserved field, for alignment */
|
||||
uchar cam_prsvd1; /* Reserved field, for alignment */
|
||||
char cam_sim_vid[ SIM_ID ]; /* Vendor ID of the SIM */
|
||||
char cam_hba_vid[ HBA_ID ]; /* Vendor ID of the HBA */
|
||||
uchar *cam_osd_usage; /* Ptr for the OSD specific area */
|
||||
} CCB_PATHINQ;
|
||||
|
||||
/* Release SIM Queue CCB */
|
||||
typedef struct ccb_relsim
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
} CCB_RELSIM;
|
||||
|
||||
/* SCSI I/O Request CCB */
|
||||
typedef struct ccb_scsiio
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */
|
||||
CCB_HEADER *cam_next_ccb; /* Ptr to the next CCB for action */
|
||||
uchar *cam_req_map; /* Ptr for mapping info on the Req. */
|
||||
void (*cam_cbfcnp)(struct ccb_scsiio *);
|
||||
/* Callback on completion function */
|
||||
uchar *cam_data_ptr; /* Pointer to the data buf/SG list */
|
||||
uint32 cam_dxfer_len; /* Data xfer length */
|
||||
uchar *cam_sense_ptr; /* Pointer to the sense data buffer */
|
||||
uchar cam_sense_len; /* Num of bytes in the Autosense buf */
|
||||
uchar cam_cdb_len; /* Number of bytes for the CDB */
|
||||
uint16 cam_sglist_cnt; /* Num of scatter gather list entries */
|
||||
uint32 cam_sort; /* Value used by SIM to sort on */
|
||||
uchar cam_scsi_status; /* Returned scsi device status */
|
||||
uchar cam_sense_resid; /* Autosense resid length: 2's comp */
|
||||
uchar cam_osd_rsvd1[2]; /* OSD Reserved field, for alignment */
|
||||
int32 cam_resid; /* Transfer residual length: 2's comp */
|
||||
CDB_UN cam_cdb_io; /* Union for CDB bytes/pointer */
|
||||
uint32 cam_timeout; /* Timeout value */
|
||||
uchar *cam_msg_ptr; /* Pointer to the message buffer */
|
||||
uint16 cam_msgb_len; /* Num of bytes in the message buf */
|
||||
uint16 cam_vu_flags; /* Vendor unique flags */
|
||||
uchar cam_tag_action; /* What to do for tag queuing */
|
||||
uchar cam_iorsvd0[3]; /* Reserved field, for alignment */
|
||||
uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */
|
||||
} CCB_SCSIIO;
|
||||
|
||||
/* Set Async Callback CCB */
|
||||
typedef struct ccb_setasync
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uint32 cam_async_flags; /* Event enables for Callback resp */
|
||||
void (*cam_async_func)(); /* Async Callback function address */
|
||||
uchar *pdrv_buf; /* Buffer set aside by the Per. drv */
|
||||
uchar pdrv_buf_len; /* The size of the buffer */
|
||||
} CCB_SETASYNC;
|
||||
|
||||
/* Set device type CCB */
|
||||
typedef struct ccb_setdev
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uchar cam_dev_type; /* Val for the dev type field in EDT */
|
||||
} CCB_SETDEV;
|
||||
|
||||
/* SCSI Control Functions. */
|
||||
|
||||
/* Abort XPT Request CCB */
|
||||
typedef struct ccb_abort
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
CCB_HEADER *cam_abort_ch; /* Pointer to the CCB to abort */
|
||||
} CCB_ABORT;
|
||||
|
||||
/* Reset SCSI Bus CCB */
|
||||
typedef struct ccb_resetbus
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
} CCB_RESETBUS;
|
||||
|
||||
/* Reset SCSI Device CCB */
|
||||
typedef struct ccb_resetdev
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
} CCB_RESETDEV;
|
||||
|
||||
/* Terminate I/O Process Request CCB */
|
||||
typedef struct ccb_termio
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
CCB_HEADER *cam_termio_ch; /* Pointer to the CCB to terminate */
|
||||
} CCB_TERMIO;
|
||||
|
||||
/* Target mode structures. */
|
||||
|
||||
/* Host Target Mode Version 1 Enable LUN CCB */
|
||||
typedef struct ccb_en_lun
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uint16 cam_grp6_len; /* Group 6 VU CDB length */
|
||||
uint16 cam_grp7_len; /* Group 7 VU CDB length */
|
||||
uchar *cam_ccb_listptr; /* Pointer to the target CCB list */
|
||||
uint16 cam_ccb_listcnt; /* Count of Target CCBs in the list */
|
||||
} CCB_EN_LUN;
|
||||
|
||||
/* Enable LUN CCB (HTM V2) */
|
||||
typedef struct ccb_enable_lun
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uint16 cam_grp6_length; /* Group 6 Vendor Unique CDB Lengths */
|
||||
uint16 cam_grp7_length; /* Group 7 Vendor Unique CDB Lengths */
|
||||
uchar *cam_immed_notify_list; /* Ptr to Immediate Notify CCB list */
|
||||
uint32 cam_immed_notify_cnt; /* Number of Immediate Notify CCBs */
|
||||
uchar *cam_accept_targ_list; /* Ptr to Accept Target I/O CCB list */
|
||||
uint32 cam_accept_targ_cnt; /* Number of Accept Target I/O CCBs */
|
||||
uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */
|
||||
} CCB_ENABLE_LUN;
|
||||
|
||||
/* Immediate Notify CCB */
|
||||
typedef struct ccb_immed_notify
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */
|
||||
void (*cam_cbfnot)(); /* Callback on notification function */
|
||||
uchar *cam_sense_ptr; /* Pointer to the sense data buffer */
|
||||
uchar cam_sense_len; /* Num of bytes in the Autosense buf */
|
||||
uchar cam_init_id; /* ID of Initiator that selected */
|
||||
uint16 cam_seq_id; /* Sequence Identifier */
|
||||
uchar cam_msg_code; /* Message Code */
|
||||
uchar cam_msg_args[7]; /* Message Arguments */
|
||||
} CCB_IMMED_NOTIFY;
|
||||
|
||||
/* Notify Acknowledge CCB */
|
||||
typedef struct ccb_notify_ack
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uint16 cam_seq_id; /* Sequence Identifier */
|
||||
uchar cam_event; /* Event */
|
||||
uchar cam_rsvd;
|
||||
} CCB_NOTIFY_ACK;
|
||||
|
||||
/* Accept Target I/O CCB */
|
||||
typedef struct ccb_accept_targ
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */
|
||||
CCB_HEADER *cam_next_ccb; /* Ptr to the next CCB for action */
|
||||
uchar *cam_req_map; /* Ptr for mapping info on the Req. */
|
||||
void (*cam_cbfcnot)(); /* Callback on completion function */
|
||||
uchar *cam_data_ptr; /* Pointer to the data buf/SG list */
|
||||
uint32 cam_dxfer_len; /* Data xfer length */
|
||||
uchar *cam_sense_ptr; /* Pointer to the sense data buffer */
|
||||
uchar cam_sense_len; /* Num of bytes in the Autosense buf */
|
||||
uchar cam_cdb_len; /* Number of bytes for the CDB */
|
||||
uint16 cam_sglist_cnt; /* Num of scatter gather list entries */
|
||||
uint32 cam_sort; /* Value used by SIM to sort on */
|
||||
uchar cam_scsi_status; /* Returned scsi device status */
|
||||
uchar cam_sense_resid; /* Autosense resid length: 2's comp */
|
||||
uchar cam_osd_rsvd1[2]; /* OSD Reserved field, for alignment */
|
||||
int32 cam_resid; /* Transfer residual length: 2's comp */
|
||||
CDB_UN cam_cdb_io; /* Union for CDB bytes/pointer */
|
||||
uint32 cam_timeout; /* Timeout value */
|
||||
uchar *cam_msg_ptr; /* Pointer to the message buffer */
|
||||
uint16 cam_msgb_len; /* Num of bytes in the message buf */
|
||||
uint16 cam_vu_flags; /* Vendor unique flags */
|
||||
uchar cam_tag_action; /* What to do for tag queuing */
|
||||
uchar cam_tag_id; /* Tag ID */
|
||||
uchar cam_initiator_id; /* Initiator ID */
|
||||
uchar cam_iorsvd0[1]; /* Reserved field, for alignment */
|
||||
uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */
|
||||
} CCB_ACCEPT_TARG;
|
||||
|
||||
/* Continue Target I/O CCB */
|
||||
typedef CCB_ACCEPT_TARG CCB_CONT_TARG;
|
||||
|
||||
/* HBA engine structures. */
|
||||
|
||||
typedef struct ccb_eng_inq
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uint16 cam_eng_num; /* The number for this inquiry */
|
||||
uchar cam_eng_type; /* Returned engine type */
|
||||
uchar cam_eng_algo; /* Returned algorithm type */
|
||||
uint32 cam_eng_memory; /* Returned engine memory size */
|
||||
} CCB_ENG_INQ;
|
||||
|
||||
typedef struct ccb_eng_exec /* NOTE: must match SCSIIO size */
|
||||
{
|
||||
CCB_HEADER cam_ch; /* Header information fields */
|
||||
uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */
|
||||
uint32 cam_engrsvd0; /* Reserved field, for alignment */
|
||||
uchar *cam_req_map; /* Ptr for mapping info on the Req. */
|
||||
void (*cam_cbfcnp)(); /* Callback on completion function */
|
||||
uchar *cam_data_ptr; /* Pointer to the data buf/SG list */
|
||||
uint32 cam_dxfer_len; /* Data xfer length */
|
||||
uchar *cam_engdata_ptr; /* Pointer to the engine buffer data */
|
||||
uchar cam_engrsvd1; /* Reserved field, for alignment */
|
||||
uchar cam_engrsvd2; /* Reserved field, for alignment */
|
||||
uint16 cam_sglist_cnt; /* Num of scatter gather list entries */
|
||||
uint32 cam_dmax_len; /* Destination data maximum length */
|
||||
uint32 cam_dest_len; /* Destination data length */
|
||||
int32 cam_src_resid; /* Source residual length: 2's comp */
|
||||
uchar cam_engrsvd3[12]; /* Reserved field, for alignment */
|
||||
uint32 cam_timeout; /* Timeout value */
|
||||
uint32 cam_engrsvd4; /* Reserved field, for alignment */
|
||||
uint16 cam_eng_num; /* Engine number for this request */
|
||||
uint16 cam_vu_flags; /* Vendor unique flags */
|
||||
uchar cam_engrsvd5; /* Reserved field, for alignment */
|
||||
uchar cam_engrsvd6[3]; /* Reserved field, for alignment */
|
||||
uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */
|
||||
} CCB_ENG_EXEC;
|
||||
|
||||
/* The sim_module_info definition is used to define the entry points for
|
||||
the SIMs contained in the SCSI CAM subsystem. Each SIM file will
|
||||
contain a declaration for it's entry. The address for this entry will
|
||||
be stored in the cam_conftbl[] array along will all the other SIM
|
||||
entries. */
|
||||
|
||||
typedef struct sim_module_info sim_module_info;
|
||||
|
||||
struct sim_module_info {
|
||||
module_info minfo;
|
||||
};
|
||||
|
||||
typedef struct CAM_SIM_ENTRY CAM_SIM_ENTRY;
|
||||
|
||||
struct CAM_SIM_ENTRY {
|
||||
status_t (*sim_init)();
|
||||
int32 (*sim_action)();
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the CAM status field in the CCB header. */
|
||||
|
||||
#define CAM_REQ_INPROG 0x00 /* CCB request is in progress */
|
||||
#define CAM_REQ_CMP 0x01 /* CCB request completed w/out error */
|
||||
#define CAM_REQ_ABORTED 0x02 /* CCB request aborted by the host */
|
||||
#define CAM_UA_ABORT 0x03 /* Unable to Abort CCB request */
|
||||
#define CAM_REQ_CMP_ERR 0x04 /* CCB request completed with an err */
|
||||
#define CAM_BUSY 0x05 /* CAM subsystem is busy */
|
||||
#define CAM_REQ_INVALID 0x06 /* CCB request is invalid */
|
||||
#define CAM_PATH_INVALID 0x07 /* Path ID supplied is invalid */
|
||||
#define CAM_DEV_NOT_THERE 0x08 /* SCSI device not installed/there */
|
||||
#define CAM_UA_TERMIO 0x09 /* Unable to Terminate I/O CCB req */
|
||||
#define CAM_SEL_TIMEOUT 0x0A /* Target selection timeout */
|
||||
#define CAM_CMD_TIMEOUT 0x0B /* Command timeout */
|
||||
#define CAM_MSG_REJECT_REC 0x0D /* Message reject received */
|
||||
#define CAM_SCSI_BUS_RESET 0x0E /* SCSI bus reset sent/received */
|
||||
#define CAM_UNCOR_PARITY 0x0F /* Uncorrectable parity err occurred */
|
||||
#define CAM_AUTOSENSE_FAIL 0x10 /* Autosense: Request sense cmd fail */
|
||||
#define CAM_NO_HBA 0x11 /* No HBA detected Error */
|
||||
#define CAM_DATA_RUN_ERR 0x12 /* Data overrun/underrun error */
|
||||
#define CAM_UNEXP_BUSFREE 0x13 /* Unexpected BUS free */
|
||||
#define CAM_SEQUENCE_FAIL 0x14 /* Target bus phase sequence failure */
|
||||
#define CAM_CCB_LEN_ERR 0x15 /* CCB length supplied is inadequate */
|
||||
#define CAM_PROVIDE_FAIL 0x16 /* Unable to provide requ. capability */
|
||||
#define CAM_BDR_SENT 0x17 /* A SCSI BDR msg was sent to target */
|
||||
#define CAM_REQ_TERMIO 0x18 /* CCB request terminated by the host */
|
||||
#define CAM_HBA_ERR 0x19 /* Unrecoverable host bus adaptor err*/
|
||||
#define CAM_BUS_RESET_DENIED 0x1A /* SCSI bus reset denied */
|
||||
|
||||
#define CAM_IDE 0x33 /* Initiator Detected Error Received */
|
||||
#define CAM_RESRC_UNAVAIL 0x34 /* Resource unavailable */
|
||||
#define CAM_UNACKED_EVENT 0x35 /* Unacknowledged event by host */
|
||||
#define CAM_MESSAGE_RECV 0x36 /* Msg received in Host Target Mode */
|
||||
#define CAM_INVALID_CDB 0x37 /* Invalid CDB recvd in HT Mode */
|
||||
#define CAM_LUN_INVALID 0x38 /* LUN supplied is invalid */
|
||||
#define CAM_TID_INVALID 0x39 /* Target ID supplied is invalid */
|
||||
#define CAM_FUNC_NOTAVAIL 0x3A /* The requ. func is not available */
|
||||
#define CAM_NO_NEXUS 0x3B /* Nexus is not established */
|
||||
#define CAM_IID_INVALID 0x3C /* The initiator ID is invalid */
|
||||
#define CAM_CDB_RECVD 0x3D /* The SCSI CDB has been received */
|
||||
#define CAM_LUN_ALLREADY_ENAB 0x3E /* LUN already enabled */
|
||||
#define CAM_SCSI_BUSY 0x3F /* SCSI bus busy */
|
||||
|
||||
#define CAM_SIM_QFRZN 0x40 /* The SIM queue is frozen w/this err */
|
||||
#define CAM_AUTOSNS_VALID 0x80 /* Autosense data valid for target */
|
||||
|
||||
#define CAM_STATUS_MASK 0x3F /* Mask bits for just the status # */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the CAM flags field in the CCB header. */
|
||||
|
||||
#define CAM_DIR_RESV 0x00000000 /* Data direction (00: reserved) */
|
||||
#define CAM_DIR_IN 0x00000040 /* Data direction (01: DATA IN) */
|
||||
#define CAM_DIR_OUT 0x00000080 /* Data direction (10: DATA OUT) */
|
||||
#define CAM_DIR_NONE 0x000000C0 /* Data direction (11: no data) */
|
||||
#define CAM_DIS_AUTOSENSE 0x00000020 /* Disable autosense feature */
|
||||
#define CAM_SCATTER_VALID 0x00000010 /* Scatter/gather list is valid */
|
||||
#define CAM_DIS_CALLBACK 0x00000008 /* Disable callback feature */
|
||||
#define CAM_CDB_LINKED 0x00000004 /* The CCB contains a linked CDB */
|
||||
#define CAM_QUEUE_ENABLE 0x00000002 /* SIM queue actions are enabled */
|
||||
#define CAM_CDB_POINTER 0x00000001 /* The CDB field contains a pointer */
|
||||
|
||||
#define CAM_DIS_DISCONNECT 0x00008000 /* Disable disconnect */
|
||||
#define CAM_INITIATE_SYNC 0x00004000 /* Attempt Sync data xfer, and SDTR */
|
||||
#define CAM_DIS_SYNC 0x00002000 /* Disable sync, go to async */
|
||||
#define CAM_SIM_QHEAD 0x00001000 /* Place CCB at the head of SIM Q */
|
||||
#define CAM_SIM_QFREEZE 0x00000800 /* Return the SIM Q to frozen state */
|
||||
#define CAM_SIM_QFRZDIS 0x00000400 /* Disable the SIM Q frozen state */
|
||||
#define CAM_ENG_SYNC 0x00000200 /* Flush resid bytes before cmplt */
|
||||
|
||||
#define CAM_ENG_SGLIST 0x00800000 /* The SG list is for the HBA engine */
|
||||
#define CAM_CDB_PHYS 0x00400000 /* CDB pointer is physical */
|
||||
#define CAM_DATA_PHYS 0x00200000 /* SG/Buffer data ptrs are physical */
|
||||
#define CAM_SNS_BUF_PHYS 0x00100000 /* Autosense data ptr is physical */
|
||||
#define CAM_MSG_BUF_PHYS 0x00080000 /* Message buffer ptr is physical */
|
||||
#define CAM_NXT_CCB_PHYS 0x00040000 /* Next CCB pointer is physical */
|
||||
#define CAM_CALLBCK_PHYS 0x00020000 /* Callback func ptr is physical */
|
||||
|
||||
#define CAM_SEND_STATUS 0x80000000 /* Send status after date phase */
|
||||
#define CAM_DISCONNECT 0x40000000 /* Disc. mandatory after cdb recv */
|
||||
#define CAM_TERM_IO 0x20000000 /* Terminate I/O Message supported */
|
||||
|
||||
#define CAM_DATAB_VALID 0x80000000 /* Data buffer valid */
|
||||
#define CAM_STATUS_VALID 0x40000000 /* Status buffer valid */
|
||||
#define CAM_MSGB_VALID 0x20000000 /* Message buffer valid */
|
||||
#define CAM_TGT_PHASE_MODE 0x08000000 /* The SIM will run in phase mode */
|
||||
#define CAM_TGT_CCB_AVAIL 0x04000000 /* Target CCB available */
|
||||
#define CAM_DIS_AUTODISC 0x02000000 /* Disable autodisconnect */
|
||||
#define CAM_DIS_AUTOSRP 0x01000000 /* Disable autosave/restore ptrs */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the SIM/HBA queue actions. These value are used in the
|
||||
SCSI I/O CCB, for the queue action field. [These values should match the
|
||||
defines from some other include file for the SCSI message phases. We may
|
||||
not need these definitions here. ] */
|
||||
|
||||
#define CAM_SIMPLE_QTAG 0x20 /* Tag for a simple queue */
|
||||
#define CAM_HEAD_QTAG 0x21 /* Tag for head of queue */
|
||||
#define CAM_ORDERED_QTAG 0x22 /* Tag for ordered queue */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the timeout field in the SCSI I/O CCB. At this time a value
|
||||
of 0xF-F indicates a infinite timeout. A value of 0x0-0 indicates that the
|
||||
SIM's default timeout can take effect. */
|
||||
|
||||
#define CAM_TIME_DEFAULT 0x00000000 /* Use SIM default value */
|
||||
#define CAM_TIME_INFINITY 0xFFFFFFFF /* Infinite timeout for I/O */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the Path Inquiry CCB fields. */
|
||||
|
||||
#define CAM_VERSION 0x25 /* Binary value for the current ver */
|
||||
|
||||
#define PI_MDP_ABLE 0x80 /* Supports MDP message */
|
||||
#define PI_WIDE_32 0x40 /* Supports 32 bit wide SCSI */
|
||||
#define PI_WIDE_16 0x20 /* Supports 16 bit wide SCSI */
|
||||
#define PI_SDTR_ABLE 0x10 /* Supports SDTR message */
|
||||
#define PI_LINKED_CDB 0x08 /* Supports linked CDBs */
|
||||
#define PI_TAG_ABLE 0x02 /* Supports tag queue message */
|
||||
#define PI_SOFT_RST 0x01 /* Supports soft reset */
|
||||
|
||||
#define PIT_PROCESSOR 0x80 /* Target mode processor mode */
|
||||
#define PIT_PHASE 0x40 /* Target mode phase cog. mode */
|
||||
|
||||
#define PIM_SCANHILO 0x80 /* Bus scans from ID 7 to ID 0 */
|
||||
#define PIM_NOREMOVE 0x40 /* Removable dev not included in scan */
|
||||
#define PIM_NOINQUIRY 0x20 /* Inquiry data not kept by XPT */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for Asynchronous Callback CCB fields. */
|
||||
|
||||
#define AC_FOUND_DEVICES 0x80 /* During a rescan new device found */
|
||||
#define AC_SIM_DEREGISTER 0x40 /* A loaded SIM has de-registered */
|
||||
#define AC_SIM_REGISTER 0x20 /* A loaded SIM has registered */
|
||||
#define AC_SENT_BDR 0x10 /* A BDR message was sent to target */
|
||||
#define AC_SCSI_AEN 0x08 /* A SCSI AEN has been received */
|
||||
#define AC_UNSOL_RESEL 0x02 /* A unsolicited reselection occurred */
|
||||
#define AC_BUS_RESET 0x01 /* A SCSI bus RESET occurred */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Typedef for a scatter/gather list element. */
|
||||
|
||||
typedef struct sg_elem
|
||||
{
|
||||
uchar *cam_sg_address; /* Scatter/Gather address */
|
||||
uint32 cam_sg_count; /* Scatter/Gather count */
|
||||
} SG_ELEM;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the "event" field in the CCB_NOTIFY_ACK */
|
||||
#define CAM_RESET_CLEARED 0x80 /* Reset Cleared */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Defines for the HBA engine inquiry CCB fields. */
|
||||
|
||||
#define EIT_BUFFER 0x00 /* Engine type: Buffer memory */
|
||||
#define EIT_LOSSLESS 0x01 /* Engine type: Lossless compression */
|
||||
#define EIT_LOSSLY 0x02 /* Engine type: Lossly compression */
|
||||
#define EIT_ENCRYPT 0x03 /* Engine type: Encryption */
|
||||
|
||||
#define EAD_VUNIQUE 0x00 /* Eng algorithm ID: vendor unique */
|
||||
#define EAD_LZ1V1 0x00 /* Eng algorithm ID: LZ1 var. 1*/
|
||||
#define EAD_LZ2V1 0x00 /* Eng algorithm ID: LZ2 var. 1*/
|
||||
#define EAD_LZ2V2 0x00 /* Eng algorithm ID: LZ2 var. 2*/
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Unix OSD defines and data structures. */
|
||||
|
||||
#define INQLEN 36 /* Inquiry string length to store. */
|
||||
|
||||
#define CAM_SUCCESS 0 /* For signaling general success */
|
||||
#define CAM_FAILURE 1 /* For signaling general failure */
|
||||
|
||||
#define CAM_FALSE 0 /* General purpose flag value */
|
||||
#define CAM_TRUE 1 /* General purpose flag value */
|
||||
|
||||
#define XPT_CCB_INVALID -1 /* for signaling a bad CCB to free */
|
||||
|
||||
/* The typedef for the Async callback information. This structure is used to
|
||||
store the supplied info from the Set Async Callback CCB, in the EDT table
|
||||
in a linked list structure. */
|
||||
|
||||
typedef struct async_info
|
||||
{
|
||||
struct async_info *cam_async_next; /* pointer to the next structure */
|
||||
uint32 cam_event_enable; /* Event enables for Callback resp */
|
||||
void (*cam_async_func)(); /* Async Callback function address */
|
||||
uint32 cam_async_blen; /* Length of "information" buffer */
|
||||
uchar *cam_async_ptr; /* Address for the "information */
|
||||
} ASYNC_INFO;
|
||||
|
||||
/* The CAM EDT table contains the device information for all the
|
||||
devices, SCSI ID and LUN, for all the SCSI busses in the system. The
|
||||
table contains a CAM_EDT_ENTRY structure for each device on the bus.
|
||||
*/
|
||||
|
||||
typedef struct cam_edt_entry
|
||||
{
|
||||
int32 cam_tlun_found; /* Flag for the existence of the target/LUN */
|
||||
ASYNC_INFO *cam_ainfo; /* Async callback list info for this B/T/L */
|
||||
uint32 cam_owner_tag; /* Tag for the peripheral driver's ownership */
|
||||
char cam_inq_data[ INQLEN ]; /* storage for the inquiry data */
|
||||
} CAM_EDT_ENTRY;
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
/* ----------------------------- VENDOR UNIQUE DATA ----------------------------- */
|
||||
/* ============================================================================== */
|
||||
|
||||
/* ---
|
||||
Vendor unique XPT function codes
|
||||
--- */
|
||||
|
||||
#define XPT_EXTENDED_PATH_INQ (XPT_VUNIQUE + 1) /* Extended Path Inquiry */
|
||||
|
||||
/* Extended path inquiry CCB */
|
||||
|
||||
#define FAM_ID 16 /* ASCII string len for FAMILY ID */
|
||||
#define TYPE_ID 16 /* ASCII string len for TYPE ID */
|
||||
#define VERS 8 /* ASCII string len for SIM & HBA vers */
|
||||
|
||||
typedef struct ccb_extended_pathinq
|
||||
{
|
||||
CCB_PATHINQ cam_path; /* Default path inquiry */
|
||||
char cam_sim_version [ VERS ]; /* SIM version number */
|
||||
char cam_hba_version [ VERS ]; /* HBA version number */
|
||||
char cam_controller_family [ FAM_ID ]; /* Controller family */
|
||||
char cam_controller_type [ TYPE_ID ]; /* Controller type */
|
||||
} CCB_EXTENDED_PATHINQ;
|
||||
|
||||
|
||||
/* ---
|
||||
Vendor unique flags supported by Be OS (cam_vu_flags)
|
||||
--- */
|
||||
|
||||
enum {
|
||||
VU_RESERVED_0 = 0x0001,
|
||||
VU_RESERVED_1 = 0x0002,
|
||||
VU_DISABLE_SEL_W_ATN = 0x0004,
|
||||
VU_RESERVED_4 = 0x0008
|
||||
};
|
||||
|
||||
|
||||
/* ---
|
||||
XPT interface used by SCSI drivers
|
||||
--- */
|
||||
|
||||
typedef struct cam_for_driver_module_info cam_for_driver_module_info;
|
||||
|
||||
struct cam_for_driver_module_info {
|
||||
bus_manager_info minfo;
|
||||
CCB_HEADER * (*xpt_ccb_alloc)(void);
|
||||
void (*xpt_ccb_free)(void *ccb);
|
||||
long (*xpt_action)(CCB_HEADER *ccbh);
|
||||
};
|
||||
|
||||
#define B_CAM_FOR_DRIVER_MODULE_NAME "bus_managers/scsi/driver/v1"
|
||||
|
||||
/* ---
|
||||
XPT interface used by SCSI SIMs
|
||||
--- */
|
||||
|
||||
typedef struct cam_for_sim_module_info cam_for_sim_module_info;
|
||||
|
||||
struct cam_for_sim_module_info {
|
||||
bus_manager_info minfo;
|
||||
long (*xpt_bus_register) (CAM_SIM_ENTRY *sim);
|
||||
long (*xpt_bus_deregister) (long path);
|
||||
};
|
||||
|
||||
#define B_CAM_FOR_SIM_MODULE_NAME "bus_managers/scsi/sim/v1"
|
||||
|
||||
|
||||
/* General Union for Kernel Space allocation. Contains all the possible CCB
|
||||
structures. This union should never be used for manipulating CCB's its only
|
||||
use is for the allocation and deallocation of raw CCB space. */
|
||||
|
||||
typedef union ccb_size_union
|
||||
{
|
||||
CCB_SCSIIO csio; /* Please keep this first, for debug/print */
|
||||
CCB_GETDEV cgd;
|
||||
CCB_PATHINQ cpi;
|
||||
CCB_RELSIM crs;
|
||||
CCB_SETASYNC csa;
|
||||
CCB_SETDEV csd;
|
||||
CCB_ABORT cab;
|
||||
CCB_RESETBUS crb;
|
||||
CCB_RESETDEV crd;
|
||||
CCB_TERMIO ctio;
|
||||
CCB_EN_LUN cel;
|
||||
CCB_ENABLE_LUN cel2;
|
||||
CCB_IMMED_NOTIFY cin;
|
||||
CCB_NOTIFY_ACK cna;
|
||||
CCB_ACCEPT_TARG cat;
|
||||
CCB_ENG_INQ cei;
|
||||
CCB_ENG_EXEC cee;
|
||||
CCB_EXTENDED_PATHINQ cdpi;
|
||||
} CCB_SIZE_UNION;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
45
headers/build/os/device/D2A.h
Normal file
45
headers/build/os/device/D2A.h
Normal file
@ -0,0 +1,45 @@
|
||||
/********************************************************************************
|
||||
/
|
||||
/ File: D2A.h
|
||||
/
|
||||
/ Description: Digital-To-Analog converter class header.
|
||||
/
|
||||
/ Copyright 1996-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _D2A_H
|
||||
#define _D2A_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <stddef.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
class BD2A {
|
||||
|
||||
public:
|
||||
BD2A();
|
||||
virtual ~BD2A();
|
||||
|
||||
status_t Open(const char *portName);
|
||||
void Close(void);
|
||||
bool IsOpen(void);
|
||||
|
||||
ssize_t Read(uint8 *buf);
|
||||
ssize_t Write(uint8 value);
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
|
||||
private:
|
||||
|
||||
virtual void _ReservedD2A1();
|
||||
virtual void _ReservedD2A2();
|
||||
virtual void _ReservedD2A3();
|
||||
|
||||
int ffd;
|
||||
uint32 _fReserved[3];
|
||||
};
|
||||
|
||||
#endif
|
54
headers/build/os/device/DigitalPort.h
Normal file
54
headers/build/os/device/DigitalPort.h
Normal file
@ -0,0 +1,54 @@
|
||||
/********************************************************************************
|
||||
/
|
||||
/ File: DigitalPort.h
|
||||
/
|
||||
/ Description: Digital Port class header.
|
||||
/
|
||||
/ Copyright 1996-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DIGITAL_PORT_H
|
||||
#define _DIGITAL_PORT_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <stddef.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
class BDigitalPort {
|
||||
|
||||
public:
|
||||
BDigitalPort();
|
||||
virtual ~BDigitalPort();
|
||||
|
||||
status_t Open(const char *portName);
|
||||
void Close(void);
|
||||
bool IsOpen(void);
|
||||
|
||||
ssize_t Read(uint8 *buf);
|
||||
ssize_t Write(uint8 value);
|
||||
|
||||
status_t SetAsOutput (void);
|
||||
bool IsOutput (void);
|
||||
|
||||
status_t SetAsInput (void);
|
||||
bool IsInput (void);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
|
||||
private:
|
||||
|
||||
virtual void _ReservedDigitalPort1();
|
||||
virtual void _ReservedDigitalPort2();
|
||||
virtual void _ReservedDigitalPort3();
|
||||
|
||||
int ffd;
|
||||
bool fIsInput;
|
||||
uint32 _fReserved[3];
|
||||
};
|
||||
|
||||
#endif
|
118
headers/build/os/device/Joystick.h
Normal file
118
headers/build/os/device/Joystick.h
Normal file
@ -0,0 +1,118 @@
|
||||
/********************************************************************************
|
||||
/
|
||||
/ File: Joystick.h
|
||||
/
|
||||
/ Description: Joystick port class header.
|
||||
/
|
||||
/ Copyright 1996-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _JOYSTICK_H
|
||||
#define _JOYSTICK_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
class BList;
|
||||
struct _extended_joystick;
|
||||
class _IMPEXP_DEVICE _BJoystickTweaker;
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
class BJoystick {
|
||||
|
||||
public:
|
||||
BJoystick();
|
||||
virtual ~BJoystick();
|
||||
|
||||
status_t Open(const char *portName); /* always goes for enhanced mode */
|
||||
status_t Open(const char *portName, bool enter_enhanced);
|
||||
void Close(void);
|
||||
|
||||
status_t Update(void);
|
||||
status_t SetMaxLatency(
|
||||
bigtime_t max_latency);
|
||||
|
||||
bigtime_t timestamp;
|
||||
int16 horizontal;
|
||||
int16 vertical;
|
||||
bool button1; /* NOTE: true == off */
|
||||
bool button2;
|
||||
|
||||
int32 CountDevices();
|
||||
status_t GetDeviceName(int32 n, char * name,
|
||||
size_t bufSize = B_OS_NAME_LENGTH);
|
||||
|
||||
/* if you care about more than just the first two axes/buttons, here's where you go */
|
||||
bool EnterEnhancedMode(
|
||||
const entry_ref * ref = NULL);
|
||||
int32 CountSticks();
|
||||
int32 CountAxes();
|
||||
int32 CountHats();
|
||||
int32 CountButtons();
|
||||
status_t GetAxisValues(
|
||||
int16 * out_values,
|
||||
int32 for_stick = 0); /* CountAxes() elements */
|
||||
status_t GetHatValues(
|
||||
uint8 * out_hats,
|
||||
int32 for_stick = 0);
|
||||
uint32 ButtonValues(
|
||||
int32 for_stick = 0); /* NOTE: Buttons() are 1 == on */
|
||||
status_t GetAxisNameAt(
|
||||
int32 index,
|
||||
BString * out_name);
|
||||
status_t GetHatNameAt(
|
||||
int32 index,
|
||||
BString * out_name);
|
||||
status_t GetButtonNameAt(
|
||||
int32 index,
|
||||
BString * out_name);
|
||||
status_t GetControllerModule(
|
||||
BString * out_name);
|
||||
status_t GetControllerName(
|
||||
BString * out_name);
|
||||
|
||||
bool IsCalibrationEnabled();
|
||||
status_t EnableCalibration(
|
||||
bool calibrates = true);
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
|
||||
protected:
|
||||
|
||||
virtual void Calibrate(
|
||||
struct _extended_joystick * reading);
|
||||
|
||||
private:
|
||||
friend class _BJoystickTweaker;
|
||||
|
||||
struct _joystick_info;
|
||||
|
||||
void ScanDevices(
|
||||
bool use_disabled = false);
|
||||
status_t gather_enhanced_info(
|
||||
const entry_ref * ref = NULL);
|
||||
status_t save_config(
|
||||
const entry_ref * ref = NULL);
|
||||
|
||||
void _ReservedJoystick1();
|
||||
virtual void _ReservedJoystick2();
|
||||
virtual void _ReservedJoystick3();
|
||||
|
||||
bool _mBeBoxMode;
|
||||
bool _mReservedBool;
|
||||
int ffd;
|
||||
BList * _fDevices;
|
||||
_joystick_info * m_info;
|
||||
char * m_dev_name;
|
||||
#if !_PR3_COMPATIBLE_
|
||||
virtual status_t _Reserved_Joystick_4(void *, ...);
|
||||
virtual status_t _Reserved_Joystick_5(void *, ...);
|
||||
virtual status_t _Reserved_Joystick_6(void *, ...);
|
||||
uint32 _reserved_Joystick_[10];
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
109
headers/build/os/device/SerialPort.h
Normal file
109
headers/build/os/device/SerialPort.h
Normal file
@ -0,0 +1,109 @@
|
||||
/********************************************************************************
|
||||
/
|
||||
/ File: SerialPort.h
|
||||
/
|
||||
/ Description: Serial Port class header.
|
||||
/
|
||||
/ Copyright 1995-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _SERIAL_PORT_H
|
||||
#define _SERIAL_PORT_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <stddef.h>
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
class BList;
|
||||
|
||||
enum data_rate { B_0_BPS = 0, B_50_BPS, B_75_BPS, B_110_BPS, B_134_BPS,
|
||||
B_150_BPS, B_200_BPS, B_300_BPS, B_600_BPS, B_1200_BPS,
|
||||
B_1800_BPS, B_2400_BPS, B_4800_BPS, B_9600_BPS, B_19200_BPS,
|
||||
B_38400_BPS, B_57600_BPS, B_115200_BPS,
|
||||
B_230400_BPS, B_31250_BPS };
|
||||
|
||||
enum data_bits { B_DATA_BITS_7, B_DATA_BITS_8 };
|
||||
|
||||
enum stop_bits { B_STOP_BITS_1, B_STOP_BITS_2 };
|
||||
#define B_STOP_BIT_1 B_STOP_BITS_1
|
||||
|
||||
enum parity_mode { B_NO_PARITY, B_ODD_PARITY, B_EVEN_PARITY };
|
||||
|
||||
enum { B_NOFLOW_CONTROL = 0, B_HARDWARE_CONTROL = 0x00000001,
|
||||
B_SOFTWARE_CONTROL = 0x00000002 };
|
||||
|
||||
/* -----------------------------------------------------------------------*/
|
||||
class BSerialPort {
|
||||
|
||||
public:
|
||||
BSerialPort();
|
||||
virtual ~BSerialPort();
|
||||
|
||||
status_t Open(const char *portName);
|
||||
void Close(void);
|
||||
|
||||
ssize_t Read(void *buf, size_t count);
|
||||
ssize_t Write(const void *buf, size_t count);
|
||||
void SetBlocking(bool Blocking);
|
||||
status_t SetTimeout(bigtime_t microSeconds);
|
||||
|
||||
status_t SetDataRate(data_rate bitsPerSecond);
|
||||
data_rate DataRate(void);
|
||||
|
||||
void SetDataBits(data_bits numBits);
|
||||
data_bits DataBits(void);
|
||||
void SetStopBits(stop_bits numBits);
|
||||
stop_bits StopBits(void);
|
||||
|
||||
void SetParityMode(parity_mode which);
|
||||
parity_mode ParityMode(void);
|
||||
|
||||
void ClearInput(void);
|
||||
void ClearOutput(void);
|
||||
|
||||
void SetFlowControl(uint32 method);
|
||||
uint32 FlowControl(void);
|
||||
|
||||
status_t SetDTR(bool asserted);
|
||||
status_t SetRTS(bool asserted);
|
||||
status_t NumCharsAvailable(int32 *wait_until_this_many);
|
||||
|
||||
bool IsCTS(void);
|
||||
bool IsDSR(void);
|
||||
bool IsRI(void);
|
||||
bool IsDCD(void);
|
||||
ssize_t WaitForInput(void);
|
||||
/* -----------------------------------------------------------------------*/
|
||||
|
||||
int32 CountDevices();
|
||||
status_t GetDeviceName(int32 n, char * name,
|
||||
size_t bufSize = B_OS_NAME_LENGTH);
|
||||
|
||||
private:
|
||||
|
||||
void ScanDevices();
|
||||
|
||||
virtual void _ReservedSerialPort1();
|
||||
virtual void _ReservedSerialPort2();
|
||||
virtual void _ReservedSerialPort3();
|
||||
virtual void _ReservedSerialPort4();
|
||||
|
||||
int ffd;
|
||||
data_rate fBaudRate;
|
||||
data_bits fDataBits;
|
||||
stop_bits fStopBits;
|
||||
parity_mode fParityMode;
|
||||
uint32 fFlow;
|
||||
bigtime_t fTimeout;
|
||||
bool fBlocking;
|
||||
|
||||
int DriverControl();
|
||||
|
||||
BList * _fDevices;
|
||||
uint32 _fReserved[3];
|
||||
};
|
||||
|
||||
#endif
|
20
headers/build/os/device/graphic_driver.h
Normal file
20
headers/build/os/device/graphic_driver.h
Normal file
@ -0,0 +1,20 @@
|
||||
#if !defined(_GRAPHIC_DRIVER_H_)
|
||||
#define _GRAPHIC_DRIVER_H_
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
/* The API for driver access is C, not C++ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
B_GET_ACCELERANT_SIGNATURE = B_GRAPHIC_DRIVER_BASE
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
178
headers/build/os/device/scsi.h
Normal file
178
headers/build/os/device/scsi.h
Normal file
@ -0,0 +1,178 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: scsi.h
|
||||
/
|
||||
/ Description: Data structures and control calls for using the scsi driver.
|
||||
/
|
||||
/ Copyright 1992-98, Be Incorporated
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _SCSI_H
|
||||
#define _SCSI_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
#include <Drivers.h>
|
||||
|
||||
|
||||
/* scsi device types */
|
||||
/*------------------------*/
|
||||
#define B_SCSI_DISK 0x00
|
||||
#define B_SCSI_TAPE 0x01
|
||||
#define B_SCSI_PRINTER 0x02
|
||||
#define B_SCSI_CPU 0x03
|
||||
#define B_SCSI_WORM 0x04
|
||||
#define B_SCSI_CD 0x05
|
||||
#define B_SCSI_SCANNER 0x06
|
||||
#define B_SCSI_OPTICAL 0x07
|
||||
#define B_SCSI_JUKEBOX 0x08
|
||||
#define B_SCSI_NETWORK 0x09
|
||||
|
||||
|
||||
/* scsi device masks */
|
||||
/*----------------------------------*/
|
||||
#define B_SCSI_ALL_DEVICES_MASK 0xffffffff
|
||||
#define B_SCSI_DISK_MASK (1 << (B_SCSI_DISK))
|
||||
#define B_SCSI_TAPE_MASK (1 << (B_SCSI_TAPE))
|
||||
#define B_SCSI_PRINTER_MASK (1 << (B_SCSI_PRINTER))
|
||||
#define B_SCSI_CPU_MASK (1 << (B_SCSI_CPU))
|
||||
#define B_SCSI_WORM_MASK (1 << (B_SCSI_WORM))
|
||||
#define B_SCSI_CD_MASK (1 << (B_SCSI_CD))
|
||||
#define B_SCSI_SCANNER_MASK (1 << (B_SCSI_SCANNER))
|
||||
#define B_SCSI_OPTICAL_MASK (1 << (B_SCSI_OPTICAL))
|
||||
#define B_SCSI_JUKEBOX_MASK (1 << (B_SCSI_JUKEBOX))
|
||||
#define B_SCSI_NETWORK_MASK (1 << (B_SCSI_NETWORK))
|
||||
|
||||
/* control call codes for rescan scsi driver (/dev/scsi/rescan) */
|
||||
/*-----------------------------------------------------*/
|
||||
enum {
|
||||
B_SCSI_SCAN_FOR_DEVICES = B_DEVICE_OP_CODES_END + 1,
|
||||
B_SCSI_ENABLE_PROFILING
|
||||
};
|
||||
|
||||
|
||||
/* control calls for all individual scsi device drivers */
|
||||
/*------------------------------------------------------*/
|
||||
enum {
|
||||
B_SCSI_INQUIRY = B_DEVICE_OP_CODES_END + 100,
|
||||
B_SCSI_EJECT,
|
||||
B_SCSI_PREVENT_ALLOW,
|
||||
B_RAW_DEVICE_COMMAND
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uchar inquiry_data[36]; /* inquiry data (see SCSI standard) */
|
||||
} scsi_inquiry;
|
||||
|
||||
|
||||
/* control calls for scsi cd-rom driver */
|
||||
/*--------------------------------------*/
|
||||
enum {
|
||||
B_SCSI_GET_TOC = B_DEVICE_OP_CODES_END + 200,
|
||||
B_SCSI_PLAY_TRACK,
|
||||
B_SCSI_PLAY_POSITION,
|
||||
B_SCSI_STOP_AUDIO,
|
||||
B_SCSI_PAUSE_AUDIO,
|
||||
B_SCSI_RESUME_AUDIO,
|
||||
B_SCSI_GET_POSITION,
|
||||
B_SCSI_SET_VOLUME,
|
||||
B_SCSI_GET_VOLUME,
|
||||
B_SCSI_READ_CD,
|
||||
B_SCSI_SCAN,
|
||||
B_SCSI_DATA_MODE
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uchar toc_data[804]; /* table of contents data (see SCSI standard) */
|
||||
} scsi_toc;
|
||||
|
||||
typedef struct {
|
||||
uchar start_track; /* starting track */
|
||||
uchar start_index; /* starting index */
|
||||
uchar end_track; /* ending track */
|
||||
uchar end_index; /* ending index */
|
||||
} scsi_play_track;
|
||||
|
||||
typedef struct {
|
||||
uchar start_m; /* starting minute */
|
||||
uchar start_s; /* starting second */
|
||||
uchar start_f; /* starting frame */
|
||||
uchar end_m; /* ending minute */
|
||||
uchar end_s; /* ending second */
|
||||
uchar end_f; /* ending frame */
|
||||
} scsi_play_position;
|
||||
|
||||
typedef struct {
|
||||
uchar position[16]; /* position data (see SCSI standard) */
|
||||
} scsi_position;
|
||||
|
||||
typedef struct {
|
||||
uchar flags; /* A 1 in any position means change that field */
|
||||
/* with port0_channel as bit 0 and port3_volume */
|
||||
/* as bit 7. */
|
||||
uchar port0_channel;
|
||||
uchar port0_volume;
|
||||
uchar port1_channel;
|
||||
uchar port1_volume;
|
||||
uchar port2_channel;
|
||||
uchar port2_volume;
|
||||
uchar port3_channel;
|
||||
uchar port3_volume;
|
||||
} scsi_volume;
|
||||
|
||||
#define B_SCSI_PORT0_CHANNEL 0x01
|
||||
#define B_SCSI_PORT0_VOLUME 0x02
|
||||
#define B_SCSI_PORT1_CHANNEL 0x04
|
||||
#define B_SCSI_PORT1_VOLUME 0x08
|
||||
#define B_SCSI_PORT2_CHANNEL 0x10
|
||||
#define B_SCSI_PORT2_VOLUME 0x20
|
||||
#define B_SCSI_PORT3_CHANNEL 0x40
|
||||
#define B_SCSI_PORT3_VOLUME 0x80
|
||||
|
||||
typedef struct {
|
||||
uchar start_m; /* starting minute */
|
||||
uchar start_s; /* starting second */
|
||||
uchar start_f; /* starting frame */
|
||||
uchar length_m; /* transfer length minute */
|
||||
uchar length_s; /* transfer length second */
|
||||
uchar length_f; /* transfer length frame */
|
||||
long buffer_length; /* size of read buffer */
|
||||
char* buffer; /* buffer to hold requested data */
|
||||
bool play; /* FALSE = don't play, TRUE = play */
|
||||
} scsi_read_cd;
|
||||
|
||||
typedef struct {
|
||||
char speed; /* 0 = slow - 5x, 1 = fast - 12x */
|
||||
char direction; /* 1 = forward, 0 = stop scan, -1 = backward */
|
||||
} scsi_scan;
|
||||
|
||||
typedef struct {
|
||||
off_t block;
|
||||
int32 mode;
|
||||
} scsi_data_mode;
|
||||
|
||||
/* raw device commands */
|
||||
|
||||
typedef struct {
|
||||
uint8 command[16];
|
||||
uint8 command_length;
|
||||
uint8 flags;
|
||||
uint8 scsi_status; /* SCSI Status Byte */
|
||||
/* (0 = success, 2 = check cond, ... */
|
||||
uint8 cam_status; /* CAM_* status conditions from CAM.h */
|
||||
void *data;
|
||||
size_t data_length;
|
||||
void *sense_data; /* buffer to return mode sense data in */
|
||||
size_t sense_data_length; /* size of optional buffer for mode sense */
|
||||
bigtime_t timeout;
|
||||
} raw_device_command;
|
||||
|
||||
enum {
|
||||
B_RAW_DEVICE_DATA_IN = 0x01,
|
||||
B_RAW_DEVICE_REPORT_RESIDUAL = 0x02,
|
||||
B_RAW_DEVICE_SHORT_READ_VALID = 0x04
|
||||
};
|
||||
|
||||
#endif
|
29
headers/build/os/device/scsi_bus_raw_driver.h
Normal file
29
headers/build/os/device/scsi_bus_raw_driver.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
** Copyright 2002-04, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Part of Open SCSI bus manager
|
||||
|
||||
Devfs entry for raw bus access.
|
||||
|
||||
This interface will go away. It's used by scsi_probe as
|
||||
long as we have no proper pnpfs where all the info can
|
||||
be retrieved from.
|
||||
*/
|
||||
|
||||
#ifndef _SCSI_BUS_RAW_DRIVER_H
|
||||
#define _SCSI_BUS_RAW_DRIVER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
// we start with +300 to not collide with any other SCSI opcode defined
|
||||
// in scsiprobe_driver.h or scsi.h;
|
||||
// all ioctl calls return the subsystem status (see SCSI.h)
|
||||
enum {
|
||||
B_SCSI_BUS_RAW_RESET = B_DEVICE_OP_CODES_END + 300,
|
||||
B_SCSI_BUS_RAW_PATH_INQUIRY
|
||||
};
|
||||
|
||||
#endif
|
122
headers/build/os/drivers/ACPI.h
Normal file
122
headers/build/os/drivers/ACPI.h
Normal file
@ -0,0 +1,122 @@
|
||||
/* ACPI Bus Manger Interface
|
||||
* Copyright 2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License
|
||||
*/
|
||||
|
||||
#ifndef _ACPI_H
|
||||
#define _ACPI_H
|
||||
|
||||
#include <bus_manager.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
typedef struct acpi_module_info acpi_module_info;
|
||||
typedef struct acpi_object_type acpi_object_type;
|
||||
|
||||
struct acpi_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
/* Fixed Event Management */
|
||||
|
||||
void (*enable_fixed_event) (uint32 event);
|
||||
void (*disable_fixed_event) (uint32 event);
|
||||
|
||||
uint32 (*fixed_event_status) (uint32 event);
|
||||
/* Returns 1 if event set, 0 otherwise */
|
||||
void (*reset_fixed_event) (uint32 event);
|
||||
|
||||
status_t (*install_fixed_event_handler) (uint32 event, interrupt_handler *handler, void *data);
|
||||
status_t (*remove_fixed_event_handler) (uint32 event, interrupt_handler *handler);
|
||||
|
||||
/* Namespace Access */
|
||||
|
||||
status_t (*get_next_entry) (uint32 object_type, const char *base, char *result, size_t len, void **counter);
|
||||
status_t (*get_device) (const char *hid, uint32 index, char *result);
|
||||
|
||||
status_t (*get_device_hid) (const char *path, char *hid);
|
||||
uint32 (*get_object_type) (const char *path);
|
||||
|
||||
/* Control method execution and data acquisition */
|
||||
|
||||
status_t (*evaluate_object) (const char *object, acpi_object_type *return_value, size_t buf_len);
|
||||
status_t (*evaluate_method) (const char *object, const char *method, acpi_object_type *return_value, size_t buf_len, acpi_object_type *args, int num_args);
|
||||
/* Power state setting */
|
||||
|
||||
status_t (*enter_sleep_state) (uint8 state);
|
||||
/* Sleep state values:
|
||||
0: On (Working)
|
||||
1: Sleep
|
||||
2: Software Off
|
||||
3: Mechanical Off
|
||||
4: Hibernate
|
||||
5: Software Off */
|
||||
};
|
||||
|
||||
|
||||
#ifndef __ACTYPES_H__
|
||||
|
||||
/* ACPI fixed event types */
|
||||
|
||||
enum {
|
||||
ACPI_EVENT_PMTIMER = 0,
|
||||
ACPI_EVENT_GLOBAL,
|
||||
ACPI_EVENT_POWER_BUTTON,
|
||||
ACPI_EVENT_SLEEP_BUTTON,
|
||||
ACPI_EVENT_RTC
|
||||
};
|
||||
|
||||
/* ACPI Object Types */
|
||||
|
||||
enum {
|
||||
ACPI_TYPE_ANY = 0,
|
||||
ACPI_TYPE_INTEGER,
|
||||
ACPI_TYPE_STRING,
|
||||
ACPI_TYPE_BUFFER,
|
||||
ACPI_TYPE_PACKAGE,
|
||||
ACPI_TYPE_FIELD_UNIT,
|
||||
ACPI_TYPE_DEVICE,
|
||||
ACPI_TYPE_EVENT,
|
||||
ACPI_TYPE_METHOD,
|
||||
ACPI_TYPE_MUTEX,
|
||||
ACPI_TYPE_REGION,
|
||||
ACPI_TYPE_POWER,
|
||||
ACPI_TYPE_PROCESSOR,
|
||||
ACPI_TYPE_THERMAL,
|
||||
ACPI_TYPE_BUFFER_FIELD
|
||||
};
|
||||
|
||||
/* ACPI control method arg type */
|
||||
|
||||
struct acpi_object_type {
|
||||
uint32 object_type;
|
||||
union {
|
||||
uint32 integer;
|
||||
struct {
|
||||
uint32 len;
|
||||
char *string; /* You have to allocate string space yourself */
|
||||
} string;
|
||||
struct {
|
||||
size_t length;
|
||||
void *buffer;
|
||||
} buffer;
|
||||
struct {
|
||||
uint32 count;
|
||||
acpi_object_type *objects;
|
||||
} package;
|
||||
struct {
|
||||
uint32 cpu_id;
|
||||
|
||||
int pblk_address;
|
||||
size_t pblk_length;
|
||||
} processor;
|
||||
struct {
|
||||
uint32 min_power_state;
|
||||
uint32 resource_order;
|
||||
} power_resource;
|
||||
} data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define B_ACPI_MODULE_NAME "bus_managers/acpi/v1"
|
||||
|
||||
#endif /* _ACPI_H */
|
213
headers/build/os/drivers/Drivers.h
Normal file
213
headers/build/os/drivers/Drivers.h
Normal file
@ -0,0 +1,213 @@
|
||||
#ifndef _DRIVERS_DRIVERS_H
|
||||
#define _DRIVERS_DRIVERS_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Select.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ---
|
||||
these hooks are how the kernel accesses the device
|
||||
--- */
|
||||
|
||||
typedef status_t (*device_open_hook) (const char *name, uint32 flags, void **cookie);
|
||||
typedef status_t (*device_close_hook) (void *cookie);
|
||||
typedef status_t (*device_free_hook) (void *cookie);
|
||||
typedef status_t (*device_control_hook) (void *cookie, uint32 op, void *data,
|
||||
size_t len);
|
||||
typedef status_t (*device_read_hook) (void *cookie, off_t position, void *data,
|
||||
size_t *numBytes);
|
||||
typedef status_t (*device_write_hook) (void *cookie, off_t position,
|
||||
const void *data, size_t *numBytes);
|
||||
typedef status_t (*device_select_hook) (void *cookie, uint8 event, uint32 ref,
|
||||
selectsync *sync);
|
||||
typedef status_t (*device_deselect_hook) (void *cookie, uint8 event,
|
||||
selectsync *sync);
|
||||
typedef status_t (*device_read_pages_hook)(void *cookie, off_t position, const iovec *vec,
|
||||
size_t count, size_t *_numBytes);
|
||||
typedef status_t (*device_write_pages_hook) (void *cookie, off_t position, const iovec *vec,
|
||||
size_t count, size_t *_numBytes);
|
||||
|
||||
#define B_CUR_DRIVER_API_VERSION 2
|
||||
|
||||
/* ---
|
||||
the device_hooks structure is a descriptor for the device, giving its
|
||||
entry points.
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
device_open_hook open; /* called to open the device */
|
||||
device_close_hook close; /* called to close the device */
|
||||
device_free_hook free; /* called to free the cookie */
|
||||
device_control_hook control; /* called to control the device */
|
||||
device_read_hook read; /* reads from the device */
|
||||
device_write_hook write; /* writes to the device */
|
||||
device_select_hook select; /* start select */
|
||||
device_deselect_hook deselect; /* stop select */
|
||||
device_read_pages_hook read_pages; /* scatter-gather physical read from the device */
|
||||
device_write_pages_hook write_pages; /* scatter-gather physical write to the device */
|
||||
} device_hooks;
|
||||
|
||||
status_t init_hardware(void);
|
||||
const char **publish_devices(void);
|
||||
device_hooks *find_device(const char *name);
|
||||
status_t init_driver(void);
|
||||
void uninit_driver(void);
|
||||
|
||||
extern int32 api_version;
|
||||
|
||||
enum {
|
||||
B_GET_DEVICE_SIZE = 1, /* get # bytes */
|
||||
/* returns size_t in *data */
|
||||
|
||||
B_SET_DEVICE_SIZE, /* set # bytes */
|
||||
/* passed size_t in *data */
|
||||
|
||||
B_SET_NONBLOCKING_IO, /* set to non-blocking i/o */
|
||||
|
||||
B_SET_BLOCKING_IO, /* set to blocking i/o */
|
||||
|
||||
B_GET_READ_STATUS, /* check if can read w/o blocking */
|
||||
/* returns bool in *data */
|
||||
|
||||
B_GET_WRITE_STATUS, /* check if can write w/o blocking */
|
||||
/* returns bool in *data */
|
||||
|
||||
B_GET_GEOMETRY, /* get info about device geometry */
|
||||
/* returns struct geometry in *data */
|
||||
|
||||
B_GET_DRIVER_FOR_DEVICE, /* get the path of the executable serving that device */
|
||||
|
||||
B_GET_PARTITION_INFO, /* get info about a device partition */
|
||||
/* returns struct partition_info in *data */
|
||||
|
||||
B_SET_PARTITION, /* create a user-defined partition */
|
||||
|
||||
B_FORMAT_DEVICE, /* low-level device format */
|
||||
|
||||
B_EJECT_DEVICE, /* eject the media if supported */
|
||||
|
||||
B_GET_ICON, /* return device icon (see struct below) */
|
||||
|
||||
B_GET_BIOS_GEOMETRY, /* get info about device geometry */
|
||||
/* as reported by the bios */
|
||||
/* returns struct geometry in *data */
|
||||
|
||||
B_GET_MEDIA_STATUS, /* get status of media. */
|
||||
/* return status_t in *data: */
|
||||
/* B_NO_ERROR: media ready */
|
||||
/* B_DEV_NO_MEDIA: no media */
|
||||
/* B_DEV_NOT_READY: device not ready */
|
||||
/* B_DEV_MEDIA_CHANGED: media changed */
|
||||
/* since open or last B_GET_MEDIA_STATUS */
|
||||
/* B_DEV_MEDIA_CHANGE_REQUESTED: user */
|
||||
/* pressed button on drive */
|
||||
/* B_DEV_DOOR_OPEN: door open */
|
||||
|
||||
B_LOAD_MEDIA, /* load the media if supported */
|
||||
|
||||
B_GET_BIOS_DRIVE_ID, /* get bios id for this device */
|
||||
|
||||
B_SET_UNINTERRUPTABLE_IO, /* prevent cntl-C from interrupting i/o */
|
||||
B_SET_INTERRUPTABLE_IO, /* allow cntl-C to interrupt i/o */
|
||||
|
||||
B_FLUSH_DRIVE_CACHE, /* flush drive cache */
|
||||
|
||||
B_GET_NEXT_OPEN_DEVICE = 1000, /* iterate through open devices */
|
||||
B_ADD_FIXED_DRIVER, /* private */
|
||||
B_REMOVE_FIXED_DRIVER, /* private */
|
||||
|
||||
B_AUDIO_DRIVER_BASE = 8000, /* base for codes in audio_driver.h */
|
||||
B_MIDI_DRIVER_BASE = 8100, /* base for codes in midi_driver.h */
|
||||
B_JOYSTICK_DRIVER_BASE = 8200, /* base for codes in joystick.h */
|
||||
B_GRAPHIC_DRIVER_BASE = 8300, /* base for codes in graphic_driver.h */
|
||||
|
||||
B_DEVICE_OP_CODES_END = 9999 /* end of Be-defined contol id's */
|
||||
};
|
||||
|
||||
/* ---
|
||||
geometry structure for the B_GET_GEOMETRY opcode
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
uint32 bytes_per_sector; /* sector size in bytes */
|
||||
uint32 sectors_per_track; /* # sectors per track */
|
||||
uint32 cylinder_count; /* # cylinders */
|
||||
uint32 head_count; /* # heads */
|
||||
uchar device_type; /* type */
|
||||
bool removable; /* non-zero if removable */
|
||||
bool read_only; /* non-zero if read only */
|
||||
bool write_once; /* non-zero if write-once */
|
||||
} device_geometry;
|
||||
|
||||
|
||||
/* ---
|
||||
Be-defined device types returned by B_GET_GEOMETRY. Use these if it makes
|
||||
sense for your device.
|
||||
--- */
|
||||
|
||||
enum {
|
||||
B_DISK = 0, /* Hard disks, floppy disks, etc. */
|
||||
B_TAPE, /* Tape drives */
|
||||
B_PRINTER, /* Printers */
|
||||
B_CPU, /* CPU devices */
|
||||
B_WORM, /* Write-once, read-many devices */
|
||||
B_CD, /* CD ROMS */
|
||||
B_SCANNER, /* Scanners */
|
||||
B_OPTICAL, /* Optical devices */
|
||||
B_JUKEBOX, /* Jukeboxes */
|
||||
B_NETWORK /* Network devices */
|
||||
};
|
||||
|
||||
|
||||
/* ---
|
||||
partition_info structure used by B_GET_PARTITION_INFO and B_SET_PARTITION
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
off_t offset; /* offset (in bytes) */
|
||||
off_t size; /* size (in bytes) */
|
||||
int32 logical_block_size; /* logical block size of partition */
|
||||
int32 session; /* id of session */
|
||||
int32 partition; /* id of partition */
|
||||
char device[256]; /* path to the physical device */
|
||||
} partition_info;
|
||||
|
||||
/* ---
|
||||
driver_path structure returned by the B_GET_DRIVER_FOR_DEVICE
|
||||
--- */
|
||||
|
||||
typedef char driver_path[256];
|
||||
|
||||
|
||||
/* ---
|
||||
open_device_iterator structure used by the B_GET_NEXT_OPEN_DEVICE opcode
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
uint32 cookie; /* must be set to 0 before iterating */
|
||||
char device[256]; /* device path */
|
||||
} open_device_iterator;
|
||||
|
||||
|
||||
/* ---
|
||||
icon structure for the B_GET_ICON opcode
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
int32 icon_size; /* icon size requested */
|
||||
void *icon_data; /* where to put 'em (usually BBitmap->Bits()) */
|
||||
} device_icon;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DRIVERS_DRIVERS_H */
|
84
headers/build/os/drivers/ISA.h
Normal file
84
headers/build/os/drivers/ISA.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: ISA.h
|
||||
/
|
||||
/ Description: Interface to ISA module
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _ISA_H
|
||||
#define _ISA_H
|
||||
|
||||
//#include <SupportDefs.h>
|
||||
#include <bus_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ---
|
||||
ISA scatter/gather dma support.
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
ulong address; /* memory address (little endian!) 4 bytes */
|
||||
ushort transfer_count; /* # transfers minus one (little endian!) 2 bytes*/
|
||||
uchar reserved; /* filler, 1byte*/
|
||||
uchar flag; /* end of link flag, 1byte */
|
||||
} isa_dma_entry;
|
||||
|
||||
#define B_LAST_ISA_DMA_ENTRY 0x80 /* sets end of link flag in isa_dma_entry */
|
||||
|
||||
enum {
|
||||
B_8_BIT_TRANSFER,
|
||||
B_16_BIT_TRANSFER
|
||||
};
|
||||
|
||||
#define B_MAX_ISA_DMA_COUNT 0x10000
|
||||
|
||||
typedef struct isa_module_info isa_module_info;
|
||||
struct isa_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
uint8 (*read_io_8) (int mapped_io_addr);
|
||||
void (*write_io_8) (int mapped_io_addr, uint8 value);
|
||||
uint16 (*read_io_16) (int mapped_io_addr);
|
||||
void (*write_io_16) (int mapped_io_addr, uint16 value);
|
||||
uint32 (*read_io_32) (int mapped_io_addr);
|
||||
void (*write_io_32) (int mapped_io_addr, uint32 value);
|
||||
|
||||
void * (*ram_address) (const void *physical_address_in_system_memory);
|
||||
|
||||
long (*make_isa_dma_table) (
|
||||
const void *buffer, /* buffer to make a table for */
|
||||
long buffer_size, /* buffer size */
|
||||
ulong num_bits, /* dma transfer size that will be used */
|
||||
isa_dma_entry *table, /* -> caller-supplied scatter/gather table */
|
||||
long num_entries /* max # entries in table */
|
||||
);
|
||||
long (*start_isa_dma) (
|
||||
long channel, /* dma channel to use */
|
||||
void *buf, /* buffer to transfer */
|
||||
long transfer_count, /* # transfers */
|
||||
uchar mode, /* mode flags */
|
||||
uchar e_mode /* extended mode flags */
|
||||
);
|
||||
long (*start_scattered_isa_dma) (
|
||||
long channel, /* channel # to use */
|
||||
const isa_dma_entry *table, /* physical address of scatter/gather table */
|
||||
uchar mode, /* mode flags */
|
||||
uchar emode /* extended mode flags */
|
||||
);
|
||||
long (*lock_isa_dma_channel) (long channel);
|
||||
long (*unlock_isa_dma_channel) (long channel);
|
||||
};
|
||||
|
||||
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ISA_H */
|
222
headers/build/os/drivers/KernelExport.h
Normal file
222
headers/build/os/drivers/KernelExport.h
Normal file
@ -0,0 +1,222 @@
|
||||
/* Kernel only exports for kernel add-ons
|
||||
*
|
||||
* Copyright 2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_EXPORT_H
|
||||
#define _KERNEL_EXPORT_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* interrupts and spinlocks */
|
||||
|
||||
/* disable/restore interrupts on the current CPU */
|
||||
|
||||
typedef ulong cpu_status;
|
||||
|
||||
extern cpu_status disable_interrupts(void);
|
||||
extern void restore_interrupts(cpu_status status);
|
||||
|
||||
|
||||
/* spinlocks. Note that acquire/release should be called with
|
||||
* interrupts disabled.
|
||||
*/
|
||||
|
||||
typedef vint32 spinlock;
|
||||
|
||||
extern void acquire_spinlock(spinlock *lock);
|
||||
extern void release_spinlock(spinlock *lock);
|
||||
|
||||
|
||||
/* interrupt handling support for device drivers */
|
||||
|
||||
typedef int32 (*interrupt_handler)(void *data);
|
||||
|
||||
/* Values returned by interrupt handlers */
|
||||
#define B_UNHANDLED_INTERRUPT 0 /* pass to next handler */
|
||||
#define B_HANDLED_INTERRUPT 1 /* don't pass on */
|
||||
#define B_INVOKE_SCHEDULER 2 /* don't pass on; invoke the scheduler */
|
||||
|
||||
/* Flags that can be passed to install_io_interrupt_handler() */
|
||||
#define B_NO_ENABLE_COUNTER 1
|
||||
|
||||
extern status_t install_io_interrupt_handler(long interrupt_number,
|
||||
interrupt_handler handler, void *data, ulong flags);
|
||||
extern status_t remove_io_interrupt_handler(long interrupt_number,
|
||||
interrupt_handler handler, void *data);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* timer interrupts services */
|
||||
|
||||
/* The BeOS qent structure is probably part of a general double linked list
|
||||
* interface used all over the kernel; a struct is required to have a qent
|
||||
* entry struct as first element, so it can be linked to other elements
|
||||
* easily. The key field is probably just an id, eventually used to order
|
||||
* the list.
|
||||
* Since we don't use this kind of interface, but we have to provide it
|
||||
* to keep compatibility, we can use the qent struct for other purposes...
|
||||
*
|
||||
* ToDo: don't do this! Drop source compatibility, but don't overdefine those values!
|
||||
*/
|
||||
typedef struct qent {
|
||||
int64 key; /* We use this as the sched time */
|
||||
struct qent *next; /* This is used as a pointer to next timer */
|
||||
struct qent *prev; /* This can be used for callback args */
|
||||
} qent;
|
||||
|
||||
typedef struct timer timer;
|
||||
typedef int32 (*timer_hook)(timer *);
|
||||
|
||||
struct timer {
|
||||
qent entry;
|
||||
uint16 flags;
|
||||
uint16 cpu;
|
||||
timer_hook hook;
|
||||
bigtime_t period;
|
||||
};
|
||||
|
||||
#define B_ONE_SHOT_ABSOLUTE_TIMER 1
|
||||
#define B_ONE_SHOT_RELATIVE_TIMER 2
|
||||
#define B_PERIODIC_TIMER 3
|
||||
|
||||
extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period, int32 flags);
|
||||
extern bool cancel_timer(timer *t);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* kernel threads */
|
||||
|
||||
extern thread_id spawn_kernel_thread(thread_func function, const char *threadName,
|
||||
int32 priority, void *arg);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* signal functions */
|
||||
|
||||
extern int send_signal_etc(pid_t thread, uint sig, uint32 flags);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* virtual memory buffer functions */
|
||||
|
||||
#define B_DMA_IO 0x00000001
|
||||
#define B_READ_DEVICE 0x00000002
|
||||
|
||||
typedef struct {
|
||||
void *address; /* address in physical memory */
|
||||
ulong size; /* size of block */
|
||||
} physical_entry;
|
||||
|
||||
extern long lock_memory(void *buffer, ulong numBytes, ulong flags);
|
||||
extern long unlock_memory(void *buffer, ulong numBytes, ulong flags);
|
||||
extern long get_memory_map(const void *buffer, ulong size,
|
||||
physical_entry *table, long numEntries);
|
||||
|
||||
/* address specifications for mapping physical memory */
|
||||
#define B_ANY_KERNEL_BLOCK_ADDRESS (B_ANY_KERNEL_ADDRESS + 1)
|
||||
|
||||
/* area protection flags for the kernel */
|
||||
#define B_KERNEL_READ_AREA 16
|
||||
#define B_KERNEL_WRITE_AREA 32
|
||||
#define B_USER_CLONEABLE_AREA 256
|
||||
|
||||
/* call to map physical memory - typically used for memory-mapped i/o */
|
||||
|
||||
extern area_id map_physical_memory(const char *areaName, void *physicalAddress,
|
||||
size_t size, uint32 flags, uint32 protection, void **mappedAddress);
|
||||
|
||||
|
||||
/* MTR attributes for mapping physical memory (Intel Architecture only) */
|
||||
// ToDo: what have those to do here?
|
||||
#define B_MTR_UC 0x10000000
|
||||
#define B_MTR_WC 0x20000000
|
||||
#define B_MTR_WT 0x30000000
|
||||
#define B_MTR_WP 0x40000000
|
||||
#define B_MTR_WB 0x50000000
|
||||
#define B_MTR_MASK 0xf0000000
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* hardware inquiry */
|
||||
|
||||
/* platform_type return value is defined in OS.h */
|
||||
|
||||
extern platform_type platform();
|
||||
|
||||
#if __POWERPC__
|
||||
extern long motherboard_version(void);
|
||||
extern long io_card_version(void);
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* primitive kernel debugging facilities */
|
||||
|
||||
/* Standard debug output is on...
|
||||
* mac: modem port
|
||||
* pc: com1
|
||||
* ...at 19.2 kbaud, no parity, 8 bit, 1 stop bit.
|
||||
*
|
||||
* Note: the kernel settings file can override these defaults
|
||||
*/
|
||||
|
||||
#if __GNUC__
|
||||
extern void dprintf(const char *format, ...) /* just like printf */
|
||||
__attribute__ ((format (__printf__, 1, 2)));
|
||||
extern void kprintf(const char *fmt, ...) /* only for debugger cmds */
|
||||
__attribute__ ((format (__printf__, 1, 2)));
|
||||
#else
|
||||
extern void dprintf(const char *format, ...); /* just like printf */
|
||||
extern void kprintf(const char *fmt, ...); /* only for debugger cmds */
|
||||
#endif
|
||||
|
||||
extern bool set_dprintf_enabled(bool new_state); /* returns old state */
|
||||
|
||||
extern void panic(const char *format, ...);
|
||||
|
||||
extern void kernel_debugger(const char *message); /* enter kernel debugger */
|
||||
extern uint32 parse_expression(const char *string); /* utility for debugger cmds */
|
||||
|
||||
/* special return codes for kernel debugger */
|
||||
#define B_KDEBUG_CONT 2
|
||||
#define B_KDEBUG_QUIT 3
|
||||
|
||||
typedef int (*debugger_command_hook)(int argc, char **argv);
|
||||
|
||||
extern int add_debugger_command(char *name, debugger_command_hook hook, char *help);
|
||||
extern int remove_debugger_command(char *name, debugger_command_hook hook);
|
||||
|
||||
extern status_t load_driver_symbols(const char *driverName);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* misc */
|
||||
|
||||
extern void spin(bigtime_t microseconds);
|
||||
/* does a busy delay loop for at least "microseconds" */
|
||||
|
||||
typedef void (*daemon_hook)(void *arg, int iteration);
|
||||
|
||||
extern status_t register_kernel_daemon(daemon_hook hook, void *arg, int frequency);
|
||||
extern status_t unregister_kernel_daemon(daemon_hook hook, void *arg);
|
||||
|
||||
extern void call_all_cpus(void (*f)(void *, int), void *cookie);
|
||||
|
||||
/* safe methods to access user memory without having to lock it */
|
||||
extern status_t user_memcpy(void *to, const void *from, size_t size);
|
||||
extern ssize_t user_strlcpy(char *to, const char *from, size_t size);
|
||||
extern status_t user_memset(void *start, char c, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL_EXPORT_H */
|
604
headers/build/os/drivers/PCI.h
Normal file
604
headers/build/os/drivers/PCI.h
Normal file
@ -0,0 +1,604 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: PCI.h
|
||||
/
|
||||
/ Description: Interface to the PCI bus.
|
||||
/ For more information, see "PCI Local Bus Specification, Revision 2.1",
|
||||
/ PCI Special Interest Group, 1995.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _PCI_H
|
||||
#define _PCI_H
|
||||
|
||||
//#include <BeBuild.h>
|
||||
//#include <SupportDefs.h>
|
||||
#include <bus_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* -----
|
||||
pci device info
|
||||
----- */
|
||||
|
||||
typedef struct pci_info {
|
||||
ushort vendor_id; /* vendor id */
|
||||
ushort device_id; /* device id */
|
||||
uchar bus; /* bus number */
|
||||
uchar device; /* device number on bus */
|
||||
uchar function; /* function number in device */
|
||||
uchar revision; /* revision id */
|
||||
uchar class_api; /* specific register interface type */
|
||||
uchar class_sub; /* specific device function */
|
||||
uchar class_base; /* device type (display vs network, etc) */
|
||||
uchar line_size; /* cache line size in 32 bit words */
|
||||
uchar latency; /* latency timer */
|
||||
uchar header_type; /* header type */
|
||||
uchar bist; /* built-in self-test */
|
||||
uchar reserved; /* filler, for alignment */
|
||||
union {
|
||||
struct {
|
||||
ulong cardbus_cis; /* CardBus CIS pointer */
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
ulong rom_size; /* rom size */
|
||||
ulong base_registers[6]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[6]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[6]; /* size of what base regs point to */
|
||||
uchar base_register_flags[6]; /* flags from base address fields */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
uchar min_grant; /* burst period @ 33 Mhz */
|
||||
uchar max_latency; /* how often PCI access needed */
|
||||
} h0;
|
||||
struct {
|
||||
ulong base_registers[2]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[2]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[2]; /* size of what base regs point to */
|
||||
uchar base_register_flags[2]; /* flags from base address fields */
|
||||
uchar primary_bus;
|
||||
uchar secondary_bus;
|
||||
uchar subordinate_bus;
|
||||
uchar secondary_latency;
|
||||
uchar io_base;
|
||||
uchar io_limit;
|
||||
ushort secondary_status;
|
||||
ushort memory_base;
|
||||
ushort memory_limit;
|
||||
ushort prefetchable_memory_base;
|
||||
ushort prefetchable_memory_limit;
|
||||
ulong prefetchable_memory_base_upper32;
|
||||
ulong prefetchable_memory_limit_upper32;
|
||||
ushort io_base_upper16;
|
||||
ushort io_limit_upper16;
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
ushort bridge_control;
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
} h1;
|
||||
struct {
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
} h2;
|
||||
} u;
|
||||
} pci_info;
|
||||
|
||||
|
||||
typedef struct pci_module_info pci_module_info;
|
||||
|
||||
struct pci_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
uint8 (*read_io_8) (int mapped_io_addr);
|
||||
void (*write_io_8) (int mapped_io_addr, uint8 value);
|
||||
uint16 (*read_io_16) (int mapped_io_addr);
|
||||
void (*write_io_16) (int mapped_io_addr, uint16 value);
|
||||
uint32 (*read_io_32) (int mapped_io_addr);
|
||||
void (*write_io_32) (int mapped_io_addr, uint32 value);
|
||||
|
||||
long (*get_nth_pci_info) (
|
||||
long index, /* index into pci device table */
|
||||
pci_info *info /* caller-supplied buffer for info */
|
||||
);
|
||||
uint32 (*read_pci_config) (
|
||||
uchar bus, /* bus number */
|
||||
uchar device, /* device # on bus */
|
||||
uchar function, /* function # in device */
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size /* # bytes to read (1, 2 or 4) */
|
||||
);
|
||||
void (*write_pci_config) (
|
||||
uchar bus, /* bus number */
|
||||
uchar device, /* device # on bus */
|
||||
uchar function, /* function # in device */
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size, /* # bytes to write (1, 2 or 4) */
|
||||
uint32 value /* value to write */
|
||||
);
|
||||
|
||||
void * (*ram_address) (const void *physical_address_in_system_memory);
|
||||
};
|
||||
|
||||
#define B_PCI_MODULE_NAME "bus_managers/pci/v1"
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of the predefined
|
||||
header common to all header types
|
||||
--- */
|
||||
|
||||
#define PCI_vendor_id 0x00 /* (2 byte) vendor id */
|
||||
#define PCI_device_id 0x02 /* (2 byte) device id */
|
||||
#define PCI_command 0x04 /* (2 byte) command */
|
||||
#define PCI_status 0x06 /* (2 byte) status */
|
||||
#define PCI_revision 0x08 /* (1 byte) revision id */
|
||||
#define PCI_class_api 0x09 /* (1 byte) specific register interface type */
|
||||
#define PCI_class_sub 0x0a /* (1 byte) specific device function */
|
||||
#define PCI_class_base 0x0b /* (1 byte) device type (display vs network, etc) */
|
||||
#define PCI_line_size 0x0c /* (1 byte) cache line size in 32 bit words */
|
||||
#define PCI_latency 0x0d /* (1 byte) latency timer */
|
||||
#define PCI_header_type 0x0e /* (1 byte) header type */
|
||||
#define PCI_bist 0x0f /* (1 byte) built-in self-test */
|
||||
|
||||
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of the predefined
|
||||
header common to header types 0x00 and 0x01
|
||||
--- */
|
||||
#define PCI_base_registers 0x10 /* base registers (size varies) */
|
||||
#define PCI_interrupt_line 0x3c /* (1 byte) interrupt line */
|
||||
#define PCI_interrupt_pin 0x3d /* (1 byte) interrupt pin */
|
||||
|
||||
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of header type 0x00
|
||||
--- */
|
||||
|
||||
#define PCI_cardbus_cis 0x28 /* (4 bytes) CardBus CIS (Card Information Structure) pointer (see PCMCIA v2.10 Spec) */
|
||||
#define PCI_subsystem_vendor_id 0x2c /* (2 bytes) subsystem (add-in card) vendor id */
|
||||
#define PCI_subsystem_id 0x2e /* (2 bytes) subsystem (add-in card) id */
|
||||
#define PCI_rom_base 0x30 /* (4 bytes) expansion rom base address */
|
||||
#define PCI_capabilities_ptr 0x34 /* (1 byte) pointer to the start of the capabilities list */
|
||||
#define PCI_min_grant 0x3e /* (1 byte) burst period @ 33 Mhz */
|
||||
#define PCI_max_latency 0x3f /* (1 byte) how often PCI access needed */
|
||||
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of header type 0x01 (PCI-to-PCI bridge)
|
||||
--- */
|
||||
|
||||
#define PCI_primary_bus 0x18 /* (1 byte) */
|
||||
#define PCI_secondary_bus 0x19 /* (1 byte) */
|
||||
#define PCI_subordinate_bus 0x1A /* (1 byte) */
|
||||
#define PCI_secondary_latency 0x1B /* (1 byte) latency of secondary bus */
|
||||
#define PCI_io_base 0x1C /* (1 byte) io base address register for 2ndry bus*/
|
||||
#define PCI_io_limit 0x1D /* (1 byte) */
|
||||
#define PCI_secondary_status 0x1E /* (2 bytes) */
|
||||
#define PCI_memory_base 0x20 /* (2 bytes) */
|
||||
#define PCI_memory_limit 0x22 /* (2 bytes) */
|
||||
#define PCI_prefetchable_memory_base 0x24 /* (2 bytes) */
|
||||
#define PCI_prefetchable_memory_limit 0x26 /* (2 bytes) */
|
||||
#define PCI_prefetchable_memory_base_upper32 0x28
|
||||
#define PCI_prefetchable_memory_limit_upper32 0x2C
|
||||
#define PCI_io_base_upper16 0x30 /* (2 bytes) */
|
||||
#define PCI_io_limit_upper16 0x32 /* (2 bytes) */
|
||||
#define PCI_sub_vendor_id_1 0x34 /* (2 bytes) */
|
||||
#define PCI_sub_device_id_1 0x36 /* (2 bytes) */
|
||||
#define PCI_bridge_rom_base 0x38
|
||||
#define PCI_bridge_control 0x3E /* (1 byte) */
|
||||
|
||||
|
||||
/* PCI type 2 header offsets */
|
||||
#define PCI_capabilities_ptr_2 0x14 /* (1 byte) */
|
||||
#define PCI_secondary_status_2 0x16 /* (2 bytes) */
|
||||
#define PCI_primary_bus_2 0x18 /* (1 byte) */
|
||||
#define PCI_secondary_bus_2 0x19 /* (1 byte) */
|
||||
#define PCI_subordinate_bus_2 0x1A /* (1 byte) */
|
||||
#define PCI_secondary_latency_2 0x1B /* (1 byte) latency of secondary bus */
|
||||
#define PCI_memory_base0_2 0x1C /* (4 bytes) */
|
||||
#define PCI_memory_limit0_2 0x20 /* (4 bytes) */
|
||||
#define PCI_memory_base1_2 0x24 /* (4 bytes) */
|
||||
#define PCI_memory_limit1_2 0x28 /* (4 bytes) */
|
||||
#define PCI_io_base0_2 0x2c /* (4 bytes) */
|
||||
#define PCI_io_limit0_2 0x30 /* (4 bytes) */
|
||||
#define PCI_io_base1_2 0x34 /* (4 bytes) */
|
||||
#define PCI_io_limit1_2 0x38 /* (4 bytes) */
|
||||
#define PCI_bridge_control_2 0x3E /* (1 byte) */
|
||||
|
||||
#define PCI_sub_vendor_id_2 0x40 /* (2 bytes) */
|
||||
#define PCI_sub_device_id_2 0x42 /* (2 bytes) */
|
||||
|
||||
#define PCI_card_interface_2 0x44 /* ?? */
|
||||
|
||||
/* ---
|
||||
values for the class_base field in the common header
|
||||
--- */
|
||||
|
||||
#define PCI_early 0x00 /* built before class codes defined */
|
||||
#define PCI_mass_storage 0x01 /* mass storage_controller */
|
||||
#define PCI_network 0x02 /* network controller */
|
||||
#define PCI_display 0x03 /* display controller */
|
||||
#define PCI_multimedia 0x04 /* multimedia device */
|
||||
#define PCI_memory 0x05 /* memory controller */
|
||||
#define PCI_bridge 0x06 /* bridge controller */
|
||||
#define PCI_simple_communications 0x07 /* simple communications controller */
|
||||
#define PCI_base_peripheral 0x08 /* base system peripherals */
|
||||
#define PCI_input 0x09 /* input devices */
|
||||
#define PCI_docking_station 0x0a /* docking stations */
|
||||
#define PCI_processor 0x0b /* processors */
|
||||
#define PCI_serial_bus 0x0c /* serial_bus_controller */
|
||||
#define PCI_wireless 0x0d
|
||||
#define PCI_intelligent_io 0x0e
|
||||
#define PCI_satellite_communications 0x0f
|
||||
#define PCI_encryption_decryption 0x10
|
||||
#define PCI_data_acquisition 0x11
|
||||
|
||||
#define PCI_undefined 0xFF /* not in any defined class */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x00 (built before
|
||||
class codes were defined)
|
||||
--- */
|
||||
|
||||
#define PCI_early_not_vga 0x00 /* all except vga */
|
||||
#define PCI_early_vga 0x01 /* vga devices */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x01 (mass storage)
|
||||
--- */
|
||||
|
||||
#define PCI_scsi 0x00 /* SCSI controller */
|
||||
#define PCI_ide 0x01 /* IDE controller */
|
||||
#define PCI_floppy 0x02 /* floppy disk controller */
|
||||
#define PCI_ipi 0x03 /* IPI bus controller */
|
||||
#define PCI_raid 0x04 /* RAID controller */
|
||||
#define PCI_mass_storage_other 0x80 /* other mass storage controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x02 (network)
|
||||
--- */
|
||||
|
||||
#define PCI_ethernet 0x00 /* Ethernet controller */
|
||||
#define PCI_token_ring 0x01 /* Token Ring controller */
|
||||
#define PCI_fddi 0x02 /* FDDI controller */
|
||||
#define PCI_atm 0x03 /* ATM controller */
|
||||
#define PCI_isdn 0x04 /* ISDN controller */
|
||||
#define PCI_network_other 0x80 /* other network controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x03 (display)
|
||||
--- */
|
||||
|
||||
#define PCI_vga 0x00 /* VGA controller */
|
||||
#define PCI_xga 0x01 /* XGA controller */
|
||||
#define PCI_3d 0x02 /* £d controller */
|
||||
#define PCI_display_other 0x80 /* other display controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x04 (multimedia device)
|
||||
--- */
|
||||
|
||||
#define PCI_video 0x00 /* video */
|
||||
#define PCI_audio 0x01 /* audio */
|
||||
#define PCI_telephony 0x02 /* computer telephony device */
|
||||
#define PCI_multimedia_other 0x80 /* other multimedia device */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x05 (memory)
|
||||
--- */
|
||||
|
||||
#define PCI_ram 0x00 /* RAM */
|
||||
#define PCI_flash 0x01 /* flash */
|
||||
#define PCI_memory_other 0x80 /* other memory controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x06 (bridge)
|
||||
--- */
|
||||
|
||||
#define PCI_host 0x00 /* host bridge */
|
||||
#define PCI_isa 0x01 /* ISA bridge */
|
||||
#define PCI_eisa 0x02 /* EISA bridge */
|
||||
#define PCI_microchannel 0x03 /* MicroChannel bridge */
|
||||
#define PCI_pci 0x04 /* PCI-to-PCI bridge */
|
||||
#define PCI_pcmcia 0x05 /* PCMCIA bridge */
|
||||
#define PCI_nubus 0x06 /* NuBus bridge */
|
||||
#define PCI_cardbus 0x07 /* CardBus bridge */
|
||||
#define PCI_raceway 0x08 /* RACEway bridge */
|
||||
#define PCI_bridge_other 0x80 /* other bridge device */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x07 (simple
|
||||
communications controllers)
|
||||
--- */
|
||||
|
||||
#define PCI_serial 0x00 /* serial port controller */
|
||||
#define PCI_parallel 0x01 /* parallel port */
|
||||
#define PCI_multiport_serial 0x02 /* multiport serial controller */
|
||||
#define PCI_modem 0x03 /* modem */
|
||||
#define PCI_simple_communications_other 0x80 /* other communications device */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x07 (simple communications), and
|
||||
class_sub = 0x00 (serial port controller)
|
||||
--- */
|
||||
|
||||
#define PCI_serial_xt 0x00 /* XT-compatible serial controller */
|
||||
#define PCI_serial_16450 0x01 /* 16450-compatible serial controller */
|
||||
#define PCI_serial_16550 0x02 /* 16550-compatible serial controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x07 (simple communications), and
|
||||
class_sub = 0x01 (parallel port)
|
||||
--- */
|
||||
|
||||
#define PCI_parallel_simple 0x00 /* simple (output-only) parallel port */
|
||||
#define PCI_parallel_bidirectional 0x01 /* bidirectional parallel port */
|
||||
#define PCI_parallel_ecp 0x02 /* ECP 1.x compliant parallel port */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x08 (generic
|
||||
system peripherals)
|
||||
--- */
|
||||
|
||||
#define PCI_pic 0x00 /* periperal interrupt controller */
|
||||
#define PCI_dma 0x01 /* dma controller */
|
||||
#define PCI_timer 0x02 /* timers */
|
||||
#define PCI_rtc 0x03 /* real time clock */
|
||||
#define PCI_generic_hot_plug 0x04 /* generic PCI hot-plug controller */
|
||||
#define PCI_system_peripheral_other 0x80 /* other generic system peripheral */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x00 (peripheral interrupt controller)
|
||||
--- */
|
||||
|
||||
#define PCI_pic_8259 0x00 /* generic 8259 */
|
||||
#define PCI_pic_isa 0x01 /* ISA pic */
|
||||
#define PCI_pic_eisa 0x02 /* EISA pic */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x01 (dma controller)
|
||||
--- */
|
||||
|
||||
#define PCI_dma_8237 0x00 /* generic 8237 */
|
||||
#define PCI_dma_isa 0x01 /* ISA dma */
|
||||
#define PCI_dma_eisa 0x02 /* EISA dma */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x02 (timer)
|
||||
--- */
|
||||
|
||||
#define PCI_timer_8254 0x00 /* generic 8254 */
|
||||
#define PCI_timer_isa 0x01 /* ISA timer */
|
||||
#define PCI_timer_eisa 0x02 /* EISA timers (2 timers) */
|
||||
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x03 (real time clock
|
||||
--- */
|
||||
|
||||
#define PCI_rtc_generic 0x00 /* generic real time clock */
|
||||
#define PCI_rtc_isa 0x01 /* ISA real time clock */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x09 (input devices)
|
||||
--- */
|
||||
|
||||
#define PCI_keyboard 0x00 /* keyboard controller */
|
||||
#define PCI_pen 0x01 /* pen */
|
||||
#define PCI_mouse 0x02 /* mouse controller */
|
||||
#define PCI_scanner 0x03 /* scanner controller */
|
||||
#define PCI_gameport 0x04 /* gameport controller */
|
||||
#define PCI_input_other 0x80 /* other input controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x0a (docking stations)
|
||||
--- */
|
||||
|
||||
#define PCI_docking_generic 0x00 /* generic docking station */
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x0b (processor)
|
||||
--- */
|
||||
|
||||
#define PCI_386 0x00 /* 386 */
|
||||
#define PCI_486 0x01 /* 486 */
|
||||
#define PCI_pentium 0x02 /* Pentium */
|
||||
#define PCI_alpha 0x10 /* Alpha */
|
||||
#define PCI_PowerPC 0x20 /* PowerPC */
|
||||
#define PCI_mips 0x30 /* MIPS */
|
||||
#define PCI_coprocessor 0x40 /* co-processor */
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x0c (serial bus
|
||||
controller)
|
||||
--- */
|
||||
|
||||
#define PCI_firewire 0x00 /* FireWire (IEEE 1394) */
|
||||
#define PCI_access 0x01 /* ACCESS bus */
|
||||
#define PCI_ssa 0x02 /* SSA */
|
||||
#define PCI_usb 0x03 /* Universal Serial Bus */
|
||||
#define PCI_fibre_channel 0x04 /* Fibre channel */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x0c ( serial bus controller )
|
||||
class_sub = 0x03 ( Universal Serial Bus )
|
||||
--- */
|
||||
|
||||
#define PCI_usb_uhci 0x00 /* Universal Host Controller Interface */
|
||||
#define PCI_usb_ohci 0x10 /* Open Host Controller Interface */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for command register bits
|
||||
--- */
|
||||
|
||||
#define PCI_command_io 0x001 /* 1/0 i/o space en/disabled */
|
||||
#define PCI_command_memory 0x002 /* 1/0 memory space en/disabled */
|
||||
#define PCI_command_master 0x004 /* 1/0 pci master en/disabled */
|
||||
#define PCI_command_special 0x008 /* 1/0 pci special cycles en/disabled */
|
||||
#define PCI_command_mwi 0x010 /* 1/0 memory write & invalidate en/disabled */
|
||||
#define PCI_command_vga_snoop 0x020 /* 1/0 vga pallette snoop en/disabled */
|
||||
#define PCI_command_parity 0x040 /* 1/0 parity check en/disabled */
|
||||
#define PCI_command_address_step 0x080 /* 1/0 address stepping en/disabled */
|
||||
#define PCI_command_serr 0x100 /* 1/0 SERR# en/disabled */
|
||||
#define PCI_command_fastback 0x200 /* 1/0 fast back-to-back en/disabled */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for status register bits
|
||||
--- */
|
||||
|
||||
#define PCI_status_capabilities 0x0010 /* capabilities list */
|
||||
#define PCI_status_66_MHz_capable 0x0020 /* 66 Mhz capable */
|
||||
#define PCI_status_udf_supported 0x0040 /* user-definable-features (udf) supported */
|
||||
#define PCI_status_fastback 0x0080 /* fast back-to-back capable */
|
||||
#define PCI_status_parity_signalled 0x0100 /* parity error signalled */
|
||||
#define PCI_status_devsel 0x0600 /* devsel timing (see below) */
|
||||
#define PCI_status_target_abort_signalled 0x0800 /* signaled a target abort */
|
||||
#define PCI_status_target_abort_received 0x1000 /* received a target abort */
|
||||
#define PCI_status_master_abort_received 0x2000 /* received a master abort */
|
||||
#define PCI_status_serr_signalled 0x4000 /* signalled SERR# */
|
||||
#define PCI_status_parity_error_detected 0x8000 /* parity error detected */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for devsel field in status register
|
||||
--- */
|
||||
|
||||
#define PCI_status_devsel_fast 0x0000 /* fast */
|
||||
#define PCI_status_devsel_medium 0x0200 /* medium */
|
||||
#define PCI_status_devsel_slow 0x0400 /* slow */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for header type register
|
||||
--- */
|
||||
|
||||
#define PCI_header_type_mask 0x7F /* header type field */
|
||||
#define PCI_multifunction 0x80 /* multifunction device flag */
|
||||
|
||||
|
||||
/** types of PCI header */
|
||||
|
||||
#define PCI_header_type_generic 0x00
|
||||
#define PCI_header_type_PCI_to_PCI_bridge 0x01
|
||||
#define PCI_header_type_cardbus 0x02
|
||||
|
||||
|
||||
/* ---
|
||||
masks for built in self test (bist) register bits
|
||||
--- */
|
||||
|
||||
#define PCI_bist_code 0x0F /* self-test completion code, 0 = success */
|
||||
#define PCI_bist_start 0x40 /* 1 = start self-test */
|
||||
#define PCI_bist_capable 0x80 /* 1 = self-test capable */
|
||||
|
||||
|
||||
/** masks for flags in the various base address registers */
|
||||
|
||||
#define PCI_address_space 0x01 /* 0 = memory space, 1 = i/o space */
|
||||
#define PCI_register_start 0x10
|
||||
#define PCI_register_end 0x24
|
||||
#define PCI_register_ppb_end 0x18
|
||||
#define PCI_register_pcb_end 0x14
|
||||
|
||||
/** masks for flags in memory space base address registers */
|
||||
|
||||
#define PCI_address_type_32 0x00 /* locate anywhere in 32 bit space */
|
||||
#define PCI_address_type_32_low 0x02 /* locate below 1 Meg */
|
||||
#define PCI_address_type_64 0x04 /* locate anywhere in 64 bit space */
|
||||
#define PCI_address_type 0x06 /* type (see below) */
|
||||
#define PCI_address_prefetchable 0x08 /* 1 if prefetchable (see PCI spec) */
|
||||
|
||||
#define PCI_address_memory_32_mask 0xFFFFFFF0 /* mask to get 32bit memory space base address */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for flags in i/o space base address registers
|
||||
--- */
|
||||
|
||||
#define PCI_address_io_mask 0xFFFFFFFC /* mask to get i/o space base address */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for flags in expansion rom base address registers
|
||||
--- */
|
||||
|
||||
#define PCI_rom_enable 0x00000001 /* 1 = expansion rom decode enabled */
|
||||
#define PCI_rom_address_mask 0xFFFFF800 /* mask to get expansion rom addr */
|
||||
|
||||
/** PCI interrupt pin values */
|
||||
#define PCI_pin_mask 0x07
|
||||
#define PCI_pin_none 0x00
|
||||
#define PCI_pin_a 0x01
|
||||
#define PCI_pin_b 0x02
|
||||
#define PCI_pin_c 0x03
|
||||
#define PCI_pin_d 0x04
|
||||
#define PCI_pin_max 0x04
|
||||
|
||||
/** PCI Capability Codes */
|
||||
#define PCI_cap_id_reserved 0x00
|
||||
#define PCI_cap_id_pm 0x01 /* Power management */
|
||||
#define PCI_cap_id_agp 0x02 /* AGP */
|
||||
#define PCI_cap_id_vpd 0x03 /* Vital product data */
|
||||
#define PCI_cap_id_slotid 0x04 /* Slot ID */
|
||||
#define PCI_cap_id_msi 0x05 /* Message signalled interrupt ??? */
|
||||
#define PCI_cap_id_chswp 0x06 /* Compact PCI HotSwap */
|
||||
#define PCI_cap_id_pcix 0x07
|
||||
#define PCI_cap_id_ldt 0x08
|
||||
#define PCI_cap_id_vendspec 0x09
|
||||
#define PCI_cap_id_debugport 0x0a
|
||||
#define PCI_cap_id_cpci_rsrcctl 0x0b
|
||||
#define PCI_cap_id_hotplug 0x0c
|
||||
|
||||
/** Power Management Control Status Register settings */
|
||||
#define PCI_pm_mask 0x03
|
||||
#define PCI_pm_ctrl 0x02
|
||||
#define PCI_pm_d1supp 0x0200
|
||||
#define PCI_pm_d2supp 0x0400
|
||||
#define PCI_pm_status 0x04
|
||||
#define PCI_pm_state_d0 0x00
|
||||
#define PCI_pm_state_d1 0x01
|
||||
#define PCI_pm_state_d2 0x02
|
||||
#define PCI_pm_state_d3 0x03
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PCI_H */
|
44
headers/build/os/drivers/Select.h
Normal file
44
headers/build/os/drivers/Select.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* File System and Drivers select support
|
||||
**
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
#ifndef _DRIVERS_SELECT_H
|
||||
#define _DRIVERS_SELECT_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
struct selectsync;
|
||||
typedef struct selectsync selectsync;
|
||||
|
||||
enum select_events {
|
||||
B_SELECT_READ = 1, // standard select() support
|
||||
B_SELECT_WRITE,
|
||||
B_SELECT_ERROR,
|
||||
|
||||
B_SELECT_PRI_READ, // additional poll() support
|
||||
B_SELECT_PRI_WRITE,
|
||||
|
||||
B_SELECT_HIGH_PRI_READ,
|
||||
B_SELECT_HIGH_PRI_WRITE,
|
||||
|
||||
B_SELECT_DISCONNECTED
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_FOR_R5
|
||||
extern void notify_select_event(struct selectsync *sync, uint32 ref);
|
||||
#else
|
||||
extern status_t notify_select_event(struct selectsync *sync, uint32 ref, uint8 event);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DRIVERS_SELECT_H */
|
189
headers/build/os/drivers/USB.h
Normal file
189
headers/build/os/drivers/USB.h
Normal file
@ -0,0 +1,189 @@
|
||||
/*
|
||||
** USB.h - Version 2 USB Device Driver API
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_H
|
||||
#define _USB_H
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <bus_manager.h>
|
||||
|
||||
#include <USB_spec.h>
|
||||
#include <USB_rle.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct usb_module_info usb_module_info;
|
||||
|
||||
/* these are opaque handles to internal stack objects */
|
||||
typedef struct usb_device usb_device;
|
||||
typedef struct usb_interface usb_interface;
|
||||
typedef struct usb_pipe usb_pipe;
|
||||
|
||||
typedef struct usb_endpoint_info usb_endpoint_info;
|
||||
typedef struct usb_interface_info usb_interface_info;
|
||||
typedef struct usb_interface_list usb_interface_list;
|
||||
typedef struct usb_configuration_info usb_configuration_info;
|
||||
|
||||
typedef struct usb_notify_hooks {
|
||||
status_t (*device_added)(const usb_device *device, void **cookie);
|
||||
status_t (*device_removed)(void *cookie);
|
||||
} usb_notify_hooks;
|
||||
|
||||
typedef struct usb_support_descriptor {
|
||||
uint8 dev_class;
|
||||
uint8 dev_subclass;
|
||||
uint8 dev_protocol;
|
||||
uint16 vendor;
|
||||
uint16 product;
|
||||
} usb_support_descriptor;
|
||||
|
||||
/* ie, I support any hub device:
|
||||
** usb_support_descriptor hub_devs = { 9, 0, 0, 0, 0 };
|
||||
*/
|
||||
|
||||
struct usb_endpoint_info {
|
||||
usb_endpoint_descriptor *descr; /* descriptor and handle */
|
||||
usb_pipe *handle; /* of this endpoint/pipe */
|
||||
};
|
||||
|
||||
struct usb_interface_info {
|
||||
usb_interface_descriptor *descr; /* descriptor and handle */
|
||||
usb_interface *handle; /* of this interface */
|
||||
|
||||
size_t endpoint_count; /* count and list of endpoints */
|
||||
usb_endpoint_info *endpoint; /* in this interface */
|
||||
|
||||
size_t generic_count; /* unparsed descriptors in this */
|
||||
usb_descriptor **generic; /* interface */
|
||||
};
|
||||
|
||||
struct usb_interface_list {
|
||||
size_t alt_count; /* count and list of alternate */
|
||||
usb_interface_info *alt; /* interfaces available */
|
||||
|
||||
usb_interface_info *active; /* currently active alternate */
|
||||
};
|
||||
|
||||
struct usb_configuration_info {
|
||||
usb_configuration_descriptor *descr; /* descriptor of this config */
|
||||
|
||||
size_t interface_count; /* interfaces in this config */
|
||||
usb_interface_list *interface;
|
||||
};
|
||||
|
||||
|
||||
typedef void (*usb_callback_func)(void *cookie, uint32 status,
|
||||
void *data, uint32 actual_len);
|
||||
|
||||
struct usb_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
/* inform the bus manager of our intent to support a set of devices */
|
||||
status_t (*register_driver)(const char *driver_name,
|
||||
const usb_support_descriptor *descriptors,
|
||||
size_t count,
|
||||
const char *optional_republish_driver_name);
|
||||
|
||||
/* request notification from the bus manager for add/remove of devices we
|
||||
support */
|
||||
status_t (*install_notify)(const char *driver_name,
|
||||
const usb_notify_hooks *hooks);
|
||||
status_t (*uninstall_notify)(const char *driver_name);
|
||||
|
||||
/* get the device descriptor */
|
||||
const usb_device_descriptor *(*get_device_descriptor)(const usb_device *dev);
|
||||
|
||||
/* get the nth supported configuration */
|
||||
const usb_configuration_info *(*get_nth_configuration)(const usb_device *dev, uint index);
|
||||
|
||||
/* get the active configuration */
|
||||
const usb_configuration_info *(*get_configuration)(const usb_device *dev);
|
||||
|
||||
/* set the active configuration */
|
||||
status_t (*set_configuration)(const usb_device *dev,
|
||||
const usb_configuration_info *configuration);
|
||||
|
||||
status_t (*set_alt_interface)(const usb_device *dev,
|
||||
const usb_interface_info *ifc);
|
||||
|
||||
/* standard device requests -- convenience functions */
|
||||
/* obj may be a usb_device*, usb_pipe*, or usb_interface* */
|
||||
status_t (*set_feature)(const void *object, uint16 selector);
|
||||
status_t (*clear_feature)(const void *object, uint16 selector);
|
||||
status_t (*get_status)(const void *object, uint16 *status);
|
||||
|
||||
status_t (*get_descriptor)(const usb_device *d,
|
||||
uint8 type, uint8 index, uint16 lang,
|
||||
void *data, size_t len, size_t *actual_len);
|
||||
|
||||
/* generic device request function */
|
||||
status_t (*send_request)(const usb_device *d,
|
||||
uint8 request_type, uint8 request,
|
||||
uint16 value, uint16 index, uint16 length,
|
||||
void *data, size_t data_len, size_t *actual_len);
|
||||
|
||||
/* async request queueing */
|
||||
status_t (*queue_interrupt)(const usb_pipe *handle,
|
||||
void *data, size_t len,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*queue_bulk)(const usb_pipe *handle,
|
||||
void *data, size_t len,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*queue_isochronous)(const usb_pipe *handle,
|
||||
void *data, size_t len,
|
||||
rlea* rle_array, uint16 buffer_duration_ms,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*queue_request)(const usb_device *d,
|
||||
uint8 request_type, uint8 request,
|
||||
uint16 value, uint16 index, uint16 length,
|
||||
void *data, size_t data_len,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*set_pipe_policy)(const usb_pipe *handle, uint8 max_num_queued_packets,
|
||||
uint16 max_buffer_duration_ms, uint16 sample_size);
|
||||
|
||||
/* cancel pending async requests to an endpoint */
|
||||
status_t (*cancel_queued_transfers)(const usb_pipe *handle);
|
||||
|
||||
/* tuning, timeouts, etc */
|
||||
status_t (*usb_ioctl)(uint32 opcode, void* buf, size_t buf_size);
|
||||
};
|
||||
|
||||
/* status code for usb callback functions */
|
||||
#define B_USB_STATUS_SUCCESS 0x0000
|
||||
#define B_USB_STATUS_DEVICE_CRC_ERROR 0x0002
|
||||
#define B_USB_STATUS_DEVICE_TIMEOUT 0x0004
|
||||
#define B_USB_STATUS_DEVICE_STALLED 0x0008
|
||||
#define B_USB_STATUS_IRP_CANCELLED_BY_REQUEST 0x0010
|
||||
#define B_USB_STATUS_DRIVER_INTERNAL_ERROR 0x0020
|
||||
#define B_USB_STATUS_ADAPTER_HARDWARE_ERROR 0x0040
|
||||
#define B_USB_STATUS_ISOCH_IRP_ABORTED 0x0080
|
||||
|
||||
/* result codes for usb bus manager functions */
|
||||
#define B_USBD_SUCCESS 0
|
||||
#define B_USBD_BAD_HANDLE 1
|
||||
#define B_USBD_BAD_ARGS 2
|
||||
#define B_USBD_NO_DATA 3
|
||||
#define B_USBD_DEVICE_FAILURE 4
|
||||
#define B_USBD_COMMAND_FAILED 5
|
||||
#define B_USBD_PIPE_NOT_CONFIGURED 6
|
||||
#define B_USBD_DEVICE_ERROR 7
|
||||
#define B_USBD_PIPE_ERROR 8
|
||||
#define B_USBD_NO_MEMORY 9
|
||||
|
||||
#define B_USB_MODULE_NAME "bus_managers/usb/v2"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
36
headers/build/os/drivers/USB_printer.h
Normal file
36
headers/build/os/drivers/USB_printer.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
** USB_printer.h
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_PRINTER_H
|
||||
#define _USB_PRINTER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ioctl() opcodes for usb_printer driver */
|
||||
|
||||
enum
|
||||
{
|
||||
USB_PRINTER_GET_DEVICE_ID = B_DEVICE_OP_CODES_END+1
|
||||
};
|
||||
|
||||
|
||||
/* Maximum length of the DEVICE_ID. User MUST allocate this size
|
||||
when calling USB_PRINTER_GET_DEVICE_ID ioctl() */
|
||||
|
||||
#define USB_PRINTER_DEVICE_ID_LENGTH 256
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
91
headers/build/os/drivers/USB_rle.h
Normal file
91
headers/build/os/drivers/USB_rle.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
** USB_rle.h
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_RLE_H
|
||||
#define _USB_RLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _usbd_param_hdr;
|
||||
|
||||
/*
|
||||
Run Length encoding records for isochronous IN transfers.
|
||||
|
||||
Run Length encoding records are used to identify which samples in
|
||||
the buffer are good which are bad and which are missing.
|
||||
Bad bytes are not extracted from the buffer, but are padded to next
|
||||
nearest sample boundary. The ultimate consumer of the buffer
|
||||
should also receive the RLE array.
|
||||
|
||||
RLE records are constructed based on the following rules:
|
||||
|
||||
1. an RLE record contains a sample count and a status
|
||||
(good, bad, missing or unknown). A buffer has
|
||||
associated with it an array of rle records. The number of
|
||||
rle records available is specified in the RLE header. The
|
||||
number used is also in the RLE header.
|
||||
|
||||
2. Within the scope of a buffer, successive packets with the
|
||||
same completion status are represented with (1) rle record.
|
||||
For example, after three transactions which have completion
|
||||
status of success, the byte count in the rle record for this
|
||||
position in the data stream represents the bytes received in
|
||||
all three packets.
|
||||
|
||||
3. New rle records are initialized each time the status for a
|
||||
given packet differs from that of the previous packet.
|
||||
|
||||
*/
|
||||
|
||||
#define RLE_GOOD 1
|
||||
#define RLE_BAD 2
|
||||
#define RLE_MISSING 3
|
||||
#define RLE_UNKNOWN 4
|
||||
|
||||
/*
|
||||
Name: rle
|
||||
Purpose: used to represent the state of a portion of a data buffer
|
||||
Fields:
|
||||
rle_status will contain only the values: RLE_GOOD, RLE_BAD, RLE_MISSING
|
||||
sample_count the number of usb samples in the buffer associated with this rle
|
||||
record.
|
||||
Notes:
|
||||
If the buffer length field in queue_buffer_single structure changes to an
|
||||
uint32 from uin16, then the sample_count data type must
|
||||
track this change.
|
||||
*/
|
||||
typedef struct rle {
|
||||
uint16 rle_status;
|
||||
uint16 sample_count;
|
||||
} rle;
|
||||
|
||||
|
||||
/*
|
||||
Name: rlea
|
||||
Purpose: used as the primary rle information data structure between the
|
||||
USB driver stack and a consuming client.
|
||||
|
||||
Fields:
|
||||
length the number of rle records available in this structure.
|
||||
num_valid filled in by the USB driver. indicates the number of valid
|
||||
records filled.
|
||||
rles[] unconstrained array of rle records.
|
||||
*/
|
||||
typedef struct rlea {
|
||||
uint16 length;
|
||||
uint16 num_valid;
|
||||
rle rles[1];
|
||||
} rlea;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
144
headers/build/os/drivers/USB_spec.h
Normal file
144
headers/build/os/drivers/USB_spec.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
** USB_spec.h
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
** This file contains structures and constants based on the USB Specification 1.1
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_SPEC_H
|
||||
#define _USB_SPEC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* request types (target & direction) for send_request() */
|
||||
/* cf USB Spec Rev 1.1, table 9-2, p 183 */
|
||||
#define USB_REQTYPE_DEVICE_IN 0x80
|
||||
#define USB_REQTYPE_DEVICE_OUT 0x00
|
||||
#define USB_REQTYPE_INTERFACE_IN 0x81
|
||||
#define USB_REQTYPE_INTERFACE_OUT 0x01
|
||||
#define USB_REQTYPE_ENDPOINT_IN 0x82
|
||||
#define USB_REQTYPE_ENDPOINT_OUT 0x02
|
||||
#define USB_REQTYPE_OTHER_OUT 0x03
|
||||
#define USB_REQTYPE_OTHER_IN 0x83
|
||||
|
||||
/* request types for send_request() */
|
||||
/* cf USB Spec Rev 1.1, table 9-2, p 183 */
|
||||
#define USB_REQTYPE_STANDARD 0x00
|
||||
#define USB_REQTYPE_CLASS 0x20
|
||||
#define USB_REQTYPE_VENDOR 0x40
|
||||
#define USB_REQTYPE_RESERVED 0x60
|
||||
#define USB_REQTYPE_MASK 0x9F
|
||||
|
||||
/* standard request values for send_request() */
|
||||
/* cf USB Spec Rev 1.1, table 9-4, p 187 */
|
||||
#define USB_REQUEST_GET_STATUS 0
|
||||
#define USB_REQUEST_CLEAR_FEATURE 1
|
||||
#define USB_REQUEST_SET_FEATURE 3
|
||||
#define USB_REQUEST_SET_ADDRESS 5
|
||||
#define USB_REQUEST_GET_DESCRIPTOR 6
|
||||
#define USB_REQUEST_SET_DESCRIPTOR 7
|
||||
#define USB_REQUEST_GET_CONFIGURATION 8
|
||||
#define USB_REQUEST_SET_CONFIGURATION 9
|
||||
#define USB_REQUEST_GET_INTERFACE 10
|
||||
#define USB_REQUEST_SET_INTERFACE 11
|
||||
#define USB_REQUEST_SYNCH_FRAME 12
|
||||
|
||||
/* used by {set,get}_descriptor() */
|
||||
/* cf USB Spec Rev 1.1, table 9-5, p 187 */
|
||||
#define USB_DESCRIPTOR_DEVICE 1
|
||||
#define USB_DESCRIPTOR_CONFIGURATION 2
|
||||
#define USB_DESCRIPTOR_STRING 3
|
||||
#define USB_DESCRIPTOR_INTERFACE 4
|
||||
#define USB_DESCRIPTOR_ENDPOINT 5
|
||||
|
||||
/* used by {set,clear}_feature() */
|
||||
/* cf USB Spec Rev 1.1, table 9-6, p 188 */
|
||||
#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1
|
||||
#define USB_FEATURE_ENDPOINT_HALT 0
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-7, p 197 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_DEVICE */
|
||||
uint16 usb_version; /* USB_DESCRIPTOR_DEVICE_LENGTH */
|
||||
uint8 device_class;
|
||||
uint8 device_subclass;
|
||||
uint8 device_protocol;
|
||||
uint8 max_packet_size_0;
|
||||
uint16 vendor_id;
|
||||
uint16 product_id;
|
||||
uint16 device_version;
|
||||
uint8 manufacturer;
|
||||
uint8 product;
|
||||
uint8 serial_number;
|
||||
uint8 num_configurations;
|
||||
} _PACKED usb_device_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-8, p 199 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_CONFIGURATION */
|
||||
uint16 total_length; /* USB_DESCRIPTOR_CONFIGURATION_LENGTH */
|
||||
uint8 number_interfaces;
|
||||
uint8 configuration_value;
|
||||
uint8 configuration;
|
||||
uint8 attributes;
|
||||
uint8 max_power;
|
||||
} _PACKED usb_configuration_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-9, p 202 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_INTERFACE */
|
||||
uint8 interface_number; /* USB_DESCRIPTOR_INTERFACE_LENGTH */
|
||||
uint8 alternate_setting;
|
||||
uint8 num_endpoints;
|
||||
uint8 interface_class;
|
||||
uint8 interface_subclass;
|
||||
uint8 interface_protocol;
|
||||
uint8 interface;
|
||||
} _PACKED usb_interface_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-10, p 203 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_ENDPOINT */
|
||||
uint8 endpoint_address; /* USB_DESCRIPTOR_ENDPOINT_LENGTH */
|
||||
uint8 attributes;
|
||||
uint16 max_packet_size;
|
||||
uint8 interval;
|
||||
} _PACKED usb_endpoint_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-12, p 205 */
|
||||
uint8 length; /* USB_DESCRIPTOR_STRING */
|
||||
uint8 descriptor_type;
|
||||
uchar string[1];
|
||||
} _PACKED usb_string_descriptor;
|
||||
|
||||
typedef struct {
|
||||
uint8 length;
|
||||
uint8 descriptor_type;
|
||||
uint8 data[1];
|
||||
} _PACKED usb_generic_descriptor;
|
||||
|
||||
typedef union {
|
||||
usb_generic_descriptor generic;
|
||||
usb_device_descriptor device;
|
||||
usb_interface_descriptor interface;
|
||||
usb_endpoint_descriptor endpoint;
|
||||
usb_configuration_descriptor configuration;
|
||||
usb_string_descriptor string;
|
||||
} usb_descriptor;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
97
headers/build/os/drivers/atomizer.h
Normal file
97
headers/build/os/drivers/atomizer.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: atomizer.h
|
||||
/
|
||||
/ Description: Kernel atomizer module API
|
||||
/
|
||||
/ Copyright 1999, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _ATOMIZER_MODULE_H_
|
||||
#define _ATOMIZER_MODULE_H_
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
An atomizer is a software device that returns a unique token for a
|
||||
null-terminated UTF8 string.
|
||||
|
||||
Each atomizer comprises a separate token space. The same string interned
|
||||
in two different atomizers will generate two distinct tokens.
|
||||
|
||||
Atomizers and the tokens they generate are only guaranteed valid between
|
||||
matched calls to get_module/put_module.
|
||||
|
||||
void * find_or_make_atomizer(const char *string)
|
||||
Returns a token that identifies the named atomizer, creating a new
|
||||
atomizer if the named atomizer does not exist. Pass null, a zero
|
||||
length string, or the value B_SYSTEM_ATOMIZER_NAME for string will
|
||||
return a pointer to the system atomizer. Returns (void *)(0)
|
||||
if the atomizer could not be created (for whatever reason). A return
|
||||
value of (void *)(-1) refers to the system atomizer.
|
||||
|
||||
status_t delete_atomizer(void *atomizer)
|
||||
Delete the atomizer specified. Returns B_OK if successfull, B_ERROR
|
||||
otherwise. An error return usually means that a race condition was
|
||||
detected while destroying the atomizer.
|
||||
|
||||
void * atomize(void *atomizer, const char *string, int create)
|
||||
Return the unique token for the specified string, creating a new token
|
||||
if the string was not previously atomized and create is non-zero. If
|
||||
atomizer is (void *)(-1), use the system atomizer (saving the step of
|
||||
looking it up with find_or_make_atomizer(). Returns (const char *)(0)
|
||||
if there were any errors detected: insufficient memory or a race
|
||||
condition with someone deleting the atomizer.
|
||||
|
||||
const char * string_for_token(void *atomizer, void *atom)
|
||||
Return a pointer to the string described by atom in the provided atomizer.
|
||||
Returns (const char *)(0) if either the atomizer or the atom were invalid.
|
||||
|
||||
status_t get_next_atomizer_info(void **cookie, atomizer_info *info)
|
||||
Returns info about the next atomizer in the list of atomizers by modifying
|
||||
the contents of info. The pointer specified by *cookie should be set to
|
||||
(void *)(0) to retrieve the first atomizer, and should not be modified
|
||||
thereafter. Returns B_ERROR when there are no more atomizers.
|
||||
Adding or deleting atomizers between calls to get_next_atomizer() results
|
||||
in a safe but undefined behavior.
|
||||
|
||||
void * get_next_atom(void *atomizer, uint32 *cookie)
|
||||
Returns the next atom interned in specified atomizer, *cookie
|
||||
should be set to (uint32)(0) to get the first atom. Returns
|
||||
(void *)(0) when there are no more atoms. Adding atoms between
|
||||
calls to get_next_atom() may cause atoms to be skipped.
|
||||
|
||||
Atomizers are SMP-safe. Check return codes for errors!
|
||||
|
||||
*/
|
||||
|
||||
#define B_ATOMIZER_MODULE_NAME "generic/atomizer/v1"
|
||||
#define B_SYSTEM_ATOMIZER_NAME "BeOS System Atomizer"
|
||||
|
||||
typedef struct {
|
||||
void *atomizer; /* An opaque token representing the atomizer. */
|
||||
char name[B_OS_NAME_LENGTH]; /* The first B_OS_NAME_LENGTH bytes of the atomizer name, null terminated. */
|
||||
uint32 atom_count; /* The number of atoms currently interned in this atomizer. */
|
||||
} atomizer_info;
|
||||
|
||||
typedef struct {
|
||||
module_info minfo;
|
||||
const void * (*find_or_make_atomizer)(const char *string);
|
||||
status_t (*delete_atomizer)(const void *atomizer);
|
||||
const void * (*atomize)(const void *atomizer, const char *string, int create);
|
||||
const char * (*string_for_token)(const void * atomizer, const void *atom);
|
||||
status_t (*get_next_atomizer_info)(void **cookie, atomizer_info *info);
|
||||
const void * (*get_next_atom)(const void *atomizer, uint32 *cookie);
|
||||
} atomizer_module_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
100
headers/build/os/drivers/block_io.h
Normal file
100
headers/build/os/drivers/block_io.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __BLOCK_IO_H__
|
||||
#define __BLOCK_IO_H__
|
||||
|
||||
/*
|
||||
Part of Open block device manager
|
||||
|
||||
Block devices can be easily written by providing the interface
|
||||
specified hereinafter. The block device manager takes care of
|
||||
DMA and other restrictions imposed by underlying controller or
|
||||
protocol and transparently handles transmission of partial blocks
|
||||
by using a buffer (performance will suffer, though).
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
// cookies issued by block_io
|
||||
typedef struct block_io_device_info *block_io_device;
|
||||
typedef struct block_io_handle_info *block_io_handle;
|
||||
|
||||
// cookies issued by device driver
|
||||
typedef struct block_device_device_cookie *block_device_device_cookie;
|
||||
typedef struct block_device_handle_cookie *block_device_handle_cookie;
|
||||
|
||||
|
||||
// two reason why to use array of size 1:
|
||||
// 1. zero-sized arrays aren't standard C
|
||||
// 2. it's handy if you need a temporary global variable with num=1
|
||||
typedef struct phys_vecs {
|
||||
size_t num;
|
||||
size_t total_len;
|
||||
physical_entry vec[1];
|
||||
} phys_vecs;
|
||||
|
||||
#define PHYS_VECS(name, size) \
|
||||
uint8 name[sizeof(phys_vecs) + (size - 1)*sizeof(phys_vec)]; \
|
||||
phys_vecs *name = (phys_vecs *)name
|
||||
|
||||
|
||||
// Block Device Node
|
||||
|
||||
// attributes:
|
||||
|
||||
// if true, this device may be a BIOS drive (uint8, optional, default: false)
|
||||
#define B_BLOCK_DEVICE_IS_BIOS_DRIVE "block_device/is_bios_drive"
|
||||
// address bits that must be 0 - must be 2^i-1 for some i (uint32, optional, default: 0)
|
||||
#define B_BLOCK_DEVICE_DMA_ALIGNMENT "block_device/dma_alignment"
|
||||
// maximum number of blocks per transfer (uint32, optional, default: unlimited)
|
||||
#define B_BLOCK_DEVICE_MAX_BLOCKS_ITEM "block_device/max_blocks"
|
||||
// mask of bits that can change in one sg block (uint32, optional, default: ~0)
|
||||
#define B_BLOCK_DEVICE_DMA_BOUNDARY "block_device/dma_boundary"
|
||||
// maximum size of one block in scatter/gather list (uint32, optional, default: ~0)
|
||||
#define B_BLOCK_DEVICE_MAX_SG_BLOCK_SIZE "block_device/max_sg_block_size"
|
||||
// maximum number of scatter/gather blocks (uint32, optional, default: unlimited)
|
||||
#define B_BLOCK_DEVICE_MAX_SG_BLOCKS "block_device/max_sg_blocks"
|
||||
|
||||
|
||||
// interface to be provided by device driver
|
||||
typedef struct block_device_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// iovecs are physical address here
|
||||
// pos and num_blocks are in blocks; bytes_transferred in bytes
|
||||
// vecs are guaranteed to describe enough data for given block count
|
||||
status_t (*open)(block_device_device_cookie device, block_device_handle_cookie *handle);
|
||||
status_t (*close)(block_device_handle_cookie handle);
|
||||
status_t (*free)(block_device_handle_cookie handle);
|
||||
|
||||
status_t (*read)(block_device_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred);
|
||||
status_t (*write)(block_device_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred);
|
||||
|
||||
status_t (*ioctl)(block_device_handle_cookie handle, int op, void *buf, size_t len);
|
||||
} block_device_interface;
|
||||
|
||||
#define B_BLOCK_IO_MODULE_NAME "generic/block_io/v1"
|
||||
|
||||
|
||||
// Interface for Drivers
|
||||
|
||||
// blkman interface used for callbacks done by driver
|
||||
typedef struct block_io_for_driver_interface {
|
||||
module_info info;
|
||||
|
||||
// block_size - block size in bytes
|
||||
// ld_block_size - log2( block_size) (set to zero if block_size is not power of two)
|
||||
// capacity - capacity in blocks
|
||||
void (*set_media_params)(block_io_device device, uint32 block_size, uint32 ld_block_size,
|
||||
uint64 capacity);
|
||||
} block_io_for_driver_interface;
|
||||
|
||||
#define B_BLOCK_IO_FOR_DRIVER_MODULE_NAME "generic/block_io/driver/v1"
|
||||
|
||||
#endif /* __BLOCK_IO_H__ */
|
363
headers/build/os/drivers/bus/IDE.h
Normal file
363
headers/build/os/drivers/bus/IDE.h
Normal file
@ -0,0 +1,363 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Part of Open IDE bus manager
|
||||
|
||||
IDE bus manager interface
|
||||
*/
|
||||
|
||||
#ifndef __IDE_H__
|
||||
#define __IDE_H__
|
||||
|
||||
#include <bus_manager.h>
|
||||
#include <iovec.h>
|
||||
#include <lendian_bitfield.h>
|
||||
#include <device_manager.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
// IDE task file.
|
||||
// contains the command block interpreted under different conditions with
|
||||
// first byte being first command register, second byte second command register
|
||||
// etc.; for lba48, registers must be written twice, therefore there
|
||||
// are twice as many bytes as registers - the first eight bytes are those
|
||||
// that must be written first, the second eight bytes are those that
|
||||
// must be written second.
|
||||
typedef union {
|
||||
struct {
|
||||
uint8 features;
|
||||
uint8 sector_count;
|
||||
uint8 sector_number;
|
||||
uint8 cylinder_0_7;
|
||||
uint8 cylinder_8_15;
|
||||
LBITFIELD8_3(
|
||||
head : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
} chs;
|
||||
struct {
|
||||
uint8 features;
|
||||
uint8 sector_count;
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
lba_24_27 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
} lba;
|
||||
struct {
|
||||
LBITFIELD8_3(
|
||||
dma : 1,
|
||||
ovl : 1,
|
||||
_0_res2 : 6
|
||||
);
|
||||
LBITFIELD8_2(
|
||||
_1_res0 : 3,
|
||||
tag : 5
|
||||
);
|
||||
uint8 _2_res;
|
||||
uint8 byte_count_0_7;
|
||||
uint8 byte_count_8_15;
|
||||
LBITFIELD8_6(
|
||||
lun : 3,
|
||||
_5_res3 : 1,
|
||||
device : 1,
|
||||
_5_one5 : 1,
|
||||
_5_res6 : 1,
|
||||
_5_one7 : 1
|
||||
);
|
||||
uint8 command;
|
||||
} packet;
|
||||
struct {
|
||||
LBITFIELD8_5(
|
||||
ili : 1,
|
||||
eom : 1,
|
||||
abrt : 1,
|
||||
_0_res3 : 1,
|
||||
sense_key : 4
|
||||
);
|
||||
LBITFIELD8_4(
|
||||
cmd_or_data : 1, // 1 - cmd, 0 - data
|
||||
input_or_output : 1, // 0 - input (to device), 1 - output
|
||||
release : 1,
|
||||
tag : 5
|
||||
);
|
||||
uint8 _2_res;
|
||||
uint8 byte_count_0_7;
|
||||
uint8 byte_count_8_15;
|
||||
LBITFIELD8_5(
|
||||
_4_res0 : 4,
|
||||
device : 1,
|
||||
_4_obs5 : 1,
|
||||
_4_res6 : 1,
|
||||
_4_obs7 : 1
|
||||
);
|
||||
LBITFIELD8_7(
|
||||
chk : 1,
|
||||
_7_res1 : 2,
|
||||
drq : 1,
|
||||
serv : 1,
|
||||
dmrd : 1,
|
||||
drdy : 1,
|
||||
bsy : 1
|
||||
);
|
||||
} packet_res;
|
||||
struct {
|
||||
uint8 sector_count;
|
||||
LBITFIELD8_4( // only <tag> is defined for write
|
||||
cmd_or_data : 1, // 1 - cmd, 0 - data
|
||||
input_or_output : 1, // 0 - input (to device), 1 - output
|
||||
release : 1,
|
||||
tag : 5
|
||||
);
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
lba_24_27 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
} queued;
|
||||
struct {
|
||||
// low order bytes
|
||||
uint8 features;
|
||||
uint8 sector_count_0_7;
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
_5low_res0 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
|
||||
// high order bytes
|
||||
uint8 _0high_res;
|
||||
uint8 sector_count_8_15;
|
||||
uint8 lba_24_31;
|
||||
uint8 lba_32_39;
|
||||
uint8 lba_40_47;
|
||||
} lba48;
|
||||
struct {
|
||||
// low order bytes
|
||||
uint8 sector_count_0_7;
|
||||
LBITFIELD8_4(
|
||||
cmd_or_data : 1, // 1 - cmd, 0 - data
|
||||
input_or_output : 1, // 0 - input (to device), 1 - output
|
||||
release : 1,
|
||||
tag : 5
|
||||
);
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
_5low_res0 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
|
||||
// high order bytes
|
||||
uint8 sector_count_8_15;
|
||||
uint8 _1high_res;
|
||||
uint8 lba_24_31;
|
||||
uint8 lba_32_39;
|
||||
uint8 lba_40_47;
|
||||
} queued48;
|
||||
struct {
|
||||
uint8 _0_res[3];
|
||||
uint8 ver; // RMSN version
|
||||
LBITFIELD8_3(
|
||||
pena : 1, // previously enabled
|
||||
lock : 1, // capable of locking
|
||||
pej : 1 // can physically eject
|
||||
);
|
||||
} set_MSN_res;
|
||||
struct {
|
||||
uint8 r[7+5];
|
||||
} raw;
|
||||
struct {
|
||||
uint8 features;
|
||||
uint8 sector_count;
|
||||
uint8 sector_number;
|
||||
uint8 cylinder_low;
|
||||
uint8 cylinder_high;
|
||||
uint8 device_head;
|
||||
uint8 command;
|
||||
} write;
|
||||
struct {
|
||||
uint8 error;
|
||||
uint8 sector_count;
|
||||
uint8 sector_number;
|
||||
uint8 cylinder_low;
|
||||
uint8 cylinder_high;
|
||||
uint8 device_head;
|
||||
uint8 status;
|
||||
} read;
|
||||
} ide_task_file;
|
||||
|
||||
// content of "mode" field
|
||||
enum {
|
||||
ide_mode_chs = 5,
|
||||
ide_mode_lba = 7
|
||||
};
|
||||
|
||||
// mask for ide_task_file fields to be written
|
||||
typedef enum {
|
||||
ide_mask_features = 0x01,
|
||||
ide_mask_sector_count = 0x02,
|
||||
|
||||
// CHS
|
||||
ide_mask_sector_number = 0x04,
|
||||
ide_mask_cylinder_low = 0x08,
|
||||
ide_mask_cylinder_high = 0x10,
|
||||
|
||||
// LBA
|
||||
ide_mask_LBA_low = 0x04,
|
||||
ide_mask_LBA_mid = 0x08,
|
||||
ide_mask_LBA_high = 0x10,
|
||||
|
||||
// packet
|
||||
ide_mask_byte_count = 0x18,
|
||||
|
||||
// packet and dma queued result
|
||||
ide_mask_error = 0x01,
|
||||
ide_mask_ireason = 0x02,
|
||||
|
||||
ide_mask_device_head = 0x20,
|
||||
ide_mask_command = 0x40,
|
||||
|
||||
ide_mask_status = 0x40,
|
||||
|
||||
// for 48 bits, the following flags tell which registers to load twice
|
||||
ide_mask_features_48 = 0x80 | ide_mask_features,
|
||||
ide_mask_sector_count_48 = 0x80 | ide_mask_sector_count,
|
||||
ide_mask_LBA_low_48 = 0x100 | ide_mask_LBA_low,
|
||||
ide_mask_LBA_mid_48 = 0x200 | ide_mask_LBA_mid,
|
||||
ide_mask_LBA_high_48 = 0x400 | ide_mask_LBA_high,
|
||||
|
||||
ide_mask_HOB = 0x780
|
||||
|
||||
//ide_mask_all = 0x7f
|
||||
} ide_reg_mask;
|
||||
|
||||
// status register
|
||||
enum {
|
||||
ide_status_err = 0x01, // error
|
||||
ide_status_index = 0x02, // obsolete
|
||||
ide_status_corr = 0x04, // obsolete
|
||||
ide_status_drq = 0x08, // data request
|
||||
ide_status_dsc = 0x10, // reserved
|
||||
ide_status_service = 0x10, // ready to service device
|
||||
ide_status_dwf = 0x20, // reserved
|
||||
ide_status_dma = 0x20, // reserved
|
||||
ide_status_dmrd = 0x20, // packet: DMA ready
|
||||
ide_status_df = 0x20, // packet: disk failure
|
||||
ide_status_drdy = 0x40, // device ready
|
||||
ide_status_bsy = 0x80 // busy
|
||||
} ide_status_mask;
|
||||
|
||||
// device control register
|
||||
enum {
|
||||
// bit 0 must be zero
|
||||
ide_devctrl_nien = 0x02, // disable INTRQ
|
||||
ide_devctrl_srst = 0x04, // software device reset
|
||||
ide_devctrl_bit3 = 0x08, // don't know, but must be set
|
||||
// bits inbetween are reserved
|
||||
ide_devctrl_hob = 0x80 // read high order byte (for 48-bit lba)
|
||||
} ide_devcntrl_mask;
|
||||
|
||||
// error register - most bits are command specific
|
||||
enum {
|
||||
// always used
|
||||
ide_error_abrt = 0x04, // command aborted
|
||||
|
||||
// used for Ultra DMA modes
|
||||
ide_error_icrc = 0x80, // interface CRC error
|
||||
|
||||
// used by reading data transfers
|
||||
ide_error_unc = 0x40, // uncorrectable data error
|
||||
// used by writing data transfers
|
||||
ide_error_wp = 0x40, // media write protect
|
||||
|
||||
// used by all data transfer commands
|
||||
ide_error_mc = 0x20, // medium changed
|
||||
ide_error_idnf = 0x10, // CHS translation not init./ invalid CHS address
|
||||
ide_error_mcr = 0x08, // media change requested
|
||||
ide_error_nm = 0x02, // no media (for removable media devices)
|
||||
} ide_error_mask;
|
||||
|
||||
|
||||
typedef struct ide_channel_info *ide_channel_cookie;
|
||||
|
||||
|
||||
// Controller Driver Node
|
||||
|
||||
// attributes:
|
||||
|
||||
// node type
|
||||
#define IDE_BUS_TYPE_NAME "bus/ide/v1"
|
||||
// maximum number of devices connected to controller (uint8, optional, default:2)
|
||||
#define IDE_CONTROLLER_MAX_DEVICES_ITEM "ide/max_devices"
|
||||
// set to not-0 if DMA is supported (uint8, optional, default:0)
|
||||
// (if so, publish necessary blkdev restriction too)
|
||||
#define IDE_CONTROLLER_CAN_DMA_ITEM "ide/can_DMA"
|
||||
// set to not-0 if CQ is supported (uint8, optional, default:1)
|
||||
#define IDE_CONTROLLER_CAN_CQ_ITEM "ide/can_CQ"
|
||||
// name of controller (string, required)
|
||||
#define IDE_CONTROLLER_CONTROLLER_NAME_ITEM "ide/controller_name"
|
||||
|
||||
// interface of controller driver
|
||||
typedef struct {
|
||||
driver_module_info info;
|
||||
|
||||
status_t (*write_command_block_regs)
|
||||
(ide_channel_cookie channel, ide_task_file *tf, ide_reg_mask mask);
|
||||
status_t (*read_command_block_regs)
|
||||
(ide_channel_cookie channel, ide_task_file *tf, ide_reg_mask mask);
|
||||
|
||||
uint8 (*get_altstatus) (ide_channel_cookie channel);
|
||||
status_t (*write_device_control) (ide_channel_cookie channel, uint8 val);
|
||||
|
||||
status_t (*write_pio) (ide_channel_cookie channel, uint16 *data, int count, bool force_16bit );
|
||||
status_t (*read_pio) (ide_channel_cookie channel, uint16 *data, int count, bool force_16bit );
|
||||
|
||||
status_t (*prepare_dma)(ide_channel_cookie channel,
|
||||
const physical_entry *sg_list, size_t sg_list_count,
|
||||
bool write);
|
||||
status_t (*start_dma)(ide_channel_cookie channel);
|
||||
status_t (*finish_dma)(ide_channel_cookie channel);
|
||||
} ide_controller_interface;
|
||||
|
||||
|
||||
// channel cookie, issued by ide bus manager
|
||||
typedef struct ide_bus_info *ide_channel;
|
||||
|
||||
|
||||
// Interface for Controller Driver
|
||||
|
||||
// interface of bus manager as seen from controller driver
|
||||
// use this interface as the fixed consumer of your controller driver
|
||||
typedef struct {
|
||||
driver_module_info info;
|
||||
|
||||
// status - status read from controller (_not_ alt_status, as reading
|
||||
// normal status acknowledges IRQ request of device)
|
||||
status_t (*irq_handler)( ide_channel channel, uint8 status );
|
||||
} ide_for_controller_interface;
|
||||
|
||||
|
||||
#define IDE_FOR_CONTROLLER_MODULE_NAME "bus_managers/ide/controller/v1"
|
||||
|
||||
|
||||
#endif /* __IDE_H__ */
|
67
headers/build/os/drivers/bus/ISA.h
Normal file
67
headers/build/os/drivers/bus/ISA.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
ISA bus manager
|
||||
|
||||
This is an improper name - this bus manager uses the PnP manager to
|
||||
load device drivers, but calling it ISA PnP manager would be wrong as
|
||||
ISA PnP information isn't used at all.
|
||||
|
||||
All ISA drivers must be Universal driver (see pnp_manager.h), as they
|
||||
are all direct children of the ISA bus node. Having an ISA PnP bus manager
|
||||
(which we don't), one node would be created per ISA device and thus you
|
||||
could write Specific drivers, but under normal ISA we don't even know
|
||||
how many devices are there, therefore the Universal driver trick.
|
||||
|
||||
Apart from the loading, the main change is the resource manager. In
|
||||
a driver, you must allocate the resources before registering the node and
|
||||
deallocate it when your node is removed and if the driver isn't loaded at
|
||||
this time. If it is, you must delay deallocation until the driver gets
|
||||
unloaded to make sure no new driver touches the same resources like you
|
||||
meanwhile.
|
||||
*/
|
||||
|
||||
#ifndef _ISA2_H
|
||||
#define _ISA2_H
|
||||
|
||||
#include <device_manager.h>
|
||||
#include <ISA.h>
|
||||
|
||||
// maximum size of one dma transfer
|
||||
// (in bytes for 8 bit transfer, in words for 16 bit transfer)
|
||||
#define B_MAX_ISA_DMA_COUNT 0x10000
|
||||
|
||||
typedef struct isa2_module_info {
|
||||
bus_module_info info;
|
||||
|
||||
uint8 (*read_io_8)( int mapped_io_addr );
|
||||
void (*write_io_8)( int mapped_io_addr, uint8 value );
|
||||
uint16 (*read_io_16)( int mapped_io_addr );
|
||||
void (*write_io_16)( int mapped_io_addr, uint16 value );
|
||||
uint32 (*read_io_32)( int mapped_io_addr );
|
||||
void (*write_io_32)( int mapped_io_addr, uint32 value );
|
||||
|
||||
// don't know what it's for, remains for compatibility
|
||||
void *(*ram_address)( const void *physical_address_in_system_memory );
|
||||
|
||||
// start dma transfer (scattered DMA is not supported as it's EISA specific)
|
||||
status_t (*start_isa_dma)(
|
||||
long channel, // dma channel to use
|
||||
void *buf, // buffer to transfer
|
||||
long transfer_count, // # transfers
|
||||
uchar mode, // mode flags
|
||||
uchar e_mode // extended mode flags
|
||||
);
|
||||
} isa2_module_info;
|
||||
|
||||
// type of isa device
|
||||
#define ISA_DEVICE_TYPE_NAME "isa/device/v1"
|
||||
// directory of ISA drivers
|
||||
// (there is only one device node, so put all drivers under "universal")
|
||||
#define ISA_DRIVERS_DIR "isa"
|
||||
|
||||
|
||||
#endif
|
158
headers/build/os/drivers/bus/PCI.h
Normal file
158
headers/build/os/drivers/bus/PCI.h
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
PCI bus manager
|
||||
*/
|
||||
|
||||
#ifndef _PCI2_H
|
||||
#define _PCI2_H
|
||||
|
||||
#include <device_manager.h>
|
||||
#include <PCI.h>
|
||||
|
||||
// currently, this structure is disabled to avoid collision with R5 header
|
||||
#if 0
|
||||
|
||||
typedef struct pci_info {
|
||||
ushort vendor_id; /* vendor id */
|
||||
ushort device_id; /* device id */
|
||||
uchar bus; /* bus number */
|
||||
uchar device; /* device number on bus */
|
||||
uchar function; /* function number in device */
|
||||
uchar revision; /* revision id */
|
||||
uchar class_api; /* specific register interface type */
|
||||
uchar class_sub; /* specific device function */
|
||||
uchar class_base; /* device type (display vs network, etc) */
|
||||
uchar line_size; /* cache line size in 32 bit words */
|
||||
uchar latency; /* latency timer */
|
||||
uchar header_type; /* header type */
|
||||
uchar bist; /* built-in self-test */
|
||||
uchar reserved; /* filler, for alignment */
|
||||
union {
|
||||
struct {
|
||||
ulong cardbus_cis; /* CardBus CIS pointer */
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
ulong rom_size; /* rom size */
|
||||
ulong base_registers[6]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[6]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[6]; /* size of what base regs point to */
|
||||
uchar base_register_flags[6]; /* flags from base address fields */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
uchar min_grant; /* burst period @ 33 Mhz */
|
||||
uchar max_latency; /* how often PCI access needed */
|
||||
} h0;
|
||||
struct {
|
||||
ulong base_registers[2]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[2]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[2]; /* size of what base regs point to */
|
||||
uchar base_register_flags[2]; /* flags from base address fields */
|
||||
uchar primary_bus;
|
||||
uchar secondary_bus;
|
||||
uchar subordinate_bus;
|
||||
uchar secondary_latency;
|
||||
uchar io_base;
|
||||
uchar io_limit;
|
||||
ushort secondary_status;
|
||||
ushort memory_base;
|
||||
ushort memory_limit;
|
||||
ushort prefetchable_memory_base;
|
||||
ushort prefetchable_memory_limit;
|
||||
ulong prefetchable_memory_base_upper32;
|
||||
ulong prefetchable_memory_limit_upper32;
|
||||
ushort io_base_upper16;
|
||||
ushort io_limit_upper16;
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
ushort bridge_control;
|
||||
} h1;
|
||||
} u;
|
||||
} pci_info;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct pci_device_info *pci_device;
|
||||
|
||||
// Interface to one PCI device.
|
||||
// Actually, this is a _function_ of a device only, but
|
||||
// pci_function_module_info would be a bit non-intuitive
|
||||
typedef struct pci_device_module_info {
|
||||
driver_module_info info;
|
||||
|
||||
uint8 (*read_io_8)(pci_device device, int mapped_io_addr);
|
||||
void (*write_io_8)(pci_device device, int mapped_io_addr, uint8 value);
|
||||
uint16 (*read_io_16)(pci_device device, int mapped_io_addr);
|
||||
void (*write_io_16)(pci_device device, int mapped_io_addr, uint16 value);
|
||||
uint32 (*read_io_32)(pci_device device, int mapped_io_addr);
|
||||
void (*write_io_32)(pci_device device, int mapped_io_addr, uint32 value);
|
||||
|
||||
uint32 (*read_pci_config)(pci_device device,
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size); /* # bytes to read (1, 2 or 4) */
|
||||
void (*write_pci_config)(pci_device device,
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size, /* # bytes to write (1, 2 or 4) */
|
||||
uint32 value); /* value to write */
|
||||
|
||||
void *(*ram_address)(pci_device device, const void *physical_address_in_system_memory);
|
||||
|
||||
/* status_t (*allocate_iomem)( void *base, size_t len, const char *name );
|
||||
status_t (*release_iomem)( void *base, size_t len );
|
||||
|
||||
status_t (*allocate_ioports)( uint16 ioport_base, size_t len, const char *name );
|
||||
status_t (*release_ioports)( uint16 ioport_base, size_t len );*/
|
||||
} pci_device_module_info;
|
||||
|
||||
|
||||
// directory of PCI drivers
|
||||
#define PCI_DRIVERS_DIR "pci"
|
||||
|
||||
// attributes of PCI device nodes
|
||||
// bus idx (uint8)
|
||||
#define PCI_DEVICE_BUS_ITEM "pci/bus"
|
||||
// device idx (uint8)
|
||||
#define PCI_DEVICE_DEVICE_ITEM "pci/device"
|
||||
// function idx (uint8)
|
||||
#define PCI_DEVICE_FUNCTION_ITEM "pci/function"
|
||||
|
||||
// vendor id (uint16)
|
||||
#define PCI_DEVICE_VENDOR_ID_ITEM "pci/vendor_id"
|
||||
// device id (uint16)
|
||||
#define PCI_DEVICE_DEVICE_ID_ITEM "pci/device_id"
|
||||
// subsystem id (uint16)
|
||||
#define PCI_DEVICE_SUBSYSTEM_ID_ITEM "pci/subsystem_id"
|
||||
// subvendor id (uint16)
|
||||
#define PCI_DEVICE_SUBVENDOR_ID_ITEM "pci/subvendor_id"
|
||||
|
||||
// device base class (uint16)
|
||||
#define PCI_DEVICE_BASE_CLASS_ID_ITEM "pci/class/base_id"
|
||||
// device subclass (uint16)
|
||||
#define PCI_DEVICE_SUB_CLASS_ID_ITEM "pci/class/sub_id"
|
||||
// device api (uint16)
|
||||
#define PCI_DEVICE_API_ID_ITEM "pci/class/api_id"
|
||||
|
||||
|
||||
// dynamic consumer patterns for PCI devices
|
||||
#define PCI_DEVICE_DYNAMIC_CONSUMER_0 \
|
||||
PCI_DRIVERS_DIR "/" \
|
||||
"vendor %" PCI_DEVICE_VENDOR_ID_ITEM "%|" \
|
||||
", device %" PCI_DEVICE_DEVICE_ID_ITEM "%|" \
|
||||
", subsystem %" PCI_DEVICE_SUBSYSTEM_ID_ITEM "%|" \
|
||||
", subvendor %" PCI_DEVICE_SUBVENDOR_ID_ITEM "%"
|
||||
|
||||
#define PCI_DEVICE_DYNAMIC_CONSUMER_1 \
|
||||
PCI_DRIVERS_DIR "/" \
|
||||
"base_class %" PCI_DEVICE_BASE_CLASS_ID_ITEM "%|" \
|
||||
", sub_class %" PCI_DEVICE_SUB_CLASS_ID_ITEM "%|" \
|
||||
", api %" PCI_DEVICE_API_ID_ITEM "%"
|
||||
|
||||
#endif
|
456
headers/build/os/drivers/bus/SCSI.h
Normal file
456
headers/build/os/drivers/bus/SCSI.h
Normal file
@ -0,0 +1,456 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __SCSI_BUSMANAGER_H__
|
||||
#define __SCSI_BUSMANAGER_H__
|
||||
|
||||
/*
|
||||
Part of Open SCSI bus manager
|
||||
|
||||
SCSI bus manager interface
|
||||
|
||||
The bus manager interface is _based_ on CAM, but I've modified it because :-
|
||||
- HBA engine, target mode and queue freezing (and probably other features)
|
||||
aren't supported (at least the first two aren't supported by linux too ;)
|
||||
- Asynchronous events aren't supported (no OS/driver I know uses them)
|
||||
- P/T/L was defined by number not by handle, requiring many redundant tests
|
||||
and thus making adding/removing of devices/busses very hard, especially if
|
||||
PnP is to be supported
|
||||
- single entry system as proposed by CAM involves extra tests and overhead
|
||||
because of generalized data structure
|
||||
|
||||
|
||||
For peripheral driver writers:
|
||||
|
||||
Something about requests involving data transfer: you can either specify
|
||||
the virtual address in <data> of CCB (in which case it must be continuous),
|
||||
or store a pointer to a S/G list that contains physical addresses in
|
||||
<sg_list>/<sg_cnt>. If <sg_list> is non-Null, <data> is ignored.
|
||||
The S/G list must be in kernel space because the request can be executed
|
||||
in a different thread context. This is also the reason why the S/G list has
|
||||
to contain physical addresses. For obvious reason, the data buffer specified
|
||||
by <sg_list> must be locked, but <data> doesn't need to be.
|
||||
|
||||
You can either execute the request synchronously ("sync_io") or
|
||||
asynchronously ("async_io"; you have to acquire <completion_sem> to find
|
||||
out when the request is finished). In the first case you can use either
|
||||
<data> or <sg_list>, in the latter <sg_list> only.
|
||||
|
||||
The SCSI bus manager takes care that the controller can access the data
|
||||
via DMA by copying it into a buffer if necessary. For the paging path,
|
||||
this can lead to problems (if the system writes a page to disk and the SCSI
|
||||
bus manager has to allocate a buffer during execution you are in trouble),
|
||||
therefore the blk_man takes care that is not necessary for reads/writes.
|
||||
To safe some microseconds, you should set the SCSI_DMA_SAFE flag for these
|
||||
requests, so the SCSI bus manager ommittes the test.
|
||||
|
||||
Effectively, using synchronous execution and specifying the address via
|
||||
<data> is a safe bet.
|
||||
|
||||
|
||||
For SIM writers:
|
||||
|
||||
Requests sent by peripheral drivers are forwarded to the <scsi_io> entry
|
||||
of the SIM. You should return as soon as some waiting is required.
|
||||
Usually, the controller raises an IRQ when a request can be continued
|
||||
or is finished. As interrupt handlers must be as fast as possible, you
|
||||
can schedule a DPC in the handler (<schedule_dpc>) which executed by a
|
||||
high priority service thread that is spawned by the SCSI bus manager
|
||||
for each bus. This service thread also takes care to submit waiting
|
||||
requests.
|
||||
|
||||
You can specify a maximum number of concurrent requests per bus via
|
||||
path_inquiry (<hba_queue_size>) for the bus. The device limit is
|
||||
determined via INQUIRY. If you need a lower/dynamic limit, you can refuse
|
||||
a request by <requeue>. If <bus_overflow> is true, no further requests
|
||||
to the bus will be sent, if <bus_overflow> is false, no further requests
|
||||
to the device will be sent. To terminate the overflow condition, call
|
||||
<cont_send_device>/<cont_send_bus>. It also terminated when a request
|
||||
for the bus/device is finished via <finished> or <resubmit>.
|
||||
Because of the asynchronous nature, requests may still arrive after the
|
||||
overflow condition being signalled, so you should add a safety test to
|
||||
<scsi_io>.
|
||||
|
||||
If a problem occurs during execution, you can ask for a restart via
|
||||
<resubmit>. The request in question will be submitted as soon as possible.
|
||||
|
||||
If you want to be not disturbed, you can block further requests via
|
||||
<block_bus>/<block_device>. As said above, you must have a safety test
|
||||
at <scsi_io> though.
|
||||
|
||||
If the SIM uses a non-SCSI protocol, it can ask the SCSI bus manager
|
||||
to emulate unsupported SCSI commands by translating them other (supported)
|
||||
commands. The bus manager calls <get_restriction> during detection for
|
||||
each device, setting <is_atapi> on return makes the bus manager translate
|
||||
READ6/WRITE6 commands to READ10/WRITE10 commands, MODE REQUEST6/SENSE6
|
||||
to MODE REQUEST10/SENSE10 and fix the version fields of INQUIRY results,
|
||||
so ATAPI devices can be used like standard SCSI devices. Further, the
|
||||
SCSI bus manager can emulate auto-sense by executing a REQUEST SENSE
|
||||
if <subsys_status> is SCSI_REQ_CMP_ERR and <device_status> is
|
||||
SCSI_DEVICE_CHECK_CONDITION when a request is finished. This emulation
|
||||
may be enhanced/generalized in the future.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
|
||||
#define SCSI_MAX_CDB_SIZE 16 // max size of cdb
|
||||
#define SCSI_MAX_SENSE_SIZE 64 // max size of sense data
|
||||
#define SCSI_SIM_PRIV 1536 // SIM private data; this may be a bit much but
|
||||
// we currently need that for the compatibility layer
|
||||
|
||||
// bus/device handle
|
||||
typedef struct scsi_bus_info *scsi_bus;
|
||||
typedef struct scsi_device_info *scsi_device;
|
||||
|
||||
|
||||
// structure of one scsi i/o CCB (command control block)
|
||||
typedef struct scsi_ccb
|
||||
{
|
||||
struct scsi_ccb *next, *prev; // internal
|
||||
|
||||
uchar subsys_status; // Returned subsystem status
|
||||
uchar device_status; // Returned scsi device status
|
||||
|
||||
uchar path_id; // Path ID for the request
|
||||
uchar target_id; // Target device ID
|
||||
uchar target_lun; // Target LUN number
|
||||
uint32 flags; // Flags for operation of the subsystem
|
||||
|
||||
// released once after asynchronous execution of request;
|
||||
// initialised by alloc_ccb, can be replaced for action but
|
||||
// must be restored before returning via free_ccb
|
||||
sem_id completion_sem;
|
||||
|
||||
uint8 cdb[SCSI_MAX_CDB_SIZE]; // command data block
|
||||
uchar cdb_len; // length of command in bytes
|
||||
int64 sort; // value of command to sort on (<0 means n/a)
|
||||
bigtime_t timeout; // timeout - 0 = use default
|
||||
|
||||
uchar *data; // pointer to data
|
||||
const physical_entry *sg_list; // SG list
|
||||
uint16 sg_cnt; // number of SG entries
|
||||
uint32 data_len; // length of data
|
||||
int32 data_resid; // data transfer residual length: 2's comp
|
||||
|
||||
uchar sense[SCSI_MAX_SENSE_SIZE]; // autosense data
|
||||
uchar sense_resid; // autosense resid length: 2's comp
|
||||
|
||||
// private
|
||||
bool ordered : 1; // request cannot overtake/be overtaken by others
|
||||
bool buffered : 1; // data is buffered to make it DMA safe
|
||||
bool emulated : 1; // command is executed as part of emulation
|
||||
|
||||
scsi_bus bus; // associated bus
|
||||
scsi_device device; // associated device
|
||||
struct dma_buffer *dma_buffer; // used dma buffer, or NULL
|
||||
uchar state; // bus manager state
|
||||
|
||||
// original data before command emulation was applied
|
||||
uint8 orig_cdb[SCSI_MAX_CDB_SIZE];
|
||||
uchar orig_cdb_len;
|
||||
const physical_entry *orig_sg_list;
|
||||
uint16 orig_sg_cnt;
|
||||
uint32 orig_data_len;
|
||||
|
||||
// private SIM data
|
||||
uchar sim_state; // set to zero when request is submitted first time
|
||||
uchar sim_priv[SCSI_SIM_PRIV]; /* SIM private data area */
|
||||
} scsi_ccb;
|
||||
|
||||
|
||||
// Defines for the subsystem status field
|
||||
|
||||
#define SCSI_REQ_INPROG 0x00 /* request is in progress */
|
||||
#define SCSI_REQ_CMP 0x01 /* request completed w/out error */
|
||||
#define SCSI_REQ_ABORTED 0x02 /* request aborted by the host */
|
||||
#define SCSI_UA_ABORT 0x03 /* Unable to Abort request */
|
||||
#define SCSI_REQ_CMP_ERR 0x04 /* request completed with an err */
|
||||
#define SCSI_BUSY 0x05 /* subsystem is busy */
|
||||
#define SCSI_REQ_INVALID 0x06 /* request is invalid */
|
||||
#define SCSI_PATH_INVALID 0x07 /* Path ID supplied is invalid */
|
||||
#define SCSI_DEV_NOT_THERE 0x08 /* SCSI device not installed/there */
|
||||
#define SCSI_UA_TERMIO 0x09 /* Unable to Terminate I/O req */
|
||||
#define SCSI_SEL_TIMEOUT 0x0A /* Target selection timeout */
|
||||
#define SCSI_CMD_TIMEOUT 0x0B /* Command timeout */
|
||||
#define SCSI_MSG_REJECT_REC 0x0D /* Message reject received */
|
||||
#define SCSI_SCSI_BUS_RESET 0x0E /* SCSI bus reset sent/received */
|
||||
#define SCSI_UNCOR_PARITY 0x0F /* Uncorrectable parity err occurred */
|
||||
#define SCSI_AUTOSENSE_FAIL 0x10 /* Autosense: Request sense cmd fail */
|
||||
#define SCSI_NO_HBA 0x11 /* No HBA detected Error */
|
||||
#define SCSI_DATA_RUN_ERR 0x12 /* Data overrun/underrun error */
|
||||
#define SCSI_UNEXP_BUSFREE 0x13 /* Unexpected BUS free */
|
||||
#define SCSI_SEQUENCE_FAIL 0x14 /* Target bus phase sequence failure */
|
||||
#define SCSI_PROVIDE_FAIL 0x16 /* Unable to provide requ. capability */
|
||||
#define SCSI_BDR_SENT 0x17 /* A SCSI BDR msg was sent to target */
|
||||
#define SCSI_REQ_TERMIO 0x18 /* request terminated by the host */
|
||||
#define SCSI_HBA_ERR 0x19 /* Unrecoverable host bus adaptor err*/
|
||||
#define SCSI_BUS_RESET_DENIED 0x1A /* SCSI bus reset denied */
|
||||
|
||||
#define SCSI_IDE 0x33 /* Initiator Detected Error Received */
|
||||
#define SCSI_RESRC_UNAVAIL 0x34 /* Resource unavailable */
|
||||
#define SCSI_UNACKED_EVENT 0x35 /* Unacknowledged event by host */
|
||||
#define SCSI_LUN_INVALID 0x38 /* LUN supplied is invalid */
|
||||
#define SCSI_TID_INVALID 0x39 /* Target ID supplied is invalid */
|
||||
#define SCSI_FUNC_NOTAVAIL 0x3A /* The requ. func is not available */
|
||||
#define SCSI_NO_NEXUS 0x3B /* Nexus is not established */
|
||||
#define SCSI_IID_INVALID 0x3C /* The initiator ID is invalid */
|
||||
#define SCSI_CDB_RECVD 0x3D /* The SCSI CDB has been received */
|
||||
#define SCSI_LUN_ALLREADY_ENAB 0x3E /* LUN already enabled */
|
||||
#define SCSI_SCSI_BUSY 0x3F /* SCSI bus busy */
|
||||
|
||||
#define SCSI_AUTOSNS_VALID 0x80 /* Autosense data valid for target */
|
||||
|
||||
#define SCSI_SUBSYS_STATUS_MASK 0x3F /* Mask bits for just the status # */
|
||||
|
||||
|
||||
// Defines for the flags field
|
||||
|
||||
#define SCSI_DIR_RESV 0x00000000 /* Data direction (00: reserved) */
|
||||
#define SCSI_DIR_IN 0x00000040 /* Data direction (01: DATA IN) */
|
||||
#define SCSI_DIR_OUT 0x00000080 /* Data direction (10: DATA OUT) */
|
||||
#define SCSI_DIR_NONE 0x000000C0 /* Data direction (11: no data) */
|
||||
#define SCSI_DIR_MASK 0x000000C0
|
||||
|
||||
#define SCSI_DIS_AUTOSENSE 0x00000020 /* Disable autosense feature */
|
||||
#define SCSI_ORDERED_QTAG 0x00000010 // ordered queue (cannot overtake/be overtaken)
|
||||
#define SCSI_DMA_SAFE 0x00000008 // set if data buffer is DMA approved
|
||||
|
||||
#define SCSI_DIS_DISCONNECT 0x00008000 /* Disable disconnect */
|
||||
#define SCSI_INITIATE_SYNC 0x00004000 /* Attempt Sync data xfer, and SDTR */
|
||||
#define SCSI_DIS_SYNC 0x00002000 /* Disable sync, go to async */
|
||||
#define SCSI_ENG_SYNC 0x00000200 /* Flush resid bytes before cmplt */
|
||||
|
||||
|
||||
// Defines for the Path Inquiry CCB fields
|
||||
|
||||
// flags in hba_inquiry
|
||||
#define SCSI_PI_MDP_ABLE 0x80 /* Supports MDP message */
|
||||
#define SCSI_PI_WIDE_32 0x40 /* Supports 32 bit wide SCSI */
|
||||
#define SCSI_PI_WIDE_16 0x20 /* Supports 16 bit wide SCSI */
|
||||
#define SCSI_PI_SDTR_ABLE 0x10 /* Supports SDTR message */
|
||||
#define SCSI_PI_TAG_ABLE 0x02 /* Supports tag queue message */
|
||||
#define SCSI_PI_SOFT_RST 0x01 /* Supports soft reset */
|
||||
|
||||
// flags in hba_misc
|
||||
#define SCSI_PIM_SCANHILO 0x80 /* Bus scans from ID 7 to ID 0 */
|
||||
#define SCSI_PIM_NOREMOVE 0x40 /* Removable dev not included in scan */
|
||||
|
||||
// sizes of inquiry fields
|
||||
#define SCSI_VUHBA 14 /* Vendor Unique HBA length */
|
||||
#define SCSI_SIM_ID 16 /* ASCII string len for SIM ID */
|
||||
#define SCSI_HBA_ID 16 /* ASCII string len for HBA ID */
|
||||
#define SCSI_FAM_ID 16 /* ASCII string len for FAMILY ID */
|
||||
#define SCSI_TYPE_ID 16 /* ASCII string len for TYPE ID */
|
||||
#define SCSI_VERS 8 /* ASCII string len for SIM & HBA vers */
|
||||
|
||||
|
||||
// Path inquiry, extended by BeOS XPT_EXTENDED_PATH_INQ parameters
|
||||
typedef struct
|
||||
{
|
||||
uchar version_num; /* Version number for the SIM/HBA */
|
||||
uchar hba_inquiry; /* Mimic of INQ byte 7 for the HBA */
|
||||
uchar hba_misc; /* Misc HBA feature flags */
|
||||
uint32 sim_priv; /* Size of SIM private data area */
|
||||
uchar vuhba_flags[SCSI_VUHBA];/* Vendor unique capabilities */
|
||||
uchar initiator_id; /* ID of the HBA on the SCSI bus */
|
||||
uint32 hba_queue_size; // size of adapaters command queue
|
||||
char sim_vid[SCSI_SIM_ID]; /* Vendor ID of the SIM */
|
||||
char hba_vid[SCSI_HBA_ID]; /* Vendor ID of the HBA */
|
||||
|
||||
char sim_version[SCSI_VERS]; /* SIM version number */
|
||||
char hba_version[SCSI_VERS]; /* HBA version number */
|
||||
char controller_family[SCSI_FAM_ID]; /* Controller family */
|
||||
char controller_type[SCSI_TYPE_ID]; /* Controller type */
|
||||
} scsi_path_inquiry;
|
||||
|
||||
|
||||
// Device node
|
||||
|
||||
// target (uint8)
|
||||
#define SCSI_DEVICE_TARGET_ID_ITEM "scsi/target_id"
|
||||
// lun (uint8)
|
||||
#define SCSI_DEVICE_TARGET_LUN_ITEM "scsi/target_lun"
|
||||
// node type
|
||||
#define SCSI_DEVICE_TYPE_NAME "scsi/device/v1"
|
||||
// device inquiry data (raw scsi_res_inquiry)
|
||||
#define SCSI_DEVICE_INQUIRY_ITEM "scsi/device_inquiry"
|
||||
// device type (uint8)
|
||||
#define SCSI_DEVICE_TYPE_ITEM "scsi/type"
|
||||
// vendor name (string)
|
||||
#define SCSI_DEVICE_VENDOR_ITEM "scsi/vendor"
|
||||
// product name (string)
|
||||
#define SCSI_DEVICE_PRODUCT_ITEM "scsi/product"
|
||||
// revision (string)
|
||||
#define SCSI_DEVICE_REVISION_ITEM "scsi/revision"
|
||||
|
||||
// directory containing links to peripheral drivers
|
||||
#define SCSI_PERIPHERAL_DRIVERS_DIR "scsi"
|
||||
|
||||
// bus manager device interface for peripheral driver
|
||||
typedef struct scsi_device_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// get CCB
|
||||
// warning: if pool of CCBs is exhausted, this call is delayed until a
|
||||
// CCB is freed, so don't try to allocate more then one CCB at once!
|
||||
scsi_ccb *(*alloc_ccb)(scsi_device device);
|
||||
// free CCB
|
||||
void (*free_ccb)(scsi_ccb *ccb);
|
||||
|
||||
// execute command asynchronously
|
||||
// when it's finished, the semaphore of the ccb is released
|
||||
// you must provide a S/G list if data_len != 0
|
||||
void (*async_io)(scsi_ccb *ccb);
|
||||
// execute command synchronously
|
||||
// you don't need to provide a S/G list nor have to lock data
|
||||
void (*sync_io)(scsi_ccb *ccb);
|
||||
|
||||
// abort request
|
||||
uchar (*abort)(scsi_ccb *ccb_to_abort);
|
||||
// reset device
|
||||
uchar (*reset_device)(scsi_device device);
|
||||
// terminate request
|
||||
uchar (*term_io)(scsi_ccb *ccb_to_terminate);
|
||||
} scsi_device_interface;
|
||||
|
||||
#define SCSI_DEVICE_MODULE_NAME "bus_managers/scsi/driver/v1"
|
||||
|
||||
|
||||
// Bus node
|
||||
|
||||
// attributes:
|
||||
|
||||
// path (uint8)
|
||||
#define SCSI_BUS_PATH_ID_ITEM "scsi/path_id"
|
||||
// node type
|
||||
#define SCSI_BUS_TYPE_NAME "scsi/bus"
|
||||
|
||||
// SCSI bus node driver.
|
||||
// This interface can be used by peripheral drivers to access the
|
||||
// bus directly.
|
||||
typedef struct scsi_bus_interface {
|
||||
bus_module_info info;
|
||||
|
||||
// get information about host controller
|
||||
uchar (*path_inquiry)(scsi_bus bus, scsi_path_inquiry *inquiry_data);
|
||||
// reset SCSI bus
|
||||
uchar (*reset_bus)(scsi_bus bus);
|
||||
} scsi_bus_interface;
|
||||
|
||||
// name of SCSI bus node driver
|
||||
#define SCSI_BUS_MODULE_NAME "bus_managers/scsi/bus/v1"
|
||||
|
||||
|
||||
// Interface for SIM
|
||||
|
||||
// cookie for dpc
|
||||
typedef struct scsi_dpc_info *scsi_dpc_cookie;
|
||||
|
||||
// Bus manager interface used by SCSI controller drivers.
|
||||
// SCSI controller drivers get this interface passed via their init_device
|
||||
// method. Further, they must specify this driver as their fixed consumer.
|
||||
typedef struct scsi_for_sim_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// put request into wait queue because of overflow
|
||||
// bus_overflow: true - too many bus requests
|
||||
// false - too many device requests
|
||||
// bus/device won't receive requests until cont_sent_bus/cont_send_device
|
||||
// is called or a request is finished via finished();
|
||||
// to avoid race conditions (reporting a full and a available bus at once)
|
||||
// the SIM should synchronize calls to requeue, resubmit and finished
|
||||
void (*requeue)(scsi_ccb *ccb, bool bus_overflow);
|
||||
// resubmit request ASAP
|
||||
// to be used if execution of request went wrong and must be retried
|
||||
void (*resubmit)(scsi_ccb *ccb);
|
||||
// mark request as being finished
|
||||
// num_requests: number of requests that were handled by device
|
||||
// when the request was sent (read: how full was the device
|
||||
// queue); needed to find out how large the device queue is;
|
||||
// e.g. if three were already running plus this request makes
|
||||
// num_requests=4
|
||||
void (*finished)(scsi_ccb *ccb, uint num_requests);
|
||||
|
||||
// following functions return error on invalid arguments only
|
||||
status_t (*alloc_dpc)(scsi_dpc_cookie *dpc);
|
||||
status_t (*free_dpc)(scsi_dpc_cookie dpc);
|
||||
status_t (*schedule_dpc)(scsi_bus cookie, scsi_dpc_cookie dpc, /*int flags,*/
|
||||
void (*func)( void * ), void *arg);
|
||||
|
||||
// block entire bus (can be nested)
|
||||
// no more request will be submitted to this bus
|
||||
void (*block_bus)(scsi_bus bus);
|
||||
// unblock entire bus
|
||||
// requests will be submitted to bus ASAP
|
||||
void (*unblock_bus)(scsi_bus bus);
|
||||
// block one device
|
||||
// no more requests will be submitted to this device
|
||||
void (*block_device)(scsi_device device);
|
||||
// unblock device
|
||||
// requests for this device will be submitted ASAP
|
||||
void (*unblock_device)(scsi_device device);
|
||||
|
||||
// terminate bus overflow condition (see "requeue")
|
||||
void (*cont_send_bus)(scsi_bus bus);
|
||||
// terminate device overflow condition (see "requeue")
|
||||
void (*cont_send_device)(scsi_device device);
|
||||
} scsi_for_sim_interface;
|
||||
|
||||
|
||||
#define SCSI_FOR_SIM_MODULE_NAME "bus_managers/scsi/sim/v1"
|
||||
|
||||
|
||||
// SIM Node
|
||||
|
||||
// attributes:
|
||||
|
||||
// node type
|
||||
#define SCSI_SIM_TYPE_NAME "bus/scsi/v1"
|
||||
// controller name (required, string)
|
||||
#define SCSI_DESCRIPTION_CONTROLLER_NAME "controller_name"
|
||||
|
||||
typedef struct scsi_sim_cookie *scsi_sim_cookie;
|
||||
|
||||
// SIM interface
|
||||
// SCSI controller drivers must provide this interface
|
||||
typedef struct scsi_sim_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// execute request
|
||||
void (*scsi_io)( scsi_sim_cookie cookie, scsi_ccb *ccb );
|
||||
// abort request
|
||||
uchar (*abort)( scsi_sim_cookie cookie, scsi_ccb *ccb_to_abort );
|
||||
// reset device
|
||||
uchar (*reset_device)( scsi_sim_cookie cookie, uchar target_id, uchar target_lun );
|
||||
// terminate request
|
||||
uchar (*term_io)( scsi_sim_cookie cookie, scsi_ccb *ccb_to_terminate );
|
||||
|
||||
// get information about bus
|
||||
uchar (*path_inquiry)( scsi_sim_cookie cookie, scsi_path_inquiry *inquiry_data );
|
||||
// scan bus
|
||||
// this is called immediately before the SCSI bus manager scans the bus
|
||||
uchar (*scan_bus)( scsi_sim_cookie cookie );
|
||||
// reset bus
|
||||
uchar (*reset_bus)( scsi_sim_cookie cookie );
|
||||
|
||||
// get restrictions of one device
|
||||
// (used for non-SCSI transport protocols and bug fixes)
|
||||
void (*get_restrictions)(
|
||||
scsi_sim_cookie cookie,
|
||||
uchar target_id, // target id
|
||||
bool *is_atapi, // set to true if this is an ATAPI device that
|
||||
// needs some commands emulated
|
||||
bool *no_autosense, // set to true if there is no autosense;
|
||||
// the SCSI bus manager will request sense on
|
||||
// SCSI_REQ_CMP_ERR/SCSI_DEVICE_CHECK_CONDITION
|
||||
uint32 *max_blocks ); // maximum number of blocks per transfer if > 0;
|
||||
// used for buggy devices that cannot handle
|
||||
// large transfers (read: ATAPI ZIP drives)
|
||||
} scsi_sim_interface;
|
||||
|
||||
|
||||
#endif /* __SCSI_BUSMANAGER_H__ */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user