From b5a20f9d111322508f179eb6dcafe43c18a4e7f0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 24 Nov 2009 18:59:40 +0000 Subject: [PATCH] Removed headers and sources not needed for build platform version for libbe. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34212 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../build/os/add-ons/graphics/Accelerant.h | 249 ---- .../build/os/add-ons/graphics/GraphicsCard.h | 188 --- .../add-ons/input_server/InputServerDevice.h | 79 - .../add-ons/input_server/InputServerFilter.h | 39 - .../add-ons/input_server/InputServerMethod.h | 51 - .../os/add-ons/screen_saver/ScreenSaver.h | 82 -- headers/build/os/add-ons/tracker/Background.h | 44 - .../build/os/add-ons/tracker/TrackerAddOn.h | 27 - headers/build/os/app/Clipboard.h | 105 -- headers/build/os/app/Cursor.h | 82 -- headers/build/os/app/Invoker.h | 128 -- headers/build/os/app/MessageFilter.h | 126 -- headers/build/os/app/MessageRunner.h | 67 - headers/build/os/app/PropertyInfo.h | 102 -- headers/build/os/arch/ppc/arch_debugger.h | 12 - headers/build/os/arch/x86/arch_debugger.h | 32 - headers/build/os/drivers/ACPI.h | 122 -- headers/build/os/drivers/ISA.h | 84 -- headers/build/os/drivers/KernelExport.h | 223 --- headers/build/os/drivers/PCI.h | 604 -------- headers/build/os/drivers/USB.h | 189 --- headers/build/os/drivers/USB_printer.h | 36 - headers/build/os/drivers/USB_rle.h | 91 -- headers/build/os/drivers/USB_spec.h | 144 -- headers/build/os/drivers/atomizer.h | 97 -- headers/build/os/drivers/block_io.h | 100 -- headers/build/os/drivers/bus/IDE.h | 360 ----- headers/build/os/drivers/bus/ISA.h | 67 - headers/build/os/drivers/bus/PCI.h | 158 -- headers/build/os/drivers/bus/SCSI.h | 456 ------ .../build/os/drivers/bus/ide/ide_adapter.h | 220 --- headers/build/os/drivers/bus/scsi/scsi_cmds.h | 1026 ------------- .../build/os/drivers/bus/scsi/scsi_periph.h | 164 --- headers/build/os/drivers/bus_manager.h | 31 - headers/build/os/drivers/config_manager.h | 115 -- headers/build/os/drivers/device_manager.h | 197 --- .../build/os/drivers/disk_device_manager.h | 126 -- headers/build/os/drivers/fast_log.h | 80 -- headers/build/os/drivers/fs_cache.h | 63 - headers/build/os/drivers/fs_interface.h | 258 ---- headers/build/os/drivers/isapnp.h | 68 - headers/build/os/drivers/lendian_bitfield.h | 68 - headers/build/os/drivers/locked_pool.h | 70 - headers/build/os/drivers/midi_driver.h | 118 -- headers/build/os/drivers/mime_table.h | 56 - headers/build/os/drivers/module.h | 58 - headers/build/os/drivers/node_monitor.h | 22 - headers/build/os/drivers/pnp_devfs.h | 55 - headers/build/os/drivers/usb/USB_audio.h | 144 -- headers/build/os/drivers/usb/USB_cdc.h | 136 -- headers/build/os/drivers/usb/USB_hid.h | 116 -- headers/build/os/drivers/usb/USB_langIDs.h | 173 --- headers/build/os/drivers/usb/USB_midi.h | 20 - headers/build/os/interface/Screen.h | 96 -- headers/build/os/kernel/debugger.h | 526 ------- headers/build/os/kernel/disk_scanner.h | 81 -- headers/build/os/kernel/fs_index.h | 40 - headers/build/os/kernel/fs_query.h | 41 - headers/build/os/kernel/fs_volume.h | 31 - headers/build/os/kernel/scheduler.h | 54 - headers/build/os/storage/FilePanel.h | 151 -- headers/build/os/storage/Query.h | 123 -- headers/build/os/storage/VolumeRoster.h | 54 - headers/build/os/support/Autolock.h | 79 - headers/build/os/support/Beep.h | 22 - headers/build/os/support/ClassInfo.h | 24 - headers/build/os/support/StopWatch.h | 41 - headers/build/os/support/TLS.h | 65 - headers/build/os/support/UTF8.h | 59 - headers/build/os/support/parsedate.h | 33 - headers/build/private/app/AppServerLink.h | 26 - .../build/private/app/ApplicationPrivate.h | 19 - headers/build/private/app/AreaLink.h | 78 - headers/build/private/app/ClipboardPrivate.h | 12 - headers/build/private/app/LinkMsgReader.h | 59 - headers/build/private/app/LinkMsgSender.h | 63 - headers/build/private/app/PortLink.h | 192 --- headers/build/private/app/PortMessage.h | 82 -- headers/build/private/app/PortQueue.h | 58 - headers/build/private/app/RegistrarThread.h | 45 - .../private/app/RegistrarThreadManager.h | 45 - headers/build/private/app/RosterPrivate.h | 76 - headers/build/private/app/Server.h | 23 - headers/build/private/app/ServerMemIO.h | 68 - headers/build/private/app/ServerProtocol.h | 369 ----- headers/build/private/app/Session.h | 112 -- headers/build/private/app/SimpleMallocIO.h | 88 -- headers/build/private/interface/BMCPrivate.h | 110 -- .../build/private/interface/ClientFontList.h | 25 - headers/build/private/interface/ColorTools.h | 103 -- .../build/private/interface/ColumnListView.h | 366 ----- headers/build/private/interface/MenuPrivate.h | 12 - headers/build/private/interface/MenuWindow.h | 47 - .../build/private/interface/PictureProtocol.h | 213 --- .../build/private/interface/PrivateScreen.h | 96 -- .../private/interface/R5_AppServerLink.h | 21 - headers/build/private/interface/R5_Session.h | 69 - headers/build/private/interface/TPicture.h | 118 -- headers/build/private/interface/TextInput.h | 90 -- .../private/interface/TextViewSupportBuffer.h | 145 -- headers/build/private/interface/ViewAux.h | 135 -- headers/build/private/interface/WidthBuffer.h | 75 - headers/build/private/interface/WindowAux.h | 69 - headers/build/private/interface/WindowInfo.h | 45 - .../build/private/interface/WindowPrivate.h | 32 - .../private/interface/ZombieReplicantView.h | 54 - .../build/private/interface/input_globals.h | 36 - headers/build/private/interface/moreUTF8.h | 101 -- headers/build/private/interface/pr_server.h | 97 -- .../build/private/interface/truncate_string.h | 22 - headers/build/private/kernel/safemode.h | 34 - headers/build/private/shared/AutoDeleter.h | 148 -- headers/build/private/shared/DataBuffer.h | 77 - headers/build/private/shared/ObjectList.h | 800 ----------- headers/build/private/shared/cpu_type.h | 231 --- headers/build/private/storage/AddOnMonitor.h | 35 - .../private/storage/AddOnMonitorHandler.h | 61 - headers/build/private/storage/DiskDevice.h | 60 - .../build/private/storage/DiskDeviceDefs.h | 163 --- headers/build/private/storage/DiskDeviceJob.h | 47 - .../build/private/storage/DiskDeviceList.h | 90 -- .../build/private/storage/DiskDevicePrivate.h | 55 - .../build/private/storage/DiskDeviceRoster.h | 166 --- .../build/private/storage/DiskDeviceTypes.h | 52 - .../build/private/storage/DiskDeviceVisitor.h | 25 - .../build/private/storage/DiskScannerAddOn.h | 85 -- headers/build/private/storage/DiskSystem.h | 64 - .../private/storage/NodeMonitorHandler.h | 55 - headers/build/private/storage/Partition.h | 172 --- .../build/private/storage/PartitioningInfo.h | 36 - .../build/private/storage/QueryPredicate.h | 210 --- .../private/storage/mime/AssociatedTypes.h | 58 - .../storage/mime/CreateAppMetaMimeThread.h | 31 - headers/build/private/storage/mime/Database.h | 122 -- .../private/storage/mime/InstalledTypes.h | 63 - .../build/private/storage/mime/SnifferRules.h | 66 - .../build/private/storage/mime/Supertype.h | 50 - .../private/storage/mime/SupportingApps.h | 51 - .../private/storage/sniffer/CharStream.h | 56 - .../build/private/storage/sniffer/DisjList.h | 41 - headers/build/private/storage/sniffer/Err.h | 58 - .../build/private/storage/sniffer/Parser.h | 311 ---- .../build/private/storage/sniffer/Pattern.h | 58 - .../private/storage/sniffer/PatternList.h | 51 - .../build/private/storage/sniffer/RPattern.h | 45 - .../private/storage/sniffer/RPatternList.h | 46 - headers/build/private/storage/sniffer/Range.h | 44 - headers/build/private/storage/sniffer/Rule.h | 53 - .../build/private/system/arch/x86/asm_defs.h | 17 - .../build/private/textencoding/CharacterSet.h | 89 -- .../private/textencoding/CharacterSetRoster.h | 91 -- .../private/translation/FuncTranslator.h | 130 -- .../libbe/storage/mime/AssociatedTypes.cpp | 449 ------ .../storage/mime/CreateAppMetaMimeThread.cpp | 99 -- src/build/libbe/storage/mime/Database.cpp | 1148 --------------- .../libbe/storage/mime/InstalledTypes.cpp | 505 ------- src/build/libbe/storage/mime/SnifferRules.cpp | 543 ------- src/build/libbe/storage/mime/Supertype.cpp | 169 --- .../libbe/storage/mime/SupportingApps.cpp | 320 ----- .../libbe/storage/mime/database_access.cpp | 425 ------ .../libbe/storage/sniffer/CharStream.cpp | 135 -- src/build/libbe/storage/sniffer/DisjList.cpp | 34 - src/build/libbe/storage/sniffer/Err.cpp | 98 -- src/build/libbe/storage/sniffer/Parser.cpp | 1277 ----------------- src/build/libbe/storage/sniffer/Pattern.cpp | 226 --- .../libbe/storage/sniffer/PatternList.cpp | 101 -- src/build/libbe/storage/sniffer/RPattern.cpp | 74 - .../libbe/storage/sniffer/RPatternList.cpp | 94 -- src/build/libbe/storage/sniffer/Range.cpp | 65 - src/build/libbe/storage/sniffer/Rule.cpp | 110 -- src/build/libbe/support/Jamfile | 3 - 171 files changed, 22616 deletions(-) delete mode 100644 headers/build/os/add-ons/graphics/Accelerant.h delete mode 100644 headers/build/os/add-ons/graphics/GraphicsCard.h delete mode 100644 headers/build/os/add-ons/input_server/InputServerDevice.h delete mode 100644 headers/build/os/add-ons/input_server/InputServerFilter.h delete mode 100644 headers/build/os/add-ons/input_server/InputServerMethod.h delete mode 100644 headers/build/os/add-ons/screen_saver/ScreenSaver.h delete mode 100644 headers/build/os/add-ons/tracker/Background.h delete mode 100644 headers/build/os/add-ons/tracker/TrackerAddOn.h delete mode 100644 headers/build/os/app/Clipboard.h delete mode 100644 headers/build/os/app/Cursor.h delete mode 100644 headers/build/os/app/Invoker.h delete mode 100644 headers/build/os/app/MessageFilter.h delete mode 100644 headers/build/os/app/MessageRunner.h delete mode 100644 headers/build/os/app/PropertyInfo.h delete mode 100644 headers/build/os/arch/ppc/arch_debugger.h delete mode 100644 headers/build/os/arch/x86/arch_debugger.h delete mode 100644 headers/build/os/drivers/ACPI.h delete mode 100644 headers/build/os/drivers/ISA.h delete mode 100644 headers/build/os/drivers/KernelExport.h delete mode 100644 headers/build/os/drivers/PCI.h delete mode 100644 headers/build/os/drivers/USB.h delete mode 100644 headers/build/os/drivers/USB_printer.h delete mode 100644 headers/build/os/drivers/USB_rle.h delete mode 100644 headers/build/os/drivers/USB_spec.h delete mode 100644 headers/build/os/drivers/atomizer.h delete mode 100644 headers/build/os/drivers/block_io.h delete mode 100644 headers/build/os/drivers/bus/IDE.h delete mode 100644 headers/build/os/drivers/bus/ISA.h delete mode 100644 headers/build/os/drivers/bus/PCI.h delete mode 100644 headers/build/os/drivers/bus/SCSI.h delete mode 100644 headers/build/os/drivers/bus/ide/ide_adapter.h delete mode 100644 headers/build/os/drivers/bus/scsi/scsi_cmds.h delete mode 100644 headers/build/os/drivers/bus/scsi/scsi_periph.h delete mode 100644 headers/build/os/drivers/bus_manager.h delete mode 100644 headers/build/os/drivers/config_manager.h delete mode 100644 headers/build/os/drivers/device_manager.h delete mode 100644 headers/build/os/drivers/disk_device_manager.h delete mode 100644 headers/build/os/drivers/fast_log.h delete mode 100644 headers/build/os/drivers/fs_cache.h delete mode 100644 headers/build/os/drivers/fs_interface.h delete mode 100644 headers/build/os/drivers/isapnp.h delete mode 100644 headers/build/os/drivers/lendian_bitfield.h delete mode 100644 headers/build/os/drivers/locked_pool.h delete mode 100644 headers/build/os/drivers/midi_driver.h delete mode 100644 headers/build/os/drivers/mime_table.h delete mode 100644 headers/build/os/drivers/module.h delete mode 100644 headers/build/os/drivers/node_monitor.h delete mode 100644 headers/build/os/drivers/pnp_devfs.h delete mode 100644 headers/build/os/drivers/usb/USB_audio.h delete mode 100644 headers/build/os/drivers/usb/USB_cdc.h delete mode 100644 headers/build/os/drivers/usb/USB_hid.h delete mode 100644 headers/build/os/drivers/usb/USB_langIDs.h delete mode 100644 headers/build/os/drivers/usb/USB_midi.h delete mode 100644 headers/build/os/interface/Screen.h delete mode 100644 headers/build/os/kernel/debugger.h delete mode 100644 headers/build/os/kernel/disk_scanner.h delete mode 100644 headers/build/os/kernel/fs_index.h delete mode 100644 headers/build/os/kernel/fs_query.h delete mode 100644 headers/build/os/kernel/fs_volume.h delete mode 100644 headers/build/os/kernel/scheduler.h delete mode 100644 headers/build/os/storage/FilePanel.h delete mode 100644 headers/build/os/storage/Query.h delete mode 100644 headers/build/os/storage/VolumeRoster.h delete mode 100644 headers/build/os/support/Autolock.h delete mode 100644 headers/build/os/support/Beep.h delete mode 100644 headers/build/os/support/ClassInfo.h delete mode 100644 headers/build/os/support/StopWatch.h delete mode 100644 headers/build/os/support/TLS.h delete mode 100644 headers/build/os/support/UTF8.h delete mode 100644 headers/build/os/support/parsedate.h delete mode 100644 headers/build/private/app/AppServerLink.h delete mode 100644 headers/build/private/app/ApplicationPrivate.h delete mode 100644 headers/build/private/app/AreaLink.h delete mode 100644 headers/build/private/app/ClipboardPrivate.h delete mode 100644 headers/build/private/app/LinkMsgReader.h delete mode 100644 headers/build/private/app/LinkMsgSender.h delete mode 100644 headers/build/private/app/PortLink.h delete mode 100644 headers/build/private/app/PortMessage.h delete mode 100644 headers/build/private/app/PortQueue.h delete mode 100644 headers/build/private/app/RegistrarThread.h delete mode 100644 headers/build/private/app/RegistrarThreadManager.h delete mode 100644 headers/build/private/app/RosterPrivate.h delete mode 100644 headers/build/private/app/Server.h delete mode 100644 headers/build/private/app/ServerMemIO.h delete mode 100644 headers/build/private/app/ServerProtocol.h delete mode 100644 headers/build/private/app/Session.h delete mode 100644 headers/build/private/app/SimpleMallocIO.h delete mode 100644 headers/build/private/interface/BMCPrivate.h delete mode 100644 headers/build/private/interface/ClientFontList.h delete mode 100644 headers/build/private/interface/ColorTools.h delete mode 100644 headers/build/private/interface/ColumnListView.h delete mode 100644 headers/build/private/interface/MenuPrivate.h delete mode 100644 headers/build/private/interface/MenuWindow.h delete mode 100644 headers/build/private/interface/PictureProtocol.h delete mode 100644 headers/build/private/interface/PrivateScreen.h delete mode 100644 headers/build/private/interface/R5_AppServerLink.h delete mode 100644 headers/build/private/interface/R5_Session.h delete mode 100644 headers/build/private/interface/TPicture.h delete mode 100644 headers/build/private/interface/TextInput.h delete mode 100644 headers/build/private/interface/TextViewSupportBuffer.h delete mode 100644 headers/build/private/interface/ViewAux.h delete mode 100644 headers/build/private/interface/WidthBuffer.h delete mode 100644 headers/build/private/interface/WindowAux.h delete mode 100644 headers/build/private/interface/WindowInfo.h delete mode 100644 headers/build/private/interface/WindowPrivate.h delete mode 100644 headers/build/private/interface/ZombieReplicantView.h delete mode 100644 headers/build/private/interface/input_globals.h delete mode 100644 headers/build/private/interface/moreUTF8.h delete mode 100644 headers/build/private/interface/pr_server.h delete mode 100644 headers/build/private/interface/truncate_string.h delete mode 100644 headers/build/private/kernel/safemode.h delete mode 100644 headers/build/private/shared/AutoDeleter.h delete mode 100644 headers/build/private/shared/DataBuffer.h delete mode 100644 headers/build/private/shared/ObjectList.h delete mode 100644 headers/build/private/shared/cpu_type.h delete mode 100644 headers/build/private/storage/AddOnMonitor.h delete mode 100644 headers/build/private/storage/AddOnMonitorHandler.h delete mode 100644 headers/build/private/storage/DiskDevice.h delete mode 100644 headers/build/private/storage/DiskDeviceDefs.h delete mode 100644 headers/build/private/storage/DiskDeviceJob.h delete mode 100644 headers/build/private/storage/DiskDeviceList.h delete mode 100644 headers/build/private/storage/DiskDevicePrivate.h delete mode 100644 headers/build/private/storage/DiskDeviceRoster.h delete mode 100644 headers/build/private/storage/DiskDeviceTypes.h delete mode 100644 headers/build/private/storage/DiskDeviceVisitor.h delete mode 100644 headers/build/private/storage/DiskScannerAddOn.h delete mode 100644 headers/build/private/storage/DiskSystem.h delete mode 100644 headers/build/private/storage/NodeMonitorHandler.h delete mode 100644 headers/build/private/storage/Partition.h delete mode 100644 headers/build/private/storage/PartitioningInfo.h delete mode 100644 headers/build/private/storage/QueryPredicate.h delete mode 100644 headers/build/private/storage/mime/AssociatedTypes.h delete mode 100644 headers/build/private/storage/mime/CreateAppMetaMimeThread.h delete mode 100644 headers/build/private/storage/mime/Database.h delete mode 100644 headers/build/private/storage/mime/InstalledTypes.h delete mode 100644 headers/build/private/storage/mime/SnifferRules.h delete mode 100644 headers/build/private/storage/mime/Supertype.h delete mode 100644 headers/build/private/storage/mime/SupportingApps.h delete mode 100644 headers/build/private/storage/sniffer/CharStream.h delete mode 100644 headers/build/private/storage/sniffer/DisjList.h delete mode 100644 headers/build/private/storage/sniffer/Err.h delete mode 100644 headers/build/private/storage/sniffer/Parser.h delete mode 100644 headers/build/private/storage/sniffer/Pattern.h delete mode 100644 headers/build/private/storage/sniffer/PatternList.h delete mode 100644 headers/build/private/storage/sniffer/RPattern.h delete mode 100644 headers/build/private/storage/sniffer/RPatternList.h delete mode 100644 headers/build/private/storage/sniffer/Range.h delete mode 100644 headers/build/private/storage/sniffer/Rule.h delete mode 100644 headers/build/private/system/arch/x86/asm_defs.h delete mode 100644 headers/build/private/textencoding/CharacterSet.h delete mode 100644 headers/build/private/textencoding/CharacterSetRoster.h delete mode 100644 headers/build/private/translation/FuncTranslator.h delete mode 100644 src/build/libbe/storage/mime/AssociatedTypes.cpp delete mode 100644 src/build/libbe/storage/mime/CreateAppMetaMimeThread.cpp delete mode 100644 src/build/libbe/storage/mime/Database.cpp delete mode 100644 src/build/libbe/storage/mime/InstalledTypes.cpp delete mode 100644 src/build/libbe/storage/mime/SnifferRules.cpp delete mode 100644 src/build/libbe/storage/mime/Supertype.cpp delete mode 100644 src/build/libbe/storage/mime/SupportingApps.cpp delete mode 100644 src/build/libbe/storage/mime/database_access.cpp delete mode 100644 src/build/libbe/storage/sniffer/CharStream.cpp delete mode 100644 src/build/libbe/storage/sniffer/DisjList.cpp delete mode 100644 src/build/libbe/storage/sniffer/Err.cpp delete mode 100644 src/build/libbe/storage/sniffer/Parser.cpp delete mode 100644 src/build/libbe/storage/sniffer/Pattern.cpp delete mode 100644 src/build/libbe/storage/sniffer/PatternList.cpp delete mode 100644 src/build/libbe/storage/sniffer/RPattern.cpp delete mode 100644 src/build/libbe/storage/sniffer/RPatternList.cpp delete mode 100644 src/build/libbe/storage/sniffer/Range.cpp delete mode 100644 src/build/libbe/storage/sniffer/Rule.cpp diff --git a/headers/build/os/add-ons/graphics/Accelerant.h b/headers/build/os/add-ons/graphics/Accelerant.h deleted file mode 100644 index 68f6386846..0000000000 --- a/headers/build/os/add-ons/graphics/Accelerant.h +++ /dev/null @@ -1,249 +0,0 @@ -#if !defined(_ACCELERANT_H_) -#define _ACCELERANT_H_ - -#include -#include -#include -#include - -#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 diff --git a/headers/build/os/add-ons/graphics/GraphicsCard.h b/headers/build/os/add-ons/graphics/GraphicsCard.h deleted file mode 100644 index 493619ffa5..0000000000 --- a/headers/build/os/add-ons/graphics/GraphicsCard.h +++ /dev/null @@ -1,188 +0,0 @@ -/****************************************************************************** -/ -/ 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 -#include -#include - -/*-------------------------------------------------------------*/ -/*----- 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 */ - - - - - - - - diff --git a/headers/build/os/add-ons/input_server/InputServerDevice.h b/headers/build/os/add-ons/input_server/InputServerDevice.h deleted file mode 100644 index fdf9201de1..0000000000 --- a/headers/build/os/add-ons/input_server/InputServerDevice.h +++ /dev/null @@ -1,79 +0,0 @@ -/****************************************************************************** -/ -/ 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 -#include -#include - - -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 diff --git a/headers/build/os/add-ons/input_server/InputServerFilter.h b/headers/build/os/add-ons/input_server/InputServerFilter.h deleted file mode 100644 index 28e37f4133..0000000000 --- a/headers/build/os/add-ons/input_server/InputServerFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -/****************************************************************************** -/ -/ 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 -#include -#include - - -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 diff --git a/headers/build/os/add-ons/input_server/InputServerMethod.h b/headers/build/os/add-ons/input_server/InputServerMethod.h deleted file mode 100644 index 125a13a5b6..0000000000 --- a/headers/build/os/add-ons/input_server/InputServerMethod.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** -/ -/ 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 -#include -#include - - -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 diff --git a/headers/build/os/add-ons/screen_saver/ScreenSaver.h b/headers/build/os/add-ons/screen_saver/ScreenSaver.h deleted file mode 100644 index 13b9fc1844..0000000000 --- a/headers/build/os/add-ons/screen_saver/ScreenSaver.h +++ /dev/null @@ -1,82 +0,0 @@ -#if ! defined _SCREENSAVER_H -#define _SCREENSAVER_H - -#include -#include // for direct_buffer_info -#include -#include - -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 diff --git a/headers/build/os/add-ons/tracker/Background.h b/headers/build/os/add-ons/tracker/Background.h deleted file mode 100644 index aa1c9a3ed2..0000000000 --- a/headers/build/os/add-ons/tracker/Background.h +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* -/ -/ 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 */ diff --git a/headers/build/os/add-ons/tracker/TrackerAddOn.h b/headers/build/os/add-ons/tracker/TrackerAddOn.h deleted file mode 100644 index e7f03c1b33..0000000000 --- a/headers/build/os/add-ons/tracker/TrackerAddOn.h +++ /dev/null @@ -1,27 +0,0 @@ -/****************************************************************************** -/ -/ 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 - -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 */ diff --git a/headers/build/os/app/Clipboard.h b/headers/build/os/app/Clipboard.h deleted file mode 100644 index 1f7d256ab5..0000000000 --- a/headers/build/os/app/Clipboard.h +++ /dev/null @@ -1,105 +0,0 @@ -//------------------------------------------------------------------------------ -// 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 -#include -#include - -// 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 - diff --git a/headers/build/os/app/Cursor.h b/headers/build/os/app/Cursor.h deleted file mode 100644 index 5eff11ab04..0000000000 --- a/headers/build/os/app/Cursor.h +++ /dev/null @@ -1,82 +0,0 @@ -//------------------------------------------------------------------------------ -// 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 -#include -#include - -// 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 $ - * - */ - diff --git a/headers/build/os/app/Invoker.h b/headers/build/os/app/Invoker.h deleted file mode 100644 index ee62279982..0000000000 --- a/headers/build/os/app/Invoker.h +++ /dev/null @@ -1,128 +0,0 @@ -//------------------------------------------------------------------------------ -// 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 -#include - -// 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 $ - * - */ - diff --git a/headers/build/os/app/MessageFilter.h b/headers/build/os/app/MessageFilter.h deleted file mode 100644 index 9fc1965034..0000000000 --- a/headers/build/os/app/MessageFilter.h +++ /dev/null @@ -1,126 +0,0 @@ -//------------------------------------------------------------------------------ -// 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 -#include - -// 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 $ - * - */ - diff --git a/headers/build/os/app/MessageRunner.h b/headers/build/os/app/MessageRunner.h deleted file mode 100644 index f517ec8b46..0000000000 --- a/headers/build/os/app/MessageRunner.h +++ /dev/null @@ -1,67 +0,0 @@ -//------------------------------------------------------------------------------ -// 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 - -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 diff --git a/headers/build/os/app/PropertyInfo.h b/headers/build/os/app/PropertyInfo.h deleted file mode 100644 index f16d33d70e..0000000000 --- a/headers/build/os/app/PropertyInfo.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. - */ -#ifndef _PROPERTY_INFO_H -#define _PROPERTY_INFO_H - - -#include -#include -#include -#include - - -struct compound_type { - struct field_pair { - const char* name; - type_code type; - }; - field_pair pairs[5]; -}; - - -struct property_info { - const char* name; - uint32 commands[10]; - uint32 specifiers[10]; - const 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 { - const char* name; - uint32 value; - value_kind kind; - const char* usage; - uint32 extra_data; - uint32 _reserved[10]; -}; - - -class BPropertyInfo : public BFlattenable { -public: - BPropertyInfo(property_info* prop = NULL, - value_info* value = NULL, - bool freeOnDelete = false); - virtual ~BPropertyInfo(); - - virtual int32 FindMatch(BMessage* msg, int32 index, - BMessage* specifier, 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 code, const void* buffer, - ssize_t size); - - const property_info* Properties() const; - const value_info* Values() const; - int32 CountProperties() const; - int32 CountValues() const; - - void PrintToStream() const; - -protected: - static bool FindCommand(uint32 what, int32 index, - property_info* info); - static bool FindSpecifier(uint32 form, property_info* info); - -private: - virtual void _ReservedPropertyInfo1(); - virtual void _ReservedPropertyInfo2(); - virtual void _ReservedPropertyInfo3(); - virtual void _ReservedPropertyInfo4(); - - BPropertyInfo(const BPropertyInfo& other); - BPropertyInfo& operator=(const BPropertyInfo& other); - void FreeMem(); - - property_info* fPropInfo; - value_info* fValueInfo; - int32 fPropCount; - bool fInHeap; - uint16 fValueCount; - uint32 _reserved[4]; -}; - -#endif /* _PROPERTY_INFO_H */ - diff --git a/headers/build/os/arch/ppc/arch_debugger.h b/headers/build/os/arch/ppc/arch_debugger.h deleted file mode 100644 index 0f82da4911..0000000000 --- a/headers/build/os/arch/ppc/arch_debugger.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * 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 diff --git a/headers/build/os/arch/x86/arch_debugger.h b/headers/build/os/arch/x86/arch_debugger.h deleted file mode 100644 index 13e4415176..0000000000 --- a/headers/build/os/arch/x86/arch_debugger.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 diff --git a/headers/build/os/drivers/ACPI.h b/headers/build/os/drivers/ACPI.h deleted file mode 100644 index accf860a84..0000000000 --- a/headers/build/os/drivers/ACPI.h +++ /dev/null @@ -1,122 +0,0 @@ -/* 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 -#include - -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 */ diff --git a/headers/build/os/drivers/ISA.h b/headers/build/os/drivers/ISA.h deleted file mode 100644 index 3d2e39af05..0000000000 --- a/headers/build/os/drivers/ISA.h +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* -/ -/ File: ISA.h -/ -/ Description: Interface to ISA module -/ -/ Copyright 1998, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - -#ifndef _ISA_H -#define _ISA_H - -//#include -#include - -#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 */ diff --git a/headers/build/os/drivers/KernelExport.h b/headers/build/os/drivers/KernelExport.h deleted file mode 100644 index 8201f402a4..0000000000 --- a/headers/build/os/drivers/KernelExport.h +++ /dev/null @@ -1,223 +0,0 @@ -/* 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 -#include - - -#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); -extern void call_all_cpus_sync(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 */ diff --git a/headers/build/os/drivers/PCI.h b/headers/build/os/drivers/PCI.h deleted file mode 100644 index 53bb1040a6..0000000000 --- a/headers/build/os/drivers/PCI.h +++ /dev/null @@ -1,604 +0,0 @@ -/******************************************************************************* -/ -/ 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 -//#include -#include - -#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 */ diff --git a/headers/build/os/drivers/USB.h b/headers/build/os/drivers/USB.h deleted file mode 100644 index b06d386728..0000000000 --- a/headers/build/os/drivers/USB.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -** USB.h - Version 2 USB Device Driver API -** -** Copyright 1999, Be Incorporated. All Rights Reserved. -** -*/ - -#ifndef _USB_H -#define _USB_H - -#include -#include - -#include -#include - -#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 diff --git a/headers/build/os/drivers/USB_printer.h b/headers/build/os/drivers/USB_printer.h deleted file mode 100644 index fc4e266d03..0000000000 --- a/headers/build/os/drivers/USB_printer.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -** USB_printer.h -** -** Copyright 1999, Be Incorporated. All Rights Reserved. -** -*/ - -#ifndef _USB_PRINTER_H -#define _USB_PRINTER_H - -#include - -#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 diff --git a/headers/build/os/drivers/USB_rle.h b/headers/build/os/drivers/USB_rle.h deleted file mode 100644 index 0b437d7e8a..0000000000 --- a/headers/build/os/drivers/USB_rle.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -** 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 diff --git a/headers/build/os/drivers/USB_spec.h b/headers/build/os/drivers/USB_spec.h deleted file mode 100644 index d21306c8d7..0000000000 --- a/headers/build/os/drivers/USB_spec.h +++ /dev/null @@ -1,144 +0,0 @@ -/* -** 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 diff --git a/headers/build/os/drivers/atomizer.h b/headers/build/os/drivers/atomizer.h deleted file mode 100644 index d3c6bf3f9d..0000000000 --- a/headers/build/os/drivers/atomizer.h +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* -/ -/ File: atomizer.h -/ -/ Description: Kernel atomizer module API -/ -/ Copyright 1999, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - -#ifndef _ATOMIZER_MODULE_H_ -#define _ATOMIZER_MODULE_H_ - -#include - -#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 - diff --git a/headers/build/os/drivers/block_io.h b/headers/build/os/drivers/block_io.h deleted file mode 100644 index c9e5eaa4f7..0000000000 --- a/headers/build/os/drivers/block_io.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 -#include - -// 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__ */ diff --git a/headers/build/os/drivers/bus/IDE.h b/headers/build/os/drivers/bus/IDE.h deleted file mode 100644 index 06fc0d33b1..0000000000 --- a/headers/build/os/drivers/bus/IDE.h +++ /dev/null @@ -1,360 +0,0 @@ -/* -** 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 -#include -#include -#include -#include - -// 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 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; - - -// 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) - (void *channel_cookie, ide_task_file *tf, ide_reg_mask mask); - status_t (*read_command_block_regs) - (void *channel_cookie, ide_task_file *tf, ide_reg_mask mask); - - uint8 (*get_altstatus) (void *channel_cookie); - status_t (*write_device_control) (void *channel_cookie, uint8 val); - - status_t (*write_pio) (void *channel_cookie, uint16 *data, int count, bool force_16bit ); - status_t (*read_pio) (void *channel_cookie, uint16 *data, int count, bool force_16bit ); - - status_t (*prepare_dma)(void *channel_cookie, - const physical_entry *sg_list, size_t sg_list_count, - bool write); - status_t (*start_dma)(void *channel_cookie); - status_t (*finish_dma)(void *channel_cookie); -} 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__ */ diff --git a/headers/build/os/drivers/bus/ISA.h b/headers/build/os/drivers/bus/ISA.h deleted file mode 100644 index f6ba5ddfe1..0000000000 --- a/headers/build/os/drivers/bus/ISA.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -** 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 -#include - -// 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 diff --git a/headers/build/os/drivers/bus/PCI.h b/headers/build/os/drivers/bus/PCI.h deleted file mode 100644 index fcc5b478cc..0000000000 --- a/headers/build/os/drivers/bus/PCI.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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 -#include - -// 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 diff --git a/headers/build/os/drivers/bus/SCSI.h b/headers/build/os/drivers/bus/SCSI.h deleted file mode 100644 index e4b9384d70..0000000000 --- a/headers/build/os/drivers/bus/SCSI.h +++ /dev/null @@ -1,456 +0,0 @@ -/* - * 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 of CCB (in which case it must be continuous), - or store a pointer to a S/G list that contains physical addresses in - /. If is non-Null, 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 must be locked, but doesn't need to be. - - You can either execute the request synchronously ("sync_io") or - asynchronously ("async_io"; you have to acquire to find - out when the request is finished). In the first case you can use either - or , in the latter 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 - is a safe bet. - - - For SIM writers: - - Requests sent by peripheral drivers are forwarded to the 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 () 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 () for the bus. The device limit is - determined via INQUIRY. If you need a lower/dynamic limit, you can refuse - a request by . If is true, no further requests - to the bus will be sent, if is false, no further requests - to the device will be sent. To terminate the overflow condition, call - /. It also terminated when a request - for the bus/device is finished via or . - Because of the asynchronous nature, requests may still arrive after the - overflow condition being signalled, so you should add a safety test to - . - - If a problem occurs during execution, you can ask for a restart via - . The request in question will be submitted as soon as possible. - - If you want to be not disturbed, you can block further requests via - /. As said above, you must have a safety test - at 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 during detection for - each device, setting 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 is SCSI_REQ_CMP_ERR and is - SCSI_DEVICE_CHECK_CONDITION when a request is finished. This emulation - may be enhanced/generalized in the future. -*/ - - -#include -#include - - -#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__ */ diff --git a/headers/build/os/drivers/bus/ide/ide_adapter.h b/headers/build/os/drivers/bus/ide/ide_adapter.h deleted file mode 100644 index 45e60f5d56..0000000000 --- a/headers/build/os/drivers/bus/ide/ide_adapter.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. - * Copyright 2002-04, Thomas Kurschel. All rights reserved. - * - * Distributed under the terms of the MIT License. - */ -#ifndef _IDE_PCI_H -#define _IDE_PCI_H - -/* - IDE adapter library - - Module to simplify writing an IDE adapter driver. - - The interface is not very abstract, i.e. the actual driver is - free to access any controller or channel data of this library. -*/ - - -#include -#include -#include - - -// one Physical Region Descriptor (PRD) -// (one region must not cross 64K boundary; -// the PRD table must not cross a 64K boundary) -typedef struct prd_entry { - uint32 address; // physical address of block (must be even) - uint16 count; // size of block, 0 stands for 65536 (must be even) - uint8 res6; - LBITFIELD8_2( - res7_0 : 7, - EOT : 1 // 1 for last entry - ); -} prd_entry; - - -// command register -typedef struct ide_bm_command { - LBITFIELD8_4( - start_stop : 1, // start BM by changing from 0 to 1; - // stop BM by changing from 1 to 0 - res0_1 : 2, - from_device : 1, // true - read from device, false - write to device - res0_4 : 4 - ); -} ide_bm_command; - - -// status register -typedef struct ide_bm_status { - LBITFIELD8_7( - active : 1, // 1, if BM is active - error : 1, // 1, if error occured; write 1 to reset - interrupt : 1, // 1, if INTRQ was raised, write 1 to reset - res0_3 : 2, - device0_dma : 1, // 1, if BIOS/driver has setup DMA for device 0 - device1_dma : 1, // 1, if BIOS/driver has setup DMA for device 1 - simplex : 1 // 1, if only one channel can use DMA at a time - ); -} ide_bm_status; - - -// offset of bus master registers -enum { - ide_bm_command_reg = 0, // see ide_bm_command - ide_bm_status_reg = 2, // see ide_bm_status - ide_bm_prdt_address = 4 // offset of PRDT register; content must be dword-aligned -}; - -// bit mask in class_api of PCI configuration -// (for adapters that can run in compatability mode) -enum { - ide_api_primary_native = 1, // primary channel is in native mode - ide_api_primary_fixed = 2, // primary channel can be switched to native mode - ide_api_secondary_native = 4, // secondary channel is in native mode - ide_api_secondary_fixed = 8 // secondary channel can be switched to native mode -}; - - -// (maximum) size of S/G table -// there are so many restrictions that we want to keep it inside one page -// to be sure that we fulfill them all -#define IDE_ADAPTER_MAX_SG_COUNT (B_PAGE_SIZE / sizeof( prd_entry )) - - -// channel node items -// io address of command block (uint16) -#define IDE_ADAPTER_COMMAND_BLOCK_BASE "ide_adapter/command_block_base" -// io address of control block (uint16) -#define IDE_ADAPTER_CONTROL_BLOCK_BASE "ide_adapter/control_block_base" -// interrupt number (uint8) -// can also be defined in controller node if both channels use same IRQ! -#define IDE_ADAPTER_INTNUM "ide_adapter/irq" -// 0 if primary channel, 1 if secondary channel, 2 if tertiary, ... (uint8) -#define IDE_ADAPTER_CHANNEL_INDEX "ide_adapter/channel_index" - - -// controller node items -// io address of bus master registers (uint16) -#define IDE_ADAPTER_BUS_MASTER_BASE "ide_adapter/bus_master_base" - - -// info about one channel -typedef struct ide_adapter_channel_info { - pci_device_module_info *pci; - pci_device device; - - uint16 command_block_base; // io address command block - uint16 control_block_base; // io address control block - uint16 bus_master_base; - int intnum; // interrupt number - - uint32 lost; // != 0 if device got removed, i.e. if it must not - // be accessed anymore - - ide_channel ide_channel; - device_node_handle node; - - int32 (*inthand)( void *arg ); - - area_id prd_area; - prd_entry *prdt; - uint32 prdt_phys; - uint32 dmaing; -} ide_adapter_channel_info; - - -// info about controller -typedef struct ide_adapter_controller_info { - pci_device_module_info *pci; - pci_device device; - - uint16 bus_master_base; - - uint32 lost; // != 0 if device got removed, i.e. if it must not - // be accessed anymore - - device_node_handle node; -} ide_adapter_controller_info; - - -// interface of IDE adapter library -typedef struct { - module_info info; - - // function calls that can be forwarded from actual driver - status_t (*write_command_block_regs)(ide_adapter_channel_info *channel, - ide_task_file *tf, ide_reg_mask mask); - status_t (*read_command_block_regs)(ide_adapter_channel_info *channel, - ide_task_file *tf, ide_reg_mask mask); - - uint8 (*get_altstatus) (ide_adapter_channel_info *channel); - status_t (*write_device_control) (ide_adapter_channel_info *channel, uint8 val); - - status_t (*write_pio)(ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit); - status_t (*read_pio)(ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit); - - status_t (*prepare_dma)(ide_adapter_channel_info *channel, const physical_entry *sg_list, - size_t sg_list_count, bool to_device); - status_t (*start_dma)(ide_adapter_channel_info *channel); - status_t (*finish_dma)(ide_adapter_channel_info *channel); - - // default functions that should be replaced by a more specific version - // (copy them from source code of this library and modify them at will) - int32 (*inthand)(void *arg); - - // functions that must be called by init/uninit etc. of channel driver - status_t (*init_channel)(device_node_handle node, ide_channel ide_channel, - ide_adapter_channel_info **cookie, size_t total_data_size, - int32 (*inthand)(void *arg)); - status_t (*uninit_channel)(ide_adapter_channel_info *channel); - void (*channel_removed)(device_node_handle node, ide_adapter_channel_info *channel); - - // publish channel node - status_t (*publish_channel)(device_node_handle controller_node, - const char *channel_module_name, uint16 command_block_base, - uint16 control_block_base, uint8 intnum, bool can_dma, - uint8 channel_index, const char *name, - io_resource_handle *resources, device_node_handle *node); - // verify channel configuration and publish node on success - status_t (*detect_channel)(pci_device_module_info *pci, pci_device pci_device, - device_node_handle controller_node, const char *channel_module_name, - bool controller_can_dma, uint16 command_block_base, - uint16 control_block_base, uint16 bus_master_base, - uint8 intnum, uint8 channel_index, const char *name, - device_node_handle *node, bool supports_compatibility_mode); - - // functions that must be called by init/uninit etc. of controller driver - status_t (*init_controller)(device_node_handle node, void *user_cookie, - ide_adapter_controller_info **cookie, size_t total_data_size); - status_t (*uninit_controller)(ide_adapter_controller_info *controller); - void (*controller_removed)(device_node_handle node, ide_adapter_controller_info *controller); - - // publish controller node - status_t (*publish_controller)(device_node_handle parent, uint16 bus_master_base, - io_resource_handle *resources, const char *controller_driver, - const char *controller_driver_type, const char *controller_name, - bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary, - uint32 max_sg_block_size, device_node_handle *node); - // verify controller configuration and publish node on success - status_t (*detect_controller)(pci_device_module_info *pci, pci_device pci_device, - device_node_handle parent, uint16 bus_master_base, - const char *controller_driver, const char *controller_driver_type, - const char *controller_name, bool can_dma, bool can_cq, - uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size, - device_node_handle *node); - // standard master probe for controller that registers controller and channel nodes - status_t (*probe_controller)(device_node_handle parent, const char *controller_driver, - const char *controller_driver_type, const char *controller_name, - const char *channel_module_name, bool can_dma, bool can_cq, - uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size, - bool supports_compatibility_mode); -} ide_adapter_interface; - - -#define IDE_ADAPTER_MODULE_NAME "generic/ide_adapter/v1" - -#endif /* _IDE_PCI_H */ diff --git a/headers/build/os/drivers/bus/scsi/scsi_cmds.h b/headers/build/os/drivers/bus/scsi/scsi_cmds.h deleted file mode 100644 index 7b8ebf2a54..0000000000 --- a/headers/build/os/drivers/bus/scsi/scsi_cmds.h +++ /dev/null @@ -1,1026 +0,0 @@ -/* -** Copyright 2002/03, Thomas Kurschel. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ - -/* - Part of Open SCSI bus manager - - SCSI commands and their data structures and constants -*/ - -#ifndef __SCSI_CMDS_H__ -#define __SCSI_CMDS_H__ - -#include - -// always keep in mind that SCSI is big-endian !!! - -#define SCSI_STD_TIMEOUT 10 - -// SCSI device status (as the result of a command) -#define SCSI_STATUS_GOOD (0 << 1) -#define SCSI_STATUS_CHECK_CONDITION (1 << 1) // error occured -#define SCSI_STATUS_CONDITION_MET (2 << 1) // "found" for SEARCH DATA and PREFETCH -#define SCSI_STATUS_BUSY (4 << 1) // try again later (??? == QUEUE_FULL ???) -#define SCSI_STATUS_INTERMEDIATE (8 << 1) // used by linked command only -#define SCSI_STATUS_INTERMEDIATE_COND_MET (10 << 1) // ditto -#define SCSI_STATUS_RESERVATION_CONFLICT (12 << 1) // only if RESERVE/RELEASE is used -#define SCSI_STATUS_COMMAND_TERMINATED (17 << 1) // aborted by TERMINATE I/O PROCESS -#define SCSI_STATUS_QUEUE_FULL (20 << 1) // queue full - -#define SCSI_STATUS_MASK 0xfe - -// SCSI sense key -#define SCSIS_KEY_NO_SENSE 0 -#define SCSIS_KEY_RECOVERED_ERROR 1 -#define SCSIS_KEY_NOT_READY 2 // operator intervention may be required -#define SCSIS_KEY_MEDIUM_ERROR 3 // can be set if source could be hardware error -#define SCSIS_KEY_HARDWARE_ERROR 4 -#define SCSIS_KEY_ILLEGAL_REQUEST 5 // invalid command -#define SCSIS_KEY_UNIT_ATTENTION 6 // medium changed or target reset -#define SCSIS_KEY_DATA_PROTECT 7 // data access forbidden -#define SCSIS_KEY_BLANK_CHECK 8 // tried to read blank or to write non-blank medium -#define SCSIS_KEY_VENDOR_SPECIFIC 9 -#define SCSIS_KEY_COPY_ABORTED 10 // error in COPY or COMPARE command -#define SCSIS_KEY_ABORTED_COMMAND 11 // aborted by target, retry *may* help -#define SCSIS_KEY_EQUAL 12 // during SEARCH: data found -#define SCSIS_KEY_VOLUME_OVERFLOW 13 // tried to write buffered data beyond end of medium -#define SCSIS_KEY_MISCOMPARE 14 -#define SCSIS_KEY_RESERVED 15 - -// SCSI ASC and ASCQ data - (ASC << 8) | ASCQ -// all codes with bit 7 of ASC or ASCQ set are vendor-specific -#define SCSIS_ASC_NO_SENSE 0x0000 -#define SCSIS_ASC_IO_PROC_TERMINATED 0x0006 -#define SCSIS_ASC_AUDIO_PLAYING 0x0011 -#define SCSIS_ASC_AUDIO_PAUSED 0x0012 -#define SCSIS_ASC_AUDIO_COMPLETED 0x0013 -#define SCSIS_ASC_AUDIO_ERROR 0x0014 // playing has stopped due to error -#define SCSIS_ASC_AUDIO_NO_STATUS 0x0015 -#define SCSIS_ASC_NO_INDEX 0x0100 // no index/sector signal -#define SCSIS_ASC_NO_SEEK_CMP 0x0200 // ??? -#define SCSIS_ASC_WRITE_FAULT 0x0300 -#define SCSIS_ASC_LUN_NOT_READY 0x0400 // LUN not ready, cause not reportable -#define SCSIS_ASC_LUN_BECOMING_READY 0x0401 // LUN in progress of becoming ready -#define SCSIS_ASC_LUN_NEED_INIT 0x0402 // LUN need initializing command -#define SCSIS_ASC_LUN_NEED_MANUAL_HELP 0x0403 // LUN needs manual intervention -#define SCSIS_ASC_LUN_FORMATTING 0x0404 // LUN format in progress -#define SCSIS_ASC_LUN_SEL_FAILED 0x0500 // LUN doesn't respond to selection -#define SCSIS_ASC_LUN_COM_FAILURE 0x0800 // LUN communication failure -#define SCSIS_ASC_LUN_TIMEOUT 0x0801 // LUN communication time-out -#define SCSIS_ASC_LUN_COM_PARITY 0x0802 // LUN communication parity failure -#define SCSIS_ASC_LUN_COM_CRC 0x0803 // LUN communication CRC failure (SCSI-3) -#define SCSIS_ASC_WRITE_ERR_AUTOREALLOC 0x0c01 // recovered by auto-reallocation -#define SCSIS_ASC_WRITE_ERR_AUTOREALLOC_FAILED 0x0c02 -#define SCSIS_ASC_ECC_ERROR 0x1000 -#define SCSIS_ASC_UNREC_READ_ERR 0x1100 // unrecovered read error -#define SCSIS_ASC_READ_RETRIES_EXH 0x1101 // read retries exhausted -#define SCSIS_ASC_UNREC_READ_ERR_AUTOREALLOC_FAILED 0x1104 // above + auto-reallocate failed -#define SCSIS_ASC_RECORD_NOT_FOUND 0x1401 -#define SCSIS_ASC_RANDOM_POS_ERROR 0x1500 // random positioning error -#define SCSIS_ASC_POSITIONING_ERR 0x1501 // mechanical positioning error -#define SCSIS_ASC_POS_ERR_ON_READ 0x1502 // positioning error detected by reading -#define SCSIS_ASC_DATA_RECOV_NO_ERR_CORR 0x1700 // recovered with no error correction applied -#define SCSIS_ASC_DATA_RECOV_WITH_RETRIES 0x1701 -#define SCSIS_ASC_DATA_RECOV_POS_HEAD_OFS 0x1702 // ?recovered with positive head offset -#define SCSIS_ASC_DATA_RECOV_NEG_HEAD_OFS 0x1703 // ?recovered with negative head offset -#define SCSIS_ASC_DATA_RECOV_WITH_RETRIES_CIRC 0x1704 // recovered with retries/CIRC -#define SCSIS_ASC_DATA_RECOV_PREV_SECT_ID 0x1705 // recovered using previous sector ID -#define SCSIS_ASC_DATA_RECOV_NO_ECC_AUTOREALLOC 0x1706 -#define SCSIS_ASC_DATA_RECOV_NO_ECC_REASSIGN 0x1707 // reassign recommended -#define SCSIS_ASC_DATA_RECOV_NO_ECC_REWRITE 0x1708 // rewrite recommended -#define SCSIS_ASC_DATA_RECOV_WITH_CORR 0x1800 // recovered using error correction -#define SCSIS_ASC_DATA_RECOV_WITH_CORR_RETRIES 0x1801 // used error correction and retries -#define SCSIS_ASC_DATA_RECOV_AUTOREALLOC 0x1802 -#define SCSIS_ASC_DATA_RECOV_CIRC 0x1803 // recovered using CIRC -#define SCSIS_ASC_DATA_RECOV_LEC 0x1804 // recovered using LEC -#define SCSIS_ASC_DATA_RECOV_REASSIGN 0x1805 // reassign recommended -#define SCSIS_ASC_DATA_RECOV_REWRITE 0x1806 // rewrite recommended -#define SCSIS_ASC_PARAM_LIST_LENGTH_ERR 0x1a00 // parameter list too short -#define SCSIS_ASC_ID_RECOV 0x1e00 // recoved ID with ECC -#define SCSIS_ASC_INV_OPCODE 0x2000 -#define SCSIS_ASC_LBA_OOR 0x2100 // LBA out of range -#define SCSIS_ASC_ILL_FUNCTION 0x2200 // better use 0x2000/0x2400/0x2600 instead -#define SCSIS_ASC_INV_CDB_FIELD 0x2400 -#define SCSIS_ASC_LUN_NOT_SUPPORTED 0x2500 -#define SCSIS_ASC_INV_PARAM_LIST_FIELD 0x2600 -#define SCSIS_ASC_PARAM_NOT_SUPPORTED 0x2601 -#define SCSIS_ASC_PARAM_VALUE_INV 0x2602 -#define SCSIS_ASC_WRITE_PROTECTED 0x2700 -#define SCSIS_ASC_MEDIUM_CHANGED 0x2800 -#define SCSIS_ASC_WAS_RESET 0x2900 // reset by power-on/bus reset/device reset -#define SCSIS_ASC_PARAMS_CHANGED 0x2a00 -#define SCSIS_ASC_MEDIUM_FORMAT_CORRUPTED 0x3100 -#define SCSIS_ASC_ROUNDED_PARAM 0x3700 // parameter got rounded -#define SCSIS_ASC_NO_MEDIUM 0x3a00 // medium not present -#define SCSIS_ASC_INTERNAL_FAILURE 0x4400 -#define SCSIS_ASC_SEL_FAILURE 0x4500 // select/reselect failure -#define SCSIS_ASC_UNSUCC_SOFT_RESET 0x4600 // unsuccessful soft reset -#define SCSIS_ASC_SCSI_PARITY_ERR 0x4700 // SCSI parity error -#define SCSIS_ASC_LOAD_EJECT_FAILED 0x5300 // media load or eject failed -#define SCSIS_ASC_REMOVAL_PREVENTED 0x5302 // medium removal prevented -#define SCSIS_ASC_REMOVAL_REQUESTED 0x5a01 // operator requests medium removal - - -// some scsi op-codes -#define SCSI_OP_TUR 0x00 -#define SCSI_OP_REQUEST_SENSE 0x03 -#define SCSI_OP_FORMAT 0x04 -#define SCSI_OP_READ_6 0x08 -#define SCSI_OP_WRITE_6 0x0a -#define SCSI_OP_INQUIRY 0x12 -#define SCSI_OP_MODE_SELECT_6 0x15 -#define SCSI_OP_RESERVE 0x16 -#define SCSI_OP_RELEASE 0x17 -#define SCSI_OP_MODE_SENSE_6 0x1a -#define SCSI_OP_START_STOP 0x1b -#define SCSI_OP_RECEIVE_DIAGNOSTIC 0x1c -#define SCSI_OP_SEND_DIAGNOSTIC 0x1d -#define SCSI_OP_PREVENT_ALLOW 0x1e -#define SCSI_OP_READ_CAPACITY 0x25 -#define SCSI_OP_READ_10 0x28 -#define SCSI_OP_WRITE_10 0x2a -#define SCSI_OP_POSITION_TO_ELEMENT 0x2b -#define SCSI_OP_VERIFY 0x2f -#define SCSI_OP_SYNCHRONIZE_CACHE 0x35 -#define SCSI_OP_WRITE_BUFFER 0x3b -#define SCSI_OP_READ_BUFFER 0x3c -#define SCSI_OP_CHANGE_DEFINITION 0x40 -#define SCSI_OP_READ_SUB_CHANNEL 0x42 -#define SCSI_OP_READ_TOC 0x43 -#define SCSI_OP_PLAY_MSF 0x47 -#define SCSI_OP_PLAY_AUDIO_TRACK_INDEX 0x48 // obsolete, spec missing -#define SCSI_OP_PAUSE_RESUME 0x4b -#define SCSI_OP_STOP_PLAY 0x4e -#define SCSI_OP_MODE_SELECT_10 0x55 -#define SCSI_OP_MODE_SENSE_10 0x5A -#define SCSI_OP_MOVE_MEDIUM 0xa5 -#define SCSI_OP_READ_12 0xa8 -#define SCSI_OP_WRITE_12 0xaa -#define SCSI_OP_READ_ELEMENT_STATUS 0xb8 -#define SCSI_OP_SCAN 0xba -#define SCSI_OP_READ_CD 0xbe - -// INQUIRY - -typedef struct scsi_cmd_inquiry { - uint8 opcode; - LBITFIELD8_3( - EVPD : 1, // enhanced vital product data - res1_1 : 4, - LUN : 3 - ); - uint8 page_code; - uint8 res3; - uint8 allocation_length; - uint8 control; -} scsi_cmd_inquiry; - -typedef struct scsi_res_inquiry { - LBITFIELD8_2( - device_type : 5, - device_qualifier : 3 - ); - LBITFIELD8_2( - device_type_modifier : 7, // obsolete, normally set to zero - RMB : 1 // 1 = removable medium - ); - LBITFIELD8_3( // 0 always means "not conforming" - ANSI_version : 3, // 1 for SCSI-1, 2 for SCSI-2 etc. - ECMA_version : 3, - ISO_version : 2 - ); - LBITFIELD8_4( - response_data_format : 4, // 2 = SCSI/2 compliant - res3_4 : 2, - TrmIOP : 1, // 1 = supports TERMINATE I/O PROCESS - AENC : 1 // processor devices only : - // Asynchronous Event Notification Capable - ); - uint8 additional_length; // total (whished) length = this + 4 - uint8 res5; - uint8 res6; - LBITFIELD8_8( - SftRe : 1, // 0 = soft reset leads to hard reset - CmdQue : 1, // 1 = supports tagged command queuing - res7_2 : 1, - Linked : 1, // 1 = supports linked commands - Sync : 1, // 1 = supports synchronous transfers - WBus16 : 1, // 1 = supports 16 bit transfers - WBus32 : 1, // 1 = supports 32 bit transfers - RelAdr : 1 // 1 = supports relative addr. for linking - ); - char vendor_ident[8]; // 8 - char product_ident[16]; // 16 - char product_rev[4]; // 32 - - // XPT doesn't return following data on XPT_GDEV_TYPE - uint8 vendor_spec[20]; // 36 - uint8 res56[2]; // 56 - - struct { - uint8 high; - uint8 low; - } version_descriptor[8]; // array of supported standards - - uint8 res74[22]; // 74 - - /* additional vendor specific data */ // 96 -} scsi_res_inquiry; - -enum { - scsi_periph_qual_connected = 0, - scsi_periph_qual_not_connected = 2, - scsi_periph_qual_not_connectable = 3 - // value 1 is reserved, values of 4 and above are vendor-specific -} scsi_peripheral_qualifier; - -enum { - scsi_dev_direct_access = 0, - scsi_dev_sequential_access = 1, - scsi_dev_printer = 2, - scsi_dev_processor = 3, - scsi_dev_WORM = 4, - scsi_dev_CDROM = 5, - scsi_dev_scanner = 6, - scsi_dev_optical = 7, - scsi_dev_medium_changer = 8, - scsi_dev_communication = 9, - // 0xa - 0xb are graphics arts pre-press devices - // 0xc - 0x1e reserved - scsi_dev_storage_array = 0xc, - scsi_dev_enclosure_services = 0xd, - scsi_dev_simplified_direct_access = 0xe, - scsi_dev_optical_card = 0xf, - scsi_dev_unknown = 0x1f // used for scsi_periph_qual_not_connectable -} scsi_device_type; - - -// vital product data: unit serial number page - -#define SCSI_PAGE_USN 0x80 - -typedef struct scsi_page_USN { - LBITFIELD8_2( - device_type : 5, - device_qualifier : 3 - ); - uint8 page_code; - uint8 res2; - - uint8 page_length; // total size = this + 3 - char PSN[1]; // size according to page_length -} scsi_page_USN; - -// READ CAPACITY - -typedef struct scsi_cmd_read_capacity { - uint8 opcode; - LBITFIELD8_3( - RelAdr : 1, // relative address - res1_1 : 4, - LUN : 3 - ); - uint8 top_LBA; - uint8 high_LBA; - uint8 mid_LBA; - uint8 low_LBA; - uint8 res6[2]; - LBITFIELD8_2( - PMI : 1, // partial medium indicator - res8_1 : 7 - ); - uint8 control; -} scsi_cmd_read_capacity; - -typedef struct scsi_res_read_capacity { - uint8 top_LBA; - uint8 high_LBA; - uint8 mid_LBA; - uint8 low_LBA; - uint8 top_block_size; // in bytes - uint8 high_block_size; - uint8 mid_block_size; - uint8 low_block_size; -} scsi_res_read_capacity; - - -// READ (6), WRITE (6) - -typedef struct scsi_cmd_rw_6 { - uint8 opcode; - LBITFIELD8_2( - high_LBA : 5, - LUN : 3 - ); - uint8 mid_LBA; - uint8 low_LBA; - uint8 length; // 0 = 256 blocks - uint8 control; -} scsi_cmd_rw_6; - - -// READ (10), WRITE (10) - -typedef struct scsi_cmd_rw_10 { - uint8 opcode; - LBITFIELD8_5( - RelAdr : 1, // relative address - res1_1 : 2, - FUA : 1, // force unit access (1 = safe, cacheless access) - DPO : 1, // disable page out (1 = not worth caching) - LUN : 3 - ); - uint8 top_LBA; - uint8 high_LBA; - uint8 mid_LBA; - uint8 low_LBA; - uint8 res6; - uint8 high_length; // 0 = no block - uint8 low_length; - uint8 control; -} scsi_cmd_rw_10; - - -// READ (12), WRITE (12) - -typedef struct scsi_cmd_rw_12 { - uint8 opcode; - LBITFIELD8_5( - RelAdr : 1, // relative address - res1_1 : 2, - FUA : 1, // force unit access (1 = safe, cacheless access) - DPO : 1, // disable page out (1 = not worth caching) - LUN : 3 - ); - uint8 top_LBA; - uint8 high_LBA; - uint8 mid_LBA; - uint8 low_LBA; - uint8 top_length; // 0 = no block - uint8 high_length; - uint8 mid_length; - uint8 low_length; - uint8 res10; - uint8 control; -} scsi_cmd_rw_12; - - -// REQUEST SENSE - -typedef struct scsi_cmd_request_sense { - uint8 opcode; - LBITFIELD8_2( - res1_0 : 5, - LUN : 3 - ); - uint8 res2[2]; - uint8 alloc_length; - uint8 control; -} scsi_cmd_request_sense; - - -// sense data structures - -#define SCSIS_CURR_ERROR 0x70 -#define SCSIS_DEFERRED_ERROR 0x71 - -typedef struct scsi_sense { - LBITFIELD8_2( - error_code : 7, - valid : 1 // 0 = not conforming to standard - ); - uint8 segment_number; // for COPY/COPY AND VERIFY/COMPARE - LBITFIELD8_5( - sense_key : 4, - res2_4 : 1, - ILI : 1, // incorrect length indicator - req. block - // length doesn't match physical block length - EOM : 1, // serial devices only - Filemark : 1 // optional for random access - ); - - uint8 highest_inf; // device-type or command specific - uint8 high_inf; // device-type 0, 4, 5, 7: block address - uint8 mid_inf; // device-type 1, 2, 3: req length - act. length - uint8 low_inf; // (and others for sequential dev. and COPY cmds - - uint8 add_sense_length; // total length = this + 7 - - uint8 highest_cmd_inf; - uint8 high_cmd_inf; - uint8 mid_cmd_inf; - uint8 low_cmd_inf; - uint8 asc; - uint8 ascq; // this can be zero if unsupported - uint8 unit_code; // != 0 to specify internal device unit - - union { - struct { - LBITFIELD8_2( - high_key_spec : 7, - SKSV : 1 // 1 = sense key specific (byte 15-17) valid - ); - uint8 mid_key_spec; - uint8 low_key_spec; - } raw; - - // ILLEGAL REQUEST - struct { - LBITFIELD8_5( - bit_pointer : 3, // points to (highest) invalid bit of parameter - BPV : 1, // 1 = bit_pointer is valid - res15_4 : 2, - c_d : 2, // 1 = error command, 0 = error in data - SKSV : 1 // s.a. - ); - uint8 high_field_pointer; // points to (highest) invalid byte of parameter - uint8 low_field_pointer; // (!using big endian, this means the first byte!) - } ill_request; - - // access error (RECOVERED, HARDWARE or MEDIUM ERROR) - struct { - LBITFIELD8_2( - res15_0 : 7, - SKSV : 1 - ); - uint8 high_retry_cnt; - uint8 low_retry_cnt; - } acc_error; - - // format progress (if sense key = NOT READY) - struct { - LBITFIELD8_2( - res15_0 : 7, - SKSV : 1 - ); - uint8 high_progress; // 0 = start, 0xffff = almost finished - uint8 low_progress; - } format_progress; - } sense_key_spec; - - // starting with offset 18 there are additional sense byte -} scsi_sense; - - -// PREVENT ALLOW - -typedef struct scsi_cmd_prevent_allow { - uint8 opcode; - LBITFIELD8_2( - res1_0 : 5, - LUN : 3 - ); - uint8 res2[2]; - LBITFIELD8_2( - prevent : 1, // 1 - prevent medium removal, 0 - allow removal - res4_1 : 7 - ); - uint8 control; -} scsi_cmd_prevent_allow; - -// START STOP UNIT - -typedef struct scsi_cmd_ssu { - uint8 opcode; - LBITFIELD8_3( - immed : 1, // 1 - return immediately, 0 - return on completion - res1_1 : 4, - LUN : 3 - ); - uint8 res2[2]; - LBITFIELD8_3( - start : 1, // 1 - load+start, i.e. allow, 0 - eject+stop, i.e. deny - LoEj : 1, // 1 - include loading/ejecting, 0 - only to allow/deny - res4_2 : 6 - ); - uint8 control; -} scsi_cmd_ssu; - - -// MODE SELECT (6) - -typedef struct scsi_cmd_mode_select_6 { - uint8 opcode; - LBITFIELD8_4( - SP : 1, // 1 = save pages to non-volatile memory - res1_1 : 3, - PF : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format - LUN : 3 - ); - uint8 res2[2]; - uint8 param_list_length; // data size - uint8 control; -} scsi_cmd_mode_select_6; - - -// MODE SENSE (6) - -typedef struct scsi_cmd_mode_sense_6 { - uint8 opcode; - LBITFIELD8_4( - res1_0 : 3, - DBD : 1, // disable block descriptors - res1_4 : 1, - LUN : 3 - ); - LBITFIELD8_2( - page_code : 6, - PC : 2 // page control field - ); - uint8 res3; - uint8 allocation_length; // maximum amount of data - uint8 control; -} scsi_cmd_mode_sense_6; - - -// MODE SELECT (10) - -typedef struct scsi_cmd_mode_select_10 { - uint8 opcode; - LBITFIELD8_4( - SP : 1, // 1 = save pages to non-volatile memory - res1_1 : 3, - PF : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format - LUN : 3 - ); - uint8 res2[5]; - uint8 high_param_list_length; // data size - uint8 low_param_list_length; - uint8 control; -} scsi_cmd_mode_select_10; - - -// MODE SENSE (10) - -typedef struct scsi_cmd_mode_sense_10 { - uint8 opcode; - LBITFIELD8_4( - res1_0 : 3, - DBD : 1, // disable block descriptors - res1_4 : 1, - LUN : 3 - ); - LBITFIELD8_2( - page_code : 6, - PC : 2 // page control field - ); - uint8 res3[4]; - uint8 high_allocation_length; // maximum amount of data - uint8 low_allocation_length; - uint8 control; -} scsi_cmd_mode_sense_10; - - -// possible contents of PC -#define SCSI_MODE_SENSE_PC_CURRENT 0 -#define SCSI_MODE_SENSE_PC_CHANGABLE 1 // changable field are filled with "1" -#define SCSI_MODE_SENSE_PC_DEFAULT 2 -#define SCSI_MODE_SENSE_PC_SAVED 3 - -// special mode page indicating to return all mode pages -#define SCSI_MODEPAGE_ALL 0x3f - -// header of mode data; followed by block descriptors and mode pages -typedef struct scsi_mode_param_header_6 { - uint8 mode_data_len; // total length excluding this byte - uint8 medium_type; - uint8 dev_spec_parameter; - uint8 block_desc_len; // total length of all transmitted block descriptors -} scsi_mode_param_header_6; - -typedef struct scsi_mode_param_header_10 { - uint8 high_mode_data_len; // total length excluding these two bytes - uint8 low_mode_data_len; - uint8 medium_type; - uint8 dev_spec_parameter; - uint8 res4[2]; - uint8 high_block_desc_len; // total length of all transmitted block descriptors - uint8 low_block_desc_len; -} scsi_mode_param_header_10; - - -// content of dev_spec_parameter for direct access devices -typedef struct scsi_mode_param_dev_spec_da { - LBITFIELD8_4( - res0_0 : 4, - DPOFUA : 1, // 1 = supports DPO and FUA, see READ (10) (sense only) - res0_6 : 1, - WP : 1 // write protected (sense only) - ); -} scsi_mode_param_dev_spec_da; - -typedef struct scsi_mode_param_block_desc { - uint8 density; // density code of area - uint8 high_numblocks; // size of this area in blocks - uint8 med_numblocks; // 0 = all remaining blocks - uint8 low_numblocks; - uint8 res4; - uint8 high_blocklen; // block size - uint8 med_blocklen; - uint8 low_blocklen; -} scsi_mode_param_block_desc; - - -// header of a mode pages -typedef struct scsi_modepage_header { - LBITFIELD8_3( - page_code : 6, - res0_6 : 1, - PS : 1 // 1 = page can be saved (only valid for MODE SENSE) - ); - uint8 page_length; // size of page excluding this common header -} scsi_modepage_header; - - -// control mode page -#define SCSI_MODEPAGE_CONTROL 0xa - -typedef struct scsi_modepage_contr { - scsi_modepage_header header; - LBITFIELD8_2( - RLEC : 1, // Report Log Exception Condition - res2_1 : 7 - ); - LBITFIELD8_4( - DQue : 1, // disable Queuing - QErr : 1, // abort queued commands on contingent allegiance condition - res3_2 : 2, - QAM : 4 // Queue Algorithm Modifier - ); - LBITFIELD8_5( - EAENP : 1, // error AEN permission; true = send AEN on deferred error - // false = generate UA condition after deferred error - UAAENP : 1, // unit attention AEN permission; true = send AEN, - // false = generate UA condition (for everything but init.) - RAENP : 1, // ready AEN permission; true = send async event notification - // (AEN) instead of generating an Unit Attention (UA) Condition - // after initialization - res4_3 : 4, - EECA : 1 // enable Extended Contingent Allegiance - ); - uint8 res5; - uint8 high_AEN_holdoff; // ready AEN hold off period - delay in ms between - uint8 low_AEN_holdoff; // initialization and AEN -} scsi_modepage_contr; - -// values for QAM -#define SCSI_QAM_RESTRICTED 0 -#define SCSI_QAM_UNRESTRICTED 1 -// 2 - 7 reserved, 8 - 0xf vendor-specific - - -// CD audio control page -#define SCSI_MODEPAGE_AUDIO 0xe - -typedef struct scsi_modepage_audio { - scsi_modepage_header header; - LBITFIELD8_4( - res2_0 : 1, - SOTC : 1, // Stop On Track Crossing - // 0 - stop according transfer length, 1 - stop at end of track - IMMED : 1, // must be one - res2_3 : 5 - ); - uint8 res3[3]; - uint8 obs6[2]; - struct { - LBITFIELD8_2( - channel : 4, // select channel to connect to this port - res0_4 : 4 - ); - uint8 volume; - } ports[4]; -} scsi_modepage_audio; - -// connection between output port and audio channel -#define SCSI_CHANNEL_SEL_MUTED 0 // mute port -#define SCSI_CHANNEL_SEL_CHANNEL0 1 // connect to channel 0 -#define SCSI_CHANNEL_SEL_CHANNEL1 2 // connect to channel 1 -#define SCSI_CHANNEL_SEL_CHANNEL0_1 3 // connect to channel 0 and channel 1 -#define SCSI_CHANNEL_SEL_CHANNEL2 4 // connect to channel 2 -#define SCSI_CHANNEL_SEL_CHANNEL3 8 // connect to channel 3 - -// TUR - -typedef struct scsi_cmd_tur { - uint8 opcode; - LBITFIELD8_2( - res1_0 : 5, - LUN : 3 - ); - uint8 res3[3]; - uint8 control; -} scsi_cmd_tur; - - -// READ_TOC - -typedef struct scsi_cmd_read_toc { - uint8 opcode; - LBITFIELD8_4( - res1_0 : 1, - TIME : 1, // true, to use TIME format, false for LBA format - res1_2 : 3, - LUN : 3 - ); - LBITFIELD8_2( - format : 4, // see below - res2_4 : 4 - ); - uint8 res3[3]; - uint8 track; // (starting) track - uint8 high_allocation_length; // maximum amount of data - uint8 low_allocation_length; - uint8 control; -} scsi_cmd_read_toc; - -// values of in TOC command -#define SCSI_TOC_FORMAT_TOC 0 // all TOCs starting with (0xaa for lead-out) -#define SCSI_TOC_FORMAT_SESSION_INFO 1 // Session info -#define SCSI_TOC_FORMAT_FULL_TOC 2 // all Q-channel data in TOC -#define SCSI_TOC_FORMAT_PMA 3 // Q-channel data in PMA area -#define SCSI_TOC_FORMAT_ATIP 4 // get ATIP data -#define SCSI_TOC_FORMAT_CD_TEXT 5 // get CD-Text from R/W-channel in lead-in - -// general structure of response -typedef struct scsi_toc_general { - uint8 high_data_len; // total length - 2 - uint8 low_data_len; - uint8 first; // first track/session/reserved - uint8 last; // last one - // remainder are parameter list descriptors -} scsi_toc_general; - -// definition of CD-ROM LBA -typedef struct scsi_cd_lba { - uint8 top; - uint8 high; - uint8 mid; - uint8 low; -} scsi_cd_lba; - -// definition of CD-ROM MSF time -typedef struct scsi_cd_msf { - uint8 reserved; - uint8 minute; - uint8 second; - uint8 frame; -} scsi_cd_msf; - -// definition of Track Number address format -typedef struct scsi_cd_tno { - uint8 res0[3]; - uint8 track; -} scsi_cd_tno; - -// one track for SCSI_TOC_FORMAT_TOC -typedef struct scsi_toc_track { - uint8 res0; - LBITFIELD8_2( - CONTROL : 4, - ADR : 4 - ); - uint8 track_number; // track number (hex) - uint8 res3; - union { // start of track (time or LBA, see TIME of command) - scsi_cd_lba lba; - scsi_cd_msf time; - } start; -} scsi_toc_track; - -// possible value of ADR-field (described Q-channel content) -enum { - scsi_adr_none = 0, // no Q-channel mode info - scsi_adr_position = 1, // Q-channel encodes current position data - scsi_adr_mcn = 2, // Q-channel encodes Media Catalog Number - scsi_adr_isrc = 3 // Q-channel encodes ISRC -} scsi_adr; - -// value of Q-channel control field (CONTROL) -enum { - scsi_q_control_2audio = 0, // stereo audio - scsi_q_control_2audio_preemp = 1, // stereo audio with 50/15µs pre-emphasis - scsi_q_control_1audio = 8, // audio (reserved in CD-R/W) - scsi_q_control_1audio_preemp = 9, // audio with pre-emphasis (reserved in CD-R/W) - scsi_q_control_data_un_intr = 4, // data, recorded un-interrupted - scsi_q_control_data_incr = 5, // data, recorded incremental - scsi_q_control_ddcd = 4, // DDCD data - scsi_q_control_copy_perm = 2 // copy permitted (or-ed with value above) -} scsi_q_control; - -// format SCSI_TOC_FORMAT_TOC -typedef struct scsi_toc_toc { - uint8 high_data_len; // total length - 2 (independant of actual size) - uint8 low_data_len; - uint8 first_track; // first track (hex) - uint8 last_track; // last track (hex) - - scsi_toc_track tracks[1]; // one entry per track -} scsi_toc_toc; - - -// READ SUB-CHANNEL - -typedef struct scsi_cmd_read_subchannel { - uint8 opcode; - LBITFIELD8_4( - res1_0 : 1, - TIME : 1, // true, to use TIME format, false for LBA format - res1_2 : 3, - LUN : 3 - ); - LBITFIELD8_3( - res2_0 : 6, - SUBQ : 1, // 1 - return Q sub-channel data - res2_7 : 1 - ); - uint8 parameter_list; // see below - uint8 res4[2]; - uint8 track; // track number (hex) - uint8 high_allocation_length; // maximum amount of data - uint8 low_allocation_length; - uint8 control; -} scsi_cmd_read_subchannel; - -// values of parameter_list -enum { - scsi_sub_channel_parameter_list_cd_pos = 1, // CD current position - scsi_sub_channel_parameter_list_mcn = 2, // Media Catalog Number - scsi_sub_channel_parameter_list_isrc = 3 // Track International Standard Recording Code -} scsi_sub_channel_parameter_list; - -// header of response -typedef struct scsi_subchannel_data_header { - uint8 res0; - uint8 audio_status; // see below - uint8 high_data_len; // total length - 4 - uint8 low_data_len; -} scsi_subchannel_data_header; - -// possible audio_status -enum { - scsi_audio_status_not_supported = 0, - scsi_audio_status_playing = 0x11, - scsi_audio_status_paused = 0x12, - scsi_audio_status_completed = 0x13, - scsi_audio_status_error_stop = 0x14, - scsi_audio_status_no_status = 0x15 -} scsi_audio_status; - -typedef struct scsi_cd_current_position { - uint8 format_code; // always 1 - LBITFIELD8_2( - CONTROL : 4, // see scsi_q_control - ADR : 4 // see scsi_adr - ); - uint8 track; - uint8 index; - union { // current position, relative to logical beginning - scsi_cd_lba lba; - scsi_cd_msf time; - } absolute_address; - union { // current position, relative to track - scsi_cd_lba lba; - scsi_cd_msf time; - } track_relative_address; -} scsi_cd_current_position; - - -// PLAY AUDIO MSF - -typedef struct scsi_cmd_play_msf { - uint8 opcode; - LBITFIELD8_2( - res1_0 : 5, - LUN : 3 - ); - uint8 res2; - uint8 start_minute; // start time - uint8 start_second; - uint8 start_frame; - uint8 end_minute; // end time (excluding) - uint8 end_second; - uint8 end_frame; - uint8 control; -} scsi_cmd_play_msf; - - -// STOP AUDIO - -typedef struct scsi_cmd_stop_play { - uint8 opcode; - LBITFIELD8_2( - res1_0 : 5, - LUN : 3 - ); - uint8 res2[7]; - uint8 control; -} scsi_cmd_stop_play; - - -// PAUSE/RESUME - -typedef struct scsi_cmd_pause_resume { - uint8 opcode; - LBITFIELD8_2( - res1_0 : 5, - LUN : 3 - ); - uint8 res2[6]; - LBITFIELD8_2( - resume : 1, // 1 for resume, 0 for pause - res8_2 : 7 - ); - uint8 control; -} scsi_cmd_pause_resume; - - -// SCAN - -typedef struct scsi_cmd_scan { - uint8 opcode; - LBITFIELD8_4( - RELADR : 1, // must be 0 - res1_1 : 3, - Direct : 1, // direction: 0 forward, 1 backward - LUN : 3 - ); - union { // start of track (depends on ) - scsi_cd_lba lba; - scsi_cd_msf time; - scsi_cd_tno tno; - } start; - uint8 res6[3]; - LBITFIELD8_2( - res9_0 : 6, - type : 2 // actual type of (see below) - ); - uint8 res10; - uint8 control; -} scsi_cmd_scan; - -// possible values for type -enum { - scsi_scan_lba = 0, - scsi_scan_msf = 1, - scsi_scan_tno = 2 -} scsi_scan_type; - - -// READ_CD - -typedef struct scsi_cmd_read_cd { - uint8 opcode; - LBITFIELD8_4( - RELADR : 1, // must be 0 - res1_1 : 1, - sector_type : 3, // required sector type (1=CDDA) - LUN : 3 - ); - scsi_cd_lba lba; - uint8 high_length; - uint8 mid_length; - uint8 low_length; - LBITFIELD8_6( - res9_0 : 1, - error_field : 2, - EDC_ECC : 1, // include EDC/ECC; includes 8 byte padding for Mode 1 format - user_data : 1, // if 1, include user data - // (mode select block size is ignored) - header_code : 2, - SYNC : 1 // if 1, include sync field from sector - ); - LBITFIELD8_2( - sub_channel_selection : 4, - res10_4 : 4 - ); - uint8 control; -} scsi_cmd_read_cd; - -// possible values for header_code -enum { - scsi_read_cd_header_none = 0, - scsi_read_cd_header_hdr_only = 1, - scsi_read_cd_header_sub_header_only = 2, - scsi_read_cd_header_all_headers = 3, -} scsi_read_cd_header_code; - -// possible values for error_field -enum { - scsi_read_cd_error_none = 0, - scsi_read_cd_error_c2_error = 1, // include 2352 bits indicating error in byte - scsi_read_cd_error_c2_and_block_error = 2, // include or of C2 data plus pad byte -} scsi_read_cd_error_field; - -// possible values for sub_channel_selection -enum { - scsi_read_cd_sub_channel_none = 0, - scsi_read_cd_sub_channel_RAW = 1, - scsi_read_cd_sub_channel_Q = 2, - scsi_read_cd_sub_channel_P_W = 4 // R/W data, depending on CD capabilities - // and Mechanism status page -} scsi_read_cd_sub_channel_selection; - -#endif diff --git a/headers/build/os/drivers/bus/scsi/scsi_periph.h b/headers/build/os/drivers/bus/scsi/scsi_periph.h deleted file mode 100644 index 8c826984bd..0000000000 --- a/headers/build/os/drivers/bus/scsi/scsi_periph.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2002/03, Thomas Kurschel. All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - Part of Open SCSI Peripheral Driver - - Use this module to minimize work required to write a SCSI - peripheral driver. - - It takes care of: - - error handling - - medium changes (including restarting the medium) - - detection of medium capacity -*/ - -#ifndef __SCSI_PERIPH_H__ -#define __SCSI_PERIPH_H__ - -#include -#include -#include -#include - -// cookie issued by module per device -typedef struct scsi_periph_device_info *scsi_periph_device; -// cookie issued by module per file handle -typedef struct scsi_periph_handle_info *scsi_periph_handle; - -// "standardized" error code to simplify handling of scsi errors -typedef enum { - err_act_ok, // executed successfully - err_act_retry, // failed, retry 3 times - err_act_fail, // failed, don't retry - err_act_many_retries, // failed, retry multiple times (currently 10 times) - err_act_start, // devices requires a "start" command - err_act_invalid_req // request is invalid -} err_act; - -// packed scsi command result -typedef struct err_res { - status_t error_code : 32; // Be error code - uint32 action : 8; // err_act code -} err_res; - -#define MK_ERROR( aaction, code ) ({ \ - err_res res = {error_code: (code), action: (aaction) }; \ - res; \ -}) - -// device icon type -typedef enum { - icon_type_disk, - icon_type_removal, - icon_type_floppy, - icon_type_cd -} icon_type; - -// cookie issued by driver to identify itself -//typedef struct periph_info *periph_cookie; -// cookie issued by driver per device -typedef struct periph_device_info *periph_device_cookie; -// cookie issued by driver per file handle -typedef struct periph_handle_info *periph_handle_cookie; - - -// callbacks to be provided by peripheral driver -typedef struct scsi_periph_callbacks { - // *** block devices *** - // informs of new size of medium - // (set to NULL if not a block device) - void (*set_capacity)( periph_device_cookie periph_device, uint64 capacity, - uint32 block_size ); - - // *** removable devices - // called when media got changed (can be NULL if medium is not changable) - // (you don't need to call periph->media_changed, but it's doesn't if you do) - // ccb - request at your disposal - void (*media_changed)( periph_device_cookie periph_device, - scsi_ccb *request ); -} scsi_periph_callbacks; - - -// functions provided by this module -typedef struct scsi_periph_interface { - module_info info; - - // *** init/cleanup *** - status_t (*register_device)( - periph_device_cookie periph_device, - scsi_periph_callbacks *callbacks, - scsi_device scsi_device, - scsi_device_interface *scsi, - device_node_handle node, - bool removable, - scsi_periph_device *driver ); - status_t (*unregister_device)( scsi_periph_device driver ); - - // *** basic command execution *** - // exec command, retrying on problems - status_t (*safe_exec)( - scsi_periph_device periph_device, - scsi_ccb *request ); - // exec simple command - status_t (*simple_exec)( scsi_periph_device device, - void *cdb, uchar cdb_len, void *data, size_t data_len, - int ccb_flags ); - - // *** file handling *** - // to be called when a new file is opened - status_t (*handle_open)( scsi_periph_device device, - periph_handle_cookie periph_handle, scsi_periph_handle *res_handle ); - // to be called when a file is closed - status_t (*handle_close)( scsi_periph_handle handle ); - // to be called when a file is freed - status_t (*handle_free)( scsi_periph_handle handle ); - - // *** default implementation for block devices *** - // block read - // preferred_ccb_size - preferred command size; if zero, the shortest is used - status_t (*read)( scsi_periph_handle handle, const phys_vecs *vecs, - off_t pos, size_t num_blocks, uint32 block_size, size_t *bytes_transferred, - int preferred_ccb_size ); - // block write - // (see block_read) - status_t (*write)( scsi_periph_handle handle, const phys_vecs *vecs, - off_t pos, size_t num_blocks, uint32 block_size, size_t *bytes_transferred, - int preferred_ccb_size ); - // block ioctls - status_t (*ioctl)( scsi_periph_handle handle, int op, void *buf, size_t len ); - // check medium capacity (calls set_capacity callback on success) - // request - ccb for this device; is used to talk to device - status_t (*check_capacity)( scsi_periph_device device, scsi_ccb *request ); - - // *** removable media *** - // to be called when a medium change is detected to block subsequent commands - void (*media_changed)( scsi_periph_device device ); - // convert result of *request to err_res - err_res (*check_error)( scsi_periph_device device, scsi_ccb *request ); - // send start or stop command to device - // with_LoEj = true - include loading/ejecting, - // false - only do allow/deny - err_res (*send_start_stop)( scsi_periph_device device, scsi_ccb *request, - bool start, bool with_LoEj ); - // checks media status and waits for device to become ready - // returns: B_OK, B_DEV_MEDIA_CHANGE_REQUESTED, B_NO_MEMORY or - // pending error reported by handle_get_error - status_t (*get_media_status)( scsi_periph_handle handle ); - - // compose device name consisting of prefix and path/target/LUN - // (result must be freed by caller) - char *(*compose_device_name)(device_node_handle device_node, const char *prefix); - - // fill data with icon (for B_GET_ICON ioctl) - status_t (*get_icon)( icon_type type, device_icon *data ); - - // synchronizes (flush) the device cache - err_res(*synchronize_cache)(scsi_periph_device device, scsi_ccb *request); -} scsi_periph_interface; - -#define SCSI_PERIPH_MODULE_NAME "generic/scsi_periph/v1" - -#endif diff --git a/headers/build/os/drivers/bus_manager.h b/headers/build/os/drivers/bus_manager.h deleted file mode 100644 index e894f7f0f4..0000000000 --- a/headers/build/os/drivers/bus_manager.h +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* -/ -/ File: bus_managers.h -/ -/ Description: bus manager API -/ -/ Copyright 1998, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - -#ifndef _BUS_MANAGER_H -#define _BUS_MANAGER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct bus_manager_info bus_manager_info; - -struct bus_manager_info { - module_info minfo; - status_t (*rescan)(); -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _BUS_MANAGER_H */ diff --git a/headers/build/os/drivers/config_manager.h b/headers/build/os/drivers/config_manager.h deleted file mode 100644 index e93e27772a..0000000000 --- a/headers/build/os/drivers/config_manager.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef _CONFIG_MANAGER_H -#define _CONFIG_MANAGER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - B_ISA_BUS, - B_PCI_BUS, - B_PCMCIA_BUS, - B_UNKNOWN_BUS = 0x80 -} bus_type; - -typedef struct { - uchar base; - uchar subtype; - uchar interface; -} device_type; - -typedef struct { - uint32 mask; - uint32 flags; - uint32 cookie; -} resource_mask_descriptor; - -typedef struct { - uint32 minbase; - uint32 maxbase; - uint32 basealign; - uint32 len; - uint32 flags; - uint32 cookie; -} resource_range_descriptor; - -typedef enum { - B_IRQ_RESOURCE, - B_DMA_RESOURCE, - B_IO_PORT_RESOURCE, - B_MEMORY_RESOURCE -} resource_type; - -typedef struct { - resource_type type; - union { - resource_mask_descriptor m; - resource_range_descriptor r; - uint32 for_padding[7]; - } d; -} resource_descriptor; - -struct device_configuration { - uint32 flags; - uint32 num_resources; - resource_descriptor resources[0]; -}; - -struct possible_device_configurations { - uint32 flags; - uint32 num_possible; - struct device_configuration possible[0]; -}; - -struct device_info { - uint32 size; - uint32 bus_dependent_info_offset; - bus_type bus; - device_type devtype; - uint32 id[4]; /* unique (per-bus) normally-persistent id for device */ - uint32 flags; - status_t config_status; - - /* bus-dependent data goes here... */ -}; - -#define B_DEVICE_INFO_ENABLED 1 -#define B_DEVICE_INFO_CONFIGURED 2 -#define B_DEVICE_INFO_CAN_BE_DISABLED 4 - -typedef struct config_manager_for_driver_module_info { - module_info minfo; - - status_t (*get_next_device_info)(bus_type bus, uint64 *cookie, - struct device_info *info, uint32 len); - status_t (*get_device_info_for)(uint64 device, - struct device_info *info, uint32 len); - - status_t (*get_size_of_current_configuration_for)(uint64 device); - status_t (*get_current_configuration_for)(uint64 device, - struct device_configuration *config, uint32 len); - - status_t (*get_size_of_possible_configurations_for)(uint64 device); - status_t (*get_possible_configurations_for)(uint64 device, - struct possible_device_configurations *possible, - uint32 len); - - /* helper routines for drivers */ - status_t (*count_resource_descriptors_of_type)( - const struct device_configuration *config, - resource_type type); - status_t (*get_nth_resource_descriptor_of_type)( - const struct device_configuration *config, uint32 n, - resource_type type, resource_descriptor *descriptor, - uint32 len); -} config_manager_for_driver_module_info; - -#define B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME "bus_managers/config_manager/driver/v1" - -#ifdef __cplusplus -} -#endif - -#endif /* _CONFIG_MANAGER_H */ diff --git a/headers/build/os/drivers/device_manager.h b/headers/build/os/drivers/device_manager.h deleted file mode 100644 index 539aa882e7..0000000000 --- a/headers/build/os/drivers/device_manager.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2004-2005, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT license. - */ -#ifndef _DEVICE_MANAGER_H -#define _DEVICE_MANAGER_H - - -#include -#include -#include - - -// type of I/O resource -enum { - IO_MEM = 1, - IO_PORT = 2, - ISA_DMA_CHANNEL = 3 -}; - - -// I/O resource description -typedef struct { - uint32 type; - // type of I/O resource - - uint32 base; - // I/O memory: first physical address (32 bit) - // I/O port: first port address (16 bit) - // ISA DMA channel: channel number (0-7) - - uint32 length; - // I/O memory: size of address range (32 bit) - // I/O port: size of port range (16 bit) - // ISA DMA channel: must be 1 -} io_resource; - -// attribute of a device node -typedef struct { - const char *name; - type_code type; // for supported types, see value - union { - uint8 ui8; // B_UINT8_TYPE - uint16 ui16; // B_UINT16_TYPE - uint32 ui32; // B_UINT32_TYPE - uint64 ui64; // B_UINT64_TYPE - const char *string; // B_STRING_TYPE - struct { // B_RAW_TYPE - void *data; - size_t length; - } raw; - } value; -} device_attr; - - -typedef struct device_node_info *device_node_handle; -typedef struct io_resource_info *io_resource_handle; -typedef struct device_attr_info *device_attr_handle; - -typedef struct driver_module_info driver_module_info; - - -// interface of the device manager - -typedef struct device_manager_info { - module_info info; - - status_t (*init_driver)(device_node_handle node, void *userCookie, - driver_module_info **interface, void **cookie); - status_t (*uninit_driver)(device_node_handle node); - - status_t (*rescan)(device_node_handle node); - - status_t (*register_device)(device_node_handle parent, - const device_attr *attrs, - const io_resource_handle *io_resources, - device_node_handle *node); - status_t (*unregister_device)(device_node_handle node); - - status_t (*get_next_child_device)(device_node_handle parent, - device_node_handle *_node, const device_attr *attrs); - device_node_handle (*get_parent)(device_node_handle node); - void (*put_device_node)(device_node_handle node); - - status_t (*acquire_io_resources)(io_resource *resources, - io_resource_handle *handles); - status_t (*release_io_resources)(const io_resource_handle *handles); - - int32 (*create_id)(const char *generator); - status_t (*free_id)(const char *generator, uint32 id); - - status_t (*get_attr_uint8)(device_node_handle node, - const char *name, uint8 *value, bool recursive); - status_t (*get_attr_uint16)(device_node_handle node, - const char *name, uint16 *value, bool recursive); - status_t (*get_attr_uint32)(device_node_handle node, - const char *name, uint32 *value, bool recursive); - status_t (*get_attr_uint64)(device_node_handle node, - const char *name, uint64 *value, bool recursive); - status_t (*get_attr_string)(device_node_handle node, - const char *name, char **value, bool recursive); - status_t (*get_attr_raw)(device_node_handle node, - const char *name, void **data, size_t *_size, - bool recursive); - - status_t (*get_next_attr)(device_node_handle node, - device_attr_handle *attrHandle); - status_t (*release_attr)(device_node_handle node, - device_attr_handle attr_handle); - status_t (*retrieve_attr)(device_attr_handle attr_handle, - const device_attr **attr); - status_t (*write_attr)(device_node_handle node, - const device_attr *attr); - status_t (*remove_attr)(device_node_handle node, const char *name); -} device_manager_info; - - -#define B_DEVICE_MANAGER_MODULE_NAME "system/device_manager/v1" - - -// interface of device driver - -struct driver_module_info { - module_info info; - - float (*supports_device)(device_node_handle parent, bool *_noConnection); - status_t (*register_device)(device_node_handle parent); - - status_t (*init_driver)(device_node_handle node, void *user_cookie, void **_cookie); - status_t (*uninit_driver)(void *cookie); - - void (*device_removed)(device_node_handle node, void *cookie); - void (*device_cleanup)(device_node_handle node); - - void (*get_supported_paths)(const char ***_busses, const char ***_devices); -}; - - -// standard device node attributes - -#define PNP_MANAGER_ID_GENERATOR "id_generator" - // if you are using an id generator (see create_id), you can let the - // manager automatically free the id when the node is deleted by setting - // the following attributes: - // name of generator (string) -#define PNP_MANAGER_AUTO_ID "auto_id" - // generated id (uint32) - -#define B_DRIVER_MODULE "driver/module" -#define B_DRIVER_PRETTY_NAME "driver/pretty name" -#define B_DRIVER_FIXED_CHILD "driver/fixed child" -#define B_DRIVER_MAPPING "driver/mapping" -#define B_DRIVER_BUS "driver/bus" -#define B_DRIVER_FIND_DEVICES_ON_DEMAND "driver/on demand" -#define B_DRIVER_EXPLORE_LAST "driver/explore last" - -#define B_DRIVER_UNIQUE_DEVICE_ID "unique id" -#define B_DRIVER_DEVICE_TYPE "device type" - -#define B_AUDIO_DRIVER_TYPE "audio" -#define B_BUS_DRIVER_TYPE "bus" -#define B_DISK_DRIVER_TYPE "disk" -#define B_GRAPHICS_DRIVER_TYPE "graphics" -#define B_INPUT_DRIVER_TYPE "input" -#define B_MISC_DRIVER_TYPE "misc" -#define B_NETWORK_DRIVER_TYPE "net" -#define B_VIDEO_DRIVER_TYPE "video" - -#define PNP_DRIVER_CONNECTION "connection" - // connection of parent the device is attached to (optional, string) - // there can be only one device per connection - - -// interface of a bus device driver - -typedef struct bus_module_info { - driver_module_info info; - - // scan the bus and register all devices. - status_t (*register_child_devices)(void *cookie); - - // user initiated rescan of the bus - only propagate changes - // you only need to implement this, if you cannot detect device changes yourself - // driver is always loaded during this call, but other hooks may - // be called concurrently - status_t (*rescan_bus)(void *cookie); -} bus_module_info; - - -// standard attributes - -// PnP bus identification (required, uint8) -// define this to let the PnP manager know that this is a PnP bus -// the actual content is ignored -#define PNP_BUS_IS_BUS "bus/is_bus" - -#endif /* _DEVICE_MANAGER_H */ diff --git a/headers/build/os/drivers/disk_device_manager.h b/headers/build/os/drivers/disk_device_manager.h deleted file mode 100644 index f9e5fd6855..0000000000 --- a/headers/build/os/drivers/disk_device_manager.h +++ /dev/null @@ -1,126 +0,0 @@ -// disk_device_manager.h -// -// C API exported by the disk device manager. -// Currently only functions of interest for partition modules/FS add-ons -// are considered. - -#ifndef _DISK_DEVICE_MANAGER_H -#define _DISK_DEVICE_MANAGER_H - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// C API partition representation -// Fields marked [sys] are set by the system and are not to be changed by -// the disk system modules. -typedef struct partition_data { - partition_id id; // [sys] - off_t offset; - off_t size; - off_t content_size; - uint32 block_size; - int32 child_count; - int32 index; // [sys] - uint32 status; - uint32 flags; - dev_t volume; // [sys] - void *mount_cookie; // [sys] - char *name; // max: B_OS_NAME_LENGTH - char *content_name; // - char *type; // - const char *content_type; // [sys] - char *parameters; - char *content_parameters; - void *cookie; - void *content_cookie; -} partition_data; - -// C API disk device representation -typedef struct disk_device_data { - partition_id id; // equal to that of the root partition - uint32 flags; - char *path; - device_geometry geometry; -} disk_device_data; - -// C API partitionable space representation -typedef struct partitionable_space_data { - off_t offset; - off_t size; -} partitionable_space_data; - -// operations on partitions -enum { - B_PARTITION_DEFRAGMENT, - B_PARTITION_REPAIR, - B_PARTITION_RESIZE, - B_PARTITION_RESIZE_CHILD, - B_PARTITION_MOVE, - B_PARTITION_MOVE_CHILD, - B_PARTITION_SET_NAME, - B_PARTITION_SET_CONTENT_NAME, - B_PARTITION_SET_TYPE, - B_PARTITION_SET_PARAMETERS, - B_PARTITION_SET_CONTENT_PARAMETERS, - B_PARTITION_INITIALIZE, - B_PARTITION_CREATE_CHILD, - B_PARTITION_DELETE_CHILD, -}; - -// disk device job cancel status -enum { - B_DISK_DEVICE_JOB_CONTINUE, - B_DISK_DEVICE_JOB_CANCEL, - B_DISK_DEVICE_JOB_REVERSE, -}; - -// disk device locking -disk_device_data *write_lock_disk_device(partition_id partitionID); -void write_unlock_disk_device(partition_id partitionID); -disk_device_data *read_lock_disk_device(partition_id partitionID); -void read_unlock_disk_device(partition_id partitionID); - // parameter is the ID of any partition on the device - -// getting disk devices/partitions by path -// (no locking required) -int32 find_disk_device(const char *path); -int32 find_partition(const char *path); - -// disk device/partition read access -// (read lock required) -disk_device_data *get_disk_device(partition_id partitionID); -partition_data *get_partition(partition_id partitionID); -partition_data *get_parent_partition(partition_id partitionID); -partition_data *get_child_partition(partition_id partitionID, int32 index); - -// partition write access -// (write lock required) -partition_data *create_child_partition(partition_id partitionID, int32 index, - partition_id childID); - // childID is an optional input parameter -- -1 to be ignored -bool delete_partition(partition_id partitionID); -void partition_modified(partition_id partitionID); - // tells the disk device manager, that the parition has been modified - -// disk systems -disk_system_id find_disk_system(const char *name); - -// jobs -bool update_disk_device_job_progress(disk_job_id jobID, float progress); -bool update_disk_device_job_extra_progress(disk_job_id jobID, - const char *info); -bool set_disk_device_job_error_message(disk_job_id jobID, const char *message); -uint32 update_disk_device_job_interrupt_properties(disk_job_id jobID, - uint32 interruptProperties); - // returns one of B_DISK_DEVICE_JOB_{CONTINUE,CANCEL,REVERSE} - -#ifdef __cplusplus -} -#endif - -#endif // _DISK_DEVICE_MANAGER_H diff --git a/headers/build/os/drivers/fast_log.h b/headers/build/os/drivers/fast_log.h deleted file mode 100644 index 310a758e95..0000000000 --- a/headers/build/os/drivers/fast_log.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -** Copyright 2002/03, Thomas Kurschel. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ - -/* - Fast logging facilities. - - This logging is much faster then dprintf and is saver - against buffer overflow conditions. - - Clients have to define events by creating an array of - fast_log_type entries, each consisting of a code and the - associated human-readable description. During logging, - only the code is stored to save space and time. Also, - all arguments are stored binary (currently, they must - be of type uint32). Conversion to human-readable text is - post-poned until the logging data is read or a client - connection is closed (as this invalidates the event- - description binding). - - The reader interface is /dev/FAST_LOG_DEVFS_NAME. This - device can only be read from (no seeking or further - functionality) and does not block if there is no data. - This is because if you want to store the log into a - file, the file access may lead to further logging data, - so doing a sleep between reads saves logging entries. -*/ - -#ifndef FAST_LOG_H -#define FAST_LOG_H - -#include - -// one event type as defined by client -typedef struct fast_log_event_type { - // code of event (zero means end-of-list) - int16 event; - // human-readable description - const char *description; -} fast_log_event_type; - - -// handle of client connection -typedef struct fast_log_connection *fast_log_handle; - - -// client interface -typedef struct fast_log_info { - module_info minfo; - - // open client connection - // prefix - prefix to print in log before each event - // types - array of event types; last entry must have event=0 - fast_log_handle (*start_log)(const char *prefix, fast_log_event_type types[]); - // close client connection - void (*stop_log)(fast_log_handle handle); - - // log an entry without arguments - void (*log_0)(fast_log_handle handle, int event); - // log an entry with one argument - void (*log_1)(fast_log_handle handle, int event, uint32 param1); - // log an entry with two arguments - void (*log_2)(fast_log_handle handle, int event, uint32 param1, uint32 param2); - // log an entry with three arguments - void (*log_3)(fast_log_handle handle, int event, uint32 param1, uint32 param2, uint32 param3); - // log an entry with four arguments - void (*log_4)(fast_log_handle handle, int event, uint32 param1, uint32 param2, uint32 param3, uint32 param4); - - // log an entry with n arguments - // don't cheat on num_params! - void (*log_n)(fast_log_handle handle, int event, int num_params, ...); -} fast_log_info; - -// name of client interface module -#define FAST_LOG_MODULE_NAME "generic/fast_log/v1" -// name of device to read logging data from -#define FAST_LOG_DEVFS_NAME "fast_log" - -#endif diff --git a/headers/build/os/drivers/fs_cache.h b/headers/build/os/drivers/fs_cache.h deleted file mode 100644 index 9fe253cf2c..0000000000 --- a/headers/build/os/drivers/fs_cache.h +++ /dev/null @@ -1,63 +0,0 @@ -/* File System File and Block Caches - * - * Copyright 2004-2005, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _FS_CACHE_H -#define _FS_CACHE_H - - -#include - - -typedef void (*transaction_notification_hook)(int32 id, void *data); - -#ifdef __cplusplus -extern "C" { -#endif - -/* transactions */ -extern int32 cache_start_transaction(void *_cache); -extern status_t cache_sync_transaction(void *_cache, int32 id); -extern status_t cache_end_transaction(void *_cache, int32 id, transaction_notification_hook hook, void *data); -extern status_t cache_abort_transaction(void *_cache, int32 id); -extern int32 cache_detach_sub_transaction(void *_cache, int32 id); -extern status_t cache_abort_sub_transaction(void *_cache, int32 id); -extern status_t cache_start_sub_transaction(void *_cache, int32 id); -extern status_t cache_next_block_in_transaction(void *_cache, int32 id, uint32 *_cookie, - off_t *_blockNumber, void **_data, void **_unchangedData); - -/* block cache */ -extern void block_cache_delete(void *_cache, bool allowWrites); -extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize); -extern status_t block_cache_sync(void *_cache); - -extern status_t block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction); -extern void *block_cache_get_writable_etc(void *_cache, off_t blockNumber, off_t base, - off_t length, int32 transaction); -extern void *block_cache_get_writable(void *_cache, off_t blockNumber, int32 transaction); -extern void *block_cache_get_empty(void *_cache, off_t blockNumber, int32 transaction); -extern const void *block_cache_get_etc(void *_cache, off_t blockNumber, off_t base, off_t length); -extern const void *block_cache_get(void *_cache, off_t blockNumber); -extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber, bool isDirty, int32 transaction); -extern void block_cache_put(void *_cache, off_t blockNumber); - -/* file cache */ -extern void *file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, int fd); -extern void file_cache_delete(void *_cacheRef); -extern status_t file_cache_set_size(void *_cacheRef, off_t size); -extern status_t file_cache_sync(void *_cache); -extern status_t file_cache_invalidate_file_map(void *_cacheRef, off_t offset, off_t size); - -extern status_t file_cache_read_pages(void *_cacheRef, off_t offset, - const iovec *vecs, size_t count, size_t *_numBytes); -extern status_t file_cache_write_pages(void *_cacheRef, off_t offset, - const iovec *vecs, size_t count, size_t *_numBytes); -extern status_t file_cache_read(void *_cacheRef, off_t offset, void *bufferBase, size_t *_size); -extern status_t file_cache_write(void *_cacheRef, off_t offset, const void *buffer, size_t *_size); - -#ifdef __cplusplus -} -#endif - -#endif /* _FS_CACHE_H */ diff --git a/headers/build/os/drivers/fs_interface.h b/headers/build/os/drivers/fs_interface.h deleted file mode 100644 index f6f567eba3..0000000000 --- a/headers/build/os/drivers/fs_interface.h +++ /dev/null @@ -1,258 +0,0 @@ -/* File System Interface Layer Definition - * - * Copyright 2004-2005, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _FS_INTERFACE_H -#define _FS_INTERFACE_H - - -#include -#include -#include -#include - -#include - - -struct dirent; -struct stat; -struct fs_info; -struct select_sync; - -typedef dev_t mount_id; -typedef ino_t vnode_id; - -/* the file system's private data structures */ -typedef void *fs_volume; -typedef void *fs_cookie; -typedef void *fs_vnode; - -/* passed to write_stat() */ -enum write_stat_mask { - FS_WRITE_STAT_MODE = 0x0001, - FS_WRITE_STAT_UID = 0x0002, - FS_WRITE_STAT_GID = 0x0004, - FS_WRITE_STAT_SIZE = 0x0008, - FS_WRITE_STAT_ATIME = 0x0010, - FS_WRITE_STAT_MTIME = 0x0020, - FS_WRITE_STAT_CRTIME = 0x0040 - // NOTE: Changing these constants will break - // src/kits/storage/LibBeAdapter.cpp:_kern_write_stat(). -}; - -/* passed to write_fs_info() */ -#define FS_WRITE_FSINFO_NAME 0x0001 - -struct file_io_vec { - off_t offset; - off_t length; -}; - -#define B_CURRENT_FS_API_VERSION "/v1" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct file_system_module_info { - struct module_info info; - const char *pretty_name; - - /* scanning (the device is write locked) */ - float (*identify_partition)(int fd, partition_data *partition, - void **cookie); - status_t (*scan_partition)(int fd, partition_data *partition, - void *cookie); - void (*free_identify_partition_cookie)(partition_data *partition, - void *cookie); - void (*free_partition_content_cookie)(partition_data *partition); - - /* general operations */ - status_t (*mount)(mount_id id, const char *device, uint32 flags, - const char *args, fs_volume *_fs, vnode_id *_rootVnodeID); - status_t (*unmount)(fs_volume fs); - - status_t (*read_fs_info)(fs_volume fs, struct fs_info *info); - status_t (*write_fs_info)(fs_volume fs, const struct fs_info *info, uint32 mask); - status_t (*sync)(fs_volume fs); - - /* vnode operations */ - status_t (*lookup)(fs_volume fs, fs_vnode dir, const char *name, vnode_id *_id, int *_type); - status_t (*get_vnode_name)(fs_volume fs, fs_vnode vnode, char *buffer, size_t bufferSize); - - status_t (*get_vnode)(fs_volume fs, vnode_id id, fs_vnode *_vnode, bool reenter); - status_t (*put_vnode)(fs_volume fs, fs_vnode vnode, bool reenter); - status_t (*remove_vnode)(fs_volume fs, fs_vnode vnode, bool reenter); - - /* VM file access */ - bool (*can_page)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes); - status_t (*write_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes); - - /* cache file access */ - status_t (*get_file_map)(fs_volume fs, fs_vnode vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count); - - /* common operations */ - status_t (*ioctl)(fs_volume fs, fs_vnode v, fs_cookie cookie, ulong op, void *buffer, size_t length); - status_t (*set_flags)(fs_volume fs, fs_vnode v, fs_cookie cookie, int flags); - status_t (*select)(fs_volume fs, fs_vnode v, fs_cookie cookie, uint8 event, - uint32 ref, selectsync *sync); - status_t (*deselect)(fs_volume fs, fs_vnode v, fs_cookie cookie, - uint8 event, selectsync *sync); - status_t (*fsync)(fs_volume fs, fs_vnode v); - - status_t (*read_link)(fs_volume fs, fs_vnode link, char *buffer, size_t *_bufferSize); - status_t (*write_link)(fs_volume fs, fs_vnode link, char *toPath); - status_t (*create_symlink)(fs_volume fs, fs_vnode dir, const char *name, const char *path, int mode); - - status_t (*link)(fs_volume fs, fs_vnode dir, const char *name, fs_vnode vnode); - status_t (*unlink)(fs_volume fs, fs_vnode dir, const char *name); - status_t (*rename)(fs_volume fs, fs_vnode fromDir, const char *fromName, fs_vnode toDir, const char *toName); - - status_t (*access)(fs_volume fs, fs_vnode vnode, int mode); - status_t (*read_stat)(fs_volume fs, fs_vnode vnode, struct stat *stat); - status_t (*write_stat)(fs_volume fs, fs_vnode vnode, const struct stat *stat, uint32 statMask); - - /* file operations */ - status_t (*create)(fs_volume fs, fs_vnode dir, const char *name, int openMode, int perms, fs_cookie *_cookie, vnode_id *_newVnodeID); - status_t (*open)(fs_volume fs, fs_vnode v, int openMode, fs_cookie *_cookie); - status_t (*close)(fs_volume fs, fs_vnode v, fs_cookie cookie); - status_t (*free_cookie)(fs_volume fs, fs_vnode v, fs_cookie cookie); - status_t (*read)(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, void *buffer, size_t *length); - status_t (*write)(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, const void *buffer, size_t *length); - - /* directory operations */ - status_t (*create_dir)(fs_volume fs, fs_vnode parent, const char *name, int perms, vnode_id *_newVnodeID); - status_t (*remove_dir)(fs_volume fs, fs_vnode parent, const char *name); - status_t (*open_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie); - status_t (*close_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - - /* attribute directory operations */ - status_t (*open_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie); - status_t (*close_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_attr_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - - /* attribute operations */ - status_t (*create_attr)(fs_volume fs, fs_vnode file, const char *name, uint32 type, int openMode, fs_cookie *_cookie); - status_t (*open_attr)(fs_volume fs, fs_vnode file, const char *name, int openMode, fs_cookie *_cookie); - status_t (*close_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie); - status_t (*free_attr_cookie)(fs_volume fs, fs_vnode file, fs_cookie cookie); - status_t (*read_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie, off_t pos, void *buffer, size_t *length); - status_t (*write_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie, off_t pos, const void *buffer, size_t *length); - - status_t (*read_attr_stat)(fs_volume fs, fs_vnode file, fs_cookie cookie, struct stat *stat); - status_t (*write_attr_stat)(fs_volume fs, fs_vnode file, fs_cookie cookie, const struct stat *stat, int statMask); - status_t (*rename_attr)(fs_volume fs, fs_vnode fromFile, const char *fromName, fs_vnode toFile, const char *toName); - status_t (*remove_attr)(fs_volume fs, fs_vnode file, const char *name); - - /* index directory & index operations */ - status_t (*open_index_dir)(fs_volume fs, fs_cookie *cookie); - status_t (*close_index_dir)(fs_volume fs, fs_cookie cookie); - status_t (*free_index_dir_cookie)(fs_volume fs, fs_cookie cookie); - status_t (*read_index_dir)(fs_volume fs, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_index_dir)(fs_volume fs, fs_cookie cookie); - - status_t (*create_index)(fs_volume fs, const char *name, uint32 type, uint32 flags); - status_t (*remove_index)(fs_volume fs, const char *name); - status_t (*read_index_stat)(fs_volume fs, const char *name, struct stat *stat); - - /* query operations */ - status_t (*open_query)(fs_volume fs, const char *query, uint32 flags, port_id port, uint32 token, fs_cookie *_cookie); - status_t (*close_query)(fs_volume fs, fs_cookie cookie); - status_t (*free_query_cookie)(fs_volume fs, fs_cookie cookie); - status_t (*read_query)(fs_volume fs, fs_cookie cookie, - struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_query)(fs_volume fs, fs_cookie cookie); - - /* capability querying (the device is read locked) */ - // ToDo: this will probably be combined to a single call - bool (*supports_defragmenting)(partition_data *partition, - bool *whileMounted); - bool (*supports_repairing)(partition_data *partition, - bool checkOnly, bool *whileMounted); - bool (*supports_resizing)(partition_data *partition, - bool *whileMounted); - bool (*supports_moving)(partition_data *partition, bool *isNoOp); - bool (*supports_setting_content_name)(partition_data *partition, - bool *whileMounted); - bool (*supports_setting_content_parameters)(partition_data *partition, - bool *whileMounted); - bool (*supports_initializing)(partition_data *partition); - - bool (*validate_resize)(partition_data *partition, off_t *size); - bool (*validate_move)(partition_data *partition, off_t *start); - bool (*validate_set_content_name)(partition_data *partition, - char *name); - bool (*validate_set_content_parameters)(partition_data *partition, - const char *parameters); - bool (*validate_initialize)(partition_data *partition, char *name, - const char *parameters); - - /* shadow partition modification (device is write locked) */ - status_t (*shadow_changed)(partition_data *partition, - uint32 operation); - - /* writing (the device is NOT locked) */ - status_t (*defragment)(int fd, partition_id partition, - disk_job_id job); - status_t (*repair)(int fd, partition_id partition, bool checkOnly, - disk_job_id job); - status_t (*resize)(int fd, partition_id partition, off_t size, - disk_job_id job); - status_t (*move)(int fd, partition_id partition, off_t offset, - disk_job_id job); - status_t (*set_content_name)(int fd, partition_id partition, - const char *name, disk_job_id job); - status_t (*set_content_parameters)(int fd, partition_id partition, - const char *parameters, disk_job_id job); - status_t (*initialize)(const char *partition, const char *name, - const char *parameters, disk_job_id job); - // This is pretty close to how the hook in R5 looked. Save the job ID, of - // course and that the parameters were given as (void*, size_t) pair. -} file_system_module_info; - - -/* file system add-ons only prototypes */ -extern status_t new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode); -extern status_t publish_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode); -extern status_t get_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode *_privateNode); -extern status_t put_vnode(mount_id mountID, vnode_id vnodeID); -extern status_t remove_vnode(mount_id mountID, vnode_id vnodeID); -extern status_t unremove_vnode(mount_id mountID, vnode_id vnodeID); - -extern status_t notify_listener(int op, mount_id device, vnode_id parentNode, - vnode_id toParentNode, vnode_id node, const char *name); -extern status_t send_notification(port_id port, long token, ulong what, long op, - mount_id device, mount_id toDevice, vnode_id parentNode, - vnode_id toParentNode, vnode_id node, const char *name); - -extern status_t notify_entry_created(mount_id device, vnode_id directory, - const char *name, vnode_id node); -extern status_t notify_entry_removed(mount_id device, vnode_id directory, - const char *name, vnode_id node); -extern status_t notify_entry_moved(mount_id device, vnode_id fromDirectory, - const char *fromName, vnode_id toDirectory, - const char *toName, vnode_id node); -extern status_t notify_stat_changed(mount_id device, vnode_id node, - uint32 statFields); -extern status_t notify_attribute_changed(mount_id device, vnode_id node, - const char *attribute, int32 cause); - -extern status_t notify_query_entry_created(port_id port, int32 token, - mount_id device, vnode_id directory, const char *name, - vnode_id node); -extern status_t notify_query_entry_removed(port_id port, int32 token, - mount_id device, vnode_id directory, const char *name, - vnode_id node); - -#ifdef __cplusplus -} -#endif - -#endif /* _FS_INTERFACE_H */ diff --git a/headers/build/os/drivers/isapnp.h b/headers/build/os/drivers/isapnp.h deleted file mode 100644 index b74e584495..0000000000 --- a/headers/build/os/drivers/isapnp.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _ISA_CONFIG_H -#define _ISA_CONFIG_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef union { - uint32 id; - uchar b[4]; -} EISA_PRODUCT_ID; - -/* uint32 MAKE_EISA_PRODUCT_ID(EISA_PRODUCT_ID* ptr, char ch0, char ch1, char ch2, uint12 prod_num, uint4 rev) */ -/* example: MAKE_EISA_PRODUCT_ID(&foo_id, 'F','O','O', 0xdb1, 3); */ -/* makes correct little-endian format */ -#define MAKE_EISA_PRODUCT_ID(ptr, ch0, ch1, ch2, prod_num, rev) \ - do { \ - (ptr)->b[0] = (uint8)(((((ch0) - 'A' + 1) & 0x1f) << 2) | ((((ch1) - 'A' + 1) & 0x18) >> 3)); \ - (ptr)->b[1] = (uint8)(((((ch1) - 'A' + 1) & 0x07) << 5) | ((((ch2) - 'A' + 1) & 0x1f) )); \ - (ptr)->b[2] = (uint8)((((prod_num) & 0xff0) >> 4)); \ - (ptr)->b[3] = (uint8)((((prod_num) & 0x00f) << 4) | ((rev) & 0xf) ); \ - } while(0) - -/* Compare IDs without revision */ -/* bool EQUAL_EISA_PRODUCT_ID(EISA_PRODUCT_ID id1, EISA_PRODUCT_ID id2); */ -#define EQUAL_EISA_PRODUCT_ID(id1, id2) \ - (((id1).b[0] == (id2).b[0]) && ((id1).b[1] == (id2).b[1]) && ((id1).b[2] == (id2).b[2]) && (((id1).b[3] & 0xf0) == ((id2).b[3] & 0xf0))) - -#define B_MAX_COMPATIBLE_IDS 8 - -/* This structure is deprecated and will be going away in the next release */ -struct isa_device_info { - struct device_info info; - - uchar csn; - uchar ldn; - uint32 vendor_id; - uint32 card_id; /* a.k.a. serial number */ - uint32 logical_device_id; - uint32 num_compatible_ids; - uint32 compatible_ids[B_MAX_COMPATIBLE_IDS]; - char card_name[B_OS_NAME_LENGTH]; - char logical_device_name[B_OS_NAME_LENGTH]; -}; - -/* So use this instead */ -struct isa_info { - uchar csn; - uchar ldn; - uint32 vendor_id; - uint32 card_id; /* a.k.a. serial number */ - uint32 logical_device_id; - uint32 num_compatible_ids; - uint32 compatible_ids[B_MAX_COMPATIBLE_IDS]; - char card_name[B_OS_NAME_LENGTH]; - char logical_device_name[B_OS_NAME_LENGTH]; -}; - -/* for the mem_descriptor cookie */ -#define B_ISA_MEMORY_32_BIT 0x100 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/headers/build/os/drivers/lendian_bitfield.h b/headers/build/os/drivers/lendian_bitfield.h deleted file mode 100644 index c38f2f038f..0000000000 --- a/headers/build/os/drivers/lendian_bitfield.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -** Copyright 2002, Thomas Kurschel. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ - -#ifndef LENDIAN_BITFIELD_H -#define LENDIAN_BITFIELD_H - -#include -#define B_HOST_IS_LENDIAN 1 - -#if B_HOST_IS_BENDIAN - -#define LBITFIELD8_2(b1,b2) uint8 b2,b1 -#define LBITFIELD8_3(b1,b2,b3) uint8 b3,b2,b1 -#define LBITFIELD8_4(b1,b2,b3,b4) uint8 b4,b3,b2,b1 -#define LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b5,b4,b3,b2,b1 -#define LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b6,b5,b4,b3,b2,b1 -#define LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b8,b7,b6,b5,b4,b3,b2,b1 - - -#define LBITFIELD2(b1,b2) uint16 b2,b1 -#define LBITFIELD3(b1,b2,b3) uint16 b3,b2,b1 -#define LBITFIELD4(b1,b2,b3,b4) uint16 b4,b3,b2,b1 -#define LBITFIELD5(b1,b2,b3,b4,b5) uint16 b5,b4,b3,b2,b1 -#define LBITFIELD6(b1,b2,b3,b4,b5,b6) uint16 b6,b5,b4,b3,b2,b1 -#define LBITFIELD7(b1,b2,b3,b4,b5,b6,b7) uint16 b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#define LBITFIELD16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b16,b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 -#elif B_HOST_IS_LENDIAN - -#define LBITFIELD8_2(b1,b2) uint8 b1,b2 -#define LBITFIELD8_3(b1,b2,b3) uint8 b1,b2,b3 -#define LBITFIELD8_4(b1,b2,b3,b4) uint8 b1,b2,b3,b4 -#define LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b1,b2,b3,b4,b5 -#define LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b1,b2,b3,b4,b5,b6 -#define LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b1,b2,b3,b4,b5,b6,b7 -#define LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b1,b2,b3,b4,b5,b6,b7,b8 - -#define LBITFIELD2(b1,b2) uint16 b1,b2 -#define LBITFIELD3(b1,b2,b3) uint16 b1,b2,b3 -#define LBITFIELD4(b1,b2,b3,b4) uint16 b1,b2,b3,b4 -#define LBITFIELD5(b1,b2,b3,b4,b5) uint16 b1,b2,b3,b4,b5 -#define LBITFIELD6(b1,b2,b3,b4,b5,b6) uint16 b1,b2,b3,b4,b5,b6 -#define LBITFIELD7(b1,b2,b3,b4,b5,b6,b7) uint16 b1,b2,b3,b4,b5,b6,b7 -#define LBITFIELD8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b1,b2,b3,b4,b5,b6,b7,b8 -#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9 -#define LBITFIELD10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 -#define LBITFIELD11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11 -#define LBITFIELD12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12 -#define LBITFIELD13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 -#define LBITFIELD14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14 -#define LBITFIELD15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15 -#define LBITFIELD16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16 - -#else -#error "Unknown host endianness" -#endif - -#endif /* LENDIAN_BITFIELD_H */ diff --git a/headers/build/os/drivers/locked_pool.h b/headers/build/os/drivers/locked_pool.h deleted file mode 100644 index 2a0064d2a6..0000000000 --- a/headers/build/os/drivers/locked_pool.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -** Copyright 2002/03, Thomas Kurschel. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ - -/* - Paging-safe allocation of locked memory. - - Library for managing temporary, locked memory with the condition of - not calling any function during allocation that can lead to paging. - Such memory is needed by drivers that are used to access the page file - but still need locked memory to execute requests. - - Basically, a background thread manages a memory pool where blocks - are allocated from. If the pool is empty, allocation is delayed until - either a blocks is freed or the pool is enlarged by the background - thread. - - All memory blocks must have same size and can be pre-initialized when - added to memory pool (and cleaned-up when removed from pool). The - free list is stored within free memory blocks, so you have to specify - a block offset where the manager can store the list pointers without - interfering with pre-initialization. - - You can also specify an alignment, e.g. if the blocks are used for - DMA access, a minimum pool size (in blocks), a maximum pool size - (in blocks) and the size of memory chunks to be added if the entire - pool is allocated. -*/ - -#ifndef __LOCKED_POOL_H__ -#define __LOCKED_POOL_H__ - -#include - -typedef struct locked_pool *locked_pool_cookie; - -typedef status_t (*locked_pool_add_hook)(void *block, void *arg); -typedef void (*locked_pool_remove_hook)(void *block, void *arg); - -typedef struct { - module_info minfo; - - // allocate block - void *(*alloc)(locked_pool_cookie pool); - // free block - void (*free)(locked_pool_cookie pool, void *block); - - // create new pool - // block_size - size of one memory block - // alignment - set address bits here that must be zero for block addresses - // next_ofs - offset in block where internal next-pointer can be stored - // chunk_size - how much system memory is to be allocated at once - // max_blocks - maximum number of blocks - // min_free_block - minimum number of free blocks - // name - name of pool - // lock_flags - flags to be passed to lock_memory() - // alloc_hook - hook to be called when new block is added to pool (can be NULL ) - // free_hook - hook to be called when block is removed from pool (can be NULL ) - // hook_arg - value to be passed to hooks as arg - locked_pool_cookie (*create)(int block_size, int alignment, int next_ofs, - int chunk_size, int max_blocks, int min_free_blocks, const char *name, - uint32 lock_flags, locked_pool_add_hook add_hook, - locked_pool_remove_hook remove_hook, void *hook_arg); - void (*destroy)(locked_pool_cookie pool); -} locked_pool_interface; - -#define LOCKED_POOL_MODULE_NAME "generic/locked_pool/v1" - -#endif diff --git a/headers/build/os/drivers/midi_driver.h b/headers/build/os/drivers/midi_driver.h deleted file mode 100644 index 147dce4915..0000000000 --- a/headers/build/os/drivers/midi_driver.h +++ /dev/null @@ -1,118 +0,0 @@ -/* ++++++++++ - FILE: midi_driver.h - REVS: $Revision: 1.1 $ - NAME: herold - DATE: Tue Jun 4 15:23:29 PDT 1996 - - Interface to /dev/midi, the midi driver -+++++ */ -/* - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. -*/ - -#ifndef _MIDI_DRIVER_H -#define _MIDI_DRIVER_H - -#include -#include - -/* ----- - ioctl codes ------ */ - -/* the old opcodes are deprecated, and may or may not work - in newer drivers */ -enum { - B_MIDI_GET_READ_TIMEOUT = B_MIDI_DRIVER_BASE, - B_MIDI_SET_READ_TIMEOUT, - B_MIDI_TIMED_READ, - B_MIDI_TIMED_WRITE, - B_MIDI_WRITE_SYNC, - B_MIDI_WRITE_CLEAR, - B_MIDI_GET_READ_TIMEOUT_OLD = B_DEVICE_OP_CODES_END + 1, - B_MIDI_SET_READ_TIMEOUT_OLD -}; - -/* the default timeout when you open a midi driver */ -#define B_MIDI_DEFAULT_TIMEOUT 1000000000000000LL - -/* Usage: - To read, set "data" to a pointer to your buffer, and "size" to the - maximum size of this buffer. On return, "when" will contain the time - at which the data was received (first byte) and "size" will contain - the actual amount of data read. - Call ioctl(fd, B_MIDI_TIMED_READ, &midi_timed_data, sizeof(midi_timed_data)); - To write, set "when" to when you want the first byte to go out the - wire, set "data" to point to your data, and set "size" to the size - of your data. - Call ioctl(fd, B_MIDI_TIMED_WRITE, &midi_timed_data, sizeof(midi_timed_data)); -*/ -typedef struct { - bigtime_t when; - size_t size; - unsigned char * data; -} midi_timed_data; - - -/* The MIDI parser returns the number of bytes that a message contains, given the */ -/* initial byte. For some messages, this is not known until the second byte is seen. */ -/* For such messages, a state > 0 is returned as well as some count > 0. When state */ -/* is > 0, you should call (*parse) for the next byte as well, which might modify */ -/* the returned message size. Message size will always be returned with the current */ -/* byte being counted as byte 1. A return of 0 means that the byte initiates a new */ -/* message. SysX is handled by returning max_size until the end or next initial message */ -/* is seen. So your loop looks something like: */ -/* - uint32 state = 0; // Only set this to 0 the first time you call the parser. - // preserve the 'state' between invocations of your read() hook. - int todo = 0; - unsigned char * end = in_buf+buf_size - unsigned char * out_buf = in_buf; - while (true) { - uchar byte = read_midi(); - if (!todo || state) { - todo = (*parser->parse)(&state, byte, end-out_buf); - } - if (todo < 1) { - unput_midi(byte); - } else { - *(out_buf++) = byte; - todo--; - } - if (todo < 1 || out_buf >= end) { - received_midi_message(in_buf, out_buf-in_buf); - todo = 0; - } - } - */ - -#define B_MIDI_PARSER_MODULE_NAME "media/midiparser/v1" - -typedef struct _midi_parser_module_info { - module_info minfo; - int (*parse)(uint32 * state, uchar byte, size_t max_size); - int _reserved_; -} midi_parser_module_info; - -#define B_MPU_401_MODULE_NAME "generic/mpu401/v1" - -enum { - B_MPU_401_ENABLE_CARD_INT = 1, - B_MPU_401_DISABLE_CARD_INT -}; -typedef struct _generic_mpu401_module { - module_info minfo; - status_t (*create_device)(int port, void ** out_storage, uint32 workarounds, void (*interrupt_op)(int32 op, void * card), void * card); - status_t (*delete_device)(void * storage); - status_t (*open_hook)(void * storage, uint32 flags, void ** out_cookie); - status_t (*close_hook)(void * cookie); - status_t (*free_hook)(void * cookie); - status_t (*control_hook)(void * cookie, uint32 op, void * data, size_t len); - status_t (*read_hook)(void * cookie, off_t pos, void * data, size_t * len); - status_t (*write_hook)(void * cookie, off_t pos, const void * data, size_t * len); - bool (*interrupt_hook)(void * cookie); - int _reserved_; -} generic_mpu401_module; - -#endif diff --git a/headers/build/os/drivers/mime_table.h b/headers/build/os/drivers/mime_table.h deleted file mode 100644 index e4d7332b72..0000000000 --- a/headers/build/os/drivers/mime_table.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* -/ -/ File: mime_table.h -/ -/ Description: Kernel mime table and matcher module API -/ -/ Copyright 2005, François Revol. -/ -*******************************************************************************/ - -#ifndef _MIME_TABLE_MODULE_H_ -#define _MIME_TABLE_MODULE_H_ - -#include - -struct ext_mime { - char *extension; - char *mime; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* - status_t get_table(struct ext_mime **table) - Returns the current kernel mime table. - You must call free_table() when finished with it. - - void free_table(struct ext_mime *table) - Frees the given mime table; - - const char * mime_for_ext(const char *ext) - Returns the known mime type for the given extension. - - const char * ext_for_mime(const char *mime) - Returns the known extension for the given mime type. - -*/ - -#define B_MIME_TABLE_MODULE_NAME "generic/mime_table/v1" - -typedef struct { - module_info minfo; - status_t (*get_table)(struct ext_mime **table); - void (*free_table)(struct ext_mime *table); - const char * (*mime_for_ext)(const char *ext); - const char * (*ext_for_mime)(const char *mime); -} mime_table_module_info; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/headers/build/os/drivers/module.h b/headers/build/os/drivers/module.h deleted file mode 100644 index 3c8a1514b3..0000000000 --- a/headers/build/os/drivers/module.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Modules Definitions -** -** Distributed under the terms of the OpenBeOS License. -*/ - -#ifndef _MODULE_H -#define _MODULE_H - - -#include - - -/* Every module exports a list of module_info structures. - * It defines the interface of the module and the name - * that is used to access the interface. - */ - -typedef struct module_info { - const char *name; - uint32 flags; - status_t (*std_ops)(int32, ...); -} module_info; - -/* module standard operations */ -#define B_MODULE_INIT 1 -#define B_MODULE_UNINIT 2 - -/* module flags */ -#define B_KEEP_LOADED 0x00000001 - - -/* Use the module_dependency structure to let the - * kernel automatically load modules yet depend on - * before B_MODULE_INIT is called. - */ - -typedef struct module_dependency { - const char *name; - module_info **info; -} module_dependency; - - -#ifdef __cplusplus -extern "C" { -#endif - -extern status_t get_module(const char *path, module_info **_info); -extern status_t put_module(const char *path); -extern status_t get_next_loaded_module_name(uint32 *cookie, char *buffer, size_t *_bufferSize); -extern void *open_module_list(const char *prefix); -extern status_t close_module_list(void *cookie); -extern status_t read_next_module_name(void *cookie, char *buffer, size_t *_bufferSize); - -#ifdef __cplusplus -} -#endif - -#endif /* _MODULE_H */ diff --git a/headers/build/os/drivers/node_monitor.h b/headers/build/os/drivers/node_monitor.h deleted file mode 100644 index 28620bc937..0000000000 --- a/headers/build/os/drivers/node_monitor.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Node monitor calls for kernel add-ons -** -** Distributed under the terms of the OpenBeOS License. -*/ - -#ifndef _DRIVERS_NODE_MONITOR_H -#define _DRIVERS_NODE_MONITOR_H - - -#include -#include - - -extern status_t stop_notifying(port_id port, uint32 token); -extern status_t start_watching(dev_t device, ino_t node, uint32 flags, - port_id port, uint32 token); -extern status_t stop_watching(dev_t device, ino_t node, uint32 flags, - port_id port, uint32 token); - -// ToDo: add simple message parsing convenience functionality - -#endif /* _DRIVERS_NODE_MONITOR_H */ diff --git a/headers/build/os/drivers/pnp_devfs.h b/headers/build/os/drivers/pnp_devfs.h deleted file mode 100644 index 5bca3def2e..0000000000 --- a/headers/build/os/drivers/pnp_devfs.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2002/03, Thomas Kurschel. All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - PnP devfs driver interface. - - The interface follows the normal pnp driver rules, i.e. - your driver creates a node for it and chooses PNP_DEVFS_MODULE_NAME - as the consumer, the type must be PNP_DEVFS_TYPE_NAME. The file - name is set via a PNP_DEVFS_FILENAME item. - - Loading and unloading of your driver is done via the pnp manager. - Hooks are similar to the original devfs interface, but the open - hook gets the driver cookie (as returned by init_device of the - driver) instead of a filename. -*/ - -#ifndef _PNP_DEVFS_H -#define _PNP_DEVFS_H - - -#include -#include - - -// changed open hook - gets cookie returned by init_device instead of name -typedef status_t (*pnp_device_open_hook)(void *device_cookie, uint32 flags, - void **handle_cookie); - -// new interface to devfs -typedef struct pnp_devfs_driver_info { - driver_module_info info; - - pnp_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 (can be NULL) - device_deselect_hook deselect; // stop select (can be NULL) - device_read_pages_hook read_pages; // scatter-gather read from the device (can be NULL) - device_write_pages_hook write_pages; // scatter-gather write to the device (can be NULL) -} pnp_devfs_driver_info; - - -// items: -// name under which the device should be published under /dev (required, string) -#define PNP_DEVFS_FILENAME "devfs/filename" - -#define PNP_DEVFS_MODULE_NAME "system/devfs/device_v1" - -#endif diff --git a/headers/build/os/drivers/usb/USB_audio.h b/headers/build/os/drivers/usb/USB_audio.h deleted file mode 100644 index 77a438433e..0000000000 --- a/headers/build/os/drivers/usb/USB_audio.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef USB_AUDIO_H -#define USB_AUDIO_H - -// (Partial) USB Class Definitions for Audio Devices, version 1.0 -// Reference: http://www.usb.org/developers/devclass_docs/audio10.pdf - -#include // for _PACKED definition - -#define USB_AUDIO_DEVICE_CLASS 0x01 -#define USB_AUDIO_CLASS_VERSION 0x0100 - -enum { - USB_AUDIO_INTERFACE_AUDIO_CLASS = 0x01 -}; - -enum { // Audio Interface Subclasses - USB_AUDIO_INTERFACE_AUDIOCONTROL_SUBCLASS = 0x01, // - USB_AUDIO_INTERFACE_AUDIOSTREAMING_SUBCLASS, // - USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS // -}; - -enum { // Audio Class-Specific AudioControl Interface descriptor subtypes - USB_AUDIO_AC_HEADER = 0x01, - USB_AUDIO_AC_INPUT_TERMINAL, - USB_AUDIO_AC_OUTPUT_TERMINAL, - USB_AUDIO_AC_MIXER_UNIT, - USB_AUDIO_AC_SELECTOR_UNIT, - USB_AUDIO_AC_FEATURE_UNIT, - USB_AUDIO_AC_PROCESSING_UNIT, - USB_AUDIO_AC_EXTENSION_UNIT -}; - -enum { // Audio Class-Specific AudioStreaming Interface descriptor subtypes - USB_AUDIO_AS_GENERAL = 0x01, - USB_AUDIO_AS_FORMAT_TYPE, - USB_AUDIO_AS_FORMAT_SPECIFIC -}; - -enum { // Processing Unit Process Types (for USB_AUDIO_AC_PROCESSING_UNIT) - USB_AUDIO_UPDOWNMIX_PROCESS = 0x01, - USB_AUDIO_DOLBY_PROLOGIC_PROCESS, - USB_AUDIO_3D_STEREO_EXTENDER_PROCESS, - USB_AUDIO_REVERBERATION_PROCESS, - USB_AUDIO_CHORUS_PROCESS, - USB_AUDIO_DYN_RANGE_COMP_PROCESS -}; - -// AudioControl request codes -#define USB_AUDIO_SET_CURRENT 0x01 -#define USB_AUDIO_GET_CURRENT 0x81 -#define USB_AUDIO_SET_MIN 0x02 -#define USB_AUDIO_GET_MIN 0x82 -#define USB_AUDIO_SET_MAX 0x03 -#define USB_AUDIO_GET_MAX 0x83 -#define USB_AUDIO_SET_RES 0x04 -#define USB_AUDIO_GET_RES 0x84 -#define USB_AUDIO_SET_MEM 0x05 -#define USB_AUDIO_GET_MEM 0x85 -#define USB_AUDIO_GET_STATUS 0xFF - -enum { // Terminal Control Selectors - USB_AUDIO_COPY_PROTECT_CONTROL = 0x01 -}; - -/* A.10.2 Feature Unit Control Selectors */ -#define AC_FU_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_MUTE_CONTROL 0x01 -#define USB_AUDIO_VOLUME_CONTROL 0x02 -#define USB_AUDIO_BASS_CONTROL 0x03 -#define USB_AUDIO_MID_CONTROL 0x04 -#define USB_AUDIO_TREBLE_CONTROL 0x05 -#define USB_AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06 -#define USB_AUDIO_AUTOMATIC_GAIN_CONTROL 0x07 -#define USB_AUDIO_DELAY_CONTROL 0x08 -#define USB_AUDIO_BASS_BOOST_CONTROL 0x09 -#define USB_AUDIO_LOUDNESS_CONTROL 0x0A - -/* A.10.3.1 Up/Down-mix Processing Unit Control Selectors */ -#define USB_AUDIO_UD_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_UD_ENABLED_CONTROL 0x01 -#define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02 - -/* A.10.3.2 Dolby Prologic(tm) Processing Unit Control Selectors */ -#define USB_AUDIO_DP_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_DP_ENABLE_CONTROL 0x01 -#define USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02 - -/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */ -#define USB_AUDIO_3D_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_3D_ENABLED_CONTROL 0x01 -#define USB_AUDIO_3D_SPACIOUSNESS_CONTROL 0x03 - -/* A.10.3.4 Reverberation Processing Unit Control Selectors */ -#define USB_AUDIO_RV_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_RV_ENABLE_CONTROL 0x01 -#define USB_AUDIO_RV_REVERB_LEVEL_CONTROL 0x02 -#define USB_AUDIO_RV_REVERB_TIME_CONTROL 0x03 -#define USB_AUDIO_RV_REVERB_FEEDBACK_CONTROL 0x04 - -/* A.10.3.5 Chorus Processing Unit Control Selectors */ -#define USB_AUDIO_CH_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_CH_ENABLE_CONTROL 0x01 -#define USB_AUDIO_CHORUS_LEVEL_CONTROL 0x02 -#define USB_AUDIO_CHORUS_RATE_CONTROL 0x03 -#define USB_AUDIO_CHORUS_DETH_CONTROL 0x04 - -/* A.10.3.6 Dynamic Range Compressor Processing Unit Control Selectors */ -#define USB_AUDIO_DR_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_DR_ENABLE_CONTROL 0x01 -#define USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02 -#define USB_AUDIO_MAXAMPL_CONTROL 0x03 -#define USB_AUDIO_THRESHOLD_CONTROL 0x04 -#define USB_AUDIO_ATTACK_TIME 0x05 -#define USB_AUDIO_RELEASE_TIME 0x06 - -/* A.10.4 Extension Unit Control Selectors */ -#define USB_AUDIO_XU_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_XU_ENABLE_CONTROL 0x01 - -/* A.10.5 Endpoint Control Selectors */ -#define USB_AUDIO_EP_CONTROL_UNDEFINED 0x00 -#define USB_AUDIO_SAMPLING_FREQ_CONTROL 0x01 -#define USB_AUDIO_PITCH_CONTROL 0x02 - -typedef struct { - uint8 length; - uint8 type; - uint8 subtype; - uint8 format_type; - uint8 num_channels; - uint8 subframe_size; - uint8 bit_resolution; - uint8 sample_freq_type; - uint8 sample_freq[3]; // [0] + [1] << 8 + [2] << 16 - // if sample_freq_type != 1, - // (sample_freq_type - 1) x uint8 sample_freq[3] follows... -} _PACKED usb_audio_format_type_descriptor; - -#define USB_AUDIO_FORMAT_TYPE_UNDEFINED 0x00 -#define USB_AUDIO_FORMAT_TYPE_I 0x01 -#define USB_AUDIO_FORMAT_TYPE_II 0x02 -#define USB_AUDIO_FORMAT_TYPE_III 0x03 - -#endif // USB_AUDIO_H diff --git a/headers/build/os/drivers/usb/USB_cdc.h b/headers/build/os/drivers/usb/USB_cdc.h deleted file mode 100644 index 680de24dac..0000000000 --- a/headers/build/os/drivers/usb/USB_cdc.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef USB_CDC_H -#define USB_CDC_H - -// (Partial) USB Class Definitions for Communication Devices (CDC), version 1.1 -// Reference: http://www.usb.org/developers/devclass_docs/usbcdc11.pdf - -#define USB_COMMUNICATION_DEVICE_CLASS 0x02 - -#define USB_CDC_COMMUNICATION_INTERFACE_CLASS 0x02 -#define USB_CDC_CLASS_VERSION 0x0101 - -enum { // Communication Interface Subclasses - USB_CDC_COMMUNICATION_INTERFACE_DLCM_SUBCLASS = 0x01, // Direct Line Control Model - USB_CDC_COMMUNICATION_INTERFACE_ACM_SUBCLASS, // Abstract Control Model - USB_CDC_COMMUNICATION_INTERFACE_TCM_SUBCLASS, // Telephone Control Model - USB_CDC_COMMUNICATION_INTERFACE_MCCM_SUBCLASS, // Multi-Channel Control Model - USB_CDC_COMMUNICATION_INTERFACE_CAPICM_SUBCLASS, // CAPI Control Model - USB_CDC_COMMUNICATION_INTERFACE_ENCM_SUBCLASS, // Ethernet Networking Control Model - USB_CDC_COMMUNICATION_INTERFACE_ATMNCM_SUBCLASS // ATM Networking Control Model -}; - -enum { // Communication Interface Class Control Protocols - USB_CDC_COMMUNICATION_INTERFACE_NONE_PROTOCOL = 0x00, // No class specific protocol required - USB_CDC_COMMUNICATION_INTERFACE_V25TER_PROTOCOL = 0x01, // Common AT commands (also knowns as "Hayes compatible") - USB_CDC_COMMUNICATION_INTERFACE_SPECIFIC_PROTOCOL = 0xff // Vendor-specific protocol -}; - -#define USB_CDC_DATA_INTERFACE_CLASS 0x0a - -enum { // Management Element Requests (p62) - USB_CDC_SEND_ENCAPSULATED_COMMAND = 0x00, - USB_CDC_GET_ENCAPSULATED_RESPONSE, - USB_CDC_SET_COMM_FEATURE, - USB_CDC_GET_COMM_FEATURE, - USB_CDC_CLEAR_COMM_FEATURE, - // 0x05 -> 0x0F: reserved for future use - USB_CDC_SET_AUX_LINE_STATE = 0x10, - USB_CDC_SET_HOOK_STATE, - USB_CDC_PULSE_SETUP, - USB_CDC_SEND_PULSE, - USB_CDC_SET_PULSE_TIME, - USB_CDC_RING_AUX_JACK, - // 0x16 -> 0x1F: reserved for future use - USB_CDC_SET_LINE_CODING = 0x20, - USB_CDC_GET_LINE_CODING, - USB_CDC_SET_CONTROL_LINE_STATE, - USB_CDC_SEND_BREAK, - // 0x24 -> 0x2F: reserved for future use - USB_CDC_SET_RINGER_PARMS = 0x30, - USB_CDC_GET_RINGER_PARMS, - USB_CDC_SET_OPERATION_PARMS, - USB_CDC_GET_OPERATION_PARMS, - USB_CDC_SET_LINE_PARMS, - USB_CDC_GET_LINE_PARMS, - USB_CDC_DIAL_DIGITS, - USB_CDC_SET_UNIT_PARAMETER, - USB_CDC_GET_UNIT_PARAMETER, - USB_CDC_CLEAR_UNIT_PARAMETER, - USB_CDC_GET_PROFILE, - // 0x3B -> 0x3F: reserved for future use - USB_CDC_SET_ETHERNET_MULTICAST_FILTERS = 0x40, - USB_CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER, - USB_CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER, - USB_CDC_SET_ETHERNET_PACKET_FILTER, - USB_CDC_GET_ETHERNET_STATISTIC, - // 0x45 -> 0x4F: reserved for future use - USB_CDC_SET_ATM_DATA_FORMAT = 0x50, - USB_CDC_GET_ATM_DEVICE_STATISTICS, - USB_CDC_SET_ATM_DEFAULT_VC, - USB_CDC_GET_ATM_VC_STATISTICS - // 0x54 -> 0xFF: reserved for future use -}; - -enum { // Feature Selector (for USB_CDC_SET/GET/CLEAR_COMM_FEATURE (p65-66)) - USB_CDC_ABSTRACT_STATE = 0x01, - USB_CDC_COUNTRY_SETTING = 0x02 -}; - -enum { // ABSTRACT_STATE bitmap (for USB_CDC_ABSTRAT_STATE Feature Selector (p66)) - USB_CDC_ABSTRACT_STATE_IDLE = 0x01, - USB_CDC_ABSTRACT_STATE_DATA_MULTIPLEXED = 0x02 -}; - -typedef struct { // Line Coding Structure (for USB_CDC_SET/GET_LINE_CODING (p69)) - uint32 speed; - uint8 stopbits; - uint8 parity; - uint8 databits; -} _PACKED usb_cdc_line_coding; - -enum { // CDC stopbits values (for Line Coding Structure stopbits field) - USB_CDC_1_STOPBIT = 0, - USB_CDC_1_5_STOPBITS, - USB_CDC_2_STOPBITS -}; - -enum { // CDC parity values (for Line Coding Structure parity field) - USB_CDC_NO_PARITY = 0, - USB_CDC_ODD_PARITY, - USB_CDC_EVEN_PARITY, - USB_CDC_MARK_PARITY, - USB_CDC_SPACE_PARITY -}; - -enum { // CDC Control Signal bitmap (for CDC_SET_CONTROL_LINE_STATE request) - USB_CDC_CONTROL_SIGNAL_STATE_DTR = 0x01, - USB_CDC_CONTROL_SIGNAL_STATE_RTS = 0x02 -}; - -enum { // Notification Elements notifications (p84) - USB_CDC_NETWORK_CONNECTION = 0x00, - USB_CDC_RESPONSE_AVAILABLE, - // 0x02 -> 0x07: reserved for future use - USB_CDC_AUX_JACK_HOOK_STATE = 0x08, - USB_CDC_RING_DETECT, - // 0x0a -> 0x1f: reserved for future use - USB_CDC_SERIAL_STATE = 0x20, - // 0x21 -> 0x27: reserved for future use - USB_CDC_CALL_STATE_CHANGE = 0x28, - USB_CDC_LINE_STATE_CHANGE, - USB_CDC_CONNECTION_SPEED_CHANGE - // 0x2b -> 0xff: reserved for future use -}; - -enum { // CDC UART State bitmap (for USB_CDC_SERIAL_STATE notification) - USB_CDC_UART_STATE_DCD = 0x01, - USB_CDC_UART_STATE_DSR = 0x02, - USB_CDC_UART_STATE_BREAK = 0x04, - USB_CDC_UART_STATE_RING = 0x08, - USB_CDC_UART_STATE_FRAMING_ERROR = 0x10, - USB_CDC_UART_STATE_PARITY_ERROR = 0x20, - USB_CDC_UART_STATE_OVERRUN_ERROR = 0x40 -}; - -#endif // USB_CDC_H - diff --git a/headers/build/os/drivers/usb/USB_hid.h b/headers/build/os/drivers/usb/USB_hid.h deleted file mode 100644 index b4cc621775..0000000000 --- a/headers/build/os/drivers/usb/USB_hid.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef USB_HID_H -#define USB_HID_H - -// (Partial) USB Class Definitions for HID Devices, version 1.11 -// Reference: http://www.usb.org/developers/devclass_docs/hid1_11.pdf - -#define USB_HID_DEVICE_CLASS 0x03 -#define USB_HID_CLASS_VERSION 0x0100 - -enum { // HID Interface Subclasses - USB_HID_INTERFACE_NO_SUBCLASS = 0x00, // No Subclass - USB_HID_INTERFACE_BOOT_SUBCLASS // Boot Interface Subclass -}; - -enum { // HID Class-Specific descriptor subtypes - USB_HID_DESCRIPTOR_HID = 0x21, - USB_HID_DESCRIPTOR_REPORT, - USB_HID_DESCRIPTOR_PHYSICAL -}; - -enum { // HID Class-specific requests - USB_REQUEST_HID_GET_REPORT = 0x01, - USB_REQUEST_HID_GET_IDLE, - USB_REQUEST_HID_GET_PROTOCOL, - - USB_REQUEST_HID_SET_REPORT = 0x09, - USB_REQUEST_HID_SET_IDLE, - USB_REQUEST_HID_SET_PROTOCOL -}; - -typedef struct -{ - uint8 length; - uint8 descriptor_type; - uint16 hid_version; - uint8 country_code; - uint8 num_descriptors; - struct - { - uint8 descriptor_type; - uint16 descriptor_length; - } _PACKED descriptor_info [1]; -} _PACKED usb_hid_descriptor; - - -/* - Usage Pages/IDs -*/ - -enum -{ - USAGE_PAGE_GENERIC_DESKTOP = 0x1, - USAGE_PAGE_SIMULATION, - USAGE_PAGE_VR, - USAGE_PAGE_SPORT, - USAGE_PAGE_GAME, - USAGE_PAGE_GENERIC, - USAGE_PAGE_KEYBOARD, - USAGE_PAGE_LED, - USAGE_PAGE_BUTTON, - USAGE_PAGE_ORDINAL, - USAGE_PAGE_TELEPHONY, - USAGE_PAGE_CONSUMER, - USAGE_PAGE_DIGITIZER, - USAGE_PAGE_PID = 0xf, - USAGE_PAGE_UNICODE, - USAGE_PAGE_ALPHANUM_DISPLAY = 0x14, - USAGE_PAGE_MEDICAL = 0x40 -}; - -/* Page 1: Generic Desktop */ - -enum -{ - USAGE_ID_POINTER = 0x1, - USAGE_ID_MOUSE, - USAGE_ID_JOYSTICK = 0x4, - USAGE_ID_GAMEPAD, - USAGE_ID_KEYBOARD, - USAGE_ID_KEYPAD, - USAGE_ID_MULTIAXIS = 0x8, - - USAGE_ID_X = 0x30, - USAGE_ID_Y, - USAGE_ID_Z, - USAGE_ID_RX, - USAGE_ID_RY, - USAGE_ID_RZ, - USAGE_ID_SLIDER, - USAGE_ID_DIAL, - USAGE_ID_WHEEL, - USAGE_ID_HAT_SWITCH, - USAGE_ID_COUNTED_BUFFER, - USAGE_ID_BYTE_COUNT, - USAGE_ID_MOTION_WAKEUP, - USAGE_ID_START, - USAGE_ID_SELECT, - USAGE_ID_VX = 0x40, - USAGE_ID_VY, - USAGE_ID_VZ, - USAGE_ID_VBRX, - USAGE_ID_VBRY, - USAGE_ID_VBRZ, - USAGE_ID_VNO, - USAGE_ID_FEATURE_NOTIFICATION -}; - -/* Page 2: Simulation */ - -enum -{ - USAGE_ID_RUDDER = 0xBA, - USAGE_ID_THROTTLE = 0xBB, -}; - -#endif // USB_HID_H diff --git a/headers/build/os/drivers/usb/USB_langIDs.h b/headers/build/os/drivers/usb/USB_langIDs.h deleted file mode 100644 index fc0672f5d8..0000000000 --- a/headers/build/os/drivers/usb/USB_langIDs.h +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef USB_LANGIDS_H -#define USB_LANGIDS_H - -// USB Language Identifiers, 3/29/2000, version 1.0 -// Reference: http://www.usb.org/developers/docs/USB_LANGIDs.pdf - -#define USB_LANGIDS_VERSION 0x0100 // version 1.0 - -// descriptor string index 0 = supported LANGIDs array -#define USB_LANGIDS_STRING_INDEX (0) - -#define USB_PRIMARY_LANGID_MASK (0x003F) // 9 to 0 bits -#define USB_SUB_LANGID_MASK (0xFC00) // 15 to 10 bits - -#define USB_PRIMARY_LANGID(id) (id & USB_PRIMARY_LANGID_MASK) -#define USB_SUB_LANGID(id) ((id & USB_SUB_LANGID_MASK) >> 10) - -enum { - USB_LANGID_AFRIKAANS = 0x0436, // Afrikaans - USB_LANGID_ALBANIAN = 0x041c, // Albanian - USB_LANGID_ARABIC_SAUDI_ARABIA = 0x0401, // Arabic (Saudi Arabia) - USB_LANGID_ARABIC_IRAK = 0x0801, // Arabic (Irak) - USB_LANGID_ARABIC_EGYPT = 0x0c01, // Arabic (Egypt) - USB_LANGID_ARABIC_LYBYA = 0x1001, // Arabic (Libya) - USB_LANGID_ARABIC_ALGERIA = 0x1401, // Arabic (Algeria) - USB_LANGID_ARABIC_MOROCCO = 0x1801, // Arabic (Morocco) - USB_LANGID_ARABIC_TUNISIA = 0x1c01, // Arabic (Tunisia) - USB_LANGID_ARABIC_OMAN = 0x2001, // Arabic (Oman) - USB_LANGID_ARABIC_YEMEN = 0x2401, // Arabic (Yemen) - USB_LANGID_ARABIC_SYRIA = 0x2801, // Arabic (Syria) - USB_LANGID_ARABIC_JORDAN = 0x2c01, // Arabic (Jordan) - USB_LANGID_ARABIC_LEBANON = 0x3001, // Arabic (Lebanon) - USB_LANGID_ARABIC_KUWAIT = 0x3401, // Arabic (Kuwait) - USB_LANGID_ARABIC_UAE = 0x3801, // Arabic (U.A.E.) - USB_LANGID_ARABIC_BAHRAIN = 0x3c01, // Arabic (Bahrain) - USB_LANGID_ARABIC_QATAR = 0x4001, // Arabic (Qatar) - USB_LANGID_ARMENIAN = 0x042b, // Armenian - USB_LANGID_ASSAMESE = 0x044d, // Assamese - USB_LANGID_AZERI_LATIN = 0x042c, // Azeri (Latin) - USB_LANGID_AZERI_CYRILLIC = 0x082c, // Azeri (Cyrillic) - USB_LANGID_BASQUE = 0x042d, // Basque - USB_LANGID_BELARUSSIAN = 0x0423, // Belarussian - USB_LANGID_BENGALI = 0x0445, // Bengali - USB_LANGID_BULGARIAN = 0x0402, // Bulgarian - USB_LANGID_BURMESE = 0x0455, // Burmese - USB_LANGID_CATALAN = 0x0403, // Catalan - USB_LANGID_CHINESE_TAIWAN = 0x0404, // Chinese (Taiwan) - USB_LANGID_CHINESE_PRC = 0x0804, // Chinese (PRC = People Republic of Chinese) - USB_LANGID_CHINESE_HONG_KONG = 0x0c04, // Chinese (Hong Kong) - USB_LANGID_CHINESE_SINGAPORE = 0x1004, // Chinese (Singapore) - USB_LANGID_CHINESE_MACAU_SAR = 0x1404, // Chinese (Macau SAR) - USB_LANGID_CROATIAN = 0x041a, // Croatian - USB_LANGID_CZECH = 0x0405, // Czech - USB_LANGID_DANISH = 0x0406, // Danish - USB_LANGID_DUTCH_NETHERLANDS = 0x0413, // Dutch (Netherlands) - USB_LANGID_DUTCH_BELGIUM = 0x0813, // Dutch (Belgium) - USB_LANGID_ENGLISH_UNITED_STATES = 0x0409, // English (United States) - USB_LANGID_ENGLISH_UNITED_KINGDOM = 0x0809, // English (United Kingdom) - USB_LANGID_ENGLISH_AUSTRALIAN = 0x0c09, // English (Australian) - USB_LANGID_ENGLISH_CANADIAN = 0x1009, // English (Canadian) - USB_LANGID_ENGLISH_NEW_ZEALAND = 0x1409, // English (New Zealand) - USB_LANGID_ENGLISH_IRELAND = 0x1809, // English (Ireland) - USB_LANGID_ENGLISH_SOUTH_AFRICA = 0x1c09, // English (South Africa) - USB_LANGID_ENGLISH_JAMAICA = 0x2009, // English (Jamaica) - USB_LANGID_ENGLISH_CARIBBEAN = 0x2409, // English (Caribbean) - USB_LANGID_ENGLISH_BELIZE = 0x2809, // English (Belize) - USB_LANGID_ENGLISH_TRINIDAD = 0x2c09, // English (Trinidad) - USB_LANGID_ENGLISH_ZIMBABWE = 0x3009, // English (Zimbabwe) - USB_LANGID_ENGLISH_PHLIPPINES = 0x3409, // English (Philippines) - USB_LANGID_ESTONIAN = 0x0425, // Estonian - USB_LANGID_FAEROESE = 0x0438, // Faeroese - USB_LANGID_FARSI = 0x0429, // Farsi - USB_LANGID_FINNISH = 0x040b, // Finnish - USB_LANGID_FRENCH_STANDARD = 0x040c, // French (Standard) - USB_LANGID_FRENCH_BELGIAN = 0x080c, // French (Belgian) - USB_LANGID_FRENCH_CANADIAN = 0x0c0c, // French (Canadian) - USB_LANGID_FRENCH_SWITZERLAND = 0x100c, // French (Switzerland) - USB_LANGID_FRENCH_LUXEMBOURG = 0x140c, // French (Luxembourg) - USB_LANGID_FRENCH_MONACO = 0x180c, // French (Monaco) - USB_LANGID_GEORGIAN = 0x0437, // Georgian - USB_LANGID_GERMAN_STANDARD = 0x0407, // German (Standard) - USB_LANGID_GERMAN_SWITZERLAND = 0x0807, // German (Switzerland) - USB_LANGID_GERMAN_AUSTRIA = 0x0c07, // German (Austria) - USB_LANGID_GERMAN_LUXEMBOURG = 0x1007, // German (Luxembourg) - USB_LANGID_GERMAN_LIECHTENSTEIN = 0x1407, // German (Liechtenstein) - USB_LANGID_GREEK = 0x0408, // Greek - USB_LANGID_GUJARATI = 0x0447, // Gujarati - USB_LANGID_HEBREW = 0x040d, // Hebrew - USB_LANGID_HINDI = 0x0439, // Hindi - USB_LANGID_HUNGARIAN = 0x040e, // Hungarian - USB_LANGID_ICELANDIC = 0x040f, // Icelandic - USB_LANGID_INDONESIAN = 0x0421, // Indonesian - USB_LANGID_ITALIAN_STANDARD = 0x0410, // Italian (Standard) - USB_LANGID_ITALIAN_SWITZERLAND = 0x0810, // Italian (Switzerland) - USB_LANGID_JAPANESE = 0x0411, // Japanese - USB_LANGID_KANNADA = 0x044b, // Kannada - USB_LANGID_KASHMIRI_INDIA = 0x0860, // Kashmiri (India) - USB_LANGID_KAZAKH = 0x043f, // Kazakh - USB_LANGID_KONKANI = 0x0457, // Konkani - USB_LANGID_KOREAN_JOHAB = 0x0412, // Korean (Johab) - USB_LANGID_LATVIAN = 0x0426, // Latvian - USB_LANGID_LITHUANIAN = 0x0427, // Lithuanian - USB_LANGID_LITHUANIAN_CLASSIC = 0x0827, // Lithuanian (Classic) - USB_LANGID_MACEDONIAN = 0x042f, // Macedonian - USB_LANGID_MALAY_MALAYSIAN = 0x043e, // Malay (Malaysian) - USB_LANGID_MALAY_BRUNEI_DARUSSALAM = 0x083e, // Malay (Brunei Darussalam) - USB_LANGID_MALAYALAM = 0x044c, // Malayalam - USB_LANGID_MANIPURI = 0x0458, // Manipuri - USB_LANGID_MARATHI = 0x044e, // Marathi - USB_LANGID_NEPALI_INDIA = 0x0861, // Nepali (India) - USB_LANGID_NORWEGIAN_BOKMAL = 0x0414, // Norwegian (Bokmal) - USB_LANGID_NORWEGIAN_NYNORSK = 0x0814, // Norwegian (Nynorsk) - USB_LANGID_ORIYA = 0x0448, // Oriya - USB_LANGID_POLISH = 0x0415, // Polish - USB_LANGID_PORTUGUESE_BRAZIL = 0x0416, // Portuguese (Brazil) - USB_LANGID_PORTUGUESE_STANDARD = 0x0816, // Portuguese (Standard) - USB_LANGID_PUNJABI = 0x0446, // Punjabi - USB_LANGID_ROMANIAN = 0x0418, // Romanian - USB_LANGID_RUSSIAN = 0x0419, // Russian - USB_LANGID_SANSKRIT = 0x044f, // Sanskrit - USB_LANGID_SERBIAN_CYRILLIC = 0x0c1a, // Serbian (Cyrillic) - USB_LANGID_SERBIAN_LATIN = 0x081a, // Serbian (Latin) - USB_LANGID_SINDHI = 0x0459, // Sindhi - USB_LANGID_SLOVAK = 0x041b, // Slovak - USB_LANGID_SLOVENIAN = 0x0424, // Slovenian - USB_LANGID_SPANNISH_TRADITIONAL_SORT= 0x040a, // Spannish (Traditional Sort) - USB_LANGID_SPANNISH_MEXICAN = 0x080a, // Spannish (Mexican) - USB_LANGID_SPANNISH_MODERN_SORT = 0x0c0a, // Spannish (Modern Sort) - USB_LANGID_SPANNISH_GUATEMALA = 0x100a, // Spannish (Guatemala) - USB_LANGID_SPANNISH_COSTA_RICA = 0x140a, // Spannish (Costa Rica) - USB_LANGID_SPANNISH_PANAMA = 0x180a, // Spannish (Panama) - USB_LANGID_SPANNISH_DOMINICAN_REPUBLIC = 0x1c0a, // Spannish (Dominican Republic) - USB_LANGID_SPANNISH_VENEZUELA = 0x200a, // Spannish (Venezuela) - USB_LANGID_SPANNISH_COLOMBIA = 0x240a, // Spannish (Colombia) - USB_LANGID_SPANNISH_PERU = 0x280a, // Spannish (Peru) - USB_LANGID_SPANNISH_ARGENTINA = 0x2c0a, // Spannish (Argentina) - USB_LANGID_SPANNISH_ECUADOR = 0x300a, // Spannish (Ecuador) - USB_LANGID_SPANNISH_CHILE = 0x340a, // Spannish (Chile) - USB_LANGID_SPANNISH_URUGUAY = 0x380a, // Spannish (Uruguay) - USB_LANGID_SPANNISH_PARAGUAY = 0x3c0a, // Spannish (Paraguay) - USB_LANGID_SPANNISH_BOLIVIA = 0x400a, // Spannish (Bolivia) - USB_LANGID_SPANNISH_EL_SALVADOR = 0x440a, // Spannish (El Salvador) - USB_LANGID_SPANNISH_HONDURAS = 0x480a, // Spannish (Honduras) - USB_LANGID_SPANNISH_NICARAGUA = 0x4c0a, // Spannish (Nicaragua) - USB_LANGID_SPANNISH_PUERTO_RICO = 0x500a, // Spannish (Puerto Rico) - USB_LANGID_SUTU = 0x0430, // Sutu - USB_LANGID_SWAHILI_KENYA = 0x0441, // Swahili (Kenya) - USB_LANGID_SWEDISH = 0x041d, // Swedish - USB_LANGID_SWEDISH_FINLAND = 0x081d, // Swedish (Finland) - USB_LANGID_TAMIL = 0x0449, // Tamil - USB_LANGID_TATAR_TATARSTAN = 0x0444, // Tatar (Tatarstan) - USB_LANGID_TELUGU = 0x044a, // Telugu - USB_LANGID_THAI = 0x041e, // Thai - USB_LANGID_TURKISH = 0x041f, // Turkish - USB_LANGID_UKRAINIAN = 0x0422, // Ukrainian - USB_LANGID_URDU_PAKISTAN = 0x0420, // Urdu (Pakistan) - USB_LANGID_URDU_INDIA = 0x0820, // Urdu (India) - USB_LANGID_UZBEK_LATIN = 0x0443, // Uzbek (Latin) - USB_LANGID_UZBEK_CYRILLIC = 0x0843, // Uzbek (Cyrillic) - USB_LANGID_VIETNAMESE = 0x042a, // Vietnamese - - USB_LANGID_HID_UDD = 0x04ff, // HID (Usage Data Descriptor) - USB_LANGID_HID1 = 0xf0ff, // HID (Vendor Defined 1) - USB_LANGID_HID2 = 0xf4ff, // HID (Vendor Defined 2) - USB_LANGID_HID3 = 0xf8ff, // HID (Vendor Defined 3) - USB_LANGID_HID4 = 0xfcff, // HID (Vendor Defined 4) - - USB_LANGID_INVALID = 0x0000 // Invalid LANG ID -}; - -#endif // USB_LANGIDS_H - - diff --git a/headers/build/os/drivers/usb/USB_midi.h b/headers/build/os/drivers/usb/USB_midi.h deleted file mode 100644 index 5f2bbab4f1..0000000000 --- a/headers/build/os/drivers/usb/USB_midi.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef USB_MIDI_H -#define USB_MIDI_H - -#include "USB_audio.h" - -// (Partial) USB Class Definitions for MIDI Devices, version 1.0 -// Reference: http://www.usb.org/developers/devclass_docs/midi10.pdf - -#define USB_MIDI_CLASS_VERSION 0x0100 // Class specification version 1.0 - -// USB MIDI Event Packet - -// ... as clean structure: -typedef struct { // USB MIDI Event Packet - uint8 cin:4; // Code Index Number - uint8 cn:4; // Cable Number - uint8 midi[3]; -} _PACKED usb_midi_event_packet; - -#endif // USB_MIDI_H diff --git a/headers/build/os/interface/Screen.h b/headers/build/os/interface/Screen.h deleted file mode 100644 index 87662d9ad6..0000000000 --- a/headers/build/os/interface/Screen.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _SCREEN_H -#define _SCREEN_H - - -#include -#include -#include -#include - - -class BBitmap; -class BWindow; - -namespace BPrivate { - class BPrivateScreen; -} - -class BScreen { - public: - BScreen(screen_id id = B_MAIN_SCREEN_ID); - BScreen(BWindow* window); - ~BScreen(); - - bool IsValid(); - status_t SetToNext(); - - color_space ColorSpace(); - BRect Frame(); - screen_id ID(); - - status_t WaitForRetrace(); - status_t WaitForRetrace(bigtime_t timeout); - - uint8 IndexForColor(rgb_color color); - uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, - uint8 alpha = 255); - rgb_color ColorForIndex(uint8 index); - uint8 InvertIndex(uint8 index); - - const color_map* ColorMap(); - - status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true, - BRect* frame = NULL); - status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true, - BRect* frame = NULL); - - rgb_color DesktopColor(); - rgb_color DesktopColor(uint32 index); - void SetDesktopColor(rgb_color color, bool makeDefault = true); - void SetDesktopColor(rgb_color color, uint32 index, - bool makeDefault = true); - - status_t ProposeMode(display_mode* target, const display_mode* low, - const display_mode* high); - status_t GetModeList(display_mode** _modeList, uint32* _count); - status_t GetMode(display_mode* mode); - status_t GetMode(uint32 workspace, display_mode* mode); - status_t SetMode(display_mode* mode, bool makeDefault = false); - status_t SetMode(uint32 workspace, display_mode* mode, - bool makeDefault = false); - status_t GetDeviceInfo(accelerant_device_info* info); - status_t GetMonitorInfo(monitor_info* info); - status_t GetPixelClockLimits(display_mode* mode, uint32* low, - uint32* high); - status_t GetTimingConstraints( - display_timing_constraints* timingConstraints); - status_t SetDPMS(uint32 state); - uint32 DPMSState(); - uint32 DPMSCapabilites(); - - private: - BScreen& operator=(const BScreen& other); - BScreen(const BScreen& other); - - // old and deprecated methods - should be faded out - BPrivate::BPrivateScreen* private_screen(); - status_t ProposeDisplayMode(display_mode* target, - const display_mode* low, const display_mode* high); - void* BaseAddress(); - uint32 BytesPerRow(); - - BPrivate::BPrivateScreen* fScreen; -}; - - -inline uint8 -BScreen::IndexForColor(rgb_color color) -{ - return IndexForColor(color.red, color.green, color.blue, color.alpha); -} - -#endif // _SCREEN_H diff --git a/headers/build/os/kernel/debugger.h b/headers/build/os/kernel/debugger.h deleted file mode 100644 index d2a96841e2..0000000000 --- a/headers/build/os/kernel/debugger.h +++ /dev/null @@ -1,526 +0,0 @@ -/* - * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. - * Distributed under the terms of the MIT License. - */ -#ifndef _DEBUGGER_H -#define _DEBUGGER_H - -#include - -#include -#include - -// include architecture specific definitions -#ifdef __INTEL__ - #include -#elif __POWERPC__ - #include -#endif - -typedef struct debug_cpu_state debug_cpu_state; - -#ifdef __cplusplus -extern "C" { -#endif - -extern status_t install_default_debugger(port_id debuggerPort); -extern port_id install_team_debugger(team_id team, port_id debuggerPort); -extern status_t remove_team_debugger(team_id team); -extern status_t debug_thread(thread_id thread); -extern void wait_for_debugger(void); - -// team debugging flags -enum { - // event mask: If a flag is set, any of the team's threads will stop when - // the respective event occurs. All flags are enabled by default. Always - // enabled are debugger() calls and hardware exceptions, as well as the - // deletion of the debugged team. - B_TEAM_DEBUG_SIGNALS = 0x00010000, - B_TEAM_DEBUG_PRE_SYSCALL = 0x00020000, - B_TEAM_DEBUG_POST_SYSCALL = 0x00040000, - B_TEAM_DEBUG_TEAM_CREATION = 0x00080000, - B_TEAM_DEBUG_THREADS = 0x00100000, - B_TEAM_DEBUG_IMAGES = 0x00200000, - - // new thread handling - B_TEAM_DEBUG_STOP_NEW_THREADS = 0x01000000, - - B_TEAM_DEBUG_USER_FLAG_MASK = 0xffff0000, -}; - -// per-thread debugging flags -enum { - // event mask: If a flag is set, the thread will stop when the respective - // event occurs. If there is a corresponding team flag, it is sufficient, - // if either is set. Per default none of the flags is set. - B_THREAD_DEBUG_PRE_SYSCALL = 0x00010000, - B_THREAD_DEBUG_POST_SYSCALL = 0x00020000, - - // child thread handling - B_THREAD_DEBUG_STOP_CHILD_THREADS = 0x00100000, - B_THREAD_DEBUG_SYSCALL_TRACE_CHILD_THREADS = 0x00200000, - - B_THREAD_DEBUG_USER_FLAG_MASK = 0xffff0000, -}; - -// in case of a B_EXCEPTION_OCCURRED event: the type of the exception -typedef enum { - B_NON_MASKABLE_INTERRUPT = 0, - B_MACHINE_CHECK_EXCEPTION, - B_SEGMENT_VIOLATION, - B_ALIGNMENT_EXCEPTION, - B_DIVIDE_ERROR, - B_OVERFLOW_EXCEPTION, - B_BOUNDS_CHECK_EXCEPTION, - B_INVALID_OPCODE_EXCEPTION, - B_SEGMENT_NOT_PRESENT, - B_STACK_FAULT, - B_GENERAL_PROTECTION_FAULT, - B_FLOATING_POINT_EXCEPTION, -} debug_exception_type; - -// Value indicating how a stopped thread shall continue. -enum { - B_THREAD_DEBUG_HANDLE_EVENT = 0, // handle the event normally - // (e.g. a signal is delivered, a - // CPU fault kills the team,...) - B_THREAD_DEBUG_IGNORE_EVENT, // ignore the event and continue as if - // it didn't occur (e.g. a signal or - // a CPU fault will be ignored) -}; - -// watchpoint types (ToDo: Check PPC support.) -enum { - B_DATA_READ_WATCHPOINT = 0, // !x86 - B_DATA_WRITE_WATCHPOINT, - B_DATA_READ_WRITE_WATCHPOINT, -}; - -// how to apply signal ignore masks -typedef enum { - B_DEBUG_SIGNAL_MASK_AND = 0, - B_DEBUG_SIGNAL_MASK_OR, - B_DEBUG_SIGNAL_MASK_SET, -} debug_signal_mask_op; - -#define B_DEBUG_SIGNAL_TO_MASK(signal) (1ULL << ((signal) - 1)) - -// maximal number of bytes to read/write via B_DEBUG_MESSAGE_{READ,WRITE]_MEMORY -enum { - B_MAX_READ_WRITE_MEMORY_SIZE = 1024, -}; - -// messages to the debug nub thread -typedef enum { - B_DEBUG_MESSAGE_READ_MEMORY = 0, // read from the team's memory - B_DEBUG_MESSAGE_WRITE_MEMORY, // write to the team's memory - B_DEBUG_MESSAGE_SET_TEAM_FLAGS, // set the team's debugging flags - B_DEBUG_MESSAGE_SET_THREAD_FLAGS, // set a thread's debugging flags - B_DEBUG_MESSAGE_CONTINUE_THREAD, // continue a stopped thread - B_DEBUG_MESSAGE_SET_CPU_STATE, // change a stopped thread's CPU state - B_DEBUG_MESSAGE_GET_CPU_STATE, // get the thread's current CPU state - B_DEBUG_MESSAGE_SET_BREAKPOINT, // set a breakpoint - B_DEBUG_MESSAGE_CLEAR_BREAKPOINT, // clear a breakpoint - B_DEBUG_MESSAGE_SET_WATCHPOINT, // set a watchpoint - B_DEBUG_MESSAGE_CLEAR_WATCHPOINT, // clear a watchpoint - B_DEBUG_MESSAGE_SET_SIGNAL_MASKS, // set/get a thread's masks of signals - B_DEBUG_MESSAGE_GET_SIGNAL_MASKS, // the debugger is interested in - B_DEBUG_MESSAGE_SET_SIGNAL_HANDLER, // set/get a thread's signal handler for - B_DEBUG_MESSAGE_GET_SIGNAL_HANDLER, // a signal - - B_DEBUG_MESSAGE_PREPARE_HANDOVER, // prepares the debugged team for being - // handed over to another debugger; - // the new debugger can just invoke - // install_team_debugger() -} debug_nub_message; - -// messages sent to the debugger -typedef enum { - B_DEBUGGER_MESSAGE_THREAD_DEBUGGED = 0, // debugger message in reaction to - // an invocation of debug_thread() - B_DEBUGGER_MESSAGE_DEBUGGER_CALL, // thread called debugger() - B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, // thread hit a breakpoint - B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, // thread hit a watchpoint - B_DEBUGGER_MESSAGE_SINGLE_STEP, // thread was single-stepped - B_DEBUGGER_MESSAGE_PRE_SYSCALL, // begin of a syscall - B_DEBUGGER_MESSAGE_POST_SYSCALL, // end of a syscall - B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED, // thread received a signal - B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, // an exception occurred - B_DEBUGGER_MESSAGE_TEAM_CREATED, // the debugged team created a new - // one - B_DEBUGGER_MESSAGE_TEAM_DELETED, // the debugged team is gone - B_DEBUGGER_MESSAGE_THREAD_CREATED, // a thread has been created - B_DEBUGGER_MESSAGE_THREAD_DELETED, // a thread has been deleted - B_DEBUGGER_MESSAGE_IMAGE_CREATED, // an image has been created - B_DEBUGGER_MESSAGE_IMAGE_DELETED, // an image has been deleted - - B_DEBUGGER_MESSAGE_HANDED_OVER, // the debugged team has been - // handed over to another debugger -} debug_debugger_message; - - -// #pragma mark - -// #pragma mark ----- messages to the debug nub thread ----- - -// B_DEBUG_MESSAGE_READ_MEMORY - -typedef struct { - port_id reply_port; // port to send the reply to - void *address; // address from which to read - int32 size; // number of bytes to read -} debug_nub_read_memory; - -typedef struct { - status_t error; // B_OK, if reading went fine - int32 size; // the number of bytes actually read - // > 0, iff error == B_OK - char data[B_MAX_READ_WRITE_MEMORY_SIZE]; - // the read data -} debug_nub_read_memory_reply; - -// B_DEBUG_MESSAGE_WRITE_MEMORY - -typedef struct { - port_id reply_port; // port to send the reply to - void *address; // address to which to write - int32 size; // number of bytes to write - char data[B_MAX_READ_WRITE_MEMORY_SIZE]; - // data to write -} debug_nub_write_memory; - -typedef struct { - status_t error; // B_OK, if writing went fine - int32 size; // the number of bytes actually written -} debug_nub_write_memory_reply; - -// B_DEBUG_MESSAGE_SET_TEAM_FLAGS - -typedef struct { - int32 flags; // the new team debugging flags -} debug_nub_set_team_flags; - -// B_DEBUG_MESSAGE_SET_THREAD_FLAGS - -typedef struct { - thread_id thread; // the thread - int32 flags; // the new thread debugging flags -} debug_nub_set_thread_flags; - -// B_DEBUG_MESSAGE_CONTINUE_THREAD - -typedef struct { - thread_id thread; // the thread - uint32 handle_event; // how to handle the occurred event - bool single_step; // true == single step, false == run full speed -} debug_nub_continue_thread; - -// B_DEBUG_MESSAGE_SET_CPU_STATE - -typedef struct { - thread_id thread; // the thread - debug_cpu_state cpu_state; // the new CPU state -} debug_nub_set_cpu_state; - -// B_DEBUG_MESSAGE_GET_CPU_STATE - -typedef struct { - port_id reply_port; // port to send the reply to - thread_id thread; // the thread -} debug_nub_get_cpu_state; - -typedef struct { - status_t error; // != B_OK, if something went wrong - // (bad thread ID, thread not stopped) - debug_debugger_message message; // the reason why the thread stopped - debug_cpu_state cpu_state; // the thread's CPU state -} debug_nub_get_cpu_state_reply; - -// B_DEBUG_MESSAGE_SET_BREAKPOINT - -typedef struct { - port_id reply_port; // port to send the reply to - void *address; // breakpoint address -} debug_nub_set_breakpoint; - -typedef struct { - status_t error; // B_OK, if the breakpoint has been set - // successfully -} debug_nub_set_breakpoint_reply; - -// B_DEBUG_MESSAGE_CLEAR_BREAKPOINT - -typedef struct { - void *address; // breakpoint address -} debug_nub_clear_breakpoint; - -// B_DEBUG_MESSAGE_SET_WATCHPOINT - -typedef struct { - port_id reply_port; // port to send the reply to - void *address; // watchpoint address - uint32 type; // watchpoint type (see type constants above) - int32 length; // number of bytes to watch (typically 1, 2, - // 4); architecture specific alignment - // restrictions apply. -} debug_nub_set_watchpoint; - -typedef struct { - status_t error; // B_OK, if the watchpoint has been set - // successfully -} debug_nub_set_watchpoint_reply; - -// B_DEBUG_MESSAGE_CLEAR_WATCHPOINT - -typedef struct { - void *address; // watchpoint address -} debug_nub_clear_watchpoint; - -// B_DEBUG_MESSAGE_SET_SIGNAL_MASKS - -typedef struct { - thread_id thread; // the thread - uint64 ignore_mask; // the mask for signals the - // debugger wishes not to be - // notified of - uint64 ignore_once_mask; // the mask for signals the - // debugger wishes not to be - // notified of when they next - // occur - debug_signal_mask_op ignore_op; // what to do with ignore_mask - debug_signal_mask_op ignore_once_op; // what to do with - // ignore_once_mask -} debug_nub_set_signal_masks; - -// B_DEBUG_MESSAGE_GET_SIGNAL_MASKS - -typedef struct { - port_id reply_port; // port to send the reply to - thread_id thread; // the thread -} debug_nub_get_signal_masks; - -typedef struct { - status_t error; // B_OK, if the thread exists - uint64 ignore_mask; // the mask for signals the debugger wishes - // not to be notified of - uint64 ignore_once_mask; // the mask for signals the debugger wishes - // not to be notified of when they next - // occur -} debug_nub_get_signal_masks_reply; - -// B_DEBUG_MESSAGE_SET_SIGNAL_HANDLER - -typedef struct { - thread_id thread; // the thread - int signal; // the signal - struct sigaction handler; // the new signal handler -} debug_nub_set_signal_handler; - -// B_DEBUG_MESSAGE_GET_SIGNAL_HANDLER - -typedef struct { - port_id reply_port; // port to send the reply to - thread_id thread; // the thread - int signal; // the signal -} debug_nub_get_signal_handler; - -typedef struct { - status_t error; // B_OK, if the thread exists - struct sigaction handler; // the signal handler -} debug_nub_get_signal_handler_reply; - -// B_DEBUG_MESSAGE_PREPARE_HANDOVER - -// no parameters, no reply - -// union of all messages structures sent to the debug nub thread -typedef union { - debug_nub_read_memory read_memory; - debug_nub_write_memory write_memory; - debug_nub_set_team_flags set_team_flags; - debug_nub_set_thread_flags set_thread_flags; - debug_nub_continue_thread continue_thread; - debug_nub_set_cpu_state set_cpu_state; - debug_nub_get_cpu_state get_cpu_state; - debug_nub_set_breakpoint set_breakpoint; - debug_nub_clear_breakpoint clear_breakpoint; - debug_nub_set_watchpoint set_watchpoint; - debug_nub_clear_watchpoint clear_watchpoint; - debug_nub_set_signal_masks set_signal_masks; - debug_nub_get_signal_masks get_signal_masks; - debug_nub_set_signal_handler set_signal_handler; - debug_nub_get_signal_handler get_signal_handler; -} debug_nub_message_data; - - -// #pragma mark - -// #pragma mark ----- messages to the debugger ----- - -// first member of all debugger messages -- not a message by itself -typedef struct { - thread_id thread; // the thread being the event origin - team_id team; // the thread's team - port_id nub_port; // port to debug nub for this team (only set - // for synchronous messages) -} debug_origin; - -// B_DEBUGGER_MESSAGE_THREAD_DEBUGGED - -typedef struct { - debug_origin origin; -} debug_thread_debugged; - -// B_DEBUGGER_MESSAGE_DEBUGGER_CALL - -typedef struct { - debug_origin origin; - void *message; // address of the message passed to - // debugger() -} debug_debugger_call; - -// B_DEBUGGER_MESSAGE_BREAKPOINT_HIT - -typedef struct { - debug_origin origin; - debug_cpu_state cpu_state; // cpu state - bool software; // true, if the is a software breakpoint - // (i.e. caused by a respective trap - // instruction) -} debug_breakpoint_hit; - -// B_DEBUGGER_MESSAGE_WATCHPOINT_HIT - -typedef struct { - debug_origin origin; - debug_cpu_state cpu_state; // cpu state -} debug_watchpoint_hit; - -// B_DEBUGGER_MESSAGE_SINGLE_STEP - -typedef struct { - debug_origin origin; - debug_cpu_state cpu_state; // cpu state -} debug_single_step; - -// B_DEBUGGER_MESSAGE_PRE_SYSCALL - -typedef struct { - debug_origin origin; - uint32 syscall; // the syscall number - uint32 args[16]; // syscall arguments -} debug_pre_syscall; - -// B_DEBUGGER_MESSAGE_POST_SYSCALL - -typedef struct { - debug_origin origin; - bigtime_t start_time; // time of syscall start - bigtime_t end_time; // time of syscall completion - uint64 return_value; // the syscall's return value - uint32 syscall; // the syscall number - uint32 args[16]; // syscall arguments -} debug_post_syscall; - -// B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED - -typedef struct { - debug_origin origin; - int signal; // the signal - struct sigaction handler; // the signal handler - bool deadly; // true, if handling the signal will kill - // the team -} debug_signal_received; - -// B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED - -typedef struct { - debug_origin origin; - debug_exception_type exception; // the exception - int signal; // the signal that will be sent, - // when the thread continues - // normally -} debug_exception_occurred; - -// B_DEBUGGER_MESSAGE_TEAM_CREATED - -typedef struct { - debug_origin origin; - team_id new_team; // the newly created team -} debug_team_created; - -// B_DEBUGGER_MESSAGE_TEAM_DELETED - -typedef struct { - debug_origin origin; // thread is < 0, team is the deleted team - // (asynchronous message) -} debug_team_deleted; - -// B_DEBUGGER_MESSAGE_THREAD_CREATED - -typedef struct { - debug_origin origin; // the thread that created the new thread - team_id new_thread; // the newly created thread -} debug_thread_created; - -// B_DEBUGGER_MESSAGE_THREAD_DELETED - -typedef struct { - debug_origin origin; // the deleted thread (asynchronous message) -} debug_thread_deleted; - -// B_DEBUGGER_MESSAGE_IMAGE_CREATED - -typedef struct { - debug_origin origin; - image_info info; // info for the image -} debug_image_created; - -// B_DEBUGGER_MESSAGE_IMAGE_DELETED - -typedef struct { - debug_origin origin; - image_info info; // info for the image -} debug_image_deleted; - -// B_DEBUGGER_MESSAGE_HANDED_OVER - -typedef struct { - debug_origin origin; // thread is < 0, team is the deleted team - // (asynchronous message) - team_id debugger; // the new debugger - port_id debugger_port; // the port the new debugger uses -} debug_handed_over; - -// union of all messages structures sent to the debugger -typedef union { - debug_thread_debugged thread_debugged; - debug_debugger_call debugger_call; - debug_breakpoint_hit breakpoint_hit; - debug_watchpoint_hit watchpoint_hit; - debug_single_step single_step; - debug_pre_syscall pre_syscall; - debug_post_syscall post_syscall; - debug_signal_received signal_received; - debug_exception_occurred exception_occurred; - debug_team_created team_created; - debug_team_deleted team_deleted; - debug_thread_created thread_created; - debug_thread_deleted thread_deleted; - debug_image_created image_created; - debug_image_deleted image_deleted; - debug_handed_over handed_over; - - debug_origin origin; // for convenience (no real message) -} debug_debugger_message_data; - - -extern void get_debug_message_string(debug_debugger_message message, - char *buffer, int32 bufferSize); -extern void get_debug_exception_string(debug_exception_type exception, - char *buffer, int32 bufferSize); - - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _DEBUGGER_H diff --git a/headers/build/os/kernel/disk_scanner.h b/headers/build/os/kernel/disk_scanner.h deleted file mode 100644 index cf68432099..0000000000 --- a/headers/build/os/kernel/disk_scanner.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Disk device iteration and information -** -** Distributed under the terms of the OpenBeOS License. -*/ -#ifndef _FS_DEVICE_H -#define _FS_DEVICE_H - - -#include -#include -#include - - -// session flags -enum { - B_DATA_SESSION = 0x01, /* data session */ - B_VIRTUAL_SESSION = 0x02, /* e.g. hard disk */ -}; - -typedef struct session_info { - off_t offset; /* offset from start of device (in bytes) */ - off_t size; /* size (in bytes) */ - int32 logical_block_size; /* logical block size (in bytes) */ - int32 index; /* session index */ - uint32 flags; /* session flags */ -} session_info; - -// partition flags -enum { - B_HIDDEN_PARTITION = 0x01, /* non-file system partition */ - B_VIRTUAL_PARTITION = 0x02, /* e.g. floppy */ - B_EMPTY_PARTITION = 0x04, /* empty partition, implies - B_HIDDEN_PARTITION */ -}; - -typedef struct extended_partition_info { - partition_info info; - uint32 flags; /* partition flags */ - char partition_name[B_FILE_NAME_LENGTH]; - char partition_type[B_FILE_NAME_LENGTH]; - char file_system_short_name[B_FILE_NAME_LENGTH]; /* "", if hidden */ - char file_system_long_name[B_FILE_NAME_LENGTH]; /* or unknown FS */ - char volume_name[B_FILE_NAME_LENGTH]; /* "", if hidden */ - uint32 file_system_flags; /* same as fs_info::flags */ -} extended_partition_info; - - -#ifdef __cplusplus -extern "C" { -#endif - -// getting infos -status_t get_nth_session_info(int deviceFD, int32 index, - session_info *sessionInfo); -status_t get_nth_partition_info(int deviceFD, int32 sessionIndex, - int32 partitionIndex, - extended_partition_info *partitionInfo, - char *partitionMapName); - -// partitioning -status_t get_partitioning_parameters(int deviceFD, int32 sessionIndex, - const char *identifier, char *buffer, - size_t bufferSize, size_t *actualSize); -status_t partition_session(int deviceFD, int32 sessionIndex, - const char *identifier, const char *parameters); - -// initialization -status_t get_fs_initialization_parameters(int deviceFD, int32 sessionIndex, - int32 partitionIndex, - const char *fileSystem, char *buffer, - size_t bufferSize, - size_t *actualSize); -// TODO: Move to . It fits better there. -status_t initialize_volume(const char *where, const char *fileSystem, - const char *volumeName, const char *parameters); - -#ifdef __cplusplus -} -#endif - -#endif /* _FS_DEVICE_H */ diff --git a/headers/build/os/kernel/fs_index.h b/headers/build/os/kernel/fs_index.h deleted file mode 100644 index 87ef486ab9..0000000000 --- a/headers/build/os/kernel/fs_index.h +++ /dev/null @@ -1,40 +0,0 @@ -/* File System indices -** -** Distributed under the terms of the OpenBeOS License. -*/ -#ifndef _FS_INDEX_H -#define _FS_INDEX_H - - -#include -#include - - -typedef struct index_info { - uint32 type; - off_t size; - time_t modification_time; - time_t creation_time; - uid_t uid; - gid_t gid; -} index_info; - - -#ifdef __cplusplus -extern "C" { -#endif - -extern int fs_create_index(dev_t device, const char *name, uint32 type, uint32 flags); -extern int fs_remove_index(dev_t device, const char *name); -extern int fs_stat_index(dev_t device, const char *name, struct index_info *indexInfo); - -extern DIR *fs_open_index_dir(dev_t device); -extern int fs_close_index_dir(DIR *indexDirectory); -extern struct dirent *fs_read_index_dir(DIR *indexDirectory); -extern void fs_rewind_index_dir(DIR *indexDirectory); - -#ifdef __cplusplus -} -#endif - -#endif /* _FS_INDEX_H */ diff --git a/headers/build/os/kernel/fs_query.h b/headers/build/os/kernel/fs_query.h deleted file mode 100644 index c717fc99ba..0000000000 --- a/headers/build/os/kernel/fs_query.h +++ /dev/null @@ -1,41 +0,0 @@ -/* File System attribute queries -** -** Distributed under the terms of the OpenBeOS License. -*/ -#ifndef _FS_QUERY_H -#define _FS_QUERY_H - - -#include -#include - - -/* Flags for fs_open_[live_]query() */ - -#define B_LIVE_QUERY 0x00000001 - // Note, if you specify B_LIVE_QUERY, you have to use fs_open_live_query(); - // it will be ignored in fs_open_query(). -#define B_QUERY_NON_INDEXED 0x00000002 - // Only enable this feature for non time-critical things, it might - // take a long time to proceed. - // Also, not every file system might support this feature. - - -#ifdef __cplusplus -extern "C" { -#endif - -extern DIR *fs_open_query(dev_t device, const char *query, uint32 flags); -extern DIR *fs_open_live_query(dev_t device, const char *query, - uint32 flags, port_id port, int32 token); -extern int fs_close_query(DIR *d); -extern struct dirent *fs_read_query(DIR *d); - -extern status_t get_path_for_dirent(struct dirent *dent, char *buf, - size_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* _FS_QUERY_H */ diff --git a/headers/build/os/kernel/fs_volume.h b/headers/build/os/kernel/fs_volume.h deleted file mode 100644 index dadb3d377a..0000000000 --- a/headers/build/os/kernel/fs_volume.h +++ /dev/null @@ -1,31 +0,0 @@ -/* File System volume functions -** -** Distributed under the terms of the Haiku License. -*/ -#ifndef _FS_VOLUME_H -#define _FS_VOLUME_H - -#include - - -/* mount flags */ -#define B_MOUNT_READ_ONLY 1 -#define B_MOUNT_VIRTUAL_DEVICE 2 - -/* unmount flags */ -#define B_FORCE_UNMOUNT 1 - - -#ifdef __cplusplus -extern "C" { -#endif - -extern status_t fs_mount_volume(const char *where, const char *device, - const char *filesystem, uint32 flags, const char *parameters); -extern status_t fs_unmount_volume(const char *path, uint32 flags); - -#ifdef __cplusplus -} -#endif - -#endif /* _FS_VOLUME_H */ diff --git a/headers/build/os/kernel/scheduler.h b/headers/build/os/kernel/scheduler.h deleted file mode 100644 index 0d67143b45..0000000000 --- a/headers/build/os/kernel/scheduler.h +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - - File: scheduler.h - - Description: Scheduling inquiry functions - - Copyright 1998-, Be Incorporated, All Rights Reserved. - -*****************************************************************************/ - - -#if !defined(SCHEDULER_H) -#define SCHEDULER_H - -#include -#include - -/* To get a good thread priority, call suggest_thread_priority() with the following information: */ -/* 'what' is a bit mask describing what you're doing in the thread. */ -/* 'period' is how many times a second your thread needs to run (-1 if you're running continuously.) */ -/* 'jitter' is an estimate (in us) of how much that period can vary, as long as it stays centered on the average. */ -/* 'length' is how long (in us) you expect to run for each invocation. */ -/* "invocation" means, typically, receiving a message, dispatching it, and then returning to reading a message. */ -/* MANIPULATION means both filtering and compression/decompression. */ -/* PLAYBACK and RECORDING means threads feeding/reading ACTUAL HARDWARE ONLY. */ -/* 0 means don't care */ -enum be_task_flags { /* bitmasks for "what" */ - B_DEFAULT_MEDIA_PRIORITY = 0, - B_OFFLINE_PROCESSING = 0x1, - B_STATUS_RENDERING = 0x2, /* can also use this for "preview" type things */ - B_USER_INPUT_HANDLING = 0x4, - B_LIVE_VIDEO_MANIPULATION = 0x8, /* non-live processing is OFFLINE_PROCESSING */ - B_VIDEO_PLAYBACK = 0x10, /* feeding hardware */ - B_VIDEO_RECORDING = 0x20, /* grabbing from hardware */ - B_LIVE_AUDIO_MANIPULATION = 0x40, /* non-live processing is OFFLINE_PROCESSING */ - B_AUDIO_PLAYBACK = 0x80, /* feeding hardware */ - B_AUDIO_RECORDING = 0x100, /* grabbing from hardware */ - B_LIVE_3D_RENDERING = 0x200, /* non-live rendering is OFFLINE_PROCESSING */ - B_NUMBER_CRUNCHING = 0x400, - B_MIDI_PROCESSING = 0x800 -}; -#if defined(__cplusplus) -extern "C" { -_IMPEXP_ROOT int32 suggest_thread_priority(uint32 task_flags = B_DEFAULT_MEDIA_PRIORITY, - int32 period = 0, bigtime_t jitter = 0, bigtime_t length = 0); -_IMPEXP_ROOT bigtime_t estimate_max_scheduling_latency(thread_id th = -1); /* default is current thread */ -} -#else -_IMPEXP_ROOT int32 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, bigtime_t length); -_IMPEXP_ROOT bigtime_t estimate_max_scheduling_latency(thread_id th); /* default is current thread */ -#endif - -#endif /* SCHEDULER_H */ - diff --git a/headers/build/os/storage/FilePanel.h b/headers/build/os/storage/FilePanel.h deleted file mode 100644 index 71b72170a0..0000000000 --- a/headers/build/os/storage/FilePanel.h +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* -/ -/ File: FilePanel.h -/ -/ Description: BFilePanel and BRefFilter classes, and -/ run_open_panel()/run_save_panel functions. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - -#ifndef _FILE_PANEL_H -#define _FILE_PANEL_H - -#ifndef _BE_BUILD_H -#include -#endif - -#include -#include -#include -#include - - -/*- Old fashioned, one-shot, heavily-defaulted panel functions. -*/ - -extern _IMPEXP_TRACKER void run_open_panel(); -extern _IMPEXP_TRACKER void run_save_panel(); - - -/*---BRefFilter--------------------------------------------------*/ - -/* BRefFilter is used by BFilePanel. Every time the user selects - * an item in a file panel, the Filter() func is sent to the - * panel's BRefFilter object. Filter()'s return value determines - * whether the item is admitted into the panel's list of - * displayed items. Optional. - */ -class BRefFilter { -public: -virtual bool Filter(const entry_ref *, BNode *, struct stat *, - const char *mimetype) = 0; -}; - - -/*---File Panel constants etc------------------------------------*/ - -enum file_panel_mode { - B_OPEN_PANEL, - B_SAVE_PANEL -}; - -enum file_panel_button { - B_CANCEL_BUTTON, - B_DEFAULT_BUTTON -}; - -class BWindow; -class BMessenger; -class BMessage; - -/*---------------------------------------------------------------*/ -/*----BFilePanel-------------------------------------------------*/ - -/* Most of the contructor parameters can also be set through individual - * funcs. But these can't: - * - * file_panel_mode mode - * uint32 node_flavors - * bool modal - */ - -class BFilePanel { - -public: - BFilePanel(file_panel_mode mode = B_OPEN_PANEL, - BMessenger *target = 0, - const entry_ref *start_directory = 0, - uint32 node_flavors = 0, - bool allow_multiple_selection = true, - BMessage *message = 0, - BRefFilter * = 0, - bool modal = false, - bool hide_when_done = true); - -virtual ~BFilePanel(); - - void Show(); - void Hide(); - bool IsShowing() const; - -virtual void WasHidden(); -virtual void SelectionChanged(); -virtual void SendMessage(const BMessenger*, BMessage*); - - BWindow* Window() const; - BMessenger Messenger() const; - BRefFilter* RefFilter() const; - void GetPanelDirectory(entry_ref *) const; - - file_panel_mode PanelMode() const; - - void SetTarget(BMessenger); - void SetMessage(BMessage *msg); - - void SetRefFilter(BRefFilter* filter); - void SetSaveText(const char* text); - void SetButtonLabel(file_panel_button, const char *label); - - void SetPanelDirectory(const BEntry *new_directory); - void SetPanelDirectory(const BDirectory *new_directory); - void SetPanelDirectory(const entry_ref *new_directory); - void SetPanelDirectory(const char *new_directory); - - void SetHideWhenDone(bool); - bool HidesWhenDone(void) const; - - void Refresh(); - void Rewind(); - status_t GetNextSelectedRef(entry_ref*); - -private: - -#if !_PR3_COMPATIBLE_ -virtual void _ReservedFilePanel1(); -virtual void _ReservedFilePanel2(); -virtual void _ReservedFilePanel3(); -virtual void _ReservedFilePanel4(); -virtual void _ReservedFilePanel5(); -virtual void _ReservedFilePanel6(); -virtual void _ReservedFilePanel7(); -virtual void _ReservedFilePanel8(); -#endif - - BWindow *fWindow; - -#if !_PR3_COMPATIBLE_ - uint32 _reserved[10]; -#endif - -public: - // deprecated calls, do not use - BFilePanel(file_panel_mode mode, BMessenger *, entry_ref *, - uint32 , bool, BMessage *, BRefFilter *, bool modal, - bool hide_when_done); - void SetPanelDirectory(BEntry*); - void SetPanelDirectory(BDirectory*); - void SetPanelDirectory(entry_ref*); -}; - -#endif diff --git a/headers/build/os/storage/Query.h b/headers/build/os/storage/Query.h deleted file mode 100644 index 1bf5888d64..0000000000 --- a/headers/build/os/storage/Query.h +++ /dev/null @@ -1,123 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Query.h - BQuery interface declaration. -*/ - -#ifndef _QUERY_H -#define _QUERY_H - -#include -#include -#include -#include - -class BVolume; -struct entry_ref; - -namespace BPrivate { - namespace Storage { - class QueryNode; - class QueryStack; - class QueryTree; - }; -}; - -typedef enum { - B_INVALID_OP = 0, - B_EQ, - B_GT, - B_GE, - B_LT, - B_LE, - B_NE, - B_CONTAINS, - B_BEGINS_WITH, - B_ENDS_WITH, - B_AND = 0x101, - B_OR, - B_NOT, - _B_RESERVED_OP_ = 0x100000 -} query_op; - -/*! - \class BQuery - \brief Represents a live or non-live file system query - - Provides an interface for creating file system queries. Implements - the BEntryList for iterating through the found entries. - - \author Ingo Weinhold - - \version 0.0.0 -*/ -class BQuery : public BEntryList { -public: - BQuery(); - virtual ~BQuery(); - - status_t Clear(); - - status_t PushAttr(const char *attrName); - status_t PushOp(query_op op); - - status_t PushUInt32(uint32 value); - status_t PushInt32(int32 value); - status_t PushUInt64(uint64 value); - status_t PushInt64(int64 value); - status_t PushFloat(float value); - status_t PushDouble(double value); - status_t PushString(const char *value, bool caseInsensitive = false); - status_t PushDate(const char *date); - - status_t SetVolume(const BVolume *volume); - status_t SetPredicate(const char *expression); - status_t SetTarget(BMessenger messenger); - - bool IsLive() const; - - status_t GetPredicate(char *buffer, size_t length); - status_t GetPredicate(BString *predicate); - size_t PredicateLength(); - - dev_t TargetDevice() const; - - status_t Fetch(); - - // BEntryList interface - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buf, size_t length, - int32 count = INT_MAX); - virtual status_t Rewind(); - virtual int32 CountEntries(); - -private: - bool _HasFetched() const; - status_t _PushNode(BPrivate::Storage::QueryNode *node, bool deleteOnError); - status_t _SetPredicate(const char *expression); - status_t _EvaluateStack(); - - // FBC - virtual void _QwertyQuery1(); - virtual void _QwertyQuery2(); - virtual void _QwertyQuery3(); - virtual void _QwertyQuery4(); - virtual void _QwertyQuery5(); - virtual void _QwertyQuery6(); - -private: - int32 _reservedData[4]; // FBC - BPrivate::Storage::QueryStack *fStack; - char *fPredicate; - dev_t fDevice; - bool fLive; - port_id fPort; - long fToken; - int fQueryFd; -}; - -#endif // _QUERY_H diff --git a/headers/build/os/storage/VolumeRoster.h b/headers/build/os/storage/VolumeRoster.h deleted file mode 100644 index ba45e199e0..0000000000 --- a/headers/build/os/storage/VolumeRoster.h +++ /dev/null @@ -1,54 +0,0 @@ -// ---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -// -// File Name: VolumeRoster.h -// -// Description: BVolumeRoster class -// ---------------------------------------------------------------------- -/*! - \file VolumeRoster.h - BVolumeRoster interface declarations. -*/ -#ifndef _VOLUME_ROSTER_H -#define _VOLUME_ROSTER_H - -#include -#include -#include - -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif - -class BVolume; -class BMessenger; - -class BVolumeRoster { -public: - BVolumeRoster(); - virtual ~BVolumeRoster(); - - status_t GetNextVolume(BVolume *volume); - void Rewind(); - - status_t GetBootVolume(BVolume *volume); - - status_t StartWatching(BMessenger messenger = be_app_messenger); - void StopWatching(); - BMessenger Messenger() const; - -private: - virtual void _SeveredVRoster1(); - virtual void _SeveredVRoster2(); - - int32 fCookie; - BMessenger *fTarget; - uint32 _reserved[3]; -}; - -#ifdef USE_OPENBEOS_NAMESPACE -} -#endif - -#endif // _VOLUME_ROSTER_H diff --git a/headers/build/os/support/Autolock.h b/headers/build/os/support/Autolock.h deleted file mode 100644 index b002e75523..0000000000 --- a/headers/build/os/support/Autolock.h +++ /dev/null @@ -1,79 +0,0 @@ -// -// $Id: Autolock.h 3246 2003-05-14 17:21:46Z haydentech $ -// -// This is the BAutolock interface for OpenBeOS. It has been created to -// be source and binary compatible with the BeOS version of BAutolock. -// To that end, all members are inline just as with the BeOS version. -// - - -#ifndef _OPENBEOS_AUTOLOCK_H -#define _OPENBEOS_AUTOLOCK_H - - -#include -#include - - -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif - -class BAutolock { -public: - inline BAutolock(BLooper *looper); - inline BAutolock(BLocker *locker); - inline BAutolock(BLocker &locker); - - inline ~BAutolock(); - - inline bool IsLocked(void); - -private: - BLocker *fTheLocker; - BLooper *fTheLooper; - bool fIsLocked; -}; - - -inline BAutolock::BAutolock(BLooper *looper) : - fTheLocker(NULL), fTheLooper(looper), fIsLocked(looper->Lock()) -{ -} - - -inline BAutolock::BAutolock(BLocker *locker) : - fTheLocker(locker), fTheLooper(NULL), fIsLocked(locker->Lock()) -{ -} - - -inline BAutolock::BAutolock(BLocker &locker) : - fTheLocker(&locker), fTheLooper(NULL), fIsLocked(locker.Lock()) -{ -} - - -inline BAutolock::~BAutolock() -{ - if (fIsLocked) { - if (fTheLooper != NULL) { - fTheLooper->Unlock(); - } else { - fTheLocker->Unlock(); - } - } -} - - -inline bool BAutolock::IsLocked() -{ - return fIsLocked; -} - - -#ifdef USE_OPENBEOS_NAMESPACE -} -#endif - -#endif // _OPENBEOS_LOCKER_H diff --git a/headers/build/os/support/Beep.h b/headers/build/os/support/Beep.h deleted file mode 100644 index 0c49e549b3..0000000000 --- a/headers/build/os/support/Beep.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _BEEP_H -#define _BEEP_H - - -#include -#include - - -#ifdef __cplusplus -// These functions are only exported for C++ - -status_t beep(); -status_t system_beep(const char* eventName); -status_t add_system_beep_event(const char* eventName, uint32 flags = 0); - -#endif - -#endif // _BEEP_H diff --git a/headers/build/os/support/ClassInfo.h b/headers/build/os/support/ClassInfo.h deleted file mode 100644 index 0df2c19c0f..0000000000 --- a/headers/build/os/support/ClassInfo.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _CLASS_INFO_H -#define _CLASS_INFO_H - - -#include - - -// deprecated, use standard RTTI calls instead -// TODO: maybe get rid of this header completely? - -#define class_name(object) \ - ((typeid(*(object))).name()) -#define cast_as(object, class) \ - (dynamic_cast(object)) -#define is_kind_of(object, class) \ - (dynamic_cast(object) != NULL) -#define is_instance_of(object, class) \ - (typeid(*(object)) == typeid(class)) - -#endif // _CLASS_INFO_H diff --git a/headers/build/os/support/StopWatch.h b/headers/build/os/support/StopWatch.h deleted file mode 100644 index 798e388312..0000000000 --- a/headers/build/os/support/StopWatch.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _BLUE_STOP_WATCH_H -#define _BLUE_STOP_WATCH_H - -#include -#include - -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif - -class BStopWatch { - public: - BStopWatch(const char *name, bool silent = false); - virtual ~BStopWatch(); - - void Suspend(); - void Resume(); - bigtime_t Lap(); - bigtime_t ElapsedTime() const; - void Reset(); - const char *Name() const; - - private: - virtual void _ReservedStopWatch1(); - virtual void _ReservedStopWatch2(); - - bigtime_t fStart; - bigtime_t fSuspendTime; - bigtime_t fLaps[10]; - int32 fLap; - const char *fName; - uint32 _reserved[2]; // these are for fName to be initiased - bool fSilent; -}; - -#ifdef USE_OPENBEOS_NAMESPACE -} // namespace OpenBeOS -using namespace OpenBeOS; -#endif - -#endif /* _STOP_WATCH_H */ diff --git a/headers/build/os/support/TLS.h b/headers/build/os/support/TLS.h deleted file mode 100644 index e62781e8ee..0000000000 --- a/headers/build/os/support/TLS.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _TLS_H -#define _TLS_H -/* -** Distributed under the terms of the OpenBeOS License. -*/ - -#include -#include - -/* A maximum of 64 keys is allowed to store in TLS - the key is reserved - * process-wide. Note that tls_allocate() will return B_NO_MEMORY if you - * try to exceed this limit. - */ -#define TLS_MAX_KEYS 64 - -#ifdef __cplusplus -extern "C" { -#endif - -extern int32 tls_allocate(void); - -#if !_NO_INLINE_ASM && __INTEL__ && __GNUC__ - -static inline void * -tls_get(int32 index) -{ - void *ret; - __asm__ __volatile__ ( - "movl %%fs:(,%%edx, 4), %%eax \n\t" - : "=a"(ret) : "d"(index) ); - return ret; -} - -static inline void ** -tls_address(int32 index) -{ - void **ret; - __asm__ __volatile__ ( - "movl %%fs:0, %%eax \n\t" - "leal (%%eax, %%edx, 4), %%eax \n\t" - : "=a"(ret) : "d"(index) ); - return ret; -} - -static inline void -tls_set(int32 index, void *value) -{ - __asm__ __volatile__ ( - "movl %%eax, %%fs:(,%%edx, 4) \n\t" - : : "d"(index), "a"(value) ); -} - -#else - -extern void *tls_get(int32 index); -extern void **tls_address(int32 index); -extern void tls_set(int32 index, void *value); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _TLS_H */ diff --git a/headers/build/os/support/UTF8.h b/headers/build/os/support/UTF8.h deleted file mode 100644 index 6482b8e3a4..0000000000 --- a/headers/build/os/support/UTF8.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _UTF8_H -#define _UTF8_H - - -#include -#include -#include - - -// Conversion Flavors -enum { - B_ISO1_CONVERSION, // ISO 8859-x - B_ISO2_CONVERSION, - B_ISO3_CONVERSION, - B_ISO4_CONVERSION, - B_ISO5_CONVERSION, - B_ISO6_CONVERSION, - B_ISO7_CONVERSION, - B_ISO8_CONVERSION, - B_ISO9_CONVERSION, - B_ISO10_CONVERSION, - B_MAC_ROMAN_CONVERSION, // Macintosh Roman - B_SJIS_CONVERSION, // Shift-JIS - B_EUC_CONVERSION, // EUC Packed Japanese - B_JIS_CONVERSION, // JIS X 0208-1990 - B_MS_WINDOWS_CONVERSION, // Windows Latin-1 Codepage 1252 - B_UNICODE_CONVERSION, // Unicode 2.0, UCS-2 - B_KOI8R_CONVERSION, // KOI8-R - B_MS_WINDOWS_1251_CONVERSION, // Windows Cyrillic Codepage 1251 - B_MS_DOS_866_CONVERSION, // MS-DOS Codepage 866 - B_MS_DOS_CONVERSION, // MS-DOS Codepage 437 - B_EUC_KR_CONVERSION, // EUC Korean - B_ISO13_CONVERSION, - B_ISO14_CONVERSION, - B_ISO15_CONVERSION, - B_BIG5_CONVERSION, // Chinese Big5 - B_GBK_CONVERSION, // Chinese GB18030 -}; - - -// Conversion Functions - -#ifdef __cplusplus - -status_t convert_to_utf8(uint32 sourceEncoding, const char* source, - int32* sourceLength, char* dest, int32* destLength, int32* state, - char substitute = B_SUBSTITUTE); - -status_t convert_from_utf8(uint32 destEncoding, const char* source, - int32* sourceLength, char* dest, int32* destLength, int32* state, - char substitute = B_SUBSTITUTE); - -#endif - -#endif /* _UTF8_H */ diff --git a/headers/build/os/support/parsedate.h b/headers/build/os/support/parsedate.h deleted file mode 100644 index 3530babc1c..0000000000 --- a/headers/build/os/support/parsedate.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _PARSEDATE_H -#define _PARSEDATE_H -/* -** Distributed under the terms of the OpenBeOS License. -*/ - - -#include - - -/* flags that will be set in the flags field by parsedate_etc() */ -#define PARSEDATE_RELATIVE_TIME 0x0001 -// ToDo: the following flags are not part of the R5 implementation and preliminary only -#define PARSEDATE_DAY_RELATIVE_TIME PARSEDATE_RELATIVE_TIME -#define PARSEDATE_MINUTE_RELATIVE_TIME 0x0002 -#define PARSEDATE_INVALID_DATE 0x0100 - - -#ifdef __cplusplus -extern "C" { -#endif - -extern time_t parsedate(const char *dateString, time_t now); -extern time_t parsedate_etc(const char *dateString, time_t now, int *_storedFlags); - -extern void set_dateformats(const char *table[]); -extern const char **get_dateformats(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _PARSEDATE_H */ diff --git a/headers/build/private/app/AppServerLink.h b/headers/build/private/app/AppServerLink.h deleted file mode 100644 index 8aadb797db..0000000000 --- a/headers/build/private/app/AppServerLink.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Erik Jaesler (erik@cgsoftware.com) - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef APPSERVERLINK_H -#define APPSERVERLINK_H - - -#include - - -namespace BPrivate { - -class AppServerLink : public ServerLink { - public: - AppServerLink(void); - ~AppServerLink(void); -}; - -} // namespace BPrivate - -#endif /* APPSERVERLINK_H */ diff --git a/headers/build/private/app/ApplicationPrivate.h b/headers/build/private/app/ApplicationPrivate.h deleted file mode 100644 index 9fa83838fd..0000000000 --- a/headers/build/private/app/ApplicationPrivate.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Ingo Weinhold - */ -#ifndef _APPLICATION_PRIVATE_H -#define _APPLICATION_PRIVATE_H - -#include - -class BApplication::Private { -public: - static inline BPrivate::PortLink *ServerLink() - { return be_app->fServerLink; } -}; - -#endif // _APPLICATION_PRIVATE_H diff --git a/headers/build/private/app/AreaLink.h b/headers/build/private/app/AreaLink.h deleted file mode 100644 index 0558d1ed11..0000000000 --- a/headers/build/private/app/AreaLink.h +++ /dev/null @@ -1,78 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: AreaLink.h -// Author: DarkWyrm -// Description: Helper class for managing chunks of small data in an area -// -//------------------------------------------------------------------------------ -#ifndef AREALINK_H -#define AREALINK_H - -#include -#include -#include - -#define MAX_ATTACHMENT_SIZE 65535 // in bytes -#define SIZE_SIZE 2 // size of the size records in an AreaLink area - -class AreaLinkHeader; - -class AreaLink -{ -public: - AreaLink(area_id area, bool is_arealink_area=false); - AreaLink(void); - ~AreaLink(void); - - void SetTarget(area_id area, bool is_arealink_area=false); - area_id GetTarget(void) { return target; } - - void Attach(const void *data, size_t size); - inline void Attach(const int32 &data); - inline void Attach(const int16 &data); - inline void Attach(const int8 &data); - inline void Attach(const float &data); - inline void Attach(const bool &data); - inline void Attach(const rgb_color &data); - inline void Attach(const BRect &data); - inline void Attach(const BPoint &data); - - void MakeEmpty(void); - void *ItemAt(int32 index) { return attachlist->ItemAt(index); } - int32 CountAttachments(void) { return attachlist->CountItems(); } - void *BaseAddress(void) { return (void *)baseaddress; } - - void Lock(void); - void Unlock(void); - bool IsLocked(void); -protected: - void _ReadAttachments(void); - - BList *attachlist; - area_id target; - bool area_ok; - bool have_lock; - int8 *baseaddress; - AreaLinkHeader *header; -}; - -#endif diff --git a/headers/build/private/app/ClipboardPrivate.h b/headers/build/private/app/ClipboardPrivate.h deleted file mode 100644 index 0e5125445a..0000000000 --- a/headers/build/private/app/ClipboardPrivate.h +++ /dev/null @@ -1,12 +0,0 @@ -// ClipboardPrivate.h - -#ifndef _CLIPBOARD_PRIVATE_H -#define _CLIPBOARD_PRIVATE_H - -namespace BPrivate { - -void init_clipboard(); - -}; - -#endif // _CLIPBOARD_PRIVATE_H diff --git a/headers/build/private/app/LinkMsgReader.h b/headers/build/private/app/LinkMsgReader.h deleted file mode 100644 index 380dcdf9a7..0000000000 --- a/headers/build/private/app/LinkMsgReader.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Pahtz - */ -#ifndef _LINKMSGREADER_H -#define _LINKMSGREADER_H - -#include - - -namespace BPrivate { - -class LinkReceiver { - public: - LinkReceiver(port_id port); - virtual ~LinkReceiver(void); - - void SetPort(port_id port); - port_id Port(void) { return fReceivePort; } - - status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT); - bool NeedsReply() const; - int32 Code() const; - - virtual status_t Read(void *data, ssize_t size); - status_t ReadString(char **string); - template status_t Read(Type *data) - { - return Read(data, sizeof(Type)); - } - - protected: - virtual status_t ReadFromPort(bigtime_t timeout); - virtual status_t AdjustReplyBuffer(bigtime_t timeout); - void ResetBuffer(); - - port_id fReceivePort; - - char *fRecvBuffer; - - int32 fRecvPosition; //current read position - - int32 fRecvStart; //start of current message - - int32 fRecvBufferSize; - - int32 fDataSize; //size of data in recv buffer - int32 fReplySize; //size of current reply message - - status_t fReadError; //Read failed for current message -}; - -} // namespace BPrivate - -#endif // _LINKMSGREADER_H diff --git a/headers/build/private/app/LinkMsgSender.h b/headers/build/private/app/LinkMsgSender.h deleted file mode 100644 index 16ddedb825..0000000000 --- a/headers/build/private/app/LinkMsgSender.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Pahtz - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef LINKMSGSENDER_H -#define LINKMSGSENDER_H - - -#include - - -namespace BPrivate { - -class LinkSender { - public: - LinkSender(port_id sendport); - virtual ~LinkSender(void); - - void SetPort(port_id port); - port_id Port() { return fPort; } - - status_t StartMessage(int32 code, size_t minSize = 0); - void CancelMessage(void); - status_t EndMessage(bool needsReply = false); - - status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false); - - // see BPrivate::BAppServerLink which inherits from BPortLink - //status_t FlushWithReply(int32 *code); - - status_t Attach(const void *data, size_t size); - status_t AttachString(const char *string, int32 length = -1); - template status_t Attach(const Type& data) - { - return Attach(&data, sizeof(Type)); - } - - protected: - size_t SpaceLeft() const { return fBufferSize - fCurrentEnd; } - size_t CurrentMessageSize() const { return fCurrentEnd - fCurrentStart; } - - status_t AdjustBuffer(size_t newBufferSize, char **_oldBuffer = NULL); - status_t FlushCompleted(size_t newBufferSize); - - port_id fPort; - - char *fBuffer; - size_t fBufferSize; - - uint32 fCurrentEnd; // current append position - uint32 fCurrentStart; // start of current message - - status_t fCurrentStatus; -}; - -} // namespace BPrivate - -#endif /* LINKMSGSENDER_H */ diff --git a/headers/build/private/app/PortLink.h b/headers/build/private/app/PortLink.h deleted file mode 100644 index 38084f1339..0000000000 --- a/headers/build/private/app/PortLink.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Pahtz - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef _PORTLINK_H -#define _PORTLINK_H - -#include -#include -#include - -/* - Error checking rules: (for if you don't want to check every return code) - - Calling EndMessage() is optional, implied by Flush() or StartMessage(). - - If you are sending just one message you only need to test Flush() == B_OK - - If you are buffering multiple messages without calling Flush() you must - check EndMessage() == B_OK, or the last Attach() for each message. Check - Flush() at the end. - - If you are reading, check the last Read() or ReadString() you perform. - -*/ - -namespace BPrivate { - -class ServerLink { - public: - ServerLink(); - virtual ~ServerLink(); - - // send methods - - void SetSenderPort(port_id port); - port_id SenderPort(); - - status_t StartMessage(int32 code, size_t minSize = 0); - void CancelMessage(); - status_t EndMessage(); - - status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false); - status_t Attach(const void *data, ssize_t size); - status_t AttachString(const char *string, int32 length = -1); - status_t AttachRegion(const BRegion ®ion); - status_t AttachShape(BShape &shape); - status_t AttachGradient(const BGradient &gradient); - template status_t Attach(const Type& data); - - // receive methods - - void SetReceiverPort(port_id port); - port_id ReceiverPort(); - - status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT); - bool NeedsReply() const; - status_t Read(void *data, ssize_t size); - status_t ReadString(char **string); - status_t ReadRegion(BRegion *region); - status_t ReadShape(BShape *shape); - status_t ReadGradient(BGradient *gradient); - template status_t Read(Type *data); - - // convenience methods - - status_t FlushWithReply(int32 &code); - LinkSender &Sender() { return *fSender; } - LinkReceiver &Receiver() { return *fReceiver; } - - protected: - LinkSender *fSender; - LinkReceiver *fReceiver; -}; - -class PortLink : public ServerLink { - public: - PortLink(port_id sender = -1, port_id receiver = -1); - virtual ~PortLink(); - - void SetTo(port_id sender, port_id receiver); -}; - - -// sender inline functions - -inline void -ServerLink::SetSenderPort(port_id port) -{ - fSender->SetPort(port); -} - -inline port_id -ServerLink::SenderPort() -{ - return fSender->Port(); -} - -inline status_t -ServerLink::StartMessage(int32 code, size_t minSize) -{ - return fSender->StartMessage(code, minSize); -} - -inline status_t -ServerLink::EndMessage() -{ - return fSender->EndMessage(); -} - -inline void -ServerLink::CancelMessage() -{ - fSender->CancelMessage(); -} - -inline status_t -ServerLink::Flush(bigtime_t timeout, bool needsReply) -{ - return fSender->Flush(timeout, needsReply); -} - -inline status_t -ServerLink::Attach(const void *data, ssize_t size) -{ - return fSender->Attach(data, size); -} - -inline status_t -ServerLink::AttachString(const char *string, int32 length) -{ - return fSender->AttachString(string, length); -} - -template status_t -ServerLink::Attach(const Type &data) -{ - return Attach(&data, sizeof(Type)); -} - -// #pragma mark - receiver inline functions - -inline void -ServerLink::SetReceiverPort(port_id port) -{ - fReceiver->SetPort(port); -} - -inline port_id -ServerLink::ReceiverPort() -{ - return fReceiver->Port(); -} - -inline status_t -ServerLink::GetNextMessage(int32 &code, bigtime_t timeout) -{ - return fReceiver->GetNextMessage(code, timeout); -} - -inline bool -ServerLink::NeedsReply() const -{ - return fReceiver->NeedsReply(); -} - -inline status_t -ServerLink::Read(void *data, ssize_t size) -{ - return fReceiver->Read(data, size); -} - -inline status_t -ServerLink::ReadString(char **string) -{ - return fReceiver->ReadString(string); -} - -template status_t -ServerLink::Read(Type *data) -{ - return Read(data, sizeof(Type)); -} - -} // namespace BPrivate - -#endif /* _PORTLINK_H */ diff --git a/headers/build/private/app/PortMessage.h b/headers/build/private/app/PortMessage.h deleted file mode 100644 index 81a5c0c8e9..0000000000 --- a/headers/build/private/app/PortMessage.h +++ /dev/null @@ -1,82 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: PortMessage.h -// Author: DarkWyrm -// Description: Package class for port messaging-based data -// -//------------------------------------------------------------------------------ -#ifndef PORTMESSAGE_H_ -#define PORTMESSAGE_H_ - -#include -#include - -class PortMessage -{ -public: - PortMessage(const int32 &code, const void *buffer, const ssize_t &buffersize, - const bool ©); - PortMessage(void); - ~PortMessage(void); - - status_t ReadFromPort(const port_id &port, const bigtime_t &timeout=B_INFINITE_TIMEOUT); - status_t WriteToPort(const port_id &port); - - void SetCode(const int32 &code); - void SetProtocol(int32 protocol) { _protocol=protocol; } - void SetBuffer(const void *buffer, const ssize_t &size, const bool ©=false); - - int32 Code(void) { return _code; } - void *Buffer(void) { return _buffer; } - ssize_t BufferSize(void) { return _buffersize; } - int32 Protocol(void) const { return _protocol; } - - status_t Read(void *data, ssize_t size); - status_t ReadString(char **string); - template status_t Read(Type *data) - { - int32 size = sizeof(Type); - - if(!data) - return B_BAD_VALUE; - - if( !_buffer || - (_buffersize < size) || - (_index+size > _buffer+_buffersize) ) - return B_NO_MEMORY; - - *data=*((Type*)_index); - _index+=size; - - return B_OK; - } - - void Rewind(void); -private: - int32 _code; - uint8 *_buffer; - ssize_t _buffersize; - uint8 *_index; - int32 _protocol; -}; - -#endif diff --git a/headers/build/private/app/PortQueue.h b/headers/build/private/app/PortQueue.h deleted file mode 100644 index b769e02695..0000000000 --- a/headers/build/private/app/PortQueue.h +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: PortQueue.h -// Author: DarkWyrm -// Description: Facilitation class for reading and queueing messages from ports -// -//------------------------------------------------------------------------------ -#ifndef PORTQUEUE_H_ -#define PORTQUEUE_H_ - -#include -#include - -class PortMessage; - -class PortQueue -{ -public: - PortQueue(const port_id &port); - ~PortQueue(void); - bool IsInitialized(void) { return _init; } - - bool SetPort(const port_id &port); - port_id GetPort(void) { return _port; } - - bool MessagesWaiting(void) { return !_q.empty(); } - - void GetMessagesFromPort(bool wait_for_messages=false); - PortMessage *GetMessageFromQueue(void); - - void MakeEmpty(void); - -private: - std::queue _q; - bool _init; - port_id _port; -}; - -#endif diff --git a/headers/build/private/app/RegistrarThread.h b/headers/build/private/app/RegistrarThread.h deleted file mode 100644 index 479399551e..0000000000 --- a/headers/build/private/app/RegistrarThread.h +++ /dev/null @@ -1,45 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file RegistrarThread.h - RegistrarThread interface declaration -*/ - -#ifndef REGISTRAR_THREAD_H -#define REGISTRAR_THREAD_H - -#include -#include - -class RegistrarThread { -public: - RegistrarThread(const char *name, int32 priority, BMessenger managerMessenger); - virtual ~RegistrarThread(); - - virtual status_t InitCheck(); - status_t Run(); - - thread_id Id() const; - const char* Name() const; - - void AskToExit(); - bool IsFinished() const; - -protected: - //! The function executed in the object's thread when Run() is called - virtual status_t ThreadFunction() = 0; - - BMessenger fManagerMessenger; - bool fShouldExit; // Initially false, may be set to true by AskToExit() - bool fIsFinished; // Initially false, set to true by the thread itself upon completion -private: - static int32 EntryFunction(void *data); - - status_t fStatus; - thread_id fId; - char fName[B_OS_NAME_LENGTH]; -}; - -#endif // REGISTRAR_THREAD_H diff --git a/headers/build/private/app/RegistrarThreadManager.h b/headers/build/private/app/RegistrarThreadManager.h deleted file mode 100644 index 12382a77e5..0000000000 --- a/headers/build/private/app/RegistrarThreadManager.h +++ /dev/null @@ -1,45 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file RegistrarThreadManager.h - RegistrarThreadManager interface declaration -*/ - -#ifndef REGISTRAR_THREAD_MANAGER_H -#define REGISTRAR_THREAD_MANAGER_H - -#include -#include - -#include - -class RegistrarThread; - -class RegistrarThreadManager : public BHandler { -public: - RegistrarThreadManager(); - ~RegistrarThreadManager(); - - // BHandler virtuals - virtual void MessageReceived(BMessage* message); - - // Thread management functions - status_t LaunchThread(RegistrarThread *thread); - status_t CleanupThreads(); - status_t ShutdownThreads(); - status_t KillThreads(); - - uint ThreadCount() const; - - static const uint kThreadLimit = 12; -private: - - std::list::iterator& RemoveThread(std::list::iterator &i); - - std::list fThreads; - uint fThreadCount; -}; - -#endif // THREAD_MANAGER_H diff --git a/headers/build/private/app/RosterPrivate.h b/headers/build/private/app/RosterPrivate.h deleted file mode 100644 index fcecffbe9f..0000000000 --- a/headers/build/private/app/RosterPrivate.h +++ /dev/null @@ -1,76 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _ROSTER_PRIVATE_H -#define _ROSTER_PRIVATE_H - -#include -#include - -class BRoster::Private { -public: - Private() : fRoster(const_cast(be_roster)) {} - Private(BRoster &roster) : fRoster(&roster) {} - Private(BRoster *roster) : fRoster(roster) {} - - void SetTo(BMessenger mainMessenger, BMessenger mimeMessenger); - - status_t SendTo(BMessage *message, BMessage *reply, bool mime); - bool IsMessengerValid(bool mime) const; - - status_t ShutDown(bool reboot, bool confirm, bool synchronous) - { return fRoster->ShutDown(reboot, confirm, synchronous); } - - // needed by BApplication - - status_t AddApplication(const char *mimeSig, const entry_ref *ref, - uint32 flags, team_id team, thread_id thread, - port_id port, bool fullReg, uint32 *token, - team_id *otherTeam) const - { return fRoster->AddApplication(mimeSig, ref, flags, team, thread, - port, fullReg, token, otherTeam); } - - status_t SetSignature(team_id team, const char *mimeSig) const - { return fRoster->SetSignature(team, mimeSig); } - - status_t CompleteRegistration(team_id team, thread_id thread, - port_id port) const - { return fRoster->CompleteRegistration(team, thread, port); } - - bool IsAppPreRegistered(const entry_ref *ref, team_id team, - app_info *info) const - { return fRoster->IsAppPreRegistered(ref, team, info); } - - status_t RemoveApp(team_id team) const - { return fRoster->RemoveApp(team); } - - // needed by GetRecentTester - - void AddToRecentApps(const char *appSig) const - { fRoster->AddToRecentApps(appSig); } - - void ClearRecentDocuments() const - { fRoster->ClearRecentDocuments(); } - - void ClearRecentFolders() const - { fRoster->ClearRecentFolders(); } - - void ClearRecentApps() const - { fRoster->ClearRecentApps(); } - - void LoadRecentLists(const char *file) const - { fRoster->LoadRecentLists(file); } - - void SaveRecentLists(const char *file) const - { fRoster->SaveRecentLists(file); } - - static void InitBeRoster(); - static void DeleteBeRoster(); - -private: - BRoster *fRoster; -}; - -#endif // _ROSTER_PRIVATE_H diff --git a/headers/build/private/app/Server.h b/headers/build/private/app/Server.h deleted file mode 100644 index dcd9ced094..0000000000 --- a/headers/build/private/app/Server.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Ingo Weinhold - */ -#ifndef _SERVER_H -#define _SERVER_H - -#include - -class BServer : public BApplication { -public: - BServer(const char* signature, bool initGUI, status_t *error); - - status_t InitGUIContext(); - -private: - bool fGUIContextInitialized; -}; - -#endif // _SERVER_H diff --git a/headers/build/private/app/ServerMemIO.h b/headers/build/private/app/ServerMemIO.h deleted file mode 100644 index b31060cc34..0000000000 --- a/headers/build/private/app/ServerMemIO.h +++ /dev/null @@ -1,68 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: DataIO.cpp -// Author(s): Ingo Weinhold (bonefish@users.sf.net) -// Stefano Ceccherini (burton666@libero.it) -// The Storage Team -// Description: Pure virtual BDataIO and BPositionIO classes provide -// the protocol for Read()/Write()/Seek(). -// -// BMallocIO and ServerMemIO classes implement the protocol, -// as does BFile in the Storage Kit. -//------------------------------------------------------------------------------ -#ifndef _SERVERMEM_IO_H -#define _SERVERMEM_IO_H - -#include -#include -#include - -class ServerMemIO : public BPositionIO -{ -public: - ServerMemIO(size_t size); - virtual ~ServerMemIO(); - - virtual ssize_t ReadAt(off_t position, void *buffer, size_t size); - virtual ssize_t WriteAt(off_t position, const void *buffer, size_t size); - - virtual off_t Seek(off_t position, uint32 seekMode); - virtual off_t Position() const; - - virtual status_t SetSize(off_t size); - size_t GetSize(void) const; - - void *GetPointer(void) const; - -private: - ServerMemIO(const ServerMemIO &); - ServerMemIO &operator=(const ServerMemIO &); - - char *fBuf; - size_t fLen; - size_t fPhys; - size_t fPos; - size_t fOffset; - area_id fArea, fSourceArea; -}; - -#endif diff --git a/headers/build/private/app/ServerProtocol.h b/headers/build/private/app/ServerProtocol.h deleted file mode 100644 index 76c263a8ba..0000000000 --- a/headers/build/private/app/ServerProtocol.h +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright 2001-2007, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Jérôme Duval, jerome.duval@free.fr - */ -#ifndef _APPSERVER_PROTOCOL_ -#define _APPSERVER_PROTOCOL_ - - -#include - - -// Server port names. The input port is the port which is used to receive -// input messages from the Input Server. The other is the "main" port for -// the server and is utilized mostly by BApplication objects. -#define SERVER_PORT_NAME "OBappserver" -#define SERVER_INPUT_PORT "OBinputport" - -enum { - // Used for quick replies from the app_server - SERVER_TRUE = B_OK, - SERVER_FALSE = B_ERROR, - - AS_SERVER_BMESSAGE = 1, - AS_SERVER_AREALINK, - AS_SERVER_SESSION, - AS_SERVER_PORTLINK, - AS_CLIENT_DEAD, - AS_GET_DESKTOP, - - // Desktop definitions - AS_GET_WINDOW_LIST, - AS_GET_WINDOW_INFO, - - // Application definitions - AS_CREATE_APP, - AS_DELETE_APP, - AS_QUIT_APP, - AS_ACTIVATE_APP, - - AS_SET_SERVER_PORT, - - AS_CREATE_WINDOW, - AS_CREATE_OFFSCREEN_WINDOW, - AS_DELETE_WINDOW, - AS_CREATE_BITMAP, - AS_DELETE_BITMAP, - - AS_ACQUIRE_SERVERMEM, - AS_RELEASE_SERVERMEM, - AS_AREA_MESSAGE, - - // Cursor definitions - AS_SET_CURSOR_DATA, - AS_SET_CURSOR_BCURSOR, - AS_SET_CURSOR_BBITMAP, - AS_SET_CURSOR_SYSTEM, - - AS_SET_SYSCURSOR_DATA, - AS_SET_SYSCURSOR_BCURSOR, - AS_SET_SYSCURSOR_BBITMAP, - AS_SET_SYSCURSOR_DEFAULTS, - AS_GET_SYSCURSOR, - - AS_SHOW_CURSOR, - AS_HIDE_CURSOR, - AS_OBSCURE_CURSOR, - AS_QUERY_CURSOR_HIDDEN, - - AS_CREATE_BCURSOR, - AS_DELETE_BCURSOR, - - AS_BEGIN_RECT_TRACKING, - AS_END_RECT_TRACKING, - - // Window definitions - AS_SHOW_WINDOW, - AS_HIDE_WINDOW, - AS_QUIT_WINDOW, - AS_SEND_BEHIND, - AS_SET_LOOK, - AS_SET_FEEL, - AS_SET_FLAGS, - AS_DISABLE_UPDATES, - AS_ENABLE_UPDATES, - AS_BEGIN_UPDATE, - AS_END_UPDATE, - AS_NEEDS_UPDATE, - AS_SET_WINDOW_TITLE, - AS_ADD_TO_SUBSET, - AS_REM_FROM_SUBSET, - AS_SET_ALIGNMENT, - AS_GET_ALIGNMENT, - AS_GET_WORKSPACES, - AS_SET_WORKSPACES, - AS_WINDOW_RESIZE, - AS_WINDOW_MOVE, - AS_SET_SIZE_LIMITS, - AS_ACTIVATE_WINDOW, - AS_WINDOW_MINIMIZE, - AS_UPDATE_IF_NEEDED, - _ALL_UPDATED_, // this should be moved in place of _UPDATE_IF_NEEDED_ in AppDefs.h - - // BPicture definitions - AS_CREATE_PICTURE, - AS_DELETE_PICTURE, - AS_CLONE_PICTURE, - AS_DOWNLOAD_PICTURE, - - // Font-related server communications - AS_SET_SYSTEM_FONT, - AS_QUERY_FONTS_CHANGED, - AS_UPDATED_CLIENT_FONTLIST, - AS_GET_FAMILY_NAME, - AS_GET_STYLE_NAME, - AS_GET_FAMILY_AND_STYLE, - AS_GET_FONT_DIRECTION, - AS_GET_FONT_BOUNDING_BOX, - AS_GET_TUNED_COUNT, - AS_GET_TUNED_INFO, - AS_GET_FONT_HEIGHT, - - AS_QUERY_FONT_FIXED, - AS_SET_FAMILY_NAME, - AS_SET_FAMILY_AND_STYLE, - AS_SET_FAMILY_AND_STYLE_FROM_ID, - AS_SET_FAMILY_AND_FACE, - - AS_COUNT_FONT_FAMILIES, - AS_COUNT_FONT_STYLES, - - AS_GET_STRING_WIDTHS, - AS_GET_EDGES, - AS_GET_ESCAPEMENTS, - AS_GET_ESCAPEMENTS_AS_FLOATS, - AS_GET_BOUNDINGBOXES_CHARS, - AS_GET_BOUNDINGBOXES_STRINGS, - AS_GET_HAS_GLYPHS, - AS_GET_GLYPH_SHAPES, - AS_GET_TRUNCATED_STRINGS, - - AS_SET_SYSFONT_PLAIN, - AS_SET_SYSFONT_BOLD, - AS_SET_SYSFONT_FIXED, - - // Screen methods - AS_SCREEN_GET_MODE, - AS_SCREEN_SET_MODE, - AS_PROPOSE_MODE, - AS_GET_MODE_LIST, - - AS_GET_PIXEL_CLOCK_LIMITS, - AS_GET_TIMING_CONSTRAINTS, - - AS_SCREEN_GET_COLORMAP, - AS_GET_DESKTOP_COLOR, - AS_SET_DESKTOP_COLOR, - - AS_READ_BITMAP, - - AS_GET_RETRACE_SEMAPHORE, - AS_GET_ACCELERANT_INFO, - - AS_SET_DPMS, - AS_GET_DPMS_STATE, - AS_GET_DPMS_CAPABILITIES, - - // Global function call defs - AS_SET_UI_COLORS, - AS_GET_UI_COLORS, - AS_GET_UI_COLOR, - AS_SET_DECORATOR, - AS_GET_DECORATOR, - AS_R5_SET_DECORATOR, - AS_COUNT_DECORATORS, - AS_GET_DECORATOR_NAME, - - AS_COUNT_WORKSPACES, - AS_SET_WORKSPACE_COUNT, - AS_CURRENT_WORKSPACE, - AS_ACTIVATE_WORKSPACE, - AS_GET_SCROLLBAR_INFO, - AS_SET_SCROLLBAR_INFO, - AS_GET_MENU_INFO, - AS_SET_MENU_INFO, - AS_IDLE_TIME, - AS_SELECT_PRINTER_PANEL, - AS_ADD_PRINTER_PANEL, - AS_RUN_BE_ABOUT, - AS_SET_MOUSE_MODE, - AS_GET_MOUSE_MODE, - - // Hook function messages - AS_WORKSPACE_ACTIVATED, - AS_WORKSPACES_CHANGED, - AS_WINDOW_ACTIVATED, - AS_SCREENMODE_CHANGED, - - // Graphics calls - // Are these TRANSACTION codes needed ? - AS_BEGIN_TRANSACTION, - AS_END_TRANSACTION, - AS_SET_HIGH_COLOR, - AS_SET_LOW_COLOR, - AS_SET_VIEW_COLOR, - - AS_STROKE_ARC, - AS_STROKE_BEZIER, - AS_STROKE_ELLIPSE, - AS_STROKE_LINE, - AS_STROKE_LINEARRAY, - AS_STROKE_POLYGON, - AS_STROKE_RECT, - AS_STROKE_ROUNDRECT, - AS_STROKE_SHAPE, - AS_STROKE_TRIANGLE, - - AS_FILL_ARC, - AS_FILL_ARC_GRADIENT, - AS_FILL_BEZIER, - AS_FILL_BEZIER_GRADIENT, - AS_FILL_ELLIPSE, - AS_FILL_ELLIPSE_GRADIENT, - AS_FILL_POLYGON, - AS_FILL_POLYGON_GRADIENT, - AS_FILL_RECT, - AS_FILL_RECT_GRADIENT, - AS_FILL_REGION, - AS_FILL_REGION_GRADIENT, - AS_FILL_ROUNDRECT, - AS_FILL_ROUNDRECT_GRADIENT, - AS_FILL_SHAPE, - AS_FILL_SHAPE_GRADIENT, - AS_FILL_TRIANGLE, - AS_FILL_TRIANGLE_GRADIENT, - - AS_MOVEPENBY, - AS_MOVEPENTO, - AS_SETPENSIZE, - AS_DRAW_STRING, - AS_SET_FONT, - AS_SET_FONT_SIZE, - - AS_FLUSH, - AS_SYNC, - - AS_LAYER_CREATE, - AS_LAYER_DELETE, - AS_LAYER_CREATE_ROOT, - AS_LAYER_DELETE_ROOT, - AS_LAYER_ADD_CHILD, - AS_LAYER_REMOVE_CHILD, - AS_LAYER_REMOVE_SELF, - AS_LAYER_SHOW, - AS_LAYER_HIDE, - AS_LAYER_MOVE, - AS_LAYER_RESIZE, - AS_LAYER_INVALIDATE, - AS_LAYER_DRAW, - - AS_LAYER_GET_TOKEN, - AS_LAYER_ADD, - AS_LAYER_REMOVE, - - // View/Layer definitions - AS_LAYER_GET_COORD, - AS_LAYER_SET_FLAGS, - AS_LAYER_SET_ORIGIN, - AS_LAYER_GET_ORIGIN, - AS_LAYER_RESIZE_MODE, - AS_LAYER_CURSOR, - AS_LAYER_BEGIN_RECT_TRACK, - AS_LAYER_END_RECT_TRACK, - AS_LAYER_DRAG_RECT, - AS_LAYER_DRAG_IMAGE, - AS_LAYER_GET_MOUSE_COORDS, - AS_LAYER_SCROLL, - AS_LAYER_SET_LINE_MODE, - AS_LAYER_GET_LINE_MODE, - AS_LAYER_PUSH_STATE, - AS_LAYER_POP_STATE, - AS_LAYER_SET_SCALE, - AS_LAYER_GET_SCALE, - AS_LAYER_SET_DRAW_MODE, - AS_LAYER_GET_DRAW_MODE, - AS_LAYER_SET_BLEND_MODE, - AS_LAYER_GET_BLEND_MODE, - AS_LAYER_SET_PEN_LOC, - AS_LAYER_GET_PEN_LOC, - AS_LAYER_SET_PEN_SIZE, - AS_LAYER_GET_PEN_SIZE, - AS_LAYER_SET_HIGH_COLOR, - AS_LAYER_SET_LOW_COLOR, - AS_LAYER_SET_VIEW_COLOR, - AS_LAYER_GET_HIGH_COLOR, - AS_LAYER_GET_LOW_COLOR, - AS_LAYER_GET_VIEW_COLOR, - AS_LAYER_PRINT_ALIASING, - AS_LAYER_CLIP_TO_PICTURE, - AS_LAYER_GET_CLIP_REGION, - AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT, - AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT, - AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT, - AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT, - AS_LAYER_SET_EVENT_MASK, - AS_LAYER_SET_MOUSE_EVENT_MASK, - - AS_LAYER_DRAW_STRING, - AS_LAYER_SET_CLIP_REGION, - AS_LAYER_LINE_ARRAY, - AS_LAYER_BEGIN_PICTURE, - AS_LAYER_APPEND_TO_PICTURE, - AS_LAYER_END_PICTURE, - AS_LAYER_COPY_BITS, - AS_LAYER_DRAW_PICTURE, - AS_LAYER_INVAL_RECT, - AS_LAYER_INVAL_REGION, - AS_LAYER_INVERT_RECT, - AS_LAYER_MOVE_TO, - AS_LAYER_RESIZE_TO, - AS_LAYER_SET_STATE, - AS_LAYER_SET_FONT_STATE, - AS_LAYER_GET_STATE, - AS_LAYER_SET_VIEW_IMAGE, - AS_LAYER_SET_PATTERN, - AS_SET_CURRENT_LAYER, - - // BDirectWindow codes - AS_DW_GET_SYNC_DATA, - AS_DW_SUPPORTS_WINDOW_MODE, - AS_DW_SET_FULLSCREEN, - - // TODO: Move these elsewhere. They don't need to - // be shared with libbe - // app_server internal communication - AS_ROOTLAYER_SHOW_WINBORDER, - AS_ROOTLAYER_HIDE_WINBORDER, - AS_ROOTLAYER_DO_INVALIDATE, - AS_ROOTLAYER_DO_REDRAW, - AS_ROOTLAYER_LAYER_MOVE, - AS_ROOTLAYER_LAYER_RESIZE, - AS_ROOTLAYER_LAYER_SCROLL, - AS_ROOTLAYER_LAYER_COPYBITS, - AS_ROOTLAYER_ADD_TO_SUBSET, - AS_ROOTLAYER_REMOVE_FROM_SUBSET, - AS_ROOTLAYER_WINBORDER_SET_WORKSPACES, - AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL -}; - -#define AS_PATTERN_SIZE 8 -#define AS_SET_COLOR_MSG_SIZE 8+4 -#define AS_STROKE_ARC_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE -#define AS_STROKE_BEZIER_MSG_SIZE 8+8*sizeof(float)+AS_PATTERN_SIZE -#define AS_STROKE_ELLIPSE_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE -#define AS_STROKE_LINE_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE -#define AS_STROKE_RECT_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE -#define AS_STROKE_ROUNDRECT_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE -#define AS_STROKE_TRIANGLE_MSG_SIZE 8+10*sizeof(float)+AS_PATTERN_SIZE -#define AS_FILL_ARC_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE -#define AS_FILL_BEZIER_MSG_SIZE 8+8*sizeof(float)+AS_PATTERN_SIZE -#define AS_FILL_ELLIPSE_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE -#define AS_FILL_RECT_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE -#define AS_FILL_ROUNDRECT_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE -#define AS_FILL_TRIANGLE_MSG_SIZE 8+10*sizeof(float)+AS_PATTERN_SIZE - -#endif diff --git a/headers/build/private/app/Session.h b/headers/build/private/app/Session.h deleted file mode 100644 index 1eb7d057e9..0000000000 --- a/headers/build/private/app/Session.h +++ /dev/null @@ -1,112 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: Session.h -// Author: Adi Oanca -// Description: Stream-based messaging class -// -//------------------------------------------------------------------------------ -#ifndef _SESSION_H -#define _SESSION_H - -#include -#include -#include -#include -#include -#include - -#define SESSION_BUFFER_SIZE 1024 - -class BSession -{ -public: - BSession(port_id receivePort, port_id sendPort); - BSession(int32, char *); - BSession( const BSession &ses ); - virtual ~BSession(void); - void SetSendPort( port_id port ); - void SetRecvPort( port_id port ); - port_id GetSendPort(void) const { return fSendPort; } - port_id GetRecvPort(void) const { return fReceivePort; } - - char *ReadString(); - void ReadBool( bool *b ); - void ReadInt8( int8 *i ); - void ReadUInt8( uint8 *i ); - void ReadInt16( int16 *i ); - void ReadUInt16( uint16 *i ); - void ReadInt32( int32 *i ); - void ReadUInt32( uint32 *i ); - void ReadInt64( int64 *i ); - void ReadUInt64( uint64 *i ); - void ReadFloat( float *f ); - void ReadFloatFromInt32( float *f ); - void ReadDouble( double *d ); - void ReadDoubleFromInt64( double *d ); - void ReadPoint( BPoint *point ); - void ReadPointFromInts( BPoint *point ); - void ReadRectCR( clipping_rect *rect ); - void ReadRect( BRect *rect ); - void ReadRectFromInts( BRect *rect ); - void ReadData( void* data, int32 size ); - - void WriteString( const char* string ); - void WriteBool( const bool& b ); - void WriteInt8( const int8& i ); - void WriteUInt8( const uint8& i ); - void WriteInt16( const int16& i ); - void WriteUInt16( const uint16& i ); - void WriteInt32( const int32& i ); - void WriteUInt32( const uint32& i ); - void WriteInt64( const int64& i ); - void WriteUInt64( const uint64& i ); - void WriteFloat(const float& f ); - void WriteFloatAsInt32( const float& f ); - void WriteDouble( const double& d ); - void WriteDoubleAsInt64( const double& d ); - void WritePoint(const BPoint& point); - void WritePointAsInt32s(const BPoint& point); - void WriteRect(const clipping_rect& rect); - void WriteRect(const BRect& rect); - void WriteRectAsInt32s(const BRect& rect); - void WriteData(const void* data, int32 size); - - void Sync(); - - // Deprecated. Do not use. - void CopyToSendBuffer(void* buffer, int32 count); - -private: - port_id fSendPort; - port_id fReceivePort; - - char *fSendBuffer; - int32 fSendPosition; - int32 fRecvCode; - - char *fReceiveBuffer; - int32 fReceiveSize; - int32 fReceivePosition; -}; - - -#endif diff --git a/headers/build/private/app/SimpleMallocIO.h b/headers/build/private/app/SimpleMallocIO.h deleted file mode 100644 index 08186654d4..0000000000 --- a/headers/build/private/app/SimpleMallocIO.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Michael Lotz - */ - -/* A BMallocIO similar structure but with less overhead */ - -#ifndef _SIMPLE_MALLOC_IO_H_ -#define _SIMPLE_MALLOC_IO_H_ - -#include - -namespace BPrivate { - -class BSimpleMallocIO { -public: - BSimpleMallocIO(size_t size) - : fSize(size) - { - fBuffer = (char *)malloc(size); - } - - ~BSimpleMallocIO() - { - free(fBuffer); - } - - void Read(void *buffer) - { - memcpy(buffer, fBuffer, fSize); - } - - void Read(void *buffer, size_t size) - { - memcpy(buffer, fBuffer, size); - } - - void ReadAt(off_t pos, void *buffer, size_t size) - { - memcpy(buffer, fBuffer + pos, size); - } - - void Write(const void *buffer) - { - memcpy(fBuffer, buffer, fSize); - } - - void Write(const void *buffer, size_t size) - { - memcpy(fBuffer, buffer, size); - } - - void WriteAt(off_t pos, const void *buffer, size_t size) - { - memcpy(fBuffer + pos, buffer, size); - } - - status_t SetSize(off_t size) - { - fBuffer = (char *)realloc(fBuffer, size); - if (!fBuffer) - return B_NO_MEMORY; - - fSize = size; - return B_OK; - } - - char *Buffer() - { - return fBuffer; - } - - size_t BufferLength() - { - return fSize; - } - -private: - char *fBuffer; - size_t fSize; -}; - -} // namespace BPivate - -#endif // _SIMPLE_MALLOC_IO_H_ diff --git a/headers/build/private/interface/BMCPrivate.h b/headers/build/private/interface/BMCPrivate.h deleted file mode 100644 index d804c4407c..0000000000 --- a/headers/build/private/interface/BMCPrivate.h +++ /dev/null @@ -1,110 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: BMCPrivate.h -// Author: Marc Flerackers (mflerackers@androme.be) -// Description: The BMCPrivate classes are used by BMenuField. -//------------------------------------------------------------------------------ - -#ifndef _BMC_PRIVATE_H -#define _BMC_PRIVATE_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include -#include -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -//------------------------------------------------------------------------------ -class _BMCItem_ : public BMenuItem { - -public: - _BMCItem_(BMenu *menu); - _BMCItem_(BMessage *message); -virtual ~_BMCItem_(); - -static BArchivable *Instantiate(BMessage *data); - - void Draw(); - void GetContentSize(float *width, float *height); - -private: -friend class BMenuField; - - bool fShowPopUpMarker; -}; -//------------------------------------------------------------------------------ - -/*//------------------------------------------------------------------------------ -_BMCFilter_::_BMCFilter_(BMenuField *menuField, uint32) -{ -} -//------------------------------------------------------------------------------ -_BMCFilter_::~_BMCFilter_() -{ -} -//------------------------------------------------------------------------------ -filter_result _BMCFilter_::Filter(BMessage *message, BHandler **handler) -{ -} -//------------------------------------------------------------------------------ -_BMCFilter_ &_BMCFilter_::operator=(const _BMCFilter_ &) -{ - return *this; -} -//------------------------------------------------------------------------------*/ - -//------------------------------------------------------------------------------ -class _BMCMenuBar_ : public BMenuBar { - -public: - _BMCMenuBar_(BRect frame, bool fixed_size, - BMenuField *menuField); - _BMCMenuBar_(BMessage *data); -virtual ~_BMCMenuBar_(); - -static BArchivable *Instantiate(BMessage *data); - -virtual void AttachedToWindow(); -virtual void Draw(BRect updateRect); -virtual void FrameResized(float width, float height); -virtual void MessageReceived(BMessage* msg); -virtual void MakeFocus(bool focused = true); - -private: - _BMCMenuBar_&operator=(const _BMCMenuBar_ &); - - BMenuField *fMenuField; - bool fFixedSize; - BMessageRunner *fRunner; -}; -//------------------------------------------------------------------------------ - -#endif // _BMC_PRIVATE_H diff --git a/headers/build/private/interface/ClientFontList.h b/headers/build/private/interface/ClientFontList.h deleted file mode 100644 index 4274e6a8a1..0000000000 --- a/headers/build/private/interface/ClientFontList.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CLIENT_FONT_LIST_H -#define CLIENT_FONT_LIST_H - -#include // for BFont-related definitions - -#include -#include -#include - -class ClientFontList -{ -public: - ClientFontList(void); - ~ClientFontList(void); - bool Update(bool check_only); - int32 CountFamilies(void); - status_t GetFamily(int32 index, font_family *name, uint32 *flags=NULL); - int32 CountStyles(font_family f); - status_t GetStyle(font_family family, int32 index, font_style *name,uint32 *flags=NULL, uint16 *face=NULL); -private: - BList *familylist; - sem_id fontlock; -}; - -#endif diff --git a/headers/build/private/interface/ColorTools.h b/headers/build/private/interface/ColorTools.h deleted file mode 100644 index 64fe4582ed..0000000000 --- a/headers/build/private/interface/ColorTools.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -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. -*/ - -/******************************************************************************* -/ -/ File: ColorTools.h -/ -/ Description: Additional experimental color manipulation functions. -/ -/ Copyright 2000, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - - -#ifndef _COLOR_TOOLS_H -#define _COLOR_TOOLS_H - -#include - -#if B_BEOS_VERSION <= B_BEOS_VERSION_5 - -namespace BExperimental { - -// Comparison operators. - -inline bool operator==(const rgb_color c1, const rgb_color c2) -{ - return (*((uint32*)&c1)) == (*((uint32*)&c2)); -} - -inline bool operator!=(const rgb_color c1, const rgb_color c2) -{ - return (*((uint32*)&c1)) != (*((uint32*)&c2)); -} - -// Color creation. - -inline rgb_color make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha=255) -{ - rgb_color c; - c.red = red; - c.green = green; - c.blue = blue; - c.alpha = alpha; - return c; -} - -// Mix two colors together, ignoring their relative alpha channels. -// If amount is 0, the result is color1; if 255, the result is color2; -// if another value, it is somewhere in-between. The resulting alpha -// channel is mixed exactly like the other color channels. -rgb_color mix_color(rgb_color color1, rgb_color color2, uint8 amount); - -// Blend two colors together, weighting by their relative alpha channels. -// The resulting color is the same as mix_color(), except that the amount -// used from color1 and color2's color channels is dependent on that color's -// alpha channel. For example, if color1.alpha is 0 and color2.alpha is -// 255, the resulting red, green, and blue values will be the same as those -// in color2, regardless of 'amount'. -rgb_color blend_color(rgb_color color1, rgb_color color2, uint8 amount); - -// Return a color that is the disabled representation of 'color' when drawn -// on a solid color 'background'. -rgb_color disable_color(rgb_color color, rgb_color background); - -} // namespace BExperimental - -using namespace BExperimental; - -#endif - -#endif diff --git a/headers/build/private/interface/ColumnListView.h b/headers/build/private/interface/ColumnListView.h deleted file mode 100644 index 56aaf54542..0000000000 --- a/headers/build/private/interface/ColumnListView.h +++ /dev/null @@ -1,366 +0,0 @@ -/* -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. -*/ - -/******************************************************************************* -/ -/ File: ColumnListView.h -/ -/ Description: Experimental multi-column list view. -/ -/ Copyright 2000+, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - - -#ifndef _COLUMN_LIST_VIEW_H -#define _COLUMN_LIST_VIEW_H - -#include -#include -#include -#include -#include - -class BScrollBar; - -namespace BPrivate { - -class OutlineView; -class TitleView; -class BRowContainer; -class RecursiveOutlineIterator; - -} // ns BPrivate - -class BField; -class BRow; -class BColumn; -class BColumnListView; - -enum LatchType { - B_NO_LATCH, - B_OPEN_LATCH, - B_PRESSED_LATCH, - B_CLOSED_LATCH -}; - -typedef enum { - B_ALLOW_COLUMN_NONE = 0, - B_ALLOW_COLUMN_MOVE = 1, - B_ALLOW_COLUMN_RESIZE = 2, - B_ALLOW_COLUMN_POPUP = 4, - B_ALLOW_COLUMN_REMOVE = 8, -} column_flags; - -enum ColumnListViewColor { - B_COLOR_BACKGROUND = 0, - B_COLOR_TEXT = 1, - B_COLOR_ROW_DIVIDER = 2, - B_COLOR_SELECTION = 3, - B_COLOR_SELECTION_TEXT = 4, - B_COLOR_NON_FOCUS_SELECTION = 5, - B_COLOR_EDIT_BACKGROUND = 6, - B_COLOR_EDIT_TEXT = 7, - B_COLOR_HEADER_BACKGROUND = 8, - B_COLOR_HEADER_TEXT = 9, - B_COLOR_SEPARATOR_LINE = 10, - B_COLOR_SEPARATOR_BORDER = 11, - - B_COLOR_TOTAL = 12 -}; - -enum ColumnListViewFont { - B_FONT_ROW = 0, - B_FONT_HEADER = 1, - - B_FONT_TOTAL = 2 -}; - - -// A single row/column intersection in the list. -class BField { -public: - BField(); - virtual ~BField(); -}; - -// A single line in the list. Each line contains a BField object -// for each column in the list, associated by their "logical field" -// index. Hierarchies are formed by adding other BRow objects as -// a parent of a row, using the AddRow() function in BColumnListView(). -class BRow { -public: - BRow(float height = 16.0); - virtual ~BRow(); - virtual bool HasLatch() const; - - int32 CountFields() const; - BField* GetField(int32 logicalFieldIndex); - const BField* GetField(int32 logicalFieldIndex) const; - void SetField(BField* field, int32 logicalFieldIndex); - - float Height() const; - bool IsExpanded() const; - -private: - // Blows up into the debugger if the validation fails. - void ValidateFields() const; - void ValidateField(const BField *field, int32 logicalFieldIndex) const; -private: - BList fFields; - BPrivate:: - BRowContainer* fChildList; - bool fIsExpanded; - float fHeight; - BRow* fNextSelected; - BRow* fPrevSelected; - BRow* fParent; - BColumnListView* fList; - - - friend class BColumnListView; - friend class BPrivate::RecursiveOutlineIterator; - friend class BPrivate::OutlineView; -}; - -// Information about a single column in the list. A column knows -// how to display the BField objects that occur at its location in -// each of the list's rows. See ColumnTypes.h for particular -// subclasses of BField and BColumn that handle common data types. -class BColumn -{ -public: - BColumn(float width, - float minWidth, - float maxWidth, - alignment align = B_ALIGN_LEFT); - virtual ~BColumn(); - - float Width() const; - void SetWidth(float width); - float MinWidth() const; - float MaxWidth() const; - - virtual void DrawTitle(BRect rect, BView *targetView); - virtual void DrawField(BField *field, BRect rect, BView *targetView); - virtual int CompareFields(BField *field1, BField *field2); - - virtual void MouseMoved(BColumnListView *parent, BRow *row, BField *field, - BRect field_rect, BPoint point, uint32 buttons, int32 code); - virtual void MouseDown(BColumnListView *parent, BRow *row, BField *field, - BRect field_rect, BPoint point, uint32 buttons); - virtual void MouseUp(BColumnListView *parent, BRow *row, BField *field); - - virtual void GetColumnName(BString* into) const; - - bool IsVisible() const; - void SetVisible(bool); - - bool WantsEvents() const; - void SetWantsEvents(bool); - - bool ShowHeading() const; - void SetShowHeading(bool); - - alignment Alignment() const; - void SetAlignment(alignment); - - int32 LogicalFieldNum() const; - - /*! - \param field The BField derivative to validate. - - Implement this function on your BColumn derivatives to validate BField derivatives - that your BColumn will be drawing/manipulating. - - This function will be called when BFields are added to the Column, use dynamic_cast<> to - determine if it is of a kind that your BColumn know how ot handle. return false if it is not. - - \note The debugger will be called if you return false from here with information about - what type of BField and BColumn and the logical field index where it occured. - - \note Do not call the inherited version of this, it just returns true; - */ - virtual bool AcceptsField(const BField* field) const; - -private: - float fWidth; - float fMinWidth; - float fMaxWidth; - bool fVisible; - int32 fFieldID; - BColumnListView *fList; - bool fSortAscending; - bool fWantsEvents; - bool fShowHeading; - alignment fAlignment; - - friend class BPrivate::OutlineView; - friend class BColumnListView; - friend class BPrivate::TitleView; -}; - -// The column list view class. -class BColumnListView : public BView, public BInvoker -{ -public: - BColumnListView(BRect rect, - const char *name, - uint32 resizingMode, - uint32 drawFlags, - border_style = B_NO_BORDER, - bool showHorizontalScrollbar = true); - virtual ~BColumnListView(); - - // Interaction - virtual bool InitiateDrag(BPoint, bool wasSelected); - virtual void MessageDropped(BMessage*, BPoint point); - virtual void ExpandOrCollapse(BRow *row, bool expand); - virtual status_t Invoke(BMessage *message = NULL); - virtual void ItemInvoked(); - virtual void SetInvocationMessage(BMessage*); - BMessage* InvocationMessage() const; - uint32 InvocationCommand() const; - BRow* FocusRow() const; - void SetFocusRow(int32 index, bool select=false); - void SetFocusRow(BRow *row, bool select=false); - void SetMouseTrackingEnabled(bool); - - // Selection - list_view_type SelectionMode() const; - void Deselect(BRow *row); - void AddToSelection(BRow *row); - void DeselectAll(); - BRow* CurrentSelection(BRow *lastSelected = 0) const; - virtual void SelectionChanged(); - virtual void SetSelectionMessage(BMessage *); - BMessage* SelectionMessage(); - uint32 SelectionCommand() const; - void SetSelectionMode(list_view_type); // list_view_type is defined in ListView.h. - - // Sorting - void SetSortingEnabled(bool); - bool SortingEnabled() const; - void SetSortColumn(BColumn *column, bool add, bool ascending); - void ClearSortColumns(); - - // The status view is a little area in the lower left hand corner. - void AddStatusView(BView *view); - BView* RemoveStatusView(); - - // Column Manipulation - void AddColumn(BColumn*, int32 logicalFieldIndex); - void MoveColumn(BColumn*, int32 index); - void RemoveColumn(BColumn*); - int32 CountColumns() const; - BColumn* ColumnAt(int32 index) const; - void SetColumnVisible(BColumn*, bool isVisible); - void SetColumnVisible(int32, bool); - bool IsColumnVisible(int32) const; - void SetColumnFlags(column_flags flags); - - // Row manipulation - const BRow* RowAt(int32 index, BRow *parent = 0) const; - BRow* RowAt(int32 index, BRow *parent = 0); - const BRow* RowAt(BPoint) const; - BRow* RowAt(BPoint); - bool GetRowRect(const BRow *row, BRect *outRect) const; - bool FindParent(BRow *row, BRow **outs_parent, bool *out_isVisible) const; - int32 IndexOf(BRow *row); - int32 CountRows(BRow *parent = 0) const; - void AddRow(BRow*, BRow *parent = 0); - void AddRow(BRow*, int32 index, BRow *parent = 0); - - void ScrollTo(const BRow* Row); - - // Does not delete row or children at this time. - // todo: Make delete row and children - void RemoveRow(BRow*); - - void UpdateRow(BRow*); - void Clear(); - - // Appearance (DEPRECATED) - void GetFont(BFont* font) const {BView::GetFont(font);} - virtual void SetFont(const BFont *font, uint32 mask = B_FONT_ALL); - virtual void SetHighColor(rgb_color); - void SetSelectionColor(rgb_color); - void SetBackgroundColor(rgb_color); - void SetEditColor(rgb_color); - const rgb_color SelectionColor() const; - const rgb_color BackgroundColor() const; - const rgb_color EditColor() const; - - // Appearance (NEW STYLE) - void SetColor(ColumnListViewColor color_num, rgb_color color); - void SetFont(ColumnListViewFont font_num, const BFont* font, uint32 mask = B_FONT_ALL); - rgb_color Color(ColumnListViewColor color_num) const; - void GetFont(ColumnListViewFont font_num, BFont* font) const; - - BPoint SuggestTextPosition(const BRow* row, const BColumn* column=NULL) const; - - void SetLatchWidth(float width); - float LatchWidth() const; - virtual void DrawLatch(BView*, BRect, LatchType, BRow*); - virtual void MakeFocus(bool isfocus = true); - void SaveState(BMessage *msg); - void LoadState(BMessage *msg); - - BView* ScrollView() const { return (BView *)fOutlineView; } - void SetEditMode(bool state); - void Refresh(); - -protected: - virtual void MessageReceived(BMessage *message); - virtual void KeyDown(const char *bytes, int32 numBytes); - virtual void AttachedToWindow(); - virtual void WindowActivated(bool active); - virtual void Draw(BRect); - -private: - rgb_color fColorList[B_COLOR_TOTAL]; - BPrivate::TitleView* fTitleView; - BPrivate::OutlineView* fOutlineView; - BList fColumns; - BScrollBar* fHorizontalScrollBar; - BScrollBar* fVerticalScrollBar; - BList fSortColumns; - BView* fStatusView; - BMessage* fSelectionMessage; - bool fSortingEnabled; - float fLatchWidth; - border_style fBorderStyle; -}; - -#endif diff --git a/headers/build/private/interface/MenuPrivate.h b/headers/build/private/interface/MenuPrivate.h deleted file mode 100644 index 431f184579..0000000000 --- a/headers/build/private/interface/MenuPrivate.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __MENU_PRIVATE_H -#define __MENU_PRIVATE_H - - -enum menu_actions { - MENU_ACT_NONE = 0, - MENU_ACT_CLOSE = 5 -}; - - - -#endif // __MENU_PRIVATE_H diff --git a/headers/build/private/interface/MenuWindow.h b/headers/build/private/interface/MenuWindow.h deleted file mode 100644 index 2a586f9856..0000000000 --- a/headers/build/private/interface/MenuWindow.h +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2003-2004, Haiku, Inc. -// -// 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: MenuWindow.h -// Authors: Marc Flerackers (mflerackers@androme.be) -// Stefano Ceccherini (burton666@libero.it) -// Description: BMenuWindow is the custom BWindow for menus. -//------------------------------------------------------------------------------ -#ifndef __MENUWINDOW_H -#define __MENUWINDOW_H - -#include - -class BMenu; -class BMenuScroller; - -class BMenuWindow : public BWindow { -public: - BMenuWindow(const char *name); - virtual ~BMenuWindow(); - - void UpdateScrollers(); - -private: - BMenuScroller *fUpperScroller; - BMenuScroller *fLowerScroller; -}; - -#endif diff --git a/headers/build/private/interface/PictureProtocol.h b/headers/build/private/interface/PictureProtocol.h deleted file mode 100644 index bc91224d5c..0000000000 --- a/headers/build/private/interface/PictureProtocol.h +++ /dev/null @@ -1,213 +0,0 @@ -#ifndef _PICTUREPROTOCOL_H -#define _PICTUREPROTOCOL_H - -// BView dirty bits -enum { - B_PEN_SIZE_BIT = 0x00000001, - B_PEN_LOCATION_BIT = 0x00000002, - B_HIGH_COLOR_BIT = 0x00000004, - B_LOW_COLOR_BIT = 0x00000008, - B_DRAW_MODE_BIT = 0x00000010, - B_LINE_MODE_BIT = 0x00000020, - B_ORIGIN_BIT = 0x00000040, - B_FONT_BIT = 0x00000080, - B_PATTERN_BIT = 0x00000100, - B_BLEND_MODE_BIT = 0x00000200 -}; - -// AppServer protocol -enum { - -// Picture instructions - - B_PIC_MOVE_PEN_BY = 0x0010, - B_PIC_STROKE_LINE = 0x0100, - B_PIC_STROKE_RECT = 0x0101, - B_PIC_FILL_RECT = 0x0102, - B_PIC_STROKE_ROUND_RECT = 0x0103, - B_PIC_FILL_ROUND_RECT = 0x0104, - B_PIC_STROKE_BEZIER = 0x0105, - B_PIC_FILL_BEZIER = 0x0106, - B_PIC_STROKE_POLYGON = 0x010B, - B_PIC_FILL_POLYGON = 0x010C, - B_PIC_STROKE_SHAPE = 0x010D, - B_PIC_FILL_SHAPE = 0x010E, - B_PIC_DRAW_STRING = 0x010F, - B_PIC_DRAW_PIXELS = 0x0110, - B_PIC_DRAW_PICTURE = 0x0112, - B_PIC_STROKE_ARC = 0x0113, - B_PIC_FILL_ARC = 0x0114, - B_PIC_STROKE_ELLIPSE = 0x0115, - B_PIC_FILL_ELLIPSE = 0x0116, - B_PIC_ENTER_STATE_CHANGE = 0x0200, - B_PIC_SET_CLIPPING_RECTS = 0x0201, - B_PIC_CLIP_TO_PICTURE = 0x0202, - B_PIC_PUSH_STATE = 0x0203, - B_PIC_POP_STATE = 0x0204, - B_PIC_CLEAR_CLIPPING_RECTS = 0x0205, - B_PIC_SET_ORIGIN = 0x0300, - B_PIC_SET_PEN_LOCATION = 0x0301, - B_PIC_SET_DRAWING_MODE = 0x0302, - B_PIC_SET_LINE_MODE = 0x0303, - B_PIC_SET_PEN_SIZE = 0x0304, - B_PIC_SET_SCALE = 0x0305, - B_PIC_SET_FORE_COLOR = 0x0306, - B_PIC_SET_BACK_COLOR = 0x0307, - B_PIC_SET_STIPLE_PATTERN = 0x0308, - B_PIC_ENTER_FONT_STATE = 0x0309, - B_PIC_SET_BLENDING_MODE = 0x030A, - B_PIC_SET_FONT_FAMILY = 0x0380, - B_PIC_SET_FONT_STYLE = 0x0381, - B_PIC_SET_FONT_SPACING = 0x0382, - B_PIC_SET_FONT_ENCODING = 0x0383, - B_PIC_SET_FONT_FLAGS = 0x0384, - B_PIC_SET_FONT_SIZE = 0x0385, - B_PIC_SET_FONT_ROTATE = 0x0386, - B_PIC_SET_FONT_SHEAR = 0x0387, - B_PIC_SET_FONT_BPP = 0x0388, - B_PIC_SET_FONT_FACE = 0x0389, - -// View instructions - - B_VIEW_CREATE = 0x0500, - B_VIEW_MOVE_BY = 0x0501, -// B_VIEW_MOVE_TO = 0x0502, // ???? - B_VIEW_RESIZE_BY = 0x0503, - B_VIEW_RESIZE_TO = 0x0504, - B_VIEW_DELETE = 0x0505, - B_VIEW_FIND = 0x0506, - B_VIEW_BOUNDS = 0x0507, // ???? - B_VIEW_SET_FLAGS = 0x0508, - B_VIEW_SET_EVENT_MASK = 0x0509, - B_VIEW_SET_MOUSE_EVENT_MASK = 0x050A, - B_VIEW_MOVE_TO = 0x050B, // ???? - B_VIEW_SET_VIEW_CURSOR = 0x050C, - -// Window instructions - -// B_WINDOW_MOVE_BY = 0x0580, -// B_WINDOW_MOVE_TO = 0x0581, - B_WINDOW_RESIZE_BY = 0x0582, - B_WINDOW_RESIZE_TO = 0x0583, - B_WINDOW_ACTIVATE = 0x0584, - B_WINDOW_SET_OWNER = 0x0585, - B_WINDOW_SET_TITLE = 0x0587, - B_WINDOW_IS_FRONT = 0x0589, - B_WINDOW_HIDE = 0x058C, - B_WINDOW_SHOW = 0x058D, - B_WINDOW_SET_SIZE_LIMITS = 0x058E, - B_WINDOW_IS_ACTIVE = 0x058F, -// B_WINDOW_MINIMIZE = 0x0590, // ???? - B_WINDOW_MINIMIZE = 0x0591, - B_WINDOW_SET_FLAGS = 0x0593, - B_WINDOW_SEND_BEHIND = 0x0594, - B_WINDOW_ADD_TO_SUBSET = 0x0595, - B_WINDOW_REMOVE_FROM_SUBSET = 0x0596, - B_WINDOW_SET_WINDOW_ALLIGNMENT = 0x0597, - B_WINDOW_GET_WINDOW_ALLIGNMENT = 0x0598, - B_WINDOW_SET_CURRENT_VIEW = 0x059A, - -// Drawing instructions - - B_MOVE_PEN_TO = 0x0600, - B_MOVE_PEN_BY = 0x0601, - B_STROKE_LINE = 0x0602, - B_STROKE_LINE_TO = 0x0603, - B_STROKE_RECT = 0x0604, - B_FILL_RECT = 0x0605, - B_STROKE_ARC_RECT = 0x0606, - B_FILL_ARC_RECT = 0x0607, - B_STROKE_ARC = 0x0608, - B_FILL_ARC = 0x0609, - B_STROKE_ROUND_RECT = 0x060A, - B_FILL_ROUND_RECT = 0x060B, - B_FILL_REGION = 0x060D, - B_STROKE_POLYGON = 0x060E, - B_FILL_POLYGON = 0x060F, - B_STROKE_BEZIER = 0x0610, - B_FILL_BEZIER = 0x0611, - B_STROKE_ELLIPSE_RECT = 0x0612, - B_FILL_ELLIPSE_RECT = 0x0613, - B_STROKE_ELLIPSE = 0x0614, - B_FILL_ELLIPSE = 0x0615, - B_DRAW_BITMAP = 0x0616, - B_STRETCH_BITMAP = 0x0617, - B_STRETCH_BITMAP_SRC = 0x0618, - B_DRAW_BITMAP_ASYNC = 0x0619, - B_STRETCH_BITMAP_ASYNC = 0x061A, - B_STRETCH_BITMAP_SRC_ASYNC = 0x061B, - B_DRAW_STRING = 0x061C, // ???? - B_COPY_BITS = 0x061D, - B_INVERT_RECT = 0x061E, - B_DRAW_LINES = 0x061F, - B_DRAW_PICTURE = 0x0620, - B_STROKE_SHAPE = 0x0621, - B_FILL_SHAPE = 0x0622, - -// Set instructions - - B_SET_DRAWING_MODE = 0x0700, - B_SCROLL_TO = 0x0701, - B_SET_PEN_SIZE = 0x0702, - B_SET_VIEW_COLOR = 0x0703, - B_SET_LINE_MODE = 0x0704, - B_SET_FONT = 0x0705, - B_SET_FORE_COLOR = 0x0706, - B_SET_BACK_COLOR = 0x0707, - B_CLEAR_CLIPPING_REGION = 0x0708, - B_SET_CLIPPING_REGION = 0x0709, - B_SET_SCALE = 0x070A, - B_SET_ORIGIN = 0x070B, - B_PUSH_STATE = 0x070C, - B_POP_STATE = 0x070D, - B_SET_PATTERN = 0x070E, - B_SET_VIEW_BITMAP = 0x070F, // ???? - B_FORCE_FONT_ANTIALIASING = 0x0710, - B_CLIP_TO_PICTURE = 0x0711, - B_SET_BLENDING_MODE = 0x0712, - -// Get instructions - - B_PEN_SIZE = 0x0780, - B_FORE_COLOR = 0x0781, - B_BACK_COLOR = 0x0782, - B_PEN_LOCATION = 0x0783, -// B_FRAME = 0x0784, // ???? - B_DRAWING_MODE = 0x0785, - B_CLIPPING_REGION = 0x0786, - B_LINE_CAP_MODE = 0x0787, - B_LINE_JOIN_MODE = 0x0788, - B_LINE_MITER_LIMIT = 0x0789, -// B_ORIGIN = 0x078A, - B_BLENDING_MODE = 0x078B, - B_FONT = 0x078C, - B_FRAME = 0x078D, - -// Misc instructions - - B_CONVERT_TO = 0x0832, - B_CONVERT_FROM = 0x0833, - B_INVALIDATE_RECT = 0x0840, - B_DISABLE_UPDATES = 0x0841, - B_ENABLES_UPDATES = 0x0842, - //???? = 0x0845, - B_BEGIN_VIEW_TRANSACTION = 0x0846, - B_END_VIEW_TRANSACTION = 0x0847, - B_BEGIN_PICTURE = 0x0850, - B_APPEND_TO_PICTURE = 0x0851, - B_END_PICTURE = 0x0852, - B_GET_WORKSPACES = 0x0860, - B_SET_WORKSPACES = 0x0861, - - // This is necessary because B_SHOW_CURSOR is defined in Accelerant.h - B_BPIC_SHOW_CURSOR = 0x0ECD, - B_HIDE_CURSOR = 0x0ECE, - B_OBSCURE_CURSOR = 0x0ECF, - - B_IS_CURSOR_HIDDEN = 0x0EDA, - - B_SET_CURSOR = 0x0F10, -}; - -#endif - diff --git a/headers/build/private/interface/PrivateScreen.h b/headers/build/private/interface/PrivateScreen.h deleted file mode 100644 index d756d3d06a..0000000000 --- a/headers/build/private/interface/PrivateScreen.h +++ /dev/null @@ -1,96 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2002-2005, Haiku -// -// 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: PrivateScreen.h -// Author: Stefano Ceccherini (burton666@libero.it) -// Description: BPrivateScreen is the class which does the real work -// for the proxy class BScreen (it interacts with the app server). -//------------------------------------------------------------------------------ - -#ifndef __PRIVATESCREEN_H -#define __PRIVATESCREEN_H - -#include -#include - -struct screen_desc; -class BApplication; -class BWindow; - -class BPrivateScreen { - // Constructor and destructor are private. Use the static methods - // CheckOut() and Return() instead. -public: - static BPrivateScreen* CheckOut(BWindow *win); - static BPrivateScreen* CheckOut(screen_id id); - static void Return(BPrivateScreen *screen); - - status_t SetToNext(); - - color_space ColorSpace(); - BRect Frame(); - screen_id ID(); - - status_t WaitForRetrace(bigtime_t timeout); - - uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha); - rgb_color ColorForIndex(const uint8 index); - uint8 InvertIndex(uint8 index); - - const color_map *ColorMap(); - - status_t GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound); - status_t ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound); - - rgb_color DesktopColor(uint32 index); - void SetDesktopColor(rgb_color, uint32, bool); - - status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high); - - status_t GetModeList(display_mode **mode_list, uint32 *count); - status_t GetMode(uint32 workspace, display_mode *mode); - status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault); - - status_t GetDeviceInfo(accelerant_device_info *info); - status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); - status_t GetTimingConstraints(display_timing_constraints *dtc); - - status_t SetDPMS(uint32 dpmsState); - uint32 DPMSState(); - uint32 DPMSCapabilites(); - - void* BaseAddress(); - uint32 BytesPerRow(); - - status_t get_screen_desc(screen_desc *desc); - -private: - color_map *fColorMap; - sem_id fRetraceSem; - bool fOwnsColorMap; - - sem_id RetraceSemaphore(); - - BPrivateScreen(); - ~BPrivateScreen(); -}; - -#endif // __PRIVATESCREEN_H diff --git a/headers/build/private/interface/R5_AppServerLink.h b/headers/build/private/interface/R5_AppServerLink.h deleted file mode 100644 index 9eafe4f4d6..0000000000 --- a/headers/build/private/interface/R5_AppServerLink.h +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: This file is here just to be able to use BDirectWindow -// with BeOS R5. Remove it when we don't need it anymore - -#ifndef _APP_SERVER_LINK_H -#define _APP_SERVER_LINK_H - -#include -#include -#include -#include - -class _BAppServerLink_ { - -public: - _BAppServerLink_(); -virtual ~_BAppServerLink_(); - - _BSession_ *fSession; -}; - -#endif diff --git a/headers/build/private/interface/R5_Session.h b/headers/build/private/interface/R5_Session.h deleted file mode 100644 index a360c52770..0000000000 --- a/headers/build/private/interface/R5_Session.h +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: This file is here just to be able to use BDirectWindow -// with BeOS R5. Remove it when we don't need it anymore - -#ifndef _SESSION_H -#define _SESSION_H - -#include -#include -#include -#include -#include - -class _BSession_ { - -public: - _BSession_(port_id receivePort, port_id sendPort); - _BSession_(int32, char *); -virtual ~_BSession_(); - - char *sread(); - void sread_coo(float *coo); - void sread_coo_a(float *coo); - void sread_point(BPoint *point); - void sread_point_a(BPoint *point); - void sread_rect(clipping_rect *rect); - void sread_rect(BRect *rect); - void sread_rect_a(BRect *rect); - void sread(int32 size, void *data); - void sread2(int32 size, void *data); - void sreadd(int32 size, void *data); - - void swrite_s(int16 s); - void swrite_l(int32 l); - void swrite(char *string); - void swrite_point(const BPoint *point); - void swrite_point_a(const BPoint *point); - void swrite_coo(float *coo); - void swrite_coo_a(float *coo); - void swrite_rect(const clipping_rect *rect); - void swrite_rect(const BRect *rect); - void swrite_rect_a(const BRect *rect); - void swrite(int32 size, void *data); - -// void get_other(message *); -// void add_to_buffer(message *); - - void recv_buffer(); - void send_buffer(); - - void sync(); - void sync_debug(); - void sclose(); - void xclose(); - -private: - port_id fSendPort; - port_id fReceivePort; - - char *fSendBuffer; - int32 fSendBufferSize; - int32 fSendSize; - char *fReceiveBuffer; - int32 fReceiveSize; - int32 fReceivePos; -}; - -extern _IMPEXP_BE _BSession_ *main_session; - -#endif diff --git a/headers/build/private/interface/TPicture.h b/headers/build/private/interface/TPicture.h deleted file mode 100644 index 1e8b84d445..0000000000 --- a/headers/build/private/interface/TPicture.h +++ /dev/null @@ -1,118 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: TPicture.h -// Author: Marc Flerackers (mflerackers@androme.be) -// Description: TPicture is used to create and play picture data. -//------------------------------------------------------------------------------ - -#ifndef _TPICTURE_H -#define _TPICTURE_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include -#include -#include -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -// TPicture class -------------------------------------------------------------- -class TPicture { -public: - TPicture(); - TPicture(void *data, int32 size, BList &pictures); -virtual ~TPicture(); - - int16 GetOp(); - bool GetBool(); - int16 GetInt8(); - int16 GetInt16(); - int32 GetInt32(); - int64 GetInt64(); - float GetFloat(); - BPoint GetCoord(); - BRect GetRect(); - rgb_color GetColor(); - //void GetString(char *); - - void *GetData(int32); - void GetData(void *data, int32 size); - - void AddInt8(int8); - void AddInt16(int16); - void AddInt32(int32); - void AddInt64(int64); - void AddFloat(float); - void AddCoord(BPoint); - void AddRect(BRect); - void AddColor(rgb_color); - void AddString(char *); - - void AddData(void *data, int32 size); - - // SwapOp(); - // SwapInt8(); - // SwapInt16(); - // SwapInt32(); - // SwapInt64(); - // SwapFloat(); - // SwapCoord(); - // SwapRect(); - // SwapIRect(); - // SwapColor(); - // SwapString(); - - // Swap(); - - // CheckPattern(); - - void BeginOp(int32); - void EndOp(); - - void EnterStateChange(); - void ExitStateChange(); - - void EnterFontChange(); - void ExitFontChange(); - - status_t Play(void **callBackTable, int32 tableEntries, - void *userData); - status_t Rewind(); - -private: - BMemoryIO fData; - int32 fSize; - BList &fPictures; -}; -//------------------------------------------------------------------------------ - -//status_t do_playback(void *, long, BArray &, void **, long, void *) - -#endif // _TPICTURE_H diff --git a/headers/build/private/interface/TextInput.h b/headers/build/private/interface/TextInput.h deleted file mode 100644 index a2bec282ff..0000000000 --- a/headers/build/private/interface/TextInput.h +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: TextInput.h -// Author: Frans van Nispen (xlr8@tref.nl) -// Description: The BTextView derivative owned by an instance of -// BTextControl. -//------------------------------------------------------------------------------ - -#ifndef _TEXT_CONTROLI_H -#define _TEXT_CONTROLI_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -class BTextControl; - -// _BTextInput_ class ---------------------------------------------------------- -class _BTextInput_ : public BTextView { -public: - _BTextInput_(BRect frame, BRect textRect, - uint32 resizeMask, - uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED); - _BTextInput_(BMessage *data); - ~_BTextInput_(); - -static BArchivable* Instantiate(BMessage *data); -virtual status_t Archive(BMessage *data, bool deep = true) const; - -virtual void FrameResized(float width, float height); -virtual void KeyDown(const char *bytes, int32 numBytes); -virtual void MakeFocus(bool focusState = true); - - void AlignTextRect(); - void SetInitialText(); - -virtual void Paste(BClipboard *clipboard); - -protected: - -virtual void InsertText(const char *inText, int32 inLength, - int32 inOffset, const text_run_array *inRuns); -virtual void DeleteText(int32 fromOffset, int32 toOffset); - -private: - - BTextControl *TextControl(); - - char *fPreviousText; - bool fBool; -}; -//------------------------------------------------------------------------------ - -#endif // _TEXT_CONTROLI_H - -/* - * $Log $ - * - * $Id $ - * - */ - diff --git a/headers/build/private/interface/TextViewSupportBuffer.h b/headers/build/private/interface/TextViewSupportBuffer.h deleted file mode 100644 index 52cd0cfb5c..0000000000 --- a/headers/build/private/interface/TextViewSupportBuffer.h +++ /dev/null @@ -1,145 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2004, Haiku, Inc. -// -// 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: TextViewSupportBuffer.h -// Authors Marc Flerackers (mflerackers@androme.be) -// Stefano Ceccherini (burton666@libero.it) -// Description: Template class used to implement the various BTextView -// buffer classes. -//------------------------------------------------------------------------------ - -#ifndef __TEXT_VIEW_SUPPORT_BUFFER__H__ -#define __TEXT_VIEW_SUPPORT_BUFFER__H__ - -#include -#include - -#include -#include - - -// _BTextViewSupportBuffer_ class ---------------------------------------------- -template -class _BTextViewSupportBuffer_ { - -public: - _BTextViewSupportBuffer_(int32 inExtraCount = 0, int32 inCount = 0); -virtual ~_BTextViewSupportBuffer_(); - - void InsertItemsAt(int32 inNumItems, int32 inAtIndex, const T *inItem); - void RemoveItemsAt(int32 inNumItems, int32 inAtIndex); - - int32 ItemCount() const; - -protected: - int32 fExtraCount; - int32 fItemCount; - int32 fBufferCount; - T* fBuffer; -}; - - -template -_BTextViewSupportBuffer_::_BTextViewSupportBuffer_(int32 inExtraCount, - int32 inCount) - : fExtraCount(inExtraCount), - fItemCount(inCount), - fBufferCount(fExtraCount + fItemCount), - fBuffer(NULL) -{ - fBuffer = (T *)calloc(fExtraCount + fItemCount, sizeof(T)); -} - - -template -_BTextViewSupportBuffer_::~_BTextViewSupportBuffer_() -{ - free(fBuffer); -} - - -template -void -_BTextViewSupportBuffer_::InsertItemsAt(int32 inNumItems, - int32 inAtIndex, - const T *inItem) -{ - if (inNumItems < 1) - return; - - inAtIndex = (inAtIndex > fItemCount) ? fItemCount : inAtIndex; - inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex; - - int32 delta = inNumItems * sizeof(T); - int32 logSize = fItemCount * sizeof(T); - if ((logSize + delta) >= fBufferCount) { - fBufferCount = logSize + delta + (fExtraCount * sizeof(T)); - fBuffer = (T *)realloc(fBuffer, fBufferCount); - if (fBuffer == NULL) - debugger("InsertItemsAt(): reallocation failed"); - } - - T *loc = fBuffer + inAtIndex; - memmove(loc + inNumItems, loc, (fItemCount - inAtIndex) * sizeof(T)); - memcpy(loc, inItem, delta); - - fItemCount += inNumItems; -} - - -template -void -_BTextViewSupportBuffer_::RemoveItemsAt(int32 inNumItems, - int32 inAtIndex) -{ - if (inNumItems < 1) - return; - - inAtIndex = (inAtIndex > fItemCount - 1) ? (fItemCount - 1) : inAtIndex; - inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex; - - T *loc = fBuffer + inAtIndex; - memmove(loc, loc + inNumItems, - (fItemCount - (inNumItems + inAtIndex)) * sizeof(T)); - - int32 delta = inNumItems * sizeof(T); - int32 logSize = fItemCount * sizeof(T); - uint32 extraSize = fBufferCount - (logSize - delta); - if (extraSize > (fExtraCount * sizeof(T))) { - fBufferCount = (logSize - delta) + (fExtraCount * sizeof(T)); - fBuffer = (T *)realloc(fBuffer, fBufferCount); - if (fBuffer == NULL) - debugger("RemoveItemsAt(): reallocation failed"); - } - - fItemCount -= inNumItems; -} - - -template -inline int32 -_BTextViewSupportBuffer_::ItemCount() const -{ - return fItemCount; -} - - -#endif // __TEXT_VIEW_SUPPORT_BUFFER__H__ diff --git a/headers/build/private/interface/ViewAux.h b/headers/build/private/interface/ViewAux.h deleted file mode 100644 index 24d9e674c3..0000000000 --- a/headers/build/private/interface/ViewAux.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef _VIEWAUX_H_ -#define _VIEWAUX_H_ - -#include -#include -#include -#include -#include -#include - -const static uint32 kDeleteDragger = 'JAHA'; - -struct shape_data { - uint32 *opList; - int32 opCount; - int32 opSize; - int32 opBlockSize; - BPoint *ptList; - int32 ptCount; - int32 ptSize; - int32 ptBlockSize; -}; - -enum { - B_VIEW_FONT_BIT = 0x00000001, - B_VIEW_HIGH_COLOR_BIT = 0x00000002, - B_VIEW_DRAWING_MODE_BIT = 0x00000004, - B_VIEW_CLIP_REGION_BIT = 0x00000008, - B_VIEW_LINE_MODES_BIT = 0x00000010, - B_VIEW_BLENDING_BIT = 0x00000020, - B_VIEW_SCALE_BIT = 0x00000040, - B_VIEW_FONT_ALIASING_BIT = 0x00000080, - B_VIEW_FRAME_BIT = 0x00000100, - B_VIEW_ORIGIN_BIT = 0x00000200, - B_VIEW_PEN_SIZE_BIT = 0x00000400, - B_VIEW_PEN_LOCATION_BIT = 0x00000800, - B_VIEW_LOW_COLOR_BIT = 0x00008000, - B_VIEW_VIEW_COLOR_BIT = 0x00010000, - B_VIEW_PATTERN_BIT = 0x00020000, - - B_VIEW_ALL_BITS = 0x0003ffff, - - // these used for archiving only - B_VIEW_RESIZE_BIT = 0x00001000, - B_VIEW_FLAGS_BIT = 0x00002000, - B_VIEW_EVENT_MASK_BIT = 0x00004000 -}; - - -namespace BPrivate { - -class ViewState { - public: - ViewState(); - - inline bool IsValid(uint32 bit) const; - inline bool IsAllValid() const; - - void UpdateServerFontState(BPrivate::PortLink &link); - void UpdateServerState(BPrivate::PortLink &link); - - void UpdateFrom(BPrivate::PortLink &link); - - public: - BPoint pen_location; - float pen_size; - - rgb_color high_color; - rgb_color low_color; - - // This one is not affected by pop state/push state - rgb_color view_color; - - ::pattern pattern; - - ::drawing_mode drawing_mode; - BRegion clipping_region; - BPoint origin; - - // line modes - join_mode line_join; - cap_mode line_cap; - float miter_limit; - - // alpha blending - source_alpha alpha_source_mode; - alpha_function alpha_function_mode; - - float scale; - - // fonts - BFont font; - uint16 font_flags; - bool font_aliasing; - // font aliasing. Used for printing only! - - // flags used for synchronization with app_server - uint32 valid_flags; - // flags used for archiving - uint32 archiving_flags; -}; - -inline bool -ViewState::IsValid(uint32 bit) const -{ - return valid_flags & bit; -} - -inline bool -ViewState::IsAllValid() const -{ - return (valid_flags & B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT) - == (B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT); -} - -} // namespace BPrivate - -struct _array_hdr_{ - float startX; - float startY; - float endX; - float endY; - rgb_color color; -}; - -struct _array_data_{ - // the max number of points in the array - uint32 maxCount; - // the current number of points in the array - uint32 count; - // the array of points - _array_hdr_* array; -}; - -#endif /* _VIEWAUX_H_ */ diff --git a/headers/build/private/interface/WidthBuffer.h b/headers/build/private/interface/WidthBuffer.h deleted file mode 100644 index 7200aed956..0000000000 --- a/headers/build/private/interface/WidthBuffer.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2003-2004 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: WidthBuffer.cpp - * Author: Stefano Ceccherini (burton666@libero.it) - * Description: _BWidthBuffer_ stores charachters widths in a hash table, to be able - * to retrieve them without passing through the app server. - * Used by BTextView and OpenTracker. - */ -#ifndef __WIDTHBUFFER_H -#define __WIDTHBUFFER_H - -#include "TextViewSupportBuffer.h" - -class BFont; // forward declaration - -// TODO: enable this as soon as we are sure opentracker works -// with our libraries, since using a BFont here (as Dano does) is much better, -// as fonts can be classified also by spacing mode and other attributes. -#define USE_DANO_WIDTHBUFFER 0 - -struct _width_table_ { -#if USE_DANO_WIDTHBUFFER - BFont font; // corresponding font -#else - int32 fontCode; // font code - float fontSize; // font size -#endif - int32 hashCount; // number of hashed items - int32 tableCount; // size of table - void *widths; // width table -}; - - -class _BTextGapBuffer_; -class _BWidthBuffer_ : public _BTextViewSupportBuffer_<_width_table_> { -public: - _BWidthBuffer_(); - virtual ~_BWidthBuffer_(); - - float StringWidth(const char *inText, int32 fromOffset, int32 length, - const BFont *inStyle); - float StringWidth(_BTextGapBuffer_ &gapBuffer, int32 fromOffset, int32 length, - const BFont *inStyle); - -private: - bool FindTable(const BFont *font, int32 *outIndex); - int32 InsertTable(const BFont *font); - - bool GetEscapement(uint32 value, int32 index, float *escapement); - float HashEscapements(const char *chars, int32 numChars, int32 numBytes, - int32 tableIndex, const BFont *font); - - static uint32 Hash(uint32); -}; - -#endif // __WIDTHBUFFER_H diff --git a/headers/build/private/interface/WindowAux.h b/headers/build/private/interface/WindowAux.h deleted file mode 100644 index 8174a2ec9b..0000000000 --- a/headers/build/private/interface/WindowAux.h +++ /dev/null @@ -1,69 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: WindowAux.h -// Author: Adrian Oanca (oancaadrian@yahoo.com) -// Description: BWindowAux.h contains helper definitions for BWindow class -// -//------------------------------------------------------------------------------ - -#ifndef _WINDOWAUX_H -#define _WINDOWAUX_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include -#include -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - - -struct _BCmdKey{ - uint32 key; - uint32 modifiers; - BMessage* message; - BHandler* target; - int32 targetToken; - - _BCmdKey(uint32 k, uint32 mod, BMessage* m = NULL) - : key(k), - modifiers(mod), - message(m), - target(NULL), - targetToken(B_ANY_TOKEN) - { - } - ~_BCmdKey() - { - delete message; - } - -}; - -#endif // _WINDOWAUX_H diff --git a/headers/build/private/interface/WindowInfo.h b/headers/build/private/interface/WindowInfo.h deleted file mode 100644 index 6182226840..0000000000 --- a/headers/build/private/interface/WindowInfo.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef _WINDOW_INFO_H_ -#define _WINDOW_INFO_H_ - - -#include - - -struct window_info { - team_id team; - int32 server_token; - - int32 thread; - int32 client_token; - int32 client_port; - uint32 workspaces; - - int32 layer; // whatever this is... - uint32 feel; - uint32 flags; - int32 window_left; - int32 window_top; - int32 window_right; - int32 window_bottom; - - int32 show_hide_level; - bool is_mini; -} _PACKED; - -struct client_window_info : window_info { - char name[1]; -} _PACKED; - -enum window_action { - B_MINIMIZE_WINDOW, - B_BRING_TO_FRONT -}; - -#endif // _WINDOW_INFO_H_ diff --git a/headers/build/private/interface/WindowPrivate.h b/headers/build/private/interface/WindowPrivate.h deleted file mode 100644 index 4f22b69a5c..0000000000 --- a/headers/build/private/interface/WindowPrivate.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2005, Jérôme Duval, jerome.duval@free.fr. - * Distributed under the terms of the MIT License. - */ -#ifndef _WINDOW_PRIVATE_H -#define _WINDOW_PRIVATE_H - - -#include - - -/* Private window looks */ - -const window_look kDesktopWindowLook = window_look(4); -const window_look kLeftTitledWindowLook = window_look(25); - -/* Private window feels */ - -const window_feel kDesktopWindowFeel = window_feel(1024); -const window_feel kMenuWindowFeel = window_feel(1025); -const window_feel kWindowScreenFeel = window_feel(1026); - -/* Private window types */ - -const window_type kWindowScreenWindow = window_type(1026); - -/* Private window flags */ - -const uint32 kWorkspacesWindowFlag = 0x8000; -const uint32 kWindowScreenFlag = 0x10000; - -#endif // _WINDOW_PRIVATE_H diff --git a/headers/build/private/interface/ZombieReplicantView.h b/headers/build/private/interface/ZombieReplicantView.h deleted file mode 100644 index e7fdb33493..0000000000 --- a/headers/build/private/interface/ZombieReplicantView.h +++ /dev/null @@ -1,54 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2004, Haiku -// -// 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: ZombieReplicantView.h -// Author: Marc Flerackers (mflerackers@androme.be) -// Description: Class for Zombie replicants -//------------------------------------------------------------------------------ - -#ifndef _ZOMBIE_REPLICANT_VIEW_H -#define _ZOMBIE_REPLICANT_VIEW_H - -#include -#include - - -// _BZombieReplicantView_ class ------------------------------------------------ -class _BZombieReplicantView_ : public BBox { - -public: - _BZombieReplicantView_(BRect frame, status_t error); -virtual ~_BZombieReplicantView_(); - -virtual void MessageReceived(BMessage *msg); - -virtual void Draw(BRect updateRect); - -virtual void MouseDown(BPoint); - - void SetArchive(BMessage *); - -private: - status_t fError; - BMessage *fArchive; -}; - -#endif /* _ZOMBIE_REPLICANT_VIEW_H */ diff --git a/headers/build/private/interface/input_globals.h b/headers/build/private/interface/input_globals.h deleted file mode 100644 index 742dc62c38..0000000000 --- a/headers/build/private/interface/input_globals.h +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004, Haiku -// -// 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: input_globals.h -// Author: -// Description: -//------------------------------------------------------------------------------ - -#ifndef __INPUT_GLOBALS_H -#define __INPUT_GLOBALS_H - -#include - -status_t _control_input_server_(BMessage *command, BMessage *reply); -status_t _restore_key_map_(); - -#endif // __INPUT_GLOBALS_H - diff --git a/headers/build/private/interface/moreUTF8.h b/headers/build/private/interface/moreUTF8.h deleted file mode 100644 index 441654627b..0000000000 --- a/headers/build/private/interface/moreUTF8.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef __MOREUTF8 -#define __MOREUTF8 - -#include - -static inline bool -IsInsideGlyph(uchar ch) -{ - return (ch & 0xC0) == 0x80; -} - -static inline uint32 -UTF8NextCharLenUnsafe(const char *text) -{ - const char *ptr = text; - - do { - ptr++; - } while (IsInsideGlyph(*ptr)); - - return ptr - text; -} - -static inline uint32 -UTF8NextCharLen(const char *text) -{ - if (text == NULL || *text == 0) - return 0; - - return UTF8NextCharLenUnsafe(text); -} - -static inline uint32 -UTF8PreviousCharLen(const char *text, const char *limit) -{ - const char *ptr = text; - - if (ptr == NULL || limit == NULL) - return 0; - - do { - if (ptr == limit) - break; - ptr--; - } while (IsInsideGlyph(*ptr)); - - return text - ptr; -} - -// TODO: use this function in other places of this file... -static inline uint32 -count_utf8_bytes(uchar ch) -{ - // the number of high bits set until the first - // unset bit determine the count of bytes used for - // this glyph from this byte on - uchar bit = 1 << 7; - uint32 count = 1; - if (ch & bit) { - bit = bit >> 1; - while (ch & bit) { - count++; - bit = bit >> 1; - } - } - return count; -} - -static inline uint32 -UTF8CountBytes(const char *text, uint32 numChars) -{ - if (text) { - // iterate over numChars glyphs incrementing ptr by the - // number of bytes for each glyph, which is encoded in - // the first byte of any glyph. - const char *ptr = text; - while (numChars--) { - ptr += count_utf8_bytes(*ptr); - } - return ptr - text; - } - return 0; -} - -static inline uint32 -UTF8CountChars(const char *text, int32 numBytes) -{ - const char* ptr = text; - const char* last = ptr + numBytes - 1; - - uint32 count = 0; - while (ptr <= last) { - ptr += UTF8NextCharLen(ptr); - count++; - } - - return count; -} - - -#endif diff --git a/headers/build/private/interface/pr_server.h b/headers/build/private/interface/pr_server.h deleted file mode 100644 index 4b882b2851..0000000000 --- a/headers/build/private/interface/pr_server.h +++ /dev/null @@ -1,97 +0,0 @@ -/*****************************************************************************/ -// print_server Background Application. -// -// Version: 1.0.0d1 -// -// The print_server manages the communication between applications and the -// printer and transport drivers. -// -// -// This application and all source files used in its construction, except -// where noted, are licensed under the MIT License, and have been written -// and are: -// -// Copyright (c) 2001 OpenBeOS Project -// -// 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. -/*****************************************************************************/ - -#ifndef _PR_SERVER_H_ -#define _PR_SERVER_H_ - -// signature mime types -#define PSRV_SIGNATURE_TYPE "application/x-vnd.Be-PSRV" -#define PRNT_SIGNATURE_TYPE "application/x-vnd.Be-PRNT" - -// messages understood by print_server -#define PSRV_GET_ACTIVE_PRINTER 'pgcp' -#define PSRV_MAKE_PRINTER_ACTIVE_QUIETLY 'pmaq' -#define PSRV_MAKE_PRINTER_ACTIVE 'pmac' -#define PSRV_MAKE_PRINTER 'selp' -#define PSRV_SHOW_PAGE_SETUP 'pgst' -#define PSRV_SHOW_PRINT_SETUP 'ppst' -#define PSRV_PRINT_SPOOLED_JOB 'psns' -#define PSRV_GET_DEFAULT_SETTINGS 'pdef' - -// mime file types -#define PSRV_PRINTER_FILETYPE "application/x-vnd.Be.printer" -#define PSRV_SPOOL_FILETYPE "application/x-vnd.Be.printer-spool" - -// spool Attributes -#define PSRV_SPOOL_ATTR_MIMETYPE "_spool/MimeType" -#define PSRV_SPOOL_ATTR_PAGECOUNT "_spool/Page Count" -#define PSRV_SPOOL_ATTR_DESCRIPTION "_spool/Description" -#define PSRV_SPOOL_ATTR_PRINTER "_spool/Printer" -#define PSRV_SPOOL_ATTR_STATUS "_spool/Status" -#define PSRV_SPOOL_ATTR_ERRCODE "_spool/_errorcode" - -// spool file status attribute values -#define PSRV_JOB_STATUS_ "" -#define PSRV_JOB_STATUS_WAITING "Waiting" -#define PSRV_JOB_STATUS_PROCESSING "Processing" -#define PSRV_JOB_STATUS_FAILED "Failed" -#define PSRV_JOB_STATUS_COMPLETED "Completed" - -// printer attributes -#define PSRV_PRINTER_ATTR_DRV_NAME "Driver Name" -#define PSRV_PRINTER_ATTR_PRT_NAME "Printer Name" -#define PSRV_PRINTER_ATTR_COMMENTS "Comments" -#define PSRV_PRINTER_ATTR_STATE "state" -#define PSRV_PRINTER_ATTR_TRANSPORT "transport" -#define PSRV_PRINTER_ATTR_TRANSPORT_ADDR "transport_address" -#define PSRV_PRINTER_ATTR_CNX "connection" -#define PSRV_PRINTER_ATTR_PNP "_PNP" -#define PSRV_PRINTER_ATTR_MDL "_MDL" - -// job settings fields -#define PSRV_FIELD_CURRENT_PRINTER "current_printer" -#define PSRV_FIELD_XRES "xres" -#define PSRV_FIELD_YRES "yres" -#define PSRV_FIELD_PAPER_RECT "paper_rect" -#define PSRV_FIELD_PRINTABLE_RECT "printable_rect" -#define PSRV_FIELD_FIRST_PAGE "first_page" -#define PSRV_FIELD_LAST_PAGE "last_page" - -// optional job settings field -#define PSRV_FIELD_ORIENTATION "orientation" -#define PSRV_FIELD_COPIES "copies" -#define PSRV_FIELD_SCALE "scale" -#define PSRV_FIELD_QUALITY "quality" - -#endif diff --git a/headers/build/private/interface/truncate_string.h b/headers/build/private/interface/truncate_string.h deleted file mode 100644 index 83aa411826..0000000000 --- a/headers/build/private/interface/truncate_string.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2005, Stephan Aßmus . All rights reserved. - * Distributed under the terms of the MIT License. - * - * a helper function to truncate strings - * - */ - - -#ifndef TRUNCATE_STRING_H -#define TRUNCATE_STRING_H - -#include - -// truncated_string -void -truncate_string(const char* string, - uint32 mode, float width, char* result, - const float* escapementArray, float fontSize, - float ellipsisWidth, int32 length, int32 numChars); - -#endif // STRING_TRUNCATION_H diff --git a/headers/build/private/kernel/safemode.h b/headers/build/private/kernel/safemode.h deleted file mode 100644 index 114bb5ec55..0000000000 --- a/headers/build/private/kernel/safemode.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _KERNEL_SAFEMODE_H -#define _KERNEL_SAFEMODE_H - - -#include - - -// these are BeOS compatible additions to the safemode -// constants in the driver_settings.h header - -#define B_SAFEMODE_DISABLE_USER_ADD_ONS "disableuseraddons" -#define B_SAFEMODE_DISABLE_IDE_DMA "disableidedma" -#define B_SAFEMODE_DISABLE_ACPI "disable_acpi" -#define B_SAFEMODE_DISABLE_SMP "disable_smp" -#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading" -#define B_SAFEMODE_FAIL_SAFE_VIDEO_MODE "fail_safe_video_mode" - - -#ifdef __cplusplus -extern "C" { -#endif - -status_t get_safemode_option(const char *parameter, char *buffer, size_t *_bufferSize); -status_t _user_get_safemode_option(const char *parameter, char *buffer, size_t *_bufferSize); - -#ifdef __cplusplus -} -#endif - -#endif /* _KERNEL_SAFEMODE_H */ diff --git a/headers/build/private/shared/AutoDeleter.h b/headers/build/private/shared/AutoDeleter.h deleted file mode 100644 index 88903cad22..0000000000 --- a/headers/build/private/shared/AutoDeleter.h +++ /dev/null @@ -1,148 +0,0 @@ -//------------------------------------------------------------------------------ -// 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: AutoDeleter.h -// Author(s): Ingo Weinhold (bonefish@users.sf.net) -// Description: Scope-based automatic deletion of objects/arrays. -// ObjectDeleter - deletes an object -// ArrayDeleter - deletes an array -// MemoryDeleter - free()s malloc()ed memory -//------------------------------------------------------------------------------ - -#ifndef _AUTO_DELETER_H -#define _AUTO_DELETER_H - -#include - -namespace BPrivate { - -// AutoDeleter - -template -class AutoDeleter { -public: - inline AutoDeleter() - : fObject(NULL) - { - } - - inline AutoDeleter(C *object) - : fObject(object) - { - } - - inline ~AutoDeleter() - { - fDelete(fObject); - } - - inline void SetTo(C *object) - { - if (object != fObject) { - fDelete(fObject); - fObject = object; - } - } - - inline void Unset() - { - SetTo(NULL); - } - - inline void Delete() - { - SetTo(NULL); - } - - inline C *Detach() - { - C *object = fObject; - fObject = NULL; - return object; - } - -private: - C *fObject; - DeleteFunc fDelete; -}; - - -// ObjectDeleter - -template -struct ObjectDelete -{ - inline void operator()(C *object) - { - delete object; - } -}; - -template -struct ObjectDeleter : AutoDeleter > -{ - ObjectDeleter() : AutoDeleter >() {} - ObjectDeleter(C *object) : AutoDeleter >(object) {} -}; - - -// ArrayDeleter - -template -struct ArrayDelete -{ - inline void operator()(C *array) - { - delete[] array; - } -}; - -template -struct ArrayDeleter : AutoDeleter > -{ - ArrayDeleter() : AutoDeleter >() {} - ArrayDeleter(C *array) : AutoDeleter >(array) {} -}; - - -// MemoryDeleter - -struct MemoryDelete -{ - inline void operator()(void *memory) - { - free(memory); - } -}; - -struct MemoryDeleter : AutoDeleter -{ - MemoryDeleter() : AutoDeleter() {} - MemoryDeleter(void *memory) : AutoDeleter(memory) {} -}; - -} // namespace BPrivate - -using BPrivate::ObjectDeleter; -using BPrivate::ArrayDeleter; -using BPrivate::MemoryDeleter; - -#endif // _AUTO_DELETER_H diff --git a/headers/build/private/shared/DataBuffer.h b/headers/build/private/shared/DataBuffer.h deleted file mode 100644 index 4f7ec14b5e..0000000000 --- a/headers/build/private/shared/DataBuffer.h +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -// DataBuffer.h -// -//------------------------------------------------------------------------------ - -#ifndef DATABUFFER_H -#define DATABUFFER_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -namespace BPrivate { - -class BDataBuffer -{ - public: - BDataBuffer(size_t len); - BDataBuffer(const void* data, size_t len, bool copy = false); - BDataBuffer(const BDataBuffer& rhs, bool copy = false); - ~BDataBuffer(); - - BDataBuffer& operator=(const BDataBuffer& rhs); - - size_t BufferSize() const; - const void* Buffer() const; - - private: - class BDataReference - { - public: - void Acquire(BDataReference*& ref); - void Release(BDataReference*& ref); - - char* Data() { return fData; } - size_t Size() const { return fSize; } - int32 Count() { return fCount; } - - static void Create(const void* data, size_t len, - BDataReference*& ref, bool copy = false); - static void Create(size_t len, BDataReference*& ref); - - private: - BDataReference(const void* data, size_t len, bool copy = false); - BDataReference(size_t len); - ~BDataReference(); - - char* fData; - size_t fSize; - int32 fCount; - }; - - BDataBuffer(); // No default construction allowed! - - BDataReference* fDataRef; -}; - -} // namespace BPrivate - -#endif // DATABUFFER_H - -/* - * $Log $ - * - * $Id $ - * - */ - diff --git a/headers/build/private/shared/ObjectList.h b/headers/build/private/shared/ObjectList.h deleted file mode 100644 index 533f14a27c..0000000000 --- a/headers/build/private/shared/ObjectList.h +++ /dev/null @@ -1,800 +0,0 @@ -/* -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. -*/ - -/**************************************************************************** -** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ** -** ** -** DANGER, WILL ROBINSON! ** -** ** -** The interfaces contained here are part of BeOS's ** -** ** -** >> PRIVATE NOT FOR PUBLIC USE << ** -** ** -** implementation. ** -** ** -** These interfaces WILL CHANGE in future releases. ** -** If you use them, your app WILL BREAK at some future time. ** -** ** -** (And yes, this does mean that binaries built from OpenTracker will not ** -** be compatible with some future releases of the OS. When that happens, ** -** we will provide an updated version of this file to keep compatibility.) ** -** ** -** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ** -****************************************************************************/ - -// -// ObjectList is a wrapper around BList that adds type safety, -// optional object ownership, search, insert operations, etc. -// - -#ifndef __OBJECT_LIST__ -#define __OBJECT_LIST__ - -#ifndef _BE_H -#include -#endif - -#include - -template class BObjectList; - -template -struct UnaryPredicate { - - virtual int operator()(const T *) const - // virtual could be avoided here if FindBinaryInsertionIndex, - // etc. were member template functions - { return 0; } - -private: - static int _unary_predicate_glue(const void *item, void *context); - -friend class BObjectList; -}; - -template -int -UnaryPredicate::_unary_predicate_glue(const void *item, void *context) -{ - return ((UnaryPredicate *)context)->operator()((const T *)item); -} - - -class _PointerList_ : public BList { -public: - _PointerList_(const _PointerList_ &list); - _PointerList_(int32 itemsPerBlock = 20, bool owning = false); - virtual ~_PointerList_(); - - typedef void *(* GenericEachFunction)(void *, void *); - typedef int (* GenericCompareFunction)(const void *, const void *); - typedef int (* GenericCompareFunctionWithState)(const void *, const void *, - void *); - typedef int (* UnaryPredicateGlue)(const void *, void *); - - void *EachElement(GenericEachFunction, void *); - void SortItems(GenericCompareFunction); - void SortItems(GenericCompareFunctionWithState, void *state); - void HSortItems(GenericCompareFunction); - void HSortItems(GenericCompareFunctionWithState, void *state); - - void *BinarySearch(const void *, GenericCompareFunction) const; - void *BinarySearch(const void *, GenericCompareFunctionWithState, void *state) const; - - int32 BinarySearchIndex(const void *, GenericCompareFunction) const; - int32 BinarySearchIndex(const void *, GenericCompareFunctionWithState, void *state) const; - int32 BinarySearchIndexByPredicate(const void *, UnaryPredicateGlue) const; - - bool Owning() const; - bool ReplaceItem(int32, void *); - -protected: - bool owning; - -}; - -template -class BObjectList : private _PointerList_ { -public: - - // iteration and sorting - typedef T *(* EachFunction)(T *, void *); - typedef const T *(* ConstEachFunction)(const T *, void *); - typedef int (* CompareFunction)(const T *, const T *); - typedef int (* CompareFunctionWithState)(const T *, const T *, void *state); - - BObjectList(int32 itemsPerBlock = 20, bool owning = false); - BObjectList(const BObjectList &list); - // clones list; if list is owning, makes copies of all - // the items - - virtual ~BObjectList(); - - BObjectList &operator=(const BObjectList &list); - // clones list; if list is owning, makes copies of all - // the items - - // adding and removing - // ToDo: - // change Add calls to return const item - bool AddItem(T *); - bool AddItem(T *, int32); - bool AddList(BObjectList *); - bool AddList(BObjectList *, int32); - - bool RemoveItem(T *, bool deleteIfOwning = true); - // if owning, deletes the removed item - T *RemoveItemAt(int32); - // returns the removed item - - void MakeEmpty(); - - // item access - T *ItemAt(int32) const; - - bool ReplaceItem(int32 index, T *); - // if list is owning, deletes the item at first - T *SwapWithItem(int32 index, T *newItem); - // same as ReplaceItem, except does not delete old item at , - // returns it instead - - T *FirstItem() const; - T *LastItem() const; - - // misc. getters - int32 IndexOf(const T *) const; - bool HasItem(const T *) const; - bool IsEmpty() const; - int32 CountItems() const; - - T *EachElement(EachFunction, void *); - const T *EachElement(ConstEachFunction, void *) const; - - void SortItems(CompareFunction); - void SortItems(CompareFunctionWithState, void *state); - void HSortItems(CompareFunction); - void HSortItems(CompareFunctionWithState, void *state); - - // linear search, returns first item that matches predicate - const T *FindIf(const UnaryPredicate &) const; - T *FindIf(const UnaryPredicate &); - - // list must be sorted with CompareFunction for these to work - const T *BinarySearch(const T &, CompareFunction) const; - const T *BinarySearch(const T &, CompareFunctionWithState, void *state) const; - - // Binary insertion - list must be sorted with CompareFunction for - // these to work - - // simple insert - void BinaryInsert(T *, CompareFunction); - void BinaryInsert(T *, CompareFunctionWithState, void *state); - void BinaryInsert(T *, const UnaryPredicate &); - - // unique insert, returns false if item already in list - bool BinaryInsertUnique(T *, CompareFunction); - bool BinaryInsertUnique(T *, CompareFunctionWithState, void *state); - bool BinaryInsertUnique(T *, const UnaryPredicate &); - - // insert a copy of the item, returns new inserted item - T *BinaryInsertCopy(const T ©This, CompareFunction); - T *BinaryInsertCopy(const T ©This, CompareFunctionWithState, void *state); - - // insert a copy of the item if not in list already - // returns new inserted item or existing item in case of a conflict - T *BinaryInsertCopyUnique(const T ©This, CompareFunction); - T *BinaryInsertCopyUnique(const T ©This, CompareFunctionWithState, void *state); - - - int32 FindBinaryInsertionIndex(const UnaryPredicate &, bool *alreadyInList = 0) const; - // returns either the index into which a new item should be inserted - // or index of an existing item that matches the predicate - - // deprecated API, will go away - BList *AsBList() - { return this; } - const BList *AsBList() const - { return this; } -private: - void SetItem(int32, T *); -}; - -template -Result -WhileEachListItem(BObjectList *list, Result (Item::*func)(Param1), Param1 p1) -{ - Result result = 0; - int32 count = list->CountItems(); - - for (int32 index = 0; index < count; index++) - if ((result = (list->ItemAt(index)->*func)(p1)) != 0) - break; - - return result; -} - -template -Result -WhileEachListItem(BObjectList *list, Result (*func)(Item *, Param1), Param1 p1) -{ - Result result = 0; - int32 count = list->CountItems(); - - for (int32 index = 0; index < count; index++) - if ((result = (*func)(list->ItemAt(index), p1)) != 0) - break; - - return result; -} - -template -Result -WhileEachListItem(BObjectList *list, Result (Item::*func)(Param1, Param2), - Param1 p1, Param2 p2) -{ - Result result = 0; - int32 count = list->CountItems(); - - for (int32 index = 0; index < count; index++) - if ((result = (list->ItemAt(index)->*func)(p1, p2)) != 0) - break; - - return result; -} - -template -Result -WhileEachListItem(BObjectList *list, Result (*func)(Item *, Param1, Param2), - Param1 p1, Param2 p2) -{ - Result result = 0; - int32 count = list->CountItems(); - - for (int32 index = 0; index < count; index++) - if ((result = (*func)(list->ItemAt(index), p1, p2)) != 0) - break; - - return result; -} - -template -Result -WhileEachListItem(BObjectList *list, Result (*func)(Item *, Param1, Param2, - Param3, Param4), Param1 p1, Param2 p2, Param3 p3, Param4 p4) -{ - Result result = 0; - int32 count = list->CountItems(); - - for (int32 index = 0; index < count; index++) - if ((result = (*func)(list->ItemAt(index), p1, p2, p3, p4)) != 0) - break; - - return result; -} - -template -void -EachListItemIgnoreResult(BObjectList *list, Result (Item::*func)()) -{ - int32 count = list->CountItems(); - for (int32 index = 0; index < count; index++) - (list->ItemAt(index)->*func)(); -} - -template -void -EachListItem(BObjectList *list, void (*func)(Item *, Param1), Param1 p1) -{ - int32 count = list->CountItems(); - for (int32 index = 0; index < count; index++) - (func)(list->ItemAt(index), p1); -} - -template -void -EachListItem(BObjectList *list, void (Item::*func)(Param1, Param2), - Param1 p1, Param2 p2) -{ - int32 count = list->CountItems(); - for (int32 index = 0; index < count; index++) - (list->ItemAt(index)->*func)(p1, p2); -} - -template -void -EachListItem(BObjectList *list, void (*func)(Item *,Param1, Param2), - Param1 p1, Param2 p2) -{ - int32 count = list->CountItems(); - for (int32 index = 0; index < count; index++) - (func)(list->ItemAt(index), p1, p2); -} - -template -void -EachListItem(BObjectList *list, void (*func)(Item *,Param1, Param2, - Param3), Param1 p1, Param2 p2, Param3 p3) -{ - int32 count = list->CountItems(); - for (int32 index = 0; index < count; index++) - (func)(list->ItemAt(index), p1, p2, p3); -} - - -template -void -EachListItem(BObjectList *list, void (*func)(Item *,Param1, Param2, - Param3, Param4), Param1 p1, Param2 p2, Param3 p3, Param4 p4) -{ - int32 count = list->CountItems(); - for (int32 index = 0; index < count; index++) - (func)(list->ItemAt(index), p1, p2, p3, p4); -} - -// inline code - -inline bool -_PointerList_::Owning() const -{ - return owning; -} - -template -BObjectList::BObjectList(int32 itemsPerBlock, bool owning) - : _PointerList_(itemsPerBlock, owning) -{ -} - -template -BObjectList::BObjectList(const BObjectList &list) - : _PointerList_(list) -{ - owning = list.owning; - if (owning) { - // make our own copies in an owning list - int32 count = list.CountItems(); - for (int32 index = 0; index < count; index++) { - T *item = list.ItemAt(index); - if (item) - item = new T(*item); - SetItem(index, item); - } - } -} - -template -BObjectList::~BObjectList() -{ - if (Owning()) - // have to nuke elements first - MakeEmpty(); - -} - -template -BObjectList & -BObjectList::operator=(const BObjectList &list) -{ - owning = list.owning; - BObjectList &result = (BObjectList &)_PointerList_::operator=(list); - if (owning) { - // make our own copies in an owning list - int32 count = list.CountItems(); - for (int32 index = 0; index < count; index++) { - T *item = list.ItemAt(index); - if (item) - item = new T(*item); - SetItem(index, item); - } - } - return result; -} - -template -bool -BObjectList::AddItem(T *item) -{ - // need to cast to void * to make T work for const pointers - return _PointerList_::AddItem((void *)item); -} - -template -bool -BObjectList::AddItem(T *item, int32 atIndex) -{ - return _PointerList_::AddItem((void *)item, atIndex); -} - -template -bool -BObjectList::AddList(BObjectList *newItems) -{ - return _PointerList_::AddList(newItems); -} - -template -bool -BObjectList::AddList(BObjectList *newItems, int32 atIndex) -{ - return _PointerList_::AddList(newItems, atIndex); -} - - -template -bool -BObjectList::RemoveItem(T *item, bool deleteIfOwning) -{ - bool result = _PointerList_::RemoveItem((void *)item); - - if (result && Owning() && deleteIfOwning) - delete item; - - return result; -} - -template -T * -BObjectList::RemoveItemAt(int32 index) -{ - return (T *)_PointerList_::RemoveItem(index); -} - -template -inline T * -BObjectList::ItemAt(int32 index) const -{ - return (T *)_PointerList_::ItemAt(index); -} - -template -bool -BObjectList::ReplaceItem(int32 index, T *item) -{ - if (owning) - delete ItemAt(index); - return _PointerList_::ReplaceItem(index, (void *)item); -} - -template -T * -BObjectList::SwapWithItem(int32 index, T *newItem) -{ - T *result = ItemAt(index); - _PointerList_::ReplaceItem(index, (void *)newItem); - return result; -} - -template -void -BObjectList::SetItem(int32 index, T *newItem) -{ - _PointerList_::ReplaceItem(index, (void *)newItem); -} - -template -int32 -BObjectList::IndexOf(const T *item) const -{ - return _PointerList_::IndexOf((void *)item); -} - -template -T * -BObjectList::FirstItem() const -{ - return (T *)_PointerList_::FirstItem(); -} - -template -T * -BObjectList::LastItem() const -{ - return (T *)_PointerList_::LastItem(); -} - -template -bool -BObjectList::HasItem(const T *item) const -{ - return _PointerList_::HasItem((void *)item); -} - -template -bool -BObjectList::IsEmpty() const -{ - return _PointerList_::IsEmpty(); -} - -template -int32 -BObjectList::CountItems() const -{ - return _PointerList_::CountItems(); -} - -template -void -BObjectList::MakeEmpty() -{ - if (owning) { - int32 count = CountItems(); - for (int32 index = 0; index < count; index++) - delete ItemAt(index); - } - _PointerList_::MakeEmpty(); -} - -template -T * -BObjectList::EachElement(EachFunction func, void *params) -{ - return (T *)_PointerList_::EachElement((GenericEachFunction)func, params); -} - - -template -const T * -BObjectList::EachElement(ConstEachFunction func, void *params) const -{ - return (const T *) - const_cast *>(this)->_PointerList_::EachElement( - (GenericEachFunction)func, params); -} - -template -const T * -BObjectList::FindIf(const UnaryPredicate &predicate) const -{ - int32 count = CountItems(); - for (int32 index = 0; index < count; index++) - if (predicate.operator()(ItemAt(index)) == 0) - return ItemAt(index); - return 0; -} - -template -T * -BObjectList::FindIf(const UnaryPredicate &predicate) -{ - int32 count = CountItems(); - for (int32 index = 0; index < count; index++) - if (predicate.operator()(ItemAt(index)) == 0) - return ItemAt(index); - return 0; -} - - -template -void -BObjectList::SortItems(CompareFunction function) -{ - _PointerList_::SortItems((GenericCompareFunction)function); -} - -template -void -BObjectList::SortItems(CompareFunctionWithState function, void *state) -{ - _PointerList_::SortItems((GenericCompareFunctionWithState)function, state); -} - -template -void -BObjectList::HSortItems(CompareFunction function) -{ - _PointerList_::HSortItems((GenericCompareFunction)function); -} - -template -void -BObjectList::HSortItems(CompareFunctionWithState function, void *state) -{ - _PointerList_::HSortItems((GenericCompareFunctionWithState)function, state); -} - -template -const T * -BObjectList::BinarySearch(const T &key, CompareFunction func) const -{ - return (const T *)_PointerList_::BinarySearch(&key, - (GenericCompareFunction)func); -} - -template -const T * -BObjectList::BinarySearch(const T &key, CompareFunctionWithState func, void *state) const -{ - return (const T *)_PointerList_::BinarySearch(&key, - (GenericCompareFunctionWithState)func, state); -} - -template -void -BObjectList::BinaryInsert(T *item, CompareFunction func) -{ - int32 index = _PointerList_::BinarySearchIndex(item, - (GenericCompareFunction)func); - if (index >= 0) - // already in list, add after existing - AddItem(item, index + 1); - else - AddItem(item, -index - 1); -} - -template -void -BObjectList::BinaryInsert(T *item, CompareFunctionWithState func, void *state) -{ - int32 index = _PointerList_::BinarySearchIndex(item, - (GenericCompareFunctionWithState)func, state); - if (index >= 0) - // already in list, add after existing - AddItem(item, index + 1); - else - AddItem(item, -index - 1); -} - -template -bool -BObjectList::BinaryInsertUnique(T *, CompareFunction func) -{ - int32 index = _PointerList_::BinarySearchIndex(item, - (GenericCompareFunction)func); - if (index >= 0) - return false; - - AddItem(item, -index - 1); - return true; -} - -template -bool -BObjectList::BinaryInsertUnique(T *, CompareFunctionWithState func, void *state) -{ - int32 index = _PointerList_::BinarySearchIndex(item, - (GenericCompareFunctionWithState)func, state); - if (index >= 0) - return false; - - AddItem(item, -index - 1); - return true; -} - - -template -T * -BObjectList::BinaryInsertCopy(const T ©This, CompareFunction func) -{ - int32 index = _PointerList_::BinarySearchIndex(©This, - (GenericCompareFunction)func); - - if (index >= 0) - index++; - else - index = -index - 1; - - T *newItem = new T(copyThis); - AddItem(newItem, index); - return newItem; -} - -template -T * -BObjectList::BinaryInsertCopy(const T ©This, CompareFunctionWithState func, void *state) -{ - int32 index = _PointerList_::BinarySearchIndex(©This, - (GenericCompareFunctionWithState)func, state); - - if (index >= 0) - index++; - else - index = -index - 1; - - T *newItem = new T(copyThis); - AddItem(newItem, index); - return newItem; -} - -template -T * -BObjectList::BinaryInsertCopyUnique(const T ©This, CompareFunction func) -{ - int32 index = _PointerList_::BinarySearchIndex(©This, - (GenericCompareFunction)func); - if (index >= 0) - return ItemAt(index); - - index = -index - 1; - T *newItem = new T(copyThis); - AddItem(newItem, index); - return newItem; -} - -template -T * -BObjectList::BinaryInsertCopyUnique(const T ©This, CompareFunctionWithState func, - void *state) -{ - int32 index = _PointerList_::BinarySearchIndex(©This, - (GenericCompareFunctionWithState)func, state); - if (index >= 0) - return ItemAt(index); - - index = -index - 1; - T *newItem = new T(copyThis); - AddItem(newItem, index); - return newItem; -} - -template -int32 -BObjectList::FindBinaryInsertionIndex(const UnaryPredicate &pred, bool *alreadyInList) - const -{ - int32 index = _PointerList_::BinarySearchIndexByPredicate(&pred, - (UnaryPredicateGlue)&UnaryPredicate::_unary_predicate_glue); - - if (alreadyInList) - *alreadyInList = index >= 0; - - if (index < 0) - index = -index - 1; - - return index; -} - -template -void -BObjectList::BinaryInsert(T *item, const UnaryPredicate &pred) -{ - int32 index = FindBinaryInsertionIndex(pred); - AddItem(item, index); -} - -template -bool -BObjectList::BinaryInsertUnique(T *item, const UnaryPredicate &pred) -{ - bool alreadyInList; - int32 index = FindBinaryInsertionIndex(pred, &alreadyInList); - if (alreadyInList) - return false; - - AddItem(item, index); - return true; -} - - -#endif diff --git a/headers/build/private/shared/cpu_type.h b/headers/build/private/shared/cpu_type.h deleted file mode 100644 index d154ad95fc..0000000000 --- a/headers/build/private/shared/cpu_type.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* Taken from the Pulse application, and extended. - * It's used by Pulse, AboutHaiku, and sysinfo. - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -const char *get_cpu_vendor_string(enum cpu_types type); -const char *get_cpu_model_string(enum cpu_types type); -void get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer, size_t modelSize); -int32 get_rounded_cpu_speed(void); - -#ifdef __cplusplus -} -#endif - - -const char * -get_cpu_vendor_string(enum cpu_types type) -{ -#if __POWERPC__ - // We're not that nice here - return "IBM/Motorola"; -#endif -#if __INTEL__ - // Determine x86 vendor name - switch (type & B_CPU_x86_VENDOR_MASK) { - case B_CPU_INTEL_x86: - return "Intel"; - case B_CPU_AMD_x86: - return "AMD"; - case B_CPU_CYRIX_x86: - return "Cyrix"; - case B_CPU_IDT_x86: - // IDT was bought by VIA - if (((type >> 8) & 0xf) >= 6) - return "VIA"; - return "IDT"; - case B_CPU_RISE_x86: - return "Rise"; - case B_CPU_TRANSMETA_x86: - return "Transmeta"; - - default: - return NULL; - } -#endif -} - - -const char * -get_cpu_model_string(enum cpu_types type) -{ - // Determine CPU type - switch (type) { -#if __POWERPC__ - case B_CPU_PPC_603: - return "603"; - case B_CPU_PPC_603e: - return "603e"; - case B_CPU_PPC_750: - return "750"; - case B_CPU_PPC_604: - return "604"; - case B_CPU_PPC_604e: - return "604e"; -#endif // __POWERPC__ -#if __INTEL__ - case B_CPU_x86: - return "Unknown x86"; - - /* Intel */ - case B_CPU_INTEL_PENTIUM: - case B_CPU_INTEL_PENTIUM75: - return "Pentium"; - case B_CPU_INTEL_PENTIUM_486_OVERDRIVE: - case B_CPU_INTEL_PENTIUM75_486_OVERDRIVE: - return "Pentium OD"; - case B_CPU_INTEL_PENTIUM_MMX: - case B_CPU_INTEL_PENTIUM_MMX_MODEL_8: - return "Pentium MMX"; - case B_CPU_INTEL_PENTIUM_PRO: - return "Pentium Pro"; - case B_CPU_INTEL_PENTIUM_II_MODEL_3: - case B_CPU_INTEL_PENTIUM_II_MODEL_5: - return "Pentium II"; - case B_CPU_INTEL_CELERON: - return "Celeron"; - case B_CPU_INTEL_PENTIUM_III: - case B_CPU_INTEL_PENTIUM_III_MODEL_8: - case B_CPU_INTEL_PENTIUM_III_MODEL_11: - case B_CPU_INTEL_PENTIUM_III_XEON: - return "Pentium III"; - case B_CPU_INTEL_PENTIUM_M: - case B_CPU_INTEL_PENTIUM_M_MODEL_13: - return "Pentium M"; - case B_CPU_INTEL_PENTIUM_IV: - case B_CPU_INTEL_PENTIUM_IV_MODEL_1: - case B_CPU_INTEL_PENTIUM_IV_MODEL_2: - case B_CPU_INTEL_PENTIUM_IV_MODEL_3: - case B_CPU_INTEL_PENTIUM_IV_MODEL_4: - return "Pentium 4"; - - /* AMD */ - case B_CPU_AMD_K5_MODEL_0: - case B_CPU_AMD_K5_MODEL_1: - case B_CPU_AMD_K5_MODEL_2: - case B_CPU_AMD_K5_MODEL_3: - return "K5"; - case B_CPU_AMD_K6_MODEL_6: - case B_CPU_AMD_K6_MODEL_7: - return "K6"; - case B_CPU_AMD_K6_2: - return "K6-2"; - case B_CPU_AMD_K6_III: - case B_CPU_AMD_K6_III_MODEL_13: - return "K6-III"; - case B_CPU_AMD_ATHLON_MODEL_1: - case B_CPU_AMD_ATHLON_MODEL_2: - case B_CPU_AMD_ATHLON_THUNDERBIRD: - return "Athlon"; - case B_CPU_AMD_ATHLON_XP: - case B_CPU_AMD_ATHLON_XP_MODEL_7: - case B_CPU_AMD_ATHLON_XP_MODEL_8: - case B_CPU_AMD_ATHLON_XP_MODEL_10: - return "Athlon XP"; - case B_CPU_AMD_DURON: - return "Duron"; - case B_CPU_AMD_ATHLON_64_MODEL_4: - case B_CPU_AMD_ATHLON_64_MODEL_7: - case B_CPU_AMD_ATHLON_64_MODEL_8: - case B_CPU_AMD_ATHLON_64_MODEL_11: - case B_CPU_AMD_ATHLON_64_MODEL_12: - case B_CPU_AMD_ATHLON_64_MODEL_14: - case B_CPU_AMD_ATHLON_64_MODEL_15: - return "Athlon 64"; - case B_CPU_AMD_OPTERON: - return "Opteron"; - - /* Transmeta */ - case B_CPU_TRANSMETA_CRUSOE: - return "Crusoe"; - - /* IDT/VIA */ - case B_CPU_IDT_WINCHIP_C6: - return "WinChip C6"; - case B_CPU_IDT_WINCHIP_2: - return "WinChip 2"; - case B_CPU_VIA_EDEN: - case B_CPU_VIA_EDEN_EZRA_T: - return "Eden"; - - /* Cyrix/VIA */ - case B_CPU_CYRIX_GXm: - return "GXm"; - case B_CPU_CYRIX_6x86MX: - return "6x86MX"; - - /* Rise */ - case B_CPU_RISE_mP6: - return "mP6"; - - /* National Semiconductor */ - case B_CPU_NATIONAL_GEODE_GX1: - return "Geode GX1"; -#endif // __INTEL__ - - default: - return NULL; - } -} - - -void -get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer, size_t modelSize) -{ - const char *vendor, *model; - system_info info; - - get_system_info(&info); - - vendor = get_cpu_vendor_string(info.cpu_type); - if (vendor == NULL) - vendor = "Unknown"; - - model = get_cpu_model_string(info.cpu_type); - if (model == NULL) - model = "Unknown"; - -#ifdef R5_COMPATIBLE - strncpy(vendorBuffer, vendor, vendorSize - 1); - vendorBuffer[vendorSize - 1] = '\0'; - strncpy(modelBuffer, model, modelSize - 1); - modelBuffer[modelSize - 1] = '\0'; -#else - strlcpy(vendorBuffer, vendor, vendorSize); - strlcpy(modelBuffer, model, modelSize); -#endif -} - - -int32 -get_rounded_cpu_speed(void) -{ - system_info sys_info; - - int target, frac, delta; - int freqs[] = { 100, 50, 25, 75, 33, 67, 20, 40, 60, 80, 10, 30, 70, 90 }; - uint x; - - get_system_info(&sys_info); - target = sys_info.cpu_clock_speed / 1000000; - frac = target % 100; - delta = -frac; - - for (x = 0; x < sizeof(freqs) / sizeof(freqs[0]); x++) { - int ndelta = freqs[x] - frac; - if (abs(ndelta) < abs(delta)) - delta = ndelta; - } - return target + delta; -} - diff --git a/headers/build/private/storage/AddOnMonitor.h b/headers/build/private/storage/AddOnMonitor.h deleted file mode 100644 index 84442d3b33..0000000000 --- a/headers/build/private/storage/AddOnMonitor.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _ADD_ON_MONITOR_H -#define _ADD_ON_MONITOR_H - -#include -#include -#include -#include -#include - -namespace BPrivate { -namespace Storage { - -class AddOnMonitorHandler; - -class AddOnMonitor : public BLooper { -private: - typedef BLooper inherited; -public: - AddOnMonitor(AddOnMonitorHandler * handler); - virtual ~AddOnMonitor(); - - virtual status_t InitCheck(); - -private: - status_t fInitCheck; - BMessage * fPulseMessage; - BMessageRunner * fPulseRunner; -}; - -}; // namespace Storage -}; // namespace BPrivate - -using namespace BPrivate::Storage; - -#endif // _ADD_ON_MONITOR_H diff --git a/headers/build/private/storage/AddOnMonitorHandler.h b/headers/build/private/storage/AddOnMonitorHandler.h deleted file mode 100644 index f471211cc4..0000000000 --- a/headers/build/private/storage/AddOnMonitorHandler.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _ADD_ON_MONITOR_HANDLER_H -#define _ADD_ON_MONITOR_HANDLER_H - -#include -#include "NodeMonitorHandler.h" - -namespace BPrivate { -namespace Storage { - -struct add_on_entry_info { - char name[B_FILE_NAME_LENGTH]; - node_ref nref; - node_ref dir_nref; -}; - -struct add_on_directory_info { - node_ref nref; - std::list entries; -}; - -class AddOnMonitorHandler : public NodeMonitorHandler { -private: - typedef NodeMonitorHandler inherited; -public: - AddOnMonitorHandler(const char * name = "AddOnMonitorHandler"); - virtual ~AddOnMonitorHandler(); - - virtual void MessageReceived(BMessage * msg); - - // supply the add on directories here, in the order you want them checked - virtual status_t AddDirectory(const node_ref * nref); - -protected: - // hooks for subclass - virtual void AddOnCreated(const add_on_entry_info * entry_info); - virtual void AddOnEnabled(const add_on_entry_info * entry_info); - virtual void AddOnDisabled(const add_on_entry_info * entry_info); - virtual void AddOnRemoved(const add_on_entry_info * entry_info); - -protected: - virtual void EntryCreated(const char *name, ino_t directory, - dev_t device, ino_t node); - virtual void EntryRemoved(ino_t directory, dev_t device, ino_t node); - virtual void EntryMoved(const char *name, ino_t from_directory, - ino_t to_directory, dev_t device, ino_t node); - -private: - void HandlePulse(); - - std::list directories; - std::list pending_entries; - std::list former_entries; -}; - - -}; // namespace Storage -}; // namespace BPrivate - -using namespace BPrivate::Storage; - -#endif // _ADD_ON_MONITOR_HANDLER_H diff --git a/headers/build/private/storage/DiskDevice.h b/headers/build/private/storage/DiskDevice.h deleted file mode 100644 index 92c0cf3f8d..0000000000 --- a/headers/build/private/storage/DiskDevice.h +++ /dev/null @@ -1,60 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_H -#define _DISK_DEVICE_H - -#include - -struct user_disk_device_data; - -class BDiskDevice : public BPartition { -public: - BDiskDevice(); - virtual ~BDiskDevice(); - - bool HasMedia() const; - bool IsRemovableMedia() const; - bool IsReadOnlyMedia() const; - bool IsWriteOnceMedia() const; - - status_t Eject(bool update = false); - - status_t SetTo(partition_id id); - status_t Update(bool *updated = NULL); - void Unset(); - status_t InitCheck() const; - - virtual status_t GetPath(BPath *path) const; - - bool IsModified() const; - status_t PrepareModifications(); - status_t CommitModifications(bool synchronously = true, - BMessenger progressMessenger = BMessenger(), - bool receiveCompleteProgressUpdates = true); - status_t CancelModifications(); - -private: - friend class BDiskDeviceList; - friend class BDiskDeviceRoster; - - BDiskDevice::BDiskDevice(const BDiskDevice &); - BDiskDevice &BDiskDevice::operator=(const BDiskDevice &); - - static status_t _GetData(partition_id id, bool deviceOnly, bool shadow, - size_t neededSize, user_disk_device_data **data); - - status_t _SetTo(partition_id id, bool deviceOnly, bool shadow, - size_t neededSize); - status_t _SetTo(user_disk_device_data *data); - status_t _Update(bool shadow, bool *updated); - status_t _Update(user_disk_device_data *data, bool *updated); - - virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level); - - user_disk_device_data *fDeviceData; -}; - -#endif // _DISK_DEVICE_H diff --git a/headers/build/private/storage/DiskDeviceDefs.h b/headers/build/private/storage/DiskDeviceDefs.h deleted file mode 100644 index 24820e3724..0000000000 --- a/headers/build/private/storage/DiskDeviceDefs.h +++ /dev/null @@ -1,163 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_DEFS_H -#define _DISK_DEVICE_DEFS_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int32 partition_id; -typedef int32 disk_system_id; -typedef int32 disk_job_id; - -// partition flags -enum { - B_PARTITION_IS_DEVICE = 0x01, - B_PARTITION_FILE_SYSTEM = 0x02, - B_PARTITION_PARTITIONING_SYSTEM = 0x04, - B_PARTITION_READ_ONLY = 0x08, - B_PARTITION_MOUNTED = 0x10, // needed? - B_PARTITION_BUSY = 0x20, - B_PARTITION_DESCENDANT_BUSY = 0x40, -}; - -// partition statuses -enum { - B_PARTITION_VALID, - B_PARTITION_CORRUPT, - B_PARTITION_UNRECOGNIZED, - B_PARTITION_UNINITIALIZED, // Only when uninitialized manually. - // When not recognized while scanning it's - // B_PARTITION_UNRECOGNIZED. -}; - -// partition change flags -enum { - B_PARTITION_CHANGED_OFFSET = 0x000001, - B_PARTITION_CHANGED_SIZE = 0x000002, - B_PARTITION_CHANGED_CONTENT_SIZE = 0x000004, - B_PARTITION_CHANGED_BLOCK_SIZE = 0x000008, - B_PARTITION_CHANGED_STATUS = 0x000010, - B_PARTITION_CHANGED_FLAGS = 0x000020, - B_PARTITION_CHANGED_VOLUME = 0x000040, - B_PARTITION_CHANGED_NAME = 0x000080, - B_PARTITION_CHANGED_CONTENT_NAME = 0x000100, - B_PARTITION_CHANGED_TYPE = 0x000200, - B_PARTITION_CHANGED_CONTENT_TYPE = 0x000400, - B_PARTITION_CHANGED_PARAMETERS = 0x000800, - B_PARTITION_CHANGED_CONTENT_PARAMETERS = 0x001000, - B_PARTITION_CHANGED_CHILDREN = 0x002000, - B_PARTITION_CHANGED_DESCENDANTS = 0x004000, - B_PARTITION_CHANGED_DEFRAGMENTATION = 0x008000, - B_PARTITION_CHANGED_CHECK = 0x010000, - B_PARTITION_CHANGED_REPAIR = 0x020000, - B_PARTITION_CHANGED_INITIALIZATION = 0x040000, -}; - -// disk device flags -enum { - B_DISK_DEVICE_REMOVABLE = 0x01, - B_DISK_DEVICE_HAS_MEDIA = 0x02, - B_DISK_DEVICE_READ_ONLY = 0x04, - B_DISK_DEVICE_WRITE_ONCE = 0x08, -}; - -// disk system flags -enum { - B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x0001, - - // flags common for both file and partitioning systems - B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x0002, - B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x0004, - B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x0008, - B_DISK_SYSTEM_SUPPORTS_MOVING = 0x0010, - B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x0020, - B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x0040, - - // file system specific flags - B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x0100, - B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x0200, - B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x0400, - B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x0800, - B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x1000, - B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x2000, - B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x4000, - B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x8000, - - // partitioning system specific flags - B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x0100, - B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x0200, - B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x0400, - B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x0800, - B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x1000, - B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x2000, - B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x4000, - B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x8000, -}; - -// disk device job types -enum { - B_DISK_DEVICE_JOB_BAD_TYPE, - B_DISK_DEVICE_JOB_DEFRAGMENT, - B_DISK_DEVICE_JOB_REPAIR, - B_DISK_DEVICE_JOB_RESIZE, - B_DISK_DEVICE_JOB_MOVE, - B_DISK_DEVICE_JOB_SET_NAME, - B_DISK_DEVICE_JOB_SET_CONTENT_NAME, - B_DISK_DEVICE_JOB_SET_TYPE, - B_DISK_DEVICE_JOB_SET_PARMETERS, - B_DISK_DEVICE_JOB_SET_CONTENT_PARMETERS, - B_DISK_DEVICE_JOB_INITIALIZE, - B_DISK_DEVICE_JOB_UNINITIALIZE, - B_DISK_DEVICE_JOB_CREATE, - B_DISK_DEVICE_JOB_DELETE, - B_DISK_DEVICE_JOB_SCAN, -}; - -// disk device job statuses -enum { - B_DISK_DEVICE_JOB_UNINITIALIZED, - B_DISK_DEVICE_JOB_SCHEDULED, - B_DISK_DEVICE_JOB_IN_PROGRESS, - B_DISK_DEVICE_JOB_SUCCEEDED, - B_DISK_DEVICE_JOB_FAILED, - B_DISK_DEVICE_JOB_CANCELED, -}; - -// disk device job progress info -typedef struct disk_device_job_progress_info { - uint32 status; - uint32 interrupt_properties; - int32 task_count; - int32 completed_tasks; - float current_task_progress; - char current_task_description[256]; -} disk_device_job_progress_info; - -// disk device job interrupt properties -enum { - B_DISK_DEVICE_JOB_CAN_CANCEL = 0x01, - B_DISK_DEVICE_JOB_STOP_ON_CANCEL = 0x02, - B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL = 0x04, - B_DISK_DEVICE_JOB_CAN_PAUSE = 0x08, -}; - -// string length constants, all of which include the NULL terminator -#define B_DISK_DEVICE_TYPE_LENGTH B_FILE_NAME_LENGTH -#define B_DISK_DEVICE_NAME_LENGTH B_FILE_NAME_LENGTH -#define B_DISK_SYSTEM_NAME_LENGTH B_PATH_NAME_LENGTH - -// max size of parameter string buffers, including NULL terminator -#define B_DISK_DEVICE_MAX_PARAMETER_SIZE (32 * 1024) - -#ifdef __cplusplus -} -#endif - -#endif // _DISK_DEVICE_DEFS_H diff --git a/headers/build/private/storage/DiskDeviceJob.h b/headers/build/private/storage/DiskDeviceJob.h deleted file mode 100644 index d4368ff89d..0000000000 --- a/headers/build/private/storage/DiskDeviceJob.h +++ /dev/null @@ -1,47 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_JOB_H -#define _DISK_DEVICE_JOB_H - -#include -#include - -struct user_disk_device_job_info; - -class BDiskDeviceJob { -public: - BDiskDeviceJob(); - ~BDiskDeviceJob(); - - status_t SetTo(disk_job_id id); - void Unset(); - status_t InitCheck() const; - - disk_job_id ID() const; - uint32 Type() const; - partition_id PartitionID() const; - const char *Description() const; - - uint32 Status() const; - float Progress() const; // [0.0, 1.0] - status_t GetProgressInfo(disk_device_job_progress_info *info) const; - uint32 InterruptProperties() const; - - status_t Cancel(bool reverse = false); - status_t Pause(); - -private: - status_t _SetTo(user_disk_device_job_info *info); - - friend class BDiskDeviceRoster; - - disk_job_id fID; - uint32 fType; - partition_id fPartitionID; - BString fDescription; -}; - -#endif // _DISK_DEVICE_JOB_H diff --git a/headers/build/private/storage/DiskDeviceList.h b/headers/build/private/storage/DiskDeviceList.h deleted file mode 100644 index 3fb3a516ca..0000000000 --- a/headers/build/private/storage/DiskDeviceList.h +++ /dev/null @@ -1,90 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the Haiku distribution and is covered -// by the MIT license. -//--------------------------------------------------------------------- -#ifndef _DISK_DEVICE_LIST_H -#define _DISK_DEVICE_LIST_H - - -#include -#include -#include - - -class BDiskDevice; -class BDiskDeviceRoster; -class BPartition; -class BSession; - -class BDiskDeviceList : public BHandler { -public: - BDiskDeviceList(bool useOwnLocker = true); - virtual ~BDiskDeviceList(); - - virtual void MessageReceived(BMessage *message); - virtual void SetNextHandler(BHandler *handler); - - status_t Fetch(); - void Unset(); - - bool Lock(); - void Unlock(); - - int32 CountDevices() const; - BDiskDevice *DeviceAt(int32 index) const; - - BDiskDevice *VisitEachDevice(BDiskDeviceVisitor *visitor); - BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor); - - BPartition *VisitEachMountedPartition(BDiskDeviceVisitor *visitor); - BPartition *VisitEachMountablePartition(BDiskDeviceVisitor *visitor); - - BDiskDevice *DeviceWithID(partition_id id) const; - BPartition *PartitionWithID(partition_id id) const; - - virtual void MountPointMoved(BPartition *partition); - virtual void PartitionMounted(BPartition *partition); - virtual void PartitionUnmounted(BPartition *partition); - virtual void PartitionInitialized(BPartition *partition); - virtual void PartitionResized(BPartition *partition); - virtual void PartitionMoved(BPartition *partition); - virtual void PartitionCreated(BPartition *partition); - virtual void PartitionDeleted(BPartition *partition, - partition_id partitionID); - virtual void PartitionDefragmented(BPartition *partition); - virtual void PartitionRepaired(BPartition *partition); - virtual void PartitionChanged(BPartition *partition, uint32 event); - virtual void MediaChanged(BDiskDevice *device); - virtual void DeviceAdded(BDiskDevice *device); - virtual void DeviceRemoved(BDiskDevice *device); - -private: - status_t _StartWatching(); - void _StopWatching(); - - void _MountPointMoved(BMessage *message); - void _PartitionMounted(BMessage *message); - void _PartitionUnmounted(BMessage *message); - void _PartitionInitialized(BMessage *message); - void _PartitionResized(BMessage *message); - void _PartitionMoved(BMessage *message); - void _PartitionCreated(BMessage *message); - void _PartitionDeleted(BMessage *message); - void _PartitionDefragmented(BMessage *message); - void _PartitionRepaired(BMessage *message); - void _MediaChanged(BMessage *message); - void _DeviceAdded(BMessage *message); - void _DeviceRemoved(BMessage *message); - - BDiskDevice *_FindDevice(BMessage *message); - BPartition *_FindPartition(BMessage *message); - - BDiskDevice *_UpdateDevice(BMessage *message); - -private: - BLocker *fLocker; - BObjectList fDevices; - bool fSubscribed; -}; - -#endif // _DISK_DEVICE_LIST_H diff --git a/headers/build/private/storage/DiskDevicePrivate.h b/headers/build/private/storage/DiskDevicePrivate.h deleted file mode 100644 index 02175b2eac..0000000000 --- a/headers/build/private/storage/DiskDevicePrivate.h +++ /dev/null @@ -1,55 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_PRIVATE_H -#define _DISK_DEVICE_PRIVATE_H - -#include -#include - -class BMessenger; -class BPath; - -namespace BPrivate { - -// PartitionFilter -class PartitionFilter { -public: - virtual bool Filter(BPartition *partition, int32 level) = 0; -}; - -// PartitionFilterVisitor -class PartitionFilterVisitor : public BDiskDeviceVisitor { -public: - PartitionFilterVisitor(BDiskDeviceVisitor *visitor, - PartitionFilter *filter); - - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); - -private: - BDiskDeviceVisitor *fVisitor; - PartitionFilter *fFilter; -}; - -// IDFinderVisitor -class IDFinderVisitor : public BDiskDeviceVisitor { -public: - IDFinderVisitor(partition_id id); - - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); - -private: - partition_id fID; -}; - -} // namespace BPrivate - -using BPrivate::PartitionFilter; -using BPrivate::PartitionFilterVisitor; -using BPrivate::IDFinderVisitor; - -#endif // _DISK_DEVICE_PRIVATE_H diff --git a/headers/build/private/storage/DiskDeviceRoster.h b/headers/build/private/storage/DiskDeviceRoster.h deleted file mode 100644 index 1d51dc4dfe..0000000000 --- a/headers/build/private/storage/DiskDeviceRoster.h +++ /dev/null @@ -1,166 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_ROSTER_H -#define _DISK_DEVICE_ROSTER_H - -#include - -#include -#include -#include - -class BDirectory; -class BDiskDevice; -class BDiskDeviceJob; -class BDiskDeviceVisiting; -class BDiskDeviceVisitor; -class BDiskScannerPartitionAddOn; -class BDiskSystem; -class BPartition; - -namespace BPrivate { - class AddOnImage; -} - -// watchable events -enum { - // Basic masks - B_DEVICE_REQUEST_MOUNT_POINT = 0x0001, // mount point changes - B_DEVICE_REQUEST_MOUNTING = 0x0002, // mounting/unmounting - B_DEVICE_REQUEST_PARTITION = 0x0004, // partition changes - B_DEVICE_REQUEST_DEVICE = 0x0008, // device changes (media changes) - B_DEVICE_REQUEST_DEVICE_LIST = 0x0010, // device additions/removals - B_DEVICE_REQUEST_JOB_LIST = 0x0020, // job addition/initiation/cancellation/completion - B_DEVICE_REQUEST_JOB_SIMPLE_PROGRESS = 0x0040, // simple job progress (i.e. "% complete" only) - B_DEVICE_REQUEST_JOB_EXTRA_PROGRESS = 0x0080, // extra info on job progress (no "% complete" info) - - // Combination masks - B_DEVICE_REQUEST_JOB_COMPLETE_PROGRESS = 0x00C0, // complete job progress info - B_DEVICE_REQUEST_ALL = 0xffff, // all events -}; - -// notification message "what" field -// TODO: move to app/AppDefs.h -enum { - B_DEVICE_UPDATE = 'DUPD' -}; - -// notification message "event" field values -enum { - B_DEVICE_MOUNT_POINT_MOVED, // mount point moved/renamed - B_DEVICE_PARTITION_MOUNTED, // partition mounted - B_DEVICE_PARTITION_UNMOUNTED, // partition unmounted - B_DEVICE_PARTITION_INITIALIZED, // partition initialized - B_DEVICE_PARTITION_RESIZED, // partition resized - B_DEVICE_PARTITION_MOVED, // partition moved - B_DEVICE_PARTITION_CREATED, // partition created - B_DEVICE_PARTITION_DELETED, // partition deleted - B_DEVICE_PARTITION_DEFRAGMENTED, // partition defragmented - B_DEVICE_PARTITION_REPAIRED, // partition repaired - B_DEVICE_MEDIA_CHANGED, // media changed - B_DEVICE_ADDED, // device added - B_DEVICE_REMOVED, // device removed - B_DEVICE_JOB_SCHEDULED, // job added - B_DEVICE_JOB_INITIATED, // job initiated - B_DEVICE_JOB_CANCELED, // job canceled - B_DEVICE_JOB_FINISHED, // job finished - B_DEVICE_JOB_SIMPLE_PROGRESS, // job percent complete progress - B_DEVICE_JOB_EXTRA_PROGRESS, // extended job progress info -}; - -// notification message "cause" field values -enum { - // helpful causes - B_DEVICE_CAUSE_MEDIA_CHANGED, - B_DEVICE_CAUSE_FORMATTED, // is this still applicable? - B_DEVICE_CAUSE_PARTITIONED, // is this still applicable? - B_DEVICE_CAUSE_INITIALIZED, // is this still applicable? - // unknown cause - B_DEVICE_CAUSE_UNKNOWN, - // for internal use only (e.g.: partition added, because device added) - B_DEVICE_CAUSE_PARENT_CHANGED, -}; - -class BDiskDeviceRoster { -public: - BDiskDeviceRoster(); - ~BDiskDeviceRoster(); - - status_t GetNextDevice(BDiskDevice *device); - status_t RewindDevices(); - - status_t GetNextDiskSystem(BDiskSystem *system); - status_t RewindDiskSystems(); - - // Active jobs are those that are scheduled or in-progress - status_t GetNextActiveJob(BDiskDeviceJob *job); - status_t RewindActiveJobs(); - - partition_id RegisterFileDevice(const char *filename); - // publishes: /dev/disk/virtual/files//raw - status_t UnregisterFileDevice(const char *filename); - status_t UnregisterFileDevice(partition_id device); - - bool VisitEachDevice(BDiskDeviceVisitor *visitor, - BDiskDevice *device = NULL); - bool VisitEachPartition(BDiskDeviceVisitor *visitor, - BDiskDevice *device = NULL, - BPartition **partition = NULL); - - bool VisitEachMountedPartition(BDiskDeviceVisitor *visitor, - BDiskDevice *device = NULL, - BPartition **partition = NULL); - bool VisitEachMountablePartition(BDiskDeviceVisitor *visitor, - BDiskDevice *device = NULL, - BPartition **partition = NULL); - - status_t GetDeviceWithID(partition_id id, BDiskDevice *device) const; - status_t GetPartitionWithID(partition_id id, BDiskDevice *device, - BPartition **partition) const; - - status_t GetDeviceForPath(const char *filename, BDiskDevice *device); - status_t GetPartitionForPath(const char *filename, BDiskDevice *device, - BPartition **partition); - - status_t StartWatching(BMessenger target, - uint32 eventMask = B_DEVICE_REQUEST_ALL); - status_t StartWatchingJob(BDiskDeviceJob *job, BMessenger target, - uint32 eventMask = B_DEVICE_REQUEST_JOB_COMPLETE_PROGRESS); - // TODO: Maybe better a BDiskDeviceJob::{Start,Stop}Watching()? - status_t StopWatching(BMessenger target); - -private: -#if 0 - status_t _GetObjectWithID(const char *fieldName, partition_id id, - BDiskDevice *device) const; - - // TODO: Introduce iterators instead of these functions. - - static status_t _GetNextAddOn(BDirectory **directory, int32 *index, - const char *subdir, - BPrivate::AddOnImage *image); - static status_t _GetNextAddOn(BDirectory *directory, - BPrivate::AddOnImage *image); - static status_t _GetNextAddOnDir(BPath *path, int32 *index, - const char *subdir); - static status_t _GetNextAddOnDir(BDirectory **directory, int32 *index, - const char *subdir); - - static status_t _LoadPartitionAddOn(const char *partitioningSystem, - BPrivate::AddOnImage *image, - BDiskScannerPartitionAddOn **addOn); -#endif // 0 -private: - int32 fDeviceCookie; - int32 fDiskSystemCookie; - int32 fJobCookie; -// BDirectory *fPartitionAddOnDir; -// BDirectory *fFSAddOnDir; -// int32 fPartitionAddOnDirIndex; -// int32 fFSAddOnDirIndex; -}; - -#endif // _DISK_DEVICE_ROSTER_H diff --git a/headers/build/private/storage/DiskDeviceTypes.h b/headers/build/private/storage/DiskDeviceTypes.h deleted file mode 100644 index fb5987627c..0000000000 --- a/headers/build/private/storage/DiskDeviceTypes.h +++ /dev/null @@ -1,52 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_TYPES_H -#define _DISK_DEVICE_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -// Device Types - -extern const char *kDeviceTypeFloppyDisk; -extern const char *kDeviceTypeHardDisk; -extern const char *kDeviceTypeOptical; - -// Partition types - -extern const char *kPartitionTypeUnrecognized; - -extern const char *kPartitionTypeMultisession; - -extern const char *kPartitionTypeAudioSession; -extern const char *kPartitionTypeDataSession; - -extern const char *kPartitionTypeAmiga; -extern const char *kPartitionTypeApple; -extern const char *kPartitionTypeIntel; - -extern const char *kPartitionTypeIntelPrimary; -extern const char *kPartitionTypeIntelExtended; -extern const char *kPartitionTypeIntelLogical; - -extern const char *kPartitionTypeAmigaFFS; -extern const char *kPartitionTypeBFS; -extern const char *kPartitionTypeEXT2; -extern const char *kPartitionTypeEXT3; -extern const char *kPartitionTypeFAT12; -extern const char *kPartitionTypeFAT32; -extern const char *kPartitionTypeHFS; -extern const char *kPartitionTypeHFSPlus; -extern const char *kPartitionTypeISO9660; -extern const char *kPartitionTypeReiser; -extern const char *kPartitionTypeUDF; - -#ifdef __cplusplus -} -#endif - -#endif // _DISK_DEVICE_TYPES_H diff --git a/headers/build/private/storage/DiskDeviceVisitor.h b/headers/build/private/storage/DiskDeviceVisitor.h deleted file mode 100644 index 785b3ed28f..0000000000 --- a/headers/build/private/storage/DiskDeviceVisitor.h +++ /dev/null @@ -1,25 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_DEVICE_VISITOR_H -#define _DISK_DEVICE_VISITOR_H - -#include - -class BDiskDevice; -class BPartition; - -// BDiskDeviceVisitor -class BDiskDeviceVisitor { -public: - BDiskDeviceVisitor(); - virtual ~BDiskDeviceVisitor(); - - // return true to abort iteration - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); -}; - -#endif // _DISK_DEVICE_VISITOR_H diff --git a/headers/build/private/storage/DiskScannerAddOn.h b/headers/build/private/storage/DiskScannerAddOn.h deleted file mode 100644 index 061c95f9e6..0000000000 --- a/headers/build/private/storage/DiskScannerAddOn.h +++ /dev/null @@ -1,85 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -#ifndef _DISK_SCANNER_ADD_ON -#define _DISK_SCANNER_ADD_ON - -#include - -class BDiskScannerParameterEditor; -class BPartition; -class BSession; -class BString; - -// BDiskScannerPartitionAddOn -class BDiskScannerPartitionAddOn { -public: - BDiskScannerPartitionAddOn(); - virtual ~BDiskScannerPartitionAddOn(); - - virtual const char *ShortName() = 0; - virtual const char *LongName() = 0; - - virtual BDiskScannerParameterEditor *CreateEditor(const BSession *session, - const char *parameters) = 0; - -private: - virtual void _ReservedDiskScannerPartitionAddOn1(); - virtual void _ReservedDiskScannerPartitionAddOn2(); - virtual void _ReservedDiskScannerPartitionAddOn3(); - virtual void _ReservedDiskScannerPartitionAddOn4(); - virtual void _ReservedDiskScannerPartitionAddOn5(); - - uint32 _reserved[8]; -}; - -// BDiskScannerFSAddOn -class BDiskScannerFSAddOn { -public: - BDiskScannerFSAddOn(); - virtual ~BDiskScannerFSAddOn(); - - virtual const char *ShortName() = 0; - virtual const char *LongName() = 0; - - virtual BDiskScannerParameterEditor *CreateEditor( - const BPartition *partition, const char *parameters) = 0; - -private: - virtual void _ReservedDiskScannerFSAddOn1(); - virtual void _ReservedDiskScannerFSAddOn2(); - virtual void _ReservedDiskScannerFSAddOn3(); - virtual void _ReservedDiskScannerFSAddOn4(); - virtual void _ReservedDiskScannerFSAddOn5(); - - uint32 _reserved[8]; -}; - -// BDiskScannerParameterEditor -class BDiskScannerParameterEditor { -public: - BDiskScannerParameterEditor(); - virtual ~BDiskScannerParameterEditor(); - - virtual BView *View(); - virtual bool EditingDone(); - virtual status_t GetParameters(BString *parameters); - -private: - virtual void _ReservedDiskScannerParameterEditor1(); - virtual void _ReservedDiskScannerParameterEditor2(); - virtual void _ReservedDiskScannerParameterEditor3(); - virtual void _ReservedDiskScannerParameterEditor4(); - virtual void _ReservedDiskScannerParameterEditor5(); - - uint32 _reserved[8]; -}; - -// partition add-ons -extern "C" BDiskScannerPartitionAddOn *create_ds_partition_add_on(); - -// fs add-ons -extern "C" BDiskScannerFSAddOn *create_ds_fs_add_on(); - -#endif // _DISK_SCANNER_ADD_ON diff --git a/headers/build/private/storage/DiskSystem.h b/headers/build/private/storage/DiskSystem.h deleted file mode 100644 index 3954c2bf99..0000000000 --- a/headers/build/private/storage/DiskSystem.h +++ /dev/null @@ -1,64 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _DISK_SYSTEM_H -#define _DISK_SYSTEM_H - -#include -#include - -class BPartition; -struct user_disk_system_info; - -class BDiskSystem { -public: - BDiskSystem(); - ~BDiskSystem(); - - status_t InitCheck() const; - - const char *Name() const; - const char *PrettyName() const; - - bool SupportsDefragmenting(bool *whileMounted) const; - bool SupportsRepairing(bool checkOnly, bool *whileMounted) const; - bool SupportsResizing(bool *whileMounted) const; - bool SupportsResizingChild() const; - bool SupportsMoving(bool *whileMounted) const; - bool SupportsMovingChild() const; - bool SupportsSettingName() const; - bool SupportsSettingContentName(bool *whileMounted) const; - bool SupportsSettingType() const; - bool SupportsSettingParameters() const; - bool SupportsSettingContentParameters(bool *whileMounted) const; - bool SupportsCreatingChild() const; - bool SupportsDeletingChild() const; - bool SupportsInitializing() const; - - status_t GetNextSupportedType(BPartition *partition, int32 *cookie, - char *type) const; - // Returns all types the disk system supports for children of the - // supplied partition. - status_t GetTypeForContentType(const char *contentType, char *type) const; - - bool IsPartitioningSystem() const; - bool IsFileSystem() const; - bool IsSubSystemFor(BPartition *parent) const; - -private: - status_t _SetTo(disk_system_id id); - status_t _SetTo(user_disk_system_info *info); - void _Unset(); - - friend class BDiskDeviceRoster; - friend class BPartition; - - disk_system_id fID; - BString fName; - BString fPrettyName; - uint32 fFlags; -}; - -#endif // _DISK_SYSTEM_H diff --git a/headers/build/private/storage/NodeMonitorHandler.h b/headers/build/private/storage/NodeMonitorHandler.h deleted file mode 100644 index 97fb3c1646..0000000000 --- a/headers/build/private/storage/NodeMonitorHandler.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _NODE_MONITOR_HANDLER_H -#define _NODE_MONITOR_HANDLER_H - -#include -#include -#include -#include - -namespace BPrivate { -namespace Storage { - -class NodeMonitorHandler : public BHandler { -private: - typedef BHandler inherited; -public: - NodeMonitorHandler(const char * name = "NodeMonitorHandler"); - virtual ~NodeMonitorHandler(); - - virtual void MessageReceived(BMessage * msg); - - // useful utility functions -static status_t make_entry_ref(dev_t device, ino_t directory, - const char * name, - entry_ref * ref); -static void make_node_ref(dev_t device, ino_t node, node_ref * ref); - -protected: - // hooks for subclass - virtual void EntryCreated(const char *name, ino_t directory, - dev_t device, ino_t node); - virtual void EntryRemoved(ino_t directory, dev_t device, ino_t node); - virtual void EntryMoved(const char *name, ino_t from_directory, - ino_t to_directory, dev_t device, ino_t node); - virtual void StatChanged(ino_t node, dev_t device); - virtual void AttrChanged(ino_t node, dev_t device); - virtual void DeviceMounted(dev_t new_device, dev_t device, - ino_t directory); - virtual void DeviceUnmounted(dev_t new_device); - -private: - status_t HandleEntryCreated(BMessage * msg); - status_t HandleEntryRemoved(BMessage * msg); - status_t HandleEntryMoved(BMessage * msg); - status_t HandleStatChanged(BMessage * msg); - status_t HandleAttrChanged(BMessage * msg); - status_t HandleDeviceMounted(BMessage * msg); - status_t HandleDeviceUnmounted(BMessage * msg); -}; - -}; // namespace Storage -}; // namespace BPrivate - -using namespace BPrivate::Storage; - -#endif // _NODE_MONITOR_HANDLER_H diff --git a/headers/build/private/storage/Partition.h b/headers/build/private/storage/Partition.h deleted file mode 100644 index ea05e38f9b..0000000000 --- a/headers/build/private/storage/Partition.h +++ /dev/null @@ -1,172 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _PARTITION_H -#define _PARTITION_H - -#include -#include -#include -#include - -class BBitmap; -class BDiskDevice; -class BDiskDeviceParameterEditor; -class BDiskDeviceVisitor; -class BDiskSystem; -class BPartitioningInfo; -class BPath; -class BVolume; -struct user_partition_data; - -class BPartition { -public: - // Partition Info - - off_t Offset() const; // 0 for devices - off_t Size() const; - off_t ContentSize() const; // 0 if uninitialized - uint32 BlockSize() const; - int32 Index() const; // 0 for devices - uint32 Status() const; - - bool ContainsFileSystem() const; - bool ContainsPartitioningSystem() const; - - bool IsDevice() const; - bool IsReadOnly() const; - bool IsMounted() const; - bool IsBusy() const; - - uint32 Flags() const; - - const char *Name() const; - const char *ContentName() const; - const char *Type() const; // See DiskDeviceTypes.h - const char *ContentType() const; // See DiskDeviceTypes.h - partition_id ID() const; - - status_t GetDiskSystem(BDiskSystem *diskSystem) const; - - virtual status_t GetPath(BPath *path) const; - status_t GetVolume(BVolume *volume) const; - status_t GetIcon(BBitmap *icon, icon_size which) const; - status_t GetMountPoint(BPath *mountPoint) const; - - status_t Mount(const char *mountPoint = NULL, uint32 mountFlags = 0, - const char *parameters = NULL); - status_t Unmount(uint32 unmountFlags = 0); - - // Hierarchy Info - - BDiskDevice *Device() const; - BPartition *Parent() const; - BPartition *ChildAt(int32 index) const; - int32 CountChildren() const; - BPartition *FindDescendant(partition_id id) const; - - status_t GetPartitioningInfo(BPartitioningInfo *info) const; - - BPartition *VisitEachChild(BDiskDeviceVisitor *visitor); - virtual BPartition *VisitEachDescendant(BDiskDeviceVisitor *visitor); - - // Self Modification - - bool CanDefragment(bool *whileMounted = NULL) const; - status_t Defragment() const; - - bool CanRepair(bool checkOnly, bool *whileMounted = NULL) const; - status_t Repair(bool checkOnly) const; - - bool CanResize(bool *canResizeContents = NULL, - bool *whileMounted = NULL) const; - status_t ValidateResize(off_t *size) const; - status_t Resize(off_t size); - - bool CanMove(BObjectList *unmovableDescendants = NULL, - BObjectList *movableOnlyIfUnmounted = NULL) const; - status_t ValidateMove(off_t *newOffset) const; - status_t Move(off_t newOffset); - - bool CanSetName() const; - status_t ValidateSetName(char *name) const; - // adjusts name to be suitable - status_t SetName(const char *name); - - bool CanSetContentName(bool *whileMounted = NULL) const; - status_t ValidateSetContentName(char *name) const; - // adjusts name to be suitable - status_t SetContentName(const char *name); - - bool CanSetType() const; - status_t ValidateSetType(const char *type) const; - // type must be one the parent disk system's GetNextSupportedType() - // returns. - status_t SetType(const char *type); - - bool CanEditParameters() const; - status_t GetParameterEditor(BDiskDeviceParameterEditor **editor); - status_t SetParameters(const char *parameters); - - bool CanEditContentParameters(bool *whileMounted = NULL) const; - status_t GetContentParameterEditor(BDiskDeviceParameterEditor **editor); - status_t SetContentParameters(const char *parameters); - - bool CanInitialize(const char *diskSystem) const; - status_t GetInitializationParameterEditor(const char *system, - BDiskDeviceParameterEditor **editor) const; - status_t ValidateInitialize(const char *diskSystem, char *name, - const char *parameters); - status_t Initialize(const char *diskSystem, const char *name, - const char *parameters); - status_t Uninitialize(); - - // Modification of child partitions - - bool CanCreateChild() const; - status_t GetChildCreationParameterEditor(const char *system, - BDiskDeviceParameterEditor **editor) const; - status_t ValidateCreateChild(off_t *start, off_t *size, - const char *type, const char *parameters) const; - status_t CreateChild(off_t start, off_t size, const char *type, - const char *parameters, BPartition **child = NULL); - - bool CanDeleteChild(int32 index) const; - status_t DeleteChild(int32 index); - -private: - BPartition(); - BPartition(const BPartition &); - virtual ~BPartition(); - BPartition & operator=(const BPartition &); - - status_t _SetTo(BDiskDevice *device, BPartition *parent, - user_partition_data *data); - void _Unset(); - status_t _RemoveObsoleteDescendants(user_partition_data *data, - bool *updated); - status_t _Update(user_partition_data *data, bool *updated); - void _RemoveChild(int32 index); - - bool _IsShadow() const; - partition_id _ShadowID() const; - disk_system_id _DiskSystem() const; - int32 _ChangeCounter() const; - - int32 _CountDescendants() const; - int32 _Level() const; - virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level); - BPartition *_VisitEachDescendant(BDiskDeviceVisitor *visitor, - int32 level = -1); - - friend class BDiskDevice; - friend class BDiskSystem; - - BDiskDevice *fDevice; - BPartition *fParent; - user_partition_data *fPartitionData; -}; - -#endif // _PARTITION_H diff --git a/headers/build/private/storage/PartitioningInfo.h b/headers/build/private/storage/PartitioningInfo.h deleted file mode 100644 index 0d779e7692..0000000000 --- a/headers/build/private/storage/PartitioningInfo.h +++ /dev/null @@ -1,36 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- - -#ifndef _PARTITIONING_INFO_H -#define _PARTITIONING_INFO_H - -#include - -struct partitionable_space_data; - -class BPartitioningInfo { -public: - BPartitioningInfo(); - virtual ~BPartitioningInfo(); - - void Unset(); - - partition_id PartitionID() const; - - status_t GetPartitionableSpaceAt(int32 index, off_t *offset, - off_t *size) const; - int32 CountPartitionableSpaces() const; - -private: - status_t _SetTo(partition_id partition, int32 changeCounter); - - friend class BPartition; - - partition_id fPartitionID; - partitionable_space_data *fSpaces; - int32 fCount; -}; - -#endif // _PARTITIONING_INFO_H diff --git a/headers/build/private/storage/QueryPredicate.h b/headers/build/private/storage/QueryPredicate.h deleted file mode 100644 index f154d9e3a6..0000000000 --- a/headers/build/private/storage/QueryPredicate.h +++ /dev/null @@ -1,210 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file QueryPredicate.h - BQuery predicate helper classes interface declaration. -*/ -#ifndef _QUERY_PREDICATE_H -#define _QUERY_PREDICATE_H - -#include - -#include -#include -#include - -namespace BPrivate { -namespace Storage { - -// QueryNode -class QueryNode { -public: - QueryNode(); - virtual ~QueryNode(); - - virtual uint32 Arity() const = 0; - virtual status_t SetChildAt(QueryNode *child, int32 index) = 0; - virtual QueryNode *ChildAt(int32 index) = 0; - - virtual status_t GetString(BString &predicate) = 0; -}; - -// LeafNode -class LeafNode : public QueryNode { -public: - LeafNode(); - virtual ~LeafNode(); - - virtual uint32 Arity() const; - virtual status_t SetChildAt(QueryNode *child, int32 index); - virtual QueryNode *ChildAt(int32 index); -}; - -// UnaryNode -class UnaryNode : public QueryNode { -public: - UnaryNode(); - virtual ~UnaryNode(); - - virtual uint32 Arity() const; - virtual status_t SetChildAt(QueryNode *child, int32 index); - virtual QueryNode *ChildAt(int32 index); - -protected: - QueryNode *fChild; -}; - -// BinaryNode -class BinaryNode : public QueryNode { -public: - BinaryNode(); - virtual ~BinaryNode(); - - virtual uint32 Arity() const; - virtual status_t SetChildAt(QueryNode *child, int32 index); - virtual QueryNode *ChildAt(int32 index); - -protected: - QueryNode *fChild1; - QueryNode *fChild2; -}; - -// AttributeNode -class AttributeNode : public LeafNode { -public: - AttributeNode(const char *attribute); - - virtual status_t GetString(BString &predicate); - -private: - BString fAttribute; -}; - -// StringNode -class StringNode : public LeafNode { -public: - StringNode(const char *value, bool caseInsensitive = false); - - virtual status_t GetString(BString &predicate); - - inline const char *Value() const { return fValue.String(); } - -private: - BString fValue; -}; - -// DateNode -class DateNode : public LeafNode { -public: - DateNode(const char *value); - - virtual status_t GetString(BString &predicate); - -private: - BString fValue; -}; - -// ValueNode -template -class ValueNode : public LeafNode { -public: - ValueNode(const ValueType &value); - - virtual status_t GetString(BString &predicate); - -private: - ValueType fValue; -}; - -// constructor -template -ValueNode::ValueNode(const ValueType &value) - : LeafNode(), - fValue(value) -{ -} - -// GetString -template -status_t -ValueNode::GetString(BString &predicate) -{ - predicate.SetTo(""); - predicate << fValue; - return B_OK; -} - -// specializations for float and double -template<> status_t ValueNode::GetString(BString &predicate); -template<> status_t ValueNode::GetString(BString &predicate); - - -// short hands -typedef ValueNode Int32ValueNode; -typedef ValueNode UInt32ValueNode; -typedef ValueNode Int64ValueNode; -typedef ValueNode UInt64ValueNode; -typedef ValueNode FloatValueNode; -typedef ValueNode DoubleValueNode; - - -// SpecialOpNode -class SpecialOpNode : public LeafNode { -public: - SpecialOpNode(query_op op); - - virtual status_t GetString(BString &predicate); - -private: - query_op fOp; -}; - -// UnaryOpNode -class UnaryOpNode : public UnaryNode { -public: - UnaryOpNode(query_op op); - - virtual status_t GetString(BString &predicate); - -private: - query_op fOp; -}; - -// BinaryOpNode -class BinaryOpNode : public BinaryNode { -public: - BinaryOpNode(query_op op); - - virtual status_t GetString(BString &predicate); - -private: - query_op fOp; -}; - - -// QueryStack -class QueryStack { -public: - QueryStack(); - virtual ~QueryStack(); - - status_t PushNode(QueryNode *node); - QueryNode *PopNode(); - - status_t ConvertToTree(QueryNode *&rootNode); - -private: - status_t _GetSubTree(QueryNode *&rootNode); - -private: - BList fNodes; -}; - -}; // namespace Storage -}; // namespace BPrivate - -#endif // _QUERY_PREDICATE_H - - diff --git a/headers/build/private/storage/mime/AssociatedTypes.h b/headers/build/private/storage/mime/AssociatedTypes.h deleted file mode 100644 index cb6cd7baf5..0000000000 --- a/headers/build/private/storage/mime/AssociatedTypes.h +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file AssociatedTypes.h - AssociatedTypes class declarations -*/ - -#ifndef _MIME_ASSOCIATED_TYPES_H -#define _MIME_ASSOCIATED_TYPES_H - -#include - -#include -#include -#include - -class BMessage; -class BString; - -namespace BPrivate { -namespace Storage { -namespace Mime { - -class AssociatedTypes { -public: - AssociatedTypes(); - ~AssociatedTypes(); - - status_t GetAssociatedTypes(const char *extension, BMessage *types); - status_t GuessMimeType(const char *filename, BString *result); - status_t GuessMimeType(const entry_ref *ref, BString *result); - - status_t SetFileExtensions(const char *type, const BMessage *extensions); - status_t DeleteFileExtensions(const char *type); - - void PrintToStream() const; -private: - status_t AddAssociatedType(const char *extension, const char *type); - status_t RemoveAssociatedType(const char *extension, const char *type); - - status_t BuildAssociatedTypesTable(); - - status_t ProcessType(const char *type); - std::string PrepExtension(const char *extension) const; - - std::map > fFileExtensions; // mime type => set of associated file extensions - std::map > fAssociatedTypes; // file extension => set of associated mime types - - bool fHaveDoneFullBuild; -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _MIME_ASSOCIATED_TYPES_H diff --git a/headers/build/private/storage/mime/CreateAppMetaMimeThread.h b/headers/build/private/storage/mime/CreateAppMetaMimeThread.h deleted file mode 100644 index acab27d886..0000000000 --- a/headers/build/private/storage/mime/CreateAppMetaMimeThread.h +++ /dev/null @@ -1,31 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file CreateAppMetaMimeThread.h - CreateAppMetaMimeThread interface declaration -*/ - -#ifndef _CREATE_APP_META_MIME_THREAD_H -#define _CREATE_APP_META_MIME_THREAD_H - -#include - -namespace BPrivate { -namespace Storage { -namespace Mime { - -class CreateAppMetaMimeThread : public MimeUpdateThread { -public: - CreateAppMetaMimeThread(const char *name, int32 priority, - BMessenger managerMessenger, const entry_ref *root, bool recursive, - int32 force, BMessage *replyee); - status_t DoMimeUpdate(const entry_ref *entry, bool *entryIsDir); -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _CREATE_APP_META_MIME_THREAD_H diff --git a/headers/build/private/storage/mime/Database.h b/headers/build/private/storage/mime/Database.h deleted file mode 100644 index 99ad3087b5..0000000000 --- a/headers/build/private/storage/mime/Database.h +++ /dev/null @@ -1,122 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Database.cpp - Database class declarations -*/ - -#ifndef _MIME_DATABASE_H -#define _MIME_DATABASE_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -class BNode; -class BBitmap; -class BMessage; -class BString; - -struct entry_ref; - -namespace BPrivate { -namespace Storage { -namespace Mime { - -// types of mime update functions that may be run asynchronously -typedef enum { - B_REG_UPDATE_MIME_INFO, - B_REG_CREATE_APP_META_MIME, -} mime_update_function; - -class Database { -public: - Database(); - ~Database(); - - status_t InitCheck() const; - - // Type management - status_t Install(const char *type); - status_t Delete(const char *type); - - // Set() - status_t SetAppHint(const char *type, const entry_ref *ref); - status_t SetAttrInfo(const char *type, const BMessage *info); - status_t SetShortDescription(const char *type, const char *description); - status_t SetLongDescription(const char *type, const char *description); - status_t SetFileExtensions(const char *type, const BMessage *extensions); - status_t SetIcon(const char *type, const void *data, size_t dataSize, icon_size which); - status_t SetIconForType(const char *type, const char *fileType, const void *data, - size_t dataSize, icon_size which); - status_t SetPreferredApp(const char *type, const char *signature, app_verb verb = B_OPEN); - status_t SetSnifferRule(const char *type, const char *rule); - status_t SetSupportedTypes(const char *type, const BMessage *types, bool fullSync); - - // Non-atomic Get() - status_t GetInstalledSupertypes(BMessage *super_types); - status_t GetInstalledTypes(BMessage *types); - status_t GetInstalledTypes(const char *super_type, - BMessage *subtypes); - status_t GetSupportingApps(const char *type, BMessage *signatures); - status_t GetAssociatedTypes(const char *extension, BMessage *types); - - // Sniffer - status_t GuessMimeType(const entry_ref *file, BString *result); - status_t GuessMimeType(const void *buffer, int32 length, BString *result); - status_t GuessMimeType(const char *filename, BString *result); - - // Monitor - status_t StartWatching(BMessenger target); - status_t StopWatching(BMessenger target); - - // Delete() - status_t DeleteAppHint(const char *type); - status_t DeleteAttrInfo(const char *type); - status_t DeleteShortDescription(const char *type); - status_t DeleteLongDescription(const char *type); - status_t DeleteFileExtensions(const char *type); - status_t DeleteIcon(const char *type, icon_size size); - status_t DeleteIconForType(const char *type, const char *fileType, icon_size which); - status_t DeletePreferredApp(const char *type, app_verb verb = B_OPEN); - status_t DeleteSnifferRule(const char *type); - status_t DeleteSupportedTypes(const char *type, bool fullSync); - -private: - // Functions to send monitor notifications - status_t SendInstallNotification(const char *type); - status_t SendDeleteNotification(const char *type); - status_t SendMonitorUpdate(int32 which, const char *type, const char *extraType, - bool largeIcon, int32 action); - status_t SendMonitorUpdate(int32 which, const char *type, const char *extraType, - int32 action); - status_t SendMonitorUpdate(int32 which, const char *type, bool largeIcon, - int32 action); - status_t SendMonitorUpdate(int32 which, const char *type, - int32 action); - status_t SendMonitorUpdate(BMessage &msg); - - status_t fStatus; - std::set fMonitorMessengers; - AssociatedTypes fAssociatedTypes; - InstalledTypes fInstalledTypes; - SnifferRules fSnifferRules; - SupportingApps fSupportingApps; -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _MIME_DATABASE_H diff --git a/headers/build/private/storage/mime/InstalledTypes.h b/headers/build/private/storage/mime/InstalledTypes.h deleted file mode 100644 index c2a0654277..0000000000 --- a/headers/build/private/storage/mime/InstalledTypes.h +++ /dev/null @@ -1,63 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file InstalledTypes.h - InstalledTypes class declarations -*/ - -#ifndef _MIME_INSTALLED_TYPES_H -#define _MIME_INSTALLED_TYPES_H - -#include -#include - -#include -#include - -class BMessage; - -namespace BPrivate { -namespace Storage { -namespace Mime { - -class InstalledTypes { -public: - InstalledTypes(); - ~InstalledTypes(); - - status_t GetInstalledTypes(BMessage *types); - status_t GetInstalledTypes(const char *supertype, BMessage *types); - status_t GetInstalledSupertypes(BMessage *types); - - status_t AddType(const char *type); - status_t RemoveType(const char *type); -private: - status_t AddSupertype(const char *super, std::map::iterator &i); - status_t AddSubtype(const char *super, const char *sub); - status_t AddSubtype(Supertype &super, const char *sub); - - status_t RemoveSupertype(const char *super); - status_t RemoveSubtype(const char *super, const char *sub); - - void Unset(); - void ClearCachedMessages(); - - status_t CreateMessageWithTypes(BMessage **result) const; - status_t CreateMessageWithSupertypes(BMessage **result) const; - void FillMessageWithSupertypes(BMessage *msg); - - status_t BuildInstalledTypesList(); - - std::map fSupertypes; - BMessage *fCachedMessage; - BMessage *fCachedSupertypesMessage; - bool fHaveDoneFullBuild; -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _MIME_INSTALLED_TYPES_H diff --git a/headers/build/private/storage/mime/SnifferRules.h b/headers/build/private/storage/mime/SnifferRules.h deleted file mode 100644 index ccd69c7a7d..0000000000 --- a/headers/build/private/storage/mime/SnifferRules.h +++ /dev/null @@ -1,66 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file SnifferRules.h - SnifferRules class declarations -*/ - -#ifndef _MIME_SNIFFER_RULES_H -#define _MIME_SNIFFER_RULES_H - -#include - -#include -#include - -struct entry_ref; -class BString; - -namespace BPrivate { -namespace Storage { - -namespace Sniffer { - class Rule; -} - -namespace Mime { - -class SnifferRules { -public: - SnifferRules(); - ~SnifferRules(); - - status_t GuessMimeType(const entry_ref *ref, BString *type); - status_t GuessMimeType(const void *buffer, int32 length, BString *type); - - status_t SetSnifferRule(const char *type, const char *rule); - status_t DeleteSnifferRule(const char *type); - - void PrintToStream() const; - - struct sniffer_rule { - std::string type; // The mime type that own the rule - std::string rule_string; // The unparsed string version of the rule - BPrivate::Storage::Sniffer::Rule *rule; // The parsed rule - - sniffer_rule(BPrivate::Storage::Sniffer::Rule *rule = NULL); - ~sniffer_rule(); - }; -private: - status_t BuildRuleList(); - status_t GuessMimeType(BPositionIO *data, BString *type); - ssize_t MaxBytesNeeded(); - status_t ProcessType(const char *type, ssize_t *bytesNeeded); - - std::list fRuleList; - ssize_t fMaxBytesNeeded; - bool fHaveDoneFullBuild; -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _MIME_SNIFFER_H diff --git a/headers/build/private/storage/mime/Supertype.h b/headers/build/private/storage/mime/Supertype.h deleted file mode 100644 index 8d691e5d2b..0000000000 --- a/headers/build/private/storage/mime/Supertype.h +++ /dev/null @@ -1,50 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Supertype.h - Supertype class declarations -*/ - -#ifndef _MIME_SUPERTYPE_H -#define _MIME_SUPERTYPE_H - -#include - -#include -#include - -class BMessage; - -namespace BPrivate { -namespace Storage { -namespace Mime { - -class Supertype { -public: - Supertype(const char *super = NULL); - ~Supertype(); - - status_t GetInstalledSubtypes(BMessage *types); - - status_t AddSubtype(const char *sub); - status_t RemoveSubtype(const char *sub); - - void SetName(const char *super); - const char* GetName(); - - status_t FillMessageWithTypes(BMessage &msg) const; -private: - status_t CreateMessageWithTypes(BMessage **result) const; - - std::set fSubtypes; - BMessage *fCachedMessage; - std::string fName; -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _MIME_SUPERTYPE_H diff --git a/headers/build/private/storage/mime/SupportingApps.h b/headers/build/private/storage/mime/SupportingApps.h deleted file mode 100644 index a7b31c8bf6..0000000000 --- a/headers/build/private/storage/mime/SupportingApps.h +++ /dev/null @@ -1,51 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file SupportingApps.h - SupportingApps class declarations -*/ - -#ifndef _MIME_SUPPORTING_APPS_H -#define _MIME_SUPPORTING_APPS_H - -#include - -#include -#include -#include - -class BMessage; - -namespace BPrivate { -namespace Storage { -namespace Mime { - -class SupportingApps { -public: - SupportingApps(); - ~SupportingApps(); - - status_t GetSupportingApps(const char *type, BMessage *apps); - - status_t SetSupportedTypes(const char *app, const BMessage *types, bool fullSync); - status_t DeleteSupportedTypes(const char *app, bool fullSync); -private: - status_t AddSupportingApp(const char *type, const char *app); - status_t RemoveSupportingApp(const char *type, const char *app); - - status_t BuildSupportingAppsTable(); - - std::map > fSupportedTypes; // app sig => set of supported types - std::map > fSupportingApps; // mime type => set of supporting apps - std::map > fStrandedTypes; // app sig => set of no longer supported types for whom the - // given app is still listed as a supporting app - bool fHaveDoneFullBuild; -}; - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - -#endif // _MIME_SUPPORTING_APPS_H diff --git a/headers/build/private/storage/sniffer/CharStream.h b/headers/build/private/storage/sniffer/CharStream.h deleted file mode 100644 index 124901d4f5..0000000000 --- a/headers/build/private/storage/sniffer/CharStream.h +++ /dev/null @@ -1,56 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/CharStream.h - Character stream class -*/ -#ifndef _SNIFFER_CHAR_STREAM_H -#define _SNIFFER_CHAR_STREAM_H - -#include - -#include - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -//! Manages a stream of characters -/*! CharStream is used by the scanner portion of the parser, which is implemented - in TokenStream::SetTo(). - - It's also used by BPrivate::TRoster while parsing through the the - roster's RosterSettings file. -*/ -class CharStream { -public: - CharStream(const std::string &string); - CharStream(); - virtual ~CharStream(); - - status_t SetTo(const std::string &string); - void Unset(); - status_t InitCheck() const; - bool IsEmpty() const; - size_t Pos() const; - const std::string& String() const; - - char Get(); - void Unget(); - -private: - std::string fString; - size_t fPos; - status_t fCStatus; - - CharStream(const CharStream &ref); - CharStream& operator=(const CharStream &ref); -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_CHAR_STREAM_H diff --git a/headers/build/private/storage/sniffer/DisjList.h b/headers/build/private/storage/sniffer/DisjList.h deleted file mode 100644 index 8f1841fa6f..0000000000 --- a/headers/build/private/storage/sniffer/DisjList.h +++ /dev/null @@ -1,41 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/DisjList.h - Mime Sniffer Disjunction List declarations -*/ -#ifndef _SNIFFER_DISJ_LIST_H -#define _SNIFFER_DISJ_LIST_H - -#include - -class BPositionIO; - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -//! Abstract class defining methods acting on a list of ORed patterns -class DisjList { -public: - DisjList(); - virtual ~DisjList(); - - virtual bool Sniff(BPositionIO *data) const = 0; - virtual ssize_t BytesNeeded() const = 0; - - void SetCaseInsensitive(bool how); - bool IsCaseInsensitive(); -protected: - bool fCaseInsensitive; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_DISJ_LIST_H - - diff --git a/headers/build/private/storage/sniffer/Err.h b/headers/build/private/storage/sniffer/Err.h deleted file mode 100644 index 9a29c56dae..0000000000 --- a/headers/build/private/storage/sniffer/Err.h +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/Err.h - Mime Sniffer Error class declarations -*/ -#ifndef _SNIFFER_ERR_H -#define _SNIFFER_ERR_H - -#include -#include - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -//! Exception class used by the MIME Sniffer -/*! Each exception contains an error message, and an byte offset into - the original rule that generated the error, for the sake of - providing spiffy error messages of the following sort: - - - "1.0 ('abc' & 0xFFAAFFAA)" - ^ Sniffer pattern error: pattern and mask lengths do not match - -*/ -class Err { -public: - Err(const char *msg, const ssize_t pos); - Err(const std::string &msg, const ssize_t pos); - Err(const Err &ref); - virtual ~Err(); - Err& operator=(const Err &ref); - - status_t SetTo(const char *msg, const ssize_t pos); - status_t SetTo(const std::string &msg, const ssize_t pos); - void Unset(); - - void SetMsg(const char *msg); - void SetPos(ssize_t pos); - - const char* Msg() const; - ssize_t Pos() const; - -private: - char *fMsg; - ssize_t fPos; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_ERR_H - - diff --git a/headers/build/private/storage/sniffer/Parser.h b/headers/build/private/storage/sniffer/Parser.h deleted file mode 100644 index 2e2e7d86a4..0000000000 --- a/headers/build/private/storage/sniffer/Parser.h +++ /dev/null @@ -1,311 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/Parser.h - MIME sniffer rule parser declarations -*/ -#ifndef _SNIFFER_PARSER_H -#define _SNIFFER_PARSER_H - -#include -#include -#include -#include -#include -#include -#include -#include - -class BString; - -//! MIME Sniffer related classes -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class Rule; -class DisjList; -class RPattern; -class Pattern; - -//------------------------------------------------------------------------------ -// The mighty parsing function ;-) -//------------------------------------------------------------------------------ - -status_t parse(const char *rule, Rule *result, BString *parseError = NULL); - -//------------------------------------------------------------------------------ -// Classes used internally by the parser -//------------------------------------------------------------------------------ - -//! Types of tokens -typedef enum TokenType { - EmptyToken, - LeftParen, - RightParen, - LeftBracket, - RightBracket, - Colon, - Divider, - Ampersand, - CaseInsensitiveFlag, - CharacterString, - Integer, - FloatingPoint -}; - -/*! \brief Returns a NULL-terminated string contating the - name of the given token type -*/ -const char* tokenTypeToString(TokenType type); - -//! Base token class returned by TokenStream -/*! Each token represents a single chunk of relevant information - in a given rule. For example, the floating point number "1.2e-35", - originally represented as a 7-character string, is added to the - token stream as a single FloatToken object. -*/ -class Token { -public: - Token(TokenType type = EmptyToken, const ssize_t pos = -1); - virtual ~Token(); - TokenType Type() const; - virtual const std::string& String() const; - virtual int32 Int() const; - virtual double Float() const; - ssize_t Pos() const; - bool operator==(Token &ref) const; -protected: - TokenType fType; - ssize_t fPos; -}; - -//! String token class -/*! Single-quoted strings, double-quoted strings, unquoted strings, and - hex literals are all converted to StringToken objects by the scanner - and from then on treated uniformly. -*/ -class StringToken : public Token { -public: - StringToken(const std::string &str, const ssize_t pos); - virtual ~StringToken(); - virtual const std::string& String() const; -protected: - std::string fString; -}; - -//! Integer token class -/*! Signed or unsigned integer literals are coverted to IntToken objects, - which may then be treated as either ints or floats (since a priority - of "1" would be valid, but scanned as an int instead of a float). -*/ -class IntToken : public Token { -public: - IntToken(const int32 value, const ssize_t pos); - virtual ~IntToken(); - virtual int32 Int() const; - virtual double Float() const; -protected: - int32 fValue; -}; - -//! Floating point token class -/*! Signed or unsigned, extended or non-extended notation floating point - numbers are converted to FloatToken objects by the scanner. -*/ -class FloatToken : public Token { -public: - FloatToken(const double value, const ssize_t pos); - virtual ~FloatToken(); - virtual double Float() const; -protected: - double fValue; -}; - -//! Manages a stream of Token objects -/*! Provides Get() and Unget() operations, some handy shortcut operations (Read() - and CondRead()), and handles memory management with respect to all the - Token objects in the stream (i.e. never delete a Token object returned by Get()). - - Also, the scanner portion of the parser is implemented in the TokenStream's - SetTo() function. -*/ -class TokenStream { -public: - TokenStream(const std::string &string); - TokenStream(); - ~TokenStream(); - - status_t SetTo(const std::string &string); - void Unset(); - status_t InitCheck() const; - - const Token* Get(); - void Unget(); - - void Read(TokenType type); - bool CondRead(TokenType type); - - ssize_t Pos() const; - ssize_t EndPos() const; - - bool IsEmpty() const; - -private: - void AddToken(TokenType type, ssize_t pos); - void AddString(const std::string &str, ssize_t pos); - void AddInt(const char *str, ssize_t pos); - void AddFloat(const char *str, ssize_t pos); - - std::vector fTokenList; - status_t fCStatus; - int fPos; - int fStrLen; - - - TokenStream(const TokenStream &ref); - TokenStream& operator=(const TokenStream &ref); -}; - -//! Handles parsing a sniffer rule, yielding either a parsed rule or a descriptive error message. -/*! A MIME sniffer rule is valid if it is well-formed with respect to the - following grammar and fulfills some further conditions listed thereafter: - - - Rule ::= LWS Priority LWS ConjList LWS - ConjList ::= DisjList (LWS DisjList)* - DisjList ::= "(" LWS PatternList LWS ")" - | "(" LWS RPatternList LWS ")" - | Range LWS "(" LWS PatternList LWS ")" - RPatternList ::= [Flag LWS] RPattern (LWS "|" LWS [Flag LWS] RPattern)* - PatternList ::= [Flag LWS] Pattern (LWS "|" LWS [Flag LWS] Pattern)* - - RPattern ::= LWS Range LWS Pattern - Pattern ::= PString [ LWS "&" LWS Mask ] - Range ::= "[" LWS SDecimal [LWS ":" LWS SDecimal] LWS "]" - - Priority ::= Float - Mask ::= PString - PString ::= HexLiteral | QuotedString | UnquotedString - - HexLiteral ::= "0x" HexPair HexPair* - HexPair ::= HexChar HexChar - - QuotedString ::= SingleQuotedString | DoubleQuotedString - SQuotedString := "'" SQChar+ "'" - DQuotedString := '"' DQChar+ '"' - - UnquotedString ::= EscapedChar UChar* - EscapedChar ::= OctalEscape | HexEscape | "\" Char - OctalEscape ::= "\" [[OctHiChar] OctChar] OctChar - HexEscape ::= "\x" HexPair - - Flag ::= "-i" - - SDecimal ::= [Sign] Decimal - Decimal ::= DecChar DecChar* - Float ::= Fixed [("E" | "e") SDecimal] - Fixed ::= SDecimal ["." [Decimal]] | [Sign] "." Decimal - Sign ::= "+" | "-" - - PunctuationChar ::= "(" | ")" | "[" | "]" | "|" | "&" | ":" - OctHiChar ::= "0" | "1" | "2" | "3" - OctChar ::= OctHiChar | "4" | "5" | "6" | "7" - DecChar ::= OctChar | "8" | "9" - HexChar ::= DecChar | "a" | "b" | "c" | "d" | "e" | "f" | "A" | "B" | "C" - | "D" | "E" | "F" - - Char :: - SQChar ::= | EscapedChar - DQChar ::= | EscapedChar - UChar ::= | EscapedChar - - LWS ::= LWSChar* - LWSChar ::= " " | TAB | LF - - - Conditions: - - If a mask is specified for a pattern, this mask must have the same - length as the pattern string. - - 0.0 <= Priority <= 1.0 - - 0 <= Range begin <= Range end - - Notes: - - If a case-insensitive flag ("-i") appears in front of any Pattern or RPattern - in a DisjList, case-insensitivity is applied to the entire DisjList. - - Examples: - - 1.0 ('ABCD') - The file must start with the string "ABCD". The priority of the rule - is 1.0 (maximal). - - 0.8 [0:3] ('ABCD' | 'abcd') - The file must contain the string "ABCD" or "abcd" starting somewhere in - the first four bytes. The rule priority is 0.8. - - 0.5 ([0:3] 'ABCD' | [0:3] 'abcd' | [13] 'EFGH') - The file must contain the string "ABCD" or "abcd" starting somewhere in - the first four bytes or the string "EFGH" at position 13. The rule - priority is 0.5. - - 0.8 [0:3] ('ABCD' & 0xff00ffff | 'abcd' & 0xffff00ff) - The file must contain the string "A.CD" or "ab.d" (whereas "." is an - arbitrary character) starting somewhere in the first four bytes. The - rule priority is 0.8. - - 0.3 [10] ('mnop') ('abc') [20] ('xyz') - The file must contain the string 'abc' at the beginning of the file, - the string 'mnop' starting at position 10, and the string 'xyz' - starting at position 20. The rule priority is 0.3. - - 200e-3 (-i 'ab') - The file must contain the string 'ab', 'aB', 'Ab', or 'AB' at the - beginning of the file. The rule priority is 0.2. - - Real examples: - - 0.20 ([0]"//" | [0]"/\*" | [0:32]"#include" | [0:32]"#ifndef" - | [0:32]"#ifdef") - text/x-source-code - - 0.70 ("8BPS \000\000\000\000" & 0xffffffff0000ffffffff ) - image/x-photoshop - - 0.40 [0:64]( -i "<HTML" | "<HEAD" | "<TITLE" | "<BODY" - | "<TABLE" | "<!--" | "<META" | "<CENTER") - text/html - -*/ -class Parser { -public: - Parser(); - ~Parser(); - status_t Parse(const char *rule, Rule *result, BString *parseError = NULL); -private: - std::string ErrorMessage(Err *err, const char *rule); - - // Things that get done a lot :-) - void ThrowEndOfStreamError(); - inline void ThrowOutOfMemError(ssize_t pos); - void ThrowUnexpectedTokenError(TokenType expected, const Token *found); - void ThrowUnexpectedTokenError(TokenType expected1, TokenType expected2, const Token *found); - - // Parsing functions - void ParseRule(Rule *result); - double ParsePriority(); - std::vector* ParseConjList(); - DisjList* ParseDisjList(); - Range ParseRange(); - DisjList* ParsePatternList(Range range); - DisjList* ParseRPatternList(); - RPattern* ParseRPattern(); - Pattern* ParsePattern(); - - TokenStream stream; - - Err *fOutOfMemErr; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_PARSER_H - - - - diff --git a/headers/build/private/storage/sniffer/Pattern.h b/headers/build/private/storage/sniffer/Pattern.h deleted file mode 100644 index 595ffb9c61..0000000000 --- a/headers/build/private/storage/sniffer/Pattern.h +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/Pattern.h - Mime Sniffer Pattern declarations -*/ -#ifndef _SNIFFER_PATTERN_H -#define _SNIFFER_PATTERN_H - -#include -#include -#include - -class BPositionIO; - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class Err; - -//! A byte string and optional mask to be compared against a data stream. -/*! The byte string and mask (if supplied) must be of the same length. */ -class Pattern { -public: - Pattern(const std::string &string, const std::string &mask); - Pattern(const std::string &string); - ~Pattern(); - - status_t InitCheck() const; - Err* GetErr() const; - - bool Sniff(Range range, BPositionIO *data, bool caseInsensitive) const; - ssize_t BytesNeeded() const; - - status_t SetTo(const std::string &string, const std::string &mask); -private: - bool Sniff(off_t start, off_t size, BPositionIO *data, bool caseInsensitive) const; - - void SetStatus(status_t status, const char *msg = NULL); - void SetErrorMessage(const char *msg); - - std::string fString; - std::string fMask; - - status_t fCStatus; - Err *fErrorMessage; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_PATTERN_H - - diff --git a/headers/build/private/storage/sniffer/PatternList.h b/headers/build/private/storage/sniffer/PatternList.h deleted file mode 100644 index faa6683e8b..0000000000 --- a/headers/build/private/storage/sniffer/PatternList.h +++ /dev/null @@ -1,51 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/PatternList.h - MIME sniffer pattern list declarations -*/ -#ifndef _SNIFFER_PATTERN_LIST_H -#define _SNIFFER_PATTERN_LIST_H - -#include -#include -#include - -class BPositionIO; - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class Err; -class Pattern; - -/*! \brief A list of patterns, one of which must match for the list to match, all - of which are to be searched over the same range. -*/ -class PatternList : public DisjList { -public: - PatternList(Range range); - virtual ~PatternList(); - - status_t InitCheck() const; - Err* GetErr() const; - - virtual bool Sniff(BPositionIO *data) const; - virtual ssize_t BytesNeeded() const; - - void Add(Pattern *pattern); -private: - std::vector fList; - Range fRange; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_PATTERN_LIST_H - - diff --git a/headers/build/private/storage/sniffer/RPattern.h b/headers/build/private/storage/sniffer/RPattern.h deleted file mode 100644 index 13f7b171f6..0000000000 --- a/headers/build/private/storage/sniffer/RPattern.h +++ /dev/null @@ -1,45 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/RPattern.h - Mime Sniffer RPattern declarations -*/ -#ifndef _SNIFFER_R_PATTERN_H -#define _SNIFFER_R_PATTERN_H - -#include - -class BPositionIO; - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class Err; -class Pattern; - -//! A Pattern and a Range, bundled into one. -class RPattern { -public: - RPattern(Range range, Pattern *pattern); - ~RPattern(); - - status_t InitCheck() const; - Err* GetErr() const; - - bool Sniff(BPositionIO *data, bool caseInsensitive) const; - ssize_t BytesNeeded() const; -private: - Range fRange; - Pattern *fPattern; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_R_PATTERN_H - - diff --git a/headers/build/private/storage/sniffer/RPatternList.h b/headers/build/private/storage/sniffer/RPatternList.h deleted file mode 100644 index 0ac67b9de8..0000000000 --- a/headers/build/private/storage/sniffer/RPatternList.h +++ /dev/null @@ -1,46 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/RPatternList.h - MIME sniffer rpattern list declarations -*/ -#ifndef _SNIFFER_R_PATTERN_LIST_H -#define _SNIFFER_R_PATTERN_LIST_H - -#include -#include - -class BPositionIO; - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class Err; -class RPattern; - -//! A list of patterns, each of which is to be searched over its own specified range. -class RPatternList : public DisjList { -public: - RPatternList(); - virtual ~RPatternList(); - - status_t InitCheck() const; - Err* GetErr() const; - - virtual bool Sniff(BPositionIO *data) const; - virtual ssize_t BytesNeeded() const; - void Add(RPattern *rpattern); -private: - std::vector fList; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_R_PATTERN_LIST_H - - diff --git a/headers/build/private/storage/sniffer/Range.h b/headers/build/private/storage/sniffer/Range.h deleted file mode 100644 index 06a2ef0e22..0000000000 --- a/headers/build/private/storage/sniffer/Range.h +++ /dev/null @@ -1,44 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/Range.h - MIME sniffer range declarations -*/ -#ifndef _SNIFFER_RANGE_H -#define _SNIFFER_RANGE_H - -#include - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class Err; - -//! A range of byte offsets from which to check a pattern against a data stream. -class Range { -public: - Range(int32 start, int32 end); - - status_t InitCheck() const; - Err* GetErr() const; - - int32 Start() const; - int32 End() const; - - void SetTo(int32 start, int32 end); -private: - int32 fStart; - int32 fEnd; - status_t fCStatus; -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_RANGE_H - - diff --git a/headers/build/private/storage/sniffer/Rule.h b/headers/build/private/storage/sniffer/Rule.h deleted file mode 100644 index b90fc7fc91..0000000000 --- a/headers/build/private/storage/sniffer/Rule.h +++ /dev/null @@ -1,53 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file sniffer/Rule.h - Mime sniffer rule declarations -*/ -#ifndef _SNIFFER_RULE_H -#define _SNIFFER_RULE_H - -#include - -#include -#include - -class BPositionIO; - -namespace BPrivate { -namespace Storage { -namespace Sniffer { - -class DisjList; - -/*! \brief A priority and a list of expressions to be used for sniffing out the - type of an untyped file. -*/ -class Rule { -public: - Rule(); - ~Rule(); - - status_t InitCheck() const; - double Priority() const; - bool Sniff(BPositionIO *data) const; - ssize_t BytesNeeded() const; -private: - friend class Parser; - - void Unset(); - void SetTo(double priority, std::vector* list); - - double fPriority; - std::vector *fConjList; // A list of DisjLists to be ANDed -}; - -}; // namespace Sniffer -}; // namespace Storage -}; // namespace BPrivate - -#endif // _SNIFFER_RULE_H - - diff --git a/headers/build/private/system/arch/x86/asm_defs.h b/headers/build/private/system/arch/x86/asm_defs.h deleted file mode 100644 index 798fa02793..0000000000 --- a/headers/build/private/system/arch/x86/asm_defs.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. - * Distributed under the terms of the MIT License. - */ -#ifndef SYSTEM_ARCH_X86_ASM_DEFS_H -#define SYSTEM_ARCH_X86_ASM_DEFS_H - - -#define SYMBOL(name) .global name; name -#define SYMBOL_END(name) 1: .size name, 1b - name -#define STATIC_FUNCTION(name) .type name, @function; name -#define FUNCTION(name) .global name; .type name, @function; name -#define FUNCTION_END(name) 1: .size name, 1b - name - - -#endif /* SYSTEM_ARCH_X86_ASM_DEFS_H */ - diff --git a/headers/build/private/textencoding/CharacterSet.h b/headers/build/private/textencoding/CharacterSet.h deleted file mode 100644 index a465615fc2..0000000000 --- a/headers/build/private/textencoding/CharacterSet.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef CHARACTER_SET_H -#define CHARACTER_SET_H - -#include - -namespace BPrivate { - -/** - * @file CharacterSet.h - * @author Andrew Bachmann - * @brief Defines BCharacterSet - * - * @see http://www.iana.org/assignments/character-sets - **/ - -class BCharacterSet { - /** - * @class BCharacterSet - * @brief An object holding a variety of useful information about a character set. - * - * This information has been derived from the IANA standards organization. - * Since IANA provides several names for some encodings, this object also - * provides for aliases. - **/ -public: - /** - * @brief default constructor, for stack allocated character set objects - **/ - BCharacterSet(); - /** - * @brief constructor, for internal use only - **/ - BCharacterSet(uint32 id, uint32 MIBenum, const char * print_name, - const char * iana_name, const char * mime_name, - const char ** aliases); - /** - * @brief returns an id for use in BFont::SetEncoding - * @return an id for use in BFont::SetEncoding - **/ - uint32 GetFontID(void) const; - /** - * @brief returns an id for use in convert_to/from_utf8 - * @return an id for use in convert_to/from_utf8 - **/ - uint32 GetConversionID(void) const; - /** - * @brief returns an id for use in MIBs to identify coded character sets - * @return an id for use in MIBs to identify coded character sets - **/ - uint32 GetMIBenum(void) const; - /** - * @brief returns the IANA standard name for this character set - * @return the IANA standard name for this character set - **/ - const char * GetName(void) const; - /** - * @brief returns a user interface friendly name for this character set - * @return a user interface friendly name for this character set - **/ - const char * GetPrintName(void) const; - /** - * @brief returns the MIME preferred name for this character set, or null if none exists - * @return the MIME preferred name for this character set, or null if none exists - **/ - const char * GetMIMEName(void) const; - /** - * @brief returns the number of aliases for this character set - * @return the number of aliases for this character set - **/ - int32 CountAliases(void) const; - /** - * @brief returns the index'th alias, or NULL if out of range - * @return the index'th alias, or NULL if out of range - **/ - const char * AliasAt(uint32 index) const; - -private: - uint32 id; //! id from convert_to_utf8/convert_from_utf8 - uint32 MIBenum; //! for use in MIBs to identify coded character sets - const char * print_name; //! user interface friendly name - const char * iana_name; //! standard IANA name - const char * mime_name; //! the preferred mime name - const char ** aliases; //! aliases for this character set - uint32 aliases_count; //! how many aliases are available -}; - -} - -#endif // CHARACTER_SET_H diff --git a/headers/build/private/textencoding/CharacterSetRoster.h b/headers/build/private/textencoding/CharacterSetRoster.h deleted file mode 100644 index 5f8b1fc4b1..0000000000 --- a/headers/build/private/textencoding/CharacterSetRoster.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef CHARACTER_SET_ROSTER_H -#define CHARACTER_SET_ROSTER_H - -#include -#include - -namespace BPrivate { - -/** - * @file BCharacterSetRoster.h - * @author Andrew Bachmann - * @brief Defines BCharacterSetRoster - * - * @see BCharacterSet.h - **/ - -class BCharacterSet; - -class BCharacterSetRoster { - /** - * @class BCharacterSetRoster - * @brief An object for finding or enumerating character sets - **/ -public: - /** - * @brief initialize the roster to the first character set - **/ - BCharacterSetRoster(); - virtual ~BCharacterSetRoster(); - - /** - * @brief get the next available character set - * @return B_NO_ERROR if it's valid, B_BAD_VALUE if it is not - **/ - status_t GetNextCharacterSet(BCharacterSet * charset); - /** - * @brief resets the iterator to the first character set - * @return B_NO_ERROR if it's valid, B_BAD_VALUE if it is not - **/ - status_t RewindCharacterSets(); - - /** - * @brief register BMessenger to receive notifications of character set events - * @return B_NO_ERROR if watching was okay, B_BAD_VALUE if poorly formed BMessenger - **/ - static status_t StartWatching(BMessenger target); - /** - * @brief stop sending notifications to BMessenger - * @return B_NO_ERROR if stopping went okay, B_BAD_VALUE if poorly formed BMessenger - **/ - static status_t StopWatching(BMessenger target); - - /** - * @brief return the character set with the given font id, or NULL if none exists - * This function executes in constant time. - * @return the character set with the given font id, or NULL if none exists - **/ - static const BCharacterSet * GetCharacterSetByFontID(uint32 id); - /** - * @brief return the character set with the given conversion id, or NULL if none exists - * This function executes in constant time. - * @return the character set with the given conversion id, or NULL if none exists - **/ - static const BCharacterSet * GetCharacterSetByConversionID(uint32 id); - /** - * @brief return the character set with the given MIB enum, or NULL if none exists - * This function executes in constant time. - * @return the character set with the given MIB enum, or NULL if none exists - **/ - static const BCharacterSet * GetCharacterSetByMIBenum(uint32 MIBenum); - - /** - * @brief return the character set with the given print name, or NULL if none exists - * This function executes in linear time. - * @return the character set with the given print name, or NULL if none exists - **/ - static const BCharacterSet * FindCharacterSetByPrintName(const char * name); - /** - * @brief return the character set with the given name, or NULL if none exists - * This function will match aliases as well. - * This function executes in linear time. - * @return the character set with the given name, or NULL if none exists - **/ - static const BCharacterSet * FindCharacterSetByName(const char * name); -private: - uint32 index; //! the state variable for iteration -}; - -} - -#endif // CHARACTER_SET_ROSTER_H diff --git a/headers/build/private/translation/FuncTranslator.h b/headers/build/private/translation/FuncTranslator.h deleted file mode 100644 index a0ada3ee3b..0000000000 --- a/headers/build/private/translation/FuncTranslator.h +++ /dev/null @@ -1,130 +0,0 @@ -/*****************************************************************************/ -// File: FuncTranslator.h -// Class: BFuncTranslator -// Author: Michael Wilber, Translation Kit Team -// Originally Created: 2002-06-11 -// -// Description: -// This header file contains the BTranslator based object for -// function based translators, i.e. the translators which export -// each translator function individually, instead of exporting -// the make_nth_translator() function, which returns the -// translator as a class derived from BTranslator. -// -// All of the BeOS R5 translators are function based translators. -// All of the Gobe Productive translators are function based -// translators. Nearly all of the translators I've found, with -// the exception of the Haiku translators, are function based. -// -// This class is used by the OpenBeOS BTranslatorRoster -// so that function based translators, make_nth_translator() -// translators and private BTranslator objects could be -// accessed in the same way. -// -// -// Copyright (c) 2002 OpenBeOS Project -// -// 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. -/*****************************************************************************/ - -#ifndef _FUNC_TRANSLATOR_H -#define _FUNC_TRANSLATOR_H - -#include -#include -#include - -// Structure used to hold the collection of function pointers and -// public variables exported by function based translator add-ons. -struct translator_data { - const char *translatorName; - const char *translatorInfo; - int32 translatorVersion; - const translation_format *inputFormats; - const translation_format *outputFormats; - - status_t (*Identify)(BPositionIO *inSource, - const translation_format *inFormat, BMessage *ioExtension, - translator_info *outInfo, uint32 outType); - - status_t (*Translate)(BPositionIO *inSource, - const translator_info *inInfo, BMessage *ioExtension, - uint32 outType, BPositionIO *outDestination); - - status_t (*MakeConfig)(BMessage *ioExtension, - BView **outView, BRect *outExtent); - - status_t (*GetConfigMessage)(BMessage *ioExtension); -}; - -class BFuncTranslator : public BTranslator { -public: - BFuncTranslator(const translator_data *kpData); - // assigns the translator to the object - - virtual const char *TranslatorName() const; - // returns the short translator name - - virtual const char *TranslatorInfo() const; - // returns the verbose translator name/description - - virtual int32 TranslatorVersion() const; - // returns the translator's version - - virtual const translation_format *InputFormats(int32 *out_count) const; - // returns the list of supported input formats - - virtual const translation_format *OutputFormats(int32 *out_count) const; - // returns the list of supported output formats - - virtual status_t Identify(BPositionIO *inSource, - const translation_format *inFormat, BMessage *ioExtension, - translator_info *outInfo, uint32 outType); - // identifies wether or not the translator can handle - // translating the data in inSource - - virtual status_t Translate(BPositionIO *inSource, - const translator_info *inInfo, BMessage *ioExtension, uint32 outType, - BPositionIO * outDestination); - // translates the data from inSource to outDestination - // in the format outType - - virtual status_t MakeConfigurationView(BMessage *ioExtension, - BView **outView, BRect *outExtent); - // creates a view object that allows the user to change - // the translator's options - // (not required to be in all translators) - - virtual status_t GetConfigurationMessage(BMessage *ioExtension); - // returns the current settings of the translator - // (not required to be in all translators) - -protected: - virtual ~BFuncTranslator(); - // This object is deleted by calling Release(), - // it can not be deleted directly. See BTranslator in the Be Book - -private: - translator_data *fpData; - // This contains all of the member variables used by this class. - // It also contains pointers to functions that the member functions - // use to do all of the actual work for this class. -}; - -#endif // _FUNC_TRANSLATOR_H diff --git a/src/build/libbe/storage/mime/AssociatedTypes.cpp b/src/build/libbe/storage/mime/AssociatedTypes.cpp deleted file mode 100644 index 54f92354a9..0000000000 --- a/src/build/libbe/storage/mime/AssociatedTypes.cpp +++ /dev/null @@ -1,449 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file AssociatedTypes.cpp - AssociatedTypes class implementation -*/ - -#include "mime/AssociatedTypes.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DBG(x) x -//#define DBG(x) -#define OUT printf - -namespace BPrivate { -namespace Storage { -namespace Mime { - -/*! - \class AssociatedTypes - \brief Information about file extensions and their associated types -*/ - -// Constructor -//! Constructs a new AssociatedTypes object -AssociatedTypes::AssociatedTypes() - : fHaveDoneFullBuild(false) -{ -} - -// Destructor -//! Destroys the AssociatedTypes object -AssociatedTypes::~AssociatedTypes() -{ -} - -// GetAssociatedTypes -/*! \brief Returns a list of mime types associated with the given file - extension in the pre-allocated \c BMessage pointed to by \c types. - - See \c BMimeType::GetAssociatedTypes() for more information. -*/ -status_t -AssociatedTypes::GetAssociatedTypes(const char *extension, BMessage *types) -{ - status_t err = extension && types ? B_OK : B_BAD_VALUE; - std::string extStr; - - // See if we need to do our initial build still - if (!err && !fHaveDoneFullBuild) { - err = BuildAssociatedTypesTable(); - } - // Format the extension - if (!err) { - extStr = PrepExtension(extension); - err = extStr.length() > 0 ? B_OK : B_BAD_VALUE; - } - // Build the message - if (!err) { - // Clear the message, as we're just going to add to it - types->MakeEmpty(); - - // Add the types associated with this extension - std::set &assTypes = fAssociatedTypes[extStr]; - std::set::const_iterator i; - for (i = assTypes.begin(); i != assTypes.end() && !err; i++) { - err = types->AddString(kTypesField, i->c_str()); - } - } - return err; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the given filename based on its extension - - \param filename The filename of interest - \param result Pointer to a pre-allocated \c BString object into which - the result is stored. If the function returns a value other - than \c B_OK, \a result will not be modified. - \return - - \c B_OK: success - - \c other error code: failure -*/ -status_t -AssociatedTypes::GuessMimeType(const char *filename, BString *result) -{ - status_t err = filename && result ? B_OK : B_BAD_VALUE; - if (!err && !fHaveDoneFullBuild) - err = BuildAssociatedTypesTable(); - if (!err) { - // Extract the extension from the file - const char *rawExtension = strrchr(filename, '.'); - - // If there was an extension, grab it and look up its associated - // type(s). Otherwise, the best guess we can offer is - // "application/octect-stream" - if (rawExtension && rawExtension[1] != '\0') { - std::string extension = PrepExtension(rawExtension + 1); - - /*! \todo I'm just grabbing the first item in the set here. Should we perhaps - do something different? - */ - std::set &types = fAssociatedTypes[extension]; - std::set::const_iterator i = types.begin(); - if (i != types.end()) - result->SetTo(i->c_str()); - else - err = kMimeGuessFailureError; - } else { - err = kMimeGuessFailureError; - } - } - return err; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the given \c entry_ref based on its filename extension - - \param filename The entry_ref of interest - \param result Pointer to a pre-allocated \c BString object into which - the result is stored. If the function returns a value other - than \c B_OK, \a result will not be modified. - \return - - \c B_OK: success - - \c other error code: failure -*/ -status_t -AssociatedTypes::GuessMimeType(const entry_ref *ref, BString *result) -{ - // Convert the entry_ref to a filename and then do the check - if (!ref) - return B_BAD_VALUE; - BPath path; - status_t err = path.SetTo(ref); - if (!err) - err = GuessMimeType(path.Path(), result); - return err; -} - -// SetFileExtensions -/*! \brief Sets the list of file extensions for the given type and - updates the associated types mappings. - - All listed extensions will including the given mime type in - their list of associated types following this call. - - All extensions previously but no longer associated with this - mime type will no longer list this mime type as an associated - type. - - \param app The mime type whose associated file extensions you are setting - \param types Pointer to a \c BMessage containing an array of associated - file extensions in its \c Mime::kExtensionsField field. -*/ -status_t -AssociatedTypes::SetFileExtensions(const char *type, const BMessage *extensions) -{ - status_t err = type && extensions ? B_OK : B_BAD_VALUE; - if (!fHaveDoneFullBuild) - return err; - - std::set oldExtensions; - std::set &newExtensions = fFileExtensions[type]; - // Make a copy of the previous extensions - if (!err) - oldExtensions = newExtensions; - - if (!err) { - // Read through the list of new extensions, creating the new - // file extensions list and adding the type as an associated type - // for each extension - newExtensions.clear(); - const char *extension; - for (int32 i = 0; - extensions->FindString(kTypesField, i, &extension) == B_OK; - i++) - { - newExtensions.insert(extension); - AddAssociatedType(extension, type); - } - - // Remove any extensions that are still associated from the list - // of previously associated extensions - for (std::set::const_iterator i = newExtensions.begin(); - i != newExtensions.end(); - i++) - { - oldExtensions.erase(*i); - } - - // Now remove the type as an associated type for any of its previously - // but no longer associated extensions - for (std::set::const_iterator i = oldExtensions.begin(); - i != oldExtensions.end(); - i++) - { - RemoveAssociatedType(i->c_str(), type); - } - } - return err; -} - -// DeleteFileExtensions -/*! \brief Clears the given types's file extensions list and removes the - types from each of said extensions' associated types list. - \param app The mime type whose file extensions you are clearing -*/ -status_t -AssociatedTypes::DeleteFileExtensions(const char *type) -{ - BMessage extensions; - return SetFileExtensions(type, &extensions); -} - -// PrintToStream -//! Dumps the associated types mapping to standard output -void -AssociatedTypes::PrintToStream() const -{ - printf("\n"); - printf("-----------------\n"); - printf("Associated Types:\n"); - printf("-----------------\n"); - - for (std::map >::const_iterator i = fAssociatedTypes.begin(); - i != fAssociatedTypes.end(); - i++) - { - printf("%s: ", i->first.c_str()); - fflush(stdout); - bool first = true; - for (std::set::const_iterator type = i->second.begin(); - type != i->second.end(); - type++) - { - if (first) - first = false; - else - printf(", "); - printf("%s", type->c_str()); - fflush(stdout); - } - printf("\n"); - } -} - -// AddAssociatedType -/*! \brief Adds the given mime type to the set of associated types - for the given extension. - - \param extension The file extension - \param type The associated mime type - \return - - B_OK: success, even if the type was already in the associated types list - - "error code": failure -*/ -status_t -AssociatedTypes::AddAssociatedType(const char *extension, const char *type) -{ - status_t err = extension && type ? B_OK : B_BAD_VALUE; - std::string extStr; - if (!err) { - extStr = PrepExtension(extension); - err = extStr.length() > 0 ? B_OK : B_BAD_VALUE; - } - if (!err) - fAssociatedTypes[extStr].insert(type); - return err; -} - -// RemoveAssociatedType -/*! \brief Removes the given mime type from the set of associated types - for the given extension. - - \param extension The file extension - \param type The associated mime type - \return - - B_OK: success, even if the type was not found in the associated types list - - "error code": failure -*/ -status_t -AssociatedTypes::RemoveAssociatedType(const char *extension, const char *type) -{ - status_t err = extension && type ? B_OK : B_BAD_VALUE; - std::string extStr; - if (!err) { - extStr = PrepExtension(extension); - err = extStr.length() > 0 ? B_OK : B_BAD_VALUE; - } - if (!err) - fAssociatedTypes[extension].erase(type); - return err; -} - -// BuildAssociatedTypesTable -/*! \brief Crawls the mime database and builds a list of associated types - for every associated file extension. -*/ -status_t -AssociatedTypes::BuildAssociatedTypesTable() -{ - fFileExtensions.clear(); - fAssociatedTypes.clear(); - - BDirectory root; - status_t err = root.SetTo(kDatabaseDir.c_str()); - if (!err) { - root.Rewind(); - while (true) { - BEntry entry; - err = root.GetNextEntry(&entry); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - // Check that this entry is both a directory and a valid MIME string - char supertype[B_PATH_NAME_LENGTH]; - if (entry.IsDirectory() - && entry.GetName(supertype) == B_OK - && BMimeType::IsValid(supertype)) - { - // Make sure the supertype string is all lowercase - BPrivate::Storage::to_lower(supertype); - - // First, iterate through this supertype directory and process - // all of its subtypes - BDirectory dir; - if (dir.SetTo(&entry) == B_OK) { - dir.Rewind(); - while (true) { - BEntry subEntry; - err = dir.GetNextEntry(&subEntry); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - // Get the subtype's name - char subtype[B_PATH_NAME_LENGTH]; - if (subEntry.GetName(subtype) == B_OK) { - BPrivate::Storage::to_lower(subtype); - - char fulltype[B_PATH_NAME_LENGTH]; - sprintf(fulltype, "%s/%s", supertype, subtype); - - // Process the subtype - ProcessType(fulltype); - } - } - } - } else { - DBG(OUT("Mime::AssociatedTypes::BuildAssociatedTypesTable(): " - "Failed opening supertype directory '%s'\n", - supertype)); - } - - // Second, process the supertype - ProcessType(supertype); - } - } - } - } else { - DBG(OUT("Mime::AssociatedTypes::BuildAssociatedTypesTable(): " - "Failed opening mime database directory '%s'\n", - kDatabaseDir.c_str())); - } - if (!err) { - fHaveDoneFullBuild = true; -// PrintToStream(); - } - else - DBG(OUT("Mime::AssociatedTypes::BuildAssociatedTypesTable() failed, error code == 0x%lx\n", err)); - return err; - -} - -// ProcessType -/*! \brief Handles a portion of the initial associated types table construction for - the given mime type. - - \note To be called by BuildAssociatedTypesTable() *ONLY*. :-) - - \param type The mime type of interest. The mime string is expected to be valid - and lowercase. Both "supertype" and "supertype/subtype" mime types - are allowed. -*/ -status_t -AssociatedTypes::ProcessType(const char *type) -{ - status_t err = type ? B_OK : B_BAD_VALUE; - if (!err) { - // Read in the list of file extension types - BMessage msg; - if (read_mime_attr_message(type, kFileExtensionsAttr, &msg) == B_OK) { - // Iterate through the file extesions, adding them to the list of - // file extensions for the mime type and adding the mime type - // to the list of associated types for each file extension - const char *extension; - std::set &fileExtensions = fFileExtensions[type]; - for (int i = 0; msg.FindString(kExtensionsField, i, &extension) == B_OK; i++) { - std::string extStr = PrepExtension(extension); - if (extStr.length() > 0) { - fileExtensions.insert(extStr); - AddAssociatedType(extStr.c_str(), type); - } - } - } - } - return err; -} - -// PrepExtension -/*! \brief Strips any leading '.' chars from the given extension and - forces all chars to lowercase. -*/ -std::string -AssociatedTypes::PrepExtension(const char *extension) const -{ - if (extension) { - uint i = 0; - while (extension[i] == '.') - i++; - return BPrivate::Storage::to_lower(&(extension[i])); - } else { - return ""; // This shouldn't ever happen, but if it does, an - // empty string is considered an invalid extension - } -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/CreateAppMetaMimeThread.cpp b/src/build/libbe/storage/mime/CreateAppMetaMimeThread.cpp deleted file mode 100644 index 4fc33ba712..0000000000 --- a/src/build/libbe/storage/mime/CreateAppMetaMimeThread.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file CreateAppMetaMimeThread.h - CreateAppMetaMimeThread implementation -*/ - -#include "mime/CreateAppMetaMimeThread.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace BPrivate { -namespace Storage { -namespace Mime { - -CreateAppMetaMimeThread::CreateAppMetaMimeThread(const char *name, - int32 priority, BMessenger managerMessenger, const entry_ref *root, - bool recursive, int32 force, BMessage *replyee) - : MimeUpdateThread(name, priority, managerMessenger, root, recursive, force, - replyee) -{ -} - -status_t -CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref *entry, bool *entryIsDir) -{ - status_t err = entry ? B_OK : B_BAD_VALUE; - BNode node; - BString sig; - BMimeType mime; - BPath path; - attr_info info; - BBitmap miniIcon(BRect(0,0,15,15), B_BITMAP_NO_SERVER_LINK, B_CMAP8); - BNode typeNode; - - if (!err) - err = node.SetTo(entry); - if (!err && entryIsDir) - *entryIsDir = node.IsDirectory(); - // Read the app sig (which consequently keeps us from updating - // non-applications, since we get an error if the file has no - // app sig) - if (!err) - err = node.ReadAttrString("BEOS:APP_SIG", &sig); - if (!err) { - // Init our various objects - err = mime.SetTo(sig.String()); - if (!err && !mime.IsInstalled()) - mime.Install(); - if (!err) { - char metaMimePath[B_PATH_NAME_LENGTH]; - sprintf(metaMimePath, "%s/%s", kDatabaseDir.c_str(), sig.String()); - err = typeNode.SetTo(metaMimePath); - } - if (!err) - err = path.SetTo(entry); - - // Preferred App - if (!err && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) == B_ENTRY_NOT_FOUND)) { - err = mime.SetPreferredApp(sig.String()); - } - // Short Description - if (!err && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) == B_ENTRY_NOT_FOUND)) { - err = mime.SetShortDescription(path.Leaf()); - } - // App Hint - if (!err && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) == B_ENTRY_NOT_FOUND)) { - err = mime.SetAppHint(entry); - } - // Mini icon - if (!err && (fForce || typeNode.GetAttrInfo(kMiniIconAttr, &info) == B_ENTRY_NOT_FOUND)) { - err = node.GetAttrInfo("BEOS:M:STD_ICON", &info); - if (!err) - err = info.size == 16*16 ? B_OK : B_BAD_VALUE; - if (!err) { - ssize_t bytes = node.ReadAttr("BEOS:M:STD_ICON", kMiniIconType, 0, miniIcon.Bits(), 16*16); - err = bytes == 16*16 ? (status_t)B_OK : (status_t)B_FILE_ERROR; - } - if (!err) - err = mime.SetIcon(&miniIcon, B_MINI_ICON); - } - } - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/Database.cpp b/src/build/libbe/storage/mime/Database.cpp deleted file mode 100644 index 09d1d13da0..0000000000 --- a/src/build/libbe/storage/mime/Database.cpp +++ /dev/null @@ -1,1148 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Database.cpp - Database class implementation -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include // For struct attr_info -#include -#include // For new(nothrow) -#include -#include - -#include "mime/Database.h" - -//#define DBG(x) x -#define DBG(x) -#define OUT printf - -// icon types -enum { - B_MINI_ICON_TYPE = 'MICN', - B_LARGE_ICON_TYPE = 'ICON', -}; - -namespace BPrivate { -namespace Storage { -namespace Mime { - -/*! - \class Database - \brief Mime::Database is the master of the MIME data base. - - All write and non-atomic read accesses are carried out by this class. - - \note No error checking (other than checks for NULL pointers) is performed - by this class on the mime type strings passed to it. It's assumed - that this sort of checking has been done beforehand. -*/ - -// constructor -/*! \brief Creates and initializes a Mime::Database object. -*/ -Database::Database() - : fStatus(B_NO_INIT) -{ - // Do some really minor error checking - BEntry entry(kDatabaseDir.c_str()); - fStatus = entry.Exists() ? B_OK : B_BAD_VALUE; -} - -// destructor -/*! \brief Frees all resources associated with this object. -*/ -Database::~Database() -{ -} - -// InitCheck -/*! \brief Returns the initialization status of the object. - \return - - B_OK: success - - "error code": failure -*/ -status_t -Database::InitCheck() const -{ - return fStatus; -} - -// Install -/*! \brief Installs the given type in the database - \note The R5 version of this call returned an unreliable result if the - MIME type was already installed. Ours simply returns B_OK. - \param type Pointer to a NULL-terminated string containing the MIME type of interest - \param decsription Pointer to a NULL-terminated string containing the new long description - \return - - B_OK: success - - B_FILE_EXISTS: the type is already installed - - "error code": failure -*/ -status_t -Database::Install(const char *type) -{ - BEntry entry; - status_t err = (type ? B_OK : B_BAD_VALUE); - if (!err) - err = entry.SetTo(type_to_filename(type).c_str()); - if (!err) { - if (entry.Exists()) - err = B_FILE_EXISTS; - else { - bool didCreate = false; - BNode node; - err = open_or_create_type(type, &node, &didCreate); - if (!err && didCreate) { - fInstalledTypes.AddType(type); - err = SendInstallNotification(type); - } - } - } - return err; -} - -// Delete -/*! \brief Removes the given type from the database - \param type Pointer to a NULL-terminated string containing the MIME type of interest - \return - - B_OK: success - - "error code": failure -*/ -status_t -Database::Delete(const char *type) -{ - BEntry entry; - status_t err = (type ? B_OK : B_BAD_VALUE); - // Open the type - if (!err) - err = entry.SetTo(type_to_filename(type).c_str()); - // Remove it - if (!err) - err = entry.Remove(); - // Notify the installed types database - if (!err) - fInstalledTypes.RemoveType(type); - // Notify the supporting apps database - if (!err) - err = fSupportingApps.DeleteSupportedTypes(type, true); - // Notify the monitor service - if (!err) - err = SendDeleteNotification(type); - return err; -} - -// SetAppHint -/*! \brief Sets the application hint for the given MIME type - \param type Pointer to a NULL-terminated string containing the MIME type of interest - \param decsription Pointer to an entry_ref containing the location of an application - that should be used when launching an application with this signature. -*/ -status_t -Database::SetAppHint(const char *type, const entry_ref *ref) -{ - DBG(OUT("Database::SetAppHint()\n")); - BPath path; - bool didCreate = false; - status_t err = (type && ref) ? B_OK : B_BAD_VALUE; - if (!err) - err = path.SetTo(ref); - if (!err) - err = write_mime_attr(type, kAppHintAttr, path.Path(), strlen(path.Path())+1, - kAppHintType, &didCreate); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = SendMonitorUpdate(B_APP_HINT_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// SetAttrInfo -/*! \brief Stores a BMessage describing the format of attributes typically associated with - files of the given MIME type - - See BMimeType::SetAttrInfo() for description of the expected message format. - - The \c BMessage::what value is ignored. - - \param info Pointer to a pre-allocated and properly formatted BMessage containing - information about the file attributes typically associated with the - MIME type. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -Database::SetAttrInfo(const char *type, const BMessage *info) -{ - DBG(OUT("Database::SetAttrInfo()\n")); - bool didCreate = false; - status_t err = (type && info) ? B_OK : B_BAD_VALUE; - if (!err) - err = write_mime_attr_message(type, kAttrInfoAttr, info, &didCreate); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = SendMonitorUpdate(B_ATTR_INFO_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// SetShortDescription -/*! \brief Sets the short description for the given MIME type - \param type Pointer to a NULL-terminated string containing the MIME type of interest - \param decsription Pointer to a NULL-terminated string containing the new short description -*/ -status_t -Database::SetShortDescription(const char *type, const char *description) -{ - DBG(OUT("Database::SetShortDescription()\n")); - bool didCreate = false; - status_t err = (type && description && strlen(description) < B_MIME_TYPE_LENGTH) ? B_OK : B_BAD_VALUE; - if (!err) - err = write_mime_attr(type, kShortDescriptionAttr, description, strlen(description)+1, - kShortDescriptionType, &didCreate); - if (!err) - err = SendMonitorUpdate(B_SHORT_DESCRIPTION_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// SetLongDescription -/*! \brief Sets the long description for the given MIME type - \param type Pointer to a NULL-terminated string containing the MIME type of interest - \param decsription Pointer to a NULL-terminated string containing the new long description -*/ -status_t -Database::SetLongDescription(const char *type, const char *description) -{ - DBG(OUT("Database::SetLongDescription()\n")); - bool didCreate = false; - status_t err = (type && description && strlen(description) < B_MIME_TYPE_LENGTH) ? B_OK : B_BAD_VALUE; - if (!err) - err = write_mime_attr(type, kLongDescriptionAttr, description, strlen(description)+1, - kLongDescriptionType, &didCreate); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = SendMonitorUpdate(B_LONG_DESCRIPTION_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// SetFileExtensions -//! Sets the list of filename extensions associated with the MIME type -/*! The list of extensions is given in a pre-allocated BMessage pointed to by - the \c extensions parameter. Please see BMimeType::SetFileExtensions() - for a description of the expected message format. - - \param extensions Pointer to a pre-allocated, properly formatted BMessage containing - the new list of file extensions to associate with this MIME type. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -Database::SetFileExtensions(const char *type, const BMessage *extensions) -{ - DBG(OUT("Database::SetFileExtensions()\n")); - bool didCreate = false; - status_t err = (type && extensions) ? B_OK : B_BAD_VALUE; - if (!err) - err = write_mime_attr_message(type, kFileExtensionsAttr, extensions, &didCreate); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = SendMonitorUpdate(B_FILE_EXTENSIONS_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -//! Sets the icon for the given mime type -/*! This is the version I would have used if I could have gotten a BBitmap - to the registrar somehow. Since R5::BBitmap::Instantiate is causing a - violent crash, I've copied most of the icon color conversion code into - Mime::get_icon_data() so BMimeType::SetIcon() can get at it. - - Once we have a sufficiently complete OBOS::BBitmap implementation, we - ought to be able to use this version of SetIcon() again. At that point, - I'll add some real documentation. -*/ -status_t -Database::SetIcon(const char *type, const void *data, size_t dataSize, icon_size which) -{ - return SetIconForType(type, NULL, data, dataSize, which); -} - -// SetIconForType -/*! \brief Sets the large or mini icon used by an application of this type for - files of the given type. - - The type of the \c BMimeType object is not required to actually be a subtype of - \c "application/"; that is the intended use however, and application-specific - icons are not expected to be present for non-application types. - - The bitmap data pointed to by \c data must be of the proper size (\c 32x32 - for \c B_LARGE_ICON, \c 16x16 for \c B_MINI_ICON) and the proper color - space (B_CMAP8). - - \param type The MIME type - \param fileType The MIME type whose custom icon you wish to set. - \param data Pointer to an array of bitmap data of proper dimensions and color depth - \param dataSize The length of the array pointed to by \c data - \param size The size icon you're expecting (\c B_LARGE_ICON or \c B_MINI_ICON) - \return - - \c B_OK: Success - - "error code": Failure - -*/ -status_t -Database::SetIconForType(const char *type, const char *fileType, const void *data, - size_t dataSize, icon_size which) -{ - ssize_t err = (type && data) ? B_OK : B_BAD_VALUE; - - std::string attr; - int32 attrType = 0; - size_t attrSize = 0; - - // Figure out what kind of data we *should* have - if (!err) { - switch (which) { - case B_MINI_ICON: - attrType = kMiniIconType; - attrSize = 16 * 16; - break; - case B_LARGE_ICON: - attrType = kLargeIconType; - attrSize = 32 * 32; - break; - default: - err = B_BAD_VALUE; - break; - } - } - - // Construct our attribute name - if (fileType) { - attr = (which == B_MINI_ICON - ? kMiniIconAttrPrefix - : kLargeIconAttrPrefix) - + BPrivate::Storage::to_lower(fileType); - } else - attr = which == B_MINI_ICON ? kMiniIconAttr : kLargeIconAttr; - - // Double check the data we've been given - if (!err) - err = dataSize == attrSize ? B_OK : B_BAD_VALUE; - - // Write the icon data - BNode node; - bool didCreate = false; - if (!err) - err = open_or_create_type(type, &node, &didCreate); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = node.WriteAttr(attr.c_str(), attrType, 0, data, attrSize); - if (err >= 0) - err = err == (ssize_t)attrSize ? (status_t)B_OK : (status_t)B_FILE_ERROR; - if (!err) { - if (fileType) - err = SendMonitorUpdate(B_ICON_FOR_TYPE_CHANGED, type, fileType, (which == B_LARGE_ICON), B_META_MIME_MODIFIED); - else - err = SendMonitorUpdate(B_ICON_CHANGED, type, (which == B_LARGE_ICON), B_META_MIME_MODIFIED); - } - return err; - -} - -// SetPreferredApp -/*! \brief Sets the signature of the preferred application for the given app verb - - Currently, the only supported app verb is \c B_OPEN - \param type Pointer to a NULL-terminated string containing the MIME type of interest - \param signature Pointer to a NULL-terminated string containing the MIME signature - of the new preferred application - \param verb \c app_verb action for which the new preferred application is applicable -*/ -status_t -Database::SetPreferredApp(const char *type, const char *signature, app_verb verb) -{ - DBG(OUT("Database::SetPreferredApp()\n")); - bool didCreate = false; - status_t err = (type && signature && strlen(signature) < B_MIME_TYPE_LENGTH) ? B_OK : B_BAD_VALUE; - if (!err) - err = write_mime_attr(type, kPreferredAppAttr, signature, strlen(signature)+1, - kPreferredAppType, &didCreate); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = SendMonitorUpdate(B_PREFERRED_APP_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// SetSnifferRule -/*! \brief Sets the mime sniffer rule for the given mime type -*/ -status_t -Database::SetSnifferRule(const char *type, const char *rule) -{ - DBG(OUT("Database::SetSnifferRule()\n")); - bool didCreate = false; - status_t err = (type && rule) ? B_OK : B_BAD_VALUE; - if (!err) - err = write_mime_attr(type, kSnifferRuleAttr, rule, strlen(rule)+1, - kSnifferRuleType, &didCreate); - if (!err) - err = fSnifferRules.SetSnifferRule(type, rule); - if (!err && didCreate) - err = SendInstallNotification(type); - if (!err) - err = SendMonitorUpdate(B_SNIFFER_RULE_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// SetSupportedTypes -/*! \brief Sets the list of MIME types supported by the MIME type and - syncs the internal supporting apps database either partially or - completely. - - Please see BMimeType::SetSupportedTypes() for details. - \param type The mime type of interest - \param types The supported types to be assigned to the file. - \param syncAll \c true to also synchronize the previously supported - types, \c false otherwise. - \return - - \c B_OK: success - - other error codes: failure -*/ -status_t -Database::SetSupportedTypes(const char *type, const BMessage *types, bool fullSync) -{ - DBG(OUT("Database::SetSupportedTypes()\n")); - bool didCreate = false; - status_t err = (type && types) ? B_OK : B_BAD_VALUE; - // Install the types - if (!err) { - const char *supportedType; - for (int32 i = 0; - err == B_OK - && types->FindString("types", i, &supportedType) == B_OK; - i++) { - if (!is_installed(supportedType)) - err = Install(supportedType); - } - } - // Write the attr - if (!err) - err = write_mime_attr_message(type, kSupportedTypesAttr, types, &didCreate); - // Notify the monitor if we created the type when we opened it - if (!err && didCreate) - err = SendInstallNotification(type); - // Update the supporting apps map - if (!err) - err = fSupportingApps.SetSupportedTypes(type, types, fullSync); - // Notify the monitor - if (!err) - err = SendMonitorUpdate(B_SUPPORTED_TYPES_CHANGED, type, B_META_MIME_MODIFIED); - return err; -} - -// GetInstalledSupertypes -/*! \brief Fetches a BMessage listing all the MIME supertypes currently - installed in the MIME database. - - The types are copied into the \c "super_types" field of the passed-in \c BMessage. - The \c BMessage must be pre-allocated. - - \param super_types Pointer to a pre-allocated \c BMessage into which the - MIME supertypes will be copied. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -Database::GetInstalledSupertypes(BMessage *supertypes) -{ - return fInstalledTypes.GetInstalledSupertypes(supertypes); -} - -// GetInstalledTypes -/*! \brief Fetches a BMessage listing all the MIME types currently installed - in the MIME database. - - The types are copied into the \c "types" field of the passed-in \c BMessage. - The \c BMessage must be pre-allocated. - - \param types Pointer to a pre-allocated \c BMessage into which the - MIME types will be copied. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -Database::GetInstalledTypes(BMessage *types) -{ - return fInstalledTypes.GetInstalledTypes(types); -} - -// GetInstalledTypes -/*! \brief Fetches a BMessage listing all the MIME subtypes of the given - supertype currently installed in the MIME database. - - The types are copied into the \c "types" field of the passed-in \c BMessage. - The \c BMessage must be pre-allocated. - - \param super_type Pointer to a string containing the MIME supertype whose - subtypes you wish to retrieve. - \param subtypes Pointer to a pre-allocated \c BMessage into which the appropriate - MIME subtypes will be copied. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -Database::GetInstalledTypes(const char *supertype, BMessage *subtypes) -{ - return fInstalledTypes.GetInstalledTypes(supertype, subtypes); -} - -// GetSupportingApps -/*! \brief Fetches a \c BMessage containing a list of MIME signatures of - applications that are able to handle files of this MIME type. - - Please see BMimeType::GetSupportingApps() for more details. -*/ -status_t -Database::GetSupportingApps(const char *type, BMessage *signatures) -{ - return fSupportingApps.GetSupportingApps(type, signatures); -} - -// GetAssociatedTypes -/*! \brief Returns a list of mime types associated with the given file extension - - Please see BMimeType::GetAssociatedTypes() for more details. -*/ -status_t -Database::GetAssociatedTypes(const char *extension, BMessage *types) -{ - return B_ERROR; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the entry referred to by the given - \c entry_ref. - - This version of GuessMimeType() combines the features of the other - versions, plus adds a few tricks of its own: - - If the entry is a meta mime entry (i.e. has a \c "META:TYPE" attribute), - the type returned is \c "application/x-vnd.be-meta-mime". - - If the entry is a directory, the type returned is - \c "application/x-vnd.be-directory". - - If the entry is a symlink, the type returned is - \c "application/x-vnd.be-symlink". - - If the entry is a regular file, the file data is sniffed and, the - type returned is the mime type with the matching rule of highest - priority. - - If sniffing fails, the filename is checked for known extensions. - - If the extension check fails, the type returned is - \c "application/octet-stream". - - \param ref Pointer to the entry_ref referring to the entry. - \param type Pointer to a pre-allocated BString which is set to the - resulting MIME type. - \return - - \c B_OK: success (even if the guess returned is "application/octet-stream") - - other error code: failure -*/ -status_t -Database::GuessMimeType(const entry_ref *file, BString *result) -{ - status_t err = file && result ? B_OK : B_BAD_VALUE; - - BNode node; - struct stat statData; - if (!err) - err = node.SetTo(file); - if (!err) { - attr_info info; - if (node.GetAttrInfo(kTypeAttr, &info) == B_OK) { - // Check for a META:TYPE attribute - result->SetTo(kMetaMimeType); - BPath path(file); - } else { - // See if we have a directory, a symlink, or a vanilla file - err = node.GetStat(&statData); - if (!err) { - if (S_ISDIR(statData.st_mode)) { - // Directory - result->SetTo(kDirectoryType); - } else if (S_ISLNK(statData.st_mode)) { - // Symlink - result->SetTo(kSymlinkType); - } else if (S_ISREG(statData.st_mode)) { - // Vanilla file: sniff first - err = fSnifferRules.GuessMimeType(file, result); - // If that fails, check extensions - if (err == kMimeGuessFailureError) - err = fAssociatedTypes.GuessMimeType(file, result); - // If that fails, return the generic file type - if (err == kMimeGuessFailureError) { - result->SetTo(kGenericFileType); - err = B_OK; - } - } - } - } - } - return err; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the supplied chunk of data. - - See \c SnifferRules::GuessMimeType(BPositionIO*, BString*) - for more details. - - \param buffer Pointer to the data buffer. - \param length Size of the buffer in bytes. - \param type Pointer to a pre-allocated BString which is set to the - resulting MIME type. - \return - - \c B_OK: success - - error code: failure -*/ -status_t -Database::GuessMimeType(const void *buffer, int32 length, BString *result) -{ - status_t err = buffer && result ? B_OK : B_BAD_VALUE; - if (!err) - err = fSnifferRules.GuessMimeType(buffer, length, result); - if (err == kMimeGuessFailureError) { - result->SetTo(kGenericFileType); - err = B_OK; - } - return err; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the given filename. - - Only the filename itself is taken into consideration (in particular its - name extension), not the entry or corresponding data it refers to (in fact, - an entry with that name need not exist at all. - - \param filename The filename. - \param type Pointer to a pre-allocated BString which is set to the - resulting MIME type. - \return - - \c B_OK: success - - error code: failure -*/ -status_t -Database::GuessMimeType(const char *filename, BString *result) -{ - status_t err = filename && result ? B_OK : B_BAD_VALUE; - if (!err) - err = fAssociatedTypes.GuessMimeType(filename, result); - if (err == kMimeGuessFailureError) { - result->SetTo(kGenericFileType); - err = B_OK; - } - return err; -} - -// StartWatching -//! Subscribes the given BMessenger to the MIME monitor service -/*! Notification messages will be sent with a \c BMessage::what value - of \c B_META_MIME_CHANGED. Notification messages have the following - fields: - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name Type Description
\c be:type \c B_STRING_TYPE The MIME type that was changed
\c be:which \c B_INT32_TYPE Bitmask describing which attributes were changed (see below)
\c be:extra_type \c B_STRING_TYPE Additional MIME type string (applicable to B_ICON_FOR_TYPE_CHANGED notifications only)
\c be:large_icon \c B_BOOL_TYPE \c true if the large icon was changed, \c false if the small icon - was changed (applicable to B_ICON_[FOR_TYPE_]CHANGED updates only)
- - The \c be:which field of the message describes which attributes were updated, and - may be the bitwise \c OR of any of the following values: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Value Triggered By
\c B_ICON_CHANGED \c BMimeType::SetIcon()
\c B_PREFERRED_APP_CHANGED \c BMimeType::SetPreferredApp()
\c B_ATTR_INFO_CHANGED \c BMimeType::SetAttrInfo()
\c B_FILE_EXTENSIONS_CHANGED \c BMimeType::SetFileExtensions()
\c B_SHORT_DESCRIPTION_CHANGED \c BMimeType::SetShortDescription()
\c B_LONG_DESCRIPTION_CHANGED \c BMimeType::SetLongDescription()
\c B_ICON_FOR_TYPE_CHANGED \c BMimeType::SetIconForType()
\c B_APP_HINT_CHANGED \c BMimeType::SetAppHint()
- - \param target The \c BMessenger to subscribe to the MIME monitor service -*/ -status_t -Database::StartWatching(BMessenger target) -{ - DBG(OUT("Database::StartWatching()\n")); - status_t err = target.IsValid() ? B_OK : B_BAD_VALUE; - if (!err) - fMonitorMessengers.insert(target); - return err; -} - -// StartWatching -//! Unsubscribes the given BMessenger from the MIME monitor service -/*! \param target The \c BMessenger to unsubscribe -*/ -status_t -Database::StopWatching(BMessenger target) -{ - DBG(OUT("Database::StopWatching()\n")); - status_t err = target.IsValid() ? B_OK : B_BAD_VALUE; - if (!err) - err = fMonitorMessengers.find(target) != fMonitorMessengers.end() ? (status_t)B_OK : (status_t)B_ENTRY_NOT_FOUND; - if (!err) - fMonitorMessengers.erase(target); - return err; -} - -// DeleteAppHint -//! Deletes the app hint attribute for the given type -/*! A \c B_APP_HINT_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteAppHint(const char *type) -{ - status_t err = delete_attribute(type, kAppHintAttr); - if (!err) - err = SendMonitorUpdate(B_APP_HINT_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteAttrInfo -//! Deletes the attribute info attribute for the given type -/*! A \c B_ATTR_INFO_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteAttrInfo(const char *type) -{ - status_t err = delete_attribute(type, kAttrInfoAttr); - if (!err) - err = SendMonitorUpdate(B_ATTR_INFO_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteShortDescription -//! Deletes the short description attribute for the given type -/*! A \c B_SHORT_DESCRIPTION_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteShortDescription(const char *type) -{ - status_t err = delete_attribute(type, kShortDescriptionAttr); - if (!err) - err = SendMonitorUpdate(B_SHORT_DESCRIPTION_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteLongDescription -//! Deletes the long description attribute for the given type -/*! A \c B_LONG_DESCRIPTION_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteLongDescription(const char *type) -{ - status_t err = delete_attribute(type, kLongDescriptionAttr); - if (!err) - err = SendMonitorUpdate(B_LONG_DESCRIPTION_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteFileExtensions -//! Deletes the associated file extensions attribute for the given type -/*! A \c B_FILE_EXTENSIONS_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteFileExtensions(const char *type) -{ - status_t err = delete_attribute(type, kFileExtensionsAttr); - if (!err) - err = SendMonitorUpdate(B_FILE_EXTENSIONS_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteIcon -//! Deletes the icon of the given size for the given type -/*! A \c B_ICON_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \param which The icon size of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteIcon(const char *type, icon_size which) -{ - const char *attr = which == B_MINI_ICON ? kMiniIconAttr : kLargeIconAttr; - status_t err = delete_attribute(type, attr); - if (!err) - err = SendMonitorUpdate(B_ICON_CHANGED, type, which, B_META_MIME_DELETED); - return err; -} - -// DeleteIconForType -/*! \brief Deletes the icon of the given size associated with the given file type for the given - application signature. - - (If this function seems confusing, please see BMimeType::GetIconForType() for a - better description of what the *IconForType() functions are used for.) - - A \c B_ICON_FOR_TYPE_CHANGED notification is sent to the mime monitor service. - \param type The mime type of the application whose custom icon you are deleting. - \param which The mime type for which you no longer wish \c type to have a custom icon. - \param which The icon size of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteIconForType(const char *type, const char *fileType, icon_size which) -{ - std::string attr; - status_t err = fileType ? B_OK : B_BAD_VALUE; - if (!err) { - attr = (which == B_MINI_ICON ? kMiniIconAttrPrefix : kLargeIconAttrPrefix) + BPrivate::Storage::to_lower(fileType); - err = delete_attribute(type, attr.c_str()); - } - if (!err) - err = SendMonitorUpdate(B_ICON_FOR_TYPE_CHANGED, type, fileType, - which == B_LARGE_ICON, B_META_MIME_DELETED); - return err; -} - -// DeletePreferredApp -//! Deletes the preferred app for the given app verb for the given type -/*! A \c B_PREFERRED_APP_CHANGED notification is sent to the mime monitor service. - \param type The mime type of interest - \param which The app verb of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeletePreferredApp(const char *type, app_verb verb) -{ - status_t err; - switch (verb) { - case B_OPEN: - err = delete_attribute(type, kPreferredAppAttr); - break; - - default: - err = B_BAD_VALUE; - break; - } - /*! \todo The R5 monitor makes no note of which app_verb value was updated. If - additional app_verb values besides \c B_OPEN are someday added, the format - of the MIME monitor messages will need to be augmented. - */ - if (!err) - err = SendMonitorUpdate(B_PREFERRED_APP_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteSnifferRule -//! Deletes the sniffer rule for the given type -/*! A \c B_SNIFFER_RULE_CHANGED notification is sent to the mime monitor service, - and the corresponding rule is removed from the internal database of sniffer - rules. - \param type The mime type of interest - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteSnifferRule(const char *type) -{ - status_t err = delete_attribute(type, kSnifferRuleAttr); - if (!err) - err = fSnifferRules.DeleteSnifferRule(type); - if (!err) - err = SendMonitorUpdate(B_SNIFFER_RULE_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// DeleteSupportedTypes -//! Deletes the supported types list for the given type -/*! A \c B_SUPPORTED_TYPES_CHANGED notification is sent to the mime monitor service. - If \c fullSync is \c true, the given type is removed from the internal list - of supporting applictions for each previously supported type. If \c fullSync - is \c false, the said removal will occur the next time SetSupportedTypes() or - DeleteSupportedTypes() is called with a \c true \c fullSync paramter, or - \c Delete() is called for the given type. - \param type The mime type of interest - \param fullSync Whether or not to remove the type as a supporting app for - all previously supported types - \return - - B_OK: success - - B_ENTRY_NOT_FOUND: no such attribute existed - - "error code": failure -*/ -status_t -Database::DeleteSupportedTypes(const char *type, bool fullSync) -{ - status_t err = delete_attribute(type, kSupportedTypesAttr); - // Update the supporting apps database. If fullSync is specified, - // do so even if the supported types attribute didn't exist, as - // stranded types *may* exist in the database due to previous - // calls to {Set,Delete}SupportedTypes() with fullSync == false. - if (!err) - err = fSupportingApps.DeleteSupportedTypes(type, fullSync); - else if (fullSync && err == B_ENTRY_NOT_FOUND) - fSupportingApps.DeleteSupportedTypes(type, fullSync); - // Send a monitor notification - if (!err) - err = SendMonitorUpdate(B_SUPPORTED_TYPES_CHANGED, type, B_META_MIME_DELETED); - return err; -} - -// SendInstallNotification -//! \brief Sends a \c B_MIME_TYPE_CREATED notification to the mime monitor service -status_t -Database::SendInstallNotification(const char *type) -{ -// fInstalledTypes.AddType(type); - status_t err = SendMonitorUpdate(B_MIME_TYPE_CREATED, type, B_META_MIME_MODIFIED); - return err; -} - -// SendDeleteNotification -//! \brief Sends a \c B_MIME_TYPE_DELETED notification to the mime monitor service -status_t -//! \brief Sends a \c B_MIME_TYPE_DELETED notification to the mime monitor service -Database::SendDeleteNotification(const char *type) -{ - // Tell the backend first -// fInstalledTypes.RemoveType(type); - status_t err = SendMonitorUpdate(B_MIME_TYPE_DELETED, type, B_META_MIME_MODIFIED); - return err; -} - -// SendMonitorUpdate -/*! \brief Sends an update notification to all BMessengers that have - subscribed to the MIME Monitor service - \param type The MIME type that was updated - \param which Bitmask describing which attribute was updated - \param extraType The MIME type to which the change is applies - \param largeIcon \true if the the large icon was updated, \false if the - small icon was updated -*/ -status_t -Database::SendMonitorUpdate(int32 which, const char *type, const char *extraType, bool largeIcon, int32 action) { - BMessage msg(B_META_MIME_CHANGED); - status_t err; - - err = msg.AddInt32("be:which", which); - if (!err) - err = msg.AddString("be:type", type); - if (!err) - err = msg.AddString("be:extra_type", extraType); - if (!err) - err = msg.AddBool("be:large_icon", largeIcon); - if (!err) - err = msg.AddInt32("be:action", action); - if (!err) - err = SendMonitorUpdate(msg); - return err; -} - -// SendMonitorUpdate -/*! \brief Sends an update notification to all BMessengers that have - subscribed to the MIME Monitor service - \param type The MIME type that was updated - \param which Bitmask describing which attribute was updated - \param extraType The MIME type to which the change is applies -*/ -status_t -Database::SendMonitorUpdate(int32 which, const char *type, const char *extraType, int32 action) { - BMessage msg(B_META_MIME_CHANGED); - status_t err; - - err = msg.AddInt32("be:which", which); - if (!err) - err = msg.AddString("be:type", type); - if (!err) - err = msg.AddString("be:extra_type", extraType); - if (!err) - err = msg.AddInt32("be:action", action); - if (!err) - err = SendMonitorUpdate(msg); - return err; -} - -// SendMonitorUpdate -/*! \brief Sends an update notification to all BMessengers that have - subscribed to the MIME Monitor service - \param type The MIME type that was updated - \param which Bitmask describing which attribute was updated - \param largeIcon \true if the the large icon was updated, \false if the - small icon was updated -*/ -status_t -Database::SendMonitorUpdate(int32 which, const char *type, bool largeIcon, int32 action) { - BMessage msg(B_META_MIME_CHANGED); - status_t err; - - err = msg.AddInt32("be:which", which); - if (!err) - err = msg.AddString("be:type", type); - if (!err) - err = msg.AddBool("be:large_icon", largeIcon); - if (!err) - err = msg.AddInt32("be:action", action); - if (!err) - err = SendMonitorUpdate(msg); - return err; -} - -// SendMonitorUpdate -/*! \brief Sends an update notification to all BMessengers that have - subscribed to the MIME Monitor service - \param type The MIME type that was updated - \param which Bitmask describing which attribute was updated -*/ -status_t -Database::SendMonitorUpdate(int32 which, const char *type, int32 action) { - BMessage msg(B_META_MIME_CHANGED); - status_t err; - - err = msg.AddInt32("be:which", which); - if (!err) - err = msg.AddString("be:type", type); - if (!err) - err = msg.AddInt32("be:action", action); - if (!err) - err = SendMonitorUpdate(msg); - return err; -} - -// SendMonitorUpdate -/*! \brief Sends an update notification to all BMessengers that have subscribed to - the MIME Monitor service - \param BMessage A preformatted MIME monitor message to be sent to all subscribers -*/ -status_t -Database::SendMonitorUpdate(BMessage &msg) { -// DBG(OUT("Database::SendMonitorUpdate(BMessage&)\n")); - status_t err; - std::set::const_iterator i; - for (i = fMonitorMessengers.begin(); i != fMonitorMessengers.end(); i++) { - status_t err = (*i).SendMessage(&msg, (BHandler*)NULL); - if (err) - DBG(OUT("Database::SendMonitorUpdate(BMessage&): BMessenger::SendMessage failed, 0x%lx\n", err)); - } -// DBG(OUT("Database::SendMonitorUpdate(BMessage&) done\n")); - err = B_OK; - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/InstalledTypes.cpp b/src/build/libbe/storage/mime/InstalledTypes.cpp deleted file mode 100644 index b21cb80372..0000000000 --- a/src/build/libbe/storage/mime/InstalledTypes.cpp +++ /dev/null @@ -1,505 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file InstalledTypes.cpp - InstalledTypes class implementation -*/ - -#include "mime/InstalledTypes.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DBG(x) x -//#define DBG(x) -#define OUT printf - -namespace BPrivate { -namespace Storage { -namespace Mime { - -/*! - \class InstalledTypes - \brief Installed types information for the entire database -*/ - -// Constructor -//! Constructs a new InstalledTypes object -InstalledTypes::InstalledTypes() - : fCachedMessage(NULL) - , fCachedSupertypesMessage(NULL) - , fHaveDoneFullBuild(false) -{ -} - -// Destructor -//! Destroys the InstalledTypes object -InstalledTypes::~InstalledTypes() -{ - delete fCachedSupertypesMessage; - delete fCachedMessage; -} - -// GetInstalledTypes -/*! \brief Returns a list of all currently installed types in the - pre-allocated \c BMessage pointed to by \c types. - - See \c BMimeType::GetInstalledTypes(BMessage*) for more information. -*/ -status_t -InstalledTypes::GetInstalledTypes(BMessage *types) -{ - status_t err = types ? B_OK : B_BAD_VALUE; - // See if we need to do our initial build still - if (!err && !fHaveDoneFullBuild) { - err = BuildInstalledTypesList(); - } - // See if we need to fill up a new message - if (!err && !fCachedMessage) { - err = CreateMessageWithTypes(&fCachedMessage); - } - // If we get this far, there a cached message waiting - if (!err) { - *types = *fCachedMessage; - } - return err; -} - -// GetInstalledTypes -/*! \brief Returns a list of all currently installed types of the given - supertype in the pre-allocated \c BMessage pointed to by \c types. - - See \c BMimeType::GetInstalledTypes(const char*, BMessage*) for more - information. -*/ -status_t -InstalledTypes::GetInstalledTypes(const char *supertype, BMessage *types) -{ - status_t err = supertype && types ? B_OK : B_BAD_VALUE; - // Verify the supertype is valid *and* is a supertype - BMimeType mime; - BMimeType super; - // Make sure the supertype is valid - if (!err) - err = mime.SetTo(supertype); - // Make sure it's really a supertype - if (!err && !mime.IsSupertypeOnly()) - err = B_BAD_VALUE; - // See if we need to do our initial build still - if (!err && !fHaveDoneFullBuild) { - err = BuildInstalledTypesList(); - } - // Ask the appropriate supertype for its list - if (!err) { - std::map::iterator i = fSupertypes.find(supertype); - if (i != fSupertypes.end()) - err = i->second.GetInstalledSubtypes(types); - else - err = B_NAME_NOT_FOUND; - } - return err; -} - -// GetInstalledSupertypes -/*! \brief Returns a list of all currently installed supertypes in the - pre-allocated \c BMessage pointed to by \c types. - - See \c BMimeType::GetInstalledSupertypes() for more information. -*/ -status_t -InstalledTypes::GetInstalledSupertypes(BMessage *types) -{ - status_t err = types ? B_OK : B_BAD_VALUE; - // See if we need to do our initial build still - if (!err && !fHaveDoneFullBuild) { - err = BuildInstalledTypesList(); - } - // See if we need to fill up a new message - if (!err && !fCachedSupertypesMessage) { - err = CreateMessageWithSupertypes(&fCachedSupertypesMessage); - } - // If we get this far, there's a cached message waiting - if (!err) { - *types = *fCachedSupertypesMessage; - } - return err; -} - -// AddType -/*! \brief Adds the given type to the appropriate lists of installed types. - - If cached messages exist, the type is simply appended to the end of - the current type list. -*/ -status_t -InstalledTypes::AddType(const char *type) -{ - status_t err; - if (fHaveDoneFullBuild) { - BMimeType mime(type); - BMimeType super; - err = type ? mime.InitCheck() : B_BAD_VALUE; - if (!err) { - // Find the / in the string, if one exists - uint i; - size_t len = strlen(type); - for (i = 0; i < len; i++) { - if (type[i] == '/') - break; - } - if (i == len) { - // Supertype only - std::map::iterator i; - err = AddSupertype(type, i); - } else { - // Copy the supertype - char super[B_PATH_NAME_LENGTH]; - strncpy(super, type, i); - super[i] = 0; - - // Get a pointer to the subtype - const char *sub = &(type[i+1]); - - // Add the subtype (which will add the supertype if necessary) - err = AddSubtype(super, sub); - } - } - } else { - err = B_OK; - } - return err; -} - -// RemoveType -/*! \brief Removes the given type from the appropriate installed types lists. - - Any corresponding cached messages are invalidated. -*/ -status_t -InstalledTypes::RemoveType(const char *type) -{ - status_t err; - if (fHaveDoneFullBuild) { - BMimeType mime(type); - BMimeType super; - err = type ? mime.InitCheck() : B_BAD_VALUE; - if (!err) { - // Find the / in the string, if one exists - uint i; - size_t len = strlen(type); - for (i = 0; i < len; i++) { - if (type[i] == '/') - break; - } - if (i == len) { - // Supertype only - err = RemoveSupertype(type); - } else { - // Copy the supertype - char super[B_PATH_NAME_LENGTH]; - strncpy(super, type, i); - super[i] = 0; - - // Get a pointer to the subtype - const char *sub = &(type[i+1]); - - // Remove the subtype - err = RemoveSubtype(super, sub); - } - } - } else - err = B_OK; - return err; -} - -// AddSupertype -/*! \brief Adds the given supertype to the supertype map. - \return - - B_OK: success, even if the supertype already existed in the map - - "error code": failure -*/ -status_t -InstalledTypes::AddSupertype(const char *super, std::map::iterator &i) -{ - status_t err = super ? B_OK : B_BAD_VALUE; - if (!err) { - i = fSupertypes.find(super); - if (i == fSupertypes.end()) { - Supertype &supertype = fSupertypes[super]; - supertype.SetName(super); - if (fCachedMessage) - err = fCachedMessage->AddString(kTypesField, super); - if (!err && fCachedSupertypesMessage) - err = fCachedSupertypesMessage->AddString(kSupertypesField, super); - } - } - return err; -} - -// AddSubtype -/*! \brief Adds the given subtype to the given supertype's lists of installed types. - - If the supertype does not yet exist, it is created. - - \param super The supertype - \param sub The subtype (subtype only; no "supertype/subtype" types please) - \return - - B_OK: success - - B_NAME_IN_USE: The subtype already exists in the subtype list - - "error code": failure -*/ -status_t -InstalledTypes::AddSubtype(const char *super, const char *sub) -{ - status_t err = super && sub ? B_OK : B_BAD_VALUE; - if (!err) { - std::map::iterator i; - err = AddSupertype(super, i); - if (!err) - err = AddSubtype(i->second, sub); - } - return err; -} - -// AddSubtype -/*! \brief Adds the given subtype to the given supertype's lists of installed types. - - \param super The supertype object - \param sub The subtype (subtype only; no "supertype/subtype" types please) - \return - - B_OK: success - - B_NAME_IN_USE: The subtype already exists in the subtype list - - "error code": failure -*/ -status_t -InstalledTypes::AddSubtype(Supertype &super, const char *sub) -{ - status_t err = sub ? B_OK : B_BAD_VALUE; - if (!err) - err = super.AddSubtype(sub); - if (!err && fCachedMessage) { - char type[B_PATH_NAME_LENGTH]; - sprintf(type, "%s/%s", super.GetName(), sub); - err = fCachedMessage->AddString("types", type); - } - return err; -} - -// RemoveSupertype -/*! \brief Removes the given supertype and any corresponding subtypes. -*/ -status_t -InstalledTypes::RemoveSupertype(const char *super) -{ - status_t err = super ? B_OK : B_BAD_VALUE; - if (!err) - err = fSupertypes.erase(super) == 1 ? B_OK : B_NAME_NOT_FOUND; - if (!err) - ClearCachedMessages(); - return err; -} - -// RemoveSubtype -/*! \brief Removes the given subtype from the given supertype. -*/ -status_t -InstalledTypes::RemoveSubtype(const char *super, const char *sub) -{ - status_t err = super && sub ? B_OK : B_BAD_VALUE; - if (!err) { - std::map::iterator i = fSupertypes.find(super); - if (i != fSupertypes.end()) { - err = i->second.RemoveSubtype(sub); - if (!err) - ClearCachedMessages(); - } else - err = B_NAME_NOT_FOUND; - } - return err; - -} - -// Unset -// Clears any cached messages and empties the supertype map -void -InstalledTypes::Unset() -{ - ClearCachedMessages(); - fSupertypes.clear(); -} - -// ClearCachedMessages -//! Frees any cached messages and sets their pointers to NULL -void -InstalledTypes::ClearCachedMessages() -{ - delete fCachedSupertypesMessage; - delete fCachedMessage; - fCachedSupertypesMessage = NULL; - fCachedMessage = NULL; -} - -// BuildInstalledTypesList -/*! \brief Reads through the database and builds a complete set of installed types lists. - - An initial set of cached messages are also created. -*/ -status_t -InstalledTypes::BuildInstalledTypesList() -{ - status_t err = B_OK; - Unset(); - - // Create empty "cached messages" so proper messages - // will be built up as we add new types - try { - fCachedMessage = new BMessage(); - fCachedSupertypesMessage = new BMessage(); - } catch (std::bad_alloc) { - err = B_NO_MEMORY; - } - - BDirectory root; - if (!err) - err = root.SetTo(kDatabaseDir.c_str()); - if (!err) { - root.Rewind(); - while (true) { - BEntry entry; - err = root.GetNextEntry(&entry); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - // Check that this entry is both a directory and a valid MIME string - char supertype[B_PATH_NAME_LENGTH]; - if (entry.IsDirectory() - && entry.GetName(supertype) == B_OK - && BMimeType::IsValid(supertype)) - { - // Make sure our string is all lowercase - BPrivate::Storage::to_lower(supertype); - - // Add this supertype - std::map::iterator i; - if (AddSupertype(supertype, i) != B_OK) - DBG(OUT("Mime::InstalledTypes::BuildInstalledTypesList() -- Error adding supertype '%s': 0x%lx\n", - supertype, err)); - Supertype &supertypeRef = fSupertypes[supertype]; - - // Now iterate through this supertype directory and add - // all of its subtypes - BDirectory dir; - if (dir.SetTo(&entry) == B_OK) { - dir.Rewind(); - while (true) { - BEntry subEntry; - err = dir.GetNextEntry(&subEntry); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - // Get the subtype's name - char subtype[B_PATH_NAME_LENGTH]; - if (subEntry.GetName(subtype) == B_OK) { - BPrivate::Storage::to_lower(subtype); - - // Add the subtype - if (AddSubtype(supertypeRef, subtype) != B_OK) { - DBG(OUT("Mime::InstalledTypes::BuildInstalledTypesList() -- Error adding subtype '%s/%s': 0x%lx\n", - supertype, subtype, err)); - } - } - } - } - } else { - DBG(OUT("Mime::InstalledTypes::BuildInstalledTypesList(): " - "Failed opening supertype directory '%s'\n", - supertype)); - } - } - } - } - } else { - DBG(OUT("Mime::InstalledTypes::BuildInstalledTypesList(): " - "Failed opening mime database directory '%s'\n", - kDatabaseDir.c_str())); - } - fHaveDoneFullBuild = true; - return err; - -} - -// CreateMessageWithTypes -/*! \brief Allocates a new BMessage into the BMessage pointer pointed to by \c result - and fills it with a complete list of installed types. -*/ -status_t -InstalledTypes::CreateMessageWithTypes(BMessage **result) const -{ - status_t err = result ? B_OK : B_BAD_VALUE; - // Alloc the message - if (!err) { - try { - *result = new BMessage(); - } catch (std::bad_alloc) { - err = B_NO_MEMORY; - } - } - // Fill with types - if (!err) { - BMessage &msg = **result; - std::map::const_iterator i; - for (i = fSupertypes.begin(); i != fSupertypes.end() && !err; i++) { - err = msg.AddString(kTypesField, i->first.c_str()); - if (!err) - err = i->second.FillMessageWithTypes(msg); - } - } - return err; -} - -// CreateMessageWithSupertypes -/*! \brief Allocates a new BMessage into the BMessage pointer pointed to by \c result - and fills it with a complete list of installed supertypes. -*/ -status_t -InstalledTypes::CreateMessageWithSupertypes(BMessage **result) const -{ - status_t err = result ? B_OK : B_BAD_VALUE; - // Alloc the message - if (!err) { - try { - *result = new BMessage(); - } catch (std::bad_alloc) { - err = B_NO_MEMORY; - } - } - // Fill with types - if (!err) { - BMessage &msg = **result; - std::map::const_iterator i; - for (i = fSupertypes.begin(); i != fSupertypes.end() && !err; i++) { - err = msg.AddString(kSupertypesField, i->first.c_str()); - } - } - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/SnifferRules.cpp b/src/build/libbe/storage/mime/SnifferRules.cpp deleted file mode 100644 index c5e863d7a3..0000000000 --- a/src/build/libbe/storage/mime/SnifferRules.cpp +++ /dev/null @@ -1,543 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//---------------------------------------------------------------------- -/*! - \file SnifferRules.cpp - SnifferRules class implementation -*/ - -#include "mime/SnifferRules.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DBG(x) x -//#define DBG(x) -#define OUT printf - -namespace BPrivate { -namespace Storage { -namespace Mime { - -using namespace BPrivate::Storage; - -/*! - \struct SnifferRules::sniffer_rule - \brief A parsed sniffer rule and its corresponding mime type and rule string - - The parse sniffer rule is stored in the \c rule member, which is a pointer - to a \c Sniffer::Rule object. This design was chosen to allow \c sniffer_rule - objects (as opposed to \c sniffer_rule pointers) to be used with STL objects - without unnecessary copying. As a consequence of this decision, the - \c SnifferRules object managing the rule list is responsible for actually - deleting each \c sniffer_rule's \c Sniffer::Rule object. -*/ - -// sniffer_rule Constructor -//! Creates a new \c sniffer_rule object -SnifferRules::sniffer_rule::sniffer_rule(Sniffer::Rule *rule) - : rule(rule) -{ -} - -// sniffer_rule Destructor -//! Destroys the \c sniffer_rule object. -/*! \note The \c Sniffer::Rule object pointed to by the \c sniffer_rule - object's \c rule member is *NOT* deleted by this function. -*/ -SnifferRules::sniffer_rule::~sniffer_rule() -{ -} - -// private functions -/*! \brief Returns true if \a left's priority is greater than \a right's - - This may seem slightly backwards, but since sort() using - operator<() sorts in ascending order, we say "left < right" - if "left.priority > right.priority" to get them sorted in - ascending order. Super, no? - - Also, sniffer_rule objects with \c NULL \c rule members are - treated as having minimal priority (and thus are placed at - the end of the list of rules). - - Finally, sniffer_rule objects that are otherwise equal are - sorted in reverse alphabetic order (thus placing sniffer - rules for supertypes *after* sniffer rules for subtypes - of said supertype when both rules have identical priorities). -*/ -bool operator<(SnifferRules::sniffer_rule &left, SnifferRules::sniffer_rule &right) -{ - if (left.rule && right.rule) { - double leftPriority = left.rule->Priority(); - double rightPriority = right.rule->Priority(); - if (leftPriority > rightPriority) { - return true; // left < right - } else if (rightPriority > leftPriority) { - return false; // right < left - } else { - return left.type > right.type; - } - } else if (left.rule) { - return true; // left < right - } else { - return false; // right < left - } -} - -/*! - \class SnifferRules - \brief Manages the sniffer rules for the entire database -*/ - -// Constructor -//! Constructs a new SnifferRules object -SnifferRules::SnifferRules() - : fHaveDoneFullBuild(false) -{ -} - -// Destructor -/*! \brief Destroys the \c SnifferRules object and all dynamically allocated - \c Sniffer::Rule objects scattered throughout the rule list in - \c sniffer_rule::rule members. -*/ -SnifferRules::~SnifferRules() -{ - for (std::list::iterator i = fRuleList.begin(); - i != fRuleList.end(); - i++) - { - delete i->rule; - i->rule = NULL; - } -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the supplied entry_ref. - - Only the data in the given entry is considered, not the filename or - its extension. Please see GuessMimeType(BPositionIO*, BString*) for - more details. - - \param ref The entry to sniff - \param type Pointer to a pre-allocated BString which is set to the - resulting MIME type. - \return - - \c B_OK: success - - \c Mime::kMimeGuessFailure: no match found (\a type is left unmodified) - - error code: failure -*/ -status_t -SnifferRules::GuessMimeType(const entry_ref *ref, BString *type) -{ - status_t err = ref && type ? B_OK : B_BAD_VALUE; - ssize_t bytes = 0; - char *buffer = NULL; - BFile file; - - // First find out the max number of bytes we need to read - // from the file to fully accomodate all of our currently - // installed sniffer rules - if (!err) { - bytes = MaxBytesNeeded(); - if (bytes < 0) - err = bytes; - } - - // Next read that many bytes (or fewer, if the file isn't - // that long) into a buffer - if (!err) { - buffer = new(std::nothrow) char[bytes]; - if (!buffer) - err = B_NO_MEMORY; - } - if (!err) - err = file.SetTo(ref, B_READ_ONLY); - if (!err) { - bytes = file.Read(buffer, bytes); - if (bytes < 0) - err = bytes; - } - - // Now sniff the buffer - if (!err) { - BMemoryIO data(buffer, bytes); - err = GuessMimeType(&data, type); - } - - return err; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the given chunk of data. - - Please see GuessMimeType(BPositionIO*, BString*) for more details. - - \param buffer Pointer to a data buffer to sniff - \param length The length of the data buffer pointed to by \a buffer - \param type Pointer to a pre-allocated BString which is set to the - resulting MIME type. - \return - - \c B_OK: success - - \c Mime::kMimeGuessFailure: no match found (\a type is left unmodified) - - error code: failure -*/ -status_t -SnifferRules::GuessMimeType(const void *buffer, int32 length, BString *type) -{ - status_t err = buffer && type ? B_OK : B_BAD_VALUE; - // Wrap a BMemoryIO around the buffer and call our private - // GuessMimeType(BPositionIO*, BString*) function to do the - // dirty work - if (!err) { - BMemoryIO data(buffer, length); - err = GuessMimeType(&data, type); - } - return err; -} - -// SetSnifferRule -/*! Updates the sniffer rule for the given type - - If the a rule currently exists in the rule list for the given type, - it is first removed before the new rule is inserted. - - The new rule is inserted in its proper, sorted position in the list. - - \param type The type of interest - \param rule The new sniffer rule - \return - - \c B_OK: success - - other error code: failure -*/ -status_t -SnifferRules::SetSnifferRule(const char *type, const char *rule) -{ - status_t err = type && rule ? B_OK : B_BAD_VALUE; - if (!err && !fHaveDoneFullBuild) - return B_OK; - - sniffer_rule item(new Sniffer::Rule()); - BString parseError; - - // Check the mem alloc - if (!err) - err = item.rule ? B_OK : B_NO_MEMORY; - // Prepare the sniffer_rule - if (!err) { - item.type = type; - item.rule_string = rule; - err = Sniffer::parse(rule, item.rule, &parseError); - if (err) - DBG(OUT("ERROR: SnifferRules::SetSnifferRule(): rule parsing error:\n%s\n", - parseError.String())); - } - // Remove any previous rule for this type - if (!err) - err = DeleteSnifferRule(type); - // Insert the new rule at the proper position in - // the sorted rule list (remembering that our list - // is sorted in ascending order using - // operator<(sniffer_rule&, sniffer_rule&)) - if (!err) { - std::list::iterator i; - for (i = fRuleList.begin(); i != fRuleList.end(); i++) - { - if (item < (*i)) { - fRuleList.insert(i, item); - break; - } - } - if (i == fRuleList.end()) - fRuleList.push_back(item); - } - - return err; -} - -// DeleteSnifferRule -/*! \brief Removes the sniffer rule for the given type from the rule list - \param type The type of interest - \return - - \c B_OK: success (even if no rule existed for the given type) - - other error code: failure -*/ -status_t -SnifferRules::DeleteSnifferRule(const char *type) -{ - status_t err = type ? B_OK : B_BAD_VALUE; - if (!err && !fHaveDoneFullBuild) - return B_OK; - - // Find the rule in the list and remove it - for (std::list::iterator i = fRuleList.begin(); - i != fRuleList.end(); - i++) - { - if (i->type == type) { - fRuleList.erase(i); - break; - } - } - - return err; -} - -// PrintToStream -//! Dumps the list of sniffer rules in sorted order to standard output -void -SnifferRules::PrintToStream() const -{ - printf("\n"); - printf("--------------\n"); - printf("Sniffer Rules:\n"); - printf("--------------\n"); - - if (fHaveDoneFullBuild) { - for (std::list::const_iterator i = fRuleList.begin(); - i != fRuleList.end(); - i++) - { - printf("%s: '%s'\n", i->type.c_str(), i->rule_string.c_str()); - } - } else { - printf("You haven't built your rule list yet, chump. ;-)\n"); - } -} - -// BuildRuleList -/*! \brief Crawls through the database, parses each sniffer rule it finds, adds - each parsed rule to the rule list, and sorts the list by priority, largest first. - - Initial MaxBytesNeeded() info is compiled by this function as well. -*/ -status_t -SnifferRules::BuildRuleList() -{ - fRuleList.clear(); - - ssize_t maxBytesNeeded = 0; - ssize_t bytesNeeded = 0; - BDirectory root; - - status_t err = root.SetTo(kDatabaseDir.c_str()); - if (!err) { - root.Rewind(); - while (true) { - BEntry entry; - err = root.GetNextEntry(&entry); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - // Check that this entry is both a directory and a valid MIME string - char supertype[B_PATH_NAME_LENGTH]; - if (entry.IsDirectory() - && entry.GetName(supertype) == B_OK - && BMimeType::IsValid(supertype)) - { - // Make sure the supertype string is all lowercase - BPrivate::Storage::to_lower(supertype); - - // First, iterate through this supertype directory and process - // all of its subtypes - BDirectory dir; - if (dir.SetTo(&entry) == B_OK) { - dir.Rewind(); - while (true) { - BEntry subEntry; - err = dir.GetNextEntry(&subEntry); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - // Get the subtype's name - char subtype[B_PATH_NAME_LENGTH]; - if (subEntry.GetName(subtype) == B_OK) { - BPrivate::Storage::to_lower(subtype); - - char fulltype[B_PATH_NAME_LENGTH]; - sprintf(fulltype, "%s/%s", supertype, subtype); - - // Process the subtype - ProcessType(fulltype, &bytesNeeded); - if (bytesNeeded > maxBytesNeeded) - maxBytesNeeded = bytesNeeded; - } - } - } - } else { - DBG(OUT("Mime::SnifferRules::BuildRuleList(): " - "Failed opening supertype directory '%s'\n", - supertype)); - } - - // Second, process the supertype - ProcessType(supertype, &bytesNeeded); - if (bytesNeeded > maxBytesNeeded) - maxBytesNeeded = bytesNeeded; - } - } - } - } else { - DBG(OUT("Mime::SnifferRules::BuildRuleList(): " - "Failed opening mime database directory '%s'\n", - kDatabaseDir.c_str())); - } - - if (!err) { - fRuleList.sort(); - fMaxBytesNeeded = maxBytesNeeded; - fHaveDoneFullBuild = true; -// PrintToStream(); - } else - DBG(OUT("Mime::SnifferRules::BuildRuleList() failed, error code == 0x%lx\n", err)); - return err; -} - -// GuessMimeType -/*! \brief Guesses a MIME type for the supplied chunk of data. - - This is accomplished by searching through the currently installed - list of sniffer rules for a rule that matches on the given data buffer. - Rules are searched in order of priority (higher priority first). Rules - of equal priority are searched in reverse-alphabetical order (that way - "supertype/subtype" form rules are checked before "supertype-only" form - rules if their priorities happen to be identical). - - \param data The data to sniff - \param type Pointer to a pre-allocated BString which is set to the - resulting MIME type. - \return - - \c B_OK: success - - \c Mime::kMimeGuessFailure: no match found (\a type is left unmodified) - - error code: failure -*/ -status_t -SnifferRules::GuessMimeType(BPositionIO *data, BString *type) -{ - status_t err = data && type ? B_OK : B_BAD_VALUE; - if (!err && !fHaveDoneFullBuild) - err = BuildRuleList(); - if (!err) { - // Run through our rule list, which is sorted in order of - // descreasing priority, and see if one of the rules sniffs - // out a match - for (std::list::const_iterator i = fRuleList.begin(); - i != fRuleList.end(); - i++) - { - if (i->rule) { - if (i->rule->Sniff(data)) { - type->SetTo(i->type.c_str()); - return B_OK; - } - } else { - DBG(OUT("WARNING: Mime::SnifferRules::GuessMimeType(BPositionIO*,BString*): " - "NULL sniffer_rule::rule member found in rule list for type == '%s', " - "rule_string == '%s'\n", - i->type.c_str(), i->rule_string.c_str())); - } - } - - // If we get here, we didn't find a damn thing - err = kMimeGuessFailureError; - } - return err; -} - -// MaxBytesNeeded -/*! \brief Returns the maxmimum number of bytes needed in a data buffer for - all the currently installed rules to be able to perform a complete sniff, - or an error code if something goes wrong. - - If the internal rule list has not yet been built (this includes parsing - all the installed rules), it will be. - - \return: If the return value is non-negative, it represents the max number - of bytes needed to do a complete sniff. Otherwise, the number returned is - an error code. -*/ -ssize_t -SnifferRules::MaxBytesNeeded() -{ - ssize_t err = fHaveDoneFullBuild ? B_OK : BuildRuleList(); - if (!err) - err = fMaxBytesNeeded; - return err; -} - -// ProcessType -/*! \brief Handles a portion of the initial rule list construction for - the given mime type. - - \note To be called by BuildRuleList() *ONLY*. :-) - - \param type The mime type of interest. The mime string is expected to be valid - and lowercase. Both "supertype" and "supertype/subtype" mime types - are allowed. - \param bytesNeeded Returns the minimum number of bytes needed for this rule to - perform a complete sniff. May not be NULL because I'm lazy - and this function is for internal use only anyway. - \return - The return value is essentially ignored (as this function prints out the - debug warning if a parse fails), but that being said: - - \c B_OK: success - - \c other error code: failure -*/ -status_t -SnifferRules::ProcessType(const char *type, ssize_t *bytesNeeded) -{ - status_t err = type && bytesNeeded ? B_OK : B_BAD_VALUE; - if (!err) - *bytesNeeded = 0; - - BString str; - BString errorMsg; - sniffer_rule rule(new Sniffer::Rule()); - - // Check the mem alloc - if (!err) - err = rule.rule ? B_OK : B_NO_MEMORY; - // Read the attr - if (!err) - err = read_mime_attr_string(type, kSnifferRuleAttr, &str); - // Parse the rule - if (!err) { - err = Sniffer::parse(str.String(), rule.rule, &errorMsg); - if (err) - DBG(OUT("WARNING: SnifferRules::ProcessType(): Parse failure:\n%s\n", errorMsg.String())); - } - if (!err) { - // Note the bytes needed - *bytesNeeded = rule.rule->BytesNeeded(); - - // Add the rule to the list - rule.type = type; - rule.rule_string = str.String(); - fRuleList.push_back(rule); - } - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/Supertype.cpp b/src/build/libbe/storage/mime/Supertype.cpp deleted file mode 100644 index 8dab5ed4b4..0000000000 --- a/src/build/libbe/storage/mime/Supertype.cpp +++ /dev/null @@ -1,169 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Supertype.cpp - Supertype class implementation -*/ - -#include "mime/Supertype.h" - -#include -#include - -#include -#include - -#define DBG(x) x -//#define DBG(x) -#define OUT printf - -namespace BPrivate { -namespace Storage { -namespace Mime { - -/*! - \class Supertype - \brief Installed types information for a single supertype -*/ - -// Constructor -//! Constructs a new Supertype object -Supertype::Supertype(const char *super) - : fCachedMessage(NULL) - , fName(super ? super : "") -{ -} - -// Destructor -//! Destroys the Supertype object -Supertype::~Supertype() -{ - delete fCachedMessage; -} - -// GetInstalledSubtypes -/*! \brief Returns a list of the installeds subtypes for this supertype - in the pre-allocated \c BMessage pointed to by \c types. -*/ -status_t -Supertype::GetInstalledSubtypes(BMessage *types) -{ - status_t err = types ? B_OK : B_BAD_VALUE; - // See if we need to fill up a new message - if (!err && !fCachedMessage) { - err = CreateMessageWithTypes(&fCachedMessage); - } - // If we get this far, there's a cached message waiting - if (!err) { - *types = *fCachedMessage; - } - return err; -} - -// AddSubtype -/*! \brief Adds the given subtype to the subtype list and the cached message, - if one exists. - \param sub The subtype to add (do not include the supertype) - \return - - B_OK: success - - B_NAME_IN_USE: The subtype already exists in the subtype list - - "error code": failure -*/ -status_t -Supertype::AddSubtype(const char *sub) -{ - status_t err = sub ? B_OK : B_BAD_VALUE; - if (!err) - err = fSubtypes.insert(sub).second ? B_OK : B_NAME_IN_USE; - if (!err && fCachedMessage) { - char type[B_PATH_NAME_LENGTH]; - sprintf(type, "%s/%s", fName.c_str(), sub); - err = fCachedMessage->AddString("types", type); - } - return err; -} - -// RemoveSubtype -/*! \brief Removes the given subtype from the subtype list and invalidates the - cached message, if one exists. - \param sub The subtype to remove (do not include the supertype) -*/ -status_t -Supertype::RemoveSubtype(const char *sub) -{ - status_t err = sub ? B_OK : B_BAD_VALUE; - if (!err) - err = fSubtypes.erase(sub) == 1 ? B_OK : B_NAME_NOT_FOUND; - if (!err && fCachedMessage) { - delete fCachedMessage; - fCachedMessage = NULL; - } - return err; -} - -// SetName -//! Sets the supertype's name -void -Supertype::SetName(const char *super) -{ - if (super) - fName = super; -} - -// GetName -//! Returns the supertype's name -const char* -Supertype::GetName() -{ - return fName.c_str(); -} - -// FillMessageWithTypes -//! Adds the supertype's subtypes to the given message -/*! Each subtype is added as another item in the message's \c Mime::kTypesField - field. The complete type ("supertype/subtype") is added. The supertype itself - is not added to the message. -*/ -status_t -Supertype::FillMessageWithTypes(BMessage &msg) const -{ - status_t err = B_OK; - std::set::const_iterator i; - for (i = fSubtypes.begin(); i != fSubtypes.end() && !err; i++) { - char type[B_PATH_NAME_LENGTH]; - sprintf(type, "%s/%s", fName.c_str(), (*i).c_str()); - err = msg.AddString(kTypesField, type); - } - return err; -} - -// CreateMessageWithTypes -/*! \brief Allocates a new BMessage into the BMessage pointer pointed to by \c result - and fills it with the supertype's subtypes. - - See \c Supertype::FillMessageWithTypes() for more information. -*/ -status_t -Supertype::CreateMessageWithTypes(BMessage **result) const -{ - status_t err = result ? B_OK : B_BAD_VALUE; - // Alloc the message - if (!err) { - try { - *result = new BMessage(); - } catch (std::bad_alloc) { - err = B_NO_MEMORY; - } - } - // Fill with types - if (!err) - err = FillMessageWithTypes(**result); - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/SupportingApps.cpp b/src/build/libbe/storage/mime/SupportingApps.cpp deleted file mode 100644 index b46b1d9c0a..0000000000 --- a/src/build/libbe/storage/mime/SupportingApps.cpp +++ /dev/null @@ -1,320 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file SupportingApps.cpp - SupportingApps class implementation -*/ - -#include "mime/SupportingApps.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define DBG(x) x -//#define DBG(x) -#define OUT printf - -namespace BPrivate { -namespace Storage { -namespace Mime { - -/*! - \class SupportingApps - \brief Supporting apps information for the entire database -*/ - -// Constructor -//! Constructs a new SupportingApps object -SupportingApps::SupportingApps() - : fHaveDoneFullBuild(false) -{ -} - -// Destructor -//! Destroys the SupportingApps object -SupportingApps::~SupportingApps() -{ -} - -// GetSupportingApps -/*! \brief Returns a list of signatures of supporting applications for the - given type in the pre-allocated \c BMessage pointed to by \c apps. - - See \c BMimeType::GetSupportingApps() for more information. -*/ -status_t -SupportingApps::GetSupportingApps(const char *type, BMessage *apps) -{ - status_t err = type && apps ? B_OK : B_BAD_VALUE; - // See if we need to do our initial build still - if (!err && !fHaveDoneFullBuild) { - err = BuildSupportingAppsTable(); - } - if (!err) { - // Clear the message, as we're just going to add to it - apps->MakeEmpty(); - - BMimeType mime(type); - err = mime.InitCheck(); - if (!err) { - if (mime.IsSupertypeOnly()) { - // Add the apps that support this supertype (plus their count) - std::set &superApps = fSupportingApps[type]; - int32 count = 0; - std::set::const_iterator i; - for (i = superApps.begin(); i != superApps.end() && !err; i++) { - err = apps->AddString(kApplicationsField, (*i).c_str()); - count++; - } - if (!err) - err = apps->AddInt32(kSupportingAppsSuperCountField, count); - } else { - // Add the apps that support this subtype (plus their count) - std::set &subApps = fSupportingApps[type]; - int32 count = 0; - std::set::const_iterator i; - for (i = subApps.begin(); i != subApps.end() && !err; i++) { - err = apps->AddString(kApplicationsField, (*i).c_str()); - count++; - } - if (!err) - err = apps->AddInt32(kSupportingAppsSubCountField, count); - - // Now add any apps that support the supertype, but not the - // subtype (plus their count). - BMimeType superMime; - err = mime.GetSupertype(&superMime); - if (!err) - err = superMime.InitCheck(); - if (!err) { - std::set &superApps = fSupportingApps[type]; - count = 0; - for (i = superApps.begin(); i != superApps.end() && !err; i++) { - if (subApps.find(*i) == subApps.end()) { - err = apps->AddString(kApplicationsField, (*i).c_str()); - count++; - } - } - if (!err) - err = apps->AddInt32(kSupportingAppsSuperCountField, count); - } - } - } - } - return err; -} - -// SetSupportedTypes -/*! \brief Sets the list of supported types for the given application and - updates the supporting apps mappings. - - All types listed as being supported types will including the given - app signature in their list of supporting apps following this call. - - If \a fullSync is true, all types previously but no longer supported - by this application with no longer list this application as a - supporting app. - - If \a fullSync is false, said previously supported types will be - saved to a "stranded types" mapping and appropriately synchronized - the next time SetSupportedTypes() is called with a \c true \a fullSync - parameter. - - The stranded types mapping is properly maintained even in the event - of types being removed and then re-added to the list of supporting - types with consecutive \c false \a fullSync parameters. - - \param app The application whose supported types you are setting - \param types Pointer to a \c BMessage containing an array of supported - mime types in its \c Mime::kTypesField field. - \param fullSync If \c true, \c app is removed as a supporting application - for any types for which it is no longer a supporting application - (including types which were removed as supporting types with - previous callsto SetSupportedTypes(..., false)). If \c false, - said mappings are not updated until the next SetSupportedTypes(..., true) - call. -*/ -status_t -SupportingApps::SetSupportedTypes(const char *app, const BMessage *types, bool fullSync) -{ - status_t err = app && types ? B_OK : B_BAD_VALUE; - if (!fHaveDoneFullBuild) - return err; - - std::set oldTypes; - std::set &newTypes = fSupportedTypes[app]; - std::set &strandedTypes = fStrandedTypes[app]; - // Make a copy of the previous types if we're doing a full sync - if (!err) - oldTypes = newTypes; - - if (!err) { - // Read through the list of new supported types, creating the new - // supported types list and adding the app as a supporting app for - // each type. - newTypes.clear(); - const char *type; - for (int32 i = 0; - types->FindString(kTypesField, i, &type) == B_OK; - i++) { - newTypes.insert(type); - AddSupportingApp(type, app); - } - - // Update the list of stranded types by removing any types that are newly - // re-supported and adding any types that are newly un-supported - for (std::set::const_iterator i = newTypes.begin(); - i != newTypes.end(); - i++) - { - strandedTypes.erase(*i); - } - for (std::set::const_iterator i = oldTypes.begin(); - i != oldTypes.end(); - i++) - { - if (newTypes.find(*i) == newTypes.end()) - strandedTypes.insert(*i); - } - - // Now, if we're doing a full sync, remove the app as a supporting - // app for any of its stranded types and then clear said list of - // stranded types. - if (fullSync) { - for (std::set::const_iterator i = strandedTypes.begin(); - i != strandedTypes.end(); - i++) - { - RemoveSupportingApp((*i).c_str(), app); - } - strandedTypes.clear(); - } - } - return err; -} - -// DeleteSupportedTypes -/*! \brief Clears the given application's supported types list and optionally - removes the application from each of said types' supporting apps list. - \param app The application whose supported types you are clearing - \param fullSync See SupportingApps::SetSupportedTypes() -*/ -status_t -SupportingApps::DeleteSupportedTypes(const char *app, bool fullSync) -{ - BMessage types; - return SetSupportedTypes(app, &types, fullSync); -} - -// AddSupportingApp -/*! \brief Adds the given application signature to the set of supporting - apps for the given type. - - \param type The full mime type - \param app The full application signature (i.e. "application/app-subtype") - \return - - B_OK: success, even if the app was already in the supporting apps list - - "error code": failure -*/ -status_t -SupportingApps::AddSupportingApp(const char *type, const char *app) -{ - status_t err = type && app ? B_OK : B_BAD_VALUE; - if (!err) - fSupportingApps[type].insert(app); - return err; -} - -// RemoveSupportingApp -/*! \brief Removes the given application signature from the set of supporting - apps for the given type. - - \param type The full mime type - \param app The full application signature (i.e. "application/app-subtype") - \return - - B_OK: success, even if the app was not found in the supporting apps list - - "error code": failure -*/ -status_t -SupportingApps::RemoveSupportingApp(const char *type, const char *app) -{ - status_t err = type && app ? B_OK : B_BAD_VALUE; - if (!err) - fSupportingApps[type].erase(app); - return err; -} - -// BuildSupportingAppsTable -/*! \brief Crawls the mime database and builds a list of supporting application - signatures for every supported type. -*/ -status_t -SupportingApps::BuildSupportingAppsTable() -{ - fSupportedTypes.clear(); - fSupportingApps.clear(); - fStrandedTypes.clear(); - - BDirectory dir; - status_t err = dir.SetTo(kApplicationDatabaseDir.c_str()); - - // Build the supporting apps table based on the mime database - if (!err) { - dir.Rewind(); - - // Handle each application type - while (true) { - entry_ref ref; - err = dir.GetNextRef(&ref); - if (err) { - // If we've come to the end of list, it's not an error - if (err == B_ENTRY_NOT_FOUND) - err = B_OK; - break; - } else { - BPath path; - BMessage msg; - char appSig[B_PATH_NAME_LENGTH]; - err = path.SetTo(&ref); - if (!err) { - // Construct a mime type string - const char *appName = path.Leaf(); - sprintf(appSig, "application/%s", appName); - - // Read in the list of supported types - if (read_mime_attr_message(appSig, kSupportedTypesAttr, &msg) == B_OK) { - // Iterate through the supported types, adding them to the list of - // supported types for the application and adding the application's - // signature to the list of supporting apps for each type - const char *type; - std::set &supportedTypes = fSupportedTypes[appName]; - for (int i = 0; msg.FindString(kTypesField, i, &type) == B_OK; i++) { - supportedTypes.insert(type); - AddSupportingApp(type, appSig); - } - } - } - } - } - } - if (err) - DBG(OUT("Mime::SupportingApps::BuildSupportingAppsTable() failed, error code == 0x%lx\n", err)); - else - fHaveDoneFullBuild = true; - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/mime/database_access.cpp b/src/build/libbe/storage/mime/database_access.cpp deleted file mode 100644 index 8332c8e534..0000000000 --- a/src/build/libbe/storage/mime/database_access.cpp +++ /dev/null @@ -1,425 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file database_access.cpp - Mime database atomic read functions -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include // For struct attr_info -#include -#include // For new(nothrow) -#include -#include - -#include "mime/database_access.h" - -#define DBG(x) x -//#define DBG(x) -#define OUT printf - -namespace BPrivate { -namespace Storage { -namespace Mime { - -//------------------------------------------------------------------------------ -// Functions -//------------------------------------------------------------------------------ - -// get_app_hint -//! Fetches the application hint for the given MIME type. -/*! The entry_ref pointed to by \c ref must be pre-allocated. - - \param type The MIME type of interest - \param ref Pointer to a pre-allocated \c entry_ref struct into - which the location of the hint application is copied. - - \return - - \c B_OK: Success - - \c B_ENTRY_NOT_FOUND: No app hint exists for the given type - - "error code": Failure -*/ -status_t -get_app_hint(const char *type, entry_ref *ref) -{ - char path[B_MIME_TYPE_LENGTH]; - BEntry entry; - ssize_t err = ref ? B_OK : B_BAD_VALUE; - if (!err) - err = read_mime_attr(type, kAppHintAttr, path, B_MIME_TYPE_LENGTH, kAppHintType); - if (err >= 0) - err = entry.SetTo(path); - if (!err) - err = entry.GetRef(ref); - return err; -} - -// get_attr_info -/*! \brief Fetches from the MIME database a BMessage describing the attributes - typically associated with files of the given MIME type - - The attribute information is returned in a pre-allocated BMessage pointed to by - the \c info parameter (note that the any prior contents of the message - will be destroyed). Please see BMimeType::SetAttrInfo() for a description - of the expected format of such a message. - - \param info Pointer to a pre-allocated BMessage into which information about - the MIME type's associated file attributes is stored. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -get_attr_info(const char *type, BMessage *info) -{ - status_t err = read_mime_attr_message(type, kAttrInfoAttr, info); - if (!err) { - info->what = 233; // Don't know why, but that's what R5 does. - err = info->AddString("type", type); - } - return err; -} - -// get_short_description -//! Fetches the short description for the given MIME type. -/*! The string pointed to by \c description must be long enough to - hold the short description; a length of \c B_MIME_TYPE_LENGTH is - recommended. - - \param type The MIME type of interest - \param description Pointer to a pre-allocated string into which the short - description is copied. If the function fails, the contents - of the string are undefined. - - \return - - \c B_OK: Success - - \c B_ENTRY_NOT_FOUND: No short description exists for the given type - - "error code": Failure -*/ -status_t -get_short_description(const char *type, char *description) -{ -/// DBG(OUT("Mime::Database::get_short_description()\n")); - ssize_t err = read_mime_attr(type, kShortDescriptionAttr, description, B_MIME_TYPE_LENGTH, kShortDescriptionType); - return err >= 0 ? B_OK : err ; -} - -// get_long_description -//! Fetches the long description for the given MIME type. -/*! The string pointed to by \c description must be long enough to - hold the long description; a length of \c B_MIME_TYPE_LENGTH is - recommended. - - \param type The MIME type of interest - \param description Pointer to a pre-allocated string into which the long - description is copied. If the function fails, the contents - of the string are undefined. - - \return - - \c B_OK: Success - - \c B_ENTRY_NOT_FOUND: No long description exists for the given type - - "error code": Failure -*/ -status_t -get_long_description(const char *type, char *description) -{ -// DBG(OUT("Mime::Database::get_long_description()\n")); - ssize_t err = read_mime_attr(type, kLongDescriptionAttr, description, B_MIME_TYPE_LENGTH, kLongDescriptionType); - return err >= 0 ? B_OK : err ; -} - -// get_file_extensions -//! Fetches a BMessage describing the MIME type's associated filename extensions -/*! The list of extensions is returned in a pre-allocated BMessage pointed to by - the \c extensions parameter (note that the any prior contents of the message - will be destroyed). Please see BMimeType::GetFileExtensions() for a description - of the message format. - - \param extensions Pointer to a pre-allocated BMessage into which the MIME - type's associated file extensions will be stored. - \return - - \c B_OK: Success - - "error code": Failure -*/ -status_t -get_file_extensions(const char *type, BMessage *extensions) -{ - status_t err = read_mime_attr_message(type, kFileExtensionsAttr, extensions); - if (!err) { - extensions->what = 234; // Don't know why, but that's what R5 does. - err = extensions->AddString("type", type); - } - return err; -} - -// get_icon -//! Fetches the icon of given size associated with the given MIME type -/*! The bitmap pointed to by \c icon must be of the proper size (\c 32x32 - for \c B_LARGE_ICON, \c 16x16 for \c B_MINI_ICON) and color depth - (\c B_CMAP8). - - \param type The mime type - \param icon Pointer to a pre-allocated bitmap of proper dimensions and color depth - \param size The size icon you're interested in (\c B_LARGE_ICON or \c B_MINI_ICON) -*/ -status_t -get_icon(const char *type, BBitmap *icon, icon_size which) -{ - return get_icon_for_type(type, NULL, icon, which); -} - -// get_icon_for_type -/*! \brief Fetches the large or mini icon used by an application of this type for files of the - given type. - - The type of the \c BMimeType object is not required to actually be a subtype of - \c "application/"; that is the intended use however, and calling \c get_icon_for_type() - on a non-application type will likely return \c B_ENTRY_NOT_FOUND. - - The icon is copied into the \c BBitmap pointed to by \c icon. The bitmap must - be the proper size: \c 32x32 for the large icon, \c 16x16 for the mini icon. - - \param type The MIME type - \param type Pointer to a pre-allocated string containing the MIME type whose - custom icon you wish to fetch. If NULL, works just like get_icon(). - \param icon Pointer to a pre-allocated \c BBitmap of proper size and colorspace into - which the icon is copied. - \param icon_size Value that specifies which icon to return. Currently \c B_LARGE_ICON - and \c B_MINI_ICON are supported. - \return - - \c B_OK: Success - - \c B_ENTRY_NOT_FOUND: No icon of the given size exists for the given type - - "error code": Failure - -*/ -status_t -get_icon_for_type(const char *type, const char *fileType, BBitmap *icon, - icon_size which) -{ - std::string attr; - attr_info info; - ssize_t err; - BNode node; - uint32 attrType = 0; - ssize_t attrSize = 0; - BRect bounds; - - err = type && icon ? B_OK : B_BAD_VALUE; - - // Figure out what kind of data we *should* find - if (!err) { - switch (which) { - case B_MINI_ICON: - bounds.Set(0, 0, 15, 15); - attrType = kMiniIconType; - attrSize = 16 * 16; - break; - case B_LARGE_ICON: - bounds.Set(0, 0, 31, 31); - attrType = kLargeIconType; - attrSize = 32 * 32; - break; - default: - err = B_BAD_VALUE; - break; - } - } - // Construct our attribute name - if (fileType) { - attr = (which == B_MINI_ICON - ? kMiniIconAttrPrefix - : kLargeIconAttrPrefix) - + BPrivate::Storage::to_lower(fileType); - } else { - attr = (which == B_MINI_ICON) ? kMiniIconAttr : kLargeIconAttr; - } - // Check the icon and attribute to see if they match - if (!err) - err = (icon->InitCheck() == B_OK && icon->Bounds() == bounds) ? B_OK : B_BAD_VALUE; - if (!err) - err = open_type(type, &node); - if (!err) - err = node.GetAttrInfo(attr.c_str(), &info); - if (!err) - err = (attrType == info.type && attrSize == info.size) ? B_OK : B_BAD_VALUE; - // read the attribute - if (!err) { - bool otherColorSpace = (icon->ColorSpace() != B_CMAP8); - char *buffer = NULL; - if (otherColorSpace) { - // other color space than stored in attribute - buffer = new(std::nothrow) char[attrSize]; - if (!buffer) - err = B_NO_MEMORY; - if (!err) - err = node.ReadAttr(attr.c_str(), attrType, 0, buffer, attrSize); - } else { - // same color space, just read direct - err = node.ReadAttr(attr.c_str(), attrType, 0, icon->Bits(), attrSize); - } - if (err >= 0) - err = (err == attrSize) ? (status_t)B_OK : (status_t)B_FILE_ERROR; - if (otherColorSpace) { - if (!err) { - err = icon->ImportBits(buffer, attrSize, B_ANY_BYTES_PER_ROW, - 0, B_CMAP8); - } - delete[] buffer; - } - } - - return err; -} - -// get_preferred_app -//! Fetches signature of the MIME type's preferred application for the given action. -/*! The string pointed to by \c signature must be long enough to - hold the short description; a length of \c B_MIME_TYPE_LENGTH is - recommended. - - Currently, the only supported app verb is \c B_OPEN. - - \param type The MIME type of interest - \param description Pointer to a pre-allocated string into which the preferred - application's signature is copied. If the function fails, the - contents of the string are undefined. - \param verb \c The action of interest - - \return - - \c B_OK: Success - - \c B_ENTRY_NOT_FOUND: No such preferred application exists - - "error code": Failure -*/ -status_t -get_preferred_app(const char *type, char *signature, app_verb verb = B_OPEN) -{ - // Since B_OPEN is the currently the only app_verb, it is essentially ignored - ssize_t err = read_mime_attr(type, kPreferredAppAttr, signature, B_MIME_TYPE_LENGTH, kPreferredAppType); - return err >= 0 ? B_OK : err ; -} - -// get_sniffer_rule -/*! \brief Fetches the sniffer rule for the given MIME type. - \param type The MIME type of interest - \param result Pointer to a pre-allocated BString into which the type's - sniffer rule is copied. - \return - - \c B_OK: Success - - \c B_ENTRY_NOT_FOUND: No such preferred application exists - - "error code": Failure -*/ -status_t -get_sniffer_rule(const char *type, BString *result) -{ - return read_mime_attr_string(type, kSnifferRuleAttr, result); -} - -// get_supported_types -status_t -get_supported_types(const char *type, BMessage *types) -{ - status_t err = read_mime_attr_message(type, kSupportedTypesAttr, types); - if (!err) { - types->what = 0; - err = types->AddString("type", type); - } - return err; -} - -// is_installed -//! Checks if the given MIME type is present in the database -bool -is_installed(const char *type) -{ - BNode node; - return open_type(type, &node) == B_OK; -} - -// get_icon_data -/*! \brief Returns properly formatted raw bitmap data, ready to be shipped off to the hacked - up 4-parameter version of Database::SetIcon() - - This function exists as something of a hack until an OBOS::BBitmap implementation is - available. It takes the given bitmap, converts it to the B_CMAP8 color space if necessary - and able, and returns said bitmap data in a newly allocated array pointed to by the - pointer that's pointed to by \c data. The length of the array is stored in the integer - pointed to by \c dataSize. The array is allocated with \c new[], and it's your responsibility - to \c delete[] it when you're finished. - -*/ -status_t -get_icon_data(const BBitmap *icon, icon_size which, void **data, int32 *dataSize) -{ - ssize_t err = (icon && data && dataSize && icon->InitCheck() == B_OK) ? B_OK : B_BAD_VALUE; - - BRect bounds; - BBitmap *icon8 = NULL; - void *srcData = NULL; - bool otherColorSpace = false; - - // Figure out what kind of data we *should* have - if (!err) { - switch (which) { - case B_MINI_ICON: - bounds.Set(0, 0, 15, 15); - break; - case B_LARGE_ICON: - bounds.Set(0, 0, 31, 31); - break; - default: - err = B_BAD_VALUE; - break; - } - } - // Check the icon - if (!err) - err = (icon->Bounds() == bounds) ? B_OK : B_BAD_VALUE; - // Convert to B_CMAP8 if necessary - if (!err) { - otherColorSpace = (icon->ColorSpace() != B_CMAP8); - if (otherColorSpace) { - icon8 = new(std::nothrow) BBitmap(bounds, B_BITMAP_NO_SERVER_LINK, - B_CMAP8); - if (!icon8) - err = B_NO_MEMORY; - if (!err) - err = icon8->ImportBits(icon); - if (!err) { - srcData = icon8->Bits(); - *dataSize = icon8->BitsLength(); - } - } else { - srcData = icon->Bits(); - *dataSize = icon->BitsLength(); - } - } - // Alloc a new data buffer - if (!err) { - *data = new(std::nothrow) char[*dataSize]; - if (!*data) - err = B_NO_MEMORY; - } - // Copy the data into it. - if (!err) - memcpy(*data, srcData, *dataSize); - if (otherColorSpace) - delete icon8; - return err; -} - -} // namespace Mime -} // namespace Storage -} // namespace BPrivate - diff --git a/src/build/libbe/storage/sniffer/CharStream.cpp b/src/build/libbe/storage/sniffer/CharStream.cpp deleted file mode 100644 index eb916fc8d6..0000000000 --- a/src/build/libbe/storage/sniffer/CharStream.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include "sniffer/CharStream.h" - -#include - -using namespace BPrivate::Storage::Sniffer; - -//------------------------------------------------------------------------------ -// CharStream -//------------------------------------------------------------------------------ - -/*! \brief Creates a new, initialized character stream - - \param string The character string to be streamed -*/ -CharStream::CharStream(const std::string &string) - : fString(string) - , fPos(0) - , fCStatus(B_OK) -{ -} - -/*! \brief Creates a new, unitialized character stream - - Call SetTo() to initialize the stream. -*/ -CharStream::CharStream() - : fString("") - , fPos(0) - , fCStatus(B_NO_INIT) -{ -} - -/*! \brief Destroys the character stream -*/ -CharStream::~CharStream() { - Unset(); -} - -/*! \brief Reinitializes the character stream to the given string - - The stream position is reset to the beginning of the stream. - - \param string The new character string to be streamed - \return Returns \c B_OK -*/ -status_t -CharStream::SetTo(const std::string &string) { - fString = string; - fPos = 0; - fCStatus = B_OK; - return fCStatus; -} - -/*! \brief Unitializes the stream -*/ -void -CharStream::Unset() { - fString = ""; - fPos = 0; - fCStatus = B_NO_INIT; -} - -/*! \brief Returns the current status of the stream - - \return - - \c B_OK: Ready and initialized - - \c B_NO_INIT: Unitialized -*/ -status_t -CharStream::InitCheck() const { - return fCStatus; -} - -/*! \brief Returns \c true if there are no more characters in the stream. - - If the stream is unitialized, \c true is also returned. -*/ -bool -CharStream::IsEmpty() const { - return fPos >= fString.length(); -} - -/*! \brief Returns the current offset of the stream into the original string. - - If the stream is unitialized, zero is returned. -*/ -size_t -CharStream::Pos() const { - return fPos; -} - -/*! \brief Returns the entire string being streamed. -*/ -const std::string& -CharStream::String() const { - return fString; -} - -/*! Returns the next character in the stream. - - Also increments the position in the stream. Call Unget() to - undo this operation. - - Throws a BPrivate::Storage::Sniffer::Err exception if the stream is - unitialized. If the end of the stream has been reached, the position - marker is still incremented, but an end of text char (\c 0x03) is - returned. -*/ -char -CharStream::Get() { - if (fCStatus != B_OK) - throw new Err("Sniffer parser error: CharStream::Get() called on uninitialized CharStream object", -1); - if (fPos < fString.length()) - return fString[fPos++]; - else { - fPos++; // Increment fPos to keep Unget()s consistent - return 0x3; // Return End-Of-Text char - } -} - -/*! Shifts the stream position back one character. - - Throws a BPrivate::Storage::Sniffer::Err exception if the stream is - unitialized or there are no more characters to unget. -*/ -void -CharStream::Unget() { - if (fCStatus != B_OK) - throw new Err("Sniffer parser error: CharStream::Unget() called on uninitialized CharStream object", -1); - if (fPos > 0) - fPos--; - else - throw new Err("Sniffer parser error: CharStream::Unget() called at beginning of character stream", -1); -} - diff --git a/src/build/libbe/storage/sniffer/DisjList.cpp b/src/build/libbe/storage/sniffer/DisjList.cpp deleted file mode 100644 index 541bebe4a2..0000000000 --- a/src/build/libbe/storage/sniffer/DisjList.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file DisjList.cpp - MIME sniffer Disjunction List class implementation -*/ - -#include - -using namespace BPrivate::Storage::Sniffer; - -DisjList::DisjList() - : fCaseInsensitive(false) -{ -} - -DisjList::~DisjList() { -} - -void -DisjList::SetCaseInsensitive(bool how) { - fCaseInsensitive = how; -} - -bool -DisjList::IsCaseInsensitive() { - return fCaseInsensitive; -} - - - - diff --git a/src/build/libbe/storage/sniffer/Err.cpp b/src/build/libbe/storage/sniffer/Err.cpp deleted file mode 100644 index f69e7d4271..0000000000 --- a/src/build/libbe/storage/sniffer/Err.cpp +++ /dev/null @@ -1,98 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Err.cpp - MIME sniffer Error class implementation -*/ - -#include -#include - -using namespace BPrivate::Storage::Sniffer; - -//------------------------------------------------------------------------------ -// Err -//------------------------------------------------------------------------------ - -Err::Err(const char *msg, const ssize_t pos) - : fMsg(NULL) - , fPos(-1) -{ - SetTo(msg, pos); -} - -Err::Err(const std::string &msg, const ssize_t pos) - : fMsg(NULL) - , fPos(-1) -{ - SetTo(msg, pos); -} - -Err::Err(const Err &ref) - : fMsg(NULL) - , fPos(-1) -{ - *this = ref; -} - -Err::~Err() { - Unset(); -} - -Err& -Err::operator=(const Err &ref) { - SetTo(ref.Msg(), ref.Pos()); - return *this; -} - -status_t -Err::SetTo(const char *msg, const ssize_t pos) { - SetMsg(msg); - SetPos(pos); - return B_OK; -} - -status_t -Err::SetTo(const std::string &msg, const ssize_t pos) { - return SetTo(msg.c_str(), pos); -} - -void -Err::Unset() { - delete fMsg; - fMsg = NULL; - fPos = -1; -} - -const char* -Err::Msg() const { - return fMsg; -} - -ssize_t -Err::Pos() const { - return fPos; -} - -void -Err::SetMsg(const char *msg) { - if (fMsg) { - delete fMsg; - fMsg = NULL; - } - if (msg) { - fMsg = new(std::nothrow) char[strlen(msg)+1]; - if (fMsg) - strcpy(fMsg, msg); - } -} - -void -Err::SetPos(ssize_t pos) { - fPos = pos; -} - - - diff --git a/src/build/libbe/storage/sniffer/Parser.cpp b/src/build/libbe/storage/sniffer/Parser.cpp deleted file mode 100644 index 5848de4f94..0000000000 --- a/src/build/libbe/storage/sniffer/Parser.cpp +++ /dev/null @@ -1,1277 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//---------------------------------------------------------------------- -/*! - \file sniffer/Parser.cpp - MIME sniffer rule parser implementation -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include // For atol(), atof() -#include -#include // BString - -using namespace BPrivate::Storage::Sniffer; - -// Miscellaneous helper functions -char escapeChar(char ch); -char hexToChar(char hi, char low); -char hexToChar(char hex); -char octalToChar(char octal); -char octalToChar(char hi, char low); -char octalToChar(char hi, char mid, char low); -bool isHexChar(char ch); -bool isWhiteSpace(char ch); -bool isOctalChar(char ch); -bool isDecimalChar(char ch); -bool isPunctuation(char ch); - -//! Parses the given rule. -/*! The resulting parsed Rule structure is stored in \c rule, which - must be pre-allocated. If parsing fails, a descriptive error message (meant - to be viewed in a monospaced font) is placed in the pre-allocated \c BString - pointed to by \c parseError (which may be \c NULL if you don't care about - the error message). - - \param rule Pointer to a NULL-terminated string containing the sniffer - rule to be parsed - \param result Pointer to a pre-allocated \c Rule object into which the result - of parsing is placed upon success. - \param parseError Point to pre-allocated \c BString object into which - a descriptive error message is stored upon failure. - - \return - - B_OK: Success - - B_BAD_MIME_SNIFFER_RULE: Failure -*/ -status_t -BPrivate::Storage::Sniffer::parse(const char *rule, Rule *result, BString *parseError) { - Parser parser; - return parser.Parse(rule, result, parseError); -} - -//------------------------------------------------------------------------------ -// Token -//------------------------------------------------------------------------------ - -Token::Token(TokenType type, const ssize_t pos) - : fType(type) - , fPos(pos) -{ -// if (type != EmptyToken) -// cout << "New Token, fType == " << tokenTypeToString(fType) << endl; -} - -Token::~Token() { -} - -TokenType -Token::Type() const { - return fType; -} - -const std::string& -Token::String() const { - throw new Err("Sniffer scanner error: Token::String() called on non-string token", fPos); -} - -int32 -Token::Int() const { - throw new Err("Sniffer scanner error: Token::Int() called on non-integer token", fPos); -} - -double -Token::Float() const { - throw new Err("Sniffer scanner error: Token::Float() called on non-float token", fPos); -} - -ssize_t -Token::Pos() const { - return fPos; -} - -bool -Token::operator==(Token &ref) const { - // Compare types, then data if necessary - if (Type() == ref.Type()) { - switch (Type()) { - case CharacterString: -// printf(" str1 == '%s'\n", String()); -// printf(" str2 == '%s'\n", ref.String()); -// printf(" strcmp() == %d\n", strcmp(String(), ref.String())); - { - return String() == ref.String(); - -/* - // strcmp() seems to choke on certain, non-normal ASCII chars - // (i.e. chars outside the usual alphabets, but still valid - // as far as ASCII is concerned), so we'll just compare the - // strings by hand to be safe. - const char *str1 = String(); - const char *str2 = ref.String(); - int len1 = strlen(str1); - int len2 = strlen(str2); -// printf("len1 == %d\n", len1); -// printf("len2 == %d\n", len2); - if (len1 == len2) { - for (int i = 0; i < len1; i++) { -// printf("i == %d, str1[%d] == %x, str2[%d] == %x\n", i, i, str1[i], i, str2[i]); - if (str1[i] != str2[i]) - return false; - } - } - return true; -*/ - } -// return strcmp(String(), ref.String()) == 0; - - case Integer: - return Int() == ref.Int(); - - case FloatingPoint: - return Float() == ref.Float(); - - default: - return true; - } - } else - return false; -} - -//------------------------------------------------------------------------------ -// StringToken -//------------------------------------------------------------------------------ - -StringToken::StringToken(const std::string &str, const ssize_t pos) - : Token(CharacterString, pos) - , fString(str) -{ -} - -StringToken::~StringToken() { -} - -const std::string& -StringToken::String() const { - return fString; -} - -//------------------------------------------------------------------------------ -// IntToken -//------------------------------------------------------------------------------ - -IntToken::IntToken(const int32 value, const ssize_t pos) - : Token(Integer, pos) - , fValue(value) -{ -} - -IntToken::~IntToken() { -} - -int32 -IntToken::Int() const { - return fValue; -} - -double -IntToken::Float() const { - return (double)fValue; -} - -//------------------------------------------------------------------------------ -// FloatToken -//------------------------------------------------------------------------------ - -FloatToken::FloatToken(const double value, const ssize_t pos) - : Token(FloatingPoint, pos) - , fValue(value) -{ -} - -FloatToken::~FloatToken() { -} - - -double -FloatToken::Float() const { - return fValue; -} - -//------------------------------------------------------------------------------ -// TokenStream -//------------------------------------------------------------------------------ - -TokenStream::TokenStream(const std::string &string) - : fCStatus(B_NO_INIT) - , fPos(-1) - , fStrLen(-1) -{ - SetTo(string); -} - -TokenStream::TokenStream() - : fCStatus(B_NO_INIT) - , fPos(-1) - , fStrLen(-1) -{ -} - -TokenStream::~TokenStream() { - Unset(); -} - -status_t -TokenStream::SetTo(const std::string &string) { - Unset(); - fStrLen = string.length(); - CharStream stream(string); - if (stream.InitCheck() != B_OK) - throw new Err("Sniffer scanner error: Unable to intialize character stream", -1); - - typedef enum TokenStreamScannerState { - tsssStart, - tsssOneSingle, - tsssOneDouble, - tsssOneZero, - tsssZeroX, - tsssOneHex, - tsssTwoHex, - tsssIntOrFloat, - tsssFloat, - tsssLonelyDecimalPoint, - tsssLonelyMinusOrPlus, - tsssLonelyFloatExtension, - tsssLonelyFloatExtensionWithSign, - tsssExtendedFloat, - tsssUnquoted, - tsssEscape, - tsssEscapeX, - tsssEscapeOneOctal, - tsssEscapeTwoOctal, - tsssEscapeOneHex, - }; - - TokenStreamScannerState state = tsssStart; - TokenStreamScannerState escapedState = tsssStart; - // Used to remember which state to return to from an escape sequence - - std::string charStr = ""; // Used to build up character strings - char lastChar = 0; // For two char lookahead - char lastLastChar = 0; // For three char lookahead (have I mentioned I hate octal?) - bool keepLooping = true; - ssize_t startPos = 0; - while (keepLooping) { - ssize_t pos = stream.Pos(); - char ch = stream.Get(); - switch (state) { - case tsssStart: - startPos = pos; - switch (ch) { - case 0x3: // End-Of-Text - if (stream.IsEmpty()) - keepLooping = false; - else - throw new Err(std::string("Sniffer pattern error: invalid character '") + ch + "'", pos); - break; - - case '\t': - case '\n': - case ' ': - // Whitespace, so ignore it. - break; - - case '"': - charStr = ""; - state = tsssOneDouble; - break; - - case '\'': - charStr = ""; - state = tsssOneSingle; - break; - - case '+': - case '-': - charStr = ch; - lastChar = ch; - state = tsssLonelyMinusOrPlus; - break; - - case '.': - charStr = ch; - state = tsssLonelyDecimalPoint; - break; - - case '0': - charStr = ch; - state = tsssOneZero; - break; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - charStr = ch; - state = tsssIntOrFloat; - break; - - case '&': AddToken(Ampersand, pos); break; - case '(': AddToken(LeftParen, pos); break; - case ')': AddToken(RightParen, pos); break; - case ':': AddToken(Colon, pos); break; - case '[': AddToken(LeftBracket, pos); break; - - case '\\': - charStr = ""; // Clear our string - state = tsssEscape; - escapedState = tsssUnquoted; // Unquoted strings begin with an escaped character - break; - - case ']': AddToken(RightBracket, pos); break; - case '|': AddToken(Divider, pos); break; - - default: - throw new Err(std::string("Sniffer pattern error: invalid character '") + ch + "'", pos); - } - break; - - case tsssOneSingle: - switch (ch) { - case '\\': - escapedState = state; // Save our state - state = tsssEscape; // Handle the escape sequence - break; - case '\'': - AddString(charStr, startPos); - state = tsssStart; - break; - case 0x3: - if (stream.IsEmpty()) - throw new Err(std::string("Sniffer pattern error: unterminated single-quoted string"), pos); - else - charStr += ch; - break; - default: - charStr += ch; - break; - } - break; - - case tsssOneDouble: - switch (ch) { - case '\\': - escapedState = state; // Save our state - state = tsssEscape; // Handle the escape sequence - break; - case '"': - AddString(charStr, startPos); - state = tsssStart; - break; - case 0x3: - if (stream.IsEmpty()) - throw new Err(std::string("Sniffer pattern error: unterminated double-quoted string"), pos); - else - charStr += ch; - break; - default: - charStr += ch; - break; - } - break; - - case tsssOneZero: - if (ch == 'x') { - charStr = ""; // Reinit, since we actually have a hex string - state = tsssZeroX; - } else if ('0' <= ch && ch <= '9') { - charStr += ch; - state = tsssIntOrFloat; - } else if (ch == '.') { - charStr += ch; - state = tsssFloat; - } else if (ch == 'e' || ch == 'E') { - charStr += ch; - state = tsssLonelyFloatExtension; - } else { - // Terminate the number - AddInt(charStr.c_str(), startPos); - - // Push the last char back on and try again - stream.Unget(); - state = tsssStart; - } - break; - - case tsssZeroX: - if (isHexChar(ch)) { - lastChar = ch; - state = tsssOneHex; - } else - throw new Err(std::string("Sniffer pattern error: incomplete hex code"), pos); - break; - - case tsssOneHex: - if (isHexChar(ch)) { - try { - charStr += hexToChar(lastChar, ch); - } catch (Err *err) { - if (err) - err->SetPos(pos); - throw err; - } - state = tsssTwoHex; - } else - throw new Err(std::string("Sniffer pattern error: bad hex literal"), pos); // Same as R5 - break; - - case tsssTwoHex: - if (isHexChar(ch)) { - lastChar = ch; - state = tsssOneHex; - } else { - AddString(charStr, startPos); - stream.Unget(); // So punctuation gets handled properly - state = tsssStart; - } - break; - - case tsssIntOrFloat: - if (isDecimalChar(ch)) - charStr += ch; - else if (ch == '.') { - charStr += ch; - state = tsssFloat; - } else if (ch == 'e' || ch == 'E') { - charStr += ch; - state = tsssLonelyFloatExtension; - } else { - // Terminate the number - AddInt(charStr.c_str(), startPos); - - // Push the last char back on and try again - stream.Unget(); - state = tsssStart; - } - break; - - case tsssFloat: - if (isDecimalChar(ch)) - charStr += ch; - else if (ch == 'e' || ch == 'E') { - charStr += ch; - state = tsssLonelyFloatExtension; - } else { - // Terminate the number - AddFloat(charStr.c_str(), startPos); - - // Push the last char back on and try again - stream.Unget(); - state = tsssStart; - } - break; - - case tsssLonelyDecimalPoint: - if (isDecimalChar(ch)) { - charStr += ch; - state = tsssFloat; - } else - throw new Err(std::string("Sniffer pattern error: incomplete floating point number"), pos); - break; - - case tsssLonelyMinusOrPlus: - if (isDecimalChar(ch)) { - charStr += ch; - state = tsssIntOrFloat; - } else if (ch == '.') { - charStr += ch; - state = tsssLonelyDecimalPoint; - } else if (ch == 'i' && lastChar == '-') { - AddToken(CaseInsensitiveFlag, startPos); - state = tsssStart; - } else - throw new Err(std::string("Sniffer pattern error: incomplete signed number or invalid flag"), pos); - break; - - case tsssLonelyFloatExtension: - if (ch == '+' || ch == '-') { - charStr += ch; - state = tsssLonelyFloatExtensionWithSign; - } else if (isDecimalChar(ch)) { - charStr += ch; - state = tsssExtendedFloat; - } else - throw new Err(std::string("Sniffer pattern error: incomplete extended-notation floating point number"), pos); - break; - - case tsssLonelyFloatExtensionWithSign: - if (isDecimalChar(ch)) { - charStr += ch; - state = tsssExtendedFloat; - } else - throw new Err(std::string("Sniffer pattern error: incomplete extended-notation floating point number"), pos); - break; - - case tsssExtendedFloat: - if (isDecimalChar(ch)) { - charStr += ch; - state = tsssExtendedFloat; - } else { - // Terminate the number - AddFloat(charStr.c_str(), startPos); - - // Push the last char back on and try again - stream.Unget(); - state = tsssStart; - } - break; - - case tsssUnquoted: - if (ch == '\\') { - escapedState = state; // Save our state - state = tsssEscape; // Handle the escape sequence - } else if (isWhiteSpace(ch) || isPunctuation(ch)) { - AddString(charStr, startPos); - stream.Unget(); // In case it's punctuation, let tsssStart handle it - state = tsssStart; - } else if (ch == 0x3 && stream.IsEmpty()) { - AddString(charStr, startPos); - keepLooping = false; - } else { - charStr += ch; - } - break; - - case tsssEscape: - if (isOctalChar(ch)) { - lastChar = ch; - state = tsssEscapeOneOctal; - } else if (ch == 'x') { - state = tsssEscapeX; - } else { - // Check for a true end-of-text marker - if (ch == 0x3 && stream.IsEmpty()) - throw new Err(std::string("Sniffer pattern error: incomplete escape sequence"), pos); - else { - charStr += escapeChar(ch); - state = escapedState; // Return to the state we were in before the escape - } - } - break; - - case tsssEscapeX: - if (isHexChar(ch)) { - lastChar = ch; - state = tsssEscapeOneHex; - } else - throw new Err(std::string("Sniffer pattern error: incomplete escaped hex code"), pos); - break; - - case tsssEscapeOneOctal: - if (isOctalChar(ch)) { - lastLastChar = lastChar; - lastChar = ch; - state = tsssEscapeTwoOctal; - } else { - // First handle the octal - try { - charStr += octalToChar(lastChar); - } catch (Err *err) { - if (err) - err->SetPos(startPos); - throw err; - } - - // Push the new char back on and let the state we - // were in when the escape sequence was hit handle it. - stream.Unget(); - state = escapedState; - } - break; - - case tsssEscapeTwoOctal: - if (isOctalChar(ch)) { - try { - charStr += octalToChar(lastLastChar, lastChar, ch); - } catch (Err *err) { - if (err) - err->SetPos(startPos); - throw err; - } - state = escapedState; - } else { - // First handle the octal - try { - charStr += octalToChar(lastLastChar, lastChar); - } catch (Err *err) { - if (err) - err->SetPos(startPos); - throw err; - } - - // Push the new char back on and let the state we - // were in when the escape sequence was hit handle it. - stream.Unget(); - state = escapedState; - } - break; - - case tsssEscapeOneHex: - if (isHexChar(ch)) { - try { - charStr += hexToChar(lastChar, ch); - } catch (Err *err) { - if (err) - err->SetPos(pos); - throw err; - } - state = escapedState; - } else - throw new Err(std::string("Sniffer pattern error: incomplete escaped hex code"), pos); - break; - - } - } - if (state == tsssStart) { - fCStatus = B_OK; - fPos = 0; - } else { - throw new Err("Sniffer pattern error: unterminated rule", stream.Pos()); - } - - return fCStatus; -} - -void -TokenStream::Unset() { - std::vector::iterator i; - for (i = fTokenList.begin(); i != fTokenList.end(); i++) - delete *i; - fTokenList.clear(); - fCStatus = B_NO_INIT; - fStrLen = -1; -} - -status_t -TokenStream::InitCheck() const { - return fCStatus; -} - -//! Returns a pointer to the next token in the stream. -/*! The TokenStream object retains owner ship of the Token object returned by Get(). - If Get() is called at the end of the stream, a pointer to a Err object is thrown. -*/ -const Token* -TokenStream::Get() { - if (fCStatus != B_OK) - throw new Err("Sniffer parser error: TokenStream::Get() called on uninitialized TokenStream object", -1); - if (fPos < (ssize_t)fTokenList.size()) - return fTokenList[fPos++]; - else { - throw new Err("Sniffer pattern error: unterminated rule", EndPos()); -// fPos++; // Increment fPos to keep Unget()s consistent -// return NULL; // Return NULL to signal end of list - } -} - -//! Places token returned by the most recent call to Get() back on the head of the stream. -/*! If Unget() is called at the beginning of the stream, a pointer to a Err object is thrown. -*/ -void -TokenStream::Unget() { - if (fCStatus != B_OK) - throw new Err("Sniffer parser error: TokenStream::Unget() called on uninitialized TokenStream object", -1); - if (fPos > 0) - fPos--; - else - throw new Err("Sniffer parser error: TokenStream::Unget() called at beginning of token stream", -1); -} - - -/*! \brief Reads the next token in the stream and verifies it is of the given type, - throwing a pointer to a Err object if it is not. -*/ -void -TokenStream::Read(TokenType type) { - const Token *t = Get(); - if (t->Type() != type) { - throw new Err((std::string("Sniffer pattern error: expected ") + tokenTypeToString(type) - + ", found " + tokenTypeToString(t->Type())).c_str(), t->Pos()); - } -} - -//! Conditionally reads the next token in the stream. -/*! CondRead() peeks at the next token in the stream. If it is of the given type, the - token is removed from the stream and \c true is returned. If it is not of the - given type, false is returned and the token remains at the head of the stream. -*/ -bool -TokenStream::CondRead(TokenType type) { - const Token *t = Get(); - if (t->Type() == type) { - return true; - } else { - Unget(); - return false; - } -} - -ssize_t -TokenStream::Pos() const { - return fPos < (ssize_t)fTokenList.size() ? fTokenList[fPos]->Pos() : fStrLen; -} - -ssize_t -TokenStream::EndPos() const { - return fStrLen; -} - -bool -TokenStream::IsEmpty() const { - return fCStatus != B_OK || fPos >= (ssize_t)fTokenList.size(); -} - -void -TokenStream::AddToken(TokenType type, ssize_t pos) { - Token *token = new Token(type, pos); - fTokenList.push_back(token); -} - -void -TokenStream::AddString(const std::string &str, ssize_t pos) { - Token *token = new StringToken(str, pos); - fTokenList.push_back(token); -} - -void -TokenStream::AddInt(const char *str, ssize_t pos) { - // Convert the string to an int - int32 value = atol(str); - Token *token = new IntToken(value, pos); - fTokenList.push_back(token); -} - -void -TokenStream::AddFloat(const char *str, ssize_t pos) { - // Convert the string to a float - double value = atof(str); - Token *token = new FloatToken(value, pos); - fTokenList.push_back(token); -} - -//------------------------------------------------------------------------------ -// Helper functions -//------------------------------------------------------------------------------ - -char -escapeChar(char ch) { - // I've manually handled all the escape sequences I could come - // up with, and for anything else I just return the character - // passed in. Hex escapes are handled elsewhere, so \x just - // returns 'x'. Similarly, octals are handled elsewhere, so \0 - // through \9 just return '0' through '9'. - switch (ch) { - case 'a': - return '\a'; - case 'b': - return '\b'; - case 'f': - return '\f'; - case 'n': - return '\n'; - case 'r': - return '\r'; - case 't': - return '\t'; - case 'v': - return '\v'; - default: - return ch; - } -} - -// Converts 0x|hi|low| to a single char -char -hexToChar(char hi, char low) { - return (hexToChar(hi) << 4) | hexToChar(low); -} - -// Converts 0x|ch| to a single char -char -hexToChar(char hex) { - if ('0' <= hex && hex <= '9') - return hex-'0'; - else if ('a' <= hex && hex <= 'f') - return hex-'a'+10; - else if ('A' <= hex && hex <= 'F') - return hex-'A'+10; - else - throw new Err(std::string("Sniffer parser error: invalid hex digit '") + hex + "' passed to hexToChar()", -1); -} - -char -octalToChar(char octal) { - return octalToChar('0', '0', octal); -} - -char -octalToChar(char hi, char low) { - return octalToChar('0', hi, low); -} - -char -octalToChar(char hi, char mid, char low) { - if (isOctalChar(hi) && isOctalChar(mid) && isOctalChar(low)) { - // Check for octals >= decimal 256 - if ((hi-'0') <= 3) - return ((hi-'0') << 6) | ((mid-'0') << 3) | (low-'0'); - else - throw new Err("Sniffer pattern error: invalid octal literal (octals must be between octal 0 and octal 377 inclusive)", -1); - } else - throw new Err(std::string("Sniffer parser error: invalid octal digit passed to hexToChar()"), -1); -} - -bool -isHexChar(char ch) { - return ('0' <= ch && ch <= '9') - || ('a' <= ch && ch <= 'f') - || ('A' <= ch && ch <= 'F'); -} - -bool -isWhiteSpace(char ch) { - return ch == ' ' || ch == '\n' || ch == '\t'; -} - -bool -isOctalChar(char ch) { - return ('0' <= ch && ch <= '7'); -} - -bool -isDecimalChar(char ch) { - return ('0' <= ch && ch <= '9'); -} - -bool -isPunctuation(char ch) { - switch (ch) { - case '&': - case '(': - case ')': - case ':': - case '[': - case ']': - case '|': - return true; - default: - return false; - } -} - -const char* -BPrivate::Storage::Sniffer::tokenTypeToString(TokenType type) { - switch (type) { - case LeftParen: - return "LeftParen"; - break; - case RightParen: - return "RightParen"; - break; - case LeftBracket: - return "LeftBracket"; - break; - case RightBracket: - return "RightBracket"; - break; - case Colon: - return "Colon"; - break; - case Divider: - return "Divider"; - break; - case Ampersand: - return "Ampersand"; - break; - case CaseInsensitiveFlag: - return "CaseInsensitiveFlag"; - break; - case CharacterString: - return "CharacterString"; - break; - case Integer: - return "Integer"; - break; - case FloatingPoint: - return "FloatingPoint"; - break; - default: - return "UNKNOWN TOKEN TYPE"; - break; - } -} - -//------------------------------------------------------------------------------ -// Parser -//------------------------------------------------------------------------------ - -Parser::Parser() - : fOutOfMemErr(new(std::nothrow) Err("Sniffer parser error: out of memory", -1)) -{ -} - -Parser::~Parser() { - delete fOutOfMemErr; -} - -status_t -Parser::Parse(const char *rule, Rule *result, BString *parseError) { - try { - if (!rule) - throw new Err("Sniffer pattern error: NULL pattern", -1); - if (!result) - return B_BAD_VALUE; - if (stream.SetTo(rule) != B_OK) - throw new Err("Sniffer parser error: Unable to intialize token stream", -1); - - ParseRule(result); - - return B_OK; - - } catch (Err *err) { -// cout << "Caught error" << endl; - if (parseError) - parseError->SetTo(ErrorMessage(err, rule).c_str()); - delete err; - return rule ? (status_t)B_BAD_MIME_SNIFFER_RULE : (status_t)B_BAD_VALUE; - } -} - -std::string -Parser::ErrorMessage(Err *err, const char *rule) { - const char* msg = (err && err->Msg()) - ? err->Msg() - : "Sniffer parser error: Unexpected error with no supplied error message"; - ssize_t pos = err && (err->Pos() >= 0) ? err->Pos() : 0; - std::string str = std::string(rule ? rule : "") + "\n"; - for (int i = 0; i < pos; i++) - str += " "; - str += "^ "; - str += msg; - return str; -} - -void -Parser::ParseRule(Rule *result) { - if (!result) - throw new Err("Sniffer parser error: NULL Rule object passed to Parser::ParseRule()", -1); - - // Priority - double priority = ParsePriority(); - // Conjunction List - std::vector* list = ParseConjList(); - - result->SetTo(priority, list); -} - -double -Parser::ParsePriority() { - const Token *t = stream.Get(); - if (t->Type() == FloatingPoint || t->Type() == Integer) { - double result = t->Float(); - if (0.0 <= result && result <= 1.0) - return result; - else { -// cout << "(priority == " << result << ")" << endl; - throw new Err("Sniffer pattern error: invalid priority", t->Pos()); - } - } else - throw new Err("Sniffer pattern error: match level expected", t->Pos()); // Same as R5 -} - -std::vector* -Parser::ParseConjList() { - std::vector *list = new(std::nothrow) std::vector; - if (!list) - ThrowOutOfMemError(stream.Pos()); - try { - // DisjList+ - int count = 0; - while (true) { - DisjList* expr = ParseDisjList(); - if (!expr) - break; - else { - list->push_back(expr); - count++; - } - } - if (count == 0) - throw new Err("Sniffer pattern error: missing expression", -1); - } catch (...) { - delete list; - throw; - } - return list; -} - -DisjList* -Parser::ParseDisjList() { - // If we've run out of tokens right now, it's okay, but - // we need to let ParseConjList() know what's up - if (stream.IsEmpty()) - return NULL; - - // Peek ahead, then let the appropriate Parse*List() - // functions handle things - const Token *t1 = stream.Get(); - - // PatternList | RangeList - if (t1->Type() == LeftParen) { - const Token *t2 = stream.Get(); - // Skip the case-insensitive flag, if there is one - const Token *tokenOfInterest = (t2->Type() == CaseInsensitiveFlag) ? stream.Get() : t2; - if (t2 != tokenOfInterest) - stream.Unget(); // We called Get() three times - stream.Unget(); - stream.Unget(); - // RangeList - if (tokenOfInterest->Type() == LeftBracket) { - return ParseRPatternList(); - // PatternList - } else { - return ParsePatternList(Range(0,0)); - } - // Range, PatternList - } else if (t1->Type() == LeftBracket) { - stream.Unget(); - return ParsePatternList(ParseRange()); - } else { - throw new Err("Sniffer pattern error: missing pattern", t1->Pos()); // Same as R5 - } - - // PatternList - // RangeList - // Range + PatternList -} - -Range -Parser::ParseRange() { - int32 start, end; - // LeftBracket - stream.Read(LeftBracket); - // Integer - { - const Token *t = stream.Get(); - if (t->Type() == Integer) { - start = t->Int(); - end = start; // In case we aren't given an explicit end - } else - throw new Err("Sniffer pattern error: pattern offset expected", t->Pos()); - } - // [Colon, Integer] RightBracket - { - const Token *t = stream.Get(); - // Colon, Integer, RightBracket - if (t->Type() == Colon) { - // Integer - { - const Token *t = stream.Get(); - if (t->Type() == Integer) { - end = t->Int(); - } else - ThrowUnexpectedTokenError(Integer, t); - } - // RightBracket - stream.Read(RightBracket); - // !(Colon, Integer) RightBracket - } else if (t->Type() == RightBracket) { - // Nothing to do here... - - // Something else... - } else - ThrowUnexpectedTokenError(Colon, Integer, t); - } - Range range(start, end); - if (range.InitCheck() == B_OK) - return range; - else - throw range.GetErr(); -} - -DisjList* -Parser::ParsePatternList(Range range) { - PatternList *list = new(std::nothrow) PatternList(range); - if (!list) - ThrowOutOfMemError(stream.Pos()); - try { - // LeftParen - stream.Read(LeftParen); - // [Flag] Pattern, (Divider, [Flag] Pattern)* - while (true) { - // [Flag] - if (stream.CondRead(CaseInsensitiveFlag)) - list->SetCaseInsensitive(true); - // Pattern - list->Add(ParsePattern()); - // [Divider] - if (!stream.CondRead(Divider)) - break; - } - // RightParen - const Token *t = stream.Get(); - if (t->Type() != RightParen) - throw new Err("Sniffer pattern error: expecting '|', ')', or possibly '&'", t->Pos()); - } catch (...) { - delete list; - throw; - } - return list; -} - -DisjList* -Parser::ParseRPatternList() { - RPatternList *list = new(std::nothrow) RPatternList(); - if (!list) - ThrowOutOfMemError(stream.Pos()); - try { - // LeftParen - stream.Read(LeftParen); - // [Flag] RPattern, (Divider, [Flag] RPattern)* - while (true) { - // [Flag] - if (stream.CondRead(CaseInsensitiveFlag)) - list->SetCaseInsensitive(true); - // RPattern - list->Add(ParseRPattern()); - // [Divider] - if (!stream.CondRead(Divider)) - break; - } - // RightParen - const Token *t = stream.Get(); - if (t->Type() != RightParen) - throw new Err("Sniffer pattern error: expecting '|', ')', or possibly '&'", t->Pos()); - } catch (...) { - delete list; - throw; - } - return list; -} - -RPattern* -Parser::ParseRPattern() { - // Range - Range range = ParseRange(); - // Pattern - Pattern *pattern = ParsePattern(); - - RPattern *result = new(std::nothrow) RPattern(range, pattern); - if (result) { - if (result->InitCheck() == B_OK) - return result; - else { - Err *err = result->GetErr(); - delete result; - throw err; - } - } else - ThrowOutOfMemError(stream.Pos()); - return NULL; -} - -Pattern* -Parser::ParsePattern() { - std::string str; - // String - { - const Token *t = stream.Get(); - if (t->Type() == CharacterString) - str = t->String(); - else - throw new Err("Sniffer pattern error: missing pattern", t->Pos()); - } - // [Ampersand, String] - if (stream.CondRead(Ampersand)) { - // String (i.e. Mask) - const Token *t = stream.Get(); - if (t->Type() == CharacterString) { - Pattern *result = new(std::nothrow) Pattern(str, t->String()); - if (!result) - ThrowOutOfMemError(t->Pos()); - if (result->InitCheck() == B_OK) { - return result; - } else { - Err *err = result->GetErr(); - delete result; - if (err) { - err->SetPos(t->Pos()); - } - throw err; - } - } else - ThrowUnexpectedTokenError(CharacterString, t); - } else { - // No mask specified. - Pattern *result = new(std::nothrow) Pattern(str); - if (result) { - if (result->InitCheck() == B_OK) - return result; - else { - Err *err = result->GetErr(); - delete result; - throw err; - } - } else - ThrowOutOfMemError(stream.Pos()); - } - return NULL; -} - -void -Parser::ThrowEndOfStreamError() { - throw new Err("Sniffer pattern error: unterminated rule", stream.EndPos()); -} - -inline -void -Parser::ThrowOutOfMemError(ssize_t pos) { - if (fOutOfMemErr) - fOutOfMemErr->SetPos(pos); - Err *err = fOutOfMemErr; - fOutOfMemErr = NULL; - throw err; -} - -void -Parser::ThrowUnexpectedTokenError(TokenType expected, const Token *found) { - throw new Err((std::string("Sniffer pattern error: expected ") + tokenTypeToString(expected) - + ", found " + (found ? tokenTypeToString(found->Type()) : "NULL token")).c_str() - , (found ? found->Pos() : stream.EndPos())); -} - -void -Parser::ThrowUnexpectedTokenError(TokenType expected1, TokenType expected2, const Token *found) { - throw new Err((std::string("Sniffer pattern error: expected ") + tokenTypeToString(expected1) - + " or " + tokenTypeToString(expected2) + ", found " - + (found ? tokenTypeToString(found->Type()) : "NULL token")).c_str() - , (found ? found->Pos() : stream.EndPos())); -} - - - diff --git a/src/build/libbe/storage/sniffer/Pattern.cpp b/src/build/libbe/storage/sniffer/Pattern.cpp deleted file mode 100644 index bbc8a80121..0000000000 --- a/src/build/libbe/storage/sniffer/Pattern.cpp +++ /dev/null @@ -1,226 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Pattern.cpp - MIME sniffer pattern implementation -*/ - -#include -#include -#include -#include // for SEEK_* defines -#include - -using namespace BPrivate::Storage::Sniffer; - -Pattern::Pattern(const std::string &string, const std::string &mask) - : fCStatus(B_NO_INIT) - , fErrorMessage(NULL) -{ - SetTo(string, mask); -} - -Pattern::Pattern(const std::string &string) - : fCStatus(B_NO_INIT) - , fErrorMessage(NULL) -{ - // Build a mask with all bits turned on of the - // appropriate length - std::string mask = ""; - for (uint i = 0; i < string.length(); i++) - mask += (char)0xFF; - SetTo(string, mask); -} - -Pattern::~Pattern() { - delete fErrorMessage; -} - -status_t -Pattern::InitCheck() const { - return fCStatus; -} - -Err* -Pattern::GetErr() const { - if (fCStatus == B_OK) - return NULL; - else - return new(std::nothrow) Err(*fErrorMessage); -} - -void dumpStr(const std::string &string, const char *label = NULL) { - if (label) - printf("%s: ", label); - for (uint i = 0; i < string.length(); i++) - printf("%x ", string[i]); - printf("\n"); -} - -status_t -Pattern::SetTo(const std::string &string, const std::string &mask) { - fString = string; - if (fString.length() == 0) { - SetStatus(B_BAD_VALUE, "Sniffer pattern error: illegal empty pattern"); - } else { - fMask = mask; -// dumpStr(string, "data"); -// dumpStr(mask, "mask"); - if (fString.length() != fMask.length()) { - SetStatus(B_BAD_VALUE, "Sniffer pattern error: pattern and mask lengths do not match"); - } else { - SetStatus(B_OK); - } - } - return fCStatus; -} - -/*! \brief Looks for a pattern match in the given data stream, starting from - each offset withing the given range. Returns true is a match is found, - false if not. -*/ -bool -Pattern::Sniff(Range range, BPositionIO *data, bool caseInsensitive) const { - int32 start = range.Start(); - int32 end = range.End(); - off_t size = data->Seek(0, SEEK_END); - if (end >= size) - end = size-1; // Don't bother searching beyond the end of the stream - for (int i = start; i <= end; i++) { - if (Sniff(i, size, data, caseInsensitive)) - return true; - } - return false; -} - -// BytesNeeded -/*! \brief Returns the number of bytes needed to perform a complete sniff, or an error - code if something goes wrong. -*/ -ssize_t -Pattern::BytesNeeded() const -{ - ssize_t result = InitCheck(); - if (result == B_OK) - result = fString.length(); - return result; -} - -//#define OPTIMIZATION_IS_FOR_CHUMPS -#if OPTIMIZATION_IS_FOR_CHUMPS -bool -Pattern::Sniff(off_t start, off_t size, BPositionIO *data, bool caseInsensitive) const { - off_t len = fString.length(); - char *buffer = new(nothrow) char[len+1]; - if (buffer) { - ssize_t bytesRead = data->ReadAt(start, buffer, len); - // \todo If there are fewer bytes left in the data stream - // from the given position than the length of our data - // string, should we just return false (which is what we're - // doing now), or should we compare as many bytes as we - // can and return true if those match? - if (bytesRead < len) - return false; - else { - bool result = true; - if (caseInsensitive) { - for (int i = 0; i < len; i++) { - char secondChar; - if ('A' <= fString[i] && fString[i] <= 'Z') - secondChar = 'a' + (fString[i] - 'A'); // Also check lowercase - else if ('a' <= fString[i] && fString[i] <= 'z') - secondChar = 'A' + (fString[i] - 'a'); // Also check uppercase - else - secondChar = fString[i]; // Check the same char twice as punishment for doing a case insensitive search ;-) - if (((fString[i] & fMask[i]) != (buffer[i] & fMask[i])) - && ((secondChar & fMask[i]) != (buffer[i] & fMask[i]))) - { - result = false; - break; - } - } - } else { - for (int i = 0; i < len; i++) { - if ((fString[i] & fMask[i]) != (buffer[i] & fMask[i])) { - result = false; - break; - } - } - } - return result; - } - } else - return false; -} -#else -bool -Pattern::Sniff(off_t start, off_t size, BPositionIO *data, bool caseInsensitive) const { - off_t len = fString.length(); - char *buffer = new(std::nothrow) char[len+1]; - if (buffer) { - ssize_t bytesRead = data->ReadAt(start, buffer, len); - // \todo If there are fewer bytes left in the data stream - // from the given position than the length of our data - // string, should we just return false (which is what we're - // doing now), or should we compare as many bytes as we - // can and return true if those match? - if (bytesRead < len) - return false; - else { - bool result = true; - if (caseInsensitive) { - for (int i = 0; i < len; i++) { - char secondChar; - if ('A' <= fString[i] && fString[i] <= 'Z') - secondChar = 'a' + (fString[i] - 'A'); // Also check lowercase - else if ('a' <= fString[i] && fString[i] <= 'z') - secondChar = 'A' + (fString[i] - 'a'); // Also check uppercase - else - secondChar = fString[i]; // Check the same char twice as punishment for doing a case insensitive search ;-) - if (((fString[i] & fMask[i]) != (buffer[i] & fMask[i])) - && ((secondChar & fMask[i]) != (buffer[i] & fMask[i]))) - { - result = false; - break; - } - } - } else { - for (int i = 0; i < len; i++) { - if ((fString[i] & fMask[i]) != (buffer[i] & fMask[i])) { - result = false; - break; - } - } - } - return result; - } - } else - return false; -} -#endif - -void -Pattern::SetStatus(status_t status, const char *msg) { - fCStatus = status; - if (status == B_OK) - SetErrorMessage(NULL); - else { - if (msg) - SetErrorMessage(msg); - else { - SetErrorMessage("Sniffer parser error: Pattern::SetStatus() -- NULL msg with non-B_OK status.\n" - "(This is officially the most helpful error message you will ever receive ;-)"); - } - } -} - -void -Pattern::SetErrorMessage(const char *msg) { - delete fErrorMessage; - fErrorMessage = (msg) ? (new(std::nothrow) Err(msg, -1)) : (NULL); -} - - - diff --git a/src/build/libbe/storage/sniffer/PatternList.cpp b/src/build/libbe/storage/sniffer/PatternList.cpp deleted file mode 100644 index b3f066a469..0000000000 --- a/src/build/libbe/storage/sniffer/PatternList.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file PatternList.cpp - MIME sniffer pattern list implementation -*/ - -#include -#include -#include -#include -#include - -using namespace BPrivate::Storage::Sniffer; - -PatternList::PatternList(Range range) - : DisjList() - , fRange(range) -{ -} - -PatternList::~PatternList() { - // Clean up - std::vector::iterator i; - for (i = fList.begin(); i != fList.end(); i++) - delete *i; -} - -status_t -PatternList::InitCheck() const { - return fRange.InitCheck(); -} - -Err* -PatternList::GetErr() const { - return fRange.GetErr(); -} - -/*! \brief Sniffs the given data stream, searching for a match with - any of the list's patterns. -*/ -bool -PatternList::Sniff(BPositionIO *data) const { - if (InitCheck() != B_OK) - return false; - else { - bool result = false; - std::vector::const_iterator i; - for (i = fList.begin(); i != fList.end(); i++) { - if (*i) - result |= (*i)->Sniff(fRange, data, fCaseInsensitive); - } - return result; - } -} - -/*! \brief Returns the number of bytes needed to perform a complete sniff, or an error - code if something goes wrong. -*/ -ssize_t -PatternList::BytesNeeded() const -{ - ssize_t result = InitCheck(); - - // Find the number of bytes needed to sniff any of our - // patterns from a single location in a data stream - if (result == B_OK) { - result = 0; // I realize it already *is* zero if it == B_OK, but just in case that changes... - std::vector::const_iterator i; - for (i = fList.begin(); i != fList.end(); i++) { - if (*i) { - ssize_t bytes = (*i)->BytesNeeded(); - if (bytes >= 0) { - if (bytes > result) - result = bytes; - } else { - result = bytes; - break; - } - } - } - } - - // Now add on the number of bytes needed to get to the - // furthest allowed starting point - if (result >= 0) - result += fRange.End(); - - return result; -} - -void -PatternList::Add(Pattern *pattern) { - if (pattern) - fList.push_back(pattern); -} - - - diff --git a/src/build/libbe/storage/sniffer/RPattern.cpp b/src/build/libbe/storage/sniffer/RPattern.cpp deleted file mode 100644 index 02678823d7..0000000000 --- a/src/build/libbe/storage/sniffer/RPattern.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file RPattern.cpp - MIME sniffer rpattern implementation -*/ - -#include -#include -#include -#include -#include - -using namespace BPrivate::Storage::Sniffer; - -RPattern::RPattern(Range range, Pattern *pattern) - : fRange(range) - , fPattern(pattern) -{ -} - -status_t -RPattern::InitCheck() const { - status_t err = fRange.InitCheck(); - if (!err) - err = fPattern ? B_OK : B_BAD_VALUE; - if (!err) - err = fPattern->InitCheck(); - return err; -} - -Err* -RPattern::GetErr() const { - if (fRange.InitCheck() != B_OK) - return fRange.GetErr(); - else if (fPattern) { - if (fPattern->InitCheck() != B_OK) - return fPattern->GetErr(); - else - return NULL; - } else - return new Err("Sniffer parser error: RPattern::RPattern() -- NULL pattern parameter", -1); -} - -RPattern::~RPattern() { - delete fPattern; -} - -//! Sniffs the given data stream over the object's range for the object's pattern -bool -RPattern::Sniff(BPositionIO *data, bool caseInsensitive) const { - if (!data || InitCheck() != B_OK) - return false; - else - return fPattern->Sniff(fRange, data, caseInsensitive); -} - -/*! \brief Returns the number of bytes needed to perform a complete sniff, or an error - code if something goes wrong. -*/ -ssize_t -RPattern::BytesNeeded() const -{ - ssize_t result = InitCheck(); - if (result == B_OK) - result = fPattern->BytesNeeded(); - if (result >= 0) - result += fRange.End(); - return result; -} - - diff --git a/src/build/libbe/storage/sniffer/RPatternList.cpp b/src/build/libbe/storage/sniffer/RPatternList.cpp deleted file mode 100644 index 38a86dbfbf..0000000000 --- a/src/build/libbe/storage/sniffer/RPatternList.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file RPatternList.cpp - MIME sniffer rpattern list implementation -*/ - -#include -#include -#include -#include -#include - -using namespace BPrivate::Storage::Sniffer; - -RPatternList::RPatternList() - : DisjList() -{ -} - -RPatternList::~RPatternList() { - // Clear our rpattern list - std::vector::iterator i; - for (i = fList.begin(); i != fList.end(); i++) - delete *i; -} - -status_t -RPatternList::InitCheck() const { - return B_OK; -} - -Err* -RPatternList::GetErr() const { - return NULL; -} - -/*! Sniffs the given data stream, searching for a match - with any of the list's patterns. Each pattern is searched - over its own specified range. -*/ -bool -RPatternList::Sniff(BPositionIO *data) const { - if (InitCheck() != B_OK) - return false; - else { - bool result = false; - std::vector::const_iterator i; - for (i = fList.begin(); i != fList.end(); i++) { - if (*i) - result |= (*i)->Sniff(data, fCaseInsensitive); - } - return result; - } -} - -/*! \brief Returns the number of bytes needed to perform a complete sniff, or an error - code if something goes wrong. -*/ -ssize_t -RPatternList::BytesNeeded() const -{ - ssize_t result = InitCheck(); - - // Tally up the BytesNeeded() values for all the RPatterns and return the largest. - if (result == B_OK) { - result = 0; // Just to be safe... - std::vector::const_iterator i; - for (i = fList.begin(); i != fList.end(); i++) { - if (*i) { - ssize_t bytes = (*i)->BytesNeeded(); - if (bytes >= 0) { - if (bytes > result) - result = bytes; - } else { - result = bytes; - break; - } - } - } - } - return result; -} - -void -RPatternList::Add(RPattern *rpattern) { - if (rpattern) - fList.push_back(rpattern); -} - - - diff --git a/src/build/libbe/storage/sniffer/Range.cpp b/src/build/libbe/storage/sniffer/Range.cpp deleted file mode 100644 index 2f994f7970..0000000000 --- a/src/build/libbe/storage/sniffer/Range.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Range.cpp - MIME sniffer range implementation -*/ - -#include -#include -#include -#include - -using namespace BPrivate::Storage::Sniffer; - -Range::Range(int32 start, int32 end) - : fStart(-1) - , fEnd(-1) - , fCStatus(B_NO_INIT) -{ - SetTo(start, end); -} - -status_t -Range::InitCheck() const { - return fCStatus; -} - -Err* -Range::GetErr() const { - if (fCStatus == B_OK) - return NULL; - else { - char start_str[32]; - char end_str[32]; - sprintf(start_str, "%ld", fStart); - sprintf(end_str, "%ld", fEnd); - return new Err(std::string("Sniffer Parser Error -- Invalid range: [") + start_str + ":" + end_str + "]", -1); - } -} - -int32 -Range::Start() const { - return fStart; -} - -int32 -Range::End() const { - return fEnd; -} - -void -Range::SetTo(int32 start, int32 end) { - fStart = start; - fEnd = end; - if (start > end) { - fCStatus = B_BAD_VALUE; - } else { - fCStatus = B_OK; - } -} - - - diff --git a/src/build/libbe/storage/sniffer/Rule.cpp b/src/build/libbe/storage/sniffer/Rule.cpp deleted file mode 100644 index 6b0dd4ef0a..0000000000 --- a/src/build/libbe/storage/sniffer/Rule.cpp +++ /dev/null @@ -1,110 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Rule.cpp - MIME sniffer rule implementation -*/ - -#include -#include -#include -#include -#include - -using namespace BPrivate::Storage::Sniffer; - -/*! \brief Creates an unitialized Sniffer::Rule object. To initialize it, you - must pass a pointer to the object to Sniffer::parse(). -*/ -Rule::Rule() - : fPriority(0.0) - , fConjList(NULL) -{ -} - -Rule::~Rule() { - Unset(); -} - -status_t -Rule::InitCheck() const { - return fConjList ? B_OK : B_NO_INIT; -} - -//! Returns the priority of the rule. 0.0 <= priority <= 1.0. -double -Rule::Priority() const { - return fPriority; -} - -//! Sniffs the given data stream. Returns true if the rule matches, false if not. -bool -Rule::Sniff(BPositionIO *data) const { - if (InitCheck() != B_OK) - return false; - else { - bool result = true; - std::vector::const_iterator i; - for (i = fConjList->begin(); i != fConjList->end(); i++) { - if (*i) - result &= (*i)->Sniff(data); - } - return result; - } -} - -/*! \brief Returns the number of bytes needed for this rule to perform a complete sniff, - or an error code if something goes wrong. -*/ -ssize_t -Rule::BytesNeeded() const -{ - ssize_t result = InitCheck(); - - // Tally up the BytesNeeded() values for all the DisjLists and return the largest. - if (result == B_OK) { - result = 0; // Just to be safe... - std::vector::const_iterator i; - for (i = fConjList->begin(); i != fConjList->end(); i++) { - if (*i) { - ssize_t bytes = (*i)->BytesNeeded(); - if (bytes >= 0) { - if (bytes > result) - result = bytes; - } else { - result = bytes; - break; - } - } - } - } - return result; -} - - -void -Rule::Unset() { - if (fConjList){ - delete fConjList; - fConjList = NULL; - } -} - -//! Called by Parser::Parse() after successfully parsing a sniffer rule. -void -Rule::SetTo(double priority, std::vector* list) { - Unset(); - if (0.0 <= priority && priority <= 1.0) - fPriority = priority; - else - throw new Err("Sniffer pattern error: invalid priority", -1); - fConjList = list; -} - - - - - - diff --git a/src/build/libbe/support/Jamfile b/src/build/libbe/support/Jamfile index a4e855db7c..d18aac4d80 100644 --- a/src/build/libbe/support/Jamfile +++ b/src/build/libbe/support/Jamfile @@ -9,12 +9,9 @@ BuildPlatformMergeObjectPIC support_kit.o : Archivable.cpp BlockCache.cpp ByteOrder.cpp - DataBuffer.cpp DataIO.cpp Flattenable.cpp List.cpp Locker.cpp - PointerList.cpp - StopWatch.cpp String.cpp ;